@robosystems/client 2.5.3 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/InvestorClient.d.ts +7 -1
- package/artifacts/InvestorClient.js +24 -14
- package/artifacts/InvestorClient.ts +46 -27
- package/artifacts/LedgerClient.d.ts +26 -18
- package/artifacts/LedgerClient.js +119 -124
- package/artifacts/LedgerClient.ts +183 -243
- package/artifacts/OperationClient.js +24 -1
- package/artifacts/OperationClient.ts +24 -1
- package/artifacts/OperatorClient.d.ts +10 -0
- package/artifacts/OperatorClient.js +72 -17
- package/artifacts/OperatorClient.ts +79 -21
- package/artifacts/QueryClient.d.ts +2 -1
- package/artifacts/QueryClient.js +17 -58
- package/artifacts/QueryClient.ts +21 -68
- package/artifacts/SSEClient.d.ts +1 -0
- package/artifacts/SSEClient.js +56 -7
- package/artifacts/SSEClient.ts +57 -7
- package/artifacts/config.js +18 -4
- package/artifacts/config.ts +18 -4
- package/artifacts/graphql/client.d.ts +10 -0
- package/artifacts/graphql/client.js +33 -21
- package/artifacts/graphql/client.ts +38 -23
- package/artifacts/index.d.ts +2 -2
- package/artifacts/index.js +6 -6
- package/artifacts/index.ts +8 -8
- package/artifacts/rest.d.ts +22 -0
- package/artifacts/rest.js +35 -0
- package/artifacts/rest.ts +63 -0
- package/artifacts/retry.js +8 -3
- package/artifacts/retry.ts +8 -3
- package/package.json +9 -1
- package/sdk/types.gen.d.ts +13 -1
- package/sdk/types.gen.ts +13 -1
- package/types.gen.d.ts +13 -1
- package/types.gen.ts +13 -1
|
@@ -6,6 +6,7 @@ const graphql_request_1 = require("graphql-request");
|
|
|
6
6
|
const sdk_gen_1 = require("../sdk.gen");
|
|
7
7
|
const client_1 = require("./graphql/client");
|
|
8
8
|
const graphql_1 = require("./graphql/generated/graphql");
|
|
9
|
+
const rest_1 = require("./rest");
|
|
9
10
|
// Re-export the structured GraphQL error type so consumers importing
|
|
10
11
|
// from the `@robosystems/client/ledger` subpath can `instanceof` it.
|
|
11
12
|
var client_2 = require("./graphql/client");
|
|
@@ -32,10 +33,7 @@ class LedgerClient {
|
|
|
32
33
|
* Returns the updated entity.
|
|
33
34
|
*/
|
|
34
35
|
async updateEntity(graphId, updates) {
|
|
35
|
-
const envelope = await this.callOperation('Update entity', (0, sdk_gen_1.updateEntity)({
|
|
36
|
-
path: { graph_id: graphId },
|
|
37
|
-
body: updates,
|
|
38
|
-
}));
|
|
36
|
+
const envelope = await this.callOperation('Update entity', (o) => (0, sdk_gen_1.updateEntity)({ ...o, path: { graph_id: graphId }, body: updates }));
|
|
39
37
|
// The REST envelope carries LedgerEntityResponse (snake_case); LedgerEntity
|
|
40
38
|
// is the GraphQL camelCase shape that getEntity returns. The old
|
|
41
39
|
// `as unknown as` cast asserted one was the other, so every multi-word
|
|
@@ -188,7 +186,7 @@ class LedgerClient {
|
|
|
188
186
|
* Idempotent — returns existing linkage if already present.
|
|
189
187
|
*/
|
|
190
188
|
async linkEntityTaxonomy(graphId, body) {
|
|
191
|
-
const envelope = await this.callOperation('Link entity taxonomy', (0, sdk_gen_1.linkEntityTaxonomy)({ path: { graph_id: graphId }, body }));
|
|
189
|
+
const envelope = await this.callOperation('Link entity taxonomy', (o) => (0, sdk_gen_1.linkEntityTaxonomy)({ ...o, path: { graph_id: graphId }, body }));
|
|
192
190
|
return this.requireResult('Link entity taxonomy', envelope.result);
|
|
193
191
|
}
|
|
194
192
|
/**
|
|
@@ -196,18 +194,21 @@ class LedgerClient {
|
|
|
196
194
|
* associations + rules in one envelope).
|
|
197
195
|
*/
|
|
198
196
|
async createTaxonomyBlock(graphId, body, idempotencyKey) {
|
|
199
|
-
const
|
|
200
|
-
|
|
197
|
+
const envelope = await this.callOperation('Create taxonomy block', (o) => (0, sdk_gen_1.createTaxonomyBlock)({
|
|
198
|
+
...(0, rest_1.withIdempotencyKey)(o, idempotencyKey),
|
|
199
|
+
path: { graph_id: graphId },
|
|
200
|
+
body,
|
|
201
|
+
}));
|
|
201
202
|
return this.requireResult('Create taxonomy block', envelope.result);
|
|
202
203
|
}
|
|
203
204
|
/** Update a taxonomy block — add/update/remove elements, structures, associations, or rules. */
|
|
204
205
|
async updateTaxonomyBlock(graphId, body) {
|
|
205
|
-
const envelope = await this.callOperation('Update taxonomy block', (0, sdk_gen_1.updateTaxonomyBlock)({ path: { graph_id: graphId }, body }));
|
|
206
|
+
const envelope = await this.callOperation('Update taxonomy block', (o) => (0, sdk_gen_1.updateTaxonomyBlock)({ ...o, path: { graph_id: graphId }, body }));
|
|
206
207
|
return this.requireResult('Update taxonomy block', envelope.result);
|
|
207
208
|
}
|
|
208
209
|
/** Delete a taxonomy block. Cascades through elements, structures, and associations. */
|
|
209
210
|
async deleteTaxonomyBlock(graphId, body) {
|
|
210
|
-
const envelope = await this.callOperation('Delete taxonomy block', (0, sdk_gen_1.deleteTaxonomyBlock)({ path: { graph_id: graphId }, body }));
|
|
211
|
+
const envelope = await this.callOperation('Delete taxonomy block', (o) => (0, sdk_gen_1.deleteTaxonomyBlock)({ ...o, path: { graph_id: graphId }, body }));
|
|
211
212
|
return (envelope.result ?? { deleted: true });
|
|
212
213
|
}
|
|
213
214
|
/**
|
|
@@ -217,8 +218,7 @@ class LedgerClient {
|
|
|
217
218
|
* (`replaced: true` in the response).
|
|
218
219
|
*/
|
|
219
220
|
async bindTextBlock(graphId, body, idempotencyKey) {
|
|
220
|
-
const
|
|
221
|
-
const envelope = await this.callOperation('Bind text block', (0, sdk_gen_1.bindTextBlock)({ path: { graph_id: graphId }, body, headers }));
|
|
221
|
+
const envelope = await this.callOperation('Bind text block', (o) => (0, sdk_gen_1.bindTextBlock)({ ...(0, rest_1.withIdempotencyKey)(o, idempotencyKey), path: { graph_id: graphId }, body }));
|
|
222
222
|
return this.requireResult('Bind text block', envelope.result);
|
|
223
223
|
}
|
|
224
224
|
/** List elements (CoA accounts, GAAP concepts, etc.) with filters. */
|
|
@@ -274,12 +274,12 @@ class LedgerClient {
|
|
|
274
274
|
}
|
|
275
275
|
/** Create a manual mapping association between two elements. */
|
|
276
276
|
async createMappingAssociation(graphId, body) {
|
|
277
|
-
const envelope = await this.callOperation('Create mapping association', (0, sdk_gen_1.createMappingAssociation)({ path: { graph_id: graphId }, body }));
|
|
277
|
+
const envelope = await this.callOperation('Create mapping association', (o) => (0, sdk_gen_1.createMappingAssociation)({ ...o, path: { graph_id: graphId }, body }));
|
|
278
278
|
return this.requireResult('Create mapping association', envelope.result);
|
|
279
279
|
}
|
|
280
280
|
/** Delete a mapping association. */
|
|
281
281
|
async deleteMappingAssociation(graphId, body) {
|
|
282
|
-
const envelope = await this.callOperation('Delete mapping association', (0, sdk_gen_1.deleteMappingAssociation)({ path: { graph_id: graphId }, body }));
|
|
282
|
+
const envelope = await this.callOperation('Delete mapping association', (o) => (0, sdk_gen_1.deleteMappingAssociation)({ ...o, path: { graph_id: graphId }, body }));
|
|
283
283
|
return (envelope.result ?? { deleted: true });
|
|
284
284
|
}
|
|
285
285
|
/**
|
|
@@ -288,7 +288,7 @@ class LedgerClient {
|
|
|
288
288
|
* via `/v1/operations/{operationId}/stream`.
|
|
289
289
|
*/
|
|
290
290
|
async autoMapElements(graphId, body) {
|
|
291
|
-
const envelope = await this.callOperation('Auto-map elements', (0, sdk_gen_1.autoMapElements)({ path: { graph_id: graphId }, body }));
|
|
291
|
+
const envelope = await this.callOperation('Auto-map elements', (o) => (0, sdk_gen_1.autoMapElements)({ ...o, path: { graph_id: graphId }, body }));
|
|
292
292
|
return { operationId: envelope.operationId, status: envelope.status };
|
|
293
293
|
}
|
|
294
294
|
// ── Information Blocks ─────────────────────────────────────────────
|
|
@@ -351,7 +351,6 @@ class LedgerClient {
|
|
|
351
351
|
return blocks ?? [];
|
|
352
352
|
}
|
|
353
353
|
// ── Schedules ──────────────────────────────────────────────────────
|
|
354
|
-
/** Create a new schedule with pre-generated monthly facts. */
|
|
355
354
|
/**
|
|
356
355
|
* Create an Information Block of any registered block_type.
|
|
357
356
|
*
|
|
@@ -363,12 +362,10 @@ class LedgerClient {
|
|
|
363
362
|
* generic entry.
|
|
364
363
|
*/
|
|
365
364
|
async createInformationBlock(graphId, body, options) {
|
|
366
|
-
const envelope = await this.callOperation('Create information block', (0, sdk_gen_1.createInformationBlock)({
|
|
365
|
+
const envelope = await this.callOperation('Create information block', (o) => (0, sdk_gen_1.createInformationBlock)({
|
|
366
|
+
...(0, rest_1.withIdempotencyKey)(o, options?.idempotencyKey),
|
|
367
367
|
path: { graph_id: graphId },
|
|
368
368
|
body,
|
|
369
|
-
headers: options?.idempotencyKey
|
|
370
|
-
? { 'Idempotency-Key': options.idempotencyKey }
|
|
371
|
-
: undefined,
|
|
372
369
|
}));
|
|
373
370
|
return this.requireResult('Create information block', envelope.result);
|
|
374
371
|
}
|
|
@@ -377,7 +374,7 @@ class LedgerClient {
|
|
|
377
374
|
* `update-information-block`.
|
|
378
375
|
*/
|
|
379
376
|
async updateInformationBlock(graphId, body) {
|
|
380
|
-
const envelope = await this.callOperation('Update information block', (0, sdk_gen_1.updateInformationBlock)({ path: { graph_id: graphId }, body }));
|
|
377
|
+
const envelope = await this.callOperation('Update information block', (o) => (0, sdk_gen_1.updateInformationBlock)({ ...o, path: { graph_id: graphId }, body }));
|
|
381
378
|
return this.requireResult('Update information block', envelope.result);
|
|
382
379
|
}
|
|
383
380
|
/**
|
|
@@ -386,9 +383,10 @@ class LedgerClient {
|
|
|
386
383
|
* associations tied to the block.
|
|
387
384
|
*/
|
|
388
385
|
async deleteInformationBlock(graphId, body) {
|
|
389
|
-
const envelope = await this.callOperation('Delete information block', (0, sdk_gen_1.deleteInformationBlock)({ path: { graph_id: graphId }, body }));
|
|
386
|
+
const envelope = await this.callOperation('Delete information block', (o) => (0, sdk_gen_1.deleteInformationBlock)({ ...o, path: { graph_id: graphId }, body }));
|
|
390
387
|
return (envelope.result ?? { deleted: true });
|
|
391
388
|
}
|
|
389
|
+
/** Create a new schedule with pre-generated monthly facts. */
|
|
392
390
|
async createSchedule(graphId, options) {
|
|
393
391
|
const body = {
|
|
394
392
|
block_type: 'schedule',
|
|
@@ -417,7 +415,7 @@ class LedgerClient {
|
|
|
417
415
|
: undefined,
|
|
418
416
|
},
|
|
419
417
|
};
|
|
420
|
-
const envelope = await this.callOperation('Create schedule', (0, sdk_gen_1.createInformationBlock)({ path: { graph_id: graphId }, body }));
|
|
418
|
+
const envelope = await this.callOperation('Create schedule', (o) => (0, sdk_gen_1.createInformationBlock)({ ...o, path: { graph_id: graphId }, body }));
|
|
421
419
|
// `create-information-block` returns an InformationBlockEnvelope, not the
|
|
422
420
|
// ScheduleCreatedResponse shape this used to decode — there is no
|
|
423
421
|
// `structure_id` / `total_periods` / `total_facts` / `rule_summary` on the
|
|
@@ -433,13 +431,16 @@ class LedgerClient {
|
|
|
433
431
|
totalFacts: block.facts?.length ?? null,
|
|
434
432
|
};
|
|
435
433
|
}
|
|
436
|
-
/**
|
|
434
|
+
/**
|
|
435
|
+
* Rename a schedule. For other block fields use `updateInformationBlock`
|
|
436
|
+
* with a `schedule` payload.
|
|
437
|
+
*/
|
|
437
438
|
async updateSchedule(graphId, structureId, options) {
|
|
438
439
|
const body = {
|
|
439
440
|
block_type: 'schedule',
|
|
440
441
|
payload: { structure_id: structureId, ...options },
|
|
441
442
|
};
|
|
442
|
-
const envelope = await this.callOperation('Update schedule', (0, sdk_gen_1.updateInformationBlock)({ path: { graph_id: graphId }, body }));
|
|
443
|
+
const envelope = await this.callOperation('Update schedule', (o) => (0, sdk_gen_1.updateInformationBlock)({ ...o, path: { graph_id: graphId }, body }));
|
|
443
444
|
return this.requireResult('Update schedule', envelope.result);
|
|
444
445
|
}
|
|
445
446
|
/** Permanently delete a schedule (cascades through facts + associations). */
|
|
@@ -448,7 +449,7 @@ class LedgerClient {
|
|
|
448
449
|
block_type: 'schedule',
|
|
449
450
|
payload: { structure_id: structureId },
|
|
450
451
|
};
|
|
451
|
-
const envelope = await this.callOperation('Delete schedule', (0, sdk_gen_1.deleteInformationBlock)({ path: { graph_id: graphId }, body }));
|
|
452
|
+
const envelope = await this.callOperation('Delete schedule', (o) => (0, sdk_gen_1.deleteInformationBlock)({ ...o, path: { graph_id: graphId }, body }));
|
|
452
453
|
return (envelope.result ?? { deleted: true });
|
|
453
454
|
}
|
|
454
455
|
/**
|
|
@@ -462,16 +463,15 @@ class LedgerClient {
|
|
|
462
463
|
* a rebuild re-scopes the schedule to today's close state. Use this to
|
|
463
464
|
* pick up a fixed generator without orphaning obligations.
|
|
464
465
|
*
|
|
465
|
-
* Returns the
|
|
466
|
+
* Returns the {@link ScheduleCreated} rebuild summary (periods, facts,
|
|
467
|
+
* rule results) — richer than `createSchedule`'s {@link ScheduleBlockCreated}.
|
|
466
468
|
*/
|
|
467
469
|
async rebuildSchedule(graphId, structureId, options) {
|
|
468
470
|
const body = { structure_id: structureId };
|
|
469
|
-
const envelope = await this.callOperation('Rebuild schedule', (0, sdk_gen_1.rebuildSchedule)({
|
|
471
|
+
const envelope = await this.callOperation('Rebuild schedule', (o) => (0, sdk_gen_1.rebuildSchedule)({
|
|
472
|
+
...(0, rest_1.withIdempotencyKey)(o, options?.idempotencyKey),
|
|
470
473
|
path: { graph_id: graphId },
|
|
471
474
|
body,
|
|
472
|
-
headers: options?.idempotencyKey
|
|
473
|
-
? { 'Idempotency-Key': options.idempotencyKey }
|
|
474
|
-
: undefined,
|
|
475
475
|
}));
|
|
476
476
|
const raw = envelope.result;
|
|
477
477
|
return {
|
|
@@ -508,12 +508,12 @@ class LedgerClient {
|
|
|
508
508
|
reason: options.reason ?? 'asset_disposed_event',
|
|
509
509
|
},
|
|
510
510
|
};
|
|
511
|
-
const envelope = await this.callOperation('Dispose schedule', (0, sdk_gen_1.createEventBlock)({ path: { graph_id: graphId }, body }));
|
|
511
|
+
const envelope = await this.callOperation('Dispose schedule', (o) => (0, sdk_gen_1.createEventBlock)({ ...o, path: { graph_id: graphId }, body }));
|
|
512
512
|
return this.requireResult('Dispose schedule', envelope.result);
|
|
513
513
|
}
|
|
514
514
|
/** Evaluate taxonomy rules against facts in a structure. */
|
|
515
515
|
async evaluateRules(graphId, body) {
|
|
516
|
-
const envelope = await this.callOperation('Evaluate rules', (0, sdk_gen_1.evaluateRules)({ path: { graph_id: graphId }, body }));
|
|
516
|
+
const envelope = await this.callOperation('Evaluate rules', (o) => (0, sdk_gen_1.evaluateRules)({ ...o, path: { graph_id: graphId }, body }));
|
|
517
517
|
return this.requireResult('Evaluate rules', envelope.result);
|
|
518
518
|
}
|
|
519
519
|
/**
|
|
@@ -525,12 +525,10 @@ class LedgerClient {
|
|
|
525
525
|
* reason rather than failing the run.
|
|
526
526
|
*/
|
|
527
527
|
async computeMetrics(graphId, body, options) {
|
|
528
|
-
const envelope = await this.callOperation('Compute metrics', (0, sdk_gen_1.computeMetrics)({
|
|
528
|
+
const envelope = await this.callOperation('Compute metrics', (o) => (0, sdk_gen_1.computeMetrics)({
|
|
529
|
+
...(0, rest_1.withIdempotencyKey)(o, options?.idempotencyKey),
|
|
529
530
|
path: { graph_id: graphId },
|
|
530
531
|
body,
|
|
531
|
-
headers: options?.idempotencyKey
|
|
532
|
-
? { 'Idempotency-Key': options.idempotencyKey }
|
|
533
|
-
: undefined,
|
|
534
532
|
}));
|
|
535
533
|
return this.requireResult('Compute metrics', envelope.result);
|
|
536
534
|
}
|
|
@@ -568,7 +566,7 @@ class LedgerClient {
|
|
|
568
566
|
memo: memo ?? null,
|
|
569
567
|
},
|
|
570
568
|
};
|
|
571
|
-
const envelope = await this.callOperation('Create closing entry', (0, sdk_gen_1.createEventBlock)({ path: { graph_id: graphId }, body }));
|
|
569
|
+
const envelope = await this.callOperation('Create closing entry', (o) => (0, sdk_gen_1.createEventBlock)({ ...o, path: { graph_id: graphId }, body }));
|
|
572
570
|
return this.requireResult('Create closing entry', envelope.result);
|
|
573
571
|
}
|
|
574
572
|
// ── Closing book ───────────────────────────────────────────────────
|
|
@@ -590,7 +588,7 @@ class LedgerClient {
|
|
|
590
588
|
auto_seed_schedules: options?.autoSeedSchedules,
|
|
591
589
|
note: options?.note ?? null,
|
|
592
590
|
};
|
|
593
|
-
const envelope = await this.callOperation('Initialize ledger', (0, sdk_gen_1.initializeLedger)({ path: { graph_id: graphId }, body }));
|
|
591
|
+
const envelope = await this.callOperation('Initialize ledger', (o) => (0, sdk_gen_1.initializeLedger)({ ...o, path: { graph_id: graphId }, body }));
|
|
594
592
|
const raw = envelope.result;
|
|
595
593
|
return {
|
|
596
594
|
fiscalCalendar: rawFiscalCalendarToCamel(raw.fiscal_calendar),
|
|
@@ -615,7 +613,7 @@ class LedgerClient {
|
|
|
615
613
|
entity_type: options?.entityType ?? null,
|
|
616
614
|
name: options?.name ?? null,
|
|
617
615
|
};
|
|
618
|
-
const envelope = await this.callOperation('Initialize chart of accounts', (0, sdk_gen_1.initializeChartOfAccounts)({ path: { graph_id: graphId }, body }));
|
|
616
|
+
const envelope = await this.callOperation('Initialize chart of accounts', (o) => (0, sdk_gen_1.initializeChartOfAccounts)({ ...o, path: { graph_id: graphId }, body }));
|
|
619
617
|
const raw = envelope.result;
|
|
620
618
|
return {
|
|
621
619
|
taxonomyId: raw.taxonomy_id,
|
|
@@ -631,7 +629,7 @@ class LedgerClient {
|
|
|
631
629
|
/** Set the user-controlled close target (YYYY-MM). */
|
|
632
630
|
async setCloseTarget(graphId, period, note) {
|
|
633
631
|
const body = { period, note: note ?? null };
|
|
634
|
-
const envelope = await this.callOperation('Set close target', (0, sdk_gen_1.setCloseTarget)({ path: { graph_id: graphId }, body }));
|
|
632
|
+
const envelope = await this.callOperation('Set close target', (o) => (0, sdk_gen_1.setCloseTarget)({ ...o, path: { graph_id: graphId }, body }));
|
|
635
633
|
return rawFiscalCalendarToCamel(envelope.result);
|
|
636
634
|
}
|
|
637
635
|
/** Close a fiscal period — the final commit action. */
|
|
@@ -645,7 +643,7 @@ class LedgerClient {
|
|
|
645
643
|
allow_reconciling_items: options?.allowReconcilingItems,
|
|
646
644
|
allow_unposted_source_events: options?.allowUnpostedSourceEvents,
|
|
647
645
|
};
|
|
648
|
-
const envelope = await this.callOperation('Close period', (0, sdk_gen_1.closePeriod)({ path: { graph_id: graphId }, body }));
|
|
646
|
+
const envelope = await this.callOperation('Close period', (o) => (0, sdk_gen_1.closePeriod)({ ...o, path: { graph_id: graphId }, body }));
|
|
649
647
|
const raw = envelope.result;
|
|
650
648
|
return {
|
|
651
649
|
period: raw.period,
|
|
@@ -665,7 +663,7 @@ class LedgerClient {
|
|
|
665
663
|
reason,
|
|
666
664
|
note: note ?? null,
|
|
667
665
|
};
|
|
668
|
-
const envelope = await this.callOperation('Reopen period', (0, sdk_gen_1.reopenPeriod)({ path: { graph_id: graphId }, body }));
|
|
666
|
+
const envelope = await this.callOperation('Reopen period', (o) => (0, sdk_gen_1.reopenPeriod)({ ...o, path: { graph_id: graphId }, body }));
|
|
669
667
|
return rawFiscalCalendarToCamel(envelope.result);
|
|
670
668
|
}
|
|
671
669
|
// ── Reconciliations ─────────────────────────────────────────────────
|
|
@@ -682,17 +680,19 @@ class LedgerClient {
|
|
|
682
680
|
* List the items with `listEventBlocks(graphId, { isReconcilingItem: true })`.
|
|
683
681
|
*/
|
|
684
682
|
async previewReconcilingItem(graphId, eventId) {
|
|
685
|
-
const envelope = await this.callOperation('Preview reconciling item', (0, sdk_gen_1.previewReconcilingItem)({ path: { graph_id: graphId }, body: { event_id: eventId } }));
|
|
683
|
+
const envelope = await this.callOperation('Preview reconciling item', (o) => (0, sdk_gen_1.previewReconcilingItem)({ ...o, path: { graph_id: graphId }, body: { event_id: eventId } }));
|
|
686
684
|
return this.requireResult('Preview reconciling item', envelope.result);
|
|
687
685
|
}
|
|
688
686
|
/**
|
|
689
687
|
* Decide one reconciling item: `restate` the affected months, `catch_up`
|
|
690
688
|
* with an entry in the open period, or `acknowledge` that it was handled
|
|
691
689
|
* elsewhere (a note is required). Omit `disposition` to take the default
|
|
692
|
-
* the preview reports.
|
|
690
|
+
* the preview reports. Pass the preview's `drift_detected_at` as
|
|
691
|
+
* `expected_drift_detected_at`: the resolution is refused when the item
|
|
692
|
+
* was flagged again since, and must be previewed again.
|
|
693
693
|
*/
|
|
694
694
|
async resolveReconcilingItem(graphId, body) {
|
|
695
|
-
const envelope = await this.callOperation('Resolve reconciling item', (0, sdk_gen_1.resolveReconcilingItem)({ path: { graph_id: graphId }, body }));
|
|
695
|
+
const envelope = await this.callOperation('Resolve reconciling item', (o) => (0, sdk_gen_1.resolveReconcilingItem)({ ...o, path: { graph_id: graphId }, body }));
|
|
696
696
|
return this.requireResult('Resolve reconciling item', envelope.result);
|
|
697
697
|
}
|
|
698
698
|
/**
|
|
@@ -701,7 +701,7 @@ class LedgerClient {
|
|
|
701
701
|
* closes. Safe to repeat.
|
|
702
702
|
*/
|
|
703
703
|
async promoteObligations(graphId, body = {}) {
|
|
704
|
-
const envelope = await this.callOperation('Promote obligations', (0, sdk_gen_1.promoteObligations)({ path: { graph_id: graphId }, body }));
|
|
704
|
+
const envelope = await this.callOperation('Promote obligations', (o) => (0, sdk_gen_1.promoteObligations)({ ...o, path: { graph_id: graphId }, body }));
|
|
705
705
|
return this.requireResult('Promote obligations', envelope.result);
|
|
706
706
|
}
|
|
707
707
|
/** Compare the ledger with something outside it. Records nothing. */
|
|
@@ -711,7 +711,7 @@ class LedgerClient {
|
|
|
711
711
|
method: options?.method,
|
|
712
712
|
include_tied: options?.includeTied,
|
|
713
713
|
};
|
|
714
|
-
const envelope = await this.callOperation('Preview reconciliations', (0, sdk_gen_1.previewReconciliations)({ path: { graph_id: graphId }, body }));
|
|
714
|
+
const envelope = await this.callOperation('Preview reconciliations', (o) => (0, sdk_gen_1.previewReconciliations)({ ...o, path: { graph_id: graphId }, body }));
|
|
715
715
|
return reconciliationPreviewToCamel(envelope.result);
|
|
716
716
|
}
|
|
717
717
|
/**
|
|
@@ -720,7 +720,7 @@ class LedgerClient {
|
|
|
720
720
|
*/
|
|
721
721
|
async refreshReconciliations(graphId, period) {
|
|
722
722
|
const body = { period };
|
|
723
|
-
const envelope = await this.callOperation('Refresh reconciliations', (0, sdk_gen_1.refreshReconciliations)({ path: { graph_id: graphId }, body }));
|
|
723
|
+
const envelope = await this.callOperation('Refresh reconciliations', (o) => (0, sdk_gen_1.refreshReconciliations)({ ...o, path: { graph_id: graphId }, body }));
|
|
724
724
|
return reconciliationListToCamel(envelope.result);
|
|
725
725
|
}
|
|
726
726
|
/**
|
|
@@ -735,7 +735,7 @@ class LedgerClient {
|
|
|
735
735
|
document_id: input.documentId ?? null,
|
|
736
736
|
note: input.note ?? null,
|
|
737
737
|
};
|
|
738
|
-
const envelope = await this.callOperation('Record statement balance', (0, sdk_gen_1.recordStatementBalance)({ path: { graph_id: graphId }, body }));
|
|
738
|
+
const envelope = await this.callOperation('Record statement balance', (o) => (0, sdk_gen_1.recordStatementBalance)({ ...o, path: { graph_id: graphId }, body }));
|
|
739
739
|
return reconciliationSummaryToCamel(envelope.result);
|
|
740
740
|
}
|
|
741
741
|
/** Change how much the close cares about one reconciliation. */
|
|
@@ -747,7 +747,7 @@ class LedgerClient {
|
|
|
747
747
|
review_required: changes.reviewRequired,
|
|
748
748
|
separate_reviewer: changes.separateReviewer,
|
|
749
749
|
};
|
|
750
|
-
const envelope = await this.callOperation('Set reconciliation policy', (0, sdk_gen_1.setReconciliationPolicy)({ path: { graph_id: graphId }, body }));
|
|
750
|
+
const envelope = await this.callOperation('Set reconciliation policy', (o) => (0, sdk_gen_1.setReconciliationPolicy)({ ...o, path: { graph_id: graphId }, body }));
|
|
751
751
|
const raw = envelope.result;
|
|
752
752
|
return {
|
|
753
753
|
structureId: raw.structure_id,
|
|
@@ -767,7 +767,7 @@ class LedgerClient {
|
|
|
767
767
|
period,
|
|
768
768
|
note: note ?? null,
|
|
769
769
|
};
|
|
770
|
-
const envelope = await this.callOperation('Sign off reconciliation', (0, sdk_gen_1.signOffReconciliation)({ path: { graph_id: graphId }, body }));
|
|
770
|
+
const envelope = await this.callOperation('Sign off reconciliation', (o) => (0, sdk_gen_1.signOffReconciliation)({ ...o, path: { graph_id: graphId }, body }));
|
|
771
771
|
return reconciliationSummaryToCamel(envelope.result);
|
|
772
772
|
}
|
|
773
773
|
// ── Journal entries (native accounting writes) ──────────────────────
|
|
@@ -807,21 +807,22 @@ class LedgerClient {
|
|
|
807
807
|
transaction_id: options.transactionId ?? null,
|
|
808
808
|
},
|
|
809
809
|
};
|
|
810
|
-
const
|
|
811
|
-
|
|
812
|
-
:
|
|
813
|
-
|
|
810
|
+
const envelope = await this.callOperation('Create journal entry', (o) => (0, sdk_gen_1.createEventBlock)({
|
|
811
|
+
...(0, rest_1.withIdempotencyKey)(o, options.idempotencyKey),
|
|
812
|
+
path: { graph_id: graphId },
|
|
813
|
+
body,
|
|
814
|
+
}));
|
|
814
815
|
return this.requireResult('Create journal entry', envelope.result);
|
|
815
816
|
}
|
|
816
817
|
/** Update a draft journal entry. Posted entries are immutable. */
|
|
817
818
|
async updateJournalEntry(graphId, body) {
|
|
818
|
-
const envelope = await this.callOperation('Update journal entry', (0, sdk_gen_1.updateJournalEntry)({ path: { graph_id: graphId }, body }));
|
|
819
|
+
const envelope = await this.callOperation('Update journal entry', (o) => (0, sdk_gen_1.updateJournalEntry)({ ...o, path: { graph_id: graphId }, body }));
|
|
819
820
|
return this.requireResult('Update journal entry', envelope.result);
|
|
820
821
|
}
|
|
821
822
|
/** Hard-delete a draft journal entry. Posted entries must be reversed. */
|
|
822
823
|
async deleteJournalEntry(graphId, entryId) {
|
|
823
824
|
const body = { entry_id: entryId };
|
|
824
|
-
const envelope = await this.callOperation('Delete journal entry', (0, sdk_gen_1.deleteJournalEntry)({ path: { graph_id: graphId }, body }));
|
|
825
|
+
const envelope = await this.callOperation('Delete journal entry', (o) => (0, sdk_gen_1.deleteJournalEntry)({ ...o, path: { graph_id: graphId }, body }));
|
|
825
826
|
return (envelope.result ?? { deleted: true });
|
|
826
827
|
}
|
|
827
828
|
/**
|
|
@@ -847,10 +848,29 @@ class LedgerClient {
|
|
|
847
848
|
reason: options?.reason ?? null,
|
|
848
849
|
},
|
|
849
850
|
};
|
|
850
|
-
const envelope = await this.callOperation('Reverse journal entry', (0, sdk_gen_1.createEventBlock)({ path: { graph_id: graphId }, body }));
|
|
851
|
+
const envelope = await this.callOperation('Reverse journal entry', (o) => (0, sdk_gen_1.createEventBlock)({ ...o, path: { graph_id: graphId }, body }));
|
|
851
852
|
return this.requireResult('Reverse journal entry', envelope.result);
|
|
852
853
|
}
|
|
853
854
|
// ── Event blocks (generic preview + status transitions) ──────────────
|
|
855
|
+
/**
|
|
856
|
+
* Create an event block directly. Use for support-class events
|
|
857
|
+
* (`event_class: 'support'`) with categories `approval`, `control`,
|
|
858
|
+
* `reconciliation`, or `inquiry`, which the specialized helpers don't
|
|
859
|
+
* cover. Economic events should generally go through
|
|
860
|
+
* `createJournalEntry`, `createClosingEntry`, etc., but this works for
|
|
861
|
+
* those too.
|
|
862
|
+
*
|
|
863
|
+
* Supply `idempotencyKey` to make the call safe to retry — replays
|
|
864
|
+
* within 24 hours return the same envelope.
|
|
865
|
+
*/
|
|
866
|
+
async createEventBlock(graphId, body, idempotencyKey) {
|
|
867
|
+
const envelope = await this.callOperation('Create event block', (o) => (0, sdk_gen_1.createEventBlock)({
|
|
868
|
+
...(0, rest_1.withIdempotencyKey)(o, idempotencyKey),
|
|
869
|
+
path: { graph_id: graphId },
|
|
870
|
+
body,
|
|
871
|
+
}));
|
|
872
|
+
return this.requireResult('Create event block', envelope.result);
|
|
873
|
+
}
|
|
854
874
|
/**
|
|
855
875
|
* Dry-run an event block — resolve the handler, evaluate metadata, and
|
|
856
876
|
* return the planned GL rows without writing anything. Companion to
|
|
@@ -860,7 +880,7 @@ class LedgerClient {
|
|
|
860
880
|
* handler would do.
|
|
861
881
|
*/
|
|
862
882
|
async previewEventBlock(graphId, body) {
|
|
863
|
-
const envelope = await this.callOperation('Preview event block', (0, sdk_gen_1.previewEventBlock)({ path: { graph_id: graphId }, body }));
|
|
883
|
+
const envelope = await this.callOperation('Preview event block', (o) => (0, sdk_gen_1.previewEventBlock)({ ...o, path: { graph_id: graphId }, body }));
|
|
864
884
|
return this.requireResult('Preview event block', envelope.result);
|
|
865
885
|
}
|
|
866
886
|
/**
|
|
@@ -870,7 +890,7 @@ class LedgerClient {
|
|
|
870
890
|
* `description` / `effective_at` / `metadata`.
|
|
871
891
|
*/
|
|
872
892
|
async updateEventBlock(graphId, body) {
|
|
873
|
-
const envelope = await this.callOperation('Update event block', (0, sdk_gen_1.updateEventBlock)({ path: { graph_id: graphId }, body }));
|
|
893
|
+
const envelope = await this.callOperation('Update event block', (o) => (0, sdk_gen_1.updateEventBlock)({ ...o, path: { graph_id: graphId }, body }));
|
|
874
894
|
return this.requireResult('Update event block', envelope.result);
|
|
875
895
|
}
|
|
876
896
|
// ── Agents (REA counterparties) ───────────────────────────────────────
|
|
@@ -881,8 +901,7 @@ class LedgerClient {
|
|
|
881
901
|
* idempotent at the DB level.
|
|
882
902
|
*/
|
|
883
903
|
async createAgent(graphId, body, idempotencyKey) {
|
|
884
|
-
const
|
|
885
|
-
const envelope = await this.callOperation('Create agent', (0, sdk_gen_1.createAgent)({ path: { graph_id: graphId }, body, headers }));
|
|
904
|
+
const envelope = await this.callOperation('Create agent', (o) => (0, sdk_gen_1.createAgent)({ ...(0, rest_1.withIdempotencyKey)(o, idempotencyKey), path: { graph_id: graphId }, body }));
|
|
886
905
|
return this.requireResult('Create agent', envelope.result);
|
|
887
906
|
}
|
|
888
907
|
/**
|
|
@@ -890,7 +909,7 @@ class LedgerClient {
|
|
|
890
909
|
* metadata object; all other fields replace.
|
|
891
910
|
*/
|
|
892
911
|
async updateAgent(graphId, body) {
|
|
893
|
-
const envelope = await this.callOperation('Update agent', (0, sdk_gen_1.updateAgent)({ path: { graph_id: graphId }, body }));
|
|
912
|
+
const envelope = await this.callOperation('Update agent', (o) => (0, sdk_gen_1.updateAgent)({ ...o, path: { graph_id: graphId }, body }));
|
|
894
913
|
return this.requireResult('Update agent', envelope.result);
|
|
895
914
|
}
|
|
896
915
|
// ── Event handlers (DSL handler registry) ────────────────────────────
|
|
@@ -901,7 +920,7 @@ class LedgerClient {
|
|
|
901
920
|
* `transaction_template` describing the GL rows to produce.
|
|
902
921
|
*/
|
|
903
922
|
async createEventHandler(graphId, body) {
|
|
904
|
-
const envelope = await this.callOperation('Create event handler', (0, sdk_gen_1.createEventHandler)({ path: { graph_id: graphId }, body }));
|
|
923
|
+
const envelope = await this.callOperation('Create event handler', (o) => (0, sdk_gen_1.createEventHandler)({ ...o, path: { graph_id: graphId }, body }));
|
|
905
924
|
return this.requireResult('Create event handler', envelope.result);
|
|
906
925
|
}
|
|
907
926
|
/**
|
|
@@ -909,7 +928,7 @@ class LedgerClient {
|
|
|
909
928
|
* AI-suggested handler from unapproved to active.
|
|
910
929
|
*/
|
|
911
930
|
async updateEventHandler(graphId, body) {
|
|
912
|
-
const envelope = await this.callOperation('Update event handler', (0, sdk_gen_1.updateEventHandler)({ path: { graph_id: graphId }, body }));
|
|
931
|
+
const envelope = await this.callOperation('Update event handler', (o) => (0, sdk_gen_1.updateEventHandler)({ ...o, path: { graph_id: graphId }, body }));
|
|
913
932
|
return this.requireResult('Update event handler', envelope.result);
|
|
914
933
|
}
|
|
915
934
|
// ── Financial statements (graph-backed) ──────────────────────────────
|
|
@@ -920,7 +939,7 @@ class LedgerClient {
|
|
|
920
939
|
* dashboards.
|
|
921
940
|
*/
|
|
922
941
|
async liveFinancialStatement(graphId, body) {
|
|
923
|
-
const envelope = await this.callOperation('Live financial statement', (0, sdk_gen_1.liveFinancialStatement)({ path: { graph_id: graphId }, body }));
|
|
942
|
+
const envelope = await this.callOperation('Live financial statement', (o) => (0, sdk_gen_1.liveFinancialStatement)({ ...o, path: { graph_id: graphId }, body }));
|
|
924
943
|
return this.requireResult('Live financial statement', envelope.result);
|
|
925
944
|
}
|
|
926
945
|
/**
|
|
@@ -930,7 +949,7 @@ class LedgerClient {
|
|
|
930
949
|
* server auto-resolve via `fiscal_year` + `period_type`.
|
|
931
950
|
*/
|
|
932
951
|
async financialStatementAnalysis(graphId, body) {
|
|
933
|
-
const envelope = await this.callOperation('Financial statement analysis', (0, sdk_gen_1.financialStatementAnalysis)({ path: { graph_id: graphId }, body }));
|
|
952
|
+
const envelope = await this.callOperation('Financial statement analysis', (o) => (0, sdk_gen_1.financialStatementAnalysis)({ ...o, path: { graph_id: graphId }, body }));
|
|
934
953
|
return this.requireResult('Financial statement analysis', envelope.result);
|
|
935
954
|
}
|
|
936
955
|
// ── Fact grid (graph-backed analytical query) ─────────────────────
|
|
@@ -942,7 +961,7 @@ class LedgerClient {
|
|
|
942
961
|
* tenant graphs (after materialization) and the SEC shared repository.
|
|
943
962
|
*/
|
|
944
963
|
async buildFactGrid(graphId, body) {
|
|
945
|
-
const envelope = await this.callOperation('Build fact grid', (0, sdk_gen_1.buildFactGrid)({ path: { graph_id: graphId }, body }));
|
|
964
|
+
const envelope = await this.callOperation('Build fact grid', (o) => (0, sdk_gen_1.buildFactGrid)({ ...o, path: { graph_id: graphId }, body }));
|
|
946
965
|
return this.requireResult('Build fact grid', envelope.result);
|
|
947
966
|
}
|
|
948
967
|
// ── Reports, statements, and publish lists ──────────────────────────────
|
|
@@ -987,7 +1006,7 @@ class LedgerClient {
|
|
|
987
1006
|
if (options.periods && options.periods.length > 0) {
|
|
988
1007
|
body.periods = options.periods;
|
|
989
1008
|
}
|
|
990
|
-
const envelope = await this.callOperation('Create report', (0, sdk_gen_1.createReport)({ path: { graph_id: graphId }, body }));
|
|
1009
|
+
const envelope = await this.callOperation('Create report', (o) => (0, sdk_gen_1.createReport)({ ...o, path: { graph_id: graphId }, body }));
|
|
991
1010
|
return this.requireResult('Create report', envelope.result);
|
|
992
1011
|
}
|
|
993
1012
|
/**
|
|
@@ -1027,7 +1046,8 @@ class LedgerClient {
|
|
|
1027
1046
|
* header.
|
|
1028
1047
|
*/
|
|
1029
1048
|
async regenerateReport(graphId, reportId, periodStart, periodEnd) {
|
|
1030
|
-
const envelope = await this.callOperation('Regenerate report', (0, sdk_gen_1.regenerateReport)({
|
|
1049
|
+
const envelope = await this.callOperation('Regenerate report', (o) => (0, sdk_gen_1.regenerateReport)({
|
|
1050
|
+
...o,
|
|
1031
1051
|
path: { graph_id: graphId },
|
|
1032
1052
|
body: {
|
|
1033
1053
|
report_id: reportId,
|
|
@@ -1039,10 +1059,7 @@ class LedgerClient {
|
|
|
1039
1059
|
}
|
|
1040
1060
|
/** Delete a report and its generated facts. */
|
|
1041
1061
|
async deleteReport(graphId, reportId) {
|
|
1042
|
-
const envelope = await this.callOperation('Delete report', (0, sdk_gen_1.deleteReport)({
|
|
1043
|
-
path: { graph_id: graphId },
|
|
1044
|
-
body: { report_id: reportId },
|
|
1045
|
-
}));
|
|
1062
|
+
const envelope = await this.callOperation('Delete report', (o) => (0, sdk_gen_1.deleteReport)({ ...o, path: { graph_id: graphId }, body: { report_id: reportId } }));
|
|
1046
1063
|
return (envelope.result ?? { deleted: true });
|
|
1047
1064
|
}
|
|
1048
1065
|
/**
|
|
@@ -1095,7 +1112,8 @@ class LedgerClient {
|
|
|
1095
1112
|
* `results` list.
|
|
1096
1113
|
*/
|
|
1097
1114
|
async shareReport(graphId, reportId, publishListId) {
|
|
1098
|
-
const envelope = await this.callOperation('Share report', (0, sdk_gen_1.shareReport)({
|
|
1115
|
+
const envelope = await this.callOperation('Share report', (o) => (0, sdk_gen_1.shareReport)({
|
|
1116
|
+
...o,
|
|
1099
1117
|
path: { graph_id: graphId },
|
|
1100
1118
|
body: {
|
|
1101
1119
|
report_id: reportId,
|
|
@@ -1112,7 +1130,7 @@ class LedgerClient {
|
|
|
1112
1130
|
*/
|
|
1113
1131
|
async fileReport(graphId, reportId) {
|
|
1114
1132
|
const body = { report_id: reportId };
|
|
1115
|
-
const envelope = await this.callOperation('File report', (0, sdk_gen_1.fileReport)({ path: { graph_id: graphId }, body }));
|
|
1133
|
+
const envelope = await this.callOperation('File report', (o) => (0, sdk_gen_1.fileReport)({ ...o, path: { graph_id: graphId }, body }));
|
|
1116
1134
|
return this.requireResult('File report', envelope.result);
|
|
1117
1135
|
}
|
|
1118
1136
|
/**
|
|
@@ -1127,7 +1145,7 @@ class LedgerClient {
|
|
|
1127
1145
|
report_id: reportId,
|
|
1128
1146
|
target_status: targetStatus,
|
|
1129
1147
|
};
|
|
1130
|
-
const envelope = await this.callOperation('Transition filing status', (0, sdk_gen_1.transitionFilingStatus)({ path: { graph_id: graphId }, body }));
|
|
1148
|
+
const envelope = await this.callOperation('Transition filing status', (o) => (0, sdk_gen_1.transitionFilingStatus)({ ...o, path: { graph_id: graphId }, body }));
|
|
1131
1149
|
return this.requireResult('Transition filing status', envelope.result);
|
|
1132
1150
|
}
|
|
1133
1151
|
/** Check if a report was received via sharing (vs locally created). */
|
|
@@ -1148,7 +1166,8 @@ class LedgerClient {
|
|
|
1148
1166
|
* investor's declared holding survives the withdrawal.
|
|
1149
1167
|
*/
|
|
1150
1168
|
async revokeReportShare(graphId, reportId, targetGraphId) {
|
|
1151
|
-
const envelope = await this.callOperation('Revoke report share', (0, sdk_gen_1.revokeReportShare)({
|
|
1169
|
+
const envelope = await this.callOperation('Revoke report share', (o) => (0, sdk_gen_1.revokeReportShare)({
|
|
1170
|
+
...o,
|
|
1152
1171
|
path: { graph_id: graphId },
|
|
1153
1172
|
body: {
|
|
1154
1173
|
report_id: reportId,
|
|
@@ -1182,7 +1201,8 @@ class LedgerClient {
|
|
|
1182
1201
|
* and is never disclosed to the sender.
|
|
1183
1202
|
*/
|
|
1184
1203
|
async blockSourceGraph(graphId, sourceGraphId, options) {
|
|
1185
|
-
const envelope = await this.callOperation('Block source graph', (0, sdk_gen_1.blockSourceGraph)({
|
|
1204
|
+
const envelope = await this.callOperation('Block source graph', (o) => (0, sdk_gen_1.blockSourceGraph)({
|
|
1205
|
+
...o,
|
|
1186
1206
|
path: { graph_id: graphId },
|
|
1187
1207
|
body: {
|
|
1188
1208
|
source_graph_id: sourceGraphId,
|
|
@@ -1199,7 +1219,8 @@ class LedgerClient {
|
|
|
1199
1219
|
* reopens the channel, it does not undo.
|
|
1200
1220
|
*/
|
|
1201
1221
|
async unblockSourceGraph(graphId, sourceGraphId) {
|
|
1202
|
-
const envelope = await this.callOperation('Unblock source graph', (0, sdk_gen_1.unblockSourceGraph)({
|
|
1222
|
+
const envelope = await this.callOperation('Unblock source graph', (o) => (0, sdk_gen_1.unblockSourceGraph)({
|
|
1223
|
+
...o,
|
|
1203
1224
|
path: { graph_id: graphId },
|
|
1204
1225
|
body: {
|
|
1205
1226
|
source_graph_id: sourceGraphId,
|
|
@@ -1222,7 +1243,7 @@ class LedgerClient {
|
|
|
1222
1243
|
name,
|
|
1223
1244
|
description: description ?? null,
|
|
1224
1245
|
};
|
|
1225
|
-
const envelope = await this.callOperation('Create publish list', (0, sdk_gen_1.createPublishList)({ path: { graph_id: graphId }, body }));
|
|
1246
|
+
const envelope = await this.callOperation('Create publish list', (o) => (0, sdk_gen_1.createPublishList)({ ...o, path: { graph_id: graphId }, body }));
|
|
1226
1247
|
return this.requireResult('Create publish list', envelope.result);
|
|
1227
1248
|
}
|
|
1228
1249
|
/** Get a single publish list with its full member list. */
|
|
@@ -1231,27 +1252,25 @@ class LedgerClient {
|
|
|
1231
1252
|
}
|
|
1232
1253
|
/** Update a publish list's name or description. */
|
|
1233
1254
|
async updatePublishList(graphId, listId, updates) {
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
}));
|
|
1255
|
+
// The server applies only the fields present, so an omitted key must
|
|
1256
|
+
// stay off the wire; an explicit `description: null` still clears it.
|
|
1257
|
+
const body = { list_id: listId };
|
|
1258
|
+
if (updates.name !== undefined)
|
|
1259
|
+
body.name = updates.name;
|
|
1260
|
+
if (updates.description !== undefined)
|
|
1261
|
+
body.description = updates.description;
|
|
1262
|
+
const envelope = await this.callOperation('Update publish list', (o) => (0, sdk_gen_1.updatePublishList)({ ...o, path: { graph_id: graphId }, body }));
|
|
1242
1263
|
return this.requireResult('Update publish list', envelope.result);
|
|
1243
1264
|
}
|
|
1244
1265
|
/** Delete a publish list. */
|
|
1245
1266
|
async deletePublishList(graphId, listId) {
|
|
1246
|
-
const envelope = await this.callOperation('Delete publish list', (0, sdk_gen_1.deletePublishList)({
|
|
1247
|
-
path: { graph_id: graphId },
|
|
1248
|
-
body: { list_id: listId },
|
|
1249
|
-
}));
|
|
1267
|
+
const envelope = await this.callOperation('Delete publish list', (o) => (0, sdk_gen_1.deletePublishList)({ ...o, path: { graph_id: graphId }, body: { list_id: listId } }));
|
|
1250
1268
|
return (envelope.result ?? { deleted: true });
|
|
1251
1269
|
}
|
|
1252
1270
|
/** Add target graphs as members of a publish list. */
|
|
1253
1271
|
async addPublishListMembers(graphId, listId, targetGraphIds) {
|
|
1254
|
-
const envelope = await this.callOperation('Add publish list members', (0, sdk_gen_1.addPublishListMembers)({
|
|
1272
|
+
const envelope = await this.callOperation('Add publish list members', (o) => (0, sdk_gen_1.addPublishListMembers)({
|
|
1273
|
+
...o,
|
|
1255
1274
|
path: { graph_id: graphId },
|
|
1256
1275
|
body: {
|
|
1257
1276
|
list_id: listId,
|
|
@@ -1262,7 +1281,8 @@ class LedgerClient {
|
|
|
1262
1281
|
}
|
|
1263
1282
|
/** Remove a single member from a publish list. */
|
|
1264
1283
|
async removePublishListMember(graphId, listId, memberId) {
|
|
1265
|
-
const envelope = await this.callOperation('Remove publish list member', (0, sdk_gen_1.removePublishListMember)({
|
|
1284
|
+
const envelope = await this.callOperation('Remove publish list member', (o) => (0, sdk_gen_1.removePublishListMember)({
|
|
1285
|
+
...o,
|
|
1266
1286
|
path: { graph_id: graphId },
|
|
1267
1287
|
body: { list_id: listId, member_id: memberId },
|
|
1268
1288
|
}));
|
|
@@ -1270,8 +1290,9 @@ class LedgerClient {
|
|
|
1270
1290
|
}
|
|
1271
1291
|
// ── Internal helpers ────────────────────────────────────────────────
|
|
1272
1292
|
/**
|
|
1273
|
-
*
|
|
1274
|
-
*
|
|
1293
|
+
* Run an SDK-generated command call with this facade's per-call
|
|
1294
|
+
* transport options (`baseUrl`, credential, headers), throw a readable
|
|
1295
|
+
* error on non-2xx, and return the parsed envelope on success.
|
|
1275
1296
|
*
|
|
1276
1297
|
* Generic over the SDK call's response shape so typed ops (e.g.
|
|
1277
1298
|
* `createEventBlock`, which returns
|
|
@@ -1280,7 +1301,7 @@ class LedgerClient {
|
|
|
1280
1301
|
* ops continue to land as `OperationEnvelope` automatically.
|
|
1281
1302
|
*/
|
|
1282
1303
|
async callOperation(label, call) {
|
|
1283
|
-
const response = await call;
|
|
1304
|
+
const response = await call(await (0, rest_1.restCallOptions)(this.config));
|
|
1284
1305
|
if (response.error !== undefined) {
|
|
1285
1306
|
throw new Error(`${label} failed: ${JSON.stringify(response.error)}`);
|
|
1286
1307
|
}
|
|
@@ -1300,32 +1321,6 @@ class LedgerClient {
|
|
|
1300
1321
|
}
|
|
1301
1322
|
return result;
|
|
1302
1323
|
}
|
|
1303
|
-
/**
|
|
1304
|
-
* Resolve the current bearer token / API key for non-GraphQL REST
|
|
1305
|
-
* calls. Mirrors the GraphQL client's behaviour — dynamic
|
|
1306
|
-
* ``tokenProvider`` is consulted first (so JWT rotation flows
|
|
1307
|
-
* naturally), then the static ``token`` config. Returns ``null``
|
|
1308
|
-
* when no credential is configured (cookie-based / anonymous flows).
|
|
1309
|
-
* A ``tokenProvider`` that **throws** fails the call fast instead of
|
|
1310
|
-
* silently proceeding unauthenticated — matching the Python client,
|
|
1311
|
-
* which raises when its configured credential cannot be resolved.
|
|
1312
|
-
*/
|
|
1313
|
-
async resolveToken() {
|
|
1314
|
-
if (this.config.tokenProvider) {
|
|
1315
|
-
let token;
|
|
1316
|
-
try {
|
|
1317
|
-
token = await this.config.tokenProvider();
|
|
1318
|
-
}
|
|
1319
|
-
catch (err) {
|
|
1320
|
-
const detail = err instanceof Error ? err.message : String(err);
|
|
1321
|
-
throw new Error(`RoboSystems SDK: tokenProvider threw while resolving the request credential (${detail}). ` +
|
|
1322
|
-
'Fix the tokenProvider passed in the client config (or via setSDKClientConfig) so it ' +
|
|
1323
|
-
'returns the current token, or null to send an unauthenticated (cookie-based) request.', { cause: err });
|
|
1324
|
-
}
|
|
1325
|
-
return token ?? null;
|
|
1326
|
-
}
|
|
1327
|
-
return this.config.token ?? null;
|
|
1328
|
-
}
|
|
1329
1324
|
}
|
|
1330
1325
|
exports.LedgerClient = LedgerClient;
|
|
1331
1326
|
// ── Module-private conversion helpers ─────────────────────────────────
|