@happyvertical/smrt-sales 0.60.9 → 0.60.11

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,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-sales",
5
- "packageVersion": "0.60.9",
5
+ "packageVersion": "0.60.11",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-sales:AgreementCollection": {
8
8
  "name": "agreementcollection",
@@ -164,8 +164,14 @@
164
164
  ],
165
165
  "schema": {
166
166
  "tableName": "agreements",
167
- "ddl": "CREATE TABLE IF NOT EXISTS \"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,\n \"kind\" TEXT NOT NULL DEFAULT '',\n \"party_a\" TEXT NOT NULL DEFAULT '',\n \"party_b\" TEXT NOT NULL DEFAULT '',\n \"version\" INTEGER DEFAULT 1,\n \"status\" TEXT DEFAULT 'draft',\n \"terms\" TEXT DEFAULT '{}',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"executed_agreement_id\" UUID,\n \"amendment_predecessor_id\" UUID,\n \"amendment_predecessor_end\" TIMESTAMP,\n \"metadata\" TEXT DEFAULT '{}'\n);",
167
+ "ddl": "CREATE TABLE IF NOT EXISTS \"agreements\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"kind\" TEXT NOT NULL DEFAULT '',\n \"party_a\" TEXT NOT NULL DEFAULT '',\n \"party_b\" TEXT NOT NULL DEFAULT '',\n \"version\" INTEGER DEFAULT 1,\n \"status\" TEXT DEFAULT 'draft',\n \"terms\" TEXT DEFAULT '{}',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"executed_agreement_id\" UUID,\n \"amendment_predecessor_id\" UUID,\n \"amendment_predecessor_end\" TIMESTAMP,\n \"metadata\" TEXT DEFAULT '{}'\n);",
168
168
  "columns": {
169
+ "_sync_origin_device_id": {
170
+ "type": "TEXT"
171
+ },
172
+ "_sync_revision": {
173
+ "type": "INTEGER"
174
+ },
169
175
  "id": {
170
176
  "type": "UUID",
171
177
  "primaryKey": true,
@@ -319,7 +325,7 @@
319
325
  ]
320
326
  }
321
327
  ],
322
- "version": "b9d6d0e8"
328
+ "version": "3309d055"
323
329
  },
324
330
  "importPath": "@happyvertical/smrt-sales/agreements"
325
331
  },
@@ -519,8 +525,14 @@
519
525
  ],
520
526
  "schema": {
521
527
  "tableName": "agreement_executions",
522
- "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);",
528
+ "ddl": "CREATE TABLE IF NOT EXISTS \"agreement_executions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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);",
523
529
  "columns": {
530
+ "_sync_origin_device_id": {
531
+ "type": "TEXT"
532
+ },
533
+ "_sync_revision": {
534
+ "type": "INTEGER"
535
+ },
524
536
  "id": {
525
537
  "type": "UUID",
526
538
  "primaryKey": true,
@@ -821,7 +833,7 @@
821
833
  ]
822
834
  }
823
835
  ],
824
- "version": "33a93a76"
836
+ "version": "32df6fda"
825
837
  },
826
838
  "importPath": "@happyvertical/smrt-sales/agreements"
827
839
  },
@@ -908,8 +920,14 @@
908
920
  ],
909
921
  "schema": {
910
922
  "tableName": "agreement_execution_events",
911
- "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);",
923
+ "ddl": "CREATE TABLE IF NOT EXISTS \"agreement_execution_events\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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);",
912
924
  "columns": {
925
+ "_sync_origin_device_id": {
926
+ "type": "TEXT"
927
+ },
928
+ "_sync_revision": {
929
+ "type": "INTEGER"
930
+ },
913
931
  "id": {
914
932
  "type": "UUID",
915
933
  "primaryKey": true,
@@ -1060,7 +1078,7 @@
1060
1078
  ]
1061
1079
  }
1062
1080
  ],
1063
- "version": "c2a25018"
1081
+ "version": "09d12856"
1064
1082
  },
1065
1083
  "importPath": "@happyvertical/smrt-sales/agreements"
1066
1084
  },
@@ -1172,8 +1190,14 @@
1172
1190
  ],
1173
1191
  "schema": {
1174
1192
  "tableName": "executed_agreements",
1175
- "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);",
1193
+ "ddl": "CREATE TABLE IF NOT EXISTS \"executed_agreements\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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);",
1176
1194
  "columns": {
1195
+ "_sync_origin_device_id": {
1196
+ "type": "TEXT"
1197
+ },
1198
+ "_sync_revision": {
1199
+ "type": "INTEGER"
1200
+ },
1177
1201
  "id": {
1178
1202
  "type": "UUID",
1179
1203
  "primaryKey": true,
@@ -1407,7 +1431,7 @@
1407
1431
  ]
1408
1432
  }
1409
1433
  ],
1410
- "version": "9b3fcc48"
1434
+ "version": "f88853da"
1411
1435
  },
1412
1436
  "importPath": "@happyvertical/smrt-sales/agreements"
1413
1437
  },
@@ -1712,8 +1736,14 @@
1712
1736
  ],
1713
1737
  "schema": {
1714
1738
  "tableName": "agreements",
1715
- "ddl": "CREATE TABLE IF NOT EXISTS \"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,\n \"kind\" TEXT NOT NULL DEFAULT '',\n \"party_a\" TEXT NOT NULL DEFAULT '',\n \"party_b\" TEXT NOT NULL DEFAULT '',\n \"version\" INTEGER DEFAULT 1,\n \"status\" TEXT DEFAULT 'draft',\n \"terms\" TEXT DEFAULT '{}',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"executed_agreement_id\" UUID,\n \"amendment_predecessor_id\" UUID,\n \"amendment_predecessor_end\" TIMESTAMP,\n \"metadata\" TEXT DEFAULT '{}'\n);",
1739
+ "ddl": "CREATE TABLE IF NOT EXISTS \"agreements\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"kind\" TEXT NOT NULL DEFAULT '',\n \"party_a\" TEXT NOT NULL DEFAULT '',\n \"party_b\" TEXT NOT NULL DEFAULT '',\n \"version\" INTEGER DEFAULT 1,\n \"status\" TEXT DEFAULT 'draft',\n \"terms\" TEXT DEFAULT '{}',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"executed_agreement_id\" UUID,\n \"amendment_predecessor_id\" UUID,\n \"amendment_predecessor_end\" TIMESTAMP,\n \"metadata\" TEXT DEFAULT '{}'\n);",
1716
1740
  "columns": {
1741
+ "_sync_origin_device_id": {
1742
+ "type": "TEXT"
1743
+ },
1744
+ "_sync_revision": {
1745
+ "type": "INTEGER"
1746
+ },
1717
1747
  "id": {
1718
1748
  "type": "UUID",
1719
1749
  "primaryKey": true,
@@ -1867,7 +1897,7 @@
1867
1897
  ]
1868
1898
  }
1869
1899
  ],
1870
- "version": "b9d6d0e8"
1900
+ "version": "3309d055"
1871
1901
  },
1872
1902
  "importPath": "@happyvertical/smrt-sales/agreements"
1873
1903
  },
@@ -2172,8 +2202,14 @@
2172
2202
  ],
2173
2203
  "schema": {
2174
2204
  "tableName": "agreement_executions",
2175
- "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);",
2205
+ "ddl": "CREATE TABLE IF NOT EXISTS \"agreement_executions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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);",
2176
2206
  "columns": {
2207
+ "_sync_origin_device_id": {
2208
+ "type": "TEXT"
2209
+ },
2210
+ "_sync_revision": {
2211
+ "type": "INTEGER"
2212
+ },
2177
2213
  "id": {
2178
2214
  "type": "UUID",
2179
2215
  "primaryKey": true,
@@ -2474,7 +2510,7 @@
2474
2510
  ]
2475
2511
  }
2476
2512
  ],
2477
- "version": "33a93a76"
2513
+ "version": "32df6fda"
2478
2514
  },
2479
2515
  "importPath": "@happyvertical/smrt-sales/agreements"
2480
2516
  },
@@ -2631,8 +2667,14 @@
2631
2667
  ],
2632
2668
  "schema": {
2633
2669
  "tableName": "agreement_execution_events",
2634
- "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);",
2670
+ "ddl": "CREATE TABLE IF NOT EXISTS \"agreement_execution_events\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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);",
2635
2671
  "columns": {
2672
+ "_sync_origin_device_id": {
2673
+ "type": "TEXT"
2674
+ },
2675
+ "_sync_revision": {
2676
+ "type": "INTEGER"
2677
+ },
2636
2678
  "id": {
2637
2679
  "type": "UUID",
2638
2680
  "primaryKey": true,
@@ -2783,7 +2825,7 @@
2783
2825
  ]
2784
2826
  }
2785
2827
  ],
2786
- "version": "c2a25018"
2828
+ "version": "09d12856"
2787
2829
  },
2788
2830
  "importPath": "@happyvertical/smrt-sales/agreements"
2789
2831
  },
@@ -3016,8 +3058,14 @@
3016
3058
  ],
3017
3059
  "schema": {
3018
3060
  "tableName": "executed_agreements",
3019
- "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);",
3061
+ "ddl": "CREATE TABLE IF NOT EXISTS \"executed_agreements\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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);",
3020
3062
  "columns": {
3063
+ "_sync_origin_device_id": {
3064
+ "type": "TEXT"
3065
+ },
3066
+ "_sync_revision": {
3067
+ "type": "INTEGER"
3068
+ },
3021
3069
  "id": {
3022
3070
  "type": "UUID",
3023
3071
  "primaryKey": true,
@@ -3251,7 +3299,7 @@
3251
3299
  ]
3252
3300
  }
3253
3301
  ],
3254
- "version": "9b3fcc48"
3302
+ "version": "f88853da"
3255
3303
  },
3256
3304
  "importPath": "@happyvertical/smrt-sales/agreements"
3257
3305
  },
@@ -3392,8 +3440,14 @@
3392
3440
  ],
3393
3441
  "schema": {
3394
3442
  "tableName": "commission_adjustments",
3395
- "ddl": "CREATE TABLE IF NOT EXISTS \"commission_adjustments\" (\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,\n \"commission_id\" UUID NOT NULL,\n \"earner_id\" UUID NOT NULL,\n \"adjustment_kind\" TEXT DEFAULT 'correction',\n \"amount_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"reason\" TEXT NOT NULL DEFAULT '',\n \"created_by_profile_id\" UUID,\n \"payout_id\" UUID,\n \"metadata\" TEXT DEFAULT '{}'\n);",
3443
+ "ddl": "CREATE TABLE IF NOT EXISTS \"commission_adjustments\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"commission_id\" UUID NOT NULL,\n \"earner_id\" UUID NOT NULL,\n \"adjustment_kind\" TEXT DEFAULT 'correction',\n \"amount_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"reason\" TEXT NOT NULL DEFAULT '',\n \"created_by_profile_id\" UUID,\n \"payout_id\" UUID,\n \"metadata\" TEXT DEFAULT '{}'\n);",
3396
3444
  "columns": {
3445
+ "_sync_origin_device_id": {
3446
+ "type": "TEXT"
3447
+ },
3448
+ "_sync_revision": {
3449
+ "type": "INTEGER"
3450
+ },
3397
3451
  "id": {
3398
3452
  "type": "UUID",
3399
3453
  "primaryKey": true,
@@ -3541,7 +3595,7 @@
3541
3595
  ]
3542
3596
  }
3543
3597
  ],
3544
- "version": "c5251e54"
3598
+ "version": "b5b2c9bd"
3545
3599
  },
3546
3600
  "importPath": "@happyvertical/smrt-sales/commissions"
3547
3601
  },
@@ -3600,8 +3654,14 @@
3600
3654
  ],
3601
3655
  "schema": {
3602
3656
  "tableName": "commission_adjustment_operations",
3603
- "ddl": "CREATE TABLE IF NOT EXISTS \"commission_adjustment_operations\" (\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 \"adjustment_id\" UUID NOT NULL\n);",
3657
+ "ddl": "CREATE TABLE IF NOT EXISTS \"commission_adjustment_operations\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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 \"adjustment_id\" UUID NOT NULL\n);",
3604
3658
  "columns": {
3659
+ "_sync_origin_device_id": {
3660
+ "type": "TEXT"
3661
+ },
3662
+ "_sync_revision": {
3663
+ "type": "INTEGER"
3664
+ },
3605
3665
  "id": {
3606
3666
  "type": "UUID",
3607
3667
  "primaryKey": true,
@@ -3663,7 +3723,7 @@
3663
3723
  ]
3664
3724
  }
3665
3725
  ],
3666
- "version": "a8aae269"
3726
+ "version": "dc71b1a8"
3667
3727
  },
3668
3728
  "importPath": "@happyvertical/smrt-sales/commissions"
3669
3729
  },
@@ -3862,8 +3922,14 @@
3862
3922
  ],
3863
3923
  "schema": {
3864
3924
  "tableName": "commissions",
3865
- "ddl": "CREATE TABLE IF NOT EXISTS \"commissions\" (\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,\n \"earner_id\" UUID NOT NULL,\n \"earning_event_id\" UUID,\n \"plan_key\" TEXT DEFAULT '',\n \"plan_version\" INTEGER DEFAULT 0,\n \"component_key\" TEXT DEFAULT '',\n \"terms_snapshot_kind\" TEXT DEFAULT '',\n \"terms_snapshot_id\" TEXT DEFAULT '',\n \"basis\" TEXT DEFAULT 'gross',\n \"base_amount_cents\" INTEGER DEFAULT 0,\n \"rate\" REAL DEFAULT 0,\n \"share_fraction\" REAL DEFAULT 1,\n \"split_group_id\" TEXT DEFAULT '',\n \"amount_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"status\" TEXT DEFAULT 'pending',\n \"clearing_ends_at\" TIMESTAMP,\n \"earned_at\" TIMESTAMP,\n \"approved_at\" TIMESTAMP,\n \"payable_at\" TIMESTAMP,\n \"paid_at\" TIMESTAMP,\n \"payout_id\" UUID,\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"calculation_trace\" TEXT DEFAULT '{}',\n \"dedupe_key\" TEXT NOT NULL DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
3925
+ "ddl": "CREATE TABLE IF NOT EXISTS \"commissions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"earner_id\" UUID NOT NULL,\n \"earning_event_id\" UUID,\n \"plan_key\" TEXT DEFAULT '',\n \"plan_version\" INTEGER DEFAULT 0,\n \"component_key\" TEXT DEFAULT '',\n \"terms_snapshot_kind\" TEXT DEFAULT '',\n \"terms_snapshot_id\" TEXT DEFAULT '',\n \"basis\" TEXT DEFAULT 'gross',\n \"base_amount_cents\" INTEGER DEFAULT 0,\n \"rate\" REAL DEFAULT 0,\n \"share_fraction\" REAL DEFAULT 1,\n \"split_group_id\" TEXT DEFAULT '',\n \"amount_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"status\" TEXT DEFAULT 'pending',\n \"clearing_ends_at\" TIMESTAMP,\n \"earned_at\" TIMESTAMP,\n \"approved_at\" TIMESTAMP,\n \"payable_at\" TIMESTAMP,\n \"paid_at\" TIMESTAMP,\n \"payout_id\" UUID,\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"calculation_trace\" TEXT DEFAULT '{}',\n \"dedupe_key\" TEXT NOT NULL DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
3866
3926
  "columns": {
3927
+ "_sync_origin_device_id": {
3928
+ "type": "TEXT"
3929
+ },
3930
+ "_sync_revision": {
3931
+ "type": "INTEGER"
3932
+ },
3867
3933
  "id": {
3868
3934
  "type": "UUID",
3869
3935
  "primaryKey": true,
@@ -4108,7 +4174,7 @@
4108
4174
  ]
4109
4175
  }
4110
4176
  ],
4111
- "version": "3c023114"
4177
+ "version": "74bec72b"
4112
4178
  },
4113
4179
  "importPath": "@happyvertical/smrt-sales/commissions"
4114
4180
  },
@@ -4269,8 +4335,14 @@
4269
4335
  ],
4270
4336
  "schema": {
4271
4337
  "tableName": "commission_payouts",
4272
- "ddl": "CREATE TABLE IF NOT EXISTS \"commission_payouts\" (\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,\n \"earner_id\" UUID NOT NULL,\n \"period_start\" TIMESTAMP,\n \"period_end\" TIMESTAMP,\n \"commission_total_cents\" INTEGER DEFAULT 0,\n \"adjustment_total_cents\" INTEGER DEFAULT 0,\n \"total_amount_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"payout_method\" TEXT DEFAULT 'bank_transfer',\n \"payout_destination\" TEXT DEFAULT '{}',\n \"status\" TEXT DEFAULT 'pending',\n \"payment_reference\" TEXT DEFAULT '',\n \"provider_ref\" TEXT DEFAULT '',\n \"paid_at\" TIMESTAMP,\n \"invoice_id\" UUID,\n \"notes\" TEXT DEFAULT '',\n \"idempotency_key\" TEXT NOT NULL DEFAULT '',\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
4338
+ "ddl": "CREATE TABLE IF NOT EXISTS \"commission_payouts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"earner_id\" UUID NOT NULL,\n \"period_start\" TIMESTAMP,\n \"period_end\" TIMESTAMP,\n \"commission_total_cents\" INTEGER DEFAULT 0,\n \"adjustment_total_cents\" INTEGER DEFAULT 0,\n \"total_amount_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"payout_method\" TEXT DEFAULT 'bank_transfer',\n \"payout_destination\" TEXT DEFAULT '{}',\n \"status\" TEXT DEFAULT 'pending',\n \"payment_reference\" TEXT DEFAULT '',\n \"provider_ref\" TEXT DEFAULT '',\n \"paid_at\" TIMESTAMP,\n \"invoice_id\" UUID,\n \"notes\" TEXT DEFAULT '',\n \"idempotency_key\" TEXT NOT NULL DEFAULT '',\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
4273
4339
  "columns": {
4340
+ "_sync_origin_device_id": {
4341
+ "type": "TEXT"
4342
+ },
4343
+ "_sync_revision": {
4344
+ "type": "INTEGER"
4345
+ },
4274
4346
  "id": {
4275
4347
  "type": "UUID",
4276
4348
  "primaryKey": true,
@@ -4463,7 +4535,7 @@
4463
4535
  ]
4464
4536
  }
4465
4537
  ],
4466
- "version": "242b9cec"
4538
+ "version": "a081b5bf"
4467
4539
  },
4468
4540
  "importPath": "@happyvertical/smrt-sales/commissions"
4469
4541
  },
@@ -4582,8 +4654,14 @@
4582
4654
  ],
4583
4655
  "schema": {
4584
4656
  "tableName": "commission_plans",
4585
- "ddl": "CREATE TABLE IF NOT EXISTS \"commission_plans\" (\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,\n \"plan_key\" TEXT NOT NULL DEFAULT '',\n \"version\" INTEGER DEFAULT 1,\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'draft',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"currency\" TEXT DEFAULT 'USD',\n \"components\" TEXT DEFAULT '[]',\n \"steps\" TEXT DEFAULT '[]',\n \"remainder_sink\" TEXT DEFAULT '{}',\n \"application_fee_offset_recipient\" TEXT DEFAULT '{}',\n \"metadata\" TEXT DEFAULT '{}'\n);",
4657
+ "ddl": "CREATE TABLE IF NOT EXISTS \"commission_plans\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"plan_key\" TEXT NOT NULL DEFAULT '',\n \"version\" INTEGER DEFAULT 1,\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'draft',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"currency\" TEXT DEFAULT 'USD',\n \"components\" TEXT DEFAULT '[]',\n \"steps\" TEXT DEFAULT '[]',\n \"remainder_sink\" TEXT DEFAULT '{}',\n \"application_fee_offset_recipient\" TEXT DEFAULT '{}',\n \"metadata\" TEXT DEFAULT '{}'\n);",
4586
4658
  "columns": {
4659
+ "_sync_origin_device_id": {
4660
+ "type": "TEXT"
4661
+ },
4662
+ "_sync_revision": {
4663
+ "type": "INTEGER"
4664
+ },
4587
4665
  "id": {
4588
4666
  "type": "UUID",
4589
4667
  "primaryKey": true,
@@ -4718,7 +4796,7 @@
4718
4796
  ]
4719
4797
  }
4720
4798
  ],
4721
- "version": "2fe6eb4a"
4799
+ "version": "6495a60c"
4722
4800
  },
4723
4801
  "importPath": "@happyvertical/smrt-sales/commissions"
4724
4802
  },
@@ -4796,8 +4874,14 @@
4796
4874
  ],
4797
4875
  "schema": {
4798
4876
  "tableName": "earners",
4799
- "ddl": "CREATE TABLE IF NOT EXISTS \"earners\" (\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,\n \"kind\" TEXT DEFAULT 'person',\n \"profile_id\" UUID,\n \"display_name\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'pending',\n \"payout_method\" TEXT DEFAULT 'bank_transfer',\n \"payout_destination\" TEXT DEFAULT '{}',\n \"payout_threshold_cents\" INTEGER DEFAULT 5000,\n \"payout_schedule_key\" TEXT DEFAULT 'manual',\n \"currency\" TEXT DEFAULT 'USD',\n \"metadata\" TEXT DEFAULT '{}'\n);",
4877
+ "ddl": "CREATE TABLE IF NOT EXISTS \"earners\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"kind\" TEXT DEFAULT 'person',\n \"profile_id\" UUID,\n \"display_name\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'pending',\n \"payout_method\" TEXT DEFAULT 'bank_transfer',\n \"payout_destination\" TEXT DEFAULT '{}',\n \"payout_threshold_cents\" INTEGER DEFAULT 5000,\n \"payout_schedule_key\" TEXT DEFAULT 'manual',\n \"currency\" TEXT DEFAULT 'USD',\n \"metadata\" TEXT DEFAULT '{}'\n);",
4800
4878
  "columns": {
4879
+ "_sync_origin_device_id": {
4880
+ "type": "TEXT"
4881
+ },
4882
+ "_sync_revision": {
4883
+ "type": "INTEGER"
4884
+ },
4801
4885
  "id": {
4802
4886
  "type": "UUID",
4803
4887
  "primaryKey": true,
@@ -4915,7 +4999,7 @@
4915
4999
  ]
4916
5000
  }
4917
5001
  ],
4918
- "version": "f9c840f9"
5002
+ "version": "29a6f5ba"
4919
5003
  },
4920
5004
  "importPath": "@happyvertical/smrt-sales/commissions"
4921
5005
  },
@@ -5018,8 +5102,14 @@
5018
5102
  ],
5019
5103
  "schema": {
5020
5104
  "tableName": "earner_source_attributions",
5021
- "ddl": "CREATE TABLE IF NOT EXISTS \"earner_source_attributions\" (\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,\n \"earner_id\" UUID NOT NULL,\n \"source_kind\" TEXT NOT NULL DEFAULT '',\n \"source_id\" TEXT NOT NULL DEFAULT '',\n \"status\" TEXT DEFAULT 'active',\n \"metadata\" TEXT DEFAULT '{}'\n);",
5105
+ "ddl": "CREATE TABLE IF NOT EXISTS \"earner_source_attributions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"earner_id\" UUID NOT NULL,\n \"source_kind\" TEXT NOT NULL DEFAULT '',\n \"source_id\" TEXT NOT NULL DEFAULT '',\n \"status\" TEXT DEFAULT 'active',\n \"metadata\" TEXT DEFAULT '{}'\n);",
5022
5106
  "columns": {
5107
+ "_sync_origin_device_id": {
5108
+ "type": "TEXT"
5109
+ },
5110
+ "_sync_revision": {
5111
+ "type": "INTEGER"
5112
+ },
5023
5113
  "id": {
5024
5114
  "type": "UUID",
5025
5115
  "primaryKey": true,
@@ -5126,7 +5216,7 @@
5126
5216
  ]
5127
5217
  }
5128
5218
  ],
5129
- "version": "56e4ef49"
5219
+ "version": "e8751018"
5130
5220
  },
5131
5221
  "importPath": "@happyvertical/smrt-sales/commissions"
5132
5222
  },
@@ -5237,8 +5327,14 @@
5237
5327
  ],
5238
5328
  "schema": {
5239
5329
  "tableName": "earning_events",
5240
- "ddl": "CREATE TABLE IF NOT EXISTS \"earning_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,\n \"event_kind\" TEXT NOT NULL DEFAULT '',\n \"occurred_at\" TIMESTAMP,\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"gross_amount_cents\" INTEGER DEFAULT 0,\n \"net_amount_cents\" INTEGER,\n \"margin_cents\" INTEGER,\n \"currency\" TEXT DEFAULT 'USD',\n \"custom_bases\" TEXT DEFAULT '{}',\n \"dedupe_key\" TEXT NOT NULL DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
5330
+ "ddl": "CREATE TABLE IF NOT EXISTS \"earning_events\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"event_kind\" TEXT NOT NULL DEFAULT '',\n \"occurred_at\" TIMESTAMP,\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"gross_amount_cents\" INTEGER DEFAULT 0,\n \"net_amount_cents\" INTEGER,\n \"margin_cents\" INTEGER,\n \"currency\" TEXT DEFAULT 'USD',\n \"custom_bases\" TEXT DEFAULT '{}',\n \"dedupe_key\" TEXT NOT NULL DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
5241
5331
  "columns": {
5332
+ "_sync_origin_device_id": {
5333
+ "type": "TEXT"
5334
+ },
5335
+ "_sync_revision": {
5336
+ "type": "INTEGER"
5337
+ },
5242
5338
  "id": {
5243
5339
  "type": "UUID",
5244
5340
  "primaryKey": true,
@@ -5359,7 +5455,7 @@
5359
5455
  ]
5360
5456
  }
5361
5457
  ],
5362
- "version": "aca82726"
5458
+ "version": "26f33ad9"
5363
5459
  },
5364
5460
  "importPath": "@happyvertical/smrt-sales/commissions"
5365
5461
  },
@@ -5749,8 +5845,14 @@
5749
5845
  ],
5750
5846
  "schema": {
5751
5847
  "tableName": "commissions",
5752
- "ddl": "CREATE TABLE IF NOT EXISTS \"commissions\" (\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,\n \"earner_id\" UUID NOT NULL,\n \"earning_event_id\" UUID,\n \"plan_key\" TEXT DEFAULT '',\n \"plan_version\" INTEGER DEFAULT 0,\n \"component_key\" TEXT DEFAULT '',\n \"terms_snapshot_kind\" TEXT DEFAULT '',\n \"terms_snapshot_id\" TEXT DEFAULT '',\n \"basis\" TEXT DEFAULT 'gross',\n \"base_amount_cents\" INTEGER DEFAULT 0,\n \"rate\" REAL DEFAULT 0,\n \"share_fraction\" REAL DEFAULT 1,\n \"split_group_id\" TEXT DEFAULT '',\n \"amount_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"status\" TEXT DEFAULT 'pending',\n \"clearing_ends_at\" TIMESTAMP,\n \"earned_at\" TIMESTAMP,\n \"approved_at\" TIMESTAMP,\n \"payable_at\" TIMESTAMP,\n \"paid_at\" TIMESTAMP,\n \"payout_id\" UUID,\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"calculation_trace\" TEXT DEFAULT '{}',\n \"dedupe_key\" TEXT NOT NULL DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
5848
+ "ddl": "CREATE TABLE IF NOT EXISTS \"commissions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"earner_id\" UUID NOT NULL,\n \"earning_event_id\" UUID,\n \"plan_key\" TEXT DEFAULT '',\n \"plan_version\" INTEGER DEFAULT 0,\n \"component_key\" TEXT DEFAULT '',\n \"terms_snapshot_kind\" TEXT DEFAULT '',\n \"terms_snapshot_id\" TEXT DEFAULT '',\n \"basis\" TEXT DEFAULT 'gross',\n \"base_amount_cents\" INTEGER DEFAULT 0,\n \"rate\" REAL DEFAULT 0,\n \"share_fraction\" REAL DEFAULT 1,\n \"split_group_id\" TEXT DEFAULT '',\n \"amount_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"status\" TEXT DEFAULT 'pending',\n \"clearing_ends_at\" TIMESTAMP,\n \"earned_at\" TIMESTAMP,\n \"approved_at\" TIMESTAMP,\n \"payable_at\" TIMESTAMP,\n \"paid_at\" TIMESTAMP,\n \"payout_id\" UUID,\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"calculation_trace\" TEXT DEFAULT '{}',\n \"dedupe_key\" TEXT NOT NULL DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
5753
5849
  "columns": {
5850
+ "_sync_origin_device_id": {
5851
+ "type": "TEXT"
5852
+ },
5853
+ "_sync_revision": {
5854
+ "type": "INTEGER"
5855
+ },
5754
5856
  "id": {
5755
5857
  "type": "UUID",
5756
5858
  "primaryKey": true,
@@ -5995,7 +6097,7 @@
5995
6097
  ]
5996
6098
  }
5997
6099
  ],
5998
- "version": "3c023114"
6100
+ "version": "74bec72b"
5999
6101
  },
6000
6102
  "importPath": "@happyvertical/smrt-sales/commissions"
6001
6103
  },
@@ -6180,8 +6282,14 @@
6180
6282
  ],
6181
6283
  "schema": {
6182
6284
  "tableName": "commission_adjustments",
6183
- "ddl": "CREATE TABLE IF NOT EXISTS \"commission_adjustments\" (\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,\n \"commission_id\" UUID NOT NULL,\n \"earner_id\" UUID NOT NULL,\n \"adjustment_kind\" TEXT DEFAULT 'correction',\n \"amount_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"reason\" TEXT NOT NULL DEFAULT '',\n \"created_by_profile_id\" UUID,\n \"payout_id\" UUID,\n \"metadata\" TEXT DEFAULT '{}'\n);",
6285
+ "ddl": "CREATE TABLE IF NOT EXISTS \"commission_adjustments\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"commission_id\" UUID NOT NULL,\n \"earner_id\" UUID NOT NULL,\n \"adjustment_kind\" TEXT DEFAULT 'correction',\n \"amount_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"reason\" TEXT NOT NULL DEFAULT '',\n \"created_by_profile_id\" UUID,\n \"payout_id\" UUID,\n \"metadata\" TEXT DEFAULT '{}'\n);",
6184
6286
  "columns": {
6287
+ "_sync_origin_device_id": {
6288
+ "type": "TEXT"
6289
+ },
6290
+ "_sync_revision": {
6291
+ "type": "INTEGER"
6292
+ },
6185
6293
  "id": {
6186
6294
  "type": "UUID",
6187
6295
  "primaryKey": true,
@@ -6329,7 +6437,7 @@
6329
6437
  ]
6330
6438
  }
6331
6439
  ],
6332
- "version": "c5251e54"
6440
+ "version": "b5b2c9bd"
6333
6441
  },
6334
6442
  "importPath": "@happyvertical/smrt-sales/commissions"
6335
6443
  },
@@ -6397,8 +6505,14 @@
6397
6505
  ],
6398
6506
  "schema": {
6399
6507
  "tableName": "commission_adjustment_operations",
6400
- "ddl": "CREATE TABLE IF NOT EXISTS \"commission_adjustment_operations\" (\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 \"adjustment_id\" UUID NOT NULL\n);",
6508
+ "ddl": "CREATE TABLE IF NOT EXISTS \"commission_adjustment_operations\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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 \"adjustment_id\" UUID NOT NULL\n);",
6401
6509
  "columns": {
6510
+ "_sync_origin_device_id": {
6511
+ "type": "TEXT"
6512
+ },
6513
+ "_sync_revision": {
6514
+ "type": "INTEGER"
6515
+ },
6402
6516
  "id": {
6403
6517
  "type": "UUID",
6404
6518
  "primaryKey": true,
@@ -6460,7 +6574,7 @@
6460
6574
  ]
6461
6575
  }
6462
6576
  ],
6463
- "version": "a8aae269"
6577
+ "version": "dc71b1a8"
6464
6578
  },
6465
6579
  "importPath": "@happyvertical/smrt-sales/commissions"
6466
6580
  },
@@ -6859,8 +6973,14 @@
6859
6973
  ],
6860
6974
  "schema": {
6861
6975
  "tableName": "commission_payouts",
6862
- "ddl": "CREATE TABLE IF NOT EXISTS \"commission_payouts\" (\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,\n \"earner_id\" UUID NOT NULL,\n \"period_start\" TIMESTAMP,\n \"period_end\" TIMESTAMP,\n \"commission_total_cents\" INTEGER DEFAULT 0,\n \"adjustment_total_cents\" INTEGER DEFAULT 0,\n \"total_amount_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"payout_method\" TEXT DEFAULT 'bank_transfer',\n \"payout_destination\" TEXT DEFAULT '{}',\n \"status\" TEXT DEFAULT 'pending',\n \"payment_reference\" TEXT DEFAULT '',\n \"provider_ref\" TEXT DEFAULT '',\n \"paid_at\" TIMESTAMP,\n \"invoice_id\" UUID,\n \"notes\" TEXT DEFAULT '',\n \"idempotency_key\" TEXT NOT NULL DEFAULT '',\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
6976
+ "ddl": "CREATE TABLE IF NOT EXISTS \"commission_payouts\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"earner_id\" UUID NOT NULL,\n \"period_start\" TIMESTAMP,\n \"period_end\" TIMESTAMP,\n \"commission_total_cents\" INTEGER DEFAULT 0,\n \"adjustment_total_cents\" INTEGER DEFAULT 0,\n \"total_amount_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"payout_method\" TEXT DEFAULT 'bank_transfer',\n \"payout_destination\" TEXT DEFAULT '{}',\n \"status\" TEXT DEFAULT 'pending',\n \"payment_reference\" TEXT DEFAULT '',\n \"provider_ref\" TEXT DEFAULT '',\n \"paid_at\" TIMESTAMP,\n \"invoice_id\" UUID,\n \"notes\" TEXT DEFAULT '',\n \"idempotency_key\" TEXT NOT NULL DEFAULT '',\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
6863
6977
  "columns": {
6978
+ "_sync_origin_device_id": {
6979
+ "type": "TEXT"
6980
+ },
6981
+ "_sync_revision": {
6982
+ "type": "INTEGER"
6983
+ },
6864
6984
  "id": {
6865
6985
  "type": "UUID",
6866
6986
  "primaryKey": true,
@@ -7053,7 +7173,7 @@
7053
7173
  ]
7054
7174
  }
7055
7175
  ],
7056
- "version": "242b9cec"
7176
+ "version": "a081b5bf"
7057
7177
  },
7058
7178
  "importPath": "@happyvertical/smrt-sales/commissions"
7059
7179
  },
@@ -7349,8 +7469,14 @@
7349
7469
  ],
7350
7470
  "schema": {
7351
7471
  "tableName": "commission_plans",
7352
- "ddl": "CREATE TABLE IF NOT EXISTS \"commission_plans\" (\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,\n \"plan_key\" TEXT NOT NULL DEFAULT '',\n \"version\" INTEGER DEFAULT 1,\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'draft',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"currency\" TEXT DEFAULT 'USD',\n \"components\" TEXT DEFAULT '[]',\n \"steps\" TEXT DEFAULT '[]',\n \"remainder_sink\" TEXT DEFAULT '{}',\n \"application_fee_offset_recipient\" TEXT DEFAULT '{}',\n \"metadata\" TEXT DEFAULT '{}'\n);",
7472
+ "ddl": "CREATE TABLE IF NOT EXISTS \"commission_plans\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"plan_key\" TEXT NOT NULL DEFAULT '',\n \"version\" INTEGER DEFAULT 1,\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'draft',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"currency\" TEXT DEFAULT 'USD',\n \"components\" TEXT DEFAULT '[]',\n \"steps\" TEXT DEFAULT '[]',\n \"remainder_sink\" TEXT DEFAULT '{}',\n \"application_fee_offset_recipient\" TEXT DEFAULT '{}',\n \"metadata\" TEXT DEFAULT '{}'\n);",
7353
7473
  "columns": {
7474
+ "_sync_origin_device_id": {
7475
+ "type": "TEXT"
7476
+ },
7477
+ "_sync_revision": {
7478
+ "type": "INTEGER"
7479
+ },
7354
7480
  "id": {
7355
7481
  "type": "UUID",
7356
7482
  "primaryKey": true,
@@ -7485,7 +7611,7 @@
7485
7611
  ]
7486
7612
  }
7487
7613
  ],
7488
- "version": "2fe6eb4a"
7614
+ "version": "6495a60c"
7489
7615
  },
7490
7616
  "importPath": "@happyvertical/smrt-sales/commissions"
7491
7617
  },
@@ -7715,8 +7841,14 @@
7715
7841
  "collectionExportName": "EarnerCollection",
7716
7842
  "schema": {
7717
7843
  "tableName": "earners",
7718
- "ddl": "CREATE TABLE IF NOT EXISTS \"earners\" (\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,\n \"kind\" TEXT DEFAULT 'person',\n \"profile_id\" UUID,\n \"display_name\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'pending',\n \"payout_method\" TEXT DEFAULT 'bank_transfer',\n \"payout_destination\" TEXT DEFAULT '{}',\n \"payout_threshold_cents\" INTEGER DEFAULT 5000,\n \"payout_schedule_key\" TEXT DEFAULT 'manual',\n \"currency\" TEXT DEFAULT 'USD',\n \"metadata\" TEXT DEFAULT '{}'\n);",
7844
+ "ddl": "CREATE TABLE IF NOT EXISTS \"earners\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"kind\" TEXT DEFAULT 'person',\n \"profile_id\" UUID,\n \"display_name\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'pending',\n \"payout_method\" TEXT DEFAULT 'bank_transfer',\n \"payout_destination\" TEXT DEFAULT '{}',\n \"payout_threshold_cents\" INTEGER DEFAULT 5000,\n \"payout_schedule_key\" TEXT DEFAULT 'manual',\n \"currency\" TEXT DEFAULT 'USD',\n \"metadata\" TEXT DEFAULT '{}'\n);",
7719
7845
  "columns": {
7846
+ "_sync_origin_device_id": {
7847
+ "type": "TEXT"
7848
+ },
7849
+ "_sync_revision": {
7850
+ "type": "INTEGER"
7851
+ },
7720
7852
  "id": {
7721
7853
  "type": "UUID",
7722
7854
  "primaryKey": true,
@@ -7834,7 +7966,7 @@
7834
7966
  ]
7835
7967
  }
7836
7968
  ],
7837
- "version": "f9c840f9"
7969
+ "version": "29a6f5ba"
7838
7970
  },
7839
7971
  "importPath": "@happyvertical/smrt-sales/commissions"
7840
7972
  },
@@ -8001,8 +8133,14 @@
8001
8133
  ],
8002
8134
  "schema": {
8003
8135
  "tableName": "earner_source_attributions",
8004
- "ddl": "CREATE TABLE IF NOT EXISTS \"earner_source_attributions\" (\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,\n \"earner_id\" UUID NOT NULL,\n \"source_kind\" TEXT NOT NULL DEFAULT '',\n \"source_id\" TEXT NOT NULL DEFAULT '',\n \"status\" TEXT DEFAULT 'active',\n \"metadata\" TEXT DEFAULT '{}'\n);",
8136
+ "ddl": "CREATE TABLE IF NOT EXISTS \"earner_source_attributions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"earner_id\" UUID NOT NULL,\n \"source_kind\" TEXT NOT NULL DEFAULT '',\n \"source_id\" TEXT NOT NULL DEFAULT '',\n \"status\" TEXT DEFAULT 'active',\n \"metadata\" TEXT DEFAULT '{}'\n);",
8005
8137
  "columns": {
8138
+ "_sync_origin_device_id": {
8139
+ "type": "TEXT"
8140
+ },
8141
+ "_sync_revision": {
8142
+ "type": "INTEGER"
8143
+ },
8006
8144
  "id": {
8007
8145
  "type": "UUID",
8008
8146
  "primaryKey": true,
@@ -8109,7 +8247,7 @@
8109
8247
  ]
8110
8248
  }
8111
8249
  ],
8112
- "version": "56e4ef49"
8250
+ "version": "e8751018"
8113
8251
  },
8114
8252
  "importPath": "@happyvertical/smrt-sales/commissions"
8115
8253
  },
@@ -8312,8 +8450,14 @@
8312
8450
  ],
8313
8451
  "schema": {
8314
8452
  "tableName": "earning_events",
8315
- "ddl": "CREATE TABLE IF NOT EXISTS \"earning_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,\n \"event_kind\" TEXT NOT NULL DEFAULT '',\n \"occurred_at\" TIMESTAMP,\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"gross_amount_cents\" INTEGER DEFAULT 0,\n \"net_amount_cents\" INTEGER,\n \"margin_cents\" INTEGER,\n \"currency\" TEXT DEFAULT 'USD',\n \"custom_bases\" TEXT DEFAULT '{}',\n \"dedupe_key\" TEXT NOT NULL DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
8453
+ "ddl": "CREATE TABLE IF NOT EXISTS \"earning_events\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"event_kind\" TEXT NOT NULL DEFAULT '',\n \"occurred_at\" TIMESTAMP,\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"gross_amount_cents\" INTEGER DEFAULT 0,\n \"net_amount_cents\" INTEGER,\n \"margin_cents\" INTEGER,\n \"currency\" TEXT DEFAULT 'USD',\n \"custom_bases\" TEXT DEFAULT '{}',\n \"dedupe_key\" TEXT NOT NULL DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
8316
8454
  "columns": {
8455
+ "_sync_origin_device_id": {
8456
+ "type": "TEXT"
8457
+ },
8458
+ "_sync_revision": {
8459
+ "type": "INTEGER"
8460
+ },
8317
8461
  "id": {
8318
8462
  "type": "UUID",
8319
8463
  "primaryKey": true,
@@ -8434,7 +8578,7 @@
8434
8578
  ]
8435
8579
  }
8436
8580
  ],
8437
- "version": "aca82726"
8581
+ "version": "26f33ad9"
8438
8582
  },
8439
8583
  "importPath": "@happyvertical/smrt-sales/commissions"
8440
8584
  },
@@ -8560,8 +8704,14 @@
8560
8704
  ],
8561
8705
  "schema": {
8562
8706
  "tableName": "leads",
8563
- "ddl": "CREATE TABLE IF NOT EXISTS \"leads\" (\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,\n \"name\" TEXT NOT NULL DEFAULT '',\n \"contact_name\" TEXT DEFAULT '',\n \"email\" TEXT DEFAULT '',\n \"phone\" TEXT DEFAULT '',\n \"organization_name\" TEXT DEFAULT '',\n \"profile_id\" UUID,\n \"owner_rep_id\" UUID,\n \"status\" TEXT DEFAULT 'new',\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"acquisition_context\" TEXT DEFAULT '{}',\n \"intake_ref\" TEXT DEFAULT '',\n \"merged_into_id\" UUID,\n \"qualified_at\" TIMESTAMP,\n \"metadata\" TEXT DEFAULT '{}'\n);",
8707
+ "ddl": "CREATE TABLE IF NOT EXISTS \"leads\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"name\" TEXT NOT NULL DEFAULT '',\n \"contact_name\" TEXT DEFAULT '',\n \"email\" TEXT DEFAULT '',\n \"phone\" TEXT DEFAULT '',\n \"organization_name\" TEXT DEFAULT '',\n \"profile_id\" UUID,\n \"owner_rep_id\" UUID,\n \"status\" TEXT DEFAULT 'new',\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"acquisition_context\" TEXT DEFAULT '{}',\n \"intake_ref\" TEXT DEFAULT '',\n \"merged_into_id\" UUID,\n \"qualified_at\" TIMESTAMP,\n \"metadata\" TEXT DEFAULT '{}'\n);",
8564
8708
  "columns": {
8709
+ "_sync_origin_device_id": {
8710
+ "type": "TEXT"
8711
+ },
8712
+ "_sync_revision": {
8713
+ "type": "INTEGER"
8714
+ },
8565
8715
  "id": {
8566
8716
  "type": "UUID",
8567
8717
  "primaryKey": true,
@@ -8732,7 +8882,7 @@
8732
8882
  ]
8733
8883
  }
8734
8884
  ],
8735
- "version": "25076135"
8885
+ "version": "a1e34aec"
8736
8886
  },
8737
8887
  "importPath": "@happyvertical/smrt-sales/crm"
8738
8888
  },
@@ -8815,8 +8965,14 @@
8815
8965
  ],
8816
8966
  "schema": {
8817
8967
  "tableName": "opportunities",
8818
- "ddl": "CREATE TABLE IF NOT EXISTS \"opportunities\" (\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,\n \"name\" TEXT NOT NULL DEFAULT '',\n \"lead_id\" UUID,\n \"owner_rep_id\" UUID,\n \"pipeline_id\" UUID,\n \"stage_id\" UUID,\n \"expected_value_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"probability\" REAL DEFAULT 0,\n \"expected_close_at\" TIMESTAMP,\n \"status\" TEXT DEFAULT 'open',\n \"outcome_reason\" TEXT DEFAULT '',\n \"won_at\" TIMESTAMP,\n \"lost_at\" TIMESTAMP,\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
8968
+ "ddl": "CREATE TABLE IF NOT EXISTS \"opportunities\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"name\" TEXT NOT NULL DEFAULT '',\n \"lead_id\" UUID,\n \"owner_rep_id\" UUID,\n \"pipeline_id\" UUID,\n \"stage_id\" UUID,\n \"expected_value_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"probability\" REAL DEFAULT 0,\n \"expected_close_at\" TIMESTAMP,\n \"status\" TEXT DEFAULT 'open',\n \"outcome_reason\" TEXT DEFAULT '',\n \"won_at\" TIMESTAMP,\n \"lost_at\" TIMESTAMP,\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
8819
8969
  "columns": {
8970
+ "_sync_origin_device_id": {
8971
+ "type": "TEXT"
8972
+ },
8973
+ "_sync_revision": {
8974
+ "type": "INTEGER"
8975
+ },
8820
8976
  "id": {
8821
8977
  "type": "UUID",
8822
8978
  "primaryKey": true,
@@ -9009,7 +9165,7 @@
9009
9165
  ]
9010
9166
  }
9011
9167
  ],
9012
- "version": "c44d109f"
9168
+ "version": "9b19d1b6"
9013
9169
  },
9014
9170
  "importPath": "@happyvertical/smrt-sales/crm"
9015
9171
  },
@@ -9079,8 +9235,14 @@
9079
9235
  ],
9080
9236
  "schema": {
9081
9237
  "tableName": "opportunity_conversions",
9082
- "ddl": "CREATE TABLE IF NOT EXISTS \"opportunity_conversions\" (\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,\n \"opportunity_id\" UUID NOT NULL,\n \"target_kind\" TEXT NOT NULL DEFAULT '',\n \"target_id\" TEXT NOT NULL DEFAULT '',\n \"note\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
9238
+ "ddl": "CREATE TABLE IF NOT EXISTS \"opportunity_conversions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"opportunity_id\" UUID NOT NULL,\n \"target_kind\" TEXT NOT NULL DEFAULT '',\n \"target_id\" TEXT NOT NULL DEFAULT '',\n \"note\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
9083
9239
  "columns": {
9240
+ "_sync_origin_device_id": {
9241
+ "type": "TEXT"
9242
+ },
9243
+ "_sync_revision": {
9244
+ "type": "INTEGER"
9245
+ },
9084
9246
  "id": {
9085
9247
  "type": "UUID",
9086
9248
  "primaryKey": true,
@@ -9174,7 +9336,7 @@
9174
9336
  ]
9175
9337
  }
9176
9338
  ],
9177
- "version": "a8ed6c44"
9339
+ "version": "21eed850"
9178
9340
  },
9179
9341
  "importPath": "@happyvertical/smrt-sales/crm"
9180
9342
  },
@@ -9265,8 +9427,14 @@
9265
9427
  ],
9266
9428
  "schema": {
9267
9429
  "tableName": "pipeline_definitions",
9268
- "ddl": "CREATE TABLE IF NOT EXISTS \"pipeline_definitions\" (\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,\n \"key\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"is_default\" BOOLEAN DEFAULT FALSE,\n \"status\" TEXT DEFAULT 'active',\n \"metadata\" TEXT DEFAULT '{}'\n);",
9430
+ "ddl": "CREATE TABLE IF NOT EXISTS \"pipeline_definitions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"key\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"is_default\" BOOLEAN DEFAULT FALSE,\n \"status\" TEXT DEFAULT 'active',\n \"metadata\" TEXT DEFAULT '{}'\n);",
9269
9431
  "columns": {
9432
+ "_sync_origin_device_id": {
9433
+ "type": "TEXT"
9434
+ },
9435
+ "_sync_revision": {
9436
+ "type": "INTEGER"
9437
+ },
9270
9438
  "id": {
9271
9439
  "type": "UUID",
9272
9440
  "primaryKey": true,
@@ -9354,7 +9522,7 @@
9354
9522
  ]
9355
9523
  }
9356
9524
  ],
9357
- "version": "5e3ace6c"
9525
+ "version": "f6e6aeaf"
9358
9526
  },
9359
9527
  "importPath": "@happyvertical/smrt-sales/crm"
9360
9528
  },
@@ -9430,8 +9598,14 @@
9430
9598
  ],
9431
9599
  "schema": {
9432
9600
  "tableName": "pipeline_stages",
9433
- "ddl": "CREATE TABLE IF NOT EXISTS \"pipeline_stages\" (\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,\n \"pipeline_id\" UUID NOT NULL,\n \"key\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"sort_order\" INTEGER DEFAULT 0,\n \"probability\" REAL DEFAULT 0,\n \"is_won\" BOOLEAN DEFAULT FALSE,\n \"is_lost\" BOOLEAN DEFAULT FALSE,\n \"metadata\" TEXT DEFAULT '{}'\n);",
9601
+ "ddl": "CREATE TABLE IF NOT EXISTS \"pipeline_stages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"pipeline_id\" UUID NOT NULL,\n \"key\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"sort_order\" INTEGER DEFAULT 0,\n \"probability\" REAL DEFAULT 0,\n \"is_won\" BOOLEAN DEFAULT FALSE,\n \"is_lost\" BOOLEAN DEFAULT FALSE,\n \"metadata\" TEXT DEFAULT '{}'\n);",
9434
9602
  "columns": {
9603
+ "_sync_origin_device_id": {
9604
+ "type": "TEXT"
9605
+ },
9606
+ "_sync_revision": {
9607
+ "type": "INTEGER"
9608
+ },
9435
9609
  "id": {
9436
9610
  "type": "UUID",
9437
9611
  "primaryKey": true,
@@ -9542,7 +9716,7 @@
9542
9716
  ]
9543
9717
  }
9544
9718
  ],
9545
- "version": "365d444e"
9719
+ "version": "33897ae4"
9546
9720
  },
9547
9721
  "importPath": "@happyvertical/smrt-sales/crm"
9548
9722
  },
@@ -9622,8 +9796,14 @@
9622
9796
  ],
9623
9797
  "schema": {
9624
9798
  "tableName": "sales_activities",
9625
- "ddl": "CREATE TABLE IF NOT EXISTS \"sales_activities\" (\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,\n \"subject_kind\" TEXT DEFAULT 'lead',\n \"subject_id\" TEXT NOT NULL DEFAULT '',\n \"activity_kind\" TEXT DEFAULT 'note',\n \"summary\" TEXT DEFAULT '',\n \"due_at\" TIMESTAMP,\n \"completed_at\" TIMESTAMP,\n \"actor_profile_id\" UUID,\n \"metadata\" TEXT DEFAULT '{}'\n);",
9799
+ "ddl": "CREATE TABLE IF NOT EXISTS \"sales_activities\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"subject_kind\" TEXT DEFAULT 'lead',\n \"subject_id\" TEXT NOT NULL DEFAULT '',\n \"activity_kind\" TEXT DEFAULT 'note',\n \"summary\" TEXT DEFAULT '',\n \"due_at\" TIMESTAMP,\n \"completed_at\" TIMESTAMP,\n \"actor_profile_id\" UUID,\n \"metadata\" TEXT DEFAULT '{}'\n);",
9626
9800
  "columns": {
9801
+ "_sync_origin_device_id": {
9802
+ "type": "TEXT"
9803
+ },
9804
+ "_sync_revision": {
9805
+ "type": "INTEGER"
9806
+ },
9627
9807
  "id": {
9628
9808
  "type": "UUID",
9629
9809
  "primaryKey": true,
@@ -9727,7 +9907,7 @@
9727
9907
  ]
9728
9908
  }
9729
9909
  ],
9730
- "version": "b3173b53"
9910
+ "version": "c7235ee1"
9731
9911
  },
9732
9912
  "importPath": "@happyvertical/smrt-sales/crm"
9733
9913
  },
@@ -9757,8 +9937,14 @@
9757
9937
  ],
9758
9938
  "schema": {
9759
9939
  "tableName": "sales_governance_events",
9760
- "ddl": "CREATE TABLE IF NOT EXISTS \"sales_governance_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 \"intent\" TEXT DEFAULT '',\n \"result\" TEXT DEFAULT ''\n);",
9940
+ "ddl": "CREATE TABLE IF NOT EXISTS \"sales_governance_events\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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 \"intent\" TEXT DEFAULT '',\n \"result\" TEXT DEFAULT ''\n);",
9761
9941
  "columns": {
9942
+ "_sync_origin_device_id": {
9943
+ "type": "TEXT"
9944
+ },
9945
+ "_sync_revision": {
9946
+ "type": "INTEGER"
9947
+ },
9762
9948
  "id": {
9763
9949
  "type": "UUID",
9764
9950
  "primaryKey": true,
@@ -9821,7 +10007,7 @@
9821
10007
  ]
9822
10008
  }
9823
10009
  ],
9824
- "version": "361ab8b5"
10010
+ "version": "6fa21826"
9825
10011
  },
9826
10012
  "importPath": "@happyvertical/smrt-sales/crm"
9827
10013
  },
@@ -9904,8 +10090,14 @@
9904
10090
  ],
9905
10091
  "schema": {
9906
10092
  "tableName": "sales_governance_states",
9907
- "ddl": "CREATE TABLE IF NOT EXISTS \"sales_governance_states\" (\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 \"revision\" INTEGER DEFAULT 0,\n \"payload\" TEXT DEFAULT '{}'\n);",
10093
+ "ddl": "CREATE TABLE IF NOT EXISTS \"sales_governance_states\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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 \"revision\" INTEGER DEFAULT 0,\n \"payload\" TEXT DEFAULT '{}'\n);",
9908
10094
  "columns": {
10095
+ "_sync_origin_device_id": {
10096
+ "type": "TEXT"
10097
+ },
10098
+ "_sync_revision": {
10099
+ "type": "INTEGER"
10100
+ },
9909
10101
  "id": {
9910
10102
  "type": "UUID",
9911
10103
  "primaryKey": true,
@@ -9968,7 +10160,7 @@
9968
10160
  ]
9969
10161
  }
9970
10162
  ],
9971
- "version": "bfdce7d0"
10163
+ "version": "42328bd8"
9972
10164
  },
9973
10165
  "importPath": "@happyvertical/smrt-sales/crm"
9974
10166
  },
@@ -10031,8 +10223,14 @@
10031
10223
  ],
10032
10224
  "schema": {
10033
10225
  "tableName": "sales_representatives",
10034
- "ddl": "CREATE TABLE IF NOT EXISTS \"sales_representatives\" (\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,\n \"profile_id\" UUID,\n \"earner_id\" UUID,\n \"status\" TEXT DEFAULT 'active',\n \"title\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
10226
+ "ddl": "CREATE TABLE IF NOT EXISTS \"sales_representatives\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"profile_id\" UUID,\n \"earner_id\" UUID,\n \"status\" TEXT DEFAULT 'active',\n \"title\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
10035
10227
  "columns": {
10228
+ "_sync_origin_device_id": {
10229
+ "type": "TEXT"
10230
+ },
10231
+ "_sync_revision": {
10232
+ "type": "INTEGER"
10233
+ },
10036
10234
  "id": {
10037
10235
  "type": "UUID",
10038
10236
  "primaryKey": true,
@@ -10132,7 +10330,7 @@
10132
10330
  ]
10133
10331
  }
10134
10332
  ],
10135
- "version": "786f3421"
10333
+ "version": "320dfc6e"
10136
10334
  },
10137
10335
  "importPath": "@happyvertical/smrt-sales/crm"
10138
10336
  },
@@ -10392,8 +10590,14 @@
10392
10590
  ],
10393
10591
  "schema": {
10394
10592
  "tableName": "leads",
10395
- "ddl": "CREATE TABLE IF NOT EXISTS \"leads\" (\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,\n \"name\" TEXT NOT NULL DEFAULT '',\n \"contact_name\" TEXT DEFAULT '',\n \"email\" TEXT DEFAULT '',\n \"phone\" TEXT DEFAULT '',\n \"organization_name\" TEXT DEFAULT '',\n \"profile_id\" UUID,\n \"owner_rep_id\" UUID,\n \"status\" TEXT DEFAULT 'new',\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"acquisition_context\" TEXT DEFAULT '{}',\n \"intake_ref\" TEXT DEFAULT '',\n \"merged_into_id\" UUID,\n \"qualified_at\" TIMESTAMP,\n \"metadata\" TEXT DEFAULT '{}'\n);",
10593
+ "ddl": "CREATE TABLE IF NOT EXISTS \"leads\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"name\" TEXT NOT NULL DEFAULT '',\n \"contact_name\" TEXT DEFAULT '',\n \"email\" TEXT DEFAULT '',\n \"phone\" TEXT DEFAULT '',\n \"organization_name\" TEXT DEFAULT '',\n \"profile_id\" UUID,\n \"owner_rep_id\" UUID,\n \"status\" TEXT DEFAULT 'new',\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"acquisition_context\" TEXT DEFAULT '{}',\n \"intake_ref\" TEXT DEFAULT '',\n \"merged_into_id\" UUID,\n \"qualified_at\" TIMESTAMP,\n \"metadata\" TEXT DEFAULT '{}'\n);",
10396
10594
  "columns": {
10595
+ "_sync_origin_device_id": {
10596
+ "type": "TEXT"
10597
+ },
10598
+ "_sync_revision": {
10599
+ "type": "INTEGER"
10600
+ },
10397
10601
  "id": {
10398
10602
  "type": "UUID",
10399
10603
  "primaryKey": true,
@@ -10564,7 +10768,7 @@
10564
10768
  ]
10565
10769
  }
10566
10770
  ],
10567
- "version": "25076135"
10771
+ "version": "a1e34aec"
10568
10772
  },
10569
10773
  "importPath": "@happyvertical/smrt-sales/crm"
10570
10774
  },
@@ -10816,8 +11020,14 @@
10816
11020
  ],
10817
11021
  "schema": {
10818
11022
  "tableName": "opportunities",
10819
- "ddl": "CREATE TABLE IF NOT EXISTS \"opportunities\" (\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,\n \"name\" TEXT NOT NULL DEFAULT '',\n \"lead_id\" UUID,\n \"owner_rep_id\" UUID,\n \"pipeline_id\" UUID,\n \"stage_id\" UUID,\n \"expected_value_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"probability\" REAL DEFAULT 0,\n \"expected_close_at\" TIMESTAMP,\n \"status\" TEXT DEFAULT 'open',\n \"outcome_reason\" TEXT DEFAULT '',\n \"won_at\" TIMESTAMP,\n \"lost_at\" TIMESTAMP,\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
11023
+ "ddl": "CREATE TABLE IF NOT EXISTS \"opportunities\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"name\" TEXT NOT NULL DEFAULT '',\n \"lead_id\" UUID,\n \"owner_rep_id\" UUID,\n \"pipeline_id\" UUID,\n \"stage_id\" UUID,\n \"expected_value_cents\" INTEGER DEFAULT 0,\n \"currency\" TEXT DEFAULT 'USD',\n \"probability\" REAL DEFAULT 0,\n \"expected_close_at\" TIMESTAMP,\n \"status\" TEXT DEFAULT 'open',\n \"outcome_reason\" TEXT DEFAULT '',\n \"won_at\" TIMESTAMP,\n \"lost_at\" TIMESTAMP,\n \"source_kind\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
10820
11024
  "columns": {
11025
+ "_sync_origin_device_id": {
11026
+ "type": "TEXT"
11027
+ },
11028
+ "_sync_revision": {
11029
+ "type": "INTEGER"
11030
+ },
10821
11031
  "id": {
10822
11032
  "type": "UUID",
10823
11033
  "primaryKey": true,
@@ -11010,7 +11220,7 @@
11010
11220
  ]
11011
11221
  }
11012
11222
  ],
11013
- "version": "c44d109f"
11223
+ "version": "9b19d1b6"
11014
11224
  },
11015
11225
  "importPath": "@happyvertical/smrt-sales/crm"
11016
11226
  },
@@ -11160,8 +11370,14 @@
11160
11370
  ],
11161
11371
  "schema": {
11162
11372
  "tableName": "opportunity_conversions",
11163
- "ddl": "CREATE TABLE IF NOT EXISTS \"opportunity_conversions\" (\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,\n \"opportunity_id\" UUID NOT NULL,\n \"target_kind\" TEXT NOT NULL DEFAULT '',\n \"target_id\" TEXT NOT NULL DEFAULT '',\n \"note\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
11373
+ "ddl": "CREATE TABLE IF NOT EXISTS \"opportunity_conversions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"opportunity_id\" UUID NOT NULL,\n \"target_kind\" TEXT NOT NULL DEFAULT '',\n \"target_id\" TEXT NOT NULL DEFAULT '',\n \"note\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
11164
11374
  "columns": {
11375
+ "_sync_origin_device_id": {
11376
+ "type": "TEXT"
11377
+ },
11378
+ "_sync_revision": {
11379
+ "type": "INTEGER"
11380
+ },
11165
11381
  "id": {
11166
11382
  "type": "UUID",
11167
11383
  "primaryKey": true,
@@ -11255,7 +11471,7 @@
11255
11471
  ]
11256
11472
  }
11257
11473
  ],
11258
- "version": "a8ed6c44"
11474
+ "version": "21eed850"
11259
11475
  },
11260
11476
  "importPath": "@happyvertical/smrt-sales/crm"
11261
11477
  },
@@ -11404,8 +11620,14 @@
11404
11620
  ],
11405
11621
  "schema": {
11406
11622
  "tableName": "pipeline_definitions",
11407
- "ddl": "CREATE TABLE IF NOT EXISTS \"pipeline_definitions\" (\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,\n \"key\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"is_default\" BOOLEAN DEFAULT FALSE,\n \"status\" TEXT DEFAULT 'active',\n \"metadata\" TEXT DEFAULT '{}'\n);",
11623
+ "ddl": "CREATE TABLE IF NOT EXISTS \"pipeline_definitions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"key\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"is_default\" BOOLEAN DEFAULT FALSE,\n \"status\" TEXT DEFAULT 'active',\n \"metadata\" TEXT DEFAULT '{}'\n);",
11408
11624
  "columns": {
11625
+ "_sync_origin_device_id": {
11626
+ "type": "TEXT"
11627
+ },
11628
+ "_sync_revision": {
11629
+ "type": "INTEGER"
11630
+ },
11409
11631
  "id": {
11410
11632
  "type": "UUID",
11411
11633
  "primaryKey": true,
@@ -11493,7 +11715,7 @@
11493
11715
  ]
11494
11716
  }
11495
11717
  ],
11496
- "version": "5e3ace6c"
11718
+ "version": "f6e6aeaf"
11497
11719
  },
11498
11720
  "importPath": "@happyvertical/smrt-sales/crm"
11499
11721
  },
@@ -11669,8 +11891,14 @@
11669
11891
  ],
11670
11892
  "schema": {
11671
11893
  "tableName": "pipeline_stages",
11672
- "ddl": "CREATE TABLE IF NOT EXISTS \"pipeline_stages\" (\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,\n \"pipeline_id\" UUID NOT NULL,\n \"key\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"sort_order\" INTEGER DEFAULT 0,\n \"probability\" REAL DEFAULT 0,\n \"is_won\" BOOLEAN DEFAULT FALSE,\n \"is_lost\" BOOLEAN DEFAULT FALSE,\n \"metadata\" TEXT DEFAULT '{}'\n);",
11894
+ "ddl": "CREATE TABLE IF NOT EXISTS \"pipeline_stages\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"pipeline_id\" UUID NOT NULL,\n \"key\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"sort_order\" INTEGER DEFAULT 0,\n \"probability\" REAL DEFAULT 0,\n \"is_won\" BOOLEAN DEFAULT FALSE,\n \"is_lost\" BOOLEAN DEFAULT FALSE,\n \"metadata\" TEXT DEFAULT '{}'\n);",
11673
11895
  "columns": {
11896
+ "_sync_origin_device_id": {
11897
+ "type": "TEXT"
11898
+ },
11899
+ "_sync_revision": {
11900
+ "type": "INTEGER"
11901
+ },
11674
11902
  "id": {
11675
11903
  "type": "UUID",
11676
11904
  "primaryKey": true,
@@ -11781,7 +12009,7 @@
11781
12009
  ]
11782
12010
  }
11783
12011
  ],
11784
- "version": "365d444e"
12012
+ "version": "33897ae4"
11785
12013
  },
11786
12014
  "importPath": "@happyvertical/smrt-sales/crm"
11787
12015
  },
@@ -11958,8 +12186,14 @@
11958
12186
  ],
11959
12187
  "schema": {
11960
12188
  "tableName": "sales_activities",
11961
- "ddl": "CREATE TABLE IF NOT EXISTS \"sales_activities\" (\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,\n \"subject_kind\" TEXT DEFAULT 'lead',\n \"subject_id\" TEXT NOT NULL DEFAULT '',\n \"activity_kind\" TEXT DEFAULT 'note',\n \"summary\" TEXT DEFAULT '',\n \"due_at\" TIMESTAMP,\n \"completed_at\" TIMESTAMP,\n \"actor_profile_id\" UUID,\n \"metadata\" TEXT DEFAULT '{}'\n);",
12189
+ "ddl": "CREATE TABLE IF NOT EXISTS \"sales_activities\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"subject_kind\" TEXT DEFAULT 'lead',\n \"subject_id\" TEXT NOT NULL DEFAULT '',\n \"activity_kind\" TEXT DEFAULT 'note',\n \"summary\" TEXT DEFAULT '',\n \"due_at\" TIMESTAMP,\n \"completed_at\" TIMESTAMP,\n \"actor_profile_id\" UUID,\n \"metadata\" TEXT DEFAULT '{}'\n);",
11962
12190
  "columns": {
12191
+ "_sync_origin_device_id": {
12192
+ "type": "TEXT"
12193
+ },
12194
+ "_sync_revision": {
12195
+ "type": "INTEGER"
12196
+ },
11963
12197
  "id": {
11964
12198
  "type": "UUID",
11965
12199
  "primaryKey": true,
@@ -12063,7 +12297,7 @@
12063
12297
  ]
12064
12298
  }
12065
12299
  ],
12066
- "version": "b3173b53"
12300
+ "version": "c7235ee1"
12067
12301
  },
12068
12302
  "importPath": "@happyvertical/smrt-sales/crm"
12069
12303
  },
@@ -12155,8 +12389,14 @@
12155
12389
  "validationRules": [],
12156
12390
  "schema": {
12157
12391
  "tableName": "sales_governance_events",
12158
- "ddl": "CREATE TABLE IF NOT EXISTS \"sales_governance_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 \"intent\" TEXT DEFAULT '',\n \"result\" TEXT DEFAULT ''\n);",
12392
+ "ddl": "CREATE TABLE IF NOT EXISTS \"sales_governance_events\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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 \"intent\" TEXT DEFAULT '',\n \"result\" TEXT DEFAULT ''\n);",
12159
12393
  "columns": {
12394
+ "_sync_origin_device_id": {
12395
+ "type": "TEXT"
12396
+ },
12397
+ "_sync_revision": {
12398
+ "type": "INTEGER"
12399
+ },
12160
12400
  "id": {
12161
12401
  "type": "UUID",
12162
12402
  "primaryKey": true,
@@ -12219,7 +12459,7 @@
12219
12459
  ]
12220
12460
  }
12221
12461
  ],
12222
- "version": "361ab8b5"
12462
+ "version": "6fa21826"
12223
12463
  },
12224
12464
  "importPath": "@happyvertical/smrt-sales/crm"
12225
12465
  },
@@ -12303,8 +12543,14 @@
12303
12543
  "validationRules": [],
12304
12544
  "schema": {
12305
12545
  "tableName": "sales_governance_states",
12306
- "ddl": "CREATE TABLE IF NOT EXISTS \"sales_governance_states\" (\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 \"revision\" INTEGER DEFAULT 0,\n \"payload\" TEXT DEFAULT '{}'\n);",
12546
+ "ddl": "CREATE TABLE IF NOT EXISTS \"sales_governance_states\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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 \"revision\" INTEGER DEFAULT 0,\n \"payload\" TEXT DEFAULT '{}'\n);",
12307
12547
  "columns": {
12548
+ "_sync_origin_device_id": {
12549
+ "type": "TEXT"
12550
+ },
12551
+ "_sync_revision": {
12552
+ "type": "INTEGER"
12553
+ },
12308
12554
  "id": {
12309
12555
  "type": "UUID",
12310
12556
  "primaryKey": true,
@@ -12367,7 +12613,7 @@
12367
12613
  ]
12368
12614
  }
12369
12615
  ],
12370
- "version": "bfdce7d0"
12616
+ "version": "42328bd8"
12371
12617
  },
12372
12618
  "importPath": "@happyvertical/smrt-sales/crm"
12373
12619
  },
@@ -12489,8 +12735,14 @@
12489
12735
  "displayLabelField": "title",
12490
12736
  "schema": {
12491
12737
  "tableName": "sales_representatives",
12492
- "ddl": "CREATE TABLE IF NOT EXISTS \"sales_representatives\" (\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,\n \"profile_id\" UUID,\n \"earner_id\" UUID,\n \"status\" TEXT DEFAULT 'active',\n \"title\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
12738
+ "ddl": "CREATE TABLE IF NOT EXISTS \"sales_representatives\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"profile_id\" UUID,\n \"earner_id\" UUID,\n \"status\" TEXT DEFAULT 'active',\n \"title\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
12493
12739
  "columns": {
12740
+ "_sync_origin_device_id": {
12741
+ "type": "TEXT"
12742
+ },
12743
+ "_sync_revision": {
12744
+ "type": "INTEGER"
12745
+ },
12494
12746
  "id": {
12495
12747
  "type": "UUID",
12496
12748
  "primaryKey": true,
@@ -12590,7 +12842,7 @@
12590
12842
  ]
12591
12843
  }
12592
12844
  ],
12593
- "version": "786f3421"
12845
+ "version": "320dfc6e"
12594
12846
  },
12595
12847
  "importPath": "@happyvertical/smrt-sales/crm"
12596
12848
  },
@@ -12682,8 +12934,14 @@
12682
12934
  ],
12683
12935
  "schema": {
12684
12936
  "tableName": "attribution_exceptions",
12685
- "ddl": "CREATE TABLE IF NOT EXISTS \"attribution_exceptions\" (\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,\n \"target_kind\" TEXT NOT NULL DEFAULT '',\n \"target_id\" TEXT NOT NULL DEFAULT '',\n \"program_id\" UUID,\n \"status\" TEXT DEFAULT 'open',\n \"conflict_reason\" TEXT DEFAULT '',\n \"candidates\" TEXT DEFAULT '[]',\n \"resolution_mode\" TEXT DEFAULT '',\n \"resolution_reason\" TEXT DEFAULT '',\n \"resolved_by_profile_id\" UUID,\n \"resolved_referral_ids\" TEXT DEFAULT '[]',\n \"resolved_at\" TIMESTAMP,\n \"metadata\" TEXT DEFAULT '{}'\n);",
12937
+ "ddl": "CREATE TABLE IF NOT EXISTS \"attribution_exceptions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"target_kind\" TEXT NOT NULL DEFAULT '',\n \"target_id\" TEXT NOT NULL DEFAULT '',\n \"program_id\" UUID,\n \"status\" TEXT DEFAULT 'open',\n \"conflict_reason\" TEXT DEFAULT '',\n \"candidates\" TEXT DEFAULT '[]',\n \"resolution_mode\" TEXT DEFAULT '',\n \"resolution_reason\" TEXT DEFAULT '',\n \"resolved_by_profile_id\" UUID,\n \"resolved_referral_ids\" TEXT DEFAULT '[]',\n \"resolved_at\" TIMESTAMP,\n \"metadata\" TEXT DEFAULT '{}'\n);",
12686
12938
  "columns": {
12939
+ "_sync_origin_device_id": {
12940
+ "type": "TEXT"
12941
+ },
12942
+ "_sync_revision": {
12943
+ "type": "INTEGER"
12944
+ },
12687
12945
  "id": {
12688
12946
  "type": "UUID",
12689
12947
  "primaryKey": true,
@@ -12824,7 +13082,7 @@
12824
13082
  ]
12825
13083
  }
12826
13084
  ],
12827
- "version": "81285926"
13085
+ "version": "f0cf1d7f"
12828
13086
  },
12829
13087
  "importPath": "@happyvertical/smrt-sales/referrals"
12830
13088
  },
@@ -12943,8 +13201,14 @@
12943
13201
  ],
12944
13202
  "schema": {
12945
13203
  "tableName": "attribution_policies",
12946
- "ddl": "CREATE TABLE IF NOT EXISTS \"attribution_policies\" (\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,\n \"policy_key\" TEXT NOT NULL DEFAULT '',\n \"version\" INTEGER DEFAULT 1,\n \"status\" TEXT DEFAULT 'draft',\n \"effective_from\" TIMESTAMP,\n \"window_days\" INTEGER DEFAULT 30,\n \"credit_mode\" TEXT DEFAULT 'first_touch',\n \"conflict_behavior\" TEXT DEFAULT 'auto',\n \"allow_self_referral\" BOOLEAN DEFAULT FALSE,\n \"allow_existing_clients\" BOOLEAN DEFAULT FALSE,\n \"eligible_services\" TEXT DEFAULT '[]',\n \"eligible_campaigns\" TEXT DEFAULT '[]',\n \"eligible_regions\" TEXT DEFAULT '[]',\n \"metadata\" TEXT DEFAULT '{}'\n);",
13204
+ "ddl": "CREATE TABLE IF NOT EXISTS \"attribution_policies\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"policy_key\" TEXT NOT NULL DEFAULT '',\n \"version\" INTEGER DEFAULT 1,\n \"status\" TEXT DEFAULT 'draft',\n \"effective_from\" TIMESTAMP,\n \"window_days\" INTEGER DEFAULT 30,\n \"credit_mode\" TEXT DEFAULT 'first_touch',\n \"conflict_behavior\" TEXT DEFAULT 'auto',\n \"allow_self_referral\" BOOLEAN DEFAULT FALSE,\n \"allow_existing_clients\" BOOLEAN DEFAULT FALSE,\n \"eligible_services\" TEXT DEFAULT '[]',\n \"eligible_campaigns\" TEXT DEFAULT '[]',\n \"eligible_regions\" TEXT DEFAULT '[]',\n \"metadata\" TEXT DEFAULT '{}'\n);",
12947
13205
  "columns": {
13206
+ "_sync_origin_device_id": {
13207
+ "type": "TEXT"
13208
+ },
13209
+ "_sync_revision": {
13210
+ "type": "INTEGER"
13211
+ },
12948
13212
  "id": {
12949
13213
  "type": "UUID",
12950
13214
  "primaryKey": true,
@@ -13080,7 +13344,7 @@
13080
13344
  ]
13081
13345
  }
13082
13346
  ],
13083
- "version": "14c54dd2"
13347
+ "version": "0f8997e6"
13084
13348
  },
13085
13349
  "importPath": "@happyvertical/smrt-sales/referrals"
13086
13350
  },
@@ -13187,8 +13451,14 @@
13187
13451
  ],
13188
13452
  "schema": {
13189
13453
  "tableName": "referral_agreements",
13190
- "ddl": "CREATE TABLE IF NOT EXISTS \"referral_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,\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID NOT NULL,\n \"version\" INTEGER DEFAULT 1,\n \"status\" TEXT DEFAULT 'draft',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"commission_plan_key\" TEXT DEFAULT '',\n \"commission_plan_version\" INTEGER DEFAULT 0,\n \"clearing_days\" INTEGER DEFAULT 0,\n \"approval_mode\" TEXT DEFAULT 'manual',\n \"execution_id\" UUID,\n \"executed_agreement_id\" UUID,\n \"metadata\" TEXT DEFAULT '{}'\n);",
13454
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referral_agreements\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID NOT NULL,\n \"version\" INTEGER DEFAULT 1,\n \"status\" TEXT DEFAULT 'draft',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"commission_plan_key\" TEXT DEFAULT '',\n \"commission_plan_version\" INTEGER DEFAULT 0,\n \"clearing_days\" INTEGER DEFAULT 0,\n \"approval_mode\" TEXT DEFAULT 'manual',\n \"execution_id\" UUID,\n \"executed_agreement_id\" UUID,\n \"metadata\" TEXT DEFAULT '{}'\n);",
13191
13455
  "columns": {
13456
+ "_sync_origin_device_id": {
13457
+ "type": "TEXT"
13458
+ },
13459
+ "_sync_revision": {
13460
+ "type": "INTEGER"
13461
+ },
13192
13462
  "id": {
13193
13463
  "type": "UUID",
13194
13464
  "primaryKey": true,
@@ -13365,7 +13635,7 @@
13365
13635
  ]
13366
13636
  }
13367
13637
  ],
13368
- "version": "77ac2606"
13638
+ "version": "14c9cf7a"
13369
13639
  },
13370
13640
  "importPath": "@happyvertical/smrt-sales/referrals"
13371
13641
  },
@@ -13424,8 +13694,14 @@
13424
13694
  ],
13425
13695
  "schema": {
13426
13696
  "tableName": "referral_click_operations",
13427
- "ddl": "CREATE TABLE IF NOT EXISTS \"referral_click_operations\" (\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,\n \"key_hash\" TEXT NOT NULL,\n \"link_id\" UUID NOT NULL,\n \"touch_id\" UUID NOT NULL,\n \"intent_hash\" TEXT NOT NULL,\n \"caller_evidence_hash\" TEXT NOT NULL,\n \"requested_occurred_at\" TEXT NOT NULL\n);",
13697
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referral_click_operations\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"key_hash\" TEXT NOT NULL,\n \"link_id\" UUID NOT NULL,\n \"touch_id\" UUID NOT NULL,\n \"intent_hash\" TEXT NOT NULL,\n \"caller_evidence_hash\" TEXT NOT NULL,\n \"requested_occurred_at\" TEXT NOT NULL\n);",
13428
13698
  "columns": {
13699
+ "_sync_origin_device_id": {
13700
+ "type": "TEXT"
13701
+ },
13702
+ "_sync_revision": {
13703
+ "type": "INTEGER"
13704
+ },
13429
13705
  "id": {
13430
13706
  "type": "UUID",
13431
13707
  "primaryKey": true,
@@ -13519,7 +13795,7 @@
13519
13795
  ]
13520
13796
  }
13521
13797
  ],
13522
- "version": "f82840ee"
13798
+ "version": "c418c750"
13523
13799
  },
13524
13800
  "importPath": "@happyvertical/smrt-sales/referrals"
13525
13801
  },
@@ -13625,8 +13901,14 @@
13625
13901
  ],
13626
13902
  "schema": {
13627
13903
  "tableName": "referrals",
13628
- "ddl": "CREATE TABLE IF NOT EXISTS \"referrals\" (\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,\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID NOT NULL,\n \"policy_key\" TEXT DEFAULT '',\n \"policy_version\" INTEGER DEFAULT 0,\n \"status\" TEXT DEFAULT 'pending',\n \"target_kind\" TEXT DEFAULT '',\n \"target_id\" TEXT DEFAULT '',\n \"credit_fraction\" REAL DEFAULT 1,\n \"split_group_id\" TEXT DEFAULT '',\n \"primary_touch_id\" UUID,\n \"attributed_at\" TIMESTAMP,\n \"qualified_at\" TIMESTAMP,\n \"expires_at\" TIMESTAMP,\n \"snapshot_id\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
13904
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referrals\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID NOT NULL,\n \"policy_key\" TEXT DEFAULT '',\n \"policy_version\" INTEGER DEFAULT 0,\n \"status\" TEXT DEFAULT 'pending',\n \"target_kind\" TEXT DEFAULT '',\n \"target_id\" TEXT DEFAULT '',\n \"credit_fraction\" REAL DEFAULT 1,\n \"split_group_id\" TEXT DEFAULT '',\n \"primary_touch_id\" UUID,\n \"attributed_at\" TIMESTAMP,\n \"qualified_at\" TIMESTAMP,\n \"expires_at\" TIMESTAMP,\n \"snapshot_id\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
13629
13905
  "columns": {
13906
+ "_sync_origin_device_id": {
13907
+ "type": "TEXT"
13908
+ },
13909
+ "_sync_revision": {
13910
+ "type": "INTEGER"
13911
+ },
13630
13912
  "id": {
13631
13913
  "type": "UUID",
13632
13914
  "primaryKey": true,
@@ -13801,7 +14083,7 @@
13801
14083
  ]
13802
14084
  }
13803
14085
  ],
13804
- "version": "db0c1067"
14086
+ "version": "0fe2527f"
13805
14087
  },
13806
14088
  "importPath": "@happyvertical/smrt-sales/referrals"
13807
14089
  },
@@ -13899,8 +14181,14 @@
13899
14181
  ],
13900
14182
  "schema": {
13901
14183
  "tableName": "referral_links",
13902
- "ddl": "CREATE TABLE IF NOT EXISTS \"referral_links\" (\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,\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID NOT NULL,\n \"code\" TEXT NOT NULL DEFAULT '',\n \"target_url\" TEXT DEFAULT '',\n \"label\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'active',\n \"click_count\" INTEGER DEFAULT 0,\n \"metadata\" TEXT DEFAULT '{}'\n);",
14184
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referral_links\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID NOT NULL,\n \"code\" TEXT NOT NULL DEFAULT '',\n \"target_url\" TEXT DEFAULT '',\n \"label\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'active',\n \"click_count\" INTEGER DEFAULT 0,\n \"metadata\" TEXT DEFAULT '{}'\n);",
13903
14185
  "columns": {
14186
+ "_sync_origin_device_id": {
14187
+ "type": "TEXT"
14188
+ },
14189
+ "_sync_revision": {
14190
+ "type": "INTEGER"
14191
+ },
13904
14192
  "id": {
13905
14193
  "type": "UUID",
13906
14194
  "primaryKey": true,
@@ -14028,7 +14316,7 @@
14028
14316
  ]
14029
14317
  }
14030
14318
  ],
14031
- "version": "94c27dd6"
14319
+ "version": "851e7586"
14032
14320
  },
14033
14321
  "importPath": "@happyvertical/smrt-sales/referrals"
14034
14322
  },
@@ -14105,8 +14393,14 @@
14105
14393
  ],
14106
14394
  "schema": {
14107
14395
  "tableName": "referral_programs",
14108
- "ddl": "CREATE TABLE IF NOT EXISTS \"referral_programs\" (\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,\n \"key\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'draft',\n \"default_commission_plan_key\" TEXT DEFAULT '',\n \"default_attribution_policy_key\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
14396
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referral_programs\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"key\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'draft',\n \"default_commission_plan_key\" TEXT DEFAULT '',\n \"default_attribution_policy_key\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
14109
14397
  "columns": {
14398
+ "_sync_origin_device_id": {
14399
+ "type": "TEXT"
14400
+ },
14401
+ "_sync_revision": {
14402
+ "type": "INTEGER"
14403
+ },
14110
14404
  "id": {
14111
14405
  "type": "UUID",
14112
14406
  "primaryKey": true,
@@ -14200,7 +14494,7 @@
14200
14494
  ]
14201
14495
  }
14202
14496
  ],
14203
- "version": "b412cfba"
14497
+ "version": "60a202d2"
14204
14498
  },
14205
14499
  "importPath": "@happyvertical/smrt-sales/referrals"
14206
14500
  },
@@ -14255,8 +14549,14 @@
14255
14549
  ],
14256
14550
  "schema": {
14257
14551
  "tableName": "referral_term_snapshots",
14258
- "ddl": "CREATE TABLE IF NOT EXISTS \"referral_term_snapshots\" (\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,\n \"referral_id\" UUID NOT NULL,\n \"agreement_id\" TEXT DEFAULT '',\n \"agreement_version\" INTEGER DEFAULT 0,\n \"plan_key\" TEXT DEFAULT '',\n \"plan_version\" INTEGER DEFAULT 0,\n \"policy_key\" TEXT DEFAULT '',\n \"policy_version\" INTEGER DEFAULT 0,\n \"components\" TEXT DEFAULT '[]',\n \"currency\" TEXT DEFAULT 'USD',\n \"clearing_days\" INTEGER DEFAULT 0,\n \"approval_mode\" TEXT DEFAULT 'manual',\n \"metadata\" TEXT DEFAULT '{}'\n);",
14552
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referral_term_snapshots\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"referral_id\" UUID NOT NULL,\n \"agreement_id\" TEXT DEFAULT '',\n \"agreement_version\" INTEGER DEFAULT 0,\n \"plan_key\" TEXT DEFAULT '',\n \"plan_version\" INTEGER DEFAULT 0,\n \"policy_key\" TEXT DEFAULT '',\n \"policy_version\" INTEGER DEFAULT 0,\n \"components\" TEXT DEFAULT '[]',\n \"currency\" TEXT DEFAULT 'USD',\n \"clearing_days\" INTEGER DEFAULT 0,\n \"approval_mode\" TEXT DEFAULT 'manual',\n \"metadata\" TEXT DEFAULT '{}'\n);",
14259
14553
  "columns": {
14554
+ "_sync_origin_device_id": {
14555
+ "type": "TEXT"
14556
+ },
14557
+ "_sync_revision": {
14558
+ "type": "INTEGER"
14559
+ },
14260
14560
  "id": {
14261
14561
  "type": "UUID",
14262
14562
  "primaryKey": true,
@@ -14392,7 +14692,7 @@
14392
14692
  ]
14393
14693
  }
14394
14694
  ],
14395
- "version": "f11da500"
14695
+ "version": "84d20ae3"
14396
14696
  },
14397
14697
  "importPath": "@happyvertical/smrt-sales/referrals"
14398
14698
  },
@@ -14481,8 +14781,14 @@
14481
14781
  ],
14482
14782
  "schema": {
14483
14783
  "tableName": "referral_touches",
14484
- "ddl": "CREATE TABLE IF NOT EXISTS \"referral_touches\" (\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,\n \"link_id\" UUID,\n \"code\" TEXT DEFAULT '',\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID,\n \"kind\" TEXT DEFAULT 'click',\n \"subject_kind\" TEXT DEFAULT '',\n \"subject_id\" TEXT DEFAULT '',\n \"occurred_at\" TIMESTAMP,\n \"evidence\" TEXT DEFAULT '{}',\n \"metadata\" TEXT DEFAULT '{}'\n);",
14784
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referral_touches\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"link_id\" UUID,\n \"code\" TEXT DEFAULT '',\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID,\n \"kind\" TEXT DEFAULT 'click',\n \"subject_kind\" TEXT DEFAULT '',\n \"subject_id\" TEXT DEFAULT '',\n \"occurred_at\" TIMESTAMP,\n \"evidence\" TEXT DEFAULT '{}',\n \"metadata\" TEXT DEFAULT '{}'\n);",
14485
14785
  "columns": {
14786
+ "_sync_origin_device_id": {
14787
+ "type": "TEXT"
14788
+ },
14789
+ "_sync_revision": {
14790
+ "type": "INTEGER"
14791
+ },
14486
14792
  "id": {
14487
14793
  "type": "UUID",
14488
14794
  "primaryKey": true,
@@ -14629,7 +14935,7 @@
14629
14935
  ]
14630
14936
  }
14631
14937
  ],
14632
- "version": "c1681352"
14938
+ "version": "61974c7a"
14633
14939
  },
14634
14940
  "importPath": "@happyvertical/smrt-sales/referrals"
14635
14941
  },
@@ -14707,8 +15013,14 @@
14707
15013
  ],
14708
15014
  "schema": {
14709
15015
  "tableName": "referrers",
14710
- "ddl": "CREATE TABLE IF NOT EXISTS \"referrers\" (\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,\n \"profile_id\" UUID,\n \"earner_id\" UUID,\n \"display_name\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'pending',\n \"metadata\" TEXT DEFAULT '{}'\n);",
15016
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referrers\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"profile_id\" UUID,\n \"earner_id\" UUID,\n \"display_name\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'pending',\n \"metadata\" TEXT DEFAULT '{}'\n);",
14711
15017
  "columns": {
15018
+ "_sync_origin_device_id": {
15019
+ "type": "TEXT"
15020
+ },
15021
+ "_sync_revision": {
15022
+ "type": "INTEGER"
15023
+ },
14712
15024
  "id": {
14713
15025
  "type": "UUID",
14714
15026
  "primaryKey": true,
@@ -14808,7 +15120,7 @@
14808
15120
  ]
14809
15121
  }
14810
15122
  ],
14811
- "version": "492c2a82"
15123
+ "version": "16a6f845"
14812
15124
  },
14813
15125
  "importPath": "@happyvertical/smrt-sales/referrals"
14814
15126
  },
@@ -15047,8 +15359,14 @@
15047
15359
  ],
15048
15360
  "schema": {
15049
15361
  "tableName": "attribution_exceptions",
15050
- "ddl": "CREATE TABLE IF NOT EXISTS \"attribution_exceptions\" (\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,\n \"target_kind\" TEXT NOT NULL DEFAULT '',\n \"target_id\" TEXT NOT NULL DEFAULT '',\n \"program_id\" UUID,\n \"status\" TEXT DEFAULT 'open',\n \"conflict_reason\" TEXT DEFAULT '',\n \"candidates\" TEXT DEFAULT '[]',\n \"resolution_mode\" TEXT DEFAULT '',\n \"resolution_reason\" TEXT DEFAULT '',\n \"resolved_by_profile_id\" UUID,\n \"resolved_referral_ids\" TEXT DEFAULT '[]',\n \"resolved_at\" TIMESTAMP,\n \"metadata\" TEXT DEFAULT '{}'\n);",
15362
+ "ddl": "CREATE TABLE IF NOT EXISTS \"attribution_exceptions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"target_kind\" TEXT NOT NULL DEFAULT '',\n \"target_id\" TEXT NOT NULL DEFAULT '',\n \"program_id\" UUID,\n \"status\" TEXT DEFAULT 'open',\n \"conflict_reason\" TEXT DEFAULT '',\n \"candidates\" TEXT DEFAULT '[]',\n \"resolution_mode\" TEXT DEFAULT '',\n \"resolution_reason\" TEXT DEFAULT '',\n \"resolved_by_profile_id\" UUID,\n \"resolved_referral_ids\" TEXT DEFAULT '[]',\n \"resolved_at\" TIMESTAMP,\n \"metadata\" TEXT DEFAULT '{}'\n);",
15051
15363
  "columns": {
15364
+ "_sync_origin_device_id": {
15365
+ "type": "TEXT"
15366
+ },
15367
+ "_sync_revision": {
15368
+ "type": "INTEGER"
15369
+ },
15052
15370
  "id": {
15053
15371
  "type": "UUID",
15054
15372
  "primaryKey": true,
@@ -15189,7 +15507,7 @@
15189
15507
  ]
15190
15508
  }
15191
15509
  ],
15192
- "version": "81285926"
15510
+ "version": "f0cf1d7f"
15193
15511
  },
15194
15512
  "importPath": "@happyvertical/smrt-sales/referrals"
15195
15513
  },
@@ -15477,8 +15795,14 @@
15477
15795
  ],
15478
15796
  "schema": {
15479
15797
  "tableName": "attribution_policies",
15480
- "ddl": "CREATE TABLE IF NOT EXISTS \"attribution_policies\" (\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,\n \"policy_key\" TEXT NOT NULL DEFAULT '',\n \"version\" INTEGER DEFAULT 1,\n \"status\" TEXT DEFAULT 'draft',\n \"effective_from\" TIMESTAMP,\n \"window_days\" INTEGER DEFAULT 30,\n \"credit_mode\" TEXT DEFAULT 'first_touch',\n \"conflict_behavior\" TEXT DEFAULT 'auto',\n \"allow_self_referral\" BOOLEAN DEFAULT FALSE,\n \"allow_existing_clients\" BOOLEAN DEFAULT FALSE,\n \"eligible_services\" TEXT DEFAULT '[]',\n \"eligible_campaigns\" TEXT DEFAULT '[]',\n \"eligible_regions\" TEXT DEFAULT '[]',\n \"metadata\" TEXT DEFAULT '{}'\n);",
15798
+ "ddl": "CREATE TABLE IF NOT EXISTS \"attribution_policies\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"policy_key\" TEXT NOT NULL DEFAULT '',\n \"version\" INTEGER DEFAULT 1,\n \"status\" TEXT DEFAULT 'draft',\n \"effective_from\" TIMESTAMP,\n \"window_days\" INTEGER DEFAULT 30,\n \"credit_mode\" TEXT DEFAULT 'first_touch',\n \"conflict_behavior\" TEXT DEFAULT 'auto',\n \"allow_self_referral\" BOOLEAN DEFAULT FALSE,\n \"allow_existing_clients\" BOOLEAN DEFAULT FALSE,\n \"eligible_services\" TEXT DEFAULT '[]',\n \"eligible_campaigns\" TEXT DEFAULT '[]',\n \"eligible_regions\" TEXT DEFAULT '[]',\n \"metadata\" TEXT DEFAULT '{}'\n);",
15481
15799
  "columns": {
15800
+ "_sync_origin_device_id": {
15801
+ "type": "TEXT"
15802
+ },
15803
+ "_sync_revision": {
15804
+ "type": "INTEGER"
15805
+ },
15482
15806
  "id": {
15483
15807
  "type": "UUID",
15484
15808
  "primaryKey": true,
@@ -15614,7 +15938,7 @@
15614
15938
  ]
15615
15939
  }
15616
15940
  ],
15617
- "version": "14c54dd2"
15941
+ "version": "0f8997e6"
15618
15942
  },
15619
15943
  "importPath": "@happyvertical/smrt-sales/referrals"
15620
15944
  },
@@ -15896,8 +16220,14 @@
15896
16220
  ],
15897
16221
  "schema": {
15898
16222
  "tableName": "referrals",
15899
- "ddl": "CREATE TABLE IF NOT EXISTS \"referrals\" (\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,\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID NOT NULL,\n \"policy_key\" TEXT DEFAULT '',\n \"policy_version\" INTEGER DEFAULT 0,\n \"status\" TEXT DEFAULT 'pending',\n \"target_kind\" TEXT DEFAULT '',\n \"target_id\" TEXT DEFAULT '',\n \"credit_fraction\" REAL DEFAULT 1,\n \"split_group_id\" TEXT DEFAULT '',\n \"primary_touch_id\" UUID,\n \"attributed_at\" TIMESTAMP,\n \"qualified_at\" TIMESTAMP,\n \"expires_at\" TIMESTAMP,\n \"snapshot_id\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
16223
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referrals\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID NOT NULL,\n \"policy_key\" TEXT DEFAULT '',\n \"policy_version\" INTEGER DEFAULT 0,\n \"status\" TEXT DEFAULT 'pending',\n \"target_kind\" TEXT DEFAULT '',\n \"target_id\" TEXT DEFAULT '',\n \"credit_fraction\" REAL DEFAULT 1,\n \"split_group_id\" TEXT DEFAULT '',\n \"primary_touch_id\" UUID,\n \"attributed_at\" TIMESTAMP,\n \"qualified_at\" TIMESTAMP,\n \"expires_at\" TIMESTAMP,\n \"snapshot_id\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
15900
16224
  "columns": {
16225
+ "_sync_origin_device_id": {
16226
+ "type": "TEXT"
16227
+ },
16228
+ "_sync_revision": {
16229
+ "type": "INTEGER"
16230
+ },
15901
16231
  "id": {
15902
16232
  "type": "UUID",
15903
16233
  "primaryKey": true,
@@ -16072,7 +16402,7 @@
16072
16402
  ]
16073
16403
  }
16074
16404
  ],
16075
- "version": "db0c1067"
16405
+ "version": "0fe2527f"
16076
16406
  },
16077
16407
  "importPath": "@happyvertical/smrt-sales/referrals"
16078
16408
  },
@@ -16343,8 +16673,14 @@
16343
16673
  ],
16344
16674
  "schema": {
16345
16675
  "tableName": "referral_agreements",
16346
- "ddl": "CREATE TABLE IF NOT EXISTS \"referral_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,\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID NOT NULL,\n \"version\" INTEGER DEFAULT 1,\n \"status\" TEXT DEFAULT 'draft',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"commission_plan_key\" TEXT DEFAULT '',\n \"commission_plan_version\" INTEGER DEFAULT 0,\n \"clearing_days\" INTEGER DEFAULT 0,\n \"approval_mode\" TEXT DEFAULT 'manual',\n \"execution_id\" UUID,\n \"executed_agreement_id\" UUID,\n \"metadata\" TEXT DEFAULT '{}'\n);",
16676
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referral_agreements\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID NOT NULL,\n \"version\" INTEGER DEFAULT 1,\n \"status\" TEXT DEFAULT 'draft',\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"commission_plan_key\" TEXT DEFAULT '',\n \"commission_plan_version\" INTEGER DEFAULT 0,\n \"clearing_days\" INTEGER DEFAULT 0,\n \"approval_mode\" TEXT DEFAULT 'manual',\n \"execution_id\" UUID,\n \"executed_agreement_id\" UUID,\n \"metadata\" TEXT DEFAULT '{}'\n);",
16347
16677
  "columns": {
16678
+ "_sync_origin_device_id": {
16679
+ "type": "TEXT"
16680
+ },
16681
+ "_sync_revision": {
16682
+ "type": "INTEGER"
16683
+ },
16348
16684
  "id": {
16349
16685
  "type": "UUID",
16350
16686
  "primaryKey": true,
@@ -16521,7 +16857,7 @@
16521
16857
  ]
16522
16858
  }
16523
16859
  ],
16524
- "version": "77ac2606"
16860
+ "version": "14c9cf7a"
16525
16861
  },
16526
16862
  "importPath": "@happyvertical/smrt-sales/referrals"
16527
16863
  },
@@ -16671,8 +17007,14 @@
16671
17007
  ],
16672
17008
  "schema": {
16673
17009
  "tableName": "referral_click_operations",
16674
- "ddl": "CREATE TABLE IF NOT EXISTS \"referral_click_operations\" (\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,\n \"key_hash\" TEXT NOT NULL,\n \"link_id\" UUID NOT NULL,\n \"touch_id\" UUID NOT NULL,\n \"intent_hash\" TEXT NOT NULL,\n \"caller_evidence_hash\" TEXT NOT NULL,\n \"requested_occurred_at\" TEXT NOT NULL\n);",
17010
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referral_click_operations\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"key_hash\" TEXT NOT NULL,\n \"link_id\" UUID NOT NULL,\n \"touch_id\" UUID NOT NULL,\n \"intent_hash\" TEXT NOT NULL,\n \"caller_evidence_hash\" TEXT NOT NULL,\n \"requested_occurred_at\" TEXT NOT NULL\n);",
16675
17011
  "columns": {
17012
+ "_sync_origin_device_id": {
17013
+ "type": "TEXT"
17014
+ },
17015
+ "_sync_revision": {
17016
+ "type": "INTEGER"
17017
+ },
16676
17018
  "id": {
16677
17019
  "type": "UUID",
16678
17020
  "primaryKey": true,
@@ -16766,7 +17108,7 @@
16766
17108
  ]
16767
17109
  }
16768
17110
  ],
16769
- "version": "f82840ee"
17111
+ "version": "c418c750"
16770
17112
  },
16771
17113
  "importPath": "@happyvertical/smrt-sales/referrals"
16772
17114
  },
@@ -16942,8 +17284,14 @@
16942
17284
  ],
16943
17285
  "schema": {
16944
17286
  "tableName": "referral_links",
16945
- "ddl": "CREATE TABLE IF NOT EXISTS \"referral_links\" (\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,\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID NOT NULL,\n \"code\" TEXT NOT NULL DEFAULT '',\n \"target_url\" TEXT DEFAULT '',\n \"label\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'active',\n \"click_count\" INTEGER DEFAULT 0,\n \"metadata\" TEXT DEFAULT '{}'\n);",
17287
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referral_links\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID NOT NULL,\n \"code\" TEXT NOT NULL DEFAULT '',\n \"target_url\" TEXT DEFAULT '',\n \"label\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'active',\n \"click_count\" INTEGER DEFAULT 0,\n \"metadata\" TEXT DEFAULT '{}'\n);",
16946
17288
  "columns": {
17289
+ "_sync_origin_device_id": {
17290
+ "type": "TEXT"
17291
+ },
17292
+ "_sync_revision": {
17293
+ "type": "INTEGER"
17294
+ },
16947
17295
  "id": {
16948
17296
  "type": "UUID",
16949
17297
  "primaryKey": true,
@@ -17071,7 +17419,7 @@
17071
17419
  ]
17072
17420
  }
17073
17421
  ],
17074
- "version": "94c27dd6"
17422
+ "version": "851e7586"
17075
17423
  },
17076
17424
  "importPath": "@happyvertical/smrt-sales/referrals"
17077
17425
  },
@@ -17217,8 +17565,14 @@
17217
17565
  ],
17218
17566
  "schema": {
17219
17567
  "tableName": "referral_programs",
17220
- "ddl": "CREATE TABLE IF NOT EXISTS \"referral_programs\" (\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,\n \"key\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'draft',\n \"default_commission_plan_key\" TEXT DEFAULT '',\n \"default_attribution_policy_key\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
17568
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referral_programs\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"key\" TEXT NOT NULL DEFAULT '',\n \"name\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'draft',\n \"default_commission_plan_key\" TEXT DEFAULT '',\n \"default_attribution_policy_key\" TEXT DEFAULT '',\n \"metadata\" TEXT DEFAULT '{}'\n);",
17221
17569
  "columns": {
17570
+ "_sync_origin_device_id": {
17571
+ "type": "TEXT"
17572
+ },
17573
+ "_sync_revision": {
17574
+ "type": "INTEGER"
17575
+ },
17222
17576
  "id": {
17223
17577
  "type": "UUID",
17224
17578
  "primaryKey": true,
@@ -17312,7 +17666,7 @@
17312
17666
  ]
17313
17667
  }
17314
17668
  ],
17315
- "version": "b412cfba"
17669
+ "version": "60a202d2"
17316
17670
  },
17317
17671
  "importPath": "@happyvertical/smrt-sales/referrals"
17318
17672
  },
@@ -17481,8 +17835,14 @@
17481
17835
  ],
17482
17836
  "schema": {
17483
17837
  "tableName": "referral_term_snapshots",
17484
- "ddl": "CREATE TABLE IF NOT EXISTS \"referral_term_snapshots\" (\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,\n \"referral_id\" UUID NOT NULL,\n \"agreement_id\" TEXT DEFAULT '',\n \"agreement_version\" INTEGER DEFAULT 0,\n \"plan_key\" TEXT DEFAULT '',\n \"plan_version\" INTEGER DEFAULT 0,\n \"policy_key\" TEXT DEFAULT '',\n \"policy_version\" INTEGER DEFAULT 0,\n \"components\" TEXT DEFAULT '[]',\n \"currency\" TEXT DEFAULT 'USD',\n \"clearing_days\" INTEGER DEFAULT 0,\n \"approval_mode\" TEXT DEFAULT 'manual',\n \"metadata\" TEXT DEFAULT '{}'\n);",
17838
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referral_term_snapshots\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"referral_id\" UUID NOT NULL,\n \"agreement_id\" TEXT DEFAULT '',\n \"agreement_version\" INTEGER DEFAULT 0,\n \"plan_key\" TEXT DEFAULT '',\n \"plan_version\" INTEGER DEFAULT 0,\n \"policy_key\" TEXT DEFAULT '',\n \"policy_version\" INTEGER DEFAULT 0,\n \"components\" TEXT DEFAULT '[]',\n \"currency\" TEXT DEFAULT 'USD',\n \"clearing_days\" INTEGER DEFAULT 0,\n \"approval_mode\" TEXT DEFAULT 'manual',\n \"metadata\" TEXT DEFAULT '{}'\n);",
17485
17839
  "columns": {
17840
+ "_sync_origin_device_id": {
17841
+ "type": "TEXT"
17842
+ },
17843
+ "_sync_revision": {
17844
+ "type": "INTEGER"
17845
+ },
17486
17846
  "id": {
17487
17847
  "type": "UUID",
17488
17848
  "primaryKey": true,
@@ -17618,7 +17978,7 @@
17618
17978
  ]
17619
17979
  }
17620
17980
  ],
17621
- "version": "f11da500"
17981
+ "version": "84d20ae3"
17622
17982
  },
17623
17983
  "importPath": "@happyvertical/smrt-sales/referrals"
17624
17984
  },
@@ -17792,8 +18152,14 @@
17792
18152
  ],
17793
18153
  "schema": {
17794
18154
  "tableName": "referral_touches",
17795
- "ddl": "CREATE TABLE IF NOT EXISTS \"referral_touches\" (\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,\n \"link_id\" UUID,\n \"code\" TEXT DEFAULT '',\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID,\n \"kind\" TEXT DEFAULT 'click',\n \"subject_kind\" TEXT DEFAULT '',\n \"subject_id\" TEXT DEFAULT '',\n \"occurred_at\" TIMESTAMP,\n \"evidence\" TEXT DEFAULT '{}',\n \"metadata\" TEXT DEFAULT '{}'\n);",
18155
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referral_touches\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"link_id\" UUID,\n \"code\" TEXT DEFAULT '',\n \"referrer_id\" UUID NOT NULL,\n \"program_id\" UUID,\n \"kind\" TEXT DEFAULT 'click',\n \"subject_kind\" TEXT DEFAULT '',\n \"subject_id\" TEXT DEFAULT '',\n \"occurred_at\" TIMESTAMP,\n \"evidence\" TEXT DEFAULT '{}',\n \"metadata\" TEXT DEFAULT '{}'\n);",
17796
18156
  "columns": {
18157
+ "_sync_origin_device_id": {
18158
+ "type": "TEXT"
18159
+ },
18160
+ "_sync_revision": {
18161
+ "type": "INTEGER"
18162
+ },
17797
18163
  "id": {
17798
18164
  "type": "UUID",
17799
18165
  "primaryKey": true,
@@ -17940,7 +18306,7 @@
17940
18306
  ]
17941
18307
  }
17942
18308
  ],
17943
- "version": "c1681352"
18309
+ "version": "61974c7a"
17944
18310
  },
17945
18311
  "importPath": "@happyvertical/smrt-sales/referrals"
17946
18312
  },
@@ -18086,8 +18452,14 @@
18086
18452
  "collectionExportName": "ReferrerCollection",
18087
18453
  "schema": {
18088
18454
  "tableName": "referrers",
18089
- "ddl": "CREATE TABLE IF NOT EXISTS \"referrers\" (\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,\n \"profile_id\" UUID,\n \"earner_id\" UUID,\n \"display_name\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'pending',\n \"metadata\" TEXT DEFAULT '{}'\n);",
18455
+ "ddl": "CREATE TABLE IF NOT EXISTS \"referrers\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\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,\n \"profile_id\" UUID,\n \"earner_id\" UUID,\n \"display_name\" TEXT DEFAULT '',\n \"status\" TEXT DEFAULT 'pending',\n \"metadata\" TEXT DEFAULT '{}'\n);",
18090
18456
  "columns": {
18457
+ "_sync_origin_device_id": {
18458
+ "type": "TEXT"
18459
+ },
18460
+ "_sync_revision": {
18461
+ "type": "INTEGER"
18462
+ },
18091
18463
  "id": {
18092
18464
  "type": "UUID",
18093
18465
  "primaryKey": true,
@@ -18187,7 +18559,7 @@
18187
18559
  ]
18188
18560
  }
18189
18561
  ],
18190
- "version": "492c2a82"
18562
+ "version": "16a6f845"
18191
18563
  },
18192
18564
  "importPath": "@happyvertical/smrt-sales/referrals"
18193
18565
  }