@rljson/rljson 0.0.48 → 0.0.49
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/buffet.d.ts +1 -1
- package/dist/content/cake.d.ts +1 -1
- package/dist/content/ingredients.d.ts +1 -1
- package/dist/content/layer.d.ts +1 -1
- package/dist/content/revision.d.ts +1 -1
- package/dist/content/slice-ids.d.ts +1 -1
- package/dist/content/table-cfg.d.ts +1 -1
- package/dist/rljson.d.ts +2 -4
- package/dist/rljson.js +0 -52
- package/dist/validate/base-validator.d.ts +0 -1
- package/package.json +1 -1
package/dist/content/buffet.d.ts
CHANGED
package/dist/content/cake.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type IngredientsRef = Ref;
|
|
|
8
8
|
/**
|
|
9
9
|
* A table containing ingredients
|
|
10
10
|
*/
|
|
11
|
-
export type IngredientsTable<T extends JsonWithId> = RljsonTable<T
|
|
11
|
+
export type IngredientsTable<T extends JsonWithId> = RljsonTable<T>;
|
|
12
12
|
/**
|
|
13
13
|
* Provides an example ingredients table for test purposes
|
|
14
14
|
*/
|
package/dist/content/layer.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export interface Revision extends Json {
|
|
|
30
30
|
/**
|
|
31
31
|
* A table containing revisions
|
|
32
32
|
*/
|
|
33
|
-
export type RevisionsTable = RljsonTable<Revision
|
|
33
|
+
export type RevisionsTable = RljsonTable<Revision>;
|
|
34
34
|
/**
|
|
35
35
|
* Example revision object for test purposes
|
|
36
36
|
*/
|
|
@@ -25,7 +25,7 @@ export interface SliceIds extends Json {
|
|
|
25
25
|
/**
|
|
26
26
|
* A table containing slice ids
|
|
27
27
|
*/
|
|
28
|
-
export type SliceIdsTable = RljsonTable<SliceIds
|
|
28
|
+
export type SliceIdsTable = RljsonTable<SliceIds>;
|
|
29
29
|
/**
|
|
30
30
|
* Returns one of the layers of the example cake
|
|
31
31
|
*/
|
|
@@ -66,7 +66,7 @@ export interface TableCfg extends Json {
|
|
|
66
66
|
/**
|
|
67
67
|
* A table containing columns
|
|
68
68
|
*/
|
|
69
|
-
export type TablesCfgTable = RljsonTable<TableCfg
|
|
69
|
+
export type TablesCfgTable = RljsonTable<TableCfg>;
|
|
70
70
|
/**
|
|
71
71
|
* Throws an error if the table configuration is not valid.
|
|
72
72
|
* @param tableCfg - The table configuration to check
|
package/dist/rljson.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ 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 {
|
|
9
|
+
import { Ref, TableKey } from './typedefs.ts';
|
|
10
10
|
export declare const reservedFieldNames: string[];
|
|
11
11
|
export declare const reservedTableKeys: string[];
|
|
12
12
|
/**
|
|
@@ -45,11 +45,9 @@ 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
|
|
48
|
+
export interface RljsonTable<Data extends Json> extends Json {
|
|
49
49
|
/** The data rows of the table */
|
|
50
50
|
_data: Data[];
|
|
51
|
-
/** The type of the table. If not set, the type is "ingredients" */
|
|
52
|
-
_type: Type;
|
|
53
51
|
/** The columns configuration of the table */
|
|
54
52
|
_tableCfg?: TableCfgRef;
|
|
55
53
|
}
|
package/dist/rljson.js
CHANGED
|
@@ -751,14 +751,12 @@ class _BaseValidator {
|
|
|
751
751
|
() => this._columnNamesNotLowerCamelCase(),
|
|
752
752
|
() => this._dataNotFound(),
|
|
753
753
|
() => this._dataHasWrongType(),
|
|
754
|
-
() => this._invalidTableTypes(),
|
|
755
754
|
// Check table cfg
|
|
756
755
|
() => this._tableCfgsReferencedTableKeyNotFound(),
|
|
757
756
|
() => this._tableCfgsHaveWrongType(),
|
|
758
757
|
() => this._tableCfgNotFound(),
|
|
759
758
|
() => this._missingColumnConfigs(),
|
|
760
759
|
() => this._dataDoesNotMatchColumnConfig(),
|
|
761
|
-
() => this._tableTypesDoNotMatch(),
|
|
762
760
|
() => this._tableCfgHasRootHeadSharedError(),
|
|
763
761
|
() => this._rootOrHeadTableHasNoIdColumn(),
|
|
764
762
|
// Check references
|
|
@@ -1041,35 +1039,6 @@ class _BaseValidator {
|
|
|
1041
1039
|
}
|
|
1042
1040
|
}
|
|
1043
1041
|
// ...........................................................................
|
|
1044
|
-
_tableTypesDoNotMatch() {
|
|
1045
|
-
const rljson = this.rljson;
|
|
1046
|
-
const tablesWithTypeMissmatch = [];
|
|
1047
|
-
for (const tableKey of this.tableKeys) {
|
|
1048
|
-
const table = rljson[tableKey];
|
|
1049
|
-
const cfgRef = table._tableCfg;
|
|
1050
|
-
if (!cfgRef) {
|
|
1051
|
-
continue;
|
|
1052
|
-
}
|
|
1053
|
-
const cfg = this.rljsonIndexed.tableCfgs._data[cfgRef];
|
|
1054
|
-
const typeShould = cfg.type;
|
|
1055
|
-
const typeIs = table._type;
|
|
1056
|
-
if (typeShould !== typeIs) {
|
|
1057
|
-
tablesWithTypeMissmatch.push({
|
|
1058
|
-
table: tableKey,
|
|
1059
|
-
typeInTable: typeIs,
|
|
1060
|
-
typeInConfig: typeShould,
|
|
1061
|
-
tableCfg: cfgRef
|
|
1062
|
-
});
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
if (tablesWithTypeMissmatch.length > 0) {
|
|
1066
|
-
this.errors.tableTypesDoNotMatch = {
|
|
1067
|
-
error: "Table types do not match table config",
|
|
1068
|
-
tables: tablesWithTypeMissmatch
|
|
1069
|
-
};
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
// ...........................................................................
|
|
1073
1042
|
_tableCfgHasRootHeadSharedError() {
|
|
1074
1043
|
const rljson = this.rljson;
|
|
1075
1044
|
const inconsistentTableCfgs = [];
|
|
@@ -1158,27 +1127,6 @@ class _BaseValidator {
|
|
|
1158
1127
|
}
|
|
1159
1128
|
}
|
|
1160
1129
|
// ...........................................................................
|
|
1161
|
-
_invalidTableTypes() {
|
|
1162
|
-
const rljson = this.rljson;
|
|
1163
|
-
const tablesWithWrongType = [];
|
|
1164
|
-
for (const tableKey of this.tableKeys) {
|
|
1165
|
-
const table = rljson[tableKey];
|
|
1166
|
-
const type = table._type;
|
|
1167
|
-
if (contentTypes.indexOf(type) === -1) {
|
|
1168
|
-
tablesWithWrongType.push({
|
|
1169
|
-
table: tableKey,
|
|
1170
|
-
type,
|
|
1171
|
-
allowedTypes: contentTypes.join(" | ")
|
|
1172
|
-
});
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
if (tablesWithWrongType.length > 0) {
|
|
1176
|
-
this.errors.invalidTableTypes = {
|
|
1177
|
-
error: "Tables with invalid types",
|
|
1178
|
-
tables: tablesWithWrongType
|
|
1179
|
-
};
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
1130
|
_refsNotFound() {
|
|
1183
1131
|
const missingRefs = [];
|
|
1184
1132
|
iterateTablesSync(this.rljson, (tableKey, table) => {
|
|
@@ -9,7 +9,6 @@ export interface BaseErrors extends Errors {
|
|
|
9
9
|
hashesNotValid?: Json;
|
|
10
10
|
dataNotFound?: Json;
|
|
11
11
|
dataHasWrongType?: Json;
|
|
12
|
-
invalidTableTypes?: Json;
|
|
13
12
|
tableCfgsReferencedTableKeyNotFound?: Json;
|
|
14
13
|
columnsHaveWrongType?: Json;
|
|
15
14
|
tableCfgReferencedNotFound?: Json;
|