@robosystems/client 1.17.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/sdk.gen.ts CHANGED
@@ -1631,13 +1631,17 @@ export const getCheckoutStatus = <ThrowOnError extends boolean = false>(options:
1631
1631
  });
1632
1632
 
1633
1633
  /**
1634
- * Handle Http Get
1634
+ * GraphQL explorer (development only)
1635
1635
  *
1636
+ * Serves the in-browser GraphiQL explorer on deployments that enable it, which is development only — it is not mounted on the hosted API. Run queries with `POST` to the same URL.
1636
1637
  *
1638
+ * Queries are scoped by the URL: `graph_id` is a path parameter and never a query argument, so a document cannot name a graph that disagrees with the path it was sent to. Reads hit the operational (OLTP) extensions database, so they reflect the books as they stand now; the analytical projection is Cypher at `POST /v1/graphs/{graph_id}/query/cypher`.
1639
+ *
1640
+ * The schema is composed per deployment: ledger fields require RoboLedger and investor fields require RoboInvestor, and a disabled domain is absent from introspection rather than failing at runtime. Every field carries a description, so introspection is the authoritative, deployment-specific reference.
1637
1641
  *
1638
1642
  * **Auth**: pass `X-API-Key` (or a JWT `Authorization: Bearer` header). Unauthenticated introspection queries are deliberately allowed for SDK codegen; data queries require credentials and raise `UNAUTHENTICATED`.
1639
1643
  *
1640
- * **Error codes**: `LEDGER_NOT_INITIALIZED`, `INVESTOR_NOT_INITIALIZED`, and `UNAUTHENTICATED` surface in the GraphQL `errors[].extensions.code` field — see `graphql/README.md` for the full vocabulary.
1644
+ * **Error codes**: `LEDGER_NOT_INITIALIZED`, `INVESTOR_NOT_INITIALIZED`, and `UNAUTHENTICATED` surface in the GraphQL `errors[].extensions.code` field. GraphQL reports errors with HTTP 200 and a populated `errors[]`, so check that array rather than the status code.
1641
1645
  */
1642
1646
  export const handleHttpGetExtensionsGraphIdGraphqlGet = <ThrowOnError extends boolean = false>(options: Options<HandleHttpGetExtensionsGraphIdGraphqlGetData, ThrowOnError>): RequestResult<HandleHttpGetExtensionsGraphIdGraphqlGetResponses, HandleHttpGetExtensionsGraphIdGraphqlGetErrors, ThrowOnError> => (options.client ?? client).get<HandleHttpGetExtensionsGraphIdGraphqlGetResponses, HandleHttpGetExtensionsGraphIdGraphqlGetErrors, ThrowOnError>({
1643
1647
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
@@ -1646,18 +1650,28 @@ export const handleHttpGetExtensionsGraphIdGraphqlGet = <ThrowOnError extends bo
1646
1650
  });
1647
1651
 
1648
1652
  /**
1649
- * Handle Http Post
1653
+ * Run a GraphQL query
1654
+ *
1655
+ * The typed read surface for a graph's extensions data — RoboLedger and RoboInvestor records as they stand right now. Writes are not here: they are the named operations at `POST /extensions/{domain}/{graph_id}/operations/{name}`.
1656
+ *
1657
+ * Send a standard GraphQL POST body: a `query` document, with optional `variables` and `operationName`.
1650
1658
  *
1659
+ * Queries are scoped by the URL: `graph_id` is a path parameter and never a query argument, so a document cannot name a graph that disagrees with the path it was sent to. Reads hit the operational (OLTP) extensions database, so they reflect the books as they stand now; the analytical projection is Cypher at `POST /v1/graphs/{graph_id}/query/cypher`.
1651
1660
  *
1661
+ * The schema is composed per deployment: ledger fields require RoboLedger and investor fields require RoboInvestor, and a disabled domain is absent from introspection rather than failing at runtime. Every field carries a description, so introspection is the authoritative, deployment-specific reference.
1652
1662
  *
1653
1663
  * **Auth**: pass `X-API-Key` (or a JWT `Authorization: Bearer` header). Unauthenticated introspection queries are deliberately allowed for SDK codegen; data queries require credentials and raise `UNAUTHENTICATED`.
1654
1664
  *
1655
- * **Error codes**: `LEDGER_NOT_INITIALIZED`, `INVESTOR_NOT_INITIALIZED`, and `UNAUTHENTICATED` surface in the GraphQL `errors[].extensions.code` field — see `graphql/README.md` for the full vocabulary.
1665
+ * **Error codes**: `LEDGER_NOT_INITIALIZED`, `INVESTOR_NOT_INITIALIZED`, and `UNAUTHENTICATED` surface in the GraphQL `errors[].extensions.code` field. GraphQL reports errors with HTTP 200 and a populated `errors[]`, so check that array rather than the status code.
1656
1666
  */
1657
1667
  export const handleHttpPostExtensionsGraphIdGraphqlPost = <ThrowOnError extends boolean = false>(options: Options<HandleHttpPostExtensionsGraphIdGraphqlPostData, ThrowOnError>): RequestResult<HandleHttpPostExtensionsGraphIdGraphqlPostResponses, HandleHttpPostExtensionsGraphIdGraphqlPostErrors, ThrowOnError> => (options.client ?? client).post<HandleHttpPostExtensionsGraphIdGraphqlPostResponses, HandleHttpPostExtensionsGraphIdGraphqlPostErrors, ThrowOnError>({
1658
1668
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
1659
1669
  url: '/extensions/{graph_id}/graphql',
1660
- ...options
1670
+ ...options,
1671
+ headers: {
1672
+ 'Content-Type': 'application/json',
1673
+ ...options.headers
1674
+ }
1661
1675
  });
1662
1676
 
1663
1677
  /**
@@ -1678,15 +1692,15 @@ export const initializeLedger = <ThrowOnError extends boolean = false>(options:
1678
1692
  });
1679
1693
 
1680
1694
  /**
1681
- * Update Entity
1695
+ * Initialize Chart of Accounts
1682
1696
  *
1683
- * Update the graph's primary entity. Only provided (non-null) fields are updated. The graph is implicit in the URL — the operation always targets the graph's primary entity.
1697
+ * Create the graph's chart of accounts from a shipped template — the fresh-company path to native books. Use when the graph has NO chart (a QuickBooks-synced tenant never needs this: its chart arrives with the sync and stays after a sever) and before connecting a bank feed, which needs a chart to resolve against. Templates: `saas` (subscription software), `services` (professional services), `product` (inventory and COGS) — the `chartTemplates` GraphQL field lists them with names and account counts. Creates the chart, its `coa_mapping` structure and the template's CoA → rs-gaap mapping associations in one transaction, with the equity rows mapped by the entity's legal form (`entity_type`, defaulting to the graph's primary entity). One-time: 409 once a chart exists — a chart is never replaced. Customize afterwards with update-taxonomy-block; accounts that carry activity are never deleted.
1684
1698
  *
1685
1699
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
1686
1700
  */
1687
- export const updateEntity = <ThrowOnError extends boolean = false>(options: Options<UpdateEntityData, ThrowOnError>): RequestResult<UpdateEntityResponses, UpdateEntityErrors, ThrowOnError> => (options.client ?? client).post<UpdateEntityResponses, UpdateEntityErrors, ThrowOnError>({
1701
+ export const initializeChartOfAccounts = <ThrowOnError extends boolean = false>(options: Options<InitializeChartOfAccountsData, ThrowOnError>): RequestResult<InitializeChartOfAccountsResponses, InitializeChartOfAccountsErrors, ThrowOnError> => (options.client ?? client).post<InitializeChartOfAccountsResponses, InitializeChartOfAccountsErrors, ThrowOnError>({
1688
1702
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
1689
- url: '/extensions/roboledger/{graph_id}/operations/update-entity',
1703
+ url: '/extensions/roboledger/{graph_id}/operations/initialize-chart-of-accounts',
1690
1704
  ...options,
1691
1705
  headers: {
1692
1706
  'Content-Type': 'application/json',
@@ -1695,15 +1709,15 @@ export const updateEntity = <ThrowOnError extends boolean = false>(options: Opti
1695
1709
  });
1696
1710
 
1697
1711
  /**
1698
- * Change Reporting Style
1712
+ * Update Entity
1699
1713
  *
1700
- * Switch the reporting entity's Reporting Style — how its statements are laid out (equity-form, close-target concept, per-statement Networks). Validates that the target Style has a complete composition in the tenant schema, then flips `entities.reporting_style_id`. Omit `entity_id` to target the graph's primary entity. Filed Reports are unaffected (their FactSet rows pin their structures at create-time); new reports use the new Style. Idempotent on the same id.
1714
+ * Update the graph's primary entity. Only provided (non-null) fields are updated. The graph is implicit in the URL — the operation always targets the graph's primary entity.
1701
1715
  *
1702
1716
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
1703
1717
  */
1704
- export const changeReportingStyle = <ThrowOnError extends boolean = false>(options: Options<ChangeReportingStyleData, ThrowOnError>): RequestResult<ChangeReportingStyleResponses, ChangeReportingStyleErrors, ThrowOnError> => (options.client ?? client).post<ChangeReportingStyleResponses, ChangeReportingStyleErrors, ThrowOnError>({
1718
+ export const updateEntity = <ThrowOnError extends boolean = false>(options: Options<UpdateEntityData, ThrowOnError>): RequestResult<UpdateEntityResponses, UpdateEntityErrors, ThrowOnError> => (options.client ?? client).post<UpdateEntityResponses, UpdateEntityErrors, ThrowOnError>({
1705
1719
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
1706
- url: '/extensions/roboledger/{graph_id}/operations/change-reporting-style',
1720
+ url: '/extensions/roboledger/{graph_id}/operations/update-entity',
1707
1721
  ...options,
1708
1722
  headers: {
1709
1723
  'Content-Type': 'application/json',
@@ -1712,15 +1726,15 @@ export const changeReportingStyle = <ThrowOnError extends boolean = false>(optio
1712
1726
  });
1713
1727
 
1714
1728
  /**
1715
- * Create Taxonomy Block
1729
+ * Change Reporting Style
1716
1730
  *
1717
- * Create a taxonomy block atomically: one envelope carrying the taxonomy row plus its structures, elements, associations, and rules. Dispatches by `taxonomy_type` — `chart_of_accounts` (declarative tenant CoA), `reporting_extension`, and `custom_ontology` are supported; `reporting_standard` is library-origin (501). `reporting_extension` / `custom_ontology` authoring may be disabled per environment (TAXONOMY_AUTHORING_ENABLED) — disabled surfaces 403. NOT the path for a functional close schedule: a structure with block_type='schedule' here is a bare ontology row with none of the schedule machinery (per-period facts, schedule_entry_due obligations, closing-entry generator). To create a working schedule use create-information-block(block_type='schedule').
1731
+ * Switch the reporting entity's Reporting Style — how its statements are laid out (equity-form, close-target concept, per-statement Networks). Validates that the target Style has a complete composition in the tenant schema, then flips `entities.reporting_style_id`. Omit `entity_id` to target the graph's primary entity. Filed Reports are unaffected (their FactSet rows pin their structures at create-time); new reports use the new Style. Idempotent on the same id.
1718
1732
  *
1719
1733
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
1720
1734
  */
1721
- export const createTaxonomyBlock = <ThrowOnError extends boolean = false>(options: Options<CreateTaxonomyBlockData, ThrowOnError>): RequestResult<CreateTaxonomyBlockResponses, CreateTaxonomyBlockErrors, ThrowOnError> => (options.client ?? client).post<CreateTaxonomyBlockResponses, CreateTaxonomyBlockErrors, ThrowOnError>({
1735
+ export const changeReportingStyle = <ThrowOnError extends boolean = false>(options: Options<ChangeReportingStyleData, ThrowOnError>): RequestResult<ChangeReportingStyleResponses, ChangeReportingStyleErrors, ThrowOnError> => (options.client ?? client).post<ChangeReportingStyleResponses, ChangeReportingStyleErrors, ThrowOnError>({
1722
1736
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
1723
- url: '/extensions/roboledger/{graph_id}/operations/create-taxonomy-block',
1737
+ url: '/extensions/roboledger/{graph_id}/operations/change-reporting-style',
1724
1738
  ...options,
1725
1739
  headers: {
1726
1740
  'Content-Type': 'application/json',
@@ -1729,15 +1743,15 @@ export const createTaxonomyBlock = <ThrowOnError extends boolean = false>(option
1729
1743
  });
1730
1744
 
1731
1745
  /**
1732
- * Initialize Chart of Accounts
1746
+ * Create Taxonomy Block
1733
1747
  *
1734
- * Create the graph's chart of accounts from a shipped template — the fresh-company path to native books. Use when the graph has NO chart (a QuickBooks-synced tenant never needs this: its chart arrives with the sync and stays after a sever) and before connecting a bank feed, which needs a chart to resolve against. Templates: `saas` (subscription software), `services` (professional services), `product` (inventory and COGS) — the `chartTemplates` GraphQL field lists them with names and account counts. Creates the chart, its `coa_mapping` structure and the template's CoA → rs-gaap mapping associations in one transaction, with the equity rows mapped by the entity's legal form (`entity_type`, defaulting to the graph's primary entity). One-time: 409 once a chart exists — a chart is never replaced. Customize afterwards with update-taxonomy-block; accounts that carry activity are never deleted.
1748
+ * Create a taxonomy block atomically: one envelope carrying the taxonomy row plus its structures, elements, associations, and rules. Dispatches by `taxonomy_type` — `chart_of_accounts` (declarative tenant CoA), `reporting_extension`, and `custom_ontology` are supported; `reporting_standard` is library-origin (501). `reporting_extension` / `custom_ontology` authoring may be disabled per environment (TAXONOMY_AUTHORING_ENABLED) — disabled surfaces 403. NOT the path for a functional close schedule: a structure with block_type='schedule' here is a bare ontology row with none of the schedule machinery (per-period facts, schedule_entry_due obligations, closing-entry generator). To create a working schedule use create-information-block(block_type='schedule').
1735
1749
  *
1736
1750
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
1737
1751
  */
1738
- export const initializeChartOfAccounts = <ThrowOnError extends boolean = false>(options: Options<InitializeChartOfAccountsData, ThrowOnError>): RequestResult<InitializeChartOfAccountsResponses, InitializeChartOfAccountsErrors, ThrowOnError> => (options.client ?? client).post<InitializeChartOfAccountsResponses, InitializeChartOfAccountsErrors, ThrowOnError>({
1752
+ export const createTaxonomyBlock = <ThrowOnError extends boolean = false>(options: Options<CreateTaxonomyBlockData, ThrowOnError>): RequestResult<CreateTaxonomyBlockResponses, CreateTaxonomyBlockErrors, ThrowOnError> => (options.client ?? client).post<CreateTaxonomyBlockResponses, CreateTaxonomyBlockErrors, ThrowOnError>({
1739
1753
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
1740
- url: '/extensions/roboledger/{graph_id}/operations/initialize-chart-of-accounts',
1754
+ url: '/extensions/roboledger/{graph_id}/operations/create-taxonomy-block',
1741
1755
  ...options,
1742
1756
  headers: {
1743
1757
  'Content-Type': 'application/json',
@@ -2037,7 +2051,7 @@ export const createEventBlock = <ThrowOnError extends boolean = false>(options:
2037
2051
  /**
2038
2052
  * Update Event Block
2039
2053
  *
2040
- * Apply a status transition (captured → classified | committed | voided) and/or field corrections (description, effective_at, metadata_patch) to an existing event block. Only supplied fields are updated. captured → classified records an account choice without posting — for a bank-feed line, patch metadata.classified_element_id (or accept_suggestion: true) in the same call. When the transition is captured/classified → committed, the registered Python handler fires against the captured metadata to produce the GL rows; a bank-feed line with no account chosen and no matching rule is refused. Errors from the handler (validation, element resolution, closed period, unbalanced lines) surface as 422 here so the inbox UI can display the failure reason without retry.
2054
+ * Apply a status transition (captured → classified | committed | voided) and/or field corrections (description, effective_at, metadata_patch) to an existing event block. Only supplied fields are updated. captured → classified records an account choice without posting — for a bank-feed line, patch metadata.classified_element_id (or accept_suggestion: true) in the same call. When the transition is captured/classified → committed, the registered Python handler fires against the captured metadata to produce the GL rows, unless it already wrote them when the event was created; a bank-feed line with no account chosen and no matching rule is refused. Errors from the handler (validation, element resolution, closed period, unbalanced lines) surface as 422 here so the inbox UI can display the failure reason without retry.
2041
2055
  *
2042
2056
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
2043
2057
  */
@@ -2188,15 +2202,15 @@ export const deleteJournalEntry = <ThrowOnError extends boolean = false>(options
2188
2202
  });
2189
2203
 
2190
2204
  /**
2191
- * Promote Due Schedule Obligations
2205
+ * Set Close Target
2192
2206
  *
2193
- * Promote matured pending schedule obligations (schedule_entry_due events whose period boundary has passed) to 'classified', and — when dispatch_handlers=true (default) — draft their closing entries in the same transaction. Also reaches stranded obligations: events already 'classified' (by an earlier flip-only sweep) whose closing entry was never drafted are dispatched in the same pass, and reported via stranded_count. This is the on-demand form of the background obligation-promotion sweep; run it before close-period when a schedule was just created or when you can't wait for the Dagster sensor. Idempotent: re-running skips already-classified obligations and reconciles to existing drafts.
2207
+ * Set the user-controlled goal period for closing (`close_target`). Format: YYYY-MM. Distinct from `closed_through` (what's actually locked) — setting a target doesn't close anything; call `close-period` for that. The catch-up sequence between `closed_through` and this target appears on the response's `fiscal_calendar.catch_up_sequence`.
2194
2208
  *
2195
2209
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
2196
2210
  */
2197
- export const promoteObligations = <ThrowOnError extends boolean = false>(options: Options<PromoteObligationsData, ThrowOnError>): RequestResult<PromoteObligationsResponses, PromoteObligationsErrors, ThrowOnError> => (options.client ?? client).post<PromoteObligationsResponses, PromoteObligationsErrors, ThrowOnError>({
2211
+ export const setCloseTarget = <ThrowOnError extends boolean = false>(options: Options<SetCloseTargetData, ThrowOnError>): RequestResult<SetCloseTargetResponses, SetCloseTargetErrors, ThrowOnError> => (options.client ?? client).post<SetCloseTargetResponses, SetCloseTargetErrors, ThrowOnError>({
2198
2212
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
2199
- url: '/extensions/roboledger/{graph_id}/operations/promote-obligations',
2213
+ url: '/extensions/roboledger/{graph_id}/operations/set-close-target',
2200
2214
  ...options,
2201
2215
  headers: {
2202
2216
  'Content-Type': 'application/json',
@@ -2205,15 +2219,15 @@ export const promoteObligations = <ThrowOnError extends boolean = false>(options
2205
2219
  });
2206
2220
 
2207
2221
  /**
2208
- * Rebuild Schedule In Place
2222
+ * Close Fiscal Period
2209
2223
  *
2210
- * Re-run the schedule generator in place on an existing schedule. Atomic alternative to delete-then-recreate (which orphans pending obligations): preserves the structure id + element associations + taxonomy, voids the old pending obligation chain, deletes the old facts and SumEquals rules, and regenerates fresh forward facts + a fresh obligation chain from the schedule's stored definition (entry_template / schedule_metadata / monthly_amount / period bounds). The historical-vs-in-scope split is re-derived from the CURRENT fiscal calendar closed_through. Use this to pick up a fixed generator (e.g. the roll-forward direction fix) without orphaning obligations.
2224
+ * Lock a single fiscal period. Posts draft entries, runs the balance-sheet equation check, advances `closed_through` by one, auto-advances `close_target` if this close caught up to it, and stamps the period's canonical statement FactSets from the posted ledger (`statements_stamped` / `stamped_statement_sets` in the response; soft-skipped with `statement_stamp_note` when reporting isn't set up). Period must be exactly `closed_through + 1` — sequence violations return 422 with structured `blockers`. Common blockers: `sync_stale` (override with `allow_stale_sync=true` after manual verification), `period_incomplete` (draft entries unbalanced), `sequence_violation` (out-of-order).
2211
2225
  *
2212
2226
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
2213
2227
  */
2214
- export const rebuildSchedule = <ThrowOnError extends boolean = false>(options: Options<RebuildScheduleData, ThrowOnError>): RequestResult<RebuildScheduleResponses, RebuildScheduleErrors, ThrowOnError> => (options.client ?? client).post<RebuildScheduleResponses, RebuildScheduleErrors, ThrowOnError>({
2228
+ export const closePeriod = <ThrowOnError extends boolean = false>(options: Options<ClosePeriodData, ThrowOnError>): RequestResult<ClosePeriodResponses, ClosePeriodErrors, ThrowOnError> => (options.client ?? client).post<ClosePeriodResponses, ClosePeriodErrors, ThrowOnError>({
2215
2229
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
2216
- url: '/extensions/roboledger/{graph_id}/operations/rebuild-schedule',
2230
+ url: '/extensions/roboledger/{graph_id}/operations/close-period',
2217
2231
  ...options,
2218
2232
  headers: {
2219
2233
  'Content-Type': 'application/json',
@@ -2222,15 +2236,15 @@ export const rebuildSchedule = <ThrowOnError extends boolean = false>(options: O
2222
2236
  });
2223
2237
 
2224
2238
  /**
2225
- * Terminate Schedule Early
2239
+ * Reopen Fiscal Period
2226
2240
  *
2227
- * End a schedule early at a month-end cutoff without booking any entry. In one transaction: deletes forward facts past the cutoff (refusing when posted entries exist past it; stale drafts past it are deleted), voids the remaining obligation chain past the cutoff (pending and classified rows), and rewrites the SumEquals rule to prove the truncated curve. History at or before the cutoff is untouched, so open months the schedule still covers close normally. Use this when the termination's GL effect is already booked (an asset transferred via a manual entry, a prepaid refunded in the source system) or none is wanted; when the derecognition entry still needs to be booked, use create-event-block(event_type='asset_disposed') instead — the disposal handler posts it atomically with the same obligation void. Run BEFORE promote-obligations at close so terminated periods are never drafted.
2241
+ * Reopen a closed period for adjustment. Only the latest closed period (`closed_through`) can be reopened; it decrements by one and the period's entries become writable again. To reach an earlier month, reopen latest-first down to it, then re-close forward — an out-of-order reopen is refused (422) with the ordered list, because every later closed month carries statements stamped from the earlier month's numbers. Retracts the month's canonical statement FactSets (a reopened month is no longer a closed assertion; re-closing restamps them). The required `reason` is captured in the audit log. Use sparingly — reopen invalidates downstream artifacts that trusted the closed state (reports, shared filings).
2228
2242
  *
2229
2243
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
2230
2244
  */
2231
- export const terminateSchedule = <ThrowOnError extends boolean = false>(options: Options<TerminateScheduleData, ThrowOnError>): RequestResult<TerminateScheduleResponses, TerminateScheduleErrors, ThrowOnError> => (options.client ?? client).post<TerminateScheduleResponses, TerminateScheduleErrors, ThrowOnError>({
2245
+ export const reopenPeriod = <ThrowOnError extends boolean = false>(options: Options<ReopenPeriodData, ThrowOnError>): RequestResult<ReopenPeriodResponses, ReopenPeriodErrors, ThrowOnError> => (options.client ?? client).post<ReopenPeriodResponses, ReopenPeriodErrors, ThrowOnError>({
2232
2246
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
2233
- url: '/extensions/roboledger/{graph_id}/operations/terminate-schedule',
2247
+ url: '/extensions/roboledger/{graph_id}/operations/reopen-period',
2234
2248
  ...options,
2235
2249
  headers: {
2236
2250
  'Content-Type': 'application/json',
@@ -2239,15 +2253,15 @@ export const terminateSchedule = <ThrowOnError extends boolean = false>(options:
2239
2253
  });
2240
2254
 
2241
2255
  /**
2242
- * Set Close Target
2256
+ * Backfill Plan History
2243
2257
  *
2244
- * Set the user-controlled goal period for closing (`close_target`). Format: YYYY-MM. Distinct from `closed_through` (what's actually locked) — setting a target doesn't close anything; call `close-period` for that. The catch-up sequence between `closed_through` and this target appears on the response's `fiscal_calendar.catch_up_sequence`.
2258
+ * Compile monthly statement history behind the close boundary — the plan's historical columns. Seeds any missing FiscalPeriod rows (baseline-closed) back to the clamped `start_period`, then restamps each month lacking canonical statement FactSets by running the real reopen → reclose cycle (balance validation, statement rules, and audit events per month). Chunked: at most `max_periods` months per call, oldest first — loop until `remaining_periods` comes back empty. Idempotent: already-stamped months are never touched. Months holding draft entries are skipped, never posted. `start_period` is clamped to the earliest month with ledger data, so deep-history tenants only backfill what actually exists.
2245
2259
  *
2246
2260
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
2247
2261
  */
2248
- export const setCloseTarget = <ThrowOnError extends boolean = false>(options: Options<SetCloseTargetData, ThrowOnError>): RequestResult<SetCloseTargetResponses, SetCloseTargetErrors, ThrowOnError> => (options.client ?? client).post<SetCloseTargetResponses, SetCloseTargetErrors, ThrowOnError>({
2262
+ export const backfillPlanHistory = <ThrowOnError extends boolean = false>(options: Options<BackfillPlanHistoryData, ThrowOnError>): RequestResult<BackfillPlanHistoryResponses, BackfillPlanHistoryErrors, ThrowOnError> => (options.client ?? client).post<BackfillPlanHistoryResponses, BackfillPlanHistoryErrors, ThrowOnError>({
2249
2263
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
2250
- url: '/extensions/roboledger/{graph_id}/operations/set-close-target',
2264
+ url: '/extensions/roboledger/{graph_id}/operations/backfill-plan-history',
2251
2265
  ...options,
2252
2266
  headers: {
2253
2267
  'Content-Type': 'application/json',
@@ -2256,15 +2270,15 @@ export const setCloseTarget = <ThrowOnError extends boolean = false>(options: Op
2256
2270
  });
2257
2271
 
2258
2272
  /**
2259
- * Close Fiscal Period
2273
+ * Promote Due Schedule Obligations
2260
2274
  *
2261
- * Lock a single fiscal period. Posts draft entries, runs the balance-sheet equation check, advances `closed_through` by one, auto-advances `close_target` if this close caught up to it, and stamps the period's canonical statement FactSets from the posted ledger (`statements_stamped` / `stamped_statement_sets` in the response; soft-skipped with `statement_stamp_note` when reporting isn't set up). Period must be exactly `closed_through + 1` — sequence violations return 422 with structured `blockers`. Common blockers: `sync_stale` (override with `allow_stale_sync=true` after manual verification), `period_incomplete` (draft entries unbalanced), `sequence_violation` (out-of-order).
2275
+ * Promote matured pending schedule obligations (schedule_entry_due events whose period boundary has passed) to 'classified', and — when dispatch_handlers=true (default) — draft their closing entries in the same transaction. Also reaches stranded obligations: events already 'classified' (by an earlier flip-only sweep) whose closing entry was never drafted are dispatched in the same pass, and reported via stranded_count. This is the on-demand form of the background obligation-promotion sweep; run it before close-period when a schedule was just created or when you can't wait for the Dagster sensor. Idempotent: re-running skips already-classified obligations and reconciles to existing drafts.
2262
2276
  *
2263
2277
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
2264
2278
  */
2265
- export const closePeriod = <ThrowOnError extends boolean = false>(options: Options<ClosePeriodData, ThrowOnError>): RequestResult<ClosePeriodResponses, ClosePeriodErrors, ThrowOnError> => (options.client ?? client).post<ClosePeriodResponses, ClosePeriodErrors, ThrowOnError>({
2279
+ export const promoteObligations = <ThrowOnError extends boolean = false>(options: Options<PromoteObligationsData, ThrowOnError>): RequestResult<PromoteObligationsResponses, PromoteObligationsErrors, ThrowOnError> => (options.client ?? client).post<PromoteObligationsResponses, PromoteObligationsErrors, ThrowOnError>({
2266
2280
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
2267
- url: '/extensions/roboledger/{graph_id}/operations/close-period',
2281
+ url: '/extensions/roboledger/{graph_id}/operations/promote-obligations',
2268
2282
  ...options,
2269
2283
  headers: {
2270
2284
  'Content-Type': 'application/json',
@@ -2273,15 +2287,15 @@ export const closePeriod = <ThrowOnError extends boolean = false>(options: Optio
2273
2287
  });
2274
2288
 
2275
2289
  /**
2276
- * Reopen Fiscal Period
2290
+ * Rebuild Schedule In Place
2277
2291
  *
2278
- * Reopen a closed period for adjustment. Only the latest closed period (`closed_through`) can be reopened; it decrements by one and the period's entries become writable again. To reach an earlier month, reopen latest-first down to it, then re-close forward — an out-of-order reopen is refused (422) with the ordered list, because every later closed month carries statements stamped from the earlier month's numbers. Retracts the month's canonical statement FactSets (a reopened month is no longer a closed assertion; re-closing restamps them). The required `reason` is captured in the audit log. Use sparingly — reopen invalidates downstream artifacts that trusted the closed state (reports, shared filings).
2292
+ * Re-run the schedule generator in place on an existing schedule. Atomic alternative to delete-then-recreate (which orphans pending obligations): preserves the structure id + element associations + taxonomy, voids the old pending obligation chain, deletes the old facts and SumEquals rules, and regenerates fresh forward facts + a fresh obligation chain from the schedule's stored definition (entry_template / schedule_metadata / monthly_amount / period bounds). The historical-vs-in-scope split is re-derived from the CURRENT fiscal calendar closed_through. Use this to pick up a fixed generator (e.g. the roll-forward direction fix) without orphaning obligations.
2279
2293
  *
2280
2294
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
2281
2295
  */
2282
- export const reopenPeriod = <ThrowOnError extends boolean = false>(options: Options<ReopenPeriodData, ThrowOnError>): RequestResult<ReopenPeriodResponses, ReopenPeriodErrors, ThrowOnError> => (options.client ?? client).post<ReopenPeriodResponses, ReopenPeriodErrors, ThrowOnError>({
2296
+ export const rebuildSchedule = <ThrowOnError extends boolean = false>(options: Options<RebuildScheduleData, ThrowOnError>): RequestResult<RebuildScheduleResponses, RebuildScheduleErrors, ThrowOnError> => (options.client ?? client).post<RebuildScheduleResponses, RebuildScheduleErrors, ThrowOnError>({
2283
2297
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
2284
- url: '/extensions/roboledger/{graph_id}/operations/reopen-period',
2298
+ url: '/extensions/roboledger/{graph_id}/operations/rebuild-schedule',
2285
2299
  ...options,
2286
2300
  headers: {
2287
2301
  'Content-Type': 'application/json',
@@ -2290,15 +2304,15 @@ export const reopenPeriod = <ThrowOnError extends boolean = false>(options: Opti
2290
2304
  });
2291
2305
 
2292
2306
  /**
2293
- * Backfill Plan History
2307
+ * Terminate Schedule Early
2294
2308
  *
2295
- * Compile monthly statement history behind the close boundary — the plan's historical columns. Seeds any missing FiscalPeriod rows (baseline-closed) back to the clamped `start_period`, then restamps each month lacking canonical statement FactSets by running the real reopen → reclose cycle (balance validation, statement rules, and audit events per month). Chunked: at most `max_periods` months per call, oldest first — loop until `remaining_periods` comes back empty. Idempotent: already-stamped months are never touched. Months holding draft entries are skipped, never posted. `start_period` is clamped to the earliest month with ledger data, so deep-history tenants only backfill what actually exists.
2309
+ * End a schedule early at a month-end cutoff without booking any entry. In one transaction: deletes forward facts past the cutoff (refusing when posted entries exist past it; stale drafts past it are deleted), voids the remaining obligation chain past the cutoff (pending and classified rows), and rewrites the SumEquals rule to prove the truncated curve. History at or before the cutoff is untouched, so open months the schedule still covers close normally. Use this when the termination's GL effect is already booked (an asset transferred via a manual entry, a prepaid refunded in the source system) or none is wanted; when the derecognition entry still needs to be booked, use create-event-block(event_type='asset_disposed') instead — the disposal handler posts it atomically with the same obligation void. Run BEFORE promote-obligations at close so terminated periods are never drafted.
2296
2310
  *
2297
2311
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
2298
2312
  */
2299
- export const backfillPlanHistory = <ThrowOnError extends boolean = false>(options: Options<BackfillPlanHistoryData, ThrowOnError>): RequestResult<BackfillPlanHistoryResponses, BackfillPlanHistoryErrors, ThrowOnError> => (options.client ?? client).post<BackfillPlanHistoryResponses, BackfillPlanHistoryErrors, ThrowOnError>({
2313
+ export const terminateSchedule = <ThrowOnError extends boolean = false>(options: Options<TerminateScheduleData, ThrowOnError>): RequestResult<TerminateScheduleResponses, TerminateScheduleErrors, ThrowOnError> => (options.client ?? client).post<TerminateScheduleResponses, TerminateScheduleErrors, ThrowOnError>({
2300
2314
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
2301
- url: '/extensions/roboledger/{graph_id}/operations/backfill-plan-history',
2315
+ url: '/extensions/roboledger/{graph_id}/operations/terminate-schedule',
2302
2316
  ...options,
2303
2317
  headers: {
2304
2318
  'Content-Type': 'application/json',
@@ -2358,15 +2372,15 @@ export const deleteReport = <ThrowOnError extends boolean = false>(options: Opti
2358
2372
  });
2359
2373
 
2360
2374
  /**
2361
- * Share Report
2375
+ * File Report
2362
2376
  *
2363
- * Pushes a published report to every member of the target publish list. Each share is an independent copy: the report row + all its facts are cloned into the recipient's tenant schema with `source_graph_id` / `source_report_id` provenance fields populated. Per-target outcomes (success or error) surface in the response — share does not fail-fast across targets. Recipients that have blocked this graph come back as an error for that target; withdraw a delivered copy with `revoke-report-share`.
2377
+ * Transitions the Report's filing_status to 'filed' — locks the package. Allowed from 'draft' or 'under_review'. Stamps filed_at + filed_by.
2364
2378
  *
2365
2379
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
2366
2380
  */
2367
- export const shareReport = <ThrowOnError extends boolean = false>(options: Options<ShareReportData, ThrowOnError>): RequestResult<ShareReportResponses, ShareReportErrors, ThrowOnError> => (options.client ?? client).post<ShareReportResponses, ShareReportErrors, ThrowOnError>({
2381
+ export const fileReport = <ThrowOnError extends boolean = false>(options: Options<FileReportData, ThrowOnError>): RequestResult<FileReportResponses, FileReportErrors, ThrowOnError> => (options.client ?? client).post<FileReportResponses, FileReportErrors, ThrowOnError>({
2368
2382
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
2369
- url: '/extensions/roboledger/{graph_id}/operations/share-report',
2383
+ url: '/extensions/roboledger/{graph_id}/operations/file-report',
2370
2384
  ...options,
2371
2385
  headers: {
2372
2386
  'Content-Type': 'application/json',
@@ -2375,15 +2389,15 @@ export const shareReport = <ThrowOnError extends boolean = false>(options: Optio
2375
2389
  });
2376
2390
 
2377
2391
  /**
2378
- * Revoke Report Share
2392
+ * Transition Filing Status
2379
2393
  *
2380
- * Withdraws a report previously shared to one recipient graph: deletes the copy from that recipient's schema and stamps the share record revoked. Scoped to a single recipient — withdrawing a distribution to a whole publish list is one call per member. A recipient who already deleted the copy is not an error; the share is still marked revoked and `copy_deleted` returns false. The linked entity in the recipient's graph is left in place, so an investor's declared holding survives.
2394
+ * Move a Report along the non-file legs of the filing lifecycle (draft ↔ under_review, filed → archived). Use 'file-report' to reach 'filed' so audit fields land cleanly.
2381
2395
  *
2382
2396
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
2383
2397
  */
2384
- export const revokeReportShare = <ThrowOnError extends boolean = false>(options: Options<RevokeReportShareData, ThrowOnError>): RequestResult<RevokeReportShareResponses, RevokeReportShareErrors, ThrowOnError> => (options.client ?? client).post<RevokeReportShareResponses, RevokeReportShareErrors, ThrowOnError>({
2398
+ export const transitionFilingStatus = <ThrowOnError extends boolean = false>(options: Options<TransitionFilingStatusData, ThrowOnError>): RequestResult<TransitionFilingStatusResponses, TransitionFilingStatusErrors, ThrowOnError> => (options.client ?? client).post<TransitionFilingStatusResponses, TransitionFilingStatusErrors, ThrowOnError>({
2385
2399
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
2386
- url: '/extensions/roboledger/{graph_id}/operations/revoke-report-share',
2400
+ url: '/extensions/roboledger/{graph_id}/operations/transition-filing-status',
2387
2401
  ...options,
2388
2402
  headers: {
2389
2403
  'Content-Type': 'application/json',
@@ -2392,15 +2406,15 @@ export const revokeReportShare = <ThrowOnError extends boolean = false>(options:
2392
2406
  });
2393
2407
 
2394
2408
  /**
2395
- * File Report
2409
+ * Share Report
2396
2410
  *
2397
- * Transitions the Report's filing_status to 'filed' — locks the package. Allowed from 'draft' or 'under_review'. Stamps filed_at + filed_by.
2411
+ * Pushes a published report to every member of the target publish list. Each share is an independent copy: the report row + all its facts are cloned into the recipient's tenant schema with `source_graph_id` / `source_report_id` provenance fields populated. Per-target outcomes (success or error) surface in the response — share does not fail-fast across targets. Recipients that have blocked this graph come back as an error for that target; withdraw a delivered copy with `revoke-report-share`.
2398
2412
  *
2399
2413
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
2400
2414
  */
2401
- export const fileReport = <ThrowOnError extends boolean = false>(options: Options<FileReportData, ThrowOnError>): RequestResult<FileReportResponses, FileReportErrors, ThrowOnError> => (options.client ?? client).post<FileReportResponses, FileReportErrors, ThrowOnError>({
2415
+ export const shareReport = <ThrowOnError extends boolean = false>(options: Options<ShareReportData, ThrowOnError>): RequestResult<ShareReportResponses, ShareReportErrors, ThrowOnError> => (options.client ?? client).post<ShareReportResponses, ShareReportErrors, ThrowOnError>({
2402
2416
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
2403
- url: '/extensions/roboledger/{graph_id}/operations/file-report',
2417
+ url: '/extensions/roboledger/{graph_id}/operations/share-report',
2404
2418
  ...options,
2405
2419
  headers: {
2406
2420
  'Content-Type': 'application/json',
@@ -2409,15 +2423,15 @@ export const fileReport = <ThrowOnError extends boolean = false>(options: Option
2409
2423
  });
2410
2424
 
2411
2425
  /**
2412
- * Transition Filing Status
2426
+ * Revoke Report Share
2413
2427
  *
2414
- * Move a Report along the non-file legs of the filing lifecycle (draft ↔ under_review, filed → archived). Use 'file-report' to reach 'filed' so audit fields land cleanly.
2428
+ * Withdraws a report previously shared to one recipient graph: deletes the copy from that recipient's schema and stamps the share record revoked. Scoped to a single recipient — withdrawing a distribution to a whole publish list is one call per member. A recipient who already deleted the copy is not an error; the share is still marked revoked and `copy_deleted` returns false. The linked entity in the recipient's graph is left in place, so an investor's declared holding survives.
2415
2429
  *
2416
2430
  * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
2417
2431
  */
2418
- export const transitionFilingStatus = <ThrowOnError extends boolean = false>(options: Options<TransitionFilingStatusData, ThrowOnError>): RequestResult<TransitionFilingStatusResponses, TransitionFilingStatusErrors, ThrowOnError> => (options.client ?? client).post<TransitionFilingStatusResponses, TransitionFilingStatusErrors, ThrowOnError>({
2432
+ export const revokeReportShare = <ThrowOnError extends boolean = false>(options: Options<RevokeReportShareData, ThrowOnError>): RequestResult<RevokeReportShareResponses, RevokeReportShareErrors, ThrowOnError> => (options.client ?? client).post<RevokeReportShareResponses, RevokeReportShareErrors, ThrowOnError>({
2419
2433
  security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
2420
- url: '/extensions/roboledger/{graph_id}/operations/transition-filing-status',
2434
+ url: '/extensions/roboledger/{graph_id}/operations/revoke-report-share',
2421
2435
  ...options,
2422
2436
  headers: {
2423
2437
  'Content-Type': 'application/json',
@@ -2544,23 +2558,6 @@ export const unblockSourceGraph = <ThrowOnError extends boolean = false>(options
2544
2558
  }
2545
2559
  });
2546
2560
 
2547
- /**
2548
- * Live Financial Statement
2549
- *
2550
- * Generate an ad-hoc financial statement directly from the tenant's OLTP ledger data using the active CoA→GAAP mapping. This is the authoritative source for RoboLedger entity graphs — no graph materialization required. Rejected on shared-repository graphs; those should use `financial-statement-analysis` instead.
2551
- *
2552
- * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
2553
- */
2554
- export const liveFinancialStatement = <ThrowOnError extends boolean = false>(options: Options<LiveFinancialStatementData, ThrowOnError>): RequestResult<LiveFinancialStatementResponses, LiveFinancialStatementErrors, ThrowOnError> => (options.client ?? client).post<LiveFinancialStatementResponses, LiveFinancialStatementErrors, ThrowOnError>({
2555
- security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
2556
- url: '/extensions/roboledger/{graph_id}/operations/live-financial-statement',
2557
- ...options,
2558
- headers: {
2559
- 'Content-Type': 'application/json',
2560
- ...options.headers
2561
- }
2562
- });
2563
-
2564
2561
  /**
2565
2562
  * Build Fact Grid
2566
2563
  *
@@ -2629,6 +2626,23 @@ export const informationBlock = <ThrowOnError extends boolean = false>(options:
2629
2626
  }
2630
2627
  });
2631
2628
 
2629
+ /**
2630
+ * Live Financial Statement
2631
+ *
2632
+ * Generate an ad-hoc financial statement directly from the tenant's OLTP ledger data using the active CoA→GAAP mapping. This is the authoritative source for RoboLedger entity graphs — no graph materialization required. Rejected on shared-repository graphs; those should use `financial-statement-analysis` instead.
2633
+ *
2634
+ * **Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
2635
+ */
2636
+ export const liveFinancialStatement = <ThrowOnError extends boolean = false>(options: Options<LiveFinancialStatementData, ThrowOnError>): RequestResult<LiveFinancialStatementResponses, LiveFinancialStatementErrors, ThrowOnError> => (options.client ?? client).post<LiveFinancialStatementResponses, LiveFinancialStatementErrors, ThrowOnError>({
2637
+ security: [{ name: 'X-API-Key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }],
2638
+ url: '/extensions/roboledger/{graph_id}/operations/live-financial-statement',
2639
+ ...options,
2640
+ headers: {
2641
+ 'Content-Type': 'application/json',
2642
+ ...options.headers
2643
+ }
2644
+ });
2645
+
2632
2646
  /**
2633
2647
  * Create Portfolio Block
2634
2648
  *