@robosystems/client 2.3.0 → 2.4.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 +107 -6
- package/artifacts/LedgerClient.js +170 -5
- package/artifacts/LedgerClient.ts +331 -5
- package/artifacts/graphql/generated/graphql.d.ts +69 -0
- package/artifacts/graphql/generated/graphql.js +132 -2
- package/artifacts/graphql/generated/graphql.ts +203 -0
- package/artifacts/graphql/queries/ledger/fiscalCalendar.js +2 -0
- package/artifacts/graphql/queries/ledger/fiscalCalendar.ts +2 -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, PublishListMemberResponse, PublishListResponse, ReportResponse, 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,68 @@ 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
|
+
/** Which reconciliation check to run. */
|
|
219
|
+
export type ReconciliationMethod = NonNullable<PreviewReconciliationsRequest['method']>;
|
|
220
|
+
export interface PreviewReconciliationsOptions {
|
|
221
|
+
/** Defaults to `source_ledger`, which needs a connected QuickBooks ledger. */
|
|
222
|
+
method?: ReconciliationMethod;
|
|
223
|
+
/** Also return the accounts that tie. */
|
|
224
|
+
includeTied?: boolean;
|
|
225
|
+
}
|
|
226
|
+
/** One comparison of the ledger with something outside it. Nothing is recorded. */
|
|
227
|
+
export interface LedgerReconciliationPreview {
|
|
228
|
+
period: string;
|
|
229
|
+
asOf: string;
|
|
230
|
+
fiscalYearStart: string;
|
|
231
|
+
method: string;
|
|
232
|
+
source: string;
|
|
233
|
+
reportBasis: string | null;
|
|
234
|
+
lastSyncAt: string | null;
|
|
235
|
+
accountsCompared: number;
|
|
236
|
+
accountsTied: number;
|
|
237
|
+
accountsDifferent: number;
|
|
238
|
+
/** Sum of the absolute differences across accounts, not a net figure. */
|
|
239
|
+
totalDifference: number;
|
|
240
|
+
/** Accounts that do not tie, largest first; tied ones follow with `includeTied`. */
|
|
241
|
+
rows: LedgerReconciliationRow[];
|
|
242
|
+
notes: string[];
|
|
243
|
+
}
|
|
244
|
+
export interface RecordStatementBalanceInput {
|
|
245
|
+
/** The balance-sheet account the statement is for. */
|
|
246
|
+
elementId: string;
|
|
247
|
+
/** The statement's ending date, as YYYY-MM-DD. */
|
|
248
|
+
asOf: string;
|
|
249
|
+
/**
|
|
250
|
+
* The ending balance as the statement shows it: a positive number in the
|
|
251
|
+
* account's normal direction (money in a bank account, or the amount owed
|
|
252
|
+
* on a loan or a card).
|
|
253
|
+
*/
|
|
254
|
+
balance: number;
|
|
255
|
+
/** The statement itself, as a document already on the graph. */
|
|
256
|
+
documentId?: string | null;
|
|
257
|
+
note?: string | null;
|
|
258
|
+
}
|
|
259
|
+
/** Policy fields to change; an omitted field keeps its value. */
|
|
260
|
+
export interface ReconciliationPolicyChanges {
|
|
261
|
+
requiredForClose?: boolean;
|
|
262
|
+
materiality?: number;
|
|
263
|
+
reviewRequired?: boolean;
|
|
264
|
+
separateReviewer?: boolean;
|
|
265
|
+
}
|
|
266
|
+
export interface LedgerReconciliationPolicy {
|
|
267
|
+
structureId: string;
|
|
268
|
+
requiredForClose: boolean;
|
|
269
|
+
materiality: number;
|
|
270
|
+
reviewRequired: boolean;
|
|
271
|
+
separateReviewer: boolean;
|
|
202
272
|
}
|
|
203
273
|
export interface CreateScheduleOptions {
|
|
204
274
|
name: string;
|
|
@@ -219,6 +289,12 @@ export interface CreateScheduleOptions {
|
|
|
219
289
|
residualValue?: number;
|
|
220
290
|
usefulLifeMonths?: number;
|
|
221
291
|
assetElementId?: string;
|
|
292
|
+
/**
|
|
293
|
+
* The day the cost went on the books (YYYY-MM-DD), when that is before
|
|
294
|
+
* the schedule's first period. The schedule reconciliation carries the
|
|
295
|
+
* cost from that day.
|
|
296
|
+
*/
|
|
297
|
+
bookedOn?: string;
|
|
222
298
|
};
|
|
223
299
|
}
|
|
224
300
|
export interface JournalEntryLineItem {
|
|
@@ -613,6 +689,30 @@ export declare class LedgerClient {
|
|
|
613
689
|
closePeriod(graphId: string, period: string, options?: ClosePeriodOptions): Promise<ClosePeriodResult>;
|
|
614
690
|
/** Reopen a closed fiscal period. Requires a reason for the audit log. */
|
|
615
691
|
reopenPeriod(graphId: string, period: string, reason: string, note?: string | null): Promise<LedgerFiscalCalendar>;
|
|
692
|
+
/**
|
|
693
|
+
* Every reconciliation block's standing at a period end (YYYY-MM). A block
|
|
694
|
+
* not yet compared for the period reads `not_started`.
|
|
695
|
+
*/
|
|
696
|
+
listReconciliations(graphId: string, period: string): Promise<LedgerReconciliationList | null>;
|
|
697
|
+
/** Compare the ledger with something outside it. Records nothing. */
|
|
698
|
+
previewReconciliations(graphId: string, period: string, options?: PreviewReconciliationsOptions): Promise<LedgerReconciliationPreview>;
|
|
699
|
+
/**
|
|
700
|
+
* Run every reconciliation that applies at a period end and record each
|
|
701
|
+
* result on its block. `notes` names any check that could not run.
|
|
702
|
+
*/
|
|
703
|
+
refreshReconciliations(graphId: string, period: string): Promise<LedgerReconciliationList>;
|
|
704
|
+
/**
|
|
705
|
+
* Record a statement's ending balance for an account and reconcile the
|
|
706
|
+
* account to it for the period the statement ends in. Writes no books.
|
|
707
|
+
*/
|
|
708
|
+
recordStatementBalance(graphId: string, input: RecordStatementBalanceInput): Promise<LedgerReconciliation>;
|
|
709
|
+
/** Change how much the close cares about one reconciliation. */
|
|
710
|
+
setReconciliationPolicy(graphId: string, structureId: string, changes: ReconciliationPolicyChanges): Promise<LedgerReconciliationPolicy>;
|
|
711
|
+
/**
|
|
712
|
+
* Sign off a reconciled period as its reviewer. Only a member of the graph
|
|
713
|
+
* can; a later change to any balance lapses the sign-off.
|
|
714
|
+
*/
|
|
715
|
+
signOffReconciliation(graphId: string, structureId: string, period: string, note?: string | null): Promise<LedgerReconciliation>;
|
|
616
716
|
/**
|
|
617
717
|
* Create a journal entry with balanced line items (DR=CR enforced).
|
|
618
718
|
*
|
|
@@ -759,8 +859,8 @@ export declare class LedgerClient {
|
|
|
759
859
|
* A download is a read, so this resolves through GraphQL
|
|
760
860
|
* (`reportDownloadUrl`) — the retired `GET .../reports/{id}/download`
|
|
761
861
|
* REST resource is gone. Every flavor resolves to a presigned S3 URL:
|
|
762
|
-
*
|
|
763
|
-
* on first request. The returned `downloadUrl` is valid for
|
|
862
|
+
* the Tavi model is stamped at publish time; the holon and XBRL are
|
|
863
|
+
* materialized + cached on first request. The returned `downloadUrl` is valid for
|
|
764
864
|
* `expiresIn` seconds (default 300, max 3600); browser callers
|
|
765
865
|
* navigate to it via `window.location.href` (or an `<a href>` click)
|
|
766
866
|
* to trigger the download — the server-set Content-Disposition forces
|
|
@@ -772,8 +872,9 @@ export declare class LedgerClient {
|
|
|
772
872
|
*
|
|
773
873
|
* @param graphId Graph identifier owning the Report.
|
|
774
874
|
* @param reportId Report identifier (rpt_-prefixed ULID).
|
|
775
|
-
* @param options.format Serialization flavor — `
|
|
776
|
-
*
|
|
875
|
+
* @param options.format Serialization flavor — `HOLON_JSONLD` (default, the
|
|
876
|
+
* holon, which carries the whole report), `TAVI` (the Project Tavi
|
|
877
|
+
* compiled model stamped at publish), or `XBRL_2_1`.
|
|
777
878
|
* @param options.expiresIn Presigned URL lifetime, in seconds.
|
|
778
879
|
*/
|
|
779
880
|
getReportDownloadUrl(graphId: string, reportId: string, options?: {
|
|
@@ -411,6 +411,7 @@ class LedgerClient {
|
|
|
411
411
|
residual_value: options.scheduleMetadata.residualValue,
|
|
412
412
|
useful_life_months: options.scheduleMetadata.usefulLifeMonths,
|
|
413
413
|
asset_element_id: options.scheduleMetadata.assetElementId,
|
|
414
|
+
booked_on: options.scheduleMetadata.bookedOn,
|
|
414
415
|
}
|
|
415
416
|
: undefined,
|
|
416
417
|
},
|
|
@@ -639,6 +640,7 @@ class LedgerClient {
|
|
|
639
640
|
note: options?.note ?? null,
|
|
640
641
|
allow_stale_sync: options?.allowStaleSync,
|
|
641
642
|
allow_stranded_obligations: options?.allowStrandedObligations,
|
|
643
|
+
allow_unreconciled_accounts: options?.allowUnreconciledAccounts,
|
|
642
644
|
};
|
|
643
645
|
const envelope = await this.callOperation('Close period', (0, sdk_gen_1.closePeriod)({ path: { graph_id: graphId }, body }));
|
|
644
646
|
const raw = envelope.result;
|
|
@@ -663,6 +665,80 @@ class LedgerClient {
|
|
|
663
665
|
const envelope = await this.callOperation('Reopen period', (0, sdk_gen_1.reopenPeriod)({ path: { graph_id: graphId }, body }));
|
|
664
666
|
return rawFiscalCalendarToCamel(envelope.result);
|
|
665
667
|
}
|
|
668
|
+
// ── Reconciliations ─────────────────────────────────────────────────
|
|
669
|
+
/**
|
|
670
|
+
* Every reconciliation block's standing at a period end (YYYY-MM). A block
|
|
671
|
+
* not yet compared for the period reads `not_started`.
|
|
672
|
+
*/
|
|
673
|
+
async listReconciliations(graphId, period) {
|
|
674
|
+
return this.gqlQuery(graphId, graphql_1.ListLedgerReconciliationsDocument, { period }, 'List reconciliations', (data) => data.reconciliations);
|
|
675
|
+
}
|
|
676
|
+
/** Compare the ledger with something outside it. Records nothing. */
|
|
677
|
+
async previewReconciliations(graphId, period, options) {
|
|
678
|
+
const body = {
|
|
679
|
+
period,
|
|
680
|
+
method: options?.method,
|
|
681
|
+
include_tied: options?.includeTied,
|
|
682
|
+
};
|
|
683
|
+
const envelope = await this.callOperation('Preview reconciliations', (0, sdk_gen_1.previewReconciliations)({ path: { graph_id: graphId }, body }));
|
|
684
|
+
return reconciliationPreviewToCamel(envelope.result);
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Run every reconciliation that applies at a period end and record each
|
|
688
|
+
* result on its block. `notes` names any check that could not run.
|
|
689
|
+
*/
|
|
690
|
+
async refreshReconciliations(graphId, period) {
|
|
691
|
+
const body = { period };
|
|
692
|
+
const envelope = await this.callOperation('Refresh reconciliations', (0, sdk_gen_1.refreshReconciliations)({ path: { graph_id: graphId }, body }));
|
|
693
|
+
return reconciliationListToCamel(envelope.result);
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Record a statement's ending balance for an account and reconcile the
|
|
697
|
+
* account to it for the period the statement ends in. Writes no books.
|
|
698
|
+
*/
|
|
699
|
+
async recordStatementBalance(graphId, input) {
|
|
700
|
+
const body = {
|
|
701
|
+
element_id: input.elementId,
|
|
702
|
+
as_of: input.asOf,
|
|
703
|
+
balance: input.balance,
|
|
704
|
+
document_id: input.documentId ?? null,
|
|
705
|
+
note: input.note ?? null,
|
|
706
|
+
};
|
|
707
|
+
const envelope = await this.callOperation('Record statement balance', (0, sdk_gen_1.recordStatementBalance)({ path: { graph_id: graphId }, body }));
|
|
708
|
+
return reconciliationSummaryToCamel(envelope.result);
|
|
709
|
+
}
|
|
710
|
+
/** Change how much the close cares about one reconciliation. */
|
|
711
|
+
async setReconciliationPolicy(graphId, structureId, changes) {
|
|
712
|
+
const body = {
|
|
713
|
+
structure_id: structureId,
|
|
714
|
+
required_for_close: changes.requiredForClose,
|
|
715
|
+
materiality: changes.materiality,
|
|
716
|
+
review_required: changes.reviewRequired,
|
|
717
|
+
separate_reviewer: changes.separateReviewer,
|
|
718
|
+
};
|
|
719
|
+
const envelope = await this.callOperation('Set reconciliation policy', (0, sdk_gen_1.setReconciliationPolicy)({ path: { graph_id: graphId }, body }));
|
|
720
|
+
const raw = envelope.result;
|
|
721
|
+
return {
|
|
722
|
+
structureId: raw.structure_id,
|
|
723
|
+
requiredForClose: raw.required_for_close,
|
|
724
|
+
materiality: raw.materiality,
|
|
725
|
+
reviewRequired: raw.review_required,
|
|
726
|
+
separateReviewer: raw.separate_reviewer,
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Sign off a reconciled period as its reviewer. Only a member of the graph
|
|
731
|
+
* can; a later change to any balance lapses the sign-off.
|
|
732
|
+
*/
|
|
733
|
+
async signOffReconciliation(graphId, structureId, period, note) {
|
|
734
|
+
const body = {
|
|
735
|
+
structure_id: structureId,
|
|
736
|
+
period,
|
|
737
|
+
note: note ?? null,
|
|
738
|
+
};
|
|
739
|
+
const envelope = await this.callOperation('Sign off reconciliation', (0, sdk_gen_1.signOffReconciliation)({ path: { graph_id: graphId }, body }));
|
|
740
|
+
return reconciliationSummaryToCamel(envelope.result);
|
|
741
|
+
}
|
|
666
742
|
// ── Journal entries (native accounting writes) ──────────────────────
|
|
667
743
|
/**
|
|
668
744
|
* Create a journal entry with balanced line items (DR=CR enforced).
|
|
@@ -945,8 +1021,8 @@ class LedgerClient {
|
|
|
945
1021
|
* A download is a read, so this resolves through GraphQL
|
|
946
1022
|
* (`reportDownloadUrl`) — the retired `GET .../reports/{id}/download`
|
|
947
1023
|
* REST resource is gone. Every flavor resolves to a presigned S3 URL:
|
|
948
|
-
*
|
|
949
|
-
* on first request. The returned `downloadUrl` is valid for
|
|
1024
|
+
* the Tavi model is stamped at publish time; the holon and XBRL are
|
|
1025
|
+
* materialized + cached on first request. The returned `downloadUrl` is valid for
|
|
950
1026
|
* `expiresIn` seconds (default 300, max 3600); browser callers
|
|
951
1027
|
* navigate to it via `window.location.href` (or an `<a href>` click)
|
|
952
1028
|
* to trigger the download — the server-set Content-Disposition forces
|
|
@@ -958,14 +1034,15 @@ class LedgerClient {
|
|
|
958
1034
|
*
|
|
959
1035
|
* @param graphId Graph identifier owning the Report.
|
|
960
1036
|
* @param reportId Report identifier (rpt_-prefixed ULID).
|
|
961
|
-
* @param options.format Serialization flavor — `
|
|
962
|
-
*
|
|
1037
|
+
* @param options.format Serialization flavor — `HOLON_JSONLD` (default, the
|
|
1038
|
+
* holon, which carries the whole report), `TAVI` (the Project Tavi
|
|
1039
|
+
* compiled model stamped at publish), or `XBRL_2_1`.
|
|
963
1040
|
* @param options.expiresIn Presigned URL lifetime, in seconds.
|
|
964
1041
|
*/
|
|
965
1042
|
async getReportDownloadUrl(graphId, reportId, options = {}) {
|
|
966
1043
|
return this.gqlQuery(graphId, graphql_1.GetLedgerReportDownloadUrlDocument, {
|
|
967
1044
|
reportId,
|
|
968
|
-
format: options.format ?? '
|
|
1045
|
+
format: options.format ?? 'HOLON_JSONLD',
|
|
969
1046
|
expiresIn: options.expiresIn ?? 300,
|
|
970
1047
|
}, 'Get report download URL', (data) => {
|
|
971
1048
|
const node = data.reportDownloadUrl;
|
|
@@ -1245,6 +1322,8 @@ function rawFiscalCalendarToCamel(raw) {
|
|
|
1245
1322
|
strandedObligationCount: raw.stranded_obligation_count ?? 0,
|
|
1246
1323
|
strandedObligationSample: (raw.stranded_obligation_sample ?? []).map(rawObligationDetailToCamel),
|
|
1247
1324
|
syncStaleDays: raw.sync_stale_days ?? null,
|
|
1325
|
+
unreconciledAccountCount: raw.unreconciled_account_count ?? 0,
|
|
1326
|
+
unreconciledAccountSample: raw.unreconciled_account_sample ?? [],
|
|
1248
1327
|
lastCloseAt: raw.last_close_at ?? null,
|
|
1249
1328
|
initializedAt: raw.initialized_at ?? null,
|
|
1250
1329
|
lastSyncAt: raw.last_sync_at ?? null,
|
|
@@ -1257,6 +1336,92 @@ function rawFiscalCalendarToCamel(raw) {
|
|
|
1257
1336
|
})),
|
|
1258
1337
|
};
|
|
1259
1338
|
}
|
|
1339
|
+
function reconciliationComponentToCamel(raw) {
|
|
1340
|
+
return {
|
|
1341
|
+
name: raw.name,
|
|
1342
|
+
amount: raw.amount,
|
|
1343
|
+
structureId: raw.structure_id ?? null,
|
|
1344
|
+
eventId: raw.event_id ?? null,
|
|
1345
|
+
documentId: raw.document_id ?? null,
|
|
1346
|
+
note: raw.note ?? null,
|
|
1347
|
+
};
|
|
1348
|
+
}
|
|
1349
|
+
function reconciliationRowToCamel(raw) {
|
|
1350
|
+
return {
|
|
1351
|
+
elementId: raw.element_id ?? null,
|
|
1352
|
+
accountCode: raw.account_code ?? null,
|
|
1353
|
+
accountName: raw.account_name,
|
|
1354
|
+
sourceAccountId: raw.source_account_id ?? null,
|
|
1355
|
+
statement: raw.statement ?? null,
|
|
1356
|
+
ledgerBalance: raw.ledger_balance,
|
|
1357
|
+
independentBalance: raw.independent_balance,
|
|
1358
|
+
difference: raw.difference,
|
|
1359
|
+
status: raw.status,
|
|
1360
|
+
asOf: raw.as_of ?? null,
|
|
1361
|
+
components: (raw.components ?? []).map(reconciliationComponentToCamel),
|
|
1362
|
+
};
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Map the REST `ReconciliationSummary` (snake_case) onto the GraphQL shape
|
|
1366
|
+
* `listReconciliations` returns, so a read and a write give the same object.
|
|
1367
|
+
*/
|
|
1368
|
+
function reconciliationSummaryToCamel(raw) {
|
|
1369
|
+
return {
|
|
1370
|
+
structureId: raw.structure_id,
|
|
1371
|
+
name: raw.name,
|
|
1372
|
+
scope: raw.scope,
|
|
1373
|
+
method: raw.method,
|
|
1374
|
+
elementId: raw.element_id ?? null,
|
|
1375
|
+
requiredForClose: raw.required_for_close,
|
|
1376
|
+
materiality: raw.materiality,
|
|
1377
|
+
period: raw.period,
|
|
1378
|
+
asOf: raw.as_of,
|
|
1379
|
+
status: raw.status,
|
|
1380
|
+
unreconciledDifference: raw.unreconciled_difference ?? null,
|
|
1381
|
+
accountsCompared: raw.accounts_compared ?? null,
|
|
1382
|
+
accountsDifferent: raw.accounts_different ?? null,
|
|
1383
|
+
ledgerBalance: raw.ledger_balance ?? null,
|
|
1384
|
+
independentBalance: raw.independent_balance ?? null,
|
|
1385
|
+
balanceAsOf: raw.balance_as_of ?? null,
|
|
1386
|
+
components: (raw.components ?? []).map(reconciliationComponentToCamel),
|
|
1387
|
+
source: raw.source ?? null,
|
|
1388
|
+
comparedAt: raw.compared_at ?? null,
|
|
1389
|
+
factSetId: raw.fact_set_id ?? null,
|
|
1390
|
+
comparedBy: raw.compared_by ?? null,
|
|
1391
|
+
comparedVia: raw.compared_via ?? null,
|
|
1392
|
+
reviewRequired: raw.review_required,
|
|
1393
|
+
separateReviewer: raw.separate_reviewer,
|
|
1394
|
+
reviewedBy: raw.reviewed_by ?? null,
|
|
1395
|
+
reviewedAt: raw.reviewed_at ?? null,
|
|
1396
|
+
selfReviewed: raw.self_reviewed ?? null,
|
|
1397
|
+
differences: (raw.differences ?? []).map(reconciliationRowToCamel),
|
|
1398
|
+
};
|
|
1399
|
+
}
|
|
1400
|
+
function reconciliationListToCamel(raw) {
|
|
1401
|
+
return {
|
|
1402
|
+
period: raw.period,
|
|
1403
|
+
asOf: raw.as_of,
|
|
1404
|
+
notes: raw.notes ?? [],
|
|
1405
|
+
reconciliations: (raw.reconciliations ?? []).map(reconciliationSummaryToCamel),
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
function reconciliationPreviewToCamel(raw) {
|
|
1409
|
+
return {
|
|
1410
|
+
period: raw.period,
|
|
1411
|
+
asOf: raw.as_of,
|
|
1412
|
+
fiscalYearStart: raw.fiscal_year_start,
|
|
1413
|
+
method: raw.method,
|
|
1414
|
+
source: raw.source,
|
|
1415
|
+
reportBasis: raw.report_basis ?? null,
|
|
1416
|
+
lastSyncAt: raw.last_sync_at ?? null,
|
|
1417
|
+
accountsCompared: raw.accounts_compared,
|
|
1418
|
+
accountsTied: raw.accounts_tied,
|
|
1419
|
+
accountsDifferent: raw.accounts_different,
|
|
1420
|
+
totalDifference: raw.total_difference,
|
|
1421
|
+
rows: (raw.rows ?? []).map(reconciliationRowToCamel),
|
|
1422
|
+
notes: raw.notes ?? [],
|
|
1423
|
+
};
|
|
1424
|
+
}
|
|
1260
1425
|
/**
|
|
1261
1426
|
* Map the REST `LedgerEntityResponse` (snake_case) onto the GraphQL
|
|
1262
1427
|
* `LedgerEntity` (camelCase) that `getEntity` returns, so callers can treat the
|