@live-change/relations-plugin 0.9.23 → 0.9.25

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/package.json +3 -3
  2. package/utilsAny.js +5 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/relations-plugin",
3
- "version": "0.9.23",
3
+ "version": "0.9.25",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "type": "module",
24
24
  "dependencies": {
25
- "@live-change/framework": "^0.9.23",
25
+ "@live-change/framework": "^0.9.25",
26
26
  "pluralize": "^8.0.0"
27
27
  },
28
- "gitHead": "bf65fb9345db4a0fa93ccc827033c766bf52738e"
28
+ "gitHead": "04e2869238087adc1a48784048614e1ee738ad1e"
29
29
  }
package/utilsAny.js CHANGED
@@ -242,12 +242,13 @@ export function defineAnyTypeIndexes(config, context, useId = false) {
242
242
  const table = await input.table(tableName)
243
243
  await table.onChange(async (obj, oldObj) => {
244
244
  const id = obj?.id ?? oldObj?.id
245
- const type = id.slice(0, id.indexOf(':'))
246
- const count = await table.count({ gte: type+':', lte: type+'_\xFF\xFF\xFF\xFF', limit: 1 })
245
+ const typeJson = id.slice(0, id.indexOf(':'))
246
+ const type = JSON.parse(typeJson)
247
+ const count = await table.count({ gte: typeJson+':', lte: type+'_\xFF\xFF\xFF\xFF', limit: 1 })
247
248
  if(count > 0) {
248
- await output.put({ id: JSON.parse(type) })
249
+ await output.put({ id: type })
249
250
  } else {
250
- await output.delete({ id: JSON.parse(type) })
251
+ await output.delete({ id: type })
251
252
  }
252
253
  })
253
254
  },