@live-change/relations-plugin 0.9.22 → 0.9.24
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 +3 -3
- 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.
|
|
3
|
+
"version": "0.9.24",
|
|
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.
|
|
25
|
+
"@live-change/framework": "^0.9.24",
|
|
26
26
|
"pluralize": "^8.0.0"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "491639ed7431a58594e60aedd14fedfb499065a4"
|
|
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
|
|
246
|
-
const
|
|
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:
|
|
249
|
+
await output.put({ id: type })
|
|
249
250
|
} else {
|
|
250
|
-
await output.delete({ id:
|
|
251
|
+
await output.delete({ id: type })
|
|
251
252
|
}
|
|
252
253
|
})
|
|
253
254
|
},
|