@rljson/rljson 0.0.51 → 0.0.53

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.
@@ -1,7 +1,7 @@
1
1
  import { Json } from '@rljson/json';
2
2
  import { BuffetsTable } from '../content/buffet.ts';
3
3
  import { CakesTable } from '../content/cake.ts';
4
- import { IngredientsTable } from '../content/ingredients.ts';
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
7
  import { Rljson } from '../rljson.ts';
@@ -11,11 +11,11 @@ export interface Ingredient extends Json {
11
11
  amountUnit: 'g' | 'ml';
12
12
  nutritionalValuesRef: Ref;
13
13
  }
14
- export interface RecipeIngredient extends Json {
14
+ export interface RecipIngredient extends Json {
15
15
  ingredientsRef: string;
16
16
  quantity: number;
17
17
  }
18
- export type IngredientsTypeTable = IngredientsTable<Ingredient>;
18
+ export type IngredientsTypeTable = ComponentsTable<Ingredient>;
19
19
  export interface NutritionalValues extends Json {
20
20
  energy: number;
21
21
  fat: number;
@@ -26,10 +26,10 @@ export interface Bakery extends Rljson {
26
26
  buffets: BuffetsTable;
27
27
  cakes: CakesTable;
28
28
  slices: SliceIdsTable;
29
- layers: LayersTable;
30
29
  recipes: LayersTable;
31
- recipeIngredients: IngredientsTable<RecipeIngredient>;
32
- ingredients: IngredientsTable<Ingredient>;
33
- nutritionalValues: IngredientsTable<NutritionalValues>;
30
+ recipeLayers: LayersTable;
31
+ recipeIngredients: ComponentsTable<RecipIngredient>;
32
+ ingredients: ComponentsTable<Ingredient>;
33
+ nutritionalValues: ComponentsTable<NutritionalValues>;
34
34
  }
35
35
  export declare const bakeryExample: () => Bakery;
package/dist/example.d.ts CHANGED
@@ -27,8 +27,8 @@ export declare class Example {
27
27
  layers: {
28
28
  missingBase: () => Rljson;
29
29
  missingSliceIdSet: () => Rljson;
30
- missingAssignedIngredientTable: () => Rljson;
31
- missingAssignedIngredient: () => Rljson;
30
+ missingAssignedComponentTable: () => Rljson;
31
+ missingAssignedComponent: () => Rljson;
32
32
  };
33
33
  cakes: {
34
34
  missingSliceIdSet: () => Rljson;
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  export * from './content/buffet.ts';
2
2
  export * from './content/cake.ts';
3
- export * from './content/ingredients.ts';
3
+ export * from './content/components.ts';
4
4
  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
8
  export * from './example.ts';
9
9
  export * from './example/bakery-example.ts';
10
- export * from './rljson-indexed.ts';
11
10
  export * from './rljson.ts';
11
+ export * from './tools/remove-duplicates.ts';
12
12
  export * from './typedefs.ts';
13
13
  export * from './validate/base-validator.ts';
14
14
  export * from './validate/validate.ts';
package/dist/rljson.d.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  import { Json } from '@rljson/json';
2
2
  import { BuffetsTable } from './content/buffet.ts';
3
3
  import { CakesTable } from './content/cake.ts';
4
- import { IngredientsTable } from './content/ingredients.ts';
4
+ import { ComponentsTable } from './content/components.ts';
5
5
  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 { Ref, TableKey } from './typedefs.ts';
9
+ import { ContentType, Ref, TableKey } from './typedefs.ts';
10
10
  export declare const reservedFieldNames: string[];
11
11
  export declare const reservedTableKeys: string[];
12
12
  /**
13
13
  * One of the supported Rljson table types
14
14
  */
15
- export type TableType = BuffetsTable | IngredientsTable<any> | LayersTable | SliceIdsTable | CakesTable | RevisionsTable;
15
+ export type TableType = BuffetsTable | ComponentsTable<any> | LayersTable | SliceIdsTable | CakesTable | RevisionsTable | TablesCfgTable;
16
16
  /** The rljson data format */
17
17
  export interface Rljson extends Json {
18
18
  [tableId: TableKey]: TableType;
@@ -45,11 +45,13 @@ export type RljsonPrivate = {
45
45
  /** An example rljson object */
46
46
  export declare const exampleRljson: () => Rljson;
47
47
  /** A table in the rljson format */
48
- export interface RljsonTable<Data extends Json> extends Json {
48
+ export interface RljsonTable<Data extends Json, T extends ContentType> extends Json {
49
49
  /** The data rows of the table */
50
50
  _data: Data[];
51
51
  /** The columns configuration of the table */
52
52
  _tableCfg?: TableCfgRef;
53
+ /** The type of the table. Must match the one in table cfg table */
54
+ _type: T;
53
55
  }
54
56
  /**
55
57
  * Iterates over all tables of an Rljson object.