@di-framework/pglite-component 0.0.0-stage → 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,6 +1,67 @@
1
1
  {
2
2
  "name": "@di-framework/pglite-component",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
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
+ "license": "(MIT OR Apache-2.0)",
7
+ "author": "@di-framework Contributors",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/di-framework/platform",
11
+ "directory": "platform/pglite-component"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/di-framework/platform/issues"
15
+ },
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
+ },
41
+ "files": [
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",
48
+ "README.md",
49
+ "wit",
50
+ "LICENSE-MIT",
51
+ "LICENSE-APACHE"
52
+ ],
53
+ "scripts": {
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",
57
+ "test": "bun test",
58
+ "smoke": "make smoke",
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"
66
+ }
67
+ }
@@ -0,0 +1,16 @@
1
+ package di-framework:pglite-engine@0.1.0;
2
+
3
+ /// Private in-memory bridge to the bundled PostgreSQL engine. Composed away
4
+ /// at build time; these functions are never host imports in the final artifact.
5
+ interface engine {
6
+ set-env: func(name: string, value: string) -> s32;
7
+ start: func(arguments: list<string>) -> s32;
8
+ initdb: func() -> s32;
9
+ backend: func();
10
+ write: func(payload: list<u8>) -> bool;
11
+ read: func() -> list<u8>;
12
+ step: func();
13
+ }
14
+ world embedded-engine {
15
+ export engine;
16
+ }
@@ -0,0 +1,159 @@
1
+ package wasi:cli@0.2.0;
2
+
3
+ interface environment {
4
+ /// Get the POSIX-style environment variables.
5
+ ///
6
+ /// Each environment variable is provided as a pair of string variable names
7
+ /// and string value.
8
+ ///
9
+ /// Morally, these are a value import, but until value imports are available
10
+ /// in the component model, this import function should return the same
11
+ /// values each time it is called.
12
+ get-environment: func() -> list<tuple<string, string>>;
13
+
14
+ /// Get the POSIX-style arguments to the program.
15
+ get-arguments: func() -> list<string>;
16
+
17
+ /// Return a path that programs should use as their initial current working
18
+ /// directory, interpreting `.` as shorthand for this.
19
+ initial-cwd: func() -> option<string>;
20
+ }
21
+
22
+ interface exit {
23
+ /// Exit the current instance and any linked instances.
24
+ exit: func(status: result);
25
+ }
26
+
27
+ interface run {
28
+ /// Run the program.
29
+ run: func() -> result;
30
+ }
31
+
32
+ interface stdin {
33
+ use wasi:io/streams@0.2.0.{input-stream};
34
+
35
+ get-stdin: func() -> input-stream;
36
+ }
37
+
38
+ interface stdout {
39
+ use wasi:io/streams@0.2.0.{output-stream};
40
+
41
+ get-stdout: func() -> output-stream;
42
+ }
43
+
44
+ interface stderr {
45
+ use wasi:io/streams@0.2.0.{output-stream};
46
+
47
+ get-stderr: func() -> output-stream;
48
+ }
49
+
50
+ /// Terminal input.
51
+ ///
52
+ /// In the future, this may include functions for disabling echoing,
53
+ /// disabling input buffering so that keyboard events are sent through
54
+ /// immediately, querying supported features, and so on.
55
+ interface terminal-input {
56
+ /// The input side of a terminal.
57
+ resource terminal-input;
58
+ }
59
+
60
+ /// Terminal output.
61
+ ///
62
+ /// In the future, this may include functions for querying the terminal
63
+ /// size, being notified of terminal size changes, querying supported
64
+ /// features, and so on.
65
+ interface terminal-output {
66
+ /// The output side of a terminal.
67
+ resource terminal-output;
68
+ }
69
+
70
+ /// An interface providing an optional `terminal-input` for stdin as a
71
+ /// link-time authority.
72
+ interface terminal-stdin {
73
+ use terminal-input.{terminal-input};
74
+
75
+ /// If stdin is connected to a terminal, return a `terminal-input` handle
76
+ /// allowing further interaction with it.
77
+ get-terminal-stdin: func() -> option<terminal-input>;
78
+ }
79
+
80
+ /// An interface providing an optional `terminal-output` for stdout as a
81
+ /// link-time authority.
82
+ interface terminal-stdout {
83
+ use terminal-output.{terminal-output};
84
+
85
+ /// If stdout is connected to a terminal, return a `terminal-output` handle
86
+ /// allowing further interaction with it.
87
+ get-terminal-stdout: func() -> option<terminal-output>;
88
+ }
89
+
90
+ /// An interface providing an optional `terminal-output` for stderr as a
91
+ /// link-time authority.
92
+ interface terminal-stderr {
93
+ use terminal-output.{terminal-output};
94
+
95
+ /// If stderr is connected to a terminal, return a `terminal-output` handle
96
+ /// allowing further interaction with it.
97
+ get-terminal-stderr: func() -> option<terminal-output>;
98
+ }
99
+
100
+ world imports {
101
+ import environment;
102
+ import exit;
103
+ import wasi:io/error@0.2.0;
104
+ import wasi:io/poll@0.2.0;
105
+ import wasi:io/streams@0.2.0;
106
+ import stdin;
107
+ import stdout;
108
+ import stderr;
109
+ import terminal-input;
110
+ import terminal-output;
111
+ import terminal-stdin;
112
+ import terminal-stdout;
113
+ import terminal-stderr;
114
+ import wasi:clocks/monotonic-clock@0.2.0;
115
+ import wasi:clocks/wall-clock@0.2.0;
116
+ import wasi:filesystem/types@0.2.0;
117
+ import wasi:filesystem/preopens@0.2.0;
118
+ import wasi:sockets/network@0.2.0;
119
+ import wasi:sockets/instance-network@0.2.0;
120
+ import wasi:sockets/udp@0.2.0;
121
+ import wasi:sockets/udp-create-socket@0.2.0;
122
+ import wasi:sockets/tcp@0.2.0;
123
+ import wasi:sockets/tcp-create-socket@0.2.0;
124
+ import wasi:sockets/ip-name-lookup@0.2.0;
125
+ import wasi:random/random@0.2.0;
126
+ import wasi:random/insecure@0.2.0;
127
+ import wasi:random/insecure-seed@0.2.0;
128
+ }
129
+ world command {
130
+ import environment;
131
+ import exit;
132
+ import wasi:io/error@0.2.0;
133
+ import wasi:io/poll@0.2.0;
134
+ import wasi:io/streams@0.2.0;
135
+ import stdin;
136
+ import stdout;
137
+ import stderr;
138
+ import terminal-input;
139
+ import terminal-output;
140
+ import terminal-stdin;
141
+ import terminal-stdout;
142
+ import terminal-stderr;
143
+ import wasi:clocks/monotonic-clock@0.2.0;
144
+ import wasi:clocks/wall-clock@0.2.0;
145
+ import wasi:filesystem/types@0.2.0;
146
+ import wasi:filesystem/preopens@0.2.0;
147
+ import wasi:sockets/network@0.2.0;
148
+ import wasi:sockets/instance-network@0.2.0;
149
+ import wasi:sockets/udp@0.2.0;
150
+ import wasi:sockets/udp-create-socket@0.2.0;
151
+ import wasi:sockets/tcp@0.2.0;
152
+ import wasi:sockets/tcp-create-socket@0.2.0;
153
+ import wasi:sockets/ip-name-lookup@0.2.0;
154
+ import wasi:random/random@0.2.0;
155
+ import wasi:random/insecure@0.2.0;
156
+ import wasi:random/insecure-seed@0.2.0;
157
+
158
+ export run;
159
+ }
@@ -0,0 +1,29 @@
1
+ package wasi:clocks@0.2.0;
2
+
3
+ interface monotonic-clock {
4
+ use wasi:io/poll@0.2.0.{pollable};
5
+
6
+ type instant = u64;
7
+
8
+ type duration = u64;
9
+
10
+ now: func() -> instant;
11
+
12
+ resolution: func() -> duration;
13
+
14
+ subscribe-instant: func(when: instant) -> pollable;
15
+
16
+ subscribe-duration: func(when: duration) -> pollable;
17
+ }
18
+
19
+ interface wall-clock {
20
+ record datetime {
21
+ seconds: u64,
22
+ nanoseconds: u32,
23
+ }
24
+
25
+ now: func() -> datetime;
26
+
27
+ resolution: func() -> datetime;
28
+ }
29
+
@@ -0,0 +1,158 @@
1
+ package wasi:filesystem@0.2.0;
2
+
3
+ interface types {
4
+ use wasi:io/streams@0.2.0.{input-stream, output-stream, error};
5
+ use wasi:clocks/wall-clock@0.2.0.{datetime};
6
+
7
+ type filesize = u64;
8
+
9
+ enum descriptor-type {
10
+ unknown,
11
+ block-device,
12
+ character-device,
13
+ directory,
14
+ fifo,
15
+ symbolic-link,
16
+ regular-file,
17
+ socket,
18
+ }
19
+
20
+ flags descriptor-flags {
21
+ read,
22
+ write,
23
+ file-integrity-sync,
24
+ data-integrity-sync,
25
+ requested-write-sync,
26
+ mutate-directory,
27
+ }
28
+
29
+ flags path-flags {
30
+ symlink-follow,
31
+ }
32
+
33
+ flags open-flags {
34
+ create,
35
+ directory,
36
+ exclusive,
37
+ truncate,
38
+ }
39
+
40
+ type link-count = u64;
41
+
42
+ record descriptor-stat {
43
+ %type: descriptor-type,
44
+ link-count: link-count,
45
+ size: filesize,
46
+ data-access-timestamp: option<datetime>,
47
+ data-modification-timestamp: option<datetime>,
48
+ status-change-timestamp: option<datetime>,
49
+ }
50
+
51
+ variant new-timestamp {
52
+ no-change,
53
+ now,
54
+ timestamp(datetime),
55
+ }
56
+
57
+ record directory-entry {
58
+ %type: descriptor-type,
59
+ name: string,
60
+ }
61
+
62
+ enum error-code {
63
+ access,
64
+ would-block,
65
+ already,
66
+ bad-descriptor,
67
+ busy,
68
+ deadlock,
69
+ quota,
70
+ exist,
71
+ file-too-large,
72
+ illegal-byte-sequence,
73
+ in-progress,
74
+ interrupted,
75
+ invalid,
76
+ io,
77
+ is-directory,
78
+ loop,
79
+ too-many-links,
80
+ message-size,
81
+ name-too-long,
82
+ no-device,
83
+ no-entry,
84
+ no-lock,
85
+ insufficient-memory,
86
+ insufficient-space,
87
+ not-directory,
88
+ not-empty,
89
+ not-recoverable,
90
+ unsupported,
91
+ no-tty,
92
+ no-such-device,
93
+ overflow,
94
+ not-permitted,
95
+ pipe,
96
+ read-only,
97
+ invalid-seek,
98
+ text-file-busy,
99
+ cross-device,
100
+ }
101
+
102
+ enum advice {
103
+ normal,
104
+ sequential,
105
+ random,
106
+ will-need,
107
+ dont-need,
108
+ no-reuse,
109
+ }
110
+
111
+ record metadata-hash-value {
112
+ lower: u64,
113
+ upper: u64,
114
+ }
115
+
116
+ resource descriptor {
117
+ read-via-stream: func(offset: filesize) -> result<input-stream, error-code>;
118
+ write-via-stream: func(offset: filesize) -> result<output-stream, error-code>;
119
+ append-via-stream: func() -> result<output-stream, error-code>;
120
+ advise: func(offset: filesize, length: filesize, advice: advice) -> result<_, error-code>;
121
+ sync-data: func() -> result<_, error-code>;
122
+ get-flags: func() -> result<descriptor-flags, error-code>;
123
+ get-type: func() -> result<descriptor-type, error-code>;
124
+ set-size: func(size: filesize) -> result<_, error-code>;
125
+ set-times: func(data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>;
126
+ read: func(length: filesize, offset: filesize) -> result<tuple<list<u8>, bool>, error-code>;
127
+ write: func(buffer: list<u8>, offset: filesize) -> result<filesize, error-code>;
128
+ read-directory: func() -> result<directory-entry-stream, error-code>;
129
+ sync: func() -> result<_, error-code>;
130
+ create-directory-at: func(path: string) -> result<_, error-code>;
131
+ stat: func() -> result<descriptor-stat, error-code>;
132
+ stat-at: func(path-flags: path-flags, path: string) -> result<descriptor-stat, error-code>;
133
+ set-times-at: func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>;
134
+ link-at: func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow<descriptor>, new-path: string) -> result<_, error-code>;
135
+ open-at: func(path-flags: path-flags, path: string, open-flags: open-flags, %flags: descriptor-flags) -> result<descriptor, error-code>;
136
+ readlink-at: func(path: string) -> result<string, error-code>;
137
+ remove-directory-at: func(path: string) -> result<_, error-code>;
138
+ rename-at: func(old-path: string, new-descriptor: borrow<descriptor>, new-path: string) -> result<_, error-code>;
139
+ symlink-at: func(old-path: string, new-path: string) -> result<_, error-code>;
140
+ unlink-file-at: func(path: string) -> result<_, error-code>;
141
+ is-same-object: func(other: borrow<descriptor>) -> bool;
142
+ metadata-hash: func() -> result<metadata-hash-value, error-code>;
143
+ metadata-hash-at: func(path-flags: path-flags, path: string) -> result<metadata-hash-value, error-code>;
144
+ }
145
+
146
+ resource directory-entry-stream {
147
+ read-directory-entry: func() -> result<option<directory-entry>, error-code>;
148
+ }
149
+
150
+ filesystem-error-code: func(err: borrow<error>) -> option<error-code>;
151
+ }
152
+
153
+ interface preopens {
154
+ use types.{descriptor};
155
+
156
+ get-directories: func() -> list<tuple<descriptor, string>>;
157
+ }
158
+