@rljson/rljson 0.0.70 → 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.
@@ -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,16 +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 { EditHistoryTable } from './edit/edit-history.ts';
9
10
  import { EditsTable } from './edit/edit.ts';
10
11
  import { MultiEditsTable } from './edit/multi-edit.ts';
11
- import { InsertHistory } from './insertHistory/insertHistory.ts';
12
+ import { InsertHistoryTable } from './insertHistory/insertHistory.ts';
12
13
  import { ContentType, Ref, TableKey } from './typedefs.ts';
13
14
  export declare const reservedFieldNames: string[];
14
15
  export declare const reservedTableKeys: string[];
15
16
  /**
16
17
  * One of the supported Rljson table types
17
18
  */
18
- export type TableType = BuffetsTable | ComponentsTable<any> | LayersTable | SliceIdsTable | CakesTable | RevisionsTable | TablesCfgTable | InsertHistory<any> | EditsTable | MultiEditsTable;
19
+ export type TableType = BuffetsTable | ComponentsTable<any> | LayersTable | SliceIdsTable | CakesTable | RevisionsTable | TablesCfgTable | InsertHistoryTable<any> | EditsTable | MultiEditsTable | EditHistoryTable;
19
20
  /** The rljson data format */
20
21
  export interface Rljson extends Json {
21
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) {
@@ -2517,8 +2610,11 @@ export {
2517
2610
  bakeryExample,
2518
2611
  contentTypes,
2519
2612
  createCakeTableCfg,
2613
+ createEditHistoryTableCfg,
2614
+ createEditTableCfg,
2520
2615
  createInsertHistoryTableCfg,
2521
2616
  createLayerTableCfg,
2617
+ createMultiEditTableCfg,
2522
2618
  exampleBuffetsTable,
2523
2619
  exampleCakesTable,
2524
2620
  exampleComponentsTable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/rljson",
3
- "version": "0.0.70",
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",