@robosystems/client 2.30.0 → 2.31.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/types.gen.ts CHANGED
@@ -4033,9 +4033,9 @@ export type CreateScheduleRequest = {
4033
4033
  /**
4034
4034
  * Monthly Amount
4035
4035
  *
4036
- * Monthly amount in cents
4036
+ * Monthly amount in cents. Required for a straight-line schedule; a custom or loan schedule takes its amounts from its curve.
4037
4037
  */
4038
- monthly_amount: number;
4038
+ monthly_amount?: number;
4039
4039
  entry_template: EntryTemplateRequest;
4040
4040
  schedule_metadata?: ScheduleMetadataRequest | null;
4041
4041
  /**
@@ -6172,7 +6172,7 @@ export type EntryTemplateRequest = {
6172
6172
  /**
6173
6173
  * Credit Element Id
6174
6174
  *
6175
- * CoA element id to credit (e.g. Accumulated Depreciation). A chart-of-accounts element id (see get-unmapped-elements), not a taxonomy qname. One template = one debit/credit pair; model a multi-account entry as several schedules.
6175
+ * CoA element id to credit (e.g. Accumulated Depreciation). A chart-of-accounts element id (see get-unmapped-elements), not a taxonomy qname. A straight-line or custom schedule posts this one debit/credit pair; a loan schedule posts its `legs`.
6176
6176
  */
6177
6177
  credit_element_id: string;
6178
6178
  /**
@@ -6199,6 +6199,12 @@ export type EntryTemplateRequest = {
6199
6199
  * The management dimension members (department, class, location, project) every entry the schedule drafts carries on both lines, one per axis: a department's depreciation lands in that department.
6200
6200
  */
6201
6201
  dimension_ids?: Array<string>;
6202
+ /**
6203
+ * Legs
6204
+ *
6205
+ * The lines of a loan schedule's entry (`method='effective_interest'` only), each taking one column of the amortization table; each period's lines must balance. Accrue interest and pay through the bank: debit Interest Expense and credit Accrued Interest, both `interest`. The schedule settles the payment itself: debit the note `principal`, debit Interest Expense `interest`, credit cash or a due-to `payment`. `debit_element_id` names the interest debit leg and `credit_element_id` one credit leg. Empty for every other method, which posts the debit/credit pair.
6206
+ */
6207
+ legs?: Array<ScheduleLegRequest>;
6202
6208
  };
6203
6209
 
6204
6210
  /**
@@ -10678,6 +10684,86 @@ export type LiveStatementFactRow = {
10678
10684
  sources?: Array<Array<StatementRowSource>> | null;
10679
10685
  };
10680
10686
 
10687
+ /**
10688
+ * LoanTermsRequest
10689
+ *
10690
+ * The terms a loan schedule's amortization table is computed from.
10691
+ */
10692
+ export type LoanTermsRequest = {
10693
+ /**
10694
+ * Principal
10695
+ *
10696
+ * Principal drawn, in cents.
10697
+ */
10698
+ principal: number;
10699
+ /**
10700
+ * Annual Rate
10701
+ *
10702
+ * Annual interest rate as a fraction: 0.099 for 9.9%.
10703
+ */
10704
+ annual_rate: number;
10705
+ /**
10706
+ * Start Date
10707
+ *
10708
+ * The day the principal was drawn; interest accrues from it. Falls in the schedule's first month.
10709
+ */
10710
+ start_date: string;
10711
+ /**
10712
+ * Day Count
10713
+ *
10714
+ * How a period's interest counts days: `30/360` (every whole month is 30 days), `actual/365` or `actual/360` (the days elapsed, over a 365- or 360-day year; actual/360 is the usual bank line of credit).
10715
+ */
10716
+ day_count?: '30/360' | 'actual/365' | 'actual/360';
10717
+ /**
10718
+ * Payment Frequency
10719
+ *
10720
+ * How often a payment falls due. A payment is applied at the end of the month it falls in.
10721
+ */
10722
+ payment_frequency?: 'monthly' | 'quarterly' | 'annual' | 'at_maturity';
10723
+ /**
10724
+ * First Payment Date
10725
+ *
10726
+ * The first payment's date. Omit for one frequency after the schedule's first month.
10727
+ */
10728
+ first_payment_date?: string | null;
10729
+ /**
10730
+ * Payment Amount
10731
+ *
10732
+ * Each scheduled payment in cents, interest included. Omit for the level payment that retires the principal by `maturity_date`, or for the accrued interest when `interest_only`.
10733
+ */
10734
+ payment_amount?: number | null;
10735
+ /**
10736
+ * Interest Only
10737
+ *
10738
+ * Payments settle interest only; the principal is due at maturity.
10739
+ */
10740
+ interest_only?: boolean;
10741
+ /**
10742
+ * Maturity Date
10743
+ *
10744
+ * When the remaining principal is due: it is repaid in that month, which is the schedule's last. Omit for a line of credit with no maturity, whose balance carries past the schedule.
10745
+ */
10746
+ maturity_date?: string | null;
10747
+ /**
10748
+ * Capitalize Interest
10749
+ *
10750
+ * Interest is added to the note rather than accrued apart (a PIK note): the balance grows by each period's interest, and payments reduce it whole.
10751
+ */
10752
+ capitalize_interest?: boolean;
10753
+ /**
10754
+ * Note Element Id
10755
+ *
10756
+ * The liability account the principal is carried in. The schedule states its balance each period, which the schedule reconciliation compares with the ledger.
10757
+ */
10758
+ note_element_id: string;
10759
+ /**
10760
+ * Current Portion Element Id
10761
+ *
10762
+ * A current-liability account for the principal due within twelve months. When set, each period's entry also reclasses between it and `note_element_id` so it holds the next twelve months' principal.
10763
+ */
10764
+ current_portion_element_id?: string | null;
10765
+ };
10766
+
10681
10767
  /**
10682
10768
  * LoginRequest
10683
10769
  *
@@ -13533,6 +13619,52 @@ export type OperationEnvelopePreviewEventBlockResponse = {
13533
13619
  idempotentReplay?: boolean;
13534
13620
  };
13535
13621
 
13622
+ /**
13623
+ * OperationEnvelope[PreviewScheduleResponse]
13624
+ */
13625
+ export type OperationEnvelopePreviewScheduleResponse = {
13626
+ /**
13627
+ * Operation
13628
+ *
13629
+ * Kebab-case operation name
13630
+ */
13631
+ operation: string;
13632
+ /**
13633
+ * Operationid
13634
+ *
13635
+ * op_-prefixed ULID for audit and SSE correlation
13636
+ */
13637
+ operationId: string;
13638
+ /**
13639
+ * Status
13640
+ *
13641
+ * Operation lifecycle state
13642
+ */
13643
+ status: 'completed' | 'pending' | 'failed';
13644
+ /**
13645
+ * Command-specific result payload
13646
+ */
13647
+ result?: PreviewScheduleResponse | null;
13648
+ /**
13649
+ * At
13650
+ *
13651
+ * ISO-8601 UTC timestamp
13652
+ */
13653
+ at: string;
13654
+ /**
13655
+ * Createdby
13656
+ *
13657
+ * User ID that initiated the operation
13658
+ */
13659
+ createdBy?: string | null;
13660
+ /**
13661
+ * Idempotentreplay
13662
+ *
13663
+ * True when this envelope came from the idempotency cache — the underlying command did not execute again. False on fresh executions.
13664
+ */
13665
+ idempotentReplay?: boolean;
13666
+ };
13667
+
13536
13668
  /**
13537
13669
  * OperationEnvelope[PromoteObligationsResponse]
13538
13670
  */
@@ -16201,6 +16333,103 @@ export type PreviewReconcilingItemRequest = {
16201
16333
  event_id: string;
16202
16334
  };
16203
16335
 
16336
+ /**
16337
+ * PreviewScheduleRequest
16338
+ *
16339
+ * A schedule's definition, generated without being kept.
16340
+ */
16341
+ export type PreviewScheduleRequest = {
16342
+ /**
16343
+ * Name
16344
+ *
16345
+ * Schedule name
16346
+ */
16347
+ name: string;
16348
+ /**
16349
+ * Entity Id
16350
+ *
16351
+ * The entity whose books the schedule belongs to, by id. Omit for the group parent. Its facts, obligations and closing entries land in that entity's books, against that entity's own accounts.
16352
+ */
16353
+ entity_id?: string | null;
16354
+ /**
16355
+ * Taxonomy Id
16356
+ *
16357
+ * Taxonomy ID (auto-creates if omitted)
16358
+ */
16359
+ taxonomy_id?: string | null;
16360
+ /**
16361
+ * Element Ids
16362
+ *
16363
+ * CoA element ids the schedule touches (the `id` from get-unmapped-elements, not taxonomy qnames) — typically the same debit + credit ids used in entry_template.
16364
+ */
16365
+ element_ids: Array<string>;
16366
+ /**
16367
+ * Period Start
16368
+ *
16369
+ * First period start
16370
+ */
16371
+ period_start: string;
16372
+ /**
16373
+ * Period End
16374
+ *
16375
+ * Last period end
16376
+ */
16377
+ period_end: string;
16378
+ /**
16379
+ * Monthly Amount
16380
+ *
16381
+ * Monthly amount in cents. Required for a straight-line schedule; a custom or loan schedule takes its amounts from its curve.
16382
+ */
16383
+ monthly_amount?: number;
16384
+ entry_template: EntryTemplateRequest;
16385
+ schedule_metadata?: ScheduleMetadataRequest | null;
16386
+ /**
16387
+ * Closed Through
16388
+ *
16389
+ * Watermark for onboarding. Facts with period_end ≤ this date are flagged 'historical' and their schedule_entry_due obligations are emitted 'voided', so the close workflow starts drafting at the first open period. Defaults to the calendar's history end: the last day of its closed_through month (calendar '2026-05' → '2026-05-31'), or the day before its first month when nothing has closed yet. An earlier date is raised to it, since an obligation there could never post; set a later one only to treat more months as already booked.
16390
+ */
16391
+ closed_through?: string | null;
16392
+ /**
16393
+ * Source Transaction Id
16394
+ *
16395
+ * Free-form reference to the originating GL transaction (e.g. an import ID, ledger entry ID, or external system key). Stored in artifact_mechanics for audit; no FK constraint.
16396
+ */
16397
+ source_transaction_id?: string | null;
16398
+ /**
16399
+ * Replaces Structure Id
16400
+ *
16401
+ * The schedule this definition would replace, when editing or recreating one: the preview then says what its posted entries mean for the change.
16402
+ */
16403
+ replaces_structure_id?: string | null;
16404
+ };
16405
+
16406
+ /**
16407
+ * PreviewScheduleResponse
16408
+ *
16409
+ * A generated schedule nobody kept: its envelope as create would leave
16410
+ * it, period by period.
16411
+ */
16412
+ export type PreviewScheduleResponse = {
16413
+ /**
16414
+ * The schedule's Information Block envelope as create would leave it. Its ids are provisional: nothing was written.
16415
+ */
16416
+ envelope: InformationBlockEnvelope;
16417
+ /**
16418
+ * Roll Forward
16419
+ */
16420
+ roll_forward?: Array<ScheduleRollForwardRow>;
16421
+ /**
16422
+ * Warnings
16423
+ *
16424
+ * Things create would go ahead with that deserve a look: an active schedule already posting to the same accounts over the same months.
16425
+ */
16426
+ warnings?: Array<string>;
16427
+ /**
16428
+ * With `replaces_structure_id`: the schedule being replaced.
16429
+ */
16430
+ replaces?: ScheduleReplacementSummary | null;
16431
+ };
16432
+
16204
16433
  /**
16205
16434
  * PromoteObligationsRequest
16206
16435
  *
@@ -16636,6 +16865,11 @@ export type ReadTextResponse = {
16636
16865
  * month, are history), so a rebuild re-scopes the schedule to today's
16637
16866
  * close state. Use this to pick up a fixed generator (e.g. the
16638
16867
  * roll-forward direction fix) without orphaning obligations.
16868
+ *
16869
+ * It is also how an edit is saved while nothing has posted: the fields below
16870
+ * replace the stored definition before it regenerates, as the schedule's
16871
+ * envelope reads them back (`artifact.mechanics`). Omitted fields keep their
16872
+ * stored values, inside `schedule_metadata` too.
16639
16873
  */
16640
16874
  export type RebuildScheduleRequest = {
16641
16875
  /**
@@ -16644,6 +16878,32 @@ export type RebuildScheduleRequest = {
16644
16878
  * The schedule structure to regenerate in place.
16645
16879
  */
16646
16880
  structure_id: string;
16881
+ /**
16882
+ * Period Start
16883
+ *
16884
+ * A new first period start.
16885
+ */
16886
+ period_start?: string | null;
16887
+ /**
16888
+ * Period End
16889
+ *
16890
+ * A new last period end.
16891
+ */
16892
+ period_end?: string | null;
16893
+ /**
16894
+ * Monthly Amount
16895
+ *
16896
+ * A new straight-line monthly amount, in cents.
16897
+ */
16898
+ monthly_amount?: number | null;
16899
+ /**
16900
+ * A new entry template, replacing the stored one whole.
16901
+ */
16902
+ entry_template?: EntryTemplateRequest | null;
16903
+ /**
16904
+ * The schedule_metadata fields to change.
16905
+ */
16906
+ schedule_metadata?: ScheduleMetadataRequest | null;
16647
16907
  };
16648
16908
 
16649
16909
  /**
@@ -18702,6 +18962,38 @@ export type ScheduleCreatedResponse = {
18702
18962
  * Pending Event Count
18703
18963
  */
18704
18964
  pending_event_count?: number;
18965
+ /**
18966
+ * Warnings
18967
+ *
18968
+ * What the write went ahead with that deserves a look: another active schedule posting to the same accounts over the same months.
18969
+ */
18970
+ warnings?: Array<string>;
18971
+ };
18972
+
18973
+ /**
18974
+ * ScheduleLegRequest
18975
+ *
18976
+ * One line of the entry a loan schedule drafts each period.
18977
+ */
18978
+ export type ScheduleLegRequest = {
18979
+ /**
18980
+ * Element Id
18981
+ *
18982
+ * CoA element id the line posts to.
18983
+ */
18984
+ element_id: string;
18985
+ /**
18986
+ * Side
18987
+ *
18988
+ * The line's side.
18989
+ */
18990
+ side: 'debit' | 'credit';
18991
+ /**
18992
+ * Amount Source
18993
+ *
18994
+ * The amortization-table column the line takes each period: `interest` (accrued in the period), `interest_paid` (accrued interest settled by the period's payment), `principal` (principal repaid), `payment` (interest_paid + principal).
18995
+ */
18996
+ amount_source: 'interest' | 'interest_paid' | 'principal' | 'payment';
18705
18997
  };
18706
18998
 
18707
18999
  /**
@@ -18733,6 +19025,42 @@ export type ScheduleMechanics = {
18733
19025
  * Number of in-scope periods that have at least one closing entry posted. Runtime state derived at envelope-build time from the Entry table.
18734
19026
  */
18735
19027
  periods_with_entries?: number;
19028
+ /**
19029
+ * Period Start
19030
+ *
19031
+ * The schedule's first period start, as defined.
19032
+ */
19033
+ period_start?: string | null;
19034
+ /**
19035
+ * Period End
19036
+ *
19037
+ * The schedule's last period end, as defined. An early end is `end_date`; rebuild-schedule regenerates to this and ends at it again.
19038
+ */
19039
+ period_end?: string | null;
19040
+ /**
19041
+ * Monthly Amount
19042
+ *
19043
+ * The straight-line monthly amount in cents. With `period_start`, `period_end`, `entry_template` and `schedule_metadata` this is the whole definition: rebuild-schedule takes the same fields back.
19044
+ */
19045
+ monthly_amount?: number | null;
19046
+ /**
19047
+ * End Date
19048
+ *
19049
+ * Where terminate-schedule ended it, when it did.
19050
+ */
19051
+ end_date?: string | null;
19052
+ /**
19053
+ * Posted Periods
19054
+ *
19055
+ * The months (YYYY-MM) holding a posted or shadowed closing entry of the schedule, which no edit may rewrite.
19056
+ */
19057
+ posted_periods?: Array<string>;
19058
+ /**
19059
+ * Edit Warning
19060
+ *
19061
+ * Set once an entry has posted: what deleting, rebuilding or recreating the schedule would do to that history, and the path an edit takes instead.
19062
+ */
19063
+ edit_warning?: string | null;
18736
19064
  };
18737
19065
 
18738
19066
  /**
@@ -18742,9 +19070,13 @@ export type ScheduleMetadataRequest = {
18742
19070
  /**
18743
19071
  * Method
18744
19072
  *
18745
- * Calculation method. 'straight_line' (default) distributes `monthly_amount` evenly across periods with the final period absorbing rounding. 'custom' requires `periodic_amounts` — the generator uses those values verbatim instead of computing. Other strings are labels only; fact values still come from `monthly_amount` or `periodic_amounts`.
19073
+ * Calculation method. 'straight_line' (default) distributes `monthly_amount` evenly across periods with the final period absorbing rounding. 'custom' requires `periodic_amounts` — the generator uses those values verbatim instead of computing. 'effective_interest' requires `loan_terms` and the template's `legs`: the generator computes the amortization table (opening balance, interest, payment, principal, closing balance) and drafts the legs from it. Other strings are labels only; fact values still come from `monthly_amount` or `periodic_amounts`.
18746
19074
  */
18747
19075
  method?: string;
19076
+ /**
19077
+ * The loan's terms, for `method='effective_interest'`.
19078
+ */
19079
+ loan_terms?: LoanTermsRequest | null;
18748
19080
  /**
18749
19081
  * Original Amount
18750
19082
  *
@@ -18783,6 +19115,109 @@ export type ScheduleMetadataRequest = {
18783
19115
  periodic_amounts?: Array<number> | null;
18784
19116
  };
18785
19117
 
19118
+ /**
19119
+ * ScheduleReplacementSummary
19120
+ *
19121
+ * What an existing schedule's entries mean for replacing it.
19122
+ */
19123
+ export type ScheduleReplacementSummary = {
19124
+ /**
19125
+ * Structure Id
19126
+ */
19127
+ structure_id: string;
19128
+ /**
19129
+ * Name
19130
+ */
19131
+ name: string;
19132
+ /**
19133
+ * Posted Entry Count
19134
+ *
19135
+ * Its posted or shadowed closing entries.
19136
+ */
19137
+ posted_entry_count: number;
19138
+ /**
19139
+ * Posted Periods
19140
+ *
19141
+ * The months those entries are in (YYYY-MM).
19142
+ */
19143
+ posted_periods?: Array<string>;
19144
+ /**
19145
+ * Draft Entry Count
19146
+ */
19147
+ draft_entry_count?: number;
19148
+ /**
19149
+ * Path
19150
+ *
19151
+ * `rebuild` when nothing has posted: rebuild-schedule with the new definition replaces it in place. `terminate_and_succeed` once an entry has: terminate it after its last posted month and create the successor from the month after.
19152
+ */
19153
+ path: 'rebuild' | 'terminate_and_succeed';
19154
+ };
19155
+
19156
+ /**
19157
+ * ScheduleRollForwardRow
19158
+ *
19159
+ * One period of a previewed schedule: the balance it carries, and what
19160
+ * moves it.
19161
+ */
19162
+ export type ScheduleRollForwardRow = {
19163
+ /**
19164
+ * Period Start
19165
+ */
19166
+ period_start: string;
19167
+ /**
19168
+ * Period End
19169
+ */
19170
+ period_end: string;
19171
+ /**
19172
+ * Opening
19173
+ *
19174
+ * The carried balance at the period's start.
19175
+ */
19176
+ opening: number;
19177
+ /**
19178
+ * Amount
19179
+ *
19180
+ * What the period recognizes: the entry's debit amount.
19181
+ */
19182
+ amount: number;
19183
+ /**
19184
+ * Closing
19185
+ *
19186
+ * The carried balance at the period's end.
19187
+ */
19188
+ closing: number;
19189
+ /**
19190
+ * Scope
19191
+ *
19192
+ * `historical` for a month already in the books' history, which the schedule records but never drafts; `in_scope` for one a close drafts.
19193
+ */
19194
+ scope: 'historical' | 'in_scope';
19195
+ /**
19196
+ * Interest
19197
+ *
19198
+ * Loan schedules: interest accrued.
19199
+ */
19200
+ interest?: number | null;
19201
+ /**
19202
+ * Payment
19203
+ *
19204
+ * Loan schedules: the payment.
19205
+ */
19206
+ payment?: number | null;
19207
+ /**
19208
+ * Principal
19209
+ *
19210
+ * Loan schedules: principal repaid.
19211
+ */
19212
+ principal?: number | null;
19213
+ /**
19214
+ * Current Portion
19215
+ *
19216
+ * Loan schedules with a current-portion account: the principal due in the next twelve months.
19217
+ */
19218
+ current_portion?: number | null;
19219
+ };
19220
+
18786
19221
  /**
18787
19222
  * SchemaExportResponse
18788
19223
  *
@@ -34247,6 +34682,70 @@ export type PromoteObligationsResponses = {
34247
34682
 
34248
34683
  export type PromoteObligationsResponse2 = PromoteObligationsResponses[keyof PromoteObligationsResponses];
34249
34684
 
34685
+ export type PreviewScheduleData = {
34686
+ body: PreviewScheduleRequest;
34687
+ headers?: {
34688
+ /**
34689
+ * Idempotency-Key
34690
+ */
34691
+ 'Idempotency-Key'?: string | null;
34692
+ };
34693
+ path: {
34694
+ /**
34695
+ * Graph Id
34696
+ */
34697
+ graph_id: string;
34698
+ };
34699
+ query?: never;
34700
+ url: '/extensions/roboledger/{graph_id}/operations/preview-schedule';
34701
+ };
34702
+
34703
+ export type PreviewScheduleErrors = {
34704
+ /**
34705
+ * Invalid request
34706
+ */
34707
+ 400: ErrorResponse;
34708
+ /**
34709
+ * Authentication required
34710
+ */
34711
+ 401: ErrorResponse;
34712
+ /**
34713
+ * Access denied
34714
+ */
34715
+ 403: ErrorResponse;
34716
+ /**
34717
+ * Resource not found
34718
+ */
34719
+ 404: ErrorResponse;
34720
+ /**
34721
+ * Idempotency-Key conflict — key reused with different body
34722
+ */
34723
+ 409: ErrorResponse;
34724
+ /**
34725
+ * Validation error
34726
+ */
34727
+ 422: ErrorResponse;
34728
+ /**
34729
+ * Rate limit exceeded
34730
+ */
34731
+ 429: ErrorResponse;
34732
+ /**
34733
+ * Internal server error
34734
+ */
34735
+ 500: ErrorResponse;
34736
+ };
34737
+
34738
+ export type PreviewScheduleError = PreviewScheduleErrors[keyof PreviewScheduleErrors];
34739
+
34740
+ export type PreviewScheduleResponses = {
34741
+ /**
34742
+ * Successful Response
34743
+ */
34744
+ 200: OperationEnvelopePreviewScheduleResponse;
34745
+ };
34746
+
34747
+ export type PreviewScheduleResponse2 = PreviewScheduleResponses[keyof PreviewScheduleResponses];
34748
+
34250
34749
  export type RebuildScheduleData = {
34251
34750
  body: RebuildScheduleRequest;
34252
34751
  headers?: {