@kubun/mutation 0.16.0 → 0.17.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 (2) hide show
  1. package/lib/apply.js +2 -1
  2. package/package.json +7 -7
package/lib/apply.js CHANGED
@@ -173,7 +173,8 @@ export async function applyChangeMutation(ctx, mutation) {
173
173
  // A delete is a single root replace to null. It only advances the tombstone
174
174
  // timestamp; it never erases retained field values or field timestamps, so a
175
175
  // later set above the tombstone can revive the exact prior field set.
176
- const isDelete = mutation.patch.length === 1 && mutation.patch[0].op === 'replace' && mutation.patch[0].path === DELETE_KEY && mutation.patch[0].value === null;
176
+ const firstPatch = mutation.patch[0];
177
+ const isDelete = mutation.patch.length === 1 && firstPatch != null && firstPatch.op === 'replace' && firstPatch.path === DELETE_KEY && firstPatch.value === null;
177
178
  if (isDelete) {
178
179
  fieldHLCs[DELETE_KEY] = t == null || mutation.hlc > t ? mutation.hlc : t;
179
180
  const assembled = assemble(fieldValues, fieldHLCs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubun/mutation",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "keywords": [],
5
5
  "license": "see LICENSE.md",
6
6
  "sideEffects": false,
@@ -15,16 +15,16 @@
15
15
  "LICENSE.md"
16
16
  ],
17
17
  "dependencies": {
18
- "@kubun/hlc": "^0.16.0",
19
- "@kubun/id": "^0.16.0",
18
+ "@kubun/hlc": "^0.17.0",
19
+ "@kubun/id": "^0.17.0",
20
20
  "@sozai/codec": "^0.4.0",
21
21
  "@sozai/patch": "^0.1.3",
22
22
  "@sozai/runtime": "^0.1.0",
23
23
  "@sozai/schema": "^0.1.2"
24
24
  },
25
25
  "devDependencies": {
26
- "@kubun/graphql": "^0.16.0",
27
- "@kubun/protocol": "^0.16.0"
26
+ "@kubun/graphql": "^0.17.0",
27
+ "@kubun/protocol": "^0.17.0"
28
28
  },
29
29
  "publishConfig": {
30
30
  "access": "public"
@@ -32,8 +32,8 @@
32
32
  "scripts": {
33
33
  "build": "pnpm run build:clean && pnpm run build:js && pnpm run build:types",
34
34
  "build:clean": "del lib",
35
- "build:js": "swc src -d ./lib --config-file ../../node_modules/@kigu/dev/swc.json --strip-leading-paths",
36
- "build:types": "tsc --emitDeclarationOnly --skipLibCheck",
35
+ "build:js": "del 'lib/**/*.js' && swc src -d ./lib --config-file ../../node_modules/@kigu/dev/swc.json --strip-leading-paths",
36
+ "build:types": "del 'lib/**/*.d.ts' 'lib/**/*.d.ts.map' && tsc --emitDeclarationOnly --skipLibCheck",
37
37
  "build:types:ci": "tsc --emitDeclarationOnly --declarationMap false",
38
38
  "test": "pnpm run test:types && pnpm run test:unit",
39
39
  "test:types": "tsc --noEmit -p tsconfig.test.json",