@rljson/rljson 0.0.50 → 0.0.52
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/README.architecture.md +84 -36
- package/dist/README.architecture.md +84 -36
- package/dist/content/buffet.d.ts +1 -1
- package/dist/content/cake.d.ts +2 -6
- package/dist/content/components.d.ts +15 -0
- package/dist/content/layer.d.ts +15 -8
- package/dist/content/revision.d.ts +2 -2
- package/dist/content/slice-ids.d.ts +1 -1
- package/dist/content/table-cfg.d.ts +2 -1
- package/dist/example/bakery-example.d.ts +7 -7
- package/dist/example.d.ts +2 -2
- package/dist/index.d.ts +1 -2
- package/dist/rljson.d.ts +6 -4
- package/dist/rljson.js +122 -106
- package/dist/src/example.ts +46 -35
- package/dist/typedefs.d.ts +2 -2
- package/dist/validate/base-validator.d.ts +2 -2
- package/package.json +23 -31
- package/dist/content/ingredients.d.ts +0 -15
package/README.architecture.md
CHANGED
|
@@ -29,7 +29,7 @@ This document describes the architecture of the Rljson format.
|
|
|
29
29
|
- [Hashes](#hashes)
|
|
30
30
|
- [Linking Tables Using References](#linking-tables-using-references)
|
|
31
31
|
- [Data Types](#data-types)
|
|
32
|
-
- [
|
|
32
|
+
- [Components](#components)
|
|
33
33
|
- [SliceIds](#sliceids)
|
|
34
34
|
- [Layer](#layer)
|
|
35
35
|
- [Cake](#cake)
|
|
@@ -145,7 +145,7 @@ This results in:
|
|
|
145
145
|
```json
|
|
146
146
|
{
|
|
147
147
|
"_hash": "D1CtRUBswzGVc1o9yHQKEh",
|
|
148
|
-
"
|
|
148
|
+
"tableA": {
|
|
149
149
|
"_data": [
|
|
150
150
|
{
|
|
151
151
|
"_hash": "LeFJOCQVgToOfbUuKJQ-GO",
|
|
@@ -165,7 +165,7 @@ table `b` references table `a` using `aRef`:
|
|
|
165
165
|
```json
|
|
166
166
|
{
|
|
167
167
|
"b": {
|
|
168
|
-
"_data": [{ "
|
|
168
|
+
"_data": [{ "tableARef": "LeFJOCQVgToOfbUuKJQ-GO" }]
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
```
|
|
@@ -177,33 +177,58 @@ This reference structure enables automated denormalization of JSON data.
|
|
|
177
177
|
Rljson provides several core data structures and table types to manage and
|
|
178
178
|
synchronize large datasets.
|
|
179
179
|
|
|
180
|
-
###
|
|
180
|
+
### Components
|
|
181
181
|
|
|
182
|
-
`
|
|
183
|
-
key-value pairs assigning values to
|
|
182
|
+
`Components` are the fundamental data concept. An `ComponentsTable` contains
|
|
183
|
+
key-value pairs assigning values to component names.
|
|
184
184
|
|
|
185
185
|
```json
|
|
186
186
|
{
|
|
187
187
|
"ingredients": {
|
|
188
|
+
"_type": "components",
|
|
188
189
|
"_data": [
|
|
189
190
|
{
|
|
190
|
-
"
|
|
191
|
+
"id": "flour",
|
|
191
192
|
"amountUnit": "g",
|
|
192
|
-
"nutritionalValuesRef": "
|
|
193
|
+
"nutritionalValuesRef": "R165gWZn_Pcj_je3AwSsXI",
|
|
194
|
+
"_hash": "A5d-4if1fQpQERfwFsjKqb"
|
|
193
195
|
}
|
|
194
|
-
]
|
|
196
|
+
],
|
|
197
|
+
"_hash": "t5oZrLJOxAj-5nlE1ZV488"
|
|
195
198
|
},
|
|
196
|
-
|
|
197
199
|
"nutritionalValues": {
|
|
200
|
+
"_type": "components",
|
|
198
201
|
"_data": [
|
|
199
202
|
{
|
|
203
|
+
"id": "flour",
|
|
200
204
|
"energy": 364,
|
|
201
205
|
"fat": 0.98,
|
|
202
206
|
"protein": 10.33,
|
|
203
207
|
"carbohydrates": 76.31,
|
|
204
|
-
"_hash": "
|
|
208
|
+
"_hash": "R165gWZn_Pcj_je3AwSsXI"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"id": "flour",
|
|
212
|
+
"energy": 364.1,
|
|
213
|
+
"fat": 0.981,
|
|
214
|
+
"protein": 10.331,
|
|
215
|
+
"carbohydrates": 76.311,
|
|
216
|
+
"_hash": "IqeoWJjZQNlr-NVk2QT15B"
|
|
205
217
|
}
|
|
206
|
-
]
|
|
218
|
+
],
|
|
219
|
+
"_hash": "4tYazUV23SSH0tW9sQznO1"
|
|
220
|
+
},
|
|
221
|
+
"recipeIngredients": {
|
|
222
|
+
"_type": "components",
|
|
223
|
+
"_data": [
|
|
224
|
+
{
|
|
225
|
+
"id": "flour",
|
|
226
|
+
"ingredientsRef": "A5d-4if1fQpQERfwFsjKqb",
|
|
227
|
+
"quantity": 500,
|
|
228
|
+
"_hash": "4coxp7hPCsH7hSnAVeUVZj"
|
|
229
|
+
}
|
|
230
|
+
],
|
|
231
|
+
"_hash": "nJ4SAM641VlxYxekNiXkKI"
|
|
207
232
|
}
|
|
208
233
|
}
|
|
209
234
|
```
|
|
@@ -211,19 +236,21 @@ key-value pairs assigning values to ingredient names.
|
|
|
211
236
|
### SliceIds
|
|
212
237
|
|
|
213
238
|
For efficient management of large layers, slice IDs are separated from their
|
|
214
|
-
|
|
239
|
+
components. This allows fetching IDs first and retrieving details later. The
|
|
215
240
|
following `SliceIds` define a set of three slice IDs:
|
|
216
241
|
|
|
217
242
|
```json
|
|
218
243
|
{
|
|
219
244
|
"slices": {
|
|
245
|
+
"_type": "sliceIds",
|
|
220
246
|
"_data": [
|
|
221
247
|
{
|
|
222
248
|
"add": ["slice0", "slice1"],
|
|
223
249
|
"remove": [],
|
|
224
250
|
"_hash": "wyYfK5E4ArrMKQ_zvi2-EE"
|
|
225
251
|
}
|
|
226
|
-
]
|
|
252
|
+
],
|
|
253
|
+
"_hash": "cnGg1WO4AHE2QX2CO2_aQL"
|
|
227
254
|
}
|
|
228
255
|
}
|
|
229
256
|
```
|
|
@@ -233,6 +260,7 @@ Derived `SliceIds` can be created by modifying an existing set:
|
|
|
233
260
|
```json
|
|
234
261
|
{
|
|
235
262
|
"slices": {
|
|
263
|
+
"_type": "sliceIds",
|
|
236
264
|
"_data": [
|
|
237
265
|
{
|
|
238
266
|
"add": ["slice0", "slice1"],
|
|
@@ -240,32 +268,49 @@ Derived `SliceIds` can be created by modifying an existing set:
|
|
|
240
268
|
"_hash": "wyYfK5E4ArrMKQ_zvi2-EE"
|
|
241
269
|
},
|
|
242
270
|
{
|
|
243
|
-
"base": "wyYfK5E4ArrMKQ_zvi2-EE",
|
|
271
|
+
"base": "wyYfK5E4ArrMKQ_zvi2-EE", // Hash of first id set
|
|
244
272
|
"add": ["slice2"],
|
|
245
|
-
"remove": []
|
|
273
|
+
"remove": ["slice0"]
|
|
246
274
|
}
|
|
247
275
|
]
|
|
276
|
+
},
|
|
277
|
+
|
|
278
|
+
"ingredientTypes": {
|
|
279
|
+
"_type": "sliceIds",
|
|
280
|
+
"_data": [
|
|
281
|
+
{
|
|
282
|
+
"add": ["flour"],
|
|
283
|
+
"remove": [],
|
|
284
|
+
"_hash": "UNxHIyPK7AACyUsbISW7bp"
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
"_hash": "c1w4IVG4J4JANpcTu8p7Jd"
|
|
248
288
|
}
|
|
249
289
|
}
|
|
250
290
|
```
|
|
251
291
|
|
|
252
292
|
### Layer
|
|
253
293
|
|
|
254
|
-
|
|
294
|
+
Layers assign components to slices.
|
|
255
295
|
|
|
256
296
|
```json
|
|
257
297
|
{
|
|
258
|
-
"
|
|
298
|
+
"recipes": {
|
|
299
|
+
"_type": "layers",
|
|
259
300
|
"_data": [
|
|
260
301
|
{
|
|
261
|
-
"
|
|
262
|
-
"
|
|
263
|
-
|
|
264
|
-
|
|
302
|
+
"id": "tastyCake",
|
|
303
|
+
"componentsTable": "recipeIngredients",
|
|
304
|
+
"sliceIdsTable": "ingredientTypes",
|
|
305
|
+
"sliceIdsTableRow": "UNxHIyPK7AACyUsbISW7bp",
|
|
306
|
+
"add": {
|
|
307
|
+
"flour": "4coxp7hPCsH7hSnAVeUVZj",
|
|
308
|
+
"_hash": "5LxOnZOPBtIqV3PlOC_ulB"
|
|
265
309
|
},
|
|
266
|
-
"_hash": "
|
|
310
|
+
"_hash": "NOVdgwVKlShXT1FTLaLrqK"
|
|
267
311
|
}
|
|
268
|
-
]
|
|
312
|
+
],
|
|
313
|
+
"_hash": "FFblMN2aS4hPtJKPTMspXl"
|
|
269
314
|
}
|
|
270
315
|
}
|
|
271
316
|
```
|
|
@@ -274,24 +319,25 @@ Cake layers assign ingredients to slices.
|
|
|
274
319
|
|
|
275
320
|
A `Cake` consists of layers of slices.
|
|
276
321
|
All layers share the same slice structure, i.e. the same slice ids.
|
|
277
|
-
Each layer assigns different
|
|
322
|
+
Each layer assigns different components to slices.
|
|
278
323
|
|
|
279
324
|
```json
|
|
280
325
|
{
|
|
281
326
|
"cakes": {
|
|
327
|
+
"_type": "cakes",
|
|
282
328
|
"_data": [
|
|
283
329
|
{
|
|
330
|
+
"id": "cake1",
|
|
284
331
|
"sliceIdsTable": "slices",
|
|
285
|
-
"
|
|
286
|
-
"layersTable": "layers",
|
|
332
|
+
"sliceIdsRow": "wyYfK5E4ArrMKQ_zvi2-EE",
|
|
287
333
|
"layers": {
|
|
288
|
-
"
|
|
289
|
-
"_hash": "
|
|
334
|
+
"recipeLayers": "PZhgu3fmAtLceImvnW7fTj",
|
|
335
|
+
"_hash": "fudiDz_SXuMQbcqmAd-JOp"
|
|
290
336
|
},
|
|
291
|
-
"_hash": "
|
|
337
|
+
"_hash": "Mge0ULLEbsemMq1ndUNZ6b"
|
|
292
338
|
}
|
|
293
339
|
],
|
|
294
|
-
"_hash": "
|
|
340
|
+
"_hash": "NeM6k972PwtYT8uXM9w27T"
|
|
295
341
|
}
|
|
296
342
|
}
|
|
297
343
|
```
|
|
@@ -299,24 +345,26 @@ Each layer assigns different ingredients to slices.
|
|
|
299
345
|
### Buffet
|
|
300
346
|
|
|
301
347
|
A `Buffet` is a heterogeneous collection of different but related items,
|
|
302
|
-
such as cakes, layers, or
|
|
348
|
+
such as cakes, layers, or components:
|
|
303
349
|
|
|
304
350
|
```json
|
|
305
351
|
{
|
|
306
352
|
"buffets": {
|
|
353
|
+
"_type": "buffets",
|
|
307
354
|
"_data": [
|
|
308
355
|
{
|
|
356
|
+
"id": "salesCounter",
|
|
309
357
|
"items": [
|
|
310
358
|
{
|
|
311
359
|
"table": "cakes",
|
|
312
|
-
"ref": "
|
|
313
|
-
"_hash": "
|
|
360
|
+
"ref": "Mge0ULLEbsemMq1ndUNZ6b",
|
|
361
|
+
"_hash": "VC_7itbevmNKG3Rc4XWyJz"
|
|
314
362
|
}
|
|
315
363
|
],
|
|
316
|
-
"_hash": "
|
|
364
|
+
"_hash": "G7ZX04bp0TdBG9fHDR7Sgu"
|
|
317
365
|
}
|
|
318
366
|
],
|
|
319
|
-
"_hash": "
|
|
367
|
+
"_hash": "0RyzLpZX1Nkfxej2WgXbEF"
|
|
320
368
|
}
|
|
321
369
|
}
|
|
322
370
|
```
|
|
@@ -29,7 +29,7 @@ This document describes the architecture of the Rljson format.
|
|
|
29
29
|
- [Hashes](#hashes)
|
|
30
30
|
- [Linking Tables Using References](#linking-tables-using-references)
|
|
31
31
|
- [Data Types](#data-types)
|
|
32
|
-
- [
|
|
32
|
+
- [Components](#components)
|
|
33
33
|
- [SliceIds](#sliceids)
|
|
34
34
|
- [Layer](#layer)
|
|
35
35
|
- [Cake](#cake)
|
|
@@ -145,7 +145,7 @@ This results in:
|
|
|
145
145
|
```json
|
|
146
146
|
{
|
|
147
147
|
"_hash": "D1CtRUBswzGVc1o9yHQKEh",
|
|
148
|
-
"
|
|
148
|
+
"tableA": {
|
|
149
149
|
"_data": [
|
|
150
150
|
{
|
|
151
151
|
"_hash": "LeFJOCQVgToOfbUuKJQ-GO",
|
|
@@ -165,7 +165,7 @@ table `b` references table `a` using `aRef`:
|
|
|
165
165
|
```json
|
|
166
166
|
{
|
|
167
167
|
"b": {
|
|
168
|
-
"_data": [{ "
|
|
168
|
+
"_data": [{ "tableARef": "LeFJOCQVgToOfbUuKJQ-GO" }]
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
```
|
|
@@ -177,33 +177,58 @@ This reference structure enables automated denormalization of JSON data.
|
|
|
177
177
|
Rljson provides several core data structures and table types to manage and
|
|
178
178
|
synchronize large datasets.
|
|
179
179
|
|
|
180
|
-
###
|
|
180
|
+
### Components
|
|
181
181
|
|
|
182
|
-
`
|
|
183
|
-
key-value pairs assigning values to
|
|
182
|
+
`Components` are the fundamental data concept. An `ComponentsTable` contains
|
|
183
|
+
key-value pairs assigning values to component names.
|
|
184
184
|
|
|
185
185
|
```json
|
|
186
186
|
{
|
|
187
187
|
"ingredients": {
|
|
188
|
+
"_type": "components",
|
|
188
189
|
"_data": [
|
|
189
190
|
{
|
|
190
|
-
"
|
|
191
|
+
"id": "flour",
|
|
191
192
|
"amountUnit": "g",
|
|
192
|
-
"nutritionalValuesRef": "
|
|
193
|
+
"nutritionalValuesRef": "R165gWZn_Pcj_je3AwSsXI",
|
|
194
|
+
"_hash": "A5d-4if1fQpQERfwFsjKqb"
|
|
193
195
|
}
|
|
194
|
-
]
|
|
196
|
+
],
|
|
197
|
+
"_hash": "t5oZrLJOxAj-5nlE1ZV488"
|
|
195
198
|
},
|
|
196
|
-
|
|
197
199
|
"nutritionalValues": {
|
|
200
|
+
"_type": "components",
|
|
198
201
|
"_data": [
|
|
199
202
|
{
|
|
203
|
+
"id": "flour",
|
|
200
204
|
"energy": 364,
|
|
201
205
|
"fat": 0.98,
|
|
202
206
|
"protein": 10.33,
|
|
203
207
|
"carbohydrates": 76.31,
|
|
204
|
-
"_hash": "
|
|
208
|
+
"_hash": "R165gWZn_Pcj_je3AwSsXI"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"id": "flour",
|
|
212
|
+
"energy": 364.1,
|
|
213
|
+
"fat": 0.981,
|
|
214
|
+
"protein": 10.331,
|
|
215
|
+
"carbohydrates": 76.311,
|
|
216
|
+
"_hash": "IqeoWJjZQNlr-NVk2QT15B"
|
|
205
217
|
}
|
|
206
|
-
]
|
|
218
|
+
],
|
|
219
|
+
"_hash": "4tYazUV23SSH0tW9sQznO1"
|
|
220
|
+
},
|
|
221
|
+
"recipeIngredients": {
|
|
222
|
+
"_type": "components",
|
|
223
|
+
"_data": [
|
|
224
|
+
{
|
|
225
|
+
"id": "flour",
|
|
226
|
+
"ingredientsRef": "A5d-4if1fQpQERfwFsjKqb",
|
|
227
|
+
"quantity": 500,
|
|
228
|
+
"_hash": "4coxp7hPCsH7hSnAVeUVZj"
|
|
229
|
+
}
|
|
230
|
+
],
|
|
231
|
+
"_hash": "nJ4SAM641VlxYxekNiXkKI"
|
|
207
232
|
}
|
|
208
233
|
}
|
|
209
234
|
```
|
|
@@ -211,19 +236,21 @@ key-value pairs assigning values to ingredient names.
|
|
|
211
236
|
### SliceIds
|
|
212
237
|
|
|
213
238
|
For efficient management of large layers, slice IDs are separated from their
|
|
214
|
-
|
|
239
|
+
components. This allows fetching IDs first and retrieving details later. The
|
|
215
240
|
following `SliceIds` define a set of three slice IDs:
|
|
216
241
|
|
|
217
242
|
```json
|
|
218
243
|
{
|
|
219
244
|
"slices": {
|
|
245
|
+
"_type": "sliceIds",
|
|
220
246
|
"_data": [
|
|
221
247
|
{
|
|
222
248
|
"add": ["slice0", "slice1"],
|
|
223
249
|
"remove": [],
|
|
224
250
|
"_hash": "wyYfK5E4ArrMKQ_zvi2-EE"
|
|
225
251
|
}
|
|
226
|
-
]
|
|
252
|
+
],
|
|
253
|
+
"_hash": "cnGg1WO4AHE2QX2CO2_aQL"
|
|
227
254
|
}
|
|
228
255
|
}
|
|
229
256
|
```
|
|
@@ -233,6 +260,7 @@ Derived `SliceIds` can be created by modifying an existing set:
|
|
|
233
260
|
```json
|
|
234
261
|
{
|
|
235
262
|
"slices": {
|
|
263
|
+
"_type": "sliceIds",
|
|
236
264
|
"_data": [
|
|
237
265
|
{
|
|
238
266
|
"add": ["slice0", "slice1"],
|
|
@@ -240,32 +268,49 @@ Derived `SliceIds` can be created by modifying an existing set:
|
|
|
240
268
|
"_hash": "wyYfK5E4ArrMKQ_zvi2-EE"
|
|
241
269
|
},
|
|
242
270
|
{
|
|
243
|
-
"base": "wyYfK5E4ArrMKQ_zvi2-EE",
|
|
271
|
+
"base": "wyYfK5E4ArrMKQ_zvi2-EE", // Hash of first id set
|
|
244
272
|
"add": ["slice2"],
|
|
245
|
-
"remove": []
|
|
273
|
+
"remove": ["slice0"]
|
|
246
274
|
}
|
|
247
275
|
]
|
|
276
|
+
},
|
|
277
|
+
|
|
278
|
+
"ingredientTypes": {
|
|
279
|
+
"_type": "sliceIds",
|
|
280
|
+
"_data": [
|
|
281
|
+
{
|
|
282
|
+
"add": ["flour"],
|
|
283
|
+
"remove": [],
|
|
284
|
+
"_hash": "UNxHIyPK7AACyUsbISW7bp"
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
"_hash": "c1w4IVG4J4JANpcTu8p7Jd"
|
|
248
288
|
}
|
|
249
289
|
}
|
|
250
290
|
```
|
|
251
291
|
|
|
252
292
|
### Layer
|
|
253
293
|
|
|
254
|
-
|
|
294
|
+
Layers assign components to slices.
|
|
255
295
|
|
|
256
296
|
```json
|
|
257
297
|
{
|
|
258
|
-
"
|
|
298
|
+
"recipes": {
|
|
299
|
+
"_type": "layers",
|
|
259
300
|
"_data": [
|
|
260
301
|
{
|
|
261
|
-
"
|
|
262
|
-
"
|
|
263
|
-
|
|
264
|
-
|
|
302
|
+
"id": "tastyCake",
|
|
303
|
+
"componentsTable": "recipeIngredients",
|
|
304
|
+
"sliceIdsTable": "ingredientTypes",
|
|
305
|
+
"sliceIdsTableRow": "UNxHIyPK7AACyUsbISW7bp",
|
|
306
|
+
"add": {
|
|
307
|
+
"flour": "4coxp7hPCsH7hSnAVeUVZj",
|
|
308
|
+
"_hash": "5LxOnZOPBtIqV3PlOC_ulB"
|
|
265
309
|
},
|
|
266
|
-
"_hash": "
|
|
310
|
+
"_hash": "NOVdgwVKlShXT1FTLaLrqK"
|
|
267
311
|
}
|
|
268
|
-
]
|
|
312
|
+
],
|
|
313
|
+
"_hash": "FFblMN2aS4hPtJKPTMspXl"
|
|
269
314
|
}
|
|
270
315
|
}
|
|
271
316
|
```
|
|
@@ -274,24 +319,25 @@ Cake layers assign ingredients to slices.
|
|
|
274
319
|
|
|
275
320
|
A `Cake` consists of layers of slices.
|
|
276
321
|
All layers share the same slice structure, i.e. the same slice ids.
|
|
277
|
-
Each layer assigns different
|
|
322
|
+
Each layer assigns different components to slices.
|
|
278
323
|
|
|
279
324
|
```json
|
|
280
325
|
{
|
|
281
326
|
"cakes": {
|
|
327
|
+
"_type": "cakes",
|
|
282
328
|
"_data": [
|
|
283
329
|
{
|
|
330
|
+
"id": "cake1",
|
|
284
331
|
"sliceIdsTable": "slices",
|
|
285
|
-
"
|
|
286
|
-
"layersTable": "layers",
|
|
332
|
+
"sliceIdsRow": "wyYfK5E4ArrMKQ_zvi2-EE",
|
|
287
333
|
"layers": {
|
|
288
|
-
"
|
|
289
|
-
"_hash": "
|
|
334
|
+
"recipeLayers": "PZhgu3fmAtLceImvnW7fTj",
|
|
335
|
+
"_hash": "fudiDz_SXuMQbcqmAd-JOp"
|
|
290
336
|
},
|
|
291
|
-
"_hash": "
|
|
337
|
+
"_hash": "Mge0ULLEbsemMq1ndUNZ6b"
|
|
292
338
|
}
|
|
293
339
|
],
|
|
294
|
-
"_hash": "
|
|
340
|
+
"_hash": "NeM6k972PwtYT8uXM9w27T"
|
|
295
341
|
}
|
|
296
342
|
}
|
|
297
343
|
```
|
|
@@ -299,24 +345,26 @@ Each layer assigns different ingredients to slices.
|
|
|
299
345
|
### Buffet
|
|
300
346
|
|
|
301
347
|
A `Buffet` is a heterogeneous collection of different but related items,
|
|
302
|
-
such as cakes, layers, or
|
|
348
|
+
such as cakes, layers, or components:
|
|
303
349
|
|
|
304
350
|
```json
|
|
305
351
|
{
|
|
306
352
|
"buffets": {
|
|
353
|
+
"_type": "buffets",
|
|
307
354
|
"_data": [
|
|
308
355
|
{
|
|
356
|
+
"id": "salesCounter",
|
|
309
357
|
"items": [
|
|
310
358
|
{
|
|
311
359
|
"table": "cakes",
|
|
312
|
-
"ref": "
|
|
313
|
-
"_hash": "
|
|
360
|
+
"ref": "Mge0ULLEbsemMq1ndUNZ6b",
|
|
361
|
+
"_hash": "VC_7itbevmNKG3Rc4XWyJz"
|
|
314
362
|
}
|
|
315
363
|
],
|
|
316
|
-
"_hash": "
|
|
364
|
+
"_hash": "G7ZX04bp0TdBG9fHDR7Sgu"
|
|
317
365
|
}
|
|
318
366
|
],
|
|
319
|
-
"_hash": "
|
|
367
|
+
"_hash": "0RyzLpZX1Nkfxej2WgXbEF"
|
|
320
368
|
}
|
|
321
369
|
}
|
|
322
370
|
```
|
package/dist/content/buffet.d.ts
CHANGED
package/dist/content/cake.d.ts
CHANGED
|
@@ -24,15 +24,11 @@ export interface Cake extends Json {
|
|
|
24
24
|
* A row in table, that contains the slice ids of the layer
|
|
25
25
|
*/
|
|
26
26
|
sliceIdsRow: SliceIdsRef;
|
|
27
|
-
/**
|
|
28
|
-
* The table containing the slice layers defining the layers
|
|
29
|
-
*/
|
|
30
|
-
layersTable: TableKey;
|
|
31
27
|
/**
|
|
32
28
|
* Assigns a layer to each layer of the cake.
|
|
33
29
|
*/
|
|
34
30
|
layers: {
|
|
35
|
-
[
|
|
31
|
+
[layerTable: TableKey]: LayerRef;
|
|
36
32
|
};
|
|
37
33
|
/**
|
|
38
34
|
* An optional ID of the cake.
|
|
@@ -42,7 +38,7 @@ export interface Cake extends Json {
|
|
|
42
38
|
/**
|
|
43
39
|
* A table containing cakes
|
|
44
40
|
*/
|
|
45
|
-
export type CakesTable = RljsonTable<Cake>;
|
|
41
|
+
export type CakesTable = RljsonTable<Cake, 'cakes'>;
|
|
46
42
|
/**
|
|
47
43
|
* Provides an example cakes table for test purposes
|
|
48
44
|
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NutritionalValues } from '../example/bakery-example.ts';
|
|
2
|
+
import { RljsonTable } from '../rljson.ts';
|
|
3
|
+
import { JsonWithId, Ref } from '../typedefs.ts';
|
|
4
|
+
/**
|
|
5
|
+
* A reference to a components row in a components table
|
|
6
|
+
*/
|
|
7
|
+
export type ComponentRef = Ref;
|
|
8
|
+
/**
|
|
9
|
+
* A table containing components
|
|
10
|
+
*/
|
|
11
|
+
export type ComponentsTable<T extends JsonWithId> = RljsonTable<T, 'components'>;
|
|
12
|
+
/**
|
|
13
|
+
* Provides an example components table for test purposes
|
|
14
|
+
*/
|
|
15
|
+
export declare const exampleComponentsTable: () => ComponentsTable<NutritionalValues>;
|
package/dist/content/layer.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Json } from '@rljson/json';
|
|
2
2
|
import { RljsonTable } from '../rljson.ts';
|
|
3
3
|
import { Ref, SliceId, TableKey } from '../typedefs.ts';
|
|
4
|
-
import {
|
|
4
|
+
import { ComponentRef } from './components.ts';
|
|
5
5
|
import { SliceIdsRef } from './slice-ids.ts';
|
|
6
6
|
/**
|
|
7
7
|
* A LayerRef is a hash pointing to a layer
|
|
8
8
|
*/
|
|
9
9
|
export type LayerRef = Ref;
|
|
10
10
|
/**
|
|
11
|
-
* A layer assigns
|
|
11
|
+
* A layer assigns components to item ids
|
|
12
12
|
*/
|
|
13
13
|
export interface Layer extends Json {
|
|
14
14
|
/**
|
|
15
|
-
* `base` an optional base layer that is extended by this layer
|
|
15
|
+
* `base` an optional base layer that is extended or shrinked by this layer
|
|
16
16
|
*/
|
|
17
17
|
base?: LayerRef;
|
|
18
18
|
/**
|
|
@@ -24,19 +24,26 @@ export interface Layer extends Json {
|
|
|
24
24
|
*/
|
|
25
25
|
sliceIdsTableRow: SliceIdsRef;
|
|
26
26
|
/**
|
|
27
|
-
* The table containing the
|
|
27
|
+
* The table containing the components that are assigned to the items
|
|
28
28
|
* with the assign property below
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
componentsTable: TableKey;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Assigns component properties to slice ids.
|
|
33
|
+
*
|
|
34
|
+
* If base is defined this will add
|
|
35
|
+
* or override assignments of the base layer.
|
|
33
36
|
*/
|
|
34
|
-
|
|
37
|
+
add: Record<SliceId, ComponentRef>;
|
|
38
|
+
/**
|
|
39
|
+
* Use this property to remove assignments from the base layer.
|
|
40
|
+
*/
|
|
41
|
+
remove?: Record<SliceId, ComponentRef>;
|
|
35
42
|
}
|
|
36
43
|
/**
|
|
37
44
|
* A table containing layers
|
|
38
45
|
*/
|
|
39
|
-
export type LayersTable = RljsonTable<Layer>;
|
|
46
|
+
export type LayersTable = RljsonTable<Layer, 'layers'>;
|
|
40
47
|
/**
|
|
41
48
|
* Provides an example layersTable for test purposes
|
|
42
49
|
*/
|
|
@@ -23,14 +23,14 @@ export interface Revision extends Json {
|
|
|
23
23
|
timestamp: number;
|
|
24
24
|
/**
|
|
25
25
|
* The optional ID of the revisioned element.
|
|
26
|
-
* Can be used get all revisions of a specific
|
|
26
|
+
* Can be used get all revisions of a specific component.
|
|
27
27
|
*/
|
|
28
28
|
id?: string;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* A table containing revisions
|
|
32
32
|
*/
|
|
33
|
-
export type RevisionsTable = RljsonTable<Revision>;
|
|
33
|
+
export type RevisionsTable = RljsonTable<Revision, 'revisions'>;
|
|
34
34
|
/**
|
|
35
35
|
* Example revision object for test purposes
|
|
36
36
|
*/
|
|
@@ -25,7 +25,7 @@ export interface SliceIds extends Json {
|
|
|
25
25
|
/**
|
|
26
26
|
* A table containing slice ids
|
|
27
27
|
*/
|
|
28
|
-
export type SliceIdsTable = RljsonTable<SliceIds>;
|
|
28
|
+
export type SliceIdsTable = RljsonTable<SliceIds, 'sliceIds'>;
|
|
29
29
|
/**
|
|
30
30
|
* Returns one of the layers of the example cake
|
|
31
31
|
*/
|
|
@@ -66,7 +66,7 @@ export interface TableCfg extends Json {
|
|
|
66
66
|
/**
|
|
67
67
|
* A table containing columns
|
|
68
68
|
*/
|
|
69
|
-
export type TablesCfgTable = RljsonTable<TableCfg>;
|
|
69
|
+
export type TablesCfgTable = RljsonTable<TableCfg, 'tableCfgs'>;
|
|
70
70
|
/**
|
|
71
71
|
* Throws an error if the table configuration is not valid.
|
|
72
72
|
* @param tableCfg - The table configuration to check
|
|
@@ -84,6 +84,7 @@ export declare const validateRljsonAgainstTableCfg: (rows: Json[], tableCfg: Tab
|
|
|
84
84
|
* @param tableCfg - The table configuration to add columns to
|
|
85
85
|
* @param columns - The columns to add
|
|
86
86
|
* @returns The updated table configuration
|
|
87
|
+
// eslint-disable-next-line tsdoc/syntax
|
|
87
88
|
* @throws Error if the columns already exist in the table configuration
|
|
88
89
|
*/
|
|
89
90
|
export declare const addColumnsToTableCfg: (tableCfg: TableCfg, columns: ColumnCfg[]) => TableCfg;
|