@contractspec/lib.runtime-sandbox 2.0.0 → 2.2.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.
Files changed (2) hide show
  1. package/README.md +40 -0
  2. 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/lib.runtime-sandbox",
3
- "version": "2.0.0",
3
+ "version": "2.2.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.38.4"
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": "3.0.0",
32
+ "@contractspec/tool.typescript": "3.2.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.9",
37
- "@contractspec/tool.bun": "3.0.0"
36
+ "@types/bun": "~1.3.10",
37
+ "@contractspec/tool.bun": "3.2.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.0"
76
+ "graphql": "^16.13.1"
77
77
  }
78
78
  }