@rljson/io 0.0.19 → 0.0.21

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.
@@ -0,0 +1,11 @@
1
+ import { TableCfg } from '@rljson/rljson';
2
+ import { Io } from './io.ts';
3
+ /**
4
+ * Initialization tools for Io
5
+ */
6
+ export declare class IoInit {
7
+ readonly io: Io;
8
+ constructor(io: Io);
9
+ get tableCfg(): TableCfg;
10
+ initRevisionsTable: () => Promise<void>;
11
+ }
package/dist/io-mem.d.ts CHANGED
@@ -28,6 +28,7 @@ export declare class IoMem implements Io {
28
28
  allTableNames(): Promise<string[]>;
29
29
  private _isReady;
30
30
  private _mem;
31
+ private _ioInit;
31
32
  private _init;
32
33
  private _initTableCfgs;
33
34
  private _createTable;
package/dist/io.js CHANGED
@@ -5,6 +5,45 @@ import { hip, hsh } from "@rljson/hash";
5
5
  import { IsReady } from "@rljson/is-ready";
6
6
  import { copy, equals } from "@rljson/json";
7
7
  // @license
8
+ class IoInit {
9
+ constructor(io) {
10
+ __publicField(this, "initRevisionsTable", async () => {
11
+ const tableCfg = {
12
+ version: 1,
13
+ key: "revisions",
14
+ type: "ingredients",
15
+ isHead: false,
16
+ isRoot: false,
17
+ isShared: true,
18
+ columns: {
19
+ table: { type: "string" },
20
+ predecessor: { type: "string" },
21
+ successor: { type: "string" },
22
+ timestamp: { type: "number" },
23
+ id: { type: "string" }
24
+ }
25
+ };
26
+ await this.io.createTable({ tableCfg });
27
+ });
28
+ this.io = io;
29
+ }
30
+ get tableCfg() {
31
+ const tableCfg = hip({
32
+ version: 1,
33
+ key: "tableCfgs",
34
+ type: "ingredients",
35
+ isHead: false,
36
+ isRoot: false,
37
+ isShared: true,
38
+ columns: {
39
+ key: { type: "string" },
40
+ type: { type: "string" }
41
+ }
42
+ });
43
+ return tableCfg;
44
+ }
45
+ }
46
+ // @license
8
47
  const _IoMem = class _IoMem {
9
48
  // ...........................................................................
10
49
  // Constructor & example
@@ -14,21 +53,10 @@ const _IoMem = class _IoMem {
14
53
  // ######################
15
54
  __publicField(this, "_isReady", new IsReady());
16
55
  __publicField(this, "_mem", hip({}));
56
+ __publicField(this, "_ioInit");
17
57
  // ...........................................................................
18
58
  __publicField(this, "_initTableCfgs", () => {
19
- const tableCfg = {
20
- version: 1,
21
- key: "tableCfgs",
22
- type: "ingredients",
23
- isHead: false,
24
- isRoot: false,
25
- isShared: true,
26
- columns: {
27
- key: { type: "string", previous: "string" },
28
- type: { type: "string", previous: "string" }
29
- }
30
- };
31
- hip(tableCfg);
59
+ const tableCfg = this._ioInit.tableCfg;
32
60
  this._mem.tableCfgs = hip({
33
61
  _data: [tableCfg],
34
62
  _type: "ingredients",
@@ -91,7 +119,9 @@ const _IoMem = class _IoMem {
91
119
  }
92
120
  // ...........................................................................
93
121
  async _init() {
122
+ this._ioInit = new IoInit(this);
94
123
  this._initTableCfgs();
124
+ await this._ioInit.initRevisionsTable();
95
125
  this._isReady.resolve();
96
126
  }
97
127
  // ...........................................................................
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/io",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "packageManager": "pnpm@10.6.2",
5
5
  "description": "Low level interface for reading and writing RLJSON data",
6
6
  "homepage": "https://github.com/rljson/io",
@@ -29,20 +29,20 @@
29
29
  "updateGoldens": "cross-env UPDATE_GOLDENS=true pnpm test"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "^22.13.17",
33
- "@typescript-eslint/eslint-plugin": "^8.29.0",
34
- "@typescript-eslint/parser": "^8.29.0",
32
+ "@types/node": "^22.14.1",
33
+ "@typescript-eslint/eslint-plugin": "^8.30.1",
34
+ "@typescript-eslint/parser": "^8.30.1",
35
35
  "@vitest/coverage-v8": "^3.1.1",
36
36
  "cross-env": "^7.0.3",
37
- "eslint": "^9.23.0",
37
+ "eslint": "^9.24.0",
38
38
  "eslint-plugin-jsdoc": "^50.6.9",
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
- "typescript": "~5.8.2",
44
- "typescript-eslint": "^8.29.0",
45
- "vite": "^6.2.4",
43
+ "typescript": "~5.8.3",
44
+ "typescript-eslint": "^8.30.1",
45
+ "vite": "^6.2.6",
46
46
  "vite-node": "^3.1.1",
47
47
  "vite-plugin-dts": "^4.5.3",
48
48
  "vite-tsconfig-paths": "^5.1.4",
@@ -59,7 +59,7 @@
59
59
  "@rljson/hash": "^0.0.13",
60
60
  "@rljson/is-ready": "^0.0.17",
61
61
  "@rljson/json": "^0.0.18",
62
- "@rljson/rljson": "^0.0.36",
62
+ "@rljson/rljson": "^0.0.38",
63
63
  "@rljson/validate": "^0.0.9"
64
64
  }
65
65
  }