@robosystems/client 0.3.1 → 0.3.3
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/{extensions → artifacts}/InvestorClient.js +0 -1
- package/{extensions → artifacts}/InvestorClient.ts +1 -1
- package/{extensions → artifacts}/LedgerClient.d.ts +168 -2
- package/{extensions → artifacts}/LedgerClient.js +301 -2
- package/{extensions → artifacts}/LedgerClient.ts +645 -2
- package/{extensions → artifacts}/config.d.ts +11 -11
- package/{extensions → artifacts}/config.js +11 -11
- package/{extensions → artifacts}/config.ts +16 -16
- package/{extensions → artifacts}/graphql/client.d.ts +1 -1
- package/{extensions → artifacts}/graphql/client.js +1 -2
- package/{extensions → artifacts}/graphql/client.ts +2 -2
- package/{extensions → artifacts}/hooks.js +6 -6
- package/{extensions → artifacts}/hooks.ts +7 -7
- package/{extensions → artifacts}/index.d.ts +21 -18
- package/{extensions → artifacts}/index.js +43 -53
- package/{extensions → artifacts}/index.ts +47 -60
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/index.ts +2 -2
- package/package.json +38 -8
- package/sdk/index.d.ts +2 -2
- package/sdk/index.js +27 -9
- package/sdk/index.ts +2 -2
- package/sdk/sdk.gen.d.ts +272 -274
- package/sdk/sdk.gen.js +468 -312
- package/sdk/sdk.gen.ts +464 -309
- package/sdk/types.gen.d.ts +2962 -440
- package/sdk/types.gen.ts +3058 -430
- package/sdk.gen.d.ts +272 -274
- package/sdk.gen.js +468 -312
- package/sdk.gen.ts +464 -309
- package/types.gen.d.ts +2962 -440
- package/types.gen.ts +3058 -430
- package/extensions/ReportClient.d.ts +0 -120
- package/extensions/ReportClient.js +0 -191
- package/extensions/ReportClient.ts +0 -433
- /package/{extensions → artifacts}/AgentClient.d.ts +0 -0
- /package/{extensions → artifacts}/AgentClient.js +0 -0
- /package/{extensions → artifacts}/AgentClient.ts +0 -0
- /package/{extensions → artifacts}/InvestorClient.d.ts +0 -0
- /package/{extensions → artifacts}/OperationClient.d.ts +0 -0
- /package/{extensions → artifacts}/OperationClient.js +0 -0
- /package/{extensions → artifacts}/OperationClient.ts +0 -0
- /package/{extensions → artifacts}/QueryClient.d.ts +0 -0
- /package/{extensions → artifacts}/QueryClient.js +0 -0
- /package/{extensions → artifacts}/QueryClient.ts +0 -0
- /package/{extensions → artifacts}/SSEClient.d.ts +0 -0
- /package/{extensions → artifacts}/SSEClient.js +0 -0
- /package/{extensions → artifacts}/SSEClient.ts +0 -0
- /package/{extensions → artifacts}/graphql/generated/graphql.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/generated/graphql.js +0 -0
- /package/{extensions → artifacts}/graphql/generated/graphql.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/holdings.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/holdings.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/holdings.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/portfolio.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/portfolio.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/portfolio.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/portfolios.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/portfolios.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/portfolios.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/position.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/position.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/position.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/positions.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/positions.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/positions.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/securities.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/securities.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/securities.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/security.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/security.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/investor/security.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/accountRollups.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/accountRollups.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/accountRollups.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/accountTree.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/accountTree.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/accountTree.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/accounts.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/accounts.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/accounts.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/closingBookStructures.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/closingBookStructures.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/closingBookStructures.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/elements.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/elements.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/elements.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/entities.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/entities.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/entities.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/entity.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/entity.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/entity.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/fiscalCalendar.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/fiscalCalendar.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/fiscalCalendar.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/mappedTrialBalance.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/mappedTrialBalance.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/mappedTrialBalance.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/mapping.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/mapping.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/mapping.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/mappingCoverage.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/mappingCoverage.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/mappingCoverage.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/mappings.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/mappings.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/mappings.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/periodCloseStatus.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/periodCloseStatus.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/periodCloseStatus.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/periodDrafts.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/periodDrafts.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/periodDrafts.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/publishList.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/publishList.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/publishList.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/publishLists.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/publishLists.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/publishLists.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/report.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/report.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/report.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/reportingTaxonomy.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/reportingTaxonomy.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/reportingTaxonomy.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/reports.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/reports.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/reports.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/scheduleFacts.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/scheduleFacts.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/scheduleFacts.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/schedules.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/schedules.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/schedules.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/statement.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/statement.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/statement.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/structures.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/structures.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/structures.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/summary.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/summary.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/summary.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/taxonomies.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/taxonomies.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/taxonomies.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/transaction.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/transaction.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/transaction.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/transactions.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/transactions.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/transactions.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/trialBalance.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/trialBalance.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/trialBalance.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/unmappedElements.d.ts +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/unmappedElements.js +0 -0
- /package/{extensions → artifacts}/graphql/queries/ledger/unmappedElements.ts +0 -0
- /package/{extensions → artifacts}/hooks.d.ts +0 -0
|
@@ -144,7 +144,6 @@ class InvestorClient {
|
|
|
144
144
|
async gqlQuery(graphId, document, variables, label, pick) {
|
|
145
145
|
try {
|
|
146
146
|
const client = this.gql.get(graphId);
|
|
147
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
148
147
|
const raw = client.request;
|
|
149
148
|
const data = (await raw.call(client, document, variables));
|
|
150
149
|
return pick(data);
|
|
@@ -361,7 +361,7 @@ export class InvestorClient {
|
|
|
361
361
|
): Promise<TResult> {
|
|
362
362
|
try {
|
|
363
363
|
const client = this.gql.get(graphId)
|
|
364
|
-
|
|
364
|
+
|
|
365
365
|
const raw = client.request as (doc: unknown, vars?: unknown) => Promise<any>
|
|
366
366
|
const data = (await raw.call(client, document, variables)) as TData
|
|
367
367
|
return pick(data)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AutoMapElementsOperation, CreateMappingAssociationOperation, CreateStructureRequest, CreateTaxonomyRequest, DeleteMappingAssociationOperation, OperationEnvelope, UpdateEntityRequest } from '../types.gen';
|
|
1
|
+
import type { AutoMapElementsOperation, BulkAssociationItem, CreateElementRequest, CreateMappingAssociationOperation, CreateStructureRequest, CreateTaxonomyRequest, CreateViewRequest, DeleteMappingAssociationOperation, LinkEntityTaxonomyRequest, OperationEnvelope, UpdateAssociationRequest, UpdateElementRequest, UpdateEntityRequest, UpdateJournalEntryRequest, UpdateScheduleRequest, UpdateStructureRequest, UpdateTaxonomyRequest } from '../types.gen';
|
|
2
2
|
import type { TokenProvider } from './graphql/client';
|
|
3
|
-
import { type GetLedgerAccountRollupsQuery, type GetLedgerAccountTreeQuery, type GetLedgerClosingBookStructuresQuery, type GetLedgerEntityQuery, type GetLedgerFiscalCalendarQuery, type GetLedgerMappedTrialBalanceQuery, type GetLedgerMappingCoverageQuery, type GetLedgerMappingQuery, type GetLedgerPeriodCloseStatusQuery, type GetLedgerPeriodDraftsQuery, type GetLedgerReportingTaxonomyQuery, type GetLedgerScheduleFactsQuery, type GetLedgerSummaryQuery, type GetLedgerTransactionQuery, type GetLedgerTrialBalanceQuery, type ListLedgerAccountsQuery, type ListLedgerElementsQuery, type ListLedgerEntitiesQuery, type ListLedgerMappingsQuery, type ListLedgerSchedulesQuery, type ListLedgerStructuresQuery, type ListLedgerTaxonomiesQuery, type ListLedgerTransactionsQuery, type ListLedgerUnmappedElementsQuery } from './graphql/generated/graphql';
|
|
3
|
+
import { type GetLedgerAccountRollupsQuery, type GetLedgerAccountTreeQuery, type GetLedgerClosingBookStructuresQuery, type GetLedgerEntityQuery, type GetLedgerFiscalCalendarQuery, type GetLedgerMappedTrialBalanceQuery, type GetLedgerMappingCoverageQuery, type GetLedgerMappingQuery, type GetLedgerPeriodCloseStatusQuery, type GetLedgerPeriodDraftsQuery, type GetLedgerPublishListQuery, type GetLedgerReportingTaxonomyQuery, type GetLedgerReportQuery, type GetLedgerScheduleFactsQuery, type GetLedgerStatementQuery, type GetLedgerSummaryQuery, type GetLedgerTransactionQuery, type GetLedgerTrialBalanceQuery, type ListLedgerAccountsQuery, type ListLedgerElementsQuery, type ListLedgerEntitiesQuery, type ListLedgerMappingsQuery, type ListLedgerPublishListsQuery, type ListLedgerReportsQuery, type ListLedgerSchedulesQuery, type ListLedgerStructuresQuery, type ListLedgerTaxonomiesQuery, type ListLedgerTransactionsQuery, type ListLedgerUnmappedElementsQuery } from './graphql/generated/graphql';
|
|
4
4
|
export type LedgerEntity = NonNullable<GetLedgerEntityQuery['entity']>;
|
|
5
5
|
export type LedgerEntitySummary = ListLedgerEntitiesQuery['entities'][number];
|
|
6
6
|
export type LedgerSummary = NonNullable<GetLedgerSummaryQuery['summary']>;
|
|
@@ -37,6 +37,34 @@ export type LedgerDraftLineItem = LedgerDraftEntry['lineItems'][number];
|
|
|
37
37
|
export type LedgerClosingBookStructures = NonNullable<GetLedgerClosingBookStructuresQuery['closingBookStructures']>;
|
|
38
38
|
export type LedgerFiscalCalendar = NonNullable<GetLedgerFiscalCalendarQuery['fiscalCalendar']>;
|
|
39
39
|
export type LedgerFiscalPeriod = LedgerFiscalCalendar['periods'][number];
|
|
40
|
+
export type Report = NonNullable<GetLedgerReportQuery['report']>;
|
|
41
|
+
export type ReportListItem = NonNullable<ListLedgerReportsQuery['reports']>['reports'][number];
|
|
42
|
+
export type StatementData = NonNullable<GetLedgerStatementQuery['statement']>;
|
|
43
|
+
export type StatementPeriod = StatementData['periods'][number];
|
|
44
|
+
export type StatementRow = StatementData['rows'][number];
|
|
45
|
+
export type PublishList = NonNullable<ListLedgerPublishListsQuery['publishLists']>['publishLists'][number];
|
|
46
|
+
export type PublishListDetail = NonNullable<GetLedgerPublishListQuery['publishList']>;
|
|
47
|
+
export type PublishListMember = PublishListDetail['members'][number];
|
|
48
|
+
export interface PeriodSpecInput {
|
|
49
|
+
start: string;
|
|
50
|
+
end: string;
|
|
51
|
+
label: string;
|
|
52
|
+
}
|
|
53
|
+
export interface CreateReportOptions {
|
|
54
|
+
name: string;
|
|
55
|
+
mappingId: string;
|
|
56
|
+
periodStart: string;
|
|
57
|
+
periodEnd: string;
|
|
58
|
+
taxonomyId?: string;
|
|
59
|
+
periodType?: string;
|
|
60
|
+
comparative?: boolean;
|
|
61
|
+
periods?: PeriodSpecInput[];
|
|
62
|
+
}
|
|
63
|
+
export interface ReportOperationAck {
|
|
64
|
+
operationId: string;
|
|
65
|
+
status: OperationEnvelope['status'];
|
|
66
|
+
result: Record<string, unknown> | null;
|
|
67
|
+
}
|
|
40
68
|
export interface InitializeLedgerResult {
|
|
41
69
|
fiscalCalendar: LedgerFiscalCalendar;
|
|
42
70
|
periodsCreated: number;
|
|
@@ -122,6 +150,21 @@ export interface CreateScheduleOptions {
|
|
|
122
150
|
assetElementId?: string;
|
|
123
151
|
};
|
|
124
152
|
}
|
|
153
|
+
export interface JournalEntryLineItem {
|
|
154
|
+
elementId: string;
|
|
155
|
+
debitAmount?: number;
|
|
156
|
+
creditAmount?: number;
|
|
157
|
+
description?: string | null;
|
|
158
|
+
}
|
|
159
|
+
export interface CreateJournalEntryOptions {
|
|
160
|
+
postingDate: string;
|
|
161
|
+
memo: string;
|
|
162
|
+
lineItems: JournalEntryLineItem[];
|
|
163
|
+
type?: LedgerEntryType;
|
|
164
|
+
status?: 'draft' | 'posted';
|
|
165
|
+
transactionId?: string | null;
|
|
166
|
+
idempotencyKey?: string | null;
|
|
167
|
+
}
|
|
125
168
|
interface LedgerClientConfig {
|
|
126
169
|
baseUrl: string;
|
|
127
170
|
credentials?: 'include' | 'same-origin' | 'omit';
|
|
@@ -202,6 +245,15 @@ export declare class LedgerClient {
|
|
|
202
245
|
}): Promise<LedgerTaxonomy[]>;
|
|
203
246
|
/** Create a new taxonomy (used for CoA + mapping taxonomies). */
|
|
204
247
|
createTaxonomy(graphId: string, body: CreateTaxonomyRequest): Promise<Record<string, unknown>>;
|
|
248
|
+
/** Update mutable fields on a taxonomy. `taxonomy_type` is immutable. */
|
|
249
|
+
updateTaxonomy(graphId: string, body: UpdateTaxonomyRequest): Promise<Record<string, unknown>>;
|
|
250
|
+
/** Soft-delete a taxonomy (`is_active=false`). */
|
|
251
|
+
deleteTaxonomy(graphId: string, taxonomyId: string): Promise<Record<string, unknown>>;
|
|
252
|
+
/**
|
|
253
|
+
* Link the graph's entity to a taxonomy (ENTITY_HAS_TAXONOMY edge).
|
|
254
|
+
* Idempotent — returns existing linkage if already present.
|
|
255
|
+
*/
|
|
256
|
+
linkEntityTaxonomy(graphId: string, body: LinkEntityTaxonomyRequest): Promise<Record<string, unknown>>;
|
|
205
257
|
/** List elements (CoA accounts, GAAP concepts, etc.) with filters. */
|
|
206
258
|
listElements(graphId: string, options?: {
|
|
207
259
|
taxonomyId?: string;
|
|
@@ -215,6 +267,12 @@ export declare class LedgerClient {
|
|
|
215
267
|
listUnmappedElements(graphId: string, options?: {
|
|
216
268
|
mappingId?: string;
|
|
217
269
|
}): Promise<LedgerUnmappedElement[]>;
|
|
270
|
+
/** Create a new element within a taxonomy (native CoA account, etc.). */
|
|
271
|
+
createElement(graphId: string, body: CreateElementRequest): Promise<Record<string, unknown>>;
|
|
272
|
+
/** Update mutable fields on an element. `taxonomy_id` and `source` are immutable. */
|
|
273
|
+
updateElement(graphId: string, body: UpdateElementRequest): Promise<Record<string, unknown>>;
|
|
274
|
+
/** Soft-delete an element (`is_active=false`). */
|
|
275
|
+
deleteElement(graphId: string, elementId: string): Promise<Record<string, unknown>>;
|
|
218
276
|
/** List reporting structures (IS, BS, CF, schedules) with optional filters. */
|
|
219
277
|
listStructures(graphId: string, options?: {
|
|
220
278
|
taxonomyId?: string;
|
|
@@ -225,6 +283,16 @@ export declare class LedgerClient {
|
|
|
225
283
|
* structure; also used for custom statement + schedule structures.
|
|
226
284
|
*/
|
|
227
285
|
createStructure(graphId: string, body: CreateStructureRequest): Promise<LedgerMappingInfo>;
|
|
286
|
+
/** Convenience wrapper — create a CoA→GAAP mapping structure. */
|
|
287
|
+
createMappingStructure(graphId: string, options?: {
|
|
288
|
+
name?: string;
|
|
289
|
+
description?: string | null;
|
|
290
|
+
taxonomyId?: string;
|
|
291
|
+
}): Promise<LedgerMappingInfo>;
|
|
292
|
+
/** Update mutable fields on a structure. `structure_type` is immutable. */
|
|
293
|
+
updateStructure(graphId: string, body: UpdateStructureRequest): Promise<Record<string, unknown>>;
|
|
294
|
+
/** Soft-delete a structure (`is_active=false`). */
|
|
295
|
+
deleteStructure(graphId: string, structureId: string): Promise<Record<string, unknown>>;
|
|
228
296
|
/** List active CoA→reporting mapping structures. */
|
|
229
297
|
listMappings(graphId: string): Promise<LedgerMappingInfo[]>;
|
|
230
298
|
/** Get a mapping structure with all its associations. */
|
|
@@ -246,6 +314,14 @@ export declare class LedgerClient {
|
|
|
246
314
|
operationId: string;
|
|
247
315
|
status: OperationEnvelope['status'];
|
|
248
316
|
}>;
|
|
317
|
+
/** Bulk create associations within a single structure, atomically. */
|
|
318
|
+
createAssociations(graphId: string, structureId: string, associations: BulkAssociationItem[]): Promise<Record<string, unknown>>;
|
|
319
|
+
/** Update mutable fields on an association (order, weight, confidence). */
|
|
320
|
+
updateAssociation(graphId: string, body: UpdateAssociationRequest): Promise<Record<string, unknown>>;
|
|
321
|
+
/** Hard-delete an association (any type: presentation, calculation, mapping). */
|
|
322
|
+
deleteAssociation(graphId: string, associationId: string): Promise<{
|
|
323
|
+
deleted: boolean;
|
|
324
|
+
}>;
|
|
249
325
|
/** List all schedule structures with metadata. */
|
|
250
326
|
listSchedules(graphId: string): Promise<LedgerSchedule[]>;
|
|
251
327
|
/** Schedule facts optionally filtered by period window. */
|
|
@@ -255,6 +331,12 @@ export declare class LedgerClient {
|
|
|
255
331
|
}): Promise<LedgerScheduleFact[]>;
|
|
256
332
|
/** Create a new schedule with pre-generated monthly facts. */
|
|
257
333
|
createSchedule(graphId: string, options: CreateScheduleOptions): Promise<ScheduleCreated>;
|
|
334
|
+
/** Update mutable fields on a schedule (name, entry_template, metadata). */
|
|
335
|
+
updateSchedule(graphId: string, body: UpdateScheduleRequest): Promise<Record<string, unknown>>;
|
|
336
|
+
/** Permanently delete a schedule (cascades through facts + associations). */
|
|
337
|
+
deleteSchedule(graphId: string, structureId: string): Promise<{
|
|
338
|
+
deleted: boolean;
|
|
339
|
+
}>;
|
|
258
340
|
/** Truncate a schedule — end it early at `newEndDate`. */
|
|
259
341
|
truncateSchedule(graphId: string, structureId: string, options: TruncateScheduleOptions): Promise<TruncateScheduleResult>;
|
|
260
342
|
/** Close status for all schedules in a fiscal period. */
|
|
@@ -283,11 +365,95 @@ export declare class LedgerClient {
|
|
|
283
365
|
closePeriod(graphId: string, period: string, options?: ClosePeriodOptions): Promise<ClosePeriodResult>;
|
|
284
366
|
/** Reopen a closed fiscal period. Requires a reason for the audit log. */
|
|
285
367
|
reopenPeriod(graphId: string, period: string, reason: string, note?: string | null): Promise<LedgerFiscalCalendar>;
|
|
368
|
+
/**
|
|
369
|
+
* Create a journal entry with balanced line items (DR=CR enforced).
|
|
370
|
+
*
|
|
371
|
+
* Defaults to `status='draft'`. Pass `status='posted'` for historical
|
|
372
|
+
* data import where entries represent already-happened business events.
|
|
373
|
+
*
|
|
374
|
+
* Supply `idempotencyKey` to make the call safe to retry — replays
|
|
375
|
+
* within 24 hours return the same envelope. Reusing the key with a
|
|
376
|
+
* different body returns HTTP 409.
|
|
377
|
+
*/
|
|
378
|
+
createJournalEntry(graphId: string, options: CreateJournalEntryOptions): Promise<Record<string, unknown>>;
|
|
379
|
+
/** Update a draft journal entry. Posted entries are immutable. */
|
|
380
|
+
updateJournalEntry(graphId: string, body: UpdateJournalEntryRequest): Promise<Record<string, unknown>>;
|
|
381
|
+
/** Hard-delete a draft journal entry. Posted entries must be reversed. */
|
|
382
|
+
deleteJournalEntry(graphId: string, entryId: string): Promise<{
|
|
383
|
+
deleted: boolean;
|
|
384
|
+
}>;
|
|
385
|
+
/**
|
|
386
|
+
* Reverse a posted journal entry — creates an offsetting entry and marks
|
|
387
|
+
* the original as reversed.
|
|
388
|
+
*/
|
|
389
|
+
reverseJournalEntry(graphId: string, entryId: string, options?: {
|
|
390
|
+
postingDate?: string | null;
|
|
391
|
+
memo?: string | null;
|
|
392
|
+
}): Promise<Record<string, unknown>>;
|
|
393
|
+
/**
|
|
394
|
+
* Build a multi-dimensional fact grid against the graph schema.
|
|
395
|
+
*
|
|
396
|
+
* Runs against LadybugDB (not the extensions OLTP database) and returns
|
|
397
|
+
* a deduplicated pivot table of XBRL facts. Works for both roboledger
|
|
398
|
+
* tenant graphs (after materialization) and the SEC shared repository.
|
|
399
|
+
*/
|
|
400
|
+
buildFactGrid(graphId: string, body: CreateViewRequest): Promise<Record<string, unknown>>;
|
|
286
401
|
/**
|
|
287
402
|
* Run a typed GraphQL query against the per-graph endpoint and
|
|
288
403
|
* translate ClientError into a readable facade error.
|
|
289
404
|
*/
|
|
290
405
|
private gqlQuery;
|
|
406
|
+
/**
|
|
407
|
+
* Kick off report creation (async). Use the returned `operationId` to
|
|
408
|
+
* subscribe to progress via SSE, then call `getReport()` once finished.
|
|
409
|
+
*/
|
|
410
|
+
createReport(graphId: string, options: CreateReportOptions): Promise<ReportOperationAck>;
|
|
411
|
+
/** List all reports for a graph (includes received shared reports). */
|
|
412
|
+
listReports(graphId: string): Promise<ReportListItem[]>;
|
|
413
|
+
/** Get a single report with its period list + available structures. */
|
|
414
|
+
getReport(graphId: string, reportId: string): Promise<Report | null>;
|
|
415
|
+
/**
|
|
416
|
+
* Render a financial statement — facts viewed through a structure.
|
|
417
|
+
*
|
|
418
|
+
* @param structureType - income_statement, balance_sheet, cash_flow_statement
|
|
419
|
+
*/
|
|
420
|
+
getStatement(graphId: string, reportId: string, structureType: string): Promise<StatementData | null>;
|
|
421
|
+
/**
|
|
422
|
+
* Regenerate an existing report (async). Returns an operation id;
|
|
423
|
+
* subscribe via SSE for progress.
|
|
424
|
+
*/
|
|
425
|
+
regenerateReport(graphId: string, reportId: string, periodStart?: string, periodEnd?: string): Promise<ReportOperationAck>;
|
|
426
|
+
/** Delete a report and its generated facts. */
|
|
427
|
+
deleteReport(graphId: string, reportId: string): Promise<void>;
|
|
428
|
+
/**
|
|
429
|
+
* Share a published report to every member of a publish list (async).
|
|
430
|
+
* Each target graph receives a snapshot copy of the report's facts.
|
|
431
|
+
*/
|
|
432
|
+
shareReport(graphId: string, reportId: string, publishListId: string): Promise<ReportOperationAck>;
|
|
433
|
+
/** Check if a report was received via sharing (vs locally created). */
|
|
434
|
+
isSharedReport(report: Report): boolean;
|
|
435
|
+
/** List publish lists with pagination. */
|
|
436
|
+
listPublishLists(graphId: string, options?: {
|
|
437
|
+
limit?: number;
|
|
438
|
+
offset?: number;
|
|
439
|
+
}): Promise<PublishList[]>;
|
|
440
|
+
/** Create a new publish list. */
|
|
441
|
+
createPublishList(graphId: string, name: string, description?: string): Promise<Record<string, unknown>>;
|
|
442
|
+
/** Get a single publish list with its full member list. */
|
|
443
|
+
getPublishList(graphId: string, listId: string): Promise<PublishListDetail | null>;
|
|
444
|
+
/** Update a publish list's name or description. */
|
|
445
|
+
updatePublishList(graphId: string, listId: string, updates: {
|
|
446
|
+
name?: string;
|
|
447
|
+
description?: string | null;
|
|
448
|
+
}): Promise<Record<string, unknown>>;
|
|
449
|
+
/** Delete a publish list. */
|
|
450
|
+
deletePublishList(graphId: string, listId: string): Promise<void>;
|
|
451
|
+
/** Add target graphs as members of a publish list. */
|
|
452
|
+
addPublishListMembers(graphId: string, listId: string, targetGraphIds: string[]): Promise<Record<string, unknown>>;
|
|
453
|
+
/** Remove a single member from a publish list. */
|
|
454
|
+
removePublishListMember(graphId: string, listId: string, memberId: string): Promise<{
|
|
455
|
+
deleted: boolean;
|
|
456
|
+
}>;
|
|
291
457
|
/**
|
|
292
458
|
* Await an SDK-generated `opXxx(...)` call, throw a readable error on
|
|
293
459
|
* non-2xx, and return the `OperationEnvelope` on success.
|
|
@@ -107,6 +107,25 @@ class LedgerClient {
|
|
|
107
107
|
const envelope = await this.callOperation('Create taxonomy', (0, sdk_gen_1.opCreateTaxonomy)({ path: { graph_id: graphId }, body }));
|
|
108
108
|
return (envelope.result ?? {});
|
|
109
109
|
}
|
|
110
|
+
/** Update mutable fields on a taxonomy. `taxonomy_type` is immutable. */
|
|
111
|
+
async updateTaxonomy(graphId, body) {
|
|
112
|
+
const envelope = await this.callOperation('Update taxonomy', (0, sdk_gen_1.opUpdateTaxonomy)({ path: { graph_id: graphId }, body }));
|
|
113
|
+
return (envelope.result ?? {});
|
|
114
|
+
}
|
|
115
|
+
/** Soft-delete a taxonomy (`is_active=false`). */
|
|
116
|
+
async deleteTaxonomy(graphId, taxonomyId) {
|
|
117
|
+
const body = { taxonomy_id: taxonomyId };
|
|
118
|
+
const envelope = await this.callOperation('Delete taxonomy', (0, sdk_gen_1.opDeleteTaxonomy)({ path: { graph_id: graphId }, body }));
|
|
119
|
+
return (envelope.result ?? {});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Link the graph's entity to a taxonomy (ENTITY_HAS_TAXONOMY edge).
|
|
123
|
+
* Idempotent — returns existing linkage if already present.
|
|
124
|
+
*/
|
|
125
|
+
async linkEntityTaxonomy(graphId, body) {
|
|
126
|
+
const envelope = await this.callOperation('Link entity taxonomy', (0, sdk_gen_1.opLinkEntityTaxonomy)({ path: { graph_id: graphId }, body }));
|
|
127
|
+
return (envelope.result ?? {});
|
|
128
|
+
}
|
|
110
129
|
/** List elements (CoA accounts, GAAP concepts, etc.) with filters. */
|
|
111
130
|
async listElements(graphId, options) {
|
|
112
131
|
return this.gqlQuery(graphId, graphql_1.ListLedgerElementsDocument, {
|
|
@@ -122,6 +141,22 @@ class LedgerClient {
|
|
|
122
141
|
async listUnmappedElements(graphId, options) {
|
|
123
142
|
return this.gqlQuery(graphId, graphql_1.ListLedgerUnmappedElementsDocument, { mappingId: options?.mappingId ?? null }, 'List unmapped elements', (data) => data.unmappedElements);
|
|
124
143
|
}
|
|
144
|
+
/** Create a new element within a taxonomy (native CoA account, etc.). */
|
|
145
|
+
async createElement(graphId, body) {
|
|
146
|
+
const envelope = await this.callOperation('Create element', (0, sdk_gen_1.opCreateElement)({ path: { graph_id: graphId }, body }));
|
|
147
|
+
return (envelope.result ?? {});
|
|
148
|
+
}
|
|
149
|
+
/** Update mutable fields on an element. `taxonomy_id` and `source` are immutable. */
|
|
150
|
+
async updateElement(graphId, body) {
|
|
151
|
+
const envelope = await this.callOperation('Update element', (0, sdk_gen_1.opUpdateElement)({ path: { graph_id: graphId }, body }));
|
|
152
|
+
return (envelope.result ?? {});
|
|
153
|
+
}
|
|
154
|
+
/** Soft-delete an element (`is_active=false`). */
|
|
155
|
+
async deleteElement(graphId, elementId) {
|
|
156
|
+
const body = { element_id: elementId };
|
|
157
|
+
const envelope = await this.callOperation('Delete element', (0, sdk_gen_1.opDeleteElement)({ path: { graph_id: graphId }, body }));
|
|
158
|
+
return (envelope.result ?? {});
|
|
159
|
+
}
|
|
125
160
|
// ── Structures ──────────────────────────────────────────────────────
|
|
126
161
|
/** List reporting structures (IS, BS, CF, schedules) with optional filters. */
|
|
127
162
|
async listStructures(graphId, options) {
|
|
@@ -139,6 +174,28 @@ class LedgerClient {
|
|
|
139
174
|
const envelope = await this.callOperation('Create structure', (0, sdk_gen_1.opCreateStructure)({ path: { graph_id: graphId }, body }));
|
|
140
175
|
return envelope.result;
|
|
141
176
|
}
|
|
177
|
+
/** Convenience wrapper — create a CoA→GAAP mapping structure. */
|
|
178
|
+
async createMappingStructure(graphId, options) {
|
|
179
|
+
const body = {
|
|
180
|
+
name: options?.name ?? 'CoA to Reporting',
|
|
181
|
+
structure_type: 'coa_mapping',
|
|
182
|
+
taxonomy_id: options?.taxonomyId ?? 'tax_usgaap_reporting',
|
|
183
|
+
description: options?.description ?? 'Map Chart of Accounts to US GAAP reporting concepts',
|
|
184
|
+
};
|
|
185
|
+
const envelope = await this.callOperation('Create mapping structure', (0, sdk_gen_1.opCreateStructure)({ path: { graph_id: graphId }, body }));
|
|
186
|
+
return envelope.result;
|
|
187
|
+
}
|
|
188
|
+
/** Update mutable fields on a structure. `structure_type` is immutable. */
|
|
189
|
+
async updateStructure(graphId, body) {
|
|
190
|
+
const envelope = await this.callOperation('Update structure', (0, sdk_gen_1.opUpdateStructure)({ path: { graph_id: graphId }, body }));
|
|
191
|
+
return (envelope.result ?? {});
|
|
192
|
+
}
|
|
193
|
+
/** Soft-delete a structure (`is_active=false`). */
|
|
194
|
+
async deleteStructure(graphId, structureId) {
|
|
195
|
+
const body = { structure_id: structureId };
|
|
196
|
+
const envelope = await this.callOperation('Delete structure', (0, sdk_gen_1.opDeleteStructure)({ path: { graph_id: graphId }, body }));
|
|
197
|
+
return (envelope.result ?? {});
|
|
198
|
+
}
|
|
142
199
|
// ── Mappings ────────────────────────────────────────────────────────
|
|
143
200
|
/** List active CoA→reporting mapping structures. */
|
|
144
201
|
async listMappings(graphId) {
|
|
@@ -172,6 +229,23 @@ class LedgerClient {
|
|
|
172
229
|
const envelope = await this.callOperation('Auto-map elements', (0, sdk_gen_1.opAutoMapElements)({ path: { graph_id: graphId }, body }));
|
|
173
230
|
return { operationId: envelope.operationId, status: envelope.status };
|
|
174
231
|
}
|
|
232
|
+
/** Bulk create associations within a single structure, atomically. */
|
|
233
|
+
async createAssociations(graphId, structureId, associations) {
|
|
234
|
+
const body = { structure_id: structureId, associations };
|
|
235
|
+
const envelope = await this.callOperation('Create associations', (0, sdk_gen_1.opCreateAssociations)({ path: { graph_id: graphId }, body }));
|
|
236
|
+
return (envelope.result ?? {});
|
|
237
|
+
}
|
|
238
|
+
/** Update mutable fields on an association (order, weight, confidence). */
|
|
239
|
+
async updateAssociation(graphId, body) {
|
|
240
|
+
const envelope = await this.callOperation('Update association', (0, sdk_gen_1.opUpdateAssociation)({ path: { graph_id: graphId }, body }));
|
|
241
|
+
return (envelope.result ?? {});
|
|
242
|
+
}
|
|
243
|
+
/** Hard-delete an association (any type: presentation, calculation, mapping). */
|
|
244
|
+
async deleteAssociation(graphId, associationId) {
|
|
245
|
+
const body = { association_id: associationId };
|
|
246
|
+
const envelope = await this.callOperation('Delete association', (0, sdk_gen_1.opDeleteAssociation)({ path: { graph_id: graphId }, body }));
|
|
247
|
+
return (envelope.result ?? { deleted: true });
|
|
248
|
+
}
|
|
175
249
|
// ── Schedules ──────────────────────────────────────────────────────
|
|
176
250
|
/** List all schedule structures with metadata. */
|
|
177
251
|
async listSchedules(graphId) {
|
|
@@ -222,6 +296,17 @@ class LedgerClient {
|
|
|
222
296
|
totalFacts: raw.total_facts,
|
|
223
297
|
};
|
|
224
298
|
}
|
|
299
|
+
/** Update mutable fields on a schedule (name, entry_template, metadata). */
|
|
300
|
+
async updateSchedule(graphId, body) {
|
|
301
|
+
const envelope = await this.callOperation('Update schedule', (0, sdk_gen_1.opUpdateSchedule)({ path: { graph_id: graphId }, body }));
|
|
302
|
+
return (envelope.result ?? {});
|
|
303
|
+
}
|
|
304
|
+
/** Permanently delete a schedule (cascades through facts + associations). */
|
|
305
|
+
async deleteSchedule(graphId, structureId) {
|
|
306
|
+
const body = { structure_id: structureId };
|
|
307
|
+
const envelope = await this.callOperation('Delete schedule', (0, sdk_gen_1.opDeleteSchedule)({ path: { graph_id: graphId }, body }));
|
|
308
|
+
return (envelope.result ?? { deleted: true });
|
|
309
|
+
}
|
|
225
310
|
/** Truncate a schedule — end it early at `newEndDate`. */
|
|
226
311
|
async truncateSchedule(graphId, structureId, options) {
|
|
227
312
|
const body = {
|
|
@@ -340,7 +425,71 @@ class LedgerClient {
|
|
|
340
425
|
const envelope = await this.callOperation('Reopen period', (0, sdk_gen_1.opReopenPeriod)({ path: { graph_id: graphId }, body }));
|
|
341
426
|
return rawFiscalCalendarToCamel(envelope.result);
|
|
342
427
|
}
|
|
343
|
-
//
|
|
428
|
+
// ── Journal entries (native accounting writes) ──────────────────────
|
|
429
|
+
/**
|
|
430
|
+
* Create a journal entry with balanced line items (DR=CR enforced).
|
|
431
|
+
*
|
|
432
|
+
* Defaults to `status='draft'`. Pass `status='posted'` for historical
|
|
433
|
+
* data import where entries represent already-happened business events.
|
|
434
|
+
*
|
|
435
|
+
* Supply `idempotencyKey` to make the call safe to retry — replays
|
|
436
|
+
* within 24 hours return the same envelope. Reusing the key with a
|
|
437
|
+
* different body returns HTTP 409.
|
|
438
|
+
*/
|
|
439
|
+
async createJournalEntry(graphId, options) {
|
|
440
|
+
const body = {
|
|
441
|
+
posting_date: options.postingDate,
|
|
442
|
+
memo: options.memo,
|
|
443
|
+
line_items: options.lineItems.map((li) => ({
|
|
444
|
+
element_id: li.elementId,
|
|
445
|
+
debit_amount: li.debitAmount,
|
|
446
|
+
credit_amount: li.creditAmount,
|
|
447
|
+
description: li.description ?? null,
|
|
448
|
+
})),
|
|
449
|
+
type: options.type,
|
|
450
|
+
status: options.status,
|
|
451
|
+
transaction_id: options.transactionId ?? null,
|
|
452
|
+
};
|
|
453
|
+
const envelope = await this.callOperation('Create journal entry', (0, sdk_gen_1.opCreateJournalEntry)({ path: { graph_id: graphId }, body }));
|
|
454
|
+
return (envelope.result ?? {});
|
|
455
|
+
}
|
|
456
|
+
/** Update a draft journal entry. Posted entries are immutable. */
|
|
457
|
+
async updateJournalEntry(graphId, body) {
|
|
458
|
+
const envelope = await this.callOperation('Update journal entry', (0, sdk_gen_1.opUpdateJournalEntry)({ path: { graph_id: graphId }, body }));
|
|
459
|
+
return (envelope.result ?? {});
|
|
460
|
+
}
|
|
461
|
+
/** Hard-delete a draft journal entry. Posted entries must be reversed. */
|
|
462
|
+
async deleteJournalEntry(graphId, entryId) {
|
|
463
|
+
const body = { entry_id: entryId };
|
|
464
|
+
const envelope = await this.callOperation('Delete journal entry', (0, sdk_gen_1.opDeleteJournalEntry)({ path: { graph_id: graphId }, body }));
|
|
465
|
+
return (envelope.result ?? { deleted: true });
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Reverse a posted journal entry — creates an offsetting entry and marks
|
|
469
|
+
* the original as reversed.
|
|
470
|
+
*/
|
|
471
|
+
async reverseJournalEntry(graphId, entryId, options) {
|
|
472
|
+
const body = {
|
|
473
|
+
entry_id: entryId,
|
|
474
|
+
posting_date: options?.postingDate ?? null,
|
|
475
|
+
memo: options?.memo ?? null,
|
|
476
|
+
};
|
|
477
|
+
const envelope = await this.callOperation('Reverse journal entry', (0, sdk_gen_1.opReverseJournalEntry)({ path: { graph_id: graphId }, body }));
|
|
478
|
+
return (envelope.result ?? {});
|
|
479
|
+
}
|
|
480
|
+
// ── Fact grid (graph-backed analytical query) ─────────────────────
|
|
481
|
+
/**
|
|
482
|
+
* Build a multi-dimensional fact grid against the graph schema.
|
|
483
|
+
*
|
|
484
|
+
* Runs against LadybugDB (not the extensions OLTP database) and returns
|
|
485
|
+
* a deduplicated pivot table of XBRL facts. Works for both roboledger
|
|
486
|
+
* tenant graphs (after materialization) and the SEC shared repository.
|
|
487
|
+
*/
|
|
488
|
+
async buildFactGrid(graphId, body) {
|
|
489
|
+
const envelope = await this.callOperation('Build fact grid', (0, sdk_gen_1.opBuildFactGrid)({ path: { graph_id: graphId }, body }));
|
|
490
|
+
return (envelope.result ?? {});
|
|
491
|
+
}
|
|
492
|
+
// ── Reports, statements, and publish lists ──────────────────────────────
|
|
344
493
|
// ── Internal helpers ────────────────────────────────────────────────
|
|
345
494
|
/**
|
|
346
495
|
* Run a typed GraphQL query against the per-graph endpoint and
|
|
@@ -349,7 +498,6 @@ class LedgerClient {
|
|
|
349
498
|
async gqlQuery(graphId, document, variables, label, pick) {
|
|
350
499
|
try {
|
|
351
500
|
const client = this.gql.get(graphId);
|
|
352
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
353
501
|
const raw = client.request;
|
|
354
502
|
// graphql-request's overloads don't cleanly resolve for generic
|
|
355
503
|
// helpers wrapping codegen's `Exact<>` var types, so we bypass
|
|
@@ -364,6 +512,157 @@ class LedgerClient {
|
|
|
364
512
|
throw err;
|
|
365
513
|
}
|
|
366
514
|
}
|
|
515
|
+
// ── Reports ─────────────────────────────────────────────────────────
|
|
516
|
+
/**
|
|
517
|
+
* Kick off report creation (async). Use the returned `operationId` to
|
|
518
|
+
* subscribe to progress via SSE, then call `getReport()` once finished.
|
|
519
|
+
*/
|
|
520
|
+
async createReport(graphId, options) {
|
|
521
|
+
const body = {
|
|
522
|
+
name: options.name,
|
|
523
|
+
mapping_id: options.mappingId,
|
|
524
|
+
period_start: options.periodStart,
|
|
525
|
+
period_end: options.periodEnd,
|
|
526
|
+
taxonomy_id: options.taxonomyId ?? 'tax_usgaap_reporting',
|
|
527
|
+
period_type: options.periodType ?? 'quarterly',
|
|
528
|
+
comparative: options.comparative ?? true,
|
|
529
|
+
};
|
|
530
|
+
if (options.periods && options.periods.length > 0) {
|
|
531
|
+
body.periods = options.periods;
|
|
532
|
+
}
|
|
533
|
+
const envelope = await this.callOperation('Create report', (0, sdk_gen_1.opCreateReport)({ path: { graph_id: graphId }, body }));
|
|
534
|
+
return {
|
|
535
|
+
operationId: envelope.operationId,
|
|
536
|
+
status: envelope.status,
|
|
537
|
+
result: envelope.result ?? null,
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
/** List all reports for a graph (includes received shared reports). */
|
|
541
|
+
async listReports(graphId) {
|
|
542
|
+
const list = await this.gqlQuery(graphId, graphql_1.ListLedgerReportsDocument, undefined, 'List reports', (data) => data.reports);
|
|
543
|
+
return list?.reports ?? [];
|
|
544
|
+
}
|
|
545
|
+
/** Get a single report with its period list + available structures. */
|
|
546
|
+
async getReport(graphId, reportId) {
|
|
547
|
+
return this.gqlQuery(graphId, graphql_1.GetLedgerReportDocument, { reportId }, 'Get report', (data) => data.report);
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Render a financial statement — facts viewed through a structure.
|
|
551
|
+
*
|
|
552
|
+
* @param structureType - income_statement, balance_sheet, cash_flow_statement
|
|
553
|
+
*/
|
|
554
|
+
async getStatement(graphId, reportId, structureType) {
|
|
555
|
+
return this.gqlQuery(graphId, graphql_1.GetLedgerStatementDocument, { reportId, structureType }, 'Get statement', (data) => data.statement);
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Regenerate an existing report (async). Returns an operation id;
|
|
559
|
+
* subscribe via SSE for progress.
|
|
560
|
+
*/
|
|
561
|
+
async regenerateReport(graphId, reportId, periodStart, periodEnd) {
|
|
562
|
+
const envelope = await this.callOperation('Regenerate report', (0, sdk_gen_1.opRegenerateReport)({
|
|
563
|
+
path: { graph_id: graphId },
|
|
564
|
+
body: {
|
|
565
|
+
report_id: reportId,
|
|
566
|
+
period_start: periodStart,
|
|
567
|
+
period_end: periodEnd,
|
|
568
|
+
},
|
|
569
|
+
}));
|
|
570
|
+
return {
|
|
571
|
+
operationId: envelope.operationId,
|
|
572
|
+
status: envelope.status,
|
|
573
|
+
result: envelope.result ?? null,
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
/** Delete a report and its generated facts. */
|
|
577
|
+
async deleteReport(graphId, reportId) {
|
|
578
|
+
await this.callOperation('Delete report', (0, sdk_gen_1.opDeleteReport)({
|
|
579
|
+
path: { graph_id: graphId },
|
|
580
|
+
body: { report_id: reportId },
|
|
581
|
+
}));
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Share a published report to every member of a publish list (async).
|
|
585
|
+
* Each target graph receives a snapshot copy of the report's facts.
|
|
586
|
+
*/
|
|
587
|
+
async shareReport(graphId, reportId, publishListId) {
|
|
588
|
+
const envelope = await this.callOperation('Share report', (0, sdk_gen_1.opShareReport)({
|
|
589
|
+
path: { graph_id: graphId },
|
|
590
|
+
body: {
|
|
591
|
+
report_id: reportId,
|
|
592
|
+
publish_list_id: publishListId,
|
|
593
|
+
},
|
|
594
|
+
}));
|
|
595
|
+
return {
|
|
596
|
+
operationId: envelope.operationId,
|
|
597
|
+
status: envelope.status,
|
|
598
|
+
result: envelope.result ?? null,
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
/** Check if a report was received via sharing (vs locally created). */
|
|
602
|
+
isSharedReport(report) {
|
|
603
|
+
return report.sourceGraphId !== null;
|
|
604
|
+
}
|
|
605
|
+
// ── Publish Lists ────────────────────────────────────────────────────
|
|
606
|
+
/** List publish lists with pagination. */
|
|
607
|
+
async listPublishLists(graphId, options) {
|
|
608
|
+
const list = await this.gqlQuery(graphId, graphql_1.ListLedgerPublishListsDocument, {
|
|
609
|
+
limit: options?.limit ?? 100,
|
|
610
|
+
offset: options?.offset ?? 0,
|
|
611
|
+
}, 'List publish lists', (data) => data.publishLists);
|
|
612
|
+
return list?.publishLists ?? [];
|
|
613
|
+
}
|
|
614
|
+
/** Create a new publish list. */
|
|
615
|
+
async createPublishList(graphId, name, description) {
|
|
616
|
+
const body = {
|
|
617
|
+
name,
|
|
618
|
+
description: description ?? null,
|
|
619
|
+
};
|
|
620
|
+
const envelope = await this.callOperation('Create publish list', (0, sdk_gen_1.opCreatePublishList)({ path: { graph_id: graphId }, body }));
|
|
621
|
+
return (envelope.result ?? {});
|
|
622
|
+
}
|
|
623
|
+
/** Get a single publish list with its full member list. */
|
|
624
|
+
async getPublishList(graphId, listId) {
|
|
625
|
+
return this.gqlQuery(graphId, graphql_1.GetLedgerPublishListDocument, { listId }, 'Get publish list', (data) => data.publishList);
|
|
626
|
+
}
|
|
627
|
+
/** Update a publish list's name or description. */
|
|
628
|
+
async updatePublishList(graphId, listId, updates) {
|
|
629
|
+
const envelope = await this.callOperation('Update publish list', (0, sdk_gen_1.opUpdatePublishList)({
|
|
630
|
+
path: { graph_id: graphId },
|
|
631
|
+
body: {
|
|
632
|
+
list_id: listId,
|
|
633
|
+
name: updates.name,
|
|
634
|
+
description: updates.description ?? null,
|
|
635
|
+
},
|
|
636
|
+
}));
|
|
637
|
+
return (envelope.result ?? {});
|
|
638
|
+
}
|
|
639
|
+
/** Delete a publish list. */
|
|
640
|
+
async deletePublishList(graphId, listId) {
|
|
641
|
+
await this.callOperation('Delete publish list', (0, sdk_gen_1.opDeletePublishList)({
|
|
642
|
+
path: { graph_id: graphId },
|
|
643
|
+
body: { list_id: listId },
|
|
644
|
+
}));
|
|
645
|
+
}
|
|
646
|
+
/** Add target graphs as members of a publish list. */
|
|
647
|
+
async addPublishListMembers(graphId, listId, targetGraphIds) {
|
|
648
|
+
const envelope = await this.callOperation('Add publish list members', (0, sdk_gen_1.opAddPublishListMembers)({
|
|
649
|
+
path: { graph_id: graphId },
|
|
650
|
+
body: {
|
|
651
|
+
list_id: listId,
|
|
652
|
+
target_graph_ids: targetGraphIds,
|
|
653
|
+
},
|
|
654
|
+
}));
|
|
655
|
+
return (envelope.result ?? {});
|
|
656
|
+
}
|
|
657
|
+
/** Remove a single member from a publish list. */
|
|
658
|
+
async removePublishListMember(graphId, listId, memberId) {
|
|
659
|
+
const envelope = await this.callOperation('Remove publish list member', (0, sdk_gen_1.opRemovePublishListMember)({
|
|
660
|
+
path: { graph_id: graphId },
|
|
661
|
+
body: { list_id: listId, member_id: memberId },
|
|
662
|
+
}));
|
|
663
|
+
return (envelope.result ?? { deleted: true });
|
|
664
|
+
}
|
|
665
|
+
// ── Internal helpers ────────────────────────────────────────────────
|
|
367
666
|
/**
|
|
368
667
|
* Await an SDK-generated `opXxx(...)` call, throw a readable error on
|
|
369
668
|
* non-2xx, and return the `OperationEnvelope` on success.
|