@rljson/io 0.0.17 → 0.0.18

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 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.
@@ -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.
@@ -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
@@ -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 |
@@ -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)
@@ -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
package/dist/io-mem.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { JsonValue } from '@rljson/json';
2
- import { Rljson } from '@rljson/rljson';
2
+ import { Rljson, TableCfg } from '@rljson/rljson';
3
3
  import { Io } from './io.ts';
4
4
  /**
5
5
  * In-Memory implementation of the Rljson Io interface.
@@ -22,9 +22,10 @@ export declare class IoMem implements Io {
22
22
  data: Rljson;
23
23
  }): Promise<void>;
24
24
  createTable(request: {
25
- tableCfg: string;
25
+ tableCfg: TableCfg;
26
26
  }): Promise<void>;
27
- tables(): Promise<Rljson>;
27
+ tableCfgs(): Promise<Rljson>;
28
+ allTableNames(): Promise<string[]>;
28
29
  private _isReady;
29
30
  private _mem;
30
31
  private _init;
package/dist/io.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { JsonValue } from '@rljson/json';
2
- import { Rljson } from '@rljson/rljson';
2
+ import { Rljson, TableCfg } from '@rljson/rljson';
3
3
  export interface Io {
4
4
  /** A promise resolving once the Io interface is ready
5
5
  *
@@ -18,10 +18,16 @@ export interface Io {
18
18
  * The config must be already in the database
19
19
  */
20
20
  createTable(request: {
21
- tableCfg: string;
21
+ tableCfg: TableCfg;
22
22
  }): Promise<void>;
23
- /** Returns the available table names */
24
- tables(): Promise<Rljson>;
23
+ /**
24
+ * Returns a json structure returning current table configurations
25
+ */
26
+ tableCfgs(): Promise<Rljson>;
27
+ /**
28
+ * Returns an rljson with all available tables without data
29
+ */
30
+ allTableNames(): Promise<string[]>;
25
31
  /** Writes Rljson data in to the database */
26
32
  write(request: {
27
33
  data: Rljson;
package/dist/io.js CHANGED
@@ -65,26 +65,28 @@ const _IoMem = class _IoMem {
65
65
  createTable(request) {
66
66
  return this._createTable(request);
67
67
  }
68
- async tables() {
69
- const tables = [];
70
- for (const key of Object.keys(this._mem)) {
71
- const table = this._mem[key];
72
- const tableCfgRef = table._tableCfg;
73
- if (tableCfgRef) {
74
- for (const tableCfg of this._mem.tableCfgs._data) {
75
- if (tableCfg._hash === tableCfgRef) {
76
- tables.push(tableCfg);
77
- }
78
- }
68
+ async tableCfgs() {
69
+ const tables = this._mem.tableCfgs._data;
70
+ const newestVersion = {};
71
+ for (const table of tables) {
72
+ const existing = newestVersion[table.key];
73
+ if (!existing) {
74
+ newestVersion[table.key] = table;
75
+ } else if (table.version > existing.version) {
76
+ newestVersion[table.key] = table;
79
77
  }
80
78
  }
81
- const result = {
79
+ const resultData = Object.values(newestVersion);
80
+ return hip({
82
81
  tableCfgs: {
83
82
  _type: "ingredients",
84
- _data: tables
83
+ _data: resultData
85
84
  }
86
- };
87
- return hip(result);
85
+ });
86
+ }
87
+ async allTableNames() {
88
+ const tables = Object.keys(this._mem).filter((key) => !key.startsWith("_"));
89
+ return tables;
88
90
  }
89
91
  // ...........................................................................
90
92
  async _init() {
@@ -94,21 +96,26 @@ const _IoMem = class _IoMem {
94
96
  // ...........................................................................
95
97
  async _createTable(request) {
96
98
  var _a;
97
- const config = this._mem.tableCfgs._data.find(
98
- (cfg) => cfg._hash === request.tableCfg
99
- );
100
- if (!config) {
101
- throw new Error(`Table config ${request.tableCfg} not found`);
102
- }
103
- const { key, type } = config;
99
+ const { key, type } = request.tableCfg;
104
100
  const existing = this._mem[key];
105
101
  if (existing) {
106
102
  throw new Error(`Table ${key} already exists`);
107
103
  }
104
+ const newConfig = hsh(request.tableCfg);
105
+ const existingConfig = this._mem.tableCfgs._data.find(
106
+ (cfg) => cfg._hash === newConfig._hash
107
+ );
108
+ if (!existingConfig) {
109
+ this._mem.tableCfgs._data.push(newConfig);
110
+ this._mem.tableCfgs._hash = "";
111
+ const updateExistingHashes = false;
112
+ const throwIfOnWrongHashes = false;
113
+ hip(this._mem.tableCfgs, updateExistingHashes, throwIfOnWrongHashes);
114
+ }
108
115
  const table = {
109
116
  _data: [],
110
117
  _type: type,
111
- _tableCfg: config._hash
118
+ _tableCfg: newConfig._hash
112
119
  };
113
120
  (_a = this._mem)[key] ?? (_a[key] = hip(table));
114
121
  }
@@ -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._hash });
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._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.17",
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": "npx vite build && tsc && node scripts/copy-readme-to-dist.js && node scripts/copy-file.js src/example.ts dist/src",
25
- "test": "npx vitest run --coverage && npm run lint",
26
- "prebuild": "npm run test",
27
- "prepublishOnly": "npm run build && npm run test",
28
- "lint": "npx eslint",
29
- "updateGoldens": "cross-env UPDATE_GOLDENS=true npm test"
30
- },
31
- "devDependencies": {
32
- "@types/node": "^22.13.14",
33
- "@typescript-eslint/eslint-plugin": "^8.28.0",
34
- "@typescript-eslint/parser": "^8.28.0",
35
- "@vitest/coverage-v8": "^3.0.9",
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.28.0",
45
- "vite": "^6.2.3",
46
- "vite-node": "^3.0.9",
47
- "vite-plugin-dts": "^4.5.3",
48
- "vite-tsconfig-paths": "^5.1.4",
49
- "vitest": "^3.0.9",
50
- "vitest-dom": "^0.1.1"
51
- },
52
- "pnpm": {
53
- "onlyBuiltDependencies": [
54
- "esbuild"
55
- ],
56
- "overrides": {}
57
- },
58
- "dependencies": {
59
- "@rljson/hash": "^0.0.12",
60
- "@rljson/is-ready": "^0.0.17",
61
- "@rljson/json": "^0.0.18",
62
- "@rljson/rljson": "^0.0.32",
63
- "@rljson/validate": "^0.0.9"
64
- }
65
- }
1
+ {
2
+ "name": "@rljson/io",
3
+ "version": "0.0.18",
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.14",
33
+ "@typescript-eslint/eslint-plugin": "^8.28.0",
34
+ "@typescript-eslint/parser": "^8.28.0",
35
+ "@vitest/coverage-v8": "^3.0.9",
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.28.0",
45
+ "vite": "^6.2.3",
46
+ "vite-node": "^3.0.9",
47
+ "vite-plugin-dts": "^4.5.3",
48
+ "vite-tsconfig-paths": "^5.1.4",
49
+ "vitest": "^3.0.9",
50
+ "vitest-dom": "^0.1.1"
51
+ },
52
+ "pnpm": {
53
+ "onlyBuiltDependencies": [
54
+ "esbuild"
55
+ ],
56
+ "overrides": {}
57
+ },
58
+ "dependencies": {
59
+ "@rljson/hash": "^0.0.12",
60
+ "@rljson/is-ready": "^0.0.17",
61
+ "@rljson/json": "^0.0.18",
62
+ "@rljson/rljson": "^0.0.32",
63
+ "@rljson/validate": "^0.0.9"
64
+ }
65
+ }