@rljson/io 0.0.1 → 0.0.4

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.
@@ -1,21 +1,39 @@
1
- # Contributors
2
-
3
- ## Important
4
-
5
- ⚠️ IMPORTANT: On `Windows, please checkout the repo on drive C`.
6
- There is a bug in the Vscode vitest extension v 1.14.4, making debugging tests
7
- not work. <https://github.com/vitest-dev/vscode/issues/548>
8
- Please check from time to time, if the issue is fixed and remove this hint.
9
-
10
- ## Report issues
11
-
12
- Visit <https://github.com/rljson/io/issues>
13
-
14
- Check if there is already an issue for your problem
15
-
16
- If no, report the issue
17
-
18
- ## Check out
1
+ <!--
2
+
3
+ -->
4
+
5
+ # Contributors Guide
6
+
7
+ - [Install](#install)
8
+ - [Check out](#check-out)
9
+ - [Install pnpm](#install-pnpm)
10
+ - [Install dependencies](#install-dependencies)
11
+ - [Install Vscode extensions](#install-vscode-extensions)
12
+ - [Uninstall Jest and Jasmine](#uninstall-jest-and-jasmine)
13
+ - [Install GitHub CLI](#install-github-cli)
14
+ - [Develop](#develop)
15
+ - [Read architecture doc](#read-architecture-doc)
16
+ - [Checkout main](#checkout-main)
17
+ - [Create a branch](#create-a-branch)
18
+ - [Debug](#debug)
19
+ - [Update goldens](#update-goldens)
20
+ - [Test and Build](#test-and-build)
21
+ - [Commit](#commit)
22
+ - [Update dependencies](#update-dependencies)
23
+ - [Increase version](#increase-version)
24
+ - [Create a pull request](#create-a-pull-request)
25
+ - [Wait until PR is merged](#wait-until-pr-is-merged)
26
+ - [Delete feature branch](#delete-feature-branch)
27
+ - [Publish to NPM](#publish-to-npm)
28
+ - [Troubleshooting](#troubleshooting)
29
+ - [Checkout README.trouble.md](#checkout-readmetroublemd)
30
+ - [File issues on GitHub](#file-issues-on-github)
31
+
32
+ <!-- ........................................................................-->
33
+
34
+ ## Install
35
+
36
+ ### Check out
19
37
 
20
38
  ```bash
21
39
  mkdir rljson
@@ -24,7 +42,7 @@ git clone https://github.com/rljson/io.git
24
42
  cd io
25
43
  ```
26
44
 
27
- ## Install pnpm
45
+ ### Install pnpm
28
46
 
29
47
  Windows:
30
48
 
@@ -38,106 +56,176 @@ Mac:
38
56
  sudo corepack enable pnpm
39
57
  ```
40
58
 
41
- ## Install dependencies
59
+ ### Install dependencies
42
60
 
43
61
  ```bash
44
62
  pnpm install
45
63
  ```
46
64
 
47
- ## Run the tests
65
+ ### Install Vscode extensions
66
+
67
+ Open this project in `vscode`.
68
+
69
+ Press `Cmd+Shift+P`.
70
+
71
+ Type `Extensions: Show Recommended Extensions` and press `Enter`.
72
+
73
+ The recommended extensions will be shown.
74
+
75
+ Make sure, all recommended extensions are shown.
76
+
77
+ ### Uninstall Jest and Jasmine
78
+
79
+ Jest or Jasmine extensions conflict with the `Vitest` extension used for this
80
+ project.
81
+
82
+ Uninstall them, if you have installed them.
83
+
84
+ ### Install GitHub CLI
85
+
86
+ Install GitHub CLI on Mac
48
87
 
49
88
  ```bash
50
- pnpm run test
89
+ brew install gh
51
90
  ```
52
91
 
53
- ## Build the package
92
+ Login
54
93
 
55
94
  ```bash
56
- pnpm run build
95
+ gh auth login
57
96
  ```
58
97
 
59
- ## Publish the package
98
+ <!-- ........................................................................-->
99
+
100
+ ## Develop
60
101
 
61
- Open `package.json`.
102
+ ### Read architecture doc
62
103
 
63
- Increase `version`.
104
+ Read [README.architecture.md](./README.architecture.md) to get an overview
105
+ of the package's architecture.
64
106
 
65
- Compile typescript:
107
+ ### Checkout main
66
108
 
67
109
  ```bash
68
- pnpm run build
110
+ git checkout main && \
111
+ git fetch && \
112
+ git pull
69
113
  ```
70
114
 
71
- Make publish dry-run
115
+ ### Create a branch
116
+
117
+ Please replace `Commit Message` in the next command by your commit message.
118
+ It will also used for branch name and pull request
72
119
 
73
120
  ```bash
74
- pnpm publish --access=public --dry-run
121
+ export MESSAGE="Fix small things in README" && \
122
+ export BRANCH=`echo "$MESSAGE" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9_]/_/g'` &&\
123
+ git checkout -b $BRANCH
75
124
  ```
76
125
 
77
- Check the changes to uploaded
126
+ ### Debug
127
+
128
+ In Vscode: At the `left side bar` click on the `Test tube` icon to open the `Test explorer`.
129
+
130
+ At the `top`, click on the `refresh` icon to show update the tests.
131
+
132
+ Open a test file (`*.spec.ts`)
78
133
 
79
- Publish the package
134
+ Set a breakpoint.
135
+
136
+ Press `alt` and click on the play button left beside the test.
137
+
138
+ Execution should stop at the breakpoint.
139
+
140
+ ### Update goldens
141
+
142
+ In various tests we are creating golden files, that are reference files that
143
+ are compared against the files created in the tests.
80
144
 
81
145
  ```bash
82
- pnpm publish --access=public
146
+ pnpm updateGoldens
83
147
  ```
84
148
 
85
- ## Architecture
149
+ ### Test and Build
86
150
 
87
- Reade [README.architecture.md](./README.architecture.md) to get an overview
88
- of the package's architecture.
151
+ ```bash
152
+ pnpm test &&\
153
+ pnpm build
154
+ ```
89
155
 
90
- ## Install Vscode extensions
156
+ ### Commit
91
157
 
92
- Open this project in `vscode`.
158
+ Develop your feature
93
159
 
94
- Press `Cmd+Shift+P`.
160
+ Commit your changes
95
161
 
96
- Type `Extensions: Show Recommended Extensions` and press `Enter`.
162
+ ```bash
163
+ git commit -am"$MESSAGE"
164
+ ```
97
165
 
98
- The recommended extensions will be shown.
166
+ ### Update dependencies
99
167
 
100
- Make sure, all recommended extensions are shown.
168
+ We aim to work with the latest versions of our dependencies.
101
169
 
102
- ## Uninstall all test extensions, e.g. Jest or Jasmine
170
+ ```bash
171
+ pnpm update --latest &&\
172
+ git commit -am"Update dependencies"
173
+ ```
103
174
 
104
- Jest or Jasmine extensions conflict with the `Vitest` extension used for this
105
- project.
175
+ ### Increase version
106
176
 
107
- Uninstall them, if you have installed them.
177
+ ```bash
178
+ pnpm version patch --no-git-tag-version && \
179
+ git commit -am"Increase version"
180
+ ```
108
181
 
109
- ## Debug tests
182
+ ### Create a pull request
110
183
 
111
- In Vscode: At the `left side bar` click on the `Test tube` icon to open the `Test explorer`.
184
+ ```bash
185
+ git push -u origin $BRANCH && \
186
+ gh pr create --base main --title "$MESSAGE" --body "" && \
187
+ gh pr merge --auto --squash
188
+ ```
112
189
 
113
- At the `top`, click on the `refresh` icon to show update the tests.
190
+ ### Wait until PR is merged
114
191
 
115
- Open a test file (`*.spec.ts`)
192
+ Get the PR URL with the following command
116
193
 
117
- Set a breakpoint.
194
+ ```bash
195
+ gh pr view --json url -q .url
196
+ ```
118
197
 
119
- Press `alt` and click on the play button left beside the test.
198
+ Visit it
120
199
 
121
- Execution should stop at the breakpoint.
200
+ ### Delete feature branch
122
201
 
123
- ## Update goldens
202
+ ```bash
203
+ git fetch && git checkout main && \
204
+ git reset --soft origin/main && \
205
+ git stash -m"PR Aftermath" && \
206
+ git pull && \
207
+ git branch -d $BRANCH
208
+ ```
124
209
 
125
- In various tests we are creating golden files, that are reference files that
126
- are compared against the files created in the tests.
210
+ ### Publish to NPM
127
211
 
128
- If change is detected, the fest fail.
212
+ ```bash
213
+ npm publish --access public && \
214
+ git tag $(npm pkg get version | tr -d '\\"')
215
+ ```
129
216
 
130
- An example is `test/goldens/README.md` which is compared against
131
- `dist/README.md`.
217
+ <!-- ........................................................................-->
132
218
 
133
- If the changes are desired, update the golden files:
219
+ ## Troubleshooting
134
220
 
135
- Open `update-goldens.ts`
221
+ ### Checkout README.trouble.md
136
222
 
137
- Set `export const updateGoldens` to `true`
223
+ Checkout [./README.trouble.md](./README.trouble.md)
138
224
 
139
- Run tests again.
225
+ ### File issues on GitHub
226
+
227
+ Visit <https://github.com/rljson/io/issues>
140
228
 
141
- Set `export const updateGoldens` to `false`.
229
+ Check if there is already an issue for your problem.
142
230
 
143
- Run tests again.
231
+ If no, report the issue.
@@ -1,21 +1,39 @@
1
- # Contributors
2
-
3
- ## Important
4
-
5
- ⚠️ IMPORTANT: On `Windows, please checkout the repo on drive C`.
6
- There is a bug in the Vscode vitest extension v 1.14.4, making debugging tests
7
- not work. <https://github.com/vitest-dev/vscode/issues/548>
8
- Please check from time to time, if the issue is fixed and remove this hint.
9
-
10
- ## Report issues
11
-
12
- Visit <https://github.com/rljson/io/issues>
13
-
14
- Check if there is already an issue for your problem
15
-
16
- If no, report the issue
17
-
18
- ## Check out
1
+ <!--
2
+
3
+ -->
4
+
5
+ # Contributors Guide
6
+
7
+ - [Install](#install)
8
+ - [Check out](#check-out)
9
+ - [Install pnpm](#install-pnpm)
10
+ - [Install dependencies](#install-dependencies)
11
+ - [Install Vscode extensions](#install-vscode-extensions)
12
+ - [Uninstall Jest and Jasmine](#uninstall-jest-and-jasmine)
13
+ - [Install GitHub CLI](#install-github-cli)
14
+ - [Develop](#develop)
15
+ - [Read architecture doc](#read-architecture-doc)
16
+ - [Checkout main](#checkout-main)
17
+ - [Create a branch](#create-a-branch)
18
+ - [Debug](#debug)
19
+ - [Update goldens](#update-goldens)
20
+ - [Test and Build](#test-and-build)
21
+ - [Commit](#commit)
22
+ - [Update dependencies](#update-dependencies)
23
+ - [Increase version](#increase-version)
24
+ - [Create a pull request](#create-a-pull-request)
25
+ - [Wait until PR is merged](#wait-until-pr-is-merged)
26
+ - [Delete feature branch](#delete-feature-branch)
27
+ - [Publish to NPM](#publish-to-npm)
28
+ - [Troubleshooting](#troubleshooting)
29
+ - [Checkout README.trouble.md](#checkout-readmetroublemd)
30
+ - [File issues on GitHub](#file-issues-on-github)
31
+
32
+ <!-- ........................................................................-->
33
+
34
+ ## Install
35
+
36
+ ### Check out
19
37
 
20
38
  ```bash
21
39
  mkdir rljson
@@ -24,7 +42,7 @@ git clone https://github.com/rljson/io.git
24
42
  cd io
25
43
  ```
26
44
 
27
- ## Install pnpm
45
+ ### Install pnpm
28
46
 
29
47
  Windows:
30
48
 
@@ -38,106 +56,176 @@ Mac:
38
56
  sudo corepack enable pnpm
39
57
  ```
40
58
 
41
- ## Install dependencies
59
+ ### Install dependencies
42
60
 
43
61
  ```bash
44
62
  pnpm install
45
63
  ```
46
64
 
47
- ## Run the tests
65
+ ### Install Vscode extensions
66
+
67
+ Open this project in `vscode`.
68
+
69
+ Press `Cmd+Shift+P`.
70
+
71
+ Type `Extensions: Show Recommended Extensions` and press `Enter`.
72
+
73
+ The recommended extensions will be shown.
74
+
75
+ Make sure, all recommended extensions are shown.
76
+
77
+ ### Uninstall Jest and Jasmine
78
+
79
+ Jest or Jasmine extensions conflict with the `Vitest` extension used for this
80
+ project.
81
+
82
+ Uninstall them, if you have installed them.
83
+
84
+ ### Install GitHub CLI
85
+
86
+ Install GitHub CLI on Mac
48
87
 
49
88
  ```bash
50
- pnpm run test
89
+ brew install gh
51
90
  ```
52
91
 
53
- ## Build the package
92
+ Login
54
93
 
55
94
  ```bash
56
- pnpm run build
95
+ gh auth login
57
96
  ```
58
97
 
59
- ## Publish the package
98
+ <!-- ........................................................................-->
99
+
100
+ ## Develop
60
101
 
61
- Open `package.json`.
102
+ ### Read architecture doc
62
103
 
63
- Increase `version`.
104
+ Read [README.architecture.md](./README.architecture.md) to get an overview
105
+ of the package's architecture.
64
106
 
65
- Compile typescript:
107
+ ### Checkout main
66
108
 
67
109
  ```bash
68
- pnpm run build
110
+ git checkout main && \
111
+ git fetch && \
112
+ git pull
69
113
  ```
70
114
 
71
- Make publish dry-run
115
+ ### Create a branch
116
+
117
+ Please replace `Commit Message` in the next command by your commit message.
118
+ It will also used for branch name and pull request
72
119
 
73
120
  ```bash
74
- pnpm publish --access=public --dry-run
121
+ export MESSAGE="Fix small things in README" && \
122
+ export BRANCH=`echo "$MESSAGE" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9_]/_/g'` &&\
123
+ git checkout -b $BRANCH
75
124
  ```
76
125
 
77
- Check the changes to uploaded
126
+ ### Debug
127
+
128
+ In Vscode: At the `left side bar` click on the `Test tube` icon to open the `Test explorer`.
129
+
130
+ At the `top`, click on the `refresh` icon to show update the tests.
131
+
132
+ Open a test file (`*.spec.ts`)
78
133
 
79
- Publish the package
134
+ Set a breakpoint.
135
+
136
+ Press `alt` and click on the play button left beside the test.
137
+
138
+ Execution should stop at the breakpoint.
139
+
140
+ ### Update goldens
141
+
142
+ In various tests we are creating golden files, that are reference files that
143
+ are compared against the files created in the tests.
80
144
 
81
145
  ```bash
82
- pnpm publish --access=public
146
+ pnpm updateGoldens
83
147
  ```
84
148
 
85
- ## Architecture
149
+ ### Test and Build
86
150
 
87
- Reade [README.architecture.md](./README.architecture.md) to get an overview
88
- of the package's architecture.
151
+ ```bash
152
+ pnpm test &&\
153
+ pnpm build
154
+ ```
89
155
 
90
- ## Install Vscode extensions
156
+ ### Commit
91
157
 
92
- Open this project in `vscode`.
158
+ Develop your feature
93
159
 
94
- Press `Cmd+Shift+P`.
160
+ Commit your changes
95
161
 
96
- Type `Extensions: Show Recommended Extensions` and press `Enter`.
162
+ ```bash
163
+ git commit -am"$MESSAGE"
164
+ ```
97
165
 
98
- The recommended extensions will be shown.
166
+ ### Update dependencies
99
167
 
100
- Make sure, all recommended extensions are shown.
168
+ We aim to work with the latest versions of our dependencies.
101
169
 
102
- ## Uninstall all test extensions, e.g. Jest or Jasmine
170
+ ```bash
171
+ pnpm update --latest &&\
172
+ git commit -am"Update dependencies"
173
+ ```
103
174
 
104
- Jest or Jasmine extensions conflict with the `Vitest` extension used for this
105
- project.
175
+ ### Increase version
106
176
 
107
- Uninstall them, if you have installed them.
177
+ ```bash
178
+ pnpm version patch --no-git-tag-version && \
179
+ git commit -am"Increase version"
180
+ ```
108
181
 
109
- ## Debug tests
182
+ ### Create a pull request
110
183
 
111
- In Vscode: At the `left side bar` click on the `Test tube` icon to open the `Test explorer`.
184
+ ```bash
185
+ git push -u origin $BRANCH && \
186
+ gh pr create --base main --title "$MESSAGE" --body "" && \
187
+ gh pr merge --auto --squash
188
+ ```
112
189
 
113
- At the `top`, click on the `refresh` icon to show update the tests.
190
+ ### Wait until PR is merged
114
191
 
115
- Open a test file (`*.spec.ts`)
192
+ Get the PR URL with the following command
116
193
 
117
- Set a breakpoint.
194
+ ```bash
195
+ gh pr view --json url -q .url
196
+ ```
118
197
 
119
- Press `alt` and click on the play button left beside the test.
198
+ Visit it
120
199
 
121
- Execution should stop at the breakpoint.
200
+ ### Delete feature branch
122
201
 
123
- ## Update goldens
202
+ ```bash
203
+ git fetch && git checkout main && \
204
+ git reset --soft origin/main && \
205
+ git stash -m"PR Aftermath" && \
206
+ git pull && \
207
+ git branch -d $BRANCH
208
+ ```
124
209
 
125
- In various tests we are creating golden files, that are reference files that
126
- are compared against the files created in the tests.
210
+ ### Publish to NPM
127
211
 
128
- If change is detected, the fest fail.
212
+ ```bash
213
+ npm publish --access public && \
214
+ git tag $(npm pkg get version | tr -d '\\"')
215
+ ```
129
216
 
130
- An example is `test/goldens/README.md` which is compared against
131
- `dist/README.md`.
217
+ <!-- ........................................................................-->
132
218
 
133
- If the changes are desired, update the golden files:
219
+ ## Troubleshooting
134
220
 
135
- Open `update-goldens.ts`
221
+ ### Checkout README.trouble.md
136
222
 
137
- Set `export const updateGoldens` to `true`
223
+ Checkout [./README.trouble.md](./README.trouble.md)
138
224
 
139
- Run tests again.
225
+ ### File issues on GitHub
226
+
227
+ Visit <https://github.com/rljson/io/issues>
140
228
 
141
- Set `export const updateGoldens` to `false`.
229
+ Check if there is already an issue for your problem.
142
230
 
143
- Run tests again.
231
+ If no, report the issue.
package/dist/io.d.ts CHANGED
@@ -1,11 +1,22 @@
1
- import { Rljson } from '@rljson/rljson';
1
+ import { ContentType, Rljson } from '@rljson/rljson';
2
2
  export interface Io {
3
+ /** A promise resolving once the Io interface is ready */
4
+ isReady(): Promise<void>;
5
+ /** Returns the complete db content as Rljson */
6
+ dump(): Promise<Rljson>;
7
+ /** Creates a table with a given type */
8
+ createTable(request: {
9
+ name: string;
10
+ type: ContentType;
11
+ }): Promise<void>;
12
+ /** Writes Rljson data in to the database */
3
13
  write(request: {
4
14
  data: Rljson;
5
15
  }): Promise<void>;
16
+ /** Reads a specific row from a database table */
6
17
  readRow(request: {
7
18
  table: string;
8
- where: Record<string, any>;
19
+ rowHash: string;
9
20
  }): Promise<Rljson>;
10
21
  }
11
22
  export declare const exampleIo = "Checkout @rljson/io-mem for an example implementation";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/io",
3
- "version": "0.0.1",
3
+ "version": "0.0.4",
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",
@@ -51,12 +51,13 @@
51
51
  "pnpm": {
52
52
  "onlyBuiltDependencies": [
53
53
  "esbuild"
54
- ]
54
+ ],
55
+ "overrides": {}
55
56
  },
56
57
  "dependencies": {
57
58
  "@rljson/hash": "^0.0.9",
58
59
  "@rljson/json": "^0.0.7",
59
- "@rljson/rljson": "^0.0.6",
60
+ "@rljson/rljson": "^0.0.7",
60
61
  "@rljson/validate": "^0.0.4"
61
62
  }
62
63
  }