@robosystems/client 2.5.3 → 2.6.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/artifacts/InvestorClient.d.ts +7 -1
- package/artifacts/InvestorClient.js +24 -14
- package/artifacts/InvestorClient.ts +46 -27
- package/artifacts/LedgerClient.d.ts +23 -17
- package/artifacts/LedgerClient.js +116 -123
- package/artifacts/LedgerClient.ts +180 -242
- 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 +29 -21
- package/artifacts/graphql/client.ts +34 -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 +27 -0
- package/artifacts/rest.ts +54 -0
- package/artifacts/retry.js +8 -3
- package/artifacts/retry.ts +8 -3
- package/package.json +9 -1
- package/sdk/types.gen.d.ts +7 -1
- package/sdk/types.gen.ts +7 -1
- package/types.gen.d.ts +7 -1
- package/types.gen.ts +7 -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,7 +680,7 @@ 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
|
/**
|
|
@@ -692,7 +690,7 @@ class LedgerClient {
|
|
|
692
690
|
* the preview reports.
|
|
693
691
|
*/
|
|
694
692
|
async resolveReconcilingItem(graphId, body) {
|
|
695
|
-
const envelope = await this.callOperation('Resolve reconciling item', (0, sdk_gen_1.resolveReconcilingItem)({ path: { graph_id: graphId }, body }));
|
|
693
|
+
const envelope = await this.callOperation('Resolve reconciling item', (o) => (0, sdk_gen_1.resolveReconcilingItem)({ ...o, path: { graph_id: graphId }, body }));
|
|
696
694
|
return this.requireResult('Resolve reconciling item', envelope.result);
|
|
697
695
|
}
|
|
698
696
|
/**
|
|
@@ -701,7 +699,7 @@ class LedgerClient {
|
|
|
701
699
|
* closes. Safe to repeat.
|
|
702
700
|
*/
|
|
703
701
|
async promoteObligations(graphId, body = {}) {
|
|
704
|
-
const envelope = await this.callOperation('Promote obligations', (0, sdk_gen_1.promoteObligations)({ path: { graph_id: graphId }, body }));
|
|
702
|
+
const envelope = await this.callOperation('Promote obligations', (o) => (0, sdk_gen_1.promoteObligations)({ ...o, path: { graph_id: graphId }, body }));
|
|
705
703
|
return this.requireResult('Promote obligations', envelope.result);
|
|
706
704
|
}
|
|
707
705
|
/** Compare the ledger with something outside it. Records nothing. */
|
|
@@ -711,7 +709,7 @@ class LedgerClient {
|
|
|
711
709
|
method: options?.method,
|
|
712
710
|
include_tied: options?.includeTied,
|
|
713
711
|
};
|
|
714
|
-
const envelope = await this.callOperation('Preview reconciliations', (0, sdk_gen_1.previewReconciliations)({ path: { graph_id: graphId }, body }));
|
|
712
|
+
const envelope = await this.callOperation('Preview reconciliations', (o) => (0, sdk_gen_1.previewReconciliations)({ ...o, path: { graph_id: graphId }, body }));
|
|
715
713
|
return reconciliationPreviewToCamel(envelope.result);
|
|
716
714
|
}
|
|
717
715
|
/**
|
|
@@ -720,7 +718,7 @@ class LedgerClient {
|
|
|
720
718
|
*/
|
|
721
719
|
async refreshReconciliations(graphId, period) {
|
|
722
720
|
const body = { period };
|
|
723
|
-
const envelope = await this.callOperation('Refresh reconciliations', (0, sdk_gen_1.refreshReconciliations)({ path: { graph_id: graphId }, body }));
|
|
721
|
+
const envelope = await this.callOperation('Refresh reconciliations', (o) => (0, sdk_gen_1.refreshReconciliations)({ ...o, path: { graph_id: graphId }, body }));
|
|
724
722
|
return reconciliationListToCamel(envelope.result);
|
|
725
723
|
}
|
|
726
724
|
/**
|
|
@@ -735,7 +733,7 @@ class LedgerClient {
|
|
|
735
733
|
document_id: input.documentId ?? null,
|
|
736
734
|
note: input.note ?? null,
|
|
737
735
|
};
|
|
738
|
-
const envelope = await this.callOperation('Record statement balance', (0, sdk_gen_1.recordStatementBalance)({ path: { graph_id: graphId }, body }));
|
|
736
|
+
const envelope = await this.callOperation('Record statement balance', (o) => (0, sdk_gen_1.recordStatementBalance)({ ...o, path: { graph_id: graphId }, body }));
|
|
739
737
|
return reconciliationSummaryToCamel(envelope.result);
|
|
740
738
|
}
|
|
741
739
|
/** Change how much the close cares about one reconciliation. */
|
|
@@ -747,7 +745,7 @@ class LedgerClient {
|
|
|
747
745
|
review_required: changes.reviewRequired,
|
|
748
746
|
separate_reviewer: changes.separateReviewer,
|
|
749
747
|
};
|
|
750
|
-
const envelope = await this.callOperation('Set reconciliation policy', (0, sdk_gen_1.setReconciliationPolicy)({ path: { graph_id: graphId }, body }));
|
|
748
|
+
const envelope = await this.callOperation('Set reconciliation policy', (o) => (0, sdk_gen_1.setReconciliationPolicy)({ ...o, path: { graph_id: graphId }, body }));
|
|
751
749
|
const raw = envelope.result;
|
|
752
750
|
return {
|
|
753
751
|
structureId: raw.structure_id,
|
|
@@ -767,7 +765,7 @@ class LedgerClient {
|
|
|
767
765
|
period,
|
|
768
766
|
note: note ?? null,
|
|
769
767
|
};
|
|
770
|
-
const envelope = await this.callOperation('Sign off reconciliation', (0, sdk_gen_1.signOffReconciliation)({ path: { graph_id: graphId }, body }));
|
|
768
|
+
const envelope = await this.callOperation('Sign off reconciliation', (o) => (0, sdk_gen_1.signOffReconciliation)({ ...o, path: { graph_id: graphId }, body }));
|
|
771
769
|
return reconciliationSummaryToCamel(envelope.result);
|
|
772
770
|
}
|
|
773
771
|
// ── Journal entries (native accounting writes) ──────────────────────
|
|
@@ -807,21 +805,22 @@ class LedgerClient {
|
|
|
807
805
|
transaction_id: options.transactionId ?? null,
|
|
808
806
|
},
|
|
809
807
|
};
|
|
810
|
-
const
|
|
811
|
-
|
|
812
|
-
:
|
|
813
|
-
|
|
808
|
+
const envelope = await this.callOperation('Create journal entry', (o) => (0, sdk_gen_1.createEventBlock)({
|
|
809
|
+
...(0, rest_1.withIdempotencyKey)(o, options.idempotencyKey),
|
|
810
|
+
path: { graph_id: graphId },
|
|
811
|
+
body,
|
|
812
|
+
}));
|
|
814
813
|
return this.requireResult('Create journal entry', envelope.result);
|
|
815
814
|
}
|
|
816
815
|
/** Update a draft journal entry. Posted entries are immutable. */
|
|
817
816
|
async updateJournalEntry(graphId, body) {
|
|
818
|
-
const envelope = await this.callOperation('Update journal entry', (0, sdk_gen_1.updateJournalEntry)({ path: { graph_id: graphId }, body }));
|
|
817
|
+
const envelope = await this.callOperation('Update journal entry', (o) => (0, sdk_gen_1.updateJournalEntry)({ ...o, path: { graph_id: graphId }, body }));
|
|
819
818
|
return this.requireResult('Update journal entry', envelope.result);
|
|
820
819
|
}
|
|
821
820
|
/** Hard-delete a draft journal entry. Posted entries must be reversed. */
|
|
822
821
|
async deleteJournalEntry(graphId, entryId) {
|
|
823
822
|
const body = { entry_id: entryId };
|
|
824
|
-
const envelope = await this.callOperation('Delete journal entry', (0, sdk_gen_1.deleteJournalEntry)({ path: { graph_id: graphId }, body }));
|
|
823
|
+
const envelope = await this.callOperation('Delete journal entry', (o) => (0, sdk_gen_1.deleteJournalEntry)({ ...o, path: { graph_id: graphId }, body }));
|
|
825
824
|
return (envelope.result ?? { deleted: true });
|
|
826
825
|
}
|
|
827
826
|
/**
|
|
@@ -847,10 +846,29 @@ class LedgerClient {
|
|
|
847
846
|
reason: options?.reason ?? null,
|
|
848
847
|
},
|
|
849
848
|
};
|
|
850
|
-
const envelope = await this.callOperation('Reverse journal entry', (0, sdk_gen_1.createEventBlock)({ path: { graph_id: graphId }, body }));
|
|
849
|
+
const envelope = await this.callOperation('Reverse journal entry', (o) => (0, sdk_gen_1.createEventBlock)({ ...o, path: { graph_id: graphId }, body }));
|
|
851
850
|
return this.requireResult('Reverse journal entry', envelope.result);
|
|
852
851
|
}
|
|
853
852
|
// ── Event blocks (generic preview + status transitions) ──────────────
|
|
853
|
+
/**
|
|
854
|
+
* Create an event block directly. Use for support-class events
|
|
855
|
+
* (`event_class: 'support'`) with categories `approval`, `control`,
|
|
856
|
+
* `reconciliation`, or `inquiry`, which the specialized helpers don't
|
|
857
|
+
* cover. Economic events should generally go through
|
|
858
|
+
* `createJournalEntry`, `createClosingEntry`, etc., but this works for
|
|
859
|
+
* those too.
|
|
860
|
+
*
|
|
861
|
+
* Supply `idempotencyKey` to make the call safe to retry — replays
|
|
862
|
+
* within 24 hours return the same envelope.
|
|
863
|
+
*/
|
|
864
|
+
async createEventBlock(graphId, body, idempotencyKey) {
|
|
865
|
+
const envelope = await this.callOperation('Create event block', (o) => (0, sdk_gen_1.createEventBlock)({
|
|
866
|
+
...(0, rest_1.withIdempotencyKey)(o, idempotencyKey),
|
|
867
|
+
path: { graph_id: graphId },
|
|
868
|
+
body,
|
|
869
|
+
}));
|
|
870
|
+
return this.requireResult('Create event block', envelope.result);
|
|
871
|
+
}
|
|
854
872
|
/**
|
|
855
873
|
* Dry-run an event block — resolve the handler, evaluate metadata, and
|
|
856
874
|
* return the planned GL rows without writing anything. Companion to
|
|
@@ -860,7 +878,7 @@ class LedgerClient {
|
|
|
860
878
|
* handler would do.
|
|
861
879
|
*/
|
|
862
880
|
async previewEventBlock(graphId, body) {
|
|
863
|
-
const envelope = await this.callOperation('Preview event block', (0, sdk_gen_1.previewEventBlock)({ path: { graph_id: graphId }, body }));
|
|
881
|
+
const envelope = await this.callOperation('Preview event block', (o) => (0, sdk_gen_1.previewEventBlock)({ ...o, path: { graph_id: graphId }, body }));
|
|
864
882
|
return this.requireResult('Preview event block', envelope.result);
|
|
865
883
|
}
|
|
866
884
|
/**
|
|
@@ -870,7 +888,7 @@ class LedgerClient {
|
|
|
870
888
|
* `description` / `effective_at` / `metadata`.
|
|
871
889
|
*/
|
|
872
890
|
async updateEventBlock(graphId, body) {
|
|
873
|
-
const envelope = await this.callOperation('Update event block', (0, sdk_gen_1.updateEventBlock)({ path: { graph_id: graphId }, body }));
|
|
891
|
+
const envelope = await this.callOperation('Update event block', (o) => (0, sdk_gen_1.updateEventBlock)({ ...o, path: { graph_id: graphId }, body }));
|
|
874
892
|
return this.requireResult('Update event block', envelope.result);
|
|
875
893
|
}
|
|
876
894
|
// ── Agents (REA counterparties) ───────────────────────────────────────
|
|
@@ -881,8 +899,7 @@ class LedgerClient {
|
|
|
881
899
|
* idempotent at the DB level.
|
|
882
900
|
*/
|
|
883
901
|
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 }));
|
|
902
|
+
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
903
|
return this.requireResult('Create agent', envelope.result);
|
|
887
904
|
}
|
|
888
905
|
/**
|
|
@@ -890,7 +907,7 @@ class LedgerClient {
|
|
|
890
907
|
* metadata object; all other fields replace.
|
|
891
908
|
*/
|
|
892
909
|
async updateAgent(graphId, body) {
|
|
893
|
-
const envelope = await this.callOperation('Update agent', (0, sdk_gen_1.updateAgent)({ path: { graph_id: graphId }, body }));
|
|
910
|
+
const envelope = await this.callOperation('Update agent', (o) => (0, sdk_gen_1.updateAgent)({ ...o, path: { graph_id: graphId }, body }));
|
|
894
911
|
return this.requireResult('Update agent', envelope.result);
|
|
895
912
|
}
|
|
896
913
|
// ── Event handlers (DSL handler registry) ────────────────────────────
|
|
@@ -901,7 +918,7 @@ class LedgerClient {
|
|
|
901
918
|
* `transaction_template` describing the GL rows to produce.
|
|
902
919
|
*/
|
|
903
920
|
async createEventHandler(graphId, body) {
|
|
904
|
-
const envelope = await this.callOperation('Create event handler', (0, sdk_gen_1.createEventHandler)({ path: { graph_id: graphId }, body }));
|
|
921
|
+
const envelope = await this.callOperation('Create event handler', (o) => (0, sdk_gen_1.createEventHandler)({ ...o, path: { graph_id: graphId }, body }));
|
|
905
922
|
return this.requireResult('Create event handler', envelope.result);
|
|
906
923
|
}
|
|
907
924
|
/**
|
|
@@ -909,7 +926,7 @@ class LedgerClient {
|
|
|
909
926
|
* AI-suggested handler from unapproved to active.
|
|
910
927
|
*/
|
|
911
928
|
async updateEventHandler(graphId, body) {
|
|
912
|
-
const envelope = await this.callOperation('Update event handler', (0, sdk_gen_1.updateEventHandler)({ path: { graph_id: graphId }, body }));
|
|
929
|
+
const envelope = await this.callOperation('Update event handler', (o) => (0, sdk_gen_1.updateEventHandler)({ ...o, path: { graph_id: graphId }, body }));
|
|
913
930
|
return this.requireResult('Update event handler', envelope.result);
|
|
914
931
|
}
|
|
915
932
|
// ── Financial statements (graph-backed) ──────────────────────────────
|
|
@@ -920,7 +937,7 @@ class LedgerClient {
|
|
|
920
937
|
* dashboards.
|
|
921
938
|
*/
|
|
922
939
|
async liveFinancialStatement(graphId, body) {
|
|
923
|
-
const envelope = await this.callOperation('Live financial statement', (0, sdk_gen_1.liveFinancialStatement)({ path: { graph_id: graphId }, body }));
|
|
940
|
+
const envelope = await this.callOperation('Live financial statement', (o) => (0, sdk_gen_1.liveFinancialStatement)({ ...o, path: { graph_id: graphId }, body }));
|
|
924
941
|
return this.requireResult('Live financial statement', envelope.result);
|
|
925
942
|
}
|
|
926
943
|
/**
|
|
@@ -930,7 +947,7 @@ class LedgerClient {
|
|
|
930
947
|
* server auto-resolve via `fiscal_year` + `period_type`.
|
|
931
948
|
*/
|
|
932
949
|
async financialStatementAnalysis(graphId, body) {
|
|
933
|
-
const envelope = await this.callOperation('Financial statement analysis', (0, sdk_gen_1.financialStatementAnalysis)({ path: { graph_id: graphId }, body }));
|
|
950
|
+
const envelope = await this.callOperation('Financial statement analysis', (o) => (0, sdk_gen_1.financialStatementAnalysis)({ ...o, path: { graph_id: graphId }, body }));
|
|
934
951
|
return this.requireResult('Financial statement analysis', envelope.result);
|
|
935
952
|
}
|
|
936
953
|
// ── Fact grid (graph-backed analytical query) ─────────────────────
|
|
@@ -942,7 +959,7 @@ class LedgerClient {
|
|
|
942
959
|
* tenant graphs (after materialization) and the SEC shared repository.
|
|
943
960
|
*/
|
|
944
961
|
async buildFactGrid(graphId, body) {
|
|
945
|
-
const envelope = await this.callOperation('Build fact grid', (0, sdk_gen_1.buildFactGrid)({ path: { graph_id: graphId }, body }));
|
|
962
|
+
const envelope = await this.callOperation('Build fact grid', (o) => (0, sdk_gen_1.buildFactGrid)({ ...o, path: { graph_id: graphId }, body }));
|
|
946
963
|
return this.requireResult('Build fact grid', envelope.result);
|
|
947
964
|
}
|
|
948
965
|
// ── Reports, statements, and publish lists ──────────────────────────────
|
|
@@ -987,7 +1004,7 @@ class LedgerClient {
|
|
|
987
1004
|
if (options.periods && options.periods.length > 0) {
|
|
988
1005
|
body.periods = options.periods;
|
|
989
1006
|
}
|
|
990
|
-
const envelope = await this.callOperation('Create report', (0, sdk_gen_1.createReport)({ path: { graph_id: graphId }, body }));
|
|
1007
|
+
const envelope = await this.callOperation('Create report', (o) => (0, sdk_gen_1.createReport)({ ...o, path: { graph_id: graphId }, body }));
|
|
991
1008
|
return this.requireResult('Create report', envelope.result);
|
|
992
1009
|
}
|
|
993
1010
|
/**
|
|
@@ -1027,7 +1044,8 @@ class LedgerClient {
|
|
|
1027
1044
|
* header.
|
|
1028
1045
|
*/
|
|
1029
1046
|
async regenerateReport(graphId, reportId, periodStart, periodEnd) {
|
|
1030
|
-
const envelope = await this.callOperation('Regenerate report', (0, sdk_gen_1.regenerateReport)({
|
|
1047
|
+
const envelope = await this.callOperation('Regenerate report', (o) => (0, sdk_gen_1.regenerateReport)({
|
|
1048
|
+
...o,
|
|
1031
1049
|
path: { graph_id: graphId },
|
|
1032
1050
|
body: {
|
|
1033
1051
|
report_id: reportId,
|
|
@@ -1039,10 +1057,7 @@ class LedgerClient {
|
|
|
1039
1057
|
}
|
|
1040
1058
|
/** Delete a report and its generated facts. */
|
|
1041
1059
|
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
|
-
}));
|
|
1060
|
+
const envelope = await this.callOperation('Delete report', (o) => (0, sdk_gen_1.deleteReport)({ ...o, path: { graph_id: graphId }, body: { report_id: reportId } }));
|
|
1046
1061
|
return (envelope.result ?? { deleted: true });
|
|
1047
1062
|
}
|
|
1048
1063
|
/**
|
|
@@ -1095,7 +1110,8 @@ class LedgerClient {
|
|
|
1095
1110
|
* `results` list.
|
|
1096
1111
|
*/
|
|
1097
1112
|
async shareReport(graphId, reportId, publishListId) {
|
|
1098
|
-
const envelope = await this.callOperation('Share report', (0, sdk_gen_1.shareReport)({
|
|
1113
|
+
const envelope = await this.callOperation('Share report', (o) => (0, sdk_gen_1.shareReport)({
|
|
1114
|
+
...o,
|
|
1099
1115
|
path: { graph_id: graphId },
|
|
1100
1116
|
body: {
|
|
1101
1117
|
report_id: reportId,
|
|
@@ -1112,7 +1128,7 @@ class LedgerClient {
|
|
|
1112
1128
|
*/
|
|
1113
1129
|
async fileReport(graphId, reportId) {
|
|
1114
1130
|
const body = { report_id: reportId };
|
|
1115
|
-
const envelope = await this.callOperation('File report', (0, sdk_gen_1.fileReport)({ path: { graph_id: graphId }, body }));
|
|
1131
|
+
const envelope = await this.callOperation('File report', (o) => (0, sdk_gen_1.fileReport)({ ...o, path: { graph_id: graphId }, body }));
|
|
1116
1132
|
return this.requireResult('File report', envelope.result);
|
|
1117
1133
|
}
|
|
1118
1134
|
/**
|
|
@@ -1127,7 +1143,7 @@ class LedgerClient {
|
|
|
1127
1143
|
report_id: reportId,
|
|
1128
1144
|
target_status: targetStatus,
|
|
1129
1145
|
};
|
|
1130
|
-
const envelope = await this.callOperation('Transition filing status', (0, sdk_gen_1.transitionFilingStatus)({ path: { graph_id: graphId }, body }));
|
|
1146
|
+
const envelope = await this.callOperation('Transition filing status', (o) => (0, sdk_gen_1.transitionFilingStatus)({ ...o, path: { graph_id: graphId }, body }));
|
|
1131
1147
|
return this.requireResult('Transition filing status', envelope.result);
|
|
1132
1148
|
}
|
|
1133
1149
|
/** Check if a report was received via sharing (vs locally created). */
|
|
@@ -1148,7 +1164,8 @@ class LedgerClient {
|
|
|
1148
1164
|
* investor's declared holding survives the withdrawal.
|
|
1149
1165
|
*/
|
|
1150
1166
|
async revokeReportShare(graphId, reportId, targetGraphId) {
|
|
1151
|
-
const envelope = await this.callOperation('Revoke report share', (0, sdk_gen_1.revokeReportShare)({
|
|
1167
|
+
const envelope = await this.callOperation('Revoke report share', (o) => (0, sdk_gen_1.revokeReportShare)({
|
|
1168
|
+
...o,
|
|
1152
1169
|
path: { graph_id: graphId },
|
|
1153
1170
|
body: {
|
|
1154
1171
|
report_id: reportId,
|
|
@@ -1182,7 +1199,8 @@ class LedgerClient {
|
|
|
1182
1199
|
* and is never disclosed to the sender.
|
|
1183
1200
|
*/
|
|
1184
1201
|
async blockSourceGraph(graphId, sourceGraphId, options) {
|
|
1185
|
-
const envelope = await this.callOperation('Block source graph', (0, sdk_gen_1.blockSourceGraph)({
|
|
1202
|
+
const envelope = await this.callOperation('Block source graph', (o) => (0, sdk_gen_1.blockSourceGraph)({
|
|
1203
|
+
...o,
|
|
1186
1204
|
path: { graph_id: graphId },
|
|
1187
1205
|
body: {
|
|
1188
1206
|
source_graph_id: sourceGraphId,
|
|
@@ -1199,7 +1217,8 @@ class LedgerClient {
|
|
|
1199
1217
|
* reopens the channel, it does not undo.
|
|
1200
1218
|
*/
|
|
1201
1219
|
async unblockSourceGraph(graphId, sourceGraphId) {
|
|
1202
|
-
const envelope = await this.callOperation('Unblock source graph', (0, sdk_gen_1.unblockSourceGraph)({
|
|
1220
|
+
const envelope = await this.callOperation('Unblock source graph', (o) => (0, sdk_gen_1.unblockSourceGraph)({
|
|
1221
|
+
...o,
|
|
1203
1222
|
path: { graph_id: graphId },
|
|
1204
1223
|
body: {
|
|
1205
1224
|
source_graph_id: sourceGraphId,
|
|
@@ -1222,7 +1241,7 @@ class LedgerClient {
|
|
|
1222
1241
|
name,
|
|
1223
1242
|
description: description ?? null,
|
|
1224
1243
|
};
|
|
1225
|
-
const envelope = await this.callOperation('Create publish list', (0, sdk_gen_1.createPublishList)({ path: { graph_id: graphId }, body }));
|
|
1244
|
+
const envelope = await this.callOperation('Create publish list', (o) => (0, sdk_gen_1.createPublishList)({ ...o, path: { graph_id: graphId }, body }));
|
|
1226
1245
|
return this.requireResult('Create publish list', envelope.result);
|
|
1227
1246
|
}
|
|
1228
1247
|
/** Get a single publish list with its full member list. */
|
|
@@ -1231,27 +1250,25 @@ class LedgerClient {
|
|
|
1231
1250
|
}
|
|
1232
1251
|
/** Update a publish list's name or description. */
|
|
1233
1252
|
async updatePublishList(graphId, listId, updates) {
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
}));
|
|
1253
|
+
// The server applies only the fields present, so an omitted key must
|
|
1254
|
+
// stay off the wire; an explicit `description: null` still clears it.
|
|
1255
|
+
const body = { list_id: listId };
|
|
1256
|
+
if (updates.name !== undefined)
|
|
1257
|
+
body.name = updates.name;
|
|
1258
|
+
if (updates.description !== undefined)
|
|
1259
|
+
body.description = updates.description;
|
|
1260
|
+
const envelope = await this.callOperation('Update publish list', (o) => (0, sdk_gen_1.updatePublishList)({ ...o, path: { graph_id: graphId }, body }));
|
|
1242
1261
|
return this.requireResult('Update publish list', envelope.result);
|
|
1243
1262
|
}
|
|
1244
1263
|
/** Delete a publish list. */
|
|
1245
1264
|
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
|
-
}));
|
|
1265
|
+
const envelope = await this.callOperation('Delete publish list', (o) => (0, sdk_gen_1.deletePublishList)({ ...o, path: { graph_id: graphId }, body: { list_id: listId } }));
|
|
1250
1266
|
return (envelope.result ?? { deleted: true });
|
|
1251
1267
|
}
|
|
1252
1268
|
/** Add target graphs as members of a publish list. */
|
|
1253
1269
|
async addPublishListMembers(graphId, listId, targetGraphIds) {
|
|
1254
|
-
const envelope = await this.callOperation('Add publish list members', (0, sdk_gen_1.addPublishListMembers)({
|
|
1270
|
+
const envelope = await this.callOperation('Add publish list members', (o) => (0, sdk_gen_1.addPublishListMembers)({
|
|
1271
|
+
...o,
|
|
1255
1272
|
path: { graph_id: graphId },
|
|
1256
1273
|
body: {
|
|
1257
1274
|
list_id: listId,
|
|
@@ -1262,7 +1279,8 @@ class LedgerClient {
|
|
|
1262
1279
|
}
|
|
1263
1280
|
/** Remove a single member from a publish list. */
|
|
1264
1281
|
async removePublishListMember(graphId, listId, memberId) {
|
|
1265
|
-
const envelope = await this.callOperation('Remove publish list member', (0, sdk_gen_1.removePublishListMember)({
|
|
1282
|
+
const envelope = await this.callOperation('Remove publish list member', (o) => (0, sdk_gen_1.removePublishListMember)({
|
|
1283
|
+
...o,
|
|
1266
1284
|
path: { graph_id: graphId },
|
|
1267
1285
|
body: { list_id: listId, member_id: memberId },
|
|
1268
1286
|
}));
|
|
@@ -1270,8 +1288,9 @@ class LedgerClient {
|
|
|
1270
1288
|
}
|
|
1271
1289
|
// ── Internal helpers ────────────────────────────────────────────────
|
|
1272
1290
|
/**
|
|
1273
|
-
*
|
|
1274
|
-
*
|
|
1291
|
+
* Run an SDK-generated command call with this facade's per-call
|
|
1292
|
+
* transport options (`baseUrl`, credential, headers), throw a readable
|
|
1293
|
+
* error on non-2xx, and return the parsed envelope on success.
|
|
1275
1294
|
*
|
|
1276
1295
|
* Generic over the SDK call's response shape so typed ops (e.g.
|
|
1277
1296
|
* `createEventBlock`, which returns
|
|
@@ -1280,7 +1299,7 @@ class LedgerClient {
|
|
|
1280
1299
|
* ops continue to land as `OperationEnvelope` automatically.
|
|
1281
1300
|
*/
|
|
1282
1301
|
async callOperation(label, call) {
|
|
1283
|
-
const response = await call;
|
|
1302
|
+
const response = await call(await (0, rest_1.restCallOptions)(this.config));
|
|
1284
1303
|
if (response.error !== undefined) {
|
|
1285
1304
|
throw new Error(`${label} failed: ${JSON.stringify(response.error)}`);
|
|
1286
1305
|
}
|
|
@@ -1300,32 +1319,6 @@ class LedgerClient {
|
|
|
1300
1319
|
}
|
|
1301
1320
|
return result;
|
|
1302
1321
|
}
|
|
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
1322
|
}
|
|
1330
1323
|
exports.LedgerClient = LedgerClient;
|
|
1331
1324
|
// ── Module-private conversion helpers ─────────────────────────────────
|