@dossier-wiki/os-sdk 0.1.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -2,6 +2,124 @@ export interface Paginated<T> {
2
2
  data: T[];
3
3
  pagination: PaginationMeta;
4
4
  }
5
+ /** A resource tag assignment: slugified `value` + snapshotted `label`. */
6
+ export interface TagValue {
7
+ /** Slugified, stable key (catalogue value). */
8
+ value: string;
9
+ /** Human-readable label snapshot at assignment time. */
10
+ label: string;
11
+ }
12
+ /**
13
+ * Tag assignment input. Pass `label` only and the slug `value` is derived
14
+ * server-side, or pass both to pin a specific catalogue value.
15
+ */
16
+ export interface TagValueInput {
17
+ label: string;
18
+ value?: string;
19
+ }
20
+ /** The eight catalogue-governed tag field-keys. */
21
+ export type TagFieldKey = 'customer.tags' | 'customer.riskTags' | 'counterparty.tags' | 'counterparty.riskTags' | 'alert.dispositionTags' | 'address.tags' | 'rule.tags' | 'identificationDocument.tags';
22
+ export type TagCatalogueEnforcement = 'open' | 'strict';
23
+ export interface TagCatalogueEntry {
24
+ id: string;
25
+ fieldKey: TagFieldKey;
26
+ value: string;
27
+ label: string;
28
+ color?: string | null;
29
+ description?: string | null;
30
+ archivedAt?: string | null;
31
+ createdAt: string;
32
+ updatedAt: string;
33
+ }
34
+ export interface TagCatalogueEntryInput {
35
+ fieldKey: TagFieldKey;
36
+ label: string;
37
+ value?: string;
38
+ color?: string;
39
+ description?: string;
40
+ }
41
+ export interface UpdateTagCatalogueEntryInput {
42
+ label?: string;
43
+ color?: string;
44
+ description?: string;
45
+ }
46
+ export interface TagFieldEnforcement {
47
+ fieldKey: TagFieldKey;
48
+ enforcement: TagCatalogueEnforcement;
49
+ }
50
+ export interface SetTagEnforcementInput {
51
+ fieldKey: TagFieldKey;
52
+ enforcement: TagCatalogueEnforcement;
53
+ }
54
+ export type TypedFieldType = 'TEXT' | 'NUMBER' | 'BOOLEAN' | 'DATE' | 'SET' | 'CURRENCY' | 'MONETARY';
55
+ /** Schema declaration carried on a parent resource (e.g. `Product.typedAccountFieldConfig`). */
56
+ export interface TypedFieldDefinition {
57
+ key: string;
58
+ displayName: string;
59
+ type: TypedFieldType;
60
+ required: boolean;
61
+ /** Default applied at write time when the caller omits the key. Raw value, validated against `type`. */
62
+ defaultValue?: unknown;
63
+ description?: string | null;
64
+ }
65
+ /**
66
+ * Caller-facing input for one typed key/value entry. `type` tells the
67
+ * backend validator how to interpret `value`:
68
+ * - TEXT / DATE / CURRENCY → string
69
+ * - NUMBER → finite JS number
70
+ * - BOOLEAN → boolean
71
+ * - SET → string[]
72
+ * - MONETARY → denominated literal `"<amount>@<TYPE:CODE>"`, e.g. `"50000.00@FIAT:USD"`
73
+ */
74
+ export interface TypedFieldValueInput {
75
+ key: string;
76
+ type: TypedFieldType;
77
+ value: unknown;
78
+ }
79
+ /** Untyped escape-hatch input (Tier C). Stored verbatim. */
80
+ export interface UntypedKeyValueInput {
81
+ key: string;
82
+ value: unknown;
83
+ }
84
+ /**
85
+ * Read shape for one typed key/value entry. Wire-format `type` strings use
86
+ * the lowercase form. Monetary carries pre-resolved minor units.
87
+ */
88
+ export type TypedFieldStored = {
89
+ key: string;
90
+ type: 'text';
91
+ value: string;
92
+ } | {
93
+ key: string;
94
+ type: 'number';
95
+ value: number;
96
+ } | {
97
+ key: string;
98
+ type: 'boolean';
99
+ value: boolean;
100
+ } | {
101
+ key: string;
102
+ type: 'date';
103
+ value: string;
104
+ } | {
105
+ key: string;
106
+ type: 'set';
107
+ value: string[];
108
+ } | {
109
+ key: string;
110
+ type: 'currency';
111
+ value: string;
112
+ } | {
113
+ key: string;
114
+ type: 'monetary';
115
+ amountMinor: number;
116
+ currency: string;
117
+ precision: number;
118
+ };
119
+ export interface UntypedKeyValueDto {
120
+ key: string;
121
+ value: unknown;
122
+ }
5
123
  export interface AccountResponseDto {
6
124
  id: string;
7
125
  externalId?: string;
@@ -12,11 +130,10 @@ export interface AccountResponseDto {
12
130
  accountType: 'CHECKING' | 'SAVINGS' | 'OPERATING' | 'TRUST' | 'INVESTMENT' | 'ESCROW' | 'CREDIT_CARD' | 'LINE_OF_CREDIT' | 'PERSONAL_LOAN' | 'MORTGAGE' | 'AUTO_LOAN' | 'BUSINESS_LOAN' | 'CRYPTO_WALLET' | 'MOBILE_WALLET' | 'PREPAID_CARD' | 'E_WALLET' | 'BROKERAGE' | 'FUND' | 'OTHER';
13
131
  status: 'ACTIVE' | 'FROZEN' | 'CLOSED' | 'DORMANT';
14
132
  currency?: string;
15
- bankName?: string;
16
- bankSwift?: string;
17
- iban?: string;
18
- accountNumber?: string;
19
- customProperties?: Record<string, unknown>;
133
+ /** Typed Field bag (Tier A). Validated against `Product.typedAccountFieldConfig`. */
134
+ fields?: TypedFieldStored[];
135
+ /** Untyped escape hatch (Tier C). */
136
+ otherProperties?: UntypedKeyValueDto[];
20
137
  openedAt: string;
21
138
  closedAt?: string;
22
139
  }
@@ -67,7 +184,7 @@ export interface AddressDto {
67
184
  ownerResourceId: string;
68
185
  category?: AddressCategory | null;
69
186
  iso20022Type?: Iso20022AddressType | null;
70
- tags: string[];
187
+ tags: TagValue[];
71
188
  note?: string | null;
72
189
  line1?: string | null;
73
190
  line2?: string | null;
@@ -106,7 +223,7 @@ export interface AddressDto {
106
223
  export interface AddressInputDto {
107
224
  category?: AddressCategory;
108
225
  iso20022Type?: Iso20022AddressType;
109
- tags?: string[];
226
+ tags?: TagValueInput[];
110
227
  note?: string;
111
228
  line1?: string;
112
229
  line2?: string;
@@ -302,7 +419,8 @@ export interface CounterpartyResponseDto {
302
419
  identity: 'INDIVIDUAL' | 'ENTITY' | 'UNKNOWN';
303
420
  classification: 'BANK_ACCOUNT' | 'WALLET' | 'MERCHANT' | 'FINANCIAL_INSTITUTION' | 'PAYMENT_NETWORK' | 'UNKNOWN';
304
421
  country?: string;
305
- riskLevel: 'HIGH' | 'MEDIUM' | 'LOW' | 'UNRATED';
422
+ /** Unified risk rating; null = unrated (was `riskLevel` with UNRATED). */
423
+ riskRating: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL' | null;
306
424
  source: 'MANUAL' | 'SYSTEM';
307
425
  linkedCustomerIds: string[];
308
426
  /** ID of the transaction that first created this counterparty */
@@ -313,25 +431,34 @@ export interface CounterpartyResponseDto {
313
431
  institution?: InstitutionDetailsDto;
314
432
  firstTransactionAt?: string;
315
433
  lastTransactionAt?: string;
434
+ /** Untyped escape hatch (Tier C). */
435
+ otherProperties?: UntypedKeyValueDto[];
316
436
  createdAt: string;
317
437
  updatedAt: string;
318
438
  }
319
439
  export interface CreateAccountDto {
320
- /** Your external identifier */
440
+ /**
441
+ * Customer to register as the PRIMARY owner. Written into
442
+ * `account_owners`, not stored on the accounts row (D18).
443
+ */
444
+ primaryCustomerId: string;
445
+ /** Your external identifier. Defaults to `ACC-${timestamp}`. */
321
446
  externalId?: string;
322
- /** Product ID this account is based on */
447
+ /**
448
+ * Product this account is instantiated from. Determines `accountCategory`
449
+ * / `accountType` and the required typed-field schema — those are NOT
450
+ * accepted from the caller (Phase 3b).
451
+ */
323
452
  productId?: string;
324
453
  label: string;
325
- accountCategory: 'DEPOSIT' | 'CREDIT' | 'LOAN' | 'WALLET' | 'SECURITIES' | 'OTHER';
326
- accountType: 'CHECKING' | 'SAVINGS' | 'OPERATING' | 'TRUST' | 'INVESTMENT' | 'ESCROW' | 'CREDIT_CARD' | 'LINE_OF_CREDIT' | 'PERSONAL_LOAN' | 'MORTGAGE' | 'AUTO_LOAN' | 'BUSINESS_LOAN' | 'CRYPTO_WALLET' | 'MOBILE_WALLET' | 'PREPAID_CARD' | 'E_WALLET' | 'BROKERAGE' | 'FUND' | 'OTHER';
327
- /** Currency code (ISO 4217) */
454
+ /** Currency code (ISO 4217 / `TYPE:CODE`). Falls back to `product.defaultCurrency`. */
328
455
  currency?: string;
329
- bankName?: string;
330
- bankSwift?: string;
331
- iban?: string;
332
- accountNumber?: string;
333
- /** Arbitrary key-value properties */
334
- customProperties?: Record<string, unknown>;
456
+ /** Typed Field write input (Tier A). Validated against `Product.typedAccountFieldConfig`. */
457
+ fields?: TypedFieldValueInput[];
458
+ /** Untyped escape hatch (Tier C). Stored verbatim. */
459
+ otherProperties?: UntypedKeyValueInput[];
460
+ /** Customer IDs to add as JOINT owners alongside the primary. */
461
+ additionalOwnerIds?: string[];
335
462
  /** Override account opening timestamp (ISO 8601). Used by data-loading tools to backfill historical accounts. */
336
463
  openedAt?: string;
337
464
  }
@@ -351,7 +478,7 @@ export interface CreateConstantDto {
351
478
  /** Scope (derived from name if omitted). */
352
479
  scope?: 'global' | 'product' | 'customer' | 'account' | 'counterparty' | 'instrument' | 'device';
353
480
  /** Constant type. Determines the required shape of `value`. */
354
- type: 'scalar' | 'monetary' | 'set' | 'range' | 'text' | 'number' | 'boolean' | 'date' | 'currency';
481
+ type: 'scalar' | 'monetary' | 'set' | 'range' | 'text' | 'number' | 'boolean' | 'date' | 'currency' | 'regex';
355
482
  /** Payload shape depends on the constant's `type`. Pick the matching variant below. Validated at write time. */
356
483
  value: {
357
484
  /** e.g. `"1000000@FIAT:USD"` = $10,000.00. Precision implied by currency: USD=2, JPY=0, BTC=8, ETH=9, USDT/USDC=6. */
@@ -458,22 +585,29 @@ export interface CreateProductDto {
458
585
  country?: string;
459
586
  /** Supported transaction method IDs. */
460
587
  supportedMethodIds: string[];
461
- /** Arbitrary product metadata. */
462
- metadata?: Record<string, unknown>;
588
+ /**
589
+ * Typed Field schema for accounts of this product (Tier A). Each entry is
590
+ * a `TypedFieldDefinition`; validates `Account.fields` writes.
591
+ */
592
+ typedAccountFieldConfig?: TypedFieldDefinition[];
593
+ /** Product-level typed bag (Tier B, self-declaring). */
594
+ fields?: TypedFieldValueInput[];
595
+ /** Untyped escape hatch (Tier C). */
596
+ otherProperties?: UntypedKeyValueInput[];
463
597
  /** Sync key for config-as-code management. */
464
598
  syncKey?: string;
465
599
  }
466
600
  export interface CreateRiskAssessmentDto {
467
601
  answers: RiskAssessmentAnswerDto[];
468
- resultingRiskLevel: 'HIGH' | 'MEDIUM' | 'LOW' | 'UNRATED';
469
- computedRiskLevel?: 'HIGH' | 'MEDIUM' | 'LOW' | 'UNRATED';
602
+ resultingRiskRating: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
603
+ computedRiskRating?: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
470
604
  ratingOverridden?: boolean;
471
605
  overrideJustification?: string;
472
606
  narrative?: string;
473
- riskTags?: string[];
607
+ riskTags?: TagValueInput[];
474
608
  }
475
- export interface CreateRiskQuestionnaireDto {
476
- answers: RiskQuestionnaireAnswerDto[];
609
+ export interface CreateCustomerRiskAssessmentDto {
610
+ answers: CustomerRiskAssessmentAnswerDto[];
477
611
  /** Optional narrative summary */
478
612
  narrative?: string;
479
613
  }
@@ -488,8 +622,8 @@ export interface CreateRuleDto {
488
622
  trigger?: string;
489
623
  /** Rule severity. */
490
624
  severity: 'HIGH' | 'MEDIUM' | 'LOW';
491
- /** Tags for categorisation. */
492
- tags?: string[];
625
+ /** Tags for categorisation (tag catalogue). */
626
+ tags?: TagValueInput[];
493
627
  /** Condition tree (AND/OR logic with leaf conditions). */
494
628
  conditionTree?: Record<string, unknown>;
495
629
  /** Actions to execute when the rule triggers. */
@@ -742,7 +876,7 @@ export interface IdentificationDocument {
742
876
  status: IdentificationDocumentStatus;
743
877
  effectiveStatus: IdentificationDocumentEffectiveStatus;
744
878
  rejectionNarrative?: string;
745
- tags: string[];
879
+ tags: TagValue[];
746
880
  attachments: IdDocFileAttachment[];
747
881
  /** @deprecated Use attachments[].fileId instead. */
748
882
  fileIds?: string[];
@@ -775,7 +909,7 @@ export interface CreateIdentificationDocumentInput {
775
909
  sex?: string;
776
910
  /** Free-form key/value metadata. */
777
911
  other?: Record<string, unknown>;
778
- tags?: string[];
912
+ tags?: TagValueInput[];
779
913
  attachments?: IdDocFileAttachmentInput[];
780
914
  notes?: string;
781
915
  }
@@ -791,7 +925,7 @@ export interface UpdateIdentificationDocumentInput {
791
925
  dateOfBirth?: string;
792
926
  sex?: string;
793
927
  other?: Record<string, unknown>;
794
- tags?: string[];
928
+ tags?: TagValueInput[];
795
929
  attachments?: IdDocFileAttachmentInput[];
796
930
  notes?: string;
797
931
  }
@@ -946,8 +1080,11 @@ export interface IngestEventDto {
946
1080
  deviceId?: string;
947
1081
  /** Session identifier for session-context rules. */
948
1082
  sessionId?: string;
949
- /** Event-specific payload data. Schema depends on event type. */
950
- data?: Record<string, unknown>;
1083
+ /**
1084
+ * Typed payload (Typed Fields primitive, Tier B). Validated via the
1085
+ * canonical TypedFields validator and stored in `events.fields`.
1086
+ */
1087
+ fields?: TypedFieldValueInput[];
951
1088
  }
952
1089
  export interface IngestTransactionDto {
953
1090
  /** Your unique identifier for this transaction. Used for idempotency. */
@@ -1253,7 +1390,7 @@ export interface RiskAssessmentAnswerDto {
1253
1390
  selectedOptionId?: string;
1254
1391
  notes?: string;
1255
1392
  }
1256
- export interface RiskQuestionnaireAnswerDto {
1393
+ export interface CustomerRiskAssessmentAnswerDto {
1257
1394
  questionId: string;
1258
1395
  question: string;
1259
1396
  answer: string;
@@ -1302,23 +1439,22 @@ export interface TransactionBodyDto {
1302
1439
  metadata?: Record<string, string | number | boolean | MetadataTextWrapperDto | MetadataNumberWrapperDto | MetadataBooleanWrapperDto | MetadataDateWrapperDto | MetadataSetWrapperDto | MetadataCurrencyWrapperDto | MetadataMonetaryWrapperDto>;
1303
1440
  }
1304
1441
  export interface UpdateAccountDto {
1305
- /** Product ID this account is based on */
1306
- productId?: string;
1307
1442
  label?: string;
1308
- /** Currency code (ISO 4217) */
1309
- currency?: string;
1310
- bankName?: string;
1311
- bankSwift?: string;
1312
- iban?: string;
1313
- accountNumber?: string;
1314
- /** Arbitrary key-value properties */
1315
- customProperties?: Record<string, unknown>;
1316
1443
  /** Override account opening timestamp (ISO 8601). Used by data-loading tools to backfill historical accounts. */
1317
1444
  openedAt?: string;
1445
+ /**
1446
+ * Typed Field write input (Tier A). Merge semantics — supplied keys
1447
+ * overwrite the stored bag, absent keys are preserved. Pass `[]` to clear.
1448
+ * Banking-style values (IBAN, SWIFT, account number, …) live here now,
1449
+ * not as flat columns (Phase 3b).
1450
+ */
1451
+ fields?: TypedFieldValueInput[];
1452
+ /** Untyped escape hatch (Tier C). Stored verbatim. */
1453
+ otherProperties?: UntypedKeyValueInput[];
1318
1454
  }
1319
1455
  export interface UpdateConstantDto {
1320
1456
  /** Constant type. If changed, `value` must be re-supplied in the new shape. */
1321
- type?: 'scalar' | 'monetary' | 'set' | 'range' | 'text' | 'number' | 'boolean' | 'date' | 'currency';
1457
+ type?: 'scalar' | 'monetary' | 'set' | 'range' | 'text' | 'number' | 'boolean' | 'date' | 'currency' | 'regex';
1322
1458
  /** Payload shape depends on the constant's `type`. Pick the matching variant below. Validated at write time. */
1323
1459
  value?: {
1324
1460
  /** e.g. `"1000000@FIAT:USD"` = $10,000.00. Precision implied by currency: USD=2, JPY=0, BTC=8, ETH=9, USDT/USDC=6. */
@@ -1483,14 +1619,32 @@ export interface UpdateProductDto {
1483
1619
  status?: string;
1484
1620
  /** Supported transaction method IDs. */
1485
1621
  supportedMethodIds?: string[];
1486
- /** Arbitrary product metadata. */
1487
- metadata?: Record<string, unknown>;
1622
+ /** Typed Field schema for accounts of this product (Tier A). */
1623
+ typedAccountFieldConfig?: TypedFieldDefinition[];
1624
+ /** Product-level typed bag (Tier B, self-declaring). */
1625
+ fields?: TypedFieldValueInput[];
1626
+ /** Untyped escape hatch (Tier C). */
1627
+ otherProperties?: UntypedKeyValueInput[];
1488
1628
  }
1489
1629
  export interface UpdateRiskRatingDto {
1490
1630
  riskRating: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
1491
1631
  /** Justification for the override */
1492
1632
  justification?: string;
1493
1633
  }
1634
+ /** Lifecycle status of a customer (individual or entity). */
1635
+ export type CustomerStatus = 'ONBOARDING' | 'IN_REVIEW' | 'ACTIVE' | 'INACTIVE' | 'SUSPENDED' | 'REJECTED';
1636
+ export interface UpdateCustomerStatusDto {
1637
+ /** New lifecycle status for the customer. */
1638
+ status: CustomerStatus;
1639
+ /** Audit reason for the status change. */
1640
+ reason?: string;
1641
+ }
1642
+ export interface UpdateCustomerStatusResponse {
1643
+ customerId: string;
1644
+ status: CustomerStatus;
1645
+ statusReason: string | null;
1646
+ updatedAt: string;
1647
+ }
1494
1648
  export interface UpdateRuleDto {
1495
1649
  /** Rule name. */
1496
1650
  name?: string;
@@ -1502,8 +1656,8 @@ export interface UpdateRuleDto {
1502
1656
  trigger?: string;
1503
1657
  /** Rule severity. */
1504
1658
  severity?: 'HIGH' | 'MEDIUM' | 'LOW';
1505
- /** Tags for categorisation. */
1506
- tags?: string[];
1659
+ /** Tags for categorisation (tag catalogue). */
1660
+ tags?: TagValueInput[];
1507
1661
  /** Rule status. */
1508
1662
  status?: 'DRAFT' | 'ACTIVE' | 'DISABLED';
1509
1663
  /** Condition tree. */
@@ -1599,6 +1753,11 @@ export interface GetCustomerQuery {
1599
1753
  /** If true, treat the path id as an external customer ID. */
1600
1754
  isExternal?: boolean;
1601
1755
  }
1756
+ /**
1757
+ * Response DTOs not enumerated in the public OpenAPI schema. The backend
1758
+ * returns these as full objects but the OpenAPI spec does not publish their
1759
+ * shape. Treated as opaque records — narrow on the caller side.
1760
+ */
1602
1761
  export type OpaqueResponse = Record<string, unknown>;
1603
1762
  export type ApiKeyResponseDto = OpaqueResponse;
1604
1763
  export type TokenResponseDto = OpaqueResponse;
@@ -1642,7 +1801,7 @@ export type PlatformConfirmUploadResponseDto = OpaqueResponse;
1642
1801
  export type StakeholderResponseDto = OpaqueResponse;
1643
1802
  export type DeviceResponseDto = OpaqueResponse;
1644
1803
  export type DeviceSummaryDto = OpaqueResponse;
1645
- export type RiskQuestionnaireResponseDto = OpaqueResponse;
1804
+ export type CustomerRiskAssessmentResponseDto = OpaqueResponse;
1646
1805
  export type RiskAssessmentResponseDto = OpaqueResponse;
1647
1806
  export type ExpectedActivityResponseDto = OpaqueResponse;
1648
1807
  export type ScreeningResultDto = OpaqueResponse;
@@ -1653,7 +1812,6 @@ export type ProductResponseDto = OpaqueResponse;
1653
1812
  export type CurrencyResponseDto = OpaqueResponse;
1654
1813
  export type EventDefinitionResponseDto = OpaqueResponse;
1655
1814
  export type WebhookResponseDto = OpaqueResponse;
1656
- export type SyncExportDto = OpaqueResponse;
1657
1815
  export interface SyncSnapshotActor {
1658
1816
  userId: string;
1659
1817
  name: string;
@@ -1677,6 +1835,137 @@ export interface SyncDriftDto {
1677
1835
  export interface CreateSyncSnapshotInput {
1678
1836
  note?: string;
1679
1837
  }
1838
+ export interface SyncConfig {
1839
+ $schema?: string;
1840
+ version: number;
1841
+ tenant: {
1842
+ organizationId: string;
1843
+ baseCurrency?: string;
1844
+ displayName?: string;
1845
+ };
1846
+ productDefinitions?: Record<string, SyncProductDefinitionConfig | string>;
1847
+ constants?: Record<string, SyncConstantConfig>;
1848
+ eventDefinitions?: Record<string, SyncEventDefConfig>;
1849
+ webhooks?: Record<string, SyncWebhookConfig>;
1850
+ rules?: Record<string, SyncRuleConfig>;
1851
+ /** Keyed by TYPE:CODE (e.g. "FIAT:USD", "CRYPTO:BTC"). */
1852
+ currencies?: Record<string, SyncCurrencyConfig>;
1853
+ customerFieldPolicy?: Record<string, SyncCustomerFieldPolicyConfig>;
1854
+ accountStatusPolicy?: SyncAccountStatusPolicyConfig;
1855
+ }
1856
+ export interface SyncCurrencyConfig {
1857
+ name: string;
1858
+ symbol?: string;
1859
+ precision: number;
1860
+ enabled?: boolean;
1861
+ custom?: boolean;
1862
+ }
1863
+ export interface SyncConstantConfig {
1864
+ type: 'scalar' | 'monetary' | 'set' | 'range' | 'text' | 'number' | 'boolean' | 'date' | 'currency' | 'regex';
1865
+ description: string;
1866
+ values?: string[];
1867
+ value?: string | number | boolean | null;
1868
+ min?: number;
1869
+ max?: number;
1870
+ }
1871
+ export interface SyncProductDefinitionConfig {
1872
+ name: string;
1873
+ description?: string;
1874
+ category: string;
1875
+ baseType: string;
1876
+ defaultCurrency: string;
1877
+ country?: string;
1878
+ supportedMethods: string[];
1879
+ metadata?: Record<string, unknown>;
1880
+ }
1881
+ export interface SyncEventDefConfig {
1882
+ name: string;
1883
+ description: string;
1884
+ subject: 'CUSTOMER' | 'ACCOUNT' | 'TRANSACTION';
1885
+ }
1886
+ export interface SyncWebhookConfig {
1887
+ description: string;
1888
+ url: string;
1889
+ headers?: Record<string, string>;
1890
+ events: string[];
1891
+ }
1892
+ export interface SyncRuleConfig {
1893
+ name: string;
1894
+ description: string;
1895
+ subject: string;
1896
+ trigger: string;
1897
+ severity: 'HIGH' | 'MEDIUM' | 'LOW';
1898
+ tags?: string[];
1899
+ conditionTree: unknown;
1900
+ actions?: Array<Record<string, unknown>>;
1901
+ initialStatus?: 'DRAFT' | 'ACTIVE' | 'DISABLED';
1902
+ status?: 'DRAFT' | 'ACTIVE' | 'DISABLED';
1903
+ }
1904
+ export interface SyncCustomerFieldPolicyConfig {
1905
+ source: string;
1906
+ syncTrigger: string;
1907
+ usedBy: string[];
1908
+ }
1909
+ export interface SyncAccountStatusPolicyConfig {
1910
+ statuses: string[];
1911
+ dormancyThresholdDays?: number;
1912
+ dormancyStrategy?: 'MANUAL' | 'AUTO';
1913
+ usedBy?: Record<string, string[]>;
1914
+ }
1915
+ /** Request body for `validate` / `plan` / `apply`. */
1916
+ export interface SyncConfigBody {
1917
+ config: SyncConfig;
1918
+ }
1919
+ export type SyncDiffOpType = 'create' | 'update' | 'destroy' | 'archive' | 'tombstone';
1920
+ export interface SyncDiffOp {
1921
+ type: SyncDiffOpType;
1922
+ key: string;
1923
+ config?: unknown;
1924
+ changes?: string[];
1925
+ }
1926
+ export interface SyncImmutableViolation {
1927
+ section: string;
1928
+ key: string;
1929
+ field: string;
1930
+ liveValue: unknown;
1931
+ configValue: unknown;
1932
+ }
1933
+ export interface SyncPlan {
1934
+ products: SyncDiffOp[];
1935
+ constants: SyncDiffOp[];
1936
+ eventDefs: SyncDiffOp[];
1937
+ webhooks: SyncDiffOp[];
1938
+ rules: SyncDiffOp[];
1939
+ currencies: SyncDiffOp[];
1940
+ immutableViolations: SyncImmutableViolation[];
1941
+ }
1942
+ /** `POST /v1/config/sync/validate` response. */
1943
+ export interface SyncValidationResult {
1944
+ errors: string[];
1945
+ warnings: string[];
1946
+ }
1947
+ /** `POST /v1/config/sync/plan` response (validation + advisory diff). */
1948
+ export interface SyncPlanResult extends SyncValidationResult {
1949
+ plan: SyncPlan;
1950
+ }
1951
+ export interface SyncApplyResultItem {
1952
+ section: string;
1953
+ key: string;
1954
+ type: SyncDiffOpType;
1955
+ status: 'applied' | 'failed';
1956
+ error?: string;
1957
+ }
1958
+ /** `POST /v1/config/sync/apply` response. */
1959
+ export interface SyncApplyResult {
1960
+ succeeded: number;
1961
+ failed: number;
1962
+ results: SyncApplyResultItem[];
1963
+ immutableViolations: SyncImmutableViolation[];
1964
+ }
1965
+ export interface SyncExportQuery {
1966
+ /** Include rows without a sync key (keyed by natural id). Used by import/pull. */
1967
+ includeUnsynced?: boolean;
1968
+ }
1680
1969
  export type ResetConfigResponseDto = OpaqueResponse;
1681
1970
  export type PushExchangeRatesResponseDto = OpaqueResponse;
1682
1971
  export type BulkCurrencyStatusResponseDto = OpaqueResponse;