@rljson/rljson 0.0.17 → 0.0.19

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.
@@ -8,302 +8,25 @@ found in the LICENSE file in the root of this package.
8
8
 
9
9
  # Contributors Guide
10
10
 
11
- - [Install](#install)
12
- - [Checkout](#checkout)
13
- - [Install pnpm](#install-pnpm)
14
- - [Install dependencies](#install-dependencies)
15
- - [Install Vscode extensions](#install-vscode-extensions)
16
- - [Uninstall Jest and Jasmine](#uninstall-jest-and-jasmine)
17
- - [Install GitHub CLI](#install-github-cli)
11
+ - [Prepare](#prepare)
18
12
  - [Develop](#develop)
19
- - [Read architecture doc](#read-architecture-doc)
20
- - [Debug](#debug)
21
- - [Update goldens](#update-goldens)
22
- - [Test and Build](#test-and-build)
23
- - [Rename classes](#rename-classes)
24
- - [Workflow](#workflow)
25
- - [Set a PR title](#set-a-pr-title)
26
- - [Checkout main](#checkout-main)
27
- - [Create a feature branch](#create-a-feature-branch)
28
- - [Update dependencies](#update-dependencies)
29
- - [Debug and develop](#debug-and-develop)
30
- - [Commit](#commit)
31
- - [Increase version](#increase-version)
32
- - [Build](#build)
33
- - [Create a pull request](#create-a-pull-request)
34
- - [Wait until PR is merged](#wait-until-pr-is-merged)
35
- - [Delete feature branch](#delete-feature-branch)
36
- - [Publish to NPM](#publish-to-npm)
37
- - [Troubleshooting](#troubleshooting)
38
- - [Checkout README.trouble.md](#checkout-readmetroublemd)
39
- - [File issues on GitHub](#file-issues-on-github)
13
+ - [Tools](#tools)
14
+ - [Superheros](#superheros)
40
15
 
41
- <!-- ........................................................................-->
42
-
43
- ## Install
44
-
45
- ### Checkout
46
-
47
- ```bash
48
- mkdir rljson
49
- cd rljson
50
- git clone https://github.com/rljson/rljson.git
51
- cd rljson
52
- ```
53
-
54
- ### Install pnpm
55
-
56
- Windows:
57
-
58
- ```bash
59
- corepack enable pnpm
60
- ```
61
-
62
- Mac:
63
-
64
- ```bash
65
- sudo corepack enable pnpm
66
- ```
67
-
68
- ### Install dependencies
69
-
70
- ```bash
71
- pnpm install
72
- ```
73
-
74
- ### Install Vscode extensions
75
-
76
- Open this project in `vscode`.
77
-
78
- Press `Cmd+Shift+P`.
79
-
80
- Type `Extensions: Show Recommended Extensions` and press `Enter`.
81
-
82
- The recommended extensions will be shown.
83
-
84
- Make sure, all recommended extensions are shown.
85
-
86
- ### Uninstall Jest and Jasmine
87
-
88
- Jest or Jasmine extensions conflict with the `Vitest` extension used for this
89
- project.
90
-
91
- Uninstall them, if you have installed them.
92
-
93
- ### Install GitHub CLI
94
-
95
- Install GitHub CLI on Mac
16
+ ## Prepare
96
17
 
97
- ```bash
98
- brew install gh
99
- ```
100
-
101
- Login
102
-
103
- ```bash
104
- gh auth login
105
- ```
18
+ Read [prepare.md](doc/workflows/prepare.md)
106
19
 
107
20
  <!-- ........................................................................-->
108
21
 
109
22
  ## Develop
110
23
 
111
- ### Read architecture doc
112
-
113
- Read [README.architecture.md](./README.architecture.md) to get an overview
114
- of the package's architecture.
115
-
116
- ### Debug
117
-
118
- In Vscode: At the `left side bar` click on the `Test tube` icon to open the `Test explorer`.
119
-
120
- At the `top`, click on the `refresh` icon to show update the tests.
121
-
122
- Open a test file (`*.spec.ts`)
123
-
124
- Set a breakpoint.
125
-
126
- Press `alt` and click on the play button left beside the test.
127
-
128
- Execution should stop at the breakpoint.
129
-
130
- ### Update goldens
131
-
132
- In various tests we are creating golden files, that are reference files that
133
- are compared against the files created in the tests.
134
-
135
- ```bash
136
- pnpm updateGoldens
137
- ```
138
-
139
- ### Test and Build
140
-
141
- ```bash
142
- pnpm test
143
- pnpm build
144
- ```
145
-
146
- ### Rename classes
147
-
148
- Replace `ClassA` by `ClassB` in the following script and run it:
149
-
150
- ```bash
151
- export CLASS_A="ColumnSelection"
152
- export CLASS_B="ColumnsConfig"
153
-
154
- to_snake_case() {
155
- echo "$1" | sed -E 's/([a-z0-9])([A-Z])/\1-\2/g' | tr '[:upper:]' '[:lower:]'
156
- }
157
-
158
- to_lower_first() {
159
- first_char=$(echo "$1" | cut -c1 | tr '[:upper:]' '[:lower:]')
160
- rest_chars=$(echo "$1" | cut -c2-)
161
- echo "$first_char$rest_chars"
162
- }
163
-
164
- export LOWER_CLASS_A=$(to_lower_first "$CLASS_A")
165
- export LOWER_CLASS_B=$(to_lower_first "$CLASS_B")
166
- export SNAKE_CLASS_A=$(to_snake_case "$CLASS_A")
167
- export SNAKE_CLASS_B=$(to_snake_case "$CLASS_B")
168
-
169
- find . -type f \( -name "*.ts" -o -name "*.md" -o -name "package.json" \) -not -path "./node_modules/*" \
170
- -exec sed -i '' "s/$CLASS_A/$CLASS_B/g" {} +
171
-
172
- find . -type f \( -name "*.ts" -o -name "*.md" -o -name "package.json" \) -not -path "./node_modules/*" \
173
- -exec sed -i '' "s/$LOWER_CLASS_A/$LOWER_CLASS_B/g" {} +
174
-
175
- find . -type f \( -name "*.ts" -o -name "*.md" -o -name "package.json" \) -not -path "./node_modules/*" \
176
- -exec sed -i '' "s/$SNAKE_CLASS_A/$SNAKE_CLASS_B/g" {} +
177
-
178
- find . -type f -not -path "*/node_modules/*" -not -path "*/.*" -name "*$SNAKE_CLASS_A*" \
179
- -exec bash -c 'mv "$1" "${1//'"$SNAKE_CLASS_A"'/'"$SNAKE_CLASS_B"'}"' _ {} \;
180
-
181
- rm -rf test/goldens
182
- pnpm updateGoldens
183
- ```
184
-
185
- Review the changes.
186
-
187
- Commit
188
-
189
- ```bash
190
- git stage .
191
- git commit -am"Rename $CLASS_A to $CLASS_B"
192
- ```
193
-
194
- <!-- ........................................................................-->
195
-
196
- ## Workflow
197
-
198
- ### Set a PR title
199
-
200
- ```bash
201
- export PR_TITLE="PR Title"
202
- ```
203
-
204
- ### Checkout main
205
-
206
- ```bash
207
- git checkout main
208
- git fetch
209
- git pull
210
- ```
211
-
212
- ### Create a feature branch
213
-
214
- ```bash
215
- export BRANCH=`echo "$PR_TITLE" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9_]/_/g'`
216
- git checkout -b $BRANCH
217
- ```
218
-
219
- ### Update dependencies
220
-
221
- ```bash
222
- pnpm update --latest
223
- git commit -am"Update dependencies"
224
- ```
225
-
226
- ### Debug and develop
227
-
228
- Debug and develop
229
-
230
- ### Commit
231
-
232
- If you only have one thing changed, execute
233
-
234
- ```bash
235
- git add . && git commit -m "$PR_TITLE"
236
- ```
237
-
238
- ### Increase version
239
-
240
- ```bash
241
- pnpm version patch --no-git-tag-version
242
- git commit -am"Increase version"
243
- ```
244
-
245
- ### Build
246
-
247
- ```bash
248
- npm run build
249
- ```
250
-
251
- ### Create a pull request
252
-
253
- ```bash
254
- git push -u origin $BRANCH
255
- gh pr create --base main --title "$PR_TITLE" --body ""
256
- gh pr merge --auto --squash
257
- ```
258
-
259
- ### Wait until PR is merged
260
-
261
- ```bash
262
- echo -e "\033[34m$(gh pr view --json url | jq -r '.url')\033[0m"
263
- echo -e "\033[33mWait until PR is closed or merged ...\033[0m"
264
-
265
- while true; do
266
- STATUS=$(gh pr view --json state | jq -r '.state')
267
- if [ "$STATUS" = "CLOSED" ] || [ "$STATUS" = "MERGED" ]; then
268
- echo -e "\033[32mPR has been merged or closed.\033[0m"
269
- break
270
- elif [ "$STATUS" = "FAILED" ]; then
271
- echo -e "\033[31mError: PR has failed.\033[0m"
272
- break
273
- fi
274
- sleep 2
275
- done
276
- ```
277
-
278
- ### Delete feature branch
279
-
280
- ```bash
281
- git fetch && git checkout main
282
- git reset --soft origin/main
283
- git stash -m"PR Aftermath"
284
- git pull
285
- git branch -d $BRANCH
286
- ```
287
-
288
- ### Publish to NPM
289
-
290
- ```bash
291
- npm publish --access public
292
- git tag $(npm pkg get version | tr -d '\\"')
293
- ```
294
-
295
- <!-- ........................................................................-->
296
-
297
- ## Troubleshooting
298
-
299
- ### Checkout README.trouble.md
300
-
301
- Checkout [./README.trouble.md](./README.trouble.md)
24
+ Read [develop.md](doc/workflows/develop.md)
302
25
 
303
- ### File issues on GitHub
26
+ ## Tools
304
27
 
305
- Visit <https://github.com/rljson/rljson/issues>
28
+ Read [tools.md](doc/workflows/tools.md)
306
29
 
307
- Check if there is already an issue for your problem.
30
+ ## Superheros
308
31
 
309
- If no, report the issue.
32
+ Read [super-hero.md](doc/workflows/super-hero.md)
@@ -8,302 +8,25 @@ found in the LICENSE file in the root of this package.
8
8
 
9
9
  # Contributors Guide
10
10
 
11
- - [Install](#install)
12
- - [Checkout](#checkout)
13
- - [Install pnpm](#install-pnpm)
14
- - [Install dependencies](#install-dependencies)
15
- - [Install Vscode extensions](#install-vscode-extensions)
16
- - [Uninstall Jest and Jasmine](#uninstall-jest-and-jasmine)
17
- - [Install GitHub CLI](#install-github-cli)
11
+ - [Prepare](#prepare)
18
12
  - [Develop](#develop)
19
- - [Read architecture doc](#read-architecture-doc)
20
- - [Debug](#debug)
21
- - [Update goldens](#update-goldens)
22
- - [Test and Build](#test-and-build)
23
- - [Rename classes](#rename-classes)
24
- - [Workflow](#workflow)
25
- - [Set a PR title](#set-a-pr-title)
26
- - [Checkout main](#checkout-main)
27
- - [Create a feature branch](#create-a-feature-branch)
28
- - [Update dependencies](#update-dependencies)
29
- - [Debug and develop](#debug-and-develop)
30
- - [Commit](#commit)
31
- - [Increase version](#increase-version)
32
- - [Build](#build)
33
- - [Create a pull request](#create-a-pull-request)
34
- - [Wait until PR is merged](#wait-until-pr-is-merged)
35
- - [Delete feature branch](#delete-feature-branch)
36
- - [Publish to NPM](#publish-to-npm)
37
- - [Troubleshooting](#troubleshooting)
38
- - [Checkout README.trouble.md](#checkout-readmetroublemd)
39
- - [File issues on GitHub](#file-issues-on-github)
13
+ - [Tools](#tools)
14
+ - [Superheros](#superheros)
40
15
 
41
- <!-- ........................................................................-->
42
-
43
- ## Install
44
-
45
- ### Checkout
46
-
47
- ```bash
48
- mkdir rljson
49
- cd rljson
50
- git clone https://github.com/rljson/rljson.git
51
- cd rljson
52
- ```
53
-
54
- ### Install pnpm
55
-
56
- Windows:
57
-
58
- ```bash
59
- corepack enable pnpm
60
- ```
61
-
62
- Mac:
63
-
64
- ```bash
65
- sudo corepack enable pnpm
66
- ```
67
-
68
- ### Install dependencies
69
-
70
- ```bash
71
- pnpm install
72
- ```
73
-
74
- ### Install Vscode extensions
75
-
76
- Open this project in `vscode`.
77
-
78
- Press `Cmd+Shift+P`.
79
-
80
- Type `Extensions: Show Recommended Extensions` and press `Enter`.
81
-
82
- The recommended extensions will be shown.
83
-
84
- Make sure, all recommended extensions are shown.
85
-
86
- ### Uninstall Jest and Jasmine
87
-
88
- Jest or Jasmine extensions conflict with the `Vitest` extension used for this
89
- project.
90
-
91
- Uninstall them, if you have installed them.
92
-
93
- ### Install GitHub CLI
94
-
95
- Install GitHub CLI on Mac
16
+ ## Prepare
96
17
 
97
- ```bash
98
- brew install gh
99
- ```
100
-
101
- Login
102
-
103
- ```bash
104
- gh auth login
105
- ```
18
+ Read [prepare.md](doc/workflows/prepare.md)
106
19
 
107
20
  <!-- ........................................................................-->
108
21
 
109
22
  ## Develop
110
23
 
111
- ### Read architecture doc
112
-
113
- Read [README.architecture.md](./README.architecture.md) to get an overview
114
- of the package's architecture.
115
-
116
- ### Debug
117
-
118
- In Vscode: At the `left side bar` click on the `Test tube` icon to open the `Test explorer`.
119
-
120
- At the `top`, click on the `refresh` icon to show update the tests.
121
-
122
- Open a test file (`*.spec.ts`)
123
-
124
- Set a breakpoint.
125
-
126
- Press `alt` and click on the play button left beside the test.
127
-
128
- Execution should stop at the breakpoint.
129
-
130
- ### Update goldens
131
-
132
- In various tests we are creating golden files, that are reference files that
133
- are compared against the files created in the tests.
134
-
135
- ```bash
136
- pnpm updateGoldens
137
- ```
138
-
139
- ### Test and Build
140
-
141
- ```bash
142
- pnpm test
143
- pnpm build
144
- ```
145
-
146
- ### Rename classes
147
-
148
- Replace `ClassA` by `ClassB` in the following script and run it:
149
-
150
- ```bash
151
- export CLASS_A="ColumnSelection"
152
- export CLASS_B="ColumnsConfig"
153
-
154
- to_snake_case() {
155
- echo "$1" | sed -E 's/([a-z0-9])([A-Z])/\1-\2/g' | tr '[:upper:]' '[:lower:]'
156
- }
157
-
158
- to_lower_first() {
159
- first_char=$(echo "$1" | cut -c1 | tr '[:upper:]' '[:lower:]')
160
- rest_chars=$(echo "$1" | cut -c2-)
161
- echo "$first_char$rest_chars"
162
- }
163
-
164
- export LOWER_CLASS_A=$(to_lower_first "$CLASS_A")
165
- export LOWER_CLASS_B=$(to_lower_first "$CLASS_B")
166
- export SNAKE_CLASS_A=$(to_snake_case "$CLASS_A")
167
- export SNAKE_CLASS_B=$(to_snake_case "$CLASS_B")
168
-
169
- find . -type f \( -name "*.ts" -o -name "*.md" -o -name "package.json" \) -not -path "./node_modules/*" \
170
- -exec sed -i '' "s/$CLASS_A/$CLASS_B/g" {} +
171
-
172
- find . -type f \( -name "*.ts" -o -name "*.md" -o -name "package.json" \) -not -path "./node_modules/*" \
173
- -exec sed -i '' "s/$LOWER_CLASS_A/$LOWER_CLASS_B/g" {} +
174
-
175
- find . -type f \( -name "*.ts" -o -name "*.md" -o -name "package.json" \) -not -path "./node_modules/*" \
176
- -exec sed -i '' "s/$SNAKE_CLASS_A/$SNAKE_CLASS_B/g" {} +
177
-
178
- find . -type f -not -path "*/node_modules/*" -not -path "*/.*" -name "*$SNAKE_CLASS_A*" \
179
- -exec bash -c 'mv "$1" "${1//'"$SNAKE_CLASS_A"'/'"$SNAKE_CLASS_B"'}"' _ {} \;
180
-
181
- rm -rf test/goldens
182
- pnpm updateGoldens
183
- ```
184
-
185
- Review the changes.
186
-
187
- Commit
188
-
189
- ```bash
190
- git stage .
191
- git commit -am"Rename $CLASS_A to $CLASS_B"
192
- ```
193
-
194
- <!-- ........................................................................-->
195
-
196
- ## Workflow
197
-
198
- ### Set a PR title
199
-
200
- ```bash
201
- export PR_TITLE="PR Title"
202
- ```
203
-
204
- ### Checkout main
205
-
206
- ```bash
207
- git checkout main
208
- git fetch
209
- git pull
210
- ```
211
-
212
- ### Create a feature branch
213
-
214
- ```bash
215
- export BRANCH=`echo "$PR_TITLE" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9_]/_/g'`
216
- git checkout -b $BRANCH
217
- ```
218
-
219
- ### Update dependencies
220
-
221
- ```bash
222
- pnpm update --latest
223
- git commit -am"Update dependencies"
224
- ```
225
-
226
- ### Debug and develop
227
-
228
- Debug and develop
229
-
230
- ### Commit
231
-
232
- If you only have one thing changed, execute
233
-
234
- ```bash
235
- git add . && git commit -m "$PR_TITLE"
236
- ```
237
-
238
- ### Increase version
239
-
240
- ```bash
241
- pnpm version patch --no-git-tag-version
242
- git commit -am"Increase version"
243
- ```
244
-
245
- ### Build
246
-
247
- ```bash
248
- npm run build
249
- ```
250
-
251
- ### Create a pull request
252
-
253
- ```bash
254
- git push -u origin $BRANCH
255
- gh pr create --base main --title "$PR_TITLE" --body ""
256
- gh pr merge --auto --squash
257
- ```
258
-
259
- ### Wait until PR is merged
260
-
261
- ```bash
262
- echo -e "\033[34m$(gh pr view --json url | jq -r '.url')\033[0m"
263
- echo -e "\033[33mWait until PR is closed or merged ...\033[0m"
264
-
265
- while true; do
266
- STATUS=$(gh pr view --json state | jq -r '.state')
267
- if [ "$STATUS" = "CLOSED" ] || [ "$STATUS" = "MERGED" ]; then
268
- echo -e "\033[32mPR has been merged or closed.\033[0m"
269
- break
270
- elif [ "$STATUS" = "FAILED" ]; then
271
- echo -e "\033[31mError: PR has failed.\033[0m"
272
- break
273
- fi
274
- sleep 2
275
- done
276
- ```
277
-
278
- ### Delete feature branch
279
-
280
- ```bash
281
- git fetch && git checkout main
282
- git reset --soft origin/main
283
- git stash -m"PR Aftermath"
284
- git pull
285
- git branch -d $BRANCH
286
- ```
287
-
288
- ### Publish to NPM
289
-
290
- ```bash
291
- npm publish --access public
292
- git tag $(npm pkg get version | tr -d '\\"')
293
- ```
294
-
295
- <!-- ........................................................................-->
296
-
297
- ## Troubleshooting
298
-
299
- ### Checkout README.trouble.md
300
-
301
- Checkout [./README.trouble.md](./README.trouble.md)
24
+ Read [develop.md](doc/workflows/develop.md)
302
25
 
303
- ### File issues on GitHub
26
+ ## Tools
304
27
 
305
- Visit <https://github.com/rljson/rljson/issues>
28
+ Read [tools.md](doc/workflows/tools.md)
306
29
 
307
- Check if there is already an issue for your problem.
30
+ ## Superheros
308
31
 
309
- If no, report the issue.
32
+ Read [super-hero.md](doc/workflows/super-hero.md)
@@ -1,5 +1,5 @@
1
1
  import { Json } from '@rljson/json';
2
- import { NutritiveValues } from '../example/bakery-example.ts';
2
+ import { NutritionalValues } from '../example/bakery-example.ts';
3
3
  import { RljsonTable } from '../rljson.ts';
4
4
  import { Ref } from '../typedefs.ts';
5
5
  /**
@@ -13,4 +13,4 @@ export type PropertiesTable<T extends Json> = RljsonTable<T, 'properties'>;
13
13
  /**
14
14
  * Provides an example collectionsTable for test purposes
15
15
  */
16
- export declare const examplePropertiesTable: () => PropertiesTable<NutritiveValues>;
16
+ export declare const examplePropertiesTable: () => PropertiesTable<NutritionalValues>;
@@ -13,18 +13,14 @@ export interface ColumnCfg extends Json {
13
13
  * The jsonKey of the column used in data
14
14
  */
15
15
  jsonKey: JsonKey;
16
- /**
17
- * A short name of the column to be shown in the table header
18
- */
19
- nameShort: string;
20
- /**
21
- * A unshorted name to be shown in the tool tip
22
- */
23
- name: string;
24
16
  /**
25
17
  * Average number of characters in the column
26
18
  */
27
19
  avgChars?: number;
20
+ /**
21
+ * Maximum number of characters in the column
22
+ */
23
+ maxChars?: number;
28
24
  /**
29
25
  * The type of the column
30
26
  */
@@ -34,8 +30,13 @@ export interface ColumnCfg extends Json {
34
30
  * Describes the configuration of a table, i.e. table metadata and columns
35
31
  */
36
32
  export interface TableCfg extends Json {
37
- name: string;
33
+ /**
34
+ * Technical lower camel case json identifier of the table
35
+ */
38
36
  jsonKey: JsonKey;
37
+ /**
38
+ * A short description of the table
39
+ */
39
40
  columns: Record<JsonKey, ColumnCfg>;
40
41
  }
41
42
  /**
@@ -9,14 +9,14 @@ import { Ref } from '../typedefs.ts';
9
9
  export interface Ingredient extends Json {
10
10
  name: string;
11
11
  amountUnit: 'g' | 'ml';
12
- nutritiveValuesRef: Ref;
12
+ nutritionalValuesRef: Ref;
13
13
  }
14
14
  export interface RecipeIngredient extends Json {
15
15
  ingredientsRef: string;
16
16
  quantity: number;
17
17
  }
18
18
  export type IngredientsTypeTable = PropertiesTable<Ingredient>;
19
- export interface NutritiveValues extends Json {
19
+ export interface NutritionalValues extends Json {
20
20
  energy: number;
21
21
  fat: number;
22
22
  protein: number;
@@ -30,6 +30,6 @@ export interface Bakery extends Rljson {
30
30
  recipes: CollectionsTable;
31
31
  recipeIngredients: PropertiesTable<RecipeIngredient>;
32
32
  ingredients: PropertiesTable<Ingredient>;
33
- nutritiveValues: PropertiesTable<NutritiveValues>;
33
+ nutritionalValues: PropertiesTable<NutritionalValues>;
34
34
  }
35
35
  export declare const bakeryExample: () => Bakery;
package/dist/rljson.js CHANGED
@@ -5,114 +5,123 @@ import { hip, hsh } from "@rljson/hash";
5
5
  import { exampleJsonObject, jsonValueTypes, jsonValueMatchesType } from "@rljson/json";
6
6
  // @license
7
7
  const bakeryExample = () => {
8
- const result = {
9
- _idSets: {
10
- _type: "idSets",
11
- _data: [
12
- {
13
- add: ["slice0", "slice1"],
14
- _hash: "Ko990SJfgPJvNGxC63CRf7"
15
- }
16
- ],
17
- _hash: "NiojsJvZ7iEU7WeMWttzyJ"
18
- },
19
- buffets: {
20
- _type: "buffets",
21
- _data: [
22
- {
23
- items: [
24
- {
25
- table: "cakes",
26
- ref: "KdLv3zTftqKKUeqYrTtO2r"
27
- }
28
- ]
29
- }
30
- ]
31
- },
32
- cakes: {
33
- _type: "cakes",
34
- _data: [
35
- {
36
- idSet: "Ko990SJfgPJvNGxC63CRf7",
37
- collections: "layers",
38
- layers: {
39
- _hash: "RBNvo1WzZ4oRRq0W9-hknp"
40
- },
41
- _hash: "KdLv3zTftqKKUeqYrTtO2r"
42
- }
43
- ]
44
- },
45
- slices: {
46
- _type: "idSets",
47
- _data: [
48
- {
49
- add: ["slice0", "slice1"],
50
- remove: [],
51
- _hash: "wyYfK5E4ArrMKQ_zvi2-EE"
8
+ const nutritionalValues = hip({
9
+ _type: "properties",
10
+ _data: [
11
+ {
12
+ energy: 364,
13
+ fat: 0.98,
14
+ protein: 10.33,
15
+ carbohydrates: 76.31,
16
+ _hash: ""
17
+ }
18
+ ],
19
+ _hash: ""
20
+ });
21
+ const ingredients = hip({
22
+ _type: "properties",
23
+ _data: [
24
+ {
25
+ name: "flour",
26
+ amountUnit: "g",
27
+ nutritionalValuesRef: nutritionalValues._data[0]._hash,
28
+ _hash: ""
29
+ }
30
+ ],
31
+ _hash: ""
32
+ });
33
+ const recipeIngredients = hip({
34
+ _type: "properties",
35
+ _data: [
36
+ {
37
+ ingredientsRef: ingredients._data[0]._hash,
38
+ quantity: 500,
39
+ _hash: ""
40
+ }
41
+ ],
42
+ _hash: ""
43
+ });
44
+ const recipes = hip({
45
+ _type: "collections",
46
+ _data: [
47
+ {
48
+ properties: "recipeIngredients",
49
+ assign: {
50
+ flour: recipeIngredients._data[0]._hash
51
+ },
52
+ _hash: ""
53
+ }
54
+ ]
55
+ });
56
+ const layers = hip({
57
+ _type: "collections",
58
+ _data: [
59
+ {
60
+ properties: "recipes",
61
+ assign: {
62
+ slice0: recipes._data[0]._hash,
63
+ slice1: recipes._data[0]._hash
52
64
  }
53
- ],
54
- _hash: "Qt6FzyzwHdEdYC3fKUXaAm"
55
- },
56
- layers: {
57
- _type: "collections",
58
- _data: [
59
- {
60
- properties: "recipes",
61
- assign: {
62
- slice0: "uRTo_Jmt9lOA09e2QnwB9W",
63
- slice1: "uRTo_Jmt9lOA09e2QnwB9W"
65
+ }
66
+ ]
67
+ });
68
+ const slices = hip({
69
+ _type: "idSets",
70
+ _data: [
71
+ {
72
+ add: ["slice0", "slice1"],
73
+ remove: [],
74
+ _hash: ""
75
+ }
76
+ ],
77
+ _hash: ""
78
+ });
79
+ const _idSets = hip({
80
+ _type: "idSets",
81
+ _data: [
82
+ {
83
+ add: ["slice0", "slice1"],
84
+ _hash: ""
85
+ }
86
+ ],
87
+ _hash: ""
88
+ });
89
+ const cakes = hip({
90
+ _type: "cakes",
91
+ _data: [
92
+ {
93
+ idSet: _idSets._data[0]._hash,
94
+ collections: "layers",
95
+ layers: {
96
+ flour: layers._data[0]._hash
97
+ },
98
+ _hash: ""
99
+ }
100
+ ]
101
+ });
102
+ const buffets = hip({
103
+ _type: "buffets",
104
+ _data: [
105
+ {
106
+ items: [
107
+ {
108
+ table: "cakes",
109
+ ref: cakes._data[0]._hash
64
110
  }
65
- }
66
- ]
67
- },
68
- recipes: {
69
- _type: "collections",
70
- _data: [
71
- {
72
- properties: "recipeIngredients",
73
- assign: {
74
- flour: "RCA4yzQe6mYOqquoLijKop"
75
- },
76
- _hash: "uRTo_Jmt9lOA09e2QnwB9W"
77
- }
78
- ]
79
- },
80
- recipeIngredients: {
81
- _type: "properties",
82
- _data: [
83
- {
84
- ingredientsRef: "CdSJV-WOfnFT1svec3iJ6x",
85
- quantity: 500,
86
- _hash: "RCA4yzQe6mYOqquoLijKop"
87
- }
88
- ],
89
- _hash: "R6dJq4ZJ3QDa9Bz8QJDhNq"
90
- },
91
- ingredients: {
92
- _type: "properties",
93
- _data: [
94
- {
95
- name: "flour",
96
- amountUnit: "g",
97
- nutritiveValuesRef: "gZXFSlrl5QAs5hOVsq5sWB",
98
- _hash: "CdSJV-WOfnFT1svec3iJ6x"
99
- }
100
- ],
101
- _hash: "FgJeTM0NcZvXwFcU-PD8Jf"
102
- },
103
- nutritiveValues: {
104
- _type: "properties",
105
- _data: [
106
- {
107
- energy: 364,
108
- fat: 0.98,
109
- protein: 10.33,
110
- carbohydrates: 76.31,
111
- _hash: "gZXFSlrl5QAs5hOVsq5sWB"
112
- }
113
- ],
114
- _hash: "7k4OqQtk71w3yVGMoA9F6p"
115
- }
111
+ ]
112
+ }
113
+ ]
114
+ });
115
+ const result = {
116
+ _idSets,
117
+ buffets,
118
+ cakes,
119
+ slices,
120
+ layers,
121
+ recipes,
122
+ recipeIngredients,
123
+ ingredients,
124
+ nutritionalValues
116
125
  };
117
126
  return result;
118
127
  };
@@ -125,7 +134,7 @@ const exampleCollectionsTable = () => bakeryExample().layers;
125
134
  // @license
126
135
  const exampleIdSetsTable = () => bakeryExample().slices;
127
136
  // @license
128
- const examplePropertiesTable = () => bakeryExample().nutritiveValues;
137
+ const examplePropertiesTable = () => bakeryExample().nutritionalValues;
129
138
  // @license
130
139
  const _Example = class _Example {
131
140
  };
@@ -532,7 +541,7 @@ const exampleTypedefs = () => {
532
541
  // @license
533
542
  class BaseValidator {
534
543
  constructor() {
535
- __publicField(this, "name", "syntax");
544
+ __publicField(this, "name", "base");
536
545
  }
537
546
  async validate(rljson) {
538
547
  return this.validateSync(rljson);
@@ -1172,7 +1181,7 @@ class Validate {
1172
1181
  return result.reduce((acc, errors) => {
1173
1182
  let hasErrors = false;
1174
1183
  for (const key of Object.keys(errors)) {
1175
- const e = Object.keys(errors[key]);
1184
+ const e = Object.keys(errors[key]).filter((k) => k !== "hasErrors");
1176
1185
  if (e.length > 0) {
1177
1186
  hasErrors = true;
1178
1187
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/rljson",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "packageManager": "pnpm@10.6.3",
5
5
  "description": "The RLJSON data format specification",
6
6
  "homepage": "https://github.com/rljson/rljson",