@rljson/rljson 0.0.81 → 0.0.83

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.
@@ -140,6 +140,9 @@ German (`de`):
140
140
  }
141
141
  ```
142
142
 
143
+ In TypeScript, the interface `Row` describes a row. Once hashed, a row carries
144
+ its hash in the field `_hash`.
145
+
143
146
  ### Column Data Types
144
147
 
145
148
  Columns can contain any of the Rljson-supported data types: `string | number |
@@ -190,6 +193,19 @@ table `b` references table `a` using `aRef`:
190
193
 
191
194
  This reference structure enables automated denormalization of JSON data.
192
195
 
196
+ In TypeScript, `ref(row)` returns the hash that `hip` has written into a row,
197
+ ready to be stored in a reference column. `rowOf(table, hash)` follows the
198
+ reference back to the row:
199
+
200
+ ```typescript
201
+ import { hip } from '@rljson/hash';
202
+ import { ref, rowOf } from '@rljson/rljson';
203
+
204
+ const tableA = hip({ _type: 'components', _data: [{ a: 10 }] });
205
+ const rowB = { tableARef: ref(tableA._data[0]) };
206
+ rowOf(tableA, rowB.tableARef); // returns the row { a: 10, _hash: '...' }
207
+ ```
208
+
193
209
  ## Data Types
194
210
 
195
211
  Rljson provides several core data structures and table types to manage and
package/README.public.md CHANGED
@@ -37,6 +37,7 @@ Core types, validation, and sync protocol for the RLJSON data format.
37
37
  - [SyncEventNames](#synceventnames)
38
38
  - [ClientId](#clientid)
39
39
  - [Utilities](#utilities)
40
+ - [Row, ref and rowOf](#row-ref-and-rowof)
40
41
  - [TimeId](#timeid)
41
42
  - [RemoveDuplicates](#removeduplicates)
42
43
  - [Ecosystem](#ecosystem)
@@ -388,6 +389,28 @@ const onConflict: ConflictCallback = (conflict: Conflict) => {
388
389
 
389
390
  ## Utilities
390
391
 
392
+ ### Row, ref and rowOf
393
+
394
+ A `Row` is a row of an Rljson table: a JSON object whose `_hash` is written by
395
+ `hip`. `ref(row)` returns that hash, the reference other rows store to point to
396
+ the row. `rowOf(table, hash)` follows a reference back to its row. Both throw
397
+ when there is nothing to return: `ref` for a row that has not been hashed,
398
+ `rowOf` for a hash the table does not contain.
399
+
400
+ ```typescript
401
+ import { hip } from '@rljson/hash';
402
+ import { ComponentsTable, ref, rowOf } from '@rljson/rljson';
403
+
404
+ const ingredients = hip<ComponentsTable<{ id: string }>>({
405
+ _type: 'components',
406
+ _data: [{ id: 'flour' }, { id: 'sugar' }],
407
+ });
408
+
409
+ const [flour] = ingredients._data;
410
+ const recipe = { ingredientsRef: ref(flour) }; // refers to the flour row
411
+ rowOf(ingredients, recipe.ingredientsRef); // returns the flour row
412
+ ```
413
+
391
414
  ### TimeId
392
415
 
393
416
  A unique, time-based identifier in the format `"timestamp:xxxx"`.
@@ -140,6 +140,9 @@ German (`de`):
140
140
  }
141
141
  ```
142
142
 
143
+ In TypeScript, the interface `Row` describes a row. Once hashed, a row carries
144
+ its hash in the field `_hash`.
145
+
143
146
  ### Column Data Types
144
147
 
145
148
  Columns can contain any of the Rljson-supported data types: `string | number |
@@ -190,6 +193,19 @@ table `b` references table `a` using `aRef`:
190
193
 
191
194
  This reference structure enables automated denormalization of JSON data.
192
195
 
196
+ In TypeScript, `ref(row)` returns the hash that `hip` has written into a row,
197
+ ready to be stored in a reference column. `rowOf(table, hash)` follows the
198
+ reference back to the row:
199
+
200
+ ```typescript
201
+ import { hip } from '@rljson/hash';
202
+ import { ref, rowOf } from '@rljson/rljson';
203
+
204
+ const tableA = hip({ _type: 'components', _data: [{ a: 10 }] });
205
+ const rowB = { tableARef: ref(tableA._data[0]) };
206
+ rowOf(tableA, rowB.tableARef); // returns the row { a: 10, _hash: '...' }
207
+ ```
208
+
193
209
  ## Data Types
194
210
 
195
211
  Rljson provides several core data structures and table types to manage and
@@ -37,6 +37,7 @@ Core types, validation, and sync protocol for the RLJSON data format.
37
37
  - [SyncEventNames](#synceventnames)
38
38
  - [ClientId](#clientid)
39
39
  - [Utilities](#utilities)
40
+ - [Row, ref and rowOf](#row-ref-and-rowof)
40
41
  - [TimeId](#timeid)
41
42
  - [RemoveDuplicates](#removeduplicates)
42
43
  - [Ecosystem](#ecosystem)
@@ -388,6 +389,28 @@ const onConflict: ConflictCallback = (conflict: Conflict) => {
388
389
 
389
390
  ## Utilities
390
391
 
392
+ ### Row, ref and rowOf
393
+
394
+ A `Row` is a row of an Rljson table: a JSON object whose `_hash` is written by
395
+ `hip`. `ref(row)` returns that hash, the reference other rows store to point to
396
+ the row. `rowOf(table, hash)` follows a reference back to its row. Both throw
397
+ when there is nothing to return: `ref` for a row that has not been hashed,
398
+ `rowOf` for a hash the table does not contain.
399
+
400
+ ```typescript
401
+ import { hip } from '@rljson/hash';
402
+ import { ComponentsTable, ref, rowOf } from '@rljson/rljson';
403
+
404
+ const ingredients = hip<ComponentsTable<{ id: string }>>({
405
+ _type: 'components',
406
+ _data: [{ id: 'flour' }, { id: 'sugar' }],
407
+ });
408
+
409
+ const [flour] = ingredients._data;
410
+ const recipe = { ingredientsRef: ref(flour) }; // refers to the flour row
411
+ rowOf(ingredients, recipe.ingredientsRef); // returns the flour row
412
+ ```
413
+
391
414
  ### TimeId
392
415
 
393
416
  A unique, time-based identifier in the format `"timestamp:xxxx"`.
@@ -3,36 +3,51 @@ import { RljsonTable } from '../rljson.ts';
3
3
  import { Ref, SliceId } from '../typedefs.ts';
4
4
  import { TableCfg } from './table-cfg.ts';
5
5
  /**
6
- * An SliceIdsRef is a hash pointing to an Ids
6
+ * A reference to a row of type `SliceIds`: the hash of that row
7
7
  */
8
8
  export type SliceIdsRef = Ref;
9
9
  /**
10
- * A list of slice ids
10
+ * A set of slice ids, e.g. the cars of a catalog.
11
+ *
12
+ * A row can extend a base row. Its slice ids are then the slice ids of the
13
+ * base, plus `add`, minus `remove`. So a derived row stores only the
14
+ * difference.
15
+ * @example
16
+ * ```ts
17
+ * const cars2025 = hip<SliceIds>({ add: ['taycan', 'macan', 'ex30'] });
18
+ *
19
+ * // The cars of 2026: taycan, ex30, ex90
20
+ * const cars2026 = hip<SliceIds>({
21
+ * base: ref(cars2025),
22
+ * add: ['ex90'],
23
+ * remove: ['macan'],
24
+ * });
25
+ * ```
11
26
  */
12
27
  export interface SliceIds extends Json {
13
28
  /**
14
- * The base list of slice ids
29
+ * Optional: the reference to the row of slice ids that this row extends
15
30
  */
16
31
  base?: SliceIdsRef;
17
32
  /**
18
- * The slice ids added to base
33
+ * The slice ids added to the base
19
34
  */
20
35
  add: SliceId[];
21
36
  /**
22
- * The slice ids removed from base
37
+ * Optional: the slice ids removed from the base
23
38
  */
24
39
  remove?: SliceId[];
25
40
  }
26
41
  /**
27
- * A table containing slice ids
42
+ * A table of type `sliceIds` whose rows are sets of slice ids
28
43
  */
29
44
  export type SliceIdsTable = RljsonTable<SliceIds, 'sliceIds'>;
30
45
  /**
31
- * Returns one of the layers of the example cake
46
+ * Returns the slice ids table of the bakery example
32
47
  */
33
48
  export declare const exampleSliceIdsTable: () => SliceIdsTable;
34
49
  /**
35
- * Creates a table configuration for slice ids table
50
+ * Creates the table configuration of a slice ids table
36
51
  * @param tableKey - the table key
37
52
  * @returns the table configuration
38
53
  */
package/dist/index.d.ts CHANGED
@@ -23,6 +23,8 @@ export * from './sync/connector-payload.ts';
23
23
  export * from './sync/gap-fill.ts';
24
24
  export * from './sync/sync-config.ts';
25
25
  export * from './sync/sync-events.ts';
26
+ export * from './tools/ref.ts';
27
+ export * from './tools/resolve-slice-ids.ts';
26
28
  export * from './tools/remove-duplicates.ts';
27
29
  export * from './tools/time-id.ts';
28
30
  export * from './typedefs.ts';
package/dist/rljson.js CHANGED
@@ -405,6 +405,12 @@ var bakeryExample = () => {
405
405
  meta: { description: "A tasty cake recipe" },
406
406
  children: null
407
407
  });
408
+ const recipesTreeRoot = hip({
409
+ id: "root",
410
+ isParent: true,
411
+ meta: { description: "Root of the recipes tree" },
412
+ children: [recipesTreeChildren._hash]
413
+ });
408
414
  return {
409
415
  buffets,
410
416
  cakes,
@@ -418,12 +424,7 @@ var bakeryExample = () => {
418
424
  ingredientsInsertHistory,
419
425
  recipesTreeTable: hip({
420
426
  _type: "trees",
421
- _data: [hip({
422
- id: "root",
423
- isParent: true,
424
- meta: { description: "Root of the recipes tree" },
425
- children: [recipesTreeChildren._hash]
426
- }), recipesTreeChildren],
427
+ _data: [recipesTreeRoot, recipesTreeChildren],
427
428
  _hash: ""
428
429
  })
429
430
  };
@@ -571,11 +572,11 @@ var exampleRevision = () => ({
571
572
  //#region src/content/slice-ids.ts
572
573
  // @license
573
574
  /**
574
- * Returns one of the layers of the example cake
575
+ * Returns the slice ids table of the bakery example
575
576
  */
576
577
  var exampleSliceIdsTable = () => bakeryExample().slices;
577
578
  /**
578
- * Creates a table configuration for slice ids table
579
+ * Creates the table configuration of a slice ids table
579
580
  * @param tableKey - the table key
580
581
  * @returns the table configuration
581
582
  */
@@ -678,39 +679,43 @@ var treeFromObject = (obj, skipRootCreation = false) => {
678
679
  if (processedIds.has(nodeId)) return;
679
680
  processedIds.add(nodeId);
680
681
  const childIds = [];
681
- if (Array.isArray(value)) if (value.length === 0 || value.every((item) => item !== null && typeof item === "object" && !Array.isArray(item) && Object.keys(item).length === 1)) {
682
- for (const item of value) {
683
- const childId = Object.keys(item)[0];
684
- childIds.push(childId);
685
- processNode(item[childId], childId);
682
+ if (Array.isArray(value)) {
683
+ if (value.length === 0 || value.every((item) => item !== null && typeof item === "object" && !Array.isArray(item) && Object.keys(item).length === 1)) {
684
+ for (const item of value) {
685
+ const childId = Object.keys(item)[0];
686
+ childIds.push(childId);
687
+ processNode(item[childId], childId);
688
+ }
689
+ /* v8 ignore next -- @preserve */
690
+ const treeNode = {
691
+ id: nodeId,
692
+ isParent: true,
693
+ meta: null,
694
+ children: childIds.length > 0 ? childIds.map((id) => idToHashMap.get(id)) : null
695
+ };
696
+ const hashedNode = hip(treeNode);
697
+ idToHashMap.set(nodeId, hashedNode._hash);
698
+ result.push(hashedNode);
699
+ } else {
700
+ const hashedNode = hip({
701
+ id: nodeId,
702
+ isParent: false,
703
+ meta: { value },
704
+ children: null
705
+ });
706
+ idToHashMap.set(nodeId, hashedNode._hash);
707
+ result.push(hashedNode);
686
708
  }
687
- const hashedNode = hip({
688
- id: nodeId,
689
- isParent: true,
690
- meta: null,
691
- children: childIds.length > 0 ? childIds.map((id) => idToHashMap.get(id)) : null
692
- });
693
- idToHashMap.set(nodeId, hashedNode._hash);
694
- result.push(hashedNode);
695
- } else {
696
- const hashedNode = hip({
697
- id: nodeId,
698
- isParent: false,
699
- meta: { value },
700
- children: null
701
- });
702
- idToHashMap.set(nodeId, hashedNode._hash);
703
- result.push(hashedNode);
704
- }
705
- else if (value !== null && typeof value === "object") {
709
+ } else if (value !== null && typeof value === "object") {
706
710
  const keys = Object.keys(value);
707
711
  if (keys.includes("meta") || keys.includes("isParent") || keys.includes("children")) {
708
- const hashedNode = hip({
712
+ const treeNode = {
709
713
  id: nodeId,
710
714
  isParent: false,
711
715
  meta: value.meta,
712
716
  children: null
713
- });
717
+ };
718
+ const hashedNode = hip(treeNode);
714
719
  idToHashMap.set(nodeId, hashedNode._hash);
715
720
  result.push(hashedNode);
716
721
  } else {
@@ -720,12 +725,14 @@ var treeFromObject = (obj, skipRootCreation = false) => {
720
725
  childIds.push(key);
721
726
  processNode(value[key], key);
722
727
  }
723
- const hashedNode = hip({
728
+ /* v8 ignore next -- @preserve */
729
+ const treeNode = {
724
730
  id: nodeId,
725
731
  isParent: true,
726
732
  meta: null,
727
733
  children: childIds.length > 0 ? childIds.map((id) => idToHashMap.get(id)) : null
728
- });
734
+ };
735
+ const hashedNode = hip(treeNode);
729
736
  idToHashMap.set(nodeId, hashedNode._hash);
730
737
  result.push(hashedNode);
731
738
  }
@@ -751,12 +758,13 @@ var treeFromObject = (obj, skipRootCreation = false) => {
751
758
  }
752
759
  }
753
760
  if (!skipRootCreation && topLevelIds.length > 0) {
754
- const hashedRootNode = hip({
761
+ const rootNode = {
755
762
  id: "root",
756
763
  isParent: true,
757
764
  meta: null,
758
765
  children: topLevelIds.map((id) => idToHashMap.get(id))
759
- });
766
+ };
767
+ const hashedRootNode = hip(rootNode);
760
768
  idToHashMap.set("root", hashedRootNode._hash);
761
769
  result.push(hashedRootNode);
762
770
  }
@@ -1102,13 +1110,14 @@ var Example = class Example {
1102
1110
  _type: "layers",
1103
1111
  _data: [abLayer0, abLayer1]
1104
1112
  });
1113
+ const cake = hip({
1114
+ sliceIdsTable: "sliceIds",
1115
+ sliceIdsRow: sliceIds._data[0]._hash,
1116
+ layers: { abLayers: abLayer1._hash }
1117
+ });
1105
1118
  const cakes = hip({
1106
1119
  _type: "cakes",
1107
- _data: [hip({
1108
- sliceIdsTable: "sliceIds",
1109
- sliceIdsRow: sliceIds._data[0]._hash,
1110
- layers: { abLayers: abLayer1._hash }
1111
- })]
1120
+ _data: [cake]
1112
1121
  });
1113
1122
  return {
1114
1123
  sliceIds,
@@ -2013,6 +2022,74 @@ var syncEvents = (route) => ({
2013
2022
  bootstrap: `${route}:bootstrap`
2014
2023
  });
2015
2024
  //#endregion
2025
+ //#region src/tools/ref.ts
2026
+ // @license
2027
+ /**
2028
+ * Returns the reference to a row: the hash that `hip` has written into it.
2029
+ *
2030
+ * Other rows refer to the row by this reference.
2031
+ * @param row - A row hashed with `hip` from `@rljson/hash`
2032
+ * @returns The hash of the row
2033
+ * @throws Error if the row has no hash
2034
+ */
2035
+ var ref = (row) => {
2036
+ const hash = row._hash;
2037
+ if (!hash) throw new Error("ref: The row has no _hash. Hash it with hip first.");
2038
+ return hash;
2039
+ };
2040
+ /**
2041
+ * Follows a reference: returns the row of a table that has the given hash.
2042
+ *
2043
+ * Searches the rows one by one.
2044
+ * @param table - The table to search
2045
+ * @param hash - The reference to the row: its hash
2046
+ * @returns The row with the given hash
2047
+ * @throws Error if the table has no row with the given hash
2048
+ */
2049
+ var rowOf = (table, hash) => {
2050
+ const row = table._data.find((row) => row._hash === hash);
2051
+ if (!row) throw new Error(`rowOf: The table has no row with hash "${hash}".`);
2052
+ return row;
2053
+ };
2054
+ //#endregion
2055
+ //#region src/tools/resolve-slice-ids.ts
2056
+ // @license
2057
+ /**
2058
+ * Merges a row of slice ids with the resolved slice ids of its base.
2059
+ *
2060
+ * Starts with the slice ids of the base, adds the slice ids of the row and
2061
+ * drops the removed ones. Each slice id appears once, in the order it was
2062
+ * added first.
2063
+ * @param base - The resolved slice ids of `row.base`, or [] without a base
2064
+ * @param row - The row of slice ids
2065
+ * @returns The slice ids of the row
2066
+ */
2067
+ var mergeSliceIds = (base, row) => {
2068
+ const result = /* @__PURE__ */ new Set([...base, ...row.add]);
2069
+ for (const sliceId of row.remove ?? []) result.delete(sliceId);
2070
+ return Array.from(result);
2071
+ };
2072
+ /**
2073
+ * Resolves a row of slice ids: follows its `base` chain within the table
2074
+ * and merges each row with its base.
2075
+ * @param table - The table that holds the row and its bases
2076
+ * @param row - The row of slice ids, e.g. a derived catalog
2077
+ * @returns The slice ids of the row
2078
+ * @throws Error if a base is not in the table, or if the bases form a cycle
2079
+ */
2080
+ var resolveSliceIds = (table, row) => {
2081
+ const chain = [row];
2082
+ const visited = /* @__PURE__ */ new Set();
2083
+ let current = row;
2084
+ while (current.base) {
2085
+ if (visited.has(current.base)) throw new Error(`resolveSliceIds: The bases of the row form a cycle at "${current.base}".`);
2086
+ visited.add(current.base);
2087
+ current = rowOf(table, current.base);
2088
+ chain.push(current);
2089
+ }
2090
+ return chain.reduceRight(mergeSliceIds, []);
2091
+ };
2092
+ //#endregion
2016
2093
  //#region src/tools/remove-duplicates.ts
2017
2094
  // @license
2018
2095
  var removeDuplicates = (rljson) => {
@@ -2803,4 +2880,4 @@ var Validate = class {
2803
2880
  //#region src/index.ts
2804
2881
  // @license
2805
2882
  //#endregion
2806
- export { BaseValidator, Example, InsertValidator, Route, Validate, ackPayloadExample, ackPayloadPartialExample, addColumnsToTableCfg, bakeryExample, clientId, clientIdExample, connectorPayloadExample, connectorPayloadFullExample, contentTypes, createCakeTableCfg, createEditHistoryTableCfg, createEditTableCfg, createInsertHistoryTableCfg, createLayerTableCfg, createMultiEditTableCfg, createSliceIdsTableCfg, createTreesTableCfg, exampleBuffetsTable, exampleCakesTable, exampleComponentsTable, exampleInsert, exampleInsertHistoryTable, exampleLayersTable, exampleRevision, exampleRljson, exampleSliceIdsTable, exampleTableCfg, exampleTableCfgTable, exampleTreesTable, exampleTypedefs, gapFillRequestExample, gapFillResponseExample, getTimeIdTimestamp, getTimeIdUniquePart, isClientId, isTimeId, isValidFieldName, iterateTables, iterateTablesSync, removeDuplicates, reservedFieldNames, reservedTableKeys, routeRefSeperator, routeSliceIdIndicators, routeSliceIdSeperator, syncConfigCausalOnlyExample, syncConfigDefault, syncConfigFullExample, syncEvents, throwOnInvalidTableCfg, timeId, treeFromObject, validateInsert, validateRljsonAgainstTableCfg };
2883
+ export { BaseValidator, Example, InsertValidator, Route, Validate, ackPayloadExample, ackPayloadPartialExample, addColumnsToTableCfg, bakeryExample, clientId, clientIdExample, connectorPayloadExample, connectorPayloadFullExample, contentTypes, createCakeTableCfg, createEditHistoryTableCfg, createEditTableCfg, createInsertHistoryTableCfg, createLayerTableCfg, createMultiEditTableCfg, createSliceIdsTableCfg, createTreesTableCfg, exampleBuffetsTable, exampleCakesTable, exampleComponentsTable, exampleInsert, exampleInsertHistoryTable, exampleLayersTable, exampleRevision, exampleRljson, exampleSliceIdsTable, exampleTableCfg, exampleTableCfgTable, exampleTreesTable, exampleTypedefs, gapFillRequestExample, gapFillResponseExample, getTimeIdTimestamp, getTimeIdUniquePart, isClientId, isTimeId, isValidFieldName, iterateTables, iterateTablesSync, mergeSliceIds, ref, removeDuplicates, reservedFieldNames, reservedTableKeys, resolveSliceIds, routeRefSeperator, routeSliceIdIndicators, routeSliceIdSeperator, rowOf, syncConfigCausalOnlyExample, syncConfigDefault, syncConfigFullExample, syncEvents, throwOnInvalidTableCfg, timeId, treeFromObject, validateInsert, validateRljsonAgainstTableCfg };
@@ -0,0 +1,2 @@
1
+ /** The version of the `@rljson/rljson` package. */
2
+ export declare const rljsonVersion = "0.0.83";
@@ -0,0 +1,21 @@
1
+ import { RljsonTable } from '../rljson.ts';
2
+ import { ContentType, Ref, Row } from '../typedefs.ts';
3
+ /**
4
+ * Returns the reference to a row: the hash that `hip` has written into it.
5
+ *
6
+ * Other rows refer to the row by this reference.
7
+ * @param row - A row hashed with `hip` from `@rljson/hash`
8
+ * @returns The hash of the row
9
+ * @throws Error if the row has no hash
10
+ */
11
+ export declare const ref: (row: Row) => Ref;
12
+ /**
13
+ * Follows a reference: returns the row of a table that has the given hash.
14
+ *
15
+ * Searches the rows one by one.
16
+ * @param table - The table to search
17
+ * @param hash - The reference to the row: its hash
18
+ * @returns The row with the given hash
19
+ * @throws Error if the table has no row with the given hash
20
+ */
21
+ export declare const rowOf: <T extends Row>(table: RljsonTable<T, ContentType>, hash: Ref) => T;
@@ -0,0 +1,22 @@
1
+ import { SliceIds, SliceIdsTable } from '../content/slice-ids.ts';
2
+ import { SliceId } from '../typedefs.ts';
3
+ /**
4
+ * Merges a row of slice ids with the resolved slice ids of its base.
5
+ *
6
+ * Starts with the slice ids of the base, adds the slice ids of the row and
7
+ * drops the removed ones. Each slice id appears once, in the order it was
8
+ * added first.
9
+ * @param base - The resolved slice ids of `row.base`, or [] without a base
10
+ * @param row - The row of slice ids
11
+ * @returns The slice ids of the row
12
+ */
13
+ export declare const mergeSliceIds: (base: SliceId[], row: SliceIds) => SliceId[];
14
+ /**
15
+ * Resolves a row of slice ids: follows its `base` chain within the table
16
+ * and merges each row with its base.
17
+ * @param table - The table that holds the row and its bases
18
+ * @param row - The row of slice ids, e.g. a derived catalog
19
+ * @returns The slice ids of the row
20
+ * @throws Error if a base is not in the table, or if the bases form a cycle
21
+ */
22
+ export declare const resolveSliceIds: (table: SliceIdsTable, row: SliceIds) => SliceId[];
@@ -4,7 +4,18 @@ import { Json, 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 slice.
7
+ * A row of an Rljson table: a JSON object that maps column names to values.
8
+ *
9
+ * `hip` from `@rljson/hash` writes the hash of the row into `_hash`. The hash
10
+ * is the primary key of the row: other rows refer to the row by it. `ref(row)`
11
+ * reads it.
12
+ */
13
+ export interface Row extends Json {
14
+ /** The hash of the row, written by `hip` */
15
+ _hash?: Ref;
16
+ }
17
+ /**
18
+ * An `id` is a *user defined* name or identifier of a slice.
8
19
  * It exists in parallel with the auto generated `_hash`.
9
20
  */
10
21
  export type SliceId = string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/rljson",
3
- "version": "0.0.81",
3
+ "version": "0.0.83",
4
4
  "packageManager": "pnpm@11.10.0+sha512.0b7f8b98060031904c017e3a41eb187a16d40eeb829b95c4f8cb03681761fc4ab53dd219115b9b447f4dce1a05a214764461e7d3703392a9f32f9511ce8c86c8",
5
5
  "description": "The RLJSON data format specification",
6
6
  "homepage": "https://github.com/rljson/rljson",
@@ -28,29 +28,29 @@
28
28
  "updateGoldens": "cross-env UPDATE_GOLDENS=true npm test"
29
29
  },
30
30
  "devDependencies": {
31
- "@types/node": "^26.1.0",
32
- "@typescript-eslint/eslint-plugin": "^8.62.1",
33
- "@typescript-eslint/parser": "^8.62.1",
34
- "@vitest/coverage-v8": "^4.1.9",
31
+ "@types/node": "^26.6.3",
32
+ "@typescript-eslint/eslint-plugin": "^8.70.1",
33
+ "@typescript-eslint/parser": "^8.70.1",
34
+ "@vitest/coverage-v8": "^5.0.2",
35
35
  "cross-env": "^10.1.0",
36
- "eslint": "^10.6.0",
37
- "eslint-plugin-jsdoc": "^63.0.11",
38
- "eslint-plugin-tsdoc": "^0.5.2",
39
- "globals": "^17.7.0",
36
+ "eslint": "^10.11.0",
37
+ "eslint-plugin-jsdoc": "^64.5.4",
38
+ "eslint-plugin-tsdoc": "^0.5.3",
39
+ "globals": "^17.12.0",
40
40
  "jsdoc": "^4.0.5",
41
41
  "read-pkg": "^10.1.0",
42
42
  "typescript": "~6.0.3",
43
- "typescript-eslint": "^8.62.1",
44
- "vite": "^8.1.3",
43
+ "typescript-eslint": "^8.70.1",
44
+ "vite": "^8.3.1",
45
45
  "vite-node": "^6.0.0",
46
- "vite-plugin-dts": "^5.0.3",
46
+ "vite-plugin-dts": "^5.1.1",
47
47
  "vite-tsconfig-paths": "^6.1.1",
48
- "vitest": "^4.1.9",
48
+ "vitest": "^5.0.2",
49
49
  "vitest-dom": "^0.1.1"
50
50
  },
51
51
  "dependencies": {
52
52
  "@rljson/hash": "0.0.19",
53
53
  "@rljson/json": "0.0.23",
54
- "nanoid": "^5.1.16"
54
+ "nanoid": "^6.0.1"
55
55
  }
56
56
  }