@rljson/rljson 0.0.51 → 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.
@@ -9,7 +9,7 @@ import { exampleJsonObject } from '@rljson/json';
9
9
 
10
10
  import { BuffetsTable } from './content/buffet.ts';
11
11
  import { Cake, CakesTable } from './content/cake.ts';
12
- import { IngredientsTable } from './content/ingredients.ts';
12
+ import { ComponentsTable } from './content/components.ts';
13
13
  import { Layer, LayersTable } from './content/layer.ts';
14
14
  import { SliceIdsTable } from './content/slice-ids.ts';
15
15
  import { ColumnCfg, TablesCfgTable } from './content/table-cfg.ts';
@@ -27,6 +27,7 @@ export class Example {
27
27
  binary: (): Rljson => {
28
28
  return {
29
29
  table: {
30
+ _type: 'components',
30
31
  _data: [
31
32
  { a: false, b: false },
32
33
  { a: false, b: true },
@@ -40,12 +41,13 @@ export class Example {
40
41
  singleRow: (): Rljson => {
41
42
  const tableCfgs = hip<TablesCfgTable>({
42
43
  _hash: '',
44
+ _type: 'tableCfgs',
43
45
  _data: [
44
46
  {
45
47
  version: 0,
46
48
  _hash: '',
47
49
  key: 'table',
48
- type: 'ingredients',
50
+ type: 'components',
49
51
  isHead: false,
50
52
  isRoot: false,
51
53
  isShared: true,
@@ -91,6 +93,7 @@ export class Example {
91
93
  tableCfgs: tableCfgs,
92
94
  table: {
93
95
  _tableCfg: tableCfgs._data[0]._hash as string,
96
+ _type: 'components',
94
97
  _data: [exampleJsonObject()],
95
98
  _hash: '',
96
99
  },
@@ -101,6 +104,7 @@ export class Example {
101
104
  multipleRows: (): Rljson => {
102
105
  return {
103
106
  table: {
107
+ _type: 'components',
104
108
  _data: [
105
109
  {
106
110
  string: 'str0',
@@ -133,6 +137,7 @@ export class Example {
133
137
  singleRef: (): Rljson => {
134
138
  return {
135
139
  tableA: {
140
+ _type: 'components',
136
141
  _data: [
137
142
  {
138
143
  keyA0: 'a0',
@@ -143,6 +148,7 @@ export class Example {
143
148
  ],
144
149
  },
145
150
  tableB: {
151
+ _type: 'components',
146
152
  _data: [
147
153
  {
148
154
  tableARef: 'KFQrf4mEz0UPmUaFHwH4T6',
@@ -153,6 +159,7 @@ export class Example {
153
159
  },
154
160
  complete: (): Rljson => {
155
161
  const sliceIds = hip<SliceIdsTable>({
162
+ _type: 'sliceIds',
156
163
  _data: [
157
164
  {
158
165
  add: ['id0', 'id1'],
@@ -160,52 +167,54 @@ export class Example {
160
167
  ],
161
168
  });
162
169
 
163
- const ingredients = hip<IngredientsTable<any>>({
170
+ const components = hip<ComponentsTable<any>>({
171
+ _type: 'components',
164
172
  _data: [{ a: '0' }, { a: '1' }],
165
173
  });
166
- const ingredient0 = ingredients._data[0];
167
- const ingredient1 = ingredients._data[1];
174
+ const component0 = components._data[0];
175
+ const component1 = components._data[1];
168
176
 
169
- const layer0 = hip<Layer>({
177
+ const abLayer0 = hip<Layer>({
170
178
  sliceIdsTable: 'sliceIds',
171
179
  sliceIdsTableRow: 'MgHRBYSrhpyl4rvsOmAWcQ',
172
- ingredientsTable: 'ingredients',
173
- assign: {
174
- id0: ingredient0._hash,
175
- id1: ingredient1._hash,
180
+ componentsTable: 'components',
181
+ add: {
182
+ id0: component0._hash,
183
+ id1: component1._hash,
176
184
  },
177
185
  });
178
186
 
179
- const layer1 = hip<Layer>({
180
- base: layer0._hash as string,
187
+ const abLayer1 = hip<Layer>({
188
+ base: abLayer0._hash as string,
181
189
  sliceIdsTable: 'sliceIds',
182
190
  sliceIdsTableRow: 'MgHRBYSrhpyl4rvsOmAWcQ',
183
- ingredientsTable: 'ingredients',
184
- assign: {
185
- id0: ingredient0._hash,
186
- id1: ingredient1._hash,
191
+ componentsTable: 'components',
192
+ add: {
193
+ id0: component0._hash,
194
+ id1: component1._hash,
187
195
  },
188
196
  });
189
197
 
190
- const layers = hip<LayersTable>({
191
- _data: [layer0, layer1],
192
- } as LayersTable);
198
+ const abLayers = hip<LayersTable>({
199
+ _type: 'layers',
200
+ _data: [abLayer0, abLayer1],
201
+ });
193
202
 
194
203
  const cake = hip<Cake>({
195
204
  sliceIdsTable: 'sliceIds',
196
205
  sliceIdsRow: sliceIds._data[0]._hash as string,
197
- layersTable: 'layers',
198
206
  layers: {
199
- layer0: layer0._hash as string,
200
- layer1: layer1._hash as string,
207
+ abLayers: abLayer1._hash as string,
201
208
  },
202
209
  });
203
210
 
204
211
  const cakes = hip<CakesTable>({
212
+ _type: 'cakes',
205
213
  _data: [cake],
206
214
  });
207
215
 
208
216
  const buffets = hip<BuffetsTable>({
217
+ _type: 'buffets',
209
218
  _data: [
210
219
  {
211
220
  items: [
@@ -214,8 +223,8 @@ export class Example {
214
223
  ref: cakes._data[0]._hash as string,
215
224
  },
216
225
  {
217
- table: 'layers',
218
- ref: layer0._hash as string,
226
+ table: 'abLayers',
227
+ ref: abLayer0._hash as string,
219
228
  },
220
229
  ],
221
230
  },
@@ -224,8 +233,8 @@ export class Example {
224
233
 
225
234
  return {
226
235
  sliceIds,
227
- ingredients,
228
- layers,
236
+ components,
237
+ abLayers,
229
238
  cakes,
230
239
  buffets,
231
240
  };
@@ -259,6 +268,7 @@ export class Example {
259
268
  missingRef: (): Rljson => {
260
269
  return {
261
270
  tableA: {
271
+ _type: 'components',
262
272
  _data: [
263
273
  {
264
274
  keyA0: 'a0',
@@ -269,6 +279,7 @@ export class Example {
269
279
  ],
270
280
  },
271
281
  tableB: {
282
+ _type: 'components',
272
283
  _data: [
273
284
  {
274
285
  tableARef: 'MISSINGREF', // MISSINGREF does not exist in tableA
@@ -281,6 +292,7 @@ export class Example {
281
292
  missingReferencedTable: (): Rljson => {
282
293
  return {
283
294
  tableB: {
295
+ _type: 'components',
284
296
  _data: [
285
297
  {
286
298
  tableARef: 'MISSINGREF', // tableA is missing
@@ -307,7 +319,7 @@ export class Example {
307
319
  layers: {
308
320
  missingBase: (): Rljson => {
309
321
  const result = Example.ok.complete();
310
- const layer1 = result.layers._data[1];
322
+ const layer1 = result.abLayers._data[1];
311
323
  layer1.base = 'MISSING'; // Missing base
312
324
 
313
325
  // Recalculate hashes
@@ -319,7 +331,7 @@ export class Example {
319
331
 
320
332
  missingSliceIdSet: (): Rljson => {
321
333
  const result = Example.ok.complete();
322
- const layer1 = (result.layers as LayersTable)._data[1];
334
+ const layer1 = (result.abLayers as LayersTable)._data[1];
323
335
 
324
336
  layer1.sliceIdsTableRow = 'MISSING1';
325
337
 
@@ -330,15 +342,15 @@ export class Example {
330
342
  });
331
343
  },
332
344
 
333
- missingAssignedIngredientTable: (): Rljson => {
345
+ missingAssignedComponentTable: (): Rljson => {
334
346
  const result = Example.ok.complete();
335
- delete result.ingredients; // Remove ingredients table
347
+ delete result.components; // Remove components table
336
348
  return result;
337
349
  },
338
350
 
339
- missingAssignedIngredient: (): Rljson => {
351
+ missingAssignedComponent: (): Rljson => {
340
352
  const result = Example.ok.complete();
341
- result.ingredients._data.splice(1, 2); // Remove an ingredient that is assigned
353
+ result.components._data.splice(1, 2); // Remove an component that is assigned
342
354
  return hip(result, {
343
355
  updateExistingHashes: true,
344
356
  throwOnWrongHashes: false,
@@ -369,7 +381,7 @@ export class Example {
369
381
 
370
382
  missingLayersTable: (): Rljson => {
371
383
  const result = Example.ok.complete();
372
- result.cakes._data[0].layersTable = 'MISSING'; // Missing layers table
384
+ result.cakes._data[0].layers = { MISSING: 'HASH' }; // Missing layers table
373
385
  hip(result.cakes, {
374
386
  updateExistingHashes: true,
375
387
  throwOnWrongHashes: false,
@@ -379,8 +391,7 @@ export class Example {
379
391
 
380
392
  missingCakeLayer: (): Rljson => {
381
393
  const result = Example.ok.complete();
382
- result.cakes._data[0].layers['layer0'] = 'MISSING0';
383
- result.cakes._data[0].layers['layer1'] = 'MISSING1';
394
+ result.cakes._data[0].layers['abLayers'] = 'MISSING0';
384
395
  hip(result.cakes, {
385
396
  updateExistingHashes: true,
386
397
  throwOnWrongHashes: false,
@@ -24,9 +24,9 @@ export type ColumnKey = JsonKey;
24
24
  * - `cakes` Tables containing cakes
25
25
  * - `layers` Tables containing layers
26
26
  * - `ids` Tables containing slice ids
27
- * - `ingredients` Tables containing slice ingredients
27
+ * - `components` Tables containing slice components
28
28
  */
29
- export declare const contentTypes: readonly ["buffets", "cakes", "layers", "sliceIds", "ingredients"];
29
+ export declare const contentTypes: readonly ["buffets", "cakes", "layers", "sliceIds", "components", "revisions", "tableCfgs"];
30
30
  export type ContentType = (typeof contentTypes)[number];
31
31
  /**
32
32
  * An example object using the typedefs
@@ -22,8 +22,8 @@ export interface BaseErrors extends Errors {
22
22
  layerSliceIdsGivenButNoTable?: Json;
23
23
  layerSliceIdsTableNotFound?: Json;
24
24
  layerSliceIdsRowNotFound?: Json;
25
- layerIngredientTablesNotFound?: Json;
26
- layerIngredientAssignmentsNotFound?: Json;
25
+ layerComponentTablesNotFound?: Json;
26
+ layerComponentAssignmentsNotFound?: Json;
27
27
  layerAssignmentsDoNotMatchSliceIds?: Json;
28
28
  cakeSliceIdsTableNotFound?: Json;
29
29
  cakeSliceIdsNotFound?: Json;
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/rljson",
3
- "version": "0.0.51",
4
- "packageManager": "pnpm@10.11.0",
3
+ "version": "0.0.52",
5
4
  "description": "The RLJSON data format specification",
6
5
  "homepage": "https://github.com/rljson/rljson",
7
6
  "bugs": "https://github.com/rljson/rljson/issues",
@@ -20,43 +19,36 @@
20
19
  "dist"
21
20
  ],
22
21
  "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
- },
31
22
  "devDependencies": {
32
- "@types/node": "^22.15.17",
33
- "@typescript-eslint/eslint-plugin": "^8.32.1",
34
- "@typescript-eslint/parser": "^8.32.1",
35
- "@vitest/coverage-v8": "^3.1.3",
36
- "cross-env": "^7.0.3",
37
- "eslint": "^9.26.0",
38
- "eslint-plugin-jsdoc": "^50.6.14",
23
+ "@types/node": "^24.4.0",
24
+ "@typescript-eslint/eslint-plugin": "^8.43.0",
25
+ "@typescript-eslint/parser": "^8.43.0",
26
+ "@vitest/coverage-v8": "^3.2.4",
27
+ "cross-env": "^10.0.0",
28
+ "eslint": "^9.35.0",
29
+ "eslint-plugin-jsdoc": "^57.0.8",
39
30
  "eslint-plugin-tsdoc": "^0.4.0",
40
- "globals": "^16.1.0",
31
+ "globals": "^16.4.0",
41
32
  "jsdoc": "^4.0.4",
42
33
  "read-pkg": "^9.0.1",
43
- "typescript": "~5.8.3",
44
- "typescript-eslint": "^8.32.1",
45
- "vite": "^6.3.5",
46
- "vite-node": "^3.1.3",
47
- "vite-plugin-dts": "^4.5.3",
34
+ "typescript": "~5.9.2",
35
+ "typescript-eslint": "^8.43.0",
36
+ "vite": "^7.1.5",
37
+ "vite-node": "^3.2.4",
38
+ "vite-plugin-dts": "^4.5.4",
48
39
  "vite-tsconfig-paths": "^5.1.4",
49
- "vitest": "^3.1.3",
40
+ "vitest": "^3.2.4",
50
41
  "vitest-dom": "^0.1.1"
51
42
  },
52
43
  "dependencies": {
53
44
  "@rljson/hash": "^0.0.16",
54
45
  "@rljson/json": "^0.0.21"
55
46
  },
56
- "pnpm": {
57
- "onlyBuiltDependencies": [
58
- "esbuild"
59
- ],
60
- "overrides": {}
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"
61
53
  }
62
- }
54
+ }
@@ -1,15 +0,0 @@
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 ingredients row in a ingredients table
6
- */
7
- export type IngredientsRef = Ref;
8
- /**
9
- * A table containing ingredients
10
- */
11
- export type IngredientsTable<T extends JsonWithId> = RljsonTable<T>;
12
- /**
13
- * Provides an example ingredients table for test purposes
14
- */
15
- export declare const exampleIngredientsTable: () => IngredientsTable<NutritionalValues>;