@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 CHANGED
@@ -8,6 +8,7 @@ export declare class Example {
8
8
  multipleRows: () => Rljson;
9
9
  singleRef: () => Rljson;
10
10
  singleSliceIdRef: () => Rljson;
11
+ multiSliceIdRef: () => Rljson;
11
12
  singleNamedRef: () => Rljson;
12
13
  multiRef: () => Rljson;
13
14
  multiMixedRef: () => Rljson;
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 targetSliceId = item[key];
1377
- if (this.tableKeys.indexOf(key) === -1) {
1378
- missingSliceIdRefs.push({
1379
- sourceTable: tableKey,
1380
- targetSliceId,
1381
- targetTable: key,
1382
- error: `Target table "${targetSliceId}" not found.`
1383
- });
1384
- continue;
1385
- }
1386
- const targetSliceIdsTable = this.rljson[key];
1387
- const targetSliceIds = targetSliceIdsTable._data.flatMap((d) => [
1388
- ...d.add,
1389
- ...d.remove ?? []
1390
- ]);
1391
- if (targetSliceIds.indexOf(targetSliceId) === -1) {
1392
- missingSliceIdRefs.push({
1393
- sourceTable: tableKey,
1394
- targetSliceId,
1395
- targetTable: key,
1396
- error: `Table "${key}" has no sliceId "${targetSliceId}"`
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
  }
@@ -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.55",
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
- "scripts": {
48
- "build": "npx vite build && tsc && cp README* dist && mkdir dist/src && cp src/example.ts dist/src",
49
- "test": "npx vitest run --coverage && npm run lint",
50
- "prebuild": "npm run test",
51
- "lint": "npx eslint",
52
- "updateGoldens": "cross-env UPDATE_GOLDENS=true npm test"
56
+ "pnpm": {
57
+ "onlyBuiltDependencies": [
58
+ "esbuild"
59
+ ],
60
+ "overrides": {}
53
61
  }
54
- }
62
+ }