@pattern-stack/codegen 0.23.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -1
- package/consumer-skills/integration/SKILL.md +11 -3
- package/dist/{chunk-XKWOJZZ4.js → chunk-37PILMIT.js} +4 -4
- package/dist/{chunk-42763UEE.js → chunk-6M6LZEP6.js} +2 -2
- package/dist/{chunk-FIUC6QB5.js → chunk-CKLM57IE.js} +10 -10
- package/dist/{chunk-SH76CFAY.js → chunk-ENAR3F5S.js} +2 -2
- package/dist/{chunk-FFUDEIFF.js → chunk-HN5HT5WL.js} +2 -2
- package/dist/{chunk-4M66MQYA.js → chunk-K4BQQ2NN.js} +4 -2
- package/dist/chunk-K4BQQ2NN.js.map +1 -0
- package/dist/{chunk-QFUIE37H.js → chunk-KFXXOFDC.js} +4 -4
- package/dist/{chunk-O2A6XHGD.js → chunk-LLDJS7PJ.js} +2 -2
- package/dist/{chunk-JOBQ6RUU.js → chunk-LQZESSM3.js} +28 -1
- package/dist/chunk-LQZESSM3.js.map +1 -0
- package/dist/{chunk-JRQO2IOF.js → chunk-MU54DZCC.js} +27 -1
- package/dist/chunk-MU54DZCC.js.map +1 -0
- package/dist/{chunk-INO47JXD.js → chunk-PBENHIN2.js} +3 -3
- package/dist/{chunk-CLWBNXKF.js → chunk-PLUJEQLU.js} +2 -2
- package/dist/{chunk-S7C6TIIF.js → chunk-S5G3HO7N.js} +3 -1
- package/dist/chunk-S5G3HO7N.js.map +1 -0
- package/dist/{chunk-6XP2Q5SS.js → chunk-WZOPWQN2.js} +2 -2
- package/dist/{chunk-TDEHU73T.js → chunk-YIVQ7KLS.js} +46 -5
- package/dist/chunk-YIVQ7KLS.js.map +1 -0
- package/dist/runtime/base-classes/index.js +17 -17
- package/dist/runtime/subsystems/auth/auth.module.js +1 -1
- package/dist/runtime/subsystems/auth/index.js +3 -3
- package/dist/runtime/subsystems/bridge/bridge.module.js +6 -6
- package/dist/runtime/subsystems/bridge/index.js +6 -6
- package/dist/runtime/subsystems/events/events.module.js +4 -4
- package/dist/runtime/subsystems/events/generated/bus.js +3 -3
- package/dist/runtime/subsystems/events/generated/index.d.ts +2 -2
- package/dist/runtime/subsystems/events/generated/index.js +9 -3
- package/dist/runtime/subsystems/events/generated/registry.d.ts +36 -0
- package/dist/runtime/subsystems/events/generated/registry.js +1 -1
- package/dist/runtime/subsystems/events/generated/schemas.d.ts +109 -1
- package/dist/runtime/subsystems/events/generated/schemas.js +7 -1
- package/dist/runtime/subsystems/events/generated/types.d.ts +48 -2
- package/dist/runtime/subsystems/events/index.js +4 -4
- package/dist/runtime/subsystems/index.d.ts +3 -2
- package/dist/runtime/subsystems/index.js +26 -22
- package/dist/runtime/subsystems/integration/execute-integration.use-case.d.ts +11 -1
- package/dist/runtime/subsystems/integration/execute-integration.use-case.js +2 -2
- package/dist/runtime/subsystems/integration/index.d.ts +2 -1
- package/dist/runtime/subsystems/integration/index.js +10 -8
- package/dist/runtime/subsystems/integration/integration-change-emitter.protocol.d.ts +106 -0
- package/dist/runtime/subsystems/integration/integration-change-emitter.protocol.js +1 -0
- package/dist/runtime/subsystems/integration/integration-change-emitter.protocol.js.map +1 -0
- package/dist/runtime/subsystems/integration/integration-cursor-store.drizzle-backend.js +2 -2
- package/dist/runtime/subsystems/integration/integration-run-recorder.drizzle-backend.js +2 -2
- package/dist/runtime/subsystems/integration/integration.module.js +4 -4
- package/dist/runtime/subsystems/integration/integration.tokens.d.ts +11 -1
- package/dist/runtime/subsystems/integration/integration.tokens.js +3 -1
- package/dist/runtime/subsystems/jobs/index.js +11 -11
- package/dist/runtime/subsystems/jobs/job-worker.module.js +5 -5
- package/dist/runtime/subsystems/jobs/jobs-domain.module.js +4 -4
- package/dist/runtime/subsystems/observability/index.js +3 -3
- package/dist/runtime/subsystems/observability/observability.module.js +3 -3
- package/dist/runtime/subsystems/observability/observability.service.js +2 -2
- package/dist/src/cli/index.js +203 -26
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/index.d.ts +13 -0
- package/dist/src/index.js +7 -7
- package/package.json +1 -1
- package/runtime/subsystems/events/generated/registry.ts +27 -0
- package/runtime/subsystems/events/generated/schemas.ts +26 -0
- package/runtime/subsystems/events/generated/types.ts +52 -0
- package/runtime/subsystems/index.ts +23 -0
- package/runtime/subsystems/integration/execute-integration.use-case.ts +69 -1
- package/runtime/subsystems/integration/index.ts +6 -0
- package/runtime/subsystems/integration/integration-change-emitter.protocol.ts +107 -0
- package/runtime/subsystems/integration/integration.tokens.ts +11 -0
- package/dist/chunk-4M66MQYA.js.map +0 -1
- package/dist/chunk-JOBQ6RUU.js.map +0 -1
- package/dist/chunk-JRQO2IOF.js.map +0 -1
- package/dist/chunk-S7C6TIIF.js.map +0 -1
- package/dist/chunk-TDEHU73T.js.map +0 -1
- /package/dist/{chunk-XKWOJZZ4.js.map → chunk-37PILMIT.js.map} +0 -0
- /package/dist/{chunk-42763UEE.js.map → chunk-6M6LZEP6.js.map} +0 -0
- /package/dist/{chunk-FIUC6QB5.js.map → chunk-CKLM57IE.js.map} +0 -0
- /package/dist/{chunk-SH76CFAY.js.map → chunk-ENAR3F5S.js.map} +0 -0
- /package/dist/{chunk-FFUDEIFF.js.map → chunk-HN5HT5WL.js.map} +0 -0
- /package/dist/{chunk-QFUIE37H.js.map → chunk-KFXXOFDC.js.map} +0 -0
- /package/dist/{chunk-O2A6XHGD.js.map → chunk-LLDJS7PJ.js.map} +0 -0
- /package/dist/{chunk-INO47JXD.js.map → chunk-PBENHIN2.js.map} +0 -0
- /package/dist/{chunk-CLWBNXKF.js.map → chunk-PLUJEQLU.js.map} +0 -0
- /package/dist/{chunk-6XP2Q5SS.js.map → chunk-WZOPWQN2.js.map} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DrizzleIntegrationRunRecorder
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HN5HT5WL.js";
|
|
4
4
|
import {
|
|
5
5
|
MemoryRunRecorder
|
|
6
6
|
} from "./chunk-EO2QPOKH.js";
|
|
7
7
|
import {
|
|
8
8
|
PostgresCursorStore
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LLDJS7PJ.js";
|
|
10
10
|
import {
|
|
11
11
|
MemoryCursorStore
|
|
12
12
|
} from "./chunk-AHV4GDYM.js";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
INTEGRATION_MODULE_OPTIONS,
|
|
20
20
|
INTEGRATION_MULTI_TENANT,
|
|
21
21
|
INTEGRATION_RUN_RECORDER
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-S5G3HO7N.js";
|
|
23
23
|
import {
|
|
24
24
|
__decorateClass
|
|
25
25
|
} from "./chunk-2E224ZSN.js";
|
|
@@ -84,4 +84,4 @@ IntegrationModule = __decorateClass([
|
|
|
84
84
|
export {
|
|
85
85
|
IntegrationModule
|
|
86
86
|
};
|
|
87
|
-
//# sourceMappingURL=chunk-
|
|
87
|
+
//# sourceMappingURL=chunk-KFXXOFDC.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-HNWZFNKP.js";
|
|
4
4
|
import {
|
|
5
5
|
INTEGRATION_MULTI_TENANT
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-S5G3HO7N.js";
|
|
7
7
|
import {
|
|
8
8
|
assertTenantId
|
|
9
9
|
} from "./chunk-MZ6GV4YF.js";
|
|
@@ -97,4 +97,4 @@ PostgresCursorStore = __decorateClass([
|
|
|
97
97
|
export {
|
|
98
98
|
PostgresCursorStore
|
|
99
99
|
};
|
|
100
|
-
//# sourceMappingURL=chunk-
|
|
100
|
+
//# sourceMappingURL=chunk-LLDJS7PJ.js.map
|
|
@@ -53,6 +53,33 @@ var eventRegistry = {
|
|
|
53
53
|
version: 1,
|
|
54
54
|
retry: { attempts: 3, backoff: "exponential" }
|
|
55
55
|
},
|
|
56
|
+
"message_created": {
|
|
57
|
+
type: "message_created",
|
|
58
|
+
tier: "domain",
|
|
59
|
+
direction: "change",
|
|
60
|
+
pool: "events_change",
|
|
61
|
+
aggregate: "message",
|
|
62
|
+
version: 1,
|
|
63
|
+
retry: { attempts: 3, backoff: "exponential" }
|
|
64
|
+
},
|
|
65
|
+
"message_deleted": {
|
|
66
|
+
type: "message_deleted",
|
|
67
|
+
tier: "domain",
|
|
68
|
+
direction: "change",
|
|
69
|
+
pool: "events_change",
|
|
70
|
+
aggregate: "message",
|
|
71
|
+
version: 1,
|
|
72
|
+
retry: { attempts: 3, backoff: "exponential" }
|
|
73
|
+
},
|
|
74
|
+
"message_edited": {
|
|
75
|
+
type: "message_edited",
|
|
76
|
+
tier: "domain",
|
|
77
|
+
direction: "change",
|
|
78
|
+
pool: "events_change",
|
|
79
|
+
aggregate: "message",
|
|
80
|
+
version: 1,
|
|
81
|
+
retry: { attempts: 3, backoff: "exponential" }
|
|
82
|
+
},
|
|
56
83
|
"stripe_payment_received": {
|
|
57
84
|
type: "stripe_payment_received",
|
|
58
85
|
tier: "domain",
|
|
@@ -85,4 +112,4 @@ export {
|
|
|
85
112
|
eventRegistry,
|
|
86
113
|
getEventMetadata
|
|
87
114
|
};
|
|
88
|
-
//# sourceMappingURL=chunk-
|
|
115
|
+
//# sourceMappingURL=chunk-LQZESSM3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../runtime/subsystems/events/generated/registry.ts"],"sourcesContent":["// AUTO-GENERATED by @pattern-stack/codegen. Do not edit.\n// Run `codegen entity new --all` to refresh.\n\n\nimport type { EventTypeName } from './types';\n\nexport interface EventMetadata {\n\ttype: EventTypeName;\n\ttier: 'domain' | 'audit';\n\tdirection: 'inbound' | 'change' | 'outbound' | null;\n\tpool: 'events_inbound' | 'events_change' | 'events_outbound' | null;\n\taggregate?: string;\n\tsource?: string;\n\tdestination?: string;\n\tversion: number;\n\tretry: { attempts: number; backoff: 'linear' | 'exponential' };\n\tschedule?: { every: string | number; align: boolean; catchUp: boolean; maxCatchUpSlots: number };\n}\n\nexport const eventRegistry = {\n\t'contact_created': {\n\t\ttype: 'contact_created',\n\t\ttier: 'domain',\n\t\tdirection: 'change',\n\t\tpool: 'events_change',\n\t\taggregate: 'contact',\n\t\tversion: 1,\n\t\tretry: { attempts: 3, backoff: 'exponential' },\n\t},\n\t'contact_marked_champion': {\n\t\ttype: 'contact_marked_champion',\n\t\ttier: 'domain',\n\t\tdirection: 'change',\n\t\tpool: 'events_change',\n\t\taggregate: 'contact',\n\t\tversion: 1,\n\t\tretry: { attempts: 3, backoff: 'exponential' },\n\t},\n\t'contact_merged': {\n\t\ttype: 'contact_merged',\n\t\ttier: 'domain',\n\t\tdirection: 'change',\n\t\tpool: 'events_change',\n\t\taggregate: 'contact',\n\t\tversion: 1,\n\t\tretry: { attempts: 3, backoff: 'exponential' },\n\t},\n\t'crm_sync_started': {\n\t\ttype: 'crm_sync_started',\n\t\ttier: 'audit',\n\t\tdirection: null,\n\t\tpool: null,\n\t\tversion: 1,\n\t\tretry: { attempts: 3, backoff: 'exponential' },\n\t},\n\t'deal_created': {\n\t\ttype: 'deal_created',\n\t\ttier: 'domain',\n\t\tdirection: 'change',\n\t\tpool: 'events_change',\n\t\taggregate: 'deal',\n\t\tversion: 1,\n\t\tretry: { attempts: 3, backoff: 'exponential' },\n\t},\n\t'deal_stage_changed': {\n\t\ttype: 'deal_stage_changed',\n\t\ttier: 'domain',\n\t\tdirection: 'change',\n\t\tpool: 'events_change',\n\t\taggregate: 'deal',\n\t\tversion: 1,\n\t\tretry: { attempts: 3, backoff: 'exponential' },\n\t},\n\t'message_created': {\n\t\ttype: 'message_created',\n\t\ttier: 'domain',\n\t\tdirection: 'change',\n\t\tpool: 'events_change',\n\t\taggregate: 'message',\n\t\tversion: 1,\n\t\tretry: { attempts: 3, backoff: 'exponential' },\n\t},\n\t'message_deleted': {\n\t\ttype: 'message_deleted',\n\t\ttier: 'domain',\n\t\tdirection: 'change',\n\t\tpool: 'events_change',\n\t\taggregate: 'message',\n\t\tversion: 1,\n\t\tretry: { attempts: 3, backoff: 'exponential' },\n\t},\n\t'message_edited': {\n\t\ttype: 'message_edited',\n\t\ttier: 'domain',\n\t\tdirection: 'change',\n\t\tpool: 'events_change',\n\t\taggregate: 'message',\n\t\tversion: 1,\n\t\tretry: { attempts: 3, backoff: 'exponential' },\n\t},\n\t'stripe_payment_received': {\n\t\ttype: 'stripe_payment_received',\n\t\ttier: 'domain',\n\t\tdirection: 'inbound',\n\t\tpool: 'events_inbound',\n\t\tsource: 'stripe',\n\t\tversion: 1,\n\t\tretry: { attempts: 5, backoff: 'exponential' },\n\t},\n\t'webhook_outbound_contact_sync': {\n\t\ttype: 'webhook_outbound_contact_sync',\n\t\ttier: 'domain',\n\t\tdirection: 'outbound',\n\t\tpool: 'events_outbound',\n\t\taggregate: 'contact',\n\t\tdestination: 'crm',\n\t\tversion: 1,\n\t\tretry: { attempts: 3, backoff: 'exponential' },\n\t},\n} as const satisfies Record<EventTypeName, EventMetadata>;\n\nexport function getEventMetadata<T extends EventTypeName>(type: T): EventMetadata {\n\tconst meta = eventRegistry[type];\n\tif (!meta) {\n\t\tthrow new Error(`No registry entry for event type '${String(type)}' — declare events under events/*.yaml and re-run \\`codegen entity new --all\\`.`);\n\t}\n\treturn meta;\n}\n"],"mappings":";AAmBO,IAAM,gBAAgB;AAAA,EAC5B,mBAAmB;AAAA,IAClB,MAAM;AAAA,IACN,MAAM;AAAA,IACN,WAAW;AAAA,IACX,MAAM;AAAA,IACN,WAAW;AAAA,IACX,SAAS;AAAA,IACT,OAAO,EAAE,UAAU,GAAG,SAAS,cAAc;AAAA,EAC9C;AAAA,EACA,2BAA2B;AAAA,IAC1B,MAAM;AAAA,IACN,MAAM;AAAA,IACN,WAAW;AAAA,IACX,MAAM;AAAA,IACN,WAAW;AAAA,IACX,SAAS;AAAA,IACT,OAAO,EAAE,UAAU,GAAG,SAAS,cAAc;AAAA,EAC9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AAS,cAAc;AAAA,EAC9C;AAAA,EACA,2BAA2B;AAAA,IAC1B,MAAM;AAAA,IACN,MAAM;AAAA,IACN,WAAW;AAAA,IACX,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,OAAO,EAAE,UAAU,GAAG,SAAS,cAAc;AAAA,EAC9C;AAAA,EACA,iCAAiC;AAAA,IAChC,MAAM;AAAA,IACN,MAAM;AAAA,IACN,WAAW;AAAA,IACX,MAAM;AAAA,IACN,WAAW;AAAA,IACX,aAAa;AAAA,IACb,SAAS;AAAA,IACT,OAAO,EAAE,UAAU,GAAG,SAAS,cAAc;AAAA,EAC9C;AACD;AAEO,SAAS,iBAA0C,MAAwB;AACjF,QAAM,OAAO,cAAc,IAAI;AAC/B,MAAI,CAAC,MAAM;AACV,UAAM,IAAI,MAAM,qCAAqC,OAAO,IAAI,CAAC,sFAAiF;AAAA,EACnJ;AACA,SAAO;AACR;","names":[]}
|
|
@@ -28,6 +28,26 @@ var dealStageChangedPayloadSchema = z.object({
|
|
|
28
28
|
newStage: z.string(),
|
|
29
29
|
oldStage: z.string()
|
|
30
30
|
}).strict();
|
|
31
|
+
var messageCreatedPayloadSchema = z.object({
|
|
32
|
+
changedFields: z.record(z.unknown()).nullable(),
|
|
33
|
+
entityId: z.string().uuid(),
|
|
34
|
+
externalId: z.string(),
|
|
35
|
+
provider: z.string(),
|
|
36
|
+
source: z.string()
|
|
37
|
+
}).strict();
|
|
38
|
+
var messageDeletedPayloadSchema = z.object({
|
|
39
|
+
entityId: z.string().uuid(),
|
|
40
|
+
externalId: z.string(),
|
|
41
|
+
provider: z.string(),
|
|
42
|
+
source: z.string()
|
|
43
|
+
}).strict();
|
|
44
|
+
var messageEditedPayloadSchema = z.object({
|
|
45
|
+
changedFields: z.record(z.unknown()).nullable(),
|
|
46
|
+
entityId: z.string().uuid(),
|
|
47
|
+
externalId: z.string(),
|
|
48
|
+
provider: z.string(),
|
|
49
|
+
source: z.string()
|
|
50
|
+
}).strict();
|
|
31
51
|
var stripePaymentReceivedPayloadSchema = z.object({
|
|
32
52
|
amountCents: z.number(),
|
|
33
53
|
currency: z.string(),
|
|
@@ -47,6 +67,9 @@ var eventPayloadSchemas = {
|
|
|
47
67
|
"crm_sync_started": crmSyncStartedPayloadSchema,
|
|
48
68
|
"deal_created": dealCreatedPayloadSchema,
|
|
49
69
|
"deal_stage_changed": dealStageChangedPayloadSchema,
|
|
70
|
+
"message_created": messageCreatedPayloadSchema,
|
|
71
|
+
"message_deleted": messageDeletedPayloadSchema,
|
|
72
|
+
"message_edited": messageEditedPayloadSchema,
|
|
50
73
|
"stripe_payment_received": stripePaymentReceivedPayloadSchema,
|
|
51
74
|
"webhook_outbound_contact_sync": webhookOutboundContactSyncPayloadSchema
|
|
52
75
|
};
|
|
@@ -58,8 +81,11 @@ export {
|
|
|
58
81
|
crmSyncStartedPayloadSchema,
|
|
59
82
|
dealCreatedPayloadSchema,
|
|
60
83
|
dealStageChangedPayloadSchema,
|
|
84
|
+
messageCreatedPayloadSchema,
|
|
85
|
+
messageDeletedPayloadSchema,
|
|
86
|
+
messageEditedPayloadSchema,
|
|
61
87
|
stripePaymentReceivedPayloadSchema,
|
|
62
88
|
webhookOutboundContactSyncPayloadSchema,
|
|
63
89
|
eventPayloadSchemas
|
|
64
90
|
};
|
|
65
|
-
//# sourceMappingURL=chunk-
|
|
91
|
+
//# sourceMappingURL=chunk-MU54DZCC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../runtime/subsystems/events/generated/schemas.ts"],"sourcesContent":["// AUTO-GENERATED by @pattern-stack/codegen. Do not edit.\n// Run `codegen entity new --all` to refresh.\n\n\nimport { z } from 'zod';\nimport type { EventTypeName } from './types';\n\nexport const contactCreatedPayloadSchema = z.object({\n\taccountId: z.string().uuid().nullable(),\n\tcontactId: z.string().uuid(),\n\tcreatedBy: z.string().uuid(),\n}).strict();\n\nexport const contactMarkedChampionPayloadSchema = z.object({\n\tcontactId: z.string().uuid(),\n\topportunityId: z.string().uuid(),\n}).strict();\n\nexport const contactMergedPayloadSchema = z.object({\n\tmergedBy: z.string().uuid(),\n\tsourceId: z.string().uuid(),\n\ttargetId: z.string().uuid(),\n}).strict();\n\nexport const crmSyncStartedPayloadSchema = z.object({\n\trunId: z.string().uuid(),\n\tsource: z.string(),\n}).strict();\n\nexport const dealCreatedPayloadSchema = z.object({\n\taccountId: z.string().uuid(),\n\tdealId: z.string().uuid(),\n\townerId: z.string().uuid(),\n}).strict();\n\nexport const dealStageChangedPayloadSchema = z.object({\n\tdealId: z.string().uuid(),\n\tnewStage: z.string(),\n\toldStage: z.string(),\n}).strict();\n\nexport const messageCreatedPayloadSchema = z.object({\n\tchangedFields: z.record(z.unknown()).nullable(),\n\tentityId: z.string().uuid(),\n\texternalId: z.string(),\n\tprovider: z.string(),\n\tsource: z.string(),\n}).strict();\n\nexport const messageDeletedPayloadSchema = z.object({\n\tentityId: z.string().uuid(),\n\texternalId: z.string(),\n\tprovider: z.string(),\n\tsource: z.string(),\n}).strict();\n\nexport const messageEditedPayloadSchema = z.object({\n\tchangedFields: z.record(z.unknown()).nullable(),\n\tentityId: z.string().uuid(),\n\texternalId: z.string(),\n\tprovider: z.string(),\n\tsource: z.string(),\n}).strict();\n\nexport const stripePaymentReceivedPayloadSchema = z.object({\n\tamountCents: z.number(),\n\tcurrency: z.string(),\n\tcustomerId: z.string(),\n\teventId: z.string(),\n\treceivedAt: z.coerce.date(),\n}).strict();\n\nexport const webhookOutboundContactSyncPayloadSchema = z.object({\n\tcontactId: z.string().uuid(),\n\toccurredAt: z.coerce.date(),\n\toperation: z.string(),\n}).strict();\n\nexport const eventPayloadSchemas = {\n\t'contact_created': contactCreatedPayloadSchema,\n\t'contact_marked_champion': contactMarkedChampionPayloadSchema,\n\t'contact_merged': contactMergedPayloadSchema,\n\t'crm_sync_started': crmSyncStartedPayloadSchema,\n\t'deal_created': dealCreatedPayloadSchema,\n\t'deal_stage_changed': dealStageChangedPayloadSchema,\n\t'message_created': messageCreatedPayloadSchema,\n\t'message_deleted': messageDeletedPayloadSchema,\n\t'message_edited': messageEditedPayloadSchema,\n\t'stripe_payment_received': stripePaymentReceivedPayloadSchema,\n\t'webhook_outbound_contact_sync': webhookOutboundContactSyncPayloadSchema,\n} as const satisfies Record<EventTypeName, z.ZodType>;\n"],"mappings":";AAIA,SAAS,SAAS;AAGX,IAAM,8BAA8B,EAAE,OAAO;AAAA,EACnD,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS;AAAA,EACtC,WAAW,EAAE,OAAO,EAAE,KAAK;AAAA,EAC3B,WAAW,EAAE,OAAO,EAAE,KAAK;AAC5B,CAAC,EAAE,OAAO;AAEH,IAAM,qCAAqC,EAAE,OAAO;AAAA,EAC1D,WAAW,EAAE,OAAO,EAAE,KAAK;AAAA,EAC3B,eAAe,EAAE,OAAO,EAAE,KAAK;AAChC,CAAC,EAAE,OAAO;AAEH,IAAM,6BAA6B,EAAE,OAAO;AAAA,EAClD,UAAU,EAAE,OAAO,EAAE,KAAK;AAAA,EAC1B,UAAU,EAAE,OAAO,EAAE,KAAK;AAAA,EAC1B,UAAU,EAAE,OAAO,EAAE,KAAK;AAC3B,CAAC,EAAE,OAAO;AAEH,IAAM,8BAA8B,EAAE,OAAO;AAAA,EACnD,OAAO,EAAE,OAAO,EAAE,KAAK;AAAA,EACvB,QAAQ,EAAE,OAAO;AAClB,CAAC,EAAE,OAAO;AAEH,IAAM,2BAA2B,EAAE,OAAO;AAAA,EAChD,WAAW,EAAE,OAAO,EAAE,KAAK;AAAA,EAC3B,QAAQ,EAAE,OAAO,EAAE,KAAK;AAAA,EACxB,SAAS,EAAE,OAAO,EAAE,KAAK;AAC1B,CAAC,EAAE,OAAO;AAEH,IAAM,gCAAgC,EAAE,OAAO;AAAA,EACrD,QAAQ,EAAE,OAAO,EAAE,KAAK;AAAA,EACxB,UAAU,EAAE,OAAO;AAAA,EACnB,UAAU,EAAE,OAAO;AACpB,CAAC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sBAAsB;AAAA,EACtB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,2BAA2B;AAAA,EAC3B,iCAAiC;AAClC;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getEventMetadata
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LQZESSM3.js";
|
|
4
4
|
import {
|
|
5
5
|
eventPayloadSchemas
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MU54DZCC.js";
|
|
7
7
|
import {
|
|
8
8
|
MissingTenantIdError
|
|
9
9
|
} from "./chunk-DUBZOXJC.js";
|
|
@@ -89,4 +89,4 @@ TypedEventBus = __decorateClass([
|
|
|
89
89
|
export {
|
|
90
90
|
TypedEventBus
|
|
91
91
|
};
|
|
92
|
-
//# sourceMappingURL=chunk-
|
|
92
|
+
//# sourceMappingURL=chunk-PBENHIN2.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
INTEGRATION_CURSOR_STORE,
|
|
12
12
|
INTEGRATION_RUN_RECORDER
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-S5G3HO7N.js";
|
|
14
14
|
import {
|
|
15
15
|
__decorateClass,
|
|
16
16
|
__decorateParam,
|
|
@@ -181,4 +181,4 @@ ObservabilityService = __decorateClass([
|
|
|
181
181
|
export {
|
|
182
182
|
ObservabilityService
|
|
183
183
|
};
|
|
184
|
-
//# sourceMappingURL=chunk-
|
|
184
|
+
//# sourceMappingURL=chunk-PLUJEQLU.js.map
|
|
@@ -3,6 +3,7 @@ var INTEGRATION_CHANGE_SOURCE = "INTEGRATION_CHANGE_SOURCE";
|
|
|
3
3
|
var INTEGRATION_CURSOR_STORE = "INTEGRATION_CURSOR_STORE";
|
|
4
4
|
var INTEGRATION_FIELD_DIFFER = "INTEGRATION_FIELD_DIFFER";
|
|
5
5
|
var INTEGRATION_SINK = "INTEGRATION_SINK";
|
|
6
|
+
var INTEGRATION_CHANGE_EMITTER = "INTEGRATION_CHANGE_EMITTER";
|
|
6
7
|
var INTEGRATION_RUN_RECORDER = "INTEGRATION_RUN_RECORDER";
|
|
7
8
|
var INTEGRATION_MODULE_OPTIONS = "INTEGRATION_MODULE_OPTIONS";
|
|
8
9
|
var INTEGRATION_MULTI_TENANT = "INTEGRATION_MULTI_TENANT";
|
|
@@ -13,9 +14,10 @@ export {
|
|
|
13
14
|
INTEGRATION_CURSOR_STORE,
|
|
14
15
|
INTEGRATION_FIELD_DIFFER,
|
|
15
16
|
INTEGRATION_SINK,
|
|
17
|
+
INTEGRATION_CHANGE_EMITTER,
|
|
16
18
|
INTEGRATION_RUN_RECORDER,
|
|
17
19
|
INTEGRATION_MODULE_OPTIONS,
|
|
18
20
|
INTEGRATION_MULTI_TENANT,
|
|
19
21
|
ENTITY_CHANGE_SOURCE_REGISTRY
|
|
20
22
|
};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-S5G3HO7N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../runtime/subsystems/integration/integration.tokens.ts"],"sourcesContent":["/**\n * Integration subsystem — DI tokens\n *\n * String constants (not Symbols) so they match by value across import\n * boundaries — same convention as the events subsystem (`EVENT_BUS`). The\n * jobs subsystem uses Symbols for its analogous tokens; events and integration\n * stay internally consistent with strings.\n *\n * Usage in use cases:\n * ```ts\n * constructor(\n * @Inject(INTEGRATION_CHANGE_SOURCE) private readonly source: IChangeSource<CanonicalOpportunity>,\n * @Inject(INTEGRATION_CURSOR_STORE) private readonly cursors: ICursorStore,\n * @Inject(INTEGRATION_FIELD_DIFFER) private readonly differ: IFieldDiffer<CanonicalOpportunity>,\n * @Inject(INTEGRATION_SINK) private readonly sink: IIntegrationSink<CanonicalOpportunity>,\n * @Inject(INTEGRATION_RUN_RECORDER) private readonly recorder: IIntegrationRunRecorder,\n * ) {}\n * ```\n *\n * Concrete bindings are registered by `IntegrationModule.forRoot(...)` (SYNC-6).\n */\n\nexport const INTEGRATION_CHANGE_SOURCE = 'INTEGRATION_CHANGE_SOURCE' as const;\nexport const INTEGRATION_CURSOR_STORE = 'INTEGRATION_CURSOR_STORE' as const;\nexport const INTEGRATION_FIELD_DIFFER = 'INTEGRATION_FIELD_DIFFER' as const;\nexport const INTEGRATION_SINK = 'INTEGRATION_SINK' as const;\n\n/**\n * Optional post-upsert change-event emitter token (EMIT-CHANGES seam).\n *\n * Backed by `IIntegrationChangeEmitter`. Bound ONLY by codegen-emitted assembly\n * modules whose entity opts in via `integration.sink.emit_changes: true`. The\n * orchestrator injects it `@Optional()` — an unbound token means no domain\n * events are published (the back-compat default for non-opted-in entities).\n * See `integration-change-emitter.protocol.ts`.\n */\nexport const INTEGRATION_CHANGE_EMITTER = 'INTEGRATION_CHANGE_EMITTER' as const;\n\n/**\n * Run-recorder token (SYNC-5). Backed by `IIntegrationRunRecorder`. Drizzle impl\n * lands in SYNC-4; tests provide inline fakes.\n */\nexport const INTEGRATION_RUN_RECORDER = 'INTEGRATION_RUN_RECORDER' as const;\n\n/**\n * Injection token for the resolved `IntegrationModuleOptions` object (SYNC-6).\n *\n * Backends that need to observe module configuration (e.g. `multiTenant`\n * flag, pool filters) inject via this token. Provided automatically by\n * `IntegrationModule.forRoot(...)` / `IntegrationModule.forRootAsync(...)`.\n */\nexport const INTEGRATION_MODULE_OPTIONS = 'INTEGRATION_MODULE_OPTIONS' as const;\n\n/**\n * Injection token for the resolved multi-tenancy flag (SYNC-6).\n *\n * Provided by `IntegrationModule.forRoot(...)` as `options.multiTenant ?? false`.\n * Consumed by `ExecuteIntegrationUseCase` to enforce the tenantId-is-required rule.\n */\nexport const INTEGRATION_MULTI_TENANT = 'INTEGRATION_MULTI_TENANT' as const;\n\n/**\n * Injection token for the entity-keyed `IEntityChangeSourceRegistry` (C7,\n * #336). Bound to the codegen-emitted aggregator that folds per-provider\n * adapter contributions into one registry (RFC-0001 §3, emitted by Track D\n * D3/D4).\n *\n * A string constant, not `Symbol.for(...)`, to match this subsystem's token\n * convention (see file header). The originating issue's code block proposed a\n * `Symbol.for('@pattern-stack/codegen.entity-change-source-registry')` key,\n * predating the sync→integration consolidation onto string tokens; kept as a\n * string here for internal consistency with the other INTEGRATION_* tokens.\n */\nexport const ENTITY_CHANGE_SOURCE_REGISTRY = 'ENTITY_CHANGE_SOURCE_REGISTRY' as const;\n"],"mappings":";AAsBO,IAAM,4BAA4B;AAClC,IAAM,2BAA2B;AACjC,IAAM,2BAA2B;AACjC,IAAM,mBAAmB;AAWzB,IAAM,6BAA6B;AAMnC,IAAM,2BAA2B;AASjC,IAAM,6BAA6B;AAQnC,IAAM,2BAA2B;AAcjC,IAAM,gCAAgC;","names":[]}
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from "./chunk-NXXDZ6ZF.js";
|
|
25
25
|
import {
|
|
26
26
|
JOB_WORKER_MODULE_OPTIONS
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-ENAR3F5S.js";
|
|
28
28
|
import {
|
|
29
29
|
BRIDGE_DELIVERY_REPO,
|
|
30
30
|
BRIDGE_MODULE_OPTIONS,
|
|
@@ -119,4 +119,4 @@ BridgeModule = __decorateClass([
|
|
|
119
119
|
export {
|
|
120
120
|
BridgeModule
|
|
121
121
|
};
|
|
122
|
-
//# sourceMappingURL=chunk-
|
|
122
|
+
//# sourceMappingURL=chunk-WZOPWQN2.js.map
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
INTEGRATION_CHANGE_EMITTER,
|
|
2
3
|
INTEGRATION_CHANGE_SOURCE,
|
|
3
4
|
INTEGRATION_CURSOR_STORE,
|
|
4
5
|
INTEGRATION_FIELD_DIFFER,
|
|
5
6
|
INTEGRATION_MULTI_TENANT,
|
|
6
7
|
INTEGRATION_RUN_RECORDER,
|
|
7
8
|
INTEGRATION_SINK
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-S5G3HO7N.js";
|
|
9
10
|
import {
|
|
10
11
|
assertTenantId
|
|
11
12
|
} from "./chunk-MZ6GV4YF.js";
|
|
@@ -17,13 +18,14 @@ import {
|
|
|
17
18
|
// runtime/subsystems/integration/execute-integration.use-case.ts
|
|
18
19
|
import { Inject, Injectable, Logger, Optional } from "@nestjs/common";
|
|
19
20
|
var ExecuteIntegrationUseCase = class {
|
|
20
|
-
constructor(source, cursors, differ, sink, recorder, multiTenant = false) {
|
|
21
|
+
constructor(source, cursors, differ, sink, recorder, multiTenant = false, emitter = null) {
|
|
21
22
|
this.source = source;
|
|
22
23
|
this.cursors = cursors;
|
|
23
24
|
this.differ = differ;
|
|
24
25
|
this.sink = sink;
|
|
25
26
|
this.recorder = recorder;
|
|
26
27
|
this.multiTenant = multiTenant;
|
|
28
|
+
this.emitter = emitter;
|
|
27
29
|
}
|
|
28
30
|
source;
|
|
29
31
|
cursors;
|
|
@@ -31,6 +33,7 @@ var ExecuteIntegrationUseCase = class {
|
|
|
31
33
|
sink;
|
|
32
34
|
recorder;
|
|
33
35
|
multiTenant;
|
|
36
|
+
emitter;
|
|
34
37
|
logger = new Logger(ExecuteIntegrationUseCase.name);
|
|
35
38
|
async execute(input) {
|
|
36
39
|
assertTenantId(input.tenantId, {
|
|
@@ -146,6 +149,9 @@ var ExecuteIntegrationUseCase = class {
|
|
|
146
149
|
changedFields: {},
|
|
147
150
|
tenantId: input.tenantId
|
|
148
151
|
});
|
|
152
|
+
if (result) {
|
|
153
|
+
await this.emitChange(input, change.externalId, result.id, "deleted");
|
|
154
|
+
}
|
|
149
155
|
return;
|
|
150
156
|
}
|
|
151
157
|
const existing = await this.sink.findByExternalId(
|
|
@@ -193,16 +199,49 @@ var ExecuteIntegrationUseCase = class {
|
|
|
193
199
|
change.record,
|
|
194
200
|
input.provider
|
|
195
201
|
);
|
|
202
|
+
const action = existing === null ? "created" : "updated";
|
|
196
203
|
await this.recorder.recordItem({
|
|
197
204
|
integrationRunId: runId,
|
|
198
205
|
entityType: input.subscription.domain,
|
|
199
206
|
externalId: change.externalId,
|
|
200
207
|
localId,
|
|
201
|
-
operation:
|
|
208
|
+
operation: action,
|
|
202
209
|
status: "success",
|
|
203
210
|
changedFields: diff,
|
|
204
211
|
tenantId: input.tenantId
|
|
205
212
|
});
|
|
213
|
+
await this.emitChange(
|
|
214
|
+
input,
|
|
215
|
+
change.externalId,
|
|
216
|
+
localId,
|
|
217
|
+
action,
|
|
218
|
+
diff
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Publish one typed data-level change event via the optional emitter
|
|
223
|
+
* (EMIT-CHANGES seam). No-op when no emitter is bound (the back-compat
|
|
224
|
+
* default). A failed publish is logged but never aborts the run — the row is
|
|
225
|
+
* already written; emission is best-effort (the outbox tx, when the generated
|
|
226
|
+
* adapter rides on one, gives the at-least-once guarantee, not this try/catch).
|
|
227
|
+
*/
|
|
228
|
+
async emitChange(input, externalId, entityId, action, changedFields) {
|
|
229
|
+
if (this.emitter === null) return;
|
|
230
|
+
try {
|
|
231
|
+
await this.emitter.emitChange({
|
|
232
|
+
entityId,
|
|
233
|
+
externalId,
|
|
234
|
+
provider: input.provider,
|
|
235
|
+
action,
|
|
236
|
+
changedFields: action === "deleted" ? void 0 : changedFields,
|
|
237
|
+
tenantId: input.tenantId
|
|
238
|
+
});
|
|
239
|
+
} catch (err) {
|
|
240
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
241
|
+
this.logger.warn(
|
|
242
|
+
`integration change-emit failed: subscription=${input.subscription.id} externalId=${externalId} action=${action}: ${message}`
|
|
243
|
+
);
|
|
244
|
+
}
|
|
206
245
|
}
|
|
207
246
|
};
|
|
208
247
|
ExecuteIntegrationUseCase = __decorateClass([
|
|
@@ -213,10 +252,12 @@ ExecuteIntegrationUseCase = __decorateClass([
|
|
|
213
252
|
__decorateParam(3, Inject(INTEGRATION_SINK)),
|
|
214
253
|
__decorateParam(4, Inject(INTEGRATION_RUN_RECORDER)),
|
|
215
254
|
__decorateParam(5, Optional()),
|
|
216
|
-
__decorateParam(5, Inject(INTEGRATION_MULTI_TENANT))
|
|
255
|
+
__decorateParam(5, Inject(INTEGRATION_MULTI_TENANT)),
|
|
256
|
+
__decorateParam(6, Optional()),
|
|
257
|
+
__decorateParam(6, Inject(INTEGRATION_CHANGE_EMITTER))
|
|
217
258
|
], ExecuteIntegrationUseCase);
|
|
218
259
|
|
|
219
260
|
export {
|
|
220
261
|
ExecuteIntegrationUseCase
|
|
221
262
|
};
|
|
222
|
-
//# sourceMappingURL=chunk-
|
|
263
|
+
//# sourceMappingURL=chunk-YIVQ7KLS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../runtime/subsystems/integration/execute-integration.use-case.ts"],"sourcesContent":["/**\n * ExecuteIntegrationUseCase — the generic integration orchestrator (SYNC-5).\n *\n * One class. Reused across every `(provider, detection-mode, canonical-entity)`\n * tuple. Parameterized over `T` so canonical records stay typed end-to-end.\n *\n * Flow per run:\n *\n * 1. `recorder.startRun(...)` — opens a `integration_runs` row in 'running'.\n * 2. for each change yielded by `source.listChanges(subscription, cursorBefore)`:\n * a. differ.diff(existing, incoming) → 'noop' short-circuits to\n * a noop audit row (no sink write).\n * b. sink.upsertByExternalId / softDeleteByExternalId → records\n * the local id on the audit row.\n * c. per-item try/catch — a failed item increments the failed\n * counter and records `status: 'failed'` with `error`, but\n * does NOT abort the run.\n * d. advance `latestCursor = change.cursor` as the iterator moves.\n * 3. `cursors.put(subscription.id, latestCursor)` when the loop completes\n * AND at least one cursor advance happened. On exceptions from the\n * source iterator (auth expiry, network error), we persist the\n * last-good cursor so the next run resumes from the last known\n * successful position.\n * 4. `finally { recorder.completeRun(...) }` — always terminates the run.\n *\n * Loopback suppression — when a consumer's writes echo back on the next\n * inbound poll/CDC/webhook — is composed into the source's middleware\n * chain via `createLoopbackMiddleware(store)` (#226-5 / ADR-033). The\n * orchestrator no longer special-cases echoes: middleware drops them\n * before they reach this loop. Consumers that don't have outbound\n * writeback paths simply omit the middleware.\n *\n * ## Generics\n *\n * - `T` = canonical record shape from the adapter side. Same `T` flows\n * through `IChangeSource<T>`, `IFieldDiffer<T>`, `IIntegrationSink<T>`.\n *\n * ## No CRM bleed\n *\n * Per the SYNC-5 issue's extraction notes (HS-9 finding), this orchestrator\n * is strictly provider-agnostic:\n * - `entityType` is `string` throughout; no `'opportunity' | 'account' | ...`\n * narrowing leaks into the use case\n * - the upstream consumer's `IntegrationRunRecorderService` class injection replaced with the\n * `IIntegrationRunRecorder` protocol (backend lands in SYNC-4)\n */\nimport { Inject, Injectable, Logger, Optional } from '@nestjs/common';\nimport type { IChangeSource, Change } from './integration-change-source.protocol';\nimport type { ICursorStore } from './integration-cursor-store.protocol';\nimport type { IFieldDiffer, FieldDiff } from './integration-field-diff.protocol';\nimport type { IIntegrationSink } from './integration-sink.protocol';\nimport type { IIntegrationRunRecorder } from './integration-run-recorder.protocol';\nimport type {\n IIntegrationChangeEmitter,\n IntegrationChangeAction,\n} from './integration-change-emitter.protocol';\nimport { assertTenantId } from './integration-errors';\nimport {\n INTEGRATION_CHANGE_EMITTER,\n INTEGRATION_CHANGE_SOURCE,\n INTEGRATION_CURSOR_STORE,\n INTEGRATION_FIELD_DIFFER,\n INTEGRATION_MULTI_TENANT,\n INTEGRATION_RUN_RECORDER,\n INTEGRATION_SINK,\n} from './integration.tokens';\n\n// ============================================================================\n// Inputs + result\n// ============================================================================\n\nexport interface ExecuteIntegrationInput<T> {\n /** The subscription whose cursor/identity frames this run. */\n readonly subscription: {\n readonly id: string;\n readonly domain: string; // entityType — used on audit rows\n readonly externalRef?: string | null;\n };\n /** Per-run user context; threaded through sink writes. */\n readonly userId: string;\n /** Provider label persisted on saved rows, e.g. `'salesforce-crm'`. */\n readonly provider: string;\n /** Run direction — almost always `'inbound'`. Reserved for writeback. */\n readonly direction: 'inbound' | 'outbound';\n /** Detection mode — maps 1:1 to `integration_runs.action`. */\n readonly action: 'poll' | 'cdc' | 'webhook' | 'manual' | 'writeback';\n /** Multi-tenant deployments pass the tenant id through. */\n readonly tenantId?: string | null;\n /**\n * Optional override — inject a specific change source for this run when\n * the DI-bound source is not the one to use (e.g. manual backfill with\n * a custom cursor). Defaults to the DI-resolved `INTEGRATION_CHANGE_SOURCE`.\n */\n readonly sourceOverride?: IChangeSource<T>;\n}\n\nexport interface ExecuteIntegrationResult {\n readonly runId: string;\n readonly status: 'success' | 'no_changes' | 'failed';\n readonly recordsFound: number;\n readonly recordsProcessed: number;\n readonly recordsFailed: number;\n readonly cursorBefore: unknown | null;\n readonly cursorAfter: unknown | null;\n readonly durationMs: number;\n readonly error?: string | null;\n}\n\n// ============================================================================\n// ExecuteIntegrationUseCase\n// ============================================================================\n\n@Injectable()\nexport class ExecuteIntegrationUseCase<T extends Record<string, unknown>> {\n private readonly logger = new Logger(ExecuteIntegrationUseCase.name);\n\n constructor(\n @Inject(INTEGRATION_CHANGE_SOURCE) private readonly source: IChangeSource<T>,\n @Inject(INTEGRATION_CURSOR_STORE) private readonly cursors: ICursorStore,\n @Inject(INTEGRATION_FIELD_DIFFER) private readonly differ: IFieldDiffer<T>,\n @Inject(INTEGRATION_SINK) private readonly sink: IIntegrationSink<T>,\n @Inject(INTEGRATION_RUN_RECORDER) private readonly recorder: IIntegrationRunRecorder,\n @Optional()\n @Inject(INTEGRATION_MULTI_TENANT)\n private readonly multiTenant: boolean = false,\n // EMIT-CHANGES seam — optional post-upsert domain-event emitter. Bound only\n // by codegen-emitted assemblies whose entity opts into\n // `integration.sink.emit_changes: true`. Unbound (the default) ⇒ no events\n // published, zero behavior change.\n @Optional()\n @Inject(INTEGRATION_CHANGE_EMITTER)\n private readonly emitter: IIntegrationChangeEmitter | null = null,\n ) {}\n\n async execute(input: ExecuteIntegrationInput<T>): Promise<ExecuteIntegrationResult> {\n // Defense-in-depth tenancy guard — fire BEFORE startRun so a rejected\n // input never leaves a dangling `status=running` row. Backends also\n // enforce (SYNC-4), but failing fast at the orchestrator boundary is\n // cheaper for observability, metrics, and manual cleanup.\n assertTenantId(input.tenantId, {\n multiTenant: this.multiTenant,\n operation: 'execute',\n });\n\n const source = input.sourceOverride ?? this.source;\n const startedAt = Date.now();\n const cursorBefore = await this.cursors.get(input.subscription.id, input.tenantId);\n\n const { id: runId } = await this.recorder.startRun({\n subscriptionId: input.subscription.id,\n direction: input.direction,\n action: input.action,\n cursorBefore,\n tenantId: input.tenantId,\n });\n\n let recordsFound = 0;\n let recordsProcessed = 0;\n let recordsFailed = 0;\n let latestCursor: unknown | null = cursorBefore;\n let cursorAdvanced = false;\n let runError: string | null = null;\n let status: 'success' | 'no_changes' | 'failed' = 'no_changes';\n\n try {\n for await (const change of source.listChanges(input.subscription, cursorBefore)) {\n recordsFound++;\n latestCursor = change.cursor;\n cursorAdvanced = true;\n\n try {\n await this.processChange(runId, input, change);\n recordsProcessed++;\n } catch (err) {\n recordsFailed++;\n const message = err instanceof Error ? err.message : String(err);\n this.logger.warn(\n `integration item failed: subscription=${input.subscription.id} externalId=${change.externalId}: ${message}`,\n );\n await this.recorder.recordItem({\n integrationRunId: runId,\n entityType: input.subscription.domain,\n externalId: change.externalId,\n operation: change.operation === 'deleted' ? 'deleted' : 'updated',\n status: 'failed',\n changedFields: {},\n error: message,\n tenantId: input.tenantId,\n });\n }\n }\n\n if (recordsFailed > 0 && recordsProcessed === 0 && recordsFound > 0) {\n // Every record we saw failed — call the run a failure, not a\n // success. Partial success (some processed, some failed) still\n // counts as 'success' so the cursor advances.\n status = 'failed';\n runError = `all ${recordsFailed} records failed`;\n } else if (recordsFound === 0) {\n status = 'no_changes';\n } else {\n status = 'success';\n }\n } catch (err) {\n // Source iterator itself threw — cursor DOES NOT advance past the\n // last-successful cursor. `latestCursor` still holds the last\n // `change.cursor` we observed, which is the furthest we know to\n // have delivered. Persist it (below) so next run resumes there.\n status = 'failed';\n runError = err instanceof Error ? err.message : String(err);\n this.logger.error(\n `integration source failed: subscription=${input.subscription.id}: ${runError}`,\n );\n }\n\n // Persist cursor advance only when something actually moved. Never\n // overwrite a valid cursor with `null` on a no-change run.\n if (cursorAdvanced && latestCursor !== null && latestCursor !== undefined) {\n try {\n await this.cursors.put(input.subscription.id, latestCursor, input.tenantId);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n this.logger.error(\n `cursor put failed: subscription=${input.subscription.id}: ${message}`,\n );\n if (status !== 'failed') {\n status = 'failed';\n runError = `cursor put failed: ${message}`;\n }\n }\n }\n\n const durationMs = Date.now() - startedAt;\n\n await this.recorder.completeRun(runId, {\n status,\n recordsFound,\n recordsProcessed,\n cursorAfter: cursorAdvanced ? latestCursor : cursorBefore,\n durationMs,\n error: runError,\n });\n\n return {\n runId,\n status,\n recordsFound,\n recordsProcessed,\n recordsFailed,\n cursorBefore,\n cursorAfter: cursorAdvanced ? latestCursor : cursorBefore,\n durationMs,\n error: runError,\n };\n }\n\n private async processChange(\n runId: string,\n input: ExecuteIntegrationInput<T>,\n change: Change<T>,\n ): Promise<void> {\n // Deletion branch — no diff, no upsert; soft-delete via sink.\n if (change.operation === 'deleted') {\n const result = await this.sink.softDeleteByExternalId(\n input.userId,\n change.externalId,\n );\n await this.recorder.recordItem({\n integrationRunId: runId,\n entityType: input.subscription.domain,\n externalId: change.externalId,\n localId: result?.id ?? null,\n operation: result ? 'deleted' : 'noop',\n status: 'success',\n changedFields: {},\n tenantId: input.tenantId,\n });\n // EMIT-CHANGES: a real tombstone (a local row existed and was soft-deleted)\n // is a `<entity>_deleted` event. A delete that hit no local row is a noop —\n // nothing changed, nothing to emit.\n if (result) {\n await this.emitChange(input, change.externalId, result.id, 'deleted');\n }\n return;\n }\n\n // Create/update path — diff against local state, short-circuit on noop.\n const existing = await this.sink.findByExternalId(\n input.userId,\n change.externalId,\n );\n const diff = this.differ.diff(\n existing,\n change.record,\n change.providerChangedFields,\n );\n\n if (diff === 'noop') {\n // Sinks that declare `reprojectsOnNoop` reproject side data the differ\n // can't see (e.g. EAV field_values) — so fall through to the idempotent\n // upsert instead of short-circuiting. The canonical state is unchanged,\n // so the audit `operation` stays `'noop'`, but we capture the local id\n // returned by the upsert. Sinks without the flag keep today's behavior.\n if (!this.sink.reprojectsOnNoop) {\n await this.recorder.recordItem({\n integrationRunId: runId,\n entityType: input.subscription.domain,\n externalId: change.externalId,\n localId: null,\n operation: 'noop',\n status: 'success',\n changedFields: {},\n tenantId: input.tenantId,\n });\n return;\n }\n\n const { id: noopLocalId } = await this.sink.upsertByExternalId(\n input.userId,\n change.record,\n input.provider,\n );\n await this.recorder.recordItem({\n integrationRunId: runId,\n entityType: input.subscription.domain,\n externalId: change.externalId,\n localId: noopLocalId,\n operation: 'noop',\n status: 'success',\n changedFields: {},\n tenantId: input.tenantId,\n });\n return;\n }\n\n const { id: localId } = await this.sink.upsertByExternalId(\n input.userId,\n change.record,\n input.provider,\n );\n\n const action: IntegrationChangeAction =\n existing === null ? 'created' : 'updated';\n\n await this.recorder.recordItem({\n integrationRunId: runId,\n entityType: input.subscription.domain,\n externalId: change.externalId,\n localId,\n operation: action,\n status: 'success',\n changedFields: diff as FieldDiff,\n tenantId: input.tenantId,\n });\n\n // EMIT-CHANGES: a real create/update (the diff was NOT noop) publishes a\n // typed `<entity>_created` / `<entity>_edited` event. The noop-reproject path\n // above intentionally does NOT emit — the canonical state is unchanged.\n await this.emitChange(\n input,\n change.externalId,\n localId,\n action,\n diff as FieldDiff,\n );\n }\n\n /**\n * Publish one typed data-level change event via the optional emitter\n * (EMIT-CHANGES seam). No-op when no emitter is bound (the back-compat\n * default). A failed publish is logged but never aborts the run — the row is\n * already written; emission is best-effort (the outbox tx, when the generated\n * adapter rides on one, gives the at-least-once guarantee, not this try/catch).\n */\n private async emitChange(\n input: ExecuteIntegrationInput<T>,\n externalId: string,\n entityId: string,\n action: IntegrationChangeAction,\n changedFields?: FieldDiff,\n ): Promise<void> {\n if (this.emitter === null) return;\n try {\n await this.emitter.emitChange({\n entityId,\n externalId,\n provider: input.provider,\n action,\n changedFields:\n action === 'deleted'\n ? undefined\n : (changedFields as Record<string, unknown> | undefined),\n tenantId: input.tenantId,\n });\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n this.logger.warn(\n `integration change-emit failed: subscription=${input.subscription.id} ` +\n `externalId=${externalId} action=${action}: ${message}`,\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8CA,SAAS,QAAQ,YAAY,QAAQ,gBAAgB;AAmE9C,IAAM,4BAAN,MAAmE;AAAA,EAGxE,YACsD,QACD,SACA,QACR,MACQ,UAGlC,cAAuB,OAOvB,UAA4C,MAC7D;AAfoD;AACD;AACA;AACR;AACQ;AAGlC;AAOA;AAAA,EAChB;AAAA,EAfmD;AAAA,EACD;AAAA,EACA;AAAA,EACR;AAAA,EACQ;AAAA,EAGlC;AAAA,EAOA;AAAA,EAjBF,SAAS,IAAI,OAAO,0BAA0B,IAAI;AAAA,EAoBnE,MAAM,QAAQ,OAAsE;AAKlF,mBAAe,MAAM,UAAU;AAAA,MAC7B,aAAa,KAAK;AAAA,MAClB,WAAW;AAAA,IACb,CAAC;AAED,UAAM,SAAS,MAAM,kBAAkB,KAAK;AAC5C,UAAM,YAAY,KAAK,IAAI;AAC3B,UAAM,eAAe,MAAM,KAAK,QAAQ,IAAI,MAAM,aAAa,IAAI,MAAM,QAAQ;AAEjF,UAAM,EAAE,IAAI,MAAM,IAAI,MAAM,KAAK,SAAS,SAAS;AAAA,MACjD,gBAAgB,MAAM,aAAa;AAAA,MACnC,WAAW,MAAM;AAAA,MACjB,QAAQ,MAAM;AAAA,MACd;AAAA,MACA,UAAU,MAAM;AAAA,IAClB,CAAC;AAED,QAAI,eAAe;AACnB,QAAI,mBAAmB;AACvB,QAAI,gBAAgB;AACpB,QAAI,eAA+B;AACnC,QAAI,iBAAiB;AACrB,QAAI,WAA0B;AAC9B,QAAI,SAA8C;AAElD,QAAI;AACF,uBAAiB,UAAU,OAAO,YAAY,MAAM,cAAc,YAA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,WAAW,YACP,SACC;AAAA,QACP,UAAU,MAAM;AAAA,MAClB,CAAC;AAAA,IACH,SAAS,KAAK;AACZ,YAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC/D,WAAK,OAAO;AAAA,QACV,gDAAgD,MAAM,aAAa,EAAE,eACrD,UAAU,WAAW,MAAM,KAAK,OAAO;AAAA,MACzD;AAAA,IACF;AAAA,EACF;AACF;AAjSa,4BAAN;AAAA,EADN,WAAW;AAAA,EAKP,0BAAO,yBAAyB;AAAA,EAChC,0BAAO,wBAAwB;AAAA,EAC/B,0BAAO,wBAAwB;AAAA,EAC/B,0BAAO,gBAAgB;AAAA,EACvB,0BAAO,wBAAwB;AAAA,EAC/B,4BAAS;AAAA,EACT,0BAAO,wBAAwB;AAAA,EAM/B,4BAAS;AAAA,EACT,0BAAO,0BAA0B;AAAA,GAjBzB;","names":[]}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
JunctionIntegrationRepository,
|
|
3
|
+
buildCompositeExternalId,
|
|
4
|
+
parseCompositeExternalId
|
|
5
|
+
} from "../../chunk-2FTZLDBP.js";
|
|
1
6
|
import {
|
|
2
7
|
KnowledgeEntityRepository
|
|
3
8
|
} from "../../chunk-NN7XZEGF.js";
|
|
@@ -13,6 +18,9 @@ import {
|
|
|
13
18
|
import {
|
|
14
19
|
WithAnalytics
|
|
15
20
|
} from "../../chunk-IBGER4YK.js";
|
|
21
|
+
import {
|
|
22
|
+
ActivityEntityService
|
|
23
|
+
} from "../../chunk-JYBFPNBJ.js";
|
|
16
24
|
import {
|
|
17
25
|
BaseFindByIdUseCase,
|
|
18
26
|
BaseListUseCase
|
|
@@ -24,10 +32,15 @@ import {
|
|
|
24
32
|
IntegratedEntityService
|
|
25
33
|
} from "../../chunk-2VHZ7EKC.js";
|
|
26
34
|
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
BaseService
|
|
36
|
+
} from "../../chunk-W72PRNJY.js";
|
|
37
|
+
import {
|
|
38
|
+
buildChangeEvents,
|
|
39
|
+
buildLifecycleEvent,
|
|
40
|
+
diffSnapshots,
|
|
41
|
+
emitSafely,
|
|
42
|
+
entitySnapshot
|
|
43
|
+
} from "../../chunk-KYR3B3OW.js";
|
|
31
44
|
import {
|
|
32
45
|
ActivityEntityRepository
|
|
33
46
|
} from "../../chunk-MKWQKKK7.js";
|
|
@@ -43,19 +56,6 @@ import {
|
|
|
43
56
|
withSuperuserScope,
|
|
44
57
|
withUserScope
|
|
45
58
|
} from "../../chunk-ZUKFQL6E.js";
|
|
46
|
-
import {
|
|
47
|
-
ActivityEntityService
|
|
48
|
-
} from "../../chunk-JYBFPNBJ.js";
|
|
49
|
-
import {
|
|
50
|
-
BaseService
|
|
51
|
-
} from "../../chunk-W72PRNJY.js";
|
|
52
|
-
import {
|
|
53
|
-
buildChangeEvents,
|
|
54
|
-
buildLifecycleEvent,
|
|
55
|
-
diffSnapshots,
|
|
56
|
-
emitSafely,
|
|
57
|
-
entitySnapshot
|
|
58
|
-
} from "../../chunk-KYR3B3OW.js";
|
|
59
59
|
import "../../chunk-2E224ZSN.js";
|
|
60
60
|
export {
|
|
61
61
|
ActivityEntityRepository,
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
import "../../../chunk-IP4OO26U.js";
|
|
5
5
|
import "../../../chunk-N5OTOWTP.js";
|
|
6
6
|
import "../../../chunk-QLTJSCE6.js";
|
|
7
|
-
import "../../../chunk-BPARRK6F.js";
|
|
8
7
|
import "../../../chunk-SZVPIHWE.js";
|
|
8
|
+
import "../../../chunk-BPARRK6F.js";
|
|
9
9
|
import "../../../chunk-NPFPZ2HO.js";
|
|
10
10
|
import "../../../chunk-6XY6ZMMD.js";
|
|
11
11
|
import "../../../chunk-GYGNEQSC.js";
|
|
@@ -29,12 +29,12 @@ import {
|
|
|
29
29
|
import {
|
|
30
30
|
MemoryOAuthStateStore
|
|
31
31
|
} from "../../../chunk-QLTJSCE6.js";
|
|
32
|
-
import {
|
|
33
|
-
OAuthStateError
|
|
34
|
-
} from "../../../chunk-BPARRK6F.js";
|
|
35
32
|
import {
|
|
36
33
|
AuthController
|
|
37
34
|
} from "../../../chunk-SZVPIHWE.js";
|
|
35
|
+
import {
|
|
36
|
+
OAuthStateError
|
|
37
|
+
} from "../../../chunk-BPARRK6F.js";
|
|
38
38
|
import {
|
|
39
39
|
authOAuthState
|
|
40
40
|
} from "../../../chunk-NPFPZ2HO.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BridgeModule
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-WZOPWQN2.js";
|
|
4
4
|
import "../../../chunk-5A432NZJ.js";
|
|
5
5
|
import "../../../chunk-7OVCARTQ.js";
|
|
6
6
|
import "../../../chunk-EDKJU5BO.js";
|
|
@@ -11,19 +11,19 @@ import "../../../chunk-R6F6KFIL.js";
|
|
|
11
11
|
import "../../../chunk-BORNCTH3.js";
|
|
12
12
|
import "../../../chunk-6DWFJNIK.js";
|
|
13
13
|
import "../../../chunk-NXXDZ6ZF.js";
|
|
14
|
-
import "../../../chunk-
|
|
14
|
+
import "../../../chunk-ENAR3F5S.js";
|
|
15
15
|
import "../../../chunk-7B7MMDOJ.js";
|
|
16
|
-
import "../../../chunk-
|
|
17
|
-
import "../../../chunk-VQOAATIG.js";
|
|
16
|
+
import "../../../chunk-CKLM57IE.js";
|
|
18
17
|
import "../../../chunk-3VEVGL74.js";
|
|
19
18
|
import "../../../chunk-CDLWYZVQ.js";
|
|
20
19
|
import "../../../chunk-L3LZWWSX.js";
|
|
21
20
|
import "../../../chunk-DV4RV2DC.js";
|
|
22
|
-
import "../../../chunk-PNZSGAB2.js";
|
|
23
|
-
import "../../../chunk-SNQ3TOWP.js";
|
|
24
21
|
import "../../../chunk-I6MVCB5A.js";
|
|
25
22
|
import "../../../chunk-RHVN6NA7.js";
|
|
26
23
|
import "../../../chunk-E6PLM6QG.js";
|
|
24
|
+
import "../../../chunk-VQOAATIG.js";
|
|
25
|
+
import "../../../chunk-PNZSGAB2.js";
|
|
26
|
+
import "../../../chunk-SNQ3TOWP.js";
|
|
27
27
|
import "../../../chunk-T4BIIU5E.js";
|
|
28
28
|
import "../../../chunk-Q6LRJ4VI.js";
|
|
29
29
|
import "../../../chunk-7P5ODGLA.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BridgeModule
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-WZOPWQN2.js";
|
|
4
4
|
import "../../../chunk-5A432NZJ.js";
|
|
5
5
|
import {
|
|
6
6
|
EventFlowService
|
|
@@ -33,19 +33,19 @@ import {
|
|
|
33
33
|
MissingTenantIdError,
|
|
34
34
|
UniqueConstraintError
|
|
35
35
|
} from "../../../chunk-NXXDZ6ZF.js";
|
|
36
|
-
import "../../../chunk-
|
|
36
|
+
import "../../../chunk-ENAR3F5S.js";
|
|
37
37
|
import "../../../chunk-7B7MMDOJ.js";
|
|
38
|
-
import "../../../chunk-
|
|
39
|
-
import "../../../chunk-VQOAATIG.js";
|
|
38
|
+
import "../../../chunk-CKLM57IE.js";
|
|
40
39
|
import "../../../chunk-3VEVGL74.js";
|
|
41
40
|
import "../../../chunk-CDLWYZVQ.js";
|
|
42
41
|
import "../../../chunk-L3LZWWSX.js";
|
|
43
42
|
import "../../../chunk-DV4RV2DC.js";
|
|
44
|
-
import "../../../chunk-PNZSGAB2.js";
|
|
45
|
-
import "../../../chunk-SNQ3TOWP.js";
|
|
46
43
|
import "../../../chunk-I6MVCB5A.js";
|
|
47
44
|
import "../../../chunk-RHVN6NA7.js";
|
|
48
45
|
import "../../../chunk-E6PLM6QG.js";
|
|
46
|
+
import "../../../chunk-VQOAATIG.js";
|
|
47
|
+
import "../../../chunk-PNZSGAB2.js";
|
|
48
|
+
import "../../../chunk-SNQ3TOWP.js";
|
|
49
49
|
import "../../../chunk-T4BIIU5E.js";
|
|
50
50
|
import "../../../chunk-Q6LRJ4VI.js";
|
|
51
51
|
import "../../../chunk-7P5ODGLA.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EventSchedulerLifecycle,
|
|
3
3
|
EventsModule
|
|
4
|
-
} from "../../../chunk-
|
|
5
|
-
import "../../../chunk-
|
|
6
|
-
import "../../../chunk-
|
|
7
|
-
import "../../../chunk-
|
|
4
|
+
} from "../../../chunk-6M6LZEP6.js";
|
|
5
|
+
import "../../../chunk-PBENHIN2.js";
|
|
6
|
+
import "../../../chunk-LQZESSM3.js";
|
|
7
|
+
import "../../../chunk-MU54DZCC.js";
|
|
8
8
|
import "../../../chunk-DUUCU77W.js";
|
|
9
9
|
import "../../../chunk-DUBZOXJC.js";
|
|
10
10
|
import "../../../chunk-PNCOUFFI.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TypedEventBus
|
|
3
|
-
} from "../../../../chunk-
|
|
4
|
-
import "../../../../chunk-
|
|
5
|
-
import "../../../../chunk-
|
|
3
|
+
} from "../../../../chunk-PBENHIN2.js";
|
|
4
|
+
import "../../../../chunk-LQZESSM3.js";
|
|
5
|
+
import "../../../../chunk-MU54DZCC.js";
|
|
6
6
|
import "../../../../chunk-DUBZOXJC.js";
|
|
7
7
|
import "../../../../chunk-H5NH7KPE.js";
|
|
8
8
|
import "../../../../chunk-GYGNEQSC.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { AppDomainEvent, ContactCreatedEvent, ContactMarkedChampionEvent, ContactMergedEvent, CrmSyncStartedEvent, DealCreatedEvent, DealStageChangedEvent, EventOfType, EventTypeName, PayloadOfType, StripePaymentReceivedEvent, WebhookOutboundContactSyncEvent } from './types.js';
|
|
2
|
-
export { contactCreatedPayloadSchema, contactMarkedChampionPayloadSchema, contactMergedPayloadSchema, crmSyncStartedPayloadSchema, dealCreatedPayloadSchema, dealStageChangedPayloadSchema, eventPayloadSchemas, stripePaymentReceivedPayloadSchema, webhookOutboundContactSyncPayloadSchema } from './schemas.js';
|
|
1
|
+
export { AppDomainEvent, ContactCreatedEvent, ContactMarkedChampionEvent, ContactMergedEvent, CrmSyncStartedEvent, DealCreatedEvent, DealStageChangedEvent, EventOfType, EventTypeName, MessageCreatedEvent, MessageDeletedEvent, MessageEditedEvent, PayloadOfType, StripePaymentReceivedEvent, WebhookOutboundContactSyncEvent } from './types.js';
|
|
2
|
+
export { contactCreatedPayloadSchema, contactMarkedChampionPayloadSchema, contactMergedPayloadSchema, crmSyncStartedPayloadSchema, dealCreatedPayloadSchema, dealStageChangedPayloadSchema, eventPayloadSchemas, messageCreatedPayloadSchema, messageDeletedPayloadSchema, messageEditedPayloadSchema, stripePaymentReceivedPayloadSchema, webhookOutboundContactSyncPayloadSchema } from './schemas.js';
|
|
3
3
|
export { EventMetadata, eventRegistry, getEventMetadata } from './registry.js';
|
|
4
4
|
export { TypedEventBus } from './bus.js';
|
|
5
5
|
import '../event-bus.protocol.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../../../../chunk-HUH73XGI.js";
|
|
2
2
|
import {
|
|
3
3
|
TypedEventBus
|
|
4
|
-
} from "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-PBENHIN2.js";
|
|
5
5
|
import {
|
|
6
6
|
eventRegistry,
|
|
7
7
|
getEventMetadata
|
|
8
|
-
} from "../../../../chunk-
|
|
8
|
+
} from "../../../../chunk-LQZESSM3.js";
|
|
9
9
|
import {
|
|
10
10
|
contactCreatedPayloadSchema,
|
|
11
11
|
contactMarkedChampionPayloadSchema,
|
|
@@ -14,9 +14,12 @@ import {
|
|
|
14
14
|
dealCreatedPayloadSchema,
|
|
15
15
|
dealStageChangedPayloadSchema,
|
|
16
16
|
eventPayloadSchemas,
|
|
17
|
+
messageCreatedPayloadSchema,
|
|
18
|
+
messageDeletedPayloadSchema,
|
|
19
|
+
messageEditedPayloadSchema,
|
|
17
20
|
stripePaymentReceivedPayloadSchema,
|
|
18
21
|
webhookOutboundContactSyncPayloadSchema
|
|
19
|
-
} from "../../../../chunk-
|
|
22
|
+
} from "../../../../chunk-MU54DZCC.js";
|
|
20
23
|
import "../../../../chunk-DUBZOXJC.js";
|
|
21
24
|
import "../../../../chunk-H5NH7KPE.js";
|
|
22
25
|
import "../../../../chunk-GYGNEQSC.js";
|
|
@@ -32,6 +35,9 @@ export {
|
|
|
32
35
|
eventPayloadSchemas,
|
|
33
36
|
eventRegistry,
|
|
34
37
|
getEventMetadata,
|
|
38
|
+
messageCreatedPayloadSchema,
|
|
39
|
+
messageDeletedPayloadSchema,
|
|
40
|
+
messageEditedPayloadSchema,
|
|
35
41
|
stripePaymentReceivedPayloadSchema,
|
|
36
42
|
webhookOutboundContactSyncPayloadSchema
|
|
37
43
|
};
|