@rljson/rljson 0.0.56 → 0.0.60
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.
- package/dist/content/cake.d.ts +9 -0
- package/dist/content/components.d.ts +3 -2
- package/dist/content/layer.d.ts +6 -0
- package/dist/edit/edit.d.ts +29 -0
- package/dist/edit/route.d.ts +13 -0
- package/dist/example/bakery-example.d.ts +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/rljson.d.ts +2 -1
- package/dist/rljson.js +587 -488
- package/dist/src/example.ts +5 -1
- package/dist/tools/time-id.d.ts +1 -0
- package/dist/typedefs.d.ts +1 -1
- package/package.json +17 -24
package/dist/content/cake.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { RljsonTable } from '../rljson.ts';
|
|
|
3
3
|
import { TableKey } from '../typedefs.ts';
|
|
4
4
|
import { LayerRef } from './layer.ts';
|
|
5
5
|
import { SliceIdsRef } from './slice-ids.ts';
|
|
6
|
+
import { TableCfg } from './table-cfg.ts';
|
|
6
7
|
/**
|
|
7
8
|
* A `CakeLayerId` assigns an id or name to a cake layer
|
|
8
9
|
*/
|
|
@@ -39,6 +40,14 @@ export interface Cake extends Json {
|
|
|
39
40
|
* A table containing cakes
|
|
40
41
|
*/
|
|
41
42
|
export type CakesTable = RljsonTable<Cake, 'cakes'>;
|
|
43
|
+
/**
|
|
44
|
+
* Sample Table as BoilerPlate for Tests and Examples
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* Sample Table as BoilerPlate for Tests and Examples
|
|
48
|
+
* @param cakeKey - the key of the cake table cfg
|
|
49
|
+
*/
|
|
50
|
+
export declare const createCakeTableCfg: (cakeKey: string) => TableCfg;
|
|
42
51
|
/**
|
|
43
52
|
* Provides an example cakes table for test purposes
|
|
44
53
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { Json } from '@rljson/json';
|
|
1
2
|
import { NutritionalValues } from '../example/bakery-example.ts';
|
|
2
3
|
import { RljsonTable } from '../rljson.ts';
|
|
3
|
-
import {
|
|
4
|
+
import { Ref } from '../typedefs.ts';
|
|
4
5
|
/**
|
|
5
6
|
* A reference to a components row in a components table
|
|
6
7
|
*/
|
|
@@ -8,7 +9,7 @@ export type ComponentRef = Ref;
|
|
|
8
9
|
/**
|
|
9
10
|
* A table containing components
|
|
10
11
|
*/
|
|
11
|
-
export type ComponentsTable<T extends
|
|
12
|
+
export type ComponentsTable<T extends Json> = RljsonTable<T, 'components'>;
|
|
12
13
|
/**
|
|
13
14
|
* Provides an example components table for test purposes
|
|
14
15
|
*/
|
package/dist/content/layer.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { RljsonTable } from '../rljson.ts';
|
|
|
3
3
|
import { Ref, SliceId, TableKey } from '../typedefs.ts';
|
|
4
4
|
import { ComponentRef } from './components.ts';
|
|
5
5
|
import { SliceIdsRef } from './slice-ids.ts';
|
|
6
|
+
import { TableCfg } from './table-cfg.ts';
|
|
6
7
|
/**
|
|
7
8
|
* A LayerRef is a hash pointing to a layer
|
|
8
9
|
*/
|
|
@@ -44,6 +45,11 @@ export interface Layer extends Json {
|
|
|
44
45
|
* A table containing layers
|
|
45
46
|
*/
|
|
46
47
|
export type LayersTable = RljsonTable<Layer, 'layers'>;
|
|
48
|
+
/**
|
|
49
|
+
* Sample Table as BoilerPlate for Tests and Examples
|
|
50
|
+
* @param layerKey - the key of the layer table
|
|
51
|
+
*/
|
|
52
|
+
export declare const createLayerTableCfg: (layerKey: string) => TableCfg;
|
|
47
53
|
/**
|
|
48
54
|
* Provides an example layersTable for test purposes
|
|
49
55
|
*/
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Json, JsonH, JsonValueH } from '@rljson/json';
|
|
2
|
+
import { Ref } from '../typedefs.ts';
|
|
3
|
+
import { RouteRef } from './route.ts';
|
|
4
|
+
import { RljsonTable } from '../rljson.ts';
|
|
5
|
+
/**
|
|
6
|
+
* An Edit Object describing edits on data basically
|
|
7
|
+
*/
|
|
8
|
+
export type EditRef = Ref;
|
|
9
|
+
export type Edit<T extends Json> = {
|
|
10
|
+
value: T & JsonValueH;
|
|
11
|
+
route: RouteRef;
|
|
12
|
+
origin?: Ref;
|
|
13
|
+
previous?: EditProtocolTimeId[];
|
|
14
|
+
acknowledged?: boolean;
|
|
15
|
+
} & JsonH;
|
|
16
|
+
export type EditProtocolTimeId = string;
|
|
17
|
+
export type EditProtocolRow<Str extends string> = {
|
|
18
|
+
[key in Str as `${Uncapitalize<string & key>}Ref`]: string;
|
|
19
|
+
} & {
|
|
20
|
+
timeId: EditProtocolTimeId;
|
|
21
|
+
route: RouteRef;
|
|
22
|
+
origin?: Ref;
|
|
23
|
+
previous?: EditProtocolTimeId[];
|
|
24
|
+
};
|
|
25
|
+
export type EditProtocol<Str extends string> = RljsonTable<EditProtocolRow<Str>, 'edits'>;
|
|
26
|
+
/**
|
|
27
|
+
* Provides an example Edits table for test purposes
|
|
28
|
+
*/
|
|
29
|
+
export declare const exampleEditsTable: () => EditProtocol<any>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type RouteRef = string;
|
|
2
|
+
/**
|
|
3
|
+
* A class to handle routes in an Rljson object.
|
|
4
|
+
*/
|
|
5
|
+
export declare class Route {
|
|
6
|
+
private segments;
|
|
7
|
+
constructor(segments: string[]);
|
|
8
|
+
static fromFlat(route: string): Route;
|
|
9
|
+
segment(index?: number): string;
|
|
10
|
+
deeper(steps?: number): Route;
|
|
11
|
+
get isRoot(): boolean;
|
|
12
|
+
get flat(): string;
|
|
13
|
+
}
|
|
@@ -4,6 +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 { EditProtocol } from '../edit/edit.ts';
|
|
7
8
|
import { Rljson } from '../rljson.ts';
|
|
8
9
|
import { Ref } from '../typedefs.ts';
|
|
9
10
|
export interface Ingredient extends Json {
|
|
@@ -31,5 +32,6 @@ export interface Bakery extends Rljson {
|
|
|
31
32
|
recipeIngredients: ComponentsTable<RecipIngredient>;
|
|
32
33
|
ingredients: ComponentsTable<Ingredient>;
|
|
33
34
|
nutritionalValues: ComponentsTable<NutritionalValues>;
|
|
35
|
+
ingredientsEdits: EditProtocol<'Ingredients'>;
|
|
34
36
|
}
|
|
35
37
|
export declare const bakeryExample: () => Bakery;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,10 +5,13 @@ 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.ts';
|
|
9
|
+
export * from './edit/route.ts';
|
|
8
10
|
export * from './example.ts';
|
|
9
11
|
export * from './example/bakery-example.ts';
|
|
10
12
|
export * from './rljson.ts';
|
|
11
13
|
export * from './tools/remove-duplicates.ts';
|
|
14
|
+
export * from './tools/time-id.ts';
|
|
12
15
|
export * from './typedefs.ts';
|
|
13
16
|
export * from './validate/base-validator.ts';
|
|
14
17
|
export * from './validate/validate.ts';
|
package/dist/rljson.d.ts
CHANGED
|
@@ -6,13 +6,14 @@ 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 { EditProtocol } from './edit/edit.ts';
|
|
9
10
|
import { ContentType, Ref, TableKey } from './typedefs.ts';
|
|
10
11
|
export declare const reservedFieldNames: string[];
|
|
11
12
|
export declare const reservedTableKeys: string[];
|
|
12
13
|
/**
|
|
13
14
|
* One of the supported Rljson table types
|
|
14
15
|
*/
|
|
15
|
-
export type TableType = BuffetsTable | ComponentsTable<any> | LayersTable | SliceIdsTable | CakesTable | RevisionsTable | TablesCfgTable
|
|
16
|
+
export type TableType = BuffetsTable | ComponentsTable<any> | LayersTable | SliceIdsTable | CakesTable | RevisionsTable | TablesCfgTable | EditProtocol<any>;
|
|
16
17
|
/** The rljson data format */
|
|
17
18
|
export interface Rljson extends Json {
|
|
18
19
|
[tableId: TableKey]: TableType;
|