@nicia-ai/typegraph 0.42.1 → 0.43.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 (49) hide show
  1. package/dist/backend/postgres/pglite-store.cjs +4 -4
  2. package/dist/backend/postgres/pglite-store.d.cts +1 -1
  3. package/dist/backend/postgres/pglite-store.d.ts +1 -1
  4. package/dist/backend/postgres/pglite-store.js +3 -3
  5. package/dist/backend/sqlite/local-store.cjs +4 -4
  6. package/dist/backend/sqlite/local-store.d.cts +1 -1
  7. package/dist/backend/sqlite/local-store.d.ts +1 -1
  8. package/dist/backend/sqlite/local-store.js +3 -3
  9. package/dist/{chunk-5P6IPIT6.cjs → chunk-64LERBFM.cjs} +17 -17
  10. package/dist/{chunk-5P6IPIT6.cjs.map → chunk-64LERBFM.cjs.map} +1 -1
  11. package/dist/{chunk-K2HHCWZO.cjs → chunk-BLBG2VZ5.cjs} +51 -51
  12. package/dist/{chunk-K2HHCWZO.cjs.map → chunk-BLBG2VZ5.cjs.map} +1 -1
  13. package/dist/{chunk-EVFL2ZY5.js → chunk-CTWZPYJW.js} +2 -2
  14. package/dist/chunk-CTWZPYJW.js.map +1 -0
  15. package/dist/{chunk-DP7KC6CL.js → chunk-JNXZQBN3.js} +72 -25
  16. package/dist/chunk-JNXZQBN3.js.map +1 -0
  17. package/dist/{chunk-2SO5I5AI.cjs → chunk-KDRF3NR2.cjs} +2 -2
  18. package/dist/chunk-KDRF3NR2.cjs.map +1 -0
  19. package/dist/{chunk-WYQILW5V.js → chunk-L2BYRYHC.js} +4 -4
  20. package/dist/{chunk-WYQILW5V.js.map → chunk-L2BYRYHC.js.map} +1 -1
  21. package/dist/{chunk-6NB73BXV.js → chunk-L5AUCL5P.js} +3 -3
  22. package/dist/{chunk-6NB73BXV.js.map → chunk-L5AUCL5P.js.map} +1 -1
  23. package/dist/{chunk-277UZV7X.cjs → chunk-NDQLPKBX.cjs} +315 -268
  24. package/dist/chunk-NDQLPKBX.cjs.map +1 -0
  25. package/dist/graph-merge/index.cjs +25 -25
  26. package/dist/graph-merge/index.d.cts +1 -1
  27. package/dist/graph-merge/index.d.ts +1 -1
  28. package/dist/graph-merge/index.js +4 -4
  29. package/dist/index.cjs +49 -49
  30. package/dist/index.d.cts +2 -2
  31. package/dist/index.d.ts +2 -2
  32. package/dist/index.js +3 -3
  33. package/dist/interchange/index.cjs +22 -22
  34. package/dist/interchange/index.d.cts +1 -1
  35. package/dist/interchange/index.d.ts +1 -1
  36. package/dist/interchange/index.js +3 -3
  37. package/dist/profiler/index.d.cts +1 -1
  38. package/dist/profiler/index.d.ts +1 -1
  39. package/dist/provenance/index.cjs +10 -10
  40. package/dist/provenance/index.d.cts +1 -1
  41. package/dist/provenance/index.d.ts +1 -1
  42. package/dist/provenance/index.js +1 -1
  43. package/dist/{store-view-CNcOG8bQ.d.cts → store-view-D1F6KqsE.d.cts} +18 -1
  44. package/dist/{store-view-6C2vTWqf.d.ts → store-view-DdwBNjZQ.d.ts} +18 -1
  45. package/package.json +1 -1
  46. package/dist/chunk-277UZV7X.cjs.map +0 -1
  47. package/dist/chunk-2SO5I5AI.cjs.map +0 -1
  48. package/dist/chunk-DP7KC6CL.js.map +0 -1
  49. package/dist/chunk-EVFL2ZY5.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { createEdgeRowMapper, createNodeRowMapper, SQLITE_ROW_MAPPER_CONFIG, POSTGRES_ROW_MAPPER_CONFIG } from './chunk-CVNGKTHO.js';
2
- import { rowToNode, executeNodeBulkFindByIndex, executeNodeBulkFindByConstraint, executeNodeFindByConstraint, executeNodeBulkGetOrCreateByConstraint, executeNodeGetOrCreateByConstraint, executeNodeHardDelete, executeNodeDelete, nodeUpsertDirtyCheck, executeNodeUpsertUpdate, executeNodeUpdate, executeNodeCreateNoReturnBatch, executeNodeCreateBatch, executeNodeCreate, rowToEdge, runInWriteTransaction, checkCardinalityConstraint, runHookedWriteOperation, rowToNodeMeta, rowToEdgeMeta } from './chunk-6NB73BXV.js';
3
- import { isParameterRef, fieldRef, buildFieldBuilderForTypeInfo, stringField, createFulltextAccessor, storeRuntime, CURRENT_READ_INSTANT_PLACEHOLDER, withPinnedReadInstant, STORE_RUNTIME, assertRevisionTrackableBackend, createRecordedBackend, readRecordedClock, ensureRevisionOrigin, TRANSACTION_RUNTIME, withRecordedFlushObserver, recordedCaptureRequiresCallbackTransactionError, assertRecordedCaptureTransactionIsolation, createRecordedTransactionScope, lockRecordedGraphWrite, generateId, createGraphBackendProjection, assertCurrentRecordedSchema, baseField, objectField, arrayField, dateField, numberField, computeFulltextContent, AUTO_REFRESH_STATISTICS_ROW_THRESHOLD, advanceRevisionClock, runInsertBatch, edgeInsertDispatch, runInsertBatchReturning, projectBackendMembers, sqlValueList, getEmbeddingFields, getNodeRowsByIds, getEdgeRowsByIds, compileKindFilter, currentReadInstant, compileTemporalFilter, validateEdgeEndpoints, buildPredicateIndex, compileFieldValue, recordedBindParamBudget, extractVectorSimilarityPredicates, extractFulltextMatchPredicates, currentReadInstantFor, extractTemporalOptions, compilePredicateExpression, getPredicatesForAlias, getFieldPointer, getNodeKindsForAlias, getHybridTargetAlias, closeRecordedHardDeletedKind, throwHistoryUnsafeSqlAccess, throwRevisionTrackingUnsafeSqlAccess, compilePredicateClauses } from './chunk-EVFL2ZY5.js';
2
+ import { rowToNode, executeNodeBulkFindByIndex, executeNodeBulkFindByConstraint, executeNodeFindByConstraint, executeNodeBulkGetOrCreateByConstraint, executeNodeGetOrCreateByConstraint, executeNodeHardDelete, executeNodeDelete, nodeUpsertDirtyCheck, executeNodeUpsertUpdate, executeNodeUpdate, executeNodeCreateNoReturnBatch, executeNodeCreateBatch, executeNodeCreate, rowToEdge, runInWriteTransaction, checkCardinalityConstraint, runHookedWriteOperation, rowToNodeMeta, rowToEdgeMeta } from './chunk-L5AUCL5P.js';
3
+ import { isParameterRef, fieldRef, buildFieldBuilderForTypeInfo, stringField, createFulltextAccessor, storeRuntime, CURRENT_READ_INSTANT_PLACEHOLDER, withPinnedReadInstant, STORE_RUNTIME, assertRevisionTrackableBackend, createRecordedBackend, readRecordedClock, ensureRevisionOrigin, TRANSACTION_RUNTIME, withRecordedFlushObserver, recordedCaptureRequiresCallbackTransactionError, assertRecordedCaptureTransactionIsolation, createRecordedTransactionScope, lockRecordedGraphWrite, generateId, createGraphBackendProjection, assertCurrentRecordedSchema, baseField, objectField, arrayField, dateField, numberField, computeFulltextContent, AUTO_REFRESH_STATISTICS_ROW_THRESHOLD, advanceRevisionClock, runInsertBatch, edgeInsertDispatch, runInsertBatchReturning, projectBackendMembers, sqlValueList, getEmbeddingFields, getNodeRowsByIds, getEdgeRowsByIds, compileKindFilter, currentReadInstant, compileTemporalFilter, validateEdgeEndpoints, buildPredicateIndex, compileFieldValue, recordedBindParamBudget, extractVectorSimilarityPredicates, extractFulltextMatchPredicates, currentReadInstantFor, extractTemporalOptions, compilePredicateExpression, getPredicatesForAlias, getFieldPointer, getNodeKindsForAlias, getHybridTargetAlias, closeRecordedHardDeletedKind, throwHistoryUnsafeSqlAccess, throwRevisionTrackingUnsafeSqlAccess, compilePredicateClauses } from './chunk-CTWZPYJW.js';
4
4
  import { chunk } from './chunk-35S6P5ZU.js';
5
5
  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-CDYRPI5U.js';
6
6
  import { runOptionallyInTransaction, createTransactionReadBackend, rowPropsToObject, createBackendOverlay, INTERNAL_TEMPORARY_WRITES } from './chunk-UZLEQFTV.js';
@@ -13830,11 +13830,18 @@ function createEdgeCollection(config) {
13830
13830
  return result === void 0 ? void 0 : narrowEdge(result);
13831
13831
  },
13832
13832
  async getOrCreateByEndpoints(from, to, props, options) {
13833
- const getOrCreateOptions = {};
13834
- if (options?.matchOn !== void 0)
13835
- getOrCreateOptions.matchOn = options.matchOn;
13836
- if (options?.ifExists !== void 0)
13837
- getOrCreateOptions.ifExists = options.ifExists;
13833
+ const getOrCreateOptions = {
13834
+ ...options?.matchOn !== void 0 && {
13835
+ matchOn: options.matchOn
13836
+ },
13837
+ ...options?.ifExists !== void 0 && {
13838
+ ifExists: options.ifExists
13839
+ },
13840
+ ...options?.validFrom !== void 0 && {
13841
+ validFrom: options.validFrom
13842
+ },
13843
+ ...options?.validTo !== void 0 && { validTo: options.validTo }
13844
+ };
13838
13845
  const result = await config.executeGetOrCreateByEndpoints(
13839
13846
  kind,
13840
13847
  from.kind,
@@ -13854,13 +13861,18 @@ function createEdgeCollection(config) {
13854
13861
  fromId: item.from.id,
13855
13862
  toKind: item.to.kind,
13856
13863
  toId: item.to.id,
13857
- props: item.props
13864
+ props: item.props,
13865
+ ...item.validFrom !== void 0 && { validFrom: item.validFrom },
13866
+ ...item.validTo !== void 0 && { validTo: item.validTo }
13858
13867
  }));
13859
- const getOrCreateOptions = {};
13860
- if (options?.matchOn !== void 0)
13861
- getOrCreateOptions.matchOn = options.matchOn;
13862
- if (options?.ifExists !== void 0)
13863
- getOrCreateOptions.ifExists = options.ifExists;
13868
+ const getOrCreateOptions = {
13869
+ ...options?.matchOn !== void 0 && {
13870
+ matchOn: options.matchOn
13871
+ },
13872
+ ...options?.ifExists !== void 0 && {
13873
+ ifExists: options.ifExists
13874
+ }
13875
+ };
13864
13876
  const getOrCreateAll = async (target) => {
13865
13877
  const results = await config.executeBulkGetOrCreateByEndpoints(
13866
13878
  kind,
@@ -16062,6 +16074,11 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
16062
16074
  operation: "create"
16063
16075
  });
16064
16076
  validateMatchOnFields(edgeKind.schema, matchOn, kind);
16077
+ const validFrom = validateOptionalCanonicalIsoDate(
16078
+ options?.validFrom,
16079
+ "validFrom"
16080
+ );
16081
+ const validTo = validateOptionalCanonicalIsoDate(options?.validTo, "validTo");
16065
16082
  if (ifExists === "return") {
16066
16083
  const probeRows = await backend.findEdgesByKind({
16067
16084
  graphId: ctx.graphId,
@@ -16105,7 +16122,9 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
16105
16122
  fromId,
16106
16123
  toKind,
16107
16124
  toId,
16108
- props: validatedProps
16125
+ props: validatedProps,
16126
+ ...validFrom !== void 0 && { validFrom },
16127
+ ...validTo !== void 0 && { validTo }
16109
16128
  };
16110
16129
  const edge2 = await executeEdgeCreate(ctx, input, backend);
16111
16130
  return { edge: edge2, action: "created" };
@@ -16116,7 +16135,11 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
16116
16135
  }
16117
16136
  const edge2 = await executeEdgeUpsertUpdate(
16118
16137
  ctx,
16119
- { id: liveRow.id, props: validatedProps },
16138
+ {
16139
+ id: liveRow.id,
16140
+ props: validatedProps,
16141
+ ...validTo !== void 0 && { validTo }
16142
+ },
16120
16143
  backend
16121
16144
  );
16122
16145
  return { edge: edge2, action: "updated" };
@@ -16126,7 +16149,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
16126
16149
  throw new Error("Expected deletedRow to be defined");
16127
16150
  }
16128
16151
  const matchedDeletedRow = deletedRow;
16129
- const effectiveValidTo = matchedDeletedRow.valid_to;
16152
+ const effectiveValidTo = validTo ?? matchedDeletedRow.valid_to;
16130
16153
  const constraintContext = {
16131
16154
  graphId: ctx.graphId,
16132
16155
  registry: ctx.registry,
@@ -16144,7 +16167,11 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
16144
16167
  );
16145
16168
  const edge = await executeEdgeUpsertUpdate(
16146
16169
  ctx,
16147
- { id: matchedDeletedRow.id, props: validatedProps },
16170
+ {
16171
+ id: matchedDeletedRow.id,
16172
+ props: validatedProps,
16173
+ ...validTo !== void 0 && { validTo }
16174
+ },
16148
16175
  backend,
16149
16176
  { clearDeleted: true }
16150
16177
  );
@@ -16171,6 +16198,11 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
16171
16198
  kind,
16172
16199
  operation: "create"
16173
16200
  });
16201
+ const validFrom = validateOptionalCanonicalIsoDate(
16202
+ item.validFrom,
16203
+ "validFrom"
16204
+ );
16205
+ const validTo = validateOptionalCanonicalIsoDate(item.validTo, "validTo");
16174
16206
  const compositeKey = buildEdgeCompositeKey(
16175
16207
  item.fromKind,
16176
16208
  item.fromId,
@@ -16192,7 +16224,9 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
16192
16224
  toId: item.toId,
16193
16225
  validatedProps,
16194
16226
  compositeKey,
16195
- endpointKey
16227
+ endpointKey,
16228
+ ...validFrom !== void 0 && { validFrom },
16229
+ ...validTo !== void 0 && { validTo }
16196
16230
  });
16197
16231
  }
16198
16232
  const uniqueEndpoints = /* @__PURE__ */ new Map();
@@ -16250,7 +16284,11 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
16250
16284
  fromId: entry2.fromId,
16251
16285
  toKind: entry2.toKind,
16252
16286
  toId: entry2.toId,
16253
- props: entry2.validatedProps
16287
+ props: entry2.validatedProps,
16288
+ ...entry2.validFrom !== void 0 && {
16289
+ validFrom: entry2.validFrom
16290
+ },
16291
+ ...entry2.validTo !== void 0 && { validTo: entry2.validTo }
16254
16292
  }
16255
16293
  });
16256
16294
  } else {
@@ -16266,7 +16304,8 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
16266
16304
  fromKind: entry2.fromKind,
16267
16305
  fromId: entry2.fromId,
16268
16306
  toKind: entry2.toKind,
16269
- toId: entry2.toId
16307
+ toId: entry2.toId,
16308
+ ...entry2.validTo !== void 0 && { validTo: entry2.validTo }
16270
16309
  });
16271
16310
  }
16272
16311
  }
@@ -16310,7 +16349,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
16310
16349
  }
16311
16350
  for (const entry2 of toFetch) {
16312
16351
  if (entry2.isDeleted) {
16313
- const effectiveValidTo = entry2.row.valid_to;
16352
+ const effectiveValidTo = entry2.validTo ?? entry2.row.valid_to;
16314
16353
  const constraintContext = {
16315
16354
  graphId: ctx.graphId,
16316
16355
  registry: ctx.registry,
@@ -16328,7 +16367,11 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
16328
16367
  );
16329
16368
  const edge = await executeEdgeUpsertUpdate(
16330
16369
  ctx,
16331
- { id: entry2.row.id, props: entry2.validatedProps },
16370
+ {
16371
+ id: entry2.row.id,
16372
+ props: entry2.validatedProps,
16373
+ ...entry2.validTo !== void 0 && { validTo: entry2.validTo }
16374
+ },
16332
16375
  target,
16333
16376
  { clearDeleted: true }
16334
16377
  );
@@ -16336,7 +16379,11 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
16336
16379
  } else if (ifExists === "update") {
16337
16380
  const edge = await executeEdgeUpsertUpdate(
16338
16381
  ctx,
16339
- { id: entry2.row.id, props: entry2.validatedProps },
16382
+ {
16383
+ id: entry2.row.id,
16384
+ props: entry2.validatedProps,
16385
+ ...entry2.validTo !== void 0 && { validTo: entry2.validTo }
16386
+ },
16340
16387
  target
16341
16388
  );
16342
16389
  results[entry2.index] = { edge, action: "updated" };
@@ -19306,5 +19353,5 @@ async function createVerifiedAdapterStore(graph, backend, options) {
19306
19353
  }
19307
19354
 
19308
19355
  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 };
19309
- //# sourceMappingURL=chunk-DP7KC6CL.js.map
19310
- //# sourceMappingURL=chunk-DP7KC6CL.js.map
19356
+ //# sourceMappingURL=chunk-JNXZQBN3.js.map
19357
+ //# sourceMappingURL=chunk-JNXZQBN3.js.map