@robosystems/client 0.3.8 → 0.3.10
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 +42 -49
- package/artifacts/LedgerClient.js +86 -116
- package/artifacts/LedgerClient.ts +155 -238
- package/artifacts/graphql/generated/graphql.d.ts +334 -68
- package/artifacts/graphql/generated/graphql.js +276 -117
- package/artifacts/graphql/generated/graphql.ts +654 -217
- package/artifacts/graphql/queries/ledger/informationBlock.d.ts +15 -0
- package/artifacts/graphql/queries/ledger/informationBlock.js +125 -0
- package/artifacts/graphql/queries/ledger/informationBlock.ts +124 -0
- package/index.ts +2 -2
- package/package.json +1 -1
- package/sdk/index.d.ts +2 -2
- package/sdk/index.js +11 -18
- package/sdk/index.ts +2 -2
- package/sdk/sdk.gen.d.ts +49 -105
- package/sdk/sdk.gen.js +82 -201
- package/sdk/sdk.gen.ts +65 -184
- package/sdk/types.gen.d.ts +2329 -2593
- package/sdk/types.gen.ts +852 -1155
- package/sdk.gen.d.ts +49 -105
- package/sdk.gen.js +82 -201
- package/sdk.gen.ts +65 -184
- package/types.gen.d.ts +2329 -2593
- package/types.gen.ts +852 -1155
- package/artifacts/graphql/queries/ledger/scheduleFacts.d.ts +0 -7
- package/artifacts/graphql/queries/ledger/scheduleFacts.js +0 -24
- package/artifacts/graphql/queries/ledger/scheduleFacts.ts +0 -22
- package/artifacts/graphql/queries/ledger/schedules.d.ts +0 -6
- package/artifacts/graphql/queries/ledger/schedules.js +0 -24
- package/artifacts/graphql/queries/ledger/schedules.ts +0 -22
|
@@ -29,27 +29,23 @@ import {
|
|
|
29
29
|
opAutoMapElements,
|
|
30
30
|
opBuildFactGrid,
|
|
31
31
|
opClosePeriod,
|
|
32
|
-
opCreateAssociations,
|
|
33
32
|
opCreateClosingEntry,
|
|
34
|
-
|
|
33
|
+
opCreateInformationBlock,
|
|
35
34
|
opCreateJournalEntry,
|
|
36
35
|
opCreateManualClosingEntry,
|
|
37
36
|
opCreateMappingAssociation,
|
|
38
37
|
opCreatePublishList,
|
|
39
38
|
opCreateReport,
|
|
40
|
-
|
|
41
|
-
opCreateStructure,
|
|
42
|
-
opCreateTaxonomy,
|
|
39
|
+
opCreateTaxonomyBlock,
|
|
43
40
|
opCreateTransaction,
|
|
44
|
-
|
|
45
|
-
opDeleteElement,
|
|
41
|
+
opDeleteInformationBlock,
|
|
46
42
|
opDeleteJournalEntry,
|
|
47
43
|
opDeleteMappingAssociation,
|
|
48
44
|
opDeletePublishList,
|
|
49
45
|
opDeleteReport,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
opDeleteTaxonomyBlock,
|
|
47
|
+
opDisposeSchedule,
|
|
48
|
+
opEvaluateRules,
|
|
53
49
|
opInitializeLedger,
|
|
54
50
|
opLinkEntityTaxonomy,
|
|
55
51
|
opRegenerateReport,
|
|
@@ -59,40 +55,32 @@ import {
|
|
|
59
55
|
opSetCloseTarget,
|
|
60
56
|
opShareReport,
|
|
61
57
|
opTruncateSchedule,
|
|
62
|
-
opUpdateAssociation,
|
|
63
|
-
opUpdateElement,
|
|
64
58
|
opUpdateEntity,
|
|
59
|
+
opUpdateInformationBlock,
|
|
65
60
|
opUpdateJournalEntry,
|
|
66
61
|
opUpdatePublishList,
|
|
67
|
-
|
|
68
|
-
opUpdateStructure,
|
|
69
|
-
opUpdateTaxonomy,
|
|
62
|
+
opUpdateTaxonomyBlock,
|
|
70
63
|
} from '../sdk.gen'
|
|
71
64
|
import type {
|
|
72
65
|
AddPublishListMembersOperation,
|
|
73
66
|
AutoMapElementsOperation,
|
|
74
|
-
BulkAssociationItem,
|
|
75
|
-
BulkCreateAssociationsRequest,
|
|
76
67
|
ClosePeriodOperation,
|
|
77
68
|
CreateClosingEntryOperation,
|
|
78
|
-
|
|
69
|
+
CreateInformationBlockRequest,
|
|
79
70
|
CreateJournalEntryRequest,
|
|
80
71
|
CreateManualClosingEntryRequest,
|
|
81
72
|
CreateMappingAssociationOperation,
|
|
82
73
|
CreatePublishListRequest,
|
|
83
74
|
CreateReportRequest,
|
|
84
|
-
|
|
85
|
-
CreateStructureRequest,
|
|
86
|
-
CreateTaxonomyRequest,
|
|
75
|
+
CreateTaxonomyBlockRequest,
|
|
87
76
|
CreateTransactionRequest,
|
|
88
77
|
CreateViewRequest,
|
|
89
|
-
|
|
90
|
-
DeleteElementRequest,
|
|
78
|
+
DeleteInformationBlockRequest,
|
|
91
79
|
DeleteJournalEntryRequest,
|
|
92
80
|
DeleteMappingAssociationOperation,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
81
|
+
DeleteTaxonomyBlockRequest,
|
|
82
|
+
DisposeScheduleRequest,
|
|
83
|
+
EvaluateRulesRequest,
|
|
96
84
|
InitializeLedgerRequest,
|
|
97
85
|
JournalEntryLineItemInput,
|
|
98
86
|
LinkEntityTaxonomyRequest,
|
|
@@ -101,18 +89,16 @@ import type {
|
|
|
101
89
|
ReverseJournalEntryRequest,
|
|
102
90
|
SetCloseTargetOperation,
|
|
103
91
|
TruncateScheduleOperation,
|
|
104
|
-
UpdateAssociationRequest,
|
|
105
|
-
UpdateElementRequest,
|
|
106
92
|
UpdateEntityRequest,
|
|
93
|
+
UpdateInformationBlockRequest,
|
|
107
94
|
UpdateJournalEntryRequest,
|
|
108
95
|
UpdatePublishListOperation,
|
|
109
|
-
|
|
110
|
-
UpdateStructureRequest,
|
|
111
|
-
UpdateTaxonomyRequest,
|
|
96
|
+
UpdateTaxonomyBlockRequest,
|
|
112
97
|
} from '../types.gen'
|
|
113
98
|
import type { TokenProvider } from './graphql/client'
|
|
114
99
|
import { GraphQLClientCache } from './graphql/client'
|
|
115
100
|
import {
|
|
101
|
+
GetInformationBlockDocument,
|
|
116
102
|
GetLedgerAccountRollupsDocument,
|
|
117
103
|
GetLedgerAccountTreeDocument,
|
|
118
104
|
GetLedgerClosingBookStructuresDocument,
|
|
@@ -126,22 +112,22 @@ import {
|
|
|
126
112
|
GetLedgerPublishListDocument,
|
|
127
113
|
GetLedgerReportDocument,
|
|
128
114
|
GetLedgerReportingTaxonomyDocument,
|
|
129
|
-
GetLedgerScheduleFactsDocument,
|
|
130
115
|
GetLedgerStatementDocument,
|
|
131
116
|
GetLedgerSummaryDocument,
|
|
132
117
|
GetLedgerTransactionDocument,
|
|
133
118
|
GetLedgerTrialBalanceDocument,
|
|
119
|
+
ListInformationBlocksDocument,
|
|
134
120
|
ListLedgerAccountsDocument,
|
|
135
121
|
ListLedgerElementsDocument,
|
|
136
122
|
ListLedgerEntitiesDocument,
|
|
137
123
|
ListLedgerMappingsDocument,
|
|
138
124
|
ListLedgerPublishListsDocument,
|
|
139
125
|
ListLedgerReportsDocument,
|
|
140
|
-
ListLedgerSchedulesDocument,
|
|
141
126
|
ListLedgerStructuresDocument,
|
|
142
127
|
ListLedgerTaxonomiesDocument,
|
|
143
128
|
ListLedgerTransactionsDocument,
|
|
144
129
|
ListLedgerUnmappedElementsDocument,
|
|
130
|
+
type GetInformationBlockQuery,
|
|
145
131
|
type GetLedgerAccountRollupsQuery,
|
|
146
132
|
type GetLedgerAccountTreeQuery,
|
|
147
133
|
type GetLedgerClosingBookStructuresQuery,
|
|
@@ -155,18 +141,17 @@ import {
|
|
|
155
141
|
type GetLedgerPublishListQuery,
|
|
156
142
|
type GetLedgerReportingTaxonomyQuery,
|
|
157
143
|
type GetLedgerReportQuery,
|
|
158
|
-
type GetLedgerScheduleFactsQuery,
|
|
159
144
|
type GetLedgerStatementQuery,
|
|
160
145
|
type GetLedgerSummaryQuery,
|
|
161
146
|
type GetLedgerTransactionQuery,
|
|
162
147
|
type GetLedgerTrialBalanceQuery,
|
|
148
|
+
type ListInformationBlocksQuery,
|
|
163
149
|
type ListLedgerAccountsQuery,
|
|
164
150
|
type ListLedgerElementsQuery,
|
|
165
151
|
type ListLedgerEntitiesQuery,
|
|
166
152
|
type ListLedgerMappingsQuery,
|
|
167
153
|
type ListLedgerPublishListsQuery,
|
|
168
154
|
type ListLedgerReportsQuery,
|
|
169
|
-
type ListLedgerSchedulesQuery,
|
|
170
155
|
type ListLedgerStructuresQuery,
|
|
171
156
|
type ListLedgerTaxonomiesQuery,
|
|
172
157
|
type ListLedgerTransactionsQuery,
|
|
@@ -217,10 +202,11 @@ export type LedgerMappingInfo = LedgerMappingList['structures'][number]
|
|
|
217
202
|
export type LedgerMapping = NonNullable<GetLedgerMappingQuery['mapping']>
|
|
218
203
|
export type LedgerMappingCoverage = NonNullable<GetLedgerMappingCoverageQuery['mappingCoverage']>
|
|
219
204
|
|
|
220
|
-
export type
|
|
221
|
-
export type
|
|
222
|
-
export type
|
|
223
|
-
export type
|
|
205
|
+
export type InformationBlock = NonNullable<GetInformationBlockQuery['informationBlock']>
|
|
206
|
+
export type InformationBlockList = ListInformationBlocksQuery['informationBlocks']
|
|
207
|
+
export type InformationBlockElement = InformationBlock['elements'][number]
|
|
208
|
+
export type InformationBlockConnection = InformationBlock['connections'][number]
|
|
209
|
+
export type InformationBlockFact = InformationBlock['facts'][number]
|
|
224
210
|
|
|
225
211
|
export type LedgerPeriodCloseStatus = NonNullable<
|
|
226
212
|
GetLedgerPeriodCloseStatusQuery['periodCloseStatus']
|
|
@@ -756,53 +742,60 @@ export class LedgerClient {
|
|
|
756
742
|
return list?.taxonomies ?? []
|
|
757
743
|
}
|
|
758
744
|
|
|
759
|
-
/**
|
|
760
|
-
|
|
745
|
+
/**
|
|
746
|
+
* Link the graph's entity to a taxonomy (ENTITY_HAS_TAXONOMY edge).
|
|
747
|
+
* Idempotent — returns existing linkage if already present.
|
|
748
|
+
*/
|
|
749
|
+
async linkEntityTaxonomy(
|
|
761
750
|
graphId: string,
|
|
762
|
-
body:
|
|
751
|
+
body: LinkEntityTaxonomyRequest
|
|
763
752
|
): Promise<Record<string, unknown>> {
|
|
764
753
|
const envelope = await this.callOperation(
|
|
765
|
-
'
|
|
766
|
-
|
|
754
|
+
'Link entity taxonomy',
|
|
755
|
+
opLinkEntityTaxonomy({ path: { graph_id: graphId }, body })
|
|
767
756
|
)
|
|
768
757
|
return (envelope.result ?? {}) as Record<string, unknown>
|
|
769
758
|
}
|
|
770
759
|
|
|
771
|
-
/**
|
|
772
|
-
|
|
760
|
+
/**
|
|
761
|
+
* Create a taxonomy block atomically (taxonomy + structures + elements +
|
|
762
|
+
* associations + rules in one envelope).
|
|
763
|
+
*/
|
|
764
|
+
async createTaxonomyBlock(
|
|
773
765
|
graphId: string,
|
|
774
|
-
body:
|
|
766
|
+
body: CreateTaxonomyBlockRequest,
|
|
767
|
+
idempotencyKey?: string
|
|
775
768
|
): Promise<Record<string, unknown>> {
|
|
769
|
+
const headers = idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : undefined
|
|
776
770
|
const envelope = await this.callOperation(
|
|
777
|
-
'
|
|
778
|
-
|
|
771
|
+
'Create taxonomy block',
|
|
772
|
+
opCreateTaxonomyBlock({ path: { graph_id: graphId }, body, headers })
|
|
779
773
|
)
|
|
780
774
|
return (envelope.result ?? {}) as Record<string, unknown>
|
|
781
775
|
}
|
|
782
776
|
|
|
783
|
-
/**
|
|
784
|
-
async
|
|
785
|
-
|
|
777
|
+
/** Update a taxonomy block — add/update/remove elements, structures, associations, or rules. */
|
|
778
|
+
async updateTaxonomyBlock(
|
|
779
|
+
graphId: string,
|
|
780
|
+
body: UpdateTaxonomyBlockRequest
|
|
781
|
+
): Promise<Record<string, unknown>> {
|
|
786
782
|
const envelope = await this.callOperation(
|
|
787
|
-
'
|
|
788
|
-
|
|
783
|
+
'Update taxonomy block',
|
|
784
|
+
opUpdateTaxonomyBlock({ path: { graph_id: graphId }, body })
|
|
789
785
|
)
|
|
790
786
|
return (envelope.result ?? {}) as Record<string, unknown>
|
|
791
787
|
}
|
|
792
788
|
|
|
793
|
-
/**
|
|
794
|
-
|
|
795
|
-
* Idempotent — returns existing linkage if already present.
|
|
796
|
-
*/
|
|
797
|
-
async linkEntityTaxonomy(
|
|
789
|
+
/** Delete a taxonomy block. Cascades through elements, structures, and associations. */
|
|
790
|
+
async deleteTaxonomyBlock(
|
|
798
791
|
graphId: string,
|
|
799
|
-
body:
|
|
800
|
-
): Promise<
|
|
792
|
+
body: DeleteTaxonomyBlockRequest
|
|
793
|
+
): Promise<{ deleted: boolean }> {
|
|
801
794
|
const envelope = await this.callOperation(
|
|
802
|
-
'
|
|
803
|
-
|
|
795
|
+
'Delete taxonomy block',
|
|
796
|
+
opDeleteTaxonomyBlock({ path: { graph_id: graphId }, body })
|
|
804
797
|
)
|
|
805
|
-
return (envelope.result ?? {}) as
|
|
798
|
+
return (envelope.result ?? { deleted: true }) as { deleted: boolean }
|
|
806
799
|
}
|
|
807
800
|
|
|
808
801
|
/** List elements (CoA accounts, GAAP concepts, etc.) with filters. */
|
|
@@ -847,40 +840,6 @@ export class LedgerClient {
|
|
|
847
840
|
)
|
|
848
841
|
}
|
|
849
842
|
|
|
850
|
-
/** Create a new element within a taxonomy (native CoA account, etc.). */
|
|
851
|
-
async createElement(
|
|
852
|
-
graphId: string,
|
|
853
|
-
body: CreateElementRequest
|
|
854
|
-
): Promise<Record<string, unknown>> {
|
|
855
|
-
const envelope = await this.callOperation(
|
|
856
|
-
'Create element',
|
|
857
|
-
opCreateElement({ path: { graph_id: graphId }, body })
|
|
858
|
-
)
|
|
859
|
-
return (envelope.result ?? {}) as Record<string, unknown>
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
/** Update mutable fields on an element. `taxonomy_id` and `source` are immutable. */
|
|
863
|
-
async updateElement(
|
|
864
|
-
graphId: string,
|
|
865
|
-
body: UpdateElementRequest
|
|
866
|
-
): Promise<Record<string, unknown>> {
|
|
867
|
-
const envelope = await this.callOperation(
|
|
868
|
-
'Update element',
|
|
869
|
-
opUpdateElement({ path: { graph_id: graphId }, body })
|
|
870
|
-
)
|
|
871
|
-
return (envelope.result ?? {}) as Record<string, unknown>
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
/** Soft-delete an element (`is_active=false`). */
|
|
875
|
-
async deleteElement(graphId: string, elementId: string): Promise<Record<string, unknown>> {
|
|
876
|
-
const body: DeleteElementRequest = { element_id: elementId }
|
|
877
|
-
const envelope = await this.callOperation(
|
|
878
|
-
'Delete element',
|
|
879
|
-
opDeleteElement({ path: { graph_id: graphId }, body })
|
|
880
|
-
)
|
|
881
|
-
return (envelope.result ?? {}) as Record<string, unknown>
|
|
882
|
-
}
|
|
883
|
-
|
|
884
843
|
// ── Structures ──────────────────────────────────────────────────────
|
|
885
844
|
|
|
886
845
|
/** List reporting structures (IS, BS, CF, schedules) with optional filters. */
|
|
@@ -901,62 +860,6 @@ export class LedgerClient {
|
|
|
901
860
|
return list?.structures ?? []
|
|
902
861
|
}
|
|
903
862
|
|
|
904
|
-
/**
|
|
905
|
-
* Create a new structure. Most common use is a CoA→reporting mapping
|
|
906
|
-
* structure; also used for custom statement + schedule structures.
|
|
907
|
-
*/
|
|
908
|
-
async createStructure(graphId: string, body: CreateStructureRequest): Promise<LedgerMappingInfo> {
|
|
909
|
-
const envelope = await this.callOperation(
|
|
910
|
-
'Create structure',
|
|
911
|
-
opCreateStructure({ path: { graph_id: graphId }, body })
|
|
912
|
-
)
|
|
913
|
-
return envelope.result as unknown as LedgerMappingInfo
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
/** Convenience wrapper — create a CoA→GAAP mapping structure. */
|
|
917
|
-
async createMappingStructure(
|
|
918
|
-
graphId: string,
|
|
919
|
-
options?: {
|
|
920
|
-
name?: string
|
|
921
|
-
description?: string | null
|
|
922
|
-
taxonomyId?: string
|
|
923
|
-
}
|
|
924
|
-
): Promise<LedgerMappingInfo> {
|
|
925
|
-
const body: CreateStructureRequest = {
|
|
926
|
-
name: options?.name ?? 'CoA to Reporting',
|
|
927
|
-
structure_type: 'coa_mapping',
|
|
928
|
-
taxonomy_id: options?.taxonomyId ?? 'tax_usgaap_reporting',
|
|
929
|
-
description: options?.description ?? 'Map Chart of Accounts to US GAAP reporting concepts',
|
|
930
|
-
}
|
|
931
|
-
const envelope = await this.callOperation(
|
|
932
|
-
'Create mapping structure',
|
|
933
|
-
opCreateStructure({ path: { graph_id: graphId }, body })
|
|
934
|
-
)
|
|
935
|
-
return envelope.result as unknown as LedgerMappingInfo
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
/** Update mutable fields on a structure. `structure_type` is immutable. */
|
|
939
|
-
async updateStructure(
|
|
940
|
-
graphId: string,
|
|
941
|
-
body: UpdateStructureRequest
|
|
942
|
-
): Promise<Record<string, unknown>> {
|
|
943
|
-
const envelope = await this.callOperation(
|
|
944
|
-
'Update structure',
|
|
945
|
-
opUpdateStructure({ path: { graph_id: graphId }, body })
|
|
946
|
-
)
|
|
947
|
-
return (envelope.result ?? {}) as Record<string, unknown>
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
/** Soft-delete a structure (`is_active=false`). */
|
|
951
|
-
async deleteStructure(graphId: string, structureId: string): Promise<Record<string, unknown>> {
|
|
952
|
-
const body: DeleteStructureRequest = { structure_id: structureId }
|
|
953
|
-
const envelope = await this.callOperation(
|
|
954
|
-
'Delete structure',
|
|
955
|
-
opDeleteStructure({ path: { graph_id: graphId }, body })
|
|
956
|
-
)
|
|
957
|
-
return (envelope.result ?? {}) as Record<string, unknown>
|
|
958
|
-
}
|
|
959
|
-
|
|
960
863
|
// ── Mappings ────────────────────────────────────────────────────────
|
|
961
864
|
|
|
962
865
|
/** List active CoA→reporting mapping structures. */
|
|
@@ -1036,104 +939,86 @@ export class LedgerClient {
|
|
|
1036
939
|
return { operationId: envelope.operationId, status: envelope.status }
|
|
1037
940
|
}
|
|
1038
941
|
|
|
1039
|
-
|
|
1040
|
-
async createAssociations(
|
|
1041
|
-
graphId: string,
|
|
1042
|
-
structureId: string,
|
|
1043
|
-
associations: BulkAssociationItem[]
|
|
1044
|
-
): Promise<Record<string, unknown>> {
|
|
1045
|
-
const body: BulkCreateAssociationsRequest = { structure_id: structureId, associations }
|
|
1046
|
-
const envelope = await this.callOperation(
|
|
1047
|
-
'Create associations',
|
|
1048
|
-
opCreateAssociations({ path: { graph_id: graphId }, body })
|
|
1049
|
-
)
|
|
1050
|
-
return (envelope.result ?? {}) as Record<string, unknown>
|
|
1051
|
-
}
|
|
942
|
+
// ── Information Blocks ─────────────────────────────────────────────
|
|
1052
943
|
|
|
1053
|
-
/**
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
opUpdateAssociation({ path: { graph_id: graphId }, body })
|
|
1061
|
-
)
|
|
1062
|
-
return (envelope.result ?? {}) as Record<string, unknown>
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
/** Hard-delete an association (any type: presentation, calculation, mapping). */
|
|
1066
|
-
async deleteAssociation(graphId: string, associationId: string): Promise<{ deleted: boolean }> {
|
|
1067
|
-
const body: DeleteAssociationRequest = { association_id: associationId }
|
|
1068
|
-
const envelope = await this.callOperation(
|
|
1069
|
-
'Delete association',
|
|
1070
|
-
opDeleteAssociation({ path: { graph_id: graphId }, body })
|
|
1071
|
-
)
|
|
1072
|
-
return (envelope.result ?? { deleted: true }) as { deleted: boolean }
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
// ── Schedules ──────────────────────────────────────────────────────
|
|
1076
|
-
|
|
1077
|
-
/** List all schedule structures with metadata. */
|
|
1078
|
-
async listSchedules(graphId: string): Promise<LedgerSchedule[]> {
|
|
1079
|
-
const list = await this.gqlQuery(
|
|
944
|
+
/**
|
|
945
|
+
* Fetch an Information Block envelope by id — the generic
|
|
946
|
+
* cross-block-type read. Returns `null` when the block doesn't exist
|
|
947
|
+
* (or its type isn't registered). See `information-block.md`.
|
|
948
|
+
*/
|
|
949
|
+
async getInformationBlock(graphId: string, id: string): Promise<InformationBlock | null> {
|
|
950
|
+
const block = await this.gqlQuery(
|
|
1080
951
|
graphId,
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
'
|
|
1084
|
-
(data) => data.
|
|
952
|
+
GetInformationBlockDocument,
|
|
953
|
+
{ id },
|
|
954
|
+
'Get information block',
|
|
955
|
+
(data) => data.informationBlock ?? null
|
|
1085
956
|
)
|
|
1086
|
-
return
|
|
957
|
+
return block ?? null
|
|
1087
958
|
}
|
|
1088
959
|
|
|
1089
|
-
/**
|
|
1090
|
-
|
|
960
|
+
/**
|
|
961
|
+
* List Information Block envelopes with optional block_type + category
|
|
962
|
+
* filters. Replaces the old `listSchedules` method — callers use
|
|
963
|
+
* `{blockType: 'schedule'}` to get the same set of blocks.
|
|
964
|
+
*/
|
|
965
|
+
async listInformationBlocks(
|
|
1091
966
|
graphId: string,
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
967
|
+
options?: {
|
|
968
|
+
blockType?: string
|
|
969
|
+
category?: string
|
|
970
|
+
limit?: number
|
|
971
|
+
offset?: number
|
|
972
|
+
}
|
|
973
|
+
): Promise<InformationBlockList> {
|
|
974
|
+
const blocks = await this.gqlQuery(
|
|
1096
975
|
graphId,
|
|
1097
|
-
|
|
976
|
+
ListInformationBlocksDocument,
|
|
1098
977
|
{
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
978
|
+
blockType: options?.blockType ?? null,
|
|
979
|
+
category: options?.category ?? null,
|
|
980
|
+
limit: options?.limit ?? null,
|
|
981
|
+
offset: options?.offset ?? null,
|
|
1102
982
|
},
|
|
1103
|
-
'
|
|
1104
|
-
(data) => data.
|
|
983
|
+
'List information blocks',
|
|
984
|
+
(data) => data.informationBlocks
|
|
1105
985
|
)
|
|
1106
|
-
return
|
|
986
|
+
return blocks ?? []
|
|
1107
987
|
}
|
|
1108
988
|
|
|
989
|
+
// ── Schedules ──────────────────────────────────────────────────────
|
|
990
|
+
|
|
1109
991
|
/** Create a new schedule with pre-generated monthly facts. */
|
|
1110
992
|
async createSchedule(graphId: string, options: CreateScheduleOptions): Promise<ScheduleCreated> {
|
|
1111
|
-
const body:
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
993
|
+
const body: CreateInformationBlockRequest = {
|
|
994
|
+
block_type: 'schedule',
|
|
995
|
+
payload: {
|
|
996
|
+
name: options.name,
|
|
997
|
+
element_ids: options.elementIds,
|
|
998
|
+
period_start: options.periodStart,
|
|
999
|
+
period_end: options.periodEnd,
|
|
1000
|
+
monthly_amount: options.monthlyAmount,
|
|
1001
|
+
entry_template: {
|
|
1002
|
+
debit_element_id: options.entryTemplate.debitElementId,
|
|
1003
|
+
credit_element_id: options.entryTemplate.creditElementId,
|
|
1004
|
+
entry_type: options.entryTemplate.entryType,
|
|
1005
|
+
memo_template: options.entryTemplate.memoTemplate,
|
|
1006
|
+
},
|
|
1007
|
+
taxonomy_id: options.taxonomyId,
|
|
1008
|
+
schedule_metadata: options.scheduleMetadata
|
|
1009
|
+
? {
|
|
1010
|
+
method: options.scheduleMetadata.method,
|
|
1011
|
+
original_amount: options.scheduleMetadata.originalAmount,
|
|
1012
|
+
residual_value: options.scheduleMetadata.residualValue,
|
|
1013
|
+
useful_life_months: options.scheduleMetadata.usefulLifeMonths,
|
|
1014
|
+
asset_element_id: options.scheduleMetadata.assetElementId,
|
|
1015
|
+
}
|
|
1016
|
+
: undefined,
|
|
1122
1017
|
},
|
|
1123
|
-
taxonomy_id: options.taxonomyId,
|
|
1124
|
-
schedule_metadata: options.scheduleMetadata
|
|
1125
|
-
? {
|
|
1126
|
-
method: options.scheduleMetadata.method,
|
|
1127
|
-
original_amount: options.scheduleMetadata.originalAmount,
|
|
1128
|
-
residual_value: options.scheduleMetadata.residualValue,
|
|
1129
|
-
useful_life_months: options.scheduleMetadata.usefulLifeMonths,
|
|
1130
|
-
asset_element_id: options.scheduleMetadata.assetElementId,
|
|
1131
|
-
}
|
|
1132
|
-
: undefined,
|
|
1133
1018
|
}
|
|
1134
1019
|
const envelope = await this.callOperation(
|
|
1135
1020
|
'Create schedule',
|
|
1136
|
-
|
|
1021
|
+
opCreateInformationBlock({ path: { graph_id: graphId }, body })
|
|
1137
1022
|
)
|
|
1138
1023
|
const raw = envelope.result as unknown as RawScheduleCreatedResult
|
|
1139
1024
|
return {
|
|
@@ -1148,21 +1033,29 @@ export class LedgerClient {
|
|
|
1148
1033
|
/** Update mutable fields on a schedule (name, entry_template, metadata). */
|
|
1149
1034
|
async updateSchedule(
|
|
1150
1035
|
graphId: string,
|
|
1151
|
-
|
|
1036
|
+
structureId: string,
|
|
1037
|
+
options: { name?: string }
|
|
1152
1038
|
): Promise<Record<string, unknown>> {
|
|
1039
|
+
const body: UpdateInformationBlockRequest = {
|
|
1040
|
+
block_type: 'schedule',
|
|
1041
|
+
payload: { structure_id: structureId, ...options },
|
|
1042
|
+
}
|
|
1153
1043
|
const envelope = await this.callOperation(
|
|
1154
1044
|
'Update schedule',
|
|
1155
|
-
|
|
1045
|
+
opUpdateInformationBlock({ path: { graph_id: graphId }, body })
|
|
1156
1046
|
)
|
|
1157
1047
|
return (envelope.result ?? {}) as Record<string, unknown>
|
|
1158
1048
|
}
|
|
1159
1049
|
|
|
1160
1050
|
/** Permanently delete a schedule (cascades through facts + associations). */
|
|
1161
1051
|
async deleteSchedule(graphId: string, structureId: string): Promise<{ deleted: boolean }> {
|
|
1162
|
-
const body:
|
|
1052
|
+
const body: DeleteInformationBlockRequest = {
|
|
1053
|
+
block_type: 'schedule',
|
|
1054
|
+
payload: { structure_id: structureId },
|
|
1055
|
+
}
|
|
1163
1056
|
const envelope = await this.callOperation(
|
|
1164
1057
|
'Delete schedule',
|
|
1165
|
-
|
|
1058
|
+
opDeleteInformationBlock({ path: { graph_id: graphId }, body })
|
|
1166
1059
|
)
|
|
1167
1060
|
return (envelope.result ?? { deleted: true }) as { deleted: boolean }
|
|
1168
1061
|
}
|
|
@@ -1191,6 +1084,30 @@ export class LedgerClient {
|
|
|
1191
1084
|
}
|
|
1192
1085
|
}
|
|
1193
1086
|
|
|
1087
|
+
/** Dispose of a schedule asset — post a disposal entry and delete forward facts. */
|
|
1088
|
+
async disposeSchedule(
|
|
1089
|
+
graphId: string,
|
|
1090
|
+
body: DisposeScheduleRequest
|
|
1091
|
+
): Promise<Record<string, unknown>> {
|
|
1092
|
+
const envelope = await this.callOperation(
|
|
1093
|
+
'Dispose schedule',
|
|
1094
|
+
opDisposeSchedule({ path: { graph_id: graphId }, body })
|
|
1095
|
+
)
|
|
1096
|
+
return (envelope.result ?? {}) as Record<string, unknown>
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/** Evaluate taxonomy rules against facts in a structure. */
|
|
1100
|
+
async evaluateRules(
|
|
1101
|
+
graphId: string,
|
|
1102
|
+
body: EvaluateRulesRequest
|
|
1103
|
+
): Promise<Record<string, unknown>> {
|
|
1104
|
+
const envelope = await this.callOperation(
|
|
1105
|
+
'Evaluate rules',
|
|
1106
|
+
opEvaluateRules({ path: { graph_id: graphId }, body })
|
|
1107
|
+
)
|
|
1108
|
+
return (envelope.result ?? {}) as Record<string, unknown>
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1194
1111
|
// ── Period close ────────────────────────────────────────────────────
|
|
1195
1112
|
|
|
1196
1113
|
/** Close status for all schedules in a fiscal period. */
|