graphddb 1.0.0 → 1.0.2

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.
package/dist/cdc/index.js CHANGED
@@ -8,12 +8,12 @@ import {
8
8
  createMaintenanceDrainHandler,
9
9
  hashString,
10
10
  shardIdFor
11
- } from "../chunk-VECUS35D.js";
11
+ } from "../chunk-CRC4XO47.js";
12
12
  import {
13
13
  buildSubscribeHandler,
14
14
  parseChange
15
- } from "../chunk-7OCXY4R6.js";
16
- import "../chunk-GWWRXIHF.js";
15
+ } from "../chunk-XVOJUIU6.js";
16
+ import "../chunk-LGTNDCBI.js";
17
17
  import "../chunk-XTWXMOHD.js";
18
18
  export {
19
19
  CdcEmulator,
@@ -2,7 +2,7 @@ import {
2
2
  PREPARED_FORMAT_VERSION,
3
3
  buildManifest,
4
4
  entityFingerprint
5
- } from "./chunk-PHXUFAY2.js";
5
+ } from "./chunk-4NB7PQ62.js";
6
6
  import {
7
7
  analyzeWriteRoute,
8
8
  assertBundleSerializable,
@@ -21,12 +21,12 @@ import {
21
21
  isContractKeyRef,
22
22
  isContractParamRef,
23
23
  isQueryModelContract
24
- } from "./chunk-HLFNCKFV.js";
24
+ } from "./chunk-OVTNN7FF.js";
25
25
  import {
26
26
  detectRelationFields,
27
27
  isInlineSnapshotSpec,
28
28
  normalizeSelectSpec
29
- } from "./chunk-7OCXY4R6.js";
29
+ } from "./chunk-XVOJUIU6.js";
30
30
  import {
31
31
  EXPR_VERSION,
32
32
  MARKER_ROW_ENTITY,
@@ -46,7 +46,7 @@ import {
46
46
  isRawCondition,
47
47
  param,
48
48
  resolveModelClass
49
- } from "./chunk-GWWRXIHF.js";
49
+ } from "./chunk-LGTNDCBI.js";
50
50
  import {
51
51
  TableMapping,
52
52
  isColumn,
@@ -388,6 +388,9 @@ function usesConditionTree(obj) {
388
388
  return false;
389
389
  }
390
390
  function convertConditionTree(obj, place, context) {
391
+ if (obj.notExists === true) return { notExists: true };
392
+ if (typeof obj.attributeExists === "string") return { attributeExists: obj.attributeExists };
393
+ if (typeof obj.attributeNotExists === "string") return { attributeNotExists: obj.attributeNotExists };
391
394
  const out = {};
392
395
  for (const [key, value] of Object.entries(obj)) {
393
396
  if (value === void 0) continue;
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  evaluateKey
3
- } from "./chunk-HLFNCKFV.js";
3
+ } from "./chunk-OVTNN7FF.js";
4
4
  import {
5
5
  SPEC_VERSION_KEY_EXPR
6
6
  } from "./chunk-WOFRHRXY.js";
7
7
  import {
8
8
  MetadataRegistry
9
- } from "./chunk-GWWRXIHF.js";
9
+ } from "./chunk-LGTNDCBI.js";
10
10
  import {
11
11
  TableMapping
12
12
  } from "./chunk-XTWXMOHD.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildMaintenanceGraph
3
- } from "./chunk-7OCXY4R6.js";
3
+ } from "./chunk-XVOJUIU6.js";
4
4
  import {
5
5
  ChangeCaptureRegistry,
6
6
  ClientManager,
@@ -9,7 +9,7 @@ import {
9
9
  buildDeleteInput,
10
10
  buildPutInput,
11
11
  resolveModelClass
12
- } from "./chunk-GWWRXIHF.js";
12
+ } from "./chunk-LGTNDCBI.js";
13
13
 
14
14
  // src/cdc/prng.ts
15
15
  var SeededRandom = class {
@@ -1258,6 +1258,13 @@ function compileNode(ctx, node) {
1258
1258
  if (isRawCondition(node)) {
1259
1259
  return compileRaw(ctx, node);
1260
1260
  }
1261
+ if (node.notExists === true) return "attribute_not_exists(PK)";
1262
+ if (typeof node.attributeExists === "string") {
1263
+ return `attribute_exists(${nameAlias(ctx, node.attributeExists)})`;
1264
+ }
1265
+ if (typeof node.attributeNotExists === "string") {
1266
+ return `attribute_not_exists(${nameAlias(ctx, node.attributeNotExists)})`;
1267
+ }
1261
1268
  const clauses = [];
1262
1269
  for (const [key, value] of Object.entries(node)) {
1263
1270
  if (value === void 0) continue;
@@ -1294,6 +1301,9 @@ function resolveLeaf(value, resolveParam) {
1294
1301
  }
1295
1302
  function resolveNode(node, resolveParam) {
1296
1303
  const obj = node;
1304
+ if (obj.notExists === true) return { notExists: true };
1305
+ if (typeof obj.attributeExists === "string") return { attributeExists: obj.attributeExists };
1306
+ if (typeof obj.attributeNotExists === "string") return { attributeNotExists: obj.attributeNotExists };
1297
1307
  const out = {};
1298
1308
  for (const [key, value] of Object.entries(obj)) {
1299
1309
  if (key === "and" || key === "or") {
@@ -2095,6 +2105,19 @@ function buildUpdateInput(modelClass, entity, changes, options) {
2095
2105
  values,
2096
2106
  options
2097
2107
  );
2108
+ const keySourceSetClauses = [];
2109
+ if (!options?.addOnly) {
2110
+ meta.primaryKey.inputFieldNames.forEach((fieldName, i) => {
2111
+ const raw = entity[fieldName];
2112
+ if (raw === void 0) return;
2113
+ const nameKey = `#ks${i}`;
2114
+ const valueKey = `:ks${i}`;
2115
+ const fieldMeta = fieldMap.get(fieldName);
2116
+ names[nameKey] = fieldName;
2117
+ values[valueKey] = fieldMeta ? serializeFieldValue(raw, fieldMeta) : raw;
2118
+ keySourceSetClauses.push(`${nameKey} = ${valueKey}`);
2119
+ });
2120
+ }
2098
2121
  let conditionExpression;
2099
2122
  if (options?.condition) {
2100
2123
  const condResult = buildConditionExpression(options.condition);
@@ -2102,7 +2125,10 @@ function buildUpdateInput(modelClass, entity, changes, options) {
2102
2125
  Object.assign(names, condResult.names);
2103
2126
  Object.assign(values, condResult.values);
2104
2127
  }
2105
- const setPortion = appendSetClauses(updateResult.expression, gsiSetClauses);
2128
+ const setPortion = appendSetClauses(updateResult.expression, [
2129
+ ...gsiSetClauses,
2130
+ ...keySourceSetClauses
2131
+ ]);
2106
2132
  const addPortion = addClauses.length > 0 ? `ADD ${addClauses.join(", ")}` : "";
2107
2133
  const updateExpression = [setPortion, addPortion].filter((s) => s !== "").join(" ");
2108
2134
  const updateInput = {
@@ -17,7 +17,7 @@ import {
17
17
  normalizeTopLevelSelect,
18
18
  parseChange,
19
19
  validateInlineSnapshotSelect
20
- } from "./chunk-7OCXY4R6.js";
20
+ } from "./chunk-XVOJUIU6.js";
21
21
  import {
22
22
  EXPR_VERSION,
23
23
  MARKER_ROW_ENTITY,
@@ -61,7 +61,7 @@ import {
61
61
  serializeFieldValue,
62
62
  serializeRawCondition,
63
63
  skTemplate
64
- } from "./chunk-GWWRXIHF.js";
64
+ } from "./chunk-LGTNDCBI.js";
65
65
  import {
66
66
  TableMapping,
67
67
  createColumnMap,
@@ -188,6 +188,9 @@ function conditionParamName(field, op, index) {
188
188
  return field;
189
189
  }
190
190
  function buildTree(obj, context, renderTreeLeaf) {
191
+ if (obj.notExists === true) return { notExists: true };
192
+ if (typeof obj.attributeExists === "string") return { attributeExists: obj.attributeExists };
193
+ if (typeof obj.attributeNotExists === "string") return { attributeNotExists: obj.attributeNotExists };
191
194
  const out = {};
192
195
  for (const key of Object.keys(obj).sort()) {
193
196
  const value = obj[key];
@@ -2551,6 +2554,8 @@ async function executeSingleWrite(w, retry) {
2551
2554
  if (!isConditionalCheckFailure(e)) throw e;
2552
2555
  const fallbackOptions = {
2553
2556
  add: w.add,
2557
+ addOnly: true,
2558
+ // #333: skip the key-source SET (row already exists here)
2554
2559
  ...retry !== void 0 ? { retry } : {}
2555
2560
  };
2556
2561
  await executeUpdate(w.modelClass, w.key, {}, fallbackOptions);
@@ -4938,6 +4943,9 @@ function descriptorConditionRecord(record, name) {
4938
4943
  return descriptorConditionTree(top, name, `publishCommand: method '${name}' condition`);
4939
4944
  }
4940
4945
  function descriptorConditionTree(obj, name, context) {
4946
+ if (obj.notExists === true || typeof obj.attributeExists === "string" || typeof obj.attributeNotExists === "string") {
4947
+ return { ...obj };
4948
+ }
4941
4949
  const out = {};
4942
4950
  for (const [key, value] of Object.entries(obj)) {
4943
4951
  if (value === void 0) continue;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MetadataRegistry,
3
3
  attachHiddenKey
4
- } from "./chunk-GWWRXIHF.js";
4
+ } from "./chunk-LGTNDCBI.js";
5
5
  import {
6
6
  resolveKey,
7
7
  segmentFieldNames
package/dist/cli.js CHANGED
@@ -4,16 +4,16 @@ import {
4
4
  buildOperations,
5
5
  portableIrDocument,
6
6
  renderKeyExprToTemplate
7
- } from "./chunk-5NBQYFM5.js";
7
+ } from "./chunk-4DIS4RY7.js";
8
8
  import {
9
9
  buildManifest
10
- } from "./chunk-PHXUFAY2.js";
11
- import "./chunk-HLFNCKFV.js";
12
- import "./chunk-7OCXY4R6.js";
10
+ } from "./chunk-4NB7PQ62.js";
11
+ import "./chunk-OVTNN7FF.js";
12
+ import "./chunk-XVOJUIU6.js";
13
13
  import "./chunk-WOFRHRXY.js";
14
14
  import {
15
15
  MetadataRegistry
16
- } from "./chunk-GWWRXIHF.js";
16
+ } from "./chunk-LGTNDCBI.js";
17
17
  import {
18
18
  createDefaultLinter
19
19
  } from "./chunk-XTWXMOHD.js";
package/dist/index.js CHANGED
@@ -3,13 +3,13 @@ import {
3
3
  mutate,
4
4
  publishCommand,
5
5
  publishQuery
6
- } from "./chunk-HLFNCKFV.js";
6
+ } from "./chunk-OVTNN7FF.js";
7
7
  import {
8
8
  entityWrites,
9
9
  getEntityWrites,
10
10
  identity,
11
11
  preview
12
- } from "./chunk-7OCXY4R6.js";
12
+ } from "./chunk-XVOJUIU6.js";
13
13
  import {
14
14
  when
15
15
  } from "./chunk-WOFRHRXY.js";
@@ -22,7 +22,7 @@ import {
22
22
  deriveContractEffect,
23
23
  gsi,
24
24
  param
25
- } from "./chunk-GWWRXIHF.js";
25
+ } from "./chunk-LGTNDCBI.js";
26
26
  import {
27
27
  TableMapping,
28
28
  k,
@@ -2,15 +2,15 @@ import {
2
2
  PREPARED_FORMAT_VERSION,
3
3
  buildManifestEntity,
4
4
  entityFingerprint
5
- } from "../chunk-PHXUFAY2.js";
5
+ } from "../chunk-4NB7PQ62.js";
6
6
  import {
7
7
  LOGICAL_EFFECT_CATEGORIES,
8
8
  PreparedReadStatement,
9
9
  executeLogicalParallelWrites,
10
10
  executeLogicalWriteOps,
11
11
  serializeEffectParams
12
- } from "../chunk-HLFNCKFV.js";
13
- import "../chunk-7OCXY4R6.js";
12
+ } from "../chunk-OVTNN7FF.js";
13
+ import "../chunk-XVOJUIU6.js";
14
14
  import {
15
15
  MARKER_ROW_ENTITY,
16
16
  SPEC_VERSION_KEY_EXPR,
@@ -21,7 +21,7 @@ import {
21
21
  buildConditionExpression,
22
22
  execItemKeySignature,
23
23
  resolveConditionTree
24
- } from "../chunk-GWWRXIHF.js";
24
+ } from "../chunk-LGTNDCBI.js";
25
25
  import {
26
26
  TableMapping
27
27
  } from "../chunk-XTWXMOHD.js";
@@ -14,14 +14,14 @@ import {
14
14
  collectContractN1Violations,
15
15
  compilePreparedPlan,
16
16
  portableIrDocument
17
- } from "../chunk-5NBQYFM5.js";
17
+ } from "../chunk-4DIS4RY7.js";
18
18
  import {
19
19
  PREPARED_FORMAT_VERSION,
20
20
  buildManifest,
21
21
  canonicalJson,
22
22
  entityFingerprint,
23
23
  planFingerprint
24
- } from "../chunk-PHXUFAY2.js";
24
+ } from "../chunk-4NB7PQ62.js";
25
25
  import {
26
26
  MAX_TRANSACT_COMPOSE_ITEMS,
27
27
  assertBundleSerializable,
@@ -36,8 +36,8 @@ import {
36
36
  resetMaintenanceGraphCache,
37
37
  resolveLifecycle,
38
38
  resolveMaintainers
39
- } from "../chunk-HLFNCKFV.js";
40
- import "../chunk-7OCXY4R6.js";
39
+ } from "../chunk-OVTNN7FF.js";
40
+ import "../chunk-XVOJUIU6.js";
41
41
  import {
42
42
  EXPR_VERSION,
43
43
  SPEC_VERSION,
@@ -47,7 +47,7 @@ import {
47
47
  canonicalizeExpressionSpec,
48
48
  operationsSpecVersion
49
49
  } from "../chunk-WOFRHRXY.js";
50
- import "../chunk-GWWRXIHF.js";
50
+ import "../chunk-LGTNDCBI.js";
51
51
  import "../chunk-XTWXMOHD.js";
52
52
  export {
53
53
  EXPR_VERSION,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createCdcEmulator
3
- } from "../chunk-VECUS35D.js";
4
- import "../chunk-7OCXY4R6.js";
3
+ } from "../chunk-CRC4XO47.js";
4
+ import "../chunk-XVOJUIU6.js";
5
5
  import {
6
6
  ClientManager,
7
7
  MetadataRegistry,
8
8
  resolveModelClass
9
- } from "../chunk-GWWRXIHF.js";
9
+ } from "../chunk-LGTNDCBI.js";
10
10
  import {
11
11
  TableMapping
12
12
  } from "../chunk-XTWXMOHD.js";
@@ -3,7 +3,7 @@ import {
3
3
  SCP_LOWERED_MARKER,
4
4
  canonicalizeExpressionSpec
5
5
  } from "../chunk-WOFRHRXY.js";
6
- import "../chunk-GWWRXIHF.js";
6
+ import "../chunk-LGTNDCBI.js";
7
7
  import "../chunk-XTWXMOHD.js";
8
8
 
9
9
  // src/transform/prepared-transform.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphddb",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Graph data modeling on DynamoDB with adjacency list pattern",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",