diff --git a/src/contracts/data-pathways.ts b/src/contracts/data-pathways.ts index 0e04d8c..e40c895 100644 --- a/src/contracts/data-pathways.ts +++ b/src/contracts/data-pathways.ts @@ -64,6 +64,8 @@ const TimeoutConfigSchema: TTimeoutConfig = Type.Optional( ) type TSourceConfig = TObject<{ + id: TOptional + name: TOptional flowType: TString eventTypes: TArray endpoints: TArray @@ -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), @@ -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(), @@ -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 @@ -561,6 +569,8 @@ export const DataPathwayDeliveryLogBatchEntrySchema: TObject<{ assignmentId: TString endpointUrl: TString flowType: TOptional + sourceId: TOptional + eventType: TOptional httpStatus: TOptional success: TBoolean batchSize: TOptional @@ -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()), diff --git a/test/tests/commands/data-pathways.test.ts b/test/tests/commands/data-pathways.test.ts index 2eb087b..123e217 100644 --- a/test/tests/commands/data-pathways.test.ts +++ b/test/tests/commands/data-pathways.test.ts @@ -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) + }) })