@dossier-wiki/os-sdk 0.1.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.
@@ -0,0 +1,903 @@
1
+ export class DossiersOSAPIError extends Error {
2
+ status;
3
+ body;
4
+ constructor(status, message, body) {
5
+ super(message);
6
+ this.name = 'DossiersOSAPIError';
7
+ this.status = status;
8
+ this.body = body;
9
+ }
10
+ }
11
+ // ===========================================================================
12
+ // Main service — composes resource namespaces
13
+ // ===========================================================================
14
+ export class DossiersOSAPIService {
15
+ apiKey;
16
+ baseUrl;
17
+ fetchImpl;
18
+ auth;
19
+ individuals;
20
+ entities;
21
+ customers;
22
+ accounts;
23
+ counterparties;
24
+ devices;
25
+ transactions;
26
+ events;
27
+ exchangeRates;
28
+ identificationDocuments;
29
+ alerts;
30
+ platform;
31
+ config;
32
+ setup;
33
+ settings;
34
+ constructor(options) {
35
+ if (!options.baseUrl)
36
+ throw new Error('DossiersOSAPIService: baseUrl is required');
37
+ if (!options.apiKey)
38
+ throw new Error('DossiersOSAPIService: apiKey is required');
39
+ this.apiKey = options.apiKey;
40
+ this.baseUrl = options.baseUrl.replace(/\/$/, '');
41
+ this.fetchImpl = options.fetch ?? fetch;
42
+ const req = (method, path, opts) => this.request(method, path, opts);
43
+ this.auth = new AuthResource(req);
44
+ this.individuals = new IndividualsResource(req);
45
+ this.entities = new EntitiesResource(req);
46
+ this.customers = new CustomersResource(req);
47
+ this.accounts = new AccountsResource(req);
48
+ this.counterparties = new CounterpartiesResource(req);
49
+ this.devices = new DevicesResource(req);
50
+ this.transactions = new TransactionsResource(req);
51
+ this.events = new EventsResource(req);
52
+ this.exchangeRates = new ExchangeRatesResource(req);
53
+ this.identificationDocuments = new IdentificationDocumentsResource(req);
54
+ this.alerts = new AlertsResource(req);
55
+ this.platform = new PlatformResource(req);
56
+ this.config = new ConfigResource(req);
57
+ this.setup = new SetupResource(req);
58
+ this.settings = new SettingsResource(req);
59
+ }
60
+ async request(method, path, opts = {}) {
61
+ const url = new URL(`${this.baseUrl}${path}`);
62
+ if (opts.query) {
63
+ for (const [key, value] of Object.entries(opts.query)) {
64
+ if (value === undefined || value === null)
65
+ continue;
66
+ if (Array.isArray(value)) {
67
+ for (const v of value)
68
+ url.searchParams.append(key, String(v));
69
+ }
70
+ else if (typeof value === 'object') {
71
+ url.searchParams.append(key, JSON.stringify(value));
72
+ }
73
+ else {
74
+ url.searchParams.append(key, String(value));
75
+ }
76
+ }
77
+ }
78
+ const headers = {
79
+ Authorization: `Bearer ${this.apiKey}`,
80
+ Accept: 'application/json',
81
+ };
82
+ let body;
83
+ if (opts.body !== undefined) {
84
+ headers['Content-Type'] = 'application/json';
85
+ body = JSON.stringify(opts.body);
86
+ }
87
+ const response = await this.fetchImpl(url.toString(), { method, headers, body });
88
+ const raw = await response.text();
89
+ const parsed = raw.length > 0 ? safeJsonParse(raw) : undefined;
90
+ if (!response.ok) {
91
+ const message = (parsed && typeof parsed === 'object' && 'message' in parsed
92
+ ? String(parsed.message)
93
+ : null) ?? `Dossiers OS API ${method} ${path} failed: ${response.status}`;
94
+ throw new DossiersOSAPIError(response.status, message, parsed ?? raw);
95
+ }
96
+ return parsed;
97
+ }
98
+ }
99
+ function safeJsonParse(raw) {
100
+ try {
101
+ return JSON.parse(raw);
102
+ }
103
+ catch {
104
+ return raw;
105
+ }
106
+ }
107
+ // ===========================================================================
108
+ // Per-resource comments proxy
109
+ // ===========================================================================
110
+ /**
111
+ * Scoped view of `/v1/platform/v1/comments` for a single resourceType.
112
+ * Lets callers do `sdk.individuals.comments.list(customerId)` instead of
113
+ * `sdk.platform.comments.list({ resourceType: 'CUSTOMER', resourceId: customerId })`.
114
+ *
115
+ * Update and delete take a comment id and are exposed on `sdk.platform.comments` only.
116
+ */
117
+ export class ResourceCommentsProxy {
118
+ req;
119
+ resourceType;
120
+ constructor(req, resourceType) {
121
+ this.req = req;
122
+ this.resourceType = resourceType;
123
+ }
124
+ list(resourceId) {
125
+ return this.req('GET', '/v1/platform/v1/comments', {
126
+ query: { resourceType: this.resourceType, resourceId },
127
+ });
128
+ }
129
+ create(resourceId, input) {
130
+ return this.req('POST', '/v1/platform/v1/comments', {
131
+ body: { ...input, resourceType: this.resourceType, resourceId },
132
+ });
133
+ }
134
+ }
135
+ /**
136
+ * Generic key/value "other information" bag scoped to a customer. Exposed on
137
+ * both `individuals.otherInformation` and `entities.otherInformation` — the
138
+ * server stores them in a single polymorphic table keyed by customerId.
139
+ */
140
+ export class CustomerOtherInformationResource {
141
+ req;
142
+ constructor(req) {
143
+ this.req = req;
144
+ }
145
+ list(customerId) {
146
+ return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/other-information`);
147
+ }
148
+ get(customerId, key) {
149
+ return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/other-information/${encodeURIComponent(key)}`);
150
+ }
151
+ /** Merge-upsert semantics — listed entries are inserted or updated by key; unlisted keys remain untouched. */
152
+ bulkUpsert(customerId, input) {
153
+ return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/other-information`, { body: input });
154
+ }
155
+ upsert(customerId, key, input) {
156
+ return this.req('PUT', `/v1/customers/${encodeURIComponent(customerId)}/other-information/${encodeURIComponent(key)}`, { body: input });
157
+ }
158
+ delete(customerId, key) {
159
+ return this.req('DELETE', `/v1/customers/${encodeURIComponent(customerId)}/other-information/${encodeURIComponent(key)}`);
160
+ }
161
+ }
162
+ // ===========================================================================
163
+ // Auth — /v1/auth
164
+ // ===========================================================================
165
+ export class AuthResource {
166
+ req;
167
+ constructor(req) {
168
+ this.req = req;
169
+ }
170
+ /** `GET /v1/auth/invitations/{id}` — public endpoint, no auth required. */
171
+ getInvitation(id) {
172
+ return this.req('GET', `/v1/auth/invitations/${encodeURIComponent(id)}`);
173
+ }
174
+ /** `POST /v1/auth/token` — exchange the session cookie for a 24h JWT. */
175
+ createSessionToken() {
176
+ return this.req('POST', '/v1/auth/token');
177
+ }
178
+ /** `POST /v1/auth/keys` — issue a long-lived JWT API key. */
179
+ createApiKey(input) {
180
+ return this.req('POST', '/v1/auth/keys', { body: input });
181
+ }
182
+ /** `POST /v1/auth/admin/reset-member-password` */
183
+ resetMemberPassword(input) {
184
+ return this.req('POST', '/v1/auth/admin/reset-member-password', { body: input });
185
+ }
186
+ }
187
+ // ===========================================================================
188
+ // Individuals — /v1/customers/individuals
189
+ // ===========================================================================
190
+ export class IndividualsResource {
191
+ req;
192
+ identificationDocuments;
193
+ faceImages;
194
+ comments;
195
+ otherInformation;
196
+ constructor(req) {
197
+ this.req = req;
198
+ this.identificationDocuments = new IndividualIdentificationDocumentsResource(req);
199
+ this.faceImages = new IndividualFaceImagesResource(req);
200
+ this.comments = new ResourceCommentsProxy(req, 'CUSTOMER');
201
+ this.otherInformation = new CustomerOtherInformationResource(req);
202
+ }
203
+ list(query = {}) {
204
+ return this.req('GET', '/v1/customers/individuals', { query });
205
+ }
206
+ create(input) {
207
+ return this.req('POST', '/v1/customers/individuals', { body: input });
208
+ }
209
+ get(customerId, query = {}) {
210
+ return this.req('GET', `/v1/customers/individuals/${encodeURIComponent(customerId)}`, {
211
+ query,
212
+ });
213
+ }
214
+ update(customerId, input) {
215
+ return this.req('PATCH', `/v1/customers/individuals/${encodeURIComponent(customerId)}`, {
216
+ body: input,
217
+ });
218
+ }
219
+ }
220
+ export class IndividualIdentificationDocumentsResource {
221
+ req;
222
+ constructor(req) {
223
+ this.req = req;
224
+ }
225
+ /** `GET /v1/customers/{customerId}/identification-documents` — list all documents for an individual. */
226
+ list(customerId, query = {}) {
227
+ return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/identification-documents`, { query });
228
+ }
229
+ /** `POST /v1/customers/{customerId}/identification-documents` — create a rich identification document (replaces the legacy `add`). */
230
+ create(customerId, input) {
231
+ return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/identification-documents`, { body: input });
232
+ }
233
+ update(customerId, documentId, input) {
234
+ return this.req('PATCH', `/v1/customers/individuals/${encodeURIComponent(customerId)}/identification-documents/${encodeURIComponent(documentId)}`, { body: input });
235
+ }
236
+ delete(customerId, documentId) {
237
+ return this.req('DELETE', `/v1/customers/individuals/${encodeURIComponent(customerId)}/identification-documents/${encodeURIComponent(documentId)}`);
238
+ }
239
+ }
240
+ export class IndividualFaceImagesResource {
241
+ req;
242
+ constructor(req) {
243
+ this.req = req;
244
+ }
245
+ add(customerId, input) {
246
+ return this.req('POST', `/v1/customers/individuals/${encodeURIComponent(customerId)}/face-images`, { body: input });
247
+ }
248
+ update(customerId, faceImageId, input) {
249
+ return this.req('PATCH', `/v1/customers/individuals/${encodeURIComponent(customerId)}/face-images/${encodeURIComponent(faceImageId)}`, { body: input });
250
+ }
251
+ delete(customerId, faceImageId) {
252
+ return this.req('DELETE', `/v1/customers/individuals/${encodeURIComponent(customerId)}/face-images/${encodeURIComponent(faceImageId)}`);
253
+ }
254
+ }
255
+ // ===========================================================================
256
+ // Entities — /v1/customers/entities
257
+ // ===========================================================================
258
+ export class EntitiesResource {
259
+ req;
260
+ stakeholders;
261
+ identificationDocuments;
262
+ comments;
263
+ otherInformation;
264
+ constructor(req) {
265
+ this.req = req;
266
+ this.stakeholders = new EntityStakeholdersResource(req);
267
+ this.identificationDocuments = new EntityIdentificationDocumentsResource(req);
268
+ this.comments = new ResourceCommentsProxy(req, 'CUSTOMER');
269
+ this.otherInformation = new CustomerOtherInformationResource(req);
270
+ }
271
+ list(query = {}) {
272
+ return this.req('GET', '/v1/customers/entities', { query });
273
+ }
274
+ create(input) {
275
+ return this.req('POST', '/v1/customers/entities', { body: input });
276
+ }
277
+ get(customerId, query = {}) {
278
+ return this.req('GET', `/v1/customers/entities/${encodeURIComponent(customerId)}`, {
279
+ query,
280
+ });
281
+ }
282
+ update(customerId, input) {
283
+ return this.req('PATCH', `/v1/customers/entities/${encodeURIComponent(customerId)}`, {
284
+ body: input,
285
+ });
286
+ }
287
+ }
288
+ export class EntityStakeholdersResource {
289
+ req;
290
+ constructor(req) {
291
+ this.req = req;
292
+ }
293
+ list(customerId) {
294
+ return this.req('GET', `/v1/customers/entities/${encodeURIComponent(customerId)}/stakeholders`);
295
+ }
296
+ create(customerId, input) {
297
+ return this.req('POST', `/v1/customers/entities/${encodeURIComponent(customerId)}/stakeholders`, { body: input });
298
+ }
299
+ update(customerId, stakeholderId, input) {
300
+ return this.req('PATCH', `/v1/customers/entities/${encodeURIComponent(customerId)}/stakeholders/${encodeURIComponent(stakeholderId)}`, { body: input });
301
+ }
302
+ delete(customerId, stakeholderId) {
303
+ return this.req('DELETE', `/v1/customers/entities/${encodeURIComponent(customerId)}/stakeholders/${encodeURIComponent(stakeholderId)}`);
304
+ }
305
+ }
306
+ export class EntityIdentificationDocumentsResource {
307
+ req;
308
+ constructor(req) {
309
+ this.req = req;
310
+ }
311
+ list(customerId, query = {}) {
312
+ return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/identification-documents`, { query });
313
+ }
314
+ create(customerId, input) {
315
+ return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/identification-documents`, { body: input });
316
+ }
317
+ }
318
+ // ===========================================================================
319
+ // Customers — cross-cutting resources scoped to a customerId
320
+ // ===========================================================================
321
+ export class CustomersResource {
322
+ notes;
323
+ files;
324
+ screening;
325
+ riskRating;
326
+ riskQuestionnaires;
327
+ expectedActivity;
328
+ devices;
329
+ constructor(req) {
330
+ this.notes = new CustomerNotesResource(req);
331
+ this.files = new CustomerFilesResource(req);
332
+ this.screening = new CustomerScreeningResource(req);
333
+ this.riskRating = new CustomerRiskRatingResource(req);
334
+ this.riskQuestionnaires = new CustomerRiskQuestionnairesResource(req);
335
+ this.expectedActivity = new CustomerExpectedActivityResource(req);
336
+ this.devices = new CustomerDevicesResource(req);
337
+ }
338
+ }
339
+ export class CustomerNotesResource {
340
+ req;
341
+ constructor(req) {
342
+ this.req = req;
343
+ }
344
+ list(customerId) {
345
+ return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/notes`);
346
+ }
347
+ create(customerId, input) {
348
+ return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/notes`, {
349
+ body: input,
350
+ });
351
+ }
352
+ update(customerId, noteId, input) {
353
+ return this.req('PATCH', `/v1/customers/${encodeURIComponent(customerId)}/notes/${encodeURIComponent(noteId)}`, { body: input });
354
+ }
355
+ delete(customerId, noteId) {
356
+ return this.req('DELETE', `/v1/customers/${encodeURIComponent(customerId)}/notes/${encodeURIComponent(noteId)}`);
357
+ }
358
+ }
359
+ export class CustomerFilesResource {
360
+ req;
361
+ constructor(req) {
362
+ this.req = req;
363
+ }
364
+ list(customerId) {
365
+ return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/files`);
366
+ }
367
+ requestUploadUrl(customerId, input) {
368
+ return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/files/upload-url`, { body: input });
369
+ }
370
+ confirmUpload(customerId, input) {
371
+ return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/files/confirm`, {
372
+ body: input,
373
+ });
374
+ }
375
+ get(customerId, fileId) {
376
+ return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/files/${encodeURIComponent(fileId)}`);
377
+ }
378
+ delete(customerId, fileId) {
379
+ return this.req('DELETE', `/v1/customers/${encodeURIComponent(customerId)}/files/${encodeURIComponent(fileId)}`);
380
+ }
381
+ }
382
+ export class CustomerScreeningResource {
383
+ req;
384
+ constructor(req) {
385
+ this.req = req;
386
+ }
387
+ trigger(customerId) {
388
+ return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/screen`);
389
+ }
390
+ listConfirmedMatches(customerId) {
391
+ return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/confirmed-matches`);
392
+ }
393
+ }
394
+ export class CustomerRiskRatingResource {
395
+ req;
396
+ constructor(req) {
397
+ this.req = req;
398
+ }
399
+ update(customerId, input) {
400
+ return this.req('PUT', `/v1/customers/${encodeURIComponent(customerId)}/risk-rating`, {
401
+ body: input,
402
+ });
403
+ }
404
+ }
405
+ export class CustomerRiskQuestionnairesResource {
406
+ req;
407
+ constructor(req) {
408
+ this.req = req;
409
+ }
410
+ list(customerId) {
411
+ return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/risk-questionnaires`);
412
+ }
413
+ create(customerId, input) {
414
+ return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/risk-questionnaires`, { body: input });
415
+ }
416
+ }
417
+ export class CustomerExpectedActivityResource {
418
+ req;
419
+ constructor(req) {
420
+ this.req = req;
421
+ }
422
+ get(customerId) {
423
+ return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/expected-activity`);
424
+ }
425
+ update(customerId, input) {
426
+ return this.req('PUT', `/v1/customers/${encodeURIComponent(customerId)}/expected-activity`, { body: input });
427
+ }
428
+ }
429
+ export class CustomerDevicesResource {
430
+ req;
431
+ constructor(req) {
432
+ this.req = req;
433
+ }
434
+ list(customerId) {
435
+ return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/devices`);
436
+ }
437
+ register(customerId, input) {
438
+ return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/devices`, {
439
+ body: input,
440
+ });
441
+ }
442
+ updateTrust(customerId, deviceId, input) {
443
+ return this.req('PUT', `/v1/customers/${encodeURIComponent(customerId)}/devices/${encodeURIComponent(deviceId)}/trust`, { body: input });
444
+ }
445
+ }
446
+ // ===========================================================================
447
+ // Accounts — /v1/customers/{customerId}/accounts
448
+ // ===========================================================================
449
+ export class AccountsResource {
450
+ req;
451
+ comments;
452
+ constructor(req) {
453
+ this.req = req;
454
+ this.comments = new ResourceCommentsProxy(req, 'ACCOUNT');
455
+ }
456
+ list(customerId, query = {}) {
457
+ return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/accounts`, {
458
+ query,
459
+ });
460
+ }
461
+ create(customerId, input) {
462
+ return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/accounts`, {
463
+ body: input,
464
+ });
465
+ }
466
+ get(customerId, accountId) {
467
+ return this.req('GET', `/v1/customers/${encodeURIComponent(customerId)}/accounts/${encodeURIComponent(accountId)}`);
468
+ }
469
+ update(customerId, accountId, input) {
470
+ return this.req('PATCH', `/v1/customers/${encodeURIComponent(customerId)}/accounts/${encodeURIComponent(accountId)}`, { body: input });
471
+ }
472
+ freeze(customerId, accountId) {
473
+ return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/accounts/${encodeURIComponent(accountId)}/freeze`);
474
+ }
475
+ unfreeze(customerId, accountId) {
476
+ return this.req('POST', `/v1/customers/${encodeURIComponent(customerId)}/accounts/${encodeURIComponent(accountId)}/unfreeze`);
477
+ }
478
+ }
479
+ // ===========================================================================
480
+ // Counterparties — /v1/counterparties
481
+ // ===========================================================================
482
+ export class CounterpartiesResource {
483
+ req;
484
+ riskAssessments;
485
+ files;
486
+ comments;
487
+ constructor(req) {
488
+ this.req = req;
489
+ this.riskAssessments = new CounterpartyRiskAssessmentsResource(req);
490
+ this.files = new CounterpartyFilesResource(req);
491
+ this.comments = new ResourceCommentsProxy(req, 'COUNTERPARTY');
492
+ }
493
+ list(query = {}) {
494
+ return this.req('GET', '/v1/counterparties', { query });
495
+ }
496
+ create(input) {
497
+ return this.req('POST', '/v1/counterparties', { body: input });
498
+ }
499
+ get(counterpartyId) {
500
+ return this.req('GET', `/v1/counterparties/${encodeURIComponent(counterpartyId)}`);
501
+ }
502
+ update(counterpartyId, input) {
503
+ return this.req('PATCH', `/v1/counterparties/${encodeURIComponent(counterpartyId)}`, {
504
+ body: input,
505
+ });
506
+ }
507
+ link(counterpartyId, input) {
508
+ return this.req('POST', `/v1/counterparties/${encodeURIComponent(counterpartyId)}/link`, {
509
+ body: input,
510
+ });
511
+ }
512
+ unlink(counterpartyId, input) {
513
+ return this.req('POST', `/v1/counterparties/${encodeURIComponent(counterpartyId)}/unlink`, {
514
+ body: input,
515
+ });
516
+ }
517
+ }
518
+ export class CounterpartyRiskAssessmentsResource {
519
+ req;
520
+ constructor(req) {
521
+ this.req = req;
522
+ }
523
+ list(counterpartyId) {
524
+ return this.req('GET', `/v1/counterparties/${encodeURIComponent(counterpartyId)}/risk-assessments`);
525
+ }
526
+ create(counterpartyId, input) {
527
+ return this.req('POST', `/v1/counterparties/${encodeURIComponent(counterpartyId)}/risk-assessments`, { body: input });
528
+ }
529
+ }
530
+ export class CounterpartyFilesResource {
531
+ req;
532
+ constructor(req) {
533
+ this.req = req;
534
+ }
535
+ requestUploadUrl(counterpartyId, input) {
536
+ return this.req('POST', `/v1/counterparties/${encodeURIComponent(counterpartyId)}/files/upload-url`, { body: input });
537
+ }
538
+ }
539
+ // ===========================================================================
540
+ // Devices — /v1/devices/{deviceId}
541
+ // ===========================================================================
542
+ export class DevicesResource {
543
+ req;
544
+ comments;
545
+ constructor(req) {
546
+ this.req = req;
547
+ this.comments = new ResourceCommentsProxy(req, 'DEVICE');
548
+ }
549
+ get(deviceId) {
550
+ return this.req('GET', `/v1/devices/${encodeURIComponent(deviceId)}`);
551
+ }
552
+ }
553
+ // ===========================================================================
554
+ // Transactions — /v1/transactions
555
+ // ===========================================================================
556
+ export class TransactionsResource {
557
+ req;
558
+ comments;
559
+ constructor(req) {
560
+ this.req = req;
561
+ this.comments = new ResourceCommentsProxy(req, 'TRANSACTION');
562
+ }
563
+ /** `POST /v1/transactions` — ingest a transaction for rule evaluation. */
564
+ ingest(input) {
565
+ return this.req('POST', '/v1/transactions', { body: input });
566
+ }
567
+ /** `PATCH /v1/transactions` — patch a transaction's terminal status. */
568
+ patchStatus(input) {
569
+ return this.req('PATCH', '/v1/transactions', { body: input });
570
+ }
571
+ }
572
+ // ===========================================================================
573
+ // Events — /v1/events
574
+ // ===========================================================================
575
+ export class EventsResource {
576
+ req;
577
+ constructor(req) {
578
+ this.req = req;
579
+ }
580
+ ingest(input) {
581
+ return this.req('POST', '/v1/events', { body: input });
582
+ }
583
+ }
584
+ // ===========================================================================
585
+ // Exchange Rates — /v1/exchange-rates
586
+ // ===========================================================================
587
+ export class ExchangeRatesResource {
588
+ req;
589
+ constructor(req) {
590
+ this.req = req;
591
+ }
592
+ push(input) {
593
+ return this.req('POST', '/v1/exchange-rates', { body: input });
594
+ }
595
+ }
596
+ // ===========================================================================
597
+ // Identification Documents — /v1/identification-documents/*
598
+ // First-class resource — independent of the customer collection a document
599
+ // belongs to. For customer-scoped list/create, see `customers.identificationDocuments`
600
+ // or the convenience proxies on `individuals` / `entities`.
601
+ // ===========================================================================
602
+ export class IdentificationDocumentsResource {
603
+ req;
604
+ comments;
605
+ constructor(req) {
606
+ this.req = req;
607
+ this.comments = new ResourceCommentsProxy(req, 'IDENTIFICATION_DOCUMENT');
608
+ }
609
+ get(id) {
610
+ return this.req('GET', `/v1/identification-documents/${encodeURIComponent(id)}`);
611
+ }
612
+ update(id, input) {
613
+ return this.req('PATCH', `/v1/identification-documents/${encodeURIComponent(id)}`, {
614
+ body: input,
615
+ });
616
+ }
617
+ /** Hard-delete an identification document. Returns `{ deletedId }`. */
618
+ delete(id) {
619
+ return this.req('DELETE', `/v1/identification-documents/${encodeURIComponent(id)}`);
620
+ }
621
+ /** Archive (soft-delete) an identification document. */
622
+ archive(id, input) {
623
+ return this.req('POST', `/v1/identification-documents/${encodeURIComponent(id)}/archive`, { body: input });
624
+ }
625
+ /** Restore a previously archived identification document. */
626
+ restore(id) {
627
+ return this.req('POST', `/v1/identification-documents/${encodeURIComponent(id)}/restore`);
628
+ }
629
+ /** Transition status — `rejectionNarrative` is required when `status=REJECTED`. */
630
+ transition(id, input) {
631
+ return this.req('POST', `/v1/identification-documents/${encodeURIComponent(id)}/transitions`, { body: input });
632
+ }
633
+ }
634
+ // ===========================================================================
635
+ // Alerts — surfaces comments on alerts received via webhooks.
636
+ // The OS API does not currently expose a top-level alerts CRUD; alerts are
637
+ // produced by rule evaluation and delivered via webhooks. This resource lets
638
+ // callers attach/inspect notes against an alert id without going through the
639
+ // platform comments interface.
640
+ // ===========================================================================
641
+ export class AlertsResource {
642
+ comments;
643
+ constructor(req) {
644
+ this.comments = new ResourceCommentsProxy(req, 'ALERT');
645
+ }
646
+ }
647
+ // ===========================================================================
648
+ // Platform — cross-resource primitives (/v1/platform/v1/*)
649
+ // Polymorphic comments and file uploads keyed by `resourceType` + `resourceId`.
650
+ // Most callers should prefer the per-resource proxies (e.g. `sdk.individuals.comments`).
651
+ // ===========================================================================
652
+ export class PlatformResource {
653
+ comments;
654
+ files;
655
+ constructor(req) {
656
+ this.comments = new PlatformCommentsResource(req);
657
+ this.files = new PlatformFilesResource(req);
658
+ }
659
+ }
660
+ export class PlatformCommentsResource {
661
+ req;
662
+ constructor(req) {
663
+ this.req = req;
664
+ }
665
+ list(query) {
666
+ return this.req('GET', '/v1/platform/v1/comments', { query });
667
+ }
668
+ create(input) {
669
+ return this.req('POST', '/v1/platform/v1/comments', { body: input });
670
+ }
671
+ /** Author-only. Service principals cannot edit; their comments are immutable. */
672
+ update(id, input) {
673
+ return this.req('PATCH', `/v1/platform/v1/comments/${encodeURIComponent(id)}`, {
674
+ body: input,
675
+ });
676
+ }
677
+ /** Author-only. Service principals cannot delete their own immutable comments. */
678
+ delete(id) {
679
+ return this.req('DELETE', `/v1/platform/v1/comments/${encodeURIComponent(id)}`);
680
+ }
681
+ }
682
+ export class PlatformFilesResource {
683
+ req;
684
+ constructor(req) {
685
+ this.req = req;
686
+ }
687
+ /**
688
+ * 3-step upload: (1) call this to get a presigned PUT URL + fileId;
689
+ * (2) PUT the bytes with the matching Content-Type;
690
+ * (3) reference the returned fileId in any `attachments[].fileId` field on subsequent platform writes.
691
+ */
692
+ requestUploadUrl(input) {
693
+ return this.req('POST', '/v1/platform/v1/files/upload-url', { body: input });
694
+ }
695
+ /** Optional confirm-step that returns a presigned download URL so the caller can verify the upload. */
696
+ confirmUpload(input) {
697
+ return this.req('POST', '/v1/platform/v1/files/confirm', { body: input });
698
+ }
699
+ }
700
+ // ===========================================================================
701
+ // Config — /v1/config/*
702
+ // ===========================================================================
703
+ export class ConfigResource {
704
+ req;
705
+ rules;
706
+ constants;
707
+ products;
708
+ currencies;
709
+ eventDefinitions;
710
+ webhooks;
711
+ constructor(req) {
712
+ this.req = req;
713
+ this.rules = new ConfigRulesResource(req);
714
+ this.constants = new ConfigConstantsResource(req);
715
+ this.products = new ConfigProductsResource(req);
716
+ this.currencies = new ConfigCurrenciesResource(req);
717
+ this.eventDefinitions = new ConfigEventDefinitionsResource(req);
718
+ this.webhooks = new ConfigWebhooksResource(req);
719
+ }
720
+ /** `DELETE /v1/config/reset` — clear all org config (destructive). */
721
+ reset() {
722
+ return this.req('DELETE', '/v1/config/reset');
723
+ }
724
+ }
725
+ export class ConfigRulesResource {
726
+ req;
727
+ constructor(req) {
728
+ this.req = req;
729
+ }
730
+ list(query = {}) {
731
+ return this.req('GET', '/v1/config/rules', { query });
732
+ }
733
+ create(input) {
734
+ return this.req('POST', '/v1/config/rules', { body: input });
735
+ }
736
+ getBySyncKey(syncKey) {
737
+ return this.req('GET', `/v1/config/rules/by-sync-key/${encodeURIComponent(syncKey)}`);
738
+ }
739
+ get(id) {
740
+ return this.req('GET', `/v1/config/rules/${encodeURIComponent(id)}`);
741
+ }
742
+ update(id, input) {
743
+ return this.req('PATCH', `/v1/config/rules/${encodeURIComponent(id)}`, { body: input });
744
+ }
745
+ delete(id) {
746
+ return this.req('DELETE', `/v1/config/rules/${encodeURIComponent(id)}`);
747
+ }
748
+ }
749
+ export class ConfigConstantsResource {
750
+ req;
751
+ constructor(req) {
752
+ this.req = req;
753
+ }
754
+ list(query = {}) {
755
+ return this.req('GET', '/v1/config/constants', { query });
756
+ }
757
+ create(input) {
758
+ return this.req('POST', '/v1/config/constants', { body: input });
759
+ }
760
+ getBySyncKey(syncKey) {
761
+ return this.req('GET', `/v1/config/constants/by-sync-key/${encodeURIComponent(syncKey)}`);
762
+ }
763
+ get(id) {
764
+ return this.req('GET', `/v1/config/constants/${encodeURIComponent(id)}`);
765
+ }
766
+ update(id, input) {
767
+ return this.req('PATCH', `/v1/config/constants/${encodeURIComponent(id)}`, {
768
+ body: input,
769
+ });
770
+ }
771
+ delete(id, query = {}) {
772
+ return this.req('DELETE', `/v1/config/constants/${encodeURIComponent(id)}`, { query });
773
+ }
774
+ }
775
+ export class ConfigProductsResource {
776
+ req;
777
+ constructor(req) {
778
+ this.req = req;
779
+ }
780
+ list(query = {}) {
781
+ return this.req('GET', '/v1/config/products', { query });
782
+ }
783
+ create(input) {
784
+ return this.req('POST', '/v1/config/products', { body: input });
785
+ }
786
+ getBySyncKey(syncKey) {
787
+ return this.req('GET', `/v1/config/products/by-sync-key/${encodeURIComponent(syncKey)}`);
788
+ }
789
+ get(id) {
790
+ return this.req('GET', `/v1/config/products/${encodeURIComponent(id)}`);
791
+ }
792
+ update(id, input) {
793
+ return this.req('PATCH', `/v1/config/products/${encodeURIComponent(id)}`, {
794
+ body: input,
795
+ });
796
+ }
797
+ delete(id) {
798
+ return this.req('DELETE', `/v1/config/products/${encodeURIComponent(id)}`);
799
+ }
800
+ }
801
+ export class ConfigCurrenciesResource {
802
+ req;
803
+ constructor(req) {
804
+ this.req = req;
805
+ }
806
+ list(query = {}) {
807
+ return this.req('GET', '/v1/config/currencies', { query });
808
+ }
809
+ create(input) {
810
+ return this.req('POST', '/v1/config/currencies', { body: input });
811
+ }
812
+ get(id) {
813
+ return this.req('GET', `/v1/config/currencies/${encodeURIComponent(id)}`);
814
+ }
815
+ update(id, input) {
816
+ return this.req('PATCH', `/v1/config/currencies/${encodeURIComponent(id)}`, {
817
+ body: input,
818
+ });
819
+ }
820
+ bulkUpdateStatus(input) {
821
+ return this.req('PATCH', '/v1/config/currencies/bulk-status', { body: input });
822
+ }
823
+ }
824
+ export class ConfigEventDefinitionsResource {
825
+ req;
826
+ constructor(req) {
827
+ this.req = req;
828
+ }
829
+ list(query = {}) {
830
+ return this.req('GET', '/v1/config/event-definitions', { query });
831
+ }
832
+ create(input) {
833
+ return this.req('POST', '/v1/config/event-definitions', { body: input });
834
+ }
835
+ getBySyncKey(syncKey) {
836
+ return this.req('GET', `/v1/config/event-definitions/by-sync-key/${encodeURIComponent(syncKey)}`);
837
+ }
838
+ get(id) {
839
+ return this.req('GET', `/v1/config/event-definitions/${encodeURIComponent(id)}`);
840
+ }
841
+ update(id, input) {
842
+ return this.req('PATCH', `/v1/config/event-definitions/${encodeURIComponent(id)}`, {
843
+ body: input,
844
+ });
845
+ }
846
+ delete(id) {
847
+ return this.req('DELETE', `/v1/config/event-definitions/${encodeURIComponent(id)}`);
848
+ }
849
+ }
850
+ export class ConfigWebhooksResource {
851
+ req;
852
+ constructor(req) {
853
+ this.req = req;
854
+ }
855
+ list(query = {}) {
856
+ return this.req('GET', '/v1/config/webhooks', { query });
857
+ }
858
+ create(input) {
859
+ return this.req('POST', '/v1/config/webhooks', { body: input });
860
+ }
861
+ getBySyncKey(syncKey) {
862
+ return this.req('GET', `/v1/config/webhooks/by-sync-key/${encodeURIComponent(syncKey)}`);
863
+ }
864
+ get(id) {
865
+ return this.req('GET', `/v1/config/webhooks/${encodeURIComponent(id)}`);
866
+ }
867
+ update(id, input) {
868
+ return this.req('PATCH', `/v1/config/webhooks/${encodeURIComponent(id)}`, {
869
+ body: input,
870
+ });
871
+ }
872
+ delete(id) {
873
+ return this.req('DELETE', `/v1/config/webhooks/${encodeURIComponent(id)}`);
874
+ }
875
+ }
876
+ // ===========================================================================
877
+ // Setup — /v1/setup
878
+ // ===========================================================================
879
+ export class SetupResource {
880
+ req;
881
+ constructor(req) {
882
+ this.req = req;
883
+ }
884
+ getStatus() {
885
+ return this.req('GET', '/v1/setup/status');
886
+ }
887
+ initialize(input) {
888
+ return this.req('POST', '/v1/setup/initialize', { body: input });
889
+ }
890
+ }
891
+ // ===========================================================================
892
+ // Settings — /v1/settings
893
+ // ===========================================================================
894
+ export class SettingsResource {
895
+ req;
896
+ constructor(req) {
897
+ this.req = req;
898
+ }
899
+ getSyncExport() {
900
+ return this.req('GET', '/v1/settings/sync-export');
901
+ }
902
+ }
903
+ //# sourceMappingURL=service.js.map