@rljson/io 0.0.19 → 0.0.20
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/io-init.d.ts +11 -0
- package/dist/io-mem.d.ts +1 -0
- package/dist/io.js +43 -13
- package/package.json +2 -2
|
@@ -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
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.
|
|
3
|
+
"version": "0.0.20",
|
|
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",
|
|
@@ -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.
|
|
62
|
+
"@rljson/rljson": "^0.0.37",
|
|
63
63
|
"@rljson/validate": "^0.0.9"
|
|
64
64
|
}
|
|
65
65
|
}
|