@robosystems/client 0.3.0 → 0.3.2

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 (164) hide show
  1. package/{extensions → artifacts}/InvestorClient.d.ts +7 -0
  2. package/{extensions → artifacts}/InvestorClient.js +0 -1
  3. package/{extensions → artifacts}/InvestorClient.ts +8 -1
  4. package/{extensions → artifacts}/LedgerClient.d.ts +175 -2
  5. package/{extensions → artifacts}/LedgerClient.js +301 -2
  6. package/{extensions → artifacts}/LedgerClient.ts +652 -2
  7. package/{extensions → artifacts}/config.d.ts +29 -10
  8. package/{extensions → artifacts}/config.js +11 -11
  9. package/{extensions → artifacts}/config.ts +36 -16
  10. package/artifacts/graphql/client.d.ts +82 -0
  11. package/artifacts/graphql/client.js +148 -0
  12. package/artifacts/graphql/client.ts +189 -0
  13. package/{extensions → artifacts}/hooks.js +6 -6
  14. package/{extensions → artifacts}/hooks.ts +7 -7
  15. package/{extensions → artifacts}/index.d.ts +34 -18
  16. package/{extensions → artifacts}/index.js +47 -44
  17. package/{extensions → artifacts}/index.ts +72 -52
  18. package/index.d.ts +2 -2
  19. package/index.js +2 -2
  20. package/index.ts +2 -2
  21. package/package.json +38 -8
  22. package/sdk/index.d.ts +2 -2
  23. package/sdk/index.js +27 -9
  24. package/sdk/index.ts +2 -2
  25. package/sdk/sdk.gen.d.ts +275 -274
  26. package/sdk/sdk.gen.js +469 -314
  27. package/sdk/sdk.gen.ts +465 -311
  28. package/sdk/types.gen.d.ts +2940 -466
  29. package/sdk/types.gen.ts +3053 -474
  30. package/sdk.gen.d.ts +275 -274
  31. package/sdk.gen.js +469 -314
  32. package/sdk.gen.ts +465 -311
  33. package/types.gen.d.ts +2940 -466
  34. package/types.gen.ts +3053 -474
  35. package/extensions/ReportClient.d.ts +0 -113
  36. package/extensions/ReportClient.js +0 -191
  37. package/extensions/ReportClient.ts +0 -426
  38. package/extensions/graphql/client.d.ts +0 -46
  39. package/extensions/graphql/client.js +0 -75
  40. package/extensions/graphql/client.ts +0 -82
  41. /package/{extensions → artifacts}/AgentClient.d.ts +0 -0
  42. /package/{extensions → artifacts}/AgentClient.js +0 -0
  43. /package/{extensions → artifacts}/AgentClient.ts +0 -0
  44. /package/{extensions → artifacts}/OperationClient.d.ts +0 -0
  45. /package/{extensions → artifacts}/OperationClient.js +0 -0
  46. /package/{extensions → artifacts}/OperationClient.ts +0 -0
  47. /package/{extensions → artifacts}/QueryClient.d.ts +0 -0
  48. /package/{extensions → artifacts}/QueryClient.js +0 -0
  49. /package/{extensions → artifacts}/QueryClient.ts +0 -0
  50. /package/{extensions → artifacts}/SSEClient.d.ts +0 -0
  51. /package/{extensions → artifacts}/SSEClient.js +0 -0
  52. /package/{extensions → artifacts}/SSEClient.ts +0 -0
  53. /package/{extensions → artifacts}/graphql/generated/graphql.d.ts +0 -0
  54. /package/{extensions → artifacts}/graphql/generated/graphql.js +0 -0
  55. /package/{extensions → artifacts}/graphql/generated/graphql.ts +0 -0
  56. /package/{extensions → artifacts}/graphql/queries/investor/holdings.d.ts +0 -0
  57. /package/{extensions → artifacts}/graphql/queries/investor/holdings.js +0 -0
  58. /package/{extensions → artifacts}/graphql/queries/investor/holdings.ts +0 -0
  59. /package/{extensions → artifacts}/graphql/queries/investor/portfolio.d.ts +0 -0
  60. /package/{extensions → artifacts}/graphql/queries/investor/portfolio.js +0 -0
  61. /package/{extensions → artifacts}/graphql/queries/investor/portfolio.ts +0 -0
  62. /package/{extensions → artifacts}/graphql/queries/investor/portfolios.d.ts +0 -0
  63. /package/{extensions → artifacts}/graphql/queries/investor/portfolios.js +0 -0
  64. /package/{extensions → artifacts}/graphql/queries/investor/portfolios.ts +0 -0
  65. /package/{extensions → artifacts}/graphql/queries/investor/position.d.ts +0 -0
  66. /package/{extensions → artifacts}/graphql/queries/investor/position.js +0 -0
  67. /package/{extensions → artifacts}/graphql/queries/investor/position.ts +0 -0
  68. /package/{extensions → artifacts}/graphql/queries/investor/positions.d.ts +0 -0
  69. /package/{extensions → artifacts}/graphql/queries/investor/positions.js +0 -0
  70. /package/{extensions → artifacts}/graphql/queries/investor/positions.ts +0 -0
  71. /package/{extensions → artifacts}/graphql/queries/investor/securities.d.ts +0 -0
  72. /package/{extensions → artifacts}/graphql/queries/investor/securities.js +0 -0
  73. /package/{extensions → artifacts}/graphql/queries/investor/securities.ts +0 -0
  74. /package/{extensions → artifacts}/graphql/queries/investor/security.d.ts +0 -0
  75. /package/{extensions → artifacts}/graphql/queries/investor/security.js +0 -0
  76. /package/{extensions → artifacts}/graphql/queries/investor/security.ts +0 -0
  77. /package/{extensions → artifacts}/graphql/queries/ledger/accountRollups.d.ts +0 -0
  78. /package/{extensions → artifacts}/graphql/queries/ledger/accountRollups.js +0 -0
  79. /package/{extensions → artifacts}/graphql/queries/ledger/accountRollups.ts +0 -0
  80. /package/{extensions → artifacts}/graphql/queries/ledger/accountTree.d.ts +0 -0
  81. /package/{extensions → artifacts}/graphql/queries/ledger/accountTree.js +0 -0
  82. /package/{extensions → artifacts}/graphql/queries/ledger/accountTree.ts +0 -0
  83. /package/{extensions → artifacts}/graphql/queries/ledger/accounts.d.ts +0 -0
  84. /package/{extensions → artifacts}/graphql/queries/ledger/accounts.js +0 -0
  85. /package/{extensions → artifacts}/graphql/queries/ledger/accounts.ts +0 -0
  86. /package/{extensions → artifacts}/graphql/queries/ledger/closingBookStructures.d.ts +0 -0
  87. /package/{extensions → artifacts}/graphql/queries/ledger/closingBookStructures.js +0 -0
  88. /package/{extensions → artifacts}/graphql/queries/ledger/closingBookStructures.ts +0 -0
  89. /package/{extensions → artifacts}/graphql/queries/ledger/elements.d.ts +0 -0
  90. /package/{extensions → artifacts}/graphql/queries/ledger/elements.js +0 -0
  91. /package/{extensions → artifacts}/graphql/queries/ledger/elements.ts +0 -0
  92. /package/{extensions → artifacts}/graphql/queries/ledger/entities.d.ts +0 -0
  93. /package/{extensions → artifacts}/graphql/queries/ledger/entities.js +0 -0
  94. /package/{extensions → artifacts}/graphql/queries/ledger/entities.ts +0 -0
  95. /package/{extensions → artifacts}/graphql/queries/ledger/entity.d.ts +0 -0
  96. /package/{extensions → artifacts}/graphql/queries/ledger/entity.js +0 -0
  97. /package/{extensions → artifacts}/graphql/queries/ledger/entity.ts +0 -0
  98. /package/{extensions → artifacts}/graphql/queries/ledger/fiscalCalendar.d.ts +0 -0
  99. /package/{extensions → artifacts}/graphql/queries/ledger/fiscalCalendar.js +0 -0
  100. /package/{extensions → artifacts}/graphql/queries/ledger/fiscalCalendar.ts +0 -0
  101. /package/{extensions → artifacts}/graphql/queries/ledger/mappedTrialBalance.d.ts +0 -0
  102. /package/{extensions → artifacts}/graphql/queries/ledger/mappedTrialBalance.js +0 -0
  103. /package/{extensions → artifacts}/graphql/queries/ledger/mappedTrialBalance.ts +0 -0
  104. /package/{extensions → artifacts}/graphql/queries/ledger/mapping.d.ts +0 -0
  105. /package/{extensions → artifacts}/graphql/queries/ledger/mapping.js +0 -0
  106. /package/{extensions → artifacts}/graphql/queries/ledger/mapping.ts +0 -0
  107. /package/{extensions → artifacts}/graphql/queries/ledger/mappingCoverage.d.ts +0 -0
  108. /package/{extensions → artifacts}/graphql/queries/ledger/mappingCoverage.js +0 -0
  109. /package/{extensions → artifacts}/graphql/queries/ledger/mappingCoverage.ts +0 -0
  110. /package/{extensions → artifacts}/graphql/queries/ledger/mappings.d.ts +0 -0
  111. /package/{extensions → artifacts}/graphql/queries/ledger/mappings.js +0 -0
  112. /package/{extensions → artifacts}/graphql/queries/ledger/mappings.ts +0 -0
  113. /package/{extensions → artifacts}/graphql/queries/ledger/periodCloseStatus.d.ts +0 -0
  114. /package/{extensions → artifacts}/graphql/queries/ledger/periodCloseStatus.js +0 -0
  115. /package/{extensions → artifacts}/graphql/queries/ledger/periodCloseStatus.ts +0 -0
  116. /package/{extensions → artifacts}/graphql/queries/ledger/periodDrafts.d.ts +0 -0
  117. /package/{extensions → artifacts}/graphql/queries/ledger/periodDrafts.js +0 -0
  118. /package/{extensions → artifacts}/graphql/queries/ledger/periodDrafts.ts +0 -0
  119. /package/{extensions → artifacts}/graphql/queries/ledger/publishList.d.ts +0 -0
  120. /package/{extensions → artifacts}/graphql/queries/ledger/publishList.js +0 -0
  121. /package/{extensions → artifacts}/graphql/queries/ledger/publishList.ts +0 -0
  122. /package/{extensions → artifacts}/graphql/queries/ledger/publishLists.d.ts +0 -0
  123. /package/{extensions → artifacts}/graphql/queries/ledger/publishLists.js +0 -0
  124. /package/{extensions → artifacts}/graphql/queries/ledger/publishLists.ts +0 -0
  125. /package/{extensions → artifacts}/graphql/queries/ledger/report.d.ts +0 -0
  126. /package/{extensions → artifacts}/graphql/queries/ledger/report.js +0 -0
  127. /package/{extensions → artifacts}/graphql/queries/ledger/report.ts +0 -0
  128. /package/{extensions → artifacts}/graphql/queries/ledger/reportingTaxonomy.d.ts +0 -0
  129. /package/{extensions → artifacts}/graphql/queries/ledger/reportingTaxonomy.js +0 -0
  130. /package/{extensions → artifacts}/graphql/queries/ledger/reportingTaxonomy.ts +0 -0
  131. /package/{extensions → artifacts}/graphql/queries/ledger/reports.d.ts +0 -0
  132. /package/{extensions → artifacts}/graphql/queries/ledger/reports.js +0 -0
  133. /package/{extensions → artifacts}/graphql/queries/ledger/reports.ts +0 -0
  134. /package/{extensions → artifacts}/graphql/queries/ledger/scheduleFacts.d.ts +0 -0
  135. /package/{extensions → artifacts}/graphql/queries/ledger/scheduleFacts.js +0 -0
  136. /package/{extensions → artifacts}/graphql/queries/ledger/scheduleFacts.ts +0 -0
  137. /package/{extensions → artifacts}/graphql/queries/ledger/schedules.d.ts +0 -0
  138. /package/{extensions → artifacts}/graphql/queries/ledger/schedules.js +0 -0
  139. /package/{extensions → artifacts}/graphql/queries/ledger/schedules.ts +0 -0
  140. /package/{extensions → artifacts}/graphql/queries/ledger/statement.d.ts +0 -0
  141. /package/{extensions → artifacts}/graphql/queries/ledger/statement.js +0 -0
  142. /package/{extensions → artifacts}/graphql/queries/ledger/statement.ts +0 -0
  143. /package/{extensions → artifacts}/graphql/queries/ledger/structures.d.ts +0 -0
  144. /package/{extensions → artifacts}/graphql/queries/ledger/structures.js +0 -0
  145. /package/{extensions → artifacts}/graphql/queries/ledger/structures.ts +0 -0
  146. /package/{extensions → artifacts}/graphql/queries/ledger/summary.d.ts +0 -0
  147. /package/{extensions → artifacts}/graphql/queries/ledger/summary.js +0 -0
  148. /package/{extensions → artifacts}/graphql/queries/ledger/summary.ts +0 -0
  149. /package/{extensions → artifacts}/graphql/queries/ledger/taxonomies.d.ts +0 -0
  150. /package/{extensions → artifacts}/graphql/queries/ledger/taxonomies.js +0 -0
  151. /package/{extensions → artifacts}/graphql/queries/ledger/taxonomies.ts +0 -0
  152. /package/{extensions → artifacts}/graphql/queries/ledger/transaction.d.ts +0 -0
  153. /package/{extensions → artifacts}/graphql/queries/ledger/transaction.js +0 -0
  154. /package/{extensions → artifacts}/graphql/queries/ledger/transaction.ts +0 -0
  155. /package/{extensions → artifacts}/graphql/queries/ledger/transactions.d.ts +0 -0
  156. /package/{extensions → artifacts}/graphql/queries/ledger/transactions.js +0 -0
  157. /package/{extensions → artifacts}/graphql/queries/ledger/transactions.ts +0 -0
  158. /package/{extensions → artifacts}/graphql/queries/ledger/trialBalance.d.ts +0 -0
  159. /package/{extensions → artifacts}/graphql/queries/ledger/trialBalance.js +0 -0
  160. /package/{extensions → artifacts}/graphql/queries/ledger/trialBalance.ts +0 -0
  161. /package/{extensions → artifacts}/graphql/queries/ledger/unmappedElements.d.ts +0 -0
  162. /package/{extensions → artifacts}/graphql/queries/ledger/unmappedElements.js +0 -0
  163. /package/{extensions → artifacts}/graphql/queries/ledger/unmappedElements.ts +0 -0
  164. /package/{extensions → artifacts}/hooks.d.ts +0 -0
@@ -1,4 +1,5 @@
1
1
  import type { CreatePortfolioRequest, CreatePositionRequest, CreateSecurityRequest, UpdatePortfolioOperation, UpdatePositionOperation, UpdateSecurityOperation } from '../types.gen';
2
+ import type { TokenProvider } from './graphql/client';
2
3
  import { type GetInvestorHoldingsQuery, type GetInvestorPortfolioQuery, type GetInvestorPositionQuery, type GetInvestorSecurityQuery, type ListInvestorPortfoliosQuery, type ListInvestorPositionsQuery, type ListInvestorSecuritiesQuery } from './graphql/generated/graphql';
3
4
  export type InvestorPortfolioList = NonNullable<ListInvestorPortfoliosQuery['portfolios']>;
4
5
  export type InvestorPortfolioSummary = InvestorPortfolioList['portfolios'][number];
@@ -16,7 +17,13 @@ interface InvestorClientConfig {
16
17
  baseUrl: string;
17
18
  credentials?: 'include' | 'same-origin' | 'omit';
18
19
  headers?: Record<string, string>;
20
+ /** Static credential — use `tokenProvider` instead if the JWT rotates. */
19
21
  token?: string;
22
+ /**
23
+ * Dynamic credential callback. When set, invoked on every GraphQL
24
+ * request so refreshes flow through automatically.
25
+ */
26
+ tokenProvider?: TokenProvider;
20
27
  }
21
28
  export declare class InvestorClient {
22
29
  private config;
@@ -144,7 +144,6 @@ class InvestorClient {
144
144
  async gqlQuery(graphId, document, variables, label, pick) {
145
145
  try {
146
146
  const client = this.gql.get(graphId);
147
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
148
147
  const raw = client.request;
149
148
  const data = (await raw.call(client, document, variables));
150
149
  return pick(data);
@@ -38,6 +38,7 @@ import type {
38
38
  UpdatePositionOperation,
39
39
  UpdateSecurityOperation,
40
40
  } from '../types.gen'
41
+ import type { TokenProvider } from './graphql/client'
41
42
  import { GraphQLClientCache } from './graphql/client'
42
43
  import {
43
44
  GetInvestorHoldingsDocument,
@@ -80,7 +81,13 @@ interface InvestorClientConfig {
80
81
  baseUrl: string
81
82
  credentials?: 'include' | 'same-origin' | 'omit'
82
83
  headers?: Record<string, string>
84
+ /** Static credential — use `tokenProvider` instead if the JWT rotates. */
83
85
  token?: string
86
+ /**
87
+ * Dynamic credential callback. When set, invoked on every GraphQL
88
+ * request so refreshes flow through automatically.
89
+ */
90
+ tokenProvider?: TokenProvider
84
91
  }
85
92
 
86
93
  export class InvestorClient {
@@ -354,7 +361,7 @@ export class InvestorClient {
354
361
  ): Promise<TResult> {
355
362
  try {
356
363
  const client = this.gql.get(graphId)
357
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
364
+
358
365
  const raw = client.request as (doc: unknown, vars?: unknown) => Promise<any>
359
366
  const data = (await raw.call(client, document, variables)) as TData
360
367
  return pick(data)
@@ -1,5 +1,6 @@
1
- import type { AutoMapElementsOperation, CreateMappingAssociationOperation, CreateStructureRequest, CreateTaxonomyRequest, DeleteMappingAssociationOperation, OperationEnvelope, UpdateEntityRequest } from '../types.gen';
2
- import { type GetLedgerAccountRollupsQuery, type GetLedgerAccountTreeQuery, type GetLedgerClosingBookStructuresQuery, type GetLedgerEntityQuery, type GetLedgerFiscalCalendarQuery, type GetLedgerMappedTrialBalanceQuery, type GetLedgerMappingCoverageQuery, type GetLedgerMappingQuery, type GetLedgerPeriodCloseStatusQuery, type GetLedgerPeriodDraftsQuery, type GetLedgerReportingTaxonomyQuery, type GetLedgerScheduleFactsQuery, type GetLedgerSummaryQuery, type GetLedgerTransactionQuery, type GetLedgerTrialBalanceQuery, type ListLedgerAccountsQuery, type ListLedgerElementsQuery, type ListLedgerEntitiesQuery, type ListLedgerMappingsQuery, type ListLedgerSchedulesQuery, type ListLedgerStructuresQuery, type ListLedgerTaxonomiesQuery, type ListLedgerTransactionsQuery, type ListLedgerUnmappedElementsQuery } from './graphql/generated/graphql';
1
+ import type { AutoMapElementsOperation, BulkAssociationItem, CreateElementRequest, CreateMappingAssociationOperation, CreateStructureRequest, CreateTaxonomyRequest, CreateViewRequest, DeleteMappingAssociationOperation, LinkEntityTaxonomyRequest, OperationEnvelope, UpdateAssociationRequest, UpdateElementRequest, UpdateEntityRequest, UpdateJournalEntryRequest, UpdateScheduleRequest, UpdateStructureRequest, UpdateTaxonomyRequest } from '../types.gen';
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
4
  export type LedgerEntity = NonNullable<GetLedgerEntityQuery['entity']>;
4
5
  export type LedgerEntitySummary = ListLedgerEntitiesQuery['entities'][number];
5
6
  export type LedgerSummary = NonNullable<GetLedgerSummaryQuery['summary']>;
@@ -36,6 +37,34 @@ export type LedgerDraftLineItem = LedgerDraftEntry['lineItems'][number];
36
37
  export type LedgerClosingBookStructures = NonNullable<GetLedgerClosingBookStructuresQuery['closingBookStructures']>;
37
38
  export type LedgerFiscalCalendar = NonNullable<GetLedgerFiscalCalendarQuery['fiscalCalendar']>;
38
39
  export type LedgerFiscalPeriod = LedgerFiscalCalendar['periods'][number];
40
+ export type Report = NonNullable<GetLedgerReportQuery['report']>;
41
+ export type ReportListItem = NonNullable<ListLedgerReportsQuery['reports']>['reports'][number];
42
+ export type StatementData = NonNullable<GetLedgerStatementQuery['statement']>;
43
+ export type StatementPeriod = StatementData['periods'][number];
44
+ export type StatementRow = StatementData['rows'][number];
45
+ export type PublishList = NonNullable<ListLedgerPublishListsQuery['publishLists']>['publishLists'][number];
46
+ export type PublishListDetail = NonNullable<GetLedgerPublishListQuery['publishList']>;
47
+ export type PublishListMember = PublishListDetail['members'][number];
48
+ export interface PeriodSpecInput {
49
+ start: string;
50
+ end: string;
51
+ label: string;
52
+ }
53
+ export interface CreateReportOptions {
54
+ name: string;
55
+ mappingId: string;
56
+ periodStart: string;
57
+ periodEnd: string;
58
+ taxonomyId?: string;
59
+ periodType?: string;
60
+ comparative?: boolean;
61
+ periods?: PeriodSpecInput[];
62
+ }
63
+ export interface ReportOperationAck {
64
+ operationId: string;
65
+ status: OperationEnvelope['status'];
66
+ result: Record<string, unknown> | null;
67
+ }
39
68
  export interface InitializeLedgerResult {
40
69
  fiscalCalendar: LedgerFiscalCalendar;
41
70
  periodsCreated: number;
@@ -121,11 +150,32 @@ export interface CreateScheduleOptions {
121
150
  assetElementId?: string;
122
151
  };
123
152
  }
153
+ export interface JournalEntryLineItem {
154
+ elementId: string;
155
+ debitAmount?: number;
156
+ creditAmount?: number;
157
+ description?: string | null;
158
+ }
159
+ export interface CreateJournalEntryOptions {
160
+ postingDate: string;
161
+ memo: string;
162
+ lineItems: JournalEntryLineItem[];
163
+ type?: LedgerEntryType;
164
+ status?: 'draft' | 'posted';
165
+ transactionId?: string | null;
166
+ idempotencyKey?: string | null;
167
+ }
124
168
  interface LedgerClientConfig {
125
169
  baseUrl: string;
126
170
  credentials?: 'include' | 'same-origin' | 'omit';
127
171
  headers?: Record<string, string>;
172
+ /** Static credential — use `tokenProvider` instead if the JWT rotates. */
128
173
  token?: string;
174
+ /**
175
+ * Dynamic credential callback. When set, invoked on every GraphQL
176
+ * request so refreshes flow through automatically.
177
+ */
178
+ tokenProvider?: TokenProvider;
129
179
  }
130
180
  export declare class LedgerClient {
131
181
  private config;
@@ -195,6 +245,15 @@ export declare class LedgerClient {
195
245
  }): Promise<LedgerTaxonomy[]>;
196
246
  /** Create a new taxonomy (used for CoA + mapping taxonomies). */
197
247
  createTaxonomy(graphId: string, body: CreateTaxonomyRequest): Promise<Record<string, unknown>>;
248
+ /** Update mutable fields on a taxonomy. `taxonomy_type` is immutable. */
249
+ updateTaxonomy(graphId: string, body: UpdateTaxonomyRequest): Promise<Record<string, unknown>>;
250
+ /** Soft-delete a taxonomy (`is_active=false`). */
251
+ deleteTaxonomy(graphId: string, taxonomyId: string): Promise<Record<string, unknown>>;
252
+ /**
253
+ * Link the graph's entity to a taxonomy (ENTITY_HAS_TAXONOMY edge).
254
+ * Idempotent — returns existing linkage if already present.
255
+ */
256
+ linkEntityTaxonomy(graphId: string, body: LinkEntityTaxonomyRequest): Promise<Record<string, unknown>>;
198
257
  /** List elements (CoA accounts, GAAP concepts, etc.) with filters. */
199
258
  listElements(graphId: string, options?: {
200
259
  taxonomyId?: string;
@@ -208,6 +267,12 @@ export declare class LedgerClient {
208
267
  listUnmappedElements(graphId: string, options?: {
209
268
  mappingId?: string;
210
269
  }): Promise<LedgerUnmappedElement[]>;
270
+ /** Create a new element within a taxonomy (native CoA account, etc.). */
271
+ createElement(graphId: string, body: CreateElementRequest): Promise<Record<string, unknown>>;
272
+ /** Update mutable fields on an element. `taxonomy_id` and `source` are immutable. */
273
+ updateElement(graphId: string, body: UpdateElementRequest): Promise<Record<string, unknown>>;
274
+ /** Soft-delete an element (`is_active=false`). */
275
+ deleteElement(graphId: string, elementId: string): Promise<Record<string, unknown>>;
211
276
  /** List reporting structures (IS, BS, CF, schedules) with optional filters. */
212
277
  listStructures(graphId: string, options?: {
213
278
  taxonomyId?: string;
@@ -218,6 +283,16 @@ export declare class LedgerClient {
218
283
  * structure; also used for custom statement + schedule structures.
219
284
  */
220
285
  createStructure(graphId: string, body: CreateStructureRequest): Promise<LedgerMappingInfo>;
286
+ /** Convenience wrapper — create a CoA→GAAP mapping structure. */
287
+ createMappingStructure(graphId: string, options?: {
288
+ name?: string;
289
+ description?: string | null;
290
+ taxonomyId?: string;
291
+ }): Promise<LedgerMappingInfo>;
292
+ /** Update mutable fields on a structure. `structure_type` is immutable. */
293
+ updateStructure(graphId: string, body: UpdateStructureRequest): Promise<Record<string, unknown>>;
294
+ /** Soft-delete a structure (`is_active=false`). */
295
+ deleteStructure(graphId: string, structureId: string): Promise<Record<string, unknown>>;
221
296
  /** List active CoA→reporting mapping structures. */
222
297
  listMappings(graphId: string): Promise<LedgerMappingInfo[]>;
223
298
  /** Get a mapping structure with all its associations. */
@@ -239,6 +314,14 @@ export declare class LedgerClient {
239
314
  operationId: string;
240
315
  status: OperationEnvelope['status'];
241
316
  }>;
317
+ /** Bulk create associations within a single structure, atomically. */
318
+ createAssociations(graphId: string, structureId: string, associations: BulkAssociationItem[]): Promise<Record<string, unknown>>;
319
+ /** Update mutable fields on an association (order, weight, confidence). */
320
+ updateAssociation(graphId: string, body: UpdateAssociationRequest): Promise<Record<string, unknown>>;
321
+ /** Hard-delete an association (any type: presentation, calculation, mapping). */
322
+ deleteAssociation(graphId: string, associationId: string): Promise<{
323
+ deleted: boolean;
324
+ }>;
242
325
  /** List all schedule structures with metadata. */
243
326
  listSchedules(graphId: string): Promise<LedgerSchedule[]>;
244
327
  /** Schedule facts optionally filtered by period window. */
@@ -248,6 +331,12 @@ export declare class LedgerClient {
248
331
  }): Promise<LedgerScheduleFact[]>;
249
332
  /** Create a new schedule with pre-generated monthly facts. */
250
333
  createSchedule(graphId: string, options: CreateScheduleOptions): Promise<ScheduleCreated>;
334
+ /** Update mutable fields on a schedule (name, entry_template, metadata). */
335
+ updateSchedule(graphId: string, body: UpdateScheduleRequest): Promise<Record<string, unknown>>;
336
+ /** Permanently delete a schedule (cascades through facts + associations). */
337
+ deleteSchedule(graphId: string, structureId: string): Promise<{
338
+ deleted: boolean;
339
+ }>;
251
340
  /** Truncate a schedule — end it early at `newEndDate`. */
252
341
  truncateSchedule(graphId: string, structureId: string, options: TruncateScheduleOptions): Promise<TruncateScheduleResult>;
253
342
  /** Close status for all schedules in a fiscal period. */
@@ -276,11 +365,95 @@ export declare class LedgerClient {
276
365
  closePeriod(graphId: string, period: string, options?: ClosePeriodOptions): Promise<ClosePeriodResult>;
277
366
  /** Reopen a closed fiscal period. Requires a reason for the audit log. */
278
367
  reopenPeriod(graphId: string, period: string, reason: string, note?: string | null): Promise<LedgerFiscalCalendar>;
368
+ /**
369
+ * Create a journal entry with balanced line items (DR=CR enforced).
370
+ *
371
+ * Defaults to `status='draft'`. Pass `status='posted'` for historical
372
+ * data import where entries represent already-happened business events.
373
+ *
374
+ * Supply `idempotencyKey` to make the call safe to retry — replays
375
+ * within 24 hours return the same envelope. Reusing the key with a
376
+ * different body returns HTTP 409.
377
+ */
378
+ createJournalEntry(graphId: string, options: CreateJournalEntryOptions): Promise<Record<string, unknown>>;
379
+ /** Update a draft journal entry. Posted entries are immutable. */
380
+ updateJournalEntry(graphId: string, body: UpdateJournalEntryRequest): Promise<Record<string, unknown>>;
381
+ /** Hard-delete a draft journal entry. Posted entries must be reversed. */
382
+ deleteJournalEntry(graphId: string, entryId: string): Promise<{
383
+ deleted: boolean;
384
+ }>;
385
+ /**
386
+ * Reverse a posted journal entry — creates an offsetting entry and marks
387
+ * the original as reversed.
388
+ */
389
+ reverseJournalEntry(graphId: string, entryId: string, options?: {
390
+ postingDate?: string | null;
391
+ memo?: string | null;
392
+ }): Promise<Record<string, unknown>>;
393
+ /**
394
+ * Build a multi-dimensional fact grid against the graph schema.
395
+ *
396
+ * Runs against LadybugDB (not the extensions OLTP database) and returns
397
+ * a deduplicated pivot table of XBRL facts. Works for both roboledger
398
+ * tenant graphs (after materialization) and the SEC shared repository.
399
+ */
400
+ buildFactGrid(graphId: string, body: CreateViewRequest): Promise<Record<string, unknown>>;
279
401
  /**
280
402
  * Run a typed GraphQL query against the per-graph endpoint and
281
403
  * translate ClientError into a readable facade error.
282
404
  */
283
405
  private gqlQuery;
406
+ /**
407
+ * Kick off report creation (async). Use the returned `operationId` to
408
+ * subscribe to progress via SSE, then call `getReport()` once finished.
409
+ */
410
+ createReport(graphId: string, options: CreateReportOptions): Promise<ReportOperationAck>;
411
+ /** List all reports for a graph (includes received shared reports). */
412
+ listReports(graphId: string): Promise<ReportListItem[]>;
413
+ /** Get a single report with its period list + available structures. */
414
+ getReport(graphId: string, reportId: string): Promise<Report | null>;
415
+ /**
416
+ * Render a financial statement — facts viewed through a structure.
417
+ *
418
+ * @param structureType - income_statement, balance_sheet, cash_flow_statement
419
+ */
420
+ getStatement(graphId: string, reportId: string, structureType: string): Promise<StatementData | null>;
421
+ /**
422
+ * Regenerate an existing report (async). Returns an operation id;
423
+ * subscribe via SSE for progress.
424
+ */
425
+ regenerateReport(graphId: string, reportId: string, periodStart?: string, periodEnd?: string): Promise<ReportOperationAck>;
426
+ /** Delete a report and its generated facts. */
427
+ deleteReport(graphId: string, reportId: string): Promise<void>;
428
+ /**
429
+ * Share a published report to every member of a publish list (async).
430
+ * Each target graph receives a snapshot copy of the report's facts.
431
+ */
432
+ shareReport(graphId: string, reportId: string, publishListId: string): Promise<ReportOperationAck>;
433
+ /** Check if a report was received via sharing (vs locally created). */
434
+ isSharedReport(report: Report): boolean;
435
+ /** List publish lists with pagination. */
436
+ listPublishLists(graphId: string, options?: {
437
+ limit?: number;
438
+ offset?: number;
439
+ }): Promise<PublishList[]>;
440
+ /** Create a new publish list. */
441
+ createPublishList(graphId: string, name: string, description?: string): Promise<Record<string, unknown>>;
442
+ /** Get a single publish list with its full member list. */
443
+ getPublishList(graphId: string, listId: string): Promise<PublishListDetail | null>;
444
+ /** Update a publish list's name or description. */
445
+ updatePublishList(graphId: string, listId: string, updates: {
446
+ name?: string;
447
+ description?: string | null;
448
+ }): Promise<Record<string, unknown>>;
449
+ /** Delete a publish list. */
450
+ deletePublishList(graphId: string, listId: string): Promise<void>;
451
+ /** Add target graphs as members of a publish list. */
452
+ addPublishListMembers(graphId: string, listId: string, targetGraphIds: string[]): Promise<Record<string, unknown>>;
453
+ /** Remove a single member from a publish list. */
454
+ removePublishListMember(graphId: string, listId: string, memberId: string): Promise<{
455
+ deleted: boolean;
456
+ }>;
284
457
  /**
285
458
  * Await an SDK-generated `opXxx(...)` call, throw a readable error on
286
459
  * non-2xx, and return the `OperationEnvelope` on success.
@@ -107,6 +107,25 @@ class LedgerClient {
107
107
  const envelope = await this.callOperation('Create taxonomy', (0, sdk_gen_1.opCreateTaxonomy)({ path: { graph_id: graphId }, body }));
108
108
  return (envelope.result ?? {});
109
109
  }
110
+ /** Update mutable fields on a taxonomy. `taxonomy_type` is immutable. */
111
+ async updateTaxonomy(graphId, body) {
112
+ const envelope = await this.callOperation('Update taxonomy', (0, sdk_gen_1.opUpdateTaxonomy)({ path: { graph_id: graphId }, body }));
113
+ return (envelope.result ?? {});
114
+ }
115
+ /** Soft-delete a taxonomy (`is_active=false`). */
116
+ async deleteTaxonomy(graphId, taxonomyId) {
117
+ const body = { taxonomy_id: taxonomyId };
118
+ const envelope = await this.callOperation('Delete taxonomy', (0, sdk_gen_1.opDeleteTaxonomy)({ path: { graph_id: graphId }, body }));
119
+ return (envelope.result ?? {});
120
+ }
121
+ /**
122
+ * Link the graph's entity to a taxonomy (ENTITY_HAS_TAXONOMY edge).
123
+ * Idempotent — returns existing linkage if already present.
124
+ */
125
+ async linkEntityTaxonomy(graphId, body) {
126
+ const envelope = await this.callOperation('Link entity taxonomy', (0, sdk_gen_1.opLinkEntityTaxonomy)({ path: { graph_id: graphId }, body }));
127
+ return (envelope.result ?? {});
128
+ }
110
129
  /** List elements (CoA accounts, GAAP concepts, etc.) with filters. */
111
130
  async listElements(graphId, options) {
112
131
  return this.gqlQuery(graphId, graphql_1.ListLedgerElementsDocument, {
@@ -122,6 +141,22 @@ class LedgerClient {
122
141
  async listUnmappedElements(graphId, options) {
123
142
  return this.gqlQuery(graphId, graphql_1.ListLedgerUnmappedElementsDocument, { mappingId: options?.mappingId ?? null }, 'List unmapped elements', (data) => data.unmappedElements);
124
143
  }
144
+ /** Create a new element within a taxonomy (native CoA account, etc.). */
145
+ async createElement(graphId, body) {
146
+ const envelope = await this.callOperation('Create element', (0, sdk_gen_1.opCreateElement)({ path: { graph_id: graphId }, body }));
147
+ return (envelope.result ?? {});
148
+ }
149
+ /** Update mutable fields on an element. `taxonomy_id` and `source` are immutable. */
150
+ async updateElement(graphId, body) {
151
+ const envelope = await this.callOperation('Update element', (0, sdk_gen_1.opUpdateElement)({ path: { graph_id: graphId }, body }));
152
+ return (envelope.result ?? {});
153
+ }
154
+ /** Soft-delete an element (`is_active=false`). */
155
+ async deleteElement(graphId, elementId) {
156
+ const body = { element_id: elementId };
157
+ const envelope = await this.callOperation('Delete element', (0, sdk_gen_1.opDeleteElement)({ path: { graph_id: graphId }, body }));
158
+ return (envelope.result ?? {});
159
+ }
125
160
  // ── Structures ──────────────────────────────────────────────────────
126
161
  /** List reporting structures (IS, BS, CF, schedules) with optional filters. */
127
162
  async listStructures(graphId, options) {
@@ -139,6 +174,28 @@ class LedgerClient {
139
174
  const envelope = await this.callOperation('Create structure', (0, sdk_gen_1.opCreateStructure)({ path: { graph_id: graphId }, body }));
140
175
  return envelope.result;
141
176
  }
177
+ /** Convenience wrapper — create a CoA→GAAP mapping structure. */
178
+ async createMappingStructure(graphId, options) {
179
+ const body = {
180
+ name: options?.name ?? 'CoA to Reporting',
181
+ structure_type: 'coa_mapping',
182
+ taxonomy_id: options?.taxonomyId ?? 'tax_usgaap_reporting',
183
+ description: options?.description ?? 'Map Chart of Accounts to US GAAP reporting concepts',
184
+ };
185
+ const envelope = await this.callOperation('Create mapping structure', (0, sdk_gen_1.opCreateStructure)({ path: { graph_id: graphId }, body }));
186
+ return envelope.result;
187
+ }
188
+ /** Update mutable fields on a structure. `structure_type` is immutable. */
189
+ async updateStructure(graphId, body) {
190
+ const envelope = await this.callOperation('Update structure', (0, sdk_gen_1.opUpdateStructure)({ path: { graph_id: graphId }, body }));
191
+ return (envelope.result ?? {});
192
+ }
193
+ /** Soft-delete a structure (`is_active=false`). */
194
+ async deleteStructure(graphId, structureId) {
195
+ const body = { structure_id: structureId };
196
+ const envelope = await this.callOperation('Delete structure', (0, sdk_gen_1.opDeleteStructure)({ path: { graph_id: graphId }, body }));
197
+ return (envelope.result ?? {});
198
+ }
142
199
  // ── Mappings ────────────────────────────────────────────────────────
143
200
  /** List active CoA→reporting mapping structures. */
144
201
  async listMappings(graphId) {
@@ -172,6 +229,23 @@ class LedgerClient {
172
229
  const envelope = await this.callOperation('Auto-map elements', (0, sdk_gen_1.opAutoMapElements)({ path: { graph_id: graphId }, body }));
173
230
  return { operationId: envelope.operationId, status: envelope.status };
174
231
  }
232
+ /** Bulk create associations within a single structure, atomically. */
233
+ async createAssociations(graphId, structureId, associations) {
234
+ const body = { structure_id: structureId, associations };
235
+ const envelope = await this.callOperation('Create associations', (0, sdk_gen_1.opCreateAssociations)({ path: { graph_id: graphId }, body }));
236
+ return (envelope.result ?? {});
237
+ }
238
+ /** Update mutable fields on an association (order, weight, confidence). */
239
+ async updateAssociation(graphId, body) {
240
+ const envelope = await this.callOperation('Update association', (0, sdk_gen_1.opUpdateAssociation)({ path: { graph_id: graphId }, body }));
241
+ return (envelope.result ?? {});
242
+ }
243
+ /** Hard-delete an association (any type: presentation, calculation, mapping). */
244
+ async deleteAssociation(graphId, associationId) {
245
+ const body = { association_id: associationId };
246
+ const envelope = await this.callOperation('Delete association', (0, sdk_gen_1.opDeleteAssociation)({ path: { graph_id: graphId }, body }));
247
+ return (envelope.result ?? { deleted: true });
248
+ }
175
249
  // ── Schedules ──────────────────────────────────────────────────────
176
250
  /** List all schedule structures with metadata. */
177
251
  async listSchedules(graphId) {
@@ -222,6 +296,17 @@ class LedgerClient {
222
296
  totalFacts: raw.total_facts,
223
297
  };
224
298
  }
299
+ /** Update mutable fields on a schedule (name, entry_template, metadata). */
300
+ async updateSchedule(graphId, body) {
301
+ const envelope = await this.callOperation('Update schedule', (0, sdk_gen_1.opUpdateSchedule)({ path: { graph_id: graphId }, body }));
302
+ return (envelope.result ?? {});
303
+ }
304
+ /** Permanently delete a schedule (cascades through facts + associations). */
305
+ async deleteSchedule(graphId, structureId) {
306
+ const body = { structure_id: structureId };
307
+ const envelope = await this.callOperation('Delete schedule', (0, sdk_gen_1.opDeleteSchedule)({ path: { graph_id: graphId }, body }));
308
+ return (envelope.result ?? { deleted: true });
309
+ }
225
310
  /** Truncate a schedule — end it early at `newEndDate`. */
226
311
  async truncateSchedule(graphId, structureId, options) {
227
312
  const body = {
@@ -340,7 +425,71 @@ class LedgerClient {
340
425
  const envelope = await this.callOperation('Reopen period', (0, sdk_gen_1.opReopenPeriod)({ path: { graph_id: graphId }, body }));
341
426
  return rawFiscalCalendarToCamel(envelope.result);
342
427
  }
343
- // Reports, statements, and publish lists live on `ReportClient`.
428
+ // ── Journal entries (native accounting writes) ──────────────────────
429
+ /**
430
+ * Create a journal entry with balanced line items (DR=CR enforced).
431
+ *
432
+ * Defaults to `status='draft'`. Pass `status='posted'` for historical
433
+ * data import where entries represent already-happened business events.
434
+ *
435
+ * Supply `idempotencyKey` to make the call safe to retry — replays
436
+ * within 24 hours return the same envelope. Reusing the key with a
437
+ * different body returns HTTP 409.
438
+ */
439
+ async createJournalEntry(graphId, options) {
440
+ const body = {
441
+ posting_date: options.postingDate,
442
+ memo: options.memo,
443
+ line_items: options.lineItems.map((li) => ({
444
+ element_id: li.elementId,
445
+ debit_amount: li.debitAmount,
446
+ credit_amount: li.creditAmount,
447
+ description: li.description ?? null,
448
+ })),
449
+ type: options.type,
450
+ status: options.status,
451
+ transaction_id: options.transactionId ?? null,
452
+ };
453
+ const envelope = await this.callOperation('Create journal entry', (0, sdk_gen_1.opCreateJournalEntry)({ path: { graph_id: graphId }, body }));
454
+ return (envelope.result ?? {});
455
+ }
456
+ /** Update a draft journal entry. Posted entries are immutable. */
457
+ async updateJournalEntry(graphId, body) {
458
+ const envelope = await this.callOperation('Update journal entry', (0, sdk_gen_1.opUpdateJournalEntry)({ path: { graph_id: graphId }, body }));
459
+ return (envelope.result ?? {});
460
+ }
461
+ /** Hard-delete a draft journal entry. Posted entries must be reversed. */
462
+ async deleteJournalEntry(graphId, entryId) {
463
+ const body = { entry_id: entryId };
464
+ const envelope = await this.callOperation('Delete journal entry', (0, sdk_gen_1.opDeleteJournalEntry)({ path: { graph_id: graphId }, body }));
465
+ return (envelope.result ?? { deleted: true });
466
+ }
467
+ /**
468
+ * Reverse a posted journal entry — creates an offsetting entry and marks
469
+ * the original as reversed.
470
+ */
471
+ async reverseJournalEntry(graphId, entryId, options) {
472
+ const body = {
473
+ entry_id: entryId,
474
+ posting_date: options?.postingDate ?? null,
475
+ memo: options?.memo ?? null,
476
+ };
477
+ const envelope = await this.callOperation('Reverse journal entry', (0, sdk_gen_1.opReverseJournalEntry)({ path: { graph_id: graphId }, body }));
478
+ return (envelope.result ?? {});
479
+ }
480
+ // ── Fact grid (graph-backed analytical query) ─────────────────────
481
+ /**
482
+ * Build a multi-dimensional fact grid against the graph schema.
483
+ *
484
+ * Runs against LadybugDB (not the extensions OLTP database) and returns
485
+ * a deduplicated pivot table of XBRL facts. Works for both roboledger
486
+ * tenant graphs (after materialization) and the SEC shared repository.
487
+ */
488
+ async buildFactGrid(graphId, body) {
489
+ const envelope = await this.callOperation('Build fact grid', (0, sdk_gen_1.opBuildFactGrid)({ path: { graph_id: graphId }, body }));
490
+ return (envelope.result ?? {});
491
+ }
492
+ // ── Reports, statements, and publish lists ──────────────────────────────
344
493
  // ── Internal helpers ────────────────────────────────────────────────
345
494
  /**
346
495
  * Run a typed GraphQL query against the per-graph endpoint and
@@ -349,7 +498,6 @@ class LedgerClient {
349
498
  async gqlQuery(graphId, document, variables, label, pick) {
350
499
  try {
351
500
  const client = this.gql.get(graphId);
352
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
353
501
  const raw = client.request;
354
502
  // graphql-request's overloads don't cleanly resolve for generic
355
503
  // helpers wrapping codegen's `Exact<>` var types, so we bypass
@@ -364,6 +512,157 @@ class LedgerClient {
364
512
  throw err;
365
513
  }
366
514
  }
515
+ // ── Reports ─────────────────────────────────────────────────────────
516
+ /**
517
+ * Kick off report creation (async). Use the returned `operationId` to
518
+ * subscribe to progress via SSE, then call `getReport()` once finished.
519
+ */
520
+ async createReport(graphId, options) {
521
+ const body = {
522
+ name: options.name,
523
+ mapping_id: options.mappingId,
524
+ period_start: options.periodStart,
525
+ period_end: options.periodEnd,
526
+ taxonomy_id: options.taxonomyId ?? 'tax_usgaap_reporting',
527
+ period_type: options.periodType ?? 'quarterly',
528
+ comparative: options.comparative ?? true,
529
+ };
530
+ if (options.periods && options.periods.length > 0) {
531
+ body.periods = options.periods;
532
+ }
533
+ const envelope = await this.callOperation('Create report', (0, sdk_gen_1.opCreateReport)({ path: { graph_id: graphId }, body }));
534
+ return {
535
+ operationId: envelope.operationId,
536
+ status: envelope.status,
537
+ result: envelope.result ?? null,
538
+ };
539
+ }
540
+ /** List all reports for a graph (includes received shared reports). */
541
+ async listReports(graphId) {
542
+ const list = await this.gqlQuery(graphId, graphql_1.ListLedgerReportsDocument, undefined, 'List reports', (data) => data.reports);
543
+ return list?.reports ?? [];
544
+ }
545
+ /** Get a single report with its period list + available structures. */
546
+ async getReport(graphId, reportId) {
547
+ return this.gqlQuery(graphId, graphql_1.GetLedgerReportDocument, { reportId }, 'Get report', (data) => data.report);
548
+ }
549
+ /**
550
+ * Render a financial statement — facts viewed through a structure.
551
+ *
552
+ * @param structureType - income_statement, balance_sheet, cash_flow_statement
553
+ */
554
+ async getStatement(graphId, reportId, structureType) {
555
+ return this.gqlQuery(graphId, graphql_1.GetLedgerStatementDocument, { reportId, structureType }, 'Get statement', (data) => data.statement);
556
+ }
557
+ /**
558
+ * Regenerate an existing report (async). Returns an operation id;
559
+ * subscribe via SSE for progress.
560
+ */
561
+ async regenerateReport(graphId, reportId, periodStart, periodEnd) {
562
+ const envelope = await this.callOperation('Regenerate report', (0, sdk_gen_1.opRegenerateReport)({
563
+ path: { graph_id: graphId },
564
+ body: {
565
+ report_id: reportId,
566
+ period_start: periodStart,
567
+ period_end: periodEnd,
568
+ },
569
+ }));
570
+ return {
571
+ operationId: envelope.operationId,
572
+ status: envelope.status,
573
+ result: envelope.result ?? null,
574
+ };
575
+ }
576
+ /** Delete a report and its generated facts. */
577
+ async deleteReport(graphId, reportId) {
578
+ await this.callOperation('Delete report', (0, sdk_gen_1.opDeleteReport)({
579
+ path: { graph_id: graphId },
580
+ body: { report_id: reportId },
581
+ }));
582
+ }
583
+ /**
584
+ * Share a published report to every member of a publish list (async).
585
+ * Each target graph receives a snapshot copy of the report's facts.
586
+ */
587
+ async shareReport(graphId, reportId, publishListId) {
588
+ const envelope = await this.callOperation('Share report', (0, sdk_gen_1.opShareReport)({
589
+ path: { graph_id: graphId },
590
+ body: {
591
+ report_id: reportId,
592
+ publish_list_id: publishListId,
593
+ },
594
+ }));
595
+ return {
596
+ operationId: envelope.operationId,
597
+ status: envelope.status,
598
+ result: envelope.result ?? null,
599
+ };
600
+ }
601
+ /** Check if a report was received via sharing (vs locally created). */
602
+ isSharedReport(report) {
603
+ return report.sourceGraphId !== null;
604
+ }
605
+ // ── Publish Lists ────────────────────────────────────────────────────
606
+ /** List publish lists with pagination. */
607
+ async listPublishLists(graphId, options) {
608
+ const list = await this.gqlQuery(graphId, graphql_1.ListLedgerPublishListsDocument, {
609
+ limit: options?.limit ?? 100,
610
+ offset: options?.offset ?? 0,
611
+ }, 'List publish lists', (data) => data.publishLists);
612
+ return list?.publishLists ?? [];
613
+ }
614
+ /** Create a new publish list. */
615
+ async createPublishList(graphId, name, description) {
616
+ const body = {
617
+ name,
618
+ description: description ?? null,
619
+ };
620
+ const envelope = await this.callOperation('Create publish list', (0, sdk_gen_1.opCreatePublishList)({ path: { graph_id: graphId }, body }));
621
+ return (envelope.result ?? {});
622
+ }
623
+ /** Get a single publish list with its full member list. */
624
+ async getPublishList(graphId, listId) {
625
+ return this.gqlQuery(graphId, graphql_1.GetLedgerPublishListDocument, { listId }, 'Get publish list', (data) => data.publishList);
626
+ }
627
+ /** Update a publish list's name or description. */
628
+ async updatePublishList(graphId, listId, updates) {
629
+ const envelope = await this.callOperation('Update publish list', (0, sdk_gen_1.opUpdatePublishList)({
630
+ path: { graph_id: graphId },
631
+ body: {
632
+ list_id: listId,
633
+ name: updates.name,
634
+ description: updates.description ?? null,
635
+ },
636
+ }));
637
+ return (envelope.result ?? {});
638
+ }
639
+ /** Delete a publish list. */
640
+ async deletePublishList(graphId, listId) {
641
+ await this.callOperation('Delete publish list', (0, sdk_gen_1.opDeletePublishList)({
642
+ path: { graph_id: graphId },
643
+ body: { list_id: listId },
644
+ }));
645
+ }
646
+ /** Add target graphs as members of a publish list. */
647
+ async addPublishListMembers(graphId, listId, targetGraphIds) {
648
+ const envelope = await this.callOperation('Add publish list members', (0, sdk_gen_1.opAddPublishListMembers)({
649
+ path: { graph_id: graphId },
650
+ body: {
651
+ list_id: listId,
652
+ target_graph_ids: targetGraphIds,
653
+ },
654
+ }));
655
+ return (envelope.result ?? {});
656
+ }
657
+ /** Remove a single member from a publish list. */
658
+ async removePublishListMember(graphId, listId, memberId) {
659
+ const envelope = await this.callOperation('Remove publish list member', (0, sdk_gen_1.opRemovePublishListMember)({
660
+ path: { graph_id: graphId },
661
+ body: { list_id: listId, member_id: memberId },
662
+ }));
663
+ return (envelope.result ?? { deleted: true });
664
+ }
665
+ // ── Internal helpers ────────────────────────────────────────────────
367
666
  /**
368
667
  * Await an SDK-generated `opXxx(...)` call, throw a readable error on
369
668
  * non-2xx, and return the `OperationEnvelope` on success.