@rljson/io 0.0.18 → 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/LICENSE +21 -21
- package/README.architecture.md +1 -1
- package/README.blog.md +3 -3
- package/README.contributors.md +32 -32
- package/README.md +18 -18
- package/README.public.md +7 -7
- package/README.trouble.md +36 -36
- package/dist/README.architecture.md +1 -1
- package/dist/README.blog.md +3 -3
- package/dist/README.contributors.md +32 -32
- package/dist/README.md +18 -18
- package/dist/README.public.md +7 -7
- package/dist/README.trouble.md +36 -36
- package/dist/io-init.d.ts +11 -0
- package/dist/io-mem.d.ts +1 -0
- package/dist/io.d.ts +1 -1
- package/dist/io.js +47 -18
- package/dist/reverse-ref.d.ts +39 -0
- package/dist/src/example.ts +58 -58
- package/package.json +65 -65
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Rljson
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Rljson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.architecture.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# Architecture
|
|
1
|
+
# Architecture
|
package/README.blog.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# Blog
|
|
2
|
-
|
|
3
|
-
Add latest posts at the end.
|
|
1
|
+
# Blog
|
|
2
|
+
|
|
3
|
+
Add latest posts at the end.
|
package/README.contributors.md
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@license
|
|
3
|
-
Copyright (c) 2025 Rljson
|
|
4
|
-
|
|
5
|
-
Use of this source code is governed by terms that can be
|
|
6
|
-
found in the LICENSE file in the root of this package.
|
|
7
|
-
-->
|
|
8
|
-
|
|
9
|
-
# Contributors Guide
|
|
10
|
-
|
|
11
|
-
- [Prepare](#prepare)
|
|
12
|
-
- [Develop](#develop)
|
|
13
|
-
- [Tools](#tools)
|
|
14
|
-
- [Superheros](#superheros)
|
|
15
|
-
|
|
16
|
-
## Prepare
|
|
17
|
-
|
|
18
|
-
Read [prepare.md](doc/workflows/prepare.md)
|
|
19
|
-
|
|
20
|
-
<!-- ........................................................................-->
|
|
21
|
-
|
|
22
|
-
## Develop
|
|
23
|
-
|
|
24
|
-
Read [develop.md](doc/workflows/develop.md)
|
|
25
|
-
|
|
26
|
-
## Tools
|
|
27
|
-
|
|
28
|
-
Read [tools.md](doc/workflows/tools.md)
|
|
29
|
-
|
|
30
|
-
## Superheros
|
|
31
|
-
|
|
32
|
-
Read [super-hero.md](doc/workflows/super-hero.md)
|
|
1
|
+
<!--
|
|
2
|
+
@license
|
|
3
|
+
Copyright (c) 2025 Rljson
|
|
4
|
+
|
|
5
|
+
Use of this source code is governed by terms that can be
|
|
6
|
+
found in the LICENSE file in the root of this package.
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# Contributors Guide
|
|
10
|
+
|
|
11
|
+
- [Prepare](#prepare)
|
|
12
|
+
- [Develop](#develop)
|
|
13
|
+
- [Tools](#tools)
|
|
14
|
+
- [Superheros](#superheros)
|
|
15
|
+
|
|
16
|
+
## Prepare
|
|
17
|
+
|
|
18
|
+
Read [prepare.md](doc/workflows/prepare.md)
|
|
19
|
+
|
|
20
|
+
<!-- ........................................................................-->
|
|
21
|
+
|
|
22
|
+
## Develop
|
|
23
|
+
|
|
24
|
+
Read [develop.md](doc/workflows/develop.md)
|
|
25
|
+
|
|
26
|
+
## Tools
|
|
27
|
+
|
|
28
|
+
Read [tools.md](doc/workflows/tools.md)
|
|
29
|
+
|
|
30
|
+
## Superheros
|
|
31
|
+
|
|
32
|
+
Read [super-hero.md](doc/workflows/super-hero.md)
|
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# @rljson/io
|
|
2
|
-
|
|
3
|
-
Low level interface for reading and writing RLJSON data
|
|
4
|
-
|
|
5
|
-
## Users
|
|
6
|
-
|
|
7
|
-
| File | Purpose |
|
|
8
|
-
| ------------------------------------ | --------------------------- |
|
|
9
|
-
| [README.public.md](README.public.md) | Install and use the package |
|
|
10
|
-
|
|
11
|
-
## Contributors
|
|
12
|
-
|
|
13
|
-
| File | Purpose |
|
|
14
|
-
| ------------------------------------------------ | ----------------------------- |
|
|
15
|
-
| [README.contributors.md](README.contributors.md) | Run, debug, build and publish |
|
|
16
|
-
| [README.architecture.md](README.architecture.md) | Software architecture guide |
|
|
17
|
-
| [README.trouble.md](README.trouble.md) | Errors & solutions |
|
|
18
|
-
| [README.blog.md](README.blog.md) | Blog |
|
|
1
|
+
# @rljson/io
|
|
2
|
+
|
|
3
|
+
Low level interface for reading and writing RLJSON data
|
|
4
|
+
|
|
5
|
+
## Users
|
|
6
|
+
|
|
7
|
+
| File | Purpose |
|
|
8
|
+
| ------------------------------------ | --------------------------- |
|
|
9
|
+
| [README.public.md](README.public.md) | Install and use the package |
|
|
10
|
+
|
|
11
|
+
## Contributors
|
|
12
|
+
|
|
13
|
+
| File | Purpose |
|
|
14
|
+
| ------------------------------------------------ | ----------------------------- |
|
|
15
|
+
| [README.contributors.md](README.contributors.md) | Run, debug, build and publish |
|
|
16
|
+
| [README.architecture.md](README.architecture.md) | Software architecture guide |
|
|
17
|
+
| [README.trouble.md](README.trouble.md) | Errors & solutions |
|
|
18
|
+
| [README.blog.md](README.blog.md) | Blog |
|
package/README.public.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# @rljson/
|
|
2
|
-
|
|
3
|
-
Todo: Add description here
|
|
4
|
-
|
|
5
|
-
## Example
|
|
6
|
-
|
|
7
|
-
[src/example.ts](src/example.ts)
|
|
1
|
+
# @rljson/
|
|
2
|
+
|
|
3
|
+
Todo: Add description here
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
[src/example.ts](src/example.ts)
|
package/README.trouble.md
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
|
|
3
|
-
-->
|
|
4
|
-
|
|
5
|
-
# Trouble shooting
|
|
6
|
-
|
|
7
|
-
## Table of contents <!-- omit in toc -->
|
|
8
|
-
|
|
9
|
-
- [Vscode Windows: Debugging is not working](#vscode-windows-debugging-is-not-working)
|
|
10
|
-
- [GitHub actions: Cannot find module @rollup/rollup-linux-x64-gnu](#github-actions-cannot-find-module-rolluprollup-linux-x64-gnu)
|
|
11
|
-
|
|
12
|
-
## Vscode Windows: Debugging is not working
|
|
13
|
-
|
|
14
|
-
Date: 2025-03-08
|
|
15
|
-
|
|
16
|
-
⚠️ IMPORTANT: On Windows, please check out the repo on drive C. There is a bug
|
|
17
|
-
in the VS Code Vitest extension (v1.14.4), which prevents test debugging from
|
|
18
|
-
working: <https://github.com/vitest-dev/vscode/issues/548> Please check from
|
|
19
|
-
time to time if the issue has been fixed and remove this note once it is
|
|
20
|
-
resolved.
|
|
21
|
-
|
|
22
|
-
## GitHub actions: Cannot find module @rollup/rollup-linux-x64-gnu
|
|
23
|
-
|
|
24
|
-
⚠️ Error: Cannot find module @rollup/rollup-linux-x64-gnu. npm has a bug related to
|
|
25
|
-
optional dependencies (<https://github.com/npm/cli/issues/4828>). Please try `npm
|
|
26
|
-
i` again after removing both package-lock.json and node_modules directory.
|
|
27
|
-
|
|
28
|
-
Solution:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
rm -rf node_modules
|
|
32
|
-
rm package-lock.json
|
|
33
|
-
npm install
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Then push `package-lock.yaml` again
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
-->
|
|
4
|
+
|
|
5
|
+
# Trouble shooting
|
|
6
|
+
|
|
7
|
+
## Table of contents <!-- omit in toc -->
|
|
8
|
+
|
|
9
|
+
- [Vscode Windows: Debugging is not working](#vscode-windows-debugging-is-not-working)
|
|
10
|
+
- [GitHub actions: Cannot find module @rollup/rollup-linux-x64-gnu](#github-actions-cannot-find-module-rolluprollup-linux-x64-gnu)
|
|
11
|
+
|
|
12
|
+
## Vscode Windows: Debugging is not working
|
|
13
|
+
|
|
14
|
+
Date: 2025-03-08
|
|
15
|
+
|
|
16
|
+
⚠️ IMPORTANT: On Windows, please check out the repo on drive C. There is a bug
|
|
17
|
+
in the VS Code Vitest extension (v1.14.4), which prevents test debugging from
|
|
18
|
+
working: <https://github.com/vitest-dev/vscode/issues/548> Please check from
|
|
19
|
+
time to time if the issue has been fixed and remove this note once it is
|
|
20
|
+
resolved.
|
|
21
|
+
|
|
22
|
+
## GitHub actions: Cannot find module @rollup/rollup-linux-x64-gnu
|
|
23
|
+
|
|
24
|
+
⚠️ Error: Cannot find module @rollup/rollup-linux-x64-gnu. npm has a bug related to
|
|
25
|
+
optional dependencies (<https://github.com/npm/cli/issues/4828>). Please try `npm
|
|
26
|
+
i` again after removing both package-lock.json and node_modules directory.
|
|
27
|
+
|
|
28
|
+
Solution:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
rm -rf node_modules
|
|
32
|
+
rm package-lock.json
|
|
33
|
+
npm install
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Then push `package-lock.yaml` again
|
|
@@ -1 +1 @@
|
|
|
1
|
-
# Architecture
|
|
1
|
+
# Architecture
|
package/dist/README.blog.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# Blog
|
|
2
|
-
|
|
3
|
-
Add latest posts at the end.
|
|
1
|
+
# Blog
|
|
2
|
+
|
|
3
|
+
Add latest posts at the end.
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@license
|
|
3
|
-
Copyright (c) 2025 Rljson
|
|
4
|
-
|
|
5
|
-
Use of this source code is governed by terms that can be
|
|
6
|
-
found in the LICENSE file in the root of this package.
|
|
7
|
-
-->
|
|
8
|
-
|
|
9
|
-
# Contributors Guide
|
|
10
|
-
|
|
11
|
-
- [Prepare](#prepare)
|
|
12
|
-
- [Develop](#develop)
|
|
13
|
-
- [Tools](#tools)
|
|
14
|
-
- [Superheros](#superheros)
|
|
15
|
-
|
|
16
|
-
## Prepare
|
|
17
|
-
|
|
18
|
-
Read [prepare.md](doc/workflows/prepare.md)
|
|
19
|
-
|
|
20
|
-
<!-- ........................................................................-->
|
|
21
|
-
|
|
22
|
-
## Develop
|
|
23
|
-
|
|
24
|
-
Read [develop.md](doc/workflows/develop.md)
|
|
25
|
-
|
|
26
|
-
## Tools
|
|
27
|
-
|
|
28
|
-
Read [tools.md](doc/workflows/tools.md)
|
|
29
|
-
|
|
30
|
-
## Superheros
|
|
31
|
-
|
|
32
|
-
Read [super-hero.md](doc/workflows/super-hero.md)
|
|
1
|
+
<!--
|
|
2
|
+
@license
|
|
3
|
+
Copyright (c) 2025 Rljson
|
|
4
|
+
|
|
5
|
+
Use of this source code is governed by terms that can be
|
|
6
|
+
found in the LICENSE file in the root of this package.
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# Contributors Guide
|
|
10
|
+
|
|
11
|
+
- [Prepare](#prepare)
|
|
12
|
+
- [Develop](#develop)
|
|
13
|
+
- [Tools](#tools)
|
|
14
|
+
- [Superheros](#superheros)
|
|
15
|
+
|
|
16
|
+
## Prepare
|
|
17
|
+
|
|
18
|
+
Read [prepare.md](doc/workflows/prepare.md)
|
|
19
|
+
|
|
20
|
+
<!-- ........................................................................-->
|
|
21
|
+
|
|
22
|
+
## Develop
|
|
23
|
+
|
|
24
|
+
Read [develop.md](doc/workflows/develop.md)
|
|
25
|
+
|
|
26
|
+
## Tools
|
|
27
|
+
|
|
28
|
+
Read [tools.md](doc/workflows/tools.md)
|
|
29
|
+
|
|
30
|
+
## Superheros
|
|
31
|
+
|
|
32
|
+
Read [super-hero.md](doc/workflows/super-hero.md)
|
package/dist/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# @rljson/io
|
|
2
|
-
|
|
3
|
-
Low level interface for reading and writing RLJSON data
|
|
4
|
-
|
|
5
|
-
## Users
|
|
6
|
-
|
|
7
|
-
| File | Purpose |
|
|
8
|
-
| ------------------------------------ | --------------------------- |
|
|
9
|
-
| [README.public.md](README.public.md) | Install and use the package |
|
|
10
|
-
|
|
11
|
-
## Contributors
|
|
12
|
-
|
|
13
|
-
| File | Purpose |
|
|
14
|
-
| ------------------------------------------------ | ----------------------------- |
|
|
15
|
-
| [README.contributors.md](README.contributors.md) | Run, debug, build and publish |
|
|
16
|
-
| [README.architecture.md](README.architecture.md) | Software architecture guide |
|
|
17
|
-
| [README.trouble.md](README.trouble.md) | Errors & solutions |
|
|
18
|
-
| [README.blog.md](README.blog.md) | Blog |
|
|
1
|
+
# @rljson/io
|
|
2
|
+
|
|
3
|
+
Low level interface for reading and writing RLJSON data
|
|
4
|
+
|
|
5
|
+
## Users
|
|
6
|
+
|
|
7
|
+
| File | Purpose |
|
|
8
|
+
| ------------------------------------ | --------------------------- |
|
|
9
|
+
| [README.public.md](README.public.md) | Install and use the package |
|
|
10
|
+
|
|
11
|
+
## Contributors
|
|
12
|
+
|
|
13
|
+
| File | Purpose |
|
|
14
|
+
| ------------------------------------------------ | ----------------------------- |
|
|
15
|
+
| [README.contributors.md](README.contributors.md) | Run, debug, build and publish |
|
|
16
|
+
| [README.architecture.md](README.architecture.md) | Software architecture guide |
|
|
17
|
+
| [README.trouble.md](README.trouble.md) | Errors & solutions |
|
|
18
|
+
| [README.blog.md](README.blog.md) | Blog |
|
package/dist/README.public.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# @rljson/
|
|
2
|
-
|
|
3
|
-
Todo: Add description here
|
|
4
|
-
|
|
5
|
-
## Example
|
|
6
|
-
|
|
7
|
-
[src/example.ts](src/example.ts)
|
|
1
|
+
# @rljson/
|
|
2
|
+
|
|
3
|
+
Todo: Add description here
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
[src/example.ts](src/example.ts)
|
package/dist/README.trouble.md
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
|
|
3
|
-
-->
|
|
4
|
-
|
|
5
|
-
# Trouble shooting
|
|
6
|
-
|
|
7
|
-
## Table of contents <!-- omit in toc -->
|
|
8
|
-
|
|
9
|
-
- [Vscode Windows: Debugging is not working](#vscode-windows-debugging-is-not-working)
|
|
10
|
-
- [GitHub actions: Cannot find module @rollup/rollup-linux-x64-gnu](#github-actions-cannot-find-module-rolluprollup-linux-x64-gnu)
|
|
11
|
-
|
|
12
|
-
## Vscode Windows: Debugging is not working
|
|
13
|
-
|
|
14
|
-
Date: 2025-03-08
|
|
15
|
-
|
|
16
|
-
⚠️ IMPORTANT: On Windows, please check out the repo on drive C. There is a bug
|
|
17
|
-
in the VS Code Vitest extension (v1.14.4), which prevents test debugging from
|
|
18
|
-
working: <https://github.com/vitest-dev/vscode/issues/548> Please check from
|
|
19
|
-
time to time if the issue has been fixed and remove this note once it is
|
|
20
|
-
resolved.
|
|
21
|
-
|
|
22
|
-
## GitHub actions: Cannot find module @rollup/rollup-linux-x64-gnu
|
|
23
|
-
|
|
24
|
-
⚠️ Error: Cannot find module @rollup/rollup-linux-x64-gnu. npm has a bug related to
|
|
25
|
-
optional dependencies (<https://github.com/npm/cli/issues/4828>). Please try `npm
|
|
26
|
-
i` again after removing both package-lock.json and node_modules directory.
|
|
27
|
-
|
|
28
|
-
Solution:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
rm -rf node_modules
|
|
32
|
-
rm package-lock.json
|
|
33
|
-
npm install
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Then push `package-lock.yaml` again
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
-->
|
|
4
|
+
|
|
5
|
+
# Trouble shooting
|
|
6
|
+
|
|
7
|
+
## Table of contents <!-- omit in toc -->
|
|
8
|
+
|
|
9
|
+
- [Vscode Windows: Debugging is not working](#vscode-windows-debugging-is-not-working)
|
|
10
|
+
- [GitHub actions: Cannot find module @rollup/rollup-linux-x64-gnu](#github-actions-cannot-find-module-rolluprollup-linux-x64-gnu)
|
|
11
|
+
|
|
12
|
+
## Vscode Windows: Debugging is not working
|
|
13
|
+
|
|
14
|
+
Date: 2025-03-08
|
|
15
|
+
|
|
16
|
+
⚠️ IMPORTANT: On Windows, please check out the repo on drive C. There is a bug
|
|
17
|
+
in the VS Code Vitest extension (v1.14.4), which prevents test debugging from
|
|
18
|
+
working: <https://github.com/vitest-dev/vscode/issues/548> Please check from
|
|
19
|
+
time to time if the issue has been fixed and remove this note once it is
|
|
20
|
+
resolved.
|
|
21
|
+
|
|
22
|
+
## GitHub actions: Cannot find module @rollup/rollup-linux-x64-gnu
|
|
23
|
+
|
|
24
|
+
⚠️ Error: Cannot find module @rollup/rollup-linux-x64-gnu. npm has a bug related to
|
|
25
|
+
optional dependencies (<https://github.com/npm/cli/issues/4828>). Please try `npm
|
|
26
|
+
i` again after removing both package-lock.json and node_modules directory.
|
|
27
|
+
|
|
28
|
+
Solution:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
rm -rf node_modules
|
|
32
|
+
rm package-lock.json
|
|
33
|
+
npm install
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Then push `package-lock.yaml` again
|
|
@@ -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.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface Io {
|
|
|
28
28
|
* Returns an rljson with all available tables without data
|
|
29
29
|
*/
|
|
30
30
|
allTableNames(): Promise<string[]>;
|
|
31
|
-
/** Writes Rljson data
|
|
31
|
+
/** Writes Rljson data into the database */
|
|
32
32
|
write(request: {
|
|
33
33
|
data: Rljson;
|
|
34
34
|
}): Promise<void>;
|
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,26 +53,16 @@ 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
|
-
columns: {
|
|
24
|
-
key: { key: "key", type: "string", previous: "string" },
|
|
25
|
-
type: { key: "type", type: "string", previous: "string" }
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
hip(tableCfg);
|
|
59
|
+
const tableCfg = this._ioInit.tableCfg;
|
|
29
60
|
this._mem.tableCfgs = hip({
|
|
30
61
|
_data: [tableCfg],
|
|
31
62
|
_type: "ingredients",
|
|
32
63
|
_tableCfg: tableCfg._hash
|
|
33
64
|
});
|
|
34
|
-
|
|
35
|
-
const throwOnOnWrongHashes = false;
|
|
36
|
-
hip(this._mem, updateExistingHashes, throwOnOnWrongHashes);
|
|
65
|
+
hip(this._mem, { updateExistingHashes: true, throwOnWrongHashes: false });
|
|
37
66
|
});
|
|
38
67
|
this._init();
|
|
39
68
|
}
|
|
@@ -90,7 +119,9 @@ const _IoMem = class _IoMem {
|
|
|
90
119
|
}
|
|
91
120
|
// ...........................................................................
|
|
92
121
|
async _init() {
|
|
122
|
+
this._ioInit = new IoInit(this);
|
|
93
123
|
this._initTableCfgs();
|
|
124
|
+
await this._ioInit.initRevisionsTable();
|
|
94
125
|
this._isReady.resolve();
|
|
95
126
|
}
|
|
96
127
|
// ...........................................................................
|
|
@@ -109,8 +140,8 @@ const _IoMem = class _IoMem {
|
|
|
109
140
|
this._mem.tableCfgs._data.push(newConfig);
|
|
110
141
|
this._mem.tableCfgs._hash = "";
|
|
111
142
|
const updateExistingHashes = false;
|
|
112
|
-
const
|
|
113
|
-
hip(this._mem.tableCfgs, updateExistingHashes,
|
|
143
|
+
const throwOnWrongHashes = false;
|
|
144
|
+
hip(this._mem.tableCfgs, { updateExistingHashes, throwOnWrongHashes });
|
|
114
145
|
}
|
|
115
146
|
const table = {
|
|
116
147
|
_data: [],
|
|
@@ -161,9 +192,7 @@ const _IoMem = class _IoMem {
|
|
|
161
192
|
}
|
|
162
193
|
}
|
|
163
194
|
this._mem._hash = "";
|
|
164
|
-
|
|
165
|
-
const throwIfOnWrongHashes = false;
|
|
166
|
-
hip(this._mem, updateExistingHashes, throwIfOnWrongHashes);
|
|
195
|
+
hip(this._mem, { updateExistingHashes: false, throwOnWrongHashes: false });
|
|
167
196
|
}
|
|
168
197
|
// ...........................................................................
|
|
169
198
|
async _readRows(request) {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Json } from '@rljson/json';
|
|
2
|
+
import { Ref, Rljson, TableKey } from '@rljson/rljson';
|
|
3
|
+
/**
|
|
4
|
+
* Describes a row that references a child table row
|
|
5
|
+
*/
|
|
6
|
+
export interface ParentRef {
|
|
7
|
+
/**
|
|
8
|
+
* The parent table that references the child table
|
|
9
|
+
*/
|
|
10
|
+
[parentTable: TableKey]: {
|
|
11
|
+
/**
|
|
12
|
+
* The parent row that references the child row
|
|
13
|
+
*/
|
|
14
|
+
[parentRow: Ref]: {
|
|
15
|
+
/**
|
|
16
|
+
* Details about the reference, e.g. an array index etc.
|
|
17
|
+
*/
|
|
18
|
+
details?: Json;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Describes the parent table rows referencing a child table row
|
|
24
|
+
*/
|
|
25
|
+
export interface ReverseRefs {
|
|
26
|
+
/**
|
|
27
|
+
* The child table we need the referencing rows for
|
|
28
|
+
*/
|
|
29
|
+
[childTable: TableKey]: {
|
|
30
|
+
/**
|
|
31
|
+
* The row hashwe need the referencing rows for
|
|
32
|
+
*/
|
|
33
|
+
[childRow: Ref]: ParentRef;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Calculates the reverse references for a given rljson object
|
|
38
|
+
*/
|
|
39
|
+
export declare const calcReverseRefs: (rljson: Rljson) => ReverseRefs;
|
package/dist/src/example.ts
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
// @license
|
|
2
|
-
// Copyright (c) 2025 Rljson
|
|
3
|
-
//
|
|
4
|
-
// Use of this source code is governed by terms that can be
|
|
5
|
-
// found in the LICENSE file in the root of this package.
|
|
6
|
-
|
|
7
|
-
import { hip, hsh } from '@rljson/hash';
|
|
8
|
-
import { Rljson, TableCfg } from '@rljson/rljson';
|
|
9
|
-
|
|
10
|
-
import { IoMem } from './io-mem.ts';
|
|
11
|
-
|
|
12
|
-
// Run »pnpm updateGoldens« when you change this file
|
|
13
|
-
export const example = async () => {
|
|
14
|
-
const ioMem = new IoMem();
|
|
15
|
-
|
|
16
|
-
const row = { keyA2: 'a2' };
|
|
17
|
-
const rowWithHash = hsh(row);
|
|
18
|
-
|
|
19
|
-
// Create a table config first
|
|
20
|
-
const tableCfg = hip({
|
|
21
|
-
key: 'tableA',
|
|
22
|
-
type: 'ingredients',
|
|
23
|
-
columns: {},
|
|
24
|
-
} as TableCfg);
|
|
25
|
-
|
|
26
|
-
await ioMem.write({
|
|
27
|
-
data: {
|
|
28
|
-
tableCfgs: {
|
|
29
|
-
_type: 'ingredients',
|
|
30
|
-
_data: [tableCfg],
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// Create a table first
|
|
36
|
-
await ioMem.createTable({ tableCfg: tableCfg });
|
|
37
|
-
|
|
38
|
-
// Write data into the table
|
|
39
|
-
await ioMem.write({
|
|
40
|
-
data: {
|
|
41
|
-
tableA: {
|
|
42
|
-
_type: 'ingredients',
|
|
43
|
-
_data: [row],
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Read data from the table
|
|
49
|
-
const data: Rljson = await ioMem.readRows({
|
|
50
|
-
table: 'tableA',
|
|
51
|
-
where: { _hash: rowWithHash._hash },
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// Print the return rljson data
|
|
55
|
-
console.log(JSON.stringify(data, null, 2));
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
// example();
|
|
1
|
+
// @license
|
|
2
|
+
// Copyright (c) 2025 Rljson
|
|
3
|
+
//
|
|
4
|
+
// Use of this source code is governed by terms that can be
|
|
5
|
+
// found in the LICENSE file in the root of this package.
|
|
6
|
+
|
|
7
|
+
import { hip, hsh } from '@rljson/hash';
|
|
8
|
+
import { Rljson, TableCfg } from '@rljson/rljson';
|
|
9
|
+
|
|
10
|
+
import { IoMem } from './io-mem.ts';
|
|
11
|
+
|
|
12
|
+
// Run »pnpm updateGoldens« when you change this file
|
|
13
|
+
export const example = async () => {
|
|
14
|
+
const ioMem = new IoMem();
|
|
15
|
+
|
|
16
|
+
const row = { keyA2: 'a2' };
|
|
17
|
+
const rowWithHash = hsh(row);
|
|
18
|
+
|
|
19
|
+
// Create a table config first
|
|
20
|
+
const tableCfg = hip({
|
|
21
|
+
key: 'tableA',
|
|
22
|
+
type: 'ingredients',
|
|
23
|
+
columns: {},
|
|
24
|
+
} as TableCfg);
|
|
25
|
+
|
|
26
|
+
await ioMem.write({
|
|
27
|
+
data: {
|
|
28
|
+
tableCfgs: {
|
|
29
|
+
_type: 'ingredients',
|
|
30
|
+
_data: [tableCfg],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Create a table first
|
|
36
|
+
await ioMem.createTable({ tableCfg: tableCfg });
|
|
37
|
+
|
|
38
|
+
// Write data into the table
|
|
39
|
+
await ioMem.write({
|
|
40
|
+
data: {
|
|
41
|
+
tableA: {
|
|
42
|
+
_type: 'ingredients',
|
|
43
|
+
_data: [row],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Read data from the table
|
|
49
|
+
const data: Rljson = await ioMem.readRows({
|
|
50
|
+
table: 'tableA',
|
|
51
|
+
where: { _hash: (rowWithHash as any)._hash },
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Print the return rljson data
|
|
55
|
+
console.log(JSON.stringify(data, null, 2));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// example();
|
package/package.json
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@rljson/io",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"packageManager": "pnpm@10.6.2",
|
|
5
|
-
"description": "Low level interface for reading and writing RLJSON data",
|
|
6
|
-
"homepage": "https://github.com/rljson/io",
|
|
7
|
-
"bugs": "https://github.com/rljson/io/issues",
|
|
8
|
-
"private": false,
|
|
9
|
-
"license": "MIT",
|
|
10
|
-
"engines": {
|
|
11
|
-
"node": ">=22.14.0"
|
|
12
|
-
},
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/rljson/io.git"
|
|
16
|
-
},
|
|
17
|
-
"main": "dist/io.js",
|
|
18
|
-
"types": "dist/index.d.ts",
|
|
19
|
-
"files": [
|
|
20
|
-
"dist"
|
|
21
|
-
],
|
|
22
|
-
"type": "module",
|
|
23
|
-
"scripts": {
|
|
24
|
-
"build": "pnpx vite build && tsc && node scripts/copy-readme-to-dist.js && node scripts/copy-file.js src/example.ts dist/src",
|
|
25
|
-
"test": "pnpx vitest run --coverage && pnpm run lint",
|
|
26
|
-
"prebuild": "pnpm run test",
|
|
27
|
-
"prepublishOnly": "pnpm run build && pnpm run test",
|
|
28
|
-
"lint": "pnpx eslint",
|
|
29
|
-
"updateGoldens": "cross-env UPDATE_GOLDENS=true pnpm test"
|
|
30
|
-
},
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"@types/node": "^22.13.
|
|
33
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
34
|
-
"@typescript-eslint/parser": "^8.
|
|
35
|
-
"@vitest/coverage-v8": "^3.
|
|
36
|
-
"cross-env": "^7.0.3",
|
|
37
|
-
"eslint": "^9.23.0",
|
|
38
|
-
"eslint-plugin-jsdoc": "^50.6.9",
|
|
39
|
-
"eslint-plugin-tsdoc": "^0.4.0",
|
|
40
|
-
"globals": "^16.0.0",
|
|
41
|
-
"jsdoc": "^4.0.4",
|
|
42
|
-
"read-pkg": "^9.0.1",
|
|
43
|
-
"typescript": "~5.8.2",
|
|
44
|
-
"typescript-eslint": "^8.
|
|
45
|
-
"vite": "^6.2.
|
|
46
|
-
"vite-node": "^3.
|
|
47
|
-
"vite-plugin-dts": "^4.5.3",
|
|
48
|
-
"vite-tsconfig-paths": "^5.1.4",
|
|
49
|
-
"vitest": "^3.
|
|
50
|
-
"vitest-dom": "^0.1.1"
|
|
51
|
-
},
|
|
52
|
-
"pnpm": {
|
|
53
|
-
"onlyBuiltDependencies": [
|
|
54
|
-
"esbuild"
|
|
55
|
-
],
|
|
56
|
-
"overrides": {}
|
|
57
|
-
},
|
|
58
|
-
"dependencies": {
|
|
59
|
-
"@rljson/hash": "^0.0.
|
|
60
|
-
"@rljson/is-ready": "^0.0.17",
|
|
61
|
-
"@rljson/json": "^0.0.18",
|
|
62
|
-
"@rljson/rljson": "^0.0.
|
|
63
|
-
"@rljson/validate": "^0.0.9"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@rljson/io",
|
|
3
|
+
"version": "0.0.20",
|
|
4
|
+
"packageManager": "pnpm@10.6.2",
|
|
5
|
+
"description": "Low level interface for reading and writing RLJSON data",
|
|
6
|
+
"homepage": "https://github.com/rljson/io",
|
|
7
|
+
"bugs": "https://github.com/rljson/io/issues",
|
|
8
|
+
"private": false,
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=22.14.0"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/rljson/io.git"
|
|
16
|
+
},
|
|
17
|
+
"main": "dist/io.js",
|
|
18
|
+
"types": "dist/index.d.ts",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "pnpx vite build && tsc && node scripts/copy-readme-to-dist.js && node scripts/copy-file.js src/example.ts dist/src",
|
|
25
|
+
"test": "pnpx vitest run --coverage && pnpm run lint",
|
|
26
|
+
"prebuild": "pnpm run test",
|
|
27
|
+
"prepublishOnly": "pnpm run build && pnpm run test",
|
|
28
|
+
"lint": "pnpx eslint",
|
|
29
|
+
"updateGoldens": "cross-env UPDATE_GOLDENS=true pnpm test"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^22.13.17",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^8.29.0",
|
|
34
|
+
"@typescript-eslint/parser": "^8.29.0",
|
|
35
|
+
"@vitest/coverage-v8": "^3.1.1",
|
|
36
|
+
"cross-env": "^7.0.3",
|
|
37
|
+
"eslint": "^9.23.0",
|
|
38
|
+
"eslint-plugin-jsdoc": "^50.6.9",
|
|
39
|
+
"eslint-plugin-tsdoc": "^0.4.0",
|
|
40
|
+
"globals": "^16.0.0",
|
|
41
|
+
"jsdoc": "^4.0.4",
|
|
42
|
+
"read-pkg": "^9.0.1",
|
|
43
|
+
"typescript": "~5.8.2",
|
|
44
|
+
"typescript-eslint": "^8.29.0",
|
|
45
|
+
"vite": "^6.2.4",
|
|
46
|
+
"vite-node": "^3.1.1",
|
|
47
|
+
"vite-plugin-dts": "^4.5.3",
|
|
48
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
49
|
+
"vitest": "^3.1.1",
|
|
50
|
+
"vitest-dom": "^0.1.1"
|
|
51
|
+
},
|
|
52
|
+
"pnpm": {
|
|
53
|
+
"onlyBuiltDependencies": [
|
|
54
|
+
"esbuild"
|
|
55
|
+
],
|
|
56
|
+
"overrides": {}
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@rljson/hash": "^0.0.13",
|
|
60
|
+
"@rljson/is-ready": "^0.0.17",
|
|
61
|
+
"@rljson/json": "^0.0.18",
|
|
62
|
+
"@rljson/rljson": "^0.0.37",
|
|
63
|
+
"@rljson/validate": "^0.0.9"
|
|
64
|
+
}
|
|
65
|
+
}
|