@dossier-wiki/os-sdk 1.4.1 → 1.4.2-staging.6.1

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/docs/REFERENCE.md CHANGED
@@ -44,8 +44,20 @@ the recorded event-time bounds.
44
44
  `status`, `preferredName`, `aliases`, `dateOfBirth`, `nationality[]`,
45
45
  `countryOfResidence[]`, `taxId`, `emails[]`, `phones[]`,
46
46
  `identificationDocuments[]`, `faceImageFileIds[]`, `addresses[]`, `tags[]`,
47
- `assignedToUserIds[]`, and `assignedToTeamIds[]`. Contact entries are
48
- `{ value, primary }`.
47
+ `assignedToUserIds[]`, `assignedToTeamIds[]`, `profileTemplateKey`, `fields[]`,
48
+ and `deferInitialScreening`. Contact entries are `{ value, primary }`.
49
+ `deferInitialScreening: true` skips the initial screening that creation
50
+ normally enqueues; use it when another path screens the customer, such as a
51
+ stakeholder screened with its entity.
52
+
53
+ `profileTemplateKey` names the customer's Profile Template (omit it to get the
54
+ default `INDIVIDUAL` template, if one is set). `fields` are the template's
55
+ typed profile fields (`TypedFieldValueInput[]`), validated Tier A against
56
+ `ProfileTemplate.fieldConfig`; sending `fields` with no template is a 400. On
57
+ `update`, `fields` merge (listed keys change, `value: null` clears, unlisted
58
+ keys stay) and `profileTemplateKey` switches template. Responses carry
59
+ `profileTemplateKey`, `fields` (`TypedFieldValue[]`) and `riskRatingSource`
60
+ (`'MANUAL' | 'MATRIX' | null`).
49
61
 
50
62
  Legacy field names from the pre-1.0 contract are still accepted on create and
51
63
  map onto the canonical ones — `email` / `phone` scalars fold into `emails[]` /
@@ -81,8 +93,9 @@ whenever both are supplied. Prefer the canonical names in new integrations.
81
93
  `create(input)` requires `externalId` and `legalName`. Optional create fields
82
94
  are `status`, `tradingNames[]`, `registrationNumber`, `taxId`,
83
95
  `countryOfIncorporation`, `dateOfIncorporation`, `entityType`, `websites[]`,
84
- `stakeholders[]`, `locations[]`, `tags[]`, `assignedToUserIds[]`, and
85
- `assignedToTeamIds[]`. Each stakeholder has required `name` and uppercase
96
+ `stakeholders[]`, `locations[]`, `tags[]`, `assignedToUserIds[]`,
97
+ `assignedToTeamIds[]`, `profileTemplateKey`, and `fields[]` (same profile
98
+ semantics as individuals, against an `ENTITY` template). Each stakeholder has required `name` and uppercase
86
99
  `role` (`SHAREHOLDER`, `UBO`, or `DIRECTOR`). Entity locations use the same
87
100
  `AddressInputDto` shape as individual addresses.
88
101
 
@@ -144,9 +157,47 @@ for (const m of matches.filter((m) => m.disposition === 'FALSE_POSITIVE')) {
144
157
 
145
158
  The assessment only ever eliminates on a contradiction — never on a missing attribute, never on geography alone, and never on a sanctions listing unless the contradiction is hard. A `retain` is not a confirmation, only the absence of grounds to eliminate, and an absent `disambiguation` means the match was never assessed. `resolvedBy` distinguishes the automation from your users.
146
159
 
147
- `customers.riskRating` — `update(customerId, input)` → `PUT .../risk-rating`
160
+ `customers.kyc`
148
161
 
149
- `customers.riskAssessments` — `list`, `create` on `.../risk-assessments`
162
+ | Method | Endpoint |
163
+ | --- | --- |
164
+ | `start(customerId, { providerConfigId?, workflowId? })` | `POST .../kyc/sessions` — returns the hosted `sessionUrl` to hand to the customer |
165
+ | `list(customerId)` | `GET .../kyc/sessions` |
166
+ | `refresh(customerId, sessionId)` | `POST .../kyc/sessions/{sessionId}/refresh` |
167
+ | `review(customerId, sessionId, { decision, reason?, notifyCustomer?, customerMessage? })` | `POST .../kyc/sessions/{sessionId}/review` — needs `customer:update` |
168
+ | `report(customerId, sessionId)` | `GET .../kyc/sessions/{sessionId}/report` — PDF bytes (`Uint8Array`); needs `report:read` |
169
+ | `evidenceBundle(customerId, sessionId)` | `GET .../kyc/sessions/{sessionId}/evidence` — ZIP bytes (`Uint8Array`); needs `report:read` |
170
+ | `delete(customerId, sessionId)` | `DELETE .../kyc/sessions/{sessionId}` — unfinished sessions only |
171
+
172
+ The OS keeps every session after it ends, so `report` and `evidenceBundle` work after the provider has deleted its copy. The bundle holds `report.pdf`, every archived evidence file at full resolution under `evidence/` (document pages, faces, liveness video, signature) and the raw data under `data/`.
173
+
174
+ `customers.riskRating`
175
+
176
+ | Method | Endpoint |
177
+ | --- | --- |
178
+ | `update(customerId, { riskRating, justification })` | `PUT .../risk-rating` — sets a sticky officer override (`riskRatingSource: 'MANUAL'`), up or down; `justification` is required and kept as an `OVERRIDE` assessment; returns `UpdateRiskRatingResponseDto`. Needs an owner, admin or compliance key creator (403 otherwise) |
179
+ | `clearOverride(customerId)` | `DELETE .../risk-rating/override` — hands the rating back to the risk matrix; returns the latest matrix assessment. Same role requirement as `update` |
180
+
181
+ `customers.riskAssessments`
182
+
183
+ | Method | Endpoint |
184
+ | --- | --- |
185
+ | `list(customerId)` | `GET .../risk-assessments` — questionnaires and matrix runs, newest first |
186
+ | `create(customerId, input)` | `POST .../risk-assessments` — submit a questionnaire (it replaces the rating, so owner, admin or compliance only) |
187
+ | `evaluate(customerId)` | `POST .../risk-assessments/evaluate` — run the Profile Template risk matrix now; returns the latest matrix assessment |
188
+
189
+ `CustomerRiskAssessmentResponseDto.method` is `QUESTIONNAIRE`, `MATRIX` or
190
+ `OVERRIDE` (an officer-set rating: `overrideJustification` says why,
191
+ `computedRiskRating` is what the matrix last computed).
192
+ Matrix runs add `compositeScore`, `breakdown` (`RiskMatrixBreakdown`: per
193
+ factor `input → criterion → level → score → weighted`, the composite, the
194
+ preliminary rating, escalations that fired, incomplete factors, final rating
195
+ and outcome), `profileTemplateVersion`, `trigger` (`PROFILE_UPDATED`,
196
+ `KYC_SYNC`, `SCREENING`, `SCHEDULED`, `TEMPLATE_CHANGED`, `MANUAL`), `requiredDueDiligence`
197
+ (`SDD | CDD | EDD`) and `nextReviewAt`. The matrix records its computed
198
+ rating on every run but never overwrites a `MANUAL` rating. `evaluate` and
199
+ `clearOverride` return 400 when the customer has no Profile Template with a
200
+ risk matrix.
150
201
 
151
202
  `customers.expectedActivity` — `get`, `update` on `.../expected-activity`
152
203
 
@@ -188,6 +239,8 @@ observation contracts.
188
239
 
189
240
  Standing assignment can also be stamped at create via `assignedToUserIds` / `assignedToTeamIds` on `individuals.create` / `entities.create`.
190
241
 
242
+ `customers.assignProfileTemplate({ customerIds, profileTemplateKey })` — `POST /v1/customers/profile-template-assignment` puts up to 500 existing customers on a live profile template. Values the template can hold are kept and defaults applied; required fields left empty come back per customer in `assigned[].missingFields` instead of refusing it (the next `fields` update must fill them). Customers already on the template are `unchanged`; other party types, archived customers and unknown ids are `skipped` with a `reason`. Requires `customer:update`.
243
+
191
244
  `individuals.create(input, { screening: 'sync' })` / `entities.create(input, { screening: 'sync' })` run the INITIAL screening inline and return it under `screening` (`InitialScreeningResultDto`: run status, `alertId`, and the `matches` array in the `listResults` shape). Without the option the call queues the screening as before and the response has no `screening` field.
192
245
 
193
246
  `targets` must contain at least one non-empty `userIds` or `teamIds` array.
@@ -199,7 +252,10 @@ writes require `customer:update`; archived customers return 422.
199
252
  ### `identificationDocuments` (document-scoped)
200
253
 
201
254
  Top-level resource for operating on a single identification document by its id
202
- — the review workflow's surface. Customer-scoped create/update/delete also
255
+ — the review workflow's surface. Stage definitions may carry an optional
256
+ `returnAssignment` (`RULE` | `RESTORE` | `ASK`) saying what happens to
257
+ assignees when an alert is returned to that stage; omission means `RULE`, and
258
+ Resolved stages never carry it. Customer-scoped create/update/delete also
203
259
  exist on `individuals.identificationDocuments` / `entities.identificationDocuments`.
204
260
 
205
261
  | Method | Endpoint |
@@ -532,6 +588,55 @@ schema. Editing `fields` never re-validates existing alerts — new required
532
588
  fields apply to alerts raised afterwards. Archive is refused (409) while any
533
589
  alert of the type is OPEN.
534
590
 
591
+ `config.profileTemplates` — the template a customer is created against
592
+ (Customer → Profile Template parallels Account → Product).
593
+
594
+ | Method | Endpoint |
595
+ | --- | --- |
596
+ | `list({ partyType?, includeArchived? })` | `GET /v1/config/profile-templates` |
597
+ | `get(id)` | `GET /v1/config/profile-templates/{id}` |
598
+ | `getByKey(key)` | `GET /v1/config/profile-templates/by-key/{key}` (404 when absent) |
599
+ | `versions(id)` | `GET /v1/config/profile-templates/{id}/versions` (newest first, each with `changes`) |
600
+ | `version(id, version)` | `GET /v1/config/profile-templates/{id}/versions/{version}` |
601
+ | `restoreVersion(id, version)` | `POST /v1/config/profile-templates/{id}/versions/{version}/restore` (republish as the newest version) |
602
+ | `create(input)` | `POST /v1/config/profile-templates` (409 when `key` is taken) |
603
+ | `update(id, input)` | `PATCH /v1/config/profile-templates/{id}` |
604
+ | `archive(id)` | `DELETE /v1/config/profile-templates/{id}` (archive; no hard delete) |
605
+ | `previewRiskMatrix(input)` | `POST /v1/config/profile-templates/preview-risk-matrix` (dry run for one customer; nothing saved) |
606
+ | `riskMatrixImpact(id, input)` | `POST /v1/config/profile-templates/{id}/risk-matrix-impact` (dry run for every live customer on the template; at most 5,000) |
607
+
608
+ A factor may read a platform-derived `input` (`customer.nationality`,
609
+ `customer.productKeys`, `customer.expectedMonthlyVolume`) instead of a profile
610
+ `field`. Individual and entity responses carry `nextReviewAt`, the customer's
611
+ next periodic review; the daily sweep opens a `periodic-review` Task when it
612
+ falls due.
613
+
614
+ A template carries an immutable org-unique `key`, `partyType` (`INDIVIDUAL` \|
615
+ `ENTITY`), `isDefault` (at most one live default per party type),
616
+ `fieldConfig` (`TypedFieldDefinition[]`), an optional `riskMatrix`
617
+ (`RiskMatrix`: `scale`, `bands`, `factors`, `escalations`, `outcomes`; each
618
+ `RiskFactor` is `field` + `levels` for select or yes/no fields — BOOLEAN
619
+ options `"true"` / `"false"`, a multi-select scores its highest-scoring
620
+ selected option — `field` + `ranges` (`RiskRange`: min inclusive, max
621
+ exclusive, open ends, no overlaps; money in major units) for NUMBER / MONETARY
622
+ fields, or `criteria`; any option, range or criterion may set its own `score`
623
+ to override its level's scale score) and
624
+ `kycWorkflows` (`KycWorkflowBinding[]`, one per purpose; only `ONBOARDING` is
625
+ used today), plus the creation setup of the simple create form for its party
626
+ type: `individualCreation` (`SimpleCustomerCreationPreferences`, `INDIVIDUAL`
627
+ templates) or `entityCreation` (`SimpleEntityCreationPreferences`, `ENTITY`
628
+ templates) — the other is always `null`. Writes take
629
+ `UpdateSimpleCustomerCreationPreferencesInput` /
630
+ `UpdateSimpleEntityCreationPreferencesInput` (full replacement); sending the
631
+ other party type's field is a 400. `create` without one copies the org's
632
+ current Simple Customer Creation preference; `update` with `null` clears it
633
+ (the org-wide preference applies again). The whole definition is validated on
634
+ save and every problem is returned in one 400. Changing `fieldConfig`,
635
+ `riskMatrix`, `kycWorkflows` or the creation setup publishes a new immutable
636
+ version (`versions` snapshots carry fields, matrix and workflows only); only
637
+ `fieldConfig` / `riskMatrix` changes re-assess the template's customers.
638
+ Archiving keeps existing customers on the template and clears `isDefault`.
639
+
535
640
  `config.currencies`
536
641
 
537
642
  | Method | Endpoint |
@@ -654,6 +759,14 @@ type TypedFieldStored =
654
759
  | { key: string; type: 'monetary'; amountMinor: number; currency: string; precision: number };
655
760
 
656
761
  interface UntypedKeyValueDto { key: string; value: unknown }
762
+
763
+ // Read shape on customer profile fields — the canonical uppercase tag.
764
+ type TypedFieldValue =
765
+ | { key: string; type: 'TEXT' | 'DATE' | 'CURRENCY' | 'SINGLE_SELECT'; value: string }
766
+ | { key: string; type: 'NUMBER'; value: number }
767
+ | { key: string; type: 'BOOLEAN'; value: boolean }
768
+ | { key: string; type: 'LIST' | 'MULTI_SELECT' | 'SET'; value: string[] }
769
+ | { key: string; type: 'MONETARY'; amountMinor: number; currency: string; precision: number };
657
770
  ```
658
771
 
659
772
  DTOs that carry these:
@@ -665,6 +778,9 @@ DTOs that carry these:
665
778
  | `CreateEventDefinitionDto` / `UpdateEventDefinitionDto` | `properties` (`TypedFieldDefinition[]`) | schema |
666
779
  | `CreateCustomAlertTypeDto` / `UpdateCustomAlertTypeDto` | `fields` (`TypedFieldDefinition[]`) | schema |
667
780
  | `CreateCustomAlertDto` / `AlertResponseDto` | `fields` | A |
781
+ | `CreateProfileTemplateInput` / `UpdateProfileTemplateInput` / `ProfileTemplate` | `fieldConfig` (`TypedFieldDefinition[]`) | schema |
782
+ | `CreateIndividualInput` / `UpdateIndividualDto` / `CreateEntityInput` / `UpdateEntityDto` | `fields` (`TypedFieldValueInput[]`) | A |
783
+ | `IndividualResponseDto` / `EntityResponseDto` | `fields` (`TypedFieldValue[]`) | A |
668
784
  | `CounterpartyResponseDto` | `otherProperties` | C |
669
785
  | Event ingestion (`POST /v1/events`) | `fields` | B |
670
786
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dossier-wiki/os-sdk",
3
- "version": "1.4.1",
3
+ "version": "1.4.2-staging.6.1",
4
4
  "description": "TypeScript SDK for the Dossiers OS API — customers, accounts, transactions, rules, screening, and configuration.",
5
5
  "license": "MIT",
6
6
  "type": "module",