@awsless/dynamodb-server 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +14 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1266,6 +1266,20 @@ function resolveOperand(item, operand, context) {
1266
1266
  if (operand.startsWith(":")) {
1267
1267
  return context.expressionAttributeValues?.[operand];
1268
1268
  }
1269
+ const ifNotExistsMatch = operand.match(/^if_not_exists\s*\(\s*([^,]+)\s*,\s*(.+)\s*\)$/i);
1270
+ if (ifNotExistsMatch) {
1271
+ const existing = resolveOperand(item, ifNotExistsMatch[1].trim(), context);
1272
+ return existing !== void 0 ? existing : resolveOperand(item, ifNotExistsMatch[2].trim(), context);
1273
+ }
1274
+ const listAppendMatch = operand.match(/^list_append\s*\(\s*([^,]+)\s*,\s*(.+)\s*\)$/i);
1275
+ if (listAppendMatch) {
1276
+ const list1 = resolveOperand(item, listAppendMatch[1].trim(), context);
1277
+ const list2 = resolveOperand(item, listAppendMatch[2].trim(), context);
1278
+ if (list1 && "L" in list1 && list2 && "L" in list2) {
1279
+ return { L: [...list1.L, ...list2.L] };
1280
+ }
1281
+ return list1 && "L" in list1 ? list1 : list2;
1282
+ }
1269
1283
  const segments = parsePath(operand, context.expressionAttributeNames);
1270
1284
  return getValueAtPath(item, segments);
1271
1285
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/dynamodb-server",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",