@classytic/crm 1.1.0 → 1.2.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/dist/events.d.ts CHANGED
@@ -8,85 +8,109 @@ import "@classytic/primitives/outbox";
8
8
  import "@classytic/repo-core/tenant";
9
9
  //#region src/events/event-constants.d.ts
10
10
  /** PACKAGE_RULES rule 12: `package:resource.verb`. */
11
- declare const CRM_EVENTS: {
12
- readonly LEAD_CREATED: "crm:lead.created";
13
- readonly LEAD_STATUS_CHANGED: "crm:lead.status_changed";
14
- readonly LEAD_SCORED: "crm:lead.scored";
15
- readonly LEAD_CONVERTED: "crm:lead.converted";
16
- readonly LEAD_DISQUALIFIED: "crm:lead.disqualified";
17
- readonly ACCOUNT_CREATED: "crm:account.created";
18
- readonly ACCOUNT_UPDATED: "crm:account.updated";
19
- readonly CONTACT_CREATED: "crm:contact.created";
20
- readonly CONTACT_UPDATED: "crm:contact.updated";
21
- readonly OPPORTUNITY_CREATED: "crm:opportunity.created";
22
- readonly OPPORTUNITY_STAGE_ADVANCED: "crm:opportunity.stage_advanced";
23
- readonly OPPORTUNITY_STAGE_REGRESSED: "crm:opportunity.stage_regressed";
24
- readonly OPPORTUNITY_WON: "crm:opportunity.won";
25
- readonly OPPORTUNITY_LOST: "crm:opportunity.lost";
26
- readonly OPPORTUNITY_ABANDONED: "crm:opportunity.abandoned";
27
- readonly PIPELINE_CREATED: "crm:pipeline.created";
28
- readonly PIPELINE_ARCHIVED: "crm:pipeline.archived";
29
- readonly ACTIVITY_PLANNED: "crm:activity.planned";
30
- readonly ACTIVITY_COMPLETED: "crm:activity.completed";
31
- readonly ACTIVITY_CANCELLED: "crm:activity.cancelled";
32
- readonly NOTE_ADDED: "crm:note.added";
33
- readonly CAMPAIGN_CREATED: "crm:campaign.created";
34
- readonly CAMPAIGN_ACTIVATED: "crm:campaign.activated";
35
- readonly CAMPAIGN_PAUSED: "crm:campaign.paused";
36
- readonly CAMPAIGN_RESUMED: "crm:campaign.resumed";
37
- readonly CAMPAIGN_COMPLETED: "crm:campaign.completed";
38
- readonly CAMPAIGN_ARCHIVED: "crm:campaign.archived";
39
- readonly SUBSCRIPTION_CREATED: "crm:subscription.created";
40
- readonly SUBSCRIPTION_CONFIRMED: "crm:subscription.confirmed";
41
- readonly SUBSCRIPTION_UNSUBSCRIBED: "crm:subscription.unsubscribed";
42
- readonly SUBSCRIPTION_BOUNCED: "crm:subscription.bounced";
43
- readonly SUBSCRIPTION_COMPLAINED: "crm:subscription.complained";
44
- readonly SEQUENCE_CREATED: "crm:sequence.created";
45
- readonly SEQUENCE_ACTIVATED: "crm:sequence.active";
46
- readonly SEQUENCE_PAUSED: "crm:sequence.paused";
47
- readonly SEQUENCE_ARCHIVED: "crm:sequence.archived";
48
- readonly ENROLLMENT_CREATED: "crm:enrollment.created";
49
- readonly ENROLLMENT_STEP_SENT: "crm:enrollment.step_sent";
50
- readonly ENROLLMENT_PAUSED: "crm:enrollment.paused";
51
- readonly ENROLLMENT_RESUMED: "crm:enrollment.resumed";
52
- readonly ENROLLMENT_COMPLETED: "crm:enrollment.completed";
53
- readonly ENROLLMENT_EXITED: "crm:enrollment.exited";
54
- readonly EMAIL_EVENT_OPENED: "crm:email_event.opened";
55
- readonly EMAIL_EVENT_CLICKED: "crm:email_event.clicked";
56
- readonly EMAIL_EVENT_BOUNCED: "crm:email_event.bounced";
57
- readonly EMAIL_EVENT_COMPLAINED: "crm:email_event.complained";
58
- readonly EMAIL_EVENT_UNSUBSCRIBED: "crm:email_event.unsubscribed";
59
- readonly LEAD_ENRICHED: "crm:lead.enriched";
60
- readonly LEAD_ASSIGNED: "crm:lead.assigned";
61
- readonly LEAD_ANONYMIZED: "crm:lead.anonymized";
62
- readonly CONTACT_ENRICHED: "crm:contact.enriched";
63
- readonly CONTACT_ASSIGNED: "crm:contact.assigned";
64
- readonly CONTACT_MERGED: "crm:contact.merged";
65
- readonly CONTACT_ANONYMIZED: "crm:contact.anonymized";
66
- readonly ACCOUNT_ENRICHED: "crm:account.enriched";
67
- readonly ACCOUNT_ASSIGNED: "crm:account.assigned";
68
- readonly ACCOUNT_MERGED: "crm:account.merged";
69
- readonly OPPORTUNITY_ASSIGNED: "crm:opportunity.assigned";
70
- readonly OPPORTUNITY_AMOUNT_CHANGED: "crm:opportunity.amount_changed";
71
- readonly OPPORTUNITY_EXTENDED: "crm:opportunity.extended";
72
- readonly ACTIVITY_RESCHEDULED: "crm:activity.rescheduled";
73
- readonly ACTIVITY_OUTCOME_RECORDED: "crm:activity.outcome_recorded";
74
- readonly SUPPRESSION_ADDED: "crm:suppression.added";
75
- readonly SUPPRESSION_REMOVED: "crm:suppression.removed";
76
- readonly CONVERSATION_CREATED: "crm:conversation.created";
77
- readonly CONVERSATION_ASSIGNED: "crm:conversation.assigned";
78
- readonly CONVERSATION_RESOLVED: "crm:conversation.resolved";
79
- readonly CONVERSATION_REOPENED: "crm:conversation.reopened";
80
- readonly MESSAGE_RECEIVED: "crm:message.received";
81
- readonly MESSAGE_SENT: "crm:message.sent";
11
+ export declare const CRM_EVENTS: {
12
+ readonly LEAD_CREATED: 'crm:lead.created';
13
+ readonly LEAD_STATUS_CHANGED: 'crm:lead.status_changed';
14
+ readonly LEAD_SCORED: 'crm:lead.scored';
15
+ readonly LEAD_CONVERTED: 'crm:lead.converted';
16
+ readonly LEAD_DISQUALIFIED: 'crm:lead.disqualified';
17
+ readonly ACCOUNT_CREATED: 'crm:account.created';
18
+ readonly ACCOUNT_UPDATED: 'crm:account.updated';
19
+ readonly CONTACT_CREATED: 'crm:contact.created';
20
+ readonly CONTACT_UPDATED: 'crm:contact.updated';
21
+ readonly OPPORTUNITY_CREATED: 'crm:opportunity.created';
22
+ readonly OPPORTUNITY_STAGE_ADVANCED: 'crm:opportunity.stage_advanced';
23
+ readonly OPPORTUNITY_STAGE_REGRESSED: 'crm:opportunity.stage_regressed';
24
+ readonly OPPORTUNITY_WON: 'crm:opportunity.won';
25
+ readonly OPPORTUNITY_LOST: 'crm:opportunity.lost';
26
+ readonly OPPORTUNITY_ABANDONED: 'crm:opportunity.abandoned';
27
+ readonly PIPELINE_CREATED: 'crm:pipeline.created';
28
+ readonly PIPELINE_ARCHIVED: 'crm:pipeline.archived';
29
+ readonly ACTIVITY_PLANNED: 'crm:activity.planned';
30
+ readonly ACTIVITY_COMPLETED: 'crm:activity.completed';
31
+ readonly ACTIVITY_CANCELLED: 'crm:activity.cancelled';
32
+ readonly NOTE_ADDED: 'crm:note.added';
33
+ readonly CAMPAIGN_CREATED: 'crm:campaign.created';
34
+ readonly CAMPAIGN_ACTIVATED: 'crm:campaign.activated';
35
+ readonly CAMPAIGN_PAUSED: 'crm:campaign.paused';
36
+ readonly CAMPAIGN_RESUMED: 'crm:campaign.resumed';
37
+ readonly CAMPAIGN_COMPLETED: 'crm:campaign.completed';
38
+ readonly CAMPAIGN_ARCHIVED: 'crm:campaign.archived';
39
+ readonly SUBSCRIPTION_CREATED: 'crm:subscription.created';
40
+ readonly SUBSCRIPTION_CONFIRMED: 'crm:subscription.confirmed';
41
+ readonly SUBSCRIPTION_UNSUBSCRIBED: 'crm:subscription.unsubscribed';
42
+ readonly SUBSCRIPTION_BOUNCED: 'crm:subscription.bounced';
43
+ readonly SUBSCRIPTION_COMPLAINED: 'crm:subscription.complained';
44
+ readonly SEQUENCE_CREATED: 'crm:sequence.created';
45
+ readonly SEQUENCE_ACTIVATED: 'crm:sequence.active';
46
+ readonly SEQUENCE_PAUSED: 'crm:sequence.paused';
47
+ readonly SEQUENCE_ARCHIVED: 'crm:sequence.archived';
48
+ readonly ENROLLMENT_CREATED: 'crm:enrollment.created';
49
+ readonly ENROLLMENT_STEP_SENT: 'crm:enrollment.step_sent';
50
+ readonly ENROLLMENT_PAUSED: 'crm:enrollment.paused';
51
+ readonly ENROLLMENT_RESUMED: 'crm:enrollment.resumed';
52
+ readonly ENROLLMENT_COMPLETED: 'crm:enrollment.completed';
53
+ readonly ENROLLMENT_EXITED: 'crm:enrollment.exited';
54
+ readonly EMAIL_EVENT_OPENED: 'crm:email_event.opened';
55
+ readonly EMAIL_EVENT_CLICKED: 'crm:email_event.clicked';
56
+ readonly EMAIL_EVENT_BOUNCED: 'crm:email_event.bounced';
57
+ readonly EMAIL_EVENT_COMPLAINED: 'crm:email_event.complained';
58
+ readonly EMAIL_EVENT_UNSUBSCRIBED: 'crm:email_event.unsubscribed';
59
+ readonly LEAD_ENRICHED: 'crm:lead.enriched';
60
+ readonly LEAD_ASSIGNED: 'crm:lead.assigned';
61
+ readonly LEAD_ANONYMIZED: 'crm:lead.anonymized';
62
+ readonly CONTACT_ENRICHED: 'crm:contact.enriched';
63
+ readonly CONTACT_ASSIGNED: 'crm:contact.assigned';
64
+ readonly CONTACT_MERGED: 'crm:contact.merged';
65
+ readonly CONTACT_ANONYMIZED: 'crm:contact.anonymized';
66
+ readonly ACCOUNT_ENRICHED: 'crm:account.enriched';
67
+ readonly ACCOUNT_ASSIGNED: 'crm:account.assigned';
68
+ readonly ACCOUNT_MERGED: 'crm:account.merged';
69
+ readonly OPPORTUNITY_ASSIGNED: 'crm:opportunity.assigned';
70
+ readonly OPPORTUNITY_AMOUNT_CHANGED: 'crm:opportunity.amount_changed';
71
+ readonly OPPORTUNITY_EXTENDED: 'crm:opportunity.extended';
72
+ readonly ACTIVITY_RESCHEDULED: 'crm:activity.rescheduled';
73
+ readonly ACTIVITY_OUTCOME_RECORDED: 'crm:activity.outcome_recorded';
74
+ readonly SUPPRESSION_ADDED: 'crm:suppression.added';
75
+ readonly SUPPRESSION_REMOVED: 'crm:suppression.removed';
76
+ readonly CONVERSATION_CREATED: 'crm:conversation.created';
77
+ readonly CONVERSATION_ASSIGNED: 'crm:conversation.assigned';
78
+ readonly CONVERSATION_RESOLVED: 'crm:conversation.resolved';
79
+ readonly CONVERSATION_REOPENED: 'crm:conversation.reopened';
80
+ readonly MESSAGE_RECEIVED: 'crm:message.received';
81
+ readonly MESSAGE_SENT: 'crm:message.sent';
82
82
  };
83
- type CrmEventName = (typeof CRM_EVENTS)[keyof typeof CRM_EVENTS];
83
+ export type CrmEventName = (typeof CRM_EVENTS)[keyof typeof CRM_EVENTS];
84
84
  //#endregion
85
85
  //#region src/events/event-catalog.d.ts
86
- /** JSON-Schema object produced by `z.toJSONSchema` — what arc's registry consumes. */
87
- type CrmEventSchema = Record<string, unknown>;
88
- /** Structurally identical to arc's `EventDefinitionOutput` — do NOT import arc. */
89
- interface CrmEventDefinition<TSchema extends z.ZodType = z.ZodType> {
86
+ /**
87
+ * JSON-Schema object produced by `z.toJSONSchema` — what arc's registry consumes.
88
+ *
89
+ * `type` is DECLARED. This was `Record<string, unknown>`, which is neither what
90
+ * `z.toJSONSchema` returns for an object schema nor what arc's `EventSchema`
91
+ * accepts — arc requires `type: 'object'`. So the comment below claiming
92
+ * structural identity with arc's `EventDefinitionOutput` was false, and a host
93
+ * registering this catalog got a type error whose only cheap escapes were a
94
+ * cast or re-declaring the events locally. Every runtime value already carries
95
+ * `type: 'object'`; only the declaration was loose.
96
+ *
97
+ * Same fix, same reason, as `@classytic/transfer`'s `TransferEventSchema` —
98
+ * read the note there. Enforcement is at the CONSUMER: be-prod's
99
+ * `shared/event-registry.ts` hands these straight to arc, so drift fails that
100
+ * build. A kernel must not import arc, which is why the claim can only be
101
+ * checked where both are visible.
102
+ */
103
+ export interface CrmEventSchema {
104
+ type: 'object';
105
+ properties?: Record<string, {
106
+ type?: string;
107
+ [key: string]: unknown;
108
+ }>;
109
+ required?: string[];
110
+ [key: string]: unknown;
111
+ }
112
+ /** Structurally assignable to arc's `EventDefinitionOutput` — do NOT import arc. */
113
+ export interface CrmEventDefinition<TSchema extends z.ZodType = z.ZodType> {
90
114
  name: CrmEventName;
91
115
  version: number;
92
116
  description: string;
@@ -94,62 +118,62 @@ interface CrmEventDefinition<TSchema extends z.ZodType = z.ZodType> {
94
118
  schema: CrmEventSchema;
95
119
  create(payload: z.infer<TSchema>, meta?: Partial<EventMeta>): DomainEvent<z.infer<TSchema>>;
96
120
  }
97
- declare const LeadCreated: CrmEventDefinition<z.ZodObject<{
121
+ export declare const LeadCreated: CrmEventDefinition<z.ZodObject<{
98
122
  leadId: z.ZodString;
99
123
  email: z.ZodOptional<z.ZodString>;
100
124
  score: z.ZodNumber;
101
125
  }, z.core.$strip>>;
102
- declare const LeadStatusChanged: CrmEventDefinition<z.ZodObject<{
126
+ export declare const LeadStatusChanged: CrmEventDefinition<z.ZodObject<{
103
127
  leadId: z.ZodString;
104
128
  from: z.ZodString;
105
129
  to: z.ZodString;
106
130
  }, z.core.$strip>>;
107
- declare const LeadScored: CrmEventDefinition<z.ZodObject<{
131
+ export declare const LeadScored: CrmEventDefinition<z.ZodObject<{
108
132
  leadId: z.ZodString;
109
133
  score: z.ZodNumber;
110
134
  }, z.core.$strip>>;
111
- declare const LeadConverted: CrmEventDefinition<z.ZodObject<{
135
+ export declare const LeadConverted: CrmEventDefinition<z.ZodObject<{
112
136
  leadId: z.ZodString;
113
137
  contactId: z.ZodString;
114
138
  accountId: z.ZodOptional<z.ZodString>;
115
139
  opportunityId: z.ZodString;
116
140
  }, z.core.$strip>>;
117
- declare const LeadDisqualified: CrmEventDefinition<z.ZodObject<{
141
+ export declare const LeadDisqualified: CrmEventDefinition<z.ZodObject<{
118
142
  leadId: z.ZodString;
119
143
  reason: z.ZodString;
120
144
  }, z.core.$strip>>;
121
- declare const LeadEnriched: CrmEventDefinition<z.ZodObject<{
122
- leadId: z.ZodString;
145
+ export declare const LeadEnriched: CrmEventDefinition<z.ZodObject<{
123
146
  fields: z.ZodArray<z.ZodString>;
124
147
  provider: z.ZodOptional<z.ZodString>;
125
- }, z.core.$strip>>;
126
- declare const LeadAssigned: CrmEventDefinition<z.ZodObject<{
127
148
  leadId: z.ZodString;
149
+ }, z.core.$strip>>;
150
+ export declare const LeadAssigned: CrmEventDefinition<z.ZodObject<{
128
151
  ownerId: z.ZodString;
129
152
  previousOwnerId: z.ZodOptional<z.ZodString>;
153
+ leadId: z.ZodString;
130
154
  }, z.core.$strip>>;
131
- declare const LeadAnonymized: CrmEventDefinition<z.ZodObject<{
155
+ export declare const LeadAnonymized: CrmEventDefinition<z.ZodObject<{
132
156
  leadId: z.ZodString;
133
157
  fields: z.ZodArray<z.ZodString>;
134
158
  }, z.core.$strip>>;
135
- declare const AccountCreated: CrmEventDefinition<z.ZodObject<{
159
+ export declare const AccountCreated: CrmEventDefinition<z.ZodObject<{
136
160
  accountId: z.ZodString;
137
161
  name: z.ZodString;
138
162
  }, z.core.$strip>>;
139
- declare const AccountUpdated: CrmEventDefinition<z.ZodObject<{
163
+ export declare const AccountUpdated: CrmEventDefinition<z.ZodObject<{
140
164
  accountId: z.ZodString;
141
165
  }, z.core.$strip>>;
142
- declare const AccountEnriched: CrmEventDefinition<z.ZodObject<{
143
- accountId: z.ZodString;
166
+ export declare const AccountEnriched: CrmEventDefinition<z.ZodObject<{
144
167
  fields: z.ZodArray<z.ZodString>;
145
168
  provider: z.ZodOptional<z.ZodString>;
146
- }, z.core.$strip>>;
147
- declare const AccountAssigned: CrmEventDefinition<z.ZodObject<{
148
169
  accountId: z.ZodString;
170
+ }, z.core.$strip>>;
171
+ export declare const AccountAssigned: CrmEventDefinition<z.ZodObject<{
149
172
  ownerId: z.ZodString;
150
173
  previousOwnerId: z.ZodOptional<z.ZodString>;
174
+ accountId: z.ZodString;
151
175
  }, z.core.$strip>>;
152
- declare const AccountMerged: CrmEventDefinition<z.ZodObject<{
176
+ export declare const AccountMerged: CrmEventDefinition<z.ZodObject<{
153
177
  primaryId: z.ZodString;
154
178
  secondaryId: z.ZodString;
155
179
  strategy: z.ZodEnum<{
@@ -157,24 +181,24 @@ declare const AccountMerged: CrmEventDefinition<z.ZodObject<{
157
181
  preferSecondary: "preferSecondary";
158
182
  }>;
159
183
  }, z.core.$strip>>;
160
- declare const ContactCreated: CrmEventDefinition<z.ZodObject<{
184
+ export declare const ContactCreated: CrmEventDefinition<z.ZodObject<{
161
185
  contactId: z.ZodString;
162
186
  email: z.ZodOptional<z.ZodString>;
163
187
  }, z.core.$strip>>;
164
- declare const ContactUpdated: CrmEventDefinition<z.ZodObject<{
188
+ export declare const ContactUpdated: CrmEventDefinition<z.ZodObject<{
165
189
  contactId: z.ZodString;
166
190
  }, z.core.$strip>>;
167
- declare const ContactEnriched: CrmEventDefinition<z.ZodObject<{
168
- contactId: z.ZodString;
191
+ export declare const ContactEnriched: CrmEventDefinition<z.ZodObject<{
169
192
  fields: z.ZodArray<z.ZodString>;
170
193
  provider: z.ZodOptional<z.ZodString>;
171
- }, z.core.$strip>>;
172
- declare const ContactAssigned: CrmEventDefinition<z.ZodObject<{
173
194
  contactId: z.ZodString;
195
+ }, z.core.$strip>>;
196
+ export declare const ContactAssigned: CrmEventDefinition<z.ZodObject<{
174
197
  ownerId: z.ZodString;
175
198
  previousOwnerId: z.ZodOptional<z.ZodString>;
199
+ contactId: z.ZodString;
176
200
  }, z.core.$strip>>;
177
- declare const ContactMerged: CrmEventDefinition<z.ZodObject<{
201
+ export declare const ContactMerged: CrmEventDefinition<z.ZodObject<{
178
202
  primaryId: z.ZodString;
179
203
  secondaryId: z.ZodString;
180
204
  strategy: z.ZodEnum<{
@@ -182,16 +206,16 @@ declare const ContactMerged: CrmEventDefinition<z.ZodObject<{
182
206
  preferSecondary: "preferSecondary";
183
207
  }>;
184
208
  }, z.core.$strip>>;
185
- declare const ContactAnonymized: CrmEventDefinition<z.ZodObject<{
209
+ export declare const ContactAnonymized: CrmEventDefinition<z.ZodObject<{
186
210
  contactId: z.ZodString;
187
211
  fields: z.ZodArray<z.ZodString>;
188
212
  }, z.core.$strip>>;
189
- declare const OpportunityCreated: CrmEventDefinition<z.ZodObject<{
213
+ export declare const OpportunityCreated: CrmEventDefinition<z.ZodObject<{
190
214
  opportunityId: z.ZodString;
191
215
  pipelineId: z.ZodString;
192
216
  stageId: z.ZodString;
193
217
  }, z.core.$strip>>;
194
- declare const OpportunityStageAdvanced: CrmEventDefinition<z.ZodObject<{
218
+ export declare const OpportunityStageAdvanced: CrmEventDefinition<z.ZodObject<{
195
219
  opportunityId: z.ZodString;
196
220
  from: z.ZodObject<{
197
221
  stageId: z.ZodString;
@@ -202,7 +226,7 @@ declare const OpportunityStageAdvanced: CrmEventDefinition<z.ZodObject<{
202
226
  sequence: z.ZodNumber;
203
227
  }, z.core.$strip>;
204
228
  }, z.core.$strip>>;
205
- declare const OpportunityStageRegressed: CrmEventDefinition<z.ZodObject<{
229
+ export declare const OpportunityStageRegressed: CrmEventDefinition<z.ZodObject<{
206
230
  opportunityId: z.ZodString;
207
231
  from: z.ZodObject<{
208
232
  stageId: z.ZodString;
@@ -213,242 +237,242 @@ declare const OpportunityStageRegressed: CrmEventDefinition<z.ZodObject<{
213
237
  sequence: z.ZodNumber;
214
238
  }, z.core.$strip>;
215
239
  }, z.core.$strip>>;
216
- declare const OpportunityWon: CrmEventDefinition<z.ZodObject<{
240
+ export declare const OpportunityWon: CrmEventDefinition<z.ZodObject<{
217
241
  opportunityId: z.ZodString;
218
242
  amount: z.ZodOptional<z.ZodNumber>;
219
243
  }, z.core.$strip>>;
220
- declare const OpportunityLost: CrmEventDefinition<z.ZodObject<{
244
+ export declare const OpportunityLost: CrmEventDefinition<z.ZodObject<{
221
245
  opportunityId: z.ZodString;
222
246
  lostReasonId: z.ZodOptional<z.ZodString>;
223
247
  }, z.core.$strip>>;
224
- declare const OpportunityAbandoned: CrmEventDefinition<z.ZodObject<{
248
+ export declare const OpportunityAbandoned: CrmEventDefinition<z.ZodObject<{
225
249
  opportunityId: z.ZodString;
226
250
  }, z.core.$strip>>;
227
- declare const OpportunityAssigned: CrmEventDefinition<z.ZodObject<{
228
- opportunityId: z.ZodString;
251
+ export declare const OpportunityAssigned: CrmEventDefinition<z.ZodObject<{
229
252
  ownerId: z.ZodString;
230
253
  previousOwnerId: z.ZodOptional<z.ZodString>;
254
+ opportunityId: z.ZodString;
231
255
  }, z.core.$strip>>;
232
- declare const OpportunityAmountChanged: CrmEventDefinition<z.ZodObject<{
256
+ export declare const OpportunityAmountChanged: CrmEventDefinition<z.ZodObject<{
233
257
  opportunityId: z.ZodString;
234
258
  amount: z.ZodNumber;
235
259
  previousAmount: z.ZodOptional<z.ZodNumber>;
236
260
  reason: z.ZodOptional<z.ZodString>;
237
261
  by: z.ZodOptional<z.ZodString>;
238
262
  }, z.core.$strip>>;
239
- declare const OpportunityExtended: CrmEventDefinition<z.ZodObject<{
263
+ export declare const OpportunityExtended: CrmEventDefinition<z.ZodObject<{
240
264
  opportunityId: z.ZodString;
241
265
  expectedCloseAt: z.ZodISODateTime;
242
266
  previousExpectedCloseAt: z.ZodOptional<z.ZodISODateTime>;
243
267
  reason: z.ZodOptional<z.ZodString>;
244
268
  by: z.ZodOptional<z.ZodString>;
245
269
  }, z.core.$strip>>;
246
- declare const PipelineCreated: CrmEventDefinition<z.ZodObject<{
270
+ export declare const PipelineCreated: CrmEventDefinition<z.ZodObject<{
247
271
  pipelineId: z.ZodString;
248
272
  }, z.core.$strip>>;
249
- declare const PipelineArchived: CrmEventDefinition<z.ZodObject<{
273
+ export declare const PipelineArchived: CrmEventDefinition<z.ZodObject<{
250
274
  pipelineId: z.ZodString;
251
275
  }, z.core.$strip>>;
252
- declare const ActivityPlanned: CrmEventDefinition<z.ZodObject<{
276
+ export declare const ActivityPlanned: CrmEventDefinition<z.ZodObject<{
253
277
  activityId: z.ZodString;
254
278
  type: z.ZodString;
255
279
  subjectKind: z.ZodString;
256
280
  subjectId: z.ZodString;
257
281
  }, z.core.$strip>>;
258
- declare const ActivityCompleted: CrmEventDefinition<z.ZodObject<{
282
+ export declare const ActivityCompleted: CrmEventDefinition<z.ZodObject<{
259
283
  activityId: z.ZodString;
260
284
  completedAt: z.ZodISODateTime;
261
285
  }, z.core.$strip>>;
262
- declare const ActivityCancelled: CrmEventDefinition<z.ZodObject<{
286
+ export declare const ActivityCancelled: CrmEventDefinition<z.ZodObject<{
263
287
  activityId: z.ZodString;
264
288
  reason: z.ZodOptional<z.ZodString>;
265
289
  }, z.core.$strip>>;
266
- declare const ActivityRescheduled: CrmEventDefinition<z.ZodObject<{
290
+ export declare const ActivityRescheduled: CrmEventDefinition<z.ZodObject<{
267
291
  activityId: z.ZodString;
268
292
  dueDate: z.ZodISODateTime;
269
293
  previousDueDate: z.ZodOptional<z.ZodISODateTime>;
270
294
  reason: z.ZodOptional<z.ZodString>;
271
295
  by: z.ZodOptional<z.ZodString>;
272
296
  }, z.core.$strip>>;
273
- declare const ActivityOutcomeRecorded: CrmEventDefinition<z.ZodObject<{
297
+ export declare const ActivityOutcomeRecorded: CrmEventDefinition<z.ZodObject<{
274
298
  activityId: z.ZodString;
275
299
  outcome: z.ZodRecord<z.ZodString, z.ZodUnknown>;
276
300
  }, z.core.$strip>>;
277
- declare const NoteAdded: CrmEventDefinition<z.ZodObject<{
301
+ export declare const NoteAdded: CrmEventDefinition<z.ZodObject<{
278
302
  noteId: z.ZodString;
279
303
  subjectKind: z.ZodString;
280
304
  subjectId: z.ZodString;
281
305
  }, z.core.$strip>>;
282
- declare const CampaignCreated: CrmEventDefinition<z.ZodObject<{
306
+ export declare const CampaignCreated: CrmEventDefinition<z.ZodObject<{
283
307
  campaignId: z.ZodString;
284
308
  name: z.ZodString;
285
309
  }, z.core.$strip>>;
286
- declare const CampaignActivated: CrmEventDefinition<z.ZodObject<{
310
+ export declare const CampaignActivated: CrmEventDefinition<z.ZodObject<{
287
311
  campaignId: z.ZodString;
288
312
  }, z.core.$strip>>;
289
- declare const CampaignPaused: CrmEventDefinition<z.ZodObject<{
313
+ export declare const CampaignPaused: CrmEventDefinition<z.ZodObject<{
290
314
  campaignId: z.ZodString;
291
315
  reason: z.ZodOptional<z.ZodString>;
292
316
  }, z.core.$strip>>;
293
- declare const CampaignResumed: CrmEventDefinition<z.ZodObject<{
317
+ export declare const CampaignResumed: CrmEventDefinition<z.ZodObject<{
294
318
  campaignId: z.ZodString;
295
319
  }, z.core.$strip>>;
296
- declare const CampaignCompleted: CrmEventDefinition<z.ZodObject<{
320
+ export declare const CampaignCompleted: CrmEventDefinition<z.ZodObject<{
297
321
  campaignId: z.ZodString;
298
322
  actualRevenueAmount: z.ZodOptional<z.ZodNumber>;
299
323
  }, z.core.$strip>>;
300
- declare const CampaignArchived: CrmEventDefinition<z.ZodObject<{
324
+ export declare const CampaignArchived: CrmEventDefinition<z.ZodObject<{
301
325
  campaignId: z.ZodString;
302
326
  }, z.core.$strip>>;
303
- declare const SubscriptionCreated: CrmEventDefinition<z.ZodObject<{
327
+ export declare const SubscriptionCreated: CrmEventDefinition<z.ZodObject<{
304
328
  subscriptionId: z.ZodString;
305
329
  contactId: z.ZodString;
306
330
  campaignId: z.ZodString;
307
331
  requiresConfirmation: z.ZodBoolean;
308
332
  }, z.core.$strip>>;
309
- declare const SubscriptionConfirmed: CrmEventDefinition<z.ZodObject<{
333
+ export declare const SubscriptionConfirmed: CrmEventDefinition<z.ZodObject<{
310
334
  subscriptionId: z.ZodString;
311
335
  contactId: z.ZodString;
312
336
  campaignId: z.ZodString;
313
337
  confirmedAt: z.ZodISODateTime;
314
338
  }, z.core.$strip>>;
315
- declare const SubscriptionUnsubscribed: CrmEventDefinition<z.ZodObject<{
339
+ export declare const SubscriptionUnsubscribed: CrmEventDefinition<z.ZodObject<{
316
340
  subscriptionId: z.ZodString;
317
341
  contactId: z.ZodString;
318
342
  campaignId: z.ZodString;
319
343
  reason: z.ZodOptional<z.ZodString>;
320
344
  }, z.core.$strip>>;
321
- declare const SubscriptionBounced: CrmEventDefinition<z.ZodObject<{
345
+ export declare const SubscriptionBounced: CrmEventDefinition<z.ZodObject<{
322
346
  subscriptionId: z.ZodString;
323
347
  contactId: z.ZodString;
324
348
  campaignId: z.ZodString;
325
349
  reason: z.ZodOptional<z.ZodString>;
326
350
  }, z.core.$strip>>;
327
- declare const SubscriptionComplained: CrmEventDefinition<z.ZodObject<{
351
+ export declare const SubscriptionComplained: CrmEventDefinition<z.ZodObject<{
328
352
  subscriptionId: z.ZodString;
329
353
  contactId: z.ZodString;
330
354
  campaignId: z.ZodString;
331
355
  }, z.core.$strip>>;
332
- declare const SuppressionAdded: CrmEventDefinition<z.ZodObject<{
356
+ export declare const SuppressionAdded: CrmEventDefinition<z.ZodObject<{
333
357
  email: z.ZodString;
334
358
  reason: z.ZodEnum<{
335
359
  bounce: "bounce";
336
360
  complaint: "complaint";
337
- unsubscribe: "unsubscribe";
338
361
  manual: "manual";
362
+ unsubscribe: "unsubscribe";
339
363
  }>;
340
364
  source: z.ZodOptional<z.ZodString>;
341
365
  }, z.core.$strip>>;
342
- declare const SuppressionRemoved: CrmEventDefinition<z.ZodObject<{
366
+ export declare const SuppressionRemoved: CrmEventDefinition<z.ZodObject<{
343
367
  email: z.ZodString;
344
368
  }, z.core.$strip>>;
345
- declare const EmailEventOpened: CrmEventDefinition<z.ZodObject<{
369
+ export declare const EmailEventOpened: CrmEventDefinition<z.ZodObject<{
346
370
  eventId: z.ZodString;
347
371
  kind: z.ZodString;
348
372
  subjectKind: z.ZodString;
349
373
  subjectId: z.ZodString;
350
374
  campaignId: z.ZodOptional<z.ZodString>;
351
375
  }, z.core.$strip>>;
352
- declare const EmailEventClicked: CrmEventDefinition<z.ZodObject<{
376
+ export declare const EmailEventClicked: CrmEventDefinition<z.ZodObject<{
353
377
  eventId: z.ZodString;
354
378
  kind: z.ZodString;
355
379
  subjectKind: z.ZodString;
356
380
  subjectId: z.ZodString;
357
381
  campaignId: z.ZodOptional<z.ZodString>;
358
382
  }, z.core.$strip>>;
359
- declare const EmailEventBounced: CrmEventDefinition<z.ZodObject<{
383
+ export declare const EmailEventBounced: CrmEventDefinition<z.ZodObject<{
360
384
  eventId: z.ZodString;
361
385
  kind: z.ZodString;
362
386
  subjectKind: z.ZodString;
363
387
  subjectId: z.ZodString;
364
388
  campaignId: z.ZodOptional<z.ZodString>;
365
389
  }, z.core.$strip>>;
366
- declare const EmailEventComplained: CrmEventDefinition<z.ZodObject<{
390
+ export declare const EmailEventComplained: CrmEventDefinition<z.ZodObject<{
367
391
  eventId: z.ZodString;
368
392
  kind: z.ZodString;
369
393
  subjectKind: z.ZodString;
370
394
  subjectId: z.ZodString;
371
395
  campaignId: z.ZodOptional<z.ZodString>;
372
396
  }, z.core.$strip>>;
373
- declare const EmailEventUnsubscribed: CrmEventDefinition<z.ZodObject<{
397
+ export declare const EmailEventUnsubscribed: CrmEventDefinition<z.ZodObject<{
374
398
  eventId: z.ZodString;
375
399
  kind: z.ZodString;
376
400
  subjectKind: z.ZodString;
377
401
  subjectId: z.ZodString;
378
402
  campaignId: z.ZodOptional<z.ZodString>;
379
403
  }, z.core.$strip>>;
380
- declare const ConversationCreated: CrmEventDefinition<z.ZodObject<{
404
+ export declare const ConversationCreated: CrmEventDefinition<z.ZodObject<{
381
405
  conversationId: z.ZodString;
382
406
  channel: z.ZodString;
383
407
  participantKind: z.ZodString;
384
408
  participantId: z.ZodString;
385
409
  }, z.core.$strip>>;
386
- declare const ConversationAssigned: CrmEventDefinition<z.ZodObject<{
410
+ export declare const ConversationAssigned: CrmEventDefinition<z.ZodObject<{
387
411
  conversationId: z.ZodString;
388
412
  assigneeId: z.ZodString;
389
413
  previousAssigneeId: z.ZodOptional<z.ZodString>;
390
414
  }, z.core.$strip>>;
391
- declare const ConversationResolved: CrmEventDefinition<z.ZodObject<{
415
+ export declare const ConversationResolved: CrmEventDefinition<z.ZodObject<{
392
416
  conversationId: z.ZodString;
393
417
  status: z.ZodString;
394
418
  previousStatus: z.ZodString;
395
419
  }, z.core.$strip>>;
396
- declare const ConversationReopened: CrmEventDefinition<z.ZodObject<{
420
+ export declare const ConversationReopened: CrmEventDefinition<z.ZodObject<{
397
421
  conversationId: z.ZodString;
398
422
  status: z.ZodString;
399
423
  previousStatus: z.ZodString;
400
424
  }, z.core.$strip>>;
401
- declare const MessageReceived: CrmEventDefinition<z.ZodObject<{
425
+ export declare const MessageReceived: CrmEventDefinition<z.ZodObject<{
402
426
  messageId: z.ZodString;
403
427
  conversationId: z.ZodString;
404
428
  direction: z.ZodString;
405
429
  externalMessageId: z.ZodOptional<z.ZodString>;
406
430
  }, z.core.$strip>>;
407
- declare const MessageSent: CrmEventDefinition<z.ZodObject<{
431
+ export declare const MessageSent: CrmEventDefinition<z.ZodObject<{
408
432
  messageId: z.ZodString;
409
433
  conversationId: z.ZodString;
410
434
  direction: z.ZodString;
411
435
  externalMessageId: z.ZodOptional<z.ZodString>;
412
436
  }, z.core.$strip>>;
413
- declare const SequenceCreated: CrmEventDefinition<z.ZodObject<{
437
+ export declare const SequenceCreated: CrmEventDefinition<z.ZodObject<{
414
438
  sequenceId: z.ZodString;
415
439
  name: z.ZodOptional<z.ZodString>;
416
440
  }, z.core.$strip>>;
417
- declare const SequenceActivated: CrmEventDefinition<z.ZodObject<{
441
+ export declare const SequenceActivated: CrmEventDefinition<z.ZodObject<{
418
442
  sequenceId: z.ZodString;
419
443
  }, z.core.$strip>>;
420
- declare const SequencePaused: CrmEventDefinition<z.ZodObject<{
444
+ export declare const SequencePaused: CrmEventDefinition<z.ZodObject<{
421
445
  sequenceId: z.ZodString;
422
446
  }, z.core.$strip>>;
423
- declare const SequenceArchived: CrmEventDefinition<z.ZodObject<{
447
+ export declare const SequenceArchived: CrmEventDefinition<z.ZodObject<{
424
448
  sequenceId: z.ZodString;
425
449
  }, z.core.$strip>>;
426
- declare const EnrollmentCreated: CrmEventDefinition<z.ZodObject<{
450
+ export declare const EnrollmentCreated: CrmEventDefinition<z.ZodObject<{
427
451
  enrollmentId: z.ZodString;
428
452
  sequenceId: z.ZodString;
429
453
  subjectId: z.ZodString;
430
454
  subjectKind: z.ZodString;
431
455
  }, z.core.$strip>>;
432
- declare const EnrollmentStepSent: CrmEventDefinition<z.ZodObject<{
456
+ export declare const EnrollmentStepSent: CrmEventDefinition<z.ZodObject<{
433
457
  enrollmentId: z.ZodString;
434
458
  sequenceId: z.ZodOptional<z.ZodString>;
435
459
  stepIndex: z.ZodNumber;
436
460
  channel: z.ZodOptional<z.ZodString>;
437
461
  }, z.core.$strip>>;
438
- declare const EnrollmentPaused: CrmEventDefinition<z.ZodObject<{
462
+ export declare const EnrollmentPaused: CrmEventDefinition<z.ZodObject<{
439
463
  enrollmentId: z.ZodString;
440
464
  }, z.core.$strip>>;
441
- declare const EnrollmentResumed: CrmEventDefinition<z.ZodObject<{
465
+ export declare const EnrollmentResumed: CrmEventDefinition<z.ZodObject<{
442
466
  enrollmentId: z.ZodString;
443
467
  }, z.core.$strip>>;
444
- declare const EnrollmentCompleted: CrmEventDefinition<z.ZodObject<{
468
+ export declare const EnrollmentCompleted: CrmEventDefinition<z.ZodObject<{
445
469
  enrollmentId: z.ZodString;
446
470
  }, z.core.$strip>>;
447
- declare const EnrollmentExited: CrmEventDefinition<z.ZodObject<{
471
+ export declare const EnrollmentExited: CrmEventDefinition<z.ZodObject<{
448
472
  enrollmentId: z.ZodString;
449
473
  exitReason: z.ZodOptional<z.ZodString>;
450
474
  }, z.core.$strip>>;
451
- declare const crmEventDefinitions: ReadonlyArray<CrmEventDefinition>;
475
+ export declare const crmEventDefinitions: ReadonlyArray<CrmEventDefinition>;
452
476
  //#endregion
453
477
  //#region src/engine/engine-types.d.ts
454
478
  interface CrmLogger {
@@ -471,13 +495,13 @@ interface CrmContext extends OperationContext {
471
495
  }
472
496
  //#endregion
473
497
  //#region src/events/helpers.d.ts
474
- declare function createEvent<T>(type: string, payload: T, ctx?: CrmContext, meta?: Partial<EventMeta>): DomainEvent<T>;
498
+ export declare function createEvent<T>(type: string, payload: T, ctx?: CrmContext, meta?: Partial<EventMeta>): DomainEvent<T>;
475
499
  //#endregion
476
500
  //#region src/events/in-process-bus.d.ts
477
- declare class InProcessCrmBus extends InProcessEventBus {
501
+ export declare class InProcessCrmBus extends InProcessEventBus {
478
502
  constructor(options?: {
479
503
  logger?: CrmLogger;
480
504
  });
481
505
  }
482
506
  //#endregion
483
- export { AccountAssigned, AccountCreated, AccountEnriched, AccountMerged, AccountUpdated, ActivityCancelled, ActivityCompleted, ActivityOutcomeRecorded, ActivityPlanned, ActivityRescheduled, CRM_EVENTS, CampaignActivated, CampaignArchived, CampaignCompleted, CampaignCreated, CampaignPaused, CampaignResumed, ContactAnonymized, ContactAssigned, ContactCreated, ContactEnriched, ContactMerged, ContactUpdated, ConversationAssigned, ConversationCreated, ConversationReopened, ConversationResolved, CrmEventDefinition, CrmEventName, CrmEventSchema, EmailEventBounced, EmailEventClicked, EmailEventComplained, EmailEventOpened, EmailEventUnsubscribed, EnrollmentCompleted, EnrollmentCreated, EnrollmentExited, EnrollmentPaused, EnrollmentResumed, EnrollmentStepSent, InProcessCrmBus, LeadAnonymized, LeadAssigned, LeadConverted, LeadCreated, LeadDisqualified, LeadEnriched, LeadScored, LeadStatusChanged, MessageReceived, MessageSent, NoteAdded, OpportunityAbandoned, OpportunityAmountChanged, OpportunityAssigned, OpportunityCreated, OpportunityExtended, OpportunityLost, OpportunityStageAdvanced, OpportunityStageRegressed, OpportunityWon, PipelineArchived, PipelineCreated, SequenceActivated, SequenceArchived, SequenceCreated, SequencePaused, SubscriptionBounced, SubscriptionComplained, SubscriptionConfirmed, SubscriptionCreated, SubscriptionUnsubscribed, SuppressionAdded, SuppressionRemoved, createEvent, crmEventDefinitions };
507
+ export {};