@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.
@@ -54,13 +54,21 @@ import {
54
54
  linkEntityTaxonomy,
55
55
  liveFinancialStatement,
56
56
  previewEventBlock,
57
+ previewReconciliations,
58
+ previewReconcilingItem,
59
+ promoteObligations,
57
60
  rebuildSchedule,
61
+ recordStatementBalance,
62
+ refreshReconciliations,
58
63
  regenerateReport,
59
64
  removePublishListMember,
60
65
  reopenPeriod,
66
+ resolveReconcilingItem,
61
67
  revokeReportShare,
62
68
  setCloseTarget,
69
+ setReconciliationPolicy,
63
70
  shareReport,
71
+ signOffReconciliation,
64
72
  transitionFilingStatus,
65
73
  unblockSourceGraph,
66
74
  updateAgent,
@@ -119,14 +127,30 @@ import type {
119
127
  LiveFinancialStatementResponse,
120
128
  OperationEnvelope,
121
129
  PreviewEventBlockResponse,
130
+ PreviewReconciliationsRequest,
131
+ PromoteObligationsRequest,
132
+ PromoteObligationsResponse,
122
133
  PublishListMemberResponse,
123
134
  PublishListResponse,
124
135
  RebuildScheduleRequest,
136
+ ReconciliationComponent,
137
+ ReconciliationListResponse,
138
+ ReconciliationPolicyResponse,
139
+ ReconciliationPreviewResponse,
140
+ ReconciliationRow,
141
+ ReconciliationSummary,
142
+ ReconcilingItemPlan,
143
+ RecordStatementBalanceRequest,
144
+ RefreshReconciliationsRequest,
125
145
  ReopenPeriodOperation,
126
146
  ReportResponse,
147
+ ResolveReconcilingItemRequest,
148
+ ResolveReconcilingItemResponse,
127
149
  RevokeReportShareResponse,
128
150
  SetCloseTargetOperation,
151
+ SetReconciliationPolicyRequest,
129
152
  ShareReportResponse,
153
+ SignOffReconciliationRequest,
130
154
  TaxonomyBlockEnvelope,
131
155
  TransitionFilingStatusRequest,
132
156
  UpdateAgentRequest,
@@ -176,6 +200,7 @@ import {
176
200
  ListLedgerJournalEntriesDocument,
177
201
  ListLedgerMappingsDocument,
178
202
  ListLedgerPublishListsDocument,
203
+ ListLedgerReconciliationsDocument,
179
204
  ListLedgerReportsDocument,
180
205
  ListLedgerStructuresDocument,
181
206
  ListLedgerTaxonomiesDocument,
@@ -214,6 +239,7 @@ import {
214
239
  type ListLedgerJournalEntriesQuery,
215
240
  type ListLedgerMappingsQuery,
216
241
  type ListLedgerPublishListsQuery,
242
+ type ListLedgerReconciliationsQuery,
217
243
  type ListLedgerReportsQuery,
218
244
  type ListLedgerStructuresQuery,
219
245
  type ListLedgerTaxonomiesQuery,
@@ -306,6 +332,17 @@ export type LedgerFiscalCalendar = NonNullable<GetLedgerFiscalCalendarQuery['fis
306
332
  export type LedgerChartTemplate = ListChartTemplatesQuery['chartTemplates'][number]
307
333
  export type LedgerFiscalPeriod = LedgerFiscalCalendar['periods'][number]
308
334
 
335
+ /** Every reconciliation block's standing for one period. */
336
+ export type LedgerReconciliationList = NonNullable<
337
+ ListLedgerReconciliationsQuery['reconciliations']
338
+ >
339
+ /** One reconciliation block's standing for a period. */
340
+ export type LedgerReconciliation = LedgerReconciliationList['reconciliations'][number]
341
+ /** One account: the ledger's balance, the independent balance, the difference. */
342
+ export type LedgerReconciliationRow = LedgerReconciliation['differences'][number]
343
+ /** One part of an account's independent balance: a schedule, or a statement. */
344
+ export type LedgerReconciliationComponent = LedgerReconciliation['components'][number]
345
+
309
346
  // Reports + publish lists + statements
310
347
  export type Report = NonNullable<GetLedgerReportQuery['report']>
311
348
  export type ReportPackage = NonNullable<GetLedgerReportPackageQuery['reportPackage']>
@@ -396,6 +433,12 @@ interface RawFiscalCalendar {
396
433
  stranded_obligation_count?: number
397
434
  stranded_obligation_sample?: RawObligationDetail[]
398
435
  sync_stale_days?: number | null
436
+ reconciling_item_count?: number
437
+ reconciling_item_sample?: string[]
438
+ unposted_source_event_count?: number
439
+ unposted_source_event_sample?: string[]
440
+ unreconciled_account_count?: number
441
+ unreconciled_account_sample?: string[]
399
442
  last_close_at: string | null
400
443
  initialized_at: string | null
401
444
  last_sync_at: string | null
@@ -554,6 +597,86 @@ export interface ClosePeriodOptions {
554
597
  * in the close audit note.
555
598
  */
556
599
  allowStrandedObligations?: boolean
600
+ /**
601
+ * Close despite a reconciliation the close waits on that is not
602
+ * reconciled for the period, or was never compared for it. Prefer
603
+ * `refreshReconciliations` and clearing what it reports. The override is
604
+ * recorded in the close audit note.
605
+ */
606
+ allowUnreconciledAccounts?: boolean
607
+ /**
608
+ * Close despite posted events whose source payload changed afterwards and
609
+ * that nobody has decided on. Prefer `resolveReconcilingItem` on each.
610
+ * The override is recorded in the close audit note.
611
+ */
612
+ allowReconcilingItems?: boolean
613
+ /**
614
+ * Close despite source events dated in the period that were never
615
+ * committed; once it closes they cannot post into it. Prefer committing
616
+ * or voiding each. The override is recorded in the close audit note.
617
+ */
618
+ allowUnpostedSourceEvents?: boolean
619
+ }
620
+
621
+ /** Which reconciliation check to run. */
622
+ export type ReconciliationMethod = NonNullable<PreviewReconciliationsRequest['method']>
623
+
624
+ export interface PreviewReconciliationsOptions {
625
+ /** Defaults to `source_ledger`, which needs a connected QuickBooks ledger. */
626
+ method?: ReconciliationMethod
627
+ /** Also return the accounts that tie. */
628
+ includeTied?: boolean
629
+ }
630
+
631
+ /** One comparison of the ledger with something outside it. Nothing is recorded. */
632
+ export interface LedgerReconciliationPreview {
633
+ period: string
634
+ asOf: string
635
+ fiscalYearStart: string
636
+ method: string
637
+ source: string
638
+ reportBasis: string | null
639
+ lastSyncAt: string | null
640
+ accountsCompared: number
641
+ accountsTied: number
642
+ accountsDifferent: number
643
+ /** Sum of the absolute differences across accounts, not a net figure. */
644
+ totalDifference: number
645
+ /** Accounts that do not tie, largest first; tied ones follow with `includeTied`. */
646
+ rows: LedgerReconciliationRow[]
647
+ notes: string[]
648
+ }
649
+
650
+ export interface RecordStatementBalanceInput {
651
+ /** The balance-sheet account the statement is for. */
652
+ elementId: string
653
+ /** The statement's ending date, as YYYY-MM-DD. */
654
+ asOf: string
655
+ /**
656
+ * The ending balance as the statement shows it: a positive number in the
657
+ * account's normal direction (money in a bank account, or the amount owed
658
+ * on a loan or a card).
659
+ */
660
+ balance: number
661
+ /** The statement itself, as a document already on the graph. */
662
+ documentId?: string | null
663
+ note?: string | null
664
+ }
665
+
666
+ /** Policy fields to change; an omitted field keeps its value. */
667
+ export interface ReconciliationPolicyChanges {
668
+ requiredForClose?: boolean
669
+ materiality?: number
670
+ reviewRequired?: boolean
671
+ separateReviewer?: boolean
672
+ }
673
+
674
+ export interface LedgerReconciliationPolicy {
675
+ structureId: string
676
+ requiredForClose: boolean
677
+ materiality: number
678
+ reviewRequired: boolean
679
+ separateReviewer: boolean
557
680
  }
558
681
 
559
682
  export interface CreateScheduleOptions {
@@ -575,6 +698,12 @@ export interface CreateScheduleOptions {
575
698
  residualValue?: number
576
699
  usefulLifeMonths?: number
577
700
  assetElementId?: string
701
+ /**
702
+ * The day the cost went on the books (YYYY-MM-DD), when that is before
703
+ * the schedule's first period. The schedule reconciliation carries the
704
+ * cost from that day.
705
+ */
706
+ bookedOn?: string
578
707
  }
579
708
  }
580
709
 
@@ -864,6 +993,8 @@ export class LedgerClient {
864
993
  status?: string
865
994
  agentId?: string
866
995
  source?: string
996
+ /** Only posted events whose source payload changed afterwards. */
997
+ isReconcilingItem?: boolean
867
998
  limit?: number
868
999
  offset?: number
869
1000
  }
@@ -877,6 +1008,7 @@ export class LedgerClient {
877
1008
  status: options?.status ?? null,
878
1009
  agentId: options?.agentId ?? null,
879
1010
  source: options?.source ?? null,
1011
+ isReconcilingItem: options?.isReconcilingItem ?? null,
880
1012
  limit: options?.limit ?? 50,
881
1013
  offset: options?.offset ?? 0,
882
1014
  },
@@ -1430,6 +1562,7 @@ export class LedgerClient {
1430
1562
  residual_value: options.scheduleMetadata.residualValue,
1431
1563
  useful_life_months: options.scheduleMetadata.usefulLifeMonths,
1432
1564
  asset_element_id: options.scheduleMetadata.assetElementId,
1565
+ booked_on: options.scheduleMetadata.bookedOn,
1433
1566
  }
1434
1567
  : undefined,
1435
1568
  },
@@ -1794,6 +1927,9 @@ export class LedgerClient {
1794
1927
  note: options?.note ?? null,
1795
1928
  allow_stale_sync: options?.allowStaleSync,
1796
1929
  allow_stranded_obligations: options?.allowStrandedObligations,
1930
+ allow_unreconciled_accounts: options?.allowUnreconciledAccounts,
1931
+ allow_reconciling_items: options?.allowReconcilingItems,
1932
+ allow_unposted_source_events: options?.allowUnpostedSourceEvents,
1797
1933
  }
1798
1934
  const envelope = await this.callOperation(
1799
1935
  'Close period',
@@ -1831,6 +1967,173 @@ export class LedgerClient {
1831
1967
  return rawFiscalCalendarToCamel(envelope.result as unknown as RawFiscalCalendar)
1832
1968
  }
1833
1969
 
1970
+ // ── Reconciliations ─────────────────────────────────────────────────
1971
+
1972
+ /**
1973
+ * Every reconciliation block's standing at a period end (YYYY-MM). A block
1974
+ * not yet compared for the period reads `not_started`.
1975
+ */
1976
+ async listReconciliations(
1977
+ graphId: string,
1978
+ period: string
1979
+ ): Promise<LedgerReconciliationList | null> {
1980
+ return this.gqlQuery(
1981
+ graphId,
1982
+ ListLedgerReconciliationsDocument,
1983
+ { period },
1984
+ 'List reconciliations',
1985
+ (data) => data.reconciliations
1986
+ )
1987
+ }
1988
+
1989
+ /**
1990
+ * What changed on a reconciling item (a posted event whose source payload
1991
+ * changed afterwards) and what each treatment would do. Writes nothing.
1992
+ * List the items with `listEventBlocks(graphId, { isReconcilingItem: true })`.
1993
+ */
1994
+ async previewReconcilingItem(graphId: string, eventId: string): Promise<ReconcilingItemPlan> {
1995
+ const envelope = await this.callOperation(
1996
+ 'Preview reconciling item',
1997
+ previewReconcilingItem({ path: { graph_id: graphId }, body: { event_id: eventId } })
1998
+ )
1999
+ return this.requireResult('Preview reconciling item', envelope.result)
2000
+ }
2001
+
2002
+ /**
2003
+ * Decide one reconciling item: `restate` the affected months, `catch_up`
2004
+ * with an entry in the open period, or `acknowledge` that it was handled
2005
+ * elsewhere (a note is required). Omit `disposition` to take the default
2006
+ * the preview reports.
2007
+ */
2008
+ async resolveReconcilingItem(
2009
+ graphId: string,
2010
+ body: ResolveReconcilingItemRequest
2011
+ ): Promise<ResolveReconcilingItemResponse> {
2012
+ const envelope = await this.callOperation(
2013
+ 'Resolve reconciling item',
2014
+ resolveReconcilingItem({ path: { graph_id: graphId }, body })
2015
+ )
2016
+ return this.requireResult('Resolve reconciling item', envelope.result)
2017
+ }
2018
+
2019
+ /**
2020
+ * Draft the closing entry of every matured schedule obligation, including
2021
+ * ones promoted earlier and never drafted. The drafts post when the period
2022
+ * closes. Safe to repeat.
2023
+ */
2024
+ async promoteObligations(
2025
+ graphId: string,
2026
+ body: PromoteObligationsRequest = {}
2027
+ ): Promise<PromoteObligationsResponse> {
2028
+ const envelope = await this.callOperation(
2029
+ 'Promote obligations',
2030
+ promoteObligations({ path: { graph_id: graphId }, body })
2031
+ )
2032
+ return this.requireResult('Promote obligations', envelope.result)
2033
+ }
2034
+
2035
+ /** Compare the ledger with something outside it. Records nothing. */
2036
+ async previewReconciliations(
2037
+ graphId: string,
2038
+ period: string,
2039
+ options?: PreviewReconciliationsOptions
2040
+ ): Promise<LedgerReconciliationPreview> {
2041
+ const body: PreviewReconciliationsRequest = {
2042
+ period,
2043
+ method: options?.method,
2044
+ include_tied: options?.includeTied,
2045
+ }
2046
+ const envelope = await this.callOperation(
2047
+ 'Preview reconciliations',
2048
+ previewReconciliations({ path: { graph_id: graphId }, body })
2049
+ )
2050
+ return reconciliationPreviewToCamel(envelope.result as unknown as ReconciliationPreviewResponse)
2051
+ }
2052
+
2053
+ /**
2054
+ * Run every reconciliation that applies at a period end and record each
2055
+ * result on its block. `notes` names any check that could not run.
2056
+ */
2057
+ async refreshReconciliations(graphId: string, period: string): Promise<LedgerReconciliationList> {
2058
+ const body: RefreshReconciliationsRequest = { period }
2059
+ const envelope = await this.callOperation(
2060
+ 'Refresh reconciliations',
2061
+ refreshReconciliations({ path: { graph_id: graphId }, body })
2062
+ )
2063
+ return reconciliationListToCamel(envelope.result as unknown as ReconciliationListResponse)
2064
+ }
2065
+
2066
+ /**
2067
+ * Record a statement's ending balance for an account and reconcile the
2068
+ * account to it for the period the statement ends in. Writes no books.
2069
+ */
2070
+ async recordStatementBalance(
2071
+ graphId: string,
2072
+ input: RecordStatementBalanceInput
2073
+ ): Promise<LedgerReconciliation> {
2074
+ const body: RecordStatementBalanceRequest = {
2075
+ element_id: input.elementId,
2076
+ as_of: input.asOf,
2077
+ balance: input.balance,
2078
+ document_id: input.documentId ?? null,
2079
+ note: input.note ?? null,
2080
+ }
2081
+ const envelope = await this.callOperation(
2082
+ 'Record statement balance',
2083
+ recordStatementBalance({ path: { graph_id: graphId }, body })
2084
+ )
2085
+ return reconciliationSummaryToCamel(envelope.result as unknown as ReconciliationSummary)
2086
+ }
2087
+
2088
+ /** Change how much the close cares about one reconciliation. */
2089
+ async setReconciliationPolicy(
2090
+ graphId: string,
2091
+ structureId: string,
2092
+ changes: ReconciliationPolicyChanges
2093
+ ): Promise<LedgerReconciliationPolicy> {
2094
+ const body: SetReconciliationPolicyRequest = {
2095
+ structure_id: structureId,
2096
+ required_for_close: changes.requiredForClose,
2097
+ materiality: changes.materiality,
2098
+ review_required: changes.reviewRequired,
2099
+ separate_reviewer: changes.separateReviewer,
2100
+ }
2101
+ const envelope = await this.callOperation(
2102
+ 'Set reconciliation policy',
2103
+ setReconciliationPolicy({ path: { graph_id: graphId }, body })
2104
+ )
2105
+ const raw = envelope.result as unknown as ReconciliationPolicyResponse
2106
+ return {
2107
+ structureId: raw.structure_id,
2108
+ requiredForClose: raw.required_for_close,
2109
+ materiality: raw.materiality,
2110
+ reviewRequired: raw.review_required,
2111
+ separateReviewer: raw.separate_reviewer,
2112
+ }
2113
+ }
2114
+
2115
+ /**
2116
+ * Sign off a reconciled period as its reviewer. Only a member of the graph
2117
+ * can; a later change to any balance lapses the sign-off.
2118
+ */
2119
+ async signOffReconciliation(
2120
+ graphId: string,
2121
+ structureId: string,
2122
+ period: string,
2123
+ note?: string | null
2124
+ ): Promise<LedgerReconciliation> {
2125
+ const body: SignOffReconciliationRequest = {
2126
+ structure_id: structureId,
2127
+ period,
2128
+ note: note ?? null,
2129
+ }
2130
+ const envelope = await this.callOperation(
2131
+ 'Sign off reconciliation',
2132
+ signOffReconciliation({ path: { graph_id: graphId }, body })
2133
+ )
2134
+ return reconciliationSummaryToCamel(envelope.result as unknown as ReconciliationSummary)
2135
+ }
2136
+
1834
2137
  // ── Journal entries (native accounting writes) ──────────────────────
1835
2138
 
1836
2139
  /**
@@ -2270,8 +2573,8 @@ export class LedgerClient {
2270
2573
  * A download is a read, so this resolves through GraphQL
2271
2574
  * (`reportDownloadUrl`) — the retired `GET .../reports/{id}/download`
2272
2575
  * REST resource is gone. Every flavor resolves to a presigned S3 URL:
2273
- * JSON-LD is stamped at publish time; XBRL is materialized + cached
2274
- * on first request. The returned `downloadUrl` is valid for
2576
+ * the Tavi model is stamped at publish time; the holon and XBRL are
2577
+ * materialized + cached on first request. The returned `downloadUrl` is valid for
2275
2578
  * `expiresIn` seconds (default 300, max 3600); browser callers
2276
2579
  * navigate to it via `window.location.href` (or an `<a href>` click)
2277
2580
  * to trigger the download — the server-set Content-Disposition forces
@@ -2283,8 +2586,9 @@ export class LedgerClient {
2283
2586
  *
2284
2587
  * @param graphId Graph identifier owning the Report.
2285
2588
  * @param reportId Report identifier (rpt_-prefixed ULID).
2286
- * @param options.format Serialization flavor — `TAVI` (default, the Project
2287
- * Tavi compiled model stamped at publish), `HOLON_JSONLD`, or `XBRL_2_1`.
2589
+ * @param options.format Serialization flavor — `HOLON_JSONLD` (default, the
2590
+ * holon, which carries the whole report), `TAVI` (the Project Tavi
2591
+ * compiled model stamped at publish), or `XBRL_2_1`.
2288
2592
  * @param options.expiresIn Presigned URL lifetime, in seconds.
2289
2593
  */
2290
2594
  async getReportDownloadUrl(
@@ -2297,7 +2601,7 @@ export class LedgerClient {
2297
2601
  GetLedgerReportDownloadUrlDocument,
2298
2602
  {
2299
2603
  reportId,
2300
- format: options.format ?? 'TAVI',
2604
+ format: options.format ?? 'HOLON_JSONLD',
2301
2605
  expiresIn: options.expiresIn ?? 300,
2302
2606
  },
2303
2607
  'Get report download URL',
@@ -2701,6 +3005,12 @@ function rawFiscalCalendarToCamel(raw: RawFiscalCalendar): LedgerFiscalCalendar
2701
3005
  rawObligationDetailToCamel
2702
3006
  ),
2703
3007
  syncStaleDays: raw.sync_stale_days ?? null,
3008
+ reconcilingItemCount: raw.reconciling_item_count ?? 0,
3009
+ reconcilingItemSample: raw.reconciling_item_sample ?? [],
3010
+ unpostedSourceEventCount: raw.unposted_source_event_count ?? 0,
3011
+ unpostedSourceEventSample: raw.unposted_source_event_sample ?? [],
3012
+ unreconciledAccountCount: raw.unreconciled_account_count ?? 0,
3013
+ unreconciledAccountSample: raw.unreconciled_account_sample ?? [],
2704
3014
  lastCloseAt: raw.last_close_at ?? null,
2705
3015
  initializedAt: raw.initialized_at ?? null,
2706
3016
  lastSyncAt: raw.last_sync_at ?? null,
@@ -2714,6 +3024,101 @@ function rawFiscalCalendarToCamel(raw: RawFiscalCalendar): LedgerFiscalCalendar
2714
3024
  }
2715
3025
  }
2716
3026
 
3027
+ function reconciliationComponentToCamel(
3028
+ raw: ReconciliationComponent
3029
+ ): LedgerReconciliationComponent {
3030
+ return {
3031
+ name: raw.name,
3032
+ amount: raw.amount,
3033
+ structureId: raw.structure_id ?? null,
3034
+ eventId: raw.event_id ?? null,
3035
+ documentId: raw.document_id ?? null,
3036
+ note: raw.note ?? null,
3037
+ }
3038
+ }
3039
+
3040
+ function reconciliationRowToCamel(raw: ReconciliationRow): LedgerReconciliationRow {
3041
+ return {
3042
+ elementId: raw.element_id ?? null,
3043
+ accountCode: raw.account_code ?? null,
3044
+ accountName: raw.account_name,
3045
+ sourceAccountId: raw.source_account_id ?? null,
3046
+ statement: raw.statement ?? null,
3047
+ ledgerBalance: raw.ledger_balance,
3048
+ independentBalance: raw.independent_balance,
3049
+ difference: raw.difference,
3050
+ status: raw.status,
3051
+ asOf: raw.as_of ?? null,
3052
+ components: (raw.components ?? []).map(reconciliationComponentToCamel),
3053
+ }
3054
+ }
3055
+
3056
+ /**
3057
+ * Map the REST `ReconciliationSummary` (snake_case) onto the GraphQL shape
3058
+ * `listReconciliations` returns, so a read and a write give the same object.
3059
+ */
3060
+ function reconciliationSummaryToCamel(raw: ReconciliationSummary): LedgerReconciliation {
3061
+ return {
3062
+ structureId: raw.structure_id,
3063
+ name: raw.name,
3064
+ scope: raw.scope,
3065
+ method: raw.method,
3066
+ elementId: raw.element_id ?? null,
3067
+ requiredForClose: raw.required_for_close,
3068
+ materiality: raw.materiality,
3069
+ period: raw.period,
3070
+ asOf: raw.as_of,
3071
+ status: raw.status,
3072
+ unreconciledDifference: raw.unreconciled_difference ?? null,
3073
+ accountsCompared: raw.accounts_compared ?? null,
3074
+ accountsDifferent: raw.accounts_different ?? null,
3075
+ ledgerBalance: raw.ledger_balance ?? null,
3076
+ independentBalance: raw.independent_balance ?? null,
3077
+ balanceAsOf: raw.balance_as_of ?? null,
3078
+ components: (raw.components ?? []).map(reconciliationComponentToCamel),
3079
+ source: raw.source ?? null,
3080
+ comparedAt: raw.compared_at ?? null,
3081
+ factSetId: raw.fact_set_id ?? null,
3082
+ comparedBy: raw.compared_by ?? null,
3083
+ comparedVia: raw.compared_via ?? null,
3084
+ reviewRequired: raw.review_required,
3085
+ separateReviewer: raw.separate_reviewer,
3086
+ reviewedBy: raw.reviewed_by ?? null,
3087
+ reviewedAt: raw.reviewed_at ?? null,
3088
+ selfReviewed: raw.self_reviewed ?? null,
3089
+ differences: (raw.differences ?? []).map(reconciliationRowToCamel),
3090
+ }
3091
+ }
3092
+
3093
+ function reconciliationListToCamel(raw: ReconciliationListResponse): LedgerReconciliationList {
3094
+ return {
3095
+ period: raw.period,
3096
+ asOf: raw.as_of,
3097
+ notes: raw.notes ?? [],
3098
+ reconciliations: (raw.reconciliations ?? []).map(reconciliationSummaryToCamel),
3099
+ }
3100
+ }
3101
+
3102
+ function reconciliationPreviewToCamel(
3103
+ raw: ReconciliationPreviewResponse
3104
+ ): LedgerReconciliationPreview {
3105
+ return {
3106
+ period: raw.period,
3107
+ asOf: raw.as_of,
3108
+ fiscalYearStart: raw.fiscal_year_start,
3109
+ method: raw.method,
3110
+ source: raw.source,
3111
+ reportBasis: raw.report_basis ?? null,
3112
+ lastSyncAt: raw.last_sync_at ?? null,
3113
+ accountsCompared: raw.accounts_compared,
3114
+ accountsTied: raw.accounts_tied,
3115
+ accountsDifferent: raw.accounts_different,
3116
+ totalDifference: raw.total_difference,
3117
+ rows: (raw.rows ?? []).map(reconciliationRowToCamel),
3118
+ notes: raw.notes ?? [],
3119
+ }
3120
+ }
3121
+
2717
3122
  /**
2718
3123
  * Map the REST `LedgerEntityResponse` (snake_case) onto the GraphQL
2719
3124
  * `LedgerEntity` (camelCase) that `getEntity` returns, so callers can treat the
@@ -579,6 +579,7 @@ export type ListLedgerEventBlocksQueryVariables = Exact<{
579
579
  status: string | null | undefined;
580
580
  agentId: string | null | undefined;
581
581
  source: string | null | undefined;
582
+ isReconcilingItem: boolean | null | undefined;
582
583
  limit?: number;
583
584
  offset?: number;
584
585
  }>;
@@ -627,6 +628,12 @@ export type GetLedgerFiscalCalendarQuery = {
627
628
  earliestPendingPeriod: string | null;
628
629
  strandedObligationCount: number;
629
630
  syncStaleDays: number | null;
631
+ reconcilingItemCount: number;
632
+ reconcilingItemSample: Array<string>;
633
+ unpostedSourceEventCount: number;
634
+ unpostedSourceEventSample: Array<string>;
635
+ unreconciledAccountCount: number;
636
+ unreconciledAccountSample: Array<string>;
630
637
  lastCloseAt: string | null;
631
638
  initializedAt: string | null;
632
639
  lastSyncAt: string | null;
@@ -1368,6 +1375,72 @@ export type ListLedgerPublishListsQuery = {
1368
1375
  };
1369
1376
  } | null;
1370
1377
  };
1378
+ export type ListLedgerReconciliationsQueryVariables = Exact<{
1379
+ period: string;
1380
+ }>;
1381
+ export type ListLedgerReconciliationsQuery = {
1382
+ reconciliations: {
1383
+ period: string;
1384
+ asOf: string;
1385
+ notes: Array<string>;
1386
+ reconciliations: Array<{
1387
+ structureId: string;
1388
+ name: string;
1389
+ scope: string;
1390
+ method: string;
1391
+ elementId: string | null;
1392
+ requiredForClose: boolean;
1393
+ materiality: number;
1394
+ period: string;
1395
+ asOf: string;
1396
+ status: string;
1397
+ unreconciledDifference: number | null;
1398
+ accountsCompared: number | null;
1399
+ accountsDifferent: number | null;
1400
+ ledgerBalance: number | null;
1401
+ independentBalance: number | null;
1402
+ balanceAsOf: string | null;
1403
+ source: string | null;
1404
+ comparedAt: string | null;
1405
+ factSetId: string | null;
1406
+ comparedBy: string | null;
1407
+ comparedVia: string | null;
1408
+ reviewRequired: boolean;
1409
+ separateReviewer: boolean;
1410
+ reviewedBy: string | null;
1411
+ reviewedAt: string | null;
1412
+ selfReviewed: boolean | null;
1413
+ components: Array<{
1414
+ name: string;
1415
+ amount: number;
1416
+ structureId: string | null;
1417
+ eventId: string | null;
1418
+ documentId: string | null;
1419
+ note: string | null;
1420
+ }>;
1421
+ differences: Array<{
1422
+ elementId: string | null;
1423
+ accountCode: string | null;
1424
+ accountName: string;
1425
+ sourceAccountId: string | null;
1426
+ statement: string | null;
1427
+ ledgerBalance: number;
1428
+ independentBalance: number;
1429
+ difference: number;
1430
+ status: string;
1431
+ asOf: string | null;
1432
+ components: Array<{
1433
+ name: string;
1434
+ amount: number;
1435
+ structureId: string | null;
1436
+ eventId: string | null;
1437
+ documentId: string | null;
1438
+ note: string | null;
1439
+ }>;
1440
+ }>;
1441
+ }>;
1442
+ } | null;
1443
+ };
1371
1444
  export type GetLedgerReportQueryVariables = Exact<{
1372
1445
  reportId: string;
1373
1446
  }>;
@@ -2138,6 +2211,7 @@ export declare const GetLedgerPeriodCloseStatusDocument: DocumentNode<GetLedgerP
2138
2211
  export declare const GetLedgerPeriodDraftsDocument: DocumentNode<GetLedgerPeriodDraftsQuery, GetLedgerPeriodDraftsQueryVariables>;
2139
2212
  export declare const GetLedgerPublishListDocument: DocumentNode<GetLedgerPublishListQuery, GetLedgerPublishListQueryVariables>;
2140
2213
  export declare const ListLedgerPublishListsDocument: DocumentNode<ListLedgerPublishListsQuery, ListLedgerPublishListsQueryVariables>;
2214
+ export declare const ListLedgerReconciliationsDocument: DocumentNode<ListLedgerReconciliationsQuery, ListLedgerReconciliationsQueryVariables>;
2141
2215
  export declare const GetLedgerReportDocument: DocumentNode<GetLedgerReportQuery, GetLedgerReportQueryVariables>;
2142
2216
  export declare const GetLedgerReportDownloadUrlDocument: DocumentNode<GetLedgerReportDownloadUrlQuery, GetLedgerReportDownloadUrlQueryVariables>;
2143
2217
  export declare const GetLedgerReportPackageDocument: DocumentNode<GetLedgerReportPackageQuery, GetLedgerReportPackageQueryVariables>;