@muze-nl/simplystore 0.1.5 → 0.1.7

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/src/test.mjs DELETED
@@ -1,20 +0,0 @@
1
- import {VM} from 'vm2'
2
-
3
- const vm = new VM({
4
- allowAsync: false,
5
- wasm: false
6
- })
7
- let data = [1,2,3]
8
- vm.freeze(data, 'data') // adds immutable result dataspace to sandbox as data
9
- let result = vm.run(`
10
- data.pop()
11
- `)
12
- console.log(result)
13
- result = vm.run(`
14
- data.pop()
15
- `)
16
- console.log(result)
17
- result = vm.run(`
18
- data.pop()
19
- `)
20
- console.log(result)
package/src/testrefs.mjs DELETED
@@ -1,59 +0,0 @@
1
- import fs from 'fs'
2
- import JSONTag from '@muze-nl/jsontag'
3
-
4
- function createReference(meta, obj, prop, value) {
5
- if (!meta.references) {
6
- meta.references = new WeakMap()
7
- }
8
- if (!meta.references.has(value)) {
9
- meta.references.set(value, {})
10
- }
11
- let refs = meta.references.get(value)
12
- if (!refs[prop]) {
13
- refs[prop] = []
14
- }
15
- refs[prop].push(obj)
16
- }
17
-
18
- let seenRefs = new WeakMap()
19
- function indexReferences(obj, meta) {
20
- if (seenRefs.has(obj)) {
21
- return
22
- }
23
- seenRefs.set(obj, true)
24
- Object.entries(obj).forEach(([prop,val]) => {
25
- if (Array.isArray(val)) {
26
- val.forEach(val => {
27
- if (val && typeof val == 'object') {
28
- createReference(meta, obj, prop, val)
29
- indexReferences(val, meta)
30
- }
31
- })
32
- } else if (typeof val == 'object') {
33
- createReference(meta, obj, prop, val)
34
- indexReferences(val, meta)
35
- } else {
36
- // console.log('prop', prop, 'skipped '+val)
37
- }
38
- })
39
- }
40
-
41
- function main() {
42
- let datafile = 'test.jsontag'
43
- let file = fs.readFileSync(datafile)
44
- let dataspace;
45
- let meta = {
46
- references: new WeakMap()
47
- }
48
- dataspace = JSONTag.parse(file.toString(), null, meta)
49
- indexReferences(dataspace, meta)
50
- let refs = meta.references.get(dataspace.foo);
51
- console.log(refs)
52
- refs = Object.keys(refs).map(k => {
53
- return refs[k].map(r => {
54
- return JSONTag.getAttribute(r, 'id')
55
- }).filter(Boolean);
56
- })
57
- console.log(refs)
58
- }
59
- main()
package/test.jsontag DELETED
@@ -1,301 +0,0 @@
1
- {
2
- "examenprogramma_body":[
3
- <object class="examenprogramma_body" id="/uuid/4ab7ab70-563a-45d2-9ef4-6cd13be4262c">{
4
- "id":"4ab7ab70-563a-45d2-9ef4-6cd13be4262c",
5
- "title":"Het eindexamen bestaat uit het centraal examen en het schoolexamen."
6
- },
7
- <object class="examenprogramma_body" id="/uuid/fb062294-a70d-4dfa-8766-94577d0cd5b0">{
8
- "id":"fb062294-a70d-4dfa-8766-94577d0cd5b0",
9
- "prefix":"A.",
10
- "title":"Domein A Vaardigheden"
11
- },
12
- <object class="examenprogramma_body" id="/uuid/4522dcc9-354a-4399-bcc6-1d3fb42ec4e9">{
13
- "id":"4522dcc9-354a-4399-bcc6-1d3fb42ec4e9",
14
- "prefix":"B.",
15
- "title":"Domein B Kansrekening en statistiek"
16
- },
17
- <object class="examenprogramma_body" id="/uuid/7e56f435-4e0e-4bb3-8fc3-c7e500150fae">{
18
- "id":"7e56f435-4e0e-4bb3-8fc3-c7e500150fae",
19
- "prefix":"C.",
20
- "title":"Domein C Dynamische systemen"
21
- },
22
- <object class="examenprogramma_body" id="/uuid/1e6f0af2-f51a-4e43-9147-2136ca8fc42f">{
23
- "id":"1e6f0af2-f51a-4e43-9147-2136ca8fc42f",
24
- "prefix":"D.",
25
- "title":"Domein D Meetkunde"
26
- },
27
- <object class="examenprogramma_body" id="/uuid/02a5ca1d-fd29-4c80-b59c-7c454ab153ac">{
28
- "id":"02a5ca1d-fd29-4c80-b59c-7c454ab153ac",
29
- "prefix":"E.",
30
- "title":"Domein E Complexe getallen"
31
- },
32
- <object class="examenprogramma_body" id="/uuid/cfc70d3c-a6e3-4f1f-aa97-d976c3dc0b24">{
33
- "id":"cfc70d3c-a6e3-4f1f-aa97-d976c3dc0b24",
34
- "prefix":"F.",
35
- "title":"Domein F Wiskunde in wetenschap"
36
- },
37
- <object class="examenprogramma_body" id="/uuid/6b5ba15f-73da-4da2-a097-bd2d92421227">{
38
- "id":"6b5ba15f-73da-4da2-a097-bd2d92421227",
39
- "prefix":"G.",
40
- "title":"Domein G Keuzeonderwerpen"
41
- },
42
- <object class="examenprogramma_body" id="/uuid/b3a7cecd-9077-411d-b31e-2fc223715a0f">{
43
- "id":"b3a7cecd-9077-411d-b31e-2fc223715a0f",
44
- "title":"Het schoolexamen heeft betrekking op domein A en:",
45
- "tag":[
46
- null
47
- ]
48
- },
49
- <object class="examenprogramma_body" id="/uuid/91c61706-10d2-4c16-9eed-52faf522ea97">{
50
- "id":"91c61706-10d2-4c16-9eed-52faf522ea97",
51
- "title":"de domeinen B, C, D, E, F en G;",
52
- "tag":[
53
- null
54
- ]
55
- }
56
- ],
57
- "examenprogramma_kop3":[
58
- <object class="examenprogramma_kop3" id="/uuid/1578c74b-1708-4030-b2e5-1d261a50d6eb">{
59
- "id":"1578c74b-1708-4030-b2e5-1d261a50d6eb",
60
- "title":"Dit betreft de volgende groepen van beroepsgerichte programma’s GL:",
61
- "replaces":[
62
- "872fc39c-d20d-4245-8192-749fdac881c7"
63
- ],
64
- "tag":[
65
- null
66
- ],
67
- "examenprogramma_kop4":[
68
-
69
- ],
70
- "examenprogramma_body":[
71
-
72
- ]
73
- }
74
- ],
75
- "examenprogramma_kop2":[
76
- <object class="examenprogramma_kop2" id="/uuid/7b17b55c-350c-46c2-aca9-8440136c74cf">{
77
- "id":"7b17b55c-350c-46c2-aca9-8440136c74cf",
78
- "title":"Het examenprogramma bestaat uit de volgende domeinen:",
79
- "examenprogramma_body":[
80
- <link>"#/uuid/fb062294-a70d-4dfa-8766-94577d0cd5b0",
81
- <link>"#/uuid/4522dcc9-354a-4399-bcc6-1d3fb42ec4e9",
82
- <link>"#/uuid/7e56f435-4e0e-4bb3-8fc3-c7e500150fae",
83
- <link>"#/uuid/1e6f0af2-f51a-4e43-9147-2136ca8fc42f",
84
- <link>"#/uuid/02a5ca1d-fd29-4c80-b59c-7c454ab153ac",
85
- <link>"#/uuid/cfc70d3c-a6e3-4f1f-aa97-d976c3dc0b24",
86
- <link>"#/uuid/6b5ba15f-73da-4da2-a097-bd2d92421227"
87
- ]
88
- },
89
- <object class="examenprogramma_kop2" id="/uuid/2737663a-fd21-40c0-993e-e3f4f7b8a725">{
90
- "id":"2737663a-fd21-40c0-993e-e3f4f7b8a725",
91
- "title":"Het examenprogramma bestaat uit de volgende domeinen:",
92
- "examenprogramma_body":[
93
- <link>"#/uuid/79bc90fd-4d95-4a81-8d2b-6000a143dfb2",
94
- <link>"#/uuid/69633df1-bfca-473d-a2c7-af09dc37fc84",
95
- <link>"#/uuid/6badcbf6-ce69-4cd0-8a6a-844edd0751da",
96
- <link>"#/uuid/df5d02bc-fc58-4288-972e-6338bf760efe",
97
- <link>"#/uuid/3851dff1-a89a-4840-808d-1684a336b2fa"
98
- ]
99
- }
100
- ],
101
- "examenprogramma_kop1":[
102
- <object class="examenprogramma_kop1" id="/uuid/e1cfb2b7-af13-47e0-8285-911ed8b1ca42">{
103
- "id":"e1cfb2b7-af13-47e0-8285-911ed8b1ca42",
104
- "title":"Het eindexamen",
105
- "examenprogramma_kop2":[
106
- <link>"#/uuid/7b17b55c-350c-46c2-aca9-8440136c74cf"
107
- ],
108
- "examenprogramma_body":[
109
- <link>"#/uuid/4ab7ab70-563a-45d2-9ef4-6cd13be4262c"
110
- ]
111
- },
112
- <object class="examenprogramma_kop1" id="/uuid/3b907c37-8c01-483a-8867-8a182191b5be">{
113
- "id":"3b907c37-8c01-483a-8867-8a182191b5be",
114
- "title":"Het schoolexamen",
115
- "tag":[
116
- null
117
- ],
118
- "examenprogramma_body":[
119
- <link>"#/uuid/b3a7cecd-9077-411d-b31e-2fc223715a0f",
120
- <link>"#/uuid/91c61706-10d2-4c16-9eed-52faf522ea97",
121
- <link>"#/uuid/0c873eab-f541-4a9b-8957-6a9b33558f05",
122
- <link>"#/uuid/f107e23c-a05d-44d8-a86a-27b3f84d029e"
123
- ]
124
- }
125
- ],
126
- "examenprogramma_vakleergebied":[
127
- <object class="examenprogramma_vakleergebied" id="/uuid/4d7bee87-997e-448f-9aa4-bfbc0eafb0bc">{
128
- "id":"4d7bee87-997e-448f-9aa4-bfbc0eafb0bc",
129
- "title":"Wiskunde",
130
- "vakleergebied":[
131
- null
132
- ]
133
- }
134
- ],
135
- "examenprogramma_domein":[
136
- <object class="examenprogramma_domein" id="/uuid/59ae47fe-b3b9-4c82-92dd-55d1ba520dfe">{
137
- "id":"59ae47fe-b3b9-4c82-92dd-55d1ba520dfe",
138
- "prefix":"WI/K/1",
139
- "title":"Oriëntatie op leren en werken",
140
- "ce_se":"SE",
141
- "examenprogramma_eindterm":[
142
- <link>"#/uuid/a9b12666-fe43-41f3-a85a-680a7486c3f6",
143
- <link>"#/uuid/a446511a-f71c-49fd-a66e-440fabd6d756"
144
- ]
145
- },
146
- <object class="examenprogramma_domein" id="/uuid/ff2b12cd-f333-4654-adb3-176332b11a45">{
147
- "id":"ff2b12cd-f333-4654-adb3-176332b11a45",
148
- "prefix":"WI/K/2",
149
- "title":"Basisvaardigheden",
150
- "ce_se":"SE",
151
- "examenprogramma_eindterm":[
152
- <link>"#/uuid/c2e1cedd-c033-4867-8df4-96b48af41131"
153
- ]
154
- },
155
- <object class="examenprogramma_domein" id="/uuid/0cb1f3b3-9d26-469a-b74d-cf0b1a11e78a">{
156
- "id":"0cb1f3b3-9d26-469a-b74d-cf0b1a11e78a",
157
- "prefix":"WI/K/3",
158
- "title":"Leervaardigheden in het vak wiskunde",
159
- "ce_se":"CE",
160
- "examenprogramma_eindterm":[
161
- <link>"#/uuid/70024571-16da-4d8b-ac17-1dea6e865af3",
162
- <link>"#/uuid/b72ffd75-b34b-48cb-98e5-6aeff2af720e",
163
- <link>"#/uuid/9b99e478-af5a-4b86-a97b-705921aadf81"
164
- ]
165
- },
166
- <object class="examenprogramma_domein" id="/uuid/e659b3dc-f4cf-4ccc-9c8b-c6c618811610">{
167
- "id":"e659b3dc-f4cf-4ccc-9c8b-c6c618811610",
168
- "prefix":"WI/K/4",
169
- "title":"Algebraïsche verbanden",
170
- "ce_se":"CE",
171
- "examenprogramma_eindterm":[
172
- <link>"#/uuid/6b51289b-7c7e-4a59-846a-d2ff1bcb5c8b",
173
- <link>"#/uuid/6b4a9b09-29e0-41e6-9f94-7bf8377f6f73",
174
- <link>"#/uuid/7d1cab76-38dd-4503-a2ab-2db951cb1091",
175
- <link>"#/uuid/66debbe5-e424-4431-b4bf-9587c577c2cc",
176
- <link>"#/uuid/9e61611d-4ddb-4a2a-b34e-ff4dec6274f5",
177
- <link>"#/uuid/fa6cda53-42bf-4757-a10b-083036cf76c8"
178
- ]
179
- },
180
- <object class="examenprogramma_domein" id="/uuid/49005dae-43bb-4855-9bf7-9960cb310ce0">{
181
- "id":"49005dae-43bb-4855-9bf7-9960cb310ce0",
182
- "prefix":"WI/K/5",
183
- "title":"Rekenen, meten en schatten",
184
- "ce_se":"CE",
185
- "examenprogramma_eindterm":[
186
- <link>"#/uuid/c0134c66-5a44-4f2d-aaa2-034597213566",
187
- <link>"#/uuid/9f7aeaab-862e-45cc-8d6d-099a16f608b5"
188
- ]
189
- },
190
- <object class="examenprogramma_domein" id="/uuid/2af345ce-9ef0-444d-9e6d-51f11dbddbe9">{
191
- "id":"2af345ce-9ef0-444d-9e6d-51f11dbddbe9",
192
- "prefix":"WI/K/6",
193
- "title":"Meetkunde",
194
- "ce_se":"CE",
195
- "examenprogramma_eindterm":[
196
- <link>"#/uuid/c8477483-78ba-4cea-8778-354c534e8dc2",
197
- <link>"#/uuid/2f6d6191-a676-4280-a79b-99dcbf9c5bf3",
198
- <link>"#/uuid/1693644c-5bb6-4d3f-8260-d8f046571d38",
199
- <link>"#/uuid/d3a46c00-8851-498b-98c0-cd9cc16e8b6f",
200
- <link>"#/uuid/baabe074-d1f0-42f2-afa9-6728217ccef9",
201
- <link>"#/uuid/d9351844-51f8-4623-85da-001927f7d42c"
202
- ]
203
- },
204
- <object class="examenprogramma_domein" id="/uuid/a6f1131d-9215-444e-ab70-a6e41889ce8b">{
205
- "id":"a6f1131d-9215-444e-ab70-a6e41889ce8b",
206
- "prefix":"WI/K/7",
207
- "title":"Informatieverwerking, statistiek",
208
- "ce_se":"SE",
209
- "examenprogramma_eindterm":[
210
- <link>"#/uuid/5c4a6b32-bcdf-4c9e-83e1-6ef78954d1c4",
211
- <link>"#/uuid/ac0429d6-15f5-4d17-92d0-a95ff40b0530"
212
- ]
213
- },
214
- <object class="examenprogramma_domein" id="/uuid/b28a3cd5-d6ca-4a19-8213-fb5dc5de8aa5">{
215
- "id":"b28a3cd5-d6ca-4a19-8213-fb5dc5de8aa5",
216
- "prefix":"WI/K/8",
217
- "title":"Geïntegreerde Wiskundige Activiteiten",
218
- "ce_se":"SE",
219
- "examenprogramma_eindterm":[
220
- <link>"#/uuid/1e050f76-f830-40ea-9cd9-28268d5a00dc",
221
- <link>"#/uuid/2989c36d-28bf-4223-be93-45003eb1d08d"
222
- ]
223
- },
224
- <object class="examenprogramma_domein" id="/uuid/bd1e20ec-930f-4ca8-92cd-48ed40ab8d67">{
225
- "id":"bd1e20ec-930f-4ca8-92cd-48ed40ab8d67",
226
- "prefix":"WI/V/1",
227
- "title":"Aanvullende eisen",
228
- "ce_se":"CE",
229
- "examenprogramma_eindterm":[
230
- <link>"#/uuid/844cf891-b8d0-4a6a-9442-2cdf6dc15293",
231
- <link>"#/uuid/649b200b-c6af-4c96-a914-87943161c5f0",
232
- <link>"#/uuid/6e76475c-015e-4b2f-aa3c-c629d0ef586a",
233
- <link>"#/uuid/b2b0a312-a177-4f77-8fe9-114956ed0c84"
234
- ]
235
- },
236
- <object class="examenprogramma_domein" id="/uuid/7bd4112d-cda1-473f-aef3-0c03dd03d8c5">{
237
- "id":"7bd4112d-cda1-473f-aef3-0c03dd03d8c5",
238
- "prefix":"WI/V/2",
239
- "title":"Verrijkingsopdrachten",
240
- "ce_se":"SE",
241
- "examenprogramma_eindterm":[
242
- <link>"#/uuid/019714ce-93f6-41ed-a1ae-c567a877cc10"
243
- ]
244
- },
245
- <object class="examenprogramma_domein" id="/uuid/254b5655-1677-4dac-87ab-d569eca56306">{
246
- "id":"254b5655-1677-4dac-87ab-d569eca56306",
247
- "prefix":"WI/V/3",
248
- "title":"Verwerven, verwerken en verstrekken van informatie",
249
- "ce_se":"SE",
250
- "examenprogramma_eindterm":[
251
- <link>"#/uuid/e446b967-a19a-4d4c-a816-a3483b2769a3"
252
- ]
253
- },
254
- <object class="examenprogramma_domein" id="/uuid/60fdc8d5-cceb-4fe1-ab29-b33b13746b19">{
255
- "id":"60fdc8d5-cceb-4fe1-ab29-b33b13746b19",
256
- "prefix":"WI/V/4",
257
- "title":"Vaardigheden in samenhang",
258
- "ce_se":"CE",
259
- "examenprogramma_eindterm":[
260
- <link>"#/uuid/a1ae9741-7055-4e9c-b5e9-2ffd01e0a149"
261
- ]
262
- }
263
- ],
264
- "examenprogramma":[
265
- <object class="examenprogramma" id="/uuid/edaba0d2-5ee1-4962-bcc5-bc6bfb5cea2a">{
266
- "prefix":"WI/vmbo",
267
- "id":"edaba0d2-5ee1-4962-bcc5-bc6bfb5cea2a",
268
- "title":"Examenprogramma Wiskunde vmbo",
269
- "ingangsdatum":"Vanaf CE 2017",
270
- "versie":"2020",
271
- "url":"https://www.examenblad.nl/examenstof/wiskunde-vmbo-2/2020/f=/wiskunde.pdf",
272
- "examenprogramma_vakleergebied":[
273
- <link>"#/uuid/4d7bee87-997e-448f-9aa4-bfbc0eafb0bc"
274
- ],
275
- "examenprogramma_domein":[
276
- <link>"#/uuid/36c5c292-4ec9-43d1-bf0d-f56cc7a7ef10",
277
- <link>"#/uuid/59ae47fe-b3b9-4c82-92dd-55d1ba520dfe",
278
- <link>"#/uuid/ff2b12cd-f333-4654-adb3-176332b11a45",
279
- <link>"#/uuid/0cb1f3b3-9d26-469a-b74d-cf0b1a11e78a",
280
- <link>"#/uuid/e659b3dc-f4cf-4ccc-9c8b-c6c618811610",
281
- <link>"#/uuid/49005dae-43bb-4855-9bf7-9960cb310ce0",
282
- <link>"#/uuid/2af345ce-9ef0-444d-9e6d-51f11dbddbe9",
283
- <link>"#/uuid/a6f1131d-9215-444e-ab70-a6e41889ce8b",
284
- <link>"#/uuid/b28a3cd5-d6ca-4a19-8213-fb5dc5de8aa5",
285
- <link>"#/uuid/bd1e20ec-930f-4ca8-92cd-48ed40ab8d67",
286
- <link>"#/uuid/7bd4112d-cda1-473f-aef3-0c03dd03d8c5",
287
- <link>"#/uuid/254b5655-1677-4dac-87ab-d569eca56306",
288
- <link>"#/uuid/60fdc8d5-cceb-4fe1-ab29-b33b13746b19"
289
- ],
290
- "examenprogramma_kop1":[
291
- <link>"#/uuid/177dee42-5a35-436c-8060-70084aba4958"
292
- ],
293
- "niveau":[
294
- null,
295
- null,
296
- null,
297
- null
298
- ]
299
- }
300
- ]
301
- }
package/test2.jsontag DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "examenprogramma_body":[
3
- <object class="examenprogramma_body" id="/uuid/4ab7ab70-563a-45d2-9ef4-6cd13be4262c">{
4
- "id":"4ab7ab70-563a-45d2-9ef4-6cd13be4262c",
5
- "title":"Het eindexamen bestaat uit het centraal examen en het schoolexamen."
6
- }
7
- ],
8
- "examenprogramma_kop1":[
9
- <object class="examenprogramma_kop1" id="/uuid/e1cfb2b7-af13-47e0-8285-911ed8b1ca42">{
10
- "id":"e1cfb2b7-af13-47e0-8285-911ed8b1ca42",
11
- "title":"Het eindexamen",
12
- "examenprogramma_body":[
13
- <link>"#/uuid/4ab7ab70-563a-45d2-9ef4-6cd13be4262c"
14
- ]
15
- }
16
- ]
17
- }
package/tojsontag.mjs DELETED
@@ -1,55 +0,0 @@
1
- // load the curriculum-js library
2
- import Curriculum from 'curriculum-js'
3
- // load node filesystem support
4
- import fs from 'fs'
5
- import repl from 'repl';
6
- import JSONTag from '@muze-nl/jsontag'
7
-
8
- // create an async function, so we can use await inside it
9
- async function main() {
10
-
11
- // create new curriculum instance
12
- const curriculum = new Curriculum()
13
-
14
- // read the list of all contexts from the file /curriculum-contexts.txt
15
- const schemas = fs.readFileSync('curriculum-contexts.txt','utf8')
16
- .split(/\n/g) // split the file on newlines
17
- .map(line => line.trim()) // remove leading and trailing whitespace
18
- .filter(Boolean) // filter empty lines
19
-
20
- // load all contexts from the editor/ and master/ folders
21
- let loadedSchemas = schemas.map(
22
- schema => curriculum.loadContextFromFile(schema, './editor/'+schema+'/context.json')
23
- )
24
-
25
- // wait untill all contexts have been loaded, and return the promise values as schemas
26
- Promise.allSettled(loadedSchemas).then((settledSchemas) => {
27
- loadedSchemas = settledSchemas.map(promise => promise.value)
28
- })
29
- .then(() => {
30
- // set type, class and id for each object
31
- Object.keys(curriculum.index.id).forEach(id => {
32
- let type = curriculum.index.type[id]
33
- let ob = curriculum.index.id[id]
34
- JSONTag.setAttribute(ob, 'class', type)
35
- JSONTag.setAttribute(ob, 'id', '/uuid/'+id)
36
- // replace all entity_id properties with entity arrays of actual objects
37
- Object.keys(ob).forEach(prop => {
38
- if (prop.substring(prop.length-3)=='_id') {
39
- let newname = prop.substring(0, prop.length-3)
40
- if (Array.isArray(ob[prop])) {
41
- ob[newname] = ob[prop].map(id => curriculum.index.id[id])
42
- } else {
43
- ob[newname] = curriculum.index.id[ob[prop]]
44
- }
45
- delete ob[prop]
46
- }
47
- })
48
- })
49
- // save as single jsontag blob
50
- let fileData = JSONTag.stringify(curriculum.data, null, 4)
51
- fs.writeFileSync('curriculum.jsontag', fileData);
52
- })
53
- }
54
-
55
- main()