@bytecodealliance/jco 1.33.0 → 1.35.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 +4 -0
- package/dist/bundle.d.ts.map +1 -1
- package/dist/bundle.js +5 -0
- package/dist/bundle.js.map +1 -1
- package/dist/cmd/componentize.d.ts +12 -2
- package/dist/cmd/componentize.d.ts.map +1 -1
- package/dist/cmd/componentize.js +16 -5
- package/dist/cmd/componentize.js.map +1 -1
- package/dist/cmd/new.js +2 -1
- package/dist/cmd/new.js.map +1 -1
- package/dist/cmd/transpile.d.ts.map +1 -1
- package/dist/cmd/transpile.js +28 -1
- package/dist/cmd/transpile.js.map +1 -1
- package/dist/engine-compat.d.ts +11 -0
- package/dist/engine-compat.d.ts.map +1 -0
- package/dist/engine-compat.js +56 -0
- package/dist/engine-compat.js.map +1 -0
- package/dist/jco.js +7 -2
- package/dist/jco.js.map +1 -1
- package/dist/node-builtins/assert.d.ts +3 -0
- package/dist/node-builtins/assert.d.ts.map +1 -0
- package/dist/node-builtins/assert.js +65 -0
- package/dist/node-builtins/assert.js.map +1 -0
- package/dist/node-builtins/async-hooks.d.ts +3 -0
- package/dist/node-builtins/async-hooks.d.ts.map +1 -0
- package/dist/node-builtins/async-hooks.js +27 -0
- package/dist/node-builtins/async-hooks.js.map +1 -0
- package/dist/node-builtins/buffer.d.ts +4 -0
- package/dist/node-builtins/buffer.d.ts.map +1 -0
- package/dist/node-builtins/buffer.js +87 -0
- package/dist/node-builtins/buffer.js.map +1 -0
- package/dist/node-builtins/child-process.d.ts +3 -0
- package/dist/node-builtins/child-process.d.ts.map +1 -0
- package/dist/node-builtins/child-process.js +23 -0
- package/dist/node-builtins/child-process.js.map +1 -0
- package/dist/node-builtins/cluster.d.ts +3 -0
- package/dist/node-builtins/cluster.d.ts.map +1 -0
- package/dist/node-builtins/cluster.js +28 -0
- package/dist/node-builtins/cluster.js.map +1 -0
- package/dist/node-builtins/console.d.ts +3 -0
- package/dist/node-builtins/console.d.ts.map +1 -0
- package/dist/node-builtins/console.js +39 -0
- package/dist/node-builtins/console.js.map +1 -0
- package/dist/node-builtins/crypto.d.ts +3 -0
- package/dist/node-builtins/crypto.d.ts.map +1 -0
- package/dist/node-builtins/crypto.js +5 -0
- package/dist/node-builtins/crypto.js.map +1 -0
- package/dist/node-builtins/dgram.d.ts +4 -0
- package/dist/node-builtins/dgram.d.ts.map +1 -0
- package/dist/node-builtins/dgram.js +13 -0
- package/dist/node-builtins/dgram.js.map +1 -0
- package/dist/node-builtins/diagnostics-channel.d.ts +3 -0
- package/dist/node-builtins/diagnostics-channel.d.ts.map +1 -0
- package/dist/node-builtins/diagnostics-channel.js +26 -0
- package/dist/node-builtins/diagnostics-channel.js.map +1 -0
- package/dist/node-builtins/dns.d.ts +3 -0
- package/dist/node-builtins/dns.d.ts.map +1 -0
- package/dist/node-builtins/dns.js +12 -0
- package/dist/node-builtins/dns.js.map +1 -0
- package/dist/node-builtins/domain.d.ts +3 -0
- package/dist/node-builtins/domain.d.ts.map +1 -0
- package/dist/node-builtins/domain.js +19 -0
- package/dist/node-builtins/domain.js.map +1 -0
- package/dist/node-builtins/events.d.ts +3 -0
- package/dist/node-builtins/events.d.ts.map +1 -0
- package/dist/node-builtins/events.js +39 -0
- package/dist/node-builtins/events.js.map +1 -0
- package/dist/node-builtins/ffi.d.ts +3 -0
- package/dist/node-builtins/ffi.d.ts.map +1 -0
- package/dist/node-builtins/ffi.js +59 -0
- package/dist/node-builtins/ffi.js.map +1 -0
- package/dist/node-builtins/fs.d.ts +3 -0
- package/dist/node-builtins/fs.d.ts.map +1 -0
- package/dist/node-builtins/fs.js +16 -0
- package/dist/node-builtins/fs.js.map +1 -0
- package/dist/node-builtins/globals.d.ts +19 -0
- package/dist/node-builtins/globals.d.ts.map +1 -0
- package/dist/node-builtins/globals.js +56 -0
- package/dist/node-builtins/globals.js.map +1 -0
- package/dist/node-builtins/http-common.d.ts +6 -0
- package/dist/node-builtins/http-common.d.ts.map +1 -0
- package/dist/node-builtins/http-common.js +111 -0
- package/dist/node-builtins/http-common.js.map +1 -0
- package/dist/node-builtins/http.d.ts +4 -0
- package/dist/node-builtins/http.d.ts.map +1 -0
- package/dist/node-builtins/http.js +15 -0
- package/dist/node-builtins/http.js.map +1 -0
- package/dist/node-builtins/http2.d.ts +4 -0
- package/dist/node-builtins/http2.d.ts.map +1 -0
- package/dist/node-builtins/http2.js +79 -0
- package/dist/node-builtins/http2.js.map +1 -0
- package/dist/node-builtins/https.d.ts +3 -0
- package/dist/node-builtins/https.d.ts.map +1 -0
- package/dist/node-builtins/https.js +5 -0
- package/dist/node-builtins/https.js.map +1 -0
- package/dist/node-builtins/index.d.ts +10 -0
- package/dist/node-builtins/index.d.ts.map +1 -0
- package/dist/node-builtins/index.js +164 -0
- package/dist/node-builtins/index.js.map +1 -0
- package/dist/node-builtins/inspector.d.ts +12 -0
- package/dist/node-builtins/inspector.d.ts.map +1 -0
- package/dist/node-builtins/inspector.js +70 -0
- package/dist/node-builtins/inspector.js.map +1 -0
- package/dist/node-builtins/module.d.ts +3 -0
- package/dist/node-builtins/module.d.ts.map +1 -0
- package/dist/node-builtins/module.js +55 -0
- package/dist/node-builtins/module.js.map +1 -0
- package/dist/node-builtins/net.d.ts +3 -0
- package/dist/node-builtins/net.d.ts.map +1 -0
- package/dist/node-builtins/net.js +46 -0
- package/dist/node-builtins/net.js.map +1 -0
- package/dist/node-builtins/os.d.ts +3 -0
- package/dist/node-builtins/os.d.ts.map +1 -0
- package/dist/node-builtins/os.js +39 -0
- package/dist/node-builtins/os.js.map +1 -0
- package/dist/node-builtins/path.d.ts +3 -0
- package/dist/node-builtins/path.d.ts.map +1 -0
- package/dist/node-builtins/path.js +91 -0
- package/dist/node-builtins/path.js.map +1 -0
- package/dist/node-builtins/perf-hooks.d.ts +3 -0
- package/dist/node-builtins/perf-hooks.d.ts.map +1 -0
- package/dist/node-builtins/perf-hooks.js +12 -0
- package/dist/node-builtins/perf-hooks.js.map +1 -0
- package/dist/node-builtins/process.d.ts +3 -0
- package/dist/node-builtins/process.d.ts.map +1 -0
- package/dist/node-builtins/process.js +9 -0
- package/dist/node-builtins/process.js.map +1 -0
- package/dist/node-builtins/querystring.d.ts +3 -0
- package/dist/node-builtins/querystring.d.ts.map +1 -0
- package/dist/node-builtins/querystring.js +18 -0
- package/dist/node-builtins/querystring.js.map +1 -0
- package/dist/node-builtins/readline.d.ts +3 -0
- package/dist/node-builtins/readline.d.ts.map +1 -0
- package/dist/node-builtins/readline.js +11 -0
- package/dist/node-builtins/readline.js.map +1 -0
- package/dist/node-builtins/repl.d.ts +9 -0
- package/dist/node-builtins/repl.d.ts.map +1 -0
- package/dist/node-builtins/repl.js +12 -0
- package/dist/node-builtins/repl.js.map +1 -0
- package/dist/node-builtins/shared.d.ts +24 -0
- package/dist/node-builtins/shared.d.ts.map +1 -0
- package/dist/node-builtins/shared.js +68 -0
- package/dist/node-builtins/shared.js.map +1 -0
- package/dist/node-builtins/sqlite.d.ts +3 -0
- package/dist/node-builtins/sqlite.d.ts.map +1 -0
- package/dist/node-builtins/sqlite.js +9 -0
- package/dist/node-builtins/sqlite.js.map +1 -0
- package/dist/node-builtins/stream.d.ts +3 -0
- package/dist/node-builtins/stream.d.ts.map +1 -0
- package/dist/node-builtins/stream.js +64 -0
- package/dist/node-builtins/stream.js.map +1 -0
- package/dist/node-builtins/string-decoder.d.ts +3 -0
- package/dist/node-builtins/string-decoder.d.ts.map +1 -0
- package/dist/node-builtins/string-decoder.js +14 -0
- package/dist/node-builtins/string-decoder.js.map +1 -0
- package/dist/node-builtins/test.d.ts +4 -0
- package/dist/node-builtins/test.d.ts.map +1 -0
- package/dist/node-builtins/test.js +8 -0
- package/dist/node-builtins/test.js.map +1 -0
- package/dist/node-builtins/timers.d.ts +4 -0
- package/dist/node-builtins/timers.d.ts.map +1 -0
- package/dist/node-builtins/timers.js +9 -0
- package/dist/node-builtins/timers.js.map +1 -0
- package/dist/node-builtins/tls.d.ts +3 -0
- package/dist/node-builtins/tls.d.ts.map +1 -0
- package/dist/node-builtins/tls.js +10 -0
- package/dist/node-builtins/tls.js.map +1 -0
- package/dist/node-builtins/trace-events.d.ts +3 -0
- package/dist/node-builtins/trace-events.d.ts.map +1 -0
- package/dist/node-builtins/trace-events.js +9 -0
- package/dist/node-builtins/trace-events.js.map +1 -0
- package/dist/node-builtins/tty.d.ts +8 -0
- package/dist/node-builtins/tty.d.ts.map +1 -0
- package/dist/node-builtins/tty.js +12 -0
- package/dist/node-builtins/tty.js.map +1 -0
- package/dist/{node-builtins.d.ts → node-builtins/types.d.ts} +73 -41
- package/dist/node-builtins/types.d.ts.map +1 -0
- package/dist/node-builtins/types.js +2 -0
- package/dist/node-builtins/types.js.map +1 -0
- package/dist/node-builtins/unenv.d.ts +6 -0
- package/dist/node-builtins/unenv.d.ts.map +1 -0
- package/dist/node-builtins/unenv.js +27 -0
- package/dist/node-builtins/unenv.js.map +1 -0
- package/dist/node-builtins/url-pattern.d.ts +8 -0
- package/dist/node-builtins/url-pattern.d.ts.map +1 -0
- package/dist/node-builtins/url-pattern.js +19 -0
- package/dist/node-builtins/url-pattern.js.map +1 -0
- package/dist/node-builtins/url.d.ts +4 -0
- package/dist/node-builtins/url.d.ts.map +1 -0
- package/dist/node-builtins/url.js +100 -0
- package/dist/node-builtins/url.js.map +1 -0
- package/dist/node-builtins/util.d.ts +3 -0
- package/dist/node-builtins/util.d.ts.map +1 -0
- package/dist/node-builtins/util.js +7 -0
- package/dist/node-builtins/util.js.map +1 -0
- package/dist/node-builtins/v8.d.ts +3 -0
- package/dist/node-builtins/v8.d.ts.map +1 -0
- package/dist/node-builtins/v8.js +6 -0
- package/dist/node-builtins/v8.js.map +1 -0
- package/dist/node-builtins/vfs.d.ts +3 -0
- package/dist/node-builtins/vfs.d.ts.map +1 -0
- package/dist/node-builtins/vfs.js +42 -0
- package/dist/node-builtins/vfs.js.map +1 -0
- package/dist/node-builtins/vm.d.ts +4 -0
- package/dist/node-builtins/vm.d.ts.map +1 -0
- package/dist/node-builtins/vm.js +6 -0
- package/dist/node-builtins/vm.js.map +1 -0
- package/dist/node-builtins/wasi-sockets.d.ts +10 -0
- package/dist/node-builtins/wasi-sockets.d.ts.map +1 -0
- package/dist/node-builtins/wasi-sockets.js +25 -0
- package/dist/node-builtins/wasi-sockets.js.map +1 -0
- package/dist/node-builtins/wasi.d.ts +10 -0
- package/dist/node-builtins/wasi.d.ts.map +1 -0
- package/dist/node-builtins/wasi.js +14 -0
- package/dist/node-builtins/wasi.js.map +1 -0
- package/dist/node-builtins/worker-threads.d.ts +3 -0
- package/dist/node-builtins/worker-threads.d.ts.map +1 -0
- package/dist/node-builtins/worker-threads.js +16 -0
- package/dist/node-builtins/worker-threads.js.map +1 -0
- package/dist/node-builtins/zlib.d.ts +3 -0
- package/dist/node-builtins/zlib.d.ts.map +1 -0
- package/dist/node-builtins/zlib.js +6 -0
- package/dist/node-builtins/zlib.js.map +1 -0
- package/dist/node-wit.d.ts +35 -0
- package/dist/node-wit.d.ts.map +1 -1
- package/dist/node-wit.js +135 -4
- package/dist/node-wit.js.map +1 -1
- package/lib/wit/builtin/jco-node-0.1.0/cluster.wit +3 -2
- package/lib/wit/builtin/jco-node-0.1.0/dgram.wit +142 -0
- package/lib/wit/builtin/jco-node-0.1.0/http.wit +7 -0
- package/lib/wit/builtin/jco-node-0.1.0/http2.wit +4 -5
- package/lib/wit/builtin/jco-node-0.1.0/process.wit +245 -0
- package/lib/wit/builtin/jco-node-0.1.0/sqlite.wit +154 -0
- package/lib/wit/builtin/jco-node-0.1.0/tls.wit +108 -0
- package/lib/wit/builtin/jco-node-0.1.0/trace-events.wit +27 -0
- package/lib/wit/builtin/jco-node-0.1.0/tty.wit +59 -0
- package/lib/wit/builtin/jco-node-0.1.0/v8.wit +102 -0
- package/lib/wit/builtin/jco-node-0.1.0/wasi.wit +57 -0
- package/lib/wit/builtin/jco-node-0.1.0/worker-threads.wit +67 -0
- package/lib/wit/builtin/jco-node-0.1.0/zlib.wit +77 -0
- package/lib/wit/builtin/wasi-tls-0.2.0-draft/LICENSE.md +8 -0
- package/lib/wit/builtin/wasi-tls-0.2.0-draft/README.md +25 -0
- package/lib/wit/builtin/wasi-tls-0.2.0-draft/deps/io/package.wit +66 -0
- package/lib/wit/builtin/wasi-tls-0.2.0-draft/types.wit +27 -0
- package/lib/wit/builtin/wasi-tls-0.2.0-draft/world.wit +8 -0
- package/package.json +8 -6
- package/dist/node-builtins.d.ts.map +0 -1
- package/dist/node-builtins.js +0 -1085
- package/dist/node-builtins.js.map +0 -1
|
@@ -7,8 +7,9 @@ package jco:node@0.1.0;
|
|
|
7
7
|
/// rebuild the observable JS surface guest-side.
|
|
8
8
|
///
|
|
9
9
|
/// Cluster is push-based and WIT is pull-based, so host events are queued and the guest drains
|
|
10
|
-
/// them with `drain-events`. See
|
|
11
|
-
///
|
|
10
|
+
/// them with `drain-events`. See
|
|
11
|
+
/// `docs/src/interop/nodejs-builtins/supported-modules/cluster.md`
|
|
12
|
+
/// for the delivery-timing difference this creates.
|
|
12
13
|
interface cluster {
|
|
13
14
|
use types.{env-vars};
|
|
14
15
|
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
package jco:node@0.1.0;
|
|
2
|
+
|
|
3
|
+
/// Explicit UDP capability. Guest-owned callbacks deliver DNS results, send
|
|
4
|
+
/// completions and datagrams between component entry tasks. No Node objects,
|
|
5
|
+
/// descriptors, or implicit networking authority cross this interface.
|
|
6
|
+
interface dgram {
|
|
7
|
+
variant errno {
|
|
8
|
+
number(s64),
|
|
9
|
+
symbolic(string),
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
record buffer-error-info {
|
|
13
|
+
errno: f64,
|
|
14
|
+
code: string,
|
|
15
|
+
message: string,
|
|
16
|
+
syscall: string,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
record error {
|
|
20
|
+
name: string,
|
|
21
|
+
message: string,
|
|
22
|
+
code: option<string>,
|
|
23
|
+
errno: option<errno>,
|
|
24
|
+
syscall: option<string>,
|
|
25
|
+
address: option<string>,
|
|
26
|
+
port: option<u16>,
|
|
27
|
+
info: option<buffer-error-info>,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
enum socket-type {
|
|
31
|
+
udp4,
|
|
32
|
+
udp6,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
record options {
|
|
36
|
+
%type: socket-type,
|
|
37
|
+
reuse-addr: bool,
|
|
38
|
+
reuse-port: bool,
|
|
39
|
+
ipv6-only: bool,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
record address-info {
|
|
43
|
+
address: string,
|
|
44
|
+
family: string,
|
|
45
|
+
port: u16,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
variant socket-option {
|
|
49
|
+
broadcast(bool),
|
|
50
|
+
multicast-loopback(bool),
|
|
51
|
+
ttl(f64),
|
|
52
|
+
multicast-ttl(f64),
|
|
53
|
+
recv-buffer(u32),
|
|
54
|
+
send-buffer(u32),
|
|
55
|
+
multicast-interface(string),
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
enum socket-query {
|
|
59
|
+
recv-buffer,
|
|
60
|
+
send-buffer,
|
|
61
|
+
send-queue-size,
|
|
62
|
+
send-queue-count,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
enum membership-action {
|
|
66
|
+
add,
|
|
67
|
+
drop,
|
|
68
|
+
add-source,
|
|
69
|
+
drop-source,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
create-socket: func(options: options, listener: u32) -> result<socket, error>;
|
|
73
|
+
|
|
74
|
+
resource socket {
|
|
75
|
+
/// Bind/connect only accept resolved addresses and complete synchronously.
|
|
76
|
+
bind: func(address: string, port: u16) -> result<address-info, error>;
|
|
77
|
+
|
|
78
|
+
connect: func(address: string, port: u16) -> result<_, error>;
|
|
79
|
+
|
|
80
|
+
disconnect: func() -> result<_, error>;
|
|
81
|
+
|
|
82
|
+
resolve: func(address: string, id: u32);
|
|
83
|
+
|
|
84
|
+
send: func(
|
|
85
|
+
data: list<u8>,
|
|
86
|
+
port: option<u16>,
|
|
87
|
+
address: option<string>,
|
|
88
|
+
callback: option<u32>,
|
|
89
|
+
) -> result<_, error>;
|
|
90
|
+
|
|
91
|
+
address: func(remote: bool) -> result<address-info, error>;
|
|
92
|
+
|
|
93
|
+
set-option: func(%option: socket-option) -> result<_, error>;
|
|
94
|
+
|
|
95
|
+
query: func(query: socket-query) -> result<f64, error>;
|
|
96
|
+
|
|
97
|
+
membership: func(
|
|
98
|
+
action: membership-action,
|
|
99
|
+
group: string,
|
|
100
|
+
source: option<string>,
|
|
101
|
+
iface: option<string>,
|
|
102
|
+
) -> result<_, error>;
|
|
103
|
+
|
|
104
|
+
close: func();
|
|
105
|
+
|
|
106
|
+
set-ref: func(%ref: bool);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/// Each component instance owns and redeems its listeners. Providers must serialize
|
|
111
|
+
/// callback entry and drops, never re-enter while a guest import is on the stack.
|
|
112
|
+
interface dgram-callbacks {
|
|
113
|
+
use dgram.{error, address-info};
|
|
114
|
+
|
|
115
|
+
record message {
|
|
116
|
+
data: list<u8>,
|
|
117
|
+
remote: address-info,
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
record resolved {
|
|
121
|
+
id: u32,
|
|
122
|
+
%result: result<string, error>,
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
record sent {
|
|
126
|
+
id: u32,
|
|
127
|
+
%result: result<u32, error>,
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
variant socket-event {
|
|
131
|
+
message(message),
|
|
132
|
+
error(error),
|
|
133
|
+
resolved(resolved),
|
|
134
|
+
sent(sent),
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
resource socket-listener {
|
|
138
|
+
event: func(event: socket-event);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
take-socket-listener: func(id: u32) -> option<socket-listener>;
|
|
142
|
+
}
|
|
@@ -81,6 +81,8 @@ interface http {
|
|
|
81
81
|
connect-timeout-ms: option<u32>,
|
|
82
82
|
first-byte-timeout-ms: option<u32>,
|
|
83
83
|
between-bytes-timeout-ms: option<u32>,
|
|
84
|
+
/// Set only for `https` requests that carry TLS options.
|
|
85
|
+
tls: option<tls-options>,
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
record response {
|
|
@@ -91,6 +93,9 @@ interface http {
|
|
|
91
93
|
body: list<u8>,
|
|
92
94
|
}
|
|
93
95
|
|
|
96
|
+
/// Configuration issued by the same jco:node/tls provider bound to this HTTP host.
|
|
97
|
+
record tls-options { context-id: u32 }
|
|
98
|
+
|
|
94
99
|
record server-options {
|
|
95
100
|
request-timeout: option<u32>,
|
|
96
101
|
headers-timeout: option<u32>,
|
|
@@ -105,6 +110,8 @@ interface http {
|
|
|
105
110
|
keep-alive-initial-delay: option<u32>,
|
|
106
111
|
reject-non-standard-body-writes: option<bool>,
|
|
107
112
|
optimize-empty-requests: option<bool>,
|
|
113
|
+
/// Present for every `node:https` server, even when empty: the host terminates TLS.
|
|
114
|
+
tls: option<tls-options>,
|
|
108
115
|
}
|
|
109
116
|
|
|
110
117
|
record listen-options {
|
|
@@ -32,6 +32,7 @@ interface http2-callbacks {
|
|
|
32
32
|
|
|
33
33
|
record outgoing-response {
|
|
34
34
|
headers: list<header>,
|
|
35
|
+
trailers: list<header>,
|
|
35
36
|
body: list<u8>,
|
|
36
37
|
}
|
|
37
38
|
|
|
@@ -89,9 +90,8 @@ interface http2 {
|
|
|
89
90
|
|
|
90
91
|
record client-options {
|
|
91
92
|
settings: http2-settings,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
ca: option<list<u8>>,
|
|
93
|
+
/// One-use configuration issued by the shared jco:node/tls provider.
|
|
94
|
+
tls-context: option<u32>,
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
record request-options {
|
|
@@ -126,8 +126,7 @@ interface http2 {
|
|
|
126
126
|
|
|
127
127
|
record server-options {
|
|
128
128
|
secure: bool,
|
|
129
|
-
|
|
130
|
-
cert: option<list<u8>>,
|
|
129
|
+
tls-context: option<u32>,
|
|
131
130
|
settings: http2-settings,
|
|
132
131
|
allow-http1: option<bool>,
|
|
133
132
|
strict-field-whitespace-validation: option<bool>,
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
package jco:node@0.1.0;
|
|
2
|
+
|
|
3
|
+
/// Explicit access to the embedding process. No capability is granted by default.
|
|
4
|
+
/// The Node provider affects the embedding Node process, not a virtual WASI process.
|
|
5
|
+
interface process {
|
|
6
|
+
variant errno {
|
|
7
|
+
number(s64),
|
|
8
|
+
symbolic(string)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
record error {
|
|
12
|
+
name: string,
|
|
13
|
+
message: string,
|
|
14
|
+
code: option<string>,
|
|
15
|
+
errno: option<errno>,
|
|
16
|
+
syscall: option<string>,
|
|
17
|
+
path: option<string>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
record process-metadata {
|
|
21
|
+
arch: string,
|
|
22
|
+
platform: string,
|
|
23
|
+
pid: u32,
|
|
24
|
+
ppid: u32,
|
|
25
|
+
argv: list<string>,
|
|
26
|
+
argv0: string,
|
|
27
|
+
exec-argv: list<string>,
|
|
28
|
+
exec-path: string,
|
|
29
|
+
version: string,
|
|
30
|
+
versions: list<tuple<string, string>>,
|
|
31
|
+
release-json: string,
|
|
32
|
+
config-json: string,
|
|
33
|
+
features-json: string,
|
|
34
|
+
has-permission: bool,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
enum flag {
|
|
38
|
+
no-deprecation,
|
|
39
|
+
throw-deprecation,
|
|
40
|
+
trace-deprecation,
|
|
41
|
+
trace-process-warnings
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
variant exit-code {
|
|
45
|
+
number(f64),
|
|
46
|
+
text(string)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
record state {
|
|
50
|
+
title: string,
|
|
51
|
+
debug-port: f64,
|
|
52
|
+
exit-code: option<exit-code>,
|
|
53
|
+
no-deprecation: option<bool>,
|
|
54
|
+
throw-deprecation: option<bool>,
|
|
55
|
+
trace-deprecation: option<bool>,
|
|
56
|
+
trace-process-warnings: option<bool>,
|
|
57
|
+
source-maps-enabled: bool,
|
|
58
|
+
connected: option<bool>,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
enum identity {
|
|
62
|
+
uid,
|
|
63
|
+
euid,
|
|
64
|
+
gid,
|
|
65
|
+
egid
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
variant id {
|
|
69
|
+
number(u32),
|
|
70
|
+
name(string)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
variant signal {
|
|
74
|
+
number(s32),
|
|
75
|
+
name(string)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
variant mask {
|
|
79
|
+
number(u32),
|
|
80
|
+
text(string)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
variant path {
|
|
84
|
+
text(string),
|
|
85
|
+
url(string),
|
|
86
|
+
bytes(list<u8>)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
record warning {
|
|
90
|
+
name: string,
|
|
91
|
+
message: string,
|
|
92
|
+
stack: option<string>,
|
|
93
|
+
code: option<string>,
|
|
94
|
+
detail: option<string>
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
record report-options {
|
|
98
|
+
compact: bool,
|
|
99
|
+
directory: string,
|
|
100
|
+
filename: string,
|
|
101
|
+
signal: string,
|
|
102
|
+
report-on-fatal-error: bool,
|
|
103
|
+
report-on-signal: bool,
|
|
104
|
+
report-on-uncaught-exception: bool,
|
|
105
|
+
exclude-env: bool,
|
|
106
|
+
exclude-network: bool,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
enum report-option {
|
|
110
|
+
compact,
|
|
111
|
+
directory,
|
|
112
|
+
filename,
|
|
113
|
+
signal,
|
|
114
|
+
report-on-fatal-error,
|
|
115
|
+
report-on-signal,
|
|
116
|
+
report-on-uncaught-exception,
|
|
117
|
+
exclude-env,
|
|
118
|
+
exclude-network
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
variant report-value {
|
|
122
|
+
boolean(bool),
|
|
123
|
+
text(string)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
record cpu-usage-record {
|
|
127
|
+
user: f64,
|
|
128
|
+
system: f64
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
record memory-usage-record {
|
|
132
|
+
rss: f64,
|
|
133
|
+
heap-total: f64,
|
|
134
|
+
heap-used: f64,
|
|
135
|
+
external: f64,
|
|
136
|
+
array-buffers: f64
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
record resource-usage-record {
|
|
140
|
+
user-cpu-time: f64,
|
|
141
|
+
system-cpu-time: f64,
|
|
142
|
+
max-rss: f64,
|
|
143
|
+
shared-memory-size: f64,
|
|
144
|
+
unshared-data-size: f64,
|
|
145
|
+
unshared-stack-size: f64,
|
|
146
|
+
minor-page-fault: f64,
|
|
147
|
+
major-page-fault: f64,
|
|
148
|
+
swapped-out: f64,
|
|
149
|
+
fs-read: f64,
|
|
150
|
+
fs-write: f64,
|
|
151
|
+
ipc-sent: f64,
|
|
152
|
+
ipc-received: f64,
|
|
153
|
+
signals-count: f64,
|
|
154
|
+
voluntary-context-switches: f64,
|
|
155
|
+
involuntary-context-switches: f64
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
metadata: func() -> result<process-metadata, error>;
|
|
159
|
+
|
|
160
|
+
get-state: func() -> result<state, error>;
|
|
161
|
+
|
|
162
|
+
set-title: func(value: string) -> result<_, error>;
|
|
163
|
+
|
|
164
|
+
set-debug-port: func(value: f64) -> result<_, error>;
|
|
165
|
+
|
|
166
|
+
set-exit-code: func(value: option<exit-code>) -> result<_, error>;
|
|
167
|
+
|
|
168
|
+
set-flag: func(name: flag, value: bool) -> result<_, error>;
|
|
169
|
+
|
|
170
|
+
env-entries: func() -> result<list<tuple<string, string>>, error>;
|
|
171
|
+
|
|
172
|
+
env-get: func(name: string) -> result<option<string>, error>;
|
|
173
|
+
|
|
174
|
+
env-set: func(name: string, value: option<string>) -> result<_, error>;
|
|
175
|
+
|
|
176
|
+
cwd: func() -> result<string, error>;
|
|
177
|
+
|
|
178
|
+
chdir: func(directory: string) -> result<_, error>;
|
|
179
|
+
|
|
180
|
+
cpu-usage: func(previous: option<cpu-usage-record>) -> result<cpu-usage-record, error>;
|
|
181
|
+
|
|
182
|
+
thread-cpu-usage: func(previous: option<cpu-usage-record>) -> result<cpu-usage-record, error>;
|
|
183
|
+
|
|
184
|
+
memory-usage: func() -> result<memory-usage-record, error>;
|
|
185
|
+
|
|
186
|
+
rss: func() -> result<f64, error>;
|
|
187
|
+
|
|
188
|
+
resource-usage: func() -> result<resource-usage-record, error>;
|
|
189
|
+
|
|
190
|
+
/// Split the clock to avoid engines that lift WIT u64 as an imprecise JS number.
|
|
191
|
+
record clock-time {
|
|
192
|
+
seconds: f64,
|
|
193
|
+
nanoseconds: u32
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
hrtime: func() -> result<clock-time, error>;
|
|
197
|
+
|
|
198
|
+
uptime: func() -> result<f64, error>;
|
|
199
|
+
|
|
200
|
+
available-memory: func() -> result<f64, error>;
|
|
201
|
+
|
|
202
|
+
constrained-memory: func() -> result<f64, error>;
|
|
203
|
+
|
|
204
|
+
get-active-resources-info: func() -> result<list<string>, error>;
|
|
205
|
+
|
|
206
|
+
get-id: func(kind: identity) -> result<u32, error>;
|
|
207
|
+
|
|
208
|
+
set-id: func(kind: identity, value: id) -> result<_, error>;
|
|
209
|
+
|
|
210
|
+
getgroups: func() -> result<list<u32>, error>;
|
|
211
|
+
|
|
212
|
+
setgroups: func(groups: list<id>) -> result<_, error>;
|
|
213
|
+
|
|
214
|
+
initgroups: func(user: id, extra-group: id) -> result<_, error>;
|
|
215
|
+
|
|
216
|
+
kill: func(pid: s32, signal: signal) -> result<bool, error>;
|
|
217
|
+
|
|
218
|
+
umask: func(mask: mask) -> result<u32, error>;
|
|
219
|
+
|
|
220
|
+
exit: func(code: option<exit-code>) -> result<_, error>;
|
|
221
|
+
|
|
222
|
+
abort: func() -> result<_, error>;
|
|
223
|
+
|
|
224
|
+
execve: func(file: string, args: list<string>, env: option<list<tuple<string, string>>>) -> result<_, error>;
|
|
225
|
+
|
|
226
|
+
load-env-file: func(path: option<path>) -> result<_, error>;
|
|
227
|
+
|
|
228
|
+
set-source-maps-enabled: func(value: bool) -> result<_, error>;
|
|
229
|
+
|
|
230
|
+
emit-warning: func(warning: warning) -> result<_, error>;
|
|
231
|
+
|
|
232
|
+
permission-has: func(scope: string, reference: option<path>) -> result<bool, error>;
|
|
233
|
+
|
|
234
|
+
get-report: func(error: option<warning>) -> result<string, error>;
|
|
235
|
+
|
|
236
|
+
write-report: func(filename: option<string>, error: option<warning>) -> result<string, error>;
|
|
237
|
+
|
|
238
|
+
get-report-options: func() -> result<report-options, error>;
|
|
239
|
+
|
|
240
|
+
set-report-option: func(name: report-option, value: report-value) -> result<_, error>;
|
|
241
|
+
|
|
242
|
+
allowed-flags: func() -> result<list<string>, error>;
|
|
243
|
+
|
|
244
|
+
allowed-flag: func(value: string) -> result<bool, error>;
|
|
245
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
package jco:node@0.1.0;
|
|
2
|
+
|
|
3
|
+
/// Explicit SQLite capability for Node-compatible synchronous database operations.
|
|
4
|
+
/// The default provider denies access, including :memory:. Mapping a provider grants
|
|
5
|
+
/// its database/file/extension authority; the guest's WASI filesystem is unrelated.
|
|
6
|
+
/// No callbacks may re-enter the guest while a synchronous SQL import is active.
|
|
7
|
+
interface sqlite {
|
|
8
|
+
record error {
|
|
9
|
+
name: string,
|
|
10
|
+
message: string,
|
|
11
|
+
code: option<string>,
|
|
12
|
+
errcode: option<s32>,
|
|
13
|
+
errstr: option<string>,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
variant path { text(string), bytes(list<u8>), url(string) }
|
|
17
|
+
|
|
18
|
+
/// Numbers and bigints stay distinct; blobs are copied across the boundary.
|
|
19
|
+
variant value { null, number(f64), bigint(s64), text(string), blob(list<u8>) }
|
|
20
|
+
|
|
21
|
+
variant row { object(list<tuple<string, value>>), array(list<value>) }
|
|
22
|
+
|
|
23
|
+
record bindings { named: option<list<tuple<string, value>>>, positional: list<value> }
|
|
24
|
+
|
|
25
|
+
record changes { changes: value, last-insert-rowid: value }
|
|
26
|
+
|
|
27
|
+
record column {
|
|
28
|
+
column: option<string>, database: option<string>, name: string,
|
|
29
|
+
table: option<string>, %type: option<string>,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
enum limit-name {
|
|
33
|
+
length, sql-length, column, expr-depth, compound-select, vdbe-op,
|
|
34
|
+
function-arg, attach, like-pattern-length, variable-number, trigger-depth,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
record statement-options {
|
|
38
|
+
read-big-ints: option<bool>, return-arrays: option<bool>,
|
|
39
|
+
allow-bare-named-parameters: option<bool>, allow-unknown-named-parameters: option<bool>,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
record database-options {
|
|
43
|
+
open: option<bool>, read-only: option<bool>,
|
|
44
|
+
enable-foreign-key-constraints: option<bool>, enable-double-quoted-string-literals: option<bool>,
|
|
45
|
+
allow-extension: option<bool>, timeout: option<f64>, defensive: option<bool>,
|
|
46
|
+
statement: statement-options, limits: list<tuple<limit-name, f64>>,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
record session-options { table: option<string>, db: option<string> }
|
|
50
|
+
|
|
51
|
+
record backup-options { source: option<string>, target: option<string>, rate: option<f64> }
|
|
52
|
+
|
|
53
|
+
/// Creates a connection wrapper, possibly unopened. Native failures preserve error fields.
|
|
54
|
+
open-database: func(path: path, options: database-options) -> result<database, error>;
|
|
55
|
+
|
|
56
|
+
/// Asynchronous Node backup: map this import with JSPI. Borrow retains the source
|
|
57
|
+
/// for the whole backup; no callback or implicit access to the guest filesystem.
|
|
58
|
+
backup: func(source: borrow<database>, path: path, options: backup-options) -> result<f64, error>;
|
|
59
|
+
|
|
60
|
+
/// Drop closes the connection. close/open preserve the wrapper for explicit reopening.
|
|
61
|
+
resource database {
|
|
62
|
+
open: func() -> result<_, error>;
|
|
63
|
+
|
|
64
|
+
close: func() -> result<_, error>;
|
|
65
|
+
|
|
66
|
+
is-open: func() -> result<bool, error>;
|
|
67
|
+
|
|
68
|
+
is-transaction: func() -> result<bool, error>;
|
|
69
|
+
|
|
70
|
+
exec: func(sql: string) -> result<_, error>;
|
|
71
|
+
|
|
72
|
+
prepare: func(sql: string, options: statement-options) -> result<statement, error>;
|
|
73
|
+
|
|
74
|
+
location: func(db-name: option<string>) -> result<option<string>, error>;
|
|
75
|
+
|
|
76
|
+
get-limit: func(name: limit-name) -> result<f64, error>;
|
|
77
|
+
|
|
78
|
+
set-limit: func(name: limit-name, value: f64) -> result<_, error>;
|
|
79
|
+
|
|
80
|
+
serialize: func(db-name: option<string>) -> result<list<u8>, error>;
|
|
81
|
+
|
|
82
|
+
deserialize: func(bytes: list<u8>, db-name: option<string>) -> result<_, error>;
|
|
83
|
+
|
|
84
|
+
create-session: func(options: session-options) -> result<session, error>;
|
|
85
|
+
|
|
86
|
+
apply-changeset: func(bytes: list<u8>) -> result<bool, error>;
|
|
87
|
+
|
|
88
|
+
create-tag-store: func(capacity: f64) -> result<tag-store, error>;
|
|
89
|
+
|
|
90
|
+
enable-load-extension: func(allow: bool) -> result<_, error>;
|
|
91
|
+
|
|
92
|
+
enable-defensive: func(active: bool) -> result<_, error>;
|
|
93
|
+
|
|
94
|
+
load-extension: func(path: string, entry-point: option<string>) -> result<_, error>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/// Drop releases the reference to the native statement. Database close/deserialize
|
|
98
|
+
/// invalidates every statement as in Node. No SQL or row materialization on drop.
|
|
99
|
+
resource statement {
|
|
100
|
+
all: func(parameters: bindings) -> result<list<row>, error>;
|
|
101
|
+
|
|
102
|
+
get: func(parameters: bindings) -> result<option<row>, error>;
|
|
103
|
+
|
|
104
|
+
run: func(parameters: bindings) -> result<changes, error>;
|
|
105
|
+
|
|
106
|
+
iterate: func(parameters: bindings) -> result<cursor, error>;
|
|
107
|
+
|
|
108
|
+
columns: func() -> result<list<column>, error>;
|
|
109
|
+
|
|
110
|
+
source-sql: func() -> result<string, error>;
|
|
111
|
+
|
|
112
|
+
expanded-sql: func() -> result<string, error>;
|
|
113
|
+
|
|
114
|
+
set-read-big-ints: func(enabled: bool) -> result<_, error>;
|
|
115
|
+
|
|
116
|
+
set-return-arrays: func(enabled: bool) -> result<_, error>;
|
|
117
|
+
|
|
118
|
+
set-allow-bare-named-parameters: func(enabled: bool) -> result<_, error>;
|
|
119
|
+
|
|
120
|
+
set-allow-unknown-named-parameters: func(enabled: bool) -> result<_, error>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/// next steps exactly once. close and drop invoke iterator.return to release locks.
|
|
124
|
+
resource cursor {
|
|
125
|
+
next: func() -> result<option<row>, error>;
|
|
126
|
+
|
|
127
|
+
close: func() -> result<_, error>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
resource session {
|
|
131
|
+
changeset: func() -> result<list<u8>, error>;
|
|
132
|
+
|
|
133
|
+
patchset: func() -> result<list<u8>, error>;
|
|
134
|
+
|
|
135
|
+
close: func() -> result<_, error>;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/// Tagged SQL uses separate template strings and bound values, never concatenated values.
|
|
139
|
+
resource tag-store {
|
|
140
|
+
all: func(parts: list<string>, parameters: list<value>) -> result<list<row>, error>;
|
|
141
|
+
|
|
142
|
+
get: func(parts: list<string>, parameters: list<value>) -> result<option<row>, error>;
|
|
143
|
+
|
|
144
|
+
run: func(parts: list<string>, parameters: list<value>) -> result<changes, error>;
|
|
145
|
+
|
|
146
|
+
iterate: func(parts: list<string>, parameters: list<value>) -> result<cursor, error>;
|
|
147
|
+
|
|
148
|
+
size: func() -> result<f64, error>;
|
|
149
|
+
|
|
150
|
+
capacity: func() -> result<f64, error>;
|
|
151
|
+
|
|
152
|
+
clear: func() -> result<_, error>;
|
|
153
|
+
}
|
|
154
|
+
}
|