electrodb 2.9.1 → 2.9.3

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/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "electrodb",
3
- "version": "2.9.1",
3
+ "version": "2.9.3",
4
4
  "description": "A library to more easily create and interact with multiple entities and heretical relationships in dynamodb",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
+ "build": "sh buildbrowser.sh",
8
+ "build:browser": "browserify playground/browser.js -o playground/bundle.js",
9
+ "test": "./test.sh",
10
+ "test:ci": "npm install && npm test",
7
11
  "test:run": "npm run test:types && npm run test:init && npm run test:unit",
8
12
  "test:init": "node ./test/init.js",
9
13
  "test:unit": "mocha -r ts-node/register ./test/**.spec.*",
@@ -11,14 +15,12 @@
11
15
  "coverage": "npm run test:init && nyc npm run test:unit && nyc report --reporter=text-lcov | coveralls",
12
16
  "coverage:local:coveralls": "npm run test:init && nyc npm run test:unit && nyc report --reporter=text-lcov | coveralls",
13
17
  "coverage:local:html": "npm run test:init && nyc npm run test:unit && nyc report --reporter=html",
14
- "build:browser": "browserify playground/browser.js -o playground/bundle.js",
15
- "build": "sh buildbrowser.sh",
16
- "test": "./test.sh",
17
- "test:ci": "npm install && npm test",
18
18
  "ddb:start": "docker compose up -d",
19
19
  "ddb:load": "docker compose exec electro npm run test:init",
20
20
  "ddb:stop": "docker compose stop",
21
- "example:taskapp": "npm run ddb:start && npm run ddb:load && ts-node ./examples/taskmanager/src/index.ts; npm run ddb:stop"
21
+ "examples:load:library": "npm run ddb:start && ts-node ./examples/library/load.ts",
22
+ "examples:load:taskmanager": "npm run ddb:start && ts-node ./examples/taskmanager/load.ts",
23
+ "examples:load:versioncontrol": "npm run ddb:start && ts-node ./examples/versioncontrol/load.ts"
22
24
  },
23
25
  "repository": {
24
26
  "type": "git",
@@ -32,6 +34,7 @@
32
34
  "homepage": "https://github.com/tywalch/electrodb#readme",
33
35
  "devDependencies": {
34
36
  "@aws-sdk/client-dynamodb": "^3.395.0",
37
+ "@faker-js/faker": "^8.0.2",
35
38
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
36
39
  "@types/chai": "^4.2.12",
37
40
  "@types/mocha": "^8.0.3",
package/src/clauses.js CHANGED
@@ -314,7 +314,7 @@ let clauses = {
314
314
  let record = entity.model.schema.checkCreate({...payload});
315
315
  const attributes = state.getCompositeAttributes();
316
316
  const filter = state.query.filter[ExpressionTypes.ConditionExpression];
317
- const {pk, sk} = entity._getPrimaryIndexFieldNames();
317
+ const { pk, sk } = entity._getPrimaryIndexFieldNames();
318
318
  filter.unsafeSet(FilterOperationNames.notExists, pk);
319
319
  if (sk) {
320
320
  filter.unsafeSet(FilterOperationNames.notExists, sk);
package/src/entity.js CHANGED
@@ -2397,7 +2397,7 @@ class Entity {
2397
2397
  let keyTranslations = this.model.translations.keys;
2398
2398
  let keyAttributes = { ...sk, ...pk };
2399
2399
  let completeFacets = this._expectIndexFacets(
2400
- { ...set },
2400
+ { ...setAttributes },
2401
2401
  { ...keyAttributes },
2402
2402
  );
2403
2403
 
package/src/operations.js CHANGED
@@ -262,6 +262,12 @@ const FilterOperations = {
262
262
  },
263
263
  strict: false,
264
264
  canNest: true,
265
+ },
266
+ eqOrNotExists: {
267
+ template: function eq(options, attr, name, value) {
268
+ return `(${name} = ${value} OR attribute_not_exists(${name}))`;
269
+ },
270
+ strict: false,
265
271
  }
266
272
  };
267
273