@nicia-ai/typegraph 0.67.1 → 0.68.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/backend/postgres/pglite-store.cjs +1 -1
  3. package/dist/backend/postgres/pglite-store.js +1 -1
  4. package/dist/backend/sqlite/local-store.cjs +1 -1
  5. package/dist/backend/sqlite/local-store.js +1 -1
  6. package/dist/{chunk-T3VU3YRQ.cjs → chunk-6GUBF5TF.cjs} +24 -18
  7. package/dist/chunk-6GUBF5TF.cjs.map +1 -0
  8. package/dist/{chunk-55DGFZYC.js → chunk-EJYBHBIB.js} +3 -3
  9. package/dist/{chunk-55DGFZYC.js.map → chunk-EJYBHBIB.js.map} +1 -1
  10. package/dist/{chunk-WY3IFEKV.cjs → chunk-IFTYHOEE.cjs} +13 -5
  11. package/dist/chunk-IFTYHOEE.cjs.map +1 -0
  12. package/dist/{chunk-RTPMG6LQ.js → chunk-JVKHJQ6Q.js} +13 -5
  13. package/dist/chunk-JVKHJQ6Q.js.map +1 -0
  14. package/dist/{chunk-FS2GVO2T.cjs → chunk-OBEYH22Q.cjs} +159 -159
  15. package/dist/{chunk-FS2GVO2T.cjs.map → chunk-OBEYH22Q.cjs.map} +1 -1
  16. package/dist/{chunk-7YJHUY4T.js → chunk-VUYODTHL.js} +10 -5
  17. package/dist/chunk-VUYODTHL.js.map +1 -0
  18. package/dist/graph-merge/index.cjs +540 -22
  19. package/dist/graph-merge/index.cjs.map +1 -1
  20. package/dist/graph-merge/index.d.cts +317 -9
  21. package/dist/graph-merge/index.d.ts +317 -9
  22. package/dist/graph-merge/index.js +512 -8
  23. package/dist/graph-merge/index.js.map +1 -1
  24. package/dist/index.cjs +43 -43
  25. package/dist/index.js +2 -2
  26. package/dist/interchange/index.cjs +25 -25
  27. package/dist/interchange/index.js +2 -2
  28. package/dist/{local-store-impl-GI6S4J6B.cjs → local-store-impl-INNRHDK3.cjs} +5 -5
  29. package/dist/{local-store-impl-GI6S4J6B.cjs.map → local-store-impl-INNRHDK3.cjs.map} +1 -1
  30. package/dist/{local-store-impl-CCMWTLGY.js → local-store-impl-VGC3OKCA.js} +4 -4
  31. package/dist/{local-store-impl-CCMWTLGY.js.map → local-store-impl-VGC3OKCA.js.map} +1 -1
  32. package/dist/{pglite-store-impl-HAPAJUIO.cjs → pglite-store-impl-KDS4NRMC.cjs} +5 -5
  33. package/dist/{pglite-store-impl-HAPAJUIO.cjs.map → pglite-store-impl-KDS4NRMC.cjs.map} +1 -1
  34. package/dist/{pglite-store-impl-HDLFOZWS.js → pglite-store-impl-LJDF2EUF.js} +4 -4
  35. package/dist/{pglite-store-impl-HDLFOZWS.js.map → pglite-store-impl-LJDF2EUF.js.map} +1 -1
  36. package/package.json +1 -1
  37. package/dist/chunk-7YJHUY4T.js.map +0 -1
  38. package/dist/chunk-RTPMG6LQ.js.map +0 -1
  39. package/dist/chunk-T3VU3YRQ.cjs.map +0 -1
  40. package/dist/chunk-WY3IFEKV.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @nicia-ai/typegraph
2
2
 
3
+ ## 0.68.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#735](https://github.com/nicia-ai/typegraph/pull/735) [`149db17`](https://github.com/nicia-ai/typegraph/commit/149db17e9042ee461908b9677f7c6c5c7f7bcbd6) Thanks [@pdlug](https://github.com/pdlug)! - `cloneWorkingCopyStrategy` now imports with `onUnknownProperty: "allow"`, so a working copy — and therefore `branch()`, `ingestionBranch()`, and `planCandidateWriteSet()` — can be seeded from live rows that carry undeclared properties `validateStore()` already reports as healthy. Incoming candidate write-set documents remain strict. A streamed interchange abort now names the failing entity and property in the thrown message instead of wrapping only a generic abort.
8
+
9
+ - [#737](https://github.com/nicia-ai/typegraph/pull/737) [`3428764`](https://github.com/nicia-ai/typegraph/commit/34287643aa708ed53caf56c8216c50042aef6441) Thanks [@pdlug](https://github.com/pdlug)! - `compareAndSet()` and `updateWhere()` no longer throw an untyped Zod error on node kinds whose schema has object-level refinements. Early field checks reconstruct a partial schema from `.shape` so refinements stay on the complete after-image, the same document `update()` already validates.
10
+
11
+ ## 0.68.0
12
+
13
+ ### Highlights
14
+
15
+ TypeGraph 0.68 adds atomic operations to durable graph-merge branches. `operateDurableBranch()` lets a durable host commit an opaque graph mutation and immutable evidence in one host transaction, so a process can recover and deliver committed work after a crash without inventing a second coordination protocol. Canonical request digests make retries exact: the same idempotency key replays its evidence, while a changed mutation or metadata payload conflicts without another write.
16
+
17
+ The new evidence lifecycle is inspectable and bounded. Applications can read or page committed evidence, mark delivery monotonically, and ask whether any evidence remains undelivered. TypeGraph validates every host-returned outcome and preserves a typed destruction fence until downstream delivery is complete; unsupported hosts execute no mutation, and existing durable strategies remain valid without the optional capability.
18
+
19
+ ### Upgrade notes
20
+
21
+ - Existing `DurableWorkingCopyStrategy` implementations require no changes unless they opt into `operations`. To opt in, commit the host mutation and its immutable evidence in one transaction, attest the descriptor's sealed origin, enforce exact idempotency replay and digest conflicts, and serialize operations against destruction.
22
+ - Treat only `applied` and `replayed` outcomes from `operateDurableBranch()` as committed. An `unsupported` outcome guarantees that the host ran no mutation SQL; do not recreate the atomic guarantee with callbacks or a separate evidence write.
23
+ - Deliver committed evidence with `scanDurableOperations()` or `getDurableOperation()`, then call `markDurableOperationDelivered()` only after the downstream transaction commits. A first application must remain undelivered, and `destroyDurableBranch()` refuses while any evidence is undelivered.
24
+
25
+ ### Minor Changes
26
+
27
+ - [#731](https://github.com/nicia-ai/typegraph/pull/731) [`f8e800b`](https://github.com/nicia-ai/typegraph/commit/f8e800bca25f7168747624d1ab4dea525ec736c0) Thanks [@pdlug](https://github.com/pdlug)! - Add atomic durable-branch operations. A `DurableWorkingCopyStrategy` may now expose an optional `operations` capability that commits an opaque host mutation and its immutable evidence in one host transaction, keyed by idempotency. New public orchestrators `operateDurableBranch()`, `getDurableOperation()`, `scanDurableOperations()`, `markDurableOperationDelivered()`, and `durableBranchHasUndeliveredEvidence()` wrap it, with typed `DurableOperationError` subclasses for conflicts, unsupported capabilities, malformed evidence, and the undelivered-evidence destroy fence.
28
+
3
29
  ## 0.67.1
4
30
 
5
31
  ### Patch Changes
@@ -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-HAPAJUIO.cjs')
10
+ () => import('../../pglite-store-impl-KDS4NRMC.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-HDLFOZWS.js')
8
+ () => import('../../pglite-store-impl-LJDF2EUF.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-GI6S4J6B.cjs')
11
+ () => import('../../local-store-impl-INNRHDK3.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-CCMWTLGY.js')
9
+ () => import('../../local-store-impl-VGC3OKCA.js')
10
10
  );
11
11
  return impl.createLocalSqliteStoreImpl(graph, options);
12
12
  }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkWY3IFEKV_cjs = require('./chunk-WY3IFEKV.cjs');
3
+ var chunkIFTYHOEE_cjs = require('./chunk-IFTYHOEE.cjs');
4
4
  var chunkVNJMM2QQ_cjs = require('./chunk-VNJMM2QQ.cjs');
5
5
  var chunkG7OKJDMG_cjs = require('./chunk-G7OKJDMG.cjs');
6
6
  var chunkEBQX7MYL_cjs = require('./chunk-EBQX7MYL.cjs');
@@ -372,7 +372,7 @@ async function importGraphData(store, data, options) {
372
372
  const batchPointRead = chunk7LQTDGV5_cjs.batchPointReadVerdict(backend);
373
373
  const uniqueSidecarBatch = chunk7LQTDGV5_cjs.uniqueSidecarBatchVerdict(backend);
374
374
  const statementExecution = chunk7LQTDGV5_cjs.statementExecutionVerdict(backend);
375
- const owedClaimReason = chunkWY3IFEKV_cjs.graphOwesClaims(graph, registry);
375
+ const owedClaimReason = chunkIFTYHOEE_cjs.graphOwesClaims(graph, registry);
376
376
  const claimRefusal = owedClaimReason === void 0 ? void 0 : chunk6B3LQUYG_cjs.constraintFenceRefusal({ graphId }, backend, owedClaimReason);
377
377
  if (claimRefusal !== void 0) throw claimRefusal;
378
378
  const nodeSchemas = buildNodeSchemaMap(graph);
@@ -396,7 +396,7 @@ async function importGraphData(store, data, options) {
396
396
  uniqueSidecarBatch,
397
397
  statementExecution
398
398
  };
399
- const { result, errors } = await chunkWY3IFEKV_cjs.runWritePlan(
399
+ const { result, errors } = await chunkIFTYHOEE_cjs.runWritePlan(
400
400
  {
401
401
  graphId,
402
402
  registry,
@@ -424,7 +424,7 @@ async function importGraphData(store, data, options) {
424
424
  },
425
425
  // An import writes node rows AND edge rows in one frame, so it declares the
426
426
  // mixed family explicitly instead of receiving either narrower session.
427
- chunkWY3IFEKV_cjs.mixedWritePlan(void 0, true),
427
+ chunkIFTYHOEE_cjs.mixedWritePlan(void 0, true),
428
428
  backend,
429
429
  (session, target, overlaidSession, _lock, transactionMode) => runImportWritePlanAttempt(
430
430
  attemptInputs,
@@ -618,12 +618,17 @@ function serializedStreamRefusalText(requested, heldBy) {
618
618
  suggestion: "Await the import already in flight before starting the next one, or import into an independent backend."
619
619
  };
620
620
  }
621
+ function summarizeImportErrors(errors) {
622
+ return errors.map(
623
+ (entry) => `${entry.entityType} ${entry.kind} ${entry.id}: ${entry.error}`
624
+ ).join("; ");
625
+ }
621
626
  function throwIfStreamChunkFailed(result, options) {
622
627
  if (options.onStreamChunkError === "continue" || result.errors.length === 0) {
623
628
  return;
624
629
  }
625
630
  throw new Error(
626
- 'Graph interchange stream aborted after a chunk reported import errors. Earlier chunks remain committed; use onStreamChunkError: "continue" for best-effort ingestion.'
631
+ `Graph interchange stream aborted after a chunk reported import errors. Reported errors: ${summarizeImportErrors(result.errors)}. Earlier chunks remain committed; use onStreamChunkError: "continue" for best-effort ingestion.`
627
632
  );
628
633
  }
629
634
  function assertIdentityImportSupported(store, hasIdentitySection) {
@@ -935,8 +940,8 @@ async function processNodeSlice(frame, graphId, registry, batch, schemas, option
935
940
  registerAppliedNodeUpdate,
936
941
  seedNodeRow,
937
942
  seedUniqueRow
938
- } = chunkWY3IFEKV_cjs.createNodeBatchValidationSeams(graphId, registry, frame.target);
939
- await chunkWY3IFEKV_cjs.primeBatchValidationCaches(
943
+ } = chunkIFTYHOEE_cjs.createNodeBatchValidationSeams(graphId, registry, frame.target);
944
+ await chunkIFTYHOEE_cjs.primeBatchValidationCaches(
940
945
  {
941
946
  graphId,
942
947
  registry,
@@ -1019,7 +1024,7 @@ async function processNodeSlice(frame, graphId, registry, batch, schemas, option
1019
1024
  props,
1020
1025
  uniqueConstraints
1021
1026
  );
1022
- await chunkWY3IFEKV_cjs.checkDisjointnessConstraint(
1027
+ await chunkIFTYHOEE_cjs.checkDisjointnessConstraint(
1023
1028
  { graphId, registry, backend: validationBackend },
1024
1029
  node.kind,
1025
1030
  node.id
@@ -1221,7 +1226,7 @@ async function updateImportedEdge(session, edge, props, windowFence) {
1221
1226
  }
1222
1227
  }
1223
1228
  function importedEdgeIdentityUpdateError(registration, edge, existing, props) {
1224
- return chunkWY3IFEKV_cjs.edgeMatchIdentityUpdateRefusal({
1229
+ return chunkIFTYHOEE_cjs.edgeMatchIdentityUpdateRefusal({
1225
1230
  identity: registration.matchIdentity,
1226
1231
  kind: edge.kind,
1227
1232
  id: edge.id,
@@ -1346,7 +1351,7 @@ async function processNode(frame, graphId, registry, node, schemas, options) {
1346
1351
  propsResult.data,
1347
1352
  uniqueConstraints
1348
1353
  );
1349
- await chunkWY3IFEKV_cjs.checkDisjointnessConstraint(
1354
+ await chunkIFTYHOEE_cjs.checkDisjointnessConstraint(
1350
1355
  { graphId, registry, backend: frame.target },
1351
1356
  node.kind,
1352
1357
  node.id
@@ -1413,7 +1418,7 @@ function recordEdgeOutcome(edge, outcome, result, errors) {
1413
1418
  }
1414
1419
  function prepareEdgeImportCreate(graphId, candidate, registration) {
1415
1420
  const { edge, props } = candidate;
1416
- const matchIdentity = chunkWY3IFEKV_cjs.resolveEdgeMatchIdentityStorage(
1421
+ const matchIdentity = chunkIFTYHOEE_cjs.resolveEdgeMatchIdentityStorage(
1417
1422
  registration.matchIdentity,
1418
1423
  {
1419
1424
  fromKind: edge.from.kind,
@@ -1551,7 +1556,7 @@ async function processEdgeSlice(frame, graphId, registry, batch, edgeSchemas, no
1551
1556
  backend: cardinalityValidationBackend,
1552
1557
  registerPendingEdgeForCardinality,
1553
1558
  seedCardinalityRows
1554
- } = chunkWY3IFEKV_cjs.createEdgeBatchValidationBackend(frame.target);
1559
+ } = chunkIFTYHOEE_cjs.createEdgeBatchValidationBackend(frame.target);
1555
1560
  const candidates = [];
1556
1561
  const deferred = [];
1557
1562
  const seenIds = /* @__PURE__ */ new Set();
@@ -1840,7 +1845,7 @@ async function processEdgeSlice(frame, graphId, registry, batch, edgeSchemas, no
1840
1845
  const { candidate, params, cardinality } = prepared;
1841
1846
  const { edge } = candidate;
1842
1847
  const cardinalityResult = await catchDeclaredConstraintRefusal(
1843
- () => chunkWY3IFEKV_cjs.checkCardinalityConstraint(
1848
+ () => chunkIFTYHOEE_cjs.checkCardinalityConstraint(
1844
1849
  { graphId, registry, backend: cardinalityValidationBackend },
1845
1850
  edge.kind,
1846
1851
  cardinality,
@@ -1908,7 +1913,7 @@ async function processEdgeSlice(frame, graphId, registry, batch, edgeSchemas, no
1908
1913
  const rows = await chunkBXHAPCQG_cjs.requireDefined(frame.session.createEdgesDurable)(
1909
1914
  acceptedWork
1910
1915
  );
1911
- const outcomes = chunkWY3IFEKV_cjs.classifyDurableEdgeBatchOutcomes(
1916
+ const outcomes = chunkIFTYHOEE_cjs.classifyDurableEdgeBatchOutcomes(
1912
1917
  accepted.map((prepared) => prepared.params),
1913
1918
  rows
1914
1919
  );
@@ -2105,7 +2110,7 @@ async function processEdge(frame, graphId, registry, edge, edgeSchemas, nodeSche
2105
2110
  }
2106
2111
  const { cardinality, params } = preparation.value;
2107
2112
  const cardinalityResult = await catchDeclaredConstraintRefusal(
2108
- () => chunkWY3IFEKV_cjs.checkCardinalityConstraint(
2113
+ () => chunkIFTYHOEE_cjs.checkCardinalityConstraint(
2109
2114
  { graphId, registry, backend: frame.target },
2110
2115
  edge.kind,
2111
2116
  cardinality,
@@ -2767,7 +2772,7 @@ function nodeParams(graphId, node) {
2767
2772
  };
2768
2773
  }
2769
2774
  function edgeParams(graphId, edge, registration) {
2770
- const matchIdentity = chunkWY3IFEKV_cjs.resolveEdgeMatchIdentityStorage(
2775
+ const matchIdentity = chunkIFTYHOEE_cjs.resolveEdgeMatchIdentityStorage(
2771
2776
  registration.matchIdentity,
2772
2777
  {
2773
2778
  fromKind: edge.from.kind,
@@ -3004,7 +3009,8 @@ exports.exportGraphStream = exportGraphStream;
3004
3009
  exports.importGraph = importGraph;
3005
3010
  exports.importGraphStream = importGraphStream;
3006
3011
  exports.registerIngestionImportTarget = registerIngestionImportTarget;
3012
+ exports.summarizeImportErrors = summarizeImportErrors;
3007
3013
  exports.trustedImportGraph = trustedImportGraph;
3008
3014
  exports.trustedImportGraphStream = trustedImportGraphStream;
3009
- //# sourceMappingURL=chunk-T3VU3YRQ.cjs.map
3010
- //# sourceMappingURL=chunk-T3VU3YRQ.cjs.map
3015
+ //# sourceMappingURL=chunk-6GUBF5TF.cjs.map
3016
+ //# sourceMappingURL=chunk-6GUBF5TF.cjs.map