@rljson/io 0.0.1 → 0.0.3

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