@robosystems/client 2.8.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/LedgerClient.d.ts +77 -18
- package/artifacts/LedgerClient.js +92 -25
- package/artifacts/LedgerClient.ts +161 -29
- package/artifacts/graphql/generated/graphql.d.ts +50 -5
- package/artifacts/graphql/generated/graphql.js +244 -2
- package/artifacts/graphql/generated/graphql.ts +303 -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/bankAccounts.d.ts +6 -0
- package/artifacts/graphql/queries/ledger/bankAccounts.js +35 -0
- package/artifacts/graphql/queries/ledger/bankAccounts.ts +33 -0
- 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/index.ts +2 -2
- package/package.json +1 -1
- package/sdk/index.d.ts +2 -2
- package/sdk/index.js +4 -3
- package/sdk/index.ts +2 -2
- package/sdk/sdk.gen.d.ts +9 -1
- package/sdk/sdk.gen.js +20 -3
- package/sdk/sdk.gen.ts +18 -1
- package/sdk/types.gen.d.ts +206 -0
- package/sdk/types.gen.ts +214 -0
- package/sdk.gen.d.ts +9 -1
- package/sdk.gen.js +20 -3
- package/sdk.gen.ts +18 -1
- package/types.gen.d.ts +206 -0
- package/types.gen.ts +214 -0
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
closePeriod,
|
|
37
37
|
computeMetrics,
|
|
38
38
|
createAgent,
|
|
39
|
+
createEntity,
|
|
39
40
|
createEventBlock,
|
|
40
41
|
createEventHandler,
|
|
41
42
|
createInformationBlock,
|
|
@@ -54,6 +55,7 @@ import {
|
|
|
54
55
|
financialStatementAnalysis,
|
|
55
56
|
initializeChartOfAccounts,
|
|
56
57
|
initializeLedger,
|
|
58
|
+
linkBankAccount,
|
|
57
59
|
linkEntityTaxonomy,
|
|
58
60
|
liveFinancialStatement,
|
|
59
61
|
previewEventBlock,
|
|
@@ -95,6 +97,7 @@ import type {
|
|
|
95
97
|
ComputeMetricsRequest,
|
|
96
98
|
ComputeMetricsResponse,
|
|
97
99
|
CreateAgentRequest,
|
|
100
|
+
CreateEntityRequest,
|
|
98
101
|
CreateEventBlockRequest,
|
|
99
102
|
CreateEventHandlerRequest,
|
|
100
103
|
CreateInformationBlockRequest,
|
|
@@ -125,6 +128,8 @@ import type {
|
|
|
125
128
|
JournalEntryResponse,
|
|
126
129
|
LedgerAgentResponse,
|
|
127
130
|
LedgerEntityResponse,
|
|
131
|
+
LinkBankAccountRequest,
|
|
132
|
+
LinkBankAccountResponse,
|
|
128
133
|
LinkEntityTaxonomyRequest,
|
|
129
134
|
LiveFinancialStatementRequest,
|
|
130
135
|
LiveFinancialStatementResponse,
|
|
@@ -196,6 +201,8 @@ import {
|
|
|
196
201
|
ListInformationBlocksDocument,
|
|
197
202
|
ListLedgerAccountsDocument,
|
|
198
203
|
ListLedgerAgentsDocument,
|
|
204
|
+
ListLedgerBankAccountsDocument,
|
|
205
|
+
ListLedgerBankAccountsQuery,
|
|
199
206
|
ListLedgerBlockedSourceGraphsDocument,
|
|
200
207
|
ListLedgerElementsDocument,
|
|
201
208
|
ListLedgerEntitiesDocument,
|
|
@@ -275,6 +282,8 @@ export type LedgerAccountList = NonNullable<ListLedgerAccountsQuery['accounts']>
|
|
|
275
282
|
export type LedgerAccount = LedgerAccountList['accounts'][number]
|
|
276
283
|
export type LedgerAccountTree = NonNullable<GetLedgerAccountTreeQuery['accountTree']>
|
|
277
284
|
export type LedgerAccountRollups = NonNullable<GetLedgerAccountRollupsQuery['accountRollups']>
|
|
285
|
+
export type LedgerBankAccountList = NonNullable<ListLedgerBankAccountsQuery['bankAccounts']>
|
|
286
|
+
export type LedgerBankAccount = LedgerBankAccountList['accounts'][number]
|
|
278
287
|
|
|
279
288
|
export type LedgerTrialBalance = NonNullable<GetLedgerTrialBalanceQuery['trialBalance']>
|
|
280
289
|
export type LedgerMappedTrialBalance = NonNullable<
|
|
@@ -421,6 +430,7 @@ interface RawObligationDetail {
|
|
|
421
430
|
|
|
422
431
|
interface RawFiscalCalendar {
|
|
423
432
|
graph_id: string
|
|
433
|
+
entity_id?: string | null
|
|
424
434
|
fiscal_year_start_month: number
|
|
425
435
|
closed_through: string | null
|
|
426
436
|
close_target: string | null
|
|
@@ -557,6 +567,8 @@ export type LedgerEntryType = 'standard' | 'adjusting' | 'closing' | 'reversing'
|
|
|
557
567
|
// ── Caller-facing option interfaces ────────────────────────────────────
|
|
558
568
|
|
|
559
569
|
export interface InitializeLedgerOptions {
|
|
570
|
+
/** The entity whose calendar is seeded. Omitted: the group parent. */
|
|
571
|
+
entityId?: string | null
|
|
560
572
|
closedThrough?: string | null
|
|
561
573
|
fiscalYearStartMonth?: number
|
|
562
574
|
earliestDataPeriod?: string | null
|
|
@@ -568,6 +580,8 @@ export interface InitializeLedgerOptions {
|
|
|
568
580
|
export type ChartTemplateKey = InitializeChartOfAccountsRequest['template']
|
|
569
581
|
|
|
570
582
|
export interface InitializeChartOfAccountsOptions {
|
|
583
|
+
/** The entity the chart belongs to. Omitted: the group parent. */
|
|
584
|
+
entityId?: string | null
|
|
571
585
|
/**
|
|
572
586
|
* Legal form for the equity mapping: `corporation`, `llc` or `partnership`.
|
|
573
587
|
* Defaults to the graph's primary entity, then to corporation.
|
|
@@ -591,7 +605,17 @@ export interface InitializeChartOfAccountsResult {
|
|
|
591
605
|
unresolved: string[]
|
|
592
606
|
}
|
|
593
607
|
|
|
594
|
-
|
|
608
|
+
/**
|
|
609
|
+
* Which of the graph's entities a call is about. Omitted, it is the group
|
|
610
|
+
* parent: the entity the graph's own source connection books for. Every
|
|
611
|
+
* graph has one; a graph with subsidiaries has more, and each keeps its own
|
|
612
|
+
* books, chart and calendar.
|
|
613
|
+
*/
|
|
614
|
+
export interface EntityScopeOptions {
|
|
615
|
+
entityId?: string | null
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
export interface ClosePeriodOptions extends EntityScopeOptions {
|
|
595
619
|
note?: string | null
|
|
596
620
|
allowStaleSync?: boolean
|
|
597
621
|
/**
|
|
@@ -777,20 +801,24 @@ export class LedgerClient {
|
|
|
777
801
|
// ── Entity ──────────────────────────────────────────────────────────
|
|
778
802
|
|
|
779
803
|
/**
|
|
780
|
-
* Get
|
|
781
|
-
* Returns null when the ledger has no entity yet.
|
|
804
|
+
* Get an entity of this graph: the group parent, or the one `entityId`
|
|
805
|
+
* names. Returns null when the ledger has no entity yet.
|
|
782
806
|
*/
|
|
783
|
-
async getEntity(graphId: string): Promise<LedgerEntity | null> {
|
|
807
|
+
async getEntity(graphId: string, options?: EntityScopeOptions): Promise<LedgerEntity | null> {
|
|
784
808
|
return this.gqlQuery(
|
|
785
809
|
graphId,
|
|
786
810
|
GetLedgerEntityDocument,
|
|
787
|
-
|
|
811
|
+
{ entityId: options?.entityId ?? null },
|
|
788
812
|
'Get entity',
|
|
789
813
|
(data) => data.entity
|
|
790
814
|
)
|
|
791
815
|
}
|
|
792
816
|
|
|
793
|
-
/**
|
|
817
|
+
/**
|
|
818
|
+
* List the graph's entities, optionally filtered by source system. The
|
|
819
|
+
* group parent is the row with `isParent`; a subsidiary names its
|
|
820
|
+
* `parentEntityId` and may carry an `ownershipPct`.
|
|
821
|
+
*/
|
|
794
822
|
async listEntities(
|
|
795
823
|
graphId: string,
|
|
796
824
|
options?: { source?: string }
|
|
@@ -823,14 +851,30 @@ export class LedgerClient {
|
|
|
823
851
|
return entityResponseToCamel(raw)
|
|
824
852
|
}
|
|
825
853
|
|
|
854
|
+
/**
|
|
855
|
+
* Create an entity in this graph. A graph's first entity becomes the group
|
|
856
|
+
* parent; every later one is a subsidiary of the parent unless
|
|
857
|
+
* `parent_entity_id` names another entity. The `ticker` prefixes the
|
|
858
|
+
* entity's account names and is unique in the graph (derived from the
|
|
859
|
+
* name's initials when omitted). Returns the entity in the shape
|
|
860
|
+
* `getEntity` returns.
|
|
861
|
+
*/
|
|
862
|
+
async createEntity(graphId: string, body: CreateEntityRequest): Promise<LedgerEntity> {
|
|
863
|
+
const envelope = await this.callOperation('Create entity', (o) =>
|
|
864
|
+
createEntity({ ...o, path: { graph_id: graphId }, body })
|
|
865
|
+
)
|
|
866
|
+
const raw = this.requireResult('Create entity', envelope.result)
|
|
867
|
+
return entityResponseToCamel(raw)
|
|
868
|
+
}
|
|
869
|
+
|
|
826
870
|
// ── Summary ────────────────────────────────────────────────────────
|
|
827
871
|
|
|
828
872
|
/** Ledger rollup counts + QB sync metadata. */
|
|
829
|
-
async getSummary(graphId: string): Promise<LedgerSummary | null> {
|
|
873
|
+
async getSummary(graphId: string, options?: EntityScopeOptions): Promise<LedgerSummary | null> {
|
|
830
874
|
return this.gqlQuery(
|
|
831
875
|
graphId,
|
|
832
876
|
GetLedgerSummaryDocument,
|
|
833
|
-
|
|
877
|
+
{ entityId: options?.entityId ?? null },
|
|
834
878
|
'Get summary',
|
|
835
879
|
(data) => data.summary
|
|
836
880
|
)
|
|
@@ -846,6 +890,7 @@ export class LedgerClient {
|
|
|
846
890
|
isActive?: boolean
|
|
847
891
|
limit?: number
|
|
848
892
|
offset?: number
|
|
893
|
+
entityId?: string | null
|
|
849
894
|
}
|
|
850
895
|
): Promise<LedgerAccountList | null> {
|
|
851
896
|
return this.gqlQuery(
|
|
@@ -856,6 +901,7 @@ export class LedgerClient {
|
|
|
856
901
|
isActive: options?.isActive ?? null,
|
|
857
902
|
limit: options?.limit ?? 100,
|
|
858
903
|
offset: options?.offset ?? 0,
|
|
904
|
+
entityId: options?.entityId ?? null,
|
|
859
905
|
},
|
|
860
906
|
'List accounts',
|
|
861
907
|
(data) => data.accounts
|
|
@@ -863,11 +909,14 @@ export class LedgerClient {
|
|
|
863
909
|
}
|
|
864
910
|
|
|
865
911
|
/** Hierarchical Chart of Accounts (up to 4 levels deep). */
|
|
866
|
-
async getAccountTree(
|
|
912
|
+
async getAccountTree(
|
|
913
|
+
graphId: string,
|
|
914
|
+
options?: EntityScopeOptions
|
|
915
|
+
): Promise<LedgerAccountTree | null> {
|
|
867
916
|
return this.gqlQuery(
|
|
868
917
|
graphId,
|
|
869
918
|
GetLedgerAccountTreeDocument,
|
|
870
|
-
|
|
919
|
+
{ entityId: options?.entityId ?? null },
|
|
871
920
|
'Get account tree',
|
|
872
921
|
(data) => data.accountTree
|
|
873
922
|
)
|
|
@@ -876,7 +925,7 @@ export class LedgerClient {
|
|
|
876
925
|
/** Accounts rolled up to reporting concepts via a mapping structure. */
|
|
877
926
|
async getAccountRollups(
|
|
878
927
|
graphId: string,
|
|
879
|
-
options?: { mappingId?: string; startDate?: string; endDate?: string }
|
|
928
|
+
options?: { mappingId?: string; startDate?: string; endDate?: string; entityId?: string | null }
|
|
880
929
|
): Promise<LedgerAccountRollups | null> {
|
|
881
930
|
return this.gqlQuery(
|
|
882
931
|
graphId,
|
|
@@ -885,12 +934,54 @@ export class LedgerClient {
|
|
|
885
934
|
mappingId: options?.mappingId ?? null,
|
|
886
935
|
startDate: options?.startDate ?? null,
|
|
887
936
|
endDate: options?.endDate ?? null,
|
|
937
|
+
entityId: options?.entityId ?? null,
|
|
888
938
|
},
|
|
889
939
|
'Get account rollups',
|
|
890
940
|
(data) => data.accountRollups
|
|
891
941
|
)
|
|
892
942
|
}
|
|
893
943
|
|
|
944
|
+
// ── Bank accounts ─────────────────────────────────────────────────────
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* The group's bank and card accounts: every chart account a feed books to,
|
|
948
|
+
* or that a source system types as a bank or card account, with the entity
|
|
949
|
+
* whose chart it is in (`entityId`, the books its lines go into), what
|
|
950
|
+
* writes to it (`source`: a feed provider, `quickbooks`, or null for an
|
|
951
|
+
* account kept by hand) and the connection's status and last sync. Pass
|
|
952
|
+
* `entityId` for one entity's accounts; omit it for the whole group.
|
|
953
|
+
*/
|
|
954
|
+
async listBankAccounts(
|
|
955
|
+
graphId: string,
|
|
956
|
+
options?: EntityScopeOptions
|
|
957
|
+
): Promise<LedgerBankAccountList | null> {
|
|
958
|
+
return this.gqlQuery(
|
|
959
|
+
graphId,
|
|
960
|
+
ListLedgerBankAccountsDocument,
|
|
961
|
+
{ entityId: options?.entityId ?? null },
|
|
962
|
+
'List bank accounts',
|
|
963
|
+
(data) => data.bankAccounts
|
|
964
|
+
)
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Point a bank feed's account at a chart account. `element_id` links an
|
|
969
|
+
* existing account (its chart's entity takes the feed); `entity_id` alone
|
|
970
|
+
* creates one in that entity's chart. This is how a feed account is bound
|
|
971
|
+
* to a subsidiary: lines still in the inbox move with it, posted entries
|
|
972
|
+
* stay where they were posted. An account another connection already
|
|
973
|
+
* feeds is refused.
|
|
974
|
+
*/
|
|
975
|
+
async linkBankAccount(
|
|
976
|
+
graphId: string,
|
|
977
|
+
body: LinkBankAccountRequest
|
|
978
|
+
): Promise<LinkBankAccountResponse> {
|
|
979
|
+
const envelope = await this.callOperation('Link bank account', (o) =>
|
|
980
|
+
linkBankAccount({ ...o, path: { graph_id: graphId }, body })
|
|
981
|
+
)
|
|
982
|
+
return this.requireResult('Link bank account', envelope.result)
|
|
983
|
+
}
|
|
984
|
+
|
|
894
985
|
// ── Transactions ────────────────────────────────────────────────────
|
|
895
986
|
|
|
896
987
|
/** List transactions with optional type + date filters and pagination. */
|
|
@@ -902,6 +993,7 @@ export class LedgerClient {
|
|
|
902
993
|
endDate?: string
|
|
903
994
|
limit?: number
|
|
904
995
|
offset?: number
|
|
996
|
+
entityId?: string | null
|
|
905
997
|
}
|
|
906
998
|
): Promise<LedgerTransactionList | null> {
|
|
907
999
|
return this.gqlQuery(
|
|
@@ -913,6 +1005,7 @@ export class LedgerClient {
|
|
|
913
1005
|
endDate: options?.endDate ?? null,
|
|
914
1006
|
limit: options?.limit ?? 100,
|
|
915
1007
|
offset: options?.offset ?? 0,
|
|
1008
|
+
entityId: options?.entityId ?? null,
|
|
916
1009
|
},
|
|
917
1010
|
'List transactions',
|
|
918
1011
|
(data) => data.transactions
|
|
@@ -945,6 +1038,7 @@ export class LedgerClient {
|
|
|
945
1038
|
transactionId?: string
|
|
946
1039
|
limit?: number
|
|
947
1040
|
offset?: number
|
|
1041
|
+
entityId?: string | null
|
|
948
1042
|
}
|
|
949
1043
|
): Promise<LedgerJournalEntryList | null> {
|
|
950
1044
|
return this.gqlQuery(
|
|
@@ -959,6 +1053,7 @@ export class LedgerClient {
|
|
|
959
1053
|
transactionId: options?.transactionId ?? null,
|
|
960
1054
|
limit: options?.limit ?? 100,
|
|
961
1055
|
offset: options?.offset ?? 0,
|
|
1056
|
+
entityId: options?.entityId ?? null,
|
|
962
1057
|
},
|
|
963
1058
|
'List journal entries',
|
|
964
1059
|
(data) => data.journalEntries
|
|
@@ -997,6 +1092,7 @@ export class LedgerClient {
|
|
|
997
1092
|
isReconcilingItem?: boolean
|
|
998
1093
|
limit?: number
|
|
999
1094
|
offset?: number
|
|
1095
|
+
entityId?: string | null
|
|
1000
1096
|
}
|
|
1001
1097
|
): Promise<LedgerEventBlock[]> {
|
|
1002
1098
|
return this.gqlQuery(
|
|
@@ -1011,6 +1107,7 @@ export class LedgerClient {
|
|
|
1011
1107
|
isReconcilingItem: options?.isReconcilingItem ?? null,
|
|
1012
1108
|
limit: options?.limit ?? 50,
|
|
1013
1109
|
offset: options?.offset ?? 0,
|
|
1110
|
+
entityId: options?.entityId ?? null,
|
|
1014
1111
|
},
|
|
1015
1112
|
'List event blocks',
|
|
1016
1113
|
(data) => data.eventBlocks
|
|
@@ -1076,7 +1173,7 @@ export class LedgerClient {
|
|
|
1076
1173
|
/** Trial balance by raw CoA account. */
|
|
1077
1174
|
async getTrialBalance(
|
|
1078
1175
|
graphId: string,
|
|
1079
|
-
options?: { startDate?: string; endDate?: string }
|
|
1176
|
+
options?: { startDate?: string; endDate?: string; entityId?: string | null }
|
|
1080
1177
|
): Promise<LedgerTrialBalance | null> {
|
|
1081
1178
|
return this.gqlQuery(
|
|
1082
1179
|
graphId,
|
|
@@ -1084,6 +1181,7 @@ export class LedgerClient {
|
|
|
1084
1181
|
{
|
|
1085
1182
|
startDate: options?.startDate ?? null,
|
|
1086
1183
|
endDate: options?.endDate ?? null,
|
|
1184
|
+
entityId: options?.entityId ?? null,
|
|
1087
1185
|
},
|
|
1088
1186
|
'Get trial balance',
|
|
1089
1187
|
(data) => data.trialBalance
|
|
@@ -1727,23 +1825,28 @@ export class LedgerClient {
|
|
|
1727
1825
|
async getPeriodCloseStatus(
|
|
1728
1826
|
graphId: string,
|
|
1729
1827
|
periodStart: string,
|
|
1730
|
-
periodEnd: string
|
|
1828
|
+
periodEnd: string,
|
|
1829
|
+
options?: EntityScopeOptions
|
|
1731
1830
|
): Promise<LedgerPeriodCloseStatus | null> {
|
|
1732
1831
|
return this.gqlQuery(
|
|
1733
1832
|
graphId,
|
|
1734
1833
|
GetLedgerPeriodCloseStatusDocument,
|
|
1735
|
-
{ periodStart, periodEnd },
|
|
1834
|
+
{ periodStart, periodEnd, entityId: options?.entityId ?? null },
|
|
1736
1835
|
'Get period close status',
|
|
1737
1836
|
(data) => data.periodCloseStatus
|
|
1738
1837
|
)
|
|
1739
1838
|
}
|
|
1740
1839
|
|
|
1741
1840
|
/** All draft entries in a period, fully expanded for review pre-close. */
|
|
1742
|
-
async listPeriodDrafts(
|
|
1841
|
+
async listPeriodDrafts(
|
|
1842
|
+
graphId: string,
|
|
1843
|
+
period: string,
|
|
1844
|
+
options?: EntityScopeOptions
|
|
1845
|
+
): Promise<LedgerPeriodDrafts | null> {
|
|
1743
1846
|
return this.gqlQuery(
|
|
1744
1847
|
graphId,
|
|
1745
1848
|
GetLedgerPeriodDraftsDocument,
|
|
1746
|
-
{ period },
|
|
1849
|
+
{ period, entityId: options?.entityId ?? null },
|
|
1747
1850
|
'List period drafts',
|
|
1748
1851
|
(data) => data.periodDrafts
|
|
1749
1852
|
)
|
|
@@ -1790,11 +1893,14 @@ export class LedgerClient {
|
|
|
1790
1893
|
// ── Closing book ───────────────────────────────────────────────────
|
|
1791
1894
|
|
|
1792
1895
|
/** Grouped closing book structures for the close-screen sidebar. */
|
|
1793
|
-
async getClosingBookStructures(
|
|
1896
|
+
async getClosingBookStructures(
|
|
1897
|
+
graphId: string,
|
|
1898
|
+
options?: EntityScopeOptions
|
|
1899
|
+
): Promise<LedgerClosingBookStructures | null> {
|
|
1794
1900
|
return this.gqlQuery(
|
|
1795
1901
|
graphId,
|
|
1796
1902
|
GetLedgerClosingBookStructuresDocument,
|
|
1797
|
-
|
|
1903
|
+
{ entityId: options?.entityId ?? null },
|
|
1798
1904
|
'Get closing book structures',
|
|
1799
1905
|
(data) => data.closingBookStructures
|
|
1800
1906
|
)
|
|
@@ -1802,12 +1908,18 @@ export class LedgerClient {
|
|
|
1802
1908
|
|
|
1803
1909
|
// ── Fiscal Calendar ────────────────────────────────────────────────
|
|
1804
1910
|
|
|
1805
|
-
/**
|
|
1806
|
-
|
|
1911
|
+
/**
|
|
1912
|
+
* Current fiscal calendar state — pointers, gap, closeable status — for the
|
|
1913
|
+
* group parent, or for the entity `entityId` names.
|
|
1914
|
+
*/
|
|
1915
|
+
async getFiscalCalendar(
|
|
1916
|
+
graphId: string,
|
|
1917
|
+
options?: EntityScopeOptions
|
|
1918
|
+
): Promise<LedgerFiscalCalendar | null> {
|
|
1807
1919
|
return this.gqlQuery(
|
|
1808
1920
|
graphId,
|
|
1809
1921
|
GetLedgerFiscalCalendarDocument,
|
|
1810
|
-
|
|
1922
|
+
{ entityId: options?.entityId ?? null },
|
|
1811
1923
|
'Get fiscal calendar',
|
|
1812
1924
|
(data) => data.fiscalCalendar
|
|
1813
1925
|
)
|
|
@@ -1819,6 +1931,7 @@ export class LedgerClient {
|
|
|
1819
1931
|
options?: InitializeLedgerOptions
|
|
1820
1932
|
): Promise<InitializeLedgerResult> {
|
|
1821
1933
|
const body: InitializeLedgerRequest = {
|
|
1934
|
+
entity_id: options?.entityId ?? null,
|
|
1822
1935
|
closed_through: options?.closedThrough ?? null,
|
|
1823
1936
|
fiscal_year_start_month: options?.fiscalYearStartMonth,
|
|
1824
1937
|
earliest_data_period: options?.earliestDataPeriod ?? null,
|
|
@@ -1862,6 +1975,7 @@ export class LedgerClient {
|
|
|
1862
1975
|
): Promise<InitializeChartOfAccountsResult> {
|
|
1863
1976
|
const body: InitializeChartOfAccountsRequest = {
|
|
1864
1977
|
template,
|
|
1978
|
+
entity_id: options?.entityId ?? null,
|
|
1865
1979
|
entity_type: options?.entityType ?? null,
|
|
1866
1980
|
name: options?.name ?? null,
|
|
1867
1981
|
}
|
|
@@ -1885,16 +1999,24 @@ export class LedgerClient {
|
|
|
1885
1999
|
async setCloseTarget(
|
|
1886
2000
|
graphId: string,
|
|
1887
2001
|
period: string,
|
|
1888
|
-
note?: string | null
|
|
2002
|
+
note?: string | null,
|
|
2003
|
+
options?: EntityScopeOptions
|
|
1889
2004
|
): Promise<LedgerFiscalCalendar> {
|
|
1890
|
-
const body: SetCloseTargetOperation = {
|
|
2005
|
+
const body: SetCloseTargetOperation = {
|
|
2006
|
+
period,
|
|
2007
|
+
note: note ?? null,
|
|
2008
|
+
entity_id: options?.entityId ?? null,
|
|
2009
|
+
}
|
|
1891
2010
|
const envelope = await this.callOperation('Set close target', (o) =>
|
|
1892
2011
|
setCloseTarget({ ...o, path: { graph_id: graphId }, body })
|
|
1893
2012
|
)
|
|
1894
2013
|
return rawFiscalCalendarToCamel(envelope.result as unknown as RawFiscalCalendar)
|
|
1895
2014
|
}
|
|
1896
2015
|
|
|
1897
|
-
/**
|
|
2016
|
+
/**
|
|
2017
|
+
* Close a fiscal period — the final commit action — on the group parent,
|
|
2018
|
+
* or on the entity `entityId` names. Each entity closes on its own.
|
|
2019
|
+
*/
|
|
1898
2020
|
async closePeriod(
|
|
1899
2021
|
graphId: string,
|
|
1900
2022
|
period: string,
|
|
@@ -1902,6 +2024,7 @@ export class LedgerClient {
|
|
|
1902
2024
|
): Promise<ClosePeriodResult> {
|
|
1903
2025
|
const body: ClosePeriodOperation = {
|
|
1904
2026
|
period,
|
|
2027
|
+
entity_id: options?.entityId ?? null,
|
|
1905
2028
|
note: options?.note ?? null,
|
|
1906
2029
|
allow_stale_sync: options?.allowStaleSync,
|
|
1907
2030
|
allow_stranded_obligations: options?.allowStrandedObligations,
|
|
@@ -1930,12 +2053,14 @@ export class LedgerClient {
|
|
|
1930
2053
|
graphId: string,
|
|
1931
2054
|
period: string,
|
|
1932
2055
|
reason: string,
|
|
1933
|
-
note?: string | null
|
|
2056
|
+
note?: string | null,
|
|
2057
|
+
options?: EntityScopeOptions
|
|
1934
2058
|
): Promise<LedgerFiscalCalendar> {
|
|
1935
2059
|
const body: ReopenPeriodOperation = {
|
|
1936
2060
|
period,
|
|
1937
2061
|
reason,
|
|
1938
2062
|
note: note ?? null,
|
|
2063
|
+
entity_id: options?.entityId ?? null,
|
|
1939
2064
|
}
|
|
1940
2065
|
const envelope = await this.callOperation('Reopen period', (o) =>
|
|
1941
2066
|
reopenPeriod({ ...o, path: { graph_id: graphId }, body })
|
|
@@ -1951,12 +2076,13 @@ export class LedgerClient {
|
|
|
1951
2076
|
*/
|
|
1952
2077
|
async listReconciliations(
|
|
1953
2078
|
graphId: string,
|
|
1954
|
-
period: string
|
|
2079
|
+
period: string,
|
|
2080
|
+
options?: EntityScopeOptions
|
|
1955
2081
|
): Promise<LedgerReconciliationList | null> {
|
|
1956
2082
|
return this.gqlQuery(
|
|
1957
2083
|
graphId,
|
|
1958
2084
|
ListLedgerReconciliationsDocument,
|
|
1959
|
-
{ period },
|
|
2085
|
+
{ period, entityId: options?.entityId ?? null },
|
|
1960
2086
|
'List reconciliations',
|
|
1961
2087
|
(data) => data.reconciliations
|
|
1962
2088
|
)
|
|
@@ -2453,12 +2579,15 @@ export class LedgerClient {
|
|
|
2453
2579
|
*/
|
|
2454
2580
|
async listReports(
|
|
2455
2581
|
graphId: string,
|
|
2456
|
-
options: { lifecycle?: ReportLifecycle } = {}
|
|
2582
|
+
options: { lifecycle?: ReportLifecycle; entityId?: string | null } = {}
|
|
2457
2583
|
): Promise<ReportListItem[]> {
|
|
2458
2584
|
const list = await this.gqlQuery(
|
|
2459
2585
|
graphId,
|
|
2460
2586
|
ListLedgerReportsDocument,
|
|
2461
|
-
|
|
2587
|
+
{
|
|
2588
|
+
...(options.lifecycle ? { lifecycle: options.lifecycle } : {}),
|
|
2589
|
+
entityId: options.entityId ?? null,
|
|
2590
|
+
},
|
|
2462
2591
|
'List reports',
|
|
2463
2592
|
(data) => data.reports
|
|
2464
2593
|
)
|
|
@@ -2930,6 +3059,7 @@ function rawObligationDetailToCamel(raw: RawObligationDetail) {
|
|
|
2930
3059
|
function rawFiscalCalendarToCamel(raw: RawFiscalCalendar): LedgerFiscalCalendar {
|
|
2931
3060
|
return {
|
|
2932
3061
|
graphId: raw.graph_id,
|
|
3062
|
+
entityId: raw.entity_id ?? null,
|
|
2933
3063
|
fiscalYearStartMonth: raw.fiscal_year_start_month,
|
|
2934
3064
|
closedThrough: raw.closed_through ?? null,
|
|
2935
3065
|
closeTarget: raw.close_target ?? null,
|
|
@@ -3082,11 +3212,13 @@ function entityResponseToCamel(raw: LedgerEntityResponse): LedgerEntity {
|
|
|
3082
3212
|
lei: raw.lei ?? null,
|
|
3083
3213
|
industry: raw.industry ?? null,
|
|
3084
3214
|
entityType: raw.entity_type ?? null,
|
|
3215
|
+
reportingStyleId: raw.reporting_style_id ?? null,
|
|
3085
3216
|
phone: raw.phone ?? null,
|
|
3086
3217
|
website: raw.website ?? null,
|
|
3087
3218
|
status: raw.status ?? null,
|
|
3088
3219
|
isParent: raw.is_parent ?? null,
|
|
3089
3220
|
parentEntityId: raw.parent_entity_id ?? null,
|
|
3221
|
+
ownershipPct: raw.ownership_pct ?? null,
|
|
3090
3222
|
source: raw.source ?? null,
|
|
3091
3223
|
sourceId: raw.source_id ?? null,
|
|
3092
3224
|
sourceGraphId: raw.source_graph_id ?? null,
|