@rljson/rljson 0.0.72 → 0.0.73

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.
@@ -0,0 +1,10 @@
1
+ import { Json } from '@rljson/json';
2
+ import { RljsonTable } from '../rljson.ts';
3
+ import { TableCfg } from './table-cfg.ts';
4
+ export interface Head extends Json {
5
+ timeId: string;
6
+ cakeRef: string;
7
+ _hash: string;
8
+ }
9
+ export type HeadsTable = RljsonTable<Head, 'head'>;
10
+ export declare const createHeadsTableCfg: (cakeKey: string) => TableCfg;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './content/buffet.ts';
2
2
  export * from './content/cake.ts';
3
3
  export * from './content/components.ts';
4
+ export * from './content/head.ts';
4
5
  export * from './content/layer.ts';
5
6
  export * from './content/revision.ts';
6
7
  export * from './content/slice-ids.ts';
package/dist/rljson.d.ts CHANGED
@@ -2,6 +2,7 @@ import { Json } from '@rljson/json';
2
2
  import { BuffetsTable } from './content/buffet.ts';
3
3
  import { CakesTable } from './content/cake.ts';
4
4
  import { ComponentsTable } from './content/components.ts';
5
+ import { HeadsTable } from './content/head.ts';
5
6
  import { LayersTable } from './content/layer.ts';
6
7
  import { RevisionsTable } from './content/revision.ts';
7
8
  import { SliceIdsTable } from './content/slice-ids.ts';
@@ -16,7 +17,7 @@ export declare const reservedTableKeys: string[];
16
17
  /**
17
18
  * One of the supported Rljson table types
18
19
  */
19
- export type TableType = BuffetsTable | ComponentsTable<any> | LayersTable | SliceIdsTable | CakesTable | RevisionsTable | TablesCfgTable | InsertHistoryTable<any> | EditsTable | MultiEditsTable | EditHistoryTable;
20
+ export type TableType = BuffetsTable | ComponentsTable<any> | LayersTable | SliceIdsTable | CakesTable | RevisionsTable | TablesCfgTable | InsertHistoryTable<any> | EditsTable | MultiEditsTable | EditHistoryTable | HeadsTable;
20
21
  /** The rljson data format */
21
22
  export interface Rljson extends Json {
22
23
  [tableId: TableKey]: TableType;
package/dist/rljson.js CHANGED
@@ -527,6 +527,36 @@ const createCakeTableCfg = (cakeKey) => ({
527
527
  });
528
528
  const exampleCakesTable = () => bakeryExample().cakes;
529
529
  const exampleComponentsTable = () => bakeryExample().nutritionalValues;
530
+ const createHeadsTableCfg = (cakeKey) => ({
531
+ key: `${cakeKey}Heads`,
532
+ type: "head",
533
+ columns: [
534
+ {
535
+ key: "_hash",
536
+ type: "string",
537
+ titleLong: "Hash",
538
+ titleShort: "Hash"
539
+ },
540
+ {
541
+ key: "timeId",
542
+ type: "string",
543
+ titleLong: "Time Identifier",
544
+ titleShort: "Time ID"
545
+ },
546
+ {
547
+ key: "cakeRef",
548
+ type: "string",
549
+ titleLong: "Cake Reference",
550
+ titleShort: "Cake Ref",
551
+ ref: {
552
+ tableKey: `${cakeKey}`
553
+ }
554
+ }
555
+ ],
556
+ isHead: false,
557
+ isRoot: false,
558
+ isShared: true
559
+ });
530
560
  const createLayerTableCfg = (layerKey) => ({
531
561
  key: layerKey,
532
562
  type: "layers",
@@ -1509,7 +1539,7 @@ const createEditHistoryTableCfg = (cakeKey) => ({
1509
1539
  titleLong: "Multi Edit Reference",
1510
1540
  titleShort: "Multi Edit Ref",
1511
1541
  ref: {
1512
- tableKey: `${cakeKey}MultiEdit`
1542
+ tableKey: `${cakeKey}MultiEdits`
1513
1543
  }
1514
1544
  },
1515
1545
  {
@@ -1527,7 +1557,10 @@ const createEditHistoryTableCfg = (cakeKey) => ({
1527
1557
  titleLong: "Previous Values",
1528
1558
  titleShort: "Previous"
1529
1559
  }
1530
- ]
1560
+ ],
1561
+ isHead: false,
1562
+ isRoot: false,
1563
+ isShared: true
1531
1564
  });
1532
1565
  const createEditTableCfg = (cakeKey) => ({
1533
1566
  key: `${cakeKey}Edits`,
@@ -1551,7 +1584,10 @@ const createEditTableCfg = (cakeKey) => ({
1551
1584
  titleLong: "Edit Action Data",
1552
1585
  titleShort: "Action"
1553
1586
  }
1554
- ]
1587
+ ],
1588
+ isHead: false,
1589
+ isRoot: false,
1590
+ isShared: true
1555
1591
  });
1556
1592
  const createMultiEditTableCfg = (cakeKey) => ({
1557
1593
  key: `${cakeKey}MultiEdits`,
@@ -1578,7 +1614,10 @@ const createMultiEditTableCfg = (cakeKey) => ({
1578
1614
  tableKey: `${cakeKey}Edits`
1579
1615
  }
1580
1616
  }
1581
- ]
1617
+ ],
1618
+ isHead: false,
1619
+ isRoot: false,
1620
+ isShared: true
1582
1621
  });
1583
1622
  const objectDepth = (o) => Object(o) === o ? 1 + Math.max(-1, ...Object.values(o).map(objectDepth)) : 0;
1584
1623
  class InsertValidator {
@@ -1809,7 +1848,8 @@ const contentTypes = [
1809
1848
  "insertHistory",
1810
1849
  "edits",
1811
1850
  "multiEdits",
1812
- "editHistory"
1851
+ "editHistory",
1852
+ "head"
1813
1853
  ];
1814
1854
  const exampleTypedefs = () => {
1815
1855
  return {
@@ -2663,6 +2703,7 @@ export {
2663
2703
  createCakeTableCfg,
2664
2704
  createEditHistoryTableCfg,
2665
2705
  createEditTableCfg,
2706
+ createHeadsTableCfg,
2666
2707
  createInsertHistoryTableCfg,
2667
2708
  createLayerTableCfg,
2668
2709
  createMultiEditTableCfg,
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * Generates a new TimeId.
3
- * A TimeId is a string in the format "xxxx:timestamp" where:
4
- * - "xxxx" is a 4-character unique identifier
3
+ * A TimeId has the format "timestamp:xxxx" where:
5
4
  * - "timestamp" is the current time in milliseconds since epoch
5
+ * - "xxxx" is a 4-character unique identifier
6
6
  * @returns A new TimeId string
7
7
  */
8
8
  export declare const timeId: () => string;
9
9
  /**
10
10
  * Checks if a given id is a valid TimeId.
11
- * A valid TimeId has the format "xxxx:timestamp" where:
12
- * - "xxxx" is a 4-character string
13
- * - "timestamp" is a valid number representing milliseconds since epoch
11
+ * A TimeId has the format "timestamp:xxxx" where:
12
+ * - "timestamp" is the current time in milliseconds since epoch
13
+ * - "xxxx" is a 4-character unique identifier
14
14
  * @param id - The id to check
15
15
  * @returns True if the id is a valid TimeId, false otherwise
16
16
  */
@@ -26,7 +26,7 @@ export type ColumnKey = JsonKey;
26
26
  * - `ids` Tables containing slice ids
27
27
  * - `components` Tables containing slice components
28
28
  */
29
- export declare const contentTypes: readonly ["buffets", "cakes", "layers", "sliceIds", "components", "revisions", "tableCfgs", "insertHistory", "edits", "multiEdits", "editHistory"];
29
+ export declare const contentTypes: readonly ["buffets", "cakes", "layers", "sliceIds", "components", "revisions", "tableCfgs", "insertHistory", "edits", "multiEdits", "editHistory", "head"];
30
30
  export type ContentType = (typeof contentTypes)[number];
31
31
  /**
32
32
  * An example object using the typedefs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/rljson",
3
- "version": "0.0.72",
3
+ "version": "0.0.73",
4
4
  "description": "The RLJSON data format specification",
5
5
  "homepage": "https://github.com/rljson/rljson",
6
6
  "bugs": "https://github.com/rljson/rljson/issues",
@@ -21,23 +21,23 @@
21
21
  "type": "module",
22
22
  "devDependencies": {
23
23
  "@types/node": "^24.10.1",
24
- "@typescript-eslint/eslint-plugin": "^8.46.4",
25
- "@typescript-eslint/parser": "^8.46.4",
26
- "@vitest/coverage-v8": "^4.0.9",
24
+ "@typescript-eslint/eslint-plugin": "^8.48.1",
25
+ "@typescript-eslint/parser": "^8.48.1",
26
+ "@vitest/coverage-v8": "^4.0.15",
27
27
  "cross-env": "^10.1.0",
28
28
  "eslint": "^9.39.1",
29
- "eslint-plugin-jsdoc": "^61.2.1",
29
+ "eslint-plugin-jsdoc": "^61.4.1",
30
30
  "eslint-plugin-tsdoc": "^0.5.0",
31
31
  "globals": "^16.5.0",
32
32
  "jsdoc": "^4.0.5",
33
33
  "read-pkg": "^10.0.0",
34
34
  "typescript": "~5.9.3",
35
- "typescript-eslint": "^8.46.4",
36
- "vite": "^7.2.2",
37
- "vite-node": "^5.1.0",
35
+ "typescript-eslint": "^8.48.1",
36
+ "vite": "^7.2.6",
37
+ "vite-node": "^5.2.0",
38
38
  "vite-plugin-dts": "^4.5.4",
39
39
  "vite-tsconfig-paths": "^5.1.4",
40
- "vitest": "^4.0.9",
40
+ "vitest": "^4.0.15",
41
41
  "vitest-dom": "^0.1.1"
42
42
  },
43
43
  "dependencies": {