@robosystems/client 2.11.0 → 2.11.1

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.
@@ -218,6 +218,15 @@ export interface InitializeChartOfAccountsResult {
218
218
  export interface EntityScopeOptions {
219
219
  entityId?: string | null;
220
220
  }
221
+ export interface ChangeCalendarStartOptions extends EntityScopeOptions {
222
+ note?: string | null;
223
+ }
224
+ /** The calendar after its start moved, and how many months that opened or removed. */
225
+ export interface ChangeCalendarStartResult {
226
+ fiscalCalendar: LedgerFiscalCalendar;
227
+ periodsCreated: number;
228
+ periodsRemoved: number;
229
+ }
221
230
  export interface ClosePeriodOptions extends EntityScopeOptions {
222
231
  note?: string | null;
223
232
  allowStaleSync?: boolean;
@@ -250,7 +259,7 @@ export interface ClosePeriodOptions extends EntityScopeOptions {
250
259
  }
251
260
  /** Which reconciliation check to run. */
252
261
  export type ReconciliationMethod = NonNullable<PreviewReconciliationsRequest['method']>;
253
- export interface PreviewReconciliationsOptions {
262
+ export interface PreviewReconciliationsOptions extends EntityScopeOptions {
254
263
  /** Defaults to `source_ledger`, which needs a connected QuickBooks ledger. */
255
264
  method?: ReconciliationMethod;
256
265
  /** Also return the accounts that tie. */
@@ -277,6 +286,8 @@ export interface LedgerReconciliationPreview {
277
286
  export interface RecordStatementBalanceInput {
278
287
  /** The balance-sheet account the statement is for. */
279
288
  elementId: string;
289
+ /** The subsidiary whose account it is; omitted, the group parent. */
290
+ entityId?: string | null;
280
291
  /** The statement's ending date, as YYYY-MM-DD. */
281
292
  asOf: string;
282
293
  /**
@@ -786,6 +797,12 @@ export declare class LedgerClient {
786
797
  initializeChartOfAccounts(graphId: string, template: ChartTemplateKey, options?: InitializeChartOfAccountsOptions): Promise<InitializeChartOfAccountsResult>;
787
798
  /** Set the user-controlled close target (YYYY-MM). */
788
799
  setCloseTarget(graphId: string, period: string, note?: string | null, options?: EntityScopeOptions): Promise<LedgerFiscalCalendar>;
800
+ /**
801
+ * Move the calendar's first open month (YYYY-MM), allowed only until the
802
+ * entity's first close. Earlier opens months back to it; later removes the
803
+ * leading months, refused while they hold any entry.
804
+ */
805
+ changeCalendarStart(graphId: string, firstOpenPeriod: string, options?: ChangeCalendarStartOptions): Promise<ChangeCalendarStartResult>;
789
806
  /**
790
807
  * Close a fiscal period — the final commit action — on the group parent,
791
808
  * or on the entity `entityId` names. Each entity closes on its own.
@@ -825,7 +842,7 @@ export declare class LedgerClient {
825
842
  * Run every reconciliation that applies at a period end and record each
826
843
  * result on its block. `notes` names any check that could not run.
827
844
  */
828
- refreshReconciliations(graphId: string, period: string): Promise<LedgerReconciliationList>;
845
+ refreshReconciliations(graphId: string, period: string, options?: EntityScopeOptions): Promise<LedgerReconciliationList>;
829
846
  /**
830
847
  * Record a statement's ending balance for an account and reconcile the
831
848
  * account to it for the period the statement ends in. Writes no books.
@@ -706,6 +706,25 @@ class LedgerClient {
706
706
  const envelope = await this.callOperation('Set close target', (o) => (0, sdk_gen_1.setCloseTarget)({ ...o, path: { graph_id: graphId }, body }));
707
707
  return rawFiscalCalendarToCamel(envelope.result);
708
708
  }
709
+ /**
710
+ * Move the calendar's first open month (YYYY-MM), allowed only until the
711
+ * entity's first close. Earlier opens months back to it; later removes the
712
+ * leading months, refused while they hold any entry.
713
+ */
714
+ async changeCalendarStart(graphId, firstOpenPeriod, options) {
715
+ const body = {
716
+ first_open_period: firstOpenPeriod,
717
+ entity_id: options?.entityId ?? null,
718
+ note: options?.note ?? null,
719
+ };
720
+ const envelope = await this.callOperation('Change calendar start', (o) => (0, sdk_gen_1.changeCalendarStart)({ ...o, path: { graph_id: graphId }, body }));
721
+ const raw = envelope.result;
722
+ return {
723
+ fiscalCalendar: rawFiscalCalendarToCamel(raw.fiscal_calendar),
724
+ periodsCreated: raw.periods_created ?? 0,
725
+ periodsRemoved: raw.periods_removed ?? 0,
726
+ };
727
+ }
709
728
  /**
710
729
  * Close a fiscal period — the final commit action — on the group parent,
711
730
  * or on the entity `entityId` names. Each entity closes on its own.
@@ -789,6 +808,7 @@ class LedgerClient {
789
808
  period,
790
809
  method: options?.method,
791
810
  include_tied: options?.includeTied,
811
+ entity_id: options?.entityId ?? null,
792
812
  };
793
813
  const envelope = await this.callOperation('Preview reconciliations', (o) => (0, sdk_gen_1.previewReconciliations)({ ...o, path: { graph_id: graphId }, body }));
794
814
  return reconciliationPreviewToCamel(envelope.result);
@@ -797,8 +817,8 @@ class LedgerClient {
797
817
  * Run every reconciliation that applies at a period end and record each
798
818
  * result on its block. `notes` names any check that could not run.
799
819
  */
800
- async refreshReconciliations(graphId, period) {
801
- const body = { period };
820
+ async refreshReconciliations(graphId, period, options) {
821
+ const body = { period, entity_id: options?.entityId ?? null };
802
822
  const envelope = await this.callOperation('Refresh reconciliations', (o) => (0, sdk_gen_1.refreshReconciliations)({ ...o, path: { graph_id: graphId }, body }));
803
823
  return reconciliationListToCamel(envelope.result);
804
824
  }
@@ -809,6 +829,7 @@ class LedgerClient {
809
829
  async recordStatementBalance(graphId, input) {
810
830
  const body = {
811
831
  element_id: input.elementId,
832
+ entity_id: input.entityId ?? null,
812
833
  as_of: input.asOf,
813
834
  balance: input.balance,
814
835
  document_id: input.documentId ?? null,
@@ -33,6 +33,7 @@ import {
33
33
  bindTextBlock,
34
34
  blockSourceGraph,
35
35
  buildFactGrid,
36
+ changeCalendarStart,
36
37
  closePeriod,
37
38
  computeMetrics,
38
39
  createAgent,
@@ -93,6 +94,7 @@ import type {
93
94
  BindTextBlockResponse,
94
95
  BlockedSourceGraphResponse,
95
96
  BlockSourceGraphResult,
97
+ ChangeCalendarStartRequest,
96
98
  ClosePeriodOperation,
97
99
  ComputeMetricsRequest,
98
100
  ComputeMetricsResponse,
@@ -628,6 +630,17 @@ export interface EntityScopeOptions {
628
630
  entityId?: string | null
629
631
  }
630
632
 
633
+ export interface ChangeCalendarStartOptions extends EntityScopeOptions {
634
+ note?: string | null
635
+ }
636
+
637
+ /** The calendar after its start moved, and how many months that opened or removed. */
638
+ export interface ChangeCalendarStartResult {
639
+ fiscalCalendar: LedgerFiscalCalendar
640
+ periodsCreated: number
641
+ periodsRemoved: number
642
+ }
643
+
631
644
  export interface ClosePeriodOptions extends EntityScopeOptions {
632
645
  note?: string | null
633
646
  allowStaleSync?: boolean
@@ -662,7 +675,7 @@ export interface ClosePeriodOptions extends EntityScopeOptions {
662
675
  /** Which reconciliation check to run. */
663
676
  export type ReconciliationMethod = NonNullable<PreviewReconciliationsRequest['method']>
664
677
 
665
- export interface PreviewReconciliationsOptions {
678
+ export interface PreviewReconciliationsOptions extends EntityScopeOptions {
666
679
  /** Defaults to `source_ledger`, which needs a connected QuickBooks ledger. */
667
680
  method?: ReconciliationMethod
668
681
  /** Also return the accounts that tie. */
@@ -691,6 +704,8 @@ export interface LedgerReconciliationPreview {
691
704
  export interface RecordStatementBalanceInput {
692
705
  /** The balance-sheet account the statement is for. */
693
706
  elementId: string
707
+ /** The subsidiary whose account it is; omitted, the group parent. */
708
+ entityId?: string | null
694
709
  /** The statement's ending date, as YYYY-MM-DD. */
695
710
  asOf: string
696
711
  /**
@@ -2052,6 +2067,36 @@ export class LedgerClient {
2052
2067
  return rawFiscalCalendarToCamel(envelope.result as unknown as RawFiscalCalendar)
2053
2068
  }
2054
2069
 
2070
+ /**
2071
+ * Move the calendar's first open month (YYYY-MM), allowed only until the
2072
+ * entity's first close. Earlier opens months back to it; later removes the
2073
+ * leading months, refused while they hold any entry.
2074
+ */
2075
+ async changeCalendarStart(
2076
+ graphId: string,
2077
+ firstOpenPeriod: string,
2078
+ options?: ChangeCalendarStartOptions
2079
+ ): Promise<ChangeCalendarStartResult> {
2080
+ const body: ChangeCalendarStartRequest = {
2081
+ first_open_period: firstOpenPeriod,
2082
+ entity_id: options?.entityId ?? null,
2083
+ note: options?.note ?? null,
2084
+ }
2085
+ const envelope = await this.callOperation('Change calendar start', (o) =>
2086
+ changeCalendarStart({ ...o, path: { graph_id: graphId }, body })
2087
+ )
2088
+ const raw = envelope.result as unknown as {
2089
+ fiscal_calendar: RawFiscalCalendar
2090
+ periods_created?: number
2091
+ periods_removed?: number
2092
+ }
2093
+ return {
2094
+ fiscalCalendar: rawFiscalCalendarToCamel(raw.fiscal_calendar),
2095
+ periodsCreated: raw.periods_created ?? 0,
2096
+ periodsRemoved: raw.periods_removed ?? 0,
2097
+ }
2098
+ }
2099
+
2055
2100
  /**
2056
2101
  * Close a fiscal period — the final commit action — on the group parent,
2057
2102
  * or on the entity `entityId` names. Each entity closes on its own.
@@ -2182,6 +2227,7 @@ export class LedgerClient {
2182
2227
  period,
2183
2228
  method: options?.method,
2184
2229
  include_tied: options?.includeTied,
2230
+ entity_id: options?.entityId ?? null,
2185
2231
  }
2186
2232
  const envelope = await this.callOperation('Preview reconciliations', (o) =>
2187
2233
  previewReconciliations({ ...o, path: { graph_id: graphId }, body })
@@ -2193,8 +2239,12 @@ export class LedgerClient {
2193
2239
  * Run every reconciliation that applies at a period end and record each
2194
2240
  * result on its block. `notes` names any check that could not run.
2195
2241
  */
2196
- async refreshReconciliations(graphId: string, period: string): Promise<LedgerReconciliationList> {
2197
- const body: RefreshReconciliationsRequest = { period }
2242
+ async refreshReconciliations(
2243
+ graphId: string,
2244
+ period: string,
2245
+ options?: EntityScopeOptions
2246
+ ): Promise<LedgerReconciliationList> {
2247
+ const body: RefreshReconciliationsRequest = { period, entity_id: options?.entityId ?? null }
2198
2248
  const envelope = await this.callOperation('Refresh reconciliations', (o) =>
2199
2249
  refreshReconciliations({ ...o, path: { graph_id: graphId }, body })
2200
2250
  )
@@ -2211,6 +2261,7 @@ export class LedgerClient {
2211
2261
  ): Promise<LedgerReconciliation> {
2212
2262
  const body: RecordStatementBalanceRequest = {
2213
2263
  element_id: input.elementId,
2264
+ entity_id: input.entityId ?? null,
2214
2265
  as_of: input.asOf,
2215
2266
  balance: input.balance,
2216
2267
  document_id: input.documentId ?? null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robosystems/client",
3
- "version": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "description": "TypeScript client library for the RoboSystems financial intelligence platform",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",