@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.d.ts CHANGED
@@ -3941,9 +3941,9 @@ export type CreateScheduleRequest = {
3941
3941
  /**
3942
3942
  * Monthly Amount
3943
3943
  *
3944
- * Monthly amount in cents
3944
+ * Monthly amount in cents. Required for a straight-line schedule; a custom or loan schedule takes its amounts from its curve.
3945
3945
  */
3946
- monthly_amount: number;
3946
+ monthly_amount?: number;
3947
3947
  entry_template: EntryTemplateRequest;
3948
3948
  schedule_metadata?: ScheduleMetadataRequest | null;
3949
3949
  /**
@@ -6023,7 +6023,7 @@ export type EntryTemplateRequest = {
6023
6023
  /**
6024
6024
  * Credit Element Id
6025
6025
  *
6026
- * 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.
6026
+ * 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`.
6027
6027
  */
6028
6028
  credit_element_id: string;
6029
6029
  /**
@@ -6050,6 +6050,12 @@ export type EntryTemplateRequest = {
6050
6050
  * 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.
6051
6051
  */
6052
6052
  dimension_ids?: Array<string>;
6053
+ /**
6054
+ * Legs
6055
+ *
6056
+ * 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.
6057
+ */
6058
+ legs?: Array<ScheduleLegRequest>;
6053
6059
  };
6054
6060
  /**
6055
6061
  * ErrorResponse
@@ -10444,6 +10450,85 @@ export type LiveStatementFactRow = {
10444
10450
  */
10445
10451
  sources?: Array<Array<StatementRowSource>> | null;
10446
10452
  };
10453
+ /**
10454
+ * LoanTermsRequest
10455
+ *
10456
+ * The terms a loan schedule's amortization table is computed from.
10457
+ */
10458
+ export type LoanTermsRequest = {
10459
+ /**
10460
+ * Principal
10461
+ *
10462
+ * Principal drawn, in cents.
10463
+ */
10464
+ principal: number;
10465
+ /**
10466
+ * Annual Rate
10467
+ *
10468
+ * Annual interest rate as a fraction: 0.099 for 9.9%.
10469
+ */
10470
+ annual_rate: number;
10471
+ /**
10472
+ * Start Date
10473
+ *
10474
+ * The day the principal was drawn; interest accrues from it. Falls in the schedule's first month.
10475
+ */
10476
+ start_date: string;
10477
+ /**
10478
+ * Day Count
10479
+ *
10480
+ * 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).
10481
+ */
10482
+ day_count?: '30/360' | 'actual/365' | 'actual/360';
10483
+ /**
10484
+ * Payment Frequency
10485
+ *
10486
+ * How often a payment falls due. A payment is applied at the end of the month it falls in.
10487
+ */
10488
+ payment_frequency?: 'monthly' | 'quarterly' | 'annual' | 'at_maturity';
10489
+ /**
10490
+ * First Payment Date
10491
+ *
10492
+ * The first payment's date. Omit for one frequency after the schedule's first month.
10493
+ */
10494
+ first_payment_date?: string | null;
10495
+ /**
10496
+ * Payment Amount
10497
+ *
10498
+ * 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`.
10499
+ */
10500
+ payment_amount?: number | null;
10501
+ /**
10502
+ * Interest Only
10503
+ *
10504
+ * Payments settle interest only; the principal is due at maturity.
10505
+ */
10506
+ interest_only?: boolean;
10507
+ /**
10508
+ * Maturity Date
10509
+ *
10510
+ * 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.
10511
+ */
10512
+ maturity_date?: string | null;
10513
+ /**
10514
+ * Capitalize Interest
10515
+ *
10516
+ * 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.
10517
+ */
10518
+ capitalize_interest?: boolean;
10519
+ /**
10520
+ * Note Element Id
10521
+ *
10522
+ * The liability account the principal is carried in. The schedule states its balance each period, which the schedule reconciliation compares with the ledger.
10523
+ */
10524
+ note_element_id: string;
10525
+ /**
10526
+ * Current Portion Element Id
10527
+ *
10528
+ * 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.
10529
+ */
10530
+ current_portion_element_id?: string | null;
10531
+ };
10447
10532
  /**
10448
10533
  * LoginRequest
10449
10534
  *
@@ -13232,6 +13317,51 @@ export type OperationEnvelopePreviewEventBlockResponse = {
13232
13317
  */
13233
13318
  idempotentReplay?: boolean;
13234
13319
  };
13320
+ /**
13321
+ * OperationEnvelope[PreviewScheduleResponse]
13322
+ */
13323
+ export type OperationEnvelopePreviewScheduleResponse = {
13324
+ /**
13325
+ * Operation
13326
+ *
13327
+ * Kebab-case operation name
13328
+ */
13329
+ operation: string;
13330
+ /**
13331
+ * Operationid
13332
+ *
13333
+ * op_-prefixed ULID for audit and SSE correlation
13334
+ */
13335
+ operationId: string;
13336
+ /**
13337
+ * Status
13338
+ *
13339
+ * Operation lifecycle state
13340
+ */
13341
+ status: 'completed' | 'pending' | 'failed';
13342
+ /**
13343
+ * Command-specific result payload
13344
+ */
13345
+ result?: PreviewScheduleResponse | null;
13346
+ /**
13347
+ * At
13348
+ *
13349
+ * ISO-8601 UTC timestamp
13350
+ */
13351
+ at: string;
13352
+ /**
13353
+ * Createdby
13354
+ *
13355
+ * User ID that initiated the operation
13356
+ */
13357
+ createdBy?: string | null;
13358
+ /**
13359
+ * Idempotentreplay
13360
+ *
13361
+ * True when this envelope came from the idempotency cache — the underlying command did not execute again. False on fresh executions.
13362
+ */
13363
+ idempotentReplay?: boolean;
13364
+ };
13235
13365
  /**
13236
13366
  * OperationEnvelope[PromoteObligationsResponse]
13237
13367
  */
@@ -15831,6 +15961,101 @@ export type PreviewReconcilingItemRequest = {
15831
15961
  */
15832
15962
  event_id: string;
15833
15963
  };
15964
+ /**
15965
+ * PreviewScheduleRequest
15966
+ *
15967
+ * A schedule's definition, generated without being kept.
15968
+ */
15969
+ export type PreviewScheduleRequest = {
15970
+ /**
15971
+ * Name
15972
+ *
15973
+ * Schedule name
15974
+ */
15975
+ name: string;
15976
+ /**
15977
+ * Entity Id
15978
+ *
15979
+ * 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.
15980
+ */
15981
+ entity_id?: string | null;
15982
+ /**
15983
+ * Taxonomy Id
15984
+ *
15985
+ * Taxonomy ID (auto-creates if omitted)
15986
+ */
15987
+ taxonomy_id?: string | null;
15988
+ /**
15989
+ * Element Ids
15990
+ *
15991
+ * 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.
15992
+ */
15993
+ element_ids: Array<string>;
15994
+ /**
15995
+ * Period Start
15996
+ *
15997
+ * First period start
15998
+ */
15999
+ period_start: string;
16000
+ /**
16001
+ * Period End
16002
+ *
16003
+ * Last period end
16004
+ */
16005
+ period_end: string;
16006
+ /**
16007
+ * Monthly Amount
16008
+ *
16009
+ * Monthly amount in cents. Required for a straight-line schedule; a custom or loan schedule takes its amounts from its curve.
16010
+ */
16011
+ monthly_amount?: number;
16012
+ entry_template: EntryTemplateRequest;
16013
+ schedule_metadata?: ScheduleMetadataRequest | null;
16014
+ /**
16015
+ * Closed Through
16016
+ *
16017
+ * 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.
16018
+ */
16019
+ closed_through?: string | null;
16020
+ /**
16021
+ * Source Transaction Id
16022
+ *
16023
+ * 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.
16024
+ */
16025
+ source_transaction_id?: string | null;
16026
+ /**
16027
+ * Replaces Structure Id
16028
+ *
16029
+ * The schedule this definition would replace, when editing or recreating one: the preview then says what its posted entries mean for the change.
16030
+ */
16031
+ replaces_structure_id?: string | null;
16032
+ };
16033
+ /**
16034
+ * PreviewScheduleResponse
16035
+ *
16036
+ * A generated schedule nobody kept: its envelope as create would leave
16037
+ * it, period by period.
16038
+ */
16039
+ export type PreviewScheduleResponse = {
16040
+ /**
16041
+ * The schedule's Information Block envelope as create would leave it. Its ids are provisional: nothing was written.
16042
+ */
16043
+ envelope: InformationBlockEnvelope;
16044
+ /**
16045
+ * Roll Forward
16046
+ */
16047
+ roll_forward?: Array<ScheduleRollForwardRow>;
16048
+ /**
16049
+ * Warnings
16050
+ *
16051
+ * Things create would go ahead with that deserve a look: an active schedule already posting to the same accounts over the same months.
16052
+ */
16053
+ warnings?: Array<string>;
16054
+ /**
16055
+ * With `replaces_structure_id`: the schedule being replaced.
16056
+ */
16057
+ replaces?: ScheduleReplacementSummary | null;
16058
+ };
15834
16059
  /**
15835
16060
  * PromoteObligationsRequest
15836
16061
  *
@@ -16255,6 +16480,11 @@ export type ReadTextResponse = {
16255
16480
  * month, are history), so a rebuild re-scopes the schedule to today's
16256
16481
  * close state. Use this to pick up a fixed generator (e.g. the
16257
16482
  * roll-forward direction fix) without orphaning obligations.
16483
+ *
16484
+ * It is also how an edit is saved while nothing has posted: the fields below
16485
+ * replace the stored definition before it regenerates, as the schedule's
16486
+ * envelope reads them back (`artifact.mechanics`). Omitted fields keep their
16487
+ * stored values, inside `schedule_metadata` too.
16258
16488
  */
16259
16489
  export type RebuildScheduleRequest = {
16260
16490
  /**
@@ -16263,6 +16493,32 @@ export type RebuildScheduleRequest = {
16263
16493
  * The schedule structure to regenerate in place.
16264
16494
  */
16265
16495
  structure_id: string;
16496
+ /**
16497
+ * Period Start
16498
+ *
16499
+ * A new first period start.
16500
+ */
16501
+ period_start?: string | null;
16502
+ /**
16503
+ * Period End
16504
+ *
16505
+ * A new last period end.
16506
+ */
16507
+ period_end?: string | null;
16508
+ /**
16509
+ * Monthly Amount
16510
+ *
16511
+ * A new straight-line monthly amount, in cents.
16512
+ */
16513
+ monthly_amount?: number | null;
16514
+ /**
16515
+ * A new entry template, replacing the stored one whole.
16516
+ */
16517
+ entry_template?: EntryTemplateRequest | null;
16518
+ /**
16519
+ * The schedule_metadata fields to change.
16520
+ */
16521
+ schedule_metadata?: ScheduleMetadataRequest | null;
16266
16522
  };
16267
16523
  /**
16268
16524
  * ReconciliationComponent
@@ -18274,6 +18530,37 @@ export type ScheduleCreatedResponse = {
18274
18530
  * Pending Event Count
18275
18531
  */
18276
18532
  pending_event_count?: number;
18533
+ /**
18534
+ * Warnings
18535
+ *
18536
+ * What the write went ahead with that deserves a look: another active schedule posting to the same accounts over the same months.
18537
+ */
18538
+ warnings?: Array<string>;
18539
+ };
18540
+ /**
18541
+ * ScheduleLegRequest
18542
+ *
18543
+ * One line of the entry a loan schedule drafts each period.
18544
+ */
18545
+ export type ScheduleLegRequest = {
18546
+ /**
18547
+ * Element Id
18548
+ *
18549
+ * CoA element id the line posts to.
18550
+ */
18551
+ element_id: string;
18552
+ /**
18553
+ * Side
18554
+ *
18555
+ * The line's side.
18556
+ */
18557
+ side: 'debit' | 'credit';
18558
+ /**
18559
+ * Amount Source
18560
+ *
18561
+ * 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).
18562
+ */
18563
+ amount_source: 'interest' | 'interest_paid' | 'principal' | 'payment';
18277
18564
  };
18278
18565
  /**
18279
18566
  * ScheduleMechanics
@@ -18304,6 +18591,42 @@ export type ScheduleMechanics = {
18304
18591
  * Number of in-scope periods that have at least one closing entry posted. Runtime state derived at envelope-build time from the Entry table.
18305
18592
  */
18306
18593
  periods_with_entries?: number;
18594
+ /**
18595
+ * Period Start
18596
+ *
18597
+ * The schedule's first period start, as defined.
18598
+ */
18599
+ period_start?: string | null;
18600
+ /**
18601
+ * Period End
18602
+ *
18603
+ * The schedule's last period end, as defined. An early end is `end_date`; rebuild-schedule regenerates to this and ends at it again.
18604
+ */
18605
+ period_end?: string | null;
18606
+ /**
18607
+ * Monthly Amount
18608
+ *
18609
+ * 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.
18610
+ */
18611
+ monthly_amount?: number | null;
18612
+ /**
18613
+ * End Date
18614
+ *
18615
+ * Where terminate-schedule ended it, when it did.
18616
+ */
18617
+ end_date?: string | null;
18618
+ /**
18619
+ * Posted Periods
18620
+ *
18621
+ * The months (YYYY-MM) holding a posted or shadowed closing entry of the schedule, which no edit may rewrite.
18622
+ */
18623
+ posted_periods?: Array<string>;
18624
+ /**
18625
+ * Edit Warning
18626
+ *
18627
+ * 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.
18628
+ */
18629
+ edit_warning?: string | null;
18307
18630
  };
18308
18631
  /**
18309
18632
  * ScheduleMetadataRequest
@@ -18312,9 +18635,13 @@ export type ScheduleMetadataRequest = {
18312
18635
  /**
18313
18636
  * Method
18314
18637
  *
18315
- * 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`.
18638
+ * 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`.
18316
18639
  */
18317
18640
  method?: string;
18641
+ /**
18642
+ * The loan's terms, for `method='effective_interest'`.
18643
+ */
18644
+ loan_terms?: LoanTermsRequest | null;
18318
18645
  /**
18319
18646
  * Original Amount
18320
18647
  *
@@ -18352,6 +18679,107 @@ export type ScheduleMetadataRequest = {
18352
18679
  */
18353
18680
  periodic_amounts?: Array<number> | null;
18354
18681
  };
18682
+ /**
18683
+ * ScheduleReplacementSummary
18684
+ *
18685
+ * What an existing schedule's entries mean for replacing it.
18686
+ */
18687
+ export type ScheduleReplacementSummary = {
18688
+ /**
18689
+ * Structure Id
18690
+ */
18691
+ structure_id: string;
18692
+ /**
18693
+ * Name
18694
+ */
18695
+ name: string;
18696
+ /**
18697
+ * Posted Entry Count
18698
+ *
18699
+ * Its posted or shadowed closing entries.
18700
+ */
18701
+ posted_entry_count: number;
18702
+ /**
18703
+ * Posted Periods
18704
+ *
18705
+ * The months those entries are in (YYYY-MM).
18706
+ */
18707
+ posted_periods?: Array<string>;
18708
+ /**
18709
+ * Draft Entry Count
18710
+ */
18711
+ draft_entry_count?: number;
18712
+ /**
18713
+ * Path
18714
+ *
18715
+ * `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.
18716
+ */
18717
+ path: 'rebuild' | 'terminate_and_succeed';
18718
+ };
18719
+ /**
18720
+ * ScheduleRollForwardRow
18721
+ *
18722
+ * One period of a previewed schedule: the balance it carries, and what
18723
+ * moves it.
18724
+ */
18725
+ export type ScheduleRollForwardRow = {
18726
+ /**
18727
+ * Period Start
18728
+ */
18729
+ period_start: string;
18730
+ /**
18731
+ * Period End
18732
+ */
18733
+ period_end: string;
18734
+ /**
18735
+ * Opening
18736
+ *
18737
+ * The carried balance at the period's start.
18738
+ */
18739
+ opening: number;
18740
+ /**
18741
+ * Amount
18742
+ *
18743
+ * What the period recognizes: the entry's debit amount.
18744
+ */
18745
+ amount: number;
18746
+ /**
18747
+ * Closing
18748
+ *
18749
+ * The carried balance at the period's end.
18750
+ */
18751
+ closing: number;
18752
+ /**
18753
+ * Scope
18754
+ *
18755
+ * `historical` for a month already in the books' history, which the schedule records but never drafts; `in_scope` for one a close drafts.
18756
+ */
18757
+ scope: 'historical' | 'in_scope';
18758
+ /**
18759
+ * Interest
18760
+ *
18761
+ * Loan schedules: interest accrued.
18762
+ */
18763
+ interest?: number | null;
18764
+ /**
18765
+ * Payment
18766
+ *
18767
+ * Loan schedules: the payment.
18768
+ */
18769
+ payment?: number | null;
18770
+ /**
18771
+ * Principal
18772
+ *
18773
+ * Loan schedules: principal repaid.
18774
+ */
18775
+ principal?: number | null;
18776
+ /**
18777
+ * Current Portion
18778
+ *
18779
+ * Loan schedules with a current-portion account: the principal due in the next twelve months.
18780
+ */
18781
+ current_portion?: number | null;
18782
+ };
18355
18783
  /**
18356
18784
  * SchemaExportResponse
18357
18785
  *
@@ -32739,6 +33167,65 @@ export type PromoteObligationsResponses = {
32739
33167
  200: OperationEnvelopePromoteObligationsResponse;
32740
33168
  };
32741
33169
  export type PromoteObligationsResponse2 = PromoteObligationsResponses[keyof PromoteObligationsResponses];
33170
+ export type PreviewScheduleData = {
33171
+ body: PreviewScheduleRequest;
33172
+ headers?: {
33173
+ /**
33174
+ * Idempotency-Key
33175
+ */
33176
+ 'Idempotency-Key'?: string | null;
33177
+ };
33178
+ path: {
33179
+ /**
33180
+ * Graph Id
33181
+ */
33182
+ graph_id: string;
33183
+ };
33184
+ query?: never;
33185
+ url: '/extensions/roboledger/{graph_id}/operations/preview-schedule';
33186
+ };
33187
+ export type PreviewScheduleErrors = {
33188
+ /**
33189
+ * Invalid request
33190
+ */
33191
+ 400: ErrorResponse;
33192
+ /**
33193
+ * Authentication required
33194
+ */
33195
+ 401: ErrorResponse;
33196
+ /**
33197
+ * Access denied
33198
+ */
33199
+ 403: ErrorResponse;
33200
+ /**
33201
+ * Resource not found
33202
+ */
33203
+ 404: ErrorResponse;
33204
+ /**
33205
+ * Idempotency-Key conflict — key reused with different body
33206
+ */
33207
+ 409: ErrorResponse;
33208
+ /**
33209
+ * Validation error
33210
+ */
33211
+ 422: ErrorResponse;
33212
+ /**
33213
+ * Rate limit exceeded
33214
+ */
33215
+ 429: ErrorResponse;
33216
+ /**
33217
+ * Internal server error
33218
+ */
33219
+ 500: ErrorResponse;
33220
+ };
33221
+ export type PreviewScheduleError = PreviewScheduleErrors[keyof PreviewScheduleErrors];
33222
+ export type PreviewScheduleResponses = {
33223
+ /**
33224
+ * Successful Response
33225
+ */
33226
+ 200: OperationEnvelopePreviewScheduleResponse;
33227
+ };
33228
+ export type PreviewScheduleResponse2 = PreviewScheduleResponses[keyof PreviewScheduleResponses];
32742
33229
  export type RebuildScheduleData = {
32743
33230
  body: RebuildScheduleRequest;
32744
33231
  headers?: {