@nominalso/vibe-bridge 0.0.1 → 0.1.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/dist/index.cjs CHANGED
@@ -26,7 +26,7 @@ __export(index_exports, {
26
26
  module.exports = __toCommonJS(index_exports);
27
27
 
28
28
  // package.json
29
- var version = "0.0.1";
29
+ var version = "0.1.0";
30
30
 
31
31
  // ../protocol-types/dist/index.js
32
32
  var PROTOCOL_ID = "nominal-vibe-bridge";
@@ -89,16 +89,28 @@ var VibeAppBridge = class {
89
89
  handler(msg.payload);
90
90
  }
91
91
  /**
92
- * Connects to the host and returns the tenant/user context.
93
- * Call once on app init concurrent calls return the same promise.
92
+ * Connects to the host and returns the tenant/user {@link ContextPayload}.
93
+ * **Call this once on app init and await it before any other method** — data
94
+ * methods, `upload()`, and subroute reporting all require an established
95
+ * connection. Concurrent calls return the same promise.
94
96
  *
95
97
  * Actively polls the host every 500ms until a response arrives, which
96
98
  * handles the race condition where the host's initial context push arrives
97
- * before this listener is ready.
99
+ * before this listener is ready. Rejects with `Bridge connect timed out`
100
+ * after 10 seconds if no context arrives (usually a `parentOrigin` mismatch
101
+ * or the host hasn't mounted).
98
102
  *
99
103
  * After connecting, if the context includes an initial subroute (e.g. from
100
104
  * a deep link), the bridge navigates to it and starts auto-tracking
101
105
  * internal navigation via the history API.
106
+ *
107
+ * @returns The tenant/user/subsidiary context for this app session.
108
+ * @throws If no context is received within 10 seconds.
109
+ * @example
110
+ * ```ts
111
+ * const ctx = await bridge.connect()
112
+ * // ctx.tenant, ctx.subsidiaryId, ctx.subsidiaries, ctx.user, ctx.lastClosedPeriodSlug
113
+ * ```
102
114
  */
103
115
  connect() {
104
116
  if (this.context) return Promise.resolve(this.context);
@@ -146,27 +158,278 @@ var VibeAppBridge = class {
146
158
  });
147
159
  return this.connectPromise;
148
160
  }
161
+ // ---------------------------------------------------------------------------
162
+ // Operations — Accounting: chart of accounts
163
+ //
164
+ // Each method is a typed wrapper over `request('<OP>', payload)`. The payload
165
+ // and return types come straight from the Nominal API (`RequestRegistry`).
166
+ // For any operation without a named method, call `request('<OP>', payload)`.
167
+ // ---------------------------------------------------------------------------
168
+ /**
169
+ * Fetch the flat chart of accounts for a subsidiary.
170
+ *
171
+ * @example
172
+ * ```ts
173
+ * const ctx = await bridge.connect()
174
+ * const accounts = await bridge.getChartOfAccounts({
175
+ * path: { subsidiary_id: ctx.subsidiaryId },
176
+ * })
177
+ * ```
178
+ */
149
179
  getChartOfAccounts(payload) {
150
180
  return this.request("GET_CHART_OF_ACCOUNTS", payload);
151
181
  }
152
- getSubsidiaries(payload) {
153
- return this.request("GET_SUBSIDIARIES", payload);
182
+ /** Fetch the chart of accounts as a hierarchical tree for a subsidiary. */
183
+ getCoaTree(payload) {
184
+ return this.request("GET_COA_TREE", payload);
154
185
  }
155
- getPeriods(payload) {
156
- return this.request("GET_PERIODS", payload);
186
+ /** Fetch a simplified flat chart of accounts for a subsidiary. */
187
+ getCoaFlatSimple(payload) {
188
+ return this.request("GET_COA_FLAT_SIMPLE", payload);
157
189
  }
158
- postTaskOutput(payload) {
159
- return this.request("POST_TASK_OUTPUT", payload);
190
+ /** Fetch the flat chart of accounts grouped by account group. */
191
+ getCoaGrouped(payload) {
192
+ return this.request("GET_COA_GROUPED", payload);
193
+ }
194
+ /** Fetch a single chart-of-accounts account by id within a subsidiary. */
195
+ getCoaAccount(payload) {
196
+ return this.request("GET_COA_ACCOUNT", payload);
197
+ }
198
+ /** List the currencies available to a subsidiary's chart of accounts. */
199
+ getSubsidiaryAvailableCurrencies(payload) {
200
+ return this.request("GET_SUBSIDIARY_AVAILABLE_CURRENCIES", payload);
201
+ }
202
+ /** Fetch accounts at the tenant level. */
203
+ getAccounts(payload) {
204
+ return this.request("GET_ACCOUNTS", payload);
205
+ }
206
+ /** Fetch a single account by id. */
207
+ getAccount(payload) {
208
+ return this.request("GET_ACCOUNT", payload);
209
+ }
210
+ // ---------------------------------------------------------------------------
211
+ // Operations — Accounting: exchange rates
212
+ // ---------------------------------------------------------------------------
213
+ /** Fetch currency conversion rates for a currency. */
214
+ getConversionRates(payload) {
215
+ return this.request("GET_CONVERSION_RATES", payload);
216
+ }
217
+ /** Fetch the effective consolidation exchange rate. */
218
+ getEffectiveExchangeRate(payload) {
219
+ return this.request("GET_EFFECTIVE_EXCHANGE_RATE", payload);
220
+ }
221
+ /** Fetch the exchange-rate period covering a given input date. */
222
+ getExchangeRateByDate(payload) {
223
+ return this.request("GET_EXCHANGE_RATE_BY_DATE", payload);
160
224
  }
225
+ // ---------------------------------------------------------------------------
226
+ // Operations — Accounting: dimensions
227
+ // ---------------------------------------------------------------------------
228
+ /** List accounting dimensions. */
229
+ getDimensions(payload) {
230
+ return this.request("GET_DIMENSIONS", payload);
231
+ }
232
+ /** List values for accounting dimensions. */
233
+ getDimensionValues(payload) {
234
+ return this.request("GET_DIMENSION_VALUES", payload);
235
+ }
236
+ /** List dimension values in hierarchical form. */
237
+ getDimensionValuesHierarchical(payload) {
238
+ return this.request("GET_DIMENSION_VALUES_HIERARCHICAL", payload);
239
+ }
240
+ /** List account assignments for a dimension/account pair. */
241
+ getDimensionAccountAssignments(payload) {
242
+ return this.request("GET_DIMENSION_ACCOUNT_ASSIGNMENTS", payload);
243
+ }
244
+ // ---------------------------------------------------------------------------
245
+ // Operations — Accounting: journal entries
246
+ // ---------------------------------------------------------------------------
247
+ /**
248
+ * Fetch journal entries for a subsidiary, optionally filtered by date range.
249
+ *
250
+ * @example
251
+ * ```ts
252
+ * const entries = await bridge.getJournalEntries({
253
+ * path: { subsidiary_id: ctx.subsidiaryId },
254
+ * query: { from_date: '2026-01-01', to_date: '2026-03-31' },
255
+ * })
256
+ * ```
257
+ */
161
258
  getJournalEntries(payload) {
162
259
  return this.request("GET_JOURNAL_ENTRIES", payload);
163
260
  }
261
+ /** Fetch journal entry lines for a subsidiary. */
164
262
  getJournalLines(payload) {
165
263
  return this.request("GET_JOURNAL_LINES", payload);
166
264
  }
265
+ /** Fetch a single journal entry by id within a subsidiary. */
266
+ getJournalEntry(payload) {
267
+ return this.request("GET_JOURNAL_ENTRY", payload);
268
+ }
269
+ // ---------------------------------------------------------------------------
270
+ // Operations — Activity: period instances
271
+ // ---------------------------------------------------------------------------
272
+ /** List accounting period instances. */
273
+ getPeriods(payload) {
274
+ return this.request("GET_PERIODS", payload);
275
+ }
276
+ /** Fetch a single period instance by id. */
277
+ getPeriodInstance(payload) {
278
+ return this.request("GET_PERIOD_INSTANCE", payload);
279
+ }
280
+ /** Fetch a period instance by its display slug (e.g. `"mar-2026"`). */
281
+ getPeriodInstanceBySlug(payload) {
282
+ return this.request("GET_PERIOD_INSTANCE_BY_SLUG", payload);
283
+ }
284
+ /** Fetch the close-progress breakdown for a period (by slug). */
285
+ getPeriodProgressBreakdown(payload) {
286
+ return this.request("GET_PERIOD_PROGRESS_BREAKDOWN", payload);
287
+ }
288
+ // ---------------------------------------------------------------------------
289
+ // Operations — Activity: activity definitions
290
+ // ---------------------------------------------------------------------------
291
+ /** List activity definitions. */
292
+ getActivityDefinitions(payload) {
293
+ return this.request("GET_ACTIVITY_DEFINITIONS", payload);
294
+ }
295
+ /** Fetch a single activity definition by id. */
296
+ getActivityDefinition(payload) {
297
+ return this.request("GET_ACTIVITY_DEFINITION", payload);
298
+ }
299
+ // ---------------------------------------------------------------------------
300
+ // Operations — Activity: activity instances
301
+ // ---------------------------------------------------------------------------
302
+ /** List activity instances. */
303
+ getActivityInstances(payload) {
304
+ return this.request("GET_ACTIVITY_INSTANCES", payload);
305
+ }
306
+ /** Fetch a single activity instance by id. */
307
+ getActivityInstance(payload) {
308
+ return this.request("GET_ACTIVITY_INSTANCE", payload);
309
+ }
310
+ /** Fetch an activity instance for a given period + activity definition. */
311
+ getActivityInstanceByPeriod(payload) {
312
+ return this.request("GET_ACTIVITY_INSTANCE_BY_PERIOD", payload);
313
+ }
314
+ /** List task instances for an activity instance. */
315
+ getActivityInstanceTasks(payload) {
316
+ return this.request("GET_ACTIVITY_INSTANCE_TASKS", payload);
317
+ }
318
+ /** List task instances for an activity in a given period. */
319
+ getActivityPeriodTasks(payload) {
320
+ return this.request("GET_ACTIVITY_PERIOD_TASKS", payload);
321
+ }
322
+ // ---------------------------------------------------------------------------
323
+ // Operations — Activity: task definitions
324
+ // ---------------------------------------------------------------------------
325
+ /** List task definitions. */
326
+ getTaskDefinitions(payload) {
327
+ return this.request("GET_TASK_DEFINITIONS", payload);
328
+ }
329
+ /** Fetch a single task definition by id. */
330
+ getTaskDefinition(payload) {
331
+ return this.request("GET_TASK_DEFINITION", payload);
332
+ }
333
+ /** Create a task definition. */
334
+ createTaskDefinition(payload) {
335
+ return this.request("CREATE_TASK_DEFINITION", payload);
336
+ }
337
+ /** Update a task definition by id. */
338
+ updateTaskDefinition(payload) {
339
+ return this.request("UPDATE_TASK_DEFINITION", payload);
340
+ }
341
+ /** Query task definitions by filter. */
342
+ getTaskDefinitionsByFilter(payload) {
343
+ return this.request("GET_TASK_DEFINITIONS_BY_FILTER", payload);
344
+ }
345
+ // ---------------------------------------------------------------------------
346
+ // Operations — Activity: task instances
347
+ // ---------------------------------------------------------------------------
348
+ /** List task instances. */
349
+ getTaskInstances(payload) {
350
+ return this.request("GET_TASK_INSTANCES", payload);
351
+ }
352
+ /** Fetch a single task instance by id. */
353
+ getTaskInstance(payload) {
354
+ return this.request("GET_TASK_INSTANCE", payload);
355
+ }
167
356
  /**
168
- * Uploads a file through the host. Converts the File to an ArrayBuffer
169
- * before sendingsandboxed iframes cannot pass File handles across windows.
357
+ * Submit a Close-Management task output. This is the **only write path** back
358
+ * into NominalVibe Apps never write Nominal data directly.
359
+ *
360
+ * @example
361
+ * ```ts
362
+ * // `body` carries the task-specific output shape.
363
+ * await bridge.postTaskOutput({
364
+ * path: { task_instance_id: 'task-1' },
365
+ * body: {},
366
+ * })
367
+ * ```
368
+ */
369
+ postTaskOutput(payload) {
370
+ return this.request("POST_TASK_OUTPUT", payload);
371
+ }
372
+ /** Query task instances by filter. */
373
+ getTaskInstancesByFilter(payload) {
374
+ return this.request("GET_TASK_INSTANCES_BY_FILTER", payload);
375
+ }
376
+ // ---------------------------------------------------------------------------
377
+ // Operations — Audit trail
378
+ // ---------------------------------------------------------------------------
379
+ /** List audit-trail events. */
380
+ getAuditEvents(payload) {
381
+ return this.request("GET_AUDIT_EVENTS", payload);
382
+ }
383
+ /** List audit-trail events for a specific entity. */
384
+ getEntityAuditEvents(payload) {
385
+ return this.request("GET_ENTITY_AUDIT_EVENTS", payload);
386
+ }
387
+ // ---------------------------------------------------------------------------
388
+ // Operations — Period manager: fiscal calendars
389
+ // ---------------------------------------------------------------------------
390
+ /** List fiscal calendars for a subsidiary. */
391
+ getFiscalCalendars(payload) {
392
+ return this.request("GET_FISCAL_CALENDARS", payload);
393
+ }
394
+ /** Fetch a single fiscal calendar by id. */
395
+ getFiscalCalendar(payload) {
396
+ return this.request("GET_FISCAL_CALENDAR", payload);
397
+ }
398
+ // ---------------------------------------------------------------------------
399
+ // Operations — Tenancy
400
+ // ---------------------------------------------------------------------------
401
+ /** List subsidiaries for the tenant. */
402
+ getSubsidiaries(payload) {
403
+ return this.request("GET_SUBSIDIARIES", payload);
404
+ }
405
+ /** Fetch a single subsidiary by id. */
406
+ getSubsidiary(payload) {
407
+ return this.request("GET_SUBSIDIARY", payload);
408
+ }
409
+ /** List parent currencies for a subsidiary. */
410
+ getSubsidiaryParentCurrencies(payload) {
411
+ return this.request("GET_SUBSIDIARY_PARENT_CURRENCIES", payload);
412
+ }
413
+ /** List users for the tenant. */
414
+ getTenantUsers(payload) {
415
+ return this.request("GET_TENANT_USERS", payload);
416
+ }
417
+ /**
418
+ * Uploads a file through the host. Converts the `File` to an `ArrayBuffer`
419
+ * before sending — sandboxed iframes cannot pass `File` handles across
420
+ * windows. Resolves once Nominal has stored the file.
421
+ *
422
+ * @example
423
+ * ```ts
424
+ * const input = document.querySelector<HTMLInputElement>('#file')!
425
+ * const file = input.files![0]
426
+ * const result = await bridge.upload(file, {
427
+ * entityType: 'JOURNAL_ENTRY',
428
+ * entityId: '123',
429
+ * onProgress: (p) => console.log(`${p.progress}%`),
430
+ * })
431
+ * // result.attachmentId, result.name
432
+ * ```
170
433
  */
171
434
  async upload(file, options) {
172
435
  const buffer = await file.arrayBuffer();
@@ -280,6 +543,18 @@ var VibeAppBridge = class {
280
543
  this.parentOrigin
281
544
  );
282
545
  }
546
+ /**
547
+ * Low-level typed request for **any** operation in {@link RequestRegistry}.
548
+ * The named methods (e.g. {@link VibeAppBridge.getChartOfAccounts}) wrap this;
549
+ * use it directly for operations without a named method, or to pass an
550
+ * `onProgress` callback. `type` autocompletes to every operation name and
551
+ * narrows `payload`/return to that operation's types.
552
+ *
553
+ * @example
554
+ * ```ts
555
+ * const accounts = await bridge.request('GET_ACCOUNTS', { query: { account_ids: ['acc-1'] } })
556
+ * ```
557
+ */
283
558
  request(type, payload, onProgress) {
284
559
  return new Promise((resolve, reject) => {
285
560
  const requestId = crypto.randomUUID();
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- var version = "0.0.1";
1
+ var version = "0.1.0";
2
2
 
3
3
  type AccountingAccountDimensionValues = {
4
4
  account_id: string;
@@ -3424,14 +3424,48 @@ interface RequestRegistry {
3424
3424
  }
3425
3425
 
3426
3426
  interface VibeAppBridgeOptions {
3427
+ /**
3428
+ * Origin of the Nominal app embedding this iframe (e.g.
3429
+ * `https://app.nominal.so` or `http://localhost:3000`). Must match the host
3430
+ * origin **exactly** — messages from any other origin are ignored, and the
3431
+ * bridge only `postMessage`s to this origin. Drive it from an env var so the
3432
+ * same code works locally and in production.
3433
+ */
3427
3434
  parentOrigin: string;
3435
+ /** Per-request timeout in milliseconds before a call rejects. Default `10000`. */
3428
3436
  requestTimeout?: number;
3429
3437
  }
3430
3438
  interface UploadOptions {
3439
+ /** Domain entity the file attaches to, e.g. `'JOURNAL_ENTRY'`. */
3431
3440
  entityType: string;
3441
+ /** Id of the entity the file attaches to, when applicable. */
3432
3442
  entityId?: string | number;
3443
+ /** Called with incremental progress (`0`–`100`) while the upload streams. */
3433
3444
  onProgress?: (p: RequestRegistry['UPLOAD_FILE']['progress']) => void;
3434
3445
  }
3446
+ /**
3447
+ * Iframe-side bridge to the Nominal host. One instance per app: construct it,
3448
+ * `await connect()` once, then call data methods, `upload()`, and subroute
3449
+ * helpers. Tear down with `destroy()` on unmount.
3450
+ *
3451
+ * Every data method delegates to {@link VibeAppBridge.request}; the ~46 named
3452
+ * methods (e.g. {@link VibeAppBridge.getChartOfAccounts}) are the typed,
3453
+ * discoverable surface, and `request('<OP>', payload)` is the escape hatch for
3454
+ * any operation in {@link RequestRegistry}.
3455
+ *
3456
+ * @example
3457
+ * ```ts
3458
+ * import { VibeAppBridge, type ContextPayload } from '@nominalso/vibe-bridge'
3459
+ *
3460
+ * const bridge = new VibeAppBridge({ parentOrigin: import.meta.env.VITE_PARENT_ORIGIN })
3461
+ *
3462
+ * const ctx: ContextPayload = await bridge.connect()
3463
+ * const accounts = await bridge.getChartOfAccounts({ path: { subsidiary_id: ctx.subsidiaryId } })
3464
+ *
3465
+ * // cleanup
3466
+ * bridge.destroy()
3467
+ * ```
3468
+ */
3435
3469
  declare class VibeAppBridge {
3436
3470
  private readonly parentOrigin;
3437
3471
  private readonly requestTimeout;
@@ -3452,27 +3486,170 @@ declare class VibeAppBridge {
3452
3486
  private readonly pushHandlers;
3453
3487
  constructor({ parentOrigin, requestTimeout }: VibeAppBridgeOptions);
3454
3488
  /**
3455
- * Connects to the host and returns the tenant/user context.
3456
- * Call once on app init concurrent calls return the same promise.
3489
+ * Connects to the host and returns the tenant/user {@link ContextPayload}.
3490
+ * **Call this once on app init and await it before any other method** — data
3491
+ * methods, `upload()`, and subroute reporting all require an established
3492
+ * connection. Concurrent calls return the same promise.
3457
3493
  *
3458
3494
  * Actively polls the host every 500ms until a response arrives, which
3459
3495
  * handles the race condition where the host's initial context push arrives
3460
- * before this listener is ready.
3496
+ * before this listener is ready. Rejects with `Bridge connect timed out`
3497
+ * after 10 seconds if no context arrives (usually a `parentOrigin` mismatch
3498
+ * or the host hasn't mounted).
3461
3499
  *
3462
3500
  * After connecting, if the context includes an initial subroute (e.g. from
3463
3501
  * a deep link), the bridge navigates to it and starts auto-tracking
3464
3502
  * internal navigation via the history API.
3503
+ *
3504
+ * @returns The tenant/user/subsidiary context for this app session.
3505
+ * @throws If no context is received within 10 seconds.
3506
+ * @example
3507
+ * ```ts
3508
+ * const ctx = await bridge.connect()
3509
+ * // ctx.tenant, ctx.subsidiaryId, ctx.subsidiaries, ctx.user, ctx.lastClosedPeriodSlug
3510
+ * ```
3465
3511
  */
3466
3512
  connect(): Promise<ContextPayload>;
3513
+ /**
3514
+ * Fetch the flat chart of accounts for a subsidiary.
3515
+ *
3516
+ * @example
3517
+ * ```ts
3518
+ * const ctx = await bridge.connect()
3519
+ * const accounts = await bridge.getChartOfAccounts({
3520
+ * path: { subsidiary_id: ctx.subsidiaryId },
3521
+ * })
3522
+ * ```
3523
+ */
3467
3524
  getChartOfAccounts(payload: RequestRegistry['GET_CHART_OF_ACCOUNTS']['payload']): Promise<RequestRegistry['GET_CHART_OF_ACCOUNTS']['data']>;
3468
- getSubsidiaries(payload: RequestRegistry['GET_SUBSIDIARIES']['payload']): Promise<RequestRegistry['GET_SUBSIDIARIES']['data']>;
3469
- getPeriods(payload: RequestRegistry['GET_PERIODS']['payload']): Promise<RequestRegistry['GET_PERIODS']['data']>;
3470
- postTaskOutput(payload: RequestRegistry['POST_TASK_OUTPUT']['payload']): Promise<RequestRegistry['POST_TASK_OUTPUT']['data']>;
3525
+ /** Fetch the chart of accounts as a hierarchical tree for a subsidiary. */
3526
+ getCoaTree(payload: RequestRegistry['GET_COA_TREE']['payload']): Promise<RequestRegistry['GET_COA_TREE']['data']>;
3527
+ /** Fetch a simplified flat chart of accounts for a subsidiary. */
3528
+ getCoaFlatSimple(payload: RequestRegistry['GET_COA_FLAT_SIMPLE']['payload']): Promise<RequestRegistry['GET_COA_FLAT_SIMPLE']['data']>;
3529
+ /** Fetch the flat chart of accounts grouped by account group. */
3530
+ getCoaGrouped(payload: RequestRegistry['GET_COA_GROUPED']['payload']): Promise<RequestRegistry['GET_COA_GROUPED']['data']>;
3531
+ /** Fetch a single chart-of-accounts account by id within a subsidiary. */
3532
+ getCoaAccount(payload: RequestRegistry['GET_COA_ACCOUNT']['payload']): Promise<RequestRegistry['GET_COA_ACCOUNT']['data']>;
3533
+ /** List the currencies available to a subsidiary's chart of accounts. */
3534
+ getSubsidiaryAvailableCurrencies(payload: RequestRegistry['GET_SUBSIDIARY_AVAILABLE_CURRENCIES']['payload']): Promise<RequestRegistry['GET_SUBSIDIARY_AVAILABLE_CURRENCIES']['data']>;
3535
+ /** Fetch accounts at the tenant level. */
3536
+ getAccounts(payload: RequestRegistry['GET_ACCOUNTS']['payload']): Promise<RequestRegistry['GET_ACCOUNTS']['data']>;
3537
+ /** Fetch a single account by id. */
3538
+ getAccount(payload: RequestRegistry['GET_ACCOUNT']['payload']): Promise<RequestRegistry['GET_ACCOUNT']['data']>;
3539
+ /** Fetch currency conversion rates for a currency. */
3540
+ getConversionRates(payload: RequestRegistry['GET_CONVERSION_RATES']['payload']): Promise<RequestRegistry['GET_CONVERSION_RATES']['data']>;
3541
+ /** Fetch the effective consolidation exchange rate. */
3542
+ getEffectiveExchangeRate(payload: RequestRegistry['GET_EFFECTIVE_EXCHANGE_RATE']['payload']): Promise<RequestRegistry['GET_EFFECTIVE_EXCHANGE_RATE']['data']>;
3543
+ /** Fetch the exchange-rate period covering a given input date. */
3544
+ getExchangeRateByDate(payload: RequestRegistry['GET_EXCHANGE_RATE_BY_DATE']['payload']): Promise<RequestRegistry['GET_EXCHANGE_RATE_BY_DATE']['data']>;
3545
+ /** List accounting dimensions. */
3546
+ getDimensions(payload: RequestRegistry['GET_DIMENSIONS']['payload']): Promise<RequestRegistry['GET_DIMENSIONS']['data']>;
3547
+ /** List values for accounting dimensions. */
3548
+ getDimensionValues(payload: RequestRegistry['GET_DIMENSION_VALUES']['payload']): Promise<RequestRegistry['GET_DIMENSION_VALUES']['data']>;
3549
+ /** List dimension values in hierarchical form. */
3550
+ getDimensionValuesHierarchical(payload: RequestRegistry['GET_DIMENSION_VALUES_HIERARCHICAL']['payload']): Promise<RequestRegistry['GET_DIMENSION_VALUES_HIERARCHICAL']['data']>;
3551
+ /** List account assignments for a dimension/account pair. */
3552
+ getDimensionAccountAssignments(payload: RequestRegistry['GET_DIMENSION_ACCOUNT_ASSIGNMENTS']['payload']): Promise<RequestRegistry['GET_DIMENSION_ACCOUNT_ASSIGNMENTS']['data']>;
3553
+ /**
3554
+ * Fetch journal entries for a subsidiary, optionally filtered by date range.
3555
+ *
3556
+ * @example
3557
+ * ```ts
3558
+ * const entries = await bridge.getJournalEntries({
3559
+ * path: { subsidiary_id: ctx.subsidiaryId },
3560
+ * query: { from_date: '2026-01-01', to_date: '2026-03-31' },
3561
+ * })
3562
+ * ```
3563
+ */
3471
3564
  getJournalEntries(payload: RequestRegistry['GET_JOURNAL_ENTRIES']['payload']): Promise<RequestRegistry['GET_JOURNAL_ENTRIES']['data']>;
3565
+ /** Fetch journal entry lines for a subsidiary. */
3472
3566
  getJournalLines(payload: RequestRegistry['GET_JOURNAL_LINES']['payload']): Promise<RequestRegistry['GET_JOURNAL_LINES']['data']>;
3567
+ /** Fetch a single journal entry by id within a subsidiary. */
3568
+ getJournalEntry(payload: RequestRegistry['GET_JOURNAL_ENTRY']['payload']): Promise<RequestRegistry['GET_JOURNAL_ENTRY']['data']>;
3569
+ /** List accounting period instances. */
3570
+ getPeriods(payload: RequestRegistry['GET_PERIODS']['payload']): Promise<RequestRegistry['GET_PERIODS']['data']>;
3571
+ /** Fetch a single period instance by id. */
3572
+ getPeriodInstance(payload: RequestRegistry['GET_PERIOD_INSTANCE']['payload']): Promise<RequestRegistry['GET_PERIOD_INSTANCE']['data']>;
3573
+ /** Fetch a period instance by its display slug (e.g. `"mar-2026"`). */
3574
+ getPeriodInstanceBySlug(payload: RequestRegistry['GET_PERIOD_INSTANCE_BY_SLUG']['payload']): Promise<RequestRegistry['GET_PERIOD_INSTANCE_BY_SLUG']['data']>;
3575
+ /** Fetch the close-progress breakdown for a period (by slug). */
3576
+ getPeriodProgressBreakdown(payload: RequestRegistry['GET_PERIOD_PROGRESS_BREAKDOWN']['payload']): Promise<RequestRegistry['GET_PERIOD_PROGRESS_BREAKDOWN']['data']>;
3577
+ /** List activity definitions. */
3578
+ getActivityDefinitions(payload: RequestRegistry['GET_ACTIVITY_DEFINITIONS']['payload']): Promise<RequestRegistry['GET_ACTIVITY_DEFINITIONS']['data']>;
3579
+ /** Fetch a single activity definition by id. */
3580
+ getActivityDefinition(payload: RequestRegistry['GET_ACTIVITY_DEFINITION']['payload']): Promise<RequestRegistry['GET_ACTIVITY_DEFINITION']['data']>;
3581
+ /** List activity instances. */
3582
+ getActivityInstances(payload: RequestRegistry['GET_ACTIVITY_INSTANCES']['payload']): Promise<RequestRegistry['GET_ACTIVITY_INSTANCES']['data']>;
3583
+ /** Fetch a single activity instance by id. */
3584
+ getActivityInstance(payload: RequestRegistry['GET_ACTIVITY_INSTANCE']['payload']): Promise<RequestRegistry['GET_ACTIVITY_INSTANCE']['data']>;
3585
+ /** Fetch an activity instance for a given period + activity definition. */
3586
+ getActivityInstanceByPeriod(payload: RequestRegistry['GET_ACTIVITY_INSTANCE_BY_PERIOD']['payload']): Promise<RequestRegistry['GET_ACTIVITY_INSTANCE_BY_PERIOD']['data']>;
3587
+ /** List task instances for an activity instance. */
3588
+ getActivityInstanceTasks(payload: RequestRegistry['GET_ACTIVITY_INSTANCE_TASKS']['payload']): Promise<RequestRegistry['GET_ACTIVITY_INSTANCE_TASKS']['data']>;
3589
+ /** List task instances for an activity in a given period. */
3590
+ getActivityPeriodTasks(payload: RequestRegistry['GET_ACTIVITY_PERIOD_TASKS']['payload']): Promise<RequestRegistry['GET_ACTIVITY_PERIOD_TASKS']['data']>;
3591
+ /** List task definitions. */
3592
+ getTaskDefinitions(payload: RequestRegistry['GET_TASK_DEFINITIONS']['payload']): Promise<RequestRegistry['GET_TASK_DEFINITIONS']['data']>;
3593
+ /** Fetch a single task definition by id. */
3594
+ getTaskDefinition(payload: RequestRegistry['GET_TASK_DEFINITION']['payload']): Promise<RequestRegistry['GET_TASK_DEFINITION']['data']>;
3595
+ /** Create a task definition. */
3596
+ createTaskDefinition(payload: RequestRegistry['CREATE_TASK_DEFINITION']['payload']): Promise<RequestRegistry['CREATE_TASK_DEFINITION']['data']>;
3597
+ /** Update a task definition by id. */
3598
+ updateTaskDefinition(payload: RequestRegistry['UPDATE_TASK_DEFINITION']['payload']): Promise<RequestRegistry['UPDATE_TASK_DEFINITION']['data']>;
3599
+ /** Query task definitions by filter. */
3600
+ getTaskDefinitionsByFilter(payload: RequestRegistry['GET_TASK_DEFINITIONS_BY_FILTER']['payload']): Promise<RequestRegistry['GET_TASK_DEFINITIONS_BY_FILTER']['data']>;
3601
+ /** List task instances. */
3602
+ getTaskInstances(payload: RequestRegistry['GET_TASK_INSTANCES']['payload']): Promise<RequestRegistry['GET_TASK_INSTANCES']['data']>;
3603
+ /** Fetch a single task instance by id. */
3604
+ getTaskInstance(payload: RequestRegistry['GET_TASK_INSTANCE']['payload']): Promise<RequestRegistry['GET_TASK_INSTANCE']['data']>;
3605
+ /**
3606
+ * Submit a Close-Management task output. This is the **only write path** back
3607
+ * into Nominal — Vibe Apps never write Nominal data directly.
3608
+ *
3609
+ * @example
3610
+ * ```ts
3611
+ * // `body` carries the task-specific output shape.
3612
+ * await bridge.postTaskOutput({
3613
+ * path: { task_instance_id: 'task-1' },
3614
+ * body: {},
3615
+ * })
3616
+ * ```
3617
+ */
3618
+ postTaskOutput(payload: RequestRegistry['POST_TASK_OUTPUT']['payload']): Promise<RequestRegistry['POST_TASK_OUTPUT']['data']>;
3619
+ /** Query task instances by filter. */
3620
+ getTaskInstancesByFilter(payload: RequestRegistry['GET_TASK_INSTANCES_BY_FILTER']['payload']): Promise<RequestRegistry['GET_TASK_INSTANCES_BY_FILTER']['data']>;
3621
+ /** List audit-trail events. */
3622
+ getAuditEvents(payload: RequestRegistry['GET_AUDIT_EVENTS']['payload']): Promise<RequestRegistry['GET_AUDIT_EVENTS']['data']>;
3623
+ /** List audit-trail events for a specific entity. */
3624
+ getEntityAuditEvents(payload: RequestRegistry['GET_ENTITY_AUDIT_EVENTS']['payload']): Promise<RequestRegistry['GET_ENTITY_AUDIT_EVENTS']['data']>;
3625
+ /** List fiscal calendars for a subsidiary. */
3626
+ getFiscalCalendars(payload: RequestRegistry['GET_FISCAL_CALENDARS']['payload']): Promise<RequestRegistry['GET_FISCAL_CALENDARS']['data']>;
3627
+ /** Fetch a single fiscal calendar by id. */
3628
+ getFiscalCalendar(payload: RequestRegistry['GET_FISCAL_CALENDAR']['payload']): Promise<RequestRegistry['GET_FISCAL_CALENDAR']['data']>;
3629
+ /** List subsidiaries for the tenant. */
3630
+ getSubsidiaries(payload: RequestRegistry['GET_SUBSIDIARIES']['payload']): Promise<RequestRegistry['GET_SUBSIDIARIES']['data']>;
3631
+ /** Fetch a single subsidiary by id. */
3632
+ getSubsidiary(payload: RequestRegistry['GET_SUBSIDIARY']['payload']): Promise<RequestRegistry['GET_SUBSIDIARY']['data']>;
3633
+ /** List parent currencies for a subsidiary. */
3634
+ getSubsidiaryParentCurrencies(payload: RequestRegistry['GET_SUBSIDIARY_PARENT_CURRENCIES']['payload']): Promise<RequestRegistry['GET_SUBSIDIARY_PARENT_CURRENCIES']['data']>;
3635
+ /** List users for the tenant. */
3636
+ getTenantUsers(payload: RequestRegistry['GET_TENANT_USERS']['payload']): Promise<RequestRegistry['GET_TENANT_USERS']['data']>;
3473
3637
  /**
3474
- * Uploads a file through the host. Converts the File to an ArrayBuffer
3475
- * before sending — sandboxed iframes cannot pass File handles across windows.
3638
+ * Uploads a file through the host. Converts the `File` to an `ArrayBuffer`
3639
+ * before sending — sandboxed iframes cannot pass `File` handles across
3640
+ * windows. Resolves once Nominal has stored the file.
3641
+ *
3642
+ * @example
3643
+ * ```ts
3644
+ * const input = document.querySelector<HTMLInputElement>('#file')!
3645
+ * const file = input.files![0]
3646
+ * const result = await bridge.upload(file, {
3647
+ * entityType: 'JOURNAL_ENTRY',
3648
+ * entityId: '123',
3649
+ * onProgress: (p) => console.log(`${p.progress}%`),
3650
+ * })
3651
+ * // result.attachmentId, result.name
3652
+ * ```
3476
3653
  */
3477
3654
  upload(file: File, options: UploadOptions): Promise<RequestRegistry['UPLOAD_FILE']['data']>;
3478
3655
  /**
@@ -3503,10 +3680,22 @@ declare class VibeAppBridge {
3503
3680
  private withSubrouteSuppressed;
3504
3681
  private reportCurrentSubroute;
3505
3682
  private sendCommand;
3683
+ /**
3684
+ * Low-level typed request for **any** operation in {@link RequestRegistry}.
3685
+ * The named methods (e.g. {@link VibeAppBridge.getChartOfAccounts}) wrap this;
3686
+ * use it directly for operations without a named method, or to pass an
3687
+ * `onProgress` callback. `type` autocompletes to every operation name and
3688
+ * narrows `payload`/return to that operation's types.
3689
+ *
3690
+ * @example
3691
+ * ```ts
3692
+ * const accounts = await bridge.request('GET_ACCOUNTS', { query: { account_ids: ['acc-1'] } })
3693
+ * ```
3694
+ */
3506
3695
  request<K extends keyof RequestRegistry>(type: K, payload: RequestRegistry[K]['payload'], onProgress?: (payload: unknown) => void): Promise<RequestRegistry[K]['data']>;
3507
3696
  private handleMessage;
3508
3697
  private handleResponse;
3509
3698
  private handleProgress;
3510
3699
  }
3511
3700
 
3512
- export { version as BRIDGE_VERSION, VibeAppBridge, type VibeAppBridgeOptions };
3701
+ export { version as BRIDGE_VERSION, type BridgeSubsidiary, type ContextPayload, type RequestRegistry, type UploadOptions, type UploadProgress, type UploadResponse, VibeAppBridge, type VibeAppBridgeOptions };