@nicia-ai/typegraph 0.66.1 → 0.67.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 (39) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +15 -0
  3. package/dist/backend/postgres/pglite-store.cjs +1 -1
  4. package/dist/backend/postgres/pglite-store.js +1 -1
  5. package/dist/backend/sqlite/local-store.cjs +1 -1
  6. package/dist/backend/sqlite/local-store.js +1 -1
  7. package/dist/{chunk-TR7QTODF.js → chunk-55DGFZYC.js} +3 -3
  8. package/dist/{chunk-TR7QTODF.js.map → chunk-55DGFZYC.js.map} +1 -1
  9. package/dist/{chunk-WB55URNM.js → chunk-6CKSTY2D.js} +7 -3
  10. package/dist/chunk-6CKSTY2D.js.map +1 -0
  11. package/dist/{chunk-SSDHR2C2.js → chunk-EFSXK3DW.js} +3 -3
  12. package/dist/{chunk-SSDHR2C2.js.map → chunk-EFSXK3DW.js.map} +1 -1
  13. package/dist/{chunk-Y4X6ODVY.cjs → chunk-FS2GVO2T.cjs} +56 -56
  14. package/dist/{chunk-Y4X6ODVY.cjs.map → chunk-FS2GVO2T.cjs.map} +1 -1
  15. package/dist/{chunk-K7YACILO.cjs → chunk-GXHEGNI6.cjs} +9 -9
  16. package/dist/{chunk-K7YACILO.cjs.map → chunk-GXHEGNI6.cjs.map} +1 -1
  17. package/dist/{chunk-BX42F7IJ.cjs → chunk-SSDLQPMY.cjs} +7 -2
  18. package/dist/chunk-SSDLQPMY.cjs.map +1 -0
  19. package/dist/graph-merge/index.cjs +500 -26
  20. package/dist/graph-merge/index.cjs.map +1 -1
  21. package/dist/graph-merge/index.d.cts +384 -2
  22. package/dist/graph-merge/index.d.ts +384 -2
  23. package/dist/graph-merge/index.js +485 -15
  24. package/dist/graph-merge/index.js.map +1 -1
  25. package/dist/index.cjs +63 -63
  26. package/dist/index.js +3 -3
  27. package/dist/{local-store-impl-OUINMCYI.cjs → local-store-impl-7SPBIS4M.cjs} +5 -5
  28. package/dist/{local-store-impl-OUINMCYI.cjs.map → local-store-impl-7SPBIS4M.cjs.map} +1 -1
  29. package/dist/{local-store-impl-ERPNYOCL.js → local-store-impl-E23EDYPV.js} +4 -4
  30. package/dist/{local-store-impl-ERPNYOCL.js.map → local-store-impl-E23EDYPV.js.map} +1 -1
  31. package/dist/{pglite-store-impl-Z3SOOP75.cjs → pglite-store-impl-U55HQ5ZY.cjs} +5 -5
  32. package/dist/{pglite-store-impl-Z3SOOP75.cjs.map → pglite-store-impl-U55HQ5ZY.cjs.map} +1 -1
  33. package/dist/{pglite-store-impl-DUJBQZS5.js → pglite-store-impl-VAIEJZOU.js} +4 -4
  34. package/dist/{pglite-store-impl-DUJBQZS5.js.map → pglite-store-impl-VAIEJZOU.js.map} +1 -1
  35. package/dist/schema/index.cjs +27 -27
  36. package/dist/schema/index.js +2 -2
  37. package/package.json +1 -1
  38. package/dist/chunk-BX42F7IJ.cjs.map +0 -1
  39. package/dist/chunk-WB55URNM.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @nicia-ai/typegraph
2
2
 
3
+ ## 0.67.0
4
+
5
+ ### Highlights
6
+
7
+ TypeGraph 0.67 adds durable graph-merge branches for workflows that outlive one process. `branchDurable()` creates a persistent working copy and a JSON-safe descriptor that can cross a queue, deployment, or machine boundary; `reopenDurableBranch()` restores the ordinary `GraphBranch` used by merge planning, and `destroyDurableBranch()` explicitly removes or archives the host allocation. The existing reviewable plan/apply lifecycle remains the source of truth for accepted graph changes.
8
+
9
+ Durable strategies own host allocation and reconnection while TypeGraph validates the sealed graph, schema, branch, and base origin. Creation fences writes racing the allocation and accepts either an exact revision token or a complete semantic match when the persistent copy has its own revision namespace. Strategies can optionally attempt a proven-equivalent native merge; a mutation-free `unsupported` result returns to the complete portable apply path, while uncertain native failures never risk a second application.
10
+
11
+ ### Upgrade notes
12
+
13
+ - Existing `branch()` and portable merge workflows require no changes. Use the durable APIs only when a working copy must survive closing its current backend or move between processes.
14
+ - Custom durable strategies must return a non-secret, JSON-safe locator and attest the complete sealed origin on reopen and destroy. Each opened working copy must provide either sound cross-client engine fencing or an allocation-wide exclusive writer lease; closing releases access but intentionally leaves the persistent allocation available until `destroyDurableBranch()` succeeds.
15
+ - Treat `DurableWorkingCopyStrategy.merge()` as an optional optimization. Return `unsupported` only when no merge SQL or host mutation ran. Return `applied` only after proving the complete host diff equals the approved TypeGraph write set and validating the target fence on the merged resource. Throw on failed or uncertain native outcomes; TypeGraph will not fall back after a possibly partial application. Apply callbacks and persisted provenance continue through the portable path.
16
+
17
+ ### Minor Changes
18
+
19
+ - [#726](https://github.com/nicia-ai/typegraph/pull/726) [`595e6d9`](https://github.com/nicia-ai/typegraph/commit/595e6d9e5a68faf5ca118288bf921065b822ff61) Thanks [@pdlug](https://github.com/pdlug)! - Add durable graph-merge branches that can be serialized, reopened in a later process, and explicitly destroyed. Durable strategies attest the complete fork origin, prove the created working copy matches its stamped base, and declare either engine-level fencing or an allocation-wide exclusive writer lease. Approved plans can optionally use a strategy's proven-equivalent native database merge; unsupported native dimensions execute no host mutation and fall back to the complete portable plan application.
20
+
3
21
  ## 0.66.1
4
22
 
5
23
  ### Highlights
package/README.md CHANGED
@@ -86,11 +86,15 @@ TypeGraph ships semantic graph merge as a dedicated subpath:
86
86
 
87
87
  ```ts
88
88
  import {
89
+ applyDurableMergePlan,
89
90
  applyMergePlan,
90
91
  applyMergePlanInTransaction,
91
92
  branch,
93
+ branchDurable,
94
+ destroyDurableBranch,
92
95
  merge,
93
96
  planMerge,
97
+ reopenDurableBranch,
94
98
  } from "@nicia-ai/typegraph/graph-merge";
95
99
  ```
96
100
 
@@ -137,6 +141,17 @@ caller-owned commit. It throws on failure and leaves rollback and whole-
137
141
  transaction retry to the caller. This path refuses persisted provenance, while
138
142
  report-only provenance remains available.
139
143
 
144
+ Long-running workflows can use `branchDurable()` to allocate a persistent
145
+ working copy, serialize its descriptor, close the current connection, and
146
+ reattach from a later process with `reopenDurableBranch()`. A
147
+ `DurableWorkingCopyStrategy` owns the database's branch lifecycle and declares
148
+ the cross-client fencing or exclusive writer lease that keeps planning sound.
149
+ After review, `applyDurableMergePlan()` may use a strategy's native database
150
+ merge only when it proves the host diff is exactly the approved TypeGraph plan;
151
+ otherwise it applies the complete portable plan. Use `destroyDurableBranch()`
152
+ for explicit teardown. The guide documents the requirements a branch-native
153
+ database strategy must satisfy.
154
+
140
155
  It lives in the core package because the primitive is defined over TypeGraph
141
156
  stores, schemas, indexes, backends, and ontology semantics rather than as a
142
157
  separate product surface.
@@ -7,7 +7,7 @@ require('../../chunk-7XYPLAPL.cjs');
7
7
  async function createLocalPgliteStore(graph, options = {}) {
8
8
  const impl = await chunkMUKIEXH5_cjs.loadDrizzleBackedModule(
9
9
  "./postgres/pglite",
10
- () => import('../../pglite-store-impl-Z3SOOP75.cjs')
10
+ () => import('../../pglite-store-impl-U55HQ5ZY.cjs')
11
11
  );
12
12
  return impl.createLocalPgliteStoreImpl(graph, options);
13
13
  }
@@ -5,7 +5,7 @@ import '../../chunk-GMKPIYHY.js';
5
5
  async function createLocalPgliteStore(graph, options = {}) {
6
6
  const impl = await loadDrizzleBackedModule(
7
7
  "./postgres/pglite",
8
- () => import('../../pglite-store-impl-DUJBQZS5.js')
8
+ () => import('../../pglite-store-impl-VAIEJZOU.js')
9
9
  );
10
10
  return impl.createLocalPgliteStoreImpl(graph, options);
11
11
  }
@@ -8,7 +8,7 @@ require('../../chunk-7XYPLAPL.cjs');
8
8
  async function createLocalSqliteStore(graph, options = {}) {
9
9
  const impl = await chunkMUKIEXH5_cjs.loadDrizzleBackedModule(
10
10
  "./sqlite/local",
11
- () => import('../../local-store-impl-OUINMCYI.cjs')
11
+ () => import('../../local-store-impl-7SPBIS4M.cjs')
12
12
  );
13
13
  return impl.createLocalSqliteStoreImpl(graph, options);
14
14
  }
@@ -6,7 +6,7 @@ import '../../chunk-GMKPIYHY.js';
6
6
  async function createLocalSqliteStore(graph, options = {}) {
7
7
  const impl = await loadDrizzleBackedModule(
8
8
  "./sqlite/local",
9
- () => import('../../local-store-impl-ERPNYOCL.js')
9
+ () => import('../../local-store-impl-E23EDYPV.js')
10
10
  );
11
11
  return impl.createLocalSqliteStoreImpl(graph, options);
12
12
  }
@@ -6,7 +6,7 @@ import { isBundledRootAutocommitEligible } from './chunk-6ECNYQDW.js';
6
6
  import { edgeCardinalityClaimTarget, edgeCardinalityClaimRefusal, edgeCardinalityClaim, edgeCardinalityClaimMode, claimEdgeCardinality } from './chunk-CDKNGCE7.js';
7
7
  import { resolveBackendFulltext } from './chunk-N535PWMA.js';
8
8
  import { AtomicEdgeBatchEndpointRefusalError, AtomicEdgeConvergenceTombstoneRefusalError, AtomicEdgeDeleteIdentityRefusalError, AtomicEdgeBatchCardinalityRefusalError } from './chunk-UFKYMQJ5.js';
9
- import { loadAndMergeGraphExtensionDocument, serializeSchema, buildKindRegistry, ensureIdentitySchemaStorage, loadAndVerifyGraph, identitySchemaCommitPreflight, getSchemaChanges, requiresMigration, inspectAdoptedIdentityStorage, parseSerializedSchema, mergeGraphExtension, commitNewSchemaVersion, commitNewSchemaVersionWithPreflight, planRemovals, stripGraphExtension, applyDeprecatedKinds, identityKindCascadeNeeded, ensureSchema, loadActiveSchemaWithBootstrap, extensionKindNames, serializeSchemaProperties, buildGraphExtensionOntologyKeySet, compileTimeOntologyKey, prepareNewSchemaVersion, commitNewSchemaVersionIfKindsEmpty, serializeIndexDeclaration } from './chunk-WB55URNM.js';
9
+ import { loadAndMergeGraphExtensionDocument, serializeSchema, buildKindRegistry, ensureIdentitySchemaStorage, loadAndVerifyGraph, identitySchemaCommitPreflight, getSchemaChanges, requiresMigration, inspectAdoptedIdentityStorage, parseSerializedSchema, mergeGraphExtension, commitNewSchemaVersion, commitNewSchemaVersionWithPreflight, planRemovals, stripGraphExtension, applyDeprecatedKinds, identityKindCascadeNeeded, ensureSchema, loadActiveSchemaWithBootstrap, extensionKindNames, serializeSchemaProperties, buildGraphExtensionOntologyKeySet, compileTimeOntologyKey, prepareNewSchemaVersion, commitNewSchemaVersionIfKindsEmpty, serializeIndexDeclaration } from './chunk-6CKSTY2D.js';
10
10
  import { countSchemaKindRows } from './chunk-RFMSZ7CF.js';
11
11
  import { getTypeName } from './chunk-Q2SPDS3B.js';
12
12
  import { loadCurrentStructuralClasses, loadAssertionsByIds, toTransferAssertion, liveNodeKindsSharingIds, createIdentityFacade, createIdentityReadFacade, validateIdentityForContext, removeIdentityKindsForContext, readIdentityAssertionsForInterchange, readIdentityAssertionPageAtTarget, lockIdentityGraph, foldIdentityForCreatedNodes, importIdentityAssertionsIntoTarget, assertAffectedIdentityClassesConsistent, applyIdentityChangesForContext, refKey, requireNodeValidityEndCompatible, detachIdentityForNode, rebuildIdentityClosureForContext, assertEdgeMatchIdentityBackendSupport } from './chunk-SYXTWPX6.js';
@@ -31191,5 +31191,5 @@ async function createVerifiedAdapterStore(graph, backend, options) {
31191
31191
  }
31192
31192
 
31193
31193
  export { CURRENT_ONLY_READ_NAMES, EDGE_TEMPORAL_READ_NAMES, ExecutableAggregateQuery, ExecutableProjectionQuery, ExecutableQuery, ExecutableRelationQuery, IDENTITY_READ_NAMES, MAX_EXPLICIT_RECURSIVE_DEPTH, MAX_RECURSIVE_DEPTH, NODE_TEMPORAL_READ_NAMES, PreparedQuery, QueryBuilder, RecordedStoreView, StoreAnalysisCursorStaleError, 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 };
31194
- //# sourceMappingURL=chunk-TR7QTODF.js.map
31195
- //# sourceMappingURL=chunk-TR7QTODF.js.map
31194
+ //# sourceMappingURL=chunk-55DGFZYC.js.map
31195
+ //# sourceMappingURL=chunk-55DGFZYC.js.map