@di-framework/pglite-component 6.0.9 → 6.0.11

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.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * `SqlDatabase` adapter for the `di-framework:pglite/database` WIT interface
3
+ * this package's component exports. Depends on `@di-framework/repo` as a peer.
4
+ */
5
+ export * from './adapter.js';
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@di-framework/pglite-component",
3
- "version": "6.0.9",
4
- "private": false,
5
- "description": "Embedded PostgreSQL component with persistent WASI storage and no TCP.",
3
+ "version": "6.0.11",
4
+ "type": "module",
5
+ "description": "Embedded PostgreSQL component with persistent WASI storage and no TCP, plus its SqlDatabase adapter for @di-framework/repo.",
6
6
  "license": "(MIT OR Apache-2.0)",
7
7
  "author": "@di-framework Contributors",
8
8
  "repository": {
@@ -14,15 +14,54 @@
14
14
  "url": "https://github.com/di-framework/platform/issues"
15
15
  },
16
16
  "homepage": "https://github.com/di-framework/platform",
17
+ "keywords": [
18
+ "postgresql",
19
+ "pglite",
20
+ "wasi",
21
+ "wit",
22
+ "webassembly",
23
+ "component-model",
24
+ "di-framework"
25
+ ],
26
+ "main": "./dist/js/index.js",
27
+ "types": "./dist/js/index.d.ts",
28
+ "module": "./dist/js/index.js",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/js/index.d.ts",
32
+ "bun": "./dist/js/index.js",
33
+ "import": "./dist/js/index.js",
34
+ "default": "./dist/js/index.js"
35
+ },
36
+ "./wasm": "./dist/di-framework-pglite.wasm",
37
+ "./wit": "./dist/di-framework-pglite.wit",
38
+ "./wit/*": "./wit/*",
39
+ "./package.json": "./package.json"
40
+ },
17
41
  "files": [
18
- "dist",
42
+ "dist/js",
43
+ "dist/di-framework-pglite.wasm",
44
+ "dist/di-framework-pglite.wit",
45
+ "dist/BUILD-INFO.txt",
46
+ "dist/SHA256SUMS",
47
+ "dist/THIRD-PARTY-NOTICES.txt",
19
48
  "README.md",
20
- "wit"
49
+ "wit",
50
+ "LICENSE-MIT",
51
+ "LICENSE-APACHE"
21
52
  ],
22
53
  "scripts": {
23
- "build": "make build",
54
+ "build": "bun run build:adapter && make build",
55
+ "build:adapter": "bun scripts/wit-types.ts --check && rm -rf dist/js && bun x tsc -p tsconfig.build.json && bun ../../scripts/fix-esm-imports.ts dist/js",
56
+ "wit-types": "bun scripts/wit-types.ts",
24
57
  "test": "bun test",
25
58
  "smoke": "make smoke",
26
59
  "publish-asset": "make publish-asset"
60
+ },
61
+ "peerDependencies": {
62
+ "@di-framework/repo": "^6.1.0"
63
+ },
64
+ "devDependencies": {
65
+ "@di-framework/repo": "^6.1.0"
27
66
  }
28
67
  }
package/wit/world.wit CHANGED
@@ -1,4 +1,4 @@
1
- package di-framework:pglite@0.1.0;
1
+ package di-framework:pglite@0.2.0;
2
2
 
3
3
  /// Types shared by the `database` interface.
4
4
  ///
@@ -25,9 +25,11 @@ interface types {
25
25
  open-failed(string),
26
26
  /// The connection has been closed with `close` and cannot be used again.
27
27
  closed,
28
- /// The statement could not be prepared or executed: syntax error, unknown
29
- /// table or column. Only single statements are accepted by `run`/`query`/`first`
30
- /// (unlike `exec`, which allows `;`-separated batches like the SQLite provider).
28
+ /// The SQL was rejected before execution. Causes: a syntax error (42601),
29
+ /// an undeterminable parameter type (42P18), a bad savepoint name, a NUL
30
+ /// byte in the SQL, or more than one statement passed to `run`/`query`/
31
+ /// `first` (the server reports that as a syntax error; unlike `exec`,
32
+ /// which allows `;`-separated batches like the SQLite provider).
31
33
  invalid-sql(string),
32
34
  /// Wrong number of parameters or a value that could not be bound.
33
35
  /// Parameters bind positionally to `$1`, `$2`, ... (not `?`/`?NNN`).
@@ -50,6 +52,23 @@ interface types {
50
52
  /// A dynamically-typed value, used for parameters and results.
51
53
  /// Identical to the SQLite provider plus `boolean`: Postgres has a native
52
54
  /// boolean type and the text encoding (`t`/`f`) is lossy without it.
55
+ /// `json` and `timestamp` are new in 0.2.0 for PostgreSQL-specific types.
56
+ ///
57
+ /// Results (session is `DateStyle=ISO`, `TimeZone=UTC`):
58
+ /// - `bool` -> `boolean`; `int2`/`int4`/`int8` -> `integer` (`int8` too);
59
+ /// `float4`/`float8` -> `real`; `bytea` -> `blob`.
60
+ /// - `json` and `jsonb` -> `json` (JSON text).
61
+ /// - `timestamptz` -> `timestamp`, RFC 3339 in UTC (`2024-01-15T10:30:00Z`,
62
+ /// fractional seconds kept). `infinity` and `-infinity` are returned as
63
+ /// those literals.
64
+ /// - `timestamp` (no zone) and `date` -> `text` (`2024-01-15 10:30:00`,
65
+ /// `2024-01-15`).
66
+ /// - `uuid` and `numeric` -> `text`; arrays -> `text` as PostgreSQL array
67
+ /// literals (`{a,b}`); all other types -> `text`.
68
+ ///
69
+ /// Parameters: `text`, `json` and `timestamp` are sent with unknown type
70
+ /// (OID 0) so PostgreSQL infers the type from context; a parameter with no
71
+ /// context (`SELECT $1 IS NULL`) needs a cast.
53
72
  variant value {
54
73
  null,
55
74
  integer(s64),
@@ -57,6 +76,8 @@ interface types {
57
76
  text(string),
58
77
  blob(list<u8>),
59
78
  boolean(bool),
79
+ json(string),
80
+ timestamp(string),
60
81
  }
61
82
 
62
83
  /// A result row: `(column-name, value)` pairs in column order.