Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/contracts/data-pathways.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ const TimeoutConfigSchema: TTimeoutConfig = Type.Optional(
)

type TSourceConfig = TObject<{
id: TOptional<TString>
name: TOptional<TString>
flowType: TString
eventTypes: TArray<TString>
endpoints: TArray<TEndpointConfig>
Expand All @@ -73,6 +75,8 @@ type TSourceConfig = TObject<{
timeouts: TTimeoutConfig
}>
const SourceConfigSchema: TSourceConfig = Type.Object({
id: Type.Optional(Type.String()),
name: Type.Optional(Type.String()),
flowType: Type.String(),
eventTypes: Type.Array(Type.String()),
endpoints: Type.Array(EndpointConfigSchema),
Expand Down Expand Up @@ -530,6 +534,8 @@ export const DataPathwayDeliveryLogEntrySchema: TObject<{
errorMessage: TUnion<[TString, TNull]>
responseBody: TUnion<[TString, TNull]>
flowType: TUnion<[TString, TNull]>
sourceId: TUnion<[TString, TNull]>
eventType: TUnion<[TString, TNull]>
createdAt: TString
}> = Type.Object({
id: Type.String(),
Expand All @@ -543,6 +549,8 @@ export const DataPathwayDeliveryLogEntrySchema: TObject<{
errorMessage: Type.Union([Type.String(), Type.Null()]),
responseBody: Type.Union([Type.String(), Type.Null()]),
flowType: Type.Union([Type.String(), Type.Null()]),
sourceId: Type.Union([Type.String(), Type.Null()]),
eventType: Type.Union([Type.String(), Type.Null()]),
createdAt: Type.String(),
})
export type DataPathwayDeliveryLogEntry = Static<typeof DataPathwayDeliveryLogEntrySchema>
Expand All @@ -561,6 +569,8 @@ export const DataPathwayDeliveryLogBatchEntrySchema: TObject<{
assignmentId: TString
endpointUrl: TString
flowType: TOptional<TString>
sourceId: TOptional<TString>
eventType: TOptional<TString>
httpStatus: TOptional<TInteger>
success: TBoolean
batchSize: TOptional<TInteger>
Expand All @@ -572,6 +582,8 @@ export const DataPathwayDeliveryLogBatchEntrySchema: TObject<{
assignmentId: Type.String(),
endpointUrl: Type.String(),
flowType: Type.Optional(Type.String()),
sourceId: Type.Optional(Type.String()),
eventType: Type.Optional(Type.String()),
httpStatus: Type.Optional(Type.Integer()),
success: Type.Boolean(),
batchSize: Type.Optional(Type.Integer()),
Expand Down
25 changes: 25 additions & 0 deletions test/tests/commands/data-pathways.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -782,4 +782,29 @@ describe("DataPathways", () => {
)
assertEquals(result, response)
})

it("should accept sourceId and eventType on delivery log batch entries", async () => {
const pathwayId = crypto.randomUUID()
const assignmentId = crypto.randomUUID()
const sourceId = crypto.randomUUID()
const response = { inserted: 1 }

base.post("/api/v1/delivery-log/batch")
.respondWith(200, response)

const result = await apiKeyClient.execute(
new DataPathwayDeliveryLogBatchCommand({
entries: [{
pathwayId,
assignmentId,
endpointUrl: "https://example.com/webhook",
success: true,
flowType: "analytics",
sourceId,
eventType: "pat.created.0",
}],
}),
)
assertEquals(result, response)
})
})
Loading