@rljson/rljson 0.0.36 → 0.0.37
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/dist/content/cake.d.ts +5 -10
- package/dist/content/layer.d.ts +8 -10
- package/dist/rljson.js +26 -57
- package/dist/src/example.ts +21 -26
- package/package.json +1 -1
package/dist/content/cake.d.ts
CHANGED
|
@@ -19,16 +19,11 @@ export interface Cake extends Json {
|
|
|
19
19
|
* must match these slice ids of the layers.
|
|
20
20
|
* The slice ids can be found in the idSet table.
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* A row in table, that contains the slice ids of the layer
|
|
29
|
-
*/
|
|
30
|
-
row: SliceIdsRef;
|
|
31
|
-
};
|
|
22
|
+
sliceIdsTable: TableKey;
|
|
23
|
+
/**
|
|
24
|
+
* A row in table, that contains the slice ids of the layer
|
|
25
|
+
*/
|
|
26
|
+
sliceIdsRow: SliceIdsRef;
|
|
32
27
|
/**
|
|
33
28
|
* The table containing the slice layers defining the layers
|
|
34
29
|
*/
|
package/dist/content/layer.d.ts
CHANGED
|
@@ -15,16 +15,14 @@ export interface Layer extends Json {
|
|
|
15
15
|
* `base` an optional base layer that is extended by this layer
|
|
16
16
|
*/
|
|
17
17
|
base?: LayerRef;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
row: SliceIdsRef;
|
|
27
|
-
};
|
|
18
|
+
/**
|
|
19
|
+
* The table containing the item ids of the layer
|
|
20
|
+
*/
|
|
21
|
+
sliceIdsTable: TableKey;
|
|
22
|
+
/**
|
|
23
|
+
* A row in table, that contains the slice ids of the layer
|
|
24
|
+
*/
|
|
25
|
+
sliceIdsTableRow: SliceIdsRef;
|
|
28
26
|
/**
|
|
29
27
|
* The table containing the ingredients that are assigned to the items
|
|
30
28
|
* with the assign property below
|
package/dist/rljson.js
CHANGED
|
@@ -75,10 +75,8 @@ const bakeryExample = () => {
|
|
|
75
75
|
{
|
|
76
76
|
id: "tastyCake",
|
|
77
77
|
ingredientsTable: "recipeIngredients",
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
row: ingredientTypes._data[0]._hash
|
|
81
|
-
},
|
|
78
|
+
sliceIdsTable: "ingredientTypes",
|
|
79
|
+
sliceIdsTableRow: ingredientTypes._data[0]._hash,
|
|
82
80
|
assign: {
|
|
83
81
|
flour: recipeIngredients._data[0]._hash
|
|
84
82
|
},
|
|
@@ -91,10 +89,8 @@ const bakeryExample = () => {
|
|
|
91
89
|
_data: [
|
|
92
90
|
{
|
|
93
91
|
ingredientsTable: "recipes",
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
row: slices._data[0]._hash
|
|
97
|
-
},
|
|
92
|
+
sliceIdsTable: "slices",
|
|
93
|
+
sliceIdsTableRow: slices._data[0]._hash,
|
|
98
94
|
assign: {
|
|
99
95
|
slice0: recipes._data[0]._hash,
|
|
100
96
|
slice1: recipes._data[0]._hash
|
|
@@ -107,10 +103,8 @@ const bakeryExample = () => {
|
|
|
107
103
|
_data: [
|
|
108
104
|
{
|
|
109
105
|
id: "cake1",
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
row: slices._data[0]._hash
|
|
113
|
-
},
|
|
106
|
+
sliceIdsTable: "slices",
|
|
107
|
+
sliceIdsRow: slices._data[0]._hash,
|
|
114
108
|
layersTable: "layers",
|
|
115
109
|
layers: {
|
|
116
110
|
flour: layers._data[0]._hash
|
|
@@ -298,10 +292,8 @@ __publicField(_Example, "ok", {
|
|
|
298
292
|
const ingredient0 = ingredients._data[0];
|
|
299
293
|
const ingredient1 = ingredients._data[1];
|
|
300
294
|
const layer0 = hip({
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
row: "MgHRBYSrhpyl4rvsOmAWcQ"
|
|
304
|
-
},
|
|
295
|
+
sliceIdsTable: "sliceIds",
|
|
296
|
+
sliceIdsTableRow: "MgHRBYSrhpyl4rvsOmAWcQ",
|
|
305
297
|
ingredientsTable: "ingredients",
|
|
306
298
|
assign: {
|
|
307
299
|
id0: ingredient0._hash,
|
|
@@ -310,10 +302,8 @@ __publicField(_Example, "ok", {
|
|
|
310
302
|
});
|
|
311
303
|
const layer1 = hip({
|
|
312
304
|
base: layer0._hash,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
row: "MgHRBYSrhpyl4rvsOmAWcQ"
|
|
316
|
-
},
|
|
305
|
+
sliceIdsTable: "sliceIds",
|
|
306
|
+
sliceIdsTableRow: "MgHRBYSrhpyl4rvsOmAWcQ",
|
|
317
307
|
ingredientsTable: "ingredients",
|
|
318
308
|
assign: {
|
|
319
309
|
id0: ingredient0._hash,
|
|
@@ -325,10 +315,8 @@ __publicField(_Example, "ok", {
|
|
|
325
315
|
_data: [layer0, layer1]
|
|
326
316
|
});
|
|
327
317
|
const cake = hip({
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
row: sliceIds._data[0]._hash
|
|
331
|
-
},
|
|
318
|
+
sliceIdsTable: "sliceIds",
|
|
319
|
+
sliceIdsRow: sliceIds._data[0]._hash,
|
|
332
320
|
layersTable: "layers",
|
|
333
321
|
layers: {
|
|
334
322
|
layer0: layer0._hash,
|
|
@@ -452,7 +440,7 @@ __publicField(_Example, "broken", {
|
|
|
452
440
|
missingSliceIdSet: () => {
|
|
453
441
|
const result = _Example.ok.complete();
|
|
454
442
|
const layer1 = result.layers._data[1];
|
|
455
|
-
layer1.
|
|
443
|
+
layer1.sliceIdsTableRow = "MISSING1";
|
|
456
444
|
return hip(result, {
|
|
457
445
|
updateExistingHashes: true,
|
|
458
446
|
throwOnWrongHashes: false
|
|
@@ -475,7 +463,7 @@ __publicField(_Example, "broken", {
|
|
|
475
463
|
cakes: {
|
|
476
464
|
missingSliceIdSet: () => {
|
|
477
465
|
const result = _Example.ok.complete();
|
|
478
|
-
result.cakes._data[0].
|
|
466
|
+
result.cakes._data[0].sliceIdsRow = "MISSING";
|
|
479
467
|
hip(result.cakes, {
|
|
480
468
|
updateExistingHashes: true,
|
|
481
469
|
throwOnWrongHashes: false
|
|
@@ -1154,16 +1142,12 @@ class _BaseValidator {
|
|
|
1154
1142
|
}
|
|
1155
1143
|
const layersTable = table;
|
|
1156
1144
|
for (const layer of layersTable._data) {
|
|
1157
|
-
const
|
|
1158
|
-
if (!sliceIds) {
|
|
1159
|
-
continue;
|
|
1160
|
-
}
|
|
1161
|
-
const sliceIdsTable = this.rljsonIndexed[sliceIds.table];
|
|
1145
|
+
const sliceIdsTable = this.rljsonIndexed[layer.sliceIdsTable];
|
|
1162
1146
|
if (!sliceIdsTable) {
|
|
1163
1147
|
brokenLayers.push({
|
|
1164
1148
|
layersTable: tableKey,
|
|
1165
1149
|
layerHash: layer._hash,
|
|
1166
|
-
missingSliceIdsTable:
|
|
1150
|
+
missingSliceIdsTable: layer.sliceIdsTable
|
|
1167
1151
|
});
|
|
1168
1152
|
}
|
|
1169
1153
|
}
|
|
@@ -1183,18 +1167,14 @@ class _BaseValidator {
|
|
|
1183
1167
|
}
|
|
1184
1168
|
const layersTable = table;
|
|
1185
1169
|
for (const layer of layersTable._data) {
|
|
1186
|
-
const
|
|
1187
|
-
if (!sliceIds) {
|
|
1188
|
-
continue;
|
|
1189
|
-
}
|
|
1190
|
-
const sliceIdsTableName = sliceIds.table;
|
|
1170
|
+
const sliceIdsTableName = layer.sliceIdsTable;
|
|
1191
1171
|
const sliceIdsTable = this.rljsonIndexed[sliceIdsTableName];
|
|
1192
|
-
const idSet = sliceIdsTable._data[
|
|
1172
|
+
const idSet = sliceIdsTable._data[layer.sliceIdsTableRow];
|
|
1193
1173
|
if (!idSet) {
|
|
1194
1174
|
brokenLayers.push({
|
|
1195
1175
|
layersTable: tableKey,
|
|
1196
1176
|
layerHash: layer._hash,
|
|
1197
|
-
missingSliceIdsRow:
|
|
1177
|
+
missingSliceIdsRow: layer.sliceIdsTableRow
|
|
1198
1178
|
});
|
|
1199
1179
|
}
|
|
1200
1180
|
}
|
|
@@ -1264,11 +1244,8 @@ class _BaseValidator {
|
|
|
1264
1244
|
}
|
|
1265
1245
|
const layersTable = table;
|
|
1266
1246
|
for (const layer of layersTable._data) {
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
}
|
|
1270
|
-
const sliceIdsTable = this.rljsonIndexed[layer.sliceIds.table];
|
|
1271
|
-
const sliceIdsRow = sliceIdsTable._data[layer.sliceIds.row];
|
|
1247
|
+
const sliceIdsTable = this.rljsonIndexed[layer.sliceIdsTable];
|
|
1248
|
+
const sliceIdsRow = sliceIdsTable._data[layer.sliceIdsTableRow];
|
|
1272
1249
|
const sliceIds = sliceIdsRow.add;
|
|
1273
1250
|
const sliceIdsInLayer = Object.keys(layer.assign);
|
|
1274
1251
|
const unassignedSliceIds = [];
|
|
@@ -1302,16 +1279,12 @@ class _BaseValidator {
|
|
|
1302
1279
|
}
|
|
1303
1280
|
const cakesTable = table;
|
|
1304
1281
|
for (const cake of cakesTable._data) {
|
|
1305
|
-
const
|
|
1306
|
-
if (!sliceIds) {
|
|
1307
|
-
continue;
|
|
1308
|
-
}
|
|
1309
|
-
const sliceIdsTable = this.rljsonIndexed[sliceIds.table];
|
|
1282
|
+
const sliceIdsTable = this.rljsonIndexed[cake.sliceIdsTable];
|
|
1310
1283
|
if (!sliceIdsTable) {
|
|
1311
1284
|
brokenCakes.push({
|
|
1312
1285
|
cakeTable: tableKey,
|
|
1313
1286
|
brokenCake: cake._hash,
|
|
1314
|
-
missingSliceIdsTable:
|
|
1287
|
+
missingSliceIdsTable: cake.sliceIdsTable
|
|
1315
1288
|
});
|
|
1316
1289
|
}
|
|
1317
1290
|
}
|
|
@@ -1331,18 +1304,14 @@ class _BaseValidator {
|
|
|
1331
1304
|
}
|
|
1332
1305
|
const cakesTable = table;
|
|
1333
1306
|
for (const cake of cakesTable._data) {
|
|
1334
|
-
const
|
|
1335
|
-
if (!sliceIds) {
|
|
1336
|
-
continue;
|
|
1337
|
-
}
|
|
1338
|
-
const sliceIdsTableName = cake.sliceIds.table;
|
|
1307
|
+
const sliceIdsTableName = cake.sliceIdsTable;
|
|
1339
1308
|
const sliceIdsTable = this.rljsonIndexed[sliceIdsTableName];
|
|
1340
|
-
const sliceIdValues = sliceIdsTable._data[
|
|
1309
|
+
const sliceIdValues = sliceIdsTable._data[cake.sliceIdsRow];
|
|
1341
1310
|
if (!sliceIdValues) {
|
|
1342
1311
|
brokenCakes.push({
|
|
1343
1312
|
cakeTable: tableKey,
|
|
1344
1313
|
brokenCake: cake._hash,
|
|
1345
|
-
missingSliceIdsRow:
|
|
1314
|
+
missingSliceIdsRow: cake.sliceIdsRow
|
|
1346
1315
|
});
|
|
1347
1316
|
}
|
|
1348
1317
|
}
|
package/dist/src/example.ts
CHANGED
|
@@ -39,7 +39,7 @@ export class Example {
|
|
|
39
39
|
},
|
|
40
40
|
|
|
41
41
|
singleRow: (): Rljson => {
|
|
42
|
-
const tableCfgs
|
|
42
|
+
const tableCfgs = hip<TablesCfgTable>({
|
|
43
43
|
_hash: '',
|
|
44
44
|
|
|
45
45
|
_type: 'ingredients',
|
|
@@ -151,7 +151,7 @@ export class Example {
|
|
|
151
151
|
};
|
|
152
152
|
},
|
|
153
153
|
complete: (): Rljson => {
|
|
154
|
-
const sliceIds
|
|
154
|
+
const sliceIds = hip<SliceIdsTable>({
|
|
155
155
|
_type: 'sliceIds',
|
|
156
156
|
_data: [
|
|
157
157
|
{
|
|
@@ -160,18 +160,16 @@ export class Example {
|
|
|
160
160
|
],
|
|
161
161
|
});
|
|
162
162
|
|
|
163
|
-
const ingredients
|
|
163
|
+
const ingredients = hip<IngredientsTable<any>>({
|
|
164
164
|
_type: 'ingredients',
|
|
165
165
|
_data: [{ a: '0' }, { a: '1' }],
|
|
166
166
|
});
|
|
167
167
|
const ingredient0 = ingredients._data[0];
|
|
168
168
|
const ingredient1 = ingredients._data[1];
|
|
169
169
|
|
|
170
|
-
const layer0
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
row: 'MgHRBYSrhpyl4rvsOmAWcQ',
|
|
174
|
-
},
|
|
170
|
+
const layer0 = hip<Layer>({
|
|
171
|
+
sliceIdsTable: 'sliceIds',
|
|
172
|
+
sliceIdsTableRow: 'MgHRBYSrhpyl4rvsOmAWcQ',
|
|
175
173
|
ingredientsTable: 'ingredients',
|
|
176
174
|
assign: {
|
|
177
175
|
id0: ingredient0._hash,
|
|
@@ -179,12 +177,10 @@ export class Example {
|
|
|
179
177
|
},
|
|
180
178
|
});
|
|
181
179
|
|
|
182
|
-
const layer1
|
|
180
|
+
const layer1 = hip<Layer>({
|
|
183
181
|
base: layer0._hash as string,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
row: 'MgHRBYSrhpyl4rvsOmAWcQ',
|
|
187
|
-
},
|
|
182
|
+
sliceIdsTable: 'sliceIds',
|
|
183
|
+
sliceIdsTableRow: 'MgHRBYSrhpyl4rvsOmAWcQ',
|
|
188
184
|
ingredientsTable: 'ingredients',
|
|
189
185
|
assign: {
|
|
190
186
|
id0: ingredient0._hash,
|
|
@@ -192,16 +188,14 @@ export class Example {
|
|
|
192
188
|
},
|
|
193
189
|
});
|
|
194
190
|
|
|
195
|
-
const layers
|
|
191
|
+
const layers = hip<LayersTable>({
|
|
196
192
|
_type: 'layers',
|
|
197
193
|
_data: [layer0, layer1],
|
|
198
194
|
} as LayersTable);
|
|
199
195
|
|
|
200
|
-
const cake
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
row: sliceIds._data[0]._hash as string,
|
|
204
|
-
},
|
|
196
|
+
const cake = hip<Cake>({
|
|
197
|
+
sliceIdsTable: 'sliceIds',
|
|
198
|
+
sliceIdsRow: sliceIds._data[0]._hash as string,
|
|
205
199
|
layersTable: 'layers',
|
|
206
200
|
layers: {
|
|
207
201
|
layer0: layer0._hash as string,
|
|
@@ -209,12 +203,12 @@ export class Example {
|
|
|
209
203
|
},
|
|
210
204
|
});
|
|
211
205
|
|
|
212
|
-
const cakes
|
|
206
|
+
const cakes = hip<CakesTable>({
|
|
213
207
|
_type: 'cakes',
|
|
214
208
|
_data: [cake],
|
|
215
209
|
});
|
|
216
210
|
|
|
217
|
-
const buffets
|
|
211
|
+
const buffets = hip<BuffetsTable>({
|
|
218
212
|
_type: 'buffets',
|
|
219
213
|
_data: [
|
|
220
214
|
{
|
|
@@ -335,9 +329,9 @@ export class Example {
|
|
|
335
329
|
|
|
336
330
|
missingSliceIdSet: (): Rljson => {
|
|
337
331
|
const result = Example.ok.complete();
|
|
338
|
-
const layer1 = result.layers._data[1];
|
|
332
|
+
const layer1 = (result.layers as LayersTable)._data[1];
|
|
339
333
|
|
|
340
|
-
layer1.
|
|
334
|
+
layer1.sliceIdsTableRow = 'MISSING1';
|
|
341
335
|
|
|
342
336
|
// Recalculate hashes
|
|
343
337
|
return hip(result, {
|
|
@@ -365,14 +359,15 @@ export class Example {
|
|
|
365
359
|
cakes: {
|
|
366
360
|
missingSliceIdSet: (): Rljson => {
|
|
367
361
|
const result = Example.ok.complete();
|
|
368
|
-
result.cakes._data[0].
|
|
362
|
+
(result.cakes as CakesTable)._data[0].sliceIdsRow = 'MISSING'; // Missing ID set
|
|
363
|
+
|
|
369
364
|
hip(result.cakes, {
|
|
370
365
|
updateExistingHashes: true,
|
|
371
366
|
throwOnWrongHashes: false,
|
|
372
367
|
});
|
|
373
368
|
|
|
374
|
-
result.buffets._data[0].items[0].ref = result.cakes
|
|
375
|
-
._hash as string; // Update buffet reference
|
|
369
|
+
(result.buffets as BuffetsTable)._data[0].items[0].ref = result.cakes
|
|
370
|
+
._data[0]._hash as string; // Update buffet reference
|
|
376
371
|
|
|
377
372
|
hip(result.buffets, {
|
|
378
373
|
updateExistingHashes: true,
|