@bridgebrew/storage-sqlite 0.0.0-stage → 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.
- package/LICENSE +21 -0
- package/README.md +19 -2
- package/package.json +37 -4
- package/server.ts +22 -0
- package/tsconfig.json +3 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 bridgebrew
|
|
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.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# SQLite storage (`@bridgebrew/storage-sqlite`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Keeps the workspace's data in a SQLite database, `storage.db` in the workspace's data folder. It is the default
|
|
4
|
+
storage of a Bridge workspace.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
Installed with every new workspace.
|
|
9
|
+
|
|
10
|
+
## Use
|
|
11
|
+
|
|
12
|
+
Nothing to set up. On its first start it imports the workspace's data from the JSON files it finds, then every
|
|
13
|
+
plugin's data is read and written in `storage.db`. When the plugin stops, it waits for the writes in flight, then
|
|
14
|
+
closes the database.
|
|
15
|
+
|
|
16
|
+
It keeps the audit trail when `@bridgebrew/storage-tools-audit` is installed.
|
|
17
|
+
|
|
18
|
+
## Contracts
|
|
19
|
+
|
|
20
|
+
Implements `storageBackend`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bridgebrew/storage-sqlite",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Keeps the workspace's data in a SQLite database, imported from the JSON files on first start.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"bridge-plugin"
|
|
8
|
+
],
|
|
9
|
+
"type": "module",
|
|
10
|
+
"files": [
|
|
11
|
+
"*.json",
|
|
12
|
+
"*.ts",
|
|
13
|
+
"!**/*.test.ts",
|
|
14
|
+
"!**/*.test.tsx"
|
|
15
|
+
],
|
|
16
|
+
"bridge": {
|
|
17
|
+
"kind": "service",
|
|
18
|
+
"title": "SQLite storage",
|
|
19
|
+
"icon": "hard-drive",
|
|
20
|
+
"domain": "data",
|
|
21
|
+
"server": "./server.ts",
|
|
22
|
+
"implements": [
|
|
23
|
+
"storageBackend"
|
|
24
|
+
],
|
|
25
|
+
"placement": "both"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"cordis": "4.0.0-rc.11",
|
|
29
|
+
"@bridge/storage": ">=0.0.1"
|
|
30
|
+
},
|
|
31
|
+
"releaseStage": "dev",
|
|
32
|
+
"scripts": {
|
|
33
|
+
"test": "bridge plugin test .",
|
|
34
|
+
"typecheck": "bridge plugin check ."
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"bridge": ">=0.0.1-nightly.20261119.1"
|
|
38
|
+
}
|
|
39
|
+
}
|
package/server.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// SQLite storage backend (AD-14): owns the SQLite backend over this workspace's data folder (`storage.db`, imported
|
|
2
|
+
// from the JSON files on first start), provides it as `storageBackend`, and closes it (waiting for writes in flight)
|
|
3
|
+
// when it disposes.
|
|
4
|
+
import type { Context } from 'cordis';
|
|
5
|
+
import type { Backend } from '@bridge/storage';
|
|
6
|
+
import { sqliteBackend } from '@bridge/storage/sqlite';
|
|
7
|
+
import type {} from '@bridge/worker-runtime/workspace';
|
|
8
|
+
|
|
9
|
+
declare module 'cordis' {
|
|
10
|
+
interface Context {
|
|
11
|
+
storageBackend: Backend;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const name = 'storage-sqlite';
|
|
16
|
+
export const inject = ['workspace'];
|
|
17
|
+
|
|
18
|
+
export function apply(ctx: Context) {
|
|
19
|
+
const backend = sqliteBackend(ctx.workspace.dataDir);
|
|
20
|
+
ctx.provide('storageBackend', backend);
|
|
21
|
+
ctx.effect(() => () => backend.close());
|
|
22
|
+
}
|
package/tsconfig.json
ADDED