@dossier-wiki/os-sdk 0.1.1 → 1.3.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/README.md +488 -7
- package/dist/alert-workflow-types.d.ts +113 -0
- package/dist/alert-workflow-types.d.ts.map +1 -0
- package/dist/alert-workflow-types.js +2 -0
- package/dist/alert-workflow-types.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/service.d.ts +660 -10
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +962 -79
- package/dist/service.js.map +1 -1
- package/dist/types.d.ts +2760 -132
- package/dist/types.d.ts.map +1 -1
- package/docs/REFERENCE.md +488 -3
- package/package.json +1 -1
package/dist/service.js
CHANGED
|
@@ -8,9 +8,6 @@ export class DossiersOSAPIError extends Error {
|
|
|
8
8
|
this.body = body;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
// ===========================================================================
|
|
12
|
-
// Main service — composes resource namespaces
|
|
13
|
-
// ===========================================================================
|
|
14
11
|
export class DossiersOSAPIService {
|
|
15
12
|
apiKey;
|
|
16
13
|
baseUrl;
|
|
@@ -22,15 +19,28 @@ export class DossiersOSAPIService {
|
|
|
22
19
|
accounts;
|
|
23
20
|
counterparties;
|
|
24
21
|
devices;
|
|
22
|
+
paymentInstruments;
|
|
23
|
+
sessions;
|
|
24
|
+
channelEndpoints;
|
|
25
25
|
transactions;
|
|
26
|
+
transactionAttempts;
|
|
27
|
+
behaviorSettings;
|
|
26
28
|
events;
|
|
29
|
+
riskSignals;
|
|
30
|
+
employees;
|
|
31
|
+
branches;
|
|
27
32
|
exchangeRates;
|
|
33
|
+
states;
|
|
28
34
|
identificationDocuments;
|
|
29
35
|
alerts;
|
|
30
36
|
platform;
|
|
31
37
|
config;
|
|
32
38
|
setup;
|
|
33
39
|
settings;
|
|
40
|
+
customLists;
|
|
41
|
+
teams;
|
|
42
|
+
reports;
|
|
43
|
+
partyRelationships;
|
|
34
44
|
constructor(options) {
|
|
35
45
|
if (!options.baseUrl)
|
|
36
46
|
throw new Error('DossiersOSAPIService: baseUrl is required');
|
|
@@ -47,15 +57,28 @@ export class DossiersOSAPIService {
|
|
|
47
57
|
this.accounts = new AccountsResource(req);
|
|
48
58
|
this.counterparties = new CounterpartiesResource(req);
|
|
49
59
|
this.devices = new DevicesResource(req);
|
|
60
|
+
this.paymentInstruments = new PaymentInstrumentsResource(req);
|
|
61
|
+
this.sessions = new SessionsResource(req);
|
|
62
|
+
this.channelEndpoints = new ChannelEndpointsResource(req);
|
|
50
63
|
this.transactions = new TransactionsResource(req);
|
|
64
|
+
this.transactionAttempts = new TransactionAttemptsResource(req);
|
|
65
|
+
this.behaviorSettings = new BehaviorSettingsResource(req);
|
|
51
66
|
this.events = new EventsResource(req);
|
|
67
|
+
this.riskSignals = new RiskSignalsResource(req);
|
|
68
|
+
this.employees = new EmployeesResource(req);
|
|
69
|
+
this.branches = new BranchesResource(req);
|
|
52
70
|
this.exchangeRates = new ExchangeRatesResource(req);
|
|
71
|
+
this.states = new StatesResource(req);
|
|
53
72
|
this.identificationDocuments = new IdentificationDocumentsResource(req);
|
|
54
73
|
this.alerts = new AlertsResource(req);
|
|
55
74
|
this.platform = new PlatformResource(req);
|
|
56
75
|
this.config = new ConfigResource(req);
|
|
57
76
|
this.setup = new SetupResource(req);
|
|
58
77
|
this.settings = new SettingsResource(req);
|
|
78
|
+
this.customLists = new CustomListsResource(req);
|
|
79
|
+
this.teams = new TeamsResource(req);
|
|
80
|
+
this.reports = new ReportsResource((path) => this.requestBinary(path));
|
|
81
|
+
this.partyRelationships = new PartyRelationshipsResource(req);
|
|
59
82
|
}
|
|
60
83
|
async request(method, path, opts = {}) {
|
|
61
84
|
const url = new URL(`${this.baseUrl}${path}`);
|
|
@@ -95,6 +118,44 @@ export class DossiersOSAPIService {
|
|
|
95
118
|
}
|
|
96
119
|
return parsed;
|
|
97
120
|
}
|
|
121
|
+
/** GET a binary body (PDF reports). Errors are parsed the same way as JSON requests. */
|
|
122
|
+
async requestBinary(path) {
|
|
123
|
+
const url = `${this.baseUrl}${path}`;
|
|
124
|
+
const response = await this.fetchImpl(url, {
|
|
125
|
+
method: 'GET',
|
|
126
|
+
headers: { Authorization: `Bearer ${this.apiKey}`, Accept: 'application/pdf' },
|
|
127
|
+
});
|
|
128
|
+
if (!response.ok) {
|
|
129
|
+
const raw = await response.text();
|
|
130
|
+
const parsed = raw.length > 0 ? safeJsonParse(raw) : undefined;
|
|
131
|
+
const message = (parsed && typeof parsed === 'object' && 'message' in parsed
|
|
132
|
+
? String(parsed.message)
|
|
133
|
+
: null) ?? `Dossiers OS API GET ${path} failed: ${response.status}`;
|
|
134
|
+
throw new DossiersOSAPIError(response.status, message, parsed ?? raw);
|
|
135
|
+
}
|
|
136
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
export class PartyRelationshipsResource {
|
|
140
|
+
req;
|
|
141
|
+
constructor(req) {
|
|
142
|
+
this.req = req;
|
|
143
|
+
}
|
|
144
|
+
listTypes() {
|
|
145
|
+
return this.req('GET', '/v1/party-relationships/types');
|
|
146
|
+
}
|
|
147
|
+
createType(input) {
|
|
148
|
+
return this.req('POST', '/v1/party-relationships/types', { body: input });
|
|
149
|
+
}
|
|
150
|
+
list(partyType, partyId) {
|
|
151
|
+
return this.req('GET', '/v1/party-relationships', { query: { partyType, partyId } });
|
|
152
|
+
}
|
|
153
|
+
create(input) {
|
|
154
|
+
return this.req('POST', '/v1/party-relationships', { body: input });
|
|
155
|
+
}
|
|
156
|
+
end(id) {
|
|
157
|
+
return this.req('POST', `/v1/party-relationships/${encodeURIComponent(id)}/end`);
|
|
158
|
+
}
|
|
98
159
|
}
|
|
99
160
|
function safeJsonParse(raw) {
|
|
100
161
|
try {
|
|
@@ -104,9 +165,6 @@ function safeJsonParse(raw) {
|
|
|
104
165
|
return raw;
|
|
105
166
|
}
|
|
106
167
|
}
|
|
107
|
-
// ===========================================================================
|
|
108
|
-
// Per-resource comments proxy
|
|
109
|
-
// ===========================================================================
|
|
110
168
|
/**
|
|
111
169
|
* Scoped view of `/v1/platform/v1/comments` for a single resourceType.
|
|
112
170
|
* Lets callers do `sdk.individuals.comments.list(customerId)` instead of
|
|
@@ -159,9 +217,6 @@ export class CustomerOtherInformationResource {
|
|
|
159
217
|
return this.req('DELETE', `/v1/customers/${encodeURIComponent(customerId)}/other-information/${encodeURIComponent(key)}`);
|
|
160
218
|
}
|
|
161
219
|
}
|
|
162
|
-
// ===========================================================================
|
|
163
|
-
// Auth — /v1/auth
|
|
164
|
-
// ===========================================================================
|
|
165
220
|
export class AuthResource {
|
|
166
221
|
req;
|
|
167
222
|
constructor(req) {
|
|
@@ -184,9 +239,6 @@ export class AuthResource {
|
|
|
184
239
|
return this.req('POST', '/v1/auth/admin/reset-member-password', { body: input });
|
|
185
240
|
}
|
|
186
241
|
}
|
|
187
|
-
// ===========================================================================
|
|
188
|
-
// Individuals — /v1/customers/individuals
|
|
189
|
-
// ===========================================================================
|
|
190
242
|
export class IndividualsResource {
|
|
191
243
|
req;
|
|
192
244
|
identificationDocuments;
|
|
@@ -203,8 +255,16 @@ export class IndividualsResource {
|
|
|
203
255
|
list(query = {}) {
|
|
204
256
|
return this.req('GET', '/v1/customers/individuals', { query });
|
|
205
257
|
}
|
|
206
|
-
|
|
207
|
-
|
|
258
|
+
/**
|
|
259
|
+
* `POST /v1/customers/individuals` — create an individual. Pass
|
|
260
|
+
* `{ screening: 'sync' }` to run the INITIAL screening before the call
|
|
261
|
+
* returns; the result and its matches then arrive under `screening`.
|
|
262
|
+
*/
|
|
263
|
+
create(input, options = {}) {
|
|
264
|
+
return this.req('POST', '/v1/customers/individuals', {
|
|
265
|
+
body: input,
|
|
266
|
+
query: { screening: options.screening },
|
|
267
|
+
});
|
|
208
268
|
}
|
|
209
269
|
get(customerId, query = {}) {
|
|
210
270
|
return this.req('GET', `/v1/customers/individuals/${encodeURIComponent(customerId)}`, {
|
|
@@ -252,9 +312,6 @@ export class IndividualFaceImagesResource {
|
|
|
252
312
|
return this.req('DELETE', `/v1/customers/individuals/${encodeURIComponent(customerId)}/face-images/${encodeURIComponent(faceImageId)}`);
|
|
253
313
|
}
|
|
254
314
|
}
|
|
255
|
-
// ===========================================================================
|
|
256
|
-
// Entities — /v1/customers/entities
|
|
257
|
-
// ===========================================================================
|
|
258
315
|
export class EntitiesResource {
|
|
259
316
|
req;
|
|
260
317
|
stakeholders;
|
|
@@ -271,8 +328,16 @@ export class EntitiesResource {
|
|
|
271
328
|
list(query = {}) {
|
|
272
329
|
return this.req('GET', '/v1/customers/entities', { query });
|
|
273
330
|
}
|
|
274
|
-
|
|
275
|
-
|
|
331
|
+
/**
|
|
332
|
+
* `POST /v1/customers/entities` — create an entity. Pass
|
|
333
|
+
* `{ screening: 'sync' }` to run the INITIAL screening before the call
|
|
334
|
+
* returns; the result and its matches then arrive under `screening`.
|
|
335
|
+
*/
|
|
336
|
+
create(input, options = {}) {
|
|
337
|
+
return this.req('POST', '/v1/customers/entities', {
|
|
338
|
+
body: input,
|
|
339
|
+
query: { screening: options.screening },
|
|
340
|
+
});
|
|
276
341
|
}
|
|
277
342
|
get(customerId, query = {}) {
|
|
278
343
|
return this.req('GET', `/v1/customers/entities/${encodeURIComponent(customerId)}`, {
|
|
@@ -315,25 +380,105 @@ export class EntityIdentificationDocumentsResource {
|
|
|
315
380
|
return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/identification-documents`, { body: input });
|
|
316
381
|
}
|
|
317
382
|
}
|
|
318
|
-
// ===========================================================================
|
|
319
|
-
// Customers — cross-cutting resources scoped to a customerId
|
|
320
|
-
// ===========================================================================
|
|
321
383
|
export class CustomersResource {
|
|
384
|
+
req;
|
|
322
385
|
notes;
|
|
323
386
|
files;
|
|
324
387
|
screening;
|
|
388
|
+
kyc;
|
|
325
389
|
riskRating;
|
|
326
|
-
|
|
390
|
+
status;
|
|
391
|
+
riskAssessments;
|
|
327
392
|
expectedActivity;
|
|
328
393
|
devices;
|
|
394
|
+
assignment;
|
|
329
395
|
constructor(req) {
|
|
396
|
+
this.req = req;
|
|
330
397
|
this.notes = new CustomerNotesResource(req);
|
|
331
398
|
this.files = new CustomerFilesResource(req);
|
|
332
399
|
this.screening = new CustomerScreeningResource(req);
|
|
400
|
+
this.kyc = new CustomerKycResource(req);
|
|
333
401
|
this.riskRating = new CustomerRiskRatingResource(req);
|
|
334
|
-
this.
|
|
402
|
+
this.status = new CustomerStatusResource(req);
|
|
403
|
+
this.riskAssessments = new CustomerRiskAssessmentsResource(req);
|
|
335
404
|
this.expectedActivity = new CustomerExpectedActivityResource(req);
|
|
336
405
|
this.devices = new CustomerDevicesResource(req);
|
|
406
|
+
this.assignment = new CustomerAssignmentResource(req);
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* `POST /v1/customers/{customerId}/archive` — archive a customer
|
|
410
|
+
* (organization owner/admin only, irreversible). Frees the customer's
|
|
411
|
+
* external ID for reuse and makes the record read-only.
|
|
412
|
+
*/
|
|
413
|
+
archive(customerId, input = {}) {
|
|
414
|
+
return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/archive`, {
|
|
415
|
+
body: input,
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
export class CustomerAssignmentResource {
|
|
420
|
+
req;
|
|
421
|
+
constructor(req) {
|
|
422
|
+
this.req = req;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* `POST /v1/customers/{customerId}/assignment` — add users/teams to a
|
|
426
|
+
* customer's standing assignment (additive; never silently removes).
|
|
427
|
+
*/
|
|
428
|
+
assign(customerId, input) {
|
|
429
|
+
return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/assignment`, {
|
|
430
|
+
body: input,
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* `DELETE /v1/customers/{customerId}/assignment` — remove users/teams from
|
|
435
|
+
* a customer's standing assignment.
|
|
436
|
+
*/
|
|
437
|
+
unassign(customerId, input) {
|
|
438
|
+
return this.req('DELETE', `/v1/customers/${encodeURIComponent(customerId)}/assignment`, {
|
|
439
|
+
body: input,
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* `POST /v1/customers/assignment` — assign many customers to the same
|
|
444
|
+
* users/teams. Customers that already carry the target are skipped.
|
|
445
|
+
*/
|
|
446
|
+
assignMany(input) {
|
|
447
|
+
return this.req('POST', '/v1/customers/assignment', { body: input });
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
export class TeamsResource {
|
|
451
|
+
req;
|
|
452
|
+
constructor(req) {
|
|
453
|
+
this.req = req;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Active teams. `tags` is an any-of filter over the team's `team.tags`
|
|
457
|
+
* catalogue values (repeated as `?tags=a&tags=b`).
|
|
458
|
+
*/
|
|
459
|
+
list(query = {}) {
|
|
460
|
+
return this.req('GET', '/v1/teams', { query });
|
|
461
|
+
}
|
|
462
|
+
get(id) {
|
|
463
|
+
return this.req('GET', `/v1/teams/${encodeURIComponent(id)}`);
|
|
464
|
+
}
|
|
465
|
+
create(input) {
|
|
466
|
+
return this.req('POST', '/v1/teams', { body: input });
|
|
467
|
+
}
|
|
468
|
+
update(id, input) {
|
|
469
|
+
return this.req('PATCH', `/v1/teams/${encodeURIComponent(id)}`, { body: input });
|
|
470
|
+
}
|
|
471
|
+
archive(id) {
|
|
472
|
+
return this.req('POST', `/v1/teams/${encodeURIComponent(id)}/archive`);
|
|
473
|
+
}
|
|
474
|
+
delete(id) {
|
|
475
|
+
return this.req('DELETE', `/v1/teams/${encodeURIComponent(id)}`);
|
|
476
|
+
}
|
|
477
|
+
addMembers(id, input) {
|
|
478
|
+
return this.req('POST', `/v1/teams/${encodeURIComponent(id)}/members`, { body: input });
|
|
479
|
+
}
|
|
480
|
+
removeMembers(id, input) {
|
|
481
|
+
return this.req('DELETE', `/v1/teams/${encodeURIComponent(id)}/members`, { body: input });
|
|
337
482
|
}
|
|
338
483
|
}
|
|
339
484
|
export class CustomerNotesResource {
|
|
@@ -387,10 +532,89 @@ export class CustomerScreeningResource {
|
|
|
387
532
|
trigger(customerId) {
|
|
388
533
|
return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/screen`);
|
|
389
534
|
}
|
|
535
|
+
/**
|
|
536
|
+
* `GET /v1/customers/{customerId}/screening-history` — every screening run
|
|
537
|
+
* for the customer, most recent first. `limit` caps the number of entries
|
|
538
|
+
* returned (default 50 server-side).
|
|
539
|
+
*/
|
|
540
|
+
listHistory(customerId, params = {}) {
|
|
541
|
+
const query = {};
|
|
542
|
+
if (params.limit !== undefined)
|
|
543
|
+
query.limit = params.limit;
|
|
544
|
+
return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/screening-history`, { query });
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* `GET /v1/customers/{customerId}/screening-history/latest` — the most
|
|
548
|
+
* recent screening run, or `null` if the customer has never been screened.
|
|
549
|
+
*/
|
|
550
|
+
async getLast(customerId) {
|
|
551
|
+
const latest = await this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/screening-history/latest`);
|
|
552
|
+
return latest ?? null;
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* `GET /v1/customers/{customerId}/screening-results` — every match for the
|
|
556
|
+
* customer with its current disposition (true positives = `CONFIRMED`,
|
|
557
|
+
* false positives = `FALSE_POSITIVE`, plus undecided `PENDING`, which
|
|
558
|
+
* also covers matches a workflow reviewer marked inconclusive). Pass
|
|
559
|
+
* `disposition` to filter (e.g. `['CONFIRMED', 'FALSE_POSITIVE']`).
|
|
560
|
+
*/
|
|
561
|
+
listResults(customerId, params = {}) {
|
|
562
|
+
const query = {};
|
|
563
|
+
if (params.disposition && params.disposition.length > 0) {
|
|
564
|
+
query.disposition = params.disposition.join(',');
|
|
565
|
+
}
|
|
566
|
+
return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/screening-results`, { query });
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* `GET /v1/customers/{customerId}/confirmed-matches` — confirmed
|
|
570
|
+
* (true-positive) matches only. Alias for `listResults` filtered to
|
|
571
|
+
* `CONFIRMED`, kept for backwards compatibility.
|
|
572
|
+
*/
|
|
390
573
|
listConfirmedMatches(customerId) {
|
|
391
574
|
return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/confirmed-matches`);
|
|
392
575
|
}
|
|
393
576
|
}
|
|
577
|
+
/**
|
|
578
|
+
* KYC verification sessions for a customer. A session is an asynchronous,
|
|
579
|
+
* customer-driven flow: `start()` returns a hosted `sessionUrl` the customer
|
|
580
|
+
* visits; completion arrives out-of-band (provider webhook) or can be pulled
|
|
581
|
+
* with `refresh()`.
|
|
582
|
+
*/
|
|
583
|
+
export class CustomerKycResource {
|
|
584
|
+
req;
|
|
585
|
+
constructor(req) {
|
|
586
|
+
this.req = req;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* `POST /v1/customers/{customerId}/kyc/sessions` — start a KYC session with
|
|
590
|
+
* the organization's active provider. Hand the returned `sessionUrl` to the
|
|
591
|
+
* customer.
|
|
592
|
+
*/
|
|
593
|
+
start(customerId) {
|
|
594
|
+
return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/kyc/sessions`);
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* `GET /v1/customers/{customerId}/kyc/sessions` — list a customer's KYC
|
|
598
|
+
* sessions, newest first.
|
|
599
|
+
*/
|
|
600
|
+
list(customerId) {
|
|
601
|
+
return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/kyc/sessions`);
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* `POST /v1/customers/{customerId}/kyc/sessions/{sessionId}/refresh` — pull
|
|
605
|
+
* the latest provider state for a session and persist it.
|
|
606
|
+
*/
|
|
607
|
+
refresh(customerId, sessionId) {
|
|
608
|
+
return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/kyc/sessions/${encodeURIComponent(sessionId)}/refresh`);
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* `DELETE /v1/customers/{customerId}/kyc/sessions/{sessionId}` — cancel the
|
|
612
|
+
* session at the provider and remove the local record.
|
|
613
|
+
*/
|
|
614
|
+
delete(customerId, sessionId) {
|
|
615
|
+
return this.req('DELETE', `/v1/customers/${encodeURIComponent(customerId)}/kyc/sessions/${encodeURIComponent(sessionId)}`);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
394
618
|
export class CustomerRiskRatingResource {
|
|
395
619
|
req;
|
|
396
620
|
constructor(req) {
|
|
@@ -402,16 +626,31 @@ export class CustomerRiskRatingResource {
|
|
|
402
626
|
});
|
|
403
627
|
}
|
|
404
628
|
}
|
|
405
|
-
export class
|
|
629
|
+
export class CustomerStatusResource {
|
|
630
|
+
req;
|
|
631
|
+
constructor(req) {
|
|
632
|
+
this.req = req;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* `PUT /v1/customers/{customerId}/status` — transition a customer's lifecycle
|
|
636
|
+
* status. Emits a `customer.status_changed` webhook.
|
|
637
|
+
*/
|
|
638
|
+
update(customerId, input) {
|
|
639
|
+
return this.req('PUT', `/v1/customers/${encodeURIComponent(customerId)}/status`, {
|
|
640
|
+
body: input,
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
export class CustomerRiskAssessmentsResource {
|
|
406
645
|
req;
|
|
407
646
|
constructor(req) {
|
|
408
647
|
this.req = req;
|
|
409
648
|
}
|
|
410
649
|
list(customerId) {
|
|
411
|
-
return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/risk-
|
|
650
|
+
return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/risk-assessments`);
|
|
412
651
|
}
|
|
413
652
|
create(customerId, input) {
|
|
414
|
-
return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/risk-
|
|
653
|
+
return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/risk-assessments`, { body: input });
|
|
415
654
|
}
|
|
416
655
|
}
|
|
417
656
|
export class CustomerExpectedActivityResource {
|
|
@@ -443,9 +682,6 @@ export class CustomerDevicesResource {
|
|
|
443
682
|
return this.req('PUT', `/v1/customers/${encodeURIComponent(customerId)}/devices/${encodeURIComponent(deviceId)}/trust`, { body: input });
|
|
444
683
|
}
|
|
445
684
|
}
|
|
446
|
-
// ===========================================================================
|
|
447
|
-
// Accounts — /v1/customers/{customerId}/accounts
|
|
448
|
-
// ===========================================================================
|
|
449
685
|
export class AccountsResource {
|
|
450
686
|
req;
|
|
451
687
|
comments;
|
|
@@ -476,9 +712,6 @@ export class AccountsResource {
|
|
|
476
712
|
return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/accounts/${encodeURIComponent(accountId)}/unfreeze`);
|
|
477
713
|
}
|
|
478
714
|
}
|
|
479
|
-
// ===========================================================================
|
|
480
|
-
// Counterparties — /v1/counterparties
|
|
481
|
-
// ===========================================================================
|
|
482
715
|
export class CounterpartiesResource {
|
|
483
716
|
req;
|
|
484
717
|
riskAssessments;
|
|
@@ -536,9 +769,6 @@ export class CounterpartyFilesResource {
|
|
|
536
769
|
return this.req('POST', `/v1/counterparties/${encodeURIComponent(counterpartyId)}/files/upload-url`, { body: input });
|
|
537
770
|
}
|
|
538
771
|
}
|
|
539
|
-
// ===========================================================================
|
|
540
|
-
// Devices — /v1/devices/{deviceId}
|
|
541
|
-
// ===========================================================================
|
|
542
772
|
export class DevicesResource {
|
|
543
773
|
req;
|
|
544
774
|
comments;
|
|
@@ -549,10 +779,63 @@ export class DevicesResource {
|
|
|
549
779
|
get(deviceId) {
|
|
550
780
|
return this.req('GET', `/v1/devices/${encodeURIComponent(deviceId)}`);
|
|
551
781
|
}
|
|
782
|
+
/** Canonicalize the source device into the target without deleting history. */
|
|
783
|
+
merge(targetDeviceId, input) {
|
|
784
|
+
return this.req('POST', `/v1/devices/${encodeURIComponent(targetDeviceId)}/merge`, { body: input });
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
export class PaymentInstrumentsResource {
|
|
788
|
+
req;
|
|
789
|
+
constructor(req) {
|
|
790
|
+
this.req = req;
|
|
791
|
+
}
|
|
792
|
+
list() {
|
|
793
|
+
return this.req('GET', '/v1/payment-instruments');
|
|
794
|
+
}
|
|
795
|
+
get(id) {
|
|
796
|
+
return this.req('GET', `/v1/payment-instruments/${encodeURIComponent(id)}`);
|
|
797
|
+
}
|
|
798
|
+
create(input) {
|
|
799
|
+
return this.req('POST', '/v1/payment-instruments', { body: input });
|
|
800
|
+
}
|
|
801
|
+
update(id, input) {
|
|
802
|
+
return this.req('PATCH', `/v1/payment-instruments/${encodeURIComponent(id)}`, { body: input });
|
|
803
|
+
}
|
|
804
|
+
linkAccount(id, input) {
|
|
805
|
+
return this.req('POST', `/v1/payment-instruments/${encodeURIComponent(id)}/accounts`, { body: input });
|
|
806
|
+
}
|
|
807
|
+
unlinkAccount(id, relationshipId, validTo) {
|
|
808
|
+
return this.req('POST', `/v1/payment-instruments/${encodeURIComponent(id)}/accounts/${encodeURIComponent(relationshipId)}/unlink`, { body: { validTo } });
|
|
809
|
+
}
|
|
810
|
+
linkCustomer(id, input) {
|
|
811
|
+
return this.req('POST', `/v1/payment-instruments/${encodeURIComponent(id)}/customers`, { body: input });
|
|
812
|
+
}
|
|
813
|
+
unlinkCustomer(id, relationshipId, validTo) {
|
|
814
|
+
return this.req('POST', `/v1/payment-instruments/${encodeURIComponent(id)}/customers/${encodeURIComponent(relationshipId)}/unlink`, { body: { validTo } });
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
export class SessionsResource {
|
|
818
|
+
req;
|
|
819
|
+
constructor(req) {
|
|
820
|
+
this.req = req;
|
|
821
|
+
}
|
|
822
|
+
list() { return this.req('GET', '/v1/sessions'); }
|
|
823
|
+
get(id) { return this.req('GET', `/v1/sessions/${encodeURIComponent(id)}`); }
|
|
824
|
+
update(id, input) {
|
|
825
|
+
return this.req('PATCH', `/v1/sessions/${encodeURIComponent(id)}`, { body: input });
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
export class ChannelEndpointsResource {
|
|
829
|
+
req;
|
|
830
|
+
constructor(req) {
|
|
831
|
+
this.req = req;
|
|
832
|
+
}
|
|
833
|
+
list() { return this.req('GET', '/v1/channel-endpoints'); }
|
|
834
|
+
get(id) { return this.req('GET', `/v1/channel-endpoints/${encodeURIComponent(id)}`); }
|
|
835
|
+
update(id, input) {
|
|
836
|
+
return this.req('PATCH', `/v1/channel-endpoints/${encodeURIComponent(id)}`, { body: input });
|
|
837
|
+
}
|
|
552
838
|
}
|
|
553
|
-
// ===========================================================================
|
|
554
|
-
// Transactions — /v1/transactions
|
|
555
|
-
// ===========================================================================
|
|
556
839
|
export class TransactionsResource {
|
|
557
840
|
req;
|
|
558
841
|
comments;
|
|
@@ -568,22 +851,193 @@ export class TransactionsResource {
|
|
|
568
851
|
patchStatus(input) {
|
|
569
852
|
return this.req('PATCH', '/v1/transactions', { body: input });
|
|
570
853
|
}
|
|
854
|
+
/**
|
|
855
|
+
* Read back a stored transaction. By default `reference` is your own
|
|
856
|
+
* `transactionId`; pass `{ by: 'id' }` to look up the internal UUID
|
|
857
|
+
* returned by `ingest()`.
|
|
858
|
+
*/
|
|
859
|
+
get(reference, opts = {}) {
|
|
860
|
+
return this.req('GET', `/v1/transactions/${encodeURIComponent(reference)}`, {
|
|
861
|
+
query: opts.by ? { by: opts.by } : undefined,
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
export class TransactionAttemptsResource {
|
|
866
|
+
req;
|
|
867
|
+
constructor(req) {
|
|
868
|
+
this.req = req;
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* `POST /v1/transaction-attempts` — retain a failed, blocked, or unknown
|
|
872
|
+
* operation as behavioural history. This does not trigger rule evaluation.
|
|
873
|
+
*/
|
|
874
|
+
ingest(input) {
|
|
875
|
+
return this.req('POST', '/v1/transaction-attempts', { body: input });
|
|
876
|
+
}
|
|
877
|
+
/** List retained attempts using an opaque, stable cursor. Requires `config:read`. */
|
|
878
|
+
list(input = {}) {
|
|
879
|
+
return this.req('GET', '/v1/transaction-attempts', { query: input });
|
|
880
|
+
}
|
|
881
|
+
/** Read one retained attempt by its database id. Requires `config:read`. */
|
|
882
|
+
get(id) {
|
|
883
|
+
return this.req('GET', `/v1/transaction-attempts/${encodeURIComponent(id)}`);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
export class BehaviorSettingsResource {
|
|
887
|
+
req;
|
|
888
|
+
constructor(req) {
|
|
889
|
+
this.req = req;
|
|
890
|
+
}
|
|
891
|
+
get() {
|
|
892
|
+
return this.req('GET', '/v1/config/behavior-settings');
|
|
893
|
+
}
|
|
894
|
+
update(input) {
|
|
895
|
+
return this.req('PATCH', '/v1/config/behavior-settings', { body: input });
|
|
896
|
+
}
|
|
571
897
|
}
|
|
572
|
-
// ===========================================================================
|
|
573
|
-
// Events — /v1/events
|
|
574
|
-
// ===========================================================================
|
|
575
898
|
export class EventsResource {
|
|
576
899
|
req;
|
|
577
900
|
constructor(req) {
|
|
578
901
|
this.req = req;
|
|
579
902
|
}
|
|
903
|
+
/**
|
|
904
|
+
* `POST /v1/events` — store a behavioral event.
|
|
905
|
+
*
|
|
906
|
+
* Every event is about exactly one resource: pass
|
|
907
|
+
* `resource: { type, id }`. A bare top-level `customerId` is still
|
|
908
|
+
* accepted as the legacy spelling of `resource: { type: 'CUSTOMER', id }`,
|
|
909
|
+
* and `resource` wins when both are present; an event naming neither is
|
|
910
|
+
* rejected with 400.
|
|
911
|
+
*
|
|
912
|
+
* Supply `input.eventId` (your unique identifier) to make retries safe:
|
|
913
|
+
* resubmitting the same `eventId` returns the original stored event with
|
|
914
|
+
* `cached: true` instead of creating a duplicate. Idempotency covers the
|
|
915
|
+
* event's Risk Signals too — a replay echoes the same `riskSignalIds`
|
|
916
|
+
* rather than emitting a second set.
|
|
917
|
+
*
|
|
918
|
+
* The response carries the resolved `resource` and the `riskSignalIds`
|
|
919
|
+
* emitted by the event definition's `riskSignalEffects`.
|
|
920
|
+
*/
|
|
580
921
|
ingest(input) {
|
|
581
922
|
return this.req('POST', '/v1/events', { body: input });
|
|
582
923
|
}
|
|
583
924
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
925
|
+
/**
|
|
926
|
+
* Risk Signals — time-decaying evidence attached to one resource.
|
|
927
|
+
*
|
|
928
|
+
* A Risk Signal is evidence, **not** an Alert: adding one creates no alert, no
|
|
929
|
+
* notification, no assignment and no task, and does not change the resource's
|
|
930
|
+
* Risk Rating. Rules read the aggregate effective weight and decide for
|
|
931
|
+
* themselves.
|
|
932
|
+
*/
|
|
933
|
+
export class RiskSignalsResource {
|
|
934
|
+
req;
|
|
935
|
+
constructor(req) {
|
|
936
|
+
this.req = req;
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* `POST /v1/risk-signals` — attach a piece of evidence to one resource.
|
|
940
|
+
*
|
|
941
|
+
* The signal records the strength it had at `occurredAt` and how fast that
|
|
942
|
+
* strength halves, so weight 40 with half-life `P7D` reads 20 after seven
|
|
943
|
+
* days and 10 after fourteen.
|
|
944
|
+
*
|
|
945
|
+
* Supply `externalId` to make retries safe — resubmitting the same
|
|
946
|
+
* `externalId` returns the original signal instead of adding a second one.
|
|
947
|
+
*
|
|
948
|
+
* The server sets the source to `MANUAL` and captures the authenticated
|
|
949
|
+
* actor; a caller cannot claim a signal came from an Event or a Rule.
|
|
950
|
+
*/
|
|
951
|
+
create(input) {
|
|
952
|
+
return this.req('POST', '/v1/risk-signals', { body: input });
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* `GET /v1/risk-signals` — read a resource's Risk Signals with their
|
|
956
|
+
* decayed weights, plus the aggregate effective weight.
|
|
957
|
+
*
|
|
958
|
+
* The aggregate is computed as of `asOf` (defaulting to server time) — it
|
|
959
|
+
* is not a cached score column on the resource, so a historical `asOf`
|
|
960
|
+
* returns what the resource looked like at that moment.
|
|
961
|
+
*
|
|
962
|
+
* `type` and `sourceType` filter which records contribute. They never
|
|
963
|
+
* change how far a contributing signal has decayed: age is always measured
|
|
964
|
+
* to `asOf`.
|
|
965
|
+
*/
|
|
966
|
+
list(query) {
|
|
967
|
+
return this.req('GET', '/v1/risk-signals', { query });
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Employees — people acting inside the financial institution's ecosystem.
|
|
972
|
+
*
|
|
973
|
+
* Monitored domain data, distinct from Dossiers organization members: an
|
|
974
|
+
* Employee need not have a Dossiers login, and an Employee id is never an
|
|
975
|
+
* org-member id. Employees are an attachable resource for Events and Risk
|
|
976
|
+
* Signals.
|
|
977
|
+
*/
|
|
978
|
+
export class EmployeesResource {
|
|
979
|
+
req;
|
|
980
|
+
constructor(req) {
|
|
981
|
+
this.req = req;
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* `GET /v1/employees`.
|
|
985
|
+
*
|
|
986
|
+
* The endpoint declares `cursor` / `limit`, but the server currently
|
|
987
|
+
* resolves its own paging defaults (first page, 50 records) — treat paging
|
|
988
|
+
* as server-defaulted rather than caller-controlled.
|
|
989
|
+
*/
|
|
990
|
+
list(query = {}) {
|
|
991
|
+
return this.req('GET', '/v1/employees', { query });
|
|
992
|
+
}
|
|
993
|
+
get(id) {
|
|
994
|
+
return this.req('GET', `/v1/employees/${encodeURIComponent(id)}`);
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* `POST /v1/employees`. `externalEmployeeId` must be unique within the
|
|
998
|
+
* organization; a duplicate is rejected with 400.
|
|
999
|
+
*/
|
|
1000
|
+
create(input) {
|
|
1001
|
+
return this.req('POST', '/v1/employees', { body: input });
|
|
1002
|
+
}
|
|
1003
|
+
update(id, input) {
|
|
1004
|
+
return this.req('PATCH', `/v1/employees/${encodeURIComponent(id)}`, { body: input });
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Branches — the institution's own physical or organizational units, through
|
|
1009
|
+
* which Employees act. Like Employee, an attachable resource for Events and
|
|
1010
|
+
* Risk Signals.
|
|
1011
|
+
*/
|
|
1012
|
+
export class BranchesResource {
|
|
1013
|
+
req;
|
|
1014
|
+
constructor(req) {
|
|
1015
|
+
this.req = req;
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* `GET /v1/branches`.
|
|
1019
|
+
*
|
|
1020
|
+
* The endpoint declares `cursor` / `limit`, but the server currently
|
|
1021
|
+
* resolves its own paging defaults (first page, 50 records) — treat paging
|
|
1022
|
+
* as server-defaulted rather than caller-controlled.
|
|
1023
|
+
*/
|
|
1024
|
+
list(query = {}) {
|
|
1025
|
+
return this.req('GET', '/v1/branches', { query });
|
|
1026
|
+
}
|
|
1027
|
+
get(id) {
|
|
1028
|
+
return this.req('GET', `/v1/branches/${encodeURIComponent(id)}`);
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* `POST /v1/branches`. `externalBranchId` must be unique within the
|
|
1032
|
+
* organization.
|
|
1033
|
+
*/
|
|
1034
|
+
create(input) {
|
|
1035
|
+
return this.req('POST', '/v1/branches', { body: input });
|
|
1036
|
+
}
|
|
1037
|
+
update(id, input) {
|
|
1038
|
+
return this.req('PATCH', `/v1/branches/${encodeURIComponent(id)}`, { body: input });
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
587
1041
|
export class ExchangeRatesResource {
|
|
588
1042
|
req;
|
|
589
1043
|
constructor(req) {
|
|
@@ -593,12 +1047,11 @@ export class ExchangeRatesResource {
|
|
|
593
1047
|
return this.req('POST', '/v1/exchange-rates', { body: input });
|
|
594
1048
|
}
|
|
595
1049
|
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
// ===========================================================================
|
|
1050
|
+
/**
|
|
1051
|
+
* First-class identification-documents resource — independent of the customer
|
|
1052
|
+
* collection a document belongs to. For customer-scoped list/create, see
|
|
1053
|
+
* `customers.identificationDocuments` or the proxies on `individuals` / `entities`.
|
|
1054
|
+
*/
|
|
602
1055
|
export class IdentificationDocumentsResource {
|
|
603
1056
|
req;
|
|
604
1057
|
comments;
|
|
@@ -609,6 +1062,12 @@ export class IdentificationDocumentsResource {
|
|
|
609
1062
|
get(id) {
|
|
610
1063
|
return this.req('GET', `/v1/identification-documents/${encodeURIComponent(id)}`);
|
|
611
1064
|
}
|
|
1065
|
+
/**
|
|
1066
|
+
* Correct captured document fields (name, number, DOB, addresses, …).
|
|
1067
|
+
* Captured fields are frozen while the document is `APPROVED` (400) —
|
|
1068
|
+
* `transition` it back to `PENDING` first. `notes`/`tags`/`attachments`
|
|
1069
|
+
* stay editable in any status.
|
|
1070
|
+
*/
|
|
612
1071
|
update(id, input) {
|
|
613
1072
|
return this.req('PATCH', `/v1/identification-documents/${encodeURIComponent(id)}`, {
|
|
614
1073
|
body: input,
|
|
@@ -631,24 +1090,69 @@ export class IdentificationDocumentsResource {
|
|
|
631
1090
|
return this.req('POST', `/v1/identification-documents/${encodeURIComponent(id)}/transitions`, { body: input });
|
|
632
1091
|
}
|
|
633
1092
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
1093
|
+
/**
|
|
1094
|
+
* Alerts. Screening and rule-trigger alerts are produced by the platform and
|
|
1095
|
+
* delivered via webhooks; **custom alerts** are raised here against an
|
|
1096
|
+
* org-defined Custom Alert Type (`config.customAlertTypes`). Every alert type
|
|
1097
|
+
* supports markdown notes, linked resources and comments.
|
|
1098
|
+
*
|
|
1099
|
+
* Requires the `alerts:read` / `alerts:write` API-key permissions.
|
|
1100
|
+
*/
|
|
641
1101
|
export class AlertsResource {
|
|
1102
|
+
req;
|
|
642
1103
|
comments;
|
|
1104
|
+
resources;
|
|
643
1105
|
constructor(req) {
|
|
1106
|
+
this.req = req;
|
|
644
1107
|
this.comments = new ResourceCommentsProxy(req, 'ALERT');
|
|
1108
|
+
this.resources = new AlertResourcesProxy(req);
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Raise an alert by hand. `alertType` is optional: with one, `fields` are
|
|
1112
|
+
* validated against the type's schema; without one the alert is free-form
|
|
1113
|
+
* and `fields` are self-declaring. Re-sending the same `externalRequestId`
|
|
1114
|
+
* returns the existing alert (201 either way) — the key is scoped per
|
|
1115
|
+
* organization.
|
|
1116
|
+
*/
|
|
1117
|
+
create(input) {
|
|
1118
|
+
return this.req('POST', '/v1/alerts', { body: input });
|
|
1119
|
+
}
|
|
1120
|
+
/** Flat view of any alert, with its linked resources. */
|
|
1121
|
+
get(alertId) {
|
|
1122
|
+
return this.req('GET', `/v1/alerts/${encodeURIComponent(alertId)}`);
|
|
1123
|
+
}
|
|
1124
|
+
/** Replace the alert's markdown notes (any alert type). */
|
|
1125
|
+
updateNotes(alertId, input) {
|
|
1126
|
+
return this.req('PATCH', `/v1/alerts/${encodeURIComponent(alertId)}/notes`, { body: input });
|
|
1127
|
+
}
|
|
1128
|
+
/** Immutable attempt facts captured when attempt-history rules contributed to an alert. */
|
|
1129
|
+
attemptEvidence(alertId) {
|
|
1130
|
+
return this.req('GET', `/v1/alerts/${encodeURIComponent(alertId)}/attempt-evidence`);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
/** Resources linked to an alert — `/v1/alerts/{id}/resources`. */
|
|
1134
|
+
export class AlertResourcesProxy {
|
|
1135
|
+
req;
|
|
1136
|
+
constructor(req) {
|
|
1137
|
+
this.req = req;
|
|
1138
|
+
}
|
|
1139
|
+
list(alertId) {
|
|
1140
|
+
return this.req('GET', `/v1/alerts/${encodeURIComponent(alertId)}/resources`);
|
|
1141
|
+
}
|
|
1142
|
+
/** Idempotent on (resourceType, resourceId): re-linking returns the existing link. */
|
|
1143
|
+
add(alertId, input) {
|
|
1144
|
+
return this.req('POST', `/v1/alerts/${encodeURIComponent(alertId)}/resources`, { body: input });
|
|
1145
|
+
}
|
|
1146
|
+
/** `alertResourceId` is the link id from `list` / `add`, not the target's id. */
|
|
1147
|
+
remove(alertId, alertResourceId) {
|
|
1148
|
+
return this.req('DELETE', `/v1/alerts/${encodeURIComponent(alertId)}/resources/${encodeURIComponent(alertResourceId)}`);
|
|
645
1149
|
}
|
|
646
1150
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
1151
|
+
/**
|
|
1152
|
+
* Cross-resource primitives (`/v1/platform/v1/*`). Polymorphic comments and
|
|
1153
|
+
* file uploads keyed by `resourceType` + `resourceId`. Most callers should
|
|
1154
|
+
* prefer the per-resource proxies (e.g. `sdk.individuals.comments`).
|
|
1155
|
+
*/
|
|
652
1156
|
export class PlatformResource {
|
|
653
1157
|
comments;
|
|
654
1158
|
files;
|
|
@@ -697,31 +1201,70 @@ export class PlatformFilesResource {
|
|
|
697
1201
|
return this.req('POST', '/v1/platform/v1/files/confirm', { body: input });
|
|
698
1202
|
}
|
|
699
1203
|
}
|
|
700
|
-
// ===========================================================================
|
|
701
|
-
// Config — /v1/config/*
|
|
702
|
-
// ===========================================================================
|
|
703
1204
|
export class ConfigResource {
|
|
704
1205
|
req;
|
|
705
1206
|
rules;
|
|
706
1207
|
constants;
|
|
1208
|
+
alertWorkflows;
|
|
1209
|
+
/** @deprecated Read-only archive. Use alertWorkflows for assignment. */
|
|
1210
|
+
states;
|
|
1211
|
+
assignmentPolicies;
|
|
707
1212
|
products;
|
|
708
1213
|
currencies;
|
|
709
1214
|
eventDefinitions;
|
|
1215
|
+
customAlertTypes;
|
|
710
1216
|
webhooks;
|
|
1217
|
+
tagCatalogue;
|
|
1218
|
+
tagGroups;
|
|
1219
|
+
sync;
|
|
711
1220
|
constructor(req) {
|
|
712
1221
|
this.req = req;
|
|
713
1222
|
this.rules = new ConfigRulesResource(req);
|
|
714
1223
|
this.constants = new ConfigConstantsResource(req);
|
|
1224
|
+
this.alertWorkflows = new ConfigAlertWorkflowsResource(req);
|
|
1225
|
+
this.states = new ConfigStatesResource(req);
|
|
1226
|
+
this.assignmentPolicies = new ConfigAssignmentPoliciesResource(req);
|
|
715
1227
|
this.products = new ConfigProductsResource(req);
|
|
716
1228
|
this.currencies = new ConfigCurrenciesResource(req);
|
|
717
1229
|
this.eventDefinitions = new ConfigEventDefinitionsResource(req);
|
|
1230
|
+
this.customAlertTypes = new ConfigCustomAlertTypesResource(req);
|
|
718
1231
|
this.webhooks = new ConfigWebhooksResource(req);
|
|
1232
|
+
this.tagCatalogue = new ConfigTagCatalogueResource(req);
|
|
1233
|
+
this.tagGroups = new ConfigTagGroupsResource(req);
|
|
1234
|
+
this.sync = new ConfigSyncResource(req);
|
|
719
1235
|
}
|
|
720
1236
|
/** `DELETE /v1/config/reset` — clear all org config (destructive). */
|
|
721
1237
|
reset() {
|
|
722
1238
|
return this.req('DELETE', '/v1/config/reset');
|
|
723
1239
|
}
|
|
724
1240
|
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Tenant sync (config-as-code). The client loads + merges local config files
|
|
1243
|
+
* into a `SyncConfig` and the server validates / diffs / applies it against the
|
|
1244
|
+
* live tenant. Backs the `dossiers-sync` CLI.
|
|
1245
|
+
*/
|
|
1246
|
+
export class ConfigSyncResource {
|
|
1247
|
+
req;
|
|
1248
|
+
constructor(req) {
|
|
1249
|
+
this.req = req;
|
|
1250
|
+
}
|
|
1251
|
+
/** Validate a config (schema + cross-references). No writes. */
|
|
1252
|
+
validate(config) {
|
|
1253
|
+
return this.req('POST', '/v1/config/sync/validate', { body: { config } });
|
|
1254
|
+
}
|
|
1255
|
+
/** Diff a config against live state — advisory preview, no writes. */
|
|
1256
|
+
plan(config) {
|
|
1257
|
+
return this.req('POST', '/v1/config/sync/plan', { body: { config } });
|
|
1258
|
+
}
|
|
1259
|
+
/** Validate, diff, and apply a config to the live tenant. */
|
|
1260
|
+
apply(config) {
|
|
1261
|
+
return this.req('POST', '/v1/config/sync/apply', { body: { config } });
|
|
1262
|
+
}
|
|
1263
|
+
/** Serialize the live tenant config back into a `SyncConfig` (import / pull). */
|
|
1264
|
+
export(query = {}) {
|
|
1265
|
+
return this.req('GET', '/v1/config/sync/export', { query });
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
725
1268
|
export class ConfigRulesResource {
|
|
726
1269
|
req;
|
|
727
1270
|
constructor(req) {
|
|
@@ -736,9 +1279,30 @@ export class ConfigRulesResource {
|
|
|
736
1279
|
getBySyncKey(syncKey) {
|
|
737
1280
|
return this.req('GET', `/v1/config/rules/by-sync-key/${encodeURIComponent(syncKey)}`);
|
|
738
1281
|
}
|
|
1282
|
+
/**
|
|
1283
|
+
* Dry-run rule simulation (spec v0 rules §11 backtest + synthetic
|
|
1284
|
+
* source). Read-only: nothing is persisted and no actions execute —
|
|
1285
|
+
* the response summarises what WOULD have happened. Requires only
|
|
1286
|
+
* `config:read`.
|
|
1287
|
+
*/
|
|
1288
|
+
backtest(input) {
|
|
1289
|
+
return this.req('POST', '/v1/config/rules/backtest', { body: input });
|
|
1290
|
+
}
|
|
739
1291
|
get(id) {
|
|
740
1292
|
return this.req('GET', `/v1/config/rules/${encodeURIComponent(id)}`);
|
|
741
1293
|
}
|
|
1294
|
+
/** List a rule's definitional version history, newest first (audit trail). */
|
|
1295
|
+
versions(id) {
|
|
1296
|
+
return this.req('GET', `/v1/config/rules/${encodeURIComponent(id)}/versions`);
|
|
1297
|
+
}
|
|
1298
|
+
/** Get a single rule version by its version number. */
|
|
1299
|
+
getVersion(id, version) {
|
|
1300
|
+
return this.req('GET', `/v1/config/rules/${encodeURIComponent(id)}/versions/${version}`);
|
|
1301
|
+
}
|
|
1302
|
+
/** Compute-on-read alert analytics for a rule: disposition breakdown + precision. */
|
|
1303
|
+
analytics(id) {
|
|
1304
|
+
return this.req('GET', `/v1/config/rules/${encodeURIComponent(id)}/analytics`);
|
|
1305
|
+
}
|
|
742
1306
|
update(id, input) {
|
|
743
1307
|
return this.req('PATCH', `/v1/config/rules/${encodeURIComponent(id)}`, { body: input });
|
|
744
1308
|
}
|
|
@@ -760,6 +1324,75 @@ export class ConfigRulesResource {
|
|
|
760
1324
|
body: targetStatus ? { targetStatus } : undefined,
|
|
761
1325
|
});
|
|
762
1326
|
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Roll the rule back to a previous version. Forward-only: re-applies the
|
|
1329
|
+
* target version's definition through the validated update path and mints a
|
|
1330
|
+
* new version. Returns 409 if the restored definition no longer resolves
|
|
1331
|
+
* (e.g. a tombstoned reference), 403 for system rules.
|
|
1332
|
+
*/
|
|
1333
|
+
rollback(id, toVersion, reason) {
|
|
1334
|
+
return this.req('POST', `/v1/config/rules/${encodeURIComponent(id)}/rollback`, {
|
|
1335
|
+
body: { toVersion, reason },
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* One workflow per alert type. Stages control assignment and review requirements;
|
|
1341
|
+
* routers choose paths. Requires config:read / config:write.
|
|
1342
|
+
*/
|
|
1343
|
+
export class ConfigAlertWorkflowsResource {
|
|
1344
|
+
req;
|
|
1345
|
+
constructor(req) {
|
|
1346
|
+
this.req = req;
|
|
1347
|
+
}
|
|
1348
|
+
/** Organization-wide choice; defaults to SIMPLE until Defined workflows is selected. */
|
|
1349
|
+
getExperience() { return this.req('GET', '/v1/config/alert-workflows/experience'); }
|
|
1350
|
+
/** Requires config:write. Changes only the behavior of newly created alerts. */
|
|
1351
|
+
saveExperience(input) { return this.req('PUT', '/v1/config/alert-workflows/experience', { body: input }); }
|
|
1352
|
+
/** Requires config:read. Returns one workflow per alert type. */
|
|
1353
|
+
list() { return this.req('GET', '/v1/config/alert-workflows'); }
|
|
1354
|
+
/** Newest publication first. A null definition cannot be restored. Requires config:read. */
|
|
1355
|
+
versions(alertType) { return this.req('GET', `/v1/config/alert-workflows/${alertType}/versions`); }
|
|
1356
|
+
/** Replaces the draft with a saved version. Publishing is a separate operation; existing alerts are unchanged. */
|
|
1357
|
+
restore(alertType, input) { return this.req('POST', `/v1/config/alert-workflows/${alertType}/restore`, { body: input }); }
|
|
1358
|
+
get(alertType) { return this.req('GET', `/v1/config/alert-workflows/${alertType}`); }
|
|
1359
|
+
/** Requires config:write. Use revision from get(); publish=false only updates the draft. */
|
|
1360
|
+
save(alertType, input) { return this.req('PUT', `/v1/config/alert-workflows/${alertType}`, { body: input }); }
|
|
1361
|
+
}
|
|
1362
|
+
/** Read-only legacy policies. New alert assignment runs through alertWorkflows. */
|
|
1363
|
+
export class ConfigAssignmentPoliciesResource {
|
|
1364
|
+
req;
|
|
1365
|
+
constructor(req) {
|
|
1366
|
+
this.req = req;
|
|
1367
|
+
}
|
|
1368
|
+
/** List policies in evaluation order. */
|
|
1369
|
+
list() {
|
|
1370
|
+
return this.req('GET', '/v1/config/assignment-policies');
|
|
1371
|
+
}
|
|
1372
|
+
/** Create a policy (appended at the end of the evaluation order). */
|
|
1373
|
+
/** @deprecated Returns HTTP 410. Use config.alertWorkflows.save() to configure stage assignment. */
|
|
1374
|
+
create(input) {
|
|
1375
|
+
return this.req('POST', '/v1/config/assignment-policies', { body: input });
|
|
1376
|
+
}
|
|
1377
|
+
getBySyncKey(syncKey) {
|
|
1378
|
+
return this.req('GET', `/v1/config/assignment-policies/by-sync-key/${encodeURIComponent(syncKey)}`);
|
|
1379
|
+
}
|
|
1380
|
+
get(id) {
|
|
1381
|
+
return this.req('GET', `/v1/config/assignment-policies/${encodeURIComponent(id)}`);
|
|
1382
|
+
}
|
|
1383
|
+
/** @deprecated Returns HTTP 410. Use config.alertWorkflows.save() to configure stage assignment. */
|
|
1384
|
+
update(id, input) {
|
|
1385
|
+
return this.req('PUT', `/v1/config/assignment-policies/${encodeURIComponent(id)}`, { body: input });
|
|
1386
|
+
}
|
|
1387
|
+
/** Reorder: pass EVERY policy id in the desired order; priorities are reassigned 1..n. */
|
|
1388
|
+
/** @deprecated Returns HTTP 410. Use config.alertWorkflows.save() to configure stage assignment. */
|
|
1389
|
+
reorder(input) {
|
|
1390
|
+
return this.req('PUT', '/v1/config/assignment-policies/order/reorder', { body: input });
|
|
1391
|
+
}
|
|
1392
|
+
/** @deprecated Returns HTTP 410. Use config.alertWorkflows.save() to configure stage assignment. */
|
|
1393
|
+
delete(id) {
|
|
1394
|
+
return this.req('DELETE', `/v1/config/assignment-policies/${encodeURIComponent(id)}`);
|
|
1395
|
+
}
|
|
763
1396
|
}
|
|
764
1397
|
export class ConfigConstantsResource {
|
|
765
1398
|
req;
|
|
@@ -787,6 +1420,117 @@ export class ConfigConstantsResource {
|
|
|
787
1420
|
return this.req('DELETE', `/v1/config/constants/${encodeURIComponent(id)}`, { query });
|
|
788
1421
|
}
|
|
789
1422
|
}
|
|
1423
|
+
export class ConfigStatesResource {
|
|
1424
|
+
req;
|
|
1425
|
+
constructor(req) {
|
|
1426
|
+
this.req = req;
|
|
1427
|
+
}
|
|
1428
|
+
list() {
|
|
1429
|
+
return this.req('GET', '/v1/config/states');
|
|
1430
|
+
}
|
|
1431
|
+
create(input) {
|
|
1432
|
+
return this.req('POST', '/v1/config/states', { body: input });
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
export class StatesResource {
|
|
1436
|
+
req;
|
|
1437
|
+
constructor(req) {
|
|
1438
|
+
this.req = req;
|
|
1439
|
+
}
|
|
1440
|
+
change(input) {
|
|
1441
|
+
return this.req('POST', '/v1/states/change', { body: input });
|
|
1442
|
+
}
|
|
1443
|
+
get(resourceType, resourceId, name) {
|
|
1444
|
+
return this.req('GET', `/v1/states/${resourceType}/${encodeURIComponent(resourceId)}/${encodeURIComponent(name)}`);
|
|
1445
|
+
}
|
|
1446
|
+
history(resourceType, resourceId, name, limit = 100) {
|
|
1447
|
+
return this.req('GET', `/v1/states/${resourceType}/${encodeURIComponent(resourceId)}/${encodeURIComponent(name)}/history`, {
|
|
1448
|
+
query: { limit },
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
/**
|
|
1453
|
+
* Tag catalogue — per-org, per-field tag vocabulary plus enforcement. Backs
|
|
1454
|
+
* every `TagValue[]` resource tag field. Under `strict` enforcement, writes
|
|
1455
|
+
* carrying off-catalogue values are rejected (422).
|
|
1456
|
+
*/
|
|
1457
|
+
export class ConfigTagCatalogueResource {
|
|
1458
|
+
req;
|
|
1459
|
+
constructor(req) {
|
|
1460
|
+
this.req = req;
|
|
1461
|
+
}
|
|
1462
|
+
/** List catalogue entries, optionally filtered by field-key. */
|
|
1463
|
+
list(query = {}) {
|
|
1464
|
+
return this.req('GET', '/v1/config/tag-catalogue', { query });
|
|
1465
|
+
}
|
|
1466
|
+
/**
|
|
1467
|
+
* The fixed colour palette. Served by the API so the token list isn't
|
|
1468
|
+
* duplicated (and left to drift) in every client.
|
|
1469
|
+
*/
|
|
1470
|
+
palette() {
|
|
1471
|
+
return this.req('GET', '/v1/config/tag-catalogue/palette');
|
|
1472
|
+
}
|
|
1473
|
+
create(input) {
|
|
1474
|
+
return this.req('POST', '/v1/config/tag-catalogue', { body: input });
|
|
1475
|
+
}
|
|
1476
|
+
update(id, input) {
|
|
1477
|
+
return this.req('PATCH', `/v1/config/tag-catalogue/${encodeURIComponent(id)}`, { body: input });
|
|
1478
|
+
}
|
|
1479
|
+
/** Archive an entry (hidden from pickers but kept for unarchive/history). */
|
|
1480
|
+
archive(id) {
|
|
1481
|
+
return this.req('POST', `/v1/config/tag-catalogue/${encodeURIComponent(id)}/archive`);
|
|
1482
|
+
}
|
|
1483
|
+
/** Hard-delete an entry. Existing assignments keep their snapshot label/value. */
|
|
1484
|
+
delete(id) {
|
|
1485
|
+
return this.req('DELETE', `/v1/config/tag-catalogue/${encodeURIComponent(id)}`);
|
|
1486
|
+
}
|
|
1487
|
+
/** Re-sync denormalised assignment labels from the catalogue. */
|
|
1488
|
+
backfill(fieldKey) {
|
|
1489
|
+
return this.req('POST', `/v1/config/tag-catalogue/backfill/${encodeURIComponent(fieldKey)}`);
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Tag groups — the facet layer over the catalogue. A group owns a namespace, so
|
|
1494
|
+
* its member tags are stored as `<group>:<tag>` and a group is recoverable from
|
|
1495
|
+
* a tag value by splitting on the first colon.
|
|
1496
|
+
*/
|
|
1497
|
+
export class ConfigTagGroupsResource {
|
|
1498
|
+
req;
|
|
1499
|
+
constructor(req) {
|
|
1500
|
+
this.req = req;
|
|
1501
|
+
}
|
|
1502
|
+
list(query = {}) {
|
|
1503
|
+
return this.req('GET', '/v1/config/tag-groups', { query });
|
|
1504
|
+
}
|
|
1505
|
+
create(input) {
|
|
1506
|
+
return this.req('POST', '/v1/config/tag-groups', { body: input });
|
|
1507
|
+
}
|
|
1508
|
+
update(id, input) {
|
|
1509
|
+
return this.req('PATCH', `/v1/config/tag-groups/${encodeURIComponent(id)}`, { body: input });
|
|
1510
|
+
}
|
|
1511
|
+
/** Archive a group. Its tags keep their namespaced values. */
|
|
1512
|
+
archive(id) {
|
|
1513
|
+
return this.req('POST', `/v1/config/tag-groups/${encodeURIComponent(id)}/archive`);
|
|
1514
|
+
}
|
|
1515
|
+
/** Hard-delete. Rejected while the group still owns tags — archive instead. */
|
|
1516
|
+
delete(id) {
|
|
1517
|
+
return this.req('DELETE', `/v1/config/tag-groups/${encodeURIComponent(id)}`);
|
|
1518
|
+
}
|
|
1519
|
+
/** Records holding more than one tag from this group — the SINGLE pre-flight. */
|
|
1520
|
+
cardinalityConflicts(id) {
|
|
1521
|
+
return this.req('GET', `/v1/config/tag-groups/${encodeURIComponent(id)}/cardinality-conflicts`);
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Move tags into (or out of, with `groupId: null`) a group.
|
|
1525
|
+
*
|
|
1526
|
+
* This changes each tag's stored VALUE, so it also rewrites assignments,
|
|
1527
|
+
* rule condition operands, and assignment-policy routing tables. Run it
|
|
1528
|
+
* with `dryRun: true` first — the report is identical, nothing is written.
|
|
1529
|
+
*/
|
|
1530
|
+
regroup(input) {
|
|
1531
|
+
return this.req('POST', '/v1/config/tag-groups/regroup', { body: input });
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
790
1534
|
export class ConfigProductsResource {
|
|
791
1535
|
req;
|
|
792
1536
|
constructor(req) {
|
|
@@ -847,6 +1591,54 @@ export class ConfigCurrenciesResource {
|
|
|
847
1591
|
bulkUpdateStatus(input) {
|
|
848
1592
|
return this.req('PATCH', '/v1/config/currencies/bulk-status', { body: input });
|
|
849
1593
|
}
|
|
1594
|
+
/** Archive a currency (LIVE → ARCHIVED). Also disables it. */
|
|
1595
|
+
archive(id) {
|
|
1596
|
+
return this.req('POST', `/v1/config/currencies/${encodeURIComponent(id)}/archive`);
|
|
1597
|
+
}
|
|
1598
|
+
/** Tombstone a currency (terminal). Archive-first required — 409 if LIVE. */
|
|
1599
|
+
delete(id) {
|
|
1600
|
+
return this.req('DELETE', `/v1/config/currencies/${encodeURIComponent(id)}`);
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
/**
|
|
1604
|
+
* Org-defined alert types for custom alerts — `/v1/config/custom-alert-types`.
|
|
1605
|
+
* Requires `config:read` / `config:write`. Follows the canonical lifecycle:
|
|
1606
|
+
* archive (blocked while alerts of the type are OPEN) → tombstone.
|
|
1607
|
+
*/
|
|
1608
|
+
export class ConfigCustomAlertTypesResource {
|
|
1609
|
+
req;
|
|
1610
|
+
constructor(req) {
|
|
1611
|
+
this.req = req;
|
|
1612
|
+
}
|
|
1613
|
+
list(query = {}) {
|
|
1614
|
+
return this.req('GET', '/v1/config/custom-alert-types', { query });
|
|
1615
|
+
}
|
|
1616
|
+
create(input) {
|
|
1617
|
+
return this.req('POST', '/v1/config/custom-alert-types', { body: input });
|
|
1618
|
+
}
|
|
1619
|
+
/** Returns `{ found: false }` when no type has that name. */
|
|
1620
|
+
getByName(name) {
|
|
1621
|
+
return this.req('GET', `/v1/config/custom-alert-types/by-name/${encodeURIComponent(name)}`);
|
|
1622
|
+
}
|
|
1623
|
+
get(id) {
|
|
1624
|
+
return this.req('GET', `/v1/config/custom-alert-types/${encodeURIComponent(id)}`);
|
|
1625
|
+
}
|
|
1626
|
+
/** Schema edits apply to alerts raised afterwards; existing alerts are not re-validated. */
|
|
1627
|
+
update(id, input) {
|
|
1628
|
+
return this.req('PATCH', `/v1/config/custom-alert-types/${encodeURIComponent(id)}`, { body: input });
|
|
1629
|
+
}
|
|
1630
|
+
/** Tombstones the type. Archive-first enforced. */
|
|
1631
|
+
delete(id) {
|
|
1632
|
+
return this.req('DELETE', `/v1/config/custom-alert-types/${encodeURIComponent(id)}`);
|
|
1633
|
+
}
|
|
1634
|
+
/** LIVE → ARCHIVED. 409 while any alert of this type is OPEN. */
|
|
1635
|
+
archive(id) {
|
|
1636
|
+
return this.req('POST', `/v1/config/custom-alert-types/${encodeURIComponent(id)}/archive`);
|
|
1637
|
+
}
|
|
1638
|
+
/** ARCHIVED → LIVE. */
|
|
1639
|
+
unarchive(id) {
|
|
1640
|
+
return this.req('POST', `/v1/config/custom-alert-types/${encodeURIComponent(id)}/unarchive`);
|
|
1641
|
+
}
|
|
850
1642
|
}
|
|
851
1643
|
export class ConfigEventDefinitionsResource {
|
|
852
1644
|
req;
|
|
@@ -922,9 +1714,6 @@ export class ConfigWebhooksResource {
|
|
|
922
1714
|
return this.req('POST', `/v1/config/webhooks/${encodeURIComponent(id)}/unarchive`);
|
|
923
1715
|
}
|
|
924
1716
|
}
|
|
925
|
-
// ===========================================================================
|
|
926
|
-
// Setup — /v1/setup
|
|
927
|
-
// ===========================================================================
|
|
928
1717
|
export class SetupResource {
|
|
929
1718
|
req;
|
|
930
1719
|
constructor(req) {
|
|
@@ -937,21 +1726,14 @@ export class SetupResource {
|
|
|
937
1726
|
return this.req('POST', '/v1/setup/initialize', { body: input });
|
|
938
1727
|
}
|
|
939
1728
|
}
|
|
940
|
-
// ===========================================================================
|
|
941
|
-
// Settings — /v1/settings
|
|
942
|
-
// ===========================================================================
|
|
943
1729
|
export class SettingsResource {
|
|
944
1730
|
req;
|
|
945
1731
|
constructor(req) {
|
|
946
1732
|
this.req = req;
|
|
947
1733
|
}
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
}
|
|
952
|
-
// ── Sync snapshots ─────────────────────────────────────
|
|
953
|
-
// Audit-grade captures of the sync-managed config. See
|
|
954
|
-
// docs/specs/v0/tenant-config/02-sync-snapshots.md.
|
|
1734
|
+
// NOTE (v0.7.0): `getSyncExport()` was removed. Use
|
|
1735
|
+
// `os.config.sync.export()` for a typed `SyncConfig`, or the snapshot
|
|
1736
|
+
// download endpoints below for audit-grade zip archives.
|
|
955
1737
|
/** List every captured snapshot for the tenant, newest first. */
|
|
956
1738
|
listSyncSnapshots() {
|
|
957
1739
|
return this.req('GET', '/v1/settings/sync-snapshots');
|
|
@@ -972,4 +1754,105 @@ export class SettingsResource {
|
|
|
972
1754
|
return this.req('GET', `/v1/settings/sync-snapshots/${encodeURIComponent(id)}/download`);
|
|
973
1755
|
}
|
|
974
1756
|
}
|
|
1757
|
+
/**
|
|
1758
|
+
* Custom screening lists — tenant-managed lists (internal blocklists, exited
|
|
1759
|
+
* customers, local regulator lists) checked by every screening run alongside
|
|
1760
|
+
* external providers. Requires `config:read` / `config:write` API-key scope.
|
|
1761
|
+
*/
|
|
1762
|
+
export class CustomListsResource {
|
|
1763
|
+
req;
|
|
1764
|
+
constructor(req) {
|
|
1765
|
+
this.req = req;
|
|
1766
|
+
}
|
|
1767
|
+
/** `GET /v1/screening/custom-lists` — lists, LIVE only by default. */
|
|
1768
|
+
list(params = {}) {
|
|
1769
|
+
return this.req('GET', '/v1/screening/custom-lists', { query: params });
|
|
1770
|
+
}
|
|
1771
|
+
/** `POST /v1/screening/custom-lists` — create a list. */
|
|
1772
|
+
create(input) {
|
|
1773
|
+
return this.req('POST', '/v1/screening/custom-lists', { body: input });
|
|
1774
|
+
}
|
|
1775
|
+
/** `GET /v1/screening/custom-lists/{listId}`. */
|
|
1776
|
+
get(listId) {
|
|
1777
|
+
return this.req('GET', `/v1/screening/custom-lists/${encodeURIComponent(listId)}`);
|
|
1778
|
+
}
|
|
1779
|
+
/** `PATCH /v1/screening/custom-lists/{listId}` — name / description / enabled / tags. */
|
|
1780
|
+
update(listId, input) {
|
|
1781
|
+
return this.req('PATCH', `/v1/screening/custom-lists/${encodeURIComponent(listId)}`, { body: input });
|
|
1782
|
+
}
|
|
1783
|
+
/**
|
|
1784
|
+
* `POST /v1/screening/custom-lists/{listId}/archive` — archived lists are
|
|
1785
|
+
* read-only and excluded from screening.
|
|
1786
|
+
*/
|
|
1787
|
+
archive(listId) {
|
|
1788
|
+
return this.req('POST', `/v1/screening/custom-lists/${encodeURIComponent(listId)}/archive`);
|
|
1789
|
+
}
|
|
1790
|
+
/** `POST /v1/screening/custom-lists/{listId}/unarchive`. */
|
|
1791
|
+
unarchive(listId) {
|
|
1792
|
+
return this.req('POST', `/v1/screening/custom-lists/${encodeURIComponent(listId)}/unarchive`);
|
|
1793
|
+
}
|
|
1794
|
+
/** `GET /v1/screening/custom-lists/{listId}/entries`. */
|
|
1795
|
+
listEntries(listId, params = {}) {
|
|
1796
|
+
return this.req('GET', `/v1/screening/custom-lists/${encodeURIComponent(listId)}/entries`, {
|
|
1797
|
+
query: params,
|
|
1798
|
+
});
|
|
1799
|
+
}
|
|
1800
|
+
/** `POST /v1/screening/custom-lists/{listId}/entries` — add a single entry. */
|
|
1801
|
+
createEntry(listId, input) {
|
|
1802
|
+
return this.req('POST', `/v1/screening/custom-lists/${encodeURIComponent(listId)}/entries`, {
|
|
1803
|
+
body: input,
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
/**
|
|
1807
|
+
* `POST /v1/screening/custom-lists/{listId}/entries/bulk` — import up to
|
|
1808
|
+
* 500 rows per request. Invalid rows are rejected per-row (with reasons)
|
|
1809
|
+
* while valid rows proceed; rows carrying `externalRef` upsert instead of
|
|
1810
|
+
* duplicating, so re-importing a refreshed CSV is safe.
|
|
1811
|
+
*/
|
|
1812
|
+
bulkCreateEntries(listId, rows) {
|
|
1813
|
+
return this.req('POST', `/v1/screening/custom-lists/${encodeURIComponent(listId)}/entries/bulk`, {
|
|
1814
|
+
body: { rows },
|
|
1815
|
+
});
|
|
1816
|
+
}
|
|
1817
|
+
/** `PATCH /v1/screening/custom-lists/{listId}/entries/{entryId}`. */
|
|
1818
|
+
updateEntry(listId, entryId, input) {
|
|
1819
|
+
return this.req('PATCH', `/v1/screening/custom-lists/${encodeURIComponent(listId)}/entries/${encodeURIComponent(entryId)}`, { body: input });
|
|
1820
|
+
}
|
|
1821
|
+
/** `DELETE /v1/screening/custom-lists/{listId}/entries/{entryId}`. */
|
|
1822
|
+
deleteEntry(listId, entryId) {
|
|
1823
|
+
return this.req('DELETE', `/v1/screening/custom-lists/${encodeURIComponent(listId)}/entries/${encodeURIComponent(entryId)}`);
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
/**
|
|
1827
|
+
* On-demand PDF reports (`/v1/reports/...`). Each method resolves to the raw
|
|
1828
|
+
* PDF bytes; write them to disk or hand them to a download response. Requires
|
|
1829
|
+
* the `report:read` grant. Generating a report records a `report.generated`
|
|
1830
|
+
* activity on the subject record.
|
|
1831
|
+
*/
|
|
1832
|
+
export class ReportsResource {
|
|
1833
|
+
getBinary;
|
|
1834
|
+
constructor(getBinary) {
|
|
1835
|
+
this.getBinary = getBinary;
|
|
1836
|
+
}
|
|
1837
|
+
/** Alert case file: facts, subject customer, matches / rule triggers, comments, activity. */
|
|
1838
|
+
alert(alertId) {
|
|
1839
|
+
return this.getBinary(`/v1/reports/alerts/${encodeURIComponent(alertId)}/pdf`);
|
|
1840
|
+
}
|
|
1841
|
+
/** Customer profile: identity, documents, accounts, risk, screening, totals, alerts. */
|
|
1842
|
+
customerProfile(customerId) {
|
|
1843
|
+
return this.getBinary(`/v1/reports/customers/${encodeURIComponent(customerId)}/pdf`);
|
|
1844
|
+
}
|
|
1845
|
+
/** Counterparty profile: classification, identifiers, payment methods, totals. */
|
|
1846
|
+
counterpartyProfile(counterpartyId) {
|
|
1847
|
+
return this.getBinary(`/v1/reports/counterparties/${encodeURIComponent(counterpartyId)}/pdf`);
|
|
1848
|
+
}
|
|
1849
|
+
/**
|
|
1850
|
+
* Generic profile for any other registered resource type (`ACCOUNT`,
|
|
1851
|
+
* `DEVICE`, `INSTITUTION`, `PRODUCT`, `TASK`, …). `ALERT`, `CUSTOMER` and
|
|
1852
|
+
* `COUNTERPARTY` are rejected with 400 — use the dedicated methods.
|
|
1853
|
+
*/
|
|
1854
|
+
resourceProfile(resourceType, resourceId) {
|
|
1855
|
+
return this.getBinary(`/v1/reports/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/pdf`);
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
975
1858
|
//# sourceMappingURL=service.js.map
|