@rljson/rljson 0.0.31 → 0.0.32

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,9 +9,9 @@ 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 { Collection, CollectionsTable } from './content/collection.ts';
13
- import { IdSetsTable } from './content/id-set.ts';
14
- import { PropertiesTable } from './content/properties.ts';
12
+ import { IngredientsTable } from './content/ingredients.ts';
13
+ import { Layer, LayersTable } from './content/layer.ts';
14
+ import { SliceIdsTable } from './content/slice-ids.ts';
15
15
  import { TablesCfgTable } from './content/table-cfg.ts';
16
16
  import { bakeryExample } from './example/bakery-example.ts';
17
17
  import { Rljson } from './rljson.ts';
@@ -27,7 +27,7 @@ export class Example {
27
27
  binary: (): Rljson => {
28
28
  return {
29
29
  table: {
30
- _type: 'properties',
30
+ _type: 'ingredients',
31
31
  _data: [
32
32
  { a: false, b: false },
33
33
  { a: false, b: true },
@@ -42,13 +42,13 @@ export class Example {
42
42
  const tableCfgs: TablesCfgTable = hip({
43
43
  _hash: '',
44
44
 
45
- _type: 'properties',
45
+ _type: 'ingredients',
46
46
  _data: [
47
47
  {
48
48
  version: 0,
49
49
  _hash: '',
50
50
  key: 'table',
51
- type: 'properties',
51
+ type: 'ingredients',
52
52
  columns: {
53
53
  int: {
54
54
  key: 'int',
@@ -90,7 +90,7 @@ export class Example {
90
90
  const result: Rljson = {
91
91
  tableCfgs: tableCfgs,
92
92
  table: {
93
- _type: 'properties',
93
+ _type: 'ingredients',
94
94
  _tableCfg: tableCfgs._data[0]._hash as string,
95
95
  _data: [exampleJsonObject()],
96
96
  _hash: '',
@@ -102,7 +102,7 @@ export class Example {
102
102
  multipleRows: (): Rljson => {
103
103
  return {
104
104
  table: {
105
- _type: 'properties',
105
+ _type: 'ingredients',
106
106
  _data: [
107
107
  {
108
108
  string: 'str0',
@@ -135,7 +135,7 @@ export class Example {
135
135
  singleRef: (): Rljson => {
136
136
  return {
137
137
  tableA: {
138
- _type: 'properties',
138
+ _type: 'ingredients',
139
139
  _data: [
140
140
  {
141
141
  keyA0: 'a0',
@@ -146,7 +146,7 @@ export class Example {
146
146
  ],
147
147
  },
148
148
  tableB: {
149
- _type: 'properties',
149
+ _type: 'ingredients',
150
150
  _data: [
151
151
  {
152
152
  tableARef: 'KFQrf4mEz0UPmUaFHwH4T6',
@@ -156,8 +156,8 @@ export class Example {
156
156
  };
157
157
  },
158
158
  complete: (): Rljson => {
159
- const idSets: IdSetsTable = hip({
160
- _type: 'idSets',
159
+ const sliceIds: SliceIdsTable = hip({
160
+ _type: 'sliceIds',
161
161
  _data: [
162
162
  {
163
163
  add: ['id0', 'id1'],
@@ -165,43 +165,43 @@ export class Example {
165
165
  ],
166
166
  });
167
167
 
168
- const properties: PropertiesTable<any> = hip({
169
- _type: 'properties',
168
+ const ingredients: IngredientsTable<any> = hip({
169
+ _type: 'ingredients',
170
170
  _data: [{ a: '0' }, { a: '1' }],
171
171
  });
172
- const property0 = properties._data[0];
173
- const property1 = properties._data[1];
172
+ const ingredient0 = ingredients._data[0];
173
+ const ingredient1 = ingredients._data[1];
174
174
 
175
- const collection0: Collection = hip({
176
- idSetsTable: 'idSets',
175
+ const layer0: Layer = hip({
176
+ sliceIdsTable: 'sliceIds',
177
177
  idSet: 'MgHRBYSrhpyl4rvsOmAWcQ',
178
- propertiesTable: 'properties',
178
+ ingredientsTable: 'ingredients',
179
179
  assign: {},
180
180
  });
181
181
 
182
- const collection1: Collection = hip({
183
- base: collection0._hash as string,
184
- idSetsTable: 'idSets',
182
+ const layer1: Layer = hip({
183
+ base: layer0._hash as string,
184
+ sliceIdsTable: 'sliceIds',
185
185
  idSet: 'MgHRBYSrhpyl4rvsOmAWcQ',
186
- propertiesTable: 'properties',
186
+ ingredientsTable: 'ingredients',
187
187
  assign: {
188
- id0: property0._hash,
189
- id1: property1._hash,
188
+ id0: ingredient0._hash,
189
+ id1: ingredient1._hash,
190
190
  },
191
191
  });
192
192
 
193
- const collections: CollectionsTable = hip({
194
- _type: 'collections',
195
- _data: [collection0, collection1],
196
- } as CollectionsTable);
193
+ const layers: LayersTable = hip({
194
+ _type: 'layers',
195
+ _data: [layer0, layer1],
196
+ } as LayersTable);
197
197
 
198
198
  const cake: Cake = hip({
199
- idSetsTable: 'idSets',
200
- idSet: idSets._data[0]._hash as string,
201
- collectionsTable: 'collections',
199
+ sliceIdsTable: 'sliceIds',
200
+ idSet: sliceIds._data[0]._hash as string,
201
+ layersTable: 'layers',
202
202
  layers: {
203
- layer0: collection0._hash as string,
204
- layer1: collection1._hash as string,
203
+ layer0: layer0._hash as string,
204
+ layer1: layer1._hash as string,
205
205
  },
206
206
  });
207
207
 
@@ -220,8 +220,8 @@ export class Example {
220
220
  ref: cakes._data[0]._hash as string,
221
221
  },
222
222
  {
223
- table: 'collections',
224
- ref: collection0._hash as string,
223
+ table: 'layers',
224
+ ref: layer0._hash as string,
225
225
  },
226
226
  ],
227
227
  },
@@ -229,9 +229,9 @@ export class Example {
229
229
  });
230
230
 
231
231
  return {
232
- idSets,
233
- properties,
234
- collections,
232
+ sliceIds,
233
+ ingredients,
234
+ layers,
235
235
  cakes,
236
236
  buffets,
237
237
  };
@@ -243,7 +243,7 @@ export class Example {
243
243
  brokenTableKey: () => {
244
244
  return {
245
245
  brok$en: {
246
- _type: 'properties',
246
+ _type: 'ingredients',
247
247
  _data: [],
248
248
  },
249
249
  };
@@ -252,7 +252,7 @@ export class Example {
252
252
  missingData: () => {
253
253
  return {
254
254
  table: {
255
- _type: 'properties',
255
+ _type: 'ingredients',
256
256
  },
257
257
  } as unknown as Rljson;
258
258
  },
@@ -260,7 +260,7 @@ export class Example {
260
260
  dataNotBeingAnArray: () => {
261
261
  return {
262
262
  table: {
263
- _type: 'properties',
263
+ _type: 'ingredients',
264
264
  _data: {},
265
265
  },
266
266
  } as unknown as Rljson;
@@ -269,7 +269,7 @@ export class Example {
269
269
  missingRef: (): Rljson => {
270
270
  return {
271
271
  tableA: {
272
- _type: 'properties',
272
+ _type: 'ingredients',
273
273
  _data: [
274
274
  {
275
275
  keyA0: 'a0',
@@ -280,7 +280,7 @@ export class Example {
280
280
  ],
281
281
  },
282
282
  tableB: {
283
- _type: 'properties',
283
+ _type: 'ingredients',
284
284
  _data: [
285
285
  {
286
286
  tableARef: 'MISSINGREF', // MISSINGREF does not exist in tableA
@@ -293,7 +293,7 @@ export class Example {
293
293
  missingReferencedTable: (): Rljson => {
294
294
  return {
295
295
  tableB: {
296
- _type: 'properties',
296
+ _type: 'ingredients',
297
297
  _data: [
298
298
  {
299
299
  tableARef: 'MISSINGREF', // tableA is missing
@@ -313,55 +313,55 @@ export class Example {
313
313
  },
314
314
  },
315
315
 
316
- collections: {
316
+ layers: {
317
317
  missingBase: (): Rljson => {
318
318
  const result = Example.ok.complete();
319
- const collection1 = result.collections._data[1];
320
- collection1.base = 'MISSING'; // Missing base
319
+ const layer1 = result.layers._data[1];
320
+ layer1.base = 'MISSING'; // Missing base
321
321
 
322
322
  // Recalculate hashes
323
323
  return hip(result, true, false);
324
324
  },
325
325
 
326
- missingIdSet: (): Rljson => {
326
+ missingSliceIdSet: (): Rljson => {
327
327
  const result = Example.ok.complete();
328
- const collection1 = result.collections._data[1];
328
+ const layer1 = result.layers._data[1];
329
329
 
330
- collection1.idSet = 'MISSING1';
330
+ layer1.idSet = 'MISSING1';
331
331
 
332
332
  // Recalculate hashes
333
333
  return hip(result, true, false);
334
334
  },
335
335
 
336
- missingAssignedPropertyTable: (): Rljson => {
336
+ missingAssignedIngredientTable: (): Rljson => {
337
337
  const result = Example.ok.complete();
338
- delete result.properties; // Remove properties table
338
+ delete result.ingredients; // Remove ingredients table
339
339
  return result;
340
340
  },
341
341
 
342
- missingAssignedProperty: (): Rljson => {
342
+ missingAssignedIngredient: (): Rljson => {
343
343
  const result = Example.ok.complete();
344
- result.properties._data.splice(1, 2); // Remove an property that is assigned
344
+ result.ingredients._data.splice(1, 2); // Remove an ingredient that is assigned
345
345
  return hip(result, true, false);
346
346
  },
347
347
  },
348
348
 
349
349
  cakes: {
350
- missingIdSet: (): Rljson => {
350
+ missingSliceIdSet: (): Rljson => {
351
351
  const result = Example.ok.complete();
352
352
  result.cakes._data[0].idSet = 'MISSING'; // Missing ID set
353
353
  hip(result.cakes, true, false);
354
354
  return result;
355
355
  },
356
356
 
357
- missingCollectionsTable: (): Rljson => {
357
+ missingLayersTable: (): Rljson => {
358
358
  const result = Example.ok.complete();
359
- result.cakes._data[0].collectionsTable = 'MISSING'; // Missing collections table
359
+ result.cakes._data[0].layersTable = 'MISSING'; // Missing layers table
360
360
  hip(result.cakes, true, false);
361
361
  return result;
362
362
  },
363
363
 
364
- missingLayerCollection: (): Rljson => {
364
+ missingCakeLayer: (): Rljson => {
365
365
  const result = Example.ok.complete();
366
366
  result.cakes._data[0].layers['layer0'] = 'MISSING0';
367
367
  result.cakes._data[0].layers['layer1'] = 'MISSING1';
@@ -4,10 +4,10 @@ import { JsonKey } from '@rljson/json';
4
4
  */
5
5
  export type Ref = string;
6
6
  /**
7
- * An `id` is a *user defined* name or identifier of an item.
7
+ * An `id` is a *user defined* name or identifier of an slice.
8
8
  * It exists in parallel with the auto generated `_hash`.
9
9
  */
10
- export type ItemId = string;
10
+ export type SliceId = string;
11
11
  /**
12
12
  * A table id reference to a table. The table ids are used as keys in the top
13
13
  * level structure of an Rljson data object.
@@ -22,18 +22,18 @@ export type ColumnKey = JsonKey;
22
22
  *
23
23
  * - `buffets` Tables containing buffets
24
24
  * - `cakes` Tables containing cakes
25
- * - `collections` Tables containing collections
26
- * - `ids` Tables containing item ids
27
- * - `properties` Tables containing item properties
25
+ * - `layers` Tables containing layers
26
+ * - `ids` Tables containing slice ids
27
+ * - `ingredients` Tables containing slice ingredients
28
28
  */
29
- export declare const contentTypes: readonly ["buffets", "cakes", "collections", "idSets", "properties"];
29
+ export declare const contentTypes: readonly ["buffets", "cakes", "layers", "sliceIds", "ingredients"];
30
30
  export type ContentType = (typeof contentTypes)[number];
31
31
  /**
32
32
  * An example object using the typedefs
33
33
  */
34
34
  export declare const exampleTypedefs: () => {
35
35
  ref: Ref;
36
- itemId: ItemId;
36
+ sliceId: SliceId;
37
37
  tableKey: TableKey;
38
38
  contentType: ContentType;
39
39
  };
@@ -17,15 +17,15 @@ export interface BaseErrors extends Errors {
17
17
  dataDoesNotMatchColumnConfig?: Json;
18
18
  tableTypesDoNotMatch?: Json;
19
19
  refsNotFound?: Json;
20
- collectionBasesNotFound?: Json;
21
- collectionIdSetsTableNotFound?: Json;
22
- collectionIdSetNotFound?: Json;
23
- collectionPropertyTablesNotFound?: Json;
24
- collectionPropertyAssignmentsNotFound?: Json;
25
- cakeIdSetsTableNotFound?: Json;
26
- cakeIdSetNotFound?: Json;
27
- cakeCollectionTablesNotFound?: Json;
28
- cakeLayerCollectionsNotFound?: Json;
20
+ layerBasesNotFound?: Json;
21
+ layerSliceIdsTableNotFound?: Json;
22
+ layerSliceIdsNotFound?: Json;
23
+ layerIngredientTablesNotFound?: Json;
24
+ layerIngredientAssignmentsNotFound?: Json;
25
+ cakeSliceIdsTableNotFound?: Json;
26
+ cakeSliceIdsNotFound?: Json;
27
+ cakeLayerTablesNotFound?: Json;
28
+ cakeLayersNotFound?: Json;
29
29
  buffetReferencedTablesNotFound?: Json;
30
30
  buffetReferencedItemsNotFound?: Json;
31
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/rljson",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "packageManager": "pnpm@10.6.3",
5
5
  "description": "The RLJSON data format specification",
6
6
  "homepage": "https://github.com/rljson/rljson",
@@ -29,20 +29,20 @@
29
29
  "updateGoldens": "cross-env UPDATE_GOLDENS=true npm test"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "^22.13.11",
33
- "@typescript-eslint/eslint-plugin": "^8.27.0",
34
- "@typescript-eslint/parser": "^8.27.0",
32
+ "@types/node": "^22.13.13",
33
+ "@typescript-eslint/eslint-plugin": "^8.28.0",
34
+ "@typescript-eslint/parser": "^8.28.0",
35
35
  "@vitest/coverage-v8": "^3.0.9",
36
36
  "cross-env": "^7.0.3",
37
37
  "eslint": "^9.23.0",
38
- "eslint-plugin-jsdoc": "^50.6.8",
38
+ "eslint-plugin-jsdoc": "^50.6.9",
39
39
  "eslint-plugin-tsdoc": "^0.4.0",
40
40
  "globals": "^16.0.0",
41
41
  "jsdoc": "^4.0.4",
42
42
  "read-pkg": "^9.0.1",
43
43
  "typescript": "~5.8.2",
44
- "typescript-eslint": "^8.27.0",
45
- "vite": "^6.2.2",
44
+ "typescript-eslint": "^8.28.0",
45
+ "vite": "^6.2.3",
46
46
  "vite-node": "^3.0.9",
47
47
  "vite-plugin-dts": "^4.5.3",
48
48
  "vite-tsconfig-paths": "^5.1.4",
@@ -1,44 +0,0 @@
1
- import { Json } from '@rljson/json';
2
- import { RljsonTable } from '../rljson.ts';
3
- import { ItemId, Ref, TableKey } from '../typedefs.ts';
4
- import { IdSetRef } from './id-set.ts';
5
- import { PropertiesRef } from './properties.ts';
6
- /**
7
- * A CollectionRef is a hash pointing to a collection
8
- */
9
- export type CollectionRef = Ref;
10
- /**
11
- * A collection assigns properties to item ids
12
- */
13
- export interface Collection extends Json {
14
- /**
15
- * `base` an optional base collection that is extended by this collection
16
- */
17
- base?: CollectionRef;
18
- /**
19
- * The item ids of the collection. If present, the item ids in `assign`
20
- * must match these ids. The item id sets can be found in the idSets table.
21
- */
22
- idSet?: IdSetRef;
23
- /**
24
- * The table containing the item ids of the collection
25
- */
26
- idSetsTable?: TableKey;
27
- /**
28
- * The table containing the properties that are assigned to the items
29
- * with the assign property below
30
- */
31
- propertiesTable: TableKey;
32
- /**
33
- * Assign properties to each item of the collection.
34
- */
35
- assign: Record<ItemId, PropertiesRef>;
36
- }
37
- /**
38
- * A table containing collections
39
- */
40
- export type CollectionsTable = RljsonTable<Collection, 'collections'>;
41
- /**
42
- * Provides an example collectionsTable for test purposes
43
- */
44
- export declare const exampleCollectionsTable: () => CollectionsTable;
@@ -1,33 +0,0 @@
1
- import { Json } from '@rljson/json';
2
- import { RljsonTable } from '../rljson.ts';
3
- import { ItemId, Ref } from '../typedefs.ts';
4
- /**
5
- * An IdSetRef is a hash pointing to an Ids
6
- */
7
- export type IdSetRef = Ref;
8
- /**
9
- * An Ids manages list of item ids
10
- */
11
- export interface IdSet extends Json {
12
- /**
13
- * The hash of another item id list which is extended by this one.
14
- * Must be empty or null, when the list is the root.
15
- */
16
- base?: IdSetRef;
17
- /**
18
- * The item ids added to base
19
- */
20
- add: ItemId[];
21
- /**
22
- * The item ids removed from base
23
- */
24
- remove?: ItemId[];
25
- }
26
- /**
27
- * A table containing item ids
28
- */
29
- export type IdSetsTable = RljsonTable<IdSet, 'idSets'>;
30
- /**
31
- * Returns one of the layers of the example cake
32
- */
33
- export declare const exampleIdSetsTable: () => IdSetsTable;
@@ -1,16 +0,0 @@
1
- import { Json } from '@rljson/json';
2
- import { NutritionalValues } from '../example/bakery-example.ts';
3
- import { RljsonTable } from '../rljson.ts';
4
- import { Ref } from '../typedefs.ts';
5
- /**
6
- * A reference to a properties row in a properties table
7
- */
8
- export type PropertiesRef = Ref;
9
- /**
10
- * A table containing item properties
11
- */
12
- export type PropertiesTable<T extends Json> = RljsonTable<T, 'properties'>;
13
- /**
14
- * Provides an example collectionsTable for test purposes
15
- */
16
- export declare const examplePropertiesTable: () => PropertiesTable<NutritionalValues>;