@contractspec/lib.runtime-sandbox 1.9.0 → 2.1.0
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/README.md +40 -0
- package/dist/browser/index.js +5 -1
- package/dist/index.js +5 -1
- package/dist/node/index.js +5 -1
- package/package.json +6 -6
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @contractspec/lib.runtime-sandbox
|
|
2
|
+
|
|
3
|
+
Website: https://contractspec.io/
|
|
4
|
+
|
|
5
|
+
**Browser-friendly database abstraction with lazy-loaded PGLite.**
|
|
6
|
+
|
|
7
|
+
Provides a `DatabasePort` interface and a PGLite adapter for running PostgreSQL-compatible queries in the browser. The adapter is lazy-loaded to avoid bundle bloat for consumers that don't need it.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bun add @contractspec/lib.runtime-sandbox
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Exports
|
|
16
|
+
|
|
17
|
+
- `.` -- `DatabasePort`, `DatabaseAdapterFactory`, `createPGLiteAdapter()`, `web` namespace, and core types
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { createPGLiteAdapter } from "@contractspec/lib.runtime-sandbox";
|
|
23
|
+
|
|
24
|
+
const db = await createPGLiteAdapter();
|
|
25
|
+
await db.init();
|
|
26
|
+
|
|
27
|
+
await db.execute("CREATE TABLE users (id TEXT PRIMARY KEY, name TEXT)");
|
|
28
|
+
await db.execute("INSERT INTO users VALUES ('1', 'Alice')");
|
|
29
|
+
|
|
30
|
+
const result = await db.query("SELECT * FROM users");
|
|
31
|
+
console.log(result.rows);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Web namespace
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { web } from "@contractspec/lib.runtime-sandbox";
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The `web` namespace provides browser-specific utilities for the sandbox runtime.
|
package/dist/browser/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __returnValue = (v) => v;
|
|
3
|
+
function __exportSetter(name, newValue) {
|
|
4
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
5
|
+
}
|
|
2
6
|
var __export = (target, all) => {
|
|
3
7
|
for (var name in all)
|
|
4
8
|
__defProp(target, name, {
|
|
5
9
|
get: all[name],
|
|
6
10
|
enumerable: true,
|
|
7
11
|
configurable: true,
|
|
8
|
-
set: (
|
|
12
|
+
set: __exportSetter.bind(all, name)
|
|
9
13
|
});
|
|
10
14
|
};
|
|
11
15
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
3
7
|
var __export = (target, all) => {
|
|
4
8
|
for (var name in all)
|
|
5
9
|
__defProp(target, name, {
|
|
6
10
|
get: all[name],
|
|
7
11
|
enumerable: true,
|
|
8
12
|
configurable: true,
|
|
9
|
-
set: (
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
10
14
|
});
|
|
11
15
|
};
|
|
12
16
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
package/dist/node/index.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
3
7
|
var __export = (target, all) => {
|
|
4
8
|
for (var name in all)
|
|
5
9
|
__defProp(target, name, {
|
|
6
10
|
get: all[name],
|
|
7
11
|
enumerable: true,
|
|
8
12
|
configurable: true,
|
|
9
|
-
set: (
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
10
14
|
});
|
|
11
15
|
};
|
|
12
16
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/lib.runtime-sandbox",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@electric-sql/pglite": "^0.3.14",
|
|
21
|
-
"drizzle-orm": "^0.
|
|
21
|
+
"drizzle-orm": "^0.45.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependenciesMeta": {
|
|
24
24
|
"@electric-sql/pglite": {
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@contractspec/tool.typescript": "
|
|
32
|
+
"@contractspec/tool.typescript": "3.1.0",
|
|
33
33
|
"typescript": "^5.9.3",
|
|
34
34
|
"@electric-sql/pglite": "^0.3.14",
|
|
35
35
|
"drizzle-orm": "^0.45.1",
|
|
36
|
-
"@types/bun": "~1.3.
|
|
37
|
-
"@contractspec/tool.bun": "
|
|
36
|
+
"@types/bun": "~1.3.10",
|
|
37
|
+
"@contractspec/tool.bun": "3.1.0"
|
|
38
38
|
},
|
|
39
39
|
"types": "./dist/index.d.ts",
|
|
40
40
|
"exports": {
|
|
@@ -73,6 +73,6 @@
|
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@apollo/client": "^4.1.6",
|
|
75
75
|
"@graphql-tools/schema": "^10.0.31",
|
|
76
|
-
"graphql": "^16.13.
|
|
76
|
+
"graphql": "^16.13.1"
|
|
77
77
|
}
|
|
78
78
|
}
|