@nicia-ai/typegraph 0.40.0 → 0.41.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.
Files changed (85) hide show
  1. package/dist/backend/drizzle/indexes.d.cts +1 -1
  2. package/dist/backend/drizzle/indexes.d.ts +1 -1
  3. package/dist/backend/index.d.cts +2 -2
  4. package/dist/backend/index.d.ts +2 -2
  5. package/dist/backend/postgres/index.d.cts +5 -5
  6. package/dist/backend/postgres/index.d.ts +5 -5
  7. package/dist/backend/postgres/pglite-store.cjs +3 -3
  8. package/dist/backend/postgres/pglite-store.d.cts +5 -5
  9. package/dist/backend/postgres/pglite-store.d.ts +5 -5
  10. package/dist/backend/postgres/pglite-store.js +2 -2
  11. package/dist/backend/postgres/pglite.d.cts +2 -2
  12. package/dist/backend/postgres/pglite.d.ts +2 -2
  13. package/dist/backend/sqlite/index.d.cts +5 -5
  14. package/dist/backend/sqlite/index.d.ts +5 -5
  15. package/dist/backend/sqlite/libsql.d.cts +2 -2
  16. package/dist/backend/sqlite/libsql.d.ts +2 -2
  17. package/dist/backend/sqlite/local-store.cjs +3 -3
  18. package/dist/backend/sqlite/local-store.d.cts +5 -5
  19. package/dist/backend/sqlite/local-store.d.ts +5 -5
  20. package/dist/backend/sqlite/local-store.js +2 -2
  21. package/dist/backend/sqlite/local.d.cts +2 -2
  22. package/dist/backend/sqlite/local.d.ts +2 -2
  23. package/dist/{chunk-K4FB2RMO.cjs → chunk-JP5EICR6.cjs} +7 -2
  24. package/dist/chunk-JP5EICR6.cjs.map +1 -0
  25. package/dist/chunk-KOI7UEI5.js +81 -0
  26. package/dist/chunk-KOI7UEI5.js.map +1 -0
  27. package/dist/{chunk-H6I36MGT.cjs → chunk-LOKG3KQV.cjs} +114 -37
  28. package/dist/chunk-LOKG3KQV.cjs.map +1 -0
  29. package/dist/{chunk-3BL3JFHL.js → chunk-MQBF3XGY.js} +82 -5
  30. package/dist/chunk-MQBF3XGY.js.map +1 -0
  31. package/dist/chunk-QCKD3RCI.cjs +83 -0
  32. package/dist/chunk-QCKD3RCI.cjs.map +1 -0
  33. package/dist/{chunk-CU3LPYNB.js → chunk-V3S74J44.js} +7 -3
  34. package/dist/chunk-V3S74J44.js.map +1 -0
  35. package/dist/core/index.d.cts +3 -3
  36. package/dist/core/index.d.ts +3 -3
  37. package/dist/{ddl-KnCdF_le.d.cts → ddl-BCXFRLWg.d.cts} +3 -3
  38. package/dist/{ddl-BLEzHw6j.d.ts → ddl-ByLmGgn9.d.ts} +3 -3
  39. package/dist/{define-graph-DQnj3fNH.d.ts → define-graph-BSviZubs.d.ts} +1 -1
  40. package/dist/{define-graph-Cv3CFwKm.d.cts → define-graph-XyJheaFm.d.cts} +1 -1
  41. package/dist/graph-merge/index.cjs +5 -5
  42. package/dist/graph-merge/index.d.cts +5 -5
  43. package/dist/graph-merge/index.d.ts +5 -5
  44. package/dist/graph-merge/index.js +2 -2
  45. package/dist/index.cjs +58 -53
  46. package/dist/index.cjs.map +1 -1
  47. package/dist/index.d.cts +10 -10
  48. package/dist/index.d.ts +10 -10
  49. package/dist/index.js +3 -2
  50. package/dist/index.js.map +1 -1
  51. package/dist/indexes/index.d.cts +4 -4
  52. package/dist/indexes/index.d.ts +4 -4
  53. package/dist/interchange/index.d.cts +5 -5
  54. package/dist/interchange/index.d.ts +5 -5
  55. package/dist/{manager-DjE6Mhag.d.ts → manager-C7iC5bk_.d.ts} +27 -3
  56. package/dist/{manager-mqee5MVB.d.cts → manager-Dm6MCYO7.d.cts} +27 -3
  57. package/dist/{postgres-Bm4DyFQU.d.cts → postgres-Cb6ceh4-.d.ts} +1 -1
  58. package/dist/{postgres-DtaVALOZ.d.ts → postgres-DZxwzCQ8.d.cts} +1 -1
  59. package/dist/profiler/index.d.cts +7 -7
  60. package/dist/profiler/index.d.ts +7 -7
  61. package/dist/provenance/index.d.cts +5 -5
  62. package/dist/provenance/index.d.ts +5 -5
  63. package/dist/schema/index.cjs +29 -95
  64. package/dist/schema/index.cjs.map +1 -1
  65. package/dist/schema/index.d.cts +55 -55
  66. package/dist/schema/index.d.ts +55 -55
  67. package/dist/schema/index.js +2 -80
  68. package/dist/schema/index.js.map +1 -1
  69. package/dist/{searchable-ChJ29MCd.d.ts → searchable-Cet4Oztt.d.ts} +2 -2
  70. package/dist/{searchable-BxlJQVFw.d.cts → searchable-aUaKh3_r.d.cts} +2 -2
  71. package/dist/{sqlite-m9Izphk_.d.ts → sqlite-Cb3Ilj9_.d.ts} +1 -1
  72. package/dist/{sqlite-DT6tTHOG.d.cts → sqlite-Dxklpizv.d.cts} +1 -1
  73. package/dist/{store-view-CagdeyNn.d.ts → store-view-BDjGFjpN.d.ts} +64 -13
  74. package/dist/{store-view-C-buB8Q8.d.cts → store-view-PCT7vTKH.d.cts} +64 -13
  75. package/dist/{types-CYdXzZef.d.ts → types-CFZiEEPh.d.ts} +1 -1
  76. package/dist/{types-CqSfMRW3.d.cts → types-CsaG00wS.d.cts} +1 -1
  77. package/dist/{types-D8szWDUo.d.ts → types-D-vOo_pM.d.ts} +1 -1
  78. package/dist/{types-C5pZeKTl.d.cts → types-ho4DJJb_.d.cts} +1 -1
  79. package/dist/{where-sQL4u5h-.d.ts → where-DLYaXa4L.d.ts} +1 -1
  80. package/dist/{where-C3-HRgUq.d.cts → where-udes1WRA.d.cts} +1 -1
  81. package/package.json +1 -1
  82. package/dist/chunk-3BL3JFHL.js.map +0 -1
  83. package/dist/chunk-CU3LPYNB.js.map +0 -1
  84. package/dist/chunk-H6I36MGT.cjs.map +0 -1
  85. package/dist/chunk-K4FB2RMO.cjs.map +0 -1
@@ -6,7 +6,7 @@ import { chunk } from './chunk-35S6P5ZU.js';
6
6
  import { DEFAULT_SQL_SCHEMA, requireSqlSchema, recordedReadSchemaFor, createSqlSchema, requireExternalRecordedReadSource, createRecordedReadBinding, vectorSlotKey, recordedReadSqlSchema, requireRecordedReadBinding, ALIAS_CTE_PREFIX, EMBEDDINGS_CTE_ALIAS, FULLTEXT_CTE_ALIAS, HYBRID_CANDIDATES_CTE_ALIAS } from './chunk-YYLMXERH.js';
7
7
  import { runOptionallyInTransaction, createTransactionReadBackend, rowPropsToObject, createBackendOverlay, INTERNAL_TEMPORARY_WRITES } from './chunk-L5ET7FYQ.js';
8
8
  import { resolveReadCoordinate, withRecordedCoordinate, describeCoordinate, coordinateContext, recordedInstantWallTime, asRecordedInstant, assertValidRecordedInstant } from './chunk-QOHTVDHU.js';
9
- import { loadAndMergeGraphExtensionDocument, ensureSchema, loadAndVerifyGraph, buildKindRegistry, mergeGraphExtension, commitNewSchemaVersion, applyDeprecatedKinds, loadActiveSchemaWithBootstrap, parseSerializedSchema, extensionKindNames, serializeSchemaProperties, buildGraphExtensionOntologyKeySet, compileTimeOntologyKey, serializeIndexDeclaration } from './chunk-CU3LPYNB.js';
9
+ import { loadAndMergeGraphExtensionDocument, ensureSchema, loadAndVerifyGraph, buildKindRegistry, mergeGraphExtension, commitNewSchemaVersion, applyDeprecatedKinds, loadActiveSchemaWithBootstrap, parseSerializedSchema, extensionKindNames, serializeSchemaProperties, buildGraphExtensionOntologyKeySet, compileTimeOntologyKey, serializeIndexDeclaration } from './chunk-V3S74J44.js';
10
10
  import { getTypeName } from './chunk-76HE7DJP.js';
11
11
  import { validateEdgeProps } from './chunk-ZE6NVENI.js';
12
12
  import { canonicalEqual, sortedReplacer } from './chunk-UR7W5YQK.js';
@@ -16971,6 +16971,37 @@ var StoreImplementation = class _StoreImplementation {
16971
16971
  get registry() {
16972
16972
  return this.#registry;
16973
16973
  }
16974
+ /**
16975
+ * An opaque, in-memory snapshot of this store's reconciled schema — the
16976
+ * merged compile-time + runtime-committed graph plus the committed version
16977
+ * it reflects. Cache it after a verified open and hand it to
16978
+ * {@link createAdapterStore} via `{ reconciled }` (or call
16979
+ * {@link AdapterStoreImplementation.withBackend}) to build request-scoped
16980
+ * stores against fresh connections with zero database round-trips. Refresh
16981
+ * it when {@link getCommittedSchemaVersion} reports a moved version.
16982
+ */
16983
+ get reconciledSchema() {
16984
+ return Object.freeze({
16985
+ graph: this.#graph,
16986
+ version: this.#schemaMetadata.schemaVersion,
16987
+ hash: this.#schemaMetadata.schemaHash
16988
+ });
16989
+ }
16990
+ /**
16991
+ * Reconstruction inputs for a connection rebind: the merged graph, the
16992
+ * verbatim construction options, and the reconciled schema metadata. Lets an
16993
+ * adapter subclass rebuild an equivalent store against a fresh backend
16994
+ * without a verify round-trip.
16995
+ *
16996
+ * @internal
16997
+ */
16998
+ reconstructionState() {
16999
+ return {
17000
+ graph: this.#graph,
17001
+ options: this.#options,
17002
+ schemaMetadata: this.#schemaMetadata
17003
+ };
17004
+ }
16974
17005
  /**
16975
17006
  * Whether recorded-time capture is enabled for this store.
16976
17007
  *
@@ -18950,7 +18981,7 @@ var StoreImplementation = class _StoreImplementation {
18950
18981
  );
18951
18982
  }
18952
18983
  };
18953
- var AdapterStoreImplementation = class extends StoreImplementation {
18984
+ var AdapterStoreImplementation = class _AdapterStoreImplementation extends StoreImplementation {
18954
18985
  backend;
18955
18986
  constructor(graph, backend, options, schemaMetadata) {
18956
18987
  super(graph, backend, options, schemaMetadata, backend);
@@ -18958,6 +18989,23 @@ var AdapterStoreImplementation = class extends StoreImplementation {
18958
18989
  createGraphBackendProjection(this[STORE_RUNTIME].backend)
18959
18990
  );
18960
18991
  }
18992
+ /**
18993
+ * Rebind this store's already-reconciled schema onto a fresh backend/
18994
+ * connection, returning a new equivalent store with **no** verify round-trip.
18995
+ * The connection is captured at construction and never mutated, so this
18996
+ * returns a new instance rather than rebinding in place — the serverless
18997
+ * per-request primitive: verify once per isolate, then `withBackend` the
18998
+ * per-request connection.
18999
+ */
19000
+ withBackend(backend) {
19001
+ const state = this.reconstructionState();
19002
+ return new _AdapterStoreImplementation(
19003
+ state.graph,
19004
+ backend,
19005
+ state.options,
19006
+ state.schemaMetadata
19007
+ );
19008
+ }
18961
19009
  async evolve(extension, options) {
18962
19010
  return this.#withAdapterReplacement(
18963
19011
  options?.ref,
@@ -19041,8 +19089,26 @@ function createStore(graph, backend, options) {
19041
19089
  return new StoreImplementation(graph, backend, options);
19042
19090
  }
19043
19091
  function createAdapterStore(graph, backend, options) {
19092
+ const reconciled = options?.reconciled;
19093
+ if (reconciled !== void 0 && reconciled.graph.id !== graph.id) {
19094
+ throw new ConfigurationError(
19095
+ `Reconciled snapshot is for graph "${reconciled.graph.id}", not "${graph.id}".`,
19096
+ { code: "RECONCILED_GRAPH_MISMATCH" },
19097
+ {
19098
+ suggestion: "Pass the ReconciledSchema produced from the same graph you are building the store with; snapshots are not interchangeable across graphs."
19099
+ }
19100
+ );
19101
+ }
19102
+ const storeOptions = stripReconciledOption(options);
19103
+ const resolvedGraph = reconciled?.graph ?? graph;
19104
+ const schemaMetadata = reconciled === void 0 ? void 0 : reconciledSchemaMetadata(reconciled);
19044
19105
  return asAdapterStoreSurface(
19045
- new AdapterStoreImplementation(graph, backend, options)
19106
+ new AdapterStoreImplementation(
19107
+ resolvedGraph,
19108
+ backend,
19109
+ storeOptions,
19110
+ schemaMetadata
19111
+ )
19046
19112
  );
19047
19113
  }
19048
19114
  function isKnownEdgeKind(graph, name) {
@@ -19060,6 +19126,17 @@ function schemaMetadataFromRow(row) {
19060
19126
  schemaHash: row.schema_hash
19061
19127
  });
19062
19128
  }
19129
+ function reconciledSchemaMetadata(reconciled) {
19130
+ return Object.freeze({
19131
+ schemaVersion: reconciled.version,
19132
+ schemaHash: reconciled.hash
19133
+ });
19134
+ }
19135
+ function stripReconciledOption(options) {
19136
+ if (options === void 0 || !("reconciled" in options)) return options;
19137
+ const { reconciled: _reconciled, ...rest } = options;
19138
+ return rest;
19139
+ }
19063
19140
  function schemaMetadataForResult(activeRow, result) {
19064
19141
  if (result.status === "initialized" || result.status === "migrated") {
19065
19142
  return schemaMetadataFromRow(result.committedRow);
@@ -19205,5 +19282,5 @@ async function createVerifiedAdapterStore(graph, backend, options) {
19205
19282
  }
19206
19283
 
19207
19284
  export { ExecutableAggregateQuery, ExecutableQuery, MAX_EXPLICIT_RECURSIVE_DEPTH, MAX_RECURSIVE_DEPTH, PreparedQuery, QueryBuilder, RecordedStoreView, StoreSearch, StoreView, UnionableQuery, avg, composeFragments, count, countDistinct, countDistinctEdges, countEdges, createAdapterStore, createAdapterStoreWithSchema, createFragment, createQueryBuilder, createStore, createStoreWithSchema, createVerifiedAdapterStore, createVerifiedStore, defineSubgraphProject, field, having, havingEq, havingGt, havingGte, havingLt, havingLte, limitFragment, max, min, offsetFragment, orderByFragment, sum };
19208
- //# sourceMappingURL=chunk-3BL3JFHL.js.map
19209
- //# sourceMappingURL=chunk-3BL3JFHL.js.map
19285
+ //# sourceMappingURL=chunk-MQBF3XGY.js.map
19286
+ //# sourceMappingURL=chunk-MQBF3XGY.js.map