@happyvertical/smrt-sales 0.40.69 → 0.40.70

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.
@@ -2,195 +2,308 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-sales",
5
- "packageVersion": "0.40.69",
5
+ "packageVersion": "0.40.70",
6
6
  "objects": {
7
- "@happyvertical/smrt-sales:AgreementExecutionCollection": {
8
- "name": "agreementexecutioncollection",
9
- "className": "AgreementExecutionCollection",
10
- "qualifiedName": "@happyvertical/smrt-sales:AgreementExecutionCollection",
7
+ "@happyvertical/smrt-sales:AgreementExecution": {
8
+ "name": "agreementexecution",
9
+ "className": "AgreementExecution",
10
+ "qualifiedName": "@happyvertical/smrt-sales:AgreementExecution",
11
11
  "collection": "agreementexecutions",
12
- "filePath": "/home/runner/_work/smrt/smrt/packages/sales/src/agreements/collections/AgreementExecutionCollection.ts",
12
+ "filePath": "/home/runner/_work/smrt/smrt/packages/sales/src/agreements/models/AgreementExecution.ts",
13
13
  "packageName": "@happyvertical/smrt-sales",
14
- "fields": {},
15
- "methods": {
16
- "findByIdempotencyKey": {
17
- "name": "findByIdempotencyKey",
18
- "async": true,
19
- "parameters": [
20
- {
21
- "name": "idempotencyKey",
22
- "type": "string",
23
- "optional": false
14
+ "fields": {
15
+ "tenantId": {
16
+ "type": "text",
17
+ "required": true,
18
+ "_meta": {
19
+ "sqlType": "UUID",
20
+ "__tenancy": {
21
+ "isTenantIdField": true,
22
+ "autoFilter": true,
23
+ "required": true,
24
+ "autoPopulate": true,
25
+ "nullable": false,
26
+ "mode": "required",
27
+ "field": "tenantId",
28
+ "allowSuperAdminBypass": false
24
29
  }
25
- ],
26
- "returnType": "Promise<AgreementExecution | null>",
27
- "isStatic": false,
28
- "isPublic": true
30
+ }
29
31
  },
30
- "findByProviderRequest": {
31
- "name": "findByProviderRequest",
32
- "async": true,
33
- "parameters": [
34
- {
35
- "name": "provider",
36
- "type": "string",
37
- "optional": false
38
- },
39
- {
40
- "name": "providerRequestId",
41
- "type": "string",
42
- "optional": false
43
- }
44
- ],
45
- "returnType": "Promise<AgreementExecution | null>",
46
- "isStatic": false,
47
- "isPublic": true
32
+ "provider": {
33
+ "type": "text",
34
+ "required": true,
35
+ "default": "",
36
+ "_meta": {
37
+ "required": true
38
+ }
48
39
  },
49
- "claimCreateAttempt": {
50
- "name": "claimCreateAttempt",
51
- "async": true,
52
- "parameters": [
53
- {
54
- "name": "input",
55
- "type": "ClaimAgreementCreateAttemptInput",
56
- "optional": false
57
- }
58
- ],
59
- "returnType": "Promise<AgreementExecution | null>",
60
- "isStatic": false,
61
- "isPublic": true
40
+ "providerAccountRef": {
41
+ "type": "text",
42
+ "required": false,
43
+ "default": ""
62
44
  },
63
- "completeCreateAttempt": {
64
- "name": "completeCreateAttempt",
65
- "async": true,
66
- "parameters": [
67
- {
68
- "name": "input",
69
- "type": "CompleteAgreementCreateAttemptInput",
70
- "optional": false
71
- }
72
- ],
73
- "returnType": "Promise<AgreementExecution | null>",
74
- "isStatic": false,
75
- "isPublic": true
45
+ "credentialRef": {
46
+ "type": "text",
47
+ "required": false,
48
+ "default": ""
76
49
  },
77
- "failCreateAttempt": {
78
- "name": "failCreateAttempt",
79
- "async": true,
80
- "parameters": [
81
- {
82
- "name": "input",
83
- "type": "FailAgreementCreateAttemptInput",
84
- "optional": false
85
- }
86
- ],
87
- "returnType": "Promise<AgreementExecution | null>",
88
- "isStatic": false,
89
- "isPublic": true
50
+ "idempotencyKey": {
51
+ "type": "text",
52
+ "required": true,
53
+ "default": "",
54
+ "_meta": {
55
+ "required": true
56
+ }
90
57
  },
91
- "bindProviderRequest": {
92
- "name": "bindProviderRequest",
93
- "async": true,
94
- "parameters": [
95
- {
96
- "name": "input",
97
- "type": "BindAgreementProviderRequestInput",
98
- "optional": false
99
- }
100
- ],
101
- "returnType": "Promise<AgreementExecution | null>",
102
- "isStatic": false,
103
- "isPublic": true
58
+ "sourceKind": {
59
+ "type": "text",
60
+ "required": true,
61
+ "default": "",
62
+ "_meta": {
63
+ "required": true
64
+ }
104
65
  },
105
- "compareAndSetLifecycle": {
106
- "name": "compareAndSetLifecycle",
107
- "async": true,
108
- "parameters": [
109
- {
110
- "name": "input",
111
- "type": "CompareAndSetAgreementLifecycleInput",
112
- "optional": false
113
- }
114
- ],
115
- "returnType": "Promise<AgreementExecution | null>",
116
- "isStatic": false,
117
- "isPublic": true
66
+ "sourceId": {
67
+ "type": "text",
68
+ "required": true,
69
+ "default": "",
70
+ "_meta": {
71
+ "required": true
72
+ }
118
73
  },
119
- "incrementAttemptCount": {
120
- "name": "incrementAttemptCount",
121
- "async": true,
122
- "parameters": [
123
- {
124
- "name": "tenantId",
125
- "type": "string",
126
- "optional": false
127
- },
128
- {
129
- "name": "executionId",
130
- "type": "string",
131
- "optional": false
132
- }
133
- ],
134
- "returnType": "Promise<AgreementExecution>",
135
- "isStatic": false,
136
- "isPublic": true
74
+ "sourceVersion": {
75
+ "type": "integer",
76
+ "required": false,
77
+ "default": 1
137
78
  },
138
- "updateLastError": {
139
- "name": "updateLastError",
79
+ "sourceAssetId": {
80
+ "type": "crossPackageRef",
81
+ "required": false,
82
+ "related": "@happyvertical/smrt-assets:Asset"
83
+ },
84
+ "sourceSha256": {
85
+ "type": "text",
86
+ "required": false,
87
+ "default": ""
88
+ },
89
+ "sourceSizeBytes": {
90
+ "type": "integer",
91
+ "required": false,
92
+ "default": 0
93
+ },
94
+ "requestIntentSha256": {
95
+ "type": "text",
96
+ "required": false,
97
+ "default": ""
98
+ },
99
+ "title": {
100
+ "type": "text",
101
+ "required": false,
102
+ "default": ""
103
+ },
104
+ "signerIntent": {
105
+ "type": "text",
106
+ "required": false,
107
+ "default": "[]"
108
+ },
109
+ "providerRequestId": {
110
+ "type": "text",
111
+ "required": false,
112
+ "default": ""
113
+ },
114
+ "providerRequestKey": {
115
+ "type": "text",
116
+ "required": false,
117
+ "_meta": {
118
+ "nullable": true,
119
+ "unique": true
120
+ }
121
+ },
122
+ "status": {
123
+ "type": "text",
124
+ "required": false,
125
+ "default": "prepared"
126
+ },
127
+ "expiresAt": {
128
+ "type": "datetime",
129
+ "required": false
130
+ },
131
+ "cancellationReason": {
132
+ "type": "text",
133
+ "required": false,
134
+ "default": ""
135
+ },
136
+ "lastProviderEventAt": {
137
+ "type": "datetime",
138
+ "required": false
139
+ },
140
+ "lastReconciledAt": {
141
+ "type": "datetime",
142
+ "required": false
143
+ },
144
+ "completedAt": {
145
+ "type": "datetime",
146
+ "required": false
147
+ },
148
+ "effectiveFrom": {
149
+ "type": "datetime",
150
+ "required": false
151
+ },
152
+ "effectiveTo": {
153
+ "type": "datetime",
154
+ "required": false
155
+ },
156
+ "supersedesExecutedAgreementId": {
157
+ "type": "text",
158
+ "required": false,
159
+ "default": ""
160
+ },
161
+ "signedDocumentAssetId": {
162
+ "type": "crossPackageRef",
163
+ "required": false,
164
+ "related": "@happyvertical/smrt-assets:Asset"
165
+ },
166
+ "signedDocumentSha256": {
167
+ "type": "text",
168
+ "required": false,
169
+ "default": ""
170
+ },
171
+ "signedDocumentSizeBytes": {
172
+ "type": "integer",
173
+ "required": false,
174
+ "default": 0
175
+ },
176
+ "signedDocumentMediaType": {
177
+ "type": "text",
178
+ "required": false,
179
+ "default": ""
180
+ },
181
+ "signedDocumentFilename": {
182
+ "type": "text",
183
+ "required": false,
184
+ "default": ""
185
+ },
186
+ "auditTrailAssetId": {
187
+ "type": "crossPackageRef",
188
+ "required": false,
189
+ "related": "@happyvertical/smrt-assets:Asset"
190
+ },
191
+ "auditTrailSha256": {
192
+ "type": "text",
193
+ "required": false,
194
+ "default": ""
195
+ },
196
+ "auditTrailSizeBytes": {
197
+ "type": "integer",
198
+ "required": false,
199
+ "default": 0
200
+ },
201
+ "auditTrailMediaType": {
202
+ "type": "text",
203
+ "required": false,
204
+ "default": ""
205
+ },
206
+ "auditTrailFilename": {
207
+ "type": "text",
208
+ "required": false,
209
+ "default": ""
210
+ },
211
+ "attemptCount": {
212
+ "type": "integer",
213
+ "required": false,
214
+ "default": 0
215
+ },
216
+ "createLeaseId": {
217
+ "type": "text",
218
+ "required": false,
219
+ "default": ""
220
+ },
221
+ "createLeaseExpiresAt": {
222
+ "type": "datetime",
223
+ "required": false
224
+ },
225
+ "lastError": {
226
+ "type": "text",
227
+ "required": false,
228
+ "default": ""
229
+ },
230
+ "metadata": {
231
+ "type": "text",
232
+ "required": false,
233
+ "default": "{}"
234
+ }
235
+ },
236
+ "methods": {
237
+ "initialize": {
238
+ "name": "initialize",
140
239
  "async": true,
141
- "parameters": [
142
- {
143
- "name": "input",
144
- "type": "UpdateAgreementExecutionErrorInput",
145
- "optional": false
146
- }
147
- ],
148
- "returnType": "Promise<AgreementExecution>",
240
+ "parameters": [],
241
+ "returnType": "Promise",
149
242
  "isStatic": false,
150
243
  "isPublic": true
151
244
  },
152
- "bindEvidenceArtifact": {
153
- "name": "bindEvidenceArtifact",
245
+ "save": {
246
+ "name": "save",
154
247
  "async": true,
155
- "parameters": [
156
- {
157
- "name": "input",
158
- "type": "BindAgreementEvidenceArtifactInput",
159
- "optional": false
160
- }
161
- ],
162
- "returnType": "Promise<AgreementExecution | null>",
248
+ "parameters": [],
249
+ "returnType": "Promise",
163
250
  "isStatic": false,
164
251
  "isPublic": true
165
252
  },
166
- "findBySource": {
167
- "name": "findBySource",
168
- "async": true,
169
- "parameters": [
170
- {
171
- "name": "sourceKind",
172
- "type": "string",
173
- "optional": false
174
- },
175
- {
176
- "name": "sourceId",
177
- "type": "string",
178
- "optional": false
179
- }
180
- ],
181
- "returnType": "Promise<AgreementExecution[]>",
253
+ "getSignerIntent": {
254
+ "name": "getSignerIntent",
255
+ "async": false,
256
+ "parameters": [],
257
+ "returnType": "AgreementSignerIntent[]",
182
258
  "isStatic": false,
183
259
  "isPublic": true
184
260
  }
185
- },
186
- "decoratorConfig": {},
187
- "extends": "SmrtCollection",
188
- "extendsTypeArg": "AgreementExecution",
189
- "exportName": "AgreementExecutionCollection",
190
- "collectionExportName": "AgreementExecutionCollectionCollection",
261
+ },
262
+ "decoratorConfig": {
263
+ "conflictColumns": [
264
+ "tenant_id",
265
+ "idempotency_key"
266
+ ],
267
+ "api": false,
268
+ "mcp": false,
269
+ "cli": false,
270
+ "tenantScoped": {
271
+ "mode": "required"
272
+ }
273
+ },
274
+ "extends": "SmrtObject",
275
+ "exportName": "AgreementExecution",
276
+ "collectionExportName": "AgreementExecutionCollection",
277
+ "validationRules": [
278
+ {
279
+ "field": "tenantId",
280
+ "rule": "required",
281
+ "fieldType": "text"
282
+ },
283
+ {
284
+ "field": "provider",
285
+ "rule": "required",
286
+ "fieldType": "text"
287
+ },
288
+ {
289
+ "field": "idempotencyKey",
290
+ "rule": "required",
291
+ "fieldType": "text"
292
+ },
293
+ {
294
+ "field": "sourceKind",
295
+ "rule": "required",
296
+ "fieldType": "text"
297
+ },
298
+ {
299
+ "field": "sourceId",
300
+ "rule": "required",
301
+ "fieldType": "text"
302
+ }
303
+ ],
191
304
  "schema": {
192
- "tableName": "agreement_execution_collections",
193
- "ddl": "CREATE TABLE IF NOT EXISTS \"agreement_execution_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
305
+ "tableName": "agreement_executions",
306
+ "ddl": "CREATE TABLE IF NOT EXISTS \"agreement_executions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"provider\" TEXT NOT NULL DEFAULT '',\n \"provider_account_ref\" TEXT DEFAULT '',\n \"credential_ref\" TEXT DEFAULT '',\n \"idempotency_key\" TEXT NOT NULL DEFAULT '',\n \"source_kind\" TEXT NOT NULL DEFAULT '',\n \"source_id\" TEXT NOT NULL DEFAULT '',\n \"source_version\" INTEGER DEFAULT 1,\n \"source_asset_id\" UUID,\n \"source_sha256\" TEXT DEFAULT '',\n \"source_size_bytes\" INTEGER DEFAULT 0,\n \"request_intent_sha256\" TEXT DEFAULT '',\n \"title\" TEXT DEFAULT '',\n \"signer_intent\" TEXT DEFAULT '[]',\n \"provider_request_id\" TEXT DEFAULT '',\n \"provider_request_key\" TEXT UNIQUE,\n \"status\" TEXT DEFAULT 'prepared',\n \"expires_at\" TIMESTAMP,\n \"cancellation_reason\" TEXT DEFAULT '',\n \"last_provider_event_at\" TIMESTAMP,\n \"last_reconciled_at\" TIMESTAMP,\n \"completed_at\" TIMESTAMP,\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"supersedes_executed_agreement_id\" TEXT DEFAULT '',\n \"signed_document_asset_id\" UUID,\n \"signed_document_sha256\" TEXT DEFAULT '',\n \"signed_document_size_bytes\" INTEGER DEFAULT 0,\n \"signed_document_media_type\" TEXT DEFAULT '',\n \"signed_document_filename\" TEXT DEFAULT '',\n \"audit_trail_asset_id\" UUID,\n \"audit_trail_sha256\" TEXT DEFAULT '',\n \"audit_trail_size_bytes\" INTEGER DEFAULT 0,\n \"audit_trail_media_type\" TEXT DEFAULT '',\n \"audit_trail_filename\" TEXT DEFAULT '',\n \"attempt_count\" INTEGER DEFAULT 0,\n \"create_lease_id\" TEXT DEFAULT '',\n \"create_lease_expires_at\" TIMESTAMP,\n \"last_error\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
194
307
  "columns": {
195
308
  "id": {
196
309
  "type": "UUID",
@@ -216,236 +329,412 @@
216
329
  "type": "TIMESTAMP",
217
330
  "notNull": true,
218
331
  "default": "current_timestamp"
219
- }
220
- },
221
- "indexes": [
222
- {
223
- "name": "agreement_execution_collections_id_idx",
224
- "columns": [
225
- "id"
226
- ]
227
332
  },
228
- {
229
- "name": "agreement_execution_collections_slug_context_idx",
230
- "columns": [
231
- "slug",
232
- "context"
233
- ],
333
+ "tenant_id": {
334
+ "type": "UUID",
335
+ "referenceKind": "tenantId",
336
+ "notNull": true,
337
+ "unique": false
338
+ },
339
+ "provider": {
340
+ "type": "TEXT",
341
+ "notNull": true,
342
+ "unique": false,
343
+ "default": ""
344
+ },
345
+ "provider_account_ref": {
346
+ "type": "TEXT",
347
+ "notNull": false,
348
+ "unique": false,
349
+ "default": ""
350
+ },
351
+ "credential_ref": {
352
+ "type": "TEXT",
353
+ "notNull": false,
354
+ "unique": false,
355
+ "default": ""
356
+ },
357
+ "idempotency_key": {
358
+ "type": "TEXT",
359
+ "notNull": true,
360
+ "unique": false,
361
+ "default": ""
362
+ },
363
+ "source_kind": {
364
+ "type": "TEXT",
365
+ "notNull": true,
366
+ "unique": false,
367
+ "default": ""
368
+ },
369
+ "source_id": {
370
+ "type": "TEXT",
371
+ "notNull": true,
372
+ "unique": false,
373
+ "default": ""
374
+ },
375
+ "source_version": {
376
+ "type": "INTEGER",
377
+ "notNull": false,
378
+ "unique": false,
379
+ "default": 1
380
+ },
381
+ "source_asset_id": {
382
+ "type": "UUID",
383
+ "referenceKind": "crossPackageRef",
384
+ "notNull": false,
385
+ "unique": false
386
+ },
387
+ "source_sha256": {
388
+ "type": "TEXT",
389
+ "notNull": false,
390
+ "unique": false,
391
+ "default": ""
392
+ },
393
+ "source_size_bytes": {
394
+ "type": "INTEGER",
395
+ "notNull": false,
396
+ "unique": false,
397
+ "default": 0
398
+ },
399
+ "request_intent_sha256": {
400
+ "type": "TEXT",
401
+ "notNull": false,
402
+ "unique": false,
403
+ "default": ""
404
+ },
405
+ "title": {
406
+ "type": "TEXT",
407
+ "notNull": false,
408
+ "unique": false,
409
+ "default": ""
410
+ },
411
+ "signer_intent": {
412
+ "type": "TEXT",
413
+ "notNull": false,
414
+ "unique": false,
415
+ "default": "[]"
416
+ },
417
+ "provider_request_id": {
418
+ "type": "TEXT",
419
+ "notNull": false,
420
+ "unique": false,
421
+ "default": ""
422
+ },
423
+ "provider_request_key": {
424
+ "type": "TEXT",
425
+ "notNull": false,
234
426
  "unique": true
235
- }
236
- ],
237
- "version": "801c5482"
238
- }
239
- },
240
- "@happyvertical/smrt-sales:AgreementExecutionEventCollection": {
241
- "name": "agreementexecutioneventcollection",
242
- "className": "AgreementExecutionEventCollection",
243
- "qualifiedName": "@happyvertical/smrt-sales:AgreementExecutionEventCollection",
244
- "collection": "agreementexecutionevents",
245
- "filePath": "/home/runner/_work/smrt/smrt/packages/sales/src/agreements/collections/AgreementExecutionEventCollection.ts",
246
- "packageName": "@happyvertical/smrt-sales",
247
- "fields": {},
248
- "methods": {
249
- "findByDedupeKey": {
250
- "name": "findByDedupeKey",
251
- "async": true,
252
- "parameters": [
253
- {
254
- "name": "dedupeKey",
255
- "type": "string",
256
- "optional": false
257
- }
258
- ],
259
- "returnType": "Promise<AgreementExecutionEvent | null>",
260
- "isStatic": false,
261
- "isPublic": true
262
- },
263
- "recordVerified": {
264
- "name": "recordVerified",
265
- "async": true,
266
- "parameters": [
267
- {
268
- "name": "options",
269
- "type": "VerifiedAgreementExecutionEventOptions",
270
- "optional": false
271
- }
272
- ],
273
- "returnType": "Promise<object>",
274
- "isStatic": false,
275
- "isPublic": true
276
- },
277
- "findByExecution": {
278
- "name": "findByExecution",
279
- "async": true,
280
- "parameters": [
281
- {
282
- "name": "executionId",
283
- "type": "string",
284
- "optional": false
285
- }
286
- ],
287
- "returnType": "Promise<AgreementExecutionEvent[]>",
288
- "isStatic": false,
289
- "isPublic": true
290
- },
291
- "findProviderEventsByExecution": {
292
- "name": "findProviderEventsByExecution",
293
- "async": true,
294
- "parameters": [
295
- {
296
- "name": "executionId",
297
- "type": "string",
298
- "optional": false
299
- }
300
- ],
301
- "returnType": "Promise<AgreementExecutionEvent[]>",
302
- "isStatic": false,
303
- "isPublic": true
304
- }
305
- },
306
- "decoratorConfig": {},
307
- "extends": "SmrtCollection",
308
- "extendsTypeArg": "AgreementExecutionEvent",
309
- "exportName": "AgreementExecutionEventCollection",
310
- "collectionExportName": "AgreementExecutionEventCollectionCollection",
311
- "schema": {
312
- "tableName": "agreement_execution_event_collections",
313
- "ddl": "CREATE TABLE IF NOT EXISTS \"agreement_execution_event_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
314
- "columns": {
315
- "id": {
427
+ },
428
+ "status": {
429
+ "type": "TEXT",
430
+ "notNull": false,
431
+ "unique": false,
432
+ "default": "prepared"
433
+ },
434
+ "expires_at": {
435
+ "type": "TIMESTAMP",
436
+ "notNull": false,
437
+ "unique": false
438
+ },
439
+ "cancellation_reason": {
440
+ "type": "TEXT",
441
+ "notNull": false,
442
+ "unique": false,
443
+ "default": ""
444
+ },
445
+ "last_provider_event_at": {
446
+ "type": "TIMESTAMP",
447
+ "notNull": false,
448
+ "unique": false
449
+ },
450
+ "last_reconciled_at": {
451
+ "type": "TIMESTAMP",
452
+ "notNull": false,
453
+ "unique": false
454
+ },
455
+ "completed_at": {
456
+ "type": "TIMESTAMP",
457
+ "notNull": false,
458
+ "unique": false
459
+ },
460
+ "effective_from": {
461
+ "type": "TIMESTAMP",
462
+ "notNull": false,
463
+ "unique": false
464
+ },
465
+ "effective_to": {
466
+ "type": "TIMESTAMP",
467
+ "notNull": false,
468
+ "unique": false
469
+ },
470
+ "supersedes_executed_agreement_id": {
471
+ "type": "TEXT",
472
+ "notNull": false,
473
+ "unique": false,
474
+ "default": ""
475
+ },
476
+ "signed_document_asset_id": {
316
477
  "type": "UUID",
317
- "primaryKey": true,
318
- "referenceKind": "id",
319
- "notNull": true
478
+ "referenceKind": "crossPackageRef",
479
+ "notNull": false,
480
+ "unique": false
320
481
  },
321
- "slug": {
482
+ "signed_document_sha256": {
322
483
  "type": "TEXT",
323
- "notNull": true
484
+ "notNull": false,
485
+ "unique": false,
486
+ "default": ""
324
487
  },
325
- "context": {
488
+ "signed_document_size_bytes": {
489
+ "type": "INTEGER",
490
+ "notNull": false,
491
+ "unique": false,
492
+ "default": 0
493
+ },
494
+ "signed_document_media_type": {
326
495
  "type": "TEXT",
327
- "notNull": true,
496
+ "notNull": false,
497
+ "unique": false,
328
498
  "default": ""
329
499
  },
330
- "created_at": {
331
- "type": "TIMESTAMP",
332
- "notNull": true,
333
- "default": "current_timestamp"
500
+ "signed_document_filename": {
501
+ "type": "TEXT",
502
+ "notNull": false,
503
+ "unique": false,
504
+ "default": ""
334
505
  },
335
- "updated_at": {
506
+ "audit_trail_asset_id": {
507
+ "type": "UUID",
508
+ "referenceKind": "crossPackageRef",
509
+ "notNull": false,
510
+ "unique": false
511
+ },
512
+ "audit_trail_sha256": {
513
+ "type": "TEXT",
514
+ "notNull": false,
515
+ "unique": false,
516
+ "default": ""
517
+ },
518
+ "audit_trail_size_bytes": {
519
+ "type": "INTEGER",
520
+ "notNull": false,
521
+ "unique": false,
522
+ "default": 0
523
+ },
524
+ "audit_trail_media_type": {
525
+ "type": "TEXT",
526
+ "notNull": false,
527
+ "unique": false,
528
+ "default": ""
529
+ },
530
+ "audit_trail_filename": {
531
+ "type": "TEXT",
532
+ "notNull": false,
533
+ "unique": false,
534
+ "default": ""
535
+ },
536
+ "attempt_count": {
537
+ "type": "INTEGER",
538
+ "notNull": false,
539
+ "unique": false,
540
+ "default": 0
541
+ },
542
+ "create_lease_id": {
543
+ "type": "TEXT",
544
+ "notNull": false,
545
+ "unique": false,
546
+ "default": ""
547
+ },
548
+ "create_lease_expires_at": {
336
549
  "type": "TIMESTAMP",
337
- "notNull": true,
338
- "default": "current_timestamp"
550
+ "notNull": false,
551
+ "unique": false
552
+ },
553
+ "last_error": {
554
+ "type": "TEXT",
555
+ "notNull": false,
556
+ "unique": false,
557
+ "default": ""
558
+ },
559
+ "metadata": {
560
+ "type": "TEXT",
561
+ "notNull": false,
562
+ "unique": false,
563
+ "default": "{}"
339
564
  }
340
565
  },
341
566
  "indexes": [
342
567
  {
343
- "name": "agreement_execution_event_collections_id_idx",
568
+ "name": "agreement_executions_id_idx",
344
569
  "columns": [
345
570
  "id"
346
571
  ]
347
572
  },
348
573
  {
349
- "name": "agreement_execution_event_collections_slug_context_idx",
574
+ "name": "agreement_executions_tenant_id_idempotency_key_idx",
350
575
  "columns": [
351
- "slug",
352
- "context"
576
+ "tenant_id",
577
+ "idempotency_key"
353
578
  ],
354
579
  "unique": true
355
580
  }
356
581
  ],
357
- "version": "055a9e0f"
582
+ "version": "33a93a76"
358
583
  }
359
584
  },
360
- "@happyvertical/smrt-sales:ExecutedAgreementCollection": {
361
- "name": "executedagreementcollection",
362
- "className": "ExecutedAgreementCollection",
363
- "qualifiedName": "@happyvertical/smrt-sales:ExecutedAgreementCollection",
364
- "collection": "executedagreements",
365
- "filePath": "/home/runner/_work/smrt/smrt/packages/sales/src/agreements/collections/ExecutedAgreementCollection.ts",
585
+ "@happyvertical/smrt-sales:AgreementExecutionEvent": {
586
+ "name": "agreementexecutionevent",
587
+ "className": "AgreementExecutionEvent",
588
+ "qualifiedName": "@happyvertical/smrt-sales:AgreementExecutionEvent",
589
+ "collection": "agreementexecutionevents",
590
+ "filePath": "/home/runner/_work/smrt/smrt/packages/sales/src/agreements/models/AgreementExecutionEvent.ts",
366
591
  "packageName": "@happyvertical/smrt-sales",
367
- "fields": {},
368
- "methods": {
369
- "findByExecution": {
370
- "name": "findByExecution",
371
- "async": true,
372
- "parameters": [
373
- {
374
- "name": "executionId",
375
- "type": "string",
376
- "optional": false
592
+ "fields": {
593
+ "tenantId": {
594
+ "type": "text",
595
+ "required": true,
596
+ "_meta": {
597
+ "sqlType": "UUID",
598
+ "__tenancy": {
599
+ "isTenantIdField": true,
600
+ "autoFilter": true,
601
+ "required": true,
602
+ "autoPopulate": true,
603
+ "nullable": false,
604
+ "mode": "required",
605
+ "field": "tenantId",
606
+ "allowSuperAdminBypass": false
377
607
  }
378
- ],
379
- "returnType": "Promise<ExecutedAgreement | null>",
380
- "isStatic": false,
381
- "isPublic": true
608
+ }
382
609
  },
383
- "createImmutable": {
384
- "name": "createImmutable",
385
- "async": true,
386
- "parameters": [
387
- {
388
- "name": "options",
389
- "type": "ExecutedAgreementOptions",
390
- "optional": false
391
- }
392
- ],
393
- "returnType": "Promise<object>",
394
- "isStatic": false,
395
- "isPublic": true
610
+ "executionId": {
611
+ "type": "foreignKey",
612
+ "required": true,
613
+ "related": "AgreementExecution",
614
+ "_meta": {
615
+ "required": true
616
+ }
396
617
  },
397
- "findVersionsBySource": {
398
- "name": "findVersionsBySource",
399
- "async": true,
400
- "parameters": [
401
- {
402
- "name": "sourceKind",
403
- "type": "string",
404
- "optional": false
405
- },
406
- {
407
- "name": "sourceId",
408
- "type": "string",
409
- "optional": false
410
- }
411
- ],
412
- "returnType": "Promise<ExecutedAgreement[]>",
618
+ "provider": {
619
+ "type": "text",
620
+ "required": false,
621
+ "default": ""
622
+ },
623
+ "providerEventId": {
624
+ "type": "text",
625
+ "required": false,
626
+ "default": ""
627
+ },
628
+ "eventOrigin": {
629
+ "type": "text",
630
+ "required": false,
631
+ "default": "provider_webhook"
632
+ },
633
+ "operationId": {
634
+ "type": "text",
635
+ "required": false,
636
+ "default": ""
637
+ },
638
+ "dedupeKey": {
639
+ "type": "text",
640
+ "required": true,
641
+ "default": "",
642
+ "_meta": {
643
+ "required": true
644
+ }
645
+ },
646
+ "orderingKey": {
647
+ "type": "text",
648
+ "required": false,
649
+ "default": ""
650
+ },
651
+ "eventType": {
652
+ "type": "text",
653
+ "required": false,
654
+ "default": ""
655
+ },
656
+ "status": {
657
+ "type": "text",
658
+ "required": false,
659
+ "default": "prepared"
660
+ },
661
+ "occurredAt": {
662
+ "type": "datetime",
663
+ "required": false
664
+ },
665
+ "receivedAt": {
666
+ "type": "datetime",
667
+ "required": false
668
+ },
669
+ "payloadSha256": {
670
+ "type": "text",
671
+ "required": false,
672
+ "default": ""
673
+ },
674
+ "signerEvidence": {
675
+ "type": "text",
676
+ "required": false,
677
+ "default": "[]"
678
+ },
679
+ "payload": {
680
+ "type": "text",
681
+ "required": false,
682
+ "default": "{}"
683
+ }
684
+ },
685
+ "methods": {
686
+ "initialize": {
687
+ "name": "initialize",
688
+ "async": true,
689
+ "parameters": [],
690
+ "returnType": "Promise",
413
691
  "isStatic": false,
414
692
  "isPublic": true
415
693
  },
416
- "effectiveForSource": {
417
- "name": "effectiveForSource",
694
+ "save": {
695
+ "name": "save",
418
696
  "async": true,
419
- "parameters": [
420
- {
421
- "name": "sourceKind",
422
- "type": "string",
423
- "optional": false
424
- },
425
- {
426
- "name": "sourceId",
427
- "type": "string",
428
- "optional": false
429
- },
430
- {
431
- "name": "at",
432
- "type": "Date",
433
- "optional": true
434
- }
435
- ],
436
- "returnType": "Promise<ExecutedAgreement | null>",
697
+ "parameters": [],
698
+ "returnType": "Promise",
437
699
  "isStatic": false,
438
700
  "isPublic": true
439
701
  }
440
702
  },
441
- "decoratorConfig": {},
442
- "extends": "SmrtCollection",
443
- "extendsTypeArg": "ExecutedAgreement",
444
- "exportName": "ExecutedAgreementCollection",
445
- "collectionExportName": "ExecutedAgreementCollectionCollection",
703
+ "decoratorConfig": {
704
+ "conflictColumns": [
705
+ "tenant_id",
706
+ "dedupe_key"
707
+ ],
708
+ "api": false,
709
+ "mcp": false,
710
+ "cli": false,
711
+ "tenantScoped": {
712
+ "mode": "required"
713
+ }
714
+ },
715
+ "extends": "SmrtObject",
716
+ "exportName": "AgreementExecutionEvent",
717
+ "collectionExportName": "AgreementExecutionEventCollection",
718
+ "validationRules": [
719
+ {
720
+ "field": "tenantId",
721
+ "rule": "required",
722
+ "fieldType": "text"
723
+ },
724
+ {
725
+ "field": "executionId",
726
+ "rule": "required",
727
+ "fieldType": "foreignKey"
728
+ },
729
+ {
730
+ "field": "dedupeKey",
731
+ "rule": "required",
732
+ "fieldType": "text"
733
+ }
734
+ ],
446
735
  "schema": {
447
- "tableName": "executed_agreement_collections",
448
- "ddl": "CREATE TABLE IF NOT EXISTS \"executed_agreement_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
736
+ "tableName": "agreement_execution_events",
737
+ "ddl": "CREATE TABLE IF NOT EXISTS \"agreement_execution_events\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"execution_id\" UUID NOT NULL,\n \"provider\" TEXT DEFAULT '',\n \"provider_event_id\" TEXT DEFAULT '',\n \"event_origin\" TEXT DEFAULT 'provider_webhook',\n \"operation_id\" TEXT DEFAULT '',\n \"dedupe_key\" TEXT NOT NULL DEFAULT '',\n \"ordering_key\" TEXT DEFAULT '',\n \"event_type\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'prepared',\n \"occurred_at\" TIMESTAMP,\n \"received_at\" TIMESTAMP,\n \"payload_sha256\" TEXT DEFAULT '',\n \"signer_evidence\" TEXT DEFAULT '[]',\n \"payload\" TEXT DEFAULT '{}'\n);",
449
738
  "columns": {
450
739
  "id": {
451
740
  "type": "UUID",
@@ -471,33 +760,121 @@
471
760
  "type": "TIMESTAMP",
472
761
  "notNull": true,
473
762
  "default": "current_timestamp"
763
+ },
764
+ "tenant_id": {
765
+ "type": "UUID",
766
+ "referenceKind": "tenantId",
767
+ "notNull": true,
768
+ "unique": false
769
+ },
770
+ "execution_id": {
771
+ "type": "UUID",
772
+ "referenceKind": "foreignKey",
773
+ "notNull": true,
774
+ "unique": false
775
+ },
776
+ "provider": {
777
+ "type": "TEXT",
778
+ "notNull": false,
779
+ "unique": false,
780
+ "default": ""
781
+ },
782
+ "provider_event_id": {
783
+ "type": "TEXT",
784
+ "notNull": false,
785
+ "unique": false,
786
+ "default": ""
787
+ },
788
+ "event_origin": {
789
+ "type": "TEXT",
790
+ "notNull": false,
791
+ "unique": false,
792
+ "default": "provider_webhook"
793
+ },
794
+ "operation_id": {
795
+ "type": "TEXT",
796
+ "notNull": false,
797
+ "unique": false,
798
+ "default": ""
799
+ },
800
+ "dedupe_key": {
801
+ "type": "TEXT",
802
+ "notNull": true,
803
+ "unique": false,
804
+ "default": ""
805
+ },
806
+ "ordering_key": {
807
+ "type": "TEXT",
808
+ "notNull": false,
809
+ "unique": false,
810
+ "default": ""
811
+ },
812
+ "event_type": {
813
+ "type": "TEXT",
814
+ "notNull": false,
815
+ "unique": false,
816
+ "default": ""
817
+ },
818
+ "status": {
819
+ "type": "TEXT",
820
+ "notNull": false,
821
+ "unique": false,
822
+ "default": "prepared"
823
+ },
824
+ "occurred_at": {
825
+ "type": "TIMESTAMP",
826
+ "notNull": false,
827
+ "unique": false
828
+ },
829
+ "received_at": {
830
+ "type": "TIMESTAMP",
831
+ "notNull": false,
832
+ "unique": false
833
+ },
834
+ "payload_sha256": {
835
+ "type": "TEXT",
836
+ "notNull": false,
837
+ "unique": false,
838
+ "default": ""
839
+ },
840
+ "signer_evidence": {
841
+ "type": "TEXT",
842
+ "notNull": false,
843
+ "unique": false,
844
+ "default": "[]"
845
+ },
846
+ "payload": {
847
+ "type": "TEXT",
848
+ "notNull": false,
849
+ "unique": false,
850
+ "default": "{}"
474
851
  }
475
852
  },
476
853
  "indexes": [
477
854
  {
478
- "name": "executed_agreement_collections_id_idx",
855
+ "name": "agreement_execution_events_id_idx",
479
856
  "columns": [
480
857
  "id"
481
858
  ]
482
859
  },
483
860
  {
484
- "name": "executed_agreement_collections_slug_context_idx",
861
+ "name": "agreement_execution_events_tenant_id_dedupe_key_idx",
485
862
  "columns": [
486
- "slug",
487
- "context"
863
+ "tenant_id",
864
+ "dedupe_key"
488
865
  ],
489
866
  "unique": true
490
867
  }
491
868
  ],
492
- "version": "73fd604d"
869
+ "version": "beeb890c"
493
870
  }
494
871
  },
495
- "@happyvertical/smrt-sales:AgreementExecution": {
496
- "name": "agreementexecution",
497
- "className": "AgreementExecution",
498
- "qualifiedName": "@happyvertical/smrt-sales:AgreementExecution",
499
- "collection": "agreementexecutions",
500
- "filePath": "/home/runner/_work/smrt/smrt/packages/sales/src/agreements/models/AgreementExecution.ts",
872
+ "@happyvertical/smrt-sales:ExecutedAgreement": {
873
+ "name": "executedagreement",
874
+ "className": "ExecutedAgreement",
875
+ "qualifiedName": "@happyvertical/smrt-sales:ExecutedAgreement",
876
+ "collection": "executedagreements",
877
+ "filePath": "/home/runner/_work/smrt/smrt/packages/sales/src/agreements/models/ExecutedAgreement.ts",
501
878
  "packageName": "@happyvertical/smrt-sales",
502
879
  "fields": {
503
880
  "tenantId": {
@@ -517,134 +894,49 @@
517
894
  }
518
895
  }
519
896
  },
520
- "provider": {
521
- "type": "text",
522
- "required": true,
523
- "default": "",
524
- "_meta": {
525
- "required": true
526
- }
527
- },
528
- "providerAccountRef": {
529
- "type": "text",
530
- "required": false,
531
- "default": ""
532
- },
533
- "credentialRef": {
534
- "type": "text",
535
- "required": false,
536
- "default": ""
537
- },
538
- "idempotencyKey": {
539
- "type": "text",
540
- "required": true,
541
- "default": "",
542
- "_meta": {
543
- "required": true
544
- }
545
- },
546
- "sourceKind": {
547
- "type": "text",
548
- "required": true,
549
- "default": "",
550
- "_meta": {
551
- "required": true
552
- }
553
- },
554
- "sourceId": {
555
- "type": "text",
897
+ "executionId": {
898
+ "type": "foreignKey",
556
899
  "required": true,
557
- "default": "",
900
+ "related": "AgreementExecution",
558
901
  "_meta": {
559
- "required": true
560
- }
561
- },
562
- "sourceVersion": {
563
- "type": "integer",
564
- "required": false,
565
- "default": 1
566
- },
567
- "sourceAssetId": {
568
- "type": "crossPackageRef",
569
- "required": false,
570
- "related": "@happyvertical/smrt-assets:Asset"
571
- },
572
- "sourceSha256": {
573
- "type": "text",
574
- "required": false,
575
- "default": ""
576
- },
577
- "sourceSizeBytes": {
578
- "type": "integer",
579
- "required": false,
580
- "default": 0
581
- },
582
- "requestIntentSha256": {
583
- "type": "text",
584
- "required": false,
585
- "default": ""
586
- },
587
- "title": {
588
- "type": "text",
589
- "required": false,
590
- "default": ""
591
- },
592
- "signerIntent": {
593
- "type": "text",
594
- "required": false,
595
- "default": "[]"
902
+ "required": true
903
+ }
596
904
  },
597
- "providerRequestId": {
905
+ "sourceKind": {
598
906
  "type": "text",
599
- "required": false,
600
- "default": ""
907
+ "required": true,
908
+ "default": "",
909
+ "_meta": {
910
+ "required": true
911
+ }
601
912
  },
602
- "providerRequestKey": {
913
+ "sourceId": {
603
914
  "type": "text",
604
- "required": false,
915
+ "required": true,
916
+ "default": "",
605
917
  "_meta": {
606
- "nullable": true,
607
- "unique": true
918
+ "required": true
608
919
  }
609
920
  },
610
- "status": {
611
- "type": "text",
921
+ "sourceVersion": {
922
+ "type": "integer",
612
923
  "required": false,
613
- "default": "prepared"
924
+ "default": 1
614
925
  },
615
- "expiresAt": {
616
- "type": "datetime",
617
- "required": false
926
+ "sourceAssetId": {
927
+ "type": "crossPackageRef",
928
+ "required": false,
929
+ "related": "@happyvertical/smrt-assets:Asset"
618
930
  },
619
- "cancellationReason": {
931
+ "sourceSha256": {
620
932
  "type": "text",
621
933
  "required": false,
622
934
  "default": ""
623
935
  },
624
- "lastProviderEventAt": {
625
- "type": "datetime",
626
- "required": false
627
- },
628
- "lastReconciledAt": {
629
- "type": "datetime",
630
- "required": false
631
- },
632
- "completedAt": {
633
- "type": "datetime",
634
- "required": false
635
- },
636
- "effectiveFrom": {
637
- "type": "datetime",
638
- "required": false
639
- },
640
- "effectiveTo": {
641
- "type": "datetime",
642
- "required": false
643
- },
644
- "supersedesExecutedAgreementId": {
645
- "type": "text",
936
+ "sourceSizeBytes": {
937
+ "type": "integer",
646
938
  "required": false,
647
- "default": ""
939
+ "default": 0
648
940
  },
649
941
  "signedDocumentAssetId": {
650
942
  "type": "crossPackageRef",
@@ -696,24 +988,27 @@
696
988
  "required": false,
697
989
  "default": ""
698
990
  },
699
- "attemptCount": {
700
- "type": "integer",
701
- "required": false,
702
- "default": 0
703
- },
704
- "createLeaseId": {
991
+ "signerEvidence": {
705
992
  "type": "text",
706
993
  "required": false,
707
- "default": ""
994
+ "default": "[]"
708
995
  },
709
- "createLeaseExpiresAt": {
996
+ "acceptedAt": {
710
997
  "type": "datetime",
711
998
  "required": false
712
999
  },
713
- "lastError": {
714
- "type": "text",
1000
+ "effectiveFrom": {
1001
+ "type": "datetime",
1002
+ "required": false
1003
+ },
1004
+ "effectiveTo": {
1005
+ "type": "datetime",
1006
+ "required": false
1007
+ },
1008
+ "supersedesExecutedAgreementId": {
1009
+ "type": "foreignKey",
715
1010
  "required": false,
716
- "default": ""
1011
+ "related": "ExecutedAgreement"
717
1012
  },
718
1013
  "metadata": {
719
1014
  "type": "text",
@@ -730,6 +1025,20 @@
730
1025
  "isStatic": false,
731
1026
  "isPublic": true
732
1027
  },
1028
+ "isEffectiveAt": {
1029
+ "name": "isEffectiveAt",
1030
+ "async": false,
1031
+ "parameters": [
1032
+ {
1033
+ "name": "at",
1034
+ "type": "Date",
1035
+ "optional": false
1036
+ }
1037
+ ],
1038
+ "returnType": "boolean",
1039
+ "isStatic": false,
1040
+ "isPublic": true
1041
+ },
733
1042
  "save": {
734
1043
  "name": "save",
735
1044
  "async": true,
@@ -737,31 +1046,33 @@
737
1046
  "returnType": "Promise",
738
1047
  "isStatic": false,
739
1048
  "isPublic": true
740
- },
741
- "getSignerIntent": {
742
- "name": "getSignerIntent",
743
- "async": false,
744
- "parameters": [],
745
- "returnType": "AgreementSignerIntent[]",
746
- "isStatic": false,
747
- "isPublic": true
748
1049
  }
749
1050
  },
750
1051
  "decoratorConfig": {
751
1052
  "conflictColumns": [
752
1053
  "tenant_id",
753
- "idempotency_key"
1054
+ "execution_id"
754
1055
  ],
755
- "api": false,
756
- "mcp": false,
1056
+ "api": {
1057
+ "include": [
1058
+ "list",
1059
+ "get"
1060
+ ]
1061
+ },
1062
+ "mcp": {
1063
+ "include": [
1064
+ "list",
1065
+ "get"
1066
+ ]
1067
+ },
757
1068
  "cli": false,
758
1069
  "tenantScoped": {
759
1070
  "mode": "required"
760
1071
  }
761
1072
  },
762
1073
  "extends": "SmrtObject",
763
- "exportName": "AgreementExecution",
764
- "collectionExportName": "AgreementExecutionCollection",
1074
+ "exportName": "ExecutedAgreement",
1075
+ "collectionExportName": "ExecutedAgreementCollection",
765
1076
  "validationRules": [
766
1077
  {
767
1078
  "field": "tenantId",
@@ -769,14 +1080,9 @@
769
1080
  "fieldType": "text"
770
1081
  },
771
1082
  {
772
- "field": "provider",
773
- "rule": "required",
774
- "fieldType": "text"
775
- },
776
- {
777
- "field": "idempotencyKey",
1083
+ "field": "executionId",
778
1084
  "rule": "required",
779
- "fieldType": "text"
1085
+ "fieldType": "foreignKey"
780
1086
  },
781
1087
  {
782
1088
  "field": "sourceKind",
@@ -790,8 +1096,8 @@
790
1096
  }
791
1097
  ],
792
1098
  "schema": {
793
- "tableName": "agreement_executions",
794
- "ddl": "CREATE TABLE IF NOT EXISTS \"agreement_executions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"provider\" TEXT NOT NULL DEFAULT '',\n \"provider_account_ref\" TEXT DEFAULT '',\n \"credential_ref\" TEXT DEFAULT '',\n \"idempotency_key\" TEXT NOT NULL DEFAULT '',\n \"source_kind\" TEXT NOT NULL DEFAULT '',\n \"source_id\" TEXT NOT NULL DEFAULT '',\n \"source_version\" INTEGER DEFAULT 1,\n \"source_asset_id\" UUID,\n \"source_sha256\" TEXT DEFAULT '',\n \"source_size_bytes\" INTEGER DEFAULT 0,\n \"request_intent_sha256\" TEXT DEFAULT '',\n \"title\" TEXT DEFAULT '',\n \"signer_intent\" TEXT DEFAULT '[]',\n \"provider_request_id\" TEXT DEFAULT '',\n \"provider_request_key\" TEXT UNIQUE,\n \"status\" TEXT DEFAULT 'prepared',\n \"expires_at\" TIMESTAMP,\n \"cancellation_reason\" TEXT DEFAULT '',\n \"last_provider_event_at\" TIMESTAMP,\n \"last_reconciled_at\" TIMESTAMP,\n \"completed_at\" TIMESTAMP,\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"supersedes_executed_agreement_id\" TEXT DEFAULT '',\n \"signed_document_asset_id\" UUID,\n \"signed_document_sha256\" TEXT DEFAULT '',\n \"signed_document_size_bytes\" INTEGER DEFAULT 0,\n \"signed_document_media_type\" TEXT DEFAULT '',\n \"signed_document_filename\" TEXT DEFAULT '',\n \"audit_trail_asset_id\" UUID,\n \"audit_trail_sha256\" TEXT DEFAULT '',\n \"audit_trail_size_bytes\" INTEGER DEFAULT 0,\n \"audit_trail_media_type\" TEXT DEFAULT '',\n \"audit_trail_filename\" TEXT DEFAULT '',\n \"attempt_count\" INTEGER DEFAULT 0,\n \"create_lease_id\" TEXT DEFAULT '',\n \"create_lease_expires_at\" TIMESTAMP,\n \"last_error\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
1099
+ "tableName": "executed_agreements",
1100
+ "ddl": "CREATE TABLE IF NOT EXISTS \"executed_agreements\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"execution_id\" UUID NOT NULL,\n \"source_kind\" TEXT NOT NULL DEFAULT '',\n \"source_id\" TEXT NOT NULL DEFAULT '',\n \"source_version\" INTEGER DEFAULT 1,\n \"source_asset_id\" UUID,\n \"source_sha256\" TEXT DEFAULT '',\n \"source_size_bytes\" INTEGER DEFAULT 0,\n \"signed_document_asset_id\" UUID,\n \"signed_document_sha256\" TEXT DEFAULT '',\n \"signed_document_size_bytes\" INTEGER DEFAULT 0,\n \"signed_document_media_type\" TEXT DEFAULT '',\n \"signed_document_filename\" TEXT DEFAULT '',\n \"audit_trail_asset_id\" UUID,\n \"audit_trail_sha256\" TEXT DEFAULT '',\n \"audit_trail_size_bytes\" INTEGER DEFAULT 0,\n \"audit_trail_media_type\" TEXT DEFAULT '',\n \"audit_trail_filename\" TEXT DEFAULT '',\n \"signer_evidence\" TEXT DEFAULT '[]',\n \"accepted_at\" TIMESTAMP,\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"supersedes_executed_agreement_id\" UUID,\n \"metadata\" TEXT DEFAULT '{}'\n);",
795
1101
  "columns": {
796
1102
  "id": {
797
1103
  "type": "UUID",
@@ -824,29 +1130,11 @@
824
1130
  "notNull": true,
825
1131
  "unique": false
826
1132
  },
827
- "provider": {
828
- "type": "TEXT",
829
- "notNull": true,
830
- "unique": false,
831
- "default": ""
832
- },
833
- "provider_account_ref": {
834
- "type": "TEXT",
835
- "notNull": false,
836
- "unique": false,
837
- "default": ""
838
- },
839
- "credential_ref": {
840
- "type": "TEXT",
841
- "notNull": false,
842
- "unique": false,
843
- "default": ""
844
- },
845
- "idempotency_key": {
846
- "type": "TEXT",
1133
+ "execution_id": {
1134
+ "type": "UUID",
1135
+ "referenceKind": "foreignKey",
847
1136
  "notNull": true,
848
- "unique": false,
849
- "default": ""
1137
+ "unique": false
850
1138
  },
851
1139
  "source_kind": {
852
1140
  "type": "TEXT",
@@ -884,83 +1172,6 @@
884
1172
  "unique": false,
885
1173
  "default": 0
886
1174
  },
887
- "request_intent_sha256": {
888
- "type": "TEXT",
889
- "notNull": false,
890
- "unique": false,
891
- "default": ""
892
- },
893
- "title": {
894
- "type": "TEXT",
895
- "notNull": false,
896
- "unique": false,
897
- "default": ""
898
- },
899
- "signer_intent": {
900
- "type": "TEXT",
901
- "notNull": false,
902
- "unique": false,
903
- "default": "[]"
904
- },
905
- "provider_request_id": {
906
- "type": "TEXT",
907
- "notNull": false,
908
- "unique": false,
909
- "default": ""
910
- },
911
- "provider_request_key": {
912
- "type": "TEXT",
913
- "notNull": false,
914
- "unique": true
915
- },
916
- "status": {
917
- "type": "TEXT",
918
- "notNull": false,
919
- "unique": false,
920
- "default": "prepared"
921
- },
922
- "expires_at": {
923
- "type": "TIMESTAMP",
924
- "notNull": false,
925
- "unique": false
926
- },
927
- "cancellation_reason": {
928
- "type": "TEXT",
929
- "notNull": false,
930
- "unique": false,
931
- "default": ""
932
- },
933
- "last_provider_event_at": {
934
- "type": "TIMESTAMP",
935
- "notNull": false,
936
- "unique": false
937
- },
938
- "last_reconciled_at": {
939
- "type": "TIMESTAMP",
940
- "notNull": false,
941
- "unique": false
942
- },
943
- "completed_at": {
944
- "type": "TIMESTAMP",
945
- "notNull": false,
946
- "unique": false
947
- },
948
- "effective_from": {
949
- "type": "TIMESTAMP",
950
- "notNull": false,
951
- "unique": false
952
- },
953
- "effective_to": {
954
- "type": "TIMESTAMP",
955
- "notNull": false,
956
- "unique": false
957
- },
958
- "supersedes_executed_agreement_id": {
959
- "type": "TEXT",
960
- "notNull": false,
961
- "unique": false,
962
- "default": ""
963
- },
964
1175
  "signed_document_asset_id": {
965
1176
  "type": "UUID",
966
1177
  "referenceKind": "crossPackageRef",
@@ -1021,28 +1232,32 @@
1021
1232
  "unique": false,
1022
1233
  "default": ""
1023
1234
  },
1024
- "attempt_count": {
1025
- "type": "INTEGER",
1235
+ "signer_evidence": {
1236
+ "type": "TEXT",
1026
1237
  "notNull": false,
1027
1238
  "unique": false,
1028
- "default": 0
1239
+ "default": "[]"
1029
1240
  },
1030
- "create_lease_id": {
1031
- "type": "TEXT",
1241
+ "accepted_at": {
1242
+ "type": "TIMESTAMP",
1243
+ "notNull": false,
1244
+ "unique": false
1245
+ },
1246
+ "effective_from": {
1247
+ "type": "TIMESTAMP",
1032
1248
  "notNull": false,
1033
- "unique": false,
1034
- "default": ""
1249
+ "unique": false
1035
1250
  },
1036
- "create_lease_expires_at": {
1251
+ "effective_to": {
1037
1252
  "type": "TIMESTAMP",
1038
1253
  "notNull": false,
1039
1254
  "unique": false
1040
1255
  },
1041
- "last_error": {
1042
- "type": "TEXT",
1256
+ "supersedes_executed_agreement_id": {
1257
+ "type": "UUID",
1258
+ "referenceKind": "foreignKey",
1043
1259
  "notNull": false,
1044
- "unique": false,
1045
- "default": ""
1260
+ "unique": false
1046
1261
  },
1047
1262
  "metadata": {
1048
1263
  "type": "TEXT",
@@ -1053,176 +1268,210 @@
1053
1268
  },
1054
1269
  "indexes": [
1055
1270
  {
1056
- "name": "agreement_executions_id_idx",
1271
+ "name": "executed_agreements_id_idx",
1057
1272
  "columns": [
1058
1273
  "id"
1059
1274
  ]
1060
1275
  },
1061
1276
  {
1062
- "name": "agreement_executions_tenant_id_idempotency_key_idx",
1277
+ "name": "executed_agreements_tenant_id_execution_id_idx",
1063
1278
  "columns": [
1064
1279
  "tenant_id",
1065
- "idempotency_key"
1280
+ "execution_id"
1066
1281
  ],
1067
1282
  "unique": true
1068
1283
  }
1069
1284
  ],
1070
- "version": "33a93a76"
1285
+ "version": "9b84eda8"
1071
1286
  }
1072
1287
  },
1073
- "@happyvertical/smrt-sales:AgreementExecutionEvent": {
1074
- "name": "agreementexecutionevent",
1075
- "className": "AgreementExecutionEvent",
1076
- "qualifiedName": "@happyvertical/smrt-sales:AgreementExecutionEvent",
1077
- "collection": "agreementexecutionevents",
1078
- "filePath": "/home/runner/_work/smrt/smrt/packages/sales/src/agreements/models/AgreementExecutionEvent.ts",
1288
+ "@happyvertical/smrt-sales:AgreementExecutionCollection": {
1289
+ "name": "agreementexecutioncollection",
1290
+ "className": "AgreementExecutionCollection",
1291
+ "qualifiedName": "@happyvertical/smrt-sales:AgreementExecutionCollection",
1292
+ "collection": "agreementexecutions",
1293
+ "filePath": "/home/runner/_work/smrt/smrt/packages/sales/src/agreements/collections/AgreementExecutionCollection.ts",
1079
1294
  "packageName": "@happyvertical/smrt-sales",
1080
- "fields": {
1081
- "tenantId": {
1082
- "type": "text",
1083
- "required": true,
1084
- "_meta": {
1085
- "sqlType": "UUID",
1086
- "__tenancy": {
1087
- "isTenantIdField": true,
1088
- "autoFilter": true,
1089
- "required": true,
1090
- "autoPopulate": true,
1091
- "nullable": false,
1092
- "mode": "required",
1093
- "field": "tenantId",
1094
- "allowSuperAdminBypass": false
1295
+ "fields": {},
1296
+ "methods": {
1297
+ "findByIdempotencyKey": {
1298
+ "name": "findByIdempotencyKey",
1299
+ "async": true,
1300
+ "parameters": [
1301
+ {
1302
+ "name": "idempotencyKey",
1303
+ "type": "string",
1304
+ "optional": false
1095
1305
  }
1096
- }
1097
- },
1098
- "executionId": {
1099
- "type": "foreignKey",
1100
- "required": true,
1101
- "related": "AgreementExecution",
1102
- "_meta": {
1103
- "required": true
1104
- }
1105
- },
1106
- "provider": {
1107
- "type": "text",
1108
- "required": false,
1109
- "default": ""
1110
- },
1111
- "providerEventId": {
1112
- "type": "text",
1113
- "required": false,
1114
- "default": ""
1115
- },
1116
- "eventOrigin": {
1117
- "type": "text",
1118
- "required": false,
1119
- "default": "provider_webhook"
1120
- },
1121
- "operationId": {
1122
- "type": "text",
1123
- "required": false,
1124
- "default": ""
1306
+ ],
1307
+ "returnType": "Promise<AgreementExecution | null>",
1308
+ "isStatic": false,
1309
+ "isPublic": true
1125
1310
  },
1126
- "dedupeKey": {
1127
- "type": "text",
1128
- "required": true,
1129
- "default": "",
1130
- "_meta": {
1131
- "required": true
1132
- }
1311
+ "findByProviderRequest": {
1312
+ "name": "findByProviderRequest",
1313
+ "async": true,
1314
+ "parameters": [
1315
+ {
1316
+ "name": "provider",
1317
+ "type": "string",
1318
+ "optional": false
1319
+ },
1320
+ {
1321
+ "name": "providerRequestId",
1322
+ "type": "string",
1323
+ "optional": false
1324
+ }
1325
+ ],
1326
+ "returnType": "Promise<AgreementExecution | null>",
1327
+ "isStatic": false,
1328
+ "isPublic": true
1133
1329
  },
1134
- "orderingKey": {
1135
- "type": "text",
1136
- "required": false,
1137
- "default": ""
1330
+ "claimCreateAttempt": {
1331
+ "name": "claimCreateAttempt",
1332
+ "async": true,
1333
+ "parameters": [
1334
+ {
1335
+ "name": "input",
1336
+ "type": "ClaimAgreementCreateAttemptInput",
1337
+ "optional": false
1338
+ }
1339
+ ],
1340
+ "returnType": "Promise<AgreementExecution | null>",
1341
+ "isStatic": false,
1342
+ "isPublic": true
1138
1343
  },
1139
- "eventType": {
1140
- "type": "text",
1141
- "required": false,
1142
- "default": ""
1344
+ "completeCreateAttempt": {
1345
+ "name": "completeCreateAttempt",
1346
+ "async": true,
1347
+ "parameters": [
1348
+ {
1349
+ "name": "input",
1350
+ "type": "CompleteAgreementCreateAttemptInput",
1351
+ "optional": false
1352
+ }
1353
+ ],
1354
+ "returnType": "Promise<AgreementExecution | null>",
1355
+ "isStatic": false,
1356
+ "isPublic": true
1143
1357
  },
1144
- "status": {
1145
- "type": "text",
1146
- "required": false,
1147
- "default": "prepared"
1358
+ "failCreateAttempt": {
1359
+ "name": "failCreateAttempt",
1360
+ "async": true,
1361
+ "parameters": [
1362
+ {
1363
+ "name": "input",
1364
+ "type": "FailAgreementCreateAttemptInput",
1365
+ "optional": false
1366
+ }
1367
+ ],
1368
+ "returnType": "Promise<AgreementExecution | null>",
1369
+ "isStatic": false,
1370
+ "isPublic": true
1148
1371
  },
1149
- "occurredAt": {
1150
- "type": "datetime",
1151
- "required": false
1372
+ "bindProviderRequest": {
1373
+ "name": "bindProviderRequest",
1374
+ "async": true,
1375
+ "parameters": [
1376
+ {
1377
+ "name": "input",
1378
+ "type": "BindAgreementProviderRequestInput",
1379
+ "optional": false
1380
+ }
1381
+ ],
1382
+ "returnType": "Promise<AgreementExecution | null>",
1383
+ "isStatic": false,
1384
+ "isPublic": true
1152
1385
  },
1153
- "receivedAt": {
1154
- "type": "datetime",
1155
- "required": false
1386
+ "compareAndSetLifecycle": {
1387
+ "name": "compareAndSetLifecycle",
1388
+ "async": true,
1389
+ "parameters": [
1390
+ {
1391
+ "name": "input",
1392
+ "type": "CompareAndSetAgreementLifecycleInput",
1393
+ "optional": false
1394
+ }
1395
+ ],
1396
+ "returnType": "Promise<AgreementExecution | null>",
1397
+ "isStatic": false,
1398
+ "isPublic": true
1156
1399
  },
1157
- "payloadSha256": {
1158
- "type": "text",
1159
- "required": false,
1160
- "default": ""
1400
+ "incrementAttemptCount": {
1401
+ "name": "incrementAttemptCount",
1402
+ "async": true,
1403
+ "parameters": [
1404
+ {
1405
+ "name": "tenantId",
1406
+ "type": "string",
1407
+ "optional": false
1408
+ },
1409
+ {
1410
+ "name": "executionId",
1411
+ "type": "string",
1412
+ "optional": false
1413
+ }
1414
+ ],
1415
+ "returnType": "Promise<AgreementExecution>",
1416
+ "isStatic": false,
1417
+ "isPublic": true
1161
1418
  },
1162
- "signerEvidence": {
1163
- "type": "text",
1164
- "required": false,
1165
- "default": "[]"
1419
+ "updateLastError": {
1420
+ "name": "updateLastError",
1421
+ "async": true,
1422
+ "parameters": [
1423
+ {
1424
+ "name": "input",
1425
+ "type": "UpdateAgreementExecutionErrorInput",
1426
+ "optional": false
1427
+ }
1428
+ ],
1429
+ "returnType": "Promise<AgreementExecution>",
1430
+ "isStatic": false,
1431
+ "isPublic": true
1166
1432
  },
1167
- "payload": {
1168
- "type": "text",
1169
- "required": false,
1170
- "default": "{}"
1171
- }
1172
- },
1173
- "methods": {
1174
- "initialize": {
1175
- "name": "initialize",
1433
+ "bindEvidenceArtifact": {
1434
+ "name": "bindEvidenceArtifact",
1176
1435
  "async": true,
1177
- "parameters": [],
1178
- "returnType": "Promise",
1436
+ "parameters": [
1437
+ {
1438
+ "name": "input",
1439
+ "type": "BindAgreementEvidenceArtifactInput",
1440
+ "optional": false
1441
+ }
1442
+ ],
1443
+ "returnType": "Promise<AgreementExecution | null>",
1179
1444
  "isStatic": false,
1180
1445
  "isPublic": true
1181
1446
  },
1182
- "save": {
1183
- "name": "save",
1447
+ "findBySource": {
1448
+ "name": "findBySource",
1184
1449
  "async": true,
1185
- "parameters": [],
1186
- "returnType": "Promise",
1450
+ "parameters": [
1451
+ {
1452
+ "name": "sourceKind",
1453
+ "type": "string",
1454
+ "optional": false
1455
+ },
1456
+ {
1457
+ "name": "sourceId",
1458
+ "type": "string",
1459
+ "optional": false
1460
+ }
1461
+ ],
1462
+ "returnType": "Promise<AgreementExecution[]>",
1187
1463
  "isStatic": false,
1188
1464
  "isPublic": true
1189
1465
  }
1190
1466
  },
1191
- "decoratorConfig": {
1192
- "conflictColumns": [
1193
- "tenant_id",
1194
- "dedupe_key"
1195
- ],
1196
- "api": false,
1197
- "mcp": false,
1198
- "cli": false,
1199
- "tenantScoped": {
1200
- "mode": "required"
1201
- }
1202
- },
1203
- "extends": "SmrtObject",
1204
- "exportName": "AgreementExecutionEvent",
1205
- "collectionExportName": "AgreementExecutionEventCollection",
1206
- "validationRules": [
1207
- {
1208
- "field": "tenantId",
1209
- "rule": "required",
1210
- "fieldType": "text"
1211
- },
1212
- {
1213
- "field": "executionId",
1214
- "rule": "required",
1215
- "fieldType": "foreignKey"
1216
- },
1217
- {
1218
- "field": "dedupeKey",
1219
- "rule": "required",
1220
- "fieldType": "text"
1221
- }
1222
- ],
1467
+ "decoratorConfig": {},
1468
+ "extends": "SmrtCollection",
1469
+ "extendsTypeArg": "AgreementExecution",
1470
+ "exportName": "AgreementExecutionCollection",
1471
+ "collectionExportName": "AgreementExecutionCollectionCollection",
1223
1472
  "schema": {
1224
- "tableName": "agreement_execution_events",
1225
- "ddl": "CREATE TABLE IF NOT EXISTS \"agreement_execution_events\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"execution_id\" UUID NOT NULL,\n \"provider\" TEXT DEFAULT '',\n \"provider_event_id\" TEXT DEFAULT '',\n \"event_origin\" TEXT DEFAULT 'provider_webhook',\n \"operation_id\" TEXT DEFAULT '',\n \"dedupe_key\" TEXT NOT NULL DEFAULT '',\n \"ordering_key\" TEXT DEFAULT '',\n \"event_type\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'prepared',\n \"occurred_at\" TIMESTAMP,\n \"received_at\" TIMESTAMP,\n \"payload_sha256\" TEXT DEFAULT '',\n \"signer_evidence\" TEXT DEFAULT '[]',\n \"payload\" TEXT DEFAULT '{}'\n);",
1473
+ "tableName": "agreement_execution_collections",
1474
+ "ddl": "CREATE TABLE IF NOT EXISTS \"agreement_execution_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1226
1475
  "columns": {
1227
1476
  "id": {
1228
1477
  "type": "UUID",
@@ -1248,344 +1497,236 @@
1248
1497
  "type": "TIMESTAMP",
1249
1498
  "notNull": true,
1250
1499
  "default": "current_timestamp"
1500
+ }
1501
+ },
1502
+ "indexes": [
1503
+ {
1504
+ "name": "agreement_execution_collections_id_idx",
1505
+ "columns": [
1506
+ "id"
1507
+ ]
1251
1508
  },
1252
- "tenant_id": {
1253
- "type": "UUID",
1254
- "referenceKind": "tenantId",
1255
- "notNull": true,
1256
- "unique": false
1257
- },
1258
- "execution_id": {
1509
+ {
1510
+ "name": "agreement_execution_collections_slug_context_idx",
1511
+ "columns": [
1512
+ "slug",
1513
+ "context"
1514
+ ],
1515
+ "unique": true
1516
+ }
1517
+ ],
1518
+ "version": "801c5482"
1519
+ }
1520
+ },
1521
+ "@happyvertical/smrt-sales:AgreementExecutionEventCollection": {
1522
+ "name": "agreementexecutioneventcollection",
1523
+ "className": "AgreementExecutionEventCollection",
1524
+ "qualifiedName": "@happyvertical/smrt-sales:AgreementExecutionEventCollection",
1525
+ "collection": "agreementexecutionevents",
1526
+ "filePath": "/home/runner/_work/smrt/smrt/packages/sales/src/agreements/collections/AgreementExecutionEventCollection.ts",
1527
+ "packageName": "@happyvertical/smrt-sales",
1528
+ "fields": {},
1529
+ "methods": {
1530
+ "findByDedupeKey": {
1531
+ "name": "findByDedupeKey",
1532
+ "async": true,
1533
+ "parameters": [
1534
+ {
1535
+ "name": "dedupeKey",
1536
+ "type": "string",
1537
+ "optional": false
1538
+ }
1539
+ ],
1540
+ "returnType": "Promise<AgreementExecutionEvent | null>",
1541
+ "isStatic": false,
1542
+ "isPublic": true
1543
+ },
1544
+ "recordVerified": {
1545
+ "name": "recordVerified",
1546
+ "async": true,
1547
+ "parameters": [
1548
+ {
1549
+ "name": "options",
1550
+ "type": "VerifiedAgreementExecutionEventOptions",
1551
+ "optional": false
1552
+ }
1553
+ ],
1554
+ "returnType": "Promise<object>",
1555
+ "isStatic": false,
1556
+ "isPublic": true
1557
+ },
1558
+ "findByExecution": {
1559
+ "name": "findByExecution",
1560
+ "async": true,
1561
+ "parameters": [
1562
+ {
1563
+ "name": "executionId",
1564
+ "type": "string",
1565
+ "optional": false
1566
+ }
1567
+ ],
1568
+ "returnType": "Promise<AgreementExecutionEvent[]>",
1569
+ "isStatic": false,
1570
+ "isPublic": true
1571
+ },
1572
+ "findProviderEventsByExecution": {
1573
+ "name": "findProviderEventsByExecution",
1574
+ "async": true,
1575
+ "parameters": [
1576
+ {
1577
+ "name": "executionId",
1578
+ "type": "string",
1579
+ "optional": false
1580
+ }
1581
+ ],
1582
+ "returnType": "Promise<AgreementExecutionEvent[]>",
1583
+ "isStatic": false,
1584
+ "isPublic": true
1585
+ }
1586
+ },
1587
+ "decoratorConfig": {},
1588
+ "extends": "SmrtCollection",
1589
+ "extendsTypeArg": "AgreementExecutionEvent",
1590
+ "exportName": "AgreementExecutionEventCollection",
1591
+ "collectionExportName": "AgreementExecutionEventCollectionCollection",
1592
+ "schema": {
1593
+ "tableName": "agreement_execution_event_collections",
1594
+ "ddl": "CREATE TABLE IF NOT EXISTS \"agreement_execution_event_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1595
+ "columns": {
1596
+ "id": {
1259
1597
  "type": "UUID",
1260
- "referenceKind": "foreignKey",
1261
- "notNull": true,
1262
- "unique": false
1263
- },
1264
- "provider": {
1265
- "type": "TEXT",
1266
- "notNull": false,
1267
- "unique": false,
1268
- "default": ""
1269
- },
1270
- "provider_event_id": {
1271
- "type": "TEXT",
1272
- "notNull": false,
1273
- "unique": false,
1274
- "default": ""
1275
- },
1276
- "event_origin": {
1277
- "type": "TEXT",
1278
- "notNull": false,
1279
- "unique": false,
1280
- "default": "provider_webhook"
1598
+ "primaryKey": true,
1599
+ "referenceKind": "id",
1600
+ "notNull": true
1281
1601
  },
1282
- "operation_id": {
1602
+ "slug": {
1283
1603
  "type": "TEXT",
1284
- "notNull": false,
1285
- "unique": false,
1286
- "default": ""
1604
+ "notNull": true
1287
1605
  },
1288
- "dedupe_key": {
1606
+ "context": {
1289
1607
  "type": "TEXT",
1290
1608
  "notNull": true,
1291
- "unique": false,
1292
- "default": ""
1293
- },
1294
- "ordering_key": {
1295
- "type": "TEXT",
1296
- "notNull": false,
1297
- "unique": false,
1298
- "default": ""
1299
- },
1300
- "event_type": {
1301
- "type": "TEXT",
1302
- "notNull": false,
1303
- "unique": false,
1304
1609
  "default": ""
1305
1610
  },
1306
- "status": {
1307
- "type": "TEXT",
1308
- "notNull": false,
1309
- "unique": false,
1310
- "default": "prepared"
1311
- },
1312
- "occurred_at": {
1611
+ "created_at": {
1313
1612
  "type": "TIMESTAMP",
1314
- "notNull": false,
1315
- "unique": false
1613
+ "notNull": true,
1614
+ "default": "current_timestamp"
1316
1615
  },
1317
- "received_at": {
1616
+ "updated_at": {
1318
1617
  "type": "TIMESTAMP",
1319
- "notNull": false,
1320
- "unique": false
1321
- },
1322
- "payload_sha256": {
1323
- "type": "TEXT",
1324
- "notNull": false,
1325
- "unique": false,
1326
- "default": ""
1327
- },
1328
- "signer_evidence": {
1329
- "type": "TEXT",
1330
- "notNull": false,
1331
- "unique": false,
1332
- "default": "[]"
1333
- },
1334
- "payload": {
1335
- "type": "TEXT",
1336
- "notNull": false,
1337
- "unique": false,
1338
- "default": "{}"
1618
+ "notNull": true,
1619
+ "default": "current_timestamp"
1339
1620
  }
1340
1621
  },
1341
1622
  "indexes": [
1342
1623
  {
1343
- "name": "agreement_execution_events_id_idx",
1624
+ "name": "agreement_execution_event_collections_id_idx",
1344
1625
  "columns": [
1345
1626
  "id"
1346
1627
  ]
1347
1628
  },
1348
1629
  {
1349
- "name": "agreement_execution_events_tenant_id_dedupe_key_idx",
1350
- "columns": [
1351
- "tenant_id",
1352
- "dedupe_key"
1630
+ "name": "agreement_execution_event_collections_slug_context_idx",
1631
+ "columns": [
1632
+ "slug",
1633
+ "context"
1353
1634
  ],
1354
1635
  "unique": true
1355
1636
  }
1356
1637
  ],
1357
- "version": "beeb890c"
1638
+ "version": "055a9e0f"
1358
1639
  }
1359
1640
  },
1360
- "@happyvertical/smrt-sales:ExecutedAgreement": {
1361
- "name": "executedagreement",
1362
- "className": "ExecutedAgreement",
1363
- "qualifiedName": "@happyvertical/smrt-sales:ExecutedAgreement",
1641
+ "@happyvertical/smrt-sales:ExecutedAgreementCollection": {
1642
+ "name": "executedagreementcollection",
1643
+ "className": "ExecutedAgreementCollection",
1644
+ "qualifiedName": "@happyvertical/smrt-sales:ExecutedAgreementCollection",
1364
1645
  "collection": "executedagreements",
1365
- "filePath": "/home/runner/_work/smrt/smrt/packages/sales/src/agreements/models/ExecutedAgreement.ts",
1646
+ "filePath": "/home/runner/_work/smrt/smrt/packages/sales/src/agreements/collections/ExecutedAgreementCollection.ts",
1366
1647
  "packageName": "@happyvertical/smrt-sales",
1367
- "fields": {
1368
- "tenantId": {
1369
- "type": "text",
1370
- "required": true,
1371
- "_meta": {
1372
- "sqlType": "UUID",
1373
- "__tenancy": {
1374
- "isTenantIdField": true,
1375
- "autoFilter": true,
1376
- "required": true,
1377
- "autoPopulate": true,
1378
- "nullable": false,
1379
- "mode": "required",
1380
- "field": "tenantId",
1381
- "allowSuperAdminBypass": false
1382
- }
1383
- }
1384
- },
1385
- "executionId": {
1386
- "type": "foreignKey",
1387
- "required": true,
1388
- "related": "AgreementExecution",
1389
- "_meta": {
1390
- "required": true
1391
- }
1392
- },
1393
- "sourceKind": {
1394
- "type": "text",
1395
- "required": true,
1396
- "default": "",
1397
- "_meta": {
1398
- "required": true
1399
- }
1400
- },
1401
- "sourceId": {
1402
- "type": "text",
1403
- "required": true,
1404
- "default": "",
1405
- "_meta": {
1406
- "required": true
1407
- }
1408
- },
1409
- "sourceVersion": {
1410
- "type": "integer",
1411
- "required": false,
1412
- "default": 1
1413
- },
1414
- "sourceAssetId": {
1415
- "type": "crossPackageRef",
1416
- "required": false,
1417
- "related": "@happyvertical/smrt-assets:Asset"
1418
- },
1419
- "sourceSha256": {
1420
- "type": "text",
1421
- "required": false,
1422
- "default": ""
1423
- },
1424
- "sourceSizeBytes": {
1425
- "type": "integer",
1426
- "required": false,
1427
- "default": 0
1428
- },
1429
- "signedDocumentAssetId": {
1430
- "type": "crossPackageRef",
1431
- "required": false,
1432
- "related": "@happyvertical/smrt-assets:Asset"
1433
- },
1434
- "signedDocumentSha256": {
1435
- "type": "text",
1436
- "required": false,
1437
- "default": ""
1438
- },
1439
- "signedDocumentSizeBytes": {
1440
- "type": "integer",
1441
- "required": false,
1442
- "default": 0
1443
- },
1444
- "signedDocumentMediaType": {
1445
- "type": "text",
1446
- "required": false,
1447
- "default": ""
1448
- },
1449
- "signedDocumentFilename": {
1450
- "type": "text",
1451
- "required": false,
1452
- "default": ""
1453
- },
1454
- "auditTrailAssetId": {
1455
- "type": "crossPackageRef",
1456
- "required": false,
1457
- "related": "@happyvertical/smrt-assets:Asset"
1458
- },
1459
- "auditTrailSha256": {
1460
- "type": "text",
1461
- "required": false,
1462
- "default": ""
1463
- },
1464
- "auditTrailSizeBytes": {
1465
- "type": "integer",
1466
- "required": false,
1467
- "default": 0
1468
- },
1469
- "auditTrailMediaType": {
1470
- "type": "text",
1471
- "required": false,
1472
- "default": ""
1473
- },
1474
- "auditTrailFilename": {
1475
- "type": "text",
1476
- "required": false,
1477
- "default": ""
1478
- },
1479
- "signerEvidence": {
1480
- "type": "text",
1481
- "required": false,
1482
- "default": "[]"
1483
- },
1484
- "acceptedAt": {
1485
- "type": "datetime",
1486
- "required": false
1487
- },
1488
- "effectiveFrom": {
1489
- "type": "datetime",
1490
- "required": false
1491
- },
1492
- "effectiveTo": {
1493
- "type": "datetime",
1494
- "required": false
1495
- },
1496
- "supersedesExecutedAgreementId": {
1497
- "type": "foreignKey",
1498
- "required": false,
1499
- "related": "ExecutedAgreement"
1500
- },
1501
- "metadata": {
1502
- "type": "text",
1503
- "required": false,
1504
- "default": "{}"
1505
- }
1506
- },
1648
+ "fields": {},
1507
1649
  "methods": {
1508
- "initialize": {
1509
- "name": "initialize",
1650
+ "findByExecution": {
1651
+ "name": "findByExecution",
1510
1652
  "async": true,
1511
- "parameters": [],
1512
- "returnType": "Promise",
1653
+ "parameters": [
1654
+ {
1655
+ "name": "executionId",
1656
+ "type": "string",
1657
+ "optional": false
1658
+ }
1659
+ ],
1660
+ "returnType": "Promise<ExecutedAgreement | null>",
1513
1661
  "isStatic": false,
1514
1662
  "isPublic": true
1515
1663
  },
1516
- "isEffectiveAt": {
1517
- "name": "isEffectiveAt",
1518
- "async": false,
1664
+ "createImmutable": {
1665
+ "name": "createImmutable",
1666
+ "async": true,
1519
1667
  "parameters": [
1520
1668
  {
1521
- "name": "at",
1522
- "type": "Date",
1669
+ "name": "options",
1670
+ "type": "ExecutedAgreementOptions",
1523
1671
  "optional": false
1524
1672
  }
1525
1673
  ],
1526
- "returnType": "boolean",
1674
+ "returnType": "Promise<object>",
1527
1675
  "isStatic": false,
1528
1676
  "isPublic": true
1529
1677
  },
1530
- "save": {
1531
- "name": "save",
1678
+ "findVersionsBySource": {
1679
+ "name": "findVersionsBySource",
1532
1680
  "async": true,
1533
- "parameters": [],
1534
- "returnType": "Promise",
1681
+ "parameters": [
1682
+ {
1683
+ "name": "sourceKind",
1684
+ "type": "string",
1685
+ "optional": false
1686
+ },
1687
+ {
1688
+ "name": "sourceId",
1689
+ "type": "string",
1690
+ "optional": false
1691
+ }
1692
+ ],
1693
+ "returnType": "Promise<ExecutedAgreement[]>",
1535
1694
  "isStatic": false,
1536
1695
  "isPublic": true
1537
- }
1538
- },
1539
- "decoratorConfig": {
1540
- "conflictColumns": [
1541
- "tenant_id",
1542
- "execution_id"
1543
- ],
1544
- "api": {
1545
- "include": [
1546
- "list",
1547
- "get"
1548
- ]
1549
- },
1550
- "mcp": {
1551
- "include": [
1552
- "list",
1553
- "get"
1554
- ]
1555
- },
1556
- "cli": false,
1557
- "tenantScoped": {
1558
- "mode": "required"
1559
- }
1560
- },
1561
- "extends": "SmrtObject",
1562
- "exportName": "ExecutedAgreement",
1563
- "collectionExportName": "ExecutedAgreementCollection",
1564
- "validationRules": [
1565
- {
1566
- "field": "tenantId",
1567
- "rule": "required",
1568
- "fieldType": "text"
1569
- },
1570
- {
1571
- "field": "executionId",
1572
- "rule": "required",
1573
- "fieldType": "foreignKey"
1574
- },
1575
- {
1576
- "field": "sourceKind",
1577
- "rule": "required",
1578
- "fieldType": "text"
1579
1696
  },
1580
- {
1581
- "field": "sourceId",
1582
- "rule": "required",
1583
- "fieldType": "text"
1697
+ "effectiveForSource": {
1698
+ "name": "effectiveForSource",
1699
+ "async": true,
1700
+ "parameters": [
1701
+ {
1702
+ "name": "sourceKind",
1703
+ "type": "string",
1704
+ "optional": false
1705
+ },
1706
+ {
1707
+ "name": "sourceId",
1708
+ "type": "string",
1709
+ "optional": false
1710
+ },
1711
+ {
1712
+ "name": "at",
1713
+ "type": "Date",
1714
+ "optional": true
1715
+ }
1716
+ ],
1717
+ "returnType": "Promise<ExecutedAgreement | null>",
1718
+ "isStatic": false,
1719
+ "isPublic": true
1584
1720
  }
1585
- ],
1721
+ },
1722
+ "decoratorConfig": {},
1723
+ "extends": "SmrtCollection",
1724
+ "extendsTypeArg": "ExecutedAgreement",
1725
+ "exportName": "ExecutedAgreementCollection",
1726
+ "collectionExportName": "ExecutedAgreementCollectionCollection",
1586
1727
  "schema": {
1587
- "tableName": "executed_agreements",
1588
- "ddl": "CREATE TABLE IF NOT EXISTS \"executed_agreements\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"execution_id\" UUID NOT NULL,\n \"source_kind\" TEXT NOT NULL DEFAULT '',\n \"source_id\" TEXT NOT NULL DEFAULT '',\n \"source_version\" INTEGER DEFAULT 1,\n \"source_asset_id\" UUID,\n \"source_sha256\" TEXT DEFAULT '',\n \"source_size_bytes\" INTEGER DEFAULT 0,\n \"signed_document_asset_id\" UUID,\n \"signed_document_sha256\" TEXT DEFAULT '',\n \"signed_document_size_bytes\" INTEGER DEFAULT 0,\n \"signed_document_media_type\" TEXT DEFAULT '',\n \"signed_document_filename\" TEXT DEFAULT '',\n \"audit_trail_asset_id\" UUID,\n \"audit_trail_sha256\" TEXT DEFAULT '',\n \"audit_trail_size_bytes\" INTEGER DEFAULT 0,\n \"audit_trail_media_type\" TEXT DEFAULT '',\n \"audit_trail_filename\" TEXT DEFAULT '',\n \"signer_evidence\" TEXT DEFAULT '[]',\n \"accepted_at\" TIMESTAMP,\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"supersedes_executed_agreement_id\" UUID,\n \"metadata\" TEXT DEFAULT '{}'\n);",
1728
+ "tableName": "executed_agreement_collections",
1729
+ "ddl": "CREATE TABLE IF NOT EXISTS \"executed_agreement_collections\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1589
1730
  "columns": {
1590
1731
  "id": {
1591
1732
  "type": "UUID",
@@ -1611,166 +1752,25 @@
1611
1752
  "type": "TIMESTAMP",
1612
1753
  "notNull": true,
1613
1754
  "default": "current_timestamp"
1614
- },
1615
- "tenant_id": {
1616
- "type": "UUID",
1617
- "referenceKind": "tenantId",
1618
- "notNull": true,
1619
- "unique": false
1620
- },
1621
- "execution_id": {
1622
- "type": "UUID",
1623
- "referenceKind": "foreignKey",
1624
- "notNull": true,
1625
- "unique": false
1626
- },
1627
- "source_kind": {
1628
- "type": "TEXT",
1629
- "notNull": true,
1630
- "unique": false,
1631
- "default": ""
1632
- },
1633
- "source_id": {
1634
- "type": "TEXT",
1635
- "notNull": true,
1636
- "unique": false,
1637
- "default": ""
1638
- },
1639
- "source_version": {
1640
- "type": "INTEGER",
1641
- "notNull": false,
1642
- "unique": false,
1643
- "default": 1
1644
- },
1645
- "source_asset_id": {
1646
- "type": "UUID",
1647
- "referenceKind": "crossPackageRef",
1648
- "notNull": false,
1649
- "unique": false
1650
- },
1651
- "source_sha256": {
1652
- "type": "TEXT",
1653
- "notNull": false,
1654
- "unique": false,
1655
- "default": ""
1656
- },
1657
- "source_size_bytes": {
1658
- "type": "INTEGER",
1659
- "notNull": false,
1660
- "unique": false,
1661
- "default": 0
1662
- },
1663
- "signed_document_asset_id": {
1664
- "type": "UUID",
1665
- "referenceKind": "crossPackageRef",
1666
- "notNull": false,
1667
- "unique": false
1668
- },
1669
- "signed_document_sha256": {
1670
- "type": "TEXT",
1671
- "notNull": false,
1672
- "unique": false,
1673
- "default": ""
1674
- },
1675
- "signed_document_size_bytes": {
1676
- "type": "INTEGER",
1677
- "notNull": false,
1678
- "unique": false,
1679
- "default": 0
1680
- },
1681
- "signed_document_media_type": {
1682
- "type": "TEXT",
1683
- "notNull": false,
1684
- "unique": false,
1685
- "default": ""
1686
- },
1687
- "signed_document_filename": {
1688
- "type": "TEXT",
1689
- "notNull": false,
1690
- "unique": false,
1691
- "default": ""
1692
- },
1693
- "audit_trail_asset_id": {
1694
- "type": "UUID",
1695
- "referenceKind": "crossPackageRef",
1696
- "notNull": false,
1697
- "unique": false
1698
- },
1699
- "audit_trail_sha256": {
1700
- "type": "TEXT",
1701
- "notNull": false,
1702
- "unique": false,
1703
- "default": ""
1704
- },
1705
- "audit_trail_size_bytes": {
1706
- "type": "INTEGER",
1707
- "notNull": false,
1708
- "unique": false,
1709
- "default": 0
1710
- },
1711
- "audit_trail_media_type": {
1712
- "type": "TEXT",
1713
- "notNull": false,
1714
- "unique": false,
1715
- "default": ""
1716
- },
1717
- "audit_trail_filename": {
1718
- "type": "TEXT",
1719
- "notNull": false,
1720
- "unique": false,
1721
- "default": ""
1722
- },
1723
- "signer_evidence": {
1724
- "type": "TEXT",
1725
- "notNull": false,
1726
- "unique": false,
1727
- "default": "[]"
1728
- },
1729
- "accepted_at": {
1730
- "type": "TIMESTAMP",
1731
- "notNull": false,
1732
- "unique": false
1733
- },
1734
- "effective_from": {
1735
- "type": "TIMESTAMP",
1736
- "notNull": false,
1737
- "unique": false
1738
- },
1739
- "effective_to": {
1740
- "type": "TIMESTAMP",
1741
- "notNull": false,
1742
- "unique": false
1743
- },
1744
- "supersedes_executed_agreement_id": {
1745
- "type": "UUID",
1746
- "referenceKind": "foreignKey",
1747
- "notNull": false,
1748
- "unique": false
1749
- },
1750
- "metadata": {
1751
- "type": "TEXT",
1752
- "notNull": false,
1753
- "unique": false,
1754
- "default": "{}"
1755
1755
  }
1756
1756
  },
1757
1757
  "indexes": [
1758
1758
  {
1759
- "name": "executed_agreements_id_idx",
1759
+ "name": "executed_agreement_collections_id_idx",
1760
1760
  "columns": [
1761
1761
  "id"
1762
1762
  ]
1763
1763
  },
1764
1764
  {
1765
- "name": "executed_agreements_tenant_id_execution_id_idx",
1765
+ "name": "executed_agreement_collections_slug_context_idx",
1766
1766
  "columns": [
1767
- "tenant_id",
1768
- "execution_id"
1767
+ "slug",
1768
+ "context"
1769
1769
  ],
1770
1770
  "unique": true
1771
1771
  }
1772
1772
  ],
1773
- "version": "9b84eda8"
1773
+ "version": "73fd604d"
1774
1774
  }
1775
1775
  },
1776
1776
  "@happyvertical/smrt-sales:CommissionAdjustmentCollection": {
@@ -3424,6 +3424,12 @@
3424
3424
  "dedupe_key"
3425
3425
  ],
3426
3426
  "unique": true
3427
+ },
3428
+ {
3429
+ "name": "commissions_tenant_id_idx",
3430
+ "columns": [
3431
+ "tenant_id"
3432
+ ]
3427
3433
  }
3428
3434
  ],
3429
3435
  "version": "e719c168"
@@ -3701,6 +3707,12 @@
3701
3707
  "context"
3702
3708
  ],
3703
3709
  "unique": true
3710
+ },
3711
+ {
3712
+ "name": "commission_adjustments_tenant_id_idx",
3713
+ "columns": [
3714
+ "tenant_id"
3715
+ ]
3704
3716
  }
3705
3717
  ],
3706
3718
  "version": "98ce4ad1"
@@ -3828,6 +3840,12 @@
3828
3840
  "columns": [
3829
3841
  "adjustment_id"
3830
3842
  ]
3843
+ },
3844
+ {
3845
+ "name": "commission_adjustment_operations_tenant_id_idx",
3846
+ "columns": [
3847
+ "tenant_id"
3848
+ ]
3831
3849
  }
3832
3850
  ],
3833
3851
  "version": "a8aae269"
@@ -4324,6 +4342,12 @@
4324
4342
  "columns": [
4325
4343
  "source_id"
4326
4344
  ]
4345
+ },
4346
+ {
4347
+ "name": "commission_payouts_tenant_id_idx",
4348
+ "columns": [
4349
+ "tenant_id"
4350
+ ]
4327
4351
  }
4328
4352
  ],
4329
4353
  "version": "2b0ec505"
@@ -4885,6 +4909,12 @@
4885
4909
  "context"
4886
4910
  ],
4887
4911
  "unique": true
4912
+ },
4913
+ {
4914
+ "name": "earners_tenant_id_idx",
4915
+ "columns": [
4916
+ "tenant_id"
4917
+ ]
4888
4918
  }
4889
4919
  ],
4890
4920
  "version": "b1c567fb"
@@ -5439,6 +5469,12 @@
5439
5469
  "dedupe_key"
5440
5470
  ],
5441
5471
  "unique": true
5472
+ },
5473
+ {
5474
+ "name": "earning_events_tenant_id_idx",
5475
+ "columns": [
5476
+ "tenant_id"
5477
+ ]
5442
5478
  }
5443
5479
  ],
5444
5480
  "version": "aca82726"
@@ -6527,6 +6563,12 @@
6527
6563
  "context"
6528
6564
  ],
6529
6565
  "unique": true
6566
+ },
6567
+ {
6568
+ "name": "leads_tenant_id_idx",
6569
+ "columns": [
6570
+ "tenant_id"
6571
+ ]
6530
6572
  }
6531
6573
  ],
6532
6574
  "version": "a1c330c8"
@@ -6868,6 +6910,12 @@
6868
6910
  "context"
6869
6911
  ],
6870
6912
  "unique": true
6913
+ },
6914
+ {
6915
+ "name": "opportunities_tenant_id_idx",
6916
+ "columns": [
6917
+ "tenant_id"
6918
+ ]
6871
6919
  }
6872
6920
  ],
6873
6921
  "version": "a403c6cf"
@@ -7091,6 +7139,12 @@
7091
7139
  "target_id"
7092
7140
  ],
7093
7141
  "unique": true
7142
+ },
7143
+ {
7144
+ "name": "opportunity_conversions_tenant_id_idx",
7145
+ "columns": [
7146
+ "tenant_id"
7147
+ ]
7094
7148
  }
7095
7149
  ],
7096
7150
  "version": "82c29042"
@@ -7544,6 +7598,12 @@
7544
7598
  "key"
7545
7599
  ],
7546
7600
  "unique": true
7601
+ },
7602
+ {
7603
+ "name": "pipeline_stages_tenant_id_idx",
7604
+ "columns": [
7605
+ "tenant_id"
7606
+ ]
7547
7607
  }
7548
7608
  ],
7549
7609
  "version": "bdb0cf4e"
@@ -7782,6 +7842,12 @@
7782
7842
  "context"
7783
7843
  ],
7784
7844
  "unique": true
7845
+ },
7846
+ {
7847
+ "name": "sales_activities_tenant_id_idx",
7848
+ "columns": [
7849
+ "tenant_id"
7850
+ ]
7785
7851
  }
7786
7852
  ],
7787
7853
  "version": "b3173b53"
@@ -7974,6 +8040,12 @@
7974
8040
  "context"
7975
8041
  ],
7976
8042
  "unique": true
8043
+ },
8044
+ {
8045
+ "name": "sales_representatives_tenant_id_idx",
8046
+ "columns": [
8047
+ "tenant_id"
8048
+ ]
7977
8049
  }
7978
8050
  ],
7979
8051
  "version": "7b67ed6e"
@@ -9435,6 +9507,12 @@
9435
9507
  "context"
9436
9508
  ],
9437
9509
  "unique": true
9510
+ },
9511
+ {
9512
+ "name": "attribution_exceptions_tenant_id_idx",
9513
+ "columns": [
9514
+ "tenant_id"
9515
+ ]
9438
9516
  }
9439
9517
  ],
9440
9518
  "version": "7b26a117"
@@ -10239,6 +10317,12 @@
10239
10317
  "context"
10240
10318
  ],
10241
10319
  "unique": true
10320
+ },
10321
+ {
10322
+ "name": "referrals_tenant_id_idx",
10323
+ "columns": [
10324
+ "tenant_id"
10325
+ ]
10242
10326
  }
10243
10327
  ],
10244
10328
  "version": "ad461382"
@@ -10628,6 +10712,12 @@
10628
10712
  "version"
10629
10713
  ],
10630
10714
  "unique": true
10715
+ },
10716
+ {
10717
+ "name": "referral_agreements_tenant_id_idx",
10718
+ "columns": [
10719
+ "tenant_id"
10720
+ ]
10631
10721
  }
10632
10722
  ],
10633
10723
  "version": "aadbced2"
@@ -10863,6 +10953,12 @@
10863
10953
  "columns": [
10864
10954
  "touch_id"
10865
10955
  ]
10956
+ },
10957
+ {
10958
+ "name": "referral_click_operations_tenant_id_idx",
10959
+ "columns": [
10960
+ "tenant_id"
10961
+ ]
10866
10962
  }
10867
10963
  ],
10868
10964
  "version": "f82840ee"
@@ -11125,6 +11221,12 @@
11125
11221
  "code"
11126
11222
  ],
11127
11223
  "unique": true
11224
+ },
11225
+ {
11226
+ "name": "referral_links_tenant_id_idx",
11227
+ "columns": [
11228
+ "tenant_id"
11229
+ ]
11128
11230
  }
11129
11231
  ],
11130
11232
  "version": "948b7e89"
@@ -11621,6 +11723,12 @@
11621
11723
  "context"
11622
11724
  ],
11623
11725
  "unique": true
11726
+ },
11727
+ {
11728
+ "name": "referral_term_snapshots_tenant_id_idx",
11729
+ "columns": [
11730
+ "tenant_id"
11731
+ ]
11624
11732
  }
11625
11733
  ],
11626
11734
  "version": "61077e65"
@@ -11897,6 +12005,12 @@
11897
12005
  "context"
11898
12006
  ],
11899
12007
  "unique": true
12008
+ },
12009
+ {
12010
+ "name": "referral_touches_tenant_id_idx",
12011
+ "columns": [
12012
+ "tenant_id"
12013
+ ]
11900
12014
  }
11901
12015
  ],
11902
12016
  "version": "3b3c5106"
@@ -12106,6 +12220,12 @@
12106
12220
  "context"
12107
12221
  ],
12108
12222
  "unique": true
12223
+ },
12224
+ {
12225
+ "name": "referrers_tenant_id_idx",
12226
+ "columns": [
12227
+ "tenant_id"
12228
+ ]
12109
12229
  }
12110
12230
  ],
12111
12231
  "version": "81f4908a"