@robosystems/client 2.22.0 → 2.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/artifacts/LedgerClient.d.ts +58 -3
  2. package/artifacts/LedgerClient.js +65 -1
  3. package/artifacts/LedgerClient.ts +125 -2
  4. package/artifacts/graphql/generated/graphql.d.ts +173 -0
  5. package/artifacts/graphql/generated/graphql.js +430 -2
  6. package/artifacts/graphql/generated/graphql.ts +583 -0
  7. package/artifacts/graphql/queries/ledger/accountRegister.d.ts +13 -0
  8. package/artifacts/graphql/queries/ledger/accountRegister.js +98 -0
  9. package/artifacts/graphql/queries/ledger/accountRegister.ts +96 -0
  10. package/artifacts/graphql/queries/ledger/dimensions.d.ts +7 -0
  11. package/artifacts/graphql/queries/ledger/dimensions.js +27 -0
  12. package/artifacts/graphql/queries/ledger/dimensions.ts +25 -0
  13. package/artifacts/graphql/queries/ledger/eventBlock.d.ts +3 -1
  14. package/artifacts/graphql/queries/ledger/eventBlock.js +24 -1
  15. package/artifacts/graphql/queries/ledger/eventBlock.ts +24 -1
  16. package/artifacts/graphql/queries/ledger/journalEntries.js +6 -0
  17. package/artifacts/graphql/queries/ledger/journalEntries.ts +6 -0
  18. package/artifacts/graphql/queries/ledger/transaction.js +6 -0
  19. package/artifacts/graphql/queries/ledger/transaction.ts +6 -0
  20. package/artifacts/graphql/queries/ledger/trialBalance.d.ts +4 -1
  21. package/artifacts/graphql/queries/ledger/trialBalance.js +19 -3
  22. package/artifacts/graphql/queries/ledger/trialBalance.ts +19 -3
  23. package/index.ts +2 -2
  24. package/package.json +1 -1
  25. package/sdk/index.d.ts +2 -2
  26. package/sdk/index.js +7 -5
  27. package/sdk/index.ts +2 -2
  28. package/sdk/sdk.gen.d.ts +19 -3
  29. package/sdk/sdk.gen.js +38 -4
  30. package/sdk/sdk.gen.ts +37 -3
  31. package/sdk/types.gen.d.ts +455 -4
  32. package/sdk/types.gen.ts +474 -4
  33. package/sdk.gen.d.ts +19 -3
  34. package/sdk.gen.js +38 -4
  35. package/sdk.gen.ts +37 -3
  36. package/types.gen.d.ts +455 -4
  37. package/types.gen.ts +474 -4
@@ -1,6 +1,6 @@
1
- import type { AcceptSuggestionsRequest, AcceptSuggestionsResponse, AllocationOverrideResponse, AssociationResponse, AutoMapElementsOperation, BindTextBlockRequest, BindTextBlockResponse, BlockedSourceGraphResponse, BlockSourceGraphResult, ComputeMetricsRequest, ComputeMetricsResponse, ConsolidationProposal, ConsolidationWorksheetRequest, ConsolidationWorksheetResponse, CreateAgentRequest, CreateEntityRequest, CreateEventBlockRequest, CreateEventHandlerRequest, CreateInformationBlockRequest, CreateMappingAssociationOperation, CreateTaxonomyBlockRequest, CreateViewRequest, DeleteInformationBlockRequest, DeleteInformationBlockResponse, DeleteMappingAssociationOperation, DeleteResult, DeleteTaxonomyBlockRequest, DeleteTaxonomyBlockResponse, EntityTaxonomyResponse, EvaluateRulesRequest, EvaluateRulesResponse, EventBlockEnvelope, EventHandlerResponse, FinancialStatementAnalysisRequest, FinancialStatementAnalysisResponse, InformationBlockEnvelope, InitializeChartOfAccountsRequest, JournalEntryResponse, LearnClassificationDefaultsResponse, LedgerAgentResponse, LinkBankAccountRequest, LinkBankAccountResponse, LinkEntityTaxonomyRequest, LiveFinancialStatementRequest, LiveFinancialStatementResponse, OperationEnvelope, PreviewConsolidationEntriesResponse, PreviewEventBlockResponse, PreviewReconciliationsRequest, PromoteObligationsRequest, PromoteObligationsResponse, ProposeConsolidationEntriesResponse, PublishListMemberResponse, PublishListResponse, ReconcilingItemPlan, RecordOpeningBalanceRequest, ReportResponse, ResolveReconcilingItemRequest, ResolveReconcilingItemResponse, RevokeReportShareResponse, SetAllocationOverrideRequest, ShareReportResponse, TaxonomyBlockEnvelope, UpdateAgentRequest, UpdateEntityRequest, UpdateEventBlockRequest, UpdateEventHandlerRequest, UpdateInformationBlockRequest, UpdateJournalEntryRequest, UpdateTaxonomyBlockRequest, ViewResponse } from '../types.gen';
1
+ import type { AcceptSuggestionsRequest, AcceptSuggestionsResponse, AllocationOverrideResponse, AssociationResponse, AutoMapElementsOperation, BindTextBlockRequest, BindTextBlockResponse, BlockedSourceGraphResponse, BlockSourceGraphResult, ComputeMetricsRequest, ComputeMetricsResponse, ConsolidationProposal, ConsolidationWorksheetRequest, ConsolidationWorksheetResponse, CreateAgentRequest, CreateDimensionRequest, CreateEntityRequest, CreateEventBlockRequest, CreateEventHandlerRequest, CreateInformationBlockRequest, CreateMappingAssociationOperation, CreateTaxonomyBlockRequest, CreateViewRequest, DeleteInformationBlockRequest, DeleteInformationBlockResponse, DeleteMappingAssociationOperation, DeleteResult, DeleteTaxonomyBlockRequest, DeleteTaxonomyBlockResponse, DimensionResponse, EntityTaxonomyResponse, EvaluateRulesRequest, EvaluateRulesResponse, EventBlockEnvelope, EventHandlerResponse, FinancialStatementAnalysisRequest, FinancialStatementAnalysisResponse, InformationBlockEnvelope, InitializeChartOfAccountsRequest, JournalEntryResponse, LearnClassificationDefaultsResponse, LedgerAgentResponse, LinkBankAccountRequest, LinkBankAccountResponse, LinkEntityTaxonomyRequest, LiveFinancialStatementRequest, LiveFinancialStatementResponse, OperationEnvelope, PreviewConsolidationEntriesResponse, PreviewEventBlockResponse, PreviewReconciliationsRequest, PromoteObligationsRequest, PromoteObligationsResponse, ProposeConsolidationEntriesResponse, PublishListMemberResponse, PublishListResponse, ReconcilingItemPlan, RecordOpeningBalanceRequest, ReportResponse, ResolveReconcilingItemRequest, ResolveReconcilingItemResponse, RevokeReportShareResponse, SetAllocationOverrideRequest, ShareReportResponse, TaxonomyBlockEnvelope, UpdateAgentRequest, UpdateDimensionRequest, UpdateEntityRequest, UpdateEventBlockRequest, UpdateEventHandlerRequest, UpdateInformationBlockRequest, UpdateJournalEntryRequest, UpdateTaxonomyBlockRequest, ViewResponse } from '../types.gen';
2
2
  import type { TokenProvider } from './graphql/client';
3
- import { ListLedgerBankAccountsQuery, type AgedReceivablesQuery, type ClassificationStatsQuery, type DischargeCandidatesQuery, type FlowCandidatesQuery, 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 ListInformationBlockSummariesQuery, 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 OpenItemsForAgentQuery, type ReportDownloadFormat, type ReportLifecycle } from './graphql/generated/graphql';
3
+ import { ListLedgerBankAccountsQuery, type AgedReceivablesQuery, type ClassificationStatsQuery, type DischargeCandidatesQuery, type FlowCandidatesQuery, type GetInformationBlockQuery, type GetLedgerAccountRegisterQuery, 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 ListInformationBlockSummariesQuery, type ListLedgerAccountsQuery, type ListLedgerAgentsQuery, type ListLedgerBlockedSourceGraphsQuery, type ListLedgerDimensionsQuery, 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 OpenItemsForAgentQuery, type ReportDownloadFormat, type ReportLifecycle } from './graphql/generated/graphql';
4
4
  export { GraphQLError } from './graphql/client';
5
5
  export type { ReportLifecycle };
6
6
  export type LedgerEntity = NonNullable<GetLedgerEntityQuery['entity']>;
@@ -13,6 +13,7 @@ export type LedgerAccountRollups = NonNullable<GetLedgerAccountRollupsQuery['acc
13
13
  export type LedgerBankAccountList = NonNullable<ListLedgerBankAccountsQuery['bankAccounts']>;
14
14
  export type LedgerBankAccount = LedgerBankAccountList['accounts'][number];
15
15
  export type LedgerTrialBalance = NonNullable<GetLedgerTrialBalanceQuery['trialBalance']>;
16
+ export type LedgerAccountRegister = NonNullable<GetLedgerAccountRegisterQuery['accountRegister']>;
16
17
  export type LedgerMappedTrialBalance = NonNullable<GetLedgerMappedTrialBalanceQuery['mappedTrialBalance']>;
17
18
  export type LedgerTransactionList = NonNullable<ListLedgerTransactionsQuery['transactions']>;
18
19
  export type LedgerTransactionListItem = LedgerTransactionList['transactions'][number];
@@ -40,6 +41,8 @@ export type LedgerControlTieOut = LedgerAgedBalances['tieOuts'][number];
40
41
  export type LedgerIntercompanyPair = LedgerAgedBalances['pairs'][number];
41
42
  export type LedgerOpenItem = OpenItemsForAgentQuery['openItemsForAgent'][number];
42
43
  export type LedgerDischargeCandidates = NonNullable<DischargeCandidatesQuery['dischargeCandidates']>;
44
+ export type LedgerDimensionList = NonNullable<ListLedgerDimensionsQuery['dimensions']>;
45
+ export type LedgerDimension = LedgerDimensionList['dimensions'][number];
43
46
  /** `receivables` (invoices) or `payables` (bills). */
44
47
  export type LedgerOpenItemKind = 'receivables' | 'payables';
45
48
  export type LedgerStructureList = NonNullable<ListLedgerStructuresQuery['structures']>;
@@ -616,12 +619,64 @@ export declare class LedgerClient {
616
619
  * such event.
617
620
  */
618
621
  getDischargeCandidates(graphId: string, eventId: string): Promise<LedgerDischargeCandidates | null>;
619
- /** Trial balance by raw CoA account. */
622
+ /**
623
+ * The graph's management dimension members — departments, classes,
624
+ * locations, projects — by axis then name, each with how many lines carry
625
+ * it. `types` lists the axes the graph has members on. Retired members
626
+ * are left out unless `options.includeInactive`.
627
+ */
628
+ getDimensions(graphId: string, options?: {
629
+ dimensionType?: string | null;
630
+ includeInactive?: boolean;
631
+ }): Promise<LedgerDimensionList | null>;
632
+ /**
633
+ * Add a member to a management dimension (`dimension_type`: department,
634
+ * class, location, project, or an axis of your own). `value`, the
635
+ * member's key within its axis, defaults to a slug of the name; a
636
+ * duplicate key is refused (409).
637
+ */
638
+ createDimension(graphId: string, body: CreateDimensionRequest, idempotencyKey?: string): Promise<DimensionResponse>;
639
+ /**
640
+ * Rename a member, or retire it with `is_active: false`: it stays on the
641
+ * lines that carry it and goes on no new ones. A member synced from
642
+ * QuickBooks keeps QuickBooks's name.
643
+ */
644
+ updateDimension(graphId: string, body: UpdateDimensionRequest): Promise<DimensionResponse>;
645
+ /**
646
+ * Trial balance by raw CoA account. `options.dimension` sums one
647
+ * management dimension member's lines (`memberId: 'unallocated'` for the
648
+ * lines no member of the axis tags); such a balance need not foot, and
649
+ * says so in `sliced`.
650
+ */
620
651
  getTrialBalance(graphId: string, options?: {
621
652
  startDate?: string;
622
653
  endDate?: string;
623
654
  entityId?: string | null;
655
+ dimension?: {
656
+ type: string;
657
+ memberId: string;
658
+ } | null;
624
659
  }): Promise<LedgerTrialBalance | null>;
660
+ /**
661
+ * One entity's posted lines on one account, oldest first, each with the
662
+ * balance it leaves, between an opening and a closing balance that agree
663
+ * with the trial balance. An income or expense account opens at the fiscal
664
+ * year's start. `options.after` takes the last page's `nextCursor`;
665
+ * `options.dimension` or `options.flowElementId` reads one slice.
666
+ */
667
+ getAccountRegister(graphId: string, accountId: string, options?: {
668
+ startDate?: string;
669
+ endDate?: string;
670
+ entityId?: string | null;
671
+ dimension?: {
672
+ type: string;
673
+ memberId: string;
674
+ } | null;
675
+ flowElementId?: string | null;
676
+ includeDrafts?: boolean;
677
+ after?: string | null;
678
+ limit?: number | null;
679
+ }): Promise<LedgerAccountRegister | null>;
625
680
  /** Trial balance rolled up to GAAP reporting concepts via a mapping. */
626
681
  getMappedTrialBalance(graphId: string, mappingId: string, options?: {
627
682
  startDate?: string;
@@ -249,15 +249,79 @@ class LedgerClient {
249
249
  async getDischargeCandidates(graphId, eventId) {
250
250
  return this.gqlQuery(graphId, graphql_1.DischargeCandidatesDocument, { eventId }, 'Discharge candidates', (data) => data.dischargeCandidates);
251
251
  }
252
+ // ── Management dimensions ─────────────────────────────────────────
253
+ /**
254
+ * The graph's management dimension members — departments, classes,
255
+ * locations, projects — by axis then name, each with how many lines carry
256
+ * it. `types` lists the axes the graph has members on. Retired members
257
+ * are left out unless `options.includeInactive`.
258
+ */
259
+ async getDimensions(graphId, options) {
260
+ return this.gqlQuery(graphId, graphql_1.ListLedgerDimensionsDocument, {
261
+ dimensionType: options?.dimensionType ?? null,
262
+ includeInactive: options?.includeInactive ?? false,
263
+ }, 'List dimensions', (data) => data.dimensions);
264
+ }
265
+ /**
266
+ * Add a member to a management dimension (`dimension_type`: department,
267
+ * class, location, project, or an axis of your own). `value`, the
268
+ * member's key within its axis, defaults to a slug of the name; a
269
+ * duplicate key is refused (409).
270
+ */
271
+ async createDimension(graphId, body, idempotencyKey) {
272
+ const envelope = await this.callOperation('Create dimension', (o) => (0, sdk_gen_1.createDimension)({
273
+ ...(0, rest_1.withIdempotencyKey)(o, idempotencyKey),
274
+ path: { graph_id: graphId },
275
+ body,
276
+ }));
277
+ return this.requireResult('Create dimension', envelope.result);
278
+ }
279
+ /**
280
+ * Rename a member, or retire it with `is_active: false`: it stays on the
281
+ * lines that carry it and goes on no new ones. A member synced from
282
+ * QuickBooks keeps QuickBooks's name.
283
+ */
284
+ async updateDimension(graphId, body) {
285
+ const envelope = await this.callOperation('Update dimension', (o) => (0, sdk_gen_1.updateDimension)({ ...o, path: { graph_id: graphId }, body }));
286
+ return this.requireResult('Update dimension', envelope.result);
287
+ }
252
288
  // ── Trial Balance ──────────────────────────────────────────────────
253
- /** Trial balance by raw CoA account. */
289
+ /**
290
+ * Trial balance by raw CoA account. `options.dimension` sums one
291
+ * management dimension member's lines (`memberId: 'unallocated'` for the
292
+ * lines no member of the axis tags); such a balance need not foot, and
293
+ * says so in `sliced`.
294
+ */
254
295
  async getTrialBalance(graphId, options) {
255
296
  return this.gqlQuery(graphId, graphql_1.GetLedgerTrialBalanceDocument, {
256
297
  startDate: options?.startDate ?? null,
257
298
  endDate: options?.endDate ?? null,
258
299
  entityId: options?.entityId ?? null,
300
+ dimensionType: options?.dimension?.type ?? null,
301
+ dimensionMemberId: options?.dimension?.memberId ?? null,
259
302
  }, 'Get trial balance', (data) => data.trialBalance);
260
303
  }
304
+ /**
305
+ * One entity's posted lines on one account, oldest first, each with the
306
+ * balance it leaves, between an opening and a closing balance that agree
307
+ * with the trial balance. An income or expense account opens at the fiscal
308
+ * year's start. `options.after` takes the last page's `nextCursor`;
309
+ * `options.dimension` or `options.flowElementId` reads one slice.
310
+ */
311
+ async getAccountRegister(graphId, accountId, options) {
312
+ return this.gqlQuery(graphId, graphql_1.GetLedgerAccountRegisterDocument, {
313
+ accountId,
314
+ startDate: options?.startDate ?? null,
315
+ endDate: options?.endDate ?? null,
316
+ entityId: options?.entityId ?? null,
317
+ dimensionType: options?.dimension?.type ?? null,
318
+ dimensionMemberId: options?.dimension?.memberId ?? null,
319
+ flowElementId: options?.flowElementId ?? null,
320
+ includeDrafts: options?.includeDrafts ?? false,
321
+ after: options?.after ?? null,
322
+ limit: options?.limit ?? null,
323
+ }, 'Get account register', (data) => data.accountRegister);
324
+ }
261
325
  /** Trial balance rolled up to GAAP reporting concepts via a mapping. */
262
326
  async getMappedTrialBalance(graphId, mappingId, options) {
263
327
  return this.gqlQuery(graphId, graphql_1.GetLedgerMappedTrialBalanceDocument, {
@@ -39,6 +39,7 @@ import {
39
39
  computeMetrics,
40
40
  consolidationWorksheet,
41
41
  createAgent,
42
+ createDimension,
42
43
  createEntity,
43
44
  createEventBlock,
44
45
  createEventHandler,
@@ -85,6 +86,7 @@ import {
85
86
  transitionFilingStatus,
86
87
  unblockSourceGraph,
87
88
  updateAgent,
89
+ updateDimension,
88
90
  updateEntity,
89
91
  updateEventBlock,
90
92
  updateEventHandler,
@@ -112,6 +114,7 @@ import type {
112
114
  ConsolidationWorksheetRequest,
113
115
  ConsolidationWorksheetResponse,
114
116
  CreateAgentRequest,
117
+ CreateDimensionRequest,
115
118
  CreateEntityRequest,
116
119
  CreateEventBlockRequest,
117
120
  CreateEventHandlerRequest,
@@ -128,6 +131,7 @@ import type {
128
131
  DeleteResult,
129
132
  DeleteTaxonomyBlockRequest,
130
133
  DeleteTaxonomyBlockResponse,
134
+ DimensionResponse,
131
135
  EntityTaxonomyResponse,
132
136
  EvaluateRulesRequest,
133
137
  EvaluateRulesResponse,
@@ -183,6 +187,7 @@ import type {
183
187
  TaxonomyBlockEnvelope,
184
188
  TransitionFilingStatusRequest,
185
189
  UpdateAgentRequest,
190
+ UpdateDimensionRequest,
186
191
  UpdateEntityRequest,
187
192
  UpdateEventBlockRequest,
188
193
  UpdateEventHandlerRequest,
@@ -202,6 +207,7 @@ import {
202
207
  FlowCandidatesDocument,
203
208
  GetInformationBlockDocument,
204
209
  GetInformationBlockWindowedDocument,
210
+ GetLedgerAccountRegisterDocument,
205
211
  GetLedgerAccountRollupsDocument,
206
212
  GetLedgerAccountTreeDocument,
207
213
  GetLedgerAgentDocument,
@@ -231,6 +237,7 @@ import {
231
237
  ListLedgerBankAccountsDocument,
232
238
  ListLedgerBankAccountsQuery,
233
239
  ListLedgerBlockedSourceGraphsDocument,
240
+ ListLedgerDimensionsDocument,
234
241
  ListLedgerElementsDocument,
235
242
  ListLedgerEntitiesDocument,
236
243
  ListLedgerEventBlocksDocument,
@@ -250,6 +257,7 @@ import {
250
257
  type DischargeCandidatesQuery,
251
258
  type FlowCandidatesQuery,
252
259
  type GetInformationBlockQuery,
260
+ type GetLedgerAccountRegisterQuery,
253
261
  type GetLedgerAccountRollupsQuery,
254
262
  type GetLedgerAccountTreeQuery,
255
263
  type GetLedgerAgentQuery,
@@ -276,6 +284,7 @@ import {
276
284
  type ListLedgerAccountsQuery,
277
285
  type ListLedgerAgentsQuery,
278
286
  type ListLedgerBlockedSourceGraphsQuery,
287
+ type ListLedgerDimensionsQuery,
279
288
  type ListLedgerElementsQuery,
280
289
  type ListLedgerEntitiesQuery,
281
290
  type ListLedgerEventBlocksQuery,
@@ -320,6 +329,7 @@ export type LedgerBankAccountList = NonNullable<ListLedgerBankAccountsQuery['ban
320
329
  export type LedgerBankAccount = LedgerBankAccountList['accounts'][number]
321
330
 
322
331
  export type LedgerTrialBalance = NonNullable<GetLedgerTrialBalanceQuery['trialBalance']>
332
+ export type LedgerAccountRegister = NonNullable<GetLedgerAccountRegisterQuery['accountRegister']>
323
333
  export type LedgerMappedTrialBalance = NonNullable<
324
334
  GetLedgerMappedTrialBalanceQuery['mappedTrialBalance']
325
335
  >
@@ -358,6 +368,9 @@ export type LedgerControlTieOut = LedgerAgedBalances['tieOuts'][number]
358
368
  export type LedgerIntercompanyPair = LedgerAgedBalances['pairs'][number]
359
369
  export type LedgerOpenItem = OpenItemsForAgentQuery['openItemsForAgent'][number]
360
370
  export type LedgerDischargeCandidates = NonNullable<DischargeCandidatesQuery['dischargeCandidates']>
371
+
372
+ export type LedgerDimensionList = NonNullable<ListLedgerDimensionsQuery['dimensions']>
373
+ export type LedgerDimension = LedgerDimensionList['dimensions'][number]
361
374
  /** `receivables` (invoices) or `payables` (bills). */
362
375
  export type LedgerOpenItemKind = 'receivables' | 'payables'
363
376
 
@@ -1383,12 +1396,79 @@ export class LedgerClient {
1383
1396
  )
1384
1397
  }
1385
1398
 
1399
+ // ── Management dimensions ─────────────────────────────────────────
1400
+
1401
+ /**
1402
+ * The graph's management dimension members — departments, classes,
1403
+ * locations, projects — by axis then name, each with how many lines carry
1404
+ * it. `types` lists the axes the graph has members on. Retired members
1405
+ * are left out unless `options.includeInactive`.
1406
+ */
1407
+ async getDimensions(
1408
+ graphId: string,
1409
+ options?: { dimensionType?: string | null; includeInactive?: boolean }
1410
+ ): Promise<LedgerDimensionList | null> {
1411
+ return this.gqlQuery(
1412
+ graphId,
1413
+ ListLedgerDimensionsDocument,
1414
+ {
1415
+ dimensionType: options?.dimensionType ?? null,
1416
+ includeInactive: options?.includeInactive ?? false,
1417
+ },
1418
+ 'List dimensions',
1419
+ (data) => data.dimensions
1420
+ )
1421
+ }
1422
+
1423
+ /**
1424
+ * Add a member to a management dimension (`dimension_type`: department,
1425
+ * class, location, project, or an axis of your own). `value`, the
1426
+ * member's key within its axis, defaults to a slug of the name; a
1427
+ * duplicate key is refused (409).
1428
+ */
1429
+ async createDimension(
1430
+ graphId: string,
1431
+ body: CreateDimensionRequest,
1432
+ idempotencyKey?: string
1433
+ ): Promise<DimensionResponse> {
1434
+ const envelope = await this.callOperation('Create dimension', (o) =>
1435
+ createDimension({
1436
+ ...withIdempotencyKey(o, idempotencyKey),
1437
+ path: { graph_id: graphId },
1438
+ body,
1439
+ })
1440
+ )
1441
+ return this.requireResult('Create dimension', envelope.result)
1442
+ }
1443
+
1444
+ /**
1445
+ * Rename a member, or retire it with `is_active: false`: it stays on the
1446
+ * lines that carry it and goes on no new ones. A member synced from
1447
+ * QuickBooks keeps QuickBooks's name.
1448
+ */
1449
+ async updateDimension(graphId: string, body: UpdateDimensionRequest): Promise<DimensionResponse> {
1450
+ const envelope = await this.callOperation('Update dimension', (o) =>
1451
+ updateDimension({ ...o, path: { graph_id: graphId }, body })
1452
+ )
1453
+ return this.requireResult('Update dimension', envelope.result)
1454
+ }
1455
+
1386
1456
  // ── Trial Balance ──────────────────────────────────────────────────
1387
1457
 
1388
- /** Trial balance by raw CoA account. */
1458
+ /**
1459
+ * Trial balance by raw CoA account. `options.dimension` sums one
1460
+ * management dimension member's lines (`memberId: 'unallocated'` for the
1461
+ * lines no member of the axis tags); such a balance need not foot, and
1462
+ * says so in `sliced`.
1463
+ */
1389
1464
  async getTrialBalance(
1390
1465
  graphId: string,
1391
- options?: { startDate?: string; endDate?: string; entityId?: string | null }
1466
+ options?: {
1467
+ startDate?: string
1468
+ endDate?: string
1469
+ entityId?: string | null
1470
+ dimension?: { type: string; memberId: string } | null
1471
+ }
1392
1472
  ): Promise<LedgerTrialBalance | null> {
1393
1473
  return this.gqlQuery(
1394
1474
  graphId,
@@ -1397,12 +1477,55 @@ export class LedgerClient {
1397
1477
  startDate: options?.startDate ?? null,
1398
1478
  endDate: options?.endDate ?? null,
1399
1479
  entityId: options?.entityId ?? null,
1480
+ dimensionType: options?.dimension?.type ?? null,
1481
+ dimensionMemberId: options?.dimension?.memberId ?? null,
1400
1482
  },
1401
1483
  'Get trial balance',
1402
1484
  (data) => data.trialBalance
1403
1485
  )
1404
1486
  }
1405
1487
 
1488
+ /**
1489
+ * One entity's posted lines on one account, oldest first, each with the
1490
+ * balance it leaves, between an opening and a closing balance that agree
1491
+ * with the trial balance. An income or expense account opens at the fiscal
1492
+ * year's start. `options.after` takes the last page's `nextCursor`;
1493
+ * `options.dimension` or `options.flowElementId` reads one slice.
1494
+ */
1495
+ async getAccountRegister(
1496
+ graphId: string,
1497
+ accountId: string,
1498
+ options?: {
1499
+ startDate?: string
1500
+ endDate?: string
1501
+ entityId?: string | null
1502
+ dimension?: { type: string; memberId: string } | null
1503
+ flowElementId?: string | null
1504
+ includeDrafts?: boolean
1505
+ after?: string | null
1506
+ limit?: number | null
1507
+ }
1508
+ ): Promise<LedgerAccountRegister | null> {
1509
+ return this.gqlQuery(
1510
+ graphId,
1511
+ GetLedgerAccountRegisterDocument,
1512
+ {
1513
+ accountId,
1514
+ startDate: options?.startDate ?? null,
1515
+ endDate: options?.endDate ?? null,
1516
+ entityId: options?.entityId ?? null,
1517
+ dimensionType: options?.dimension?.type ?? null,
1518
+ dimensionMemberId: options?.dimension?.memberId ?? null,
1519
+ flowElementId: options?.flowElementId ?? null,
1520
+ includeDrafts: options?.includeDrafts ?? false,
1521
+ after: options?.after ?? null,
1522
+ limit: options?.limit ?? null,
1523
+ },
1524
+ 'Get account register',
1525
+ (data) => data.accountRegister
1526
+ )
1527
+ }
1528
+
1406
1529
  /** Trial balance rolled up to GAAP reporting concepts via a mapping. */
1407
1530
  async getMappedTrialBalance(
1408
1531
  graphId: string,
@@ -227,6 +227,121 @@ export type GetInvestorSecurityQuery = {
227
227
  updatedAt: string;
228
228
  } | null;
229
229
  };
230
+ export type GetLedgerAccountRegisterQueryVariables = Exact<{
231
+ accountId: string;
232
+ startDate: string | null | undefined;
233
+ endDate: string | null | undefined;
234
+ entityId: string | null | undefined;
235
+ dimensionType: string | null | undefined;
236
+ dimensionMemberId: string | null | undefined;
237
+ flowElementId: string | null | undefined;
238
+ includeDrafts?: boolean;
239
+ after: string | null | undefined;
240
+ limit: number | null | undefined;
241
+ }>;
242
+ export type GetLedgerAccountRegisterQuery = {
243
+ accountRegister: {
244
+ entityId: string | null;
245
+ startDate: string | null;
246
+ endDate: string | null;
247
+ openingFrom: string | null;
248
+ openingBalance: number;
249
+ totalDebits: number;
250
+ totalCredits: number;
251
+ closingBalance: number;
252
+ lineCount: number;
253
+ pageOpeningBalance: number;
254
+ nextCursor: string | null;
255
+ sliced: boolean;
256
+ draftsTruncated: boolean;
257
+ account: {
258
+ id: string;
259
+ code: string | null;
260
+ name: string;
261
+ balanceType: string;
262
+ trait: string | null;
263
+ temporary: boolean;
264
+ };
265
+ lines: Array<{
266
+ lineId: string;
267
+ entryId: string;
268
+ entryNumber: string | null;
269
+ postingDate: string;
270
+ entryType: string;
271
+ provenance: string | null;
272
+ status: string;
273
+ memo: string | null;
274
+ description: string | null;
275
+ debit: number;
276
+ credit: number;
277
+ balance: number | null;
278
+ triggeredByEventId: string | null;
279
+ triggeredByEventType: string | null;
280
+ reversalOf: string | null;
281
+ reversedBy: string | null;
282
+ agentId: string | null;
283
+ agentName: string | null;
284
+ flowElementId: string | null;
285
+ dimensions: Array<{
286
+ id: string;
287
+ dimensionType: string;
288
+ name: string;
289
+ }>;
290
+ }>;
291
+ drafts: Array<{
292
+ lineId: string;
293
+ entryId: string;
294
+ entryNumber: string | null;
295
+ postingDate: string;
296
+ entryType: string;
297
+ provenance: string | null;
298
+ status: string;
299
+ memo: string | null;
300
+ description: string | null;
301
+ debit: number;
302
+ credit: number;
303
+ balance: number | null;
304
+ triggeredByEventId: string | null;
305
+ triggeredByEventType: string | null;
306
+ reversalOf: string | null;
307
+ reversedBy: string | null;
308
+ agentId: string | null;
309
+ agentName: string | null;
310
+ flowElementId: string | null;
311
+ dimensions: Array<{
312
+ id: string;
313
+ dimensionType: string;
314
+ name: string;
315
+ }>;
316
+ }>;
317
+ } | null;
318
+ };
319
+ export type RegisterLineFieldsFragment = {
320
+ lineId: string;
321
+ entryId: string;
322
+ entryNumber: string | null;
323
+ postingDate: string;
324
+ entryType: string;
325
+ provenance: string | null;
326
+ status: string;
327
+ memo: string | null;
328
+ description: string | null;
329
+ debit: number;
330
+ credit: number;
331
+ balance: number | null;
332
+ triggeredByEventId: string | null;
333
+ triggeredByEventType: string | null;
334
+ reversalOf: string | null;
335
+ reversedBy: string | null;
336
+ agentId: string | null;
337
+ agentName: string | null;
338
+ flowElementId: string | null;
339
+ dimensions: Array<{
340
+ id: string;
341
+ dimensionType: string;
342
+ name: string;
343
+ }>;
344
+ };
230
345
  export type GetLedgerAccountRollupsQueryVariables = Exact<{
231
346
  mappingId: string | null | undefined;
232
347
  startDate: string | null | undefined;
@@ -829,6 +944,25 @@ export type GetLedgerClosingBookStructuresQuery = {
829
944
  }>;
830
945
  } | null;
831
946
  };
947
+ export type ListLedgerDimensionsQueryVariables = Exact<{
948
+ dimensionType: string | null | undefined;
949
+ includeInactive?: boolean;
950
+ }>;
951
+ export type ListLedgerDimensionsQuery = {
952
+ dimensions: {
953
+ types: Array<string>;
954
+ dimensions: Array<{
955
+ id: string;
956
+ dimensionType: string;
957
+ name: string;
958
+ value: string;
959
+ source: string;
960
+ isActive: boolean;
961
+ lineCount: number;
962
+ createdAt: string | null;
963
+ }>;
964
+ } | null;
965
+ };
832
966
  export type ListLedgerElementsQueryVariables = Exact<{
833
967
  taxonomyId: string | null | undefined;
834
968
  source: string | null | undefined;
@@ -970,6 +1104,27 @@ export type GetLedgerEventBlockQuery = {
970
1104
  documentId: string | null;
971
1105
  createdAt: string;
972
1106
  createdBy: string;
1107
+ triggeredEntries: Array<{
1108
+ id: string;
1109
+ number: string | null;
1110
+ type: string;
1111
+ status: string;
1112
+ postingDate: string;
1113
+ memo: string | null;
1114
+ provenance: string | null;
1115
+ totalDebit: number;
1116
+ totalCredit: number;
1117
+ lineItems: Array<{
1118
+ id: string;
1119
+ accountId: string;
1120
+ accountName: string | null;
1121
+ accountCode: string | null;
1122
+ debitAmount: number;
1123
+ creditAmount: number;
1124
+ description: string | null;
1125
+ lineOrder: number;
1126
+ }>;
1127
+ }>;
973
1128
  } | null;
974
1129
  };
975
1130
  export type ListLedgerEventBlocksQueryVariables = Exact<{
@@ -1600,6 +1755,7 @@ export type ListLedgerJournalEntriesQuery = {
1600
1755
  sourceStructureId: string | null;
1601
1756
  sourceStructureName: string | null;
1602
1757
  triggeredByEventId: string | null;
1758
+ triggeredByEventType: string | null;
1603
1759
  reversalOf: string | null;
1604
1760
  postedAt: string | null;
1605
1761
  totalDebit: number;
@@ -1615,6 +1771,11 @@ export type ListLedgerJournalEntriesQuery = {
1615
1771
  description: string | null;
1616
1772
  lineOrder: number;
1617
1773
  flowQname: string | null;
1774
+ dimensions: Array<{
1775
+ id: string;
1776
+ dimensionType: string;
1777
+ name: string;
1778
+ }>;
1618
1779
  }>;
1619
1780
  }>;
1620
1781
  pagination: {
@@ -2335,6 +2496,12 @@ export type GetLedgerTransactionQuery = {
2335
2496
  creditAmount: number;
2336
2497
  description: string | null;
2337
2498
  lineOrder: number;
2499
+ flowQname: string | null;
2500
+ dimensions: Array<{
2501
+ id: string;
2502
+ dimensionType: string;
2503
+ name: string;
2504
+ }>;
2338
2505
  }>;
2339
2506
  }>;
2340
2507
  } | null;
@@ -2376,11 +2543,14 @@ export type GetLedgerTrialBalanceQueryVariables = Exact<{
2376
2543
  startDate: string | null | undefined;
2377
2544
  endDate: string | null | undefined;
2378
2545
  entityId: string | null | undefined;
2546
+ dimensionType: string | null | undefined;
2547
+ dimensionMemberId: string | null | undefined;
2379
2548
  }>;
2380
2549
  export type GetLedgerTrialBalanceQuery = {
2381
2550
  trialBalance: {
2382
2551
  totalDebits: number;
2383
2552
  totalCredits: number;
2553
+ sliced: boolean;
2384
2554
  rows: Array<{
2385
2555
  accountId: string;
2386
2556
  accountCode: string;
@@ -2665,6 +2835,7 @@ export type GetLibraryTaxonomyQuery = {
2665
2835
  elementCount: number | null;
2666
2836
  } | null;
2667
2837
  };
2838
+ export declare const RegisterLineFieldsFragmentDoc: DocumentNode<RegisterLineFieldsFragment, unknown>;
2668
2839
  export declare const AgingBucketsFieldsFragmentDoc: DocumentNode<AgingBucketsFieldsFragment, unknown>;
2669
2840
  export declare const OpenItemFieldsFragmentDoc: DocumentNode<OpenItemFieldsFragment, unknown>;
2670
2841
  export declare const AgedBalancesFieldsFragmentDoc: DocumentNode<AgedBalancesFieldsFragment, unknown>;
@@ -2675,6 +2846,7 @@ export declare const GetInvestorPositionDocument: DocumentNode<GetInvestorPositi
2675
2846
  export declare const ListInvestorPositionsDocument: DocumentNode<ListInvestorPositionsQuery, ListInvestorPositionsQueryVariables>;
2676
2847
  export declare const ListInvestorSecuritiesDocument: DocumentNode<ListInvestorSecuritiesQuery, ListInvestorSecuritiesQueryVariables>;
2677
2848
  export declare const GetInvestorSecurityDocument: DocumentNode<GetInvestorSecurityQuery, GetInvestorSecurityQueryVariables>;
2849
+ export declare const GetLedgerAccountRegisterDocument: DocumentNode<GetLedgerAccountRegisterQuery, GetLedgerAccountRegisterQueryVariables>;
2678
2850
  export declare const GetLedgerAccountRollupsDocument: DocumentNode<GetLedgerAccountRollupsQuery, GetLedgerAccountRollupsQueryVariables>;
2679
2851
  export declare const GetLedgerAccountTreeDocument: DocumentNode<GetLedgerAccountTreeQuery, GetLedgerAccountTreeQueryVariables>;
2680
2852
  export declare const ListLedgerAccountsDocument: DocumentNode<ListLedgerAccountsQuery, ListLedgerAccountsQueryVariables>;
@@ -2689,6 +2861,7 @@ export declare const ListLedgerBlockedSourceGraphsDocument: DocumentNode<ListLed
2689
2861
  export declare const ListChartTemplatesDocument: DocumentNode<ListChartTemplatesQuery, ListChartTemplatesQueryVariables>;
2690
2862
  export declare const ClassificationStatsDocument: DocumentNode<ClassificationStatsQuery, ClassificationStatsQueryVariables>;
2691
2863
  export declare const GetLedgerClosingBookStructuresDocument: DocumentNode<GetLedgerClosingBookStructuresQuery, GetLedgerClosingBookStructuresQueryVariables>;
2864
+ export declare const ListLedgerDimensionsDocument: DocumentNode<ListLedgerDimensionsQuery, ListLedgerDimensionsQueryVariables>;
2692
2865
  export declare const ListLedgerElementsDocument: DocumentNode<ListLedgerElementsQuery, ListLedgerElementsQueryVariables>;
2693
2866
  export declare const ListLedgerEntitiesDocument: DocumentNode<ListLedgerEntitiesQuery, ListLedgerEntitiesQueryVariables>;
2694
2867
  export declare const GetLedgerEntityDocument: DocumentNode<GetLedgerEntityQuery, GetLedgerEntityQueryVariables>;