@robosystems/client 0.3.9 → 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.
@@ -1,4 +1,4 @@
1
- import type { AutoMapElementsOperation, BulkAssociationItem, CreateElementRequest, CreateMappingAssociationOperation, CreateStructureRequest, CreateTaxonomyRequest, CreateViewRequest, DeleteMappingAssociationOperation, LinkEntityTaxonomyRequest, OperationEnvelope, UpdateAssociationRequest, UpdateElementRequest, UpdateEntityRequest, UpdateJournalEntryRequest, UpdateStructureRequest, UpdateTaxonomyRequest } from '../types.gen';
1
+ import type { AutoMapElementsOperation, CreateMappingAssociationOperation, CreateTaxonomyBlockRequest, CreateViewRequest, DeleteMappingAssociationOperation, DeleteTaxonomyBlockRequest, DisposeScheduleRequest, EvaluateRulesRequest, LinkEntityTaxonomyRequest, OperationEnvelope, UpdateEntityRequest, UpdateJournalEntryRequest, UpdateTaxonomyBlockRequest } from '../types.gen';
2
2
  import type { TokenProvider } from './graphql/client';
3
3
  import { type GetInformationBlockQuery, type GetLedgerAccountRollupsQuery, type GetLedgerAccountTreeQuery, type GetLedgerClosingBookStructuresQuery, type GetLedgerEntityQuery, type GetLedgerFiscalCalendarQuery, type GetLedgerMappedTrialBalanceQuery, type GetLedgerMappingCoverageQuery, type GetLedgerMappingQuery, type GetLedgerPeriodCloseStatusQuery, type GetLedgerPeriodDraftsQuery, type GetLedgerPublishListQuery, type GetLedgerReportingTaxonomyQuery, type GetLedgerReportQuery, type GetLedgerStatementQuery, type GetLedgerSummaryQuery, type GetLedgerTransactionQuery, type GetLedgerTrialBalanceQuery, type ListInformationBlocksQuery, type ListLedgerAccountsQuery, type ListLedgerElementsQuery, type ListLedgerEntitiesQuery, type ListLedgerMappingsQuery, type ListLedgerPublishListsQuery, type ListLedgerReportsQuery, type ListLedgerStructuresQuery, type ListLedgerTaxonomiesQuery, type ListLedgerTransactionsQuery, type ListLedgerUnmappedElementsQuery } from './graphql/generated/graphql';
4
4
  export type LedgerEntity = NonNullable<GetLedgerEntityQuery['entity']>;
@@ -268,17 +268,22 @@ export declare class LedgerClient {
268
268
  listTaxonomies(graphId: string, options?: {
269
269
  taxonomyType?: string;
270
270
  }): Promise<LedgerTaxonomy[]>;
271
- /** Create a new taxonomy (used for CoA + mapping taxonomies). */
272
- createTaxonomy(graphId: string, body: CreateTaxonomyRequest): Promise<Record<string, unknown>>;
273
- /** Update mutable fields on a taxonomy. `taxonomy_type` is immutable. */
274
- updateTaxonomy(graphId: string, body: UpdateTaxonomyRequest): Promise<Record<string, unknown>>;
275
- /** Soft-delete a taxonomy (`is_active=false`). */
276
- deleteTaxonomy(graphId: string, taxonomyId: string): Promise<Record<string, unknown>>;
277
271
  /**
278
272
  * Link the graph's entity to a taxonomy (ENTITY_HAS_TAXONOMY edge).
279
273
  * Idempotent — returns existing linkage if already present.
280
274
  */
281
275
  linkEntityTaxonomy(graphId: string, body: LinkEntityTaxonomyRequest): Promise<Record<string, unknown>>;
276
+ /**
277
+ * Create a taxonomy block atomically (taxonomy + structures + elements +
278
+ * associations + rules in one envelope).
279
+ */
280
+ createTaxonomyBlock(graphId: string, body: CreateTaxonomyBlockRequest, idempotencyKey?: string): Promise<Record<string, unknown>>;
281
+ /** Update a taxonomy block — add/update/remove elements, structures, associations, or rules. */
282
+ updateTaxonomyBlock(graphId: string, body: UpdateTaxonomyBlockRequest): Promise<Record<string, unknown>>;
283
+ /** Delete a taxonomy block. Cascades through elements, structures, and associations. */
284
+ deleteTaxonomyBlock(graphId: string, body: DeleteTaxonomyBlockRequest): Promise<{
285
+ deleted: boolean;
286
+ }>;
282
287
  /** List elements (CoA accounts, GAAP concepts, etc.) with filters. */
283
288
  listElements(graphId: string, options?: {
284
289
  taxonomyId?: string;
@@ -292,32 +297,11 @@ export declare class LedgerClient {
292
297
  listUnmappedElements(graphId: string, options?: {
293
298
  mappingId?: string;
294
299
  }): Promise<LedgerUnmappedElement[]>;
295
- /** Create a new element within a taxonomy (native CoA account, etc.). */
296
- createElement(graphId: string, body: CreateElementRequest): Promise<Record<string, unknown>>;
297
- /** Update mutable fields on an element. `taxonomy_id` and `source` are immutable. */
298
- updateElement(graphId: string, body: UpdateElementRequest): Promise<Record<string, unknown>>;
299
- /** Soft-delete an element (`is_active=false`). */
300
- deleteElement(graphId: string, elementId: string): Promise<Record<string, unknown>>;
301
300
  /** List reporting structures (IS, BS, CF, schedules) with optional filters. */
302
301
  listStructures(graphId: string, options?: {
303
302
  taxonomyId?: string;
304
303
  structureType?: string;
305
304
  }): Promise<LedgerStructure[]>;
306
- /**
307
- * Create a new structure. Most common use is a CoA→reporting mapping
308
- * structure; also used for custom statement + schedule structures.
309
- */
310
- createStructure(graphId: string, body: CreateStructureRequest): Promise<LedgerMappingInfo>;
311
- /** Convenience wrapper — create a CoA→GAAP mapping structure. */
312
- createMappingStructure(graphId: string, options?: {
313
- name?: string;
314
- description?: string | null;
315
- taxonomyId?: string;
316
- }): Promise<LedgerMappingInfo>;
317
- /** Update mutable fields on a structure. `structure_type` is immutable. */
318
- updateStructure(graphId: string, body: UpdateStructureRequest): Promise<Record<string, unknown>>;
319
- /** Soft-delete a structure (`is_active=false`). */
320
- deleteStructure(graphId: string, structureId: string): Promise<Record<string, unknown>>;
321
305
  /** List active CoA→reporting mapping structures. */
322
306
  listMappings(graphId: string): Promise<LedgerMappingInfo[]>;
323
307
  /** Get a mapping structure with all its associations. */
@@ -339,14 +323,6 @@ export declare class LedgerClient {
339
323
  operationId: string;
340
324
  status: OperationEnvelope['status'];
341
325
  }>;
342
- /** Bulk create associations within a single structure, atomically. */
343
- createAssociations(graphId: string, structureId: string, associations: BulkAssociationItem[]): Promise<Record<string, unknown>>;
344
- /** Update mutable fields on an association (order, weight, confidence). */
345
- updateAssociation(graphId: string, body: UpdateAssociationRequest): Promise<Record<string, unknown>>;
346
- /** Hard-delete an association (any type: presentation, calculation, mapping). */
347
- deleteAssociation(graphId: string, associationId: string): Promise<{
348
- deleted: boolean;
349
- }>;
350
326
  /**
351
327
  * Fetch an Information Block envelope by id — the generic
352
328
  * cross-block-type read. Returns `null` when the block doesn't exist
@@ -376,6 +352,10 @@ export declare class LedgerClient {
376
352
  }>;
377
353
  /** Truncate a schedule — end it early at `newEndDate`. */
378
354
  truncateSchedule(graphId: string, structureId: string, options: TruncateScheduleOptions): Promise<TruncateScheduleResult>;
355
+ /** Dispose of a schedule asset — post a disposal entry and delete forward facts. */
356
+ disposeSchedule(graphId: string, body: DisposeScheduleRequest): Promise<Record<string, unknown>>;
357
+ /** Evaluate taxonomy rules against facts in a structure. */
358
+ evaluateRules(graphId: string, body: EvaluateRulesRequest): Promise<Record<string, unknown>>;
379
359
  /** Close status for all schedules in a fiscal period. */
380
360
  getPeriodCloseStatus(graphId: string, periodStart: string, periodEnd: string): Promise<LedgerPeriodCloseStatus | null>;
381
361
  /** All draft entries in a period, fully expanded for review pre-close. */
@@ -132,22 +132,6 @@ class LedgerClient {
132
132
  const list = await this.gqlQuery(graphId, graphql_1.ListLedgerTaxonomiesDocument, { taxonomyType: options?.taxonomyType ?? null }, 'List taxonomies', (data) => data.taxonomies);
133
133
  return list?.taxonomies ?? [];
134
134
  }
135
- /** Create a new taxonomy (used for CoA + mapping taxonomies). */
136
- async createTaxonomy(graphId, body) {
137
- const envelope = await this.callOperation('Create taxonomy', (0, sdk_gen_1.opCreateTaxonomy)({ path: { graph_id: graphId }, body }));
138
- return (envelope.result ?? {});
139
- }
140
- /** Update mutable fields on a taxonomy. `taxonomy_type` is immutable. */
141
- async updateTaxonomy(graphId, body) {
142
- const envelope = await this.callOperation('Update taxonomy', (0, sdk_gen_1.opUpdateTaxonomy)({ path: { graph_id: graphId }, body }));
143
- return (envelope.result ?? {});
144
- }
145
- /** Soft-delete a taxonomy (`is_active=false`). */
146
- async deleteTaxonomy(graphId, taxonomyId) {
147
- const body = { taxonomy_id: taxonomyId };
148
- const envelope = await this.callOperation('Delete taxonomy', (0, sdk_gen_1.opDeleteTaxonomy)({ path: { graph_id: graphId }, body }));
149
- return (envelope.result ?? {});
150
- }
151
135
  /**
152
136
  * Link the graph's entity to a taxonomy (ENTITY_HAS_TAXONOMY edge).
153
137
  * Idempotent — returns existing linkage if already present.
@@ -156,6 +140,25 @@ class LedgerClient {
156
140
  const envelope = await this.callOperation('Link entity taxonomy', (0, sdk_gen_1.opLinkEntityTaxonomy)({ path: { graph_id: graphId }, body }));
157
141
  return (envelope.result ?? {});
158
142
  }
143
+ /**
144
+ * Create a taxonomy block atomically (taxonomy + structures + elements +
145
+ * associations + rules in one envelope).
146
+ */
147
+ async createTaxonomyBlock(graphId, body, idempotencyKey) {
148
+ const headers = idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : undefined;
149
+ const envelope = await this.callOperation('Create taxonomy block', (0, sdk_gen_1.opCreateTaxonomyBlock)({ path: { graph_id: graphId }, body, headers }));
150
+ return (envelope.result ?? {});
151
+ }
152
+ /** Update a taxonomy block — add/update/remove elements, structures, associations, or rules. */
153
+ async updateTaxonomyBlock(graphId, body) {
154
+ const envelope = await this.callOperation('Update taxonomy block', (0, sdk_gen_1.opUpdateTaxonomyBlock)({ path: { graph_id: graphId }, body }));
155
+ return (envelope.result ?? {});
156
+ }
157
+ /** Delete a taxonomy block. Cascades through elements, structures, and associations. */
158
+ async deleteTaxonomyBlock(graphId, body) {
159
+ const envelope = await this.callOperation('Delete taxonomy block', (0, sdk_gen_1.opDeleteTaxonomyBlock)({ path: { graph_id: graphId }, body }));
160
+ return (envelope.result ?? { deleted: true });
161
+ }
159
162
  /** List elements (CoA accounts, GAAP concepts, etc.) with filters. */
160
163
  async listElements(graphId, options) {
161
164
  return this.gqlQuery(graphId, graphql_1.ListLedgerElementsDocument, {
@@ -171,22 +174,6 @@ class LedgerClient {
171
174
  async listUnmappedElements(graphId, options) {
172
175
  return this.gqlQuery(graphId, graphql_1.ListLedgerUnmappedElementsDocument, { mappingId: options?.mappingId ?? null }, 'List unmapped elements', (data) => data.unmappedElements);
173
176
  }
174
- /** Create a new element within a taxonomy (native CoA account, etc.). */
175
- async createElement(graphId, body) {
176
- const envelope = await this.callOperation('Create element', (0, sdk_gen_1.opCreateElement)({ path: { graph_id: graphId }, body }));
177
- return (envelope.result ?? {});
178
- }
179
- /** Update mutable fields on an element. `taxonomy_id` and `source` are immutable. */
180
- async updateElement(graphId, body) {
181
- const envelope = await this.callOperation('Update element', (0, sdk_gen_1.opUpdateElement)({ path: { graph_id: graphId }, body }));
182
- return (envelope.result ?? {});
183
- }
184
- /** Soft-delete an element (`is_active=false`). */
185
- async deleteElement(graphId, elementId) {
186
- const body = { element_id: elementId };
187
- const envelope = await this.callOperation('Delete element', (0, sdk_gen_1.opDeleteElement)({ path: { graph_id: graphId }, body }));
188
- return (envelope.result ?? {});
189
- }
190
177
  // ── Structures ──────────────────────────────────────────────────────
191
178
  /** List reporting structures (IS, BS, CF, schedules) with optional filters. */
192
179
  async listStructures(graphId, options) {
@@ -196,36 +183,6 @@ class LedgerClient {
196
183
  }, 'List structures', (data) => data.structures);
197
184
  return list?.structures ?? [];
198
185
  }
199
- /**
200
- * Create a new structure. Most common use is a CoA→reporting mapping
201
- * structure; also used for custom statement + schedule structures.
202
- */
203
- async createStructure(graphId, body) {
204
- const envelope = await this.callOperation('Create structure', (0, sdk_gen_1.opCreateStructure)({ path: { graph_id: graphId }, body }));
205
- return envelope.result;
206
- }
207
- /** Convenience wrapper — create a CoA→GAAP mapping structure. */
208
- async createMappingStructure(graphId, options) {
209
- const body = {
210
- name: options?.name ?? 'CoA to Reporting',
211
- structure_type: 'coa_mapping',
212
- taxonomy_id: options?.taxonomyId ?? 'tax_usgaap_reporting',
213
- description: options?.description ?? 'Map Chart of Accounts to US GAAP reporting concepts',
214
- };
215
- const envelope = await this.callOperation('Create mapping structure', (0, sdk_gen_1.opCreateStructure)({ path: { graph_id: graphId }, body }));
216
- return envelope.result;
217
- }
218
- /** Update mutable fields on a structure. `structure_type` is immutable. */
219
- async updateStructure(graphId, body) {
220
- const envelope = await this.callOperation('Update structure', (0, sdk_gen_1.opUpdateStructure)({ path: { graph_id: graphId }, body }));
221
- return (envelope.result ?? {});
222
- }
223
- /** Soft-delete a structure (`is_active=false`). */
224
- async deleteStructure(graphId, structureId) {
225
- const body = { structure_id: structureId };
226
- const envelope = await this.callOperation('Delete structure', (0, sdk_gen_1.opDeleteStructure)({ path: { graph_id: graphId }, body }));
227
- return (envelope.result ?? {});
228
- }
229
186
  // ── Mappings ────────────────────────────────────────────────────────
230
187
  /** List active CoA→reporting mapping structures. */
231
188
  async listMappings(graphId) {
@@ -259,23 +216,6 @@ class LedgerClient {
259
216
  const envelope = await this.callOperation('Auto-map elements', (0, sdk_gen_1.opAutoMapElements)({ path: { graph_id: graphId }, body }));
260
217
  return { operationId: envelope.operationId, status: envelope.status };
261
218
  }
262
- /** Bulk create associations within a single structure, atomically. */
263
- async createAssociations(graphId, structureId, associations) {
264
- const body = { structure_id: structureId, associations };
265
- const envelope = await this.callOperation('Create associations', (0, sdk_gen_1.opCreateAssociations)({ path: { graph_id: graphId }, body }));
266
- return (envelope.result ?? {});
267
- }
268
- /** Update mutable fields on an association (order, weight, confidence). */
269
- async updateAssociation(graphId, body) {
270
- const envelope = await this.callOperation('Update association', (0, sdk_gen_1.opUpdateAssociation)({ path: { graph_id: graphId }, body }));
271
- return (envelope.result ?? {});
272
- }
273
- /** Hard-delete an association (any type: presentation, calculation, mapping). */
274
- async deleteAssociation(graphId, associationId) {
275
- const body = { association_id: associationId };
276
- const envelope = await this.callOperation('Delete association', (0, sdk_gen_1.opDeleteAssociation)({ path: { graph_id: graphId }, body }));
277
- return (envelope.result ?? { deleted: true });
278
- }
279
219
  // ── Information Blocks ─────────────────────────────────────────────
280
220
  /**
281
221
  * Fetch an Information Block envelope by id — the generic
@@ -373,6 +313,16 @@ class LedgerClient {
373
313
  reason: raw.reason,
374
314
  };
375
315
  }
316
+ /** Dispose of a schedule asset — post a disposal entry and delete forward facts. */
317
+ async disposeSchedule(graphId, body) {
318
+ const envelope = await this.callOperation('Dispose schedule', (0, sdk_gen_1.opDisposeSchedule)({ path: { graph_id: graphId }, body }));
319
+ return (envelope.result ?? {});
320
+ }
321
+ /** Evaluate taxonomy rules against facts in a structure. */
322
+ async evaluateRules(graphId, body) {
323
+ const envelope = await this.callOperation('Evaluate rules', (0, sdk_gen_1.opEvaluateRules)({ path: { graph_id: graphId }, body }));
324
+ return (envelope.result ?? {});
325
+ }
376
326
  // ── Period close ────────────────────────────────────────────────────
377
327
  /** Close status for all schedules in a fiscal period. */
378
328
  async getPeriodCloseStatus(graphId, periodStart, periodEnd) {
@@ -29,27 +29,23 @@ import {
29
29
  opAutoMapElements,
30
30
  opBuildFactGrid,
31
31
  opClosePeriod,
32
- opCreateAssociations,
33
32
  opCreateClosingEntry,
34
- opCreateElement,
35
33
  opCreateInformationBlock,
36
34
  opCreateJournalEntry,
37
35
  opCreateManualClosingEntry,
38
36
  opCreateMappingAssociation,
39
37
  opCreatePublishList,
40
38
  opCreateReport,
41
- opCreateStructure,
42
- opCreateTaxonomy,
39
+ opCreateTaxonomyBlock,
43
40
  opCreateTransaction,
44
- opDeleteAssociation,
45
- opDeleteElement,
46
41
  opDeleteInformationBlock,
47
42
  opDeleteJournalEntry,
48
43
  opDeleteMappingAssociation,
49
44
  opDeletePublishList,
50
45
  opDeleteReport,
51
- opDeleteStructure,
52
- opDeleteTaxonomy,
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,
65
59
  opUpdateInformationBlock,
66
60
  opUpdateJournalEntry,
67
61
  opUpdatePublishList,
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
- CreateElementRequest,
79
69
  CreateInformationBlockRequest,
80
70
  CreateJournalEntryRequest,
81
71
  CreateManualClosingEntryRequest,
82
72
  CreateMappingAssociationOperation,
83
73
  CreatePublishListRequest,
84
74
  CreateReportRequest,
85
- CreateStructureRequest,
86
- CreateTaxonomyRequest,
75
+ CreateTaxonomyBlockRequest,
87
76
  CreateTransactionRequest,
88
77
  CreateViewRequest,
89
- DeleteAssociationRequest,
90
- DeleteElementRequest,
91
78
  DeleteInformationBlockRequest,
92
79
  DeleteJournalEntryRequest,
93
80
  DeleteMappingAssociationOperation,
94
- DeleteStructureRequest,
95
- DeleteTaxonomyRequest,
81
+ DeleteTaxonomyBlockRequest,
82
+ DisposeScheduleRequest,
83
+ EvaluateRulesRequest,
96
84
  InitializeLedgerRequest,
97
85
  JournalEntryLineItemInput,
98
86
  LinkEntityTaxonomyRequest,
@@ -101,14 +89,11 @@ import type {
101
89
  ReverseJournalEntryRequest,
102
90
  SetCloseTargetOperation,
103
91
  TruncateScheduleOperation,
104
- UpdateAssociationRequest,
105
- UpdateElementRequest,
106
92
  UpdateEntityRequest,
107
93
  UpdateInformationBlockRequest,
108
94
  UpdateJournalEntryRequest,
109
95
  UpdatePublishListOperation,
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'
@@ -757,53 +742,60 @@ export class LedgerClient {
757
742
  return list?.taxonomies ?? []
758
743
  }
759
744
 
760
- /** Create a new taxonomy (used for CoA + mapping taxonomies). */
761
- async createTaxonomy(
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(
762
750
  graphId: string,
763
- body: CreateTaxonomyRequest
751
+ body: LinkEntityTaxonomyRequest
764
752
  ): Promise<Record<string, unknown>> {
765
753
  const envelope = await this.callOperation(
766
- 'Create taxonomy',
767
- opCreateTaxonomy({ path: { graph_id: graphId }, body })
754
+ 'Link entity taxonomy',
755
+ opLinkEntityTaxonomy({ path: { graph_id: graphId }, body })
768
756
  )
769
757
  return (envelope.result ?? {}) as Record<string, unknown>
770
758
  }
771
759
 
772
- /** Update mutable fields on a taxonomy. `taxonomy_type` is immutable. */
773
- async updateTaxonomy(
760
+ /**
761
+ * Create a taxonomy block atomically (taxonomy + structures + elements +
762
+ * associations + rules in one envelope).
763
+ */
764
+ async createTaxonomyBlock(
774
765
  graphId: string,
775
- body: UpdateTaxonomyRequest
766
+ body: CreateTaxonomyBlockRequest,
767
+ idempotencyKey?: string
776
768
  ): Promise<Record<string, unknown>> {
769
+ const headers = idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : undefined
777
770
  const envelope = await this.callOperation(
778
- 'Update taxonomy',
779
- opUpdateTaxonomy({ path: { graph_id: graphId }, body })
771
+ 'Create taxonomy block',
772
+ opCreateTaxonomyBlock({ path: { graph_id: graphId }, body, headers })
780
773
  )
781
774
  return (envelope.result ?? {}) as Record<string, unknown>
782
775
  }
783
776
 
784
- /** Soft-delete a taxonomy (`is_active=false`). */
785
- async deleteTaxonomy(graphId: string, taxonomyId: string): Promise<Record<string, unknown>> {
786
- const body: DeleteTaxonomyRequest = { taxonomy_id: taxonomyId }
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>> {
787
782
  const envelope = await this.callOperation(
788
- 'Delete taxonomy',
789
- opDeleteTaxonomy({ path: { graph_id: graphId }, body })
783
+ 'Update taxonomy block',
784
+ opUpdateTaxonomyBlock({ path: { graph_id: graphId }, body })
790
785
  )
791
786
  return (envelope.result ?? {}) as Record<string, unknown>
792
787
  }
793
788
 
794
- /**
795
- * Link the graph's entity to a taxonomy (ENTITY_HAS_TAXONOMY edge).
796
- * Idempotent — returns existing linkage if already present.
797
- */
798
- async linkEntityTaxonomy(
789
+ /** Delete a taxonomy block. Cascades through elements, structures, and associations. */
790
+ async deleteTaxonomyBlock(
799
791
  graphId: string,
800
- body: LinkEntityTaxonomyRequest
801
- ): Promise<Record<string, unknown>> {
792
+ body: DeleteTaxonomyBlockRequest
793
+ ): Promise<{ deleted: boolean }> {
802
794
  const envelope = await this.callOperation(
803
- 'Link entity taxonomy',
804
- opLinkEntityTaxonomy({ path: { graph_id: graphId }, body })
795
+ 'Delete taxonomy block',
796
+ opDeleteTaxonomyBlock({ path: { graph_id: graphId }, body })
805
797
  )
806
- return (envelope.result ?? {}) as Record<string, unknown>
798
+ return (envelope.result ?? { deleted: true }) as { deleted: boolean }
807
799
  }
808
800
 
809
801
  /** List elements (CoA accounts, GAAP concepts, etc.) with filters. */
@@ -848,40 +840,6 @@ export class LedgerClient {
848
840
  )
849
841
  }
850
842
 
851
- /** Create a new element within a taxonomy (native CoA account, etc.). */
852
- async createElement(
853
- graphId: string,
854
- body: CreateElementRequest
855
- ): Promise<Record<string, unknown>> {
856
- const envelope = await this.callOperation(
857
- 'Create element',
858
- opCreateElement({ path: { graph_id: graphId }, body })
859
- )
860
- return (envelope.result ?? {}) as Record<string, unknown>
861
- }
862
-
863
- /** Update mutable fields on an element. `taxonomy_id` and `source` are immutable. */
864
- async updateElement(
865
- graphId: string,
866
- body: UpdateElementRequest
867
- ): Promise<Record<string, unknown>> {
868
- const envelope = await this.callOperation(
869
- 'Update element',
870
- opUpdateElement({ path: { graph_id: graphId }, body })
871
- )
872
- return (envelope.result ?? {}) as Record<string, unknown>
873
- }
874
-
875
- /** Soft-delete an element (`is_active=false`). */
876
- async deleteElement(graphId: string, elementId: string): Promise<Record<string, unknown>> {
877
- const body: DeleteElementRequest = { element_id: elementId }
878
- const envelope = await this.callOperation(
879
- 'Delete element',
880
- opDeleteElement({ path: { graph_id: graphId }, body })
881
- )
882
- return (envelope.result ?? {}) as Record<string, unknown>
883
- }
884
-
885
843
  // ── Structures ──────────────────────────────────────────────────────
886
844
 
887
845
  /** List reporting structures (IS, BS, CF, schedules) with optional filters. */
@@ -902,62 +860,6 @@ export class LedgerClient {
902
860
  return list?.structures ?? []
903
861
  }
904
862
 
905
- /**
906
- * Create a new structure. Most common use is a CoA→reporting mapping
907
- * structure; also used for custom statement + schedule structures.
908
- */
909
- async createStructure(graphId: string, body: CreateStructureRequest): Promise<LedgerMappingInfo> {
910
- const envelope = await this.callOperation(
911
- 'Create structure',
912
- opCreateStructure({ path: { graph_id: graphId }, body })
913
- )
914
- return envelope.result as unknown as LedgerMappingInfo
915
- }
916
-
917
- /** Convenience wrapper — create a CoA→GAAP mapping structure. */
918
- async createMappingStructure(
919
- graphId: string,
920
- options?: {
921
- name?: string
922
- description?: string | null
923
- taxonomyId?: string
924
- }
925
- ): Promise<LedgerMappingInfo> {
926
- const body: CreateStructureRequest = {
927
- name: options?.name ?? 'CoA to Reporting',
928
- structure_type: 'coa_mapping',
929
- taxonomy_id: options?.taxonomyId ?? 'tax_usgaap_reporting',
930
- description: options?.description ?? 'Map Chart of Accounts to US GAAP reporting concepts',
931
- }
932
- const envelope = await this.callOperation(
933
- 'Create mapping structure',
934
- opCreateStructure({ path: { graph_id: graphId }, body })
935
- )
936
- return envelope.result as unknown as LedgerMappingInfo
937
- }
938
-
939
- /** Update mutable fields on a structure. `structure_type` is immutable. */
940
- async updateStructure(
941
- graphId: string,
942
- body: UpdateStructureRequest
943
- ): Promise<Record<string, unknown>> {
944
- const envelope = await this.callOperation(
945
- 'Update structure',
946
- opUpdateStructure({ path: { graph_id: graphId }, body })
947
- )
948
- return (envelope.result ?? {}) as Record<string, unknown>
949
- }
950
-
951
- /** Soft-delete a structure (`is_active=false`). */
952
- async deleteStructure(graphId: string, structureId: string): Promise<Record<string, unknown>> {
953
- const body: DeleteStructureRequest = { structure_id: structureId }
954
- const envelope = await this.callOperation(
955
- 'Delete structure',
956
- opDeleteStructure({ path: { graph_id: graphId }, body })
957
- )
958
- return (envelope.result ?? {}) as Record<string, unknown>
959
- }
960
-
961
863
  // ── Mappings ────────────────────────────────────────────────────────
962
864
 
963
865
  /** List active CoA→reporting mapping structures. */
@@ -1037,42 +939,6 @@ export class LedgerClient {
1037
939
  return { operationId: envelope.operationId, status: envelope.status }
1038
940
  }
1039
941
 
1040
- /** Bulk create associations within a single structure, atomically. */
1041
- async createAssociations(
1042
- graphId: string,
1043
- structureId: string,
1044
- associations: BulkAssociationItem[]
1045
- ): Promise<Record<string, unknown>> {
1046
- const body: BulkCreateAssociationsRequest = { structure_id: structureId, associations }
1047
- const envelope = await this.callOperation(
1048
- 'Create associations',
1049
- opCreateAssociations({ path: { graph_id: graphId }, body })
1050
- )
1051
- return (envelope.result ?? {}) as Record<string, unknown>
1052
- }
1053
-
1054
- /** Update mutable fields on an association (order, weight, confidence). */
1055
- async updateAssociation(
1056
- graphId: string,
1057
- body: UpdateAssociationRequest
1058
- ): Promise<Record<string, unknown>> {
1059
- const envelope = await this.callOperation(
1060
- 'Update association',
1061
- opUpdateAssociation({ path: { graph_id: graphId }, body })
1062
- )
1063
- return (envelope.result ?? {}) as Record<string, unknown>
1064
- }
1065
-
1066
- /** Hard-delete an association (any type: presentation, calculation, mapping). */
1067
- async deleteAssociation(graphId: string, associationId: string): Promise<{ deleted: boolean }> {
1068
- const body: DeleteAssociationRequest = { association_id: associationId }
1069
- const envelope = await this.callOperation(
1070
- 'Delete association',
1071
- opDeleteAssociation({ path: { graph_id: graphId }, body })
1072
- )
1073
- return (envelope.result ?? { deleted: true }) as { deleted: boolean }
1074
- }
1075
-
1076
942
  // ── Information Blocks ─────────────────────────────────────────────
1077
943
 
1078
944
  /**
@@ -1218,6 +1084,30 @@ export class LedgerClient {
1218
1084
  }
1219
1085
  }
1220
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
+
1221
1111
  // ── Period close ────────────────────────────────────────────────────
1222
1112
 
1223
1113
  /** Close status for all schedules in a fiscal period. */