@muze-nl/simplystore 0.6.5 → 0.6.6
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 +1 -1
- package/src/load-worker.mjs +9 -9
package/package.json
CHANGED
package/src/load-worker.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { parentPort } from 'node:worker_threads'
|
|
2
2
|
import JSONTag from '@muze-nl/jsontag'
|
|
3
|
-
import
|
|
3
|
+
import parse from '@muze-nl/od-jsontag/src/parse.mjs'
|
|
4
4
|
import fs from 'fs'
|
|
5
|
-
import
|
|
6
|
-
import {source} from '
|
|
5
|
+
import serialize from '@muze-nl/od-jsontag/src/serialize.mjs'
|
|
6
|
+
import {source, resultSet} from '@muze-nl/od-jsontag/src/symbols.mjs'
|
|
7
7
|
|
|
8
8
|
parentPort.on('message', datafile => {
|
|
9
9
|
const jsontag = fs.readFileSync(datafile)
|
|
@@ -12,19 +12,19 @@ parentPort.on('message', datafile => {
|
|
|
12
12
|
id: new Map()
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
const data =
|
|
15
|
+
const data = parse(jsontag)
|
|
16
|
+
const resultArr = data[resultSet]
|
|
16
17
|
|
|
17
|
-
//
|
|
18
|
-
let length =
|
|
18
|
+
// od-jsontag/parse doesn't create meta.index.id, so do that here
|
|
19
|
+
let length = resultArr.length
|
|
19
20
|
for (let i=0; i<length; i++) {
|
|
20
|
-
let id=JSONTag.getAttribute(
|
|
21
|
+
let id=JSONTag.getAttribute(resultArr[i][source],'id')
|
|
21
22
|
if (id) {
|
|
22
23
|
meta.index.id.set(id,i)
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
const
|
|
27
|
-
const sab = stringToSAB(strData)
|
|
27
|
+
const sab = serialize(data)
|
|
28
28
|
|
|
29
29
|
parentPort.postMessage({
|
|
30
30
|
data: sab,
|