@robosystems/client 2.8.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/LedgerClient.d.ts +56 -17
- package/artifacts/LedgerClient.js +68 -25
- package/artifacts/LedgerClient.ts +113 -29
- package/artifacts/graphql/generated/graphql.d.ts +22 -5
- package/artifacts/graphql/generated/graphql.js +177 -0
- package/artifacts/graphql/generated/graphql.ts +209 -5
- package/artifacts/graphql/queries/ledger/accountRollups.js +12 -2
- package/artifacts/graphql/queries/ledger/accountRollups.ts +12 -2
- package/artifacts/graphql/queries/ledger/accountTree.js +2 -2
- package/artifacts/graphql/queries/ledger/accountTree.ts +2 -2
- package/artifacts/graphql/queries/ledger/accounts.js +8 -1
- package/artifacts/graphql/queries/ledger/accounts.ts +8 -1
- package/artifacts/graphql/queries/ledger/closingBookStructures.js +2 -2
- package/artifacts/graphql/queries/ledger/closingBookStructures.ts +2 -2
- package/artifacts/graphql/queries/ledger/entities.js +1 -0
- package/artifacts/graphql/queries/ledger/entities.ts +1 -0
- package/artifacts/graphql/queries/ledger/entity.js +4 -2
- package/artifacts/graphql/queries/ledger/entity.ts +4 -2
- package/artifacts/graphql/queries/ledger/eventBlocks.js +2 -0
- package/artifacts/graphql/queries/ledger/eventBlocks.ts +2 -0
- package/artifacts/graphql/queries/ledger/fiscalCalendar.js +3 -2
- package/artifacts/graphql/queries/ledger/fiscalCalendar.ts +3 -2
- package/artifacts/graphql/queries/ledger/journalEntries.js +2 -0
- package/artifacts/graphql/queries/ledger/journalEntries.ts +2 -0
- package/artifacts/graphql/queries/ledger/periodCloseStatus.js +2 -2
- package/artifacts/graphql/queries/ledger/periodCloseStatus.ts +2 -2
- package/artifacts/graphql/queries/ledger/periodDrafts.js +2 -2
- package/artifacts/graphql/queries/ledger/periodDrafts.ts +2 -2
- package/artifacts/graphql/queries/ledger/reconciliations.js +2 -2
- package/artifacts/graphql/queries/ledger/reconciliations.ts +2 -2
- package/artifacts/graphql/queries/ledger/report.js +1 -0
- package/artifacts/graphql/queries/ledger/report.ts +1 -0
- package/artifacts/graphql/queries/ledger/reports.js +3 -2
- package/artifacts/graphql/queries/ledger/reports.ts +3 -2
- package/artifacts/graphql/queries/ledger/summary.js +3 -2
- package/artifacts/graphql/queries/ledger/summary.ts +3 -2
- package/artifacts/graphql/queries/ledger/transactions.js +2 -0
- package/artifacts/graphql/queries/ledger/transactions.ts +2 -0
- package/artifacts/graphql/queries/ledger/trialBalance.js +2 -2
- package/artifacts/graphql/queries/ledger/trialBalance.ts +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssociationResponse, AutoMapElementsOperation, BindTextBlockRequest, BindTextBlockResponse, BlockedSourceGraphResponse, BlockSourceGraphResult, ComputeMetricsRequest, ComputeMetricsResponse, CreateAgentRequest, CreateEventBlockRequest, CreateEventHandlerRequest, CreateInformationBlockRequest, CreateMappingAssociationOperation, CreateTaxonomyBlockRequest, CreateViewRequest, DeleteInformationBlockRequest, DeleteInformationBlockResponse, DeleteMappingAssociationOperation, DeleteResult, DeleteTaxonomyBlockRequest, DeleteTaxonomyBlockResponse, EntityTaxonomyResponse, EvaluateRulesRequest, EvaluateRulesResponse, EventBlockEnvelope, EventHandlerResponse, FinancialStatementAnalysisRequest, FinancialStatementAnalysisResponse, InformationBlockEnvelope, InitializeChartOfAccountsRequest, JournalEntryResponse, LedgerAgentResponse, LinkEntityTaxonomyRequest, LiveFinancialStatementRequest, LiveFinancialStatementResponse, OperationEnvelope, PreviewEventBlockResponse, PreviewReconciliationsRequest, PromoteObligationsRequest, PromoteObligationsResponse, PublishListMemberResponse, PublishListResponse, ReconcilingItemPlan, ReportResponse, ResolveReconcilingItemRequest, ResolveReconcilingItemResponse, RevokeReportShareResponse, ShareReportResponse, TaxonomyBlockEnvelope, UpdateAgentRequest, UpdateEntityRequest, UpdateEventBlockRequest, UpdateEventHandlerRequest, UpdateInformationBlockRequest, UpdateJournalEntryRequest, UpdateTaxonomyBlockRequest, ViewResponse } from '../types.gen';
|
|
1
|
+
import type { AssociationResponse, AutoMapElementsOperation, BindTextBlockRequest, BindTextBlockResponse, BlockedSourceGraphResponse, BlockSourceGraphResult, ComputeMetricsRequest, ComputeMetricsResponse, CreateAgentRequest, CreateEntityRequest, CreateEventBlockRequest, CreateEventHandlerRequest, CreateInformationBlockRequest, CreateMappingAssociationOperation, CreateTaxonomyBlockRequest, CreateViewRequest, DeleteInformationBlockRequest, DeleteInformationBlockResponse, DeleteMappingAssociationOperation, DeleteResult, DeleteTaxonomyBlockRequest, DeleteTaxonomyBlockResponse, EntityTaxonomyResponse, EvaluateRulesRequest, EvaluateRulesResponse, EventBlockEnvelope, EventHandlerResponse, FinancialStatementAnalysisRequest, FinancialStatementAnalysisResponse, InformationBlockEnvelope, InitializeChartOfAccountsRequest, JournalEntryResponse, LedgerAgentResponse, LinkEntityTaxonomyRequest, LiveFinancialStatementRequest, LiveFinancialStatementResponse, OperationEnvelope, PreviewEventBlockResponse, PreviewReconciliationsRequest, PromoteObligationsRequest, PromoteObligationsResponse, PublishListMemberResponse, PublishListResponse, ReconcilingItemPlan, ReportResponse, ResolveReconcilingItemRequest, ResolveReconcilingItemResponse, RevokeReportShareResponse, ShareReportResponse, TaxonomyBlockEnvelope, UpdateAgentRequest, UpdateEntityRequest, UpdateEventBlockRequest, UpdateEventHandlerRequest, UpdateInformationBlockRequest, UpdateJournalEntryRequest, UpdateTaxonomyBlockRequest, ViewResponse } 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 ListChartTemplatesQuery, type ListInformationBlocksQuery, type ListLedgerAccountsQuery, type ListLedgerAgentsQuery, type ListLedgerBlockedSourceGraphsQuery, type ListLedgerElementsQuery, type ListLedgerEntitiesQuery, type ListLedgerEventBlocksQuery, type ListLedgerJournalEntriesQuery, type ListLedgerMappingsQuery, type ListLedgerPublishListsQuery, type ListLedgerReconciliationsQuery, type ListLedgerReportsQuery, type ListLedgerStructuresQuery, type ListLedgerTaxonomiesQuery, type ListLedgerTransactionsQuery, type ListLedgerUnmappedElementsQuery, type MappingCandidatesQuery, type ReportDownloadFormat, type ReportLifecycle } from './graphql/generated/graphql';
|
|
4
4
|
export { GraphQLError } from './graphql/client';
|
|
@@ -167,6 +167,8 @@ export interface ScheduleCreated {
|
|
|
167
167
|
}
|
|
168
168
|
export type LedgerEntryType = 'standard' | 'adjusting' | 'closing' | 'reversing';
|
|
169
169
|
export interface InitializeLedgerOptions {
|
|
170
|
+
/** The entity whose calendar is seeded. Omitted: the group parent. */
|
|
171
|
+
entityId?: string | null;
|
|
170
172
|
closedThrough?: string | null;
|
|
171
173
|
fiscalYearStartMonth?: number;
|
|
172
174
|
earliestDataPeriod?: string | null;
|
|
@@ -176,6 +178,8 @@ export interface InitializeLedgerOptions {
|
|
|
176
178
|
/** A shipped chart template key — the `key` of a `listChartTemplates()` row. */
|
|
177
179
|
export type ChartTemplateKey = InitializeChartOfAccountsRequest['template'];
|
|
178
180
|
export interface InitializeChartOfAccountsOptions {
|
|
181
|
+
/** The entity the chart belongs to. Omitted: the group parent. */
|
|
182
|
+
entityId?: string | null;
|
|
179
183
|
/**
|
|
180
184
|
* Legal form for the equity mapping: `corporation`, `llc` or `partnership`.
|
|
181
185
|
* Defaults to the graph's primary entity, then to corporation.
|
|
@@ -197,7 +201,16 @@ export interface InitializeChartOfAccountsResult {
|
|
|
197
201
|
/** Targets that did not resolve, or a framework this graph does not carry. Never fatal. */
|
|
198
202
|
unresolved: string[];
|
|
199
203
|
}
|
|
200
|
-
|
|
204
|
+
/**
|
|
205
|
+
* Which of the graph's entities a call is about. Omitted, it is the group
|
|
206
|
+
* parent: the entity the graph's own source connection books for. Every
|
|
207
|
+
* graph has one; a graph with subsidiaries has more, and each keeps its own
|
|
208
|
+
* books, chart and calendar.
|
|
209
|
+
*/
|
|
210
|
+
export interface EntityScopeOptions {
|
|
211
|
+
entityId?: string | null;
|
|
212
|
+
}
|
|
213
|
+
export interface ClosePeriodOptions extends EntityScopeOptions {
|
|
201
214
|
note?: string | null;
|
|
202
215
|
allowStaleSync?: boolean;
|
|
203
216
|
/**
|
|
@@ -362,11 +375,15 @@ export declare class LedgerClient {
|
|
|
362
375
|
private gql;
|
|
363
376
|
constructor(config: LedgerClientConfig);
|
|
364
377
|
/**
|
|
365
|
-
* Get
|
|
366
|
-
* Returns null when the ledger has no entity yet.
|
|
378
|
+
* Get an entity of this graph: the group parent, or the one `entityId`
|
|
379
|
+
* names. Returns null when the ledger has no entity yet.
|
|
380
|
+
*/
|
|
381
|
+
getEntity(graphId: string, options?: EntityScopeOptions): Promise<LedgerEntity | null>;
|
|
382
|
+
/**
|
|
383
|
+
* List the graph's entities, optionally filtered by source system. The
|
|
384
|
+
* group parent is the row with `isParent`; a subsidiary names its
|
|
385
|
+
* `parentEntityId` and may carry an `ownershipPct`.
|
|
367
386
|
*/
|
|
368
|
-
getEntity(graphId: string): Promise<LedgerEntity | null>;
|
|
369
|
-
/** List all entities for this graph, optionally filtered by source system. */
|
|
370
387
|
listEntities(graphId: string, options?: {
|
|
371
388
|
source?: string;
|
|
372
389
|
}): Promise<LedgerEntitySummary[]>;
|
|
@@ -375,22 +392,33 @@ export declare class LedgerClient {
|
|
|
375
392
|
* Returns the updated entity.
|
|
376
393
|
*/
|
|
377
394
|
updateEntity(graphId: string, updates: UpdateEntityRequest): Promise<LedgerEntity>;
|
|
395
|
+
/**
|
|
396
|
+
* Create an entity in this graph. A graph's first entity becomes the group
|
|
397
|
+
* parent; every later one is a subsidiary of the parent unless
|
|
398
|
+
* `parent_entity_id` names another entity. The `ticker` prefixes the
|
|
399
|
+
* entity's account names and is unique in the graph (derived from the
|
|
400
|
+
* name's initials when omitted). Returns the entity in the shape
|
|
401
|
+
* `getEntity` returns.
|
|
402
|
+
*/
|
|
403
|
+
createEntity(graphId: string, body: CreateEntityRequest): Promise<LedgerEntity>;
|
|
378
404
|
/** Ledger rollup counts + QB sync metadata. */
|
|
379
|
-
getSummary(graphId: string): Promise<LedgerSummary | null>;
|
|
405
|
+
getSummary(graphId: string, options?: EntityScopeOptions): Promise<LedgerSummary | null>;
|
|
380
406
|
/** List CoA accounts with optional filters and pagination. */
|
|
381
407
|
listAccounts(graphId: string, options?: {
|
|
382
408
|
classification?: string;
|
|
383
409
|
isActive?: boolean;
|
|
384
410
|
limit?: number;
|
|
385
411
|
offset?: number;
|
|
412
|
+
entityId?: string | null;
|
|
386
413
|
}): Promise<LedgerAccountList | null>;
|
|
387
414
|
/** Hierarchical Chart of Accounts (up to 4 levels deep). */
|
|
388
|
-
getAccountTree(graphId: string): Promise<LedgerAccountTree | null>;
|
|
415
|
+
getAccountTree(graphId: string, options?: EntityScopeOptions): Promise<LedgerAccountTree | null>;
|
|
389
416
|
/** Accounts rolled up to reporting concepts via a mapping structure. */
|
|
390
417
|
getAccountRollups(graphId: string, options?: {
|
|
391
418
|
mappingId?: string;
|
|
392
419
|
startDate?: string;
|
|
393
420
|
endDate?: string;
|
|
421
|
+
entityId?: string | null;
|
|
394
422
|
}): Promise<LedgerAccountRollups | null>;
|
|
395
423
|
/** List transactions with optional type + date filters and pagination. */
|
|
396
424
|
listTransactions(graphId: string, options?: {
|
|
@@ -399,6 +427,7 @@ export declare class LedgerClient {
|
|
|
399
427
|
endDate?: string;
|
|
400
428
|
limit?: number;
|
|
401
429
|
offset?: number;
|
|
430
|
+
entityId?: string | null;
|
|
402
431
|
}): Promise<LedgerTransactionList | null>;
|
|
403
432
|
/**
|
|
404
433
|
* List journal entries with their line items, newest first.
|
|
@@ -422,6 +451,7 @@ export declare class LedgerClient {
|
|
|
422
451
|
transactionId?: string;
|
|
423
452
|
limit?: number;
|
|
424
453
|
offset?: number;
|
|
454
|
+
entityId?: string | null;
|
|
425
455
|
}): Promise<LedgerJournalEntryList | null>;
|
|
426
456
|
/** Get transaction detail with entries + line items. */
|
|
427
457
|
getTransaction(graphId: string, transactionId: string): Promise<LedgerTransaction | null>;
|
|
@@ -442,6 +472,7 @@ export declare class LedgerClient {
|
|
|
442
472
|
isReconcilingItem?: boolean;
|
|
443
473
|
limit?: number;
|
|
444
474
|
offset?: number;
|
|
475
|
+
entityId?: string | null;
|
|
445
476
|
}): Promise<LedgerEventBlock[]>;
|
|
446
477
|
/** Get event block detail (carries the metadata blob with nested entries). */
|
|
447
478
|
getEventBlock(graphId: string, eventId: string): Promise<LedgerEventBlockDetail | null>;
|
|
@@ -463,6 +494,7 @@ export declare class LedgerClient {
|
|
|
463
494
|
getTrialBalance(graphId: string, options?: {
|
|
464
495
|
startDate?: string;
|
|
465
496
|
endDate?: string;
|
|
497
|
+
entityId?: string | null;
|
|
466
498
|
}): Promise<LedgerTrialBalance | null>;
|
|
467
499
|
/** Trial balance rolled up to GAAP reporting concepts via a mapping. */
|
|
468
500
|
getMappedTrialBalance(graphId: string, mappingId: string, options?: {
|
|
@@ -673,9 +705,9 @@ export declare class LedgerClient {
|
|
|
673
705
|
idempotencyKey?: string;
|
|
674
706
|
}): Promise<ComputeMetricsResponse>;
|
|
675
707
|
/** Close status for all schedules in a fiscal period. */
|
|
676
|
-
getPeriodCloseStatus(graphId: string, periodStart: string, periodEnd: string): Promise<LedgerPeriodCloseStatus | null>;
|
|
708
|
+
getPeriodCloseStatus(graphId: string, periodStart: string, periodEnd: string, options?: EntityScopeOptions): Promise<LedgerPeriodCloseStatus | null>;
|
|
677
709
|
/** All draft entries in a period, fully expanded for review pre-close. */
|
|
678
|
-
listPeriodDrafts(graphId: string, period: string): Promise<LedgerPeriodDrafts | null>;
|
|
710
|
+
listPeriodDrafts(graphId: string, period: string, options?: EntityScopeOptions): Promise<LedgerPeriodDrafts | null>;
|
|
679
711
|
/**
|
|
680
712
|
* Idempotently create (or refresh) a draft closing entry from a
|
|
681
713
|
* schedule for a period.
|
|
@@ -687,9 +719,12 @@ export declare class LedgerClient {
|
|
|
687
719
|
*/
|
|
688
720
|
createClosingEntry(graphId: string, structureId: string, postingDate: string, periodStart: string, periodEnd: string, memo?: string): Promise<EventBlockEnvelope>;
|
|
689
721
|
/** Grouped closing book structures for the close-screen sidebar. */
|
|
690
|
-
getClosingBookStructures(graphId: string): Promise<LedgerClosingBookStructures | null>;
|
|
691
|
-
/**
|
|
692
|
-
|
|
722
|
+
getClosingBookStructures(graphId: string, options?: EntityScopeOptions): Promise<LedgerClosingBookStructures | null>;
|
|
723
|
+
/**
|
|
724
|
+
* Current fiscal calendar state — pointers, gap, closeable status — for the
|
|
725
|
+
* group parent, or for the entity `entityId` names.
|
|
726
|
+
*/
|
|
727
|
+
getFiscalCalendar(graphId: string, options?: EntityScopeOptions): Promise<LedgerFiscalCalendar | null>;
|
|
693
728
|
/** One-time ledger initialization — seed fiscal calendar + periods. */
|
|
694
729
|
initializeLedger(graphId: string, options?: InitializeLedgerOptions): Promise<InitializeLedgerResult>;
|
|
695
730
|
/** Shipped chart-of-accounts templates for `initializeChartOfAccounts`. */
|
|
@@ -702,16 +737,19 @@ export declare class LedgerClient {
|
|
|
702
737
|
*/
|
|
703
738
|
initializeChartOfAccounts(graphId: string, template: ChartTemplateKey, options?: InitializeChartOfAccountsOptions): Promise<InitializeChartOfAccountsResult>;
|
|
704
739
|
/** Set the user-controlled close target (YYYY-MM). */
|
|
705
|
-
setCloseTarget(graphId: string, period: string, note?: string | null): Promise<LedgerFiscalCalendar>;
|
|
706
|
-
/**
|
|
740
|
+
setCloseTarget(graphId: string, period: string, note?: string | null, options?: EntityScopeOptions): Promise<LedgerFiscalCalendar>;
|
|
741
|
+
/**
|
|
742
|
+
* Close a fiscal period — the final commit action — on the group parent,
|
|
743
|
+
* or on the entity `entityId` names. Each entity closes on its own.
|
|
744
|
+
*/
|
|
707
745
|
closePeriod(graphId: string, period: string, options?: ClosePeriodOptions): Promise<ClosePeriodResult>;
|
|
708
746
|
/** Reopen a closed fiscal period. Requires a reason for the audit log. */
|
|
709
|
-
reopenPeriod(graphId: string, period: string, reason: string, note?: string | null): Promise<LedgerFiscalCalendar>;
|
|
747
|
+
reopenPeriod(graphId: string, period: string, reason: string, note?: string | null, options?: EntityScopeOptions): Promise<LedgerFiscalCalendar>;
|
|
710
748
|
/**
|
|
711
749
|
* Every reconciliation block's standing at a period end (YYYY-MM). A block
|
|
712
750
|
* not yet compared for the period reads `not_started`.
|
|
713
751
|
*/
|
|
714
|
-
listReconciliations(graphId: string, period: string): Promise<LedgerReconciliationList | null>;
|
|
752
|
+
listReconciliations(graphId: string, period: string, options?: EntityScopeOptions): Promise<LedgerReconciliationList | null>;
|
|
715
753
|
/**
|
|
716
754
|
* What changed on a reconciling item (a posted event whose source payload
|
|
717
755
|
* changed afterwards) and what each treatment would do. Writes nothing.
|
|
@@ -879,6 +917,7 @@ export declare class LedgerClient {
|
|
|
879
917
|
*/
|
|
880
918
|
listReports(graphId: string, options?: {
|
|
881
919
|
lifecycle?: ReportLifecycle;
|
|
920
|
+
entityId?: string | null;
|
|
882
921
|
}): Promise<ReportListItem[]>;
|
|
883
922
|
/** Get a single report with its period list + available structures. */
|
|
884
923
|
getReport(graphId: string, reportId: string): Promise<Report | null>;
|
|
@@ -18,13 +18,17 @@ class LedgerClient {
|
|
|
18
18
|
}
|
|
19
19
|
// ── Entity ──────────────────────────────────────────────────────────
|
|
20
20
|
/**
|
|
21
|
-
* Get
|
|
22
|
-
* Returns null when the ledger has no entity yet.
|
|
21
|
+
* Get an entity of this graph: the group parent, or the one `entityId`
|
|
22
|
+
* names. Returns null when the ledger has no entity yet.
|
|
23
23
|
*/
|
|
24
|
-
async getEntity(graphId) {
|
|
25
|
-
return this.gqlQuery(graphId, graphql_1.GetLedgerEntityDocument,
|
|
24
|
+
async getEntity(graphId, options) {
|
|
25
|
+
return this.gqlQuery(graphId, graphql_1.GetLedgerEntityDocument, { entityId: options?.entityId ?? null }, 'Get entity', (data) => data.entity);
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* List the graph's entities, optionally filtered by source system. The
|
|
29
|
+
* group parent is the row with `isParent`; a subsidiary names its
|
|
30
|
+
* `parentEntityId` and may carry an `ownershipPct`.
|
|
31
|
+
*/
|
|
28
32
|
async listEntities(graphId, options) {
|
|
29
33
|
return this.gqlQuery(graphId, graphql_1.ListLedgerEntitiesDocument, { source: options?.source ?? null }, 'List entities', (data) => data.entities);
|
|
30
34
|
}
|
|
@@ -44,10 +48,23 @@ class LedgerClient {
|
|
|
44
48
|
const raw = this.requireResult('Update entity', envelope.result);
|
|
45
49
|
return entityResponseToCamel(raw);
|
|
46
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Create an entity in this graph. A graph's first entity becomes the group
|
|
53
|
+
* parent; every later one is a subsidiary of the parent unless
|
|
54
|
+
* `parent_entity_id` names another entity. The `ticker` prefixes the
|
|
55
|
+
* entity's account names and is unique in the graph (derived from the
|
|
56
|
+
* name's initials when omitted). Returns the entity in the shape
|
|
57
|
+
* `getEntity` returns.
|
|
58
|
+
*/
|
|
59
|
+
async createEntity(graphId, body) {
|
|
60
|
+
const envelope = await this.callOperation('Create entity', (o) => (0, sdk_gen_1.createEntity)({ ...o, path: { graph_id: graphId }, body }));
|
|
61
|
+
const raw = this.requireResult('Create entity', envelope.result);
|
|
62
|
+
return entityResponseToCamel(raw);
|
|
63
|
+
}
|
|
47
64
|
// ── Summary ────────────────────────────────────────────────────────
|
|
48
65
|
/** Ledger rollup counts + QB sync metadata. */
|
|
49
|
-
async getSummary(graphId) {
|
|
50
|
-
return this.gqlQuery(graphId, graphql_1.GetLedgerSummaryDocument,
|
|
66
|
+
async getSummary(graphId, options) {
|
|
67
|
+
return this.gqlQuery(graphId, graphql_1.GetLedgerSummaryDocument, { entityId: options?.entityId ?? null }, 'Get summary', (data) => data.summary);
|
|
51
68
|
}
|
|
52
69
|
// ── Accounts (Chart of Accounts) ───────────────────────────────────
|
|
53
70
|
/** List CoA accounts with optional filters and pagination. */
|
|
@@ -57,11 +74,12 @@ class LedgerClient {
|
|
|
57
74
|
isActive: options?.isActive ?? null,
|
|
58
75
|
limit: options?.limit ?? 100,
|
|
59
76
|
offset: options?.offset ?? 0,
|
|
77
|
+
entityId: options?.entityId ?? null,
|
|
60
78
|
}, 'List accounts', (data) => data.accounts);
|
|
61
79
|
}
|
|
62
80
|
/** Hierarchical Chart of Accounts (up to 4 levels deep). */
|
|
63
|
-
async getAccountTree(graphId) {
|
|
64
|
-
return this.gqlQuery(graphId, graphql_1.GetLedgerAccountTreeDocument,
|
|
81
|
+
async getAccountTree(graphId, options) {
|
|
82
|
+
return this.gqlQuery(graphId, graphql_1.GetLedgerAccountTreeDocument, { entityId: options?.entityId ?? null }, 'Get account tree', (data) => data.accountTree);
|
|
65
83
|
}
|
|
66
84
|
/** Accounts rolled up to reporting concepts via a mapping structure. */
|
|
67
85
|
async getAccountRollups(graphId, options) {
|
|
@@ -69,6 +87,7 @@ class LedgerClient {
|
|
|
69
87
|
mappingId: options?.mappingId ?? null,
|
|
70
88
|
startDate: options?.startDate ?? null,
|
|
71
89
|
endDate: options?.endDate ?? null,
|
|
90
|
+
entityId: options?.entityId ?? null,
|
|
72
91
|
}, 'Get account rollups', (data) => data.accountRollups);
|
|
73
92
|
}
|
|
74
93
|
// ── Transactions ────────────────────────────────────────────────────
|
|
@@ -80,6 +99,7 @@ class LedgerClient {
|
|
|
80
99
|
endDate: options?.endDate ?? null,
|
|
81
100
|
limit: options?.limit ?? 100,
|
|
82
101
|
offset: options?.offset ?? 0,
|
|
102
|
+
entityId: options?.entityId ?? null,
|
|
83
103
|
}, 'List transactions', (data) => data.transactions);
|
|
84
104
|
}
|
|
85
105
|
// ── Journal entries ─────────────────────────────────────────────────
|
|
@@ -106,6 +126,7 @@ class LedgerClient {
|
|
|
106
126
|
transactionId: options?.transactionId ?? null,
|
|
107
127
|
limit: options?.limit ?? 100,
|
|
108
128
|
offset: options?.offset ?? 0,
|
|
129
|
+
entityId: options?.entityId ?? null,
|
|
109
130
|
}, 'List journal entries', (data) => data.journalEntries);
|
|
110
131
|
}
|
|
111
132
|
/** Get transaction detail with entries + line items. */
|
|
@@ -130,6 +151,7 @@ class LedgerClient {
|
|
|
130
151
|
isReconcilingItem: options?.isReconcilingItem ?? null,
|
|
131
152
|
limit: options?.limit ?? 50,
|
|
132
153
|
offset: options?.offset ?? 0,
|
|
154
|
+
entityId: options?.entityId ?? null,
|
|
133
155
|
}, 'List event blocks', (data) => data.eventBlocks);
|
|
134
156
|
}
|
|
135
157
|
/** Get event block detail (carries the metadata blob with nested entries). */
|
|
@@ -161,6 +183,7 @@ class LedgerClient {
|
|
|
161
183
|
return this.gqlQuery(graphId, graphql_1.GetLedgerTrialBalanceDocument, {
|
|
162
184
|
startDate: options?.startDate ?? null,
|
|
163
185
|
endDate: options?.endDate ?? null,
|
|
186
|
+
entityId: options?.entityId ?? null,
|
|
164
187
|
}, 'Get trial balance', (data) => data.trialBalance);
|
|
165
188
|
}
|
|
166
189
|
/** Trial balance rolled up to GAAP reporting concepts via a mapping. */
|
|
@@ -534,12 +557,12 @@ class LedgerClient {
|
|
|
534
557
|
}
|
|
535
558
|
// ── Period close ────────────────────────────────────────────────────
|
|
536
559
|
/** Close status for all schedules in a fiscal period. */
|
|
537
|
-
async getPeriodCloseStatus(graphId, periodStart, periodEnd) {
|
|
538
|
-
return this.gqlQuery(graphId, graphql_1.GetLedgerPeriodCloseStatusDocument, { periodStart, periodEnd }, 'Get period close status', (data) => data.periodCloseStatus);
|
|
560
|
+
async getPeriodCloseStatus(graphId, periodStart, periodEnd, options) {
|
|
561
|
+
return this.gqlQuery(graphId, graphql_1.GetLedgerPeriodCloseStatusDocument, { periodStart, periodEnd, entityId: options?.entityId ?? null }, 'Get period close status', (data) => data.periodCloseStatus);
|
|
539
562
|
}
|
|
540
563
|
/** All draft entries in a period, fully expanded for review pre-close. */
|
|
541
|
-
async listPeriodDrafts(graphId, period) {
|
|
542
|
-
return this.gqlQuery(graphId, graphql_1.GetLedgerPeriodDraftsDocument, { period }, 'List period drafts', (data) => data.periodDrafts);
|
|
564
|
+
async listPeriodDrafts(graphId, period, options) {
|
|
565
|
+
return this.gqlQuery(graphId, graphql_1.GetLedgerPeriodDraftsDocument, { period, entityId: options?.entityId ?? null }, 'List period drafts', (data) => data.periodDrafts);
|
|
543
566
|
}
|
|
544
567
|
/**
|
|
545
568
|
* Idempotently create (or refresh) a draft closing entry from a
|
|
@@ -571,17 +594,21 @@ class LedgerClient {
|
|
|
571
594
|
}
|
|
572
595
|
// ── Closing book ───────────────────────────────────────────────────
|
|
573
596
|
/** Grouped closing book structures for the close-screen sidebar. */
|
|
574
|
-
async getClosingBookStructures(graphId) {
|
|
575
|
-
return this.gqlQuery(graphId, graphql_1.GetLedgerClosingBookStructuresDocument,
|
|
597
|
+
async getClosingBookStructures(graphId, options) {
|
|
598
|
+
return this.gqlQuery(graphId, graphql_1.GetLedgerClosingBookStructuresDocument, { entityId: options?.entityId ?? null }, 'Get closing book structures', (data) => data.closingBookStructures);
|
|
576
599
|
}
|
|
577
600
|
// ── Fiscal Calendar ────────────────────────────────────────────────
|
|
578
|
-
/**
|
|
579
|
-
|
|
580
|
-
|
|
601
|
+
/**
|
|
602
|
+
* Current fiscal calendar state — pointers, gap, closeable status — for the
|
|
603
|
+
* group parent, or for the entity `entityId` names.
|
|
604
|
+
*/
|
|
605
|
+
async getFiscalCalendar(graphId, options) {
|
|
606
|
+
return this.gqlQuery(graphId, graphql_1.GetLedgerFiscalCalendarDocument, { entityId: options?.entityId ?? null }, 'Get fiscal calendar', (data) => data.fiscalCalendar);
|
|
581
607
|
}
|
|
582
608
|
/** One-time ledger initialization — seed fiscal calendar + periods. */
|
|
583
609
|
async initializeLedger(graphId, options) {
|
|
584
610
|
const body = {
|
|
611
|
+
entity_id: options?.entityId ?? null,
|
|
585
612
|
closed_through: options?.closedThrough ?? null,
|
|
586
613
|
fiscal_year_start_month: options?.fiscalYearStartMonth,
|
|
587
614
|
earliest_data_period: options?.earliestDataPeriod ?? null,
|
|
@@ -610,6 +637,7 @@ class LedgerClient {
|
|
|
610
637
|
async initializeChartOfAccounts(graphId, template, options) {
|
|
611
638
|
const body = {
|
|
612
639
|
template,
|
|
640
|
+
entity_id: options?.entityId ?? null,
|
|
613
641
|
entity_type: options?.entityType ?? null,
|
|
614
642
|
name: options?.name ?? null,
|
|
615
643
|
};
|
|
@@ -627,15 +655,23 @@ class LedgerClient {
|
|
|
627
655
|
};
|
|
628
656
|
}
|
|
629
657
|
/** Set the user-controlled close target (YYYY-MM). */
|
|
630
|
-
async setCloseTarget(graphId, period, note) {
|
|
631
|
-
const body = {
|
|
658
|
+
async setCloseTarget(graphId, period, note, options) {
|
|
659
|
+
const body = {
|
|
660
|
+
period,
|
|
661
|
+
note: note ?? null,
|
|
662
|
+
entity_id: options?.entityId ?? null,
|
|
663
|
+
};
|
|
632
664
|
const envelope = await this.callOperation('Set close target', (o) => (0, sdk_gen_1.setCloseTarget)({ ...o, path: { graph_id: graphId }, body }));
|
|
633
665
|
return rawFiscalCalendarToCamel(envelope.result);
|
|
634
666
|
}
|
|
635
|
-
/**
|
|
667
|
+
/**
|
|
668
|
+
* Close a fiscal period — the final commit action — on the group parent,
|
|
669
|
+
* or on the entity `entityId` names. Each entity closes on its own.
|
|
670
|
+
*/
|
|
636
671
|
async closePeriod(graphId, period, options) {
|
|
637
672
|
const body = {
|
|
638
673
|
period,
|
|
674
|
+
entity_id: options?.entityId ?? null,
|
|
639
675
|
note: options?.note ?? null,
|
|
640
676
|
allow_stale_sync: options?.allowStaleSync,
|
|
641
677
|
allow_stranded_obligations: options?.allowStrandedObligations,
|
|
@@ -657,11 +693,12 @@ class LedgerClient {
|
|
|
657
693
|
};
|
|
658
694
|
}
|
|
659
695
|
/** Reopen a closed fiscal period. Requires a reason for the audit log. */
|
|
660
|
-
async reopenPeriod(graphId, period, reason, note) {
|
|
696
|
+
async reopenPeriod(graphId, period, reason, note, options) {
|
|
661
697
|
const body = {
|
|
662
698
|
period,
|
|
663
699
|
reason,
|
|
664
700
|
note: note ?? null,
|
|
701
|
+
entity_id: options?.entityId ?? null,
|
|
665
702
|
};
|
|
666
703
|
const envelope = await this.callOperation('Reopen period', (o) => (0, sdk_gen_1.reopenPeriod)({ ...o, path: { graph_id: graphId }, body }));
|
|
667
704
|
return rawFiscalCalendarToCamel(envelope.result);
|
|
@@ -671,8 +708,8 @@ class LedgerClient {
|
|
|
671
708
|
* Every reconciliation block's standing at a period end (YYYY-MM). A block
|
|
672
709
|
* not yet compared for the period reads `not_started`.
|
|
673
710
|
*/
|
|
674
|
-
async listReconciliations(graphId, period) {
|
|
675
|
-
return this.gqlQuery(graphId, graphql_1.ListLedgerReconciliationsDocument, { period }, 'List reconciliations', (data) => data.reconciliations);
|
|
711
|
+
async listReconciliations(graphId, period, options) {
|
|
712
|
+
return this.gqlQuery(graphId, graphql_1.ListLedgerReconciliationsDocument, { period, entityId: options?.entityId ?? null }, 'List reconciliations', (data) => data.reconciliations);
|
|
676
713
|
}
|
|
677
714
|
/**
|
|
678
715
|
* What changed on a reconciling item (a posted event whose source payload
|
|
@@ -1016,7 +1053,10 @@ class LedgerClient {
|
|
|
1016
1053
|
* `ARCHIVED` returns only those, `ALL` every report.
|
|
1017
1054
|
*/
|
|
1018
1055
|
async listReports(graphId, options = {}) {
|
|
1019
|
-
const list = await this.gqlQuery(graphId, graphql_1.ListLedgerReportsDocument,
|
|
1056
|
+
const list = await this.gqlQuery(graphId, graphql_1.ListLedgerReportsDocument, {
|
|
1057
|
+
...(options.lifecycle ? { lifecycle: options.lifecycle } : {}),
|
|
1058
|
+
entityId: options.entityId ?? null,
|
|
1059
|
+
}, 'List reports', (data) => data.reports);
|
|
1020
1060
|
return list?.reports ?? [];
|
|
1021
1061
|
}
|
|
1022
1062
|
/** Get a single report with its period list + available structures. */
|
|
@@ -1335,6 +1375,7 @@ function rawObligationDetailToCamel(raw) {
|
|
|
1335
1375
|
function rawFiscalCalendarToCamel(raw) {
|
|
1336
1376
|
return {
|
|
1337
1377
|
graphId: raw.graph_id,
|
|
1378
|
+
entityId: raw.entity_id ?? null,
|
|
1338
1379
|
fiscalYearStartMonth: raw.fiscal_year_start_month,
|
|
1339
1380
|
closedThrough: raw.closed_through ?? null,
|
|
1340
1381
|
closeTarget: raw.close_target ?? null,
|
|
@@ -1475,11 +1516,13 @@ function entityResponseToCamel(raw) {
|
|
|
1475
1516
|
lei: raw.lei ?? null,
|
|
1476
1517
|
industry: raw.industry ?? null,
|
|
1477
1518
|
entityType: raw.entity_type ?? null,
|
|
1519
|
+
reportingStyleId: raw.reporting_style_id ?? null,
|
|
1478
1520
|
phone: raw.phone ?? null,
|
|
1479
1521
|
website: raw.website ?? null,
|
|
1480
1522
|
status: raw.status ?? null,
|
|
1481
1523
|
isParent: raw.is_parent ?? null,
|
|
1482
1524
|
parentEntityId: raw.parent_entity_id ?? null,
|
|
1525
|
+
ownershipPct: raw.ownership_pct ?? null,
|
|
1483
1526
|
source: raw.source ?? null,
|
|
1484
1527
|
sourceId: raw.source_id ?? null,
|
|
1485
1528
|
sourceGraphId: raw.source_graph_id ?? null,
|