@robosystems/client 1.13.2 → 1.14.1

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 (60) hide show
  1. package/artifacts/LedgerClient.d.ts +26 -1
  2. package/artifacts/LedgerClient.js +27 -1
  3. package/artifacts/LedgerClient.ts +53 -1
  4. package/artifacts/OperatorClient.js +2 -2
  5. package/artifacts/OperatorClient.ts +3 -2
  6. package/artifacts/QueryClient.js +1 -1
  7. package/artifacts/QueryClient.ts +1 -1
  8. package/artifacts/SSEClient.js +1 -1
  9. package/artifacts/SSEClient.ts +2 -1
  10. package/artifacts/graphql/client.js +1 -1
  11. package/artifacts/graphql/client.ts +2 -1
  12. package/artifacts/graphql/generated/graphql.d.ts +312 -2526
  13. package/artifacts/graphql/generated/graphql.js +173 -2
  14. package/artifacts/graphql/generated/graphql.ts +493 -2658
  15. package/artifacts/graphql/queries/ledger/journalEntries.d.ts +14 -0
  16. package/artifacts/graphql/queries/ledger/journalEntries.js +75 -0
  17. package/artifacts/graphql/queries/ledger/journalEntries.ts +73 -0
  18. package/client/index.d.ts +2 -0
  19. package/client/index.ts +2 -0
  20. package/client/utils.gen.d.ts +1 -1
  21. package/client/utils.gen.ts +2 -2
  22. package/client.gen.d.ts +2 -2
  23. package/client.gen.ts +2 -2
  24. package/core/auth.gen.d.ts +7 -0
  25. package/core/auth.gen.ts +7 -0
  26. package/core/params.gen.d.ts +2 -2
  27. package/core/params.gen.js +21 -13
  28. package/core/params.gen.ts +21 -12
  29. package/core/pathSerializer.gen.ts +6 -6
  30. package/core/queryKeySerializer.gen.d.ts +1 -1
  31. package/core/queryKeySerializer.gen.ts +1 -1
  32. package/core/types.gen.d.ts +5 -0
  33. package/core/types.gen.ts +6 -0
  34. package/core/utils.gen.ts +4 -4
  35. package/package.json +11 -8
  36. package/sdk/client/index.d.ts +2 -0
  37. package/sdk/client/index.ts +2 -0
  38. package/sdk/client/utils.gen.d.ts +1 -1
  39. package/sdk/client/utils.gen.ts +2 -2
  40. package/sdk/client.gen.d.ts +2 -2
  41. package/sdk/client.gen.ts +2 -2
  42. package/sdk/core/auth.gen.d.ts +7 -0
  43. package/sdk/core/auth.gen.ts +7 -0
  44. package/sdk/core/params.gen.d.ts +2 -2
  45. package/sdk/core/params.gen.js +21 -13
  46. package/sdk/core/params.gen.ts +21 -12
  47. package/sdk/core/pathSerializer.gen.ts +6 -6
  48. package/sdk/core/queryKeySerializer.gen.d.ts +1 -1
  49. package/sdk/core/queryKeySerializer.gen.ts +1 -1
  50. package/sdk/core/types.gen.d.ts +5 -0
  51. package/sdk/core/types.gen.ts +6 -0
  52. package/sdk/core/utils.gen.ts +4 -4
  53. package/sdk/sdk.gen.d.ts +199 -199
  54. package/sdk/sdk.gen.ts +199 -199
  55. package/sdk/types.gen.d.ts +35 -2
  56. package/sdk/types.gen.ts +35 -2
  57. package/sdk.gen.d.ts +199 -199
  58. package/sdk.gen.ts +199 -199
  59. package/types.gen.d.ts +35 -2
  60. package/types.gen.ts +35 -2
@@ -1,6 +1,6 @@
1
1
  import type { AssociationResponse, AutoMapElementsOperation, BindTextBlockRequest, BindTextBlockResponse, BlockedSourceGraphResponse, BlockSourceGraphResult, ComputeMetricsRequest, ComputeMetricsResponse, CreateAgentRequest, CreateEventBlockRequest, CreateEventHandlerRequest, CreateInformationBlockRequest, CreateMappingAssociationOperation, CreateTaxonomyBlockRequest, CreateViewRequest, DeleteInformationBlockRequest, DeleteInformationBlockResponse, DeleteMappingAssociationOperation, DeleteResult, DeleteTaxonomyBlockRequest, DeleteTaxonomyBlockResponse, EntityTaxonomyResponse, EvaluateRulesRequest, EvaluateRulesResponse, EventBlockEnvelope, EventHandlerResponse, FinancialStatementAnalysisRequest, FinancialStatementAnalysisResponse, InformationBlockEnvelope, JournalEntryResponse, LedgerAgentResponse, LinkEntityTaxonomyRequest, LiveFinancialStatementRequest, LiveFinancialStatementResponse, OperationEnvelope, PreviewEventBlockResponse, PublishListMemberResponse, PublishListResponse, ReportResponse, RevokeReportShareResponse, ShareReportResponse, TaxonomyBlockEnvelope, UpdateAgentRequest, UpdateEntityRequest, UpdateEventBlockRequest, UpdateEventHandlerRequest, UpdateInformationBlockRequest, UpdateJournalEntryRequest, UpdateTaxonomyBlockRequest, ViewResponse } from '../types.gen';
2
2
  import type { TokenProvider } from './graphql/client';
3
- import { type GetInformationBlockQuery, type GetLedgerAccountRollupsQuery, type GetLedgerAccountTreeQuery, type GetLedgerAgentQuery, type GetLedgerClosingBookStructuresQuery, type GetLedgerEntityQuery, type GetLedgerEventBlockQuery, type GetLedgerFiscalCalendarQuery, type GetLedgerMappedTrialBalanceQuery, type GetLedgerMappingCoverageQuery, type GetLedgerMappingQuery, type GetLedgerPeriodCloseStatusQuery, type GetLedgerPeriodDraftsQuery, type GetLedgerPublishListQuery, type GetLedgerReportingTaxonomyQuery, type GetLedgerReportPackageQuery, type GetLedgerReportQuery, type GetLedgerStatementQuery, type GetLedgerSummaryQuery, type GetLedgerTransactionQuery, type GetLedgerTrialBalanceQuery, type ListInformationBlocksQuery, type ListLedgerAccountsQuery, type ListLedgerAgentsQuery, type ListLedgerBlockedSourceGraphsQuery, type ListLedgerElementsQuery, type ListLedgerEntitiesQuery, type ListLedgerEventBlocksQuery, type ListLedgerMappingsQuery, type ListLedgerPublishListsQuery, type ListLedgerReportsQuery, type ListLedgerStructuresQuery, type ListLedgerTaxonomiesQuery, type ListLedgerTransactionsQuery, type ListLedgerUnmappedElementsQuery, type MappingCandidatesQuery, type ReportDownloadFormat } from './graphql/generated/graphql';
3
+ import { type GetInformationBlockQuery, type GetLedgerAccountRollupsQuery, type GetLedgerAccountTreeQuery, type GetLedgerAgentQuery, type GetLedgerClosingBookStructuresQuery, type GetLedgerEntityQuery, type GetLedgerEventBlockQuery, type GetLedgerFiscalCalendarQuery, type GetLedgerMappedTrialBalanceQuery, type GetLedgerMappingCoverageQuery, type GetLedgerMappingQuery, type GetLedgerPeriodCloseStatusQuery, type GetLedgerPeriodDraftsQuery, type GetLedgerPublishListQuery, type GetLedgerReportingTaxonomyQuery, type GetLedgerReportPackageQuery, type GetLedgerReportQuery, type GetLedgerStatementQuery, type GetLedgerSummaryQuery, type GetLedgerTransactionQuery, type GetLedgerTrialBalanceQuery, type ListInformationBlocksQuery, type ListLedgerAccountsQuery, type ListLedgerAgentsQuery, type ListLedgerBlockedSourceGraphsQuery, type ListLedgerElementsQuery, type ListLedgerEntitiesQuery, type ListLedgerEventBlocksQuery, type ListLedgerJournalEntriesQuery, type ListLedgerMappingsQuery, type ListLedgerPublishListsQuery, type ListLedgerReportsQuery, type ListLedgerStructuresQuery, type ListLedgerTaxonomiesQuery, type ListLedgerTransactionsQuery, type ListLedgerUnmappedElementsQuery, type MappingCandidatesQuery, type ReportDownloadFormat } from './graphql/generated/graphql';
4
4
  export { GraphQLError } from './graphql/client';
5
5
  export type LedgerEntity = NonNullable<GetLedgerEntityQuery['entity']>;
6
6
  export type LedgerEntitySummary = ListLedgerEntitiesQuery['entities'][number];
@@ -14,6 +14,8 @@ export type LedgerMappedTrialBalance = NonNullable<GetLedgerMappedTrialBalanceQu
14
14
  export type LedgerTransactionList = NonNullable<ListLedgerTransactionsQuery['transactions']>;
15
15
  export type LedgerTransactionListItem = LedgerTransactionList['transactions'][number];
16
16
  export type LedgerTransaction = NonNullable<GetLedgerTransactionQuery['transaction']>;
17
+ export type LedgerJournalEntryList = NonNullable<ListLedgerJournalEntriesQuery['journalEntries']>;
18
+ export type LedgerJournalEntry = LedgerJournalEntryList['entries'][number];
17
19
  export type LedgerEventBlock = ListLedgerEventBlocksQuery['eventBlocks'][number];
18
20
  export type LedgerEventBlockDetail = NonNullable<GetLedgerEventBlockQuery['eventBlock']>;
19
21
  export type LedgerAgent = ListLedgerAgentsQuery['agents'][number];
@@ -283,6 +285,29 @@ export declare class LedgerClient {
283
285
  limit?: number;
284
286
  offset?: number;
285
287
  }): Promise<LedgerTransactionList | null>;
288
+ /**
289
+ * List journal entries with their line items, newest first.
290
+ *
291
+ * The entry-centric read. `listTransactions` walks transactions and hangs
292
+ * entries off them, so an entry with no parent transaction appears in
293
+ * nothing it returns — and the schedule engine and event handlers create
294
+ * exactly those, which is why everything a period close posts is absent
295
+ * from that surface. Here `transactionId` is null for a standalone entry
296
+ * rather than absent data.
297
+ *
298
+ * Filter by `provenance` (`schedule_derived` for what a close posted),
299
+ * `type` (`adjusting` / `closing`), `status`, or a parent `transactionId`.
300
+ */
301
+ listJournalEntries(graphId: string, options?: {
302
+ startDate?: string;
303
+ endDate?: string;
304
+ status?: string;
305
+ type?: string;
306
+ provenance?: string;
307
+ transactionId?: string;
308
+ limit?: number;
309
+ offset?: number;
310
+ }): Promise<LedgerJournalEntryList | null>;
286
311
  /** Get transaction detail with entries + line items. */
287
312
  getTransaction(graphId: string, transactionId: string): Promise<LedgerTransaction | null>;
288
313
  /**
@@ -84,6 +84,32 @@ class LedgerClient {
84
84
  offset: options?.offset ?? 0,
85
85
  }, 'List transactions', (data) => data.transactions);
86
86
  }
87
+ // ── Journal entries ─────────────────────────────────────────────────
88
+ /**
89
+ * List journal entries with their line items, newest first.
90
+ *
91
+ * The entry-centric read. `listTransactions` walks transactions and hangs
92
+ * entries off them, so an entry with no parent transaction appears in
93
+ * nothing it returns — and the schedule engine and event handlers create
94
+ * exactly those, which is why everything a period close posts is absent
95
+ * from that surface. Here `transactionId` is null for a standalone entry
96
+ * rather than absent data.
97
+ *
98
+ * Filter by `provenance` (`schedule_derived` for what a close posted),
99
+ * `type` (`adjusting` / `closing`), `status`, or a parent `transactionId`.
100
+ */
101
+ async listJournalEntries(graphId, options) {
102
+ return this.gqlQuery(graphId, graphql_1.ListLedgerJournalEntriesDocument, {
103
+ startDate: options?.startDate ?? null,
104
+ endDate: options?.endDate ?? null,
105
+ status: options?.status ?? null,
106
+ type: options?.type ?? null,
107
+ provenance: options?.provenance ?? null,
108
+ transactionId: options?.transactionId ?? null,
109
+ limit: options?.limit ?? 100,
110
+ offset: options?.offset ?? 0,
111
+ }, 'List journal entries', (data) => data.journalEntries);
112
+ }
87
113
  /** Get transaction detail with entries + line items. */
88
114
  async getTransaction(graphId, transactionId) {
89
115
  return this.gqlQuery(graphId, graphql_1.GetLedgerTransactionDocument, { transactionId }, 'Get transaction', (data) => data.transaction);
@@ -1146,7 +1172,7 @@ class LedgerClient {
1146
1172
  const detail = err instanceof Error ? err.message : String(err);
1147
1173
  throw new Error(`RoboSystems SDK: tokenProvider threw while resolving the request credential (${detail}). ` +
1148
1174
  'Fix the tokenProvider passed in the client config (or via setSDKClientConfig) so it ' +
1149
- 'returns the current token, or null to send an unauthenticated (cookie-based) request.');
1175
+ 'returns the current token, or null to send an unauthenticated (cookie-based) request.', { cause: err });
1150
1176
  }
1151
1177
  return token ?? null;
1152
1178
  }
@@ -169,6 +169,7 @@ import {
169
169
  ListLedgerElementsDocument,
170
170
  ListLedgerEntitiesDocument,
171
171
  ListLedgerEventBlocksDocument,
172
+ ListLedgerJournalEntriesDocument,
172
173
  ListLedgerMappingsDocument,
173
174
  ListLedgerPublishListsDocument,
174
175
  ListLedgerReportsDocument,
@@ -205,6 +206,7 @@ import {
205
206
  type ListLedgerElementsQuery,
206
207
  type ListLedgerEntitiesQuery,
207
208
  type ListLedgerEventBlocksQuery,
209
+ type ListLedgerJournalEntriesQuery,
208
210
  type ListLedgerMappingsQuery,
209
211
  type ListLedgerPublishListsQuery,
210
212
  type ListLedgerReportsQuery,
@@ -246,6 +248,9 @@ export type LedgerTransactionList = NonNullable<ListLedgerTransactionsQuery['tra
246
248
  export type LedgerTransactionListItem = LedgerTransactionList['transactions'][number]
247
249
  export type LedgerTransaction = NonNullable<GetLedgerTransactionQuery['transaction']>
248
250
 
251
+ export type LedgerJournalEntryList = NonNullable<ListLedgerJournalEntriesQuery['journalEntries']>
252
+ export type LedgerJournalEntry = LedgerJournalEntryList['entries'][number]
253
+
249
254
  export type LedgerEventBlock = ListLedgerEventBlocksQuery['eventBlocks'][number]
250
255
  export type LedgerEventBlockDetail = NonNullable<GetLedgerEventBlockQuery['eventBlock']>
251
256
 
@@ -749,6 +754,52 @@ export class LedgerClient {
749
754
  )
750
755
  }
751
756
 
757
+ // ── Journal entries ─────────────────────────────────────────────────
758
+
759
+ /**
760
+ * List journal entries with their line items, newest first.
761
+ *
762
+ * The entry-centric read. `listTransactions` walks transactions and hangs
763
+ * entries off them, so an entry with no parent transaction appears in
764
+ * nothing it returns — and the schedule engine and event handlers create
765
+ * exactly those, which is why everything a period close posts is absent
766
+ * from that surface. Here `transactionId` is null for a standalone entry
767
+ * rather than absent data.
768
+ *
769
+ * Filter by `provenance` (`schedule_derived` for what a close posted),
770
+ * `type` (`adjusting` / `closing`), `status`, or a parent `transactionId`.
771
+ */
772
+ async listJournalEntries(
773
+ graphId: string,
774
+ options?: {
775
+ startDate?: string
776
+ endDate?: string
777
+ status?: string
778
+ type?: string
779
+ provenance?: string
780
+ transactionId?: string
781
+ limit?: number
782
+ offset?: number
783
+ }
784
+ ): Promise<LedgerJournalEntryList | null> {
785
+ return this.gqlQuery(
786
+ graphId,
787
+ ListLedgerJournalEntriesDocument,
788
+ {
789
+ startDate: options?.startDate ?? null,
790
+ endDate: options?.endDate ?? null,
791
+ status: options?.status ?? null,
792
+ type: options?.type ?? null,
793
+ provenance: options?.provenance ?? null,
794
+ transactionId: options?.transactionId ?? null,
795
+ limit: options?.limit ?? 100,
796
+ offset: options?.offset ?? 0,
797
+ },
798
+ 'List journal entries',
799
+ (data) => data.journalEntries
800
+ )
801
+ }
802
+
752
803
  /** Get transaction detail with entries + line items. */
753
804
  async getTransaction(graphId: string, transactionId: string): Promise<LedgerTransaction | null> {
754
805
  return this.gqlQuery(
@@ -2516,7 +2567,8 @@ export class LedgerClient {
2516
2567
  throw new Error(
2517
2568
  `RoboSystems SDK: tokenProvider threw while resolving the request credential (${detail}). ` +
2518
2569
  'Fix the tokenProvider passed in the client config (or via setSDKClientConfig) so it ' +
2519
- 'returns the current token, or null to send an unauthenticated (cookie-based) request.'
2570
+ 'returns the current token, or null to send an unauthenticated (cookie-based) request.',
2571
+ { cause: err }
2520
2572
  )
2521
2573
  }
2522
2574
  return token ?? null
@@ -212,11 +212,11 @@ class OperatorClient {
212
212
  }
213
213
  catch (pollError) {
214
214
  if (pollError instanceof PollAbort) {
215
- throw new Error(pollError.message);
215
+ throw new Error(pollError.message, { cause: pollError });
216
216
  }
217
217
  consecutiveFailures += 1;
218
218
  if (consecutiveFailures >= MAX_CONSECUTIVE_POLL_FAILURES) {
219
- throw new Error(`Operator stream failed (${streamDetail}); status polling failed (${describeError(pollError)})`);
219
+ throw new Error(`Operator stream failed (${streamDetail}); status polling failed (${describeError(pollError)})`, { cause: pollError });
220
220
  }
221
221
  await sleep(interval);
222
222
  continue;
@@ -328,12 +328,13 @@ export class OperatorClient {
328
328
  consecutiveFailures = 0
329
329
  } catch (pollError) {
330
330
  if (pollError instanceof PollAbort) {
331
- throw new Error(pollError.message)
331
+ throw new Error(pollError.message, { cause: pollError })
332
332
  }
333
333
  consecutiveFailures += 1
334
334
  if (consecutiveFailures >= MAX_CONSECUTIVE_POLL_FAILURES) {
335
335
  throw new Error(
336
- `Operator stream failed (${streamDetail}); status polling failed (${describeError(pollError)})`
336
+ `Operator stream failed (${streamDetail}); status polling failed (${describeError(pollError)})`,
337
+ { cause: pollError }
337
338
  )
338
339
  }
339
340
  await sleep(interval)
@@ -164,7 +164,7 @@ class QueryClient {
164
164
  }
165
165
  }
166
166
  catch (error) {
167
- throw new Error(`NDJSON stream reading error: ${error}`);
167
+ throw new Error(`NDJSON stream reading error: ${error}`, { cause: error });
168
168
  }
169
169
  // Report parse errors if any occurred
170
170
  if (parseErrors.length > 0) {
@@ -232,7 +232,7 @@ export class QueryClient {
232
232
  }
233
233
  }
234
234
  } catch (error) {
235
- throw new Error(`NDJSON stream reading error: ${error}`)
235
+ throw new Error(`NDJSON stream reading error: ${error}`, { cause: error })
236
236
  }
237
237
 
238
238
  // Report parse errors if any occurred
@@ -105,7 +105,7 @@ class SSEClient {
105
105
  const detail = err instanceof Error ? err.message : String(err);
106
106
  throw new Error(`RoboSystems SDK: tokenProvider threw while resolving the SSE credential (${detail}). ` +
107
107
  'Fix the tokenProvider passed in the client config (or via setSDKClientConfig) so it ' +
108
- 'returns the current token, or null to connect without one.');
108
+ 'returns the current token, or null to connect without one.', { cause: err });
109
109
  }
110
110
  return token || undefined;
111
111
  }
@@ -177,7 +177,8 @@ export class SSEClient {
177
177
  throw new Error(
178
178
  `RoboSystems SDK: tokenProvider threw while resolving the SSE credential (${detail}). ` +
179
179
  'Fix the tokenProvider passed in the client config (or via setSDKClientConfig) so it ' +
180
- 'returns the current token, or null to connect without one.'
180
+ 'returns the current token, or null to connect without one.',
181
+ { cause: err }
181
182
  )
182
183
  }
183
184
  return token || undefined
@@ -158,7 +158,7 @@ function createGraphQLClient(config, graphId) {
158
158
  const detail = err instanceof Error ? err.message : String(err);
159
159
  throw new Error(`RoboSystems SDK: tokenProvider threw while resolving the request credential (${detail}). ` +
160
160
  'Fix the tokenProvider passed in the client config (or via setSDKClientConfig) so it ' +
161
- 'returns the current token, or null to send an unauthenticated (cookie-based) request.');
161
+ 'returns the current token, or null to send an unauthenticated (cookie-based) request.', { cause: err });
162
162
  }
163
163
  if (!token) {
164
164
  return request;
@@ -219,7 +219,8 @@ export function createGraphQLClient(config: GraphQLClientConfig, graphId: string
219
219
  throw new Error(
220
220
  `RoboSystems SDK: tokenProvider threw while resolving the request credential (${detail}). ` +
221
221
  'Fix the tokenProvider passed in the client config (or via setSDKClientConfig) so it ' +
222
- 'returns the current token, or null to send an unauthenticated (cookie-based) request.'
222
+ 'returns the current token, or null to send an unauthenticated (cookie-based) request.',
223
+ { cause: err }
223
224
  )
224
225
  }
225
226
  if (!token) {