@robosystems/client 0.3.7 → 0.3.9

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 (45) hide show
  1. package/artifacts/LedgerClient.d.ts +27 -14
  2. package/artifacts/LedgerClient.js +59 -39
  3. package/artifacts/LedgerClient.ts +89 -62
  4. package/artifacts/LibraryClient.d.ts +117 -0
  5. package/artifacts/LibraryClient.js +132 -0
  6. package/artifacts/LibraryClient.ts +358 -0
  7. package/artifacts/graphql/generated/graphql.d.ts +686 -79
  8. package/artifacts/graphql/generated/graphql.js +1121 -135
  9. package/artifacts/graphql/generated/graphql.ts +1887 -281
  10. package/artifacts/graphql/queries/ledger/informationBlock.d.ts +15 -0
  11. package/artifacts/graphql/queries/ledger/informationBlock.js +125 -0
  12. package/artifacts/graphql/queries/ledger/informationBlock.ts +124 -0
  13. package/artifacts/graphql/queries/library/arcs.d.ts +24 -0
  14. package/artifacts/graphql/queries/library/arcs.js +106 -0
  15. package/artifacts/graphql/queries/library/arcs.ts +107 -0
  16. package/artifacts/graphql/queries/library/elements.d.ts +24 -0
  17. package/artifacts/graphql/queries/library/elements.js +134 -0
  18. package/artifacts/graphql/queries/library/elements.ts +134 -0
  19. package/artifacts/graphql/queries/library/taxonomies.d.ts +15 -0
  20. package/artifacts/graphql/queries/library/taxonomies.js +61 -0
  21. package/artifacts/graphql/queries/library/taxonomies.ts +60 -0
  22. package/artifacts/index.d.ts +5 -1
  23. package/artifacts/index.js +17 -1
  24. package/artifacts/index.ts +26 -1
  25. package/index.ts +2 -2
  26. package/package.json +7 -1
  27. package/sdk/index.d.ts +2 -2
  28. package/sdk/index.js +9 -7
  29. package/sdk/index.ts +2 -2
  30. package/sdk/sdk.gen.d.ts +80 -62
  31. package/sdk/sdk.gen.js +158 -122
  32. package/sdk/sdk.gen.ts +154 -118
  33. package/sdk/types.gen.d.ts +801 -623
  34. package/sdk/types.gen.ts +825 -638
  35. package/sdk.gen.d.ts +80 -62
  36. package/sdk.gen.js +158 -122
  37. package/sdk.gen.ts +154 -118
  38. package/types.gen.d.ts +801 -623
  39. package/types.gen.ts +825 -638
  40. package/artifacts/graphql/queries/ledger/scheduleFacts.d.ts +0 -7
  41. package/artifacts/graphql/queries/ledger/scheduleFacts.js +0 -24
  42. package/artifacts/graphql/queries/ledger/scheduleFacts.ts +0 -22
  43. package/artifacts/graphql/queries/ledger/schedules.d.ts +0 -6
  44. package/artifacts/graphql/queries/ledger/schedules.js +0 -24
  45. package/artifacts/graphql/queries/ledger/schedules.ts +0 -22
@@ -1,6 +1,6 @@
1
- import type { AutoMapElementsOperation, BulkAssociationItem, CreateElementRequest, CreateMappingAssociationOperation, CreateStructureRequest, CreateTaxonomyRequest, CreateViewRequest, DeleteMappingAssociationOperation, LinkEntityTaxonomyRequest, OperationEnvelope, UpdateAssociationRequest, UpdateElementRequest, UpdateEntityRequest, UpdateJournalEntryRequest, UpdateScheduleRequest, UpdateStructureRequest, UpdateTaxonomyRequest } from '../types.gen';
1
+ import type { AutoMapElementsOperation, BulkAssociationItem, CreateElementRequest, CreateMappingAssociationOperation, CreateStructureRequest, CreateTaxonomyRequest, CreateViewRequest, DeleteMappingAssociationOperation, LinkEntityTaxonomyRequest, OperationEnvelope, UpdateAssociationRequest, UpdateElementRequest, UpdateEntityRequest, UpdateJournalEntryRequest, UpdateStructureRequest, UpdateTaxonomyRequest } from '../types.gen';
2
2
  import type { TokenProvider } from './graphql/client';
3
- import { 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 GetLedgerScheduleFactsQuery, type GetLedgerStatementQuery, type GetLedgerSummaryQuery, type GetLedgerTransactionQuery, type GetLedgerTrialBalanceQuery, type ListLedgerAccountsQuery, type ListLedgerElementsQuery, type ListLedgerEntitiesQuery, type ListLedgerMappingsQuery, type ListLedgerPublishListsQuery, type ListLedgerReportsQuery, type ListLedgerSchedulesQuery, type ListLedgerStructuresQuery, type ListLedgerTaxonomiesQuery, type ListLedgerTransactionsQuery, type ListLedgerUnmappedElementsQuery } from './graphql/generated/graphql';
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']>;
5
5
  export type LedgerEntitySummary = ListLedgerEntitiesQuery['entities'][number];
6
6
  export type LedgerSummary = NonNullable<GetLedgerSummaryQuery['summary']>;
@@ -25,10 +25,11 @@ export type LedgerMappingList = NonNullable<ListLedgerMappingsQuery['mappings']>
25
25
  export type LedgerMappingInfo = LedgerMappingList['structures'][number];
26
26
  export type LedgerMapping = NonNullable<GetLedgerMappingQuery['mapping']>;
27
27
  export type LedgerMappingCoverage = NonNullable<GetLedgerMappingCoverageQuery['mappingCoverage']>;
28
- export type LedgerScheduleList = NonNullable<ListLedgerSchedulesQuery['schedules']>;
29
- export type LedgerSchedule = LedgerScheduleList['schedules'][number];
30
- export type LedgerScheduleFacts = NonNullable<GetLedgerScheduleFactsQuery['scheduleFacts']>;
31
- export type LedgerScheduleFact = LedgerScheduleFacts['facts'][number];
28
+ export type InformationBlock = NonNullable<GetInformationBlockQuery['informationBlock']>;
29
+ export type InformationBlockList = ListInformationBlocksQuery['informationBlocks'];
30
+ export type InformationBlockElement = InformationBlock['elements'][number];
31
+ export type InformationBlockConnection = InformationBlock['connections'][number];
32
+ export type InformationBlockFact = InformationBlock['facts'][number];
32
33
  export type LedgerPeriodCloseStatus = NonNullable<GetLedgerPeriodCloseStatusQuery['periodCloseStatus']>;
33
34
  export type LedgerPeriodCloseItem = LedgerPeriodCloseStatus['schedules'][number];
34
35
  export type LedgerPeriodDrafts = NonNullable<GetLedgerPeriodDraftsQuery['periodDrafts']>;
@@ -346,17 +347,29 @@ export declare class LedgerClient {
346
347
  deleteAssociation(graphId: string, associationId: string): Promise<{
347
348
  deleted: boolean;
348
349
  }>;
349
- /** List all schedule structures with metadata. */
350
- listSchedules(graphId: string): Promise<LedgerSchedule[]>;
351
- /** Schedule facts optionally filtered by period window. */
352
- getScheduleFacts(graphId: string, structureId: string, options?: {
353
- periodStart?: string;
354
- periodEnd?: string;
355
- }): Promise<LedgerScheduleFact[]>;
350
+ /**
351
+ * Fetch an Information Block envelope by id — the generic
352
+ * cross-block-type read. Returns `null` when the block doesn't exist
353
+ * (or its type isn't registered). See `information-block.md`.
354
+ */
355
+ getInformationBlock(graphId: string, id: string): Promise<InformationBlock | null>;
356
+ /**
357
+ * List Information Block envelopes with optional block_type + category
358
+ * filters. Replaces the old `listSchedules` method — callers use
359
+ * `{blockType: 'schedule'}` to get the same set of blocks.
360
+ */
361
+ listInformationBlocks(graphId: string, options?: {
362
+ blockType?: string;
363
+ category?: string;
364
+ limit?: number;
365
+ offset?: number;
366
+ }): Promise<InformationBlockList>;
356
367
  /** Create a new schedule with pre-generated monthly facts. */
357
368
  createSchedule(graphId: string, options: CreateScheduleOptions): Promise<ScheduleCreated>;
358
369
  /** Update mutable fields on a schedule (name, entry_template, metadata). */
359
- updateSchedule(graphId: string, body: UpdateScheduleRequest): Promise<Record<string, unknown>>;
370
+ updateSchedule(graphId: string, structureId: string, options: {
371
+ name?: string;
372
+ }): Promise<Record<string, unknown>>;
360
373
  /** Permanently delete a schedule (cascades through facts + associations). */
361
374
  deleteSchedule(graphId: string, structureId: string): Promise<{
362
375
  deleted: boolean;
@@ -276,47 +276,60 @@ class LedgerClient {
276
276
  const envelope = await this.callOperation('Delete association', (0, sdk_gen_1.opDeleteAssociation)({ path: { graph_id: graphId }, body }));
277
277
  return (envelope.result ?? { deleted: true });
278
278
  }
279
- // ── Schedules ──────────────────────────────────────────────────────
280
- /** List all schedule structures with metadata. */
281
- async listSchedules(graphId) {
282
- const list = await this.gqlQuery(graphId, graphql_1.ListLedgerSchedulesDocument, undefined, 'List schedules', (data) => data.schedules);
283
- return list?.schedules ?? [];
284
- }
285
- /** Schedule facts optionally filtered by period window. */
286
- async getScheduleFacts(graphId, structureId, options) {
287
- const facts = await this.gqlQuery(graphId, graphql_1.GetLedgerScheduleFactsDocument, {
288
- structureId,
289
- periodStart: options?.periodStart ?? null,
290
- periodEnd: options?.periodEnd ?? null,
291
- }, 'Get schedule facts', (data) => data.scheduleFacts);
292
- return facts?.facts ?? [];
279
+ // ── Information Blocks ─────────────────────────────────────────────
280
+ /**
281
+ * Fetch an Information Block envelope by id — the generic
282
+ * cross-block-type read. Returns `null` when the block doesn't exist
283
+ * (or its type isn't registered). See `information-block.md`.
284
+ */
285
+ async getInformationBlock(graphId, id) {
286
+ const block = await this.gqlQuery(graphId, graphql_1.GetInformationBlockDocument, { id }, 'Get information block', (data) => data.informationBlock ?? null);
287
+ return block ?? null;
288
+ }
289
+ /**
290
+ * List Information Block envelopes with optional block_type + category
291
+ * filters. Replaces the old `listSchedules` method — callers use
292
+ * `{blockType: 'schedule'}` to get the same set of blocks.
293
+ */
294
+ async listInformationBlocks(graphId, options) {
295
+ const blocks = await this.gqlQuery(graphId, graphql_1.ListInformationBlocksDocument, {
296
+ blockType: options?.blockType ?? null,
297
+ category: options?.category ?? null,
298
+ limit: options?.limit ?? null,
299
+ offset: options?.offset ?? null,
300
+ }, 'List information blocks', (data) => data.informationBlocks);
301
+ return blocks ?? [];
293
302
  }
303
+ // ── Schedules ──────────────────────────────────────────────────────
294
304
  /** Create a new schedule with pre-generated monthly facts. */
295
305
  async createSchedule(graphId, options) {
296
306
  const body = {
297
- name: options.name,
298
- element_ids: options.elementIds,
299
- period_start: options.periodStart,
300
- period_end: options.periodEnd,
301
- monthly_amount: options.monthlyAmount,
302
- entry_template: {
303
- debit_element_id: options.entryTemplate.debitElementId,
304
- credit_element_id: options.entryTemplate.creditElementId,
305
- entry_type: options.entryTemplate.entryType,
306
- memo_template: options.entryTemplate.memoTemplate,
307
+ block_type: 'schedule',
308
+ payload: {
309
+ name: options.name,
310
+ element_ids: options.elementIds,
311
+ period_start: options.periodStart,
312
+ period_end: options.periodEnd,
313
+ monthly_amount: options.monthlyAmount,
314
+ entry_template: {
315
+ debit_element_id: options.entryTemplate.debitElementId,
316
+ credit_element_id: options.entryTemplate.creditElementId,
317
+ entry_type: options.entryTemplate.entryType,
318
+ memo_template: options.entryTemplate.memoTemplate,
319
+ },
320
+ taxonomy_id: options.taxonomyId,
321
+ schedule_metadata: options.scheduleMetadata
322
+ ? {
323
+ method: options.scheduleMetadata.method,
324
+ original_amount: options.scheduleMetadata.originalAmount,
325
+ residual_value: options.scheduleMetadata.residualValue,
326
+ useful_life_months: options.scheduleMetadata.usefulLifeMonths,
327
+ asset_element_id: options.scheduleMetadata.assetElementId,
328
+ }
329
+ : undefined,
307
330
  },
308
- taxonomy_id: options.taxonomyId,
309
- schedule_metadata: options.scheduleMetadata
310
- ? {
311
- method: options.scheduleMetadata.method,
312
- original_amount: options.scheduleMetadata.originalAmount,
313
- residual_value: options.scheduleMetadata.residualValue,
314
- useful_life_months: options.scheduleMetadata.usefulLifeMonths,
315
- asset_element_id: options.scheduleMetadata.assetElementId,
316
- }
317
- : undefined,
318
331
  };
319
- const envelope = await this.callOperation('Create schedule', (0, sdk_gen_1.opCreateSchedule)({ path: { graph_id: graphId }, body }));
332
+ const envelope = await this.callOperation('Create schedule', (0, sdk_gen_1.opCreateInformationBlock)({ path: { graph_id: graphId }, body }));
320
333
  const raw = envelope.result;
321
334
  return {
322
335
  structureId: raw.structure_id,
@@ -327,14 +340,21 @@ class LedgerClient {
327
340
  };
328
341
  }
329
342
  /** Update mutable fields on a schedule (name, entry_template, metadata). */
330
- async updateSchedule(graphId, body) {
331
- const envelope = await this.callOperation('Update schedule', (0, sdk_gen_1.opUpdateSchedule)({ path: { graph_id: graphId }, body }));
343
+ async updateSchedule(graphId, structureId, options) {
344
+ const body = {
345
+ block_type: 'schedule',
346
+ payload: { structure_id: structureId, ...options },
347
+ };
348
+ const envelope = await this.callOperation('Update schedule', (0, sdk_gen_1.opUpdateInformationBlock)({ path: { graph_id: graphId }, body }));
332
349
  return (envelope.result ?? {});
333
350
  }
334
351
  /** Permanently delete a schedule (cascades through facts + associations). */
335
352
  async deleteSchedule(graphId, structureId) {
336
- const body = { structure_id: structureId };
337
- const envelope = await this.callOperation('Delete schedule', (0, sdk_gen_1.opDeleteSchedule)({ path: { graph_id: graphId }, body }));
353
+ const body = {
354
+ block_type: 'schedule',
355
+ payload: { structure_id: structureId },
356
+ };
357
+ const envelope = await this.callOperation('Delete schedule', (0, sdk_gen_1.opDeleteInformationBlock)({ path: { graph_id: graphId }, body }));
338
358
  return (envelope.result ?? { deleted: true });
339
359
  }
340
360
  /** Truncate a schedule — end it early at `newEndDate`. */
@@ -32,22 +32,22 @@ import {
32
32
  opCreateAssociations,
33
33
  opCreateClosingEntry,
34
34
  opCreateElement,
35
+ opCreateInformationBlock,
35
36
  opCreateJournalEntry,
36
37
  opCreateManualClosingEntry,
37
38
  opCreateMappingAssociation,
38
39
  opCreatePublishList,
39
40
  opCreateReport,
40
- opCreateSchedule,
41
41
  opCreateStructure,
42
42
  opCreateTaxonomy,
43
43
  opCreateTransaction,
44
44
  opDeleteAssociation,
45
45
  opDeleteElement,
46
+ opDeleteInformationBlock,
46
47
  opDeleteJournalEntry,
47
48
  opDeleteMappingAssociation,
48
49
  opDeletePublishList,
49
50
  opDeleteReport,
50
- opDeleteSchedule,
51
51
  opDeleteStructure,
52
52
  opDeleteTaxonomy,
53
53
  opInitializeLedger,
@@ -62,9 +62,9 @@ import {
62
62
  opUpdateAssociation,
63
63
  opUpdateElement,
64
64
  opUpdateEntity,
65
+ opUpdateInformationBlock,
65
66
  opUpdateJournalEntry,
66
67
  opUpdatePublishList,
67
- opUpdateSchedule,
68
68
  opUpdateStructure,
69
69
  opUpdateTaxonomy,
70
70
  } from '../sdk.gen'
@@ -76,21 +76,21 @@ import type {
76
76
  ClosePeriodOperation,
77
77
  CreateClosingEntryOperation,
78
78
  CreateElementRequest,
79
+ CreateInformationBlockRequest,
79
80
  CreateJournalEntryRequest,
80
81
  CreateManualClosingEntryRequest,
81
82
  CreateMappingAssociationOperation,
82
83
  CreatePublishListRequest,
83
84
  CreateReportRequest,
84
- CreateScheduleRequest,
85
85
  CreateStructureRequest,
86
86
  CreateTaxonomyRequest,
87
87
  CreateTransactionRequest,
88
88
  CreateViewRequest,
89
89
  DeleteAssociationRequest,
90
90
  DeleteElementRequest,
91
+ DeleteInformationBlockRequest,
91
92
  DeleteJournalEntryRequest,
92
93
  DeleteMappingAssociationOperation,
93
- DeleteScheduleRequest,
94
94
  DeleteStructureRequest,
95
95
  DeleteTaxonomyRequest,
96
96
  InitializeLedgerRequest,
@@ -104,15 +104,16 @@ import type {
104
104
  UpdateAssociationRequest,
105
105
  UpdateElementRequest,
106
106
  UpdateEntityRequest,
107
+ UpdateInformationBlockRequest,
107
108
  UpdateJournalEntryRequest,
108
109
  UpdatePublishListOperation,
109
- UpdateScheduleRequest,
110
110
  UpdateStructureRequest,
111
111
  UpdateTaxonomyRequest,
112
112
  } from '../types.gen'
113
113
  import type { TokenProvider } from './graphql/client'
114
114
  import { GraphQLClientCache } from './graphql/client'
115
115
  import {
116
+ GetInformationBlockDocument,
116
117
  GetLedgerAccountRollupsDocument,
117
118
  GetLedgerAccountTreeDocument,
118
119
  GetLedgerClosingBookStructuresDocument,
@@ -126,22 +127,22 @@ import {
126
127
  GetLedgerPublishListDocument,
127
128
  GetLedgerReportDocument,
128
129
  GetLedgerReportingTaxonomyDocument,
129
- GetLedgerScheduleFactsDocument,
130
130
  GetLedgerStatementDocument,
131
131
  GetLedgerSummaryDocument,
132
132
  GetLedgerTransactionDocument,
133
133
  GetLedgerTrialBalanceDocument,
134
+ ListInformationBlocksDocument,
134
135
  ListLedgerAccountsDocument,
135
136
  ListLedgerElementsDocument,
136
137
  ListLedgerEntitiesDocument,
137
138
  ListLedgerMappingsDocument,
138
139
  ListLedgerPublishListsDocument,
139
140
  ListLedgerReportsDocument,
140
- ListLedgerSchedulesDocument,
141
141
  ListLedgerStructuresDocument,
142
142
  ListLedgerTaxonomiesDocument,
143
143
  ListLedgerTransactionsDocument,
144
144
  ListLedgerUnmappedElementsDocument,
145
+ type GetInformationBlockQuery,
145
146
  type GetLedgerAccountRollupsQuery,
146
147
  type GetLedgerAccountTreeQuery,
147
148
  type GetLedgerClosingBookStructuresQuery,
@@ -155,18 +156,17 @@ import {
155
156
  type GetLedgerPublishListQuery,
156
157
  type GetLedgerReportingTaxonomyQuery,
157
158
  type GetLedgerReportQuery,
158
- type GetLedgerScheduleFactsQuery,
159
159
  type GetLedgerStatementQuery,
160
160
  type GetLedgerSummaryQuery,
161
161
  type GetLedgerTransactionQuery,
162
162
  type GetLedgerTrialBalanceQuery,
163
+ type ListInformationBlocksQuery,
163
164
  type ListLedgerAccountsQuery,
164
165
  type ListLedgerElementsQuery,
165
166
  type ListLedgerEntitiesQuery,
166
167
  type ListLedgerMappingsQuery,
167
168
  type ListLedgerPublishListsQuery,
168
169
  type ListLedgerReportsQuery,
169
- type ListLedgerSchedulesQuery,
170
170
  type ListLedgerStructuresQuery,
171
171
  type ListLedgerTaxonomiesQuery,
172
172
  type ListLedgerTransactionsQuery,
@@ -217,10 +217,11 @@ export type LedgerMappingInfo = LedgerMappingList['structures'][number]
217
217
  export type LedgerMapping = NonNullable<GetLedgerMappingQuery['mapping']>
218
218
  export type LedgerMappingCoverage = NonNullable<GetLedgerMappingCoverageQuery['mappingCoverage']>
219
219
 
220
- export type LedgerScheduleList = NonNullable<ListLedgerSchedulesQuery['schedules']>
221
- export type LedgerSchedule = LedgerScheduleList['schedules'][number]
222
- export type LedgerScheduleFacts = NonNullable<GetLedgerScheduleFactsQuery['scheduleFacts']>
223
- export type LedgerScheduleFact = LedgerScheduleFacts['facts'][number]
220
+ export type InformationBlock = NonNullable<GetInformationBlockQuery['informationBlock']>
221
+ export type InformationBlockList = ListInformationBlocksQuery['informationBlocks']
222
+ export type InformationBlockElement = InformationBlock['elements'][number]
223
+ export type InformationBlockConnection = InformationBlock['connections'][number]
224
+ export type InformationBlockFact = InformationBlock['facts'][number]
224
225
 
225
226
  export type LedgerPeriodCloseStatus = NonNullable<
226
227
  GetLedgerPeriodCloseStatusQuery['periodCloseStatus']
@@ -1072,68 +1073,86 @@ export class LedgerClient {
1072
1073
  return (envelope.result ?? { deleted: true }) as { deleted: boolean }
1073
1074
  }
1074
1075
 
1075
- // ── Schedules ──────────────────────────────────────────────────────
1076
+ // ── Information Blocks ─────────────────────────────────────────────
1076
1077
 
1077
- /** List all schedule structures with metadata. */
1078
- async listSchedules(graphId: string): Promise<LedgerSchedule[]> {
1079
- const list = await this.gqlQuery(
1078
+ /**
1079
+ * Fetch an Information Block envelope by id — the generic
1080
+ * cross-block-type read. Returns `null` when the block doesn't exist
1081
+ * (or its type isn't registered). See `information-block.md`.
1082
+ */
1083
+ async getInformationBlock(graphId: string, id: string): Promise<InformationBlock | null> {
1084
+ const block = await this.gqlQuery(
1080
1085
  graphId,
1081
- ListLedgerSchedulesDocument,
1082
- undefined,
1083
- 'List schedules',
1084
- (data) => data.schedules
1086
+ GetInformationBlockDocument,
1087
+ { id },
1088
+ 'Get information block',
1089
+ (data) => data.informationBlock ?? null
1085
1090
  )
1086
- return list?.schedules ?? []
1091
+ return block ?? null
1087
1092
  }
1088
1093
 
1089
- /** Schedule facts optionally filtered by period window. */
1090
- async getScheduleFacts(
1094
+ /**
1095
+ * List Information Block envelopes with optional block_type + category
1096
+ * filters. Replaces the old `listSchedules` method — callers use
1097
+ * `{blockType: 'schedule'}` to get the same set of blocks.
1098
+ */
1099
+ async listInformationBlocks(
1091
1100
  graphId: string,
1092
- structureId: string,
1093
- options?: { periodStart?: string; periodEnd?: string }
1094
- ): Promise<LedgerScheduleFact[]> {
1095
- const facts = await this.gqlQuery(
1101
+ options?: {
1102
+ blockType?: string
1103
+ category?: string
1104
+ limit?: number
1105
+ offset?: number
1106
+ }
1107
+ ): Promise<InformationBlockList> {
1108
+ const blocks = await this.gqlQuery(
1096
1109
  graphId,
1097
- GetLedgerScheduleFactsDocument,
1110
+ ListInformationBlocksDocument,
1098
1111
  {
1099
- structureId,
1100
- periodStart: options?.periodStart ?? null,
1101
- periodEnd: options?.periodEnd ?? null,
1112
+ blockType: options?.blockType ?? null,
1113
+ category: options?.category ?? null,
1114
+ limit: options?.limit ?? null,
1115
+ offset: options?.offset ?? null,
1102
1116
  },
1103
- 'Get schedule facts',
1104
- (data) => data.scheduleFacts
1117
+ 'List information blocks',
1118
+ (data) => data.informationBlocks
1105
1119
  )
1106
- return facts?.facts ?? []
1120
+ return blocks ?? []
1107
1121
  }
1108
1122
 
1123
+ // ── Schedules ──────────────────────────────────────────────────────
1124
+
1109
1125
  /** Create a new schedule with pre-generated monthly facts. */
1110
1126
  async createSchedule(graphId: string, options: CreateScheduleOptions): Promise<ScheduleCreated> {
1111
- const body: CreateScheduleRequest = {
1112
- name: options.name,
1113
- element_ids: options.elementIds,
1114
- period_start: options.periodStart,
1115
- period_end: options.periodEnd,
1116
- monthly_amount: options.monthlyAmount,
1117
- entry_template: {
1118
- debit_element_id: options.entryTemplate.debitElementId,
1119
- credit_element_id: options.entryTemplate.creditElementId,
1120
- entry_type: options.entryTemplate.entryType,
1121
- memo_template: options.entryTemplate.memoTemplate,
1127
+ const body: CreateInformationBlockRequest = {
1128
+ block_type: 'schedule',
1129
+ payload: {
1130
+ name: options.name,
1131
+ element_ids: options.elementIds,
1132
+ period_start: options.periodStart,
1133
+ period_end: options.periodEnd,
1134
+ monthly_amount: options.monthlyAmount,
1135
+ entry_template: {
1136
+ debit_element_id: options.entryTemplate.debitElementId,
1137
+ credit_element_id: options.entryTemplate.creditElementId,
1138
+ entry_type: options.entryTemplate.entryType,
1139
+ memo_template: options.entryTemplate.memoTemplate,
1140
+ },
1141
+ taxonomy_id: options.taxonomyId,
1142
+ schedule_metadata: options.scheduleMetadata
1143
+ ? {
1144
+ method: options.scheduleMetadata.method,
1145
+ original_amount: options.scheduleMetadata.originalAmount,
1146
+ residual_value: options.scheduleMetadata.residualValue,
1147
+ useful_life_months: options.scheduleMetadata.usefulLifeMonths,
1148
+ asset_element_id: options.scheduleMetadata.assetElementId,
1149
+ }
1150
+ : undefined,
1122
1151
  },
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
1152
  }
1134
1153
  const envelope = await this.callOperation(
1135
1154
  'Create schedule',
1136
- opCreateSchedule({ path: { graph_id: graphId }, body })
1155
+ opCreateInformationBlock({ path: { graph_id: graphId }, body })
1137
1156
  )
1138
1157
  const raw = envelope.result as unknown as RawScheduleCreatedResult
1139
1158
  return {
@@ -1148,21 +1167,29 @@ export class LedgerClient {
1148
1167
  /** Update mutable fields on a schedule (name, entry_template, metadata). */
1149
1168
  async updateSchedule(
1150
1169
  graphId: string,
1151
- body: UpdateScheduleRequest
1170
+ structureId: string,
1171
+ options: { name?: string }
1152
1172
  ): Promise<Record<string, unknown>> {
1173
+ const body: UpdateInformationBlockRequest = {
1174
+ block_type: 'schedule',
1175
+ payload: { structure_id: structureId, ...options },
1176
+ }
1153
1177
  const envelope = await this.callOperation(
1154
1178
  'Update schedule',
1155
- opUpdateSchedule({ path: { graph_id: graphId }, body })
1179
+ opUpdateInformationBlock({ path: { graph_id: graphId }, body })
1156
1180
  )
1157
1181
  return (envelope.result ?? {}) as Record<string, unknown>
1158
1182
  }
1159
1183
 
1160
1184
  /** Permanently delete a schedule (cascades through facts + associations). */
1161
1185
  async deleteSchedule(graphId: string, structureId: string): Promise<{ deleted: boolean }> {
1162
- const body: DeleteScheduleRequest = { structure_id: structureId }
1186
+ const body: DeleteInformationBlockRequest = {
1187
+ block_type: 'schedule',
1188
+ payload: { structure_id: structureId },
1189
+ }
1163
1190
  const envelope = await this.callOperation(
1164
1191
  'Delete schedule',
1165
- opDeleteSchedule({ path: { graph_id: graphId }, body })
1192
+ opDeleteInformationBlock({ path: { graph_id: graphId }, body })
1166
1193
  )
1167
1194
  return (envelope.result ?? { deleted: true }) as { deleted: boolean }
1168
1195
  }
@@ -0,0 +1,117 @@
1
+ import type { TokenProvider } from './graphql/client';
2
+ import { type GetLibraryElementArcsQuery, type GetLibraryElementClassificationsQuery, type GetLibraryElementEquivalentsQuery, type GetLibraryElementQuery, type GetLibraryTaxonomyQuery, type ListLibraryElementsQuery, type ListLibraryTaxonomiesQuery, type ListLibraryTaxonomyArcsQuery, type SearchLibraryElementsQuery } from './graphql/generated/graphql';
3
+ export type LibraryTaxonomy = ListLibraryTaxonomiesQuery['libraryTaxonomies'][number];
4
+ export type LibraryTaxonomyDetail = NonNullable<GetLibraryTaxonomyQuery['libraryTaxonomy']>;
5
+ export type LibraryElement = ListLibraryElementsQuery['libraryElements'][number];
6
+ export type LibraryElementDetail = NonNullable<GetLibraryElementQuery['libraryElement']>;
7
+ export type LibrarySearchResult = SearchLibraryElementsQuery['searchLibraryElements'][number];
8
+ export type LibraryLabel = LibraryElementDetail['labels'][number];
9
+ export type LibraryReference = LibraryElementDetail['references'][number];
10
+ export type LibraryArc = ListLibraryTaxonomyArcsQuery['libraryTaxonomyArcs'][number];
11
+ export type LibraryElementArc = GetLibraryElementArcsQuery['libraryElementArcs'][number];
12
+ export type LibraryElementClassification = GetLibraryElementClassificationsQuery['libraryElementClassifications'][number];
13
+ export type LibraryEquivalence = NonNullable<GetLibraryElementEquivalentsQuery['libraryElementEquivalents']>;
14
+ export interface ListLibraryElementsOptions {
15
+ taxonomyId?: string;
16
+ source?: string;
17
+ /** FASB elementsOfFinancialStatements axis (asset | liability | equity | revenue | expense | …). */
18
+ classification?: string;
19
+ /** Cash-flow activity axis (operatingActivity | investingActivity | financingActivity). */
20
+ activityType?: string;
21
+ elementType?: string;
22
+ /** `true` → abstract only; `false` → concrete only; omit for both. */
23
+ isAbstract?: boolean | null;
24
+ limit?: number;
25
+ offset?: number;
26
+ includeLabels?: boolean;
27
+ includeReferences?: boolean;
28
+ }
29
+ export interface SearchLibraryElementsOptions {
30
+ source?: string;
31
+ limit?: number;
32
+ }
33
+ export interface ListLibraryTaxonomyArcsOptions {
34
+ associationType?: string;
35
+ limit?: number;
36
+ offset?: number;
37
+ }
38
+ export interface ListLibraryTaxonomyArcsResult {
39
+ arcs: LibraryArc[];
40
+ count: number;
41
+ }
42
+ export interface GetLibraryElementIdentifier {
43
+ id?: string;
44
+ qname?: string;
45
+ }
46
+ /**
47
+ * Sentinel graph_id for the canonical library read surface. Passing
48
+ * this to any LibraryClient method routes the GraphQL request to
49
+ * `/extensions/library/graphql` and reads from the public schema only.
50
+ */
51
+ export declare const LIBRARY_GRAPH_ID = "library";
52
+ interface LibraryClientConfig {
53
+ baseUrl: string;
54
+ credentials?: 'include' | 'same-origin' | 'omit';
55
+ headers?: Record<string, string>;
56
+ /** Static credential — use `tokenProvider` instead if the JWT rotates. */
57
+ token?: string;
58
+ /**
59
+ * Dynamic credential callback. When set, invoked on every GraphQL
60
+ * request so refreshes flow through automatically.
61
+ */
62
+ tokenProvider?: TokenProvider;
63
+ }
64
+ export declare class LibraryClient {
65
+ private config;
66
+ private gql;
67
+ constructor(config: LibraryClientConfig);
68
+ /**
69
+ * List every taxonomy visible at this graph_id.
70
+ *
71
+ * On the `"library"` sentinel this is the canonical set (sfac6,
72
+ * fac, rs-gaap, …). On a tenant graph_id this also includes the
73
+ * tenant's own CoA and any custom taxonomies they've created.
74
+ */
75
+ listLibraryTaxonomies(graphId: string, options?: {
76
+ standard?: string;
77
+ includeElementCount?: boolean;
78
+ }): Promise<LibraryTaxonomy[]>;
79
+ /** Fetch one taxonomy by id or by (standard, version). */
80
+ getLibraryTaxonomy(graphId: string, identifier: {
81
+ id?: string;
82
+ standard?: string;
83
+ version?: string;
84
+ }, options?: {
85
+ includeElementCount?: boolean;
86
+ }): Promise<LibraryTaxonomyDetail | null>;
87
+ /** List library elements with filters + pagination. */
88
+ listLibraryElements(graphId: string, options?: ListLibraryElementsOptions): Promise<LibraryElement[]>;
89
+ /**
90
+ * Substring search across qname, name, and standard label text.
91
+ * Always includes labels + references inline — search UIs render them.
92
+ */
93
+ searchLibraryElements(graphId: string, query: string, options?: SearchLibraryElementsOptions): Promise<LibrarySearchResult[]>;
94
+ /**
95
+ * Get a single element by id or by qname. Returns null when neither
96
+ * identifier is supplied or neither resolves.
97
+ */
98
+ getLibraryElement(graphId: string, identifier: GetLibraryElementIdentifier): Promise<LibraryElementDetail | null>;
99
+ /**
100
+ * All arcs contributed by a taxonomy, plus their total count, in one
101
+ * round-trip. For mapping taxonomies (fac-to-rs-gaap, sfac6-to-fac,
102
+ * type-subtype) this is the primary browse view.
103
+ */
104
+ listLibraryTaxonomyArcs(graphId: string, taxonomyId: string, options?: ListLibraryTaxonomyArcsOptions): Promise<ListLibraryTaxonomyArcsResult>;
105
+ /**
106
+ * All mapping arcs where this element is source or target. Covers
107
+ * every `taxonomy_type='mapping'` bridge — equivalence,
108
+ * general-special, type-subtype.
109
+ */
110
+ getLibraryElementArcs(graphId: string, id: string): Promise<LibraryElementArc[]>;
111
+ /** All classification traits (category + identifier) assigned to this element. */
112
+ getLibraryElementClassifications(graphId: string, id: string): Promise<LibraryElementClassification[]>;
113
+ /** Equivalence fan-out (FAC ↔ us-gaap collapse). */
114
+ getLibraryElementEquivalents(graphId: string, id: string): Promise<LibraryEquivalence | null>;
115
+ private gqlQuery;
116
+ }
117
+ export {};