@rljson/rljson 0.0.69 → 0.0.71

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,12 @@
1
+ import { Json } from '@rljson/json';
2
+ import { TableCfg } from '../content/table-cfg.ts';
3
+ import { RljsonTable } from '../rljson.ts';
4
+ export interface EditHistory extends Json {
5
+ timeId: string;
6
+ multiEditRef: string;
7
+ dataRef: string;
8
+ previous: string[];
9
+ _hash: string;
10
+ }
11
+ export type EditHistoryTable = RljsonTable<EditHistory, 'editHistory'>;
12
+ export declare const createEditHistoryTableCfg: (cakeKey: string) => TableCfg;
@@ -0,0 +1,16 @@
1
+ import { Json } from '@rljson/json';
2
+ import { TableCfg } from '../content/table-cfg.ts';
3
+ import { RljsonTable } from '../rljson.ts';
4
+ export interface EditAction extends Json {
5
+ name: string;
6
+ type: string;
7
+ data: Json;
8
+ _hash: string;
9
+ }
10
+ export interface Edit extends Json {
11
+ name: string;
12
+ action: EditAction;
13
+ _hash: string;
14
+ }
15
+ export type EditsTable = RljsonTable<Edit, 'edits'>;
16
+ export declare const createEditTableCfg: (cakeKey: string) => TableCfg;
@@ -0,0 +1,10 @@
1
+ import { Json } from '@rljson/json';
2
+ import { TableCfg } from '../content/table-cfg.ts';
3
+ import { RljsonTable } from '../rljson.ts';
4
+ export interface MultiEdit extends Json {
5
+ previous: string | null;
6
+ edit: string;
7
+ _hash: string;
8
+ }
9
+ export type MultiEditsTable = RljsonTable<MultiEdit, 'multiEdits'>;
10
+ export declare const createMultiEditTableCfg: (cakeKey: string) => TableCfg;
@@ -4,7 +4,7 @@ import { CakesTable } from '../content/cake.ts';
4
4
  import { ComponentsTable } from '../content/components.ts';
5
5
  import { LayersTable } from '../content/layer.ts';
6
6
  import { SliceIdsTable } from '../content/slice-ids.ts';
7
- import { InsertHistory } from '../insertHistory/insertHistory.ts';
7
+ import { InsertHistoryTable } from '../insertHistory/insertHistory.ts';
8
8
  import { Rljson } from '../rljson.ts';
9
9
  import { Ref } from '../typedefs.ts';
10
10
  export interface Ingredient extends Json {
@@ -32,6 +32,6 @@ export interface Bakery extends Rljson {
32
32
  recipeIngredients: ComponentsTable<RecipIngredient>;
33
33
  ingredients: ComponentsTable<Ingredient>;
34
34
  nutritionalValues: ComponentsTable<NutritionalValues>;
35
- ingredientsInsertHistory: InsertHistory<'Ingredients'>;
35
+ ingredientsInsertHistory: InsertHistoryTable<'Ingredients'>;
36
36
  }
37
37
  export declare const bakeryExample: () => Bakery;
package/dist/index.d.ts CHANGED
@@ -5,6 +5,9 @@ export * from './content/layer.ts';
5
5
  export * from './content/revision.ts';
6
6
  export * from './content/slice-ids.ts';
7
7
  export * from './content/table-cfg.ts';
8
+ export * from './edit/edit-history.ts';
9
+ export * from './edit/edit.ts';
10
+ export * from './edit/multi-edit.ts';
8
11
  export * from './example.ts';
9
12
  export * from './example/bakery-example.ts';
10
13
  export * from './insert/insert-validator.ts';
@@ -11,7 +11,7 @@ export type InsertHistoryRow<Str extends string> = {
11
11
  origin?: Ref;
12
12
  previous?: InsertHistoryTimeId[];
13
13
  };
14
- export type InsertHistory<Str extends string> = RljsonTable<InsertHistoryRow<Str>, 'insertHistory'>;
14
+ export type InsertHistoryTable<Str extends string> = RljsonTable<InsertHistoryRow<Str>, 'insertHistory'>;
15
15
  /**
16
16
  * Creates a TableCfg for a InsertHistory table for the given table configuration
17
17
  * @param tableCfg - The table configuration to create the InsertHistory table for
@@ -21,4 +21,4 @@ export declare const createInsertHistoryTableCfg: (tableCfg: TableCfg) => TableC
21
21
  /**
22
22
  * Provides an example insertHistory table for test purposes
23
23
  */
24
- export declare const exampleInsertHistoryTable: () => InsertHistory<any>;
24
+ export declare const exampleInsertHistoryTable: () => InsertHistoryTable<any>;
package/dist/rljson.d.ts CHANGED
@@ -6,14 +6,17 @@ import { LayersTable } from './content/layer.ts';
6
6
  import { RevisionsTable } from './content/revision.ts';
7
7
  import { SliceIdsTable } from './content/slice-ids.ts';
8
8
  import { TableCfgRef, TablesCfgTable } from './content/table-cfg.ts';
9
- import { InsertHistory } from './insertHistory/insertHistory.ts';
9
+ import { EditHistoryTable } from './edit/edit-history.ts';
10
+ import { EditsTable } from './edit/edit.ts';
11
+ import { MultiEditsTable } from './edit/multi-edit.ts';
12
+ import { InsertHistoryTable } from './insertHistory/insertHistory.ts';
10
13
  import { ContentType, Ref, TableKey } from './typedefs.ts';
11
14
  export declare const reservedFieldNames: string[];
12
15
  export declare const reservedTableKeys: string[];
13
16
  /**
14
17
  * One of the supported Rljson table types
15
18
  */
16
- export type TableType = BuffetsTable | ComponentsTable<any> | LayersTable | SliceIdsTable | CakesTable | RevisionsTable | TablesCfgTable | InsertHistory<any>;
19
+ export type TableType = BuffetsTable | ComponentsTable<any> | LayersTable | SliceIdsTable | CakesTable | RevisionsTable | TablesCfgTable | InsertHistoryTable<any> | EditsTable | MultiEditsTable | EditHistoryTable;
17
20
  /** The rljson data format */
18
21
  export interface Rljson extends Json {
19
22
  [tableId: TableKey]: TableType;
package/dist/rljson.js CHANGED
@@ -1436,6 +1436,99 @@ const exampleTableCfg = (tableCfg = void 0) => {
1436
1436
  isShared: false
1437
1437
  };
1438
1438
  };
1439
+ const createEditHistoryTableCfg = (cakeKey) => ({
1440
+ key: `${cakeKey}EditHistory`,
1441
+ type: "editHistory",
1442
+ columns: [
1443
+ {
1444
+ key: "_hash",
1445
+ type: "string",
1446
+ titleLong: "Hash",
1447
+ titleShort: "Hash"
1448
+ },
1449
+ {
1450
+ key: "timeId",
1451
+ type: "string",
1452
+ titleLong: "Time Identifier",
1453
+ titleShort: "Time ID"
1454
+ },
1455
+ {
1456
+ key: "multiEditRef",
1457
+ type: "string",
1458
+ titleLong: "Multi Edit Reference",
1459
+ titleShort: "Multi Edit Ref",
1460
+ ref: {
1461
+ tableKey: `${cakeKey}MultiEdit`
1462
+ }
1463
+ },
1464
+ {
1465
+ key: "dataRef",
1466
+ type: "string",
1467
+ titleLong: "Data Reference",
1468
+ titleShort: "Data Ref",
1469
+ ref: {
1470
+ tableKey: cakeKey
1471
+ }
1472
+ },
1473
+ {
1474
+ key: "previous",
1475
+ type: "jsonArray",
1476
+ titleLong: "Previous Values",
1477
+ titleShort: "Previous"
1478
+ }
1479
+ ]
1480
+ });
1481
+ const createEditTableCfg = (cakeKey) => ({
1482
+ key: `${cakeKey}Edits`,
1483
+ type: "edits",
1484
+ columns: [
1485
+ {
1486
+ key: "_hash",
1487
+ type: "string",
1488
+ titleLong: "Hash",
1489
+ titleShort: "Hash"
1490
+ },
1491
+ {
1492
+ key: "name",
1493
+ type: "string",
1494
+ titleLong: "Name of the Edit",
1495
+ titleShort: "Name"
1496
+ },
1497
+ {
1498
+ key: "action",
1499
+ type: "json",
1500
+ titleLong: "Edit Action Data",
1501
+ titleShort: "Action"
1502
+ }
1503
+ ]
1504
+ });
1505
+ const createMultiEditTableCfg = (cakeKey) => ({
1506
+ key: `${cakeKey}MultiEdits`,
1507
+ type: "multiEdits",
1508
+ columns: [
1509
+ {
1510
+ key: "_hash",
1511
+ type: "string",
1512
+ titleLong: "Hash",
1513
+ titleShort: "Hash"
1514
+ },
1515
+ {
1516
+ key: "previous",
1517
+ type: "string",
1518
+ titleLong: "Previous Value",
1519
+ titleShort: "Previous"
1520
+ },
1521
+ {
1522
+ key: "edit",
1523
+ type: "string",
1524
+ titleLong: "Edit Reference",
1525
+ titleShort: "Edit Ref",
1526
+ ref: {
1527
+ tableKey: `${cakeKey}Edits`
1528
+ }
1529
+ }
1530
+ ]
1531
+ });
1439
1532
  const objectDepth = (o) => Object(o) === o ? 1 + Math.max(-1, ...Object.values(o).map(objectDepth)) : 0;
1440
1533
  class InsertValidator {
1441
1534
  constructor(_insert) {
@@ -1663,10 +1756,9 @@ const contentTypes = [
1663
1756
  "revisions",
1664
1757
  "tableCfgs",
1665
1758
  "insertHistory",
1666
- // Additional types for edits, implemented in DB
1667
1759
  "edits",
1668
1760
  "multiEdits",
1669
- "editsHistory"
1761
+ "editHistory"
1670
1762
  ];
1671
1763
  const exampleTypedefs = () => {
1672
1764
  return {
@@ -2518,8 +2610,11 @@ export {
2518
2610
  bakeryExample,
2519
2611
  contentTypes,
2520
2612
  createCakeTableCfg,
2613
+ createEditHistoryTableCfg,
2614
+ createEditTableCfg,
2521
2615
  createInsertHistoryTableCfg,
2522
2616
  createLayerTableCfg,
2617
+ createMultiEditTableCfg,
2523
2618
  exampleBuffetsTable,
2524
2619
  exampleCakesTable,
2525
2620
  exampleComponentsTable,
@@ -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", "editsHistory"];
29
+ export declare const contentTypes: readonly ["buffets", "cakes", "layers", "sliceIds", "components", "revisions", "tableCfgs", "insertHistory", "edits", "multiEdits", "editHistory"];
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.69",
3
+ "version": "0.0.71",
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",
@@ -23,10 +23,10 @@
23
23
  "@types/node": "^24.10.1",
24
24
  "@typescript-eslint/eslint-plugin": "^8.46.4",
25
25
  "@typescript-eslint/parser": "^8.46.4",
26
- "@vitest/coverage-v8": "^4.0.8",
26
+ "@vitest/coverage-v8": "^4.0.9",
27
27
  "cross-env": "^10.1.0",
28
28
  "eslint": "^9.39.1",
29
- "eslint-plugin-jsdoc": "^61.1.12",
29
+ "eslint-plugin-jsdoc": "^61.2.1",
30
30
  "eslint-plugin-tsdoc": "^0.5.0",
31
31
  "globals": "^16.5.0",
32
32
  "jsdoc": "^4.0.5",
@@ -34,10 +34,10 @@
34
34
  "typescript": "~5.9.3",
35
35
  "typescript-eslint": "^8.46.4",
36
36
  "vite": "^7.2.2",
37
- "vite-node": "^5.0.0",
37
+ "vite-node": "^5.1.0",
38
38
  "vite-plugin-dts": "^4.5.4",
39
39
  "vite-tsconfig-paths": "^5.1.4",
40
- "vitest": "^4.0.8",
40
+ "vitest": "^4.0.9",
41
41
  "vitest-dom": "^0.1.1"
42
42
  },
43
43
  "dependencies": {