@rljson/rljson 0.0.19 → 0.0.22

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.
@@ -16,7 +16,7 @@ export type CakeLayerId = ItemId;
16
16
  export interface Cake extends Json {
17
17
  /**
18
18
  * The item ids of the collection. If present, the item ids in the layers
19
- * must match these ids. The item id sets can be found in the _idSets table.
19
+ * must match these ids. The item id sets can be found in the idSets table.
20
20
  */
21
21
  idSet?: IdSetRef;
22
22
  /**
@@ -17,7 +17,7 @@ export interface Collection extends Json {
17
17
  base?: CollectionRef;
18
18
  /**
19
19
  * The item ids of the collection. If presnet, the item ids in `assign`
20
- * must match these ids. The item id sets can be found in the _idSets table.
20
+ * must match these ids. The item id sets can be found in the idSets table.
21
21
  */
22
22
  idSet?: IdSetRef;
23
23
  /**
package/dist/rljson.d.ts CHANGED
@@ -39,7 +39,7 @@ export type RljsonPrivate = {
39
39
  /**
40
40
  * Column configurations used accross the Rljson object
41
41
  */
42
- _tableCfgs?: TablesCfgTable;
42
+ tableCfgs?: TablesCfgTable;
43
43
  };
44
44
  /** An example rljson object */
45
45
  export declare const exampleRljson: () => Rljson;
package/dist/rljson.js CHANGED
@@ -76,7 +76,7 @@ const bakeryExample = () => {
76
76
  ],
77
77
  _hash: ""
78
78
  });
79
- const _idSets = hip({
79
+ const idSets = hip({
80
80
  _type: "idSets",
81
81
  _data: [
82
82
  {
@@ -90,7 +90,7 @@ const bakeryExample = () => {
90
90
  _type: "cakes",
91
91
  _data: [
92
92
  {
93
- idSet: _idSets._data[0]._hash,
93
+ idSet: idSets._data[0]._hash,
94
94
  collections: "layers",
95
95
  layers: {
96
96
  flour: layers._data[0]._hash
@@ -113,7 +113,7 @@ const bakeryExample = () => {
113
113
  ]
114
114
  });
115
115
  const result = {
116
- _idSets,
116
+ idSets,
117
117
  buffets,
118
118
  cakes,
119
119
  slices,
@@ -219,7 +219,7 @@ __publicField(_Example, "ok", {
219
219
  ]
220
220
  };
221
221
  const result = {
222
- _tableCfgs: tableCfgs,
222
+ tableCfgs,
223
223
  table: {
224
224
  _type: "properties",
225
225
  _tableCfg: "R-rCQ4YwYYJAp6uAo6S_6n",
@@ -284,7 +284,7 @@ __publicField(_Example, "ok", {
284
284
  },
285
285
  complete: () => {
286
286
  return {
287
- _idSets: {
287
+ idSets: {
288
288
  _type: "idSets",
289
289
  _data: [
290
290
  {
@@ -421,7 +421,7 @@ __publicField(_Example, "broken", {
421
421
  tableCfg: {
422
422
  wrongType: () => {
423
423
  const result = _Example.ok.singleRow();
424
- const tableCfg = result._tableCfgs._data[0];
424
+ const tableCfg = result.tableCfgs._data[0];
425
425
  tableCfg.columns["int"].type = "numberBroken";
426
426
  return hip(result, true, false);
427
427
  }
@@ -492,7 +492,7 @@ __publicField(_Example, "broken", {
492
492
  });
493
493
  let Example = _Example;
494
494
  // @license
495
- const exampleTableCfgTable = () => Example.ok.singleRow()._tableCfgs;
495
+ const exampleTableCfgTable = () => Example.ok.singleRow().tableCfgs;
496
496
  // @license
497
497
  const rljsonIndexed = (rljson) => {
498
498
  const result = {};
@@ -518,7 +518,7 @@ const rljsonIndexed = (rljson) => {
518
518
  };
519
519
  // @license
520
520
  const reservedFieldNames = ["_type", "_data"];
521
- const reservedTableNames = ["_hash", "_tables", "_columns"];
521
+ const reservedTableNames = ["_hash", "idSets", "tableCfgs"];
522
522
  const exampleRljson = () => Example.ok.singleRow();
523
523
  const iterateTables = (rljson, callback) => {
524
524
  for (const tableName in rljson) {
@@ -580,8 +580,8 @@ class _BaseValidator {
580
580
  () => this._dataNotFound(),
581
581
  () => this._dataHasWrongType(),
582
582
  // Check table cfg
583
- () => this._tableCfgsReferencedTableNameNotFound(),
584
- () => this._tableCfgsHaveWrongType(),
583
+ () => this.tableCfgsReferencedTableNameNotFound(),
584
+ () => this.tableCfgsHaveWrongType(),
585
585
  () => this._tableCfgNotFound(),
586
586
  () => this._missingColumnConfigs(),
587
587
  () => this._dataDoesNotMatchColumnConfig(),
@@ -704,8 +704,8 @@ class _BaseValidator {
704
704
  }
705
705
  }
706
706
  // ...........................................................................
707
- _tableCfgsReferencedTableNameNotFound() {
708
- const tableCfgs = this.rljson._tableCfgs;
707
+ tableCfgsReferencedTableNameNotFound() {
708
+ const tableCfgs = this.rljson.tableCfgs;
709
709
  if (!tableCfgs) {
710
710
  return;
711
711
  }
@@ -721,14 +721,14 @@ class _BaseValidator {
721
721
  }
722
722
  if (brokenCfgs.length > 0) {
723
723
  this.errors.tableCfgsReferencedTableNameNotFound = {
724
- error: "Tables referenced in _tableCfgs not found",
724
+ error: "Tables referenced in tableCfgs not found",
725
725
  brokenCfgs
726
726
  };
727
727
  }
728
728
  }
729
729
  // ...........................................................................
730
- _tableCfgsHaveWrongType() {
731
- const tableCfgs = this.rljson._tableCfgs;
730
+ tableCfgsHaveWrongType() {
731
+ const tableCfgs = this.rljson.tableCfgs;
732
732
  if (!tableCfgs) {
733
733
  return;
734
734
  }
@@ -757,7 +757,7 @@ class _BaseValidator {
757
757
  }
758
758
  // ...........................................................................
759
759
  _tableCfgNotFound() {
760
- const tableCfgs = this.rljsonIndexed._tableCfgs;
760
+ const tableCfgs = this.rljsonIndexed.tableCfgs;
761
761
  const tableCfgNotFound = [];
762
762
  iterateTables(this.rljson, (tableName, table) => {
763
763
  const tableCfgRef = table._tableCfg;
@@ -782,7 +782,7 @@ class _BaseValidator {
782
782
  }
783
783
  // ...........................................................................
784
784
  _missingColumnConfigs() {
785
- const tableCfgs = this.rljsonIndexed._tableCfgs;
785
+ const tableCfgs = this.rljsonIndexed.tableCfgs;
786
786
  const missingColumnConfigs = [];
787
787
  iterateTables(this.rljson, (tableName, table) => {
788
788
  const tableCfgRef = table._tableCfg;
@@ -799,7 +799,8 @@ class _BaseValidator {
799
799
  (key) => processedColumnKeys.indexOf(key) === -1
800
800
  );
801
801
  for (const columnKey of newColumnKey) {
802
- if (!tableCfgData.columns[columnKey]) {
802
+ const columns = tableCfgData.columns;
803
+ if (!columns[columnKey]) {
803
804
  missingColumnConfigs.push({
804
805
  tableCfg: tableCfgRef,
805
806
  row: row._hash,
@@ -820,7 +821,7 @@ class _BaseValidator {
820
821
  }
821
822
  // ...........................................................................
822
823
  _dataDoesNotMatchColumnConfig() {
823
- const tableCfgs = this.rljsonIndexed._tableCfgs;
824
+ const tableCfgs = this.rljsonIndexed.tableCfgs;
824
825
  const brokenValues = [];
825
826
  iterateTables(this.rljson, (tableName, table) => {
826
827
  const tableCfgRef = table._tableCfg;
@@ -833,7 +834,8 @@ class _BaseValidator {
833
834
  (key) => !key.startsWith("_")
834
835
  );
835
836
  for (const columnKey of columnKeys) {
836
- const columnConfig = tableCfgData.columns[columnKey];
837
+ const columns = tableCfgData.columns;
838
+ const columnConfig = columns[columnKey];
837
839
  const value = row[columnKey];
838
840
  if (value == null || value == void 0) {
839
841
  continue;
@@ -955,7 +957,7 @@ class _BaseValidator {
955
957
  if (table._type !== "collections") {
956
958
  return;
957
959
  }
958
- const idSets = this.rljsonIndexed._idSets;
960
+ const idSets = this.rljsonIndexed.idSets;
959
961
  const collectionsTable = table;
960
962
  for (const collection of collectionsTable._data) {
961
963
  const idSetRef = collection.idSet;
@@ -1035,7 +1037,7 @@ class _BaseValidator {
1035
1037
  if (table._type !== "cakes") {
1036
1038
  return;
1037
1039
  }
1038
- const idSets = this.rljsonIndexed._idSets;
1040
+ const idSets = this.rljsonIndexed.idSets;
1039
1041
  const cakesTable = table;
1040
1042
  for (const cake of cakesTable._data) {
1041
1043
  const idSetRef = cake.idSet;
@@ -97,7 +97,7 @@ export class Example {
97
97
  };
98
98
 
99
99
  const result: Rljson = {
100
- _tableCfgs: tableCfgs,
100
+ tableCfgs: tableCfgs,
101
101
  table: {
102
102
  _type: 'properties',
103
103
  _tableCfg: 'R-rCQ4YwYYJAp6uAo6S_6n',
@@ -166,7 +166,7 @@ export class Example {
166
166
  },
167
167
  complete: (): Rljson => {
168
168
  return {
169
- _idSets: {
169
+ idSets: {
170
170
  _type: 'idSets',
171
171
 
172
172
  _data: [
@@ -312,7 +312,7 @@ export class Example {
312
312
  tableCfg: {
313
313
  wrongType: () => {
314
314
  const result = Example.ok.singleRow();
315
- const tableCfg = result._tableCfgs._data[0];
315
+ const tableCfg = result.tableCfgs._data[0];
316
316
  tableCfg.columns['int'].type = 'numberBroken'; // Break one of the types
317
317
  return hip(result, true, false);
318
318
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/rljson",
3
- "version": "0.0.19",
3
+ "version": "0.0.22",
4
4
  "packageManager": "pnpm@10.6.3",
5
5
  "description": "The RLJSON data format specification",
6
6
  "homepage": "https://github.com/rljson/rljson",
@@ -29,19 +29,19 @@
29
29
  "updateGoldens": "cross-env UPDATE_GOLDENS=true npm test"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "^22.13.10",
33
- "@typescript-eslint/eslint-plugin": "^8.26.1",
34
- "@typescript-eslint/parser": "^8.26.1",
32
+ "@types/node": "^22.13.11",
33
+ "@typescript-eslint/eslint-plugin": "^8.27.0",
34
+ "@typescript-eslint/parser": "^8.27.0",
35
35
  "@vitest/coverage-v8": "^3.0.9",
36
36
  "cross-env": "^7.0.3",
37
- "eslint": "^9.22.0",
37
+ "eslint": "^9.23.0",
38
38
  "eslint-plugin-jsdoc": "^50.6.8",
39
39
  "eslint-plugin-tsdoc": "^0.4.0",
40
40
  "globals": "^16.0.0",
41
41
  "jsdoc": "^4.0.4",
42
42
  "read-pkg": "^9.0.1",
43
43
  "typescript": "~5.8.2",
44
- "typescript-eslint": "^8.26.1",
44
+ "typescript-eslint": "^8.27.0",
45
45
  "vite": "^6.2.2",
46
46
  "vite-node": "^3.0.9",
47
47
  "vite-plugin-dts": "^4.5.3",