{"version":3,"sources":["../src/backend/sqlite/local-store-impl.ts"],"names":["createSqliteTables","createLocalSqliteBackend","createStoreWithSchema","closeAfterFailure"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAS,sBACP,gBAAA,EACsC;AACtC,EAAA,IAAI,gBAAA,KAAqB,MAAA,EAAW,OAAO,EAAC;AAC5C,EAAA,MAAM,EAAE,MAAA,EAAQ,QAAA,EAAU,GAAG,MAAK,GAChC,gBAAA;AAEF,EAAA,OAAO,IAAA;AACT;AAGA,eAAsB,0BAAA,CACpB,OACA,OAAA,EAC4D;AAC5D,EAAA,MAAM,MAAA,GACJ,OAAA,CAAQ,KAAA,EAAO,MAAA,KAAW,MAAA,GACxB,SACAA,oCAAA,CAAmB,OAAA,CAAQ,KAAA,CAAM,MAAA,CAAO,MAAM,CAAA;AAClD,EAAA,MAAM,EAAE,OAAA,EAAQ,GAAIC,0CAAA,CAAyB;AAAA,IAC3C,GAAI,QAAQ,IAAA,KAAS,MAAA,GAAY,EAAC,GAAI,EAAE,IAAA,EAAM,OAAA,CAAQ,IAAA,EAAK;AAAA,IAC3D,GAAI,QAAQ,OAAA,KAAY,MAAA,GAAY,EAAC,GAAI,EAAE,OAAA,EAAS,OAAA,CAAQ,OAAA,EAAQ;AAAA,IACpE,GAAI,QAAQ,YAAA,KAAiB,MAAA,GAC3B,EAAC,GACD,EAAE,YAAA,EAAc,OAAA,CAAQ,YAAA,EAAa;AAAA,IACvC,GAAI,QAAQ,QAAA,KAAa,MAAA,GAAY,EAAC,GAAI,EAAE,QAAA,EAAU,OAAA,CAAQ,QAAA,EAAS;AAAA,IACvE,GAAI,MAAA,KAAW,MAAA,GAAY,EAAC,GAAI,EAAE,MAAA;AAAO,GAC1C,CAAA;AACD,EAAA,IAAI;AACF,IAAA,MAAM,CAAC,KAAK,CAAA,GAAI,MAAMC,uCAAA,CAAsB,OAAO,OAAA,EAAS;AAAA,MAC1D,GAAG,OAAA,CAAQ,KAAA;AAAA;AAAA;AAAA;AAAA,MAIX,GAAG,qBAAA,CAAsB,OAAA,CAAQ,gBAAgB;AAAA,KAClD,CAAA;AACD,IAAA,OAAO,KAAA;AAAA,EACT,SAAS,KAAA,EAAO;AACd,IAAA,OAAOC,mCAAA,CAAkB,SAAS,KAAK,CAAA;AAAA,EACzC;AACF","file":"local-store-impl-INNRHDK3.cjs","sourcesContent":["/**\n * `createLocalSqliteStore`'s implementation body, loaded behind a dynamic\n * import from `./local-store.ts` so a missing `drizzle-orm` peer surfaces as\n * a typed refusal rather than a bare module-resolution stack (design §4.4b).\n *\n * This module owns every value import that reaches `drizzle-orm` for this\n * entrypoint. `local-store.ts` must hold no static reference to this module\n * — only the `import(\"./local-store-impl\")` expression inside its factory —\n * so the dynamic import survives into its own chunk in both the ESM and CJS\n * shipped artifacts (I12).\n */\nimport { type GraphDef } from \"../../core/define-graph\";\nimport { type SchemaManagerOptions } from \"../../schema/manager\";\nimport {\n  createStoreWithSchema,\n  type HistoryStore,\n  type RecordedReadStore,\n  type Store,\n} from \"../../store/store\";\nimport { createSqliteTables } from \"../drizzle/schema/sqlite\";\nimport { closeAfterFailure } from \"../types\";\nimport { createLocalSqliteBackend } from \"./local\";\n// Type-only import: the option types are defined in `local-store.ts`, which\n// is this module's ONLY caller. A static value import in the other direction\n// would give `collectModuleEdges` a real edge from the store module to this\n// one, turning I12's `load` verdict dirty; a type-only import is erased at\n// runtime (no `verbatimModuleSyntax` in `tsconfig.base.json`), so this\n// back-edge never becomes a value cycle — the same precedent documented at\n// `src/errors/index.ts:26-29`.\nimport type { LocalSqliteStoreOptions } from \"./local-store\";\n\n/**\n * Drops a smuggled `schema` from the nested schema-management options: the\n * effective `SqlSchema` has exactly one source (`store.schema`), which also\n * drives physical table provisioning in this constructor.\n */\nfunction withoutSchemaOverride(\n  schemaManagement: Omit<SchemaManagerOptions, \"schema\"> | undefined,\n): Omit<SchemaManagerOptions, \"schema\"> {\n  if (schemaManagement === undefined) return {};\n  const { schema: smuggled, ...rest } =\n    schemaManagement as SchemaManagerOptions;\n  void smuggled;\n  return rest;\n}\n\n/** {@link createLocalSqliteStore}'s implementation body, verbatim from before the split. */\nexport async function createLocalSqliteStoreImpl<G extends GraphDef>(\n  graph: G,\n  options: LocalSqliteStoreOptions,\n): Promise<Store<G> | HistoryStore<G> | RecordedReadStore<G>> {\n  const tables =\n    options.store?.schema === undefined ?\n      undefined\n    : createSqliteTables(options.store.schema.tables);\n  const { backend } = createLocalSqliteBackend({\n    ...(options.path === undefined ? {} : { path: options.path }),\n    ...(options.pragmas === undefined ? {} : { pragmas: options.pragmas }),\n    ...(options.capabilities === undefined ?\n      {}\n    : { capabilities: options.capabilities }),\n    ...(options.fulltext === undefined ? {} : { fulltext: options.fulltext }),\n    ...(tables === undefined ? {} : { tables }),\n  });\n  try {\n    const [store] = await createStoreWithSchema(graph, backend, {\n      ...options.store,\n      // The type already excludes `schema` here; the runtime strip guards\n      // untyped callers, so the provisioned schema (or the default tables)\n      // can never diverge from the one the Store reads.\n      ...withoutSchemaOverride(options.schemaManagement),\n    });\n    return store;\n  } catch (error) {\n    return closeAfterFailure(backend, error);\n  }\n}\n"]}