@rljson/rljson 0.0.55 → 0.0.56
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/example.d.ts +1 -0
- package/dist/rljson.js +44 -22
- package/dist/src/example.ts +20 -0
- package/package.json +16 -8
package/dist/example.d.ts
CHANGED
package/dist/rljson.js
CHANGED
|
@@ -311,6 +311,26 @@ __publicField(_Example, "ok", {
|
|
|
311
311
|
}
|
|
312
312
|
};
|
|
313
313
|
},
|
|
314
|
+
multiSliceIdRef: () => {
|
|
315
|
+
return {
|
|
316
|
+
exampleSliceId: {
|
|
317
|
+
_type: "sliceIds",
|
|
318
|
+
_data: [
|
|
319
|
+
{
|
|
320
|
+
add: ["id0", "id1"]
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
},
|
|
324
|
+
exampleComponent: {
|
|
325
|
+
_type: "components",
|
|
326
|
+
_data: [
|
|
327
|
+
{
|
|
328
|
+
exampleSliceId: ["id0", "id1"]
|
|
329
|
+
}
|
|
330
|
+
]
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
},
|
|
314
334
|
singleNamedRef: () => {
|
|
315
335
|
return {
|
|
316
336
|
tableA: {
|
|
@@ -1373,28 +1393,30 @@ class _BaseValidator {
|
|
|
1373
1393
|
for (const item of tableData) {
|
|
1374
1394
|
for (const key of Object.keys(item)) {
|
|
1375
1395
|
if (key.endsWith("SliceId")) {
|
|
1376
|
-
const
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1396
|
+
const targetSliceIds = Array.isArray(item[key]) ? item[key] : [item[key]];
|
|
1397
|
+
for (const targetSliceId of targetSliceIds) {
|
|
1398
|
+
if (this.tableKeys.indexOf(key) === -1) {
|
|
1399
|
+
missingSliceIdRefs.push({
|
|
1400
|
+
sourceTable: tableKey,
|
|
1401
|
+
targetSliceId,
|
|
1402
|
+
targetTable: key,
|
|
1403
|
+
error: `Target table "${targetSliceId}" not found.`
|
|
1404
|
+
});
|
|
1405
|
+
continue;
|
|
1406
|
+
}
|
|
1407
|
+
const targetSliceIdsTable = this.rljson[key];
|
|
1408
|
+
const targetSliceIds2 = targetSliceIdsTable._data.flatMap((d) => [
|
|
1409
|
+
...d.add,
|
|
1410
|
+
...d.remove ?? []
|
|
1411
|
+
]);
|
|
1412
|
+
if (targetSliceIds2.indexOf(targetSliceId) === -1) {
|
|
1413
|
+
missingSliceIdRefs.push({
|
|
1414
|
+
sourceTable: tableKey,
|
|
1415
|
+
targetSliceId,
|
|
1416
|
+
targetTable: key,
|
|
1417
|
+
error: `Table "${key}" has no sliceId "${targetSliceId}"`
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1398
1420
|
}
|
|
1399
1421
|
}
|
|
1400
1422
|
}
|
package/dist/src/example.ts
CHANGED
|
@@ -177,6 +177,26 @@ export class Example {
|
|
|
177
177
|
} as ComponentsTable<Json>,
|
|
178
178
|
};
|
|
179
179
|
},
|
|
180
|
+
multiSliceIdRef: (): Rljson => {
|
|
181
|
+
return {
|
|
182
|
+
exampleSliceId: {
|
|
183
|
+
_type: 'sliceIds',
|
|
184
|
+
_data: [
|
|
185
|
+
{
|
|
186
|
+
add: ['id0', 'id1'],
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
} as SliceIdsTable,
|
|
190
|
+
exampleComponent: {
|
|
191
|
+
_type: 'components',
|
|
192
|
+
_data: [
|
|
193
|
+
{
|
|
194
|
+
exampleSliceId: ['id0', 'id1'],
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
} as ComponentsTable<Json>,
|
|
198
|
+
};
|
|
199
|
+
},
|
|
180
200
|
singleNamedRef: (): Rljson => {
|
|
181
201
|
return {
|
|
182
202
|
tableA: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rljson/rljson",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.56",
|
|
4
|
+
"packageManager": "pnpm@10.11.0",
|
|
4
5
|
"description": "The RLJSON data format specification",
|
|
5
6
|
"homepage": "https://github.com/rljson/rljson",
|
|
6
7
|
"bugs": "https://github.com/rljson/rljson/issues",
|
|
@@ -19,6 +20,14 @@
|
|
|
19
20
|
"dist"
|
|
20
21
|
],
|
|
21
22
|
"type": "module",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "npx vite build && tsc && cp README* dist && mkdir dist/src && cp src/example.ts dist/src",
|
|
25
|
+
"test": "npx vitest run --coverage && npm run lint",
|
|
26
|
+
"prebuild": "npm run test",
|
|
27
|
+
"prepublishOnly": "npm run build && npm run test",
|
|
28
|
+
"lint": "npx eslint",
|
|
29
|
+
"updateGoldens": "cross-env UPDATE_GOLDENS=true npm test"
|
|
30
|
+
},
|
|
22
31
|
"devDependencies": {
|
|
23
32
|
"@types/node": "^24.4.0",
|
|
24
33
|
"@typescript-eslint/eslint-plugin": "^8.43.0",
|
|
@@ -44,11 +53,10 @@
|
|
|
44
53
|
"@rljson/hash": "^0.0.16",
|
|
45
54
|
"@rljson/json": "^0.0.21"
|
|
46
55
|
},
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
"updateGoldens": "cross-env UPDATE_GOLDENS=true npm test"
|
|
56
|
+
"pnpm": {
|
|
57
|
+
"onlyBuiltDependencies": [
|
|
58
|
+
"esbuild"
|
|
59
|
+
],
|
|
60
|
+
"overrides": {}
|
|
53
61
|
}
|
|
54
|
-
}
|
|
62
|
+
}
|