@nominalso/vibe-bridge 0.8.0 → 0.8.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.server.ts","../../protocol-types/dist/index.js","../src/data-methods.ts","../src/server-bridge.ts","../package.json","../src/version.ts"],"sourcesContent":["// Server entry point — resolved through the `react-server`, `worker`, `workerd`,\n// `edge-light`, and `deno` export conditions (RSC / Worker / edge graphs). Plain\n// Node and jsdom/happy-dom test runners get the real build instead. It exposes the identical\n// public surface as the browser entry (same types, same symbol names) but the\n// `VibeAppBridge` here is a server-safe stub: a no-op constructor + `destroy()`,\n// with every other method throwing/rejecting `BridgeError('SERVER_ENVIRONMENT')`.\n// No DOM access, no `posthog-js` — nothing to pull into a server/edge bundle.\nexport { VibeAppBridge } from './server-bridge'\nexport * from './shared-exports'\n","// src/subroute.ts\nfunction normalizeSubroute(subroute) {\n const normalized = subroute.startsWith(\"/\") ? subroute : `/${subroute}`;\n const path = normalized.split(/[?#]/)[0];\n let decoded = path;\n let prev;\n do {\n prev = decoded;\n decoded = decoded.replace(/%25/gi, \"%\").replace(/%2e/gi, \".\").replace(/%2f/gi, \"/\");\n } while (decoded !== prev);\n if (decoded.split(\"/\").some((segment) => segment === \"..\")) return null;\n return normalized;\n}\n\n// src/protocol.ts\nvar PROTOCOL_ID = \"nominal-vibe-bridge\";\nvar PROTOCOL_VERSION = 2;\nvar BRIDGE_KINDS = [\"request\", \"response\", \"push\", \"command\", \"progress\"];\nvar CORRELATED_KINDS = [\"request\", \"response\", \"progress\"];\nvar BRIDGE_KINDS_SET = new Set(BRIDGE_KINDS);\nvar CORRELATED_KINDS_SET = new Set(CORRELATED_KINDS);\nfunction isBridgeMessage(data) {\n if (typeof data !== \"object\" || data === null) return false;\n const d = data;\n if (d.__protocol !== PROTOCOL_ID) return false;\n if (d.__version !== PROTOCOL_VERSION) return false;\n if (typeof d.kind !== \"string\" || !BRIDGE_KINDS_SET.has(d.kind)) return false;\n if (typeof d.type !== \"string\") return false;\n if (CORRELATED_KINDS_SET.has(d.kind) && typeof d.requestId !== \"string\") return false;\n return true;\n}\n\n// src/errors.ts\nvar BRIDGE_ERROR_BRAND = /* @__PURE__ */ Symbol.for(\"@nominalso/vibe-bridge:BridgeError\");\nvar HTTP_BRIDGE_ERROR_BRAND = /* @__PURE__ */ Symbol.for(\"@nominalso/vibe-bridge:HttpBridgeError\");\nvar BridgeError = class extends Error {\n constructor(code, message) {\n super(message);\n this.code = code;\n this.name = \"BridgeError\";\n }\n /**\n * Cross-realm-safe type guard. Prefer this over `instanceof BridgeError` when\n * an error may have been thrown by a differently-built copy of the SDK (e.g.\n * server bundle vs client bundle) — it matches on a process-global brand\n * rather than class identity.\n */\n static isBridgeError(err) {\n return typeof err === \"object\" && err !== null && err[BRIDGE_ERROR_BRAND] === true;\n }\n};\nObject.defineProperty(BridgeError.prototype, BRIDGE_ERROR_BRAND, {\n value: true,\n enumerable: false\n});\nvar HttpBridgeError = class extends BridgeError {\n constructor(status, message) {\n super(\"REQUEST_FAILED\", message);\n this.status = status;\n this.name = \"HttpBridgeError\";\n }\n /**\n * Cross-realm-safe type guard (see {@link BridgeError.isBridgeError}). Returns\n * `true` only for `HttpBridgeError` instances, not plain `BridgeError`s.\n */\n static isHttpBridgeError(err) {\n return typeof err === \"object\" && err !== null && err[HTTP_BRIDGE_ERROR_BRAND] === true;\n }\n};\nObject.defineProperty(HttpBridgeError.prototype, HTTP_BRIDGE_ERROR_BRAND, {\n value: true,\n enumerable: false\n});\n\n// src/origins.ts\nfunction isOriginPattern(entry) {\n return entry.includes(\"*\");\n}\nvar patternCache = /* @__PURE__ */ new Map();\nfunction patternToRegExp(pattern) {\n const cached = patternCache.get(pattern);\n if (cached) return cached;\n const escaped = pattern.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const body = escaped.replace(/\\\\\\*/g, \"[^./:@?#\\\\s]+\");\n const compiled = new RegExp(`^${body}$`);\n patternCache.set(pattern, compiled);\n return compiled;\n}\nfunction matchesOrigin(origin, entry) {\n if (!isOriginPattern(entry)) return origin === entry;\n return patternToRegExp(entry).test(origin);\n}\nfunction isOriginAllowed(origin, allowlist, { allowPatterns }) {\n for (const entry of allowlist) {\n if (isOriginPattern(entry)) {\n if (allowPatterns && matchesOrigin(origin, entry)) return true;\n } else if (origin === entry) {\n return true;\n }\n }\n return false;\n}\nexport {\n BridgeError,\n HttpBridgeError,\n PROTOCOL_ID,\n PROTOCOL_VERSION,\n isBridgeMessage,\n isOriginAllowed,\n isOriginPattern,\n matchesOrigin,\n normalizeSubroute\n};\n","import type { RequestRegistry } from '@nominalso/vibe-protocol-types'\n\nexport interface UploadOptions {\n /** Domain entity the file attaches to, e.g. `'JOURNAL_ENTRY'`. */\n entityType: string\n /** Id of the entity the file attaches to, when applicable. */\n entityId?: string | number\n /** Called with incremental progress (`0`–`100`) while the upload streams. */\n onProgress?: (p: RequestRegistry['UPLOAD_FILE']['progress']) => void\n}\n\n/**\n * The typed Nominal data methods (~46) plus {@link BridgeDataMethods.upload},\n * factored onto a base class so {@link VibeAppBridge} stays focused on\n * connection/transport. Each method is a thin typed wrapper over `request()`;\n * `VibeAppBridge` provides the concrete `request` implementation.\n */\nexport abstract class BridgeDataMethods {\n /**\n * Low-level typed request for **any** operation in {@link RequestRegistry} —\n * implemented by {@link VibeAppBridge}. The named methods below wrap this.\n */\n abstract request<K extends keyof RequestRegistry>(\n type: K,\n payload: RequestRegistry[K]['payload'],\n onProgress?: (payload: unknown) => void,\n ): Promise<RequestRegistry[K]['data']>\n\n // ---------------------------------------------------------------------------\n // Operations — Accounting: chart of accounts\n //\n // Each method is a typed wrapper over `request('<OP>', payload)`. The payload\n // and return types come straight from the Nominal API (`RequestRegistry`).\n // For any operation without a named method, call `request('<OP>', payload)`.\n // ---------------------------------------------------------------------------\n\n /**\n * Fetch the flat chart of accounts for a subsidiary.\n *\n * @example\n * ```ts\n * const ctx = await bridge.connect()\n * const accounts = await bridge.getChartOfAccounts({\n * path: { subsidiary_id: ctx.subsidiaryId },\n * })\n * ```\n */\n getChartOfAccounts(\n payload: RequestRegistry['GET_CHART_OF_ACCOUNTS']['payload'],\n ): Promise<RequestRegistry['GET_CHART_OF_ACCOUNTS']['data']> {\n return this.request('GET_CHART_OF_ACCOUNTS', payload)\n }\n\n /** Fetch the chart of accounts as a hierarchical tree for a subsidiary. */\n getCoaTree(\n payload: RequestRegistry['GET_COA_TREE']['payload'],\n ): Promise<RequestRegistry['GET_COA_TREE']['data']> {\n return this.request('GET_COA_TREE', payload)\n }\n\n /** Fetch a simplified flat chart of accounts for a subsidiary. */\n getCoaFlatSimple(\n payload: RequestRegistry['GET_COA_FLAT_SIMPLE']['payload'],\n ): Promise<RequestRegistry['GET_COA_FLAT_SIMPLE']['data']> {\n return this.request('GET_COA_FLAT_SIMPLE', payload)\n }\n\n /** Fetch the flat chart of accounts grouped by account group. */\n getCoaGrouped(\n payload: RequestRegistry['GET_COA_GROUPED']['payload'],\n ): Promise<RequestRegistry['GET_COA_GROUPED']['data']> {\n return this.request('GET_COA_GROUPED', payload)\n }\n\n /** Fetch a single chart-of-accounts account by id within a subsidiary. */\n getCoaAccount(\n payload: RequestRegistry['GET_COA_ACCOUNT']['payload'],\n ): Promise<RequestRegistry['GET_COA_ACCOUNT']['data']> {\n return this.request('GET_COA_ACCOUNT', payload)\n }\n\n /** List the currencies available to a subsidiary's chart of accounts. */\n getSubsidiaryAvailableCurrencies(\n payload: RequestRegistry['GET_SUBSIDIARY_AVAILABLE_CURRENCIES']['payload'],\n ): Promise<RequestRegistry['GET_SUBSIDIARY_AVAILABLE_CURRENCIES']['data']> {\n return this.request('GET_SUBSIDIARY_AVAILABLE_CURRENCIES', payload)\n }\n\n /** Fetch accounts at the tenant level. */\n getAccounts(\n payload: RequestRegistry['GET_ACCOUNTS']['payload'],\n ): Promise<RequestRegistry['GET_ACCOUNTS']['data']> {\n return this.request('GET_ACCOUNTS', payload)\n }\n\n /** Fetch a single account by id. */\n getAccount(\n payload: RequestRegistry['GET_ACCOUNT']['payload'],\n ): Promise<RequestRegistry['GET_ACCOUNT']['data']> {\n return this.request('GET_ACCOUNT', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Accounting: exchange rates\n // ---------------------------------------------------------------------------\n\n /** Fetch currency conversion rates for a currency. */\n getConversionRates(\n payload: RequestRegistry['GET_CONVERSION_RATES']['payload'],\n ): Promise<RequestRegistry['GET_CONVERSION_RATES']['data']> {\n return this.request('GET_CONVERSION_RATES', payload)\n }\n\n /** Fetch the effective consolidation exchange rate. */\n getEffectiveExchangeRate(\n payload: RequestRegistry['GET_EFFECTIVE_EXCHANGE_RATE']['payload'],\n ): Promise<RequestRegistry['GET_EFFECTIVE_EXCHANGE_RATE']['data']> {\n return this.request('GET_EFFECTIVE_EXCHANGE_RATE', payload)\n }\n\n /** Fetch the exchange-rate period covering a given input date. */\n getExchangeRateByDate(\n payload: RequestRegistry['GET_EXCHANGE_RATE_BY_DATE']['payload'],\n ): Promise<RequestRegistry['GET_EXCHANGE_RATE_BY_DATE']['data']> {\n return this.request('GET_EXCHANGE_RATE_BY_DATE', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Accounting: dimensions\n // ---------------------------------------------------------------------------\n\n /** List accounting dimensions. */\n getDimensions(\n payload: RequestRegistry['GET_DIMENSIONS']['payload'],\n ): Promise<RequestRegistry['GET_DIMENSIONS']['data']> {\n return this.request('GET_DIMENSIONS', payload)\n }\n\n /** List values for accounting dimensions. */\n getDimensionValues(\n payload: RequestRegistry['GET_DIMENSION_VALUES']['payload'],\n ): Promise<RequestRegistry['GET_DIMENSION_VALUES']['data']> {\n return this.request('GET_DIMENSION_VALUES', payload)\n }\n\n /** List dimension values in hierarchical form. */\n getDimensionValuesHierarchical(\n payload: RequestRegistry['GET_DIMENSION_VALUES_HIERARCHICAL']['payload'],\n ): Promise<RequestRegistry['GET_DIMENSION_VALUES_HIERARCHICAL']['data']> {\n return this.request('GET_DIMENSION_VALUES_HIERARCHICAL', payload)\n }\n\n /** List account assignments for a dimension/account pair. */\n getDimensionAccountAssignments(\n payload: RequestRegistry['GET_DIMENSION_ACCOUNT_ASSIGNMENTS']['payload'],\n ): Promise<RequestRegistry['GET_DIMENSION_ACCOUNT_ASSIGNMENTS']['data']> {\n return this.request('GET_DIMENSION_ACCOUNT_ASSIGNMENTS', payload)\n }\n\n /** Get dimension-value balances for a dimension over a date window. */\n getDimensionBalance(\n payload: RequestRegistry['GET_DIMENSION_BALANCE']['payload'],\n ): Promise<RequestRegistry['GET_DIMENSION_BALANCE']['data']> {\n return this.request('GET_DIMENSION_BALANCE', payload)\n }\n\n /** Add a new value under an existing dimension. */\n addDimensionValue(\n payload: RequestRegistry['ADD_DIMENSION_VALUE']['payload'],\n ): Promise<RequestRegistry['ADD_DIMENSION_VALUE']['data']> {\n return this.request('ADD_DIMENSION_VALUE', payload)\n }\n\n /** Set or override the dimension value on a single journal-entry line. */\n setLineDimensionValue(\n payload: RequestRegistry['SET_LINE_DIMENSION_VALUE']['payload'],\n ): Promise<RequestRegistry['SET_LINE_DIMENSION_VALUE']['data']> {\n return this.request('SET_LINE_DIMENSION_VALUE', payload)\n }\n\n /** Bulk-assign a dimension value to many journal-entry lines at once. */\n bulkSetLineDimensionValue(\n payload: RequestRegistry['BULK_SET_LINE_DIMENSION_VALUE']['payload'],\n ): Promise<RequestRegistry['BULK_SET_LINE_DIMENSION_VALUE']['data']> {\n return this.request('BULK_SET_LINE_DIMENSION_VALUE', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Accounting: journal entries\n // ---------------------------------------------------------------------------\n\n /**\n * Fetch journal entries for a subsidiary, optionally filtered by date range.\n *\n * @example\n * ```ts\n * const entries = await bridge.getJournalEntries({\n * path: { subsidiary_id: ctx.subsidiaryId },\n * query: { from_date: '2026-01-01', to_date: '2026-03-31' },\n * })\n * ```\n */\n getJournalEntries(\n payload: RequestRegistry['GET_JOURNAL_ENTRIES']['payload'],\n ): Promise<RequestRegistry['GET_JOURNAL_ENTRIES']['data']> {\n return this.request('GET_JOURNAL_ENTRIES', payload)\n }\n\n /** Fetch journal entry lines for a subsidiary. */\n getJournalLines(\n payload: RequestRegistry['GET_JOURNAL_LINES']['payload'],\n ): Promise<RequestRegistry['GET_JOURNAL_LINES']['data']> {\n return this.request('GET_JOURNAL_LINES', payload)\n }\n\n /** Fetch a single journal entry by id within a subsidiary. */\n getJournalEntry(\n payload: RequestRegistry['GET_JOURNAL_ENTRY']['payload'],\n ): Promise<RequestRegistry['GET_JOURNAL_ENTRY']['data']> {\n return this.request('GET_JOURNAL_ENTRY', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Activity: period instances\n // ---------------------------------------------------------------------------\n\n /** List accounting period instances. */\n getPeriods(\n payload: RequestRegistry['GET_PERIODS']['payload'],\n ): Promise<RequestRegistry['GET_PERIODS']['data']> {\n return this.request('GET_PERIODS', payload)\n }\n\n /** Fetch a single period instance by id. */\n getPeriodInstance(\n payload: RequestRegistry['GET_PERIOD_INSTANCE']['payload'],\n ): Promise<RequestRegistry['GET_PERIOD_INSTANCE']['data']> {\n return this.request('GET_PERIOD_INSTANCE', payload)\n }\n\n /** Fetch a period instance by its display slug (e.g. `\"mar-2026\"`). */\n getPeriodInstanceBySlug(\n payload: RequestRegistry['GET_PERIOD_INSTANCE_BY_SLUG']['payload'],\n ): Promise<RequestRegistry['GET_PERIOD_INSTANCE_BY_SLUG']['data']> {\n return this.request('GET_PERIOD_INSTANCE_BY_SLUG', payload)\n }\n\n /** Fetch the close-progress breakdown for a period (by slug). */\n getPeriodProgressBreakdown(\n payload: RequestRegistry['GET_PERIOD_PROGRESS_BREAKDOWN']['payload'],\n ): Promise<RequestRegistry['GET_PERIOD_PROGRESS_BREAKDOWN']['data']> {\n return this.request('GET_PERIOD_PROGRESS_BREAKDOWN', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Activity: activity definitions\n // ---------------------------------------------------------------------------\n\n /** List activity definitions. */\n getActivityDefinitions(\n payload: RequestRegistry['GET_ACTIVITY_DEFINITIONS']['payload'],\n ): Promise<RequestRegistry['GET_ACTIVITY_DEFINITIONS']['data']> {\n return this.request('GET_ACTIVITY_DEFINITIONS', payload)\n }\n\n /** Fetch a single activity definition by id. */\n getActivityDefinition(\n payload: RequestRegistry['GET_ACTIVITY_DEFINITION']['payload'],\n ): Promise<RequestRegistry['GET_ACTIVITY_DEFINITION']['data']> {\n return this.request('GET_ACTIVITY_DEFINITION', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Activity: activity instances\n // ---------------------------------------------------------------------------\n\n /** List activity instances. */\n getActivityInstances(\n payload: RequestRegistry['GET_ACTIVITY_INSTANCES']['payload'],\n ): Promise<RequestRegistry['GET_ACTIVITY_INSTANCES']['data']> {\n return this.request('GET_ACTIVITY_INSTANCES', payload)\n }\n\n /** Fetch a single activity instance by id. */\n getActivityInstance(\n payload: RequestRegistry['GET_ACTIVITY_INSTANCE']['payload'],\n ): Promise<RequestRegistry['GET_ACTIVITY_INSTANCE']['data']> {\n return this.request('GET_ACTIVITY_INSTANCE', payload)\n }\n\n /** Fetch an activity instance for a given period + activity definition. */\n getActivityInstanceByPeriod(\n payload: RequestRegistry['GET_ACTIVITY_INSTANCE_BY_PERIOD']['payload'],\n ): Promise<RequestRegistry['GET_ACTIVITY_INSTANCE_BY_PERIOD']['data']> {\n return this.request('GET_ACTIVITY_INSTANCE_BY_PERIOD', payload)\n }\n\n /** List task instances for an activity instance. */\n getActivityInstanceTasks(\n payload: RequestRegistry['GET_ACTIVITY_INSTANCE_TASKS']['payload'],\n ): Promise<RequestRegistry['GET_ACTIVITY_INSTANCE_TASKS']['data']> {\n return this.request('GET_ACTIVITY_INSTANCE_TASKS', payload)\n }\n\n /** List task instances for an activity in a given period. */\n getActivityPeriodTasks(\n payload: RequestRegistry['GET_ACTIVITY_PERIOD_TASKS']['payload'],\n ): Promise<RequestRegistry['GET_ACTIVITY_PERIOD_TASKS']['data']> {\n return this.request('GET_ACTIVITY_PERIOD_TASKS', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Activity: task definitions\n // ---------------------------------------------------------------------------\n\n /** List task definitions. */\n getTaskDefinitions(\n payload: RequestRegistry['GET_TASK_DEFINITIONS']['payload'],\n ): Promise<RequestRegistry['GET_TASK_DEFINITIONS']['data']> {\n return this.request('GET_TASK_DEFINITIONS', payload)\n }\n\n /** Fetch a single task definition by id. */\n getTaskDefinition(\n payload: RequestRegistry['GET_TASK_DEFINITION']['payload'],\n ): Promise<RequestRegistry['GET_TASK_DEFINITION']['data']> {\n return this.request('GET_TASK_DEFINITION', payload)\n }\n\n /** Create a task definition. */\n createTaskDefinition(\n payload: RequestRegistry['CREATE_TASK_DEFINITION']['payload'],\n ): Promise<RequestRegistry['CREATE_TASK_DEFINITION']['data']> {\n return this.request('CREATE_TASK_DEFINITION', payload)\n }\n\n /** Update a task definition by id. */\n updateTaskDefinition(\n payload: RequestRegistry['UPDATE_TASK_DEFINITION']['payload'],\n ): Promise<RequestRegistry['UPDATE_TASK_DEFINITION']['data']> {\n return this.request('UPDATE_TASK_DEFINITION', payload)\n }\n\n /** Query task definitions by filter. */\n getTaskDefinitionsByFilter(\n payload: RequestRegistry['GET_TASK_DEFINITIONS_BY_FILTER']['payload'],\n ): Promise<RequestRegistry['GET_TASK_DEFINITIONS_BY_FILTER']['data']> {\n return this.request('GET_TASK_DEFINITIONS_BY_FILTER', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Activity: task instances\n // ---------------------------------------------------------------------------\n\n /** List task instances. */\n getTaskInstances(\n payload: RequestRegistry['GET_TASK_INSTANCES']['payload'],\n ): Promise<RequestRegistry['GET_TASK_INSTANCES']['data']> {\n return this.request('GET_TASK_INSTANCES', payload)\n }\n\n /** Fetch a single task instance by id. */\n getTaskInstance(\n payload: RequestRegistry['GET_TASK_INSTANCE']['payload'],\n ): Promise<RequestRegistry['GET_TASK_INSTANCE']['data']> {\n return this.request('GET_TASK_INSTANCE', payload)\n }\n\n /**\n * Submit a Close-Management task output. This is the **only write path** back\n * into Nominal — Vibe Apps never write Nominal data directly.\n *\n * @example\n * ```ts\n * // `body` carries the task-specific output shape.\n * await bridge.postTaskOutput({\n * path: { task_instance_id: 'task-1' },\n * body: {},\n * })\n * ```\n */\n postTaskOutput(\n payload: RequestRegistry['POST_TASK_OUTPUT']['payload'],\n ): Promise<RequestRegistry['POST_TASK_OUTPUT']['data']> {\n return this.request('POST_TASK_OUTPUT', payload)\n }\n\n /** Query task instances by filter. */\n getTaskInstancesByFilter(\n payload: RequestRegistry['GET_TASK_INSTANCES_BY_FILTER']['payload'],\n ): Promise<RequestRegistry['GET_TASK_INSTANCES_BY_FILTER']['data']> {\n return this.request('GET_TASK_INSTANCES_BY_FILTER', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Audit trail\n // ---------------------------------------------------------------------------\n\n /** List audit-trail events. */\n getAuditEvents(\n payload: RequestRegistry['GET_AUDIT_EVENTS']['payload'],\n ): Promise<RequestRegistry['GET_AUDIT_EVENTS']['data']> {\n return this.request('GET_AUDIT_EVENTS', payload)\n }\n\n /** List audit-trail events for a specific entity. */\n getEntityAuditEvents(\n payload: RequestRegistry['GET_ENTITY_AUDIT_EVENTS']['payload'],\n ): Promise<RequestRegistry['GET_ENTITY_AUDIT_EVENTS']['data']> {\n return this.request('GET_ENTITY_AUDIT_EVENTS', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Period manager: fiscal calendars\n // ---------------------------------------------------------------------------\n\n /** List fiscal calendars for a subsidiary. */\n getFiscalCalendars(\n payload: RequestRegistry['GET_FISCAL_CALENDARS']['payload'],\n ): Promise<RequestRegistry['GET_FISCAL_CALENDARS']['data']> {\n return this.request('GET_FISCAL_CALENDARS', payload)\n }\n\n /** Fetch a single fiscal calendar by id. */\n getFiscalCalendar(\n payload: RequestRegistry['GET_FISCAL_CALENDAR']['payload'],\n ): Promise<RequestRegistry['GET_FISCAL_CALENDAR']['data']> {\n return this.request('GET_FISCAL_CALENDAR', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Tenancy\n // ---------------------------------------------------------------------------\n\n /** List subsidiaries for the tenant. */\n getSubsidiaries(\n payload: RequestRegistry['GET_SUBSIDIARIES']['payload'],\n ): Promise<RequestRegistry['GET_SUBSIDIARIES']['data']> {\n return this.request('GET_SUBSIDIARIES', payload)\n }\n\n /** Fetch a single subsidiary by id. */\n getSubsidiary(\n payload: RequestRegistry['GET_SUBSIDIARY']['payload'],\n ): Promise<RequestRegistry['GET_SUBSIDIARY']['data']> {\n return this.request('GET_SUBSIDIARY', payload)\n }\n\n /** List parent currencies for a subsidiary. */\n getSubsidiaryParentCurrencies(\n payload: RequestRegistry['GET_SUBSIDIARY_PARENT_CURRENCIES']['payload'],\n ): Promise<RequestRegistry['GET_SUBSIDIARY_PARENT_CURRENCIES']['data']> {\n return this.request('GET_SUBSIDIARY_PARENT_CURRENCIES', payload)\n }\n\n /** List users for the tenant. */\n getTenantUsers(\n payload: RequestRegistry['GET_TENANT_USERS']['payload'],\n ): Promise<RequestRegistry['GET_TENANT_USERS']['data']> {\n return this.request('GET_TENANT_USERS', payload)\n }\n\n /**\n * Uploads a file through the host. Converts the `File` to an `ArrayBuffer`\n * before sending — sandboxed iframes cannot pass `File` handles across\n * windows. Resolves once Nominal has stored the file.\n *\n * @example\n * ```ts\n * const input = document.querySelector<HTMLInputElement>('#file')!\n * const file = input.files![0]\n * const result = await bridge.upload(file, {\n * entityType: 'JOURNAL_ENTRY',\n * entityId: '123',\n * onProgress: (p) => console.log(`${p.progress}%`),\n * })\n * // result.attachmentId, result.name\n * ```\n */\n async upload(\n file: File,\n options: UploadOptions,\n ): Promise<RequestRegistry['UPLOAD_FILE']['data']> {\n const buffer = await file.arrayBuffer()\n const payload: RequestRegistry['UPLOAD_FILE']['payload'] = {\n buffer,\n fileName: file.name,\n fileType: file.type,\n entityType: options.entityType,\n entityId: options.entityId,\n }\n const onProgress = options.onProgress\n ? (p: unknown): void => options.onProgress!(p as RequestRegistry['UPLOAD_FILE']['progress'])\n : undefined\n return this.request('UPLOAD_FILE', payload, onProgress)\n }\n}\n","import { BridgeError } from '@nominalso/vibe-protocol-types'\nimport type {\n AuthPayload,\n ContextPayload,\n InvalidateCachePayload,\n InvalidateResult,\n NavigateAction,\n RequestRegistry,\n SetSideNavPayload,\n} from '@nominalso/vibe-protocol-types'\nimport type { VibeAppBridgeOptions } from './options'\nimport { BridgeDataMethods } from './data-methods'\n\n/**\n * The server/RSC/Worker build's error. Thrown (or rejected) by every method of\n * the {@link VibeAppBridge} stub so a call made outside the browser fails with a\n * clear, coded message instead of a cryptic `window is not defined`.\n */\nfunction serverEnvError(method: string): BridgeError {\n return new BridgeError(\n 'SERVER_ENVIRONMENT',\n `VibeAppBridge.${method} is not available on the server. This build of ` +\n `@nominalso/vibe-bridge was resolved through a server / React Server Component / ` +\n `Worker export condition — construct and drive the bridge from the browser ` +\n `(a client component or an effect), not during SSR or in a Server Component.`,\n )\n}\n\n/**\n * **Server-safe stub of {@link import('./VibeAppBridge').VibeAppBridge}.** This\n * is the class exported from `@nominalso/vibe-bridge` when the package is\n * resolved through an RSC / Worker / edge export condition (`react-server`,\n * `worker`, `workerd`, `edge-light`, `deno`) — i.e. the RSC server graph or a\n * Cloudflare Worker. (Plain Node and jsdom/happy-dom test runners resolve the\n * real build instead, which self-guards at runtime.)\n *\n * It presents the **exact same public API and types** as the real bridge (both\n * extend {@link BridgeDataMethods}, so the ~46 data methods + `upload()` are\n * shared), but its runtime does nothing that needs a browser:\n *\n * - the **constructor is a no-op** (stores nothing, touches no globals) so a\n * component that references the bridge renders on the server without crashing;\n * - **`destroy()` is a no-op**, so it is safe to call from a React effect cleanup\n * that runs during SSR;\n * - **every other method throws / rejects** with `BridgeError` code\n * `'SERVER_ENVIRONMENT'`, making the client/server boundary explicit.\n *\n * There is no `posthog-js` reference and no DOM access anywhere in this module,\n * so bundling it into a server/edge build pulls in neither.\n */\nexport class VibeAppBridge extends BridgeDataMethods {\n /** No-op: stores nothing and touches no globals. */\n constructor(_options: VibeAppBridgeOptions = {}) {\n super()\n }\n\n request<K extends keyof RequestRegistry>(\n type: K,\n _payload: RequestRegistry[K]['payload'],\n _onProgress?: (payload: unknown) => void,\n ): Promise<RequestRegistry[K]['data']> {\n return Promise.reject(serverEnvError(`request(${String(type)})`))\n }\n\n attach(): void {\n throw serverEnvError('attach()')\n }\n\n connect(): Promise<ContextPayload> {\n return Promise.reject(serverEnvError('connect()'))\n }\n\n reportSubroute(_subroute: string, _options?: { replace?: boolean }): void {\n throw serverEnvError('reportSubroute()')\n }\n\n // Callback registration is pure in the real class (it touches no DOM), so it\n // must be safe on the server too — apps are told to wire these *before*\n // connect() and may do so during render, which also runs on the server. Match\n // the real shape: register nothing (no host can push here) and hand back a\n // no-op unsubscribe, rather than throwing.\n onSubrouteRequest(_callback: (subroute: string) => void): () => void {\n return () => {}\n }\n\n onContextChange(_callback: (ctx: ContextPayload) => void): () => void {\n return () => {}\n }\n\n onAuthChange(_callback: (auth: AuthPayload) => void): () => void {\n return () => {}\n }\n\n navigate(_path: string, _action: NavigateAction = 'push'): void {\n throw serverEnvError('navigate()')\n }\n\n navigateTo(\n _route: string,\n _routeParams?: Record<string, string>,\n _action: NavigateAction = 'push',\n ): void {\n throw serverEnvError('navigateTo()')\n }\n\n refresh(): void {\n throw serverEnvError('refresh()')\n }\n\n readonly ui = {\n setSideNav: (_payload: SetSideNavPayload): void => {\n throw serverEnvError('ui.setSideNav()')\n },\n switchSubsidiary: (_subsidiaryId: number): void => {\n throw serverEnvError('ui.switchSubsidiary()')\n },\n }\n\n invalidateCache(_payload: InvalidateCachePayload): Promise<InvalidateResult> {\n return Promise.reject(serverEnvError('invalidateCache()'))\n }\n\n track(_event: string, _properties?: Record<string, unknown>): void {\n throw serverEnvError('track()')\n }\n\n /** No-op — safe to call as a React effect cleanup that runs during SSR. */\n destroy(): void {\n /* intentionally empty */\n }\n\n // `upload()` is inherited from BridgeDataMethods; it delegates to this stub's\n // `request()`, which rejects with SERVER_ENVIRONMENT — matching the real class.\n}\n","{\n \"name\": \"@nominalso/vibe-bridge\",\n \"version\": \"0.8.0\",\n \"description\": \"Iframe-side SDK for building Nominal Vibe Apps — connects an embedded app to its Nominal host over a typed postMessage bridge (context, data fetch, file upload, subroute deep-linking). Safe to import from SSR, React Server Components, and edge/Worker runtimes.\",\n \"license\": \"UNLICENSED\",\n \"homepage\": \"https://github.com/nominalso/vibe-apps-sdk#readme\",\n \"bugs\": {\n \"url\": \"https://github.com/nominalso/vibe-apps-sdk/issues\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"github:nominalso/vibe-apps-sdk\",\n \"directory\": \"packages/bridge\"\n },\n \"type\": \"module\",\n \"sideEffects\": false,\n \"types\": \"./dist/index.d.ts\",\n \"main\": \"./dist/index.browser.cjs\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"react-server\": \"./dist/index.server.js\",\n \"workerd\": \"./dist/index.server.js\",\n \"worker\": \"./dist/index.server.js\",\n \"edge-light\": \"./dist/index.server.js\",\n \"deno\": \"./dist/index.server.js\",\n \"browser\": {\n \"import\": \"./dist/index.browser.js\",\n \"require\": \"./dist/index.browser.cjs\"\n },\n \"default\": {\n \"import\": \"./dist/index.browser.js\",\n \"require\": \"./dist/index.browser.cjs\"\n }\n },\n \"./server\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.server.js\",\n \"require\": \"./dist/index.server.cjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\",\n \"docs\",\n \"AGENTS.md\",\n \"llms.txt\"\n ],\n \"publishConfig\": {\n \"registry\": \"https://registry.npmjs.org/\",\n \"access\": \"public\"\n },\n \"scripts\": {\n \"clean\": \"rm -rf dist node_modules\",\n \"build\": \"rm -rf dist && tsup\",\n \"lint\": \"eslint src\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"vitest run\"\n },\n \"optionalDependencies\": {\n \"posthog-js\": \"^1.393.5\"\n },\n \"devDependencies\": {\n \"@nominalso/vibe-api-types\": \"workspace:*\",\n \"@nominalso/vibe-protocol-types\": \"workspace:*\"\n }\n}\n","import { version } from '../package.json'\n\n/**\n * Published version of this package (`@nominalso/vibe-bridge`), sent to the host\n * in the `CONNECT` handshake. Import-safe from any environment.\n */\nexport const BRIDGE_VERSION: string = version\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBA,IAAI,eAAe,CAAC,WAAW,YAAY,QAAQ,WAAW,UAAU;AACxE,IAAI,mBAAmB,CAAC,WAAW,YAAY,UAAU;AACzD,IAAI,mBAAmB,IAAI,IAAI,YAAY;AAC3C,IAAI,uBAAuB,IAAI,IAAI,gBAAgB;AAanD,IAAI,qBAAqC,uBAAO,IAAI,oCAAoC;AACxF,IAAI,0BAA0C,uBAAO,IAAI,wCAAwC;AACjG,IAAI,cAAc,cAAc,MAAM;AAAA,EACpC,YAAY,MAAM,SAAS;AACzB,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,cAAc,KAAK;AACxB,WAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,IAAI,kBAAkB,MAAM;AAAA,EAChF;AACF;AACA,OAAO,eAAe,YAAY,WAAW,oBAAoB;AAAA,EAC/D,OAAO;AAAA,EACP,YAAY;AACd,CAAC;AACD,IAAI,kBAAkB,cAAc,YAAY;AAAA,EAC9C,YAAY,QAAQ,SAAS;AAC3B,UAAM,kBAAkB,OAAO;AAC/B,SAAK,SAAS;AACd,SAAK,OAAO;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,kBAAkB,KAAK;AAC5B,WAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,IAAI,uBAAu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EAEA,WACE,QACA,cACA,UAA0B,QACpB;AACN,UAAM,eAAe,cAAc;AAAA,EACrC;AAAA,EAEA,UAAgB;AACd,UAAM,eAAe,WAAW;AAAA,EAClC;AAAA,EAWA,gBAAgB,UAA6D;AAC3E,WAAO,QAAQ,OAAO,eAAe,mBAAmB,CAAC;AAAA,EAC3D;AAAA,EAEA,MAAM,QAAgB,aAA6C;AACjE,UAAM,eAAe,SAAS;AAAA,EAChC;AAAA;AAAA,EAGA,UAAgB;AAAA,EAEhB;AAAA;AAAA;AAIF;;;ACnIE,cAAW;;;ACIN,IAAM,iBAAyB;","names":[]}
1
+ {"version":3,"sources":["../src/index.server.ts","../../protocol-types/dist/index.js","../src/data-methods.ts","../src/server-bridge.ts","../package.json","../src/version.ts"],"sourcesContent":["// Server entry point — resolved through the `react-server`, `worker`, `workerd`,\n// `edge-light`, and `deno` export conditions (RSC / Worker / edge graphs). Plain\n// Node and jsdom/happy-dom test runners get the real build instead. It exposes the identical\n// public surface as the browser entry (same types, same symbol names) but the\n// `VibeAppBridge` here is a server-safe stub: a no-op constructor + `destroy()`,\n// with every other method throwing/rejecting `BridgeError('SERVER_ENVIRONMENT')`.\n// No DOM access, no `posthog-js` — nothing to pull into a server/edge bundle.\nexport { VibeAppBridge } from './server-bridge'\nexport * from './shared-exports'\n","// src/subroute.ts\nfunction normalizeSubroute(subroute) {\n const normalized = subroute.startsWith(\"/\") ? subroute : `/${subroute}`;\n const path = normalized.split(/[?#]/)[0];\n let decoded = path;\n let prev;\n do {\n prev = decoded;\n decoded = decoded.replace(/%25/gi, \"%\").replace(/%2e/gi, \".\").replace(/%2f/gi, \"/\");\n } while (decoded !== prev);\n if (decoded.split(\"/\").some((segment) => segment === \"..\")) return null;\n return normalized;\n}\n\n// src/protocol.ts\nvar PROTOCOL_ID = \"nominal-vibe-bridge\";\nvar PROTOCOL_VERSION = 2;\nvar BRIDGE_KINDS = [\"request\", \"response\", \"push\", \"command\", \"progress\"];\nvar CORRELATED_KINDS = [\"request\", \"response\", \"progress\"];\nvar BRIDGE_KINDS_SET = new Set(BRIDGE_KINDS);\nvar CORRELATED_KINDS_SET = new Set(CORRELATED_KINDS);\nfunction isBridgeMessage(data) {\n if (typeof data !== \"object\" || data === null) return false;\n const d = data;\n if (d.__protocol !== PROTOCOL_ID) return false;\n if (d.__version !== PROTOCOL_VERSION) return false;\n if (typeof d.kind !== \"string\" || !BRIDGE_KINDS_SET.has(d.kind)) return false;\n if (typeof d.type !== \"string\") return false;\n if (CORRELATED_KINDS_SET.has(d.kind) && typeof d.requestId !== \"string\") return false;\n return true;\n}\n\n// src/errors.ts\nvar BRIDGE_ERROR_BRAND = /* @__PURE__ */ Symbol.for(\"@nominalso/vibe-bridge:BridgeError\");\nvar HTTP_BRIDGE_ERROR_BRAND = /* @__PURE__ */ Symbol.for(\"@nominalso/vibe-bridge:HttpBridgeError\");\nvar BridgeError = class extends Error {\n constructor(code, message) {\n super(message);\n this.code = code;\n this.name = \"BridgeError\";\n }\n /**\n * Cross-realm-safe type guard. Prefer this over `instanceof BridgeError` when\n * an error may have been thrown by a differently-built copy of the SDK (e.g.\n * server bundle vs client bundle) — it matches on a process-global brand\n * rather than class identity.\n */\n static isBridgeError(err) {\n return typeof err === \"object\" && err !== null && err[BRIDGE_ERROR_BRAND] === true;\n }\n};\nObject.defineProperty(BridgeError.prototype, BRIDGE_ERROR_BRAND, {\n value: true,\n enumerable: false\n});\nvar HttpBridgeError = class extends BridgeError {\n constructor(status, message) {\n super(\"REQUEST_FAILED\", message);\n this.status = status;\n this.name = \"HttpBridgeError\";\n }\n /**\n * Cross-realm-safe type guard (see {@link BridgeError.isBridgeError}). Returns\n * `true` only for `HttpBridgeError` instances, not plain `BridgeError`s.\n */\n static isHttpBridgeError(err) {\n return typeof err === \"object\" && err !== null && err[HTTP_BRIDGE_ERROR_BRAND] === true;\n }\n};\nObject.defineProperty(HttpBridgeError.prototype, HTTP_BRIDGE_ERROR_BRAND, {\n value: true,\n enumerable: false\n});\n\n// src/origins.ts\nfunction isOriginPattern(entry) {\n return entry.includes(\"*\");\n}\nvar patternCache = /* @__PURE__ */ new Map();\nfunction patternToRegExp(pattern) {\n const cached = patternCache.get(pattern);\n if (cached) return cached;\n const escaped = pattern.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const body = escaped.replace(/\\\\\\*/g, \"[^./:@?#\\\\s]+\");\n const compiled = new RegExp(`^${body}$`);\n patternCache.set(pattern, compiled);\n return compiled;\n}\nfunction matchesOrigin(origin, entry) {\n if (!isOriginPattern(entry)) return origin === entry;\n return patternToRegExp(entry).test(origin);\n}\nfunction isOriginAllowed(origin, allowlist, { allowPatterns }) {\n for (const entry of allowlist) {\n if (isOriginPattern(entry)) {\n if (allowPatterns && matchesOrigin(origin, entry)) return true;\n } else if (origin === entry) {\n return true;\n }\n }\n return false;\n}\nexport {\n BridgeError,\n HttpBridgeError,\n PROTOCOL_ID,\n PROTOCOL_VERSION,\n isBridgeMessage,\n isOriginAllowed,\n isOriginPattern,\n matchesOrigin,\n normalizeSubroute\n};\n","import type { RequestRegistry } from '@nominalso/vibe-protocol-types'\n\nexport interface UploadOptions {\n /** Domain entity the file attaches to, e.g. `'JOURNAL_ENTRY'`. */\n entityType: string\n /** Id of the entity the file attaches to, when applicable. */\n entityId?: string | number\n /** Called with incremental progress (`0`–`100`) while the upload streams. */\n onProgress?: (p: RequestRegistry['UPLOAD_FILE']['progress']) => void\n}\n\n/**\n * The typed Nominal data methods (~46) plus {@link BridgeDataMethods.upload},\n * factored onto a base class so {@link VibeAppBridge} stays focused on\n * connection/transport. Each method is a thin typed wrapper over `request()`;\n * `VibeAppBridge` provides the concrete `request` implementation.\n */\nexport abstract class BridgeDataMethods {\n /**\n * Low-level typed request for **any** operation in {@link RequestRegistry} —\n * implemented by {@link VibeAppBridge}. The named methods below wrap this.\n */\n abstract request<K extends keyof RequestRegistry>(\n type: K,\n payload: RequestRegistry[K]['payload'],\n onProgress?: (payload: unknown) => void,\n ): Promise<RequestRegistry[K]['data']>\n\n // ---------------------------------------------------------------------------\n // Operations — Accounting: chart of accounts\n //\n // Each method is a typed wrapper over `request('<OP>', payload)`. The payload\n // and return types come straight from the Nominal API (`RequestRegistry`).\n // For any operation without a named method, call `request('<OP>', payload)`.\n // ---------------------------------------------------------------------------\n\n /**\n * Fetch the flat chart of accounts for a subsidiary.\n *\n * @example\n * ```ts\n * const ctx = await bridge.connect()\n * const accounts = await bridge.getChartOfAccounts({\n * path: { subsidiary_id: ctx.subsidiaryId },\n * })\n * ```\n */\n getChartOfAccounts(\n payload: RequestRegistry['GET_CHART_OF_ACCOUNTS']['payload'],\n ): Promise<RequestRegistry['GET_CHART_OF_ACCOUNTS']['data']> {\n return this.request('GET_CHART_OF_ACCOUNTS', payload)\n }\n\n /** Fetch the chart of accounts as a hierarchical tree for a subsidiary. */\n getCoaTree(\n payload: RequestRegistry['GET_COA_TREE']['payload'],\n ): Promise<RequestRegistry['GET_COA_TREE']['data']> {\n return this.request('GET_COA_TREE', payload)\n }\n\n /** Fetch a simplified flat chart of accounts for a subsidiary. */\n getCoaFlatSimple(\n payload: RequestRegistry['GET_COA_FLAT_SIMPLE']['payload'],\n ): Promise<RequestRegistry['GET_COA_FLAT_SIMPLE']['data']> {\n return this.request('GET_COA_FLAT_SIMPLE', payload)\n }\n\n /** Fetch the flat chart of accounts grouped by account group. */\n getCoaGrouped(\n payload: RequestRegistry['GET_COA_GROUPED']['payload'],\n ): Promise<RequestRegistry['GET_COA_GROUPED']['data']> {\n return this.request('GET_COA_GROUPED', payload)\n }\n\n /** Fetch a single chart-of-accounts account by id within a subsidiary. */\n getCoaAccount(\n payload: RequestRegistry['GET_COA_ACCOUNT']['payload'],\n ): Promise<RequestRegistry['GET_COA_ACCOUNT']['data']> {\n return this.request('GET_COA_ACCOUNT', payload)\n }\n\n /** List the currencies available to a subsidiary's chart of accounts. */\n getSubsidiaryAvailableCurrencies(\n payload: RequestRegistry['GET_SUBSIDIARY_AVAILABLE_CURRENCIES']['payload'],\n ): Promise<RequestRegistry['GET_SUBSIDIARY_AVAILABLE_CURRENCIES']['data']> {\n return this.request('GET_SUBSIDIARY_AVAILABLE_CURRENCIES', payload)\n }\n\n /** Fetch accounts at the tenant level. */\n getAccounts(\n payload: RequestRegistry['GET_ACCOUNTS']['payload'],\n ): Promise<RequestRegistry['GET_ACCOUNTS']['data']> {\n return this.request('GET_ACCOUNTS', payload)\n }\n\n /** Fetch a single account by id. */\n getAccount(\n payload: RequestRegistry['GET_ACCOUNT']['payload'],\n ): Promise<RequestRegistry['GET_ACCOUNT']['data']> {\n return this.request('GET_ACCOUNT', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Accounting: exchange rates\n // ---------------------------------------------------------------------------\n\n /** Fetch currency conversion rates for a currency. */\n getConversionRates(\n payload: RequestRegistry['GET_CONVERSION_RATES']['payload'],\n ): Promise<RequestRegistry['GET_CONVERSION_RATES']['data']> {\n return this.request('GET_CONVERSION_RATES', payload)\n }\n\n /** Fetch the effective consolidation exchange rate. */\n getEffectiveExchangeRate(\n payload: RequestRegistry['GET_EFFECTIVE_EXCHANGE_RATE']['payload'],\n ): Promise<RequestRegistry['GET_EFFECTIVE_EXCHANGE_RATE']['data']> {\n return this.request('GET_EFFECTIVE_EXCHANGE_RATE', payload)\n }\n\n /** Fetch the exchange-rate period covering a given input date. */\n getExchangeRateByDate(\n payload: RequestRegistry['GET_EXCHANGE_RATE_BY_DATE']['payload'],\n ): Promise<RequestRegistry['GET_EXCHANGE_RATE_BY_DATE']['data']> {\n return this.request('GET_EXCHANGE_RATE_BY_DATE', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Accounting: dimensions\n // ---------------------------------------------------------------------------\n\n /** List accounting dimensions. */\n getDimensions(\n payload: RequestRegistry['GET_DIMENSIONS']['payload'],\n ): Promise<RequestRegistry['GET_DIMENSIONS']['data']> {\n return this.request('GET_DIMENSIONS', payload)\n }\n\n /** List values for accounting dimensions. */\n getDimensionValues(\n payload: RequestRegistry['GET_DIMENSION_VALUES']['payload'],\n ): Promise<RequestRegistry['GET_DIMENSION_VALUES']['data']> {\n return this.request('GET_DIMENSION_VALUES', payload)\n }\n\n /** List dimension values in hierarchical form. */\n getDimensionValuesHierarchical(\n payload: RequestRegistry['GET_DIMENSION_VALUES_HIERARCHICAL']['payload'],\n ): Promise<RequestRegistry['GET_DIMENSION_VALUES_HIERARCHICAL']['data']> {\n return this.request('GET_DIMENSION_VALUES_HIERARCHICAL', payload)\n }\n\n /** List account assignments for a dimension/account pair. */\n getDimensionAccountAssignments(\n payload: RequestRegistry['GET_DIMENSION_ACCOUNT_ASSIGNMENTS']['payload'],\n ): Promise<RequestRegistry['GET_DIMENSION_ACCOUNT_ASSIGNMENTS']['data']> {\n return this.request('GET_DIMENSION_ACCOUNT_ASSIGNMENTS', payload)\n }\n\n /** Get dimension-value balances for a dimension over a date window. */\n getDimensionBalance(\n payload: RequestRegistry['GET_DIMENSION_BALANCE']['payload'],\n ): Promise<RequestRegistry['GET_DIMENSION_BALANCE']['data']> {\n return this.request('GET_DIMENSION_BALANCE', payload)\n }\n\n /** Add a new value under an existing dimension. */\n addDimensionValue(\n payload: RequestRegistry['ADD_DIMENSION_VALUE']['payload'],\n ): Promise<RequestRegistry['ADD_DIMENSION_VALUE']['data']> {\n return this.request('ADD_DIMENSION_VALUE', payload)\n }\n\n /** Set or override the dimension value on a single journal-entry line. */\n setLineDimensionValue(\n payload: RequestRegistry['SET_LINE_DIMENSION_VALUE']['payload'],\n ): Promise<RequestRegistry['SET_LINE_DIMENSION_VALUE']['data']> {\n return this.request('SET_LINE_DIMENSION_VALUE', payload)\n }\n\n /** Bulk-assign a dimension value to many journal-entry lines at once. */\n bulkSetLineDimensionValue(\n payload: RequestRegistry['BULK_SET_LINE_DIMENSION_VALUE']['payload'],\n ): Promise<RequestRegistry['BULK_SET_LINE_DIMENSION_VALUE']['data']> {\n return this.request('BULK_SET_LINE_DIMENSION_VALUE', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Accounting: journal entries\n // ---------------------------------------------------------------------------\n\n /**\n * Fetch journal entries for a subsidiary, optionally filtered by date range.\n *\n * @example\n * ```ts\n * const entries = await bridge.getJournalEntries({\n * path: { subsidiary_id: ctx.subsidiaryId },\n * query: { from_date: '2026-01-01', to_date: '2026-03-31' },\n * })\n * ```\n */\n getJournalEntries(\n payload: RequestRegistry['GET_JOURNAL_ENTRIES']['payload'],\n ): Promise<RequestRegistry['GET_JOURNAL_ENTRIES']['data']> {\n return this.request('GET_JOURNAL_ENTRIES', payload)\n }\n\n /** Fetch journal entry lines for a subsidiary. */\n getJournalLines(\n payload: RequestRegistry['GET_JOURNAL_LINES']['payload'],\n ): Promise<RequestRegistry['GET_JOURNAL_LINES']['data']> {\n return this.request('GET_JOURNAL_LINES', payload)\n }\n\n /** Fetch a single journal entry by id within a subsidiary. */\n getJournalEntry(\n payload: RequestRegistry['GET_JOURNAL_ENTRY']['payload'],\n ): Promise<RequestRegistry['GET_JOURNAL_ENTRY']['data']> {\n return this.request('GET_JOURNAL_ENTRY', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Activity: period instances\n // ---------------------------------------------------------------------------\n\n /** List accounting period instances. */\n getPeriods(\n payload: RequestRegistry['GET_PERIODS']['payload'],\n ): Promise<RequestRegistry['GET_PERIODS']['data']> {\n return this.request('GET_PERIODS', payload)\n }\n\n /** Fetch a single period instance by id. */\n getPeriodInstance(\n payload: RequestRegistry['GET_PERIOD_INSTANCE']['payload'],\n ): Promise<RequestRegistry['GET_PERIOD_INSTANCE']['data']> {\n return this.request('GET_PERIOD_INSTANCE', payload)\n }\n\n /** Fetch a period instance by its display slug (e.g. `\"mar-2026\"`). */\n getPeriodInstanceBySlug(\n payload: RequestRegistry['GET_PERIOD_INSTANCE_BY_SLUG']['payload'],\n ): Promise<RequestRegistry['GET_PERIOD_INSTANCE_BY_SLUG']['data']> {\n return this.request('GET_PERIOD_INSTANCE_BY_SLUG', payload)\n }\n\n /** Fetch the close-progress breakdown for a period (by slug). */\n getPeriodProgressBreakdown(\n payload: RequestRegistry['GET_PERIOD_PROGRESS_BREAKDOWN']['payload'],\n ): Promise<RequestRegistry['GET_PERIOD_PROGRESS_BREAKDOWN']['data']> {\n return this.request('GET_PERIOD_PROGRESS_BREAKDOWN', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Activity: activity definitions\n // ---------------------------------------------------------------------------\n\n /** List activity definitions. */\n getActivityDefinitions(\n payload: RequestRegistry['GET_ACTIVITY_DEFINITIONS']['payload'],\n ): Promise<RequestRegistry['GET_ACTIVITY_DEFINITIONS']['data']> {\n return this.request('GET_ACTIVITY_DEFINITIONS', payload)\n }\n\n /** Fetch a single activity definition by id. */\n getActivityDefinition(\n payload: RequestRegistry['GET_ACTIVITY_DEFINITION']['payload'],\n ): Promise<RequestRegistry['GET_ACTIVITY_DEFINITION']['data']> {\n return this.request('GET_ACTIVITY_DEFINITION', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Activity: activity instances\n // ---------------------------------------------------------------------------\n\n /** List activity instances. */\n getActivityInstances(\n payload: RequestRegistry['GET_ACTIVITY_INSTANCES']['payload'],\n ): Promise<RequestRegistry['GET_ACTIVITY_INSTANCES']['data']> {\n return this.request('GET_ACTIVITY_INSTANCES', payload)\n }\n\n /** Fetch a single activity instance by id. */\n getActivityInstance(\n payload: RequestRegistry['GET_ACTIVITY_INSTANCE']['payload'],\n ): Promise<RequestRegistry['GET_ACTIVITY_INSTANCE']['data']> {\n return this.request('GET_ACTIVITY_INSTANCE', payload)\n }\n\n /** Fetch an activity instance for a given period + activity definition. */\n getActivityInstanceByPeriod(\n payload: RequestRegistry['GET_ACTIVITY_INSTANCE_BY_PERIOD']['payload'],\n ): Promise<RequestRegistry['GET_ACTIVITY_INSTANCE_BY_PERIOD']['data']> {\n return this.request('GET_ACTIVITY_INSTANCE_BY_PERIOD', payload)\n }\n\n /** List task instances for an activity instance. */\n getActivityInstanceTasks(\n payload: RequestRegistry['GET_ACTIVITY_INSTANCE_TASKS']['payload'],\n ): Promise<RequestRegistry['GET_ACTIVITY_INSTANCE_TASKS']['data']> {\n return this.request('GET_ACTIVITY_INSTANCE_TASKS', payload)\n }\n\n /** List task instances for an activity in a given period. */\n getActivityPeriodTasks(\n payload: RequestRegistry['GET_ACTIVITY_PERIOD_TASKS']['payload'],\n ): Promise<RequestRegistry['GET_ACTIVITY_PERIOD_TASKS']['data']> {\n return this.request('GET_ACTIVITY_PERIOD_TASKS', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Activity: task definitions\n // ---------------------------------------------------------------------------\n\n /** List task definitions. */\n getTaskDefinitions(\n payload: RequestRegistry['GET_TASK_DEFINITIONS']['payload'],\n ): Promise<RequestRegistry['GET_TASK_DEFINITIONS']['data']> {\n return this.request('GET_TASK_DEFINITIONS', payload)\n }\n\n /** Fetch a single task definition by id. */\n getTaskDefinition(\n payload: RequestRegistry['GET_TASK_DEFINITION']['payload'],\n ): Promise<RequestRegistry['GET_TASK_DEFINITION']['data']> {\n return this.request('GET_TASK_DEFINITION', payload)\n }\n\n /** Create a task definition. */\n createTaskDefinition(\n payload: RequestRegistry['CREATE_TASK_DEFINITION']['payload'],\n ): Promise<RequestRegistry['CREATE_TASK_DEFINITION']['data']> {\n return this.request('CREATE_TASK_DEFINITION', payload)\n }\n\n /** Update a task definition by id. */\n updateTaskDefinition(\n payload: RequestRegistry['UPDATE_TASK_DEFINITION']['payload'],\n ): Promise<RequestRegistry['UPDATE_TASK_DEFINITION']['data']> {\n return this.request('UPDATE_TASK_DEFINITION', payload)\n }\n\n /** Query task definitions by filter. */\n getTaskDefinitionsByFilter(\n payload: RequestRegistry['GET_TASK_DEFINITIONS_BY_FILTER']['payload'],\n ): Promise<RequestRegistry['GET_TASK_DEFINITIONS_BY_FILTER']['data']> {\n return this.request('GET_TASK_DEFINITIONS_BY_FILTER', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Activity: task instances\n // ---------------------------------------------------------------------------\n\n /** List task instances. */\n getTaskInstances(\n payload: RequestRegistry['GET_TASK_INSTANCES']['payload'],\n ): Promise<RequestRegistry['GET_TASK_INSTANCES']['data']> {\n return this.request('GET_TASK_INSTANCES', payload)\n }\n\n /** Fetch a single task instance by id. */\n getTaskInstance(\n payload: RequestRegistry['GET_TASK_INSTANCE']['payload'],\n ): Promise<RequestRegistry['GET_TASK_INSTANCE']['data']> {\n return this.request('GET_TASK_INSTANCE', payload)\n }\n\n /**\n * Submit a Close-Management task output. This is the **only write path** back\n * into Nominal — Vibe Apps never write Nominal data directly.\n *\n * @example\n * ```ts\n * // `body` carries the task-specific output shape.\n * await bridge.postTaskOutput({\n * path: { task_instance_id: 'task-1' },\n * body: {},\n * })\n * ```\n */\n postTaskOutput(\n payload: RequestRegistry['POST_TASK_OUTPUT']['payload'],\n ): Promise<RequestRegistry['POST_TASK_OUTPUT']['data']> {\n return this.request('POST_TASK_OUTPUT', payload)\n }\n\n /** Query task instances by filter. */\n getTaskInstancesByFilter(\n payload: RequestRegistry['GET_TASK_INSTANCES_BY_FILTER']['payload'],\n ): Promise<RequestRegistry['GET_TASK_INSTANCES_BY_FILTER']['data']> {\n return this.request('GET_TASK_INSTANCES_BY_FILTER', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Audit trail\n // ---------------------------------------------------------------------------\n\n /** List audit-trail events. */\n getAuditEvents(\n payload: RequestRegistry['GET_AUDIT_EVENTS']['payload'],\n ): Promise<RequestRegistry['GET_AUDIT_EVENTS']['data']> {\n return this.request('GET_AUDIT_EVENTS', payload)\n }\n\n /** List audit-trail events for a specific entity. */\n getEntityAuditEvents(\n payload: RequestRegistry['GET_ENTITY_AUDIT_EVENTS']['payload'],\n ): Promise<RequestRegistry['GET_ENTITY_AUDIT_EVENTS']['data']> {\n return this.request('GET_ENTITY_AUDIT_EVENTS', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Period manager: fiscal calendars\n // ---------------------------------------------------------------------------\n\n /** List fiscal calendars for a subsidiary. */\n getFiscalCalendars(\n payload: RequestRegistry['GET_FISCAL_CALENDARS']['payload'],\n ): Promise<RequestRegistry['GET_FISCAL_CALENDARS']['data']> {\n return this.request('GET_FISCAL_CALENDARS', payload)\n }\n\n /** Fetch a single fiscal calendar by id. */\n getFiscalCalendar(\n payload: RequestRegistry['GET_FISCAL_CALENDAR']['payload'],\n ): Promise<RequestRegistry['GET_FISCAL_CALENDAR']['data']> {\n return this.request('GET_FISCAL_CALENDAR', payload)\n }\n\n // ---------------------------------------------------------------------------\n // Operations — Tenancy\n // ---------------------------------------------------------------------------\n\n /** List subsidiaries for the tenant. */\n getSubsidiaries(\n payload: RequestRegistry['GET_SUBSIDIARIES']['payload'],\n ): Promise<RequestRegistry['GET_SUBSIDIARIES']['data']> {\n return this.request('GET_SUBSIDIARIES', payload)\n }\n\n /** Fetch a single subsidiary by id. */\n getSubsidiary(\n payload: RequestRegistry['GET_SUBSIDIARY']['payload'],\n ): Promise<RequestRegistry['GET_SUBSIDIARY']['data']> {\n return this.request('GET_SUBSIDIARY', payload)\n }\n\n /** List parent currencies for a subsidiary. */\n getSubsidiaryParentCurrencies(\n payload: RequestRegistry['GET_SUBSIDIARY_PARENT_CURRENCIES']['payload'],\n ): Promise<RequestRegistry['GET_SUBSIDIARY_PARENT_CURRENCIES']['data']> {\n return this.request('GET_SUBSIDIARY_PARENT_CURRENCIES', payload)\n }\n\n /** List users for the tenant. */\n getTenantUsers(\n payload: RequestRegistry['GET_TENANT_USERS']['payload'],\n ): Promise<RequestRegistry['GET_TENANT_USERS']['data']> {\n return this.request('GET_TENANT_USERS', payload)\n }\n\n /**\n * Uploads a file through the host. Converts the `File` to an `ArrayBuffer`\n * before sending — sandboxed iframes cannot pass `File` handles across\n * windows. Resolves once Nominal has stored the file.\n *\n * @example\n * ```ts\n * const input = document.querySelector<HTMLInputElement>('#file')!\n * const file = input.files![0]\n * const result = await bridge.upload(file, {\n * entityType: 'JOURNAL_ENTRY',\n * entityId: '123',\n * onProgress: (p) => console.log(`${p.progress}%`),\n * })\n * // result.attachmentId, result.name\n * ```\n */\n async upload(\n file: File,\n options: UploadOptions,\n ): Promise<RequestRegistry['UPLOAD_FILE']['data']> {\n const buffer = await file.arrayBuffer()\n const payload: RequestRegistry['UPLOAD_FILE']['payload'] = {\n buffer,\n fileName: file.name,\n fileType: file.type,\n entityType: options.entityType,\n entityId: options.entityId,\n }\n const onProgress = options.onProgress\n ? (p: unknown): void => options.onProgress!(p as RequestRegistry['UPLOAD_FILE']['progress'])\n : undefined\n return this.request('UPLOAD_FILE', payload, onProgress)\n }\n}\n","import { BridgeError } from '@nominalso/vibe-protocol-types'\nimport type {\n AuthPayload,\n ContextPayload,\n InvalidateCachePayload,\n InvalidateResult,\n NavigateAction,\n RequestRegistry,\n SetSideNavPayload,\n} from '@nominalso/vibe-protocol-types'\nimport type { VibeAppBridgeOptions } from './options'\nimport { BridgeDataMethods } from './data-methods'\n\n/**\n * The server/RSC/Worker build's error. Thrown (or rejected) by every method of\n * the {@link VibeAppBridge} stub so a call made outside the browser fails with a\n * clear, coded message instead of a cryptic `window is not defined`.\n */\nfunction serverEnvError(method: string): BridgeError {\n return new BridgeError(\n 'SERVER_ENVIRONMENT',\n `VibeAppBridge.${method} is not available on the server. This build of ` +\n `@nominalso/vibe-bridge was resolved through a server / React Server Component / ` +\n `Worker export condition — construct and drive the bridge from the browser ` +\n `(a client component or an effect), not during SSR or in a Server Component.`,\n )\n}\n\n/**\n * **Server-safe stub of {@link import('./VibeAppBridge').VibeAppBridge}.** This\n * is the class exported from `@nominalso/vibe-bridge` when the package is\n * resolved through an RSC / Worker / edge export condition (`react-server`,\n * `worker`, `workerd`, `edge-light`, `deno`) — i.e. the RSC server graph or a\n * Cloudflare Worker. (Plain Node and jsdom/happy-dom test runners resolve the\n * real build instead, which self-guards at runtime.)\n *\n * It presents the **exact same public API and types** as the real bridge (both\n * extend {@link BridgeDataMethods}, so the ~46 data methods + `upload()` are\n * shared), but its runtime does nothing that needs a browser:\n *\n * - the **constructor is a no-op** (stores nothing, touches no globals) so a\n * component that references the bridge renders on the server without crashing;\n * - **`destroy()` is a no-op**, so it is safe to call from a React effect cleanup\n * that runs during SSR;\n * - **every other method throws / rejects** with `BridgeError` code\n * `'SERVER_ENVIRONMENT'`, making the client/server boundary explicit.\n *\n * There is no `posthog-js` reference and no DOM access anywhere in this module,\n * so bundling it into a server/edge build pulls in neither.\n */\nexport class VibeAppBridge extends BridgeDataMethods {\n /** No-op: stores nothing and touches no globals. */\n constructor(_options: VibeAppBridgeOptions = {}) {\n super()\n }\n\n request<K extends keyof RequestRegistry>(\n type: K,\n _payload: RequestRegistry[K]['payload'],\n _onProgress?: (payload: unknown) => void,\n ): Promise<RequestRegistry[K]['data']> {\n return Promise.reject(serverEnvError(`request(${String(type)})`))\n }\n\n attach(): void {\n throw serverEnvError('attach()')\n }\n\n connect(): Promise<ContextPayload> {\n return Promise.reject(serverEnvError('connect()'))\n }\n\n reportSubroute(_subroute: string, _options?: { replace?: boolean }): void {\n throw serverEnvError('reportSubroute()')\n }\n\n // Callback registration is pure in the real class (it touches no DOM), so it\n // must be safe on the server too — apps are told to wire these *before*\n // connect() and may do so during render, which also runs on the server. Match\n // the real shape: register nothing (no host can push here) and hand back a\n // no-op unsubscribe, rather than throwing.\n onSubrouteRequest(_callback: (subroute: string) => void): () => void {\n return () => {}\n }\n\n onContextChange(_callback: (ctx: ContextPayload) => void): () => void {\n return () => {}\n }\n\n onAuthChange(_callback: (auth: AuthPayload) => void): () => void {\n return () => {}\n }\n\n navigate(_path: string, _action: NavigateAction = 'push'): void {\n throw serverEnvError('navigate()')\n }\n\n navigateTo(\n _route: string,\n _routeParams?: Record<string, string>,\n _action: NavigateAction = 'push',\n ): void {\n throw serverEnvError('navigateTo()')\n }\n\n refresh(): void {\n throw serverEnvError('refresh()')\n }\n\n readonly ui = {\n setSideNav: (_payload: SetSideNavPayload): void => {\n throw serverEnvError('ui.setSideNav()')\n },\n switchSubsidiary: (_subsidiaryId: number): void => {\n throw serverEnvError('ui.switchSubsidiary()')\n },\n }\n\n invalidateCache(_payload: InvalidateCachePayload): Promise<InvalidateResult> {\n return Promise.reject(serverEnvError('invalidateCache()'))\n }\n\n track(_event: string, _properties?: Record<string, unknown>): void {\n throw serverEnvError('track()')\n }\n\n /** No-op — safe to call as a React effect cleanup that runs during SSR. */\n destroy(): void {\n /* intentionally empty */\n }\n\n // `upload()` is inherited from BridgeDataMethods; it delegates to this stub's\n // `request()`, which rejects with SERVER_ENVIRONMENT — matching the real class.\n}\n","{\n \"name\": \"@nominalso/vibe-bridge\",\n \"version\": \"0.8.1\",\n \"description\": \"Iframe-side SDK for building Nominal Vibe Apps — connects an embedded app to its Nominal host over a typed postMessage bridge (context, data fetch, file upload, subroute deep-linking). Safe to import from SSR, React Server Components, and edge/Worker runtimes.\",\n \"license\": \"UNLICENSED\",\n \"homepage\": \"https://github.com/nominalso/vibe-apps-sdk#readme\",\n \"bugs\": {\n \"url\": \"https://github.com/nominalso/vibe-apps-sdk/issues\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"github:nominalso/vibe-apps-sdk\",\n \"directory\": \"packages/bridge\"\n },\n \"type\": \"module\",\n \"sideEffects\": false,\n \"types\": \"./dist/index.d.ts\",\n \"main\": \"./dist/index.browser.cjs\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"react-server\": \"./dist/index.server.js\",\n \"workerd\": \"./dist/index.server.js\",\n \"worker\": \"./dist/index.server.js\",\n \"edge-light\": \"./dist/index.server.js\",\n \"deno\": \"./dist/index.server.js\",\n \"browser\": {\n \"import\": \"./dist/index.browser.js\",\n \"require\": \"./dist/index.browser.cjs\"\n },\n \"default\": {\n \"import\": \"./dist/index.browser.js\",\n \"require\": \"./dist/index.browser.cjs\"\n }\n },\n \"./server\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.server.js\",\n \"require\": \"./dist/index.server.cjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\",\n \"docs\",\n \"AGENTS.md\",\n \"llms.txt\"\n ],\n \"publishConfig\": {\n \"registry\": \"https://registry.npmjs.org/\",\n \"access\": \"public\"\n },\n \"scripts\": {\n \"clean\": \"rm -rf dist node_modules\",\n \"build\": \"rm -rf dist && tsup\",\n \"lint\": \"eslint src\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"vitest run\"\n },\n \"optionalDependencies\": {\n \"posthog-js\": \"^1.393.5\"\n },\n \"devDependencies\": {\n \"@nominalso/vibe-api-types\": \"workspace:*\",\n \"@nominalso/vibe-protocol-types\": \"workspace:*\"\n }\n}\n","import { version } from '../package.json'\n\n/**\n * Published version of this package (`@nominalso/vibe-bridge`), sent to the host\n * in the `CONNECT` handshake. Import-safe from any environment.\n */\nexport const BRIDGE_VERSION: string = version\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBA,IAAI,eAAe,CAAC,WAAW,YAAY,QAAQ,WAAW,UAAU;AACxE,IAAI,mBAAmB,CAAC,WAAW,YAAY,UAAU;AACzD,IAAI,mBAAmB,IAAI,IAAI,YAAY;AAC3C,IAAI,uBAAuB,IAAI,IAAI,gBAAgB;AAanD,IAAI,qBAAqC,uBAAO,IAAI,oCAAoC;AACxF,IAAI,0BAA0C,uBAAO,IAAI,wCAAwC;AACjG,IAAI,cAAc,cAAc,MAAM;AAAA,EACpC,YAAY,MAAM,SAAS;AACzB,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,cAAc,KAAK;AACxB,WAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,IAAI,kBAAkB,MAAM;AAAA,EAChF;AACF;AACA,OAAO,eAAe,YAAY,WAAW,oBAAoB;AAAA,EAC/D,OAAO;AAAA,EACP,YAAY;AACd,CAAC;A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AO,MAAM;AAAA,IAAC;AAAA,EAChB;AAAA,EAEA,gBAAgB,WAAsD;AACpE,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AAAA,EAEA,aAAa,WAAoD;AAC/D,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AAAA,EAEA,SAAS,OAAe,UAA0B,QAAc;AAC9D,UAAM,eAAe,YAAY;AAAA,EACnC;AAAA,EAEA,WACE,QACA,cACA,UAA0B,QACpB;AACN,UAAM,eAAe,cAAc;AAAA,EACrC;AAAA,EAEA,UAAgB;AACd,UAAM,eAAe,WAAW;AAAA,EAClC;AAAA,EAWA,gBAAgB,UAA6D;AAC3E,WAAO,QAAQ,OAAO,eAAe,mBAAmB,CAAC;AAAA,EAC3D;AAAA,EAEA,MAAM,QAAgB,aAA6C;AACjE,UAAM,eAAe,SAAS;AAAA,EAChC;AAAA;AAAA,EAGA,UAAgB;AAAA,EAEhB;AAAA;AAAA;AAIF;;;ACnIE,cAAW;;;ACIN,IAAM,iBAAyB;","names":[]}
@@ -1,5 +1,5 @@
1
- import { B as BridgeDataMethods, V as VibeAppBridgeOptions, R as RequestRegistry, C as ContextPayload, A as AuthPayload, N as NavigateAction, S as SetSideNavPayload, I as InvalidateCachePayload, a as InvalidateResult } from './version-yG6_fNT5.cjs';
2
- export { b as BRIDGE_VERSION, c as BridgeError, d as BridgeSubsidiary, H as HttpBridgeError, P as PostHogContext, U as UploadOptions, e as UploadProgress, f as UploadResponse } from './version-yG6_fNT5.cjs';
1
+ import { B as BridgeDataMethods, V as VibeAppBridgeOptions, R as RequestRegistry, C as ContextPayload, A as AuthPayload, N as NavigateAction, S as SetSideNavPayload, I as InvalidateCachePayload, a as InvalidateResult } from './version-08MdcXcY.cjs';
2
+ export { b as BRIDGE_VERSION, c as BridgeError, d as BridgeSubsidiary, H as HttpBridgeError, P as PostHogContext, U as UploadOptions, e as UploadProgress, f as UploadResponse } from './version-08MdcXcY.cjs';
3
3
 
4
4
  /**
5
5
  * **Server-safe stub of {@link import('./VibeAppBridge').VibeAppBridge}.** This
@@ -1,5 +1,5 @@
1
- import { B as BridgeDataMethods, V as VibeAppBridgeOptions, R as RequestRegistry, C as ContextPayload, A as AuthPayload, N as NavigateAction, S as SetSideNavPayload, I as InvalidateCachePayload, a as InvalidateResult } from './version-yG6_fNT5.js';
2
- export { b as BRIDGE_VERSION, c as BridgeError, d as BridgeSubsidiary, H as HttpBridgeError, P as PostHogContext, U as UploadOptions, e as UploadProgress, f as UploadResponse } from './version-yG6_fNT5.js';
1
+ import { B as BridgeDataMethods, V as VibeAppBridgeOptions, R as RequestRegistry, C as ContextPayload, A as AuthPayload, N as NavigateAction, S as SetSideNavPayload, I as InvalidateCachePayload, a as InvalidateResult } from './version-08MdcXcY.js';
2
+ export { b as BRIDGE_VERSION, c as BridgeError, d as BridgeSubsidiary, H as HttpBridgeError, P as PostHogContext, U as UploadOptions, e as UploadProgress, f as UploadResponse } from './version-08MdcXcY.js';
3
3
 
4
4
  /**
5
5
  * **Server-safe stub of {@link import('./VibeAppBridge').VibeAppBridge}.** This
@@ -3,7 +3,7 @@ import {
3
3
  BridgeDataMethods,
4
4
  BridgeError,
5
5
  HttpBridgeError
6
- } from "./chunk-5P74A5S7.js";
6
+ } from "./chunk-7ET6VUWW.js";
7
7
 
8
8
  // src/server-bridge.ts
9
9
  function serverEnvError(method) {
@@ -9,7 +9,7 @@ type AccountingAccountType = 'Bank' | 'Current Asset' | 'Non-current Asset' | 'F
9
9
  type AccountingAccountingClass = 'Asset' | 'Equity' | 'Liability' | 'Revenue' | 'Expense' | 'Statistical';
10
10
  type AccountingBalanceOutput = {
11
11
  balance?: number;
12
- currency?: AccountingCurrency | null;
12
+ currency?: string | null;
13
13
  };
14
14
  type AccountingBulkSetLineDimensionValueRequest = {
15
15
  dimension_id: string;
@@ -88,14 +88,15 @@ type AccountingDimensionValue = {
88
88
  has_children?: boolean;
89
89
  };
90
90
  /**
91
- * SDK-facing shape of a single dimension value's movement balance over the requested window.
91
+ * SDK-facing shape of a single account + dimension value's movement balance over the requested window.
92
92
  *
93
- * Mirrors the internal DimensionBalance — primary/secondary currency amounts, their credit/debit
93
+ * Mirrors the internal DimensionAccountBalance — primary/secondary currency amounts, their credit/debit
94
94
  * splits, and CTA — so the Rollforward has the full breakdown, but as a stable Response type
95
95
  * decoupled from the aggregation model. Field names match the source so it maps via
96
96
  * model_validate(from_attributes).
97
97
  */
98
98
  type AccountingDimensionValueBalanceResponse = {
99
+ account_id: string;
99
100
  dimension_id: string;
100
101
  dimension_value_id?: string | null;
101
102
  subsidiary_id: number;
@@ -168,8 +169,14 @@ type AccountingDimensionWithRules = {
168
169
  values?: Array<AccountingDimensionValueWithRules>;
169
170
  };
170
171
  type AccountingExchangeRate = {
171
- from_currency: AccountingCurrency;
172
- to_currency: AccountingCurrency;
172
+ /**
173
+ * Full currency name as per the Currency enum (e.g. 'United States Dollar', 'Euro', 'New Israeli Shekel').
174
+ */
175
+ from_currency: string;
176
+ /**
177
+ * Full currency name as per the Currency enum (e.g. 'United States Dollar', 'Euro', 'New Israeli Shekel').
178
+ */
179
+ to_currency: string;
173
180
  rate: number;
174
181
  };
175
182
  type AccountingExchangeRates = {
@@ -398,7 +405,10 @@ type AccountingTAccountOutput = {
398
405
  is_manually_created?: boolean;
399
406
  provider_id: string;
400
407
  subsidiary_id: number;
401
- currency?: AccountingCurrency;
408
+ /**
409
+ * Full currency name as per the Currency enum (e.g. 'United States Dollar', 'Euro', 'New Israeli Shekel').
410
+ */
411
+ currency?: string;
402
412
  sourced_account_id?: string | null;
403
413
  account_balance?: AccountingBalanceOutput;
404
414
  primary_balance?: AccountingBalanceOutput;
@@ -438,7 +448,10 @@ type AccountingTAccountWithSubAccounts = {
438
448
  is_manually_created?: boolean;
439
449
  provider_id: string;
440
450
  subsidiary_id: number;
441
- currency?: AccountingCurrency;
451
+ /**
452
+ * Full currency name as per the Currency enum (e.g. 'United States Dollar', 'Euro', 'New Israeli Shekel').
453
+ */
454
+ currency?: string;
442
455
  sourced_account_id?: string | null;
443
456
  account_balance?: AccountingBalanceOutput;
444
457
  primary_balance?: AccountingBalanceOutput;
@@ -479,7 +492,10 @@ type AccountingTAccountWithoutSubsidiaryMappingOutput = {
479
492
  is_manually_created?: boolean;
480
493
  provider_id: string;
481
494
  subsidiary_id: number;
482
- currency?: AccountingCurrency;
495
+ /**
496
+ * Full currency name as per the Currency enum (e.g. 'United States Dollar', 'Euro', 'New Israeli Shekel').
497
+ */
498
+ currency?: string;
483
499
  sourced_account_id?: string | null;
484
500
  account_balance?: AccountingBalanceOutput;
485
501
  primary_balance?: AccountingBalanceOutput;
@@ -2909,11 +2925,29 @@ type GetDimensionValuesHierarchicalApiAccountingDimensionValueHierarchicalGetDat
2909
2925
  body?: never;
2910
2926
  path?: never;
2911
2927
  query?: {
2928
+ /**
2929
+ * Filter to values belonging to a specific dimension ID.
2930
+ */
2912
2931
  dimension_id?: string | null;
2932
+ /**
2933
+ * Text search filter on the parent dimension name.
2934
+ */
2913
2935
  dimension_name?: string | null;
2936
+ /**
2937
+ * Parent value ID for lazy-loading children; omit for roots.
2938
+ */
2914
2939
  parent_id?: string | null;
2940
+ /**
2941
+ * Search query; matching values are returned with ancestor context.
2942
+ */
2915
2943
  search_query?: string | null;
2944
+ /**
2945
+ * Explicit value IDs to include, with their ancestors for tree context.
2946
+ */
2916
2947
  include_ids?: Array<string> | null;
2948
+ /**
2949
+ * Return a lightweight response without rules and extended metadata.
2950
+ */
2917
2951
  slim?: boolean;
2918
2952
  };
2919
2953
  url: '/api/accounting/dimension-value/hierarchical';
@@ -9,7 +9,7 @@ type AccountingAccountType = 'Bank' | 'Current Asset' | 'Non-current Asset' | 'F
9
9
  type AccountingAccountingClass = 'Asset' | 'Equity' | 'Liability' | 'Revenue' | 'Expense' | 'Statistical';
10
10
  type AccountingBalanceOutput = {
11
11
  balance?: number;
12
- currency?: AccountingCurrency | null;
12
+ currency?: string | null;
13
13
  };
14
14
  type AccountingBulkSetLineDimensionValueRequest = {
15
15
  dimension_id: string;
@@ -88,14 +88,15 @@ type AccountingDimensionValue = {
88
88
  has_children?: boolean;
89
89
  };
90
90
  /**
91
- * SDK-facing shape of a single dimension value's movement balance over the requested window.
91
+ * SDK-facing shape of a single account + dimension value's movement balance over the requested window.
92
92
  *
93
- * Mirrors the internal DimensionBalance — primary/secondary currency amounts, their credit/debit
93
+ * Mirrors the internal DimensionAccountBalance — primary/secondary currency amounts, their credit/debit
94
94
  * splits, and CTA — so the Rollforward has the full breakdown, but as a stable Response type
95
95
  * decoupled from the aggregation model. Field names match the source so it maps via
96
96
  * model_validate(from_attributes).
97
97
  */
98
98
  type AccountingDimensionValueBalanceResponse = {
99
+ account_id: string;
99
100
  dimension_id: string;
100
101
  dimension_value_id?: string | null;
101
102
  subsidiary_id: number;
@@ -168,8 +169,14 @@ type AccountingDimensionWithRules = {
168
169
  values?: Array<AccountingDimensionValueWithRules>;
169
170
  };
170
171
  type AccountingExchangeRate = {
171
- from_currency: AccountingCurrency;
172
- to_currency: AccountingCurrency;
172
+ /**
173
+ * Full currency name as per the Currency enum (e.g. 'United States Dollar', 'Euro', 'New Israeli Shekel').
174
+ */
175
+ from_currency: string;
176
+ /**
177
+ * Full currency name as per the Currency enum (e.g. 'United States Dollar', 'Euro', 'New Israeli Shekel').
178
+ */
179
+ to_currency: string;
173
180
  rate: number;
174
181
  };
175
182
  type AccountingExchangeRates = {
@@ -398,7 +405,10 @@ type AccountingTAccountOutput = {
398
405
  is_manually_created?: boolean;
399
406
  provider_id: string;
400
407
  subsidiary_id: number;
401
- currency?: AccountingCurrency;
408
+ /**
409
+ * Full currency name as per the Currency enum (e.g. 'United States Dollar', 'Euro', 'New Israeli Shekel').
410
+ */
411
+ currency?: string;
402
412
  sourced_account_id?: string | null;
403
413
  account_balance?: AccountingBalanceOutput;
404
414
  primary_balance?: AccountingBalanceOutput;
@@ -438,7 +448,10 @@ type AccountingTAccountWithSubAccounts = {
438
448
  is_manually_created?: boolean;
439
449
  provider_id: string;
440
450
  subsidiary_id: number;
441
- currency?: AccountingCurrency;
451
+ /**
452
+ * Full currency name as per the Currency enum (e.g. 'United States Dollar', 'Euro', 'New Israeli Shekel').
453
+ */
454
+ currency?: string;
442
455
  sourced_account_id?: string | null;
443
456
  account_balance?: AccountingBalanceOutput;
444
457
  primary_balance?: AccountingBalanceOutput;
@@ -479,7 +492,10 @@ type AccountingTAccountWithoutSubsidiaryMappingOutput = {
479
492
  is_manually_created?: boolean;
480
493
  provider_id: string;
481
494
  subsidiary_id: number;
482
- currency?: AccountingCurrency;
495
+ /**
496
+ * Full currency name as per the Currency enum (e.g. 'United States Dollar', 'Euro', 'New Israeli Shekel').
497
+ */
498
+ currency?: string;
483
499
  sourced_account_id?: string | null;
484
500
  account_balance?: AccountingBalanceOutput;
485
501
  primary_balance?: AccountingBalanceOutput;
@@ -2909,11 +2925,29 @@ type GetDimensionValuesHierarchicalApiAccountingDimensionValueHierarchicalGetDat
2909
2925
  body?: never;
2910
2926
  path?: never;
2911
2927
  query?: {
2928
+ /**
2929
+ * Filter to values belonging to a specific dimension ID.
2930
+ */
2912
2931
  dimension_id?: string | null;
2932
+ /**
2933
+ * Text search filter on the parent dimension name.
2934
+ */
2913
2935
  dimension_name?: string | null;
2936
+ /**
2937
+ * Parent value ID for lazy-loading children; omit for roots.
2938
+ */
2914
2939
  parent_id?: string | null;
2940
+ /**
2941
+ * Search query; matching values are returned with ancestor context.
2942
+ */
2915
2943
  search_query?: string | null;
2944
+ /**
2945
+ * Explicit value IDs to include, with their ancestors for tree context.
2946
+ */
2916
2947
  include_ids?: Array<string> | null;
2948
+ /**
2949
+ * Return a lightweight response without rules and extended metadata.
2950
+ */
2917
2951
  slim?: boolean;
2918
2952
  };
2919
2953
  url: '/api/accounting/dimension-value/hierarchical';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nominalso/vibe-bridge",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Iframe-side SDK for building Nominal Vibe Apps — connects an embedded app to its Nominal host over a typed postMessage bridge (context, data fetch, file upload, subroute deep-linking). Safe to import from SSR, React Server Components, and edge/Worker runtimes.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://github.com/nominalso/vibe-apps-sdk#readme",