@robosystems/client 2.30.0 → 2.32.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/artifacts/LedgerClient.d.ts +208 -23
- package/artifacts/LedgerClient.js +123 -26
- package/artifacts/LedgerClient.ts +333 -47
- package/artifacts/graphql/generated/graphql.d.ts +1 -0
- package/artifacts/graphql/generated/graphql.js +14 -0
- package/artifacts/graphql/generated/graphql.ts +15 -0
- package/artifacts/graphql/queries/ledger/elements.d.ts +2 -1
- package/artifacts/graphql/queries/ledger/elements.js +4 -1
- package/artifacts/graphql/queries/ledger/elements.ts +4 -1
- package/index.ts +2 -2
- package/package.json +1 -1
- package/sdk/index.d.ts +2 -2
- package/sdk/index.js +4 -2
- package/sdk/index.ts +2 -2
- package/sdk/sdk.gen.d.ts +18 -2
- package/sdk/sdk.gen.js +37 -3
- package/sdk/sdk.gen.ts +36 -2
- package/sdk/types.gen.d.ts +726 -8
- package/sdk/types.gen.ts +746 -7
- package/sdk.gen.d.ts +18 -2
- package/sdk.gen.js +37 -3
- package/sdk.gen.ts +36 -2
- package/types.gen.d.ts +726 -8
- package/types.gen.ts +746 -7
|
@@ -67,6 +67,7 @@ import {
|
|
|
67
67
|
previewEventBlock,
|
|
68
68
|
previewReconciliations,
|
|
69
69
|
previewReconcilingItem,
|
|
70
|
+
previewSchedule,
|
|
70
71
|
promoteObligations,
|
|
71
72
|
proposeConsolidationEntries,
|
|
72
73
|
rebuildSchedule,
|
|
@@ -125,6 +126,7 @@ import type {
|
|
|
125
126
|
CreateMappingAssociationOperation,
|
|
126
127
|
CreatePublishListRequest,
|
|
127
128
|
CreateReportRequest,
|
|
129
|
+
CreateScheduleArm,
|
|
128
130
|
CreateTaxonomyBlockRequest,
|
|
129
131
|
CreateViewRequest,
|
|
130
132
|
DeleteInformationBlockRequest,
|
|
@@ -136,6 +138,7 @@ import type {
|
|
|
136
138
|
DeleteTaxonomyBlockResponse,
|
|
137
139
|
DimensionResponse,
|
|
138
140
|
EntityTaxonomyResponse,
|
|
141
|
+
EntryTemplateRequest,
|
|
139
142
|
EvaluateRulesRequest,
|
|
140
143
|
EvaluateRulesResponse,
|
|
141
144
|
EventBlockEnvelope,
|
|
@@ -156,11 +159,13 @@ import type {
|
|
|
156
159
|
LinkEntityTaxonomyRequest,
|
|
157
160
|
LiveFinancialStatementRequest,
|
|
158
161
|
LiveFinancialStatementResponse,
|
|
162
|
+
LoanTermsRequest,
|
|
159
163
|
OperationEnvelope,
|
|
160
164
|
OwnershipChangeResponse,
|
|
161
165
|
PreviewConsolidationEntriesResponse,
|
|
162
166
|
PreviewEventBlockResponse,
|
|
163
167
|
PreviewReconciliationsRequest,
|
|
168
|
+
PreviewScheduleRequest,
|
|
164
169
|
PromoteObligationsRequest,
|
|
165
170
|
PromoteObligationsResponse,
|
|
166
171
|
ProposeConsolidationEntriesResponse,
|
|
@@ -185,6 +190,7 @@ import type {
|
|
|
185
190
|
ResolveReconcilingItemRequest,
|
|
186
191
|
ResolveReconcilingItemResponse,
|
|
187
192
|
RevokeReportShareResponse,
|
|
193
|
+
ScheduleMetadataRequest,
|
|
188
194
|
SetAllocationOverrideRequest,
|
|
189
195
|
SetCloseTargetOperation,
|
|
190
196
|
SetReconciliationPolicyRequest,
|
|
@@ -866,36 +872,264 @@ export interface LedgerReconciliationPolicy {
|
|
|
866
872
|
statementCycle: StatementCycle | null
|
|
867
873
|
}
|
|
868
874
|
|
|
875
|
+
export type ScheduleMethod = 'straight_line' | 'custom' | 'effective_interest'
|
|
876
|
+
/** The columns of a loan schedule's amortization table a leg can post. */
|
|
877
|
+
export type ScheduleCurveColumn = 'interest' | 'interest_paid' | 'principal' | 'payment'
|
|
878
|
+
export type ScheduleDayCount = '30/360' | 'actual/365' | 'actual/360'
|
|
879
|
+
export type SchedulePaymentFrequency = 'monthly' | 'quarterly' | 'annual' | 'at_maturity'
|
|
880
|
+
|
|
881
|
+
/** One line of the entry a loan schedule drafts each period. */
|
|
882
|
+
export interface ScheduleLeg {
|
|
883
|
+
elementId: string
|
|
884
|
+
side: 'debit' | 'credit'
|
|
885
|
+
/**
|
|
886
|
+
* The amortization-table column the line takes each period: `interest`
|
|
887
|
+
* (accrued in the period), `interest_paid` (accrued interest settled by
|
|
888
|
+
* the period's payment), `principal` (principal repaid), `payment`
|
|
889
|
+
* (interest_paid + principal).
|
|
890
|
+
*/
|
|
891
|
+
amountSource: ScheduleCurveColumn
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
/** The terms a loan schedule's amortization table is computed from. */
|
|
895
|
+
export interface LoanTerms {
|
|
896
|
+
/** Principal drawn, in cents. */
|
|
897
|
+
principal: number
|
|
898
|
+
/** Annual interest rate as a fraction: 0.099 for 9.9%. */
|
|
899
|
+
annualRate: number
|
|
900
|
+
/** The day the principal was drawn (YYYY-MM-DD); falls in the schedule's first month. */
|
|
901
|
+
startDate: string
|
|
902
|
+
/** `30/360` (default), `actual/365`, or `actual/360` (the usual bank line of credit). */
|
|
903
|
+
dayCount?: ScheduleDayCount
|
|
904
|
+
/** How often a payment falls due, applied at the end of the month it falls in. Default monthly. */
|
|
905
|
+
paymentFrequency?: SchedulePaymentFrequency
|
|
906
|
+
/** The first payment's date. Omit for one frequency after the schedule's first month. */
|
|
907
|
+
firstPaymentDate?: string | null
|
|
908
|
+
/**
|
|
909
|
+
* Each scheduled payment in cents, interest included. Omit for the level
|
|
910
|
+
* payment that retires the principal by `maturityDate`, or for the accrued
|
|
911
|
+
* interest when `interestOnly`.
|
|
912
|
+
*/
|
|
913
|
+
paymentAmount?: number | null
|
|
914
|
+
/** Payments settle interest only; the principal is due at maturity. */
|
|
915
|
+
interestOnly?: boolean
|
|
916
|
+
/**
|
|
917
|
+
* When the remaining principal is due: repaid in that month, the
|
|
918
|
+
* schedule's last. Omit for a line of credit with no maturity, whose
|
|
919
|
+
* balance carries past the schedule.
|
|
920
|
+
*/
|
|
921
|
+
maturityDate?: string | null
|
|
922
|
+
/** Interest is added to the note (a PIK note) rather than accrued apart. */
|
|
923
|
+
capitalizeInterest?: boolean
|
|
924
|
+
/**
|
|
925
|
+
* The liability account the principal is carried in. The schedule states
|
|
926
|
+
* its balance each period, which the schedule reconciliation compares
|
|
927
|
+
* with the ledger.
|
|
928
|
+
*/
|
|
929
|
+
noteElementId: string
|
|
930
|
+
/**
|
|
931
|
+
* A current-liability account for the principal due within twelve
|
|
932
|
+
* months. When set, each period's entry also reclasses between it and
|
|
933
|
+
* the note so it holds the next twelve months' principal.
|
|
934
|
+
*/
|
|
935
|
+
currentPortionElementId?: string | null
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
export interface ScheduleEntryTemplate {
|
|
939
|
+
/** The account debited: a straight-line or custom schedule's debit; a loan's interest debit leg. */
|
|
940
|
+
debitElementId: string
|
|
941
|
+
/** The account credited: the pair's credit; one of a loan's credit legs. */
|
|
942
|
+
creditElementId: string
|
|
943
|
+
entryType?: LedgerEntryType
|
|
944
|
+
memoTemplate?: string
|
|
945
|
+
/** Auto-generate a reversing entry on the first day of the next period. */
|
|
946
|
+
autoReverse?: boolean
|
|
947
|
+
/** The management dimension members every drafted entry carries, one per axis. */
|
|
948
|
+
dimensionIds?: string[]
|
|
949
|
+
/**
|
|
950
|
+
* The lines of a loan schedule's entry (`method: 'effective_interest'`
|
|
951
|
+
* only), each taking one column of the amortization table; each period's
|
|
952
|
+
* lines must balance. Accrue and pay through the bank: debit Interest
|
|
953
|
+
* Expense and credit Accrued Interest, both `interest`. The schedule
|
|
954
|
+
* settles the payment itself: debit the note `principal`, debit Interest
|
|
955
|
+
* Expense `interest`, credit cash or a due-to `payment`.
|
|
956
|
+
*/
|
|
957
|
+
legs?: ScheduleLeg[]
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
export interface ScheduleMetadata {
|
|
961
|
+
/**
|
|
962
|
+
* `straight_line` (default) spreads `monthlyAmount` over the months, the
|
|
963
|
+
* last absorbing rounding; `custom` takes `periodicAmounts`;
|
|
964
|
+
* `effective_interest` is a loan computed from `loanTerms`.
|
|
965
|
+
*/
|
|
966
|
+
method?: ScheduleMethod | (string & {})
|
|
967
|
+
/** Cost basis in cents. */
|
|
968
|
+
originalAmount?: number
|
|
969
|
+
/** Salvage value in cents; the schedule expenses `originalAmount` less this. */
|
|
970
|
+
residualValue?: number
|
|
971
|
+
usefulLifeMonths?: number
|
|
972
|
+
/** Balance-sheet asset element for net book value. */
|
|
973
|
+
assetElementId?: string
|
|
974
|
+
/**
|
|
975
|
+
* The day the cost went on the books (YYYY-MM-DD), when that is before
|
|
976
|
+
* the schedule's first period. The schedule reconciliation carries the
|
|
977
|
+
* cost from that day.
|
|
978
|
+
*/
|
|
979
|
+
bookedOn?: string
|
|
980
|
+
/**
|
|
981
|
+
* `custom` only: one cents value per month, non-negative, summing to
|
|
982
|
+
* `originalAmount` less `residualValue`.
|
|
983
|
+
*/
|
|
984
|
+
periodicAmounts?: number[]
|
|
985
|
+
/** `effective_interest` only. */
|
|
986
|
+
loanTerms?: LoanTerms
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* A schedule's definition: what `createSchedule` and `previewSchedule`
|
|
991
|
+
* take, and what `rebuildSchedule` saves back.
|
|
992
|
+
*/
|
|
869
993
|
export interface CreateScheduleOptions {
|
|
870
994
|
name: string
|
|
871
995
|
elementIds: string[]
|
|
872
996
|
periodStart: string
|
|
873
997
|
periodEnd: string
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
}
|
|
998
|
+
/**
|
|
999
|
+
* Monthly amount in cents. Required for a straight-line schedule; a
|
|
1000
|
+
* custom or loan schedule takes its amounts from its curve.
|
|
1001
|
+
*/
|
|
1002
|
+
monthlyAmount?: number
|
|
1003
|
+
entryTemplate: ScheduleEntryTemplate
|
|
881
1004
|
taxonomyId?: string
|
|
882
|
-
scheduleMetadata?:
|
|
883
|
-
method?: string
|
|
884
|
-
originalAmount?: number
|
|
885
|
-
residualValue?: number
|
|
886
|
-
usefulLifeMonths?: number
|
|
887
|
-
assetElementId?: string
|
|
888
|
-
/**
|
|
889
|
-
* The day the cost went on the books (YYYY-MM-DD), when that is before
|
|
890
|
-
* the schedule's first period. The schedule reconciliation carries the
|
|
891
|
-
* cost from that day.
|
|
892
|
-
*/
|
|
893
|
-
bookedOn?: string
|
|
894
|
-
}
|
|
1005
|
+
scheduleMetadata?: ScheduleMetadata
|
|
895
1006
|
/** The entity whose books the schedule belongs to. Omit for the group parent. */
|
|
896
1007
|
entityId?: string | null
|
|
1008
|
+
/**
|
|
1009
|
+
* Onboarding watermark: months ending on or before it are history the
|
|
1010
|
+
* schedule records but never drafts. Defaults to the calendar's
|
|
1011
|
+
* closed-through month.
|
|
1012
|
+
*/
|
|
1013
|
+
closedThrough?: string
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
export interface PreviewScheduleOptions extends CreateScheduleOptions {
|
|
1017
|
+
/** The schedule this definition would replace, when editing or recreating one. */
|
|
1018
|
+
replacesStructureId?: string | null
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
export interface RebuildScheduleOptions {
|
|
1022
|
+
idempotencyKey?: string
|
|
1023
|
+
periodStart?: string
|
|
1024
|
+
periodEnd?: string
|
|
1025
|
+
monthlyAmount?: number
|
|
1026
|
+
/** A new entry template, replacing the stored one whole. */
|
|
1027
|
+
entryTemplate?: ScheduleEntryTemplate
|
|
1028
|
+
/** The schedule_metadata fields to change; the rest keep their stored values. */
|
|
1029
|
+
scheduleMetadata?: ScheduleMetadata
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
/** One period of a previewed schedule: the balance it carries, and what moves it. */
|
|
1033
|
+
export interface ScheduleRollForwardPeriod {
|
|
1034
|
+
periodStart: string
|
|
1035
|
+
periodEnd: string
|
|
1036
|
+
opening: number
|
|
1037
|
+
/** What the period recognizes: the entry's debit amount. */
|
|
1038
|
+
amount: number
|
|
1039
|
+
closing: number
|
|
1040
|
+
/** `historical` for a month already in the books' history; `in_scope` for one a close drafts. */
|
|
1041
|
+
scope: 'historical' | 'in_scope'
|
|
1042
|
+
/** Loan schedules only. */
|
|
1043
|
+
interest: number | null
|
|
1044
|
+
payment: number | null
|
|
1045
|
+
principal: number | null
|
|
1046
|
+
currentPortion: number | null
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
/** What an existing schedule's entries mean for replacing it. */
|
|
1050
|
+
export interface ScheduleReplacement {
|
|
1051
|
+
structureId: string
|
|
1052
|
+
name: string
|
|
1053
|
+
postedEntryCount: number
|
|
1054
|
+
/** The months (YYYY-MM) its posted entries are in. */
|
|
1055
|
+
postedPeriods: string[]
|
|
1056
|
+
draftEntryCount: number
|
|
1057
|
+
/** `rebuild` while nothing has posted; `terminate_and_succeed` once an entry has. */
|
|
1058
|
+
path: 'rebuild' | 'terminate_and_succeed'
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
/** Result of `previewSchedule`: a generated schedule nobody kept. */
|
|
1062
|
+
export interface SchedulePreview {
|
|
1063
|
+
/**
|
|
1064
|
+
* The envelope create would leave, in the operation's own snake_case
|
|
1065
|
+
* shape; its ids are provisional. `artifact.mechanics` reads the
|
|
1066
|
+
* definition back.
|
|
1067
|
+
*/
|
|
1068
|
+
envelope: InformationBlockEnvelope
|
|
1069
|
+
rollForward: ScheduleRollForwardPeriod[]
|
|
1070
|
+
/** Another active schedule already posting the same accounts over the same months. */
|
|
1071
|
+
warnings: string[]
|
|
1072
|
+
replaces: ScheduleReplacement | null
|
|
897
1073
|
}
|
|
898
1074
|
|
|
1075
|
+
const toScheduleLeg = (leg: ScheduleLeg) => ({
|
|
1076
|
+
element_id: leg.elementId,
|
|
1077
|
+
side: leg.side,
|
|
1078
|
+
amount_source: leg.amountSource,
|
|
1079
|
+
})
|
|
1080
|
+
|
|
1081
|
+
const toEntryTemplate = (template: ScheduleEntryTemplate): EntryTemplateRequest => ({
|
|
1082
|
+
debit_element_id: template.debitElementId,
|
|
1083
|
+
credit_element_id: template.creditElementId,
|
|
1084
|
+
entry_type: template.entryType,
|
|
1085
|
+
memo_template: template.memoTemplate,
|
|
1086
|
+
auto_reverse: template.autoReverse,
|
|
1087
|
+
dimension_ids: template.dimensionIds,
|
|
1088
|
+
legs: template.legs?.map(toScheduleLeg),
|
|
1089
|
+
})
|
|
1090
|
+
|
|
1091
|
+
const toLoanTerms = (terms: LoanTerms): LoanTermsRequest => ({
|
|
1092
|
+
principal: terms.principal,
|
|
1093
|
+
annual_rate: terms.annualRate,
|
|
1094
|
+
start_date: terms.startDate,
|
|
1095
|
+
day_count: terms.dayCount,
|
|
1096
|
+
payment_frequency: terms.paymentFrequency,
|
|
1097
|
+
first_payment_date: terms.firstPaymentDate,
|
|
1098
|
+
payment_amount: terms.paymentAmount,
|
|
1099
|
+
interest_only: terms.interestOnly,
|
|
1100
|
+
maturity_date: terms.maturityDate,
|
|
1101
|
+
capitalize_interest: terms.capitalizeInterest,
|
|
1102
|
+
note_element_id: terms.noteElementId,
|
|
1103
|
+
current_portion_element_id: terms.currentPortionElementId,
|
|
1104
|
+
})
|
|
1105
|
+
|
|
1106
|
+
const toScheduleMetadata = (metadata: ScheduleMetadata): ScheduleMetadataRequest => ({
|
|
1107
|
+
method: metadata.method,
|
|
1108
|
+
original_amount: metadata.originalAmount,
|
|
1109
|
+
residual_value: metadata.residualValue,
|
|
1110
|
+
useful_life_months: metadata.usefulLifeMonths,
|
|
1111
|
+
asset_element_id: metadata.assetElementId,
|
|
1112
|
+
booked_on: metadata.bookedOn,
|
|
1113
|
+
periodic_amounts: metadata.periodicAmounts,
|
|
1114
|
+
loan_terms: metadata.loanTerms ? toLoanTerms(metadata.loanTerms) : undefined,
|
|
1115
|
+
})
|
|
1116
|
+
|
|
1117
|
+
/** The definition as the schedule operations take it. */
|
|
1118
|
+
const toScheduleDefinition = (options: CreateScheduleOptions): CreateScheduleArm['payload'] => ({
|
|
1119
|
+
name: options.name,
|
|
1120
|
+
element_ids: options.elementIds,
|
|
1121
|
+
period_start: options.periodStart,
|
|
1122
|
+
period_end: options.periodEnd,
|
|
1123
|
+
monthly_amount: options.monthlyAmount,
|
|
1124
|
+
entry_template: toEntryTemplate(options.entryTemplate),
|
|
1125
|
+
taxonomy_id: options.taxonomyId,
|
|
1126
|
+
...(options.entityId ? { entity_id: options.entityId } : {}),
|
|
1127
|
+
closed_through: options.closedThrough,
|
|
1128
|
+
schedule_metadata: options.scheduleMetadata
|
|
1129
|
+
? toScheduleMetadata(options.scheduleMetadata)
|
|
1130
|
+
: undefined,
|
|
1131
|
+
})
|
|
1132
|
+
|
|
899
1133
|
export interface JournalEntryLineItem {
|
|
900
1134
|
elementId: string
|
|
901
1135
|
debitAmount?: number
|
|
@@ -1703,6 +1937,8 @@ export class LedgerClient {
|
|
|
1703
1937
|
source?: string
|
|
1704
1938
|
classification?: string
|
|
1705
1939
|
isAbstract?: boolean
|
|
1940
|
+
/** Include retired accounts (`isActive: false`), to reactivate one. */
|
|
1941
|
+
includeInactive?: boolean
|
|
1706
1942
|
limit?: number
|
|
1707
1943
|
offset?: number
|
|
1708
1944
|
}
|
|
@@ -1715,6 +1951,7 @@ export class LedgerClient {
|
|
|
1715
1951
|
source: options?.source ?? null,
|
|
1716
1952
|
classification: options?.classification ?? null,
|
|
1717
1953
|
isAbstract: options?.isAbstract ?? null,
|
|
1954
|
+
includeInactive: options?.includeInactive ?? false,
|
|
1718
1955
|
limit: options?.limit ?? 100,
|
|
1719
1956
|
offset: options?.offset ?? 0,
|
|
1720
1957
|
},
|
|
@@ -2099,31 +2336,7 @@ export class LedgerClient {
|
|
|
2099
2336
|
): Promise<ScheduleBlockCreated> {
|
|
2100
2337
|
const body: CreateInformationBlockRequest = {
|
|
2101
2338
|
block_type: 'schedule',
|
|
2102
|
-
payload:
|
|
2103
|
-
name: options.name,
|
|
2104
|
-
element_ids: options.elementIds,
|
|
2105
|
-
period_start: options.periodStart,
|
|
2106
|
-
period_end: options.periodEnd,
|
|
2107
|
-
monthly_amount: options.monthlyAmount,
|
|
2108
|
-
entry_template: {
|
|
2109
|
-
debit_element_id: options.entryTemplate.debitElementId,
|
|
2110
|
-
credit_element_id: options.entryTemplate.creditElementId,
|
|
2111
|
-
entry_type: options.entryTemplate.entryType,
|
|
2112
|
-
memo_template: options.entryTemplate.memoTemplate,
|
|
2113
|
-
},
|
|
2114
|
-
taxonomy_id: options.taxonomyId,
|
|
2115
|
-
...(options.entityId ? { entity_id: options.entityId } : {}),
|
|
2116
|
-
schedule_metadata: options.scheduleMetadata
|
|
2117
|
-
? {
|
|
2118
|
-
method: options.scheduleMetadata.method,
|
|
2119
|
-
original_amount: options.scheduleMetadata.originalAmount,
|
|
2120
|
-
residual_value: options.scheduleMetadata.residualValue,
|
|
2121
|
-
useful_life_months: options.scheduleMetadata.usefulLifeMonths,
|
|
2122
|
-
asset_element_id: options.scheduleMetadata.assetElementId,
|
|
2123
|
-
booked_on: options.scheduleMetadata.bookedOn,
|
|
2124
|
-
}
|
|
2125
|
-
: undefined,
|
|
2126
|
-
},
|
|
2339
|
+
payload: toScheduleDefinition(options),
|
|
2127
2340
|
}
|
|
2128
2341
|
const envelope = await this.callOperation('Create schedule', (o) =>
|
|
2129
2342
|
createInformationBlock({ ...o, path: { graph_id: graphId }, body })
|
|
@@ -2144,6 +2357,61 @@ export class LedgerClient {
|
|
|
2144
2357
|
}
|
|
2145
2358
|
}
|
|
2146
2359
|
|
|
2360
|
+
/**
|
|
2361
|
+
* Generate a schedule from a definition without keeping it: the same
|
|
2362
|
+
* generator and guards as `createSchedule`, run and rolled back. Returns
|
|
2363
|
+
* the envelope create would leave (its ids provisional), the roll-forward
|
|
2364
|
+
* (the balance the schedule carries period by period; a loan's note, with
|
|
2365
|
+
* its interest, payment, principal and current portion), and warnings
|
|
2366
|
+
* naming any active schedule already posting the same accounts in the
|
|
2367
|
+
* same months. A definition create would refuse (a roll-forward that
|
|
2368
|
+
* climbs where it should fall, legs that do not balance) is refused here
|
|
2369
|
+
* with the period that breaks. With `replacesStructureId`, `replaces`
|
|
2370
|
+
* says what the schedule being edited or recreated has posted, by month,
|
|
2371
|
+
* and the path the change takes: `rebuild` (save through
|
|
2372
|
+
* `rebuildSchedule`) while nothing has posted, `terminate_and_succeed`
|
|
2373
|
+
* after.
|
|
2374
|
+
*/
|
|
2375
|
+
async previewSchedule(
|
|
2376
|
+
graphId: string,
|
|
2377
|
+
options: PreviewScheduleOptions
|
|
2378
|
+
): Promise<SchedulePreview> {
|
|
2379
|
+
const body: PreviewScheduleRequest = {
|
|
2380
|
+
...toScheduleDefinition(options),
|
|
2381
|
+
replaces_structure_id: options.replacesStructureId ?? undefined,
|
|
2382
|
+
}
|
|
2383
|
+
const envelope = await this.callOperation('Preview schedule', (o) =>
|
|
2384
|
+
previewSchedule({ ...o, path: { graph_id: graphId }, body })
|
|
2385
|
+
)
|
|
2386
|
+
const raw = this.requireResult('Preview schedule', envelope.result)
|
|
2387
|
+
return {
|
|
2388
|
+
envelope: raw.envelope,
|
|
2389
|
+
rollForward: (raw.roll_forward ?? []).map((row) => ({
|
|
2390
|
+
periodStart: row.period_start,
|
|
2391
|
+
periodEnd: row.period_end,
|
|
2392
|
+
opening: row.opening,
|
|
2393
|
+
amount: row.amount,
|
|
2394
|
+
closing: row.closing,
|
|
2395
|
+
scope: row.scope,
|
|
2396
|
+
interest: row.interest ?? null,
|
|
2397
|
+
payment: row.payment ?? null,
|
|
2398
|
+
principal: row.principal ?? null,
|
|
2399
|
+
currentPortion: row.current_portion ?? null,
|
|
2400
|
+
})),
|
|
2401
|
+
warnings: raw.warnings ?? [],
|
|
2402
|
+
replaces: raw.replaces
|
|
2403
|
+
? {
|
|
2404
|
+
structureId: raw.replaces.structure_id,
|
|
2405
|
+
name: raw.replaces.name,
|
|
2406
|
+
postedEntryCount: raw.replaces.posted_entry_count,
|
|
2407
|
+
postedPeriods: raw.replaces.posted_periods ?? [],
|
|
2408
|
+
draftEntryCount: raw.replaces.draft_entry_count ?? 0,
|
|
2409
|
+
path: raw.replaces.path,
|
|
2410
|
+
}
|
|
2411
|
+
: null,
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2147
2415
|
/**
|
|
2148
2416
|
* Rename a schedule. For other block fields use `updateInformationBlock`
|
|
2149
2417
|
* with a `schedule` payload.
|
|
@@ -2189,15 +2457,33 @@ export class LedgerClient {
|
|
|
2189
2457
|
* a rebuild re-scopes the schedule to today's close state. Use this to
|
|
2190
2458
|
* pick up a fixed generator without orphaning obligations.
|
|
2191
2459
|
*
|
|
2460
|
+
* It is also how an edit is saved while nothing has posted: the
|
|
2461
|
+
* definition fields on `options` (`periodStart`, `periodEnd`,
|
|
2462
|
+
* `monthlyAmount`, `entryTemplate` replacing the stored one whole,
|
|
2463
|
+
* `scheduleMetadata` for only the fields named) replace the stored
|
|
2464
|
+
* definition before it regenerates, as the schedule's envelope reads them
|
|
2465
|
+
* back (`artifact.mechanics`). Omitted fields keep their stored values.
|
|
2466
|
+
* Refused once an entry has posted; `previewSchedule` with
|
|
2467
|
+
* `replacesStructureId` says which path an edit takes.
|
|
2468
|
+
*
|
|
2192
2469
|
* Returns the {@link ScheduleCreated} rebuild summary (periods, facts,
|
|
2193
2470
|
* rule results) — richer than `createSchedule`'s {@link ScheduleBlockCreated}.
|
|
2194
2471
|
*/
|
|
2195
2472
|
async rebuildSchedule(
|
|
2196
2473
|
graphId: string,
|
|
2197
2474
|
structureId: string,
|
|
2198
|
-
options?:
|
|
2475
|
+
options?: RebuildScheduleOptions
|
|
2199
2476
|
): Promise<ScheduleCreated> {
|
|
2200
|
-
const body: RebuildScheduleRequest = {
|
|
2477
|
+
const body: RebuildScheduleRequest = {
|
|
2478
|
+
structure_id: structureId,
|
|
2479
|
+
period_start: options?.periodStart,
|
|
2480
|
+
period_end: options?.periodEnd,
|
|
2481
|
+
monthly_amount: options?.monthlyAmount,
|
|
2482
|
+
entry_template: options?.entryTemplate ? toEntryTemplate(options.entryTemplate) : undefined,
|
|
2483
|
+
schedule_metadata: options?.scheduleMetadata
|
|
2484
|
+
? toScheduleMetadata(options.scheduleMetadata)
|
|
2485
|
+
: undefined,
|
|
2486
|
+
}
|
|
2201
2487
|
const envelope = await this.callOperation('Rebuild schedule', (o) =>
|
|
2202
2488
|
rebuildSchedule({
|
|
2203
2489
|
...withIdempotencyKey(o, options?.idempotencyKey),
|
|
@@ -1015,6 +1015,7 @@ export type ListLedgerElementsQueryVariables = Exact<{
|
|
|
1015
1015
|
source: string | null | undefined;
|
|
1016
1016
|
classification: string | null | undefined;
|
|
1017
1017
|
isAbstract: boolean | null | undefined;
|
|
1018
|
+
includeInactive?: boolean;
|
|
1018
1019
|
limit?: number;
|
|
1019
1020
|
offset?: number;
|
|
1020
1021
|
}>;
|
|
@@ -2916,6 +2916,15 @@ exports.ListLedgerElementsDocument = {
|
|
|
2916
2916
|
variable: { kind: 'Variable', name: { kind: 'Name', value: 'isAbstract' } },
|
|
2917
2917
|
type: { kind: 'NamedType', name: { kind: 'Name', value: 'Boolean' } },
|
|
2918
2918
|
},
|
|
2919
|
+
{
|
|
2920
|
+
kind: 'VariableDefinition',
|
|
2921
|
+
variable: { kind: 'Variable', name: { kind: 'Name', value: 'includeInactive' } },
|
|
2922
|
+
type: {
|
|
2923
|
+
kind: 'NonNullType',
|
|
2924
|
+
type: { kind: 'NamedType', name: { kind: 'Name', value: 'Boolean' } },
|
|
2925
|
+
},
|
|
2926
|
+
defaultValue: { kind: 'BooleanValue', value: false },
|
|
2927
|
+
},
|
|
2919
2928
|
{
|
|
2920
2929
|
kind: 'VariableDefinition',
|
|
2921
2930
|
variable: { kind: 'Variable', name: { kind: 'Name', value: 'limit' } },
|
|
@@ -2962,6 +2971,11 @@ exports.ListLedgerElementsDocument = {
|
|
|
2962
2971
|
name: { kind: 'Name', value: 'isAbstract' },
|
|
2963
2972
|
value: { kind: 'Variable', name: { kind: 'Name', value: 'isAbstract' } },
|
|
2964
2973
|
},
|
|
2974
|
+
{
|
|
2975
|
+
kind: 'Argument',
|
|
2976
|
+
name: { kind: 'Name', value: 'includeInactive' },
|
|
2977
|
+
value: { kind: 'Variable', name: { kind: 'Name', value: 'includeInactive' } },
|
|
2978
|
+
},
|
|
2965
2979
|
{
|
|
2966
2980
|
kind: 'Argument',
|
|
2967
2981
|
name: { kind: 'Name', value: 'limit' },
|
|
@@ -1008,6 +1008,7 @@ export type ListLedgerElementsQueryVariables = Exact<{
|
|
|
1008
1008
|
source: string | null | undefined
|
|
1009
1009
|
classification: string | null | undefined
|
|
1010
1010
|
isAbstract: boolean | null | undefined
|
|
1011
|
+
includeInactive?: boolean
|
|
1011
1012
|
limit?: number
|
|
1012
1013
|
offset?: number
|
|
1013
1014
|
}>
|
|
@@ -5869,6 +5870,15 @@ export const ListLedgerElementsDocument = {
|
|
|
5869
5870
|
variable: { kind: 'Variable', name: { kind: 'Name', value: 'isAbstract' } },
|
|
5870
5871
|
type: { kind: 'NamedType', name: { kind: 'Name', value: 'Boolean' } },
|
|
5871
5872
|
},
|
|
5873
|
+
{
|
|
5874
|
+
kind: 'VariableDefinition',
|
|
5875
|
+
variable: { kind: 'Variable', name: { kind: 'Name', value: 'includeInactive' } },
|
|
5876
|
+
type: {
|
|
5877
|
+
kind: 'NonNullType',
|
|
5878
|
+
type: { kind: 'NamedType', name: { kind: 'Name', value: 'Boolean' } },
|
|
5879
|
+
},
|
|
5880
|
+
defaultValue: { kind: 'BooleanValue', value: false },
|
|
5881
|
+
},
|
|
5872
5882
|
{
|
|
5873
5883
|
kind: 'VariableDefinition',
|
|
5874
5884
|
variable: { kind: 'Variable', name: { kind: 'Name', value: 'limit' } },
|
|
@@ -5915,6 +5925,11 @@ export const ListLedgerElementsDocument = {
|
|
|
5915
5925
|
name: { kind: 'Name', value: 'isAbstract' },
|
|
5916
5926
|
value: { kind: 'Variable', name: { kind: 'Name', value: 'isAbstract' } },
|
|
5917
5927
|
},
|
|
5928
|
+
{
|
|
5929
|
+
kind: 'Argument',
|
|
5930
|
+
name: { kind: 'Name', value: 'includeInactive' },
|
|
5931
|
+
value: { kind: 'Variable', name: { kind: 'Name', value: 'includeInactive' } },
|
|
5932
|
+
},
|
|
5918
5933
|
{
|
|
5919
5934
|
kind: 'Argument',
|
|
5920
5935
|
name: { kind: 'Name', value: 'limit' },
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Elements list with pagination. Filters narrow by taxonomy, source
|
|
3
|
-
* system, classification, or abstract flag
|
|
3
|
+
* system, classification, or abstract flag; `includeInactive` adds retired
|
|
4
|
+
* accounts so one can be reactivated. Used by the mapping UI
|
|
4
5
|
* to populate element pickers and by the CoA reconciliation views.
|
|
5
6
|
*/
|
|
6
7
|
export declare const LIST_ELEMENTS: string;
|
|
@@ -4,7 +4,8 @@ exports.LIST_ELEMENTS = void 0;
|
|
|
4
4
|
const graphql_request_1 = require("graphql-request");
|
|
5
5
|
/**
|
|
6
6
|
* Elements list with pagination. Filters narrow by taxonomy, source
|
|
7
|
-
* system, classification, or abstract flag
|
|
7
|
+
* system, classification, or abstract flag; `includeInactive` adds retired
|
|
8
|
+
* accounts so one can be reactivated. Used by the mapping UI
|
|
8
9
|
* to populate element pickers and by the CoA reconciliation views.
|
|
9
10
|
*/
|
|
10
11
|
exports.LIST_ELEMENTS = (0, graphql_request_1.gql) `
|
|
@@ -13,6 +14,7 @@ exports.LIST_ELEMENTS = (0, graphql_request_1.gql) `
|
|
|
13
14
|
$source: String
|
|
14
15
|
$classification: String
|
|
15
16
|
$isAbstract: Boolean
|
|
17
|
+
$includeInactive: Boolean! = false
|
|
16
18
|
$limit: Int! = 100
|
|
17
19
|
$offset: Int! = 0
|
|
18
20
|
) {
|
|
@@ -21,6 +23,7 @@ exports.LIST_ELEMENTS = (0, graphql_request_1.gql) `
|
|
|
21
23
|
source: $source
|
|
22
24
|
classification: $classification
|
|
23
25
|
isAbstract: $isAbstract
|
|
26
|
+
includeInactive: $includeInactive
|
|
24
27
|
limit: $limit
|
|
25
28
|
offset: $offset
|
|
26
29
|
) {
|
|
@@ -2,7 +2,8 @@ import { gql } from 'graphql-request'
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Elements list with pagination. Filters narrow by taxonomy, source
|
|
5
|
-
* system, classification, or abstract flag
|
|
5
|
+
* system, classification, or abstract flag; `includeInactive` adds retired
|
|
6
|
+
* accounts so one can be reactivated. Used by the mapping UI
|
|
6
7
|
* to populate element pickers and by the CoA reconciliation views.
|
|
7
8
|
*/
|
|
8
9
|
export const LIST_ELEMENTS = gql`
|
|
@@ -11,6 +12,7 @@ export const LIST_ELEMENTS = gql`
|
|
|
11
12
|
$source: String
|
|
12
13
|
$classification: String
|
|
13
14
|
$isAbstract: Boolean
|
|
15
|
+
$includeInactive: Boolean! = false
|
|
14
16
|
$limit: Int! = 100
|
|
15
17
|
$offset: Int! = 0
|
|
16
18
|
) {
|
|
@@ -19,6 +21,7 @@ export const LIST_ELEMENTS = gql`
|
|
|
19
21
|
source: $source
|
|
20
22
|
classification: $classification
|
|
21
23
|
isAbstract: $isAbstract
|
|
24
|
+
includeInactive: $includeInactive
|
|
22
25
|
limit: $limit
|
|
23
26
|
offset: $offset
|
|
24
27
|
) {
|