@robosystems/client 0.3.18 → 0.3.20
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.js +7 -2
- package/artifacts/InvestorClient.ts +10 -6
- package/artifacts/LedgerClient.d.ts +57 -48
- package/artifacts/LedgerClient.js +44 -25
- package/artifacts/LedgerClient.ts +122 -75
- package/artifacts/graphql/generated/graphql.d.ts +558 -0
- package/artifacts/graphql/generated/graphql.ts +558 -0
- package/index.ts +2 -2
- package/package.json +1 -1
- package/sdk/index.d.ts +2 -2
- package/sdk/index.js +5 -4
- package/sdk/index.ts +2 -2
- package/sdk/sdk.gen.d.ts +20 -14
- package/sdk/sdk.gen.js +31 -16
- package/sdk/sdk.gen.ts +29 -14
- package/sdk/types.gen.d.ts +6354 -1769
- package/sdk/types.gen.ts +5952 -1272
- package/sdk.gen.d.ts +20 -14
- package/sdk.gen.js +31 -16
- package/sdk.gen.ts +29 -14
- package/types.gen.d.ts +6354 -1769
- package/types.gen.ts +5952 -1272
|
@@ -63,7 +63,7 @@ class InvestorClient {
|
|
|
63
63
|
confirm_active_positions: options?.confirmActivePositions ?? false,
|
|
64
64
|
};
|
|
65
65
|
const envelope = await this.callOperation('Delete portfolio block', (0, sdk_gen_1.opDeletePortfolioBlock)({ path: { graph_id: graphId }, body }));
|
|
66
|
-
return
|
|
66
|
+
return envelope.result ?? { deleted: true };
|
|
67
67
|
}
|
|
68
68
|
// ── Securities ──────────────────────────────────────────────────────
|
|
69
69
|
/** List securities with pagination and filters. */
|
|
@@ -105,7 +105,7 @@ class InvestorClient {
|
|
|
105
105
|
path: { graph_id: graphId },
|
|
106
106
|
body: { security_id: securityId },
|
|
107
107
|
}));
|
|
108
|
-
return
|
|
108
|
+
return envelope.result ?? { deleted: true };
|
|
109
109
|
}
|
|
110
110
|
// ── Positions (reads only — writes folded into Portfolio Block) ─────
|
|
111
111
|
/** List positions with pagination and filters. */
|
|
@@ -146,6 +146,11 @@ class InvestorClient {
|
|
|
146
146
|
throw err;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
+
// Generic over the SDK call's response shape so typed ops (e.g.
|
|
150
|
+
// `opCreatePortfolioBlock`, which returns
|
|
151
|
+
// `OperationEnvelopePortfolioBlockEnvelope`) flow through with a typed
|
|
152
|
+
// `envelope.result` instead of being widened to `unknown`. Untyped ops
|
|
153
|
+
// continue to land as `OperationEnvelope` automatically.
|
|
149
154
|
async callOperation(label, call) {
|
|
150
155
|
const response = await call;
|
|
151
156
|
if (response.error !== undefined) {
|
|
@@ -36,7 +36,6 @@ import type {
|
|
|
36
36
|
CreatePortfolioBlockRequest,
|
|
37
37
|
CreateSecurityRequest,
|
|
38
38
|
DeletePortfolioBlockOperation,
|
|
39
|
-
OperationEnvelope,
|
|
40
39
|
PortfolioBlockPortfolioPatch,
|
|
41
40
|
PortfolioBlockPositions,
|
|
42
41
|
UpdatePortfolioBlockOperation,
|
|
@@ -206,7 +205,7 @@ export class InvestorClient {
|
|
|
206
205
|
'Delete portfolio block',
|
|
207
206
|
opDeletePortfolioBlock({ path: { graph_id: graphId }, body })
|
|
208
207
|
)
|
|
209
|
-
return
|
|
208
|
+
return envelope.result ?? { deleted: true }
|
|
210
209
|
}
|
|
211
210
|
|
|
212
211
|
// ── Securities ──────────────────────────────────────────────────────
|
|
@@ -288,7 +287,7 @@ export class InvestorClient {
|
|
|
288
287
|
body: { security_id: securityId },
|
|
289
288
|
})
|
|
290
289
|
)
|
|
291
|
-
return
|
|
290
|
+
return envelope.result ?? { deleted: true }
|
|
292
291
|
}
|
|
293
292
|
|
|
294
293
|
// ── Positions (reads only — writes folded into Portfolio Block) ─────
|
|
@@ -370,10 +369,15 @@ export class InvestorClient {
|
|
|
370
369
|
}
|
|
371
370
|
}
|
|
372
371
|
|
|
373
|
-
|
|
372
|
+
// Generic over the SDK call's response shape so typed ops (e.g.
|
|
373
|
+
// `opCreatePortfolioBlock`, which returns
|
|
374
|
+
// `OperationEnvelopePortfolioBlockEnvelope`) flow through with a typed
|
|
375
|
+
// `envelope.result` instead of being widened to `unknown`. Untyped ops
|
|
376
|
+
// continue to land as `OperationEnvelope` automatically.
|
|
377
|
+
private async callOperation<T>(
|
|
374
378
|
label: string,
|
|
375
|
-
call: Promise<{ data?:
|
|
376
|
-
): Promise<
|
|
379
|
+
call: Promise<{ data?: T; error?: unknown }>
|
|
380
|
+
): Promise<T> {
|
|
377
381
|
const response = await call
|
|
378
382
|
if (response.error !== undefined) {
|
|
379
383
|
throw new Error(`${label} failed: ${JSON.stringify(response.error)}`)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AutoMapElementsOperation, CreateAgentRequest, CreateEventBlockRequest, CreateEventHandlerRequest, CreateMappingAssociationOperation, CreateTaxonomyBlockRequest, CreateViewRequest, DeleteMappingAssociationOperation, DeleteTaxonomyBlockRequest, EvaluateRulesRequest, FinancialStatementAnalysisRequest, LinkEntityTaxonomyRequest, LiveFinancialStatementRequest, OperationEnvelope, UpdateAgentRequest, UpdateEntityRequest, UpdateEventBlockRequest, UpdateEventHandlerRequest, UpdateJournalEntryRequest, UpdateTaxonomyBlockRequest } from '../types.gen';
|
|
1
|
+
import type { AssociationResponse, AutoMapElementsOperation, CreateAgentRequest, CreateEventBlockRequest, CreateEventHandlerRequest, CreateMappingAssociationOperation, CreateTaxonomyBlockRequest, CreateViewRequest, DeleteInformationBlockResponse, DeleteMappingAssociationOperation, DeleteResult, DeleteTaxonomyBlockRequest, DeleteTaxonomyBlockResponse, EntityTaxonomyResponse, EvaluateRulesRequest, EvaluateRulesResponse, EventBlockEnvelope, EventHandlerResponse, FinancialStatementAnalysisRequest, InformationBlockEnvelope, JournalEntryResponse, LedgerAgentResponse, LinkEntityTaxonomyRequest, LiveFinancialStatementRequest, OperationEnvelope, PreviewEventBlockResponse, PublishListMemberResponse, PublishListResponse, ReportResponse, ShareReportResponse, TaxonomyBlockEnvelope, UpdateAgentRequest, UpdateEntityRequest, UpdateEventBlockRequest, UpdateEventHandlerRequest, UpdateJournalEntryRequest, UpdateTaxonomyBlockRequest } from '../types.gen';
|
|
2
2
|
import type { TokenProvider } from './graphql/client';
|
|
3
3
|
import { type GetInformationBlockQuery, type GetLedgerAccountRollupsQuery, type GetLedgerAccountTreeQuery, type GetLedgerAgentQuery, type GetLedgerClosingBookStructuresQuery, type GetLedgerEntityQuery, type GetLedgerEventBlockQuery, type GetLedgerFiscalCalendarQuery, type GetLedgerMappedTrialBalanceQuery, type GetLedgerMappingCoverageQuery, type GetLedgerMappingQuery, type GetLedgerPeriodCloseStatusQuery, type GetLedgerPeriodDraftsQuery, type GetLedgerPublishListQuery, type GetLedgerReportingTaxonomyQuery, type GetLedgerReportPackageQuery, type GetLedgerReportQuery, type GetLedgerStatementQuery, type GetLedgerSummaryQuery, type GetLedgerTransactionQuery, type GetLedgerTrialBalanceQuery, type ListInformationBlocksQuery, type ListLedgerAccountsQuery, type ListLedgerAgentsQuery, type ListLedgerElementsQuery, type ListLedgerEntitiesQuery, type ListLedgerEventBlocksQuery, type ListLedgerMappingsQuery, type ListLedgerPublishListsQuery, type ListLedgerReportsQuery, type ListLedgerStructuresQuery, type ListLedgerTaxonomiesQuery, type ListLedgerTransactionsQuery, type ListLedgerUnmappedElementsQuery } from './graphql/generated/graphql';
|
|
4
4
|
export type LedgerEntity = NonNullable<GetLedgerEntityQuery['entity']>;
|
|
@@ -67,10 +67,17 @@ export interface CreateReportOptions {
|
|
|
67
67
|
comparative?: boolean;
|
|
68
68
|
periods?: PeriodSpecInput[];
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Wrapper returned by report write methods — pairs the audit-side
|
|
72
|
+
* envelope fields (`operationId`, `status`) with the typed result
|
|
73
|
+
* payload. Generic on ``T`` so each method advertises its specific
|
|
74
|
+
* result type (e.g. ``ReportResponse`` for creates, ``DeleteResult``
|
|
75
|
+
* for deletes).
|
|
76
|
+
*/
|
|
77
|
+
export interface ReportOperationAck<T = unknown> {
|
|
71
78
|
operationId: string;
|
|
72
79
|
status: OperationEnvelope['status'];
|
|
73
|
-
result:
|
|
80
|
+
result: T | null;
|
|
74
81
|
}
|
|
75
82
|
export interface InitializeLedgerResult {
|
|
76
83
|
fiscalCalendar: LedgerFiscalCalendar;
|
|
@@ -252,18 +259,16 @@ export declare class LedgerClient {
|
|
|
252
259
|
* Link the graph's entity to a taxonomy (ENTITY_HAS_TAXONOMY edge).
|
|
253
260
|
* Idempotent — returns existing linkage if already present.
|
|
254
261
|
*/
|
|
255
|
-
linkEntityTaxonomy(graphId: string, body: LinkEntityTaxonomyRequest): Promise<
|
|
262
|
+
linkEntityTaxonomy(graphId: string, body: LinkEntityTaxonomyRequest): Promise<EntityTaxonomyResponse>;
|
|
256
263
|
/**
|
|
257
264
|
* Create a taxonomy block atomically (taxonomy + structures + elements +
|
|
258
265
|
* associations + rules in one envelope).
|
|
259
266
|
*/
|
|
260
|
-
createTaxonomyBlock(graphId: string, body: CreateTaxonomyBlockRequest, idempotencyKey?: string): Promise<
|
|
267
|
+
createTaxonomyBlock(graphId: string, body: CreateTaxonomyBlockRequest, idempotencyKey?: string): Promise<TaxonomyBlockEnvelope>;
|
|
261
268
|
/** Update a taxonomy block — add/update/remove elements, structures, associations, or rules. */
|
|
262
|
-
updateTaxonomyBlock(graphId: string, body: UpdateTaxonomyBlockRequest): Promise<
|
|
269
|
+
updateTaxonomyBlock(graphId: string, body: UpdateTaxonomyBlockRequest): Promise<TaxonomyBlockEnvelope>;
|
|
263
270
|
/** Delete a taxonomy block. Cascades through elements, structures, and associations. */
|
|
264
|
-
deleteTaxonomyBlock(graphId: string, body: DeleteTaxonomyBlockRequest): Promise<
|
|
265
|
-
deleted: boolean;
|
|
266
|
-
}>;
|
|
271
|
+
deleteTaxonomyBlock(graphId: string, body: DeleteTaxonomyBlockRequest): Promise<DeleteTaxonomyBlockResponse>;
|
|
267
272
|
/** List elements (CoA accounts, GAAP concepts, etc.) with filters. */
|
|
268
273
|
listElements(graphId: string, options?: {
|
|
269
274
|
taxonomyId?: string;
|
|
@@ -289,11 +294,9 @@ export declare class LedgerClient {
|
|
|
289
294
|
/** Mapping coverage stats — how many CoA elements are mapped. */
|
|
290
295
|
getMappingCoverage(graphId: string, mappingId: string): Promise<LedgerMappingCoverage | null>;
|
|
291
296
|
/** Create a manual mapping association between two elements. */
|
|
292
|
-
createMappingAssociation(graphId: string, body: CreateMappingAssociationOperation): Promise<
|
|
297
|
+
createMappingAssociation(graphId: string, body: CreateMappingAssociationOperation): Promise<AssociationResponse>;
|
|
293
298
|
/** Delete a mapping association. */
|
|
294
|
-
deleteMappingAssociation(graphId: string, body: DeleteMappingAssociationOperation): Promise<
|
|
295
|
-
deleted: boolean;
|
|
296
|
-
}>;
|
|
299
|
+
deleteMappingAssociation(graphId: string, body: DeleteMappingAssociationOperation): Promise<DeleteResult>;
|
|
297
300
|
/**
|
|
298
301
|
* Trigger the AI MappingAgent. Returns the operation id — async; the
|
|
299
302
|
* agent runs in the background. Consumers can subscribe to progress
|
|
@@ -325,11 +328,9 @@ export declare class LedgerClient {
|
|
|
325
328
|
/** Update mutable fields on a schedule (name, entry_template, metadata). */
|
|
326
329
|
updateSchedule(graphId: string, structureId: string, options: {
|
|
327
330
|
name?: string;
|
|
328
|
-
}): Promise<
|
|
331
|
+
}): Promise<InformationBlockEnvelope>;
|
|
329
332
|
/** Permanently delete a schedule (cascades through facts + associations). */
|
|
330
|
-
deleteSchedule(graphId: string, structureId: string): Promise<
|
|
331
|
-
deleted: boolean;
|
|
332
|
-
}>;
|
|
333
|
+
deleteSchedule(graphId: string, structureId: string): Promise<DeleteInformationBlockResponse>;
|
|
333
334
|
/**
|
|
334
335
|
* Dispose of a schedule asset — atomically truncates forward facts,
|
|
335
336
|
* deletes the SumEquals rule, and posts a balanced disposal entry.
|
|
@@ -345,9 +346,9 @@ export declare class LedgerClient {
|
|
|
345
346
|
gainLossElementId?: string | null;
|
|
346
347
|
memo?: string | null;
|
|
347
348
|
reason?: string;
|
|
348
|
-
}): Promise<
|
|
349
|
+
}): Promise<EventBlockEnvelope>;
|
|
349
350
|
/** Evaluate taxonomy rules against facts in a structure. */
|
|
350
|
-
evaluateRules(graphId: string, body: EvaluateRulesRequest): Promise<
|
|
351
|
+
evaluateRules(graphId: string, body: EvaluateRulesRequest): Promise<EvaluateRulesResponse>;
|
|
351
352
|
/** Close status for all schedules in a fiscal period. */
|
|
352
353
|
getPeriodCloseStatus(graphId: string, periodStart: string, periodEnd: string): Promise<LedgerPeriodCloseStatus | null>;
|
|
353
354
|
/** All draft entries in a period, fully expanded for review pre-close. */
|
|
@@ -361,7 +362,7 @@ export declare class LedgerClient {
|
|
|
361
362
|
* the underlying handler is idempotent and dispatches to one of
|
|
362
363
|
* created / unchanged / regenerated / removed / skipped internally.
|
|
363
364
|
*/
|
|
364
|
-
createClosingEntry(graphId: string, structureId: string, postingDate: string, periodStart: string, periodEnd: string, memo?: string): Promise<
|
|
365
|
+
createClosingEntry(graphId: string, structureId: string, postingDate: string, periodStart: string, periodEnd: string, memo?: string): Promise<EventBlockEnvelope>;
|
|
365
366
|
/** Grouped closing book structures for the close-screen sidebar. */
|
|
366
367
|
getClosingBookStructures(graphId: string): Promise<LedgerClosingBookStructures | null>;
|
|
367
368
|
/** Current fiscal calendar state — pointers, gap, closeable status. */
|
|
@@ -389,13 +390,11 @@ export declare class LedgerClient {
|
|
|
389
390
|
* Returns the EventBlockEnvelope (event row fields); query the ledger
|
|
390
391
|
* separately if you need the resulting entry_id.
|
|
391
392
|
*/
|
|
392
|
-
createJournalEntry(graphId: string, options: CreateJournalEntryOptions): Promise<
|
|
393
|
+
createJournalEntry(graphId: string, options: CreateJournalEntryOptions): Promise<EventBlockEnvelope>;
|
|
393
394
|
/** Update a draft journal entry. Posted entries are immutable. */
|
|
394
|
-
updateJournalEntry(graphId: string, body: UpdateJournalEntryRequest): Promise<
|
|
395
|
+
updateJournalEntry(graphId: string, body: UpdateJournalEntryRequest): Promise<JournalEntryResponse>;
|
|
395
396
|
/** Hard-delete a draft journal entry. Posted entries must be reversed. */
|
|
396
|
-
deleteJournalEntry(graphId: string, entryId: string): Promise<
|
|
397
|
-
deleted: boolean;
|
|
398
|
-
}>;
|
|
397
|
+
deleteJournalEntry(graphId: string, entryId: string): Promise<DeleteResult>;
|
|
399
398
|
/**
|
|
400
399
|
* Reverse a posted journal entry — creates an offsetting entry and marks
|
|
401
400
|
* the original as reversed.
|
|
@@ -407,7 +406,7 @@ export declare class LedgerClient {
|
|
|
407
406
|
postingDate?: string | null;
|
|
408
407
|
memo?: string | null;
|
|
409
408
|
reason?: string | null;
|
|
410
|
-
}): Promise<
|
|
409
|
+
}): Promise<EventBlockEnvelope>;
|
|
411
410
|
/**
|
|
412
411
|
* Dry-run an event block — resolve the handler, evaluate metadata, and
|
|
413
412
|
* return the planned GL rows without writing anything. Companion to
|
|
@@ -416,38 +415,38 @@ export declare class LedgerClient {
|
|
|
416
415
|
* (the underlying `CreateEventBlockRequest`) and inspect what the
|
|
417
416
|
* handler would do.
|
|
418
417
|
*/
|
|
419
|
-
previewEventBlock(graphId: string, body: CreateEventBlockRequest): Promise<
|
|
418
|
+
previewEventBlock(graphId: string, body: CreateEventBlockRequest): Promise<PreviewEventBlockResponse>;
|
|
420
419
|
/**
|
|
421
420
|
* Apply a status transition and/or field corrections to an existing
|
|
422
421
|
* event block. Use for posting drafts (`classified` → `committed` →
|
|
423
422
|
* `fulfilled`), voiding, superseding (correction chains), or patching
|
|
424
423
|
* `description` / `effective_at` / `metadata`.
|
|
425
424
|
*/
|
|
426
|
-
updateEventBlock(graphId: string, body: UpdateEventBlockRequest): Promise<
|
|
425
|
+
updateEventBlock(graphId: string, body: UpdateEventBlockRequest): Promise<EventBlockEnvelope>;
|
|
427
426
|
/**
|
|
428
427
|
* Create an agent — REA counterparty (customer, vendor, employee, etc.)
|
|
429
428
|
* referenced by event blocks via `agent_id`. `(source, external_id)` is
|
|
430
429
|
* unique when `external_id` is provided, so external-source ingestion is
|
|
431
430
|
* idempotent at the DB level.
|
|
432
431
|
*/
|
|
433
|
-
createAgent(graphId: string, body: CreateAgentRequest, idempotencyKey?: string): Promise<
|
|
432
|
+
createAgent(graphId: string, body: CreateAgentRequest, idempotencyKey?: string): Promise<LedgerAgentResponse>;
|
|
434
433
|
/**
|
|
435
434
|
* Update an agent. `metadata_patch` is a partial merge into the existing
|
|
436
435
|
* metadata object; all other fields replace.
|
|
437
436
|
*/
|
|
438
|
-
updateAgent(graphId: string, body: UpdateAgentRequest): Promise<
|
|
437
|
+
updateAgent(graphId: string, body: UpdateAgentRequest): Promise<LedgerAgentResponse>;
|
|
439
438
|
/**
|
|
440
439
|
* Register a tenant-configurable event handler — DSL row in the
|
|
441
440
|
* `event_handlers` table that drives `create-event-block` for event
|
|
442
441
|
* types not covered by a Python handler. Match selectors plus a
|
|
443
442
|
* `transaction_template` describing the GL rows to produce.
|
|
444
443
|
*/
|
|
445
|
-
createEventHandler(graphId: string, body: CreateEventHandlerRequest): Promise<
|
|
444
|
+
createEventHandler(graphId: string, body: CreateEventHandlerRequest): Promise<EventHandlerResponse>;
|
|
446
445
|
/**
|
|
447
446
|
* Update a registered event handler. Pass `approve: true` to flip an
|
|
448
447
|
* AI-suggested handler from unapproved to active.
|
|
449
448
|
*/
|
|
450
|
-
updateEventHandler(graphId: string, body: UpdateEventHandlerRequest): Promise<
|
|
449
|
+
updateEventHandler(graphId: string, body: UpdateEventHandlerRequest): Promise<EventHandlerResponse>;
|
|
451
450
|
/**
|
|
452
451
|
* Live financial statement — pulls facts directly from the graph for
|
|
453
452
|
* an explicit period window (or fiscal year) and returns the statement
|
|
@@ -479,7 +478,7 @@ export declare class LedgerClient {
|
|
|
479
478
|
* Kick off report creation (async). Use the returned `operationId` to
|
|
480
479
|
* subscribe to progress via SSE, then call `getReport()` once finished.
|
|
481
480
|
*/
|
|
482
|
-
createReport(graphId: string, options: CreateReportOptions): Promise<ReportOperationAck
|
|
481
|
+
createReport(graphId: string, options: CreateReportOptions): Promise<ReportOperationAck<ReportResponse>>;
|
|
483
482
|
/** List all reports for a graph (includes received shared reports). */
|
|
484
483
|
listReports(graphId: string): Promise<ReportListItem[]>;
|
|
485
484
|
/** Get a single report with its period list + available structures. */
|
|
@@ -501,26 +500,26 @@ export declare class LedgerClient {
|
|
|
501
500
|
* Regenerate an existing report (async). Returns an operation id;
|
|
502
501
|
* subscribe via SSE for progress.
|
|
503
502
|
*/
|
|
504
|
-
regenerateReport(graphId: string, reportId: string, periodStart?: string, periodEnd?: string): Promise<ReportOperationAck
|
|
503
|
+
regenerateReport(graphId: string, reportId: string, periodStart?: string, periodEnd?: string): Promise<ReportOperationAck<ReportResponse>>;
|
|
505
504
|
/** Delete a report and its generated facts. */
|
|
506
|
-
deleteReport(graphId: string, reportId: string): Promise<
|
|
505
|
+
deleteReport(graphId: string, reportId: string): Promise<DeleteResult>;
|
|
507
506
|
/**
|
|
508
|
-
* Share a published report to every member of a publish list
|
|
509
|
-
*
|
|
507
|
+
* Share a published report to every member of a publish list. Each
|
|
508
|
+
* target graph receives a snapshot copy of the report's facts.
|
|
510
509
|
*/
|
|
511
|
-
shareReport(graphId: string, reportId: string, publishListId: string): Promise<ReportOperationAck
|
|
510
|
+
shareReport(graphId: string, reportId: string, publishListId: string): Promise<ReportOperationAck<ShareReportResponse>>;
|
|
512
511
|
/**
|
|
513
512
|
* Transition a Report's filing_status to 'filed' — locks the package.
|
|
514
513
|
* Allowed from 'draft' or 'under_review'. Stamps filed_at + filed_by
|
|
515
514
|
* from the auth context + server clock.
|
|
516
515
|
*/
|
|
517
|
-
fileReport(graphId: string, reportId: string): Promise<ReportOperationAck
|
|
516
|
+
fileReport(graphId: string, reportId: string): Promise<ReportOperationAck<ReportResponse>>;
|
|
518
517
|
/**
|
|
519
518
|
* Move a Report along the non-file legs of the filing lifecycle
|
|
520
519
|
* (draft ↔ under_review, filed → archived). Use ``fileReport`` to
|
|
521
520
|
* reach 'filed' so the audit fields land cleanly.
|
|
522
521
|
*/
|
|
523
|
-
transitionFilingStatus(graphId: string, reportId: string, targetStatus: string): Promise<ReportOperationAck
|
|
522
|
+
transitionFilingStatus(graphId: string, reportId: string, targetStatus: string): Promise<ReportOperationAck<ReportResponse>>;
|
|
524
523
|
/** Check if a report was received via sharing (vs locally created). */
|
|
525
524
|
isSharedReport(report: Report): boolean;
|
|
526
525
|
/** List publish lists with pagination. */
|
|
@@ -529,26 +528,36 @@ export declare class LedgerClient {
|
|
|
529
528
|
offset?: number;
|
|
530
529
|
}): Promise<PublishList[]>;
|
|
531
530
|
/** Create a new publish list. */
|
|
532
|
-
createPublishList(graphId: string, name: string, description?: string): Promise<
|
|
531
|
+
createPublishList(graphId: string, name: string, description?: string): Promise<PublishListResponse>;
|
|
533
532
|
/** Get a single publish list with its full member list. */
|
|
534
533
|
getPublishList(graphId: string, listId: string): Promise<PublishListDetail | null>;
|
|
535
534
|
/** Update a publish list's name or description. */
|
|
536
535
|
updatePublishList(graphId: string, listId: string, updates: {
|
|
537
536
|
name?: string;
|
|
538
537
|
description?: string | null;
|
|
539
|
-
}): Promise<
|
|
538
|
+
}): Promise<PublishListResponse>;
|
|
540
539
|
/** Delete a publish list. */
|
|
541
|
-
deletePublishList(graphId: string, listId: string): Promise<
|
|
540
|
+
deletePublishList(graphId: string, listId: string): Promise<DeleteResult>;
|
|
542
541
|
/** Add target graphs as members of a publish list. */
|
|
543
|
-
addPublishListMembers(graphId: string, listId: string, targetGraphIds: string[]): Promise<
|
|
542
|
+
addPublishListMembers(graphId: string, listId: string, targetGraphIds: string[]): Promise<PublishListMemberResponse[]>;
|
|
544
543
|
/** Remove a single member from a publish list. */
|
|
545
|
-
removePublishListMember(graphId: string, listId: string, memberId: string): Promise<
|
|
546
|
-
deleted: boolean;
|
|
547
|
-
}>;
|
|
544
|
+
removePublishListMember(graphId: string, listId: string, memberId: string): Promise<DeleteResult>;
|
|
548
545
|
/**
|
|
549
546
|
* Await an SDK-generated `opXxx(...)` call, throw a readable error on
|
|
550
|
-
* non-2xx, and return the
|
|
547
|
+
* non-2xx, and return the parsed envelope on success.
|
|
548
|
+
*
|
|
549
|
+
* Generic over the SDK call's response shape so typed ops (e.g.
|
|
550
|
+
* `opCreateEventBlock`, which returns
|
|
551
|
+
* `OperationEnvelopeEventBlockEnvelope`) flow through with a typed
|
|
552
|
+
* `envelope.result` instead of being widened to `unknown`. Untyped
|
|
553
|
+
* ops continue to land as `OperationEnvelope` automatically.
|
|
551
554
|
*/
|
|
552
555
|
private callOperation;
|
|
556
|
+
/**
|
|
557
|
+
* Unwrap the typed result from an OperationEnvelope. Throws when the
|
|
558
|
+
* server returned an envelope with no `result` field — generally a
|
|
559
|
+
* sign that a synchronous operation failed silently.
|
|
560
|
+
*/
|
|
561
|
+
private requireResult;
|
|
553
562
|
}
|
|
554
563
|
export {};
|
|
@@ -150,7 +150,7 @@ class LedgerClient {
|
|
|
150
150
|
*/
|
|
151
151
|
async linkEntityTaxonomy(graphId, body) {
|
|
152
152
|
const envelope = await this.callOperation('Link entity taxonomy', (0, sdk_gen_1.opLinkEntityTaxonomy)({ path: { graph_id: graphId }, body }));
|
|
153
|
-
return (envelope.result
|
|
153
|
+
return this.requireResult('Link entity taxonomy', envelope.result);
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
156
|
* Create a taxonomy block atomically (taxonomy + structures + elements +
|
|
@@ -159,12 +159,12 @@ class LedgerClient {
|
|
|
159
159
|
async createTaxonomyBlock(graphId, body, idempotencyKey) {
|
|
160
160
|
const headers = idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : undefined;
|
|
161
161
|
const envelope = await this.callOperation('Create taxonomy block', (0, sdk_gen_1.opCreateTaxonomyBlock)({ path: { graph_id: graphId }, body, headers }));
|
|
162
|
-
return (envelope.result
|
|
162
|
+
return this.requireResult('Create taxonomy block', envelope.result);
|
|
163
163
|
}
|
|
164
164
|
/** Update a taxonomy block — add/update/remove elements, structures, associations, or rules. */
|
|
165
165
|
async updateTaxonomyBlock(graphId, body) {
|
|
166
166
|
const envelope = await this.callOperation('Update taxonomy block', (0, sdk_gen_1.opUpdateTaxonomyBlock)({ path: { graph_id: graphId }, body }));
|
|
167
|
-
return (envelope.result
|
|
167
|
+
return this.requireResult('Update taxonomy block', envelope.result);
|
|
168
168
|
}
|
|
169
169
|
/** Delete a taxonomy block. Cascades through elements, structures, and associations. */
|
|
170
170
|
async deleteTaxonomyBlock(graphId, body) {
|
|
@@ -212,7 +212,7 @@ class LedgerClient {
|
|
|
212
212
|
/** Create a manual mapping association between two elements. */
|
|
213
213
|
async createMappingAssociation(graphId, body) {
|
|
214
214
|
const envelope = await this.callOperation('Create mapping association', (0, sdk_gen_1.opCreateMappingAssociation)({ path: { graph_id: graphId }, body }));
|
|
215
|
-
return (envelope.result
|
|
215
|
+
return this.requireResult('Create mapping association', envelope.result);
|
|
216
216
|
}
|
|
217
217
|
/** Delete a mapping association. */
|
|
218
218
|
async deleteMappingAssociation(graphId, body) {
|
|
@@ -298,7 +298,7 @@ class LedgerClient {
|
|
|
298
298
|
payload: { structure_id: structureId, ...options },
|
|
299
299
|
};
|
|
300
300
|
const envelope = await this.callOperation('Update schedule', (0, sdk_gen_1.opUpdateInformationBlock)({ path: { graph_id: graphId }, body }));
|
|
301
|
-
return (envelope.result
|
|
301
|
+
return this.requireResult('Update schedule', envelope.result);
|
|
302
302
|
}
|
|
303
303
|
/** Permanently delete a schedule (cascades through facts + associations). */
|
|
304
304
|
async deleteSchedule(graphId, structureId) {
|
|
@@ -333,12 +333,12 @@ class LedgerClient {
|
|
|
333
333
|
},
|
|
334
334
|
};
|
|
335
335
|
const envelope = await this.callOperation('Dispose schedule', (0, sdk_gen_1.opCreateEventBlock)({ path: { graph_id: graphId }, body }));
|
|
336
|
-
return (envelope.result
|
|
336
|
+
return this.requireResult('Dispose schedule', envelope.result);
|
|
337
337
|
}
|
|
338
338
|
/** Evaluate taxonomy rules against facts in a structure. */
|
|
339
339
|
async evaluateRules(graphId, body) {
|
|
340
340
|
const envelope = await this.callOperation('Evaluate rules', (0, sdk_gen_1.opEvaluateRules)({ path: { graph_id: graphId }, body }));
|
|
341
|
-
return (envelope.result
|
|
341
|
+
return this.requireResult('Evaluate rules', envelope.result);
|
|
342
342
|
}
|
|
343
343
|
// ── Period close ────────────────────────────────────────────────────
|
|
344
344
|
/** Close status for all schedules in a fiscal period. */
|
|
@@ -374,7 +374,7 @@ class LedgerClient {
|
|
|
374
374
|
},
|
|
375
375
|
};
|
|
376
376
|
const envelope = await this.callOperation('Create closing entry', (0, sdk_gen_1.opCreateEventBlock)({ path: { graph_id: graphId }, body }));
|
|
377
|
-
return (envelope.result
|
|
377
|
+
return this.requireResult('Create closing entry', envelope.result);
|
|
378
378
|
}
|
|
379
379
|
// ── Closing book ───────────────────────────────────────────────────
|
|
380
380
|
/** Grouped closing book structures for the close-screen sidebar. */
|
|
@@ -476,12 +476,12 @@ class LedgerClient {
|
|
|
476
476
|
? { 'Idempotency-Key': options.idempotencyKey }
|
|
477
477
|
: undefined;
|
|
478
478
|
const envelope = await this.callOperation('Create journal entry', (0, sdk_gen_1.opCreateEventBlock)({ path: { graph_id: graphId }, body, headers }));
|
|
479
|
-
return (envelope.result
|
|
479
|
+
return this.requireResult('Create journal entry', envelope.result);
|
|
480
480
|
}
|
|
481
481
|
/** Update a draft journal entry. Posted entries are immutable. */
|
|
482
482
|
async updateJournalEntry(graphId, body) {
|
|
483
483
|
const envelope = await this.callOperation('Update journal entry', (0, sdk_gen_1.opUpdateJournalEntry)({ path: { graph_id: graphId }, body }));
|
|
484
|
-
return (envelope.result
|
|
484
|
+
return this.requireResult('Update journal entry', envelope.result);
|
|
485
485
|
}
|
|
486
486
|
/** Hard-delete a draft journal entry. Posted entries must be reversed. */
|
|
487
487
|
async deleteJournalEntry(graphId, entryId) {
|
|
@@ -512,7 +512,7 @@ class LedgerClient {
|
|
|
512
512
|
},
|
|
513
513
|
};
|
|
514
514
|
const envelope = await this.callOperation('Reverse journal entry', (0, sdk_gen_1.opCreateEventBlock)({ path: { graph_id: graphId }, body }));
|
|
515
|
-
return (envelope.result
|
|
515
|
+
return this.requireResult('Reverse journal entry', envelope.result);
|
|
516
516
|
}
|
|
517
517
|
// ── Event blocks (generic preview + status transitions) ──────────────
|
|
518
518
|
/**
|
|
@@ -525,7 +525,7 @@ class LedgerClient {
|
|
|
525
525
|
*/
|
|
526
526
|
async previewEventBlock(graphId, body) {
|
|
527
527
|
const envelope = await this.callOperation('Preview event block', (0, sdk_gen_1.opPreviewEventBlock)({ path: { graph_id: graphId }, body }));
|
|
528
|
-
return (envelope.result
|
|
528
|
+
return this.requireResult('Preview event block', envelope.result);
|
|
529
529
|
}
|
|
530
530
|
/**
|
|
531
531
|
* Apply a status transition and/or field corrections to an existing
|
|
@@ -535,7 +535,7 @@ class LedgerClient {
|
|
|
535
535
|
*/
|
|
536
536
|
async updateEventBlock(graphId, body) {
|
|
537
537
|
const envelope = await this.callOperation('Update event block', (0, sdk_gen_1.opUpdateEventBlock)({ path: { graph_id: graphId }, body }));
|
|
538
|
-
return (envelope.result
|
|
538
|
+
return this.requireResult('Update event block', envelope.result);
|
|
539
539
|
}
|
|
540
540
|
// ── Agents (REA counterparties) ───────────────────────────────────────
|
|
541
541
|
/**
|
|
@@ -547,7 +547,7 @@ class LedgerClient {
|
|
|
547
547
|
async createAgent(graphId, body, idempotencyKey) {
|
|
548
548
|
const headers = idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : undefined;
|
|
549
549
|
const envelope = await this.callOperation('Create agent', (0, sdk_gen_1.opCreateAgent)({ path: { graph_id: graphId }, body, headers }));
|
|
550
|
-
return (envelope.result
|
|
550
|
+
return this.requireResult('Create agent', envelope.result);
|
|
551
551
|
}
|
|
552
552
|
/**
|
|
553
553
|
* Update an agent. `metadata_patch` is a partial merge into the existing
|
|
@@ -555,7 +555,7 @@ class LedgerClient {
|
|
|
555
555
|
*/
|
|
556
556
|
async updateAgent(graphId, body) {
|
|
557
557
|
const envelope = await this.callOperation('Update agent', (0, sdk_gen_1.opUpdateAgent)({ path: { graph_id: graphId }, body }));
|
|
558
|
-
return (envelope.result
|
|
558
|
+
return this.requireResult('Update agent', envelope.result);
|
|
559
559
|
}
|
|
560
560
|
// ── Event handlers (DSL handler registry) ────────────────────────────
|
|
561
561
|
/**
|
|
@@ -566,7 +566,7 @@ class LedgerClient {
|
|
|
566
566
|
*/
|
|
567
567
|
async createEventHandler(graphId, body) {
|
|
568
568
|
const envelope = await this.callOperation('Create event handler', (0, sdk_gen_1.opCreateEventHandler)({ path: { graph_id: graphId }, body }));
|
|
569
|
-
return (envelope.result
|
|
569
|
+
return this.requireResult('Create event handler', envelope.result);
|
|
570
570
|
}
|
|
571
571
|
/**
|
|
572
572
|
* Update a registered event handler. Pass `approve: true` to flip an
|
|
@@ -574,7 +574,7 @@ class LedgerClient {
|
|
|
574
574
|
*/
|
|
575
575
|
async updateEventHandler(graphId, body) {
|
|
576
576
|
const envelope = await this.callOperation('Update event handler', (0, sdk_gen_1.opUpdateEventHandler)({ path: { graph_id: graphId }, body }));
|
|
577
|
-
return (envelope.result
|
|
577
|
+
return this.requireResult('Update event handler', envelope.result);
|
|
578
578
|
}
|
|
579
579
|
// ── Financial statements (graph-backed) ──────────────────────────────
|
|
580
580
|
/**
|
|
@@ -704,14 +704,15 @@ class LedgerClient {
|
|
|
704
704
|
}
|
|
705
705
|
/** Delete a report and its generated facts. */
|
|
706
706
|
async deleteReport(graphId, reportId) {
|
|
707
|
-
await this.callOperation('Delete report', (0, sdk_gen_1.opDeleteReport)({
|
|
707
|
+
const envelope = await this.callOperation('Delete report', (0, sdk_gen_1.opDeleteReport)({
|
|
708
708
|
path: { graph_id: graphId },
|
|
709
709
|
body: { report_id: reportId },
|
|
710
710
|
}));
|
|
711
|
+
return (envelope.result ?? { deleted: true });
|
|
711
712
|
}
|
|
712
713
|
/**
|
|
713
|
-
* Share a published report to every member of a publish list
|
|
714
|
-
*
|
|
714
|
+
* Share a published report to every member of a publish list. Each
|
|
715
|
+
* target graph receives a snapshot copy of the report's facts.
|
|
715
716
|
*/
|
|
716
717
|
async shareReport(graphId, reportId, publishListId) {
|
|
717
718
|
const envelope = await this.callOperation('Share report', (0, sdk_gen_1.opShareReport)({
|
|
@@ -778,7 +779,7 @@ class LedgerClient {
|
|
|
778
779
|
description: description ?? null,
|
|
779
780
|
};
|
|
780
781
|
const envelope = await this.callOperation('Create publish list', (0, sdk_gen_1.opCreatePublishList)({ path: { graph_id: graphId }, body }));
|
|
781
|
-
return (envelope.result
|
|
782
|
+
return this.requireResult('Create publish list', envelope.result);
|
|
782
783
|
}
|
|
783
784
|
/** Get a single publish list with its full member list. */
|
|
784
785
|
async getPublishList(graphId, listId) {
|
|
@@ -794,14 +795,15 @@ class LedgerClient {
|
|
|
794
795
|
description: updates.description ?? null,
|
|
795
796
|
},
|
|
796
797
|
}));
|
|
797
|
-
return (envelope.result
|
|
798
|
+
return this.requireResult('Update publish list', envelope.result);
|
|
798
799
|
}
|
|
799
800
|
/** Delete a publish list. */
|
|
800
801
|
async deletePublishList(graphId, listId) {
|
|
801
|
-
await this.callOperation('Delete publish list', (0, sdk_gen_1.opDeletePublishList)({
|
|
802
|
+
const envelope = await this.callOperation('Delete publish list', (0, sdk_gen_1.opDeletePublishList)({
|
|
802
803
|
path: { graph_id: graphId },
|
|
803
804
|
body: { list_id: listId },
|
|
804
805
|
}));
|
|
806
|
+
return (envelope.result ?? { deleted: true });
|
|
805
807
|
}
|
|
806
808
|
/** Add target graphs as members of a publish list. */
|
|
807
809
|
async addPublishListMembers(graphId, listId, targetGraphIds) {
|
|
@@ -812,7 +814,7 @@ class LedgerClient {
|
|
|
812
814
|
target_graph_ids: targetGraphIds,
|
|
813
815
|
},
|
|
814
816
|
}));
|
|
815
|
-
return (envelope.result
|
|
817
|
+
return this.requireResult('Add publish list members', envelope.result);
|
|
816
818
|
}
|
|
817
819
|
/** Remove a single member from a publish list. */
|
|
818
820
|
async removePublishListMember(graphId, listId, memberId) {
|
|
@@ -825,7 +827,13 @@ class LedgerClient {
|
|
|
825
827
|
// ── Internal helpers ────────────────────────────────────────────────
|
|
826
828
|
/**
|
|
827
829
|
* Await an SDK-generated `opXxx(...)` call, throw a readable error on
|
|
828
|
-
* non-2xx, and return the
|
|
830
|
+
* non-2xx, and return the parsed envelope on success.
|
|
831
|
+
*
|
|
832
|
+
* Generic over the SDK call's response shape so typed ops (e.g.
|
|
833
|
+
* `opCreateEventBlock`, which returns
|
|
834
|
+
* `OperationEnvelopeEventBlockEnvelope`) flow through with a typed
|
|
835
|
+
* `envelope.result` instead of being widened to `unknown`. Untyped
|
|
836
|
+
* ops continue to land as `OperationEnvelope` automatically.
|
|
829
837
|
*/
|
|
830
838
|
async callOperation(label, call) {
|
|
831
839
|
const response = await call;
|
|
@@ -837,6 +845,17 @@ class LedgerClient {
|
|
|
837
845
|
}
|
|
838
846
|
return response.data;
|
|
839
847
|
}
|
|
848
|
+
/**
|
|
849
|
+
* Unwrap the typed result from an OperationEnvelope. Throws when the
|
|
850
|
+
* server returned an envelope with no `result` field — generally a
|
|
851
|
+
* sign that a synchronous operation failed silently.
|
|
852
|
+
*/
|
|
853
|
+
requireResult(label, result) {
|
|
854
|
+
if (result === null || result === undefined) {
|
|
855
|
+
throw new Error(`${label}: operation envelope had no result`);
|
|
856
|
+
}
|
|
857
|
+
return result;
|
|
858
|
+
}
|
|
840
859
|
}
|
|
841
860
|
exports.LedgerClient = LedgerClient;
|
|
842
861
|
// ── Module-private conversion helpers ─────────────────────────────────
|