@robosystems/client 2.3.0 → 2.5.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 +140 -6
- package/artifacts/LedgerClient.js +205 -5
- package/artifacts/LedgerClient.ts +410 -5
- package/artifacts/graphql/generated/graphql.d.ts +74 -0
- package/artifacts/graphql/generated/graphql.js +146 -2
- package/artifacts/graphql/generated/graphql.ts +222 -0
- package/artifacts/graphql/queries/ledger/eventBlocks.d.ts +2 -1
- package/artifacts/graphql/queries/ledger/eventBlocks.js +4 -1
- package/artifacts/graphql/queries/ledger/eventBlocks.ts +4 -1
- package/artifacts/graphql/queries/ledger/fiscalCalendar.js +6 -0
- package/artifacts/graphql/queries/ledger/fiscalCalendar.ts +6 -0
- package/artifacts/graphql/queries/ledger/reconciliations.d.ts +10 -0
- package/artifacts/graphql/queries/ledger/reconciliations.js +78 -0
- package/artifacts/graphql/queries/ledger/reconciliations.ts +76 -0
- package/index.ts +2 -2
- package/package.json +1 -1
- package/sdk/index.d.ts +2 -2
- package/sdk/index.js +8 -3
- package/sdk/index.ts +2 -2
- package/sdk/sdk.gen.d.ts +41 -1
- package/sdk/sdk.gen.js +87 -2
- package/sdk/sdk.gen.ts +86 -1
- package/sdk/types.gen.d.ts +1181 -48
- package/sdk/types.gen.ts +1591 -417
- package/sdk.gen.d.ts +41 -1
- package/sdk.gen.js +87 -2
- package/sdk.gen.ts +86 -1
- package/types.gen.d.ts +1181 -48
- package/types.gen.ts +1591 -417
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AssociationResponse, AutoMapElementsOperation, BindTextBlockRequest, BindTextBlockResponse, BlockedSourceGraphResponse, BlockSourceGraphResult, ComputeMetricsRequest, ComputeMetricsResponse, CreateAgentRequest, CreateEventBlockRequest, CreateEventHandlerRequest, CreateInformationBlockRequest, CreateMappingAssociationOperation, CreateTaxonomyBlockRequest, CreateViewRequest, DeleteInformationBlockRequest, DeleteInformationBlockResponse, DeleteMappingAssociationOperation, DeleteResult, DeleteTaxonomyBlockRequest, DeleteTaxonomyBlockResponse, EntityTaxonomyResponse, EvaluateRulesRequest, EvaluateRulesResponse, EventBlockEnvelope, EventHandlerResponse, FinancialStatementAnalysisRequest, FinancialStatementAnalysisResponse, InformationBlockEnvelope, InitializeChartOfAccountsRequest, JournalEntryResponse, LedgerAgentResponse, LinkEntityTaxonomyRequest, LiveFinancialStatementRequest, LiveFinancialStatementResponse, OperationEnvelope, PreviewEventBlockResponse, PublishListMemberResponse, PublishListResponse, ReportResponse, RevokeReportShareResponse, ShareReportResponse, TaxonomyBlockEnvelope, UpdateAgentRequest, UpdateEntityRequest, UpdateEventBlockRequest, UpdateEventHandlerRequest, UpdateInformationBlockRequest, UpdateJournalEntryRequest, UpdateTaxonomyBlockRequest, ViewResponse } from '../types.gen';
|
|
1
|
+
import type { AssociationResponse, AutoMapElementsOperation, BindTextBlockRequest, BindTextBlockResponse, BlockedSourceGraphResponse, BlockSourceGraphResult, ComputeMetricsRequest, ComputeMetricsResponse, CreateAgentRequest, CreateEventBlockRequest, CreateEventHandlerRequest, CreateInformationBlockRequest, CreateMappingAssociationOperation, CreateTaxonomyBlockRequest, CreateViewRequest, DeleteInformationBlockRequest, DeleteInformationBlockResponse, DeleteMappingAssociationOperation, DeleteResult, DeleteTaxonomyBlockRequest, DeleteTaxonomyBlockResponse, EntityTaxonomyResponse, EvaluateRulesRequest, EvaluateRulesResponse, EventBlockEnvelope, EventHandlerResponse, FinancialStatementAnalysisRequest, FinancialStatementAnalysisResponse, InformationBlockEnvelope, InitializeChartOfAccountsRequest, JournalEntryResponse, LedgerAgentResponse, LinkEntityTaxonomyRequest, LiveFinancialStatementRequest, LiveFinancialStatementResponse, OperationEnvelope, PreviewEventBlockResponse, PreviewReconciliationsRequest, PromoteObligationsRequest, PromoteObligationsResponse, PublishListMemberResponse, PublishListResponse, ReconcilingItemPlan, ReportResponse, ResolveReconcilingItemRequest, ResolveReconcilingItemResponse, RevokeReportShareResponse, ShareReportResponse, TaxonomyBlockEnvelope, UpdateAgentRequest, UpdateEntityRequest, UpdateEventBlockRequest, UpdateEventHandlerRequest, UpdateInformationBlockRequest, UpdateJournalEntryRequest, UpdateTaxonomyBlockRequest, ViewResponse } from '../types.gen';
|
|
2
2
|
import type { TokenProvider } from './graphql/client';
|
|
3
|
-
import { type GetInformationBlockQuery, type GetLedgerAccountRollupsQuery, type GetLedgerAccountTreeQuery, type GetLedgerAgentQuery, type GetLedgerClosingBookStructuresQuery, type GetLedgerEntityQuery, type GetLedgerEventBlockQuery, type GetLedgerFiscalCalendarQuery, type GetLedgerMappedTrialBalanceQuery, type GetLedgerMappingCoverageQuery, type GetLedgerMappingQuery, type GetLedgerPeriodCloseStatusQuery, type GetLedgerPeriodDraftsQuery, type GetLedgerPublishListQuery, type GetLedgerReportingTaxonomyQuery, type GetLedgerReportPackageQuery, type GetLedgerReportQuery, type GetLedgerStatementQuery, type GetLedgerSummaryQuery, type GetLedgerTransactionQuery, type GetLedgerTrialBalanceQuery, type ListChartTemplatesQuery, type ListInformationBlocksQuery, type ListLedgerAccountsQuery, type ListLedgerAgentsQuery, type ListLedgerBlockedSourceGraphsQuery, type ListLedgerElementsQuery, type ListLedgerEntitiesQuery, type ListLedgerEventBlocksQuery, type ListLedgerJournalEntriesQuery, type ListLedgerMappingsQuery, type ListLedgerPublishListsQuery, type ListLedgerReportsQuery, type ListLedgerStructuresQuery, type ListLedgerTaxonomiesQuery, type ListLedgerTransactionsQuery, type ListLedgerUnmappedElementsQuery, type MappingCandidatesQuery, type ReportDownloadFormat, type ReportLifecycle } from './graphql/generated/graphql';
|
|
3
|
+
import { type GetInformationBlockQuery, type GetLedgerAccountRollupsQuery, type GetLedgerAccountTreeQuery, type GetLedgerAgentQuery, type GetLedgerClosingBookStructuresQuery, type GetLedgerEntityQuery, type GetLedgerEventBlockQuery, type GetLedgerFiscalCalendarQuery, type GetLedgerMappedTrialBalanceQuery, type GetLedgerMappingCoverageQuery, type GetLedgerMappingQuery, type GetLedgerPeriodCloseStatusQuery, type GetLedgerPeriodDraftsQuery, type GetLedgerPublishListQuery, type GetLedgerReportingTaxonomyQuery, type GetLedgerReportPackageQuery, type GetLedgerReportQuery, type GetLedgerStatementQuery, type GetLedgerSummaryQuery, type GetLedgerTransactionQuery, type GetLedgerTrialBalanceQuery, type ListChartTemplatesQuery, type ListInformationBlocksQuery, type ListLedgerAccountsQuery, type ListLedgerAgentsQuery, type ListLedgerBlockedSourceGraphsQuery, type ListLedgerElementsQuery, type ListLedgerEntitiesQuery, type ListLedgerEventBlocksQuery, type ListLedgerJournalEntriesQuery, type ListLedgerMappingsQuery, type ListLedgerPublishListsQuery, type ListLedgerReconciliationsQuery, type ListLedgerReportsQuery, type ListLedgerStructuresQuery, type ListLedgerTaxonomiesQuery, type ListLedgerTransactionsQuery, type ListLedgerUnmappedElementsQuery, type MappingCandidatesQuery, type ReportDownloadFormat, type ReportLifecycle } from './graphql/generated/graphql';
|
|
4
4
|
export { GraphQLError } from './graphql/client';
|
|
5
5
|
export type { ReportLifecycle };
|
|
6
6
|
export type LedgerEntity = NonNullable<GetLedgerEntityQuery['entity']>;
|
|
@@ -49,6 +49,14 @@ export type LedgerFiscalCalendar = NonNullable<GetLedgerFiscalCalendarQuery['fis
|
|
|
49
49
|
/** A shipped chart-of-accounts template — `listChartTemplates()` row. */
|
|
50
50
|
export type LedgerChartTemplate = ListChartTemplatesQuery['chartTemplates'][number];
|
|
51
51
|
export type LedgerFiscalPeriod = LedgerFiscalCalendar['periods'][number];
|
|
52
|
+
/** Every reconciliation block's standing for one period. */
|
|
53
|
+
export type LedgerReconciliationList = NonNullable<ListLedgerReconciliationsQuery['reconciliations']>;
|
|
54
|
+
/** One reconciliation block's standing for a period. */
|
|
55
|
+
export type LedgerReconciliation = LedgerReconciliationList['reconciliations'][number];
|
|
56
|
+
/** One account: the ledger's balance, the independent balance, the difference. */
|
|
57
|
+
export type LedgerReconciliationRow = LedgerReconciliation['differences'][number];
|
|
58
|
+
/** One part of an account's independent balance: a schedule, or a statement. */
|
|
59
|
+
export type LedgerReconciliationComponent = LedgerReconciliation['components'][number];
|
|
52
60
|
export type Report = NonNullable<GetLedgerReportQuery['report']>;
|
|
53
61
|
export type ReportPackage = NonNullable<GetLedgerReportPackageQuery['reportPackage']>;
|
|
54
62
|
export type ReportPackageItem = ReportPackage['items'][number];
|
|
@@ -199,6 +207,80 @@ export interface ClosePeriodOptions {
|
|
|
199
207
|
* in the close audit note.
|
|
200
208
|
*/
|
|
201
209
|
allowStrandedObligations?: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Close despite a reconciliation the close waits on that is not
|
|
212
|
+
* reconciled for the period, or was never compared for it. Prefer
|
|
213
|
+
* `refreshReconciliations` and clearing what it reports. The override is
|
|
214
|
+
* recorded in the close audit note.
|
|
215
|
+
*/
|
|
216
|
+
allowUnreconciledAccounts?: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Close despite posted events whose source payload changed afterwards and
|
|
219
|
+
* that nobody has decided on. Prefer `resolveReconcilingItem` on each.
|
|
220
|
+
* The override is recorded in the close audit note.
|
|
221
|
+
*/
|
|
222
|
+
allowReconcilingItems?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Close despite source events dated in the period that were never
|
|
225
|
+
* committed; once it closes they cannot post into it. Prefer committing
|
|
226
|
+
* or voiding each. The override is recorded in the close audit note.
|
|
227
|
+
*/
|
|
228
|
+
allowUnpostedSourceEvents?: boolean;
|
|
229
|
+
}
|
|
230
|
+
/** Which reconciliation check to run. */
|
|
231
|
+
export type ReconciliationMethod = NonNullable<PreviewReconciliationsRequest['method']>;
|
|
232
|
+
export interface PreviewReconciliationsOptions {
|
|
233
|
+
/** Defaults to `source_ledger`, which needs a connected QuickBooks ledger. */
|
|
234
|
+
method?: ReconciliationMethod;
|
|
235
|
+
/** Also return the accounts that tie. */
|
|
236
|
+
includeTied?: boolean;
|
|
237
|
+
}
|
|
238
|
+
/** One comparison of the ledger with something outside it. Nothing is recorded. */
|
|
239
|
+
export interface LedgerReconciliationPreview {
|
|
240
|
+
period: string;
|
|
241
|
+
asOf: string;
|
|
242
|
+
fiscalYearStart: string;
|
|
243
|
+
method: string;
|
|
244
|
+
source: string;
|
|
245
|
+
reportBasis: string | null;
|
|
246
|
+
lastSyncAt: string | null;
|
|
247
|
+
accountsCompared: number;
|
|
248
|
+
accountsTied: number;
|
|
249
|
+
accountsDifferent: number;
|
|
250
|
+
/** Sum of the absolute differences across accounts, not a net figure. */
|
|
251
|
+
totalDifference: number;
|
|
252
|
+
/** Accounts that do not tie, largest first; tied ones follow with `includeTied`. */
|
|
253
|
+
rows: LedgerReconciliationRow[];
|
|
254
|
+
notes: string[];
|
|
255
|
+
}
|
|
256
|
+
export interface RecordStatementBalanceInput {
|
|
257
|
+
/** The balance-sheet account the statement is for. */
|
|
258
|
+
elementId: string;
|
|
259
|
+
/** The statement's ending date, as YYYY-MM-DD. */
|
|
260
|
+
asOf: string;
|
|
261
|
+
/**
|
|
262
|
+
* The ending balance as the statement shows it: a positive number in the
|
|
263
|
+
* account's normal direction (money in a bank account, or the amount owed
|
|
264
|
+
* on a loan or a card).
|
|
265
|
+
*/
|
|
266
|
+
balance: number;
|
|
267
|
+
/** The statement itself, as a document already on the graph. */
|
|
268
|
+
documentId?: string | null;
|
|
269
|
+
note?: string | null;
|
|
270
|
+
}
|
|
271
|
+
/** Policy fields to change; an omitted field keeps its value. */
|
|
272
|
+
export interface ReconciliationPolicyChanges {
|
|
273
|
+
requiredForClose?: boolean;
|
|
274
|
+
materiality?: number;
|
|
275
|
+
reviewRequired?: boolean;
|
|
276
|
+
separateReviewer?: boolean;
|
|
277
|
+
}
|
|
278
|
+
export interface LedgerReconciliationPolicy {
|
|
279
|
+
structureId: string;
|
|
280
|
+
requiredForClose: boolean;
|
|
281
|
+
materiality: number;
|
|
282
|
+
reviewRequired: boolean;
|
|
283
|
+
separateReviewer: boolean;
|
|
202
284
|
}
|
|
203
285
|
export interface CreateScheduleOptions {
|
|
204
286
|
name: string;
|
|
@@ -219,6 +301,12 @@ export interface CreateScheduleOptions {
|
|
|
219
301
|
residualValue?: number;
|
|
220
302
|
usefulLifeMonths?: number;
|
|
221
303
|
assetElementId?: string;
|
|
304
|
+
/**
|
|
305
|
+
* The day the cost went on the books (YYYY-MM-DD), when that is before
|
|
306
|
+
* the schedule's first period. The schedule reconciliation carries the
|
|
307
|
+
* cost from that day.
|
|
308
|
+
*/
|
|
309
|
+
bookedOn?: string;
|
|
222
310
|
};
|
|
223
311
|
}
|
|
224
312
|
export interface JournalEntryLineItem {
|
|
@@ -350,6 +438,8 @@ export declare class LedgerClient {
|
|
|
350
438
|
status?: string;
|
|
351
439
|
agentId?: string;
|
|
352
440
|
source?: string;
|
|
441
|
+
/** Only posted events whose source payload changed afterwards. */
|
|
442
|
+
isReconcilingItem?: boolean;
|
|
353
443
|
limit?: number;
|
|
354
444
|
offset?: number;
|
|
355
445
|
}): Promise<LedgerEventBlock[]>;
|
|
@@ -613,6 +703,49 @@ export declare class LedgerClient {
|
|
|
613
703
|
closePeriod(graphId: string, period: string, options?: ClosePeriodOptions): Promise<ClosePeriodResult>;
|
|
614
704
|
/** Reopen a closed fiscal period. Requires a reason for the audit log. */
|
|
615
705
|
reopenPeriod(graphId: string, period: string, reason: string, note?: string | null): Promise<LedgerFiscalCalendar>;
|
|
706
|
+
/**
|
|
707
|
+
* Every reconciliation block's standing at a period end (YYYY-MM). A block
|
|
708
|
+
* not yet compared for the period reads `not_started`.
|
|
709
|
+
*/
|
|
710
|
+
listReconciliations(graphId: string, period: string): Promise<LedgerReconciliationList | null>;
|
|
711
|
+
/**
|
|
712
|
+
* What changed on a reconciling item (a posted event whose source payload
|
|
713
|
+
* changed afterwards) and what each treatment would do. Writes nothing.
|
|
714
|
+
* List the items with `listEventBlocks(graphId, { isReconcilingItem: true })`.
|
|
715
|
+
*/
|
|
716
|
+
previewReconcilingItem(graphId: string, eventId: string): Promise<ReconcilingItemPlan>;
|
|
717
|
+
/**
|
|
718
|
+
* Decide one reconciling item: `restate` the affected months, `catch_up`
|
|
719
|
+
* with an entry in the open period, or `acknowledge` that it was handled
|
|
720
|
+
* elsewhere (a note is required). Omit `disposition` to take the default
|
|
721
|
+
* the preview reports.
|
|
722
|
+
*/
|
|
723
|
+
resolveReconcilingItem(graphId: string, body: ResolveReconcilingItemRequest): Promise<ResolveReconcilingItemResponse>;
|
|
724
|
+
/**
|
|
725
|
+
* Draft the closing entry of every matured schedule obligation, including
|
|
726
|
+
* ones promoted earlier and never drafted. The drafts post when the period
|
|
727
|
+
* closes. Safe to repeat.
|
|
728
|
+
*/
|
|
729
|
+
promoteObligations(graphId: string, body?: PromoteObligationsRequest): Promise<PromoteObligationsResponse>;
|
|
730
|
+
/** Compare the ledger with something outside it. Records nothing. */
|
|
731
|
+
previewReconciliations(graphId: string, period: string, options?: PreviewReconciliationsOptions): Promise<LedgerReconciliationPreview>;
|
|
732
|
+
/**
|
|
733
|
+
* Run every reconciliation that applies at a period end and record each
|
|
734
|
+
* result on its block. `notes` names any check that could not run.
|
|
735
|
+
*/
|
|
736
|
+
refreshReconciliations(graphId: string, period: string): Promise<LedgerReconciliationList>;
|
|
737
|
+
/**
|
|
738
|
+
* Record a statement's ending balance for an account and reconcile the
|
|
739
|
+
* account to it for the period the statement ends in. Writes no books.
|
|
740
|
+
*/
|
|
741
|
+
recordStatementBalance(graphId: string, input: RecordStatementBalanceInput): Promise<LedgerReconciliation>;
|
|
742
|
+
/** Change how much the close cares about one reconciliation. */
|
|
743
|
+
setReconciliationPolicy(graphId: string, structureId: string, changes: ReconciliationPolicyChanges): Promise<LedgerReconciliationPolicy>;
|
|
744
|
+
/**
|
|
745
|
+
* Sign off a reconciled period as its reviewer. Only a member of the graph
|
|
746
|
+
* can; a later change to any balance lapses the sign-off.
|
|
747
|
+
*/
|
|
748
|
+
signOffReconciliation(graphId: string, structureId: string, period: string, note?: string | null): Promise<LedgerReconciliation>;
|
|
616
749
|
/**
|
|
617
750
|
* Create a journal entry with balanced line items (DR=CR enforced).
|
|
618
751
|
*
|
|
@@ -759,8 +892,8 @@ export declare class LedgerClient {
|
|
|
759
892
|
* A download is a read, so this resolves through GraphQL
|
|
760
893
|
* (`reportDownloadUrl`) — the retired `GET .../reports/{id}/download`
|
|
761
894
|
* REST resource is gone. Every flavor resolves to a presigned S3 URL:
|
|
762
|
-
*
|
|
763
|
-
* on first request. The returned `downloadUrl` is valid for
|
|
895
|
+
* the Tavi model is stamped at publish time; the holon and XBRL are
|
|
896
|
+
* materialized + cached on first request. The returned `downloadUrl` is valid for
|
|
764
897
|
* `expiresIn` seconds (default 300, max 3600); browser callers
|
|
765
898
|
* navigate to it via `window.location.href` (or an `<a href>` click)
|
|
766
899
|
* to trigger the download — the server-set Content-Disposition forces
|
|
@@ -772,8 +905,9 @@ export declare class LedgerClient {
|
|
|
772
905
|
*
|
|
773
906
|
* @param graphId Graph identifier owning the Report.
|
|
774
907
|
* @param reportId Report identifier (rpt_-prefixed ULID).
|
|
775
|
-
* @param options.format Serialization flavor — `
|
|
776
|
-
*
|
|
908
|
+
* @param options.format Serialization flavor — `HOLON_JSONLD` (default, the
|
|
909
|
+
* holon, which carries the whole report), `TAVI` (the Project Tavi
|
|
910
|
+
* compiled model stamped at publish), or `XBRL_2_1`.
|
|
777
911
|
* @param options.expiresIn Presigned URL lifetime, in seconds.
|
|
778
912
|
*/
|
|
779
913
|
getReportDownloadUrl(graphId: string, reportId: string, options?: {
|
|
@@ -129,6 +129,7 @@ class LedgerClient {
|
|
|
129
129
|
status: options?.status ?? null,
|
|
130
130
|
agentId: options?.agentId ?? null,
|
|
131
131
|
source: options?.source ?? null,
|
|
132
|
+
isReconcilingItem: options?.isReconcilingItem ?? null,
|
|
132
133
|
limit: options?.limit ?? 50,
|
|
133
134
|
offset: options?.offset ?? 0,
|
|
134
135
|
}, 'List event blocks', (data) => data.eventBlocks);
|
|
@@ -411,6 +412,7 @@ class LedgerClient {
|
|
|
411
412
|
residual_value: options.scheduleMetadata.residualValue,
|
|
412
413
|
useful_life_months: options.scheduleMetadata.usefulLifeMonths,
|
|
413
414
|
asset_element_id: options.scheduleMetadata.assetElementId,
|
|
415
|
+
booked_on: options.scheduleMetadata.bookedOn,
|
|
414
416
|
}
|
|
415
417
|
: undefined,
|
|
416
418
|
},
|
|
@@ -639,6 +641,9 @@ class LedgerClient {
|
|
|
639
641
|
note: options?.note ?? null,
|
|
640
642
|
allow_stale_sync: options?.allowStaleSync,
|
|
641
643
|
allow_stranded_obligations: options?.allowStrandedObligations,
|
|
644
|
+
allow_unreconciled_accounts: options?.allowUnreconciledAccounts,
|
|
645
|
+
allow_reconciling_items: options?.allowReconcilingItems,
|
|
646
|
+
allow_unposted_source_events: options?.allowUnpostedSourceEvents,
|
|
642
647
|
};
|
|
643
648
|
const envelope = await this.callOperation('Close period', (0, sdk_gen_1.closePeriod)({ path: { graph_id: graphId }, body }));
|
|
644
649
|
const raw = envelope.result;
|
|
@@ -663,6 +668,108 @@ class LedgerClient {
|
|
|
663
668
|
const envelope = await this.callOperation('Reopen period', (0, sdk_gen_1.reopenPeriod)({ path: { graph_id: graphId }, body }));
|
|
664
669
|
return rawFiscalCalendarToCamel(envelope.result);
|
|
665
670
|
}
|
|
671
|
+
// ── Reconciliations ─────────────────────────────────────────────────
|
|
672
|
+
/**
|
|
673
|
+
* Every reconciliation block's standing at a period end (YYYY-MM). A block
|
|
674
|
+
* not yet compared for the period reads `not_started`.
|
|
675
|
+
*/
|
|
676
|
+
async listReconciliations(graphId, period) {
|
|
677
|
+
return this.gqlQuery(graphId, graphql_1.ListLedgerReconciliationsDocument, { period }, 'List reconciliations', (data) => data.reconciliations);
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* What changed on a reconciling item (a posted event whose source payload
|
|
681
|
+
* changed afterwards) and what each treatment would do. Writes nothing.
|
|
682
|
+
* List the items with `listEventBlocks(graphId, { isReconcilingItem: true })`.
|
|
683
|
+
*/
|
|
684
|
+
async previewReconcilingItem(graphId, eventId) {
|
|
685
|
+
const envelope = await this.callOperation('Preview reconciling item', (0, sdk_gen_1.previewReconcilingItem)({ path: { graph_id: graphId }, body: { event_id: eventId } }));
|
|
686
|
+
return this.requireResult('Preview reconciling item', envelope.result);
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Decide one reconciling item: `restate` the affected months, `catch_up`
|
|
690
|
+
* with an entry in the open period, or `acknowledge` that it was handled
|
|
691
|
+
* elsewhere (a note is required). Omit `disposition` to take the default
|
|
692
|
+
* the preview reports.
|
|
693
|
+
*/
|
|
694
|
+
async resolveReconcilingItem(graphId, body) {
|
|
695
|
+
const envelope = await this.callOperation('Resolve reconciling item', (0, sdk_gen_1.resolveReconcilingItem)({ path: { graph_id: graphId }, body }));
|
|
696
|
+
return this.requireResult('Resolve reconciling item', envelope.result);
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Draft the closing entry of every matured schedule obligation, including
|
|
700
|
+
* ones promoted earlier and never drafted. The drafts post when the period
|
|
701
|
+
* closes. Safe to repeat.
|
|
702
|
+
*/
|
|
703
|
+
async promoteObligations(graphId, body = {}) {
|
|
704
|
+
const envelope = await this.callOperation('Promote obligations', (0, sdk_gen_1.promoteObligations)({ path: { graph_id: graphId }, body }));
|
|
705
|
+
return this.requireResult('Promote obligations', envelope.result);
|
|
706
|
+
}
|
|
707
|
+
/** Compare the ledger with something outside it. Records nothing. */
|
|
708
|
+
async previewReconciliations(graphId, period, options) {
|
|
709
|
+
const body = {
|
|
710
|
+
period,
|
|
711
|
+
method: options?.method,
|
|
712
|
+
include_tied: options?.includeTied,
|
|
713
|
+
};
|
|
714
|
+
const envelope = await this.callOperation('Preview reconciliations', (0, sdk_gen_1.previewReconciliations)({ path: { graph_id: graphId }, body }));
|
|
715
|
+
return reconciliationPreviewToCamel(envelope.result);
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Run every reconciliation that applies at a period end and record each
|
|
719
|
+
* result on its block. `notes` names any check that could not run.
|
|
720
|
+
*/
|
|
721
|
+
async refreshReconciliations(graphId, period) {
|
|
722
|
+
const body = { period };
|
|
723
|
+
const envelope = await this.callOperation('Refresh reconciliations', (0, sdk_gen_1.refreshReconciliations)({ path: { graph_id: graphId }, body }));
|
|
724
|
+
return reconciliationListToCamel(envelope.result);
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Record a statement's ending balance for an account and reconcile the
|
|
728
|
+
* account to it for the period the statement ends in. Writes no books.
|
|
729
|
+
*/
|
|
730
|
+
async recordStatementBalance(graphId, input) {
|
|
731
|
+
const body = {
|
|
732
|
+
element_id: input.elementId,
|
|
733
|
+
as_of: input.asOf,
|
|
734
|
+
balance: input.balance,
|
|
735
|
+
document_id: input.documentId ?? null,
|
|
736
|
+
note: input.note ?? null,
|
|
737
|
+
};
|
|
738
|
+
const envelope = await this.callOperation('Record statement balance', (0, sdk_gen_1.recordStatementBalance)({ path: { graph_id: graphId }, body }));
|
|
739
|
+
return reconciliationSummaryToCamel(envelope.result);
|
|
740
|
+
}
|
|
741
|
+
/** Change how much the close cares about one reconciliation. */
|
|
742
|
+
async setReconciliationPolicy(graphId, structureId, changes) {
|
|
743
|
+
const body = {
|
|
744
|
+
structure_id: structureId,
|
|
745
|
+
required_for_close: changes.requiredForClose,
|
|
746
|
+
materiality: changes.materiality,
|
|
747
|
+
review_required: changes.reviewRequired,
|
|
748
|
+
separate_reviewer: changes.separateReviewer,
|
|
749
|
+
};
|
|
750
|
+
const envelope = await this.callOperation('Set reconciliation policy', (0, sdk_gen_1.setReconciliationPolicy)({ path: { graph_id: graphId }, body }));
|
|
751
|
+
const raw = envelope.result;
|
|
752
|
+
return {
|
|
753
|
+
structureId: raw.structure_id,
|
|
754
|
+
requiredForClose: raw.required_for_close,
|
|
755
|
+
materiality: raw.materiality,
|
|
756
|
+
reviewRequired: raw.review_required,
|
|
757
|
+
separateReviewer: raw.separate_reviewer,
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Sign off a reconciled period as its reviewer. Only a member of the graph
|
|
762
|
+
* can; a later change to any balance lapses the sign-off.
|
|
763
|
+
*/
|
|
764
|
+
async signOffReconciliation(graphId, structureId, period, note) {
|
|
765
|
+
const body = {
|
|
766
|
+
structure_id: structureId,
|
|
767
|
+
period,
|
|
768
|
+
note: note ?? null,
|
|
769
|
+
};
|
|
770
|
+
const envelope = await this.callOperation('Sign off reconciliation', (0, sdk_gen_1.signOffReconciliation)({ path: { graph_id: graphId }, body }));
|
|
771
|
+
return reconciliationSummaryToCamel(envelope.result);
|
|
772
|
+
}
|
|
666
773
|
// ── Journal entries (native accounting writes) ──────────────────────
|
|
667
774
|
/**
|
|
668
775
|
* Create a journal entry with balanced line items (DR=CR enforced).
|
|
@@ -945,8 +1052,8 @@ class LedgerClient {
|
|
|
945
1052
|
* A download is a read, so this resolves through GraphQL
|
|
946
1053
|
* (`reportDownloadUrl`) — the retired `GET .../reports/{id}/download`
|
|
947
1054
|
* REST resource is gone. Every flavor resolves to a presigned S3 URL:
|
|
948
|
-
*
|
|
949
|
-
* on first request. The returned `downloadUrl` is valid for
|
|
1055
|
+
* the Tavi model is stamped at publish time; the holon and XBRL are
|
|
1056
|
+
* materialized + cached on first request. The returned `downloadUrl` is valid for
|
|
950
1057
|
* `expiresIn` seconds (default 300, max 3600); browser callers
|
|
951
1058
|
* navigate to it via `window.location.href` (or an `<a href>` click)
|
|
952
1059
|
* to trigger the download — the server-set Content-Disposition forces
|
|
@@ -958,14 +1065,15 @@ class LedgerClient {
|
|
|
958
1065
|
*
|
|
959
1066
|
* @param graphId Graph identifier owning the Report.
|
|
960
1067
|
* @param reportId Report identifier (rpt_-prefixed ULID).
|
|
961
|
-
* @param options.format Serialization flavor — `
|
|
962
|
-
*
|
|
1068
|
+
* @param options.format Serialization flavor — `HOLON_JSONLD` (default, the
|
|
1069
|
+
* holon, which carries the whole report), `TAVI` (the Project Tavi
|
|
1070
|
+
* compiled model stamped at publish), or `XBRL_2_1`.
|
|
963
1071
|
* @param options.expiresIn Presigned URL lifetime, in seconds.
|
|
964
1072
|
*/
|
|
965
1073
|
async getReportDownloadUrl(graphId, reportId, options = {}) {
|
|
966
1074
|
return this.gqlQuery(graphId, graphql_1.GetLedgerReportDownloadUrlDocument, {
|
|
967
1075
|
reportId,
|
|
968
|
-
format: options.format ?? '
|
|
1076
|
+
format: options.format ?? 'HOLON_JSONLD',
|
|
969
1077
|
expiresIn: options.expiresIn ?? 300,
|
|
970
1078
|
}, 'Get report download URL', (data) => {
|
|
971
1079
|
const node = data.reportDownloadUrl;
|
|
@@ -1245,6 +1353,12 @@ function rawFiscalCalendarToCamel(raw) {
|
|
|
1245
1353
|
strandedObligationCount: raw.stranded_obligation_count ?? 0,
|
|
1246
1354
|
strandedObligationSample: (raw.stranded_obligation_sample ?? []).map(rawObligationDetailToCamel),
|
|
1247
1355
|
syncStaleDays: raw.sync_stale_days ?? null,
|
|
1356
|
+
reconcilingItemCount: raw.reconciling_item_count ?? 0,
|
|
1357
|
+
reconcilingItemSample: raw.reconciling_item_sample ?? [],
|
|
1358
|
+
unpostedSourceEventCount: raw.unposted_source_event_count ?? 0,
|
|
1359
|
+
unpostedSourceEventSample: raw.unposted_source_event_sample ?? [],
|
|
1360
|
+
unreconciledAccountCount: raw.unreconciled_account_count ?? 0,
|
|
1361
|
+
unreconciledAccountSample: raw.unreconciled_account_sample ?? [],
|
|
1248
1362
|
lastCloseAt: raw.last_close_at ?? null,
|
|
1249
1363
|
initializedAt: raw.initialized_at ?? null,
|
|
1250
1364
|
lastSyncAt: raw.last_sync_at ?? null,
|
|
@@ -1257,6 +1371,92 @@ function rawFiscalCalendarToCamel(raw) {
|
|
|
1257
1371
|
})),
|
|
1258
1372
|
};
|
|
1259
1373
|
}
|
|
1374
|
+
function reconciliationComponentToCamel(raw) {
|
|
1375
|
+
return {
|
|
1376
|
+
name: raw.name,
|
|
1377
|
+
amount: raw.amount,
|
|
1378
|
+
structureId: raw.structure_id ?? null,
|
|
1379
|
+
eventId: raw.event_id ?? null,
|
|
1380
|
+
documentId: raw.document_id ?? null,
|
|
1381
|
+
note: raw.note ?? null,
|
|
1382
|
+
};
|
|
1383
|
+
}
|
|
1384
|
+
function reconciliationRowToCamel(raw) {
|
|
1385
|
+
return {
|
|
1386
|
+
elementId: raw.element_id ?? null,
|
|
1387
|
+
accountCode: raw.account_code ?? null,
|
|
1388
|
+
accountName: raw.account_name,
|
|
1389
|
+
sourceAccountId: raw.source_account_id ?? null,
|
|
1390
|
+
statement: raw.statement ?? null,
|
|
1391
|
+
ledgerBalance: raw.ledger_balance,
|
|
1392
|
+
independentBalance: raw.independent_balance,
|
|
1393
|
+
difference: raw.difference,
|
|
1394
|
+
status: raw.status,
|
|
1395
|
+
asOf: raw.as_of ?? null,
|
|
1396
|
+
components: (raw.components ?? []).map(reconciliationComponentToCamel),
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
/**
|
|
1400
|
+
* Map the REST `ReconciliationSummary` (snake_case) onto the GraphQL shape
|
|
1401
|
+
* `listReconciliations` returns, so a read and a write give the same object.
|
|
1402
|
+
*/
|
|
1403
|
+
function reconciliationSummaryToCamel(raw) {
|
|
1404
|
+
return {
|
|
1405
|
+
structureId: raw.structure_id,
|
|
1406
|
+
name: raw.name,
|
|
1407
|
+
scope: raw.scope,
|
|
1408
|
+
method: raw.method,
|
|
1409
|
+
elementId: raw.element_id ?? null,
|
|
1410
|
+
requiredForClose: raw.required_for_close,
|
|
1411
|
+
materiality: raw.materiality,
|
|
1412
|
+
period: raw.period,
|
|
1413
|
+
asOf: raw.as_of,
|
|
1414
|
+
status: raw.status,
|
|
1415
|
+
unreconciledDifference: raw.unreconciled_difference ?? null,
|
|
1416
|
+
accountsCompared: raw.accounts_compared ?? null,
|
|
1417
|
+
accountsDifferent: raw.accounts_different ?? null,
|
|
1418
|
+
ledgerBalance: raw.ledger_balance ?? null,
|
|
1419
|
+
independentBalance: raw.independent_balance ?? null,
|
|
1420
|
+
balanceAsOf: raw.balance_as_of ?? null,
|
|
1421
|
+
components: (raw.components ?? []).map(reconciliationComponentToCamel),
|
|
1422
|
+
source: raw.source ?? null,
|
|
1423
|
+
comparedAt: raw.compared_at ?? null,
|
|
1424
|
+
factSetId: raw.fact_set_id ?? null,
|
|
1425
|
+
comparedBy: raw.compared_by ?? null,
|
|
1426
|
+
comparedVia: raw.compared_via ?? null,
|
|
1427
|
+
reviewRequired: raw.review_required,
|
|
1428
|
+
separateReviewer: raw.separate_reviewer,
|
|
1429
|
+
reviewedBy: raw.reviewed_by ?? null,
|
|
1430
|
+
reviewedAt: raw.reviewed_at ?? null,
|
|
1431
|
+
selfReviewed: raw.self_reviewed ?? null,
|
|
1432
|
+
differences: (raw.differences ?? []).map(reconciliationRowToCamel),
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
function reconciliationListToCamel(raw) {
|
|
1436
|
+
return {
|
|
1437
|
+
period: raw.period,
|
|
1438
|
+
asOf: raw.as_of,
|
|
1439
|
+
notes: raw.notes ?? [],
|
|
1440
|
+
reconciliations: (raw.reconciliations ?? []).map(reconciliationSummaryToCamel),
|
|
1441
|
+
};
|
|
1442
|
+
}
|
|
1443
|
+
function reconciliationPreviewToCamel(raw) {
|
|
1444
|
+
return {
|
|
1445
|
+
period: raw.period,
|
|
1446
|
+
asOf: raw.as_of,
|
|
1447
|
+
fiscalYearStart: raw.fiscal_year_start,
|
|
1448
|
+
method: raw.method,
|
|
1449
|
+
source: raw.source,
|
|
1450
|
+
reportBasis: raw.report_basis ?? null,
|
|
1451
|
+
lastSyncAt: raw.last_sync_at ?? null,
|
|
1452
|
+
accountsCompared: raw.accounts_compared,
|
|
1453
|
+
accountsTied: raw.accounts_tied,
|
|
1454
|
+
accountsDifferent: raw.accounts_different,
|
|
1455
|
+
totalDifference: raw.total_difference,
|
|
1456
|
+
rows: (raw.rows ?? []).map(reconciliationRowToCamel),
|
|
1457
|
+
notes: raw.notes ?? [],
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1260
1460
|
/**
|
|
1261
1461
|
* Map the REST `LedgerEntityResponse` (snake_case) onto the GraphQL
|
|
1262
1462
|
* `LedgerEntity` (camelCase) that `getEntity` returns, so callers can treat the
|