@syntropika/tembra-sdk 0.2.2 → 0.3.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 +43 -17
- package/dist/authoring/types.d.ts +64 -3
- package/dist/authoring/wit.d.ts +6 -0
- package/dist/bridge/commands.d.ts +1190 -0
- package/dist/bridge/identifiers.d.ts +2 -0
- package/dist/bridge/kernel.d.ts +18 -107
- package/dist/bridge/protocol.d.ts +3 -138
- package/dist/browser.d.ts +14 -1
- package/dist/browser.js +141 -3332
- package/dist/chunks/browser-b8jamxw2.js +3399 -0
- package/dist/chunks/execution-nsqc6nrt.js +1419 -0
- package/dist/chunks/index-01zk0xqx.js +160 -0
- package/dist/chunks/index-3fjdfdfd.js +152 -0
- package/dist/chunks/index-aaymjn7v.js +787 -0
- package/dist/chunks/index-c1w7z9hx.js +356 -0
- package/dist/chunks/index-h8t0n42q.js +738 -0
- package/dist/chunks/index-hfds9mzp.js +308 -0
- package/dist/chunks/index-kr4x67wt.js +177 -0
- package/dist/chunks/index-kr6bnh34.js +117 -0
- package/dist/chunks/index-kyt9dj0a.js +1421 -0
- package/dist/chunks/index-n1wxzc9w.js +830 -0
- package/dist/chunks/index-pvac426d.js +74 -0
- package/dist/chunks/index-smyds5ce.js +3234 -0
- package/dist/chunks/index-sse8aapb.js +121 -0
- package/dist/chunks/index-v6heph77.js +643 -0
- package/dist/chunks/index-xrdvnv37.js +3448 -0
- package/dist/chunks/index-za4mg94e.js +26 -0
- package/dist/chunks/index-zkqmnjj8.js +167 -0
- package/dist/coordinator.js +9 -500
- package/dist/error.d.ts +2 -0
- package/dist/errors.d.ts +3 -0
- package/dist/guest.d.ts +173 -0
- package/dist/guest.js +26 -0
- package/dist/host.d.ts +36 -30
- package/dist/host.js +37 -3310
- package/dist/http/bytes.d.ts +8 -0
- package/dist/http/events.d.ts +7 -0
- package/dist/http.d.ts +45 -0
- package/dist/http.js +291 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +49 -862
- package/dist/infrastructure/rpc/client.d.ts +2 -1
- package/dist/infrastructure/rpc/resources.d.ts +28 -0
- package/dist/interpreter/abi.d.ts +54 -0
- package/dist/interpreter/acquire.d.ts +18 -0
- package/dist/interpreter/browser-network.d.ts +52 -0
- package/dist/interpreter/browser-port.d.ts +55 -0
- package/dist/interpreter/browser.d.ts +79 -0
- package/dist/interpreter/cli.d.ts +5 -0
- package/dist/interpreter/codec.d.ts +42 -0
- package/dist/interpreter/component/execution.d.ts +42 -0
- package/dist/interpreter/component/host.d.ts +69 -0
- package/dist/interpreter/component/instance.d.ts +40 -0
- package/dist/interpreter/component/kernel.d.ts +120 -0
- package/dist/interpreter/component/names.d.ts +5 -0
- package/dist/interpreter/component/port.d.ts +85 -0
- package/dist/interpreter/component/prepared.d.ts +97 -0
- package/dist/interpreter/component/resources.d.ts +45 -0
- package/dist/interpreter/component/revision.d.ts +87 -0
- package/dist/interpreter/component/scope.d.ts +116 -0
- package/dist/interpreter/component/streams.d.ts +28 -0
- package/dist/interpreter/component/values.d.ts +79 -0
- package/dist/interpreter/component/wasi-filesystem.d.ts +21 -0
- package/dist/interpreter/component/wasi-host.d.ts +64 -0
- package/dist/interpreter/component/wasi-http.d.ts +33 -0
- package/dist/interpreter/component/wasi-sockets.d.ts +183 -0
- package/dist/interpreter/component/wasi.d.ts +41 -0
- package/dist/interpreter/core.d.ts +64 -0
- package/dist/interpreter/fetch-http-provider.d.ts +17 -0
- package/dist/interpreter/filesystem/contract.d.ts +85 -0
- package/dist/interpreter/filesystem/memory.d.ts +3 -0
- package/dist/interpreter/filesystem/opfs.d.ts +3 -0
- package/dist/interpreter/filesystem/scope.d.ts +35 -0
- package/dist/interpreter/filesystem.d.ts +8 -0
- package/dist/interpreter/gate.d.ts +6 -0
- package/dist/interpreter/host-protocol.d.ts +100 -0
- package/dist/interpreter/http-ingress-fetch.d.ts +7 -0
- package/dist/interpreter/http-ingress.d.ts +96 -0
- package/dist/interpreter/http-provider.d.ts +85 -0
- package/dist/interpreter/io.d.ts +20 -0
- package/dist/interpreter/mobile.d.ts +149 -0
- package/dist/interpreter/native-ingress.d.ts +95 -0
- package/dist/interpreter/node-port.d.ts +25 -0
- package/dist/interpreter/node.d.ts +36 -0
- package/dist/interpreter/revision.d.ts +64 -0
- package/dist/interpreter/scope.d.ts +89 -0
- package/dist/interpreter/socket-addresses.d.ts +50 -0
- package/dist/interpreter/socket-provider.d.ts +110 -0
- package/dist/interpreter/standard-cli.d.ts +34 -0
- package/dist/interpreter/standard-codec.d.ts +96 -0
- package/dist/interpreter/standard-filesystem.d.ts +47 -0
- package/dist/interpreter/standard-host.d.ts +71 -0
- package/dist/interpreter/standard-http-values.d.ts +159 -0
- package/dist/interpreter/standard-http.d.ts +9 -0
- package/dist/interpreter/standard-ingress.d.ts +63 -0
- package/dist/interpreter/standard-sockets.d.ts +177 -0
- package/dist/interpreter/standard-streams.d.ts +218 -0
- package/dist/interpreter/standard-system.d.ts +35 -0
- package/dist/interpreter/standard-utf8.d.ts +4 -0
- package/dist/interpreter/standard.d.ts +18 -0
- package/dist/interpreter/types.d.ts +152 -0
- package/dist/interpreter/wit-shape.d.ts +92 -0
- package/dist/manager.js +5 -332
- package/dist/msgpack.js +9 -615
- package/dist/node.d.ts +8 -1
- package/dist/node.js +248 -3321
- package/dist/rpc.js +196 -699
- package/dist/runtime/adapters.d.ts +120 -0
- package/dist/runtime/adapters.js +38 -0
- package/dist/runtime/calls.d.ts +7 -6
- package/dist/runtime/lifecycle.d.ts +3 -1
- package/dist/runtime/orbs.d.ts +5 -4
- package/dist/runtime/references.d.ts +27 -1
- package/dist/runtime/reload.d.ts +5 -3
- package/dist/runtime/scopes.d.ts +1 -1
- package/dist/runtime/signals.d.ts +4 -0
- package/dist/runtime/wit-client.d.ts +38 -0
- package/dist/telemetry.js +4 -25
- package/dist/tooling/build.d.ts +2 -2
- package/dist/tooling/client-resources.d.ts +23 -0
- package/dist/tooling/client.d.ts +10 -0
- package/dist/tooling/component-glue.d.ts +17 -0
- package/dist/tooling/component.d.ts +11 -0
- package/dist/tooling/index.d.ts +3 -1
- package/dist/tooling/index.js +1155 -102
- package/dist/tooling/resolver.d.ts +4 -4
- package/dist/tooling/typecheck.d.ts +2 -1
- package/dist/tooling/types.d.ts +27 -12
- package/dist/tooling/wit.d.ts +9 -0
- package/dist/wasi/wasi-clocks-types.d.ts +2 -0
- package/dist/wasi/wasi-http-client.d.ts +5 -0
- package/dist/wasi/wasi-http-types.d.ts +285 -0
- package/dist/wasi/wasi-sockets-ip-name-lookup.d.ts +23 -0
- package/dist/wasi/wasi-sockets-types.d.ts +146 -0
- package/package.json +62 -35
- package/src/authoring/declaration.ts +1 -1
- package/src/authoring/types.ts +53 -3
- package/src/authoring/wit.ts +15 -0
- package/src/bridge/commands.ts +1105 -0
- package/src/bridge/identifiers.ts +2 -0
- package/src/bridge/kernel.ts +56 -98
- package/src/bridge/protocol.ts +3 -142
- package/src/browser.ts +90 -6
- package/src/context-key.ts +4 -7
- package/src/error.ts +1 -1
- package/src/errors.ts +7 -0
- package/src/guest.ts +327 -0
- package/src/host.ts +128 -23
- package/src/http/bytes.ts +87 -0
- package/src/http/events.ts +34 -0
- package/src/http.ts +272 -0
- package/src/index.ts +3 -0
- package/src/infrastructure/rpc/client.ts +136 -17
- package/src/infrastructure/rpc/resources.ts +123 -0
- package/src/interpreter/abi.ts +69 -0
- package/src/interpreter/acquire.ts +58 -0
- package/src/interpreter/browser-network.ts +170 -0
- package/src/interpreter/browser-port.ts +425 -0
- package/src/interpreter/browser.ts +340 -0
- package/src/interpreter/cli.ts +30 -0
- package/src/interpreter/codec.ts +298 -0
- package/src/interpreter/component/execution.ts +264 -0
- package/src/interpreter/component/host.ts +409 -0
- package/src/interpreter/component/instance.ts +138 -0
- package/src/interpreter/component/kernel.ts +611 -0
- package/src/interpreter/component/names.ts +13 -0
- package/src/interpreter/component/port.ts +598 -0
- package/src/interpreter/component/prepared.ts +194 -0
- package/src/interpreter/component/resources.ts +345 -0
- package/src/interpreter/component/revision.ts +702 -0
- package/src/interpreter/component/scope.ts +447 -0
- package/src/interpreter/component/streams.ts +180 -0
- package/src/interpreter/component/values.ts +254 -0
- package/src/interpreter/component/wasi-filesystem.ts +472 -0
- package/src/interpreter/component/wasi-host.ts +197 -0
- package/src/interpreter/component/wasi-http.ts +939 -0
- package/src/interpreter/component/wasi-sockets.ts +958 -0
- package/src/interpreter/component/wasi.ts +238 -0
- package/src/interpreter/core.ts +386 -0
- package/src/interpreter/fetch-http-provider.ts +98 -0
- package/src/interpreter/filesystem/contract.ts +138 -0
- package/src/interpreter/filesystem/memory.ts +180 -0
- package/src/interpreter/filesystem/opfs.ts +294 -0
- package/src/interpreter/filesystem/scope.ts +390 -0
- package/src/interpreter/filesystem.ts +20 -0
- package/src/interpreter/gate.ts +55 -0
- package/src/interpreter/host-protocol.ts +242 -0
- package/src/interpreter/http-ingress-fetch.ts +133 -0
- package/src/interpreter/http-ingress.ts +203 -0
- package/src/interpreter/http-provider.ts +105 -0
- package/src/interpreter/io.ts +66 -0
- package/src/interpreter/mobile.ts +385 -0
- package/src/interpreter/native-ingress.ts +550 -0
- package/src/interpreter/node-port.ts +218 -0
- package/src/interpreter/node.ts +114 -0
- package/src/interpreter/revision.ts +450 -0
- package/src/interpreter/scope.ts +453 -0
- package/src/interpreter/socket-addresses.ts +246 -0
- package/src/interpreter/socket-provider.ts +126 -0
- package/src/interpreter/standard-cli.ts +184 -0
- package/src/interpreter/standard-codec.ts +403 -0
- package/src/interpreter/standard-filesystem.ts +545 -0
- package/src/interpreter/standard-host.ts +840 -0
- package/src/interpreter/standard-http-values.ts +624 -0
- package/src/interpreter/standard-http.ts +622 -0
- package/src/interpreter/standard-ingress.ts +344 -0
- package/src/interpreter/standard-sockets.ts +847 -0
- package/src/interpreter/standard-streams.ts +710 -0
- package/src/interpreter/standard-system.ts +182 -0
- package/src/interpreter/standard-utf8.ts +72 -0
- package/src/interpreter/standard.ts +283 -0
- package/src/interpreter/types.ts +163 -0
- package/src/interpreter/wit-shape.ts +175 -0
- package/src/node.ts +43 -14
- package/src/runtime/activities.ts +6 -6
- package/src/runtime/adapters.ts +314 -0
- package/src/runtime/calls.ts +213 -90
- package/src/runtime/context.ts +7 -7
- package/src/runtime/lifecycle.ts +36 -17
- package/src/runtime/orbs.ts +81 -39
- package/src/runtime/programs.ts +16 -8
- package/src/runtime/references.ts +128 -11
- package/src/runtime/reload.ts +71 -30
- package/src/runtime/resources.ts +2 -2
- package/src/runtime/scopes.ts +17 -17
- package/src/runtime/session.ts +3 -1
- package/src/runtime/signals.ts +31 -0
- package/src/runtime/wit-client.ts +228 -0
- package/src/tooling/build.ts +152 -54
- package/src/tooling/client-resources.ts +74 -0
- package/src/tooling/client.ts +531 -0
- package/src/tooling/component-glue.ts +288 -0
- package/src/tooling/component.ts +225 -0
- package/src/tooling/index.ts +3 -7
- package/src/tooling/resolver.ts +42 -25
- package/src/tooling/typecheck.ts +59 -4
- package/src/tooling/types.ts +27 -12
- package/src/tooling/wit.ts +188 -0
- package/dist/embedded.d.ts +0 -1
- package/dist/embedded.js +0 -1
- package/src/embedded.ts +0 -301
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
export declare
|
|
1
|
+
import type { BuildTarget } from "./types.ts";
|
|
2
|
+
/** Interfaces with generated standard WASI source bindings. */
|
|
3
|
+
export declare const STANDARD_INTERFACES: ReadonlySet<string>;
|
|
4
4
|
/** Resolve and bundle dependencies under the selected runtime rules. */
|
|
5
|
-
export declare function resolver(root: string, target: BuildTarget): Bun.BunPlugin;
|
|
5
|
+
export declare function resolver(root: string, target: BuildTarget, imports: ReadonlySet<string>): Bun.BunPlugin;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
1
2
|
/** Check orb source types before bundling an artifact. */
|
|
2
|
-
export declare function typecheck(entry: string, root: string):
|
|
3
|
+
export declare function typecheck(entry: string, root: string, virtual?: ReadonlyMap<string, string>, conditions?: readonly string[]): ts.Program;
|
package/dist/tooling/types.d.ts
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
|
-
export declare const Platform: Readonly<{
|
|
2
|
-
readonly Browser: "browser";
|
|
3
|
-
readonly Worker: "worker";
|
|
4
|
-
readonly Node: "node";
|
|
5
|
-
readonly Embedded: "embedded";
|
|
6
|
-
}>;
|
|
7
|
-
export type Platform = (typeof Platform)[keyof typeof Platform];
|
|
8
1
|
export interface BuildTarget {
|
|
9
2
|
entry: string;
|
|
10
|
-
|
|
3
|
+
wit: string;
|
|
4
|
+
world?: string;
|
|
5
|
+
/** Compiled components receive their identity from this target's name and API version. */
|
|
6
|
+
apiVersion?: number;
|
|
7
|
+
/**
|
|
8
|
+
* Compiled callback interfaces contributing to their selected Orb's hook, with execution
|
|
9
|
+
* priority, next to those a component built with `#[orb]` carries; a hook named by both must
|
|
10
|
+
* have the same priority.
|
|
11
|
+
*/
|
|
12
|
+
contributes?: Readonly<Record<string, number>>;
|
|
13
|
+
/**
|
|
14
|
+
* Compiled reference-view imports, by import binding, mapped to the provider interface identity
|
|
15
|
+
* each view addresses, next to those a component built with `#[orb]` carries; a view named by
|
|
16
|
+
* both must address the same interface. The contract checks every view's shape before
|
|
17
|
+
* packaging.
|
|
18
|
+
*/
|
|
19
|
+
references?: Readonly<Record<string, string>>;
|
|
20
|
+
/**
|
|
21
|
+
* Compiled Orbs only: also emit `browser/index.js`, an application-owned module that lets
|
|
22
|
+
* browser hosts run exactly this artifact (register it with `createHost({ isolated: {
|
|
23
|
+
* components } })`). Source Orbs run in browsers without preparation.
|
|
24
|
+
*/
|
|
25
|
+
browser?: boolean;
|
|
11
26
|
minify?: boolean;
|
|
12
|
-
typecheck?: boolean;
|
|
13
|
-
nativeExternals?: readonly string[];
|
|
14
27
|
define?: Readonly<Record<string, string>>;
|
|
15
28
|
}
|
|
16
29
|
export interface BuildConfig {
|
|
@@ -19,11 +32,13 @@ export interface BuildConfig {
|
|
|
19
32
|
builds: Readonly<Record<string, BuildTarget>>;
|
|
20
33
|
}
|
|
21
34
|
export interface Artifact {
|
|
35
|
+
/** Build target key; the source Orb's installation identity belongs to its literal declaration. */
|
|
22
36
|
name: string;
|
|
23
|
-
platform: Platform;
|
|
24
37
|
path: string;
|
|
25
38
|
sha256: string;
|
|
26
39
|
bytes: number;
|
|
40
|
+
/** The prepared browser module of a compiled Orb built with `browser: true`. */
|
|
41
|
+
browser?: string;
|
|
27
42
|
}
|
|
28
|
-
/** Preserve build
|
|
43
|
+
/** Preserve literal build configuration types. */
|
|
29
44
|
export declare function defineConfig<const C extends BuildConfig>(config: C): C;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NodeContract } from "@syntropika/tembra-engine-node";
|
|
2
|
+
export interface WitTypes {
|
|
3
|
+
readonly files: ReadonlyMap<string, string>;
|
|
4
|
+
readonly sha256: string;
|
|
5
|
+
readonly contract: NodeContract;
|
|
6
|
+
readonly imports: ReadonlyMap<string, string>;
|
|
7
|
+
}
|
|
8
|
+
/** Generate official WIT declarations in memory and expose a type-only .wit module. */
|
|
9
|
+
export declare function witTypes(file: string, world?: string, root?: string): Promise<WitTypes>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** @module Interface wasi:http/client@0.3.0 **/
|
|
2
|
+
export function send(request: Request): Promise<Response>;
|
|
3
|
+
export type Request = import('./wasi-http-types.js').Request;
|
|
4
|
+
export type Response = import('./wasi-http-types.js').Response;
|
|
5
|
+
export type ErrorCode = import('./wasi-http-types.js').ErrorCode;
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/// <reference lib="esnext.disposable" />
|
|
2
|
+
/** @module Interface wasi:http/types@0.3.0 **/
|
|
3
|
+
export type Duration = import('./wasi-clocks-types.js').Duration;
|
|
4
|
+
export type Method = MethodGet | MethodHead | MethodPost | MethodPut | MethodDelete | MethodConnect | MethodOptions | MethodTrace | MethodPatch | MethodOther;
|
|
5
|
+
export interface MethodGet {
|
|
6
|
+
tag: 'get',
|
|
7
|
+
}
|
|
8
|
+
export interface MethodHead {
|
|
9
|
+
tag: 'head',
|
|
10
|
+
}
|
|
11
|
+
export interface MethodPost {
|
|
12
|
+
tag: 'post',
|
|
13
|
+
}
|
|
14
|
+
export interface MethodPut {
|
|
15
|
+
tag: 'put',
|
|
16
|
+
}
|
|
17
|
+
export interface MethodDelete {
|
|
18
|
+
tag: 'delete',
|
|
19
|
+
}
|
|
20
|
+
export interface MethodConnect {
|
|
21
|
+
tag: 'connect',
|
|
22
|
+
}
|
|
23
|
+
export interface MethodOptions {
|
|
24
|
+
tag: 'options',
|
|
25
|
+
}
|
|
26
|
+
export interface MethodTrace {
|
|
27
|
+
tag: 'trace',
|
|
28
|
+
}
|
|
29
|
+
export interface MethodPatch {
|
|
30
|
+
tag: 'patch',
|
|
31
|
+
}
|
|
32
|
+
export interface MethodOther {
|
|
33
|
+
tag: 'other',
|
|
34
|
+
val: string,
|
|
35
|
+
}
|
|
36
|
+
export type Scheme = SchemeHttp | SchemeHttps | SchemeOther;
|
|
37
|
+
export interface SchemeHttp {
|
|
38
|
+
tag: 'HTTP',
|
|
39
|
+
}
|
|
40
|
+
export interface SchemeHttps {
|
|
41
|
+
tag: 'HTTPS',
|
|
42
|
+
}
|
|
43
|
+
export interface SchemeOther {
|
|
44
|
+
tag: 'other',
|
|
45
|
+
val: string,
|
|
46
|
+
}
|
|
47
|
+
export interface DnsErrorPayload {
|
|
48
|
+
rcode?: string,
|
|
49
|
+
infoCode?: number,
|
|
50
|
+
}
|
|
51
|
+
export interface TlsAlertReceivedPayload {
|
|
52
|
+
alertId?: number,
|
|
53
|
+
alertMessage?: string,
|
|
54
|
+
}
|
|
55
|
+
export interface FieldSizePayload {
|
|
56
|
+
fieldName?: string,
|
|
57
|
+
fieldSize?: number,
|
|
58
|
+
}
|
|
59
|
+
export type ErrorCode = ErrorCodeDnsTimeout | ErrorCodeDnsError | ErrorCodeDestinationNotFound | ErrorCodeDestinationUnavailable | ErrorCodeDestinationIpProhibited | ErrorCodeDestinationIpUnroutable | ErrorCodeConnectionRefused | ErrorCodeConnectionTerminated | ErrorCodeConnectionTimeout | ErrorCodeConnectionReadTimeout | ErrorCodeConnectionWriteTimeout | ErrorCodeConnectionLimitReached | ErrorCodeTlsProtocolError | ErrorCodeTlsCertificateError | ErrorCodeTlsAlertReceived | ErrorCodeHttpRequestDenied | ErrorCodeHttpRequestLengthRequired | ErrorCodeHttpRequestBodySize | ErrorCodeHttpRequestMethodInvalid | ErrorCodeHttpRequestUriInvalid | ErrorCodeHttpRequestUriTooLong | ErrorCodeHttpRequestHeaderSectionSize | ErrorCodeHttpRequestHeaderSize | ErrorCodeHttpRequestTrailerSectionSize | ErrorCodeHttpRequestTrailerSize | ErrorCodeHttpResponseIncomplete | ErrorCodeHttpResponseHeaderSectionSize | ErrorCodeHttpResponseHeaderSize | ErrorCodeHttpResponseBodySize | ErrorCodeHttpResponseTrailerSectionSize | ErrorCodeHttpResponseTrailerSize | ErrorCodeHttpResponseTransferCoding | ErrorCodeHttpResponseContentCoding | ErrorCodeHttpResponseTimeout | ErrorCodeHttpUpgradeFailed | ErrorCodeHttpProtocolError | ErrorCodeLoopDetected | ErrorCodeConfigurationError | ErrorCodeInternalError;
|
|
60
|
+
export interface ErrorCodeDnsTimeout {
|
|
61
|
+
tag: 'DNS-timeout',
|
|
62
|
+
}
|
|
63
|
+
export interface ErrorCodeDnsError {
|
|
64
|
+
tag: 'DNS-error',
|
|
65
|
+
val: DnsErrorPayload,
|
|
66
|
+
}
|
|
67
|
+
export interface ErrorCodeDestinationNotFound {
|
|
68
|
+
tag: 'destination-not-found',
|
|
69
|
+
}
|
|
70
|
+
export interface ErrorCodeDestinationUnavailable {
|
|
71
|
+
tag: 'destination-unavailable',
|
|
72
|
+
}
|
|
73
|
+
export interface ErrorCodeDestinationIpProhibited {
|
|
74
|
+
tag: 'destination-IP-prohibited',
|
|
75
|
+
}
|
|
76
|
+
export interface ErrorCodeDestinationIpUnroutable {
|
|
77
|
+
tag: 'destination-IP-unroutable',
|
|
78
|
+
}
|
|
79
|
+
export interface ErrorCodeConnectionRefused {
|
|
80
|
+
tag: 'connection-refused',
|
|
81
|
+
}
|
|
82
|
+
export interface ErrorCodeConnectionTerminated {
|
|
83
|
+
tag: 'connection-terminated',
|
|
84
|
+
}
|
|
85
|
+
export interface ErrorCodeConnectionTimeout {
|
|
86
|
+
tag: 'connection-timeout',
|
|
87
|
+
}
|
|
88
|
+
export interface ErrorCodeConnectionReadTimeout {
|
|
89
|
+
tag: 'connection-read-timeout',
|
|
90
|
+
}
|
|
91
|
+
export interface ErrorCodeConnectionWriteTimeout {
|
|
92
|
+
tag: 'connection-write-timeout',
|
|
93
|
+
}
|
|
94
|
+
export interface ErrorCodeConnectionLimitReached {
|
|
95
|
+
tag: 'connection-limit-reached',
|
|
96
|
+
}
|
|
97
|
+
export interface ErrorCodeTlsProtocolError {
|
|
98
|
+
tag: 'TLS-protocol-error',
|
|
99
|
+
}
|
|
100
|
+
export interface ErrorCodeTlsCertificateError {
|
|
101
|
+
tag: 'TLS-certificate-error',
|
|
102
|
+
}
|
|
103
|
+
export interface ErrorCodeTlsAlertReceived {
|
|
104
|
+
tag: 'TLS-alert-received',
|
|
105
|
+
val: TlsAlertReceivedPayload,
|
|
106
|
+
}
|
|
107
|
+
export interface ErrorCodeHttpRequestDenied {
|
|
108
|
+
tag: 'HTTP-request-denied',
|
|
109
|
+
}
|
|
110
|
+
export interface ErrorCodeHttpRequestLengthRequired {
|
|
111
|
+
tag: 'HTTP-request-length-required',
|
|
112
|
+
}
|
|
113
|
+
export interface ErrorCodeHttpRequestBodySize {
|
|
114
|
+
tag: 'HTTP-request-body-size',
|
|
115
|
+
val: bigint | undefined,
|
|
116
|
+
}
|
|
117
|
+
export interface ErrorCodeHttpRequestMethodInvalid {
|
|
118
|
+
tag: 'HTTP-request-method-invalid',
|
|
119
|
+
}
|
|
120
|
+
export interface ErrorCodeHttpRequestUriInvalid {
|
|
121
|
+
tag: 'HTTP-request-URI-invalid',
|
|
122
|
+
}
|
|
123
|
+
export interface ErrorCodeHttpRequestUriTooLong {
|
|
124
|
+
tag: 'HTTP-request-URI-too-long',
|
|
125
|
+
}
|
|
126
|
+
export interface ErrorCodeHttpRequestHeaderSectionSize {
|
|
127
|
+
tag: 'HTTP-request-header-section-size',
|
|
128
|
+
val: number | undefined,
|
|
129
|
+
}
|
|
130
|
+
export interface ErrorCodeHttpRequestHeaderSize {
|
|
131
|
+
tag: 'HTTP-request-header-size',
|
|
132
|
+
val: FieldSizePayload | undefined,
|
|
133
|
+
}
|
|
134
|
+
export interface ErrorCodeHttpRequestTrailerSectionSize {
|
|
135
|
+
tag: 'HTTP-request-trailer-section-size',
|
|
136
|
+
val: number | undefined,
|
|
137
|
+
}
|
|
138
|
+
export interface ErrorCodeHttpRequestTrailerSize {
|
|
139
|
+
tag: 'HTTP-request-trailer-size',
|
|
140
|
+
val: FieldSizePayload,
|
|
141
|
+
}
|
|
142
|
+
export interface ErrorCodeHttpResponseIncomplete {
|
|
143
|
+
tag: 'HTTP-response-incomplete',
|
|
144
|
+
}
|
|
145
|
+
export interface ErrorCodeHttpResponseHeaderSectionSize {
|
|
146
|
+
tag: 'HTTP-response-header-section-size',
|
|
147
|
+
val: number | undefined,
|
|
148
|
+
}
|
|
149
|
+
export interface ErrorCodeHttpResponseHeaderSize {
|
|
150
|
+
tag: 'HTTP-response-header-size',
|
|
151
|
+
val: FieldSizePayload,
|
|
152
|
+
}
|
|
153
|
+
export interface ErrorCodeHttpResponseBodySize {
|
|
154
|
+
tag: 'HTTP-response-body-size',
|
|
155
|
+
val: bigint | undefined,
|
|
156
|
+
}
|
|
157
|
+
export interface ErrorCodeHttpResponseTrailerSectionSize {
|
|
158
|
+
tag: 'HTTP-response-trailer-section-size',
|
|
159
|
+
val: number | undefined,
|
|
160
|
+
}
|
|
161
|
+
export interface ErrorCodeHttpResponseTrailerSize {
|
|
162
|
+
tag: 'HTTP-response-trailer-size',
|
|
163
|
+
val: FieldSizePayload,
|
|
164
|
+
}
|
|
165
|
+
export interface ErrorCodeHttpResponseTransferCoding {
|
|
166
|
+
tag: 'HTTP-response-transfer-coding',
|
|
167
|
+
val: string | undefined,
|
|
168
|
+
}
|
|
169
|
+
export interface ErrorCodeHttpResponseContentCoding {
|
|
170
|
+
tag: 'HTTP-response-content-coding',
|
|
171
|
+
val: string | undefined,
|
|
172
|
+
}
|
|
173
|
+
export interface ErrorCodeHttpResponseTimeout {
|
|
174
|
+
tag: 'HTTP-response-timeout',
|
|
175
|
+
}
|
|
176
|
+
export interface ErrorCodeHttpUpgradeFailed {
|
|
177
|
+
tag: 'HTTP-upgrade-failed',
|
|
178
|
+
}
|
|
179
|
+
export interface ErrorCodeHttpProtocolError {
|
|
180
|
+
tag: 'HTTP-protocol-error',
|
|
181
|
+
}
|
|
182
|
+
export interface ErrorCodeLoopDetected {
|
|
183
|
+
tag: 'loop-detected',
|
|
184
|
+
}
|
|
185
|
+
export interface ErrorCodeConfigurationError {
|
|
186
|
+
tag: 'configuration-error',
|
|
187
|
+
}
|
|
188
|
+
export interface ErrorCodeInternalError {
|
|
189
|
+
tag: 'internal-error',
|
|
190
|
+
val: string | undefined,
|
|
191
|
+
}
|
|
192
|
+
export type HeaderError = HeaderErrorInvalidSyntax | HeaderErrorForbidden | HeaderErrorImmutable | HeaderErrorSizeExceeded | HeaderErrorOther;
|
|
193
|
+
export interface HeaderErrorInvalidSyntax {
|
|
194
|
+
tag: 'invalid-syntax',
|
|
195
|
+
}
|
|
196
|
+
export interface HeaderErrorForbidden {
|
|
197
|
+
tag: 'forbidden',
|
|
198
|
+
}
|
|
199
|
+
export interface HeaderErrorImmutable {
|
|
200
|
+
tag: 'immutable',
|
|
201
|
+
}
|
|
202
|
+
export interface HeaderErrorSizeExceeded {
|
|
203
|
+
tag: 'size-exceeded',
|
|
204
|
+
}
|
|
205
|
+
export interface HeaderErrorOther {
|
|
206
|
+
tag: 'other',
|
|
207
|
+
val: string | undefined,
|
|
208
|
+
}
|
|
209
|
+
export type RequestOptionsError = RequestOptionsErrorNotSupported | RequestOptionsErrorImmutable | RequestOptionsErrorOther;
|
|
210
|
+
export interface RequestOptionsErrorNotSupported {
|
|
211
|
+
tag: 'not-supported',
|
|
212
|
+
}
|
|
213
|
+
export interface RequestOptionsErrorImmutable {
|
|
214
|
+
tag: 'immutable',
|
|
215
|
+
}
|
|
216
|
+
export interface RequestOptionsErrorOther {
|
|
217
|
+
tag: 'other',
|
|
218
|
+
val: string | undefined,
|
|
219
|
+
}
|
|
220
|
+
export type FieldName = string;
|
|
221
|
+
export type FieldValue = Uint8Array;
|
|
222
|
+
export type Headers = Fields;
|
|
223
|
+
export type Trailers = Fields;
|
|
224
|
+
export type StatusCode = number;
|
|
225
|
+
export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
|
|
226
|
+
|
|
227
|
+
export class Fields {
|
|
228
|
+
constructor()
|
|
229
|
+
static fromList(entries: Array<[FieldName, FieldValue]>): Fields;
|
|
230
|
+
get(name: FieldName): Array<FieldValue>;
|
|
231
|
+
has(name: FieldName): boolean;
|
|
232
|
+
set(name: FieldName, value: Array<FieldValue>): void;
|
|
233
|
+
"delete"(name: FieldName): void;
|
|
234
|
+
getAndDelete(name: FieldName): Array<FieldValue>;
|
|
235
|
+
append(name: FieldName, value: FieldValue): void;
|
|
236
|
+
copyAll(): Array<[FieldName, FieldValue]>;
|
|
237
|
+
clone(): Fields;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export class Request {
|
|
241
|
+
/**
|
|
242
|
+
* This type does not have a public constructor.
|
|
243
|
+
*/
|
|
244
|
+
private constructor();
|
|
245
|
+
static "new"(headers: Headers, contents: AsyncIterable<number> | undefined, trailers: PromiseLike<Result<Trailers | undefined, ErrorCode>>, options: RequestOptions | undefined): [Request, PromiseLike<Result<void, ErrorCode>>];
|
|
246
|
+
getMethod(): Method;
|
|
247
|
+
setMethod(method: Method): void;
|
|
248
|
+
getPathWithQuery(): string | undefined;
|
|
249
|
+
setPathWithQuery(pathWithQuery: string | undefined): void;
|
|
250
|
+
getScheme(): Scheme | undefined;
|
|
251
|
+
setScheme(scheme: Scheme | undefined): void;
|
|
252
|
+
getAuthority(): string | undefined;
|
|
253
|
+
setAuthority(authority: string | undefined): void;
|
|
254
|
+
getOptions(): RequestOptions | undefined;
|
|
255
|
+
getHeaders(): Headers;
|
|
256
|
+
static consumeBody(this_: Request, res: PromiseLike<Result<void, ErrorCode>>): [AsyncIterable<number>, PromiseLike<Result<Trailers | undefined, ErrorCode>>];
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export class RequestOptions {
|
|
260
|
+
constructor()
|
|
261
|
+
getConnectTimeout(): Duration | undefined;
|
|
262
|
+
setConnectTimeout(duration: Duration | undefined): void;
|
|
263
|
+
getFirstByteTimeout(): Duration | undefined;
|
|
264
|
+
setFirstByteTimeout(duration: Duration | undefined): void;
|
|
265
|
+
getBetweenBytesTimeout(): Duration | undefined;
|
|
266
|
+
setBetweenBytesTimeout(duration: Duration | undefined): void;
|
|
267
|
+
clone(): RequestOptions;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export class Response {
|
|
271
|
+
/**
|
|
272
|
+
* This type does not have a public constructor.
|
|
273
|
+
*/
|
|
274
|
+
private constructor();
|
|
275
|
+
static "new"(headers: Headers, contents: AsyncIterable<number> | undefined, trailers: PromiseLike<Result<Trailers | undefined, ErrorCode>>): [Response, PromiseLike<Result<void, ErrorCode>>];
|
|
276
|
+
getStatusCode(): StatusCode;
|
|
277
|
+
setStatusCode(statusCode: StatusCode): void;
|
|
278
|
+
getHeaders(): Headers;
|
|
279
|
+
static consumeBody(this_: Response, res: PromiseLike<Result<void, ErrorCode>>): [AsyncIterable<number>, PromiseLike<Result<Trailers | undefined, ErrorCode>>];
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export interface Fields extends Disposable {}
|
|
283
|
+
export interface Request extends Disposable {}
|
|
284
|
+
export interface RequestOptions extends Disposable {}
|
|
285
|
+
export interface Response extends Disposable {}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @module Interface wasi:sockets/ip-name-lookup@0.3.0 **/
|
|
2
|
+
export function resolveAddresses(name: string): Promise<Array<IpAddress>>;
|
|
3
|
+
export type IpAddress = import('./wasi-sockets-types.js').IpAddress;
|
|
4
|
+
export type ErrorCode = ErrorCodeAccessDenied | ErrorCodeInvalidArgument | ErrorCodeNameUnresolvable | ErrorCodeTemporaryResolverFailure | ErrorCodePermanentResolverFailure | ErrorCodeOther;
|
|
5
|
+
export interface ErrorCodeAccessDenied {
|
|
6
|
+
tag: 'access-denied',
|
|
7
|
+
}
|
|
8
|
+
export interface ErrorCodeInvalidArgument {
|
|
9
|
+
tag: 'invalid-argument',
|
|
10
|
+
}
|
|
11
|
+
export interface ErrorCodeNameUnresolvable {
|
|
12
|
+
tag: 'name-unresolvable',
|
|
13
|
+
}
|
|
14
|
+
export interface ErrorCodeTemporaryResolverFailure {
|
|
15
|
+
tag: 'temporary-resolver-failure',
|
|
16
|
+
}
|
|
17
|
+
export interface ErrorCodePermanentResolverFailure {
|
|
18
|
+
tag: 'permanent-resolver-failure',
|
|
19
|
+
}
|
|
20
|
+
export interface ErrorCodeOther {
|
|
21
|
+
tag: 'other',
|
|
22
|
+
val: string | undefined,
|
|
23
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/// <reference lib="esnext.disposable" />
|
|
2
|
+
/** @module Interface wasi:sockets/types@0.3.0 **/
|
|
3
|
+
export type Duration = import('./wasi-clocks-types.js').Duration;
|
|
4
|
+
export type ErrorCode = ErrorCodeAccessDenied | ErrorCodeNotSupported | ErrorCodeInvalidArgument | ErrorCodeOutOfMemory | ErrorCodeTimeout | ErrorCodeInvalidState | ErrorCodeAddressNotBindable | ErrorCodeAddressInUse | ErrorCodeRemoteUnreachable | ErrorCodeConnectionRefused | ErrorCodeConnectionBroken | ErrorCodeConnectionReset | ErrorCodeConnectionAborted | ErrorCodeDatagramTooLarge | ErrorCodeOther;
|
|
5
|
+
export interface ErrorCodeAccessDenied {
|
|
6
|
+
tag: 'access-denied',
|
|
7
|
+
}
|
|
8
|
+
export interface ErrorCodeNotSupported {
|
|
9
|
+
tag: 'not-supported',
|
|
10
|
+
}
|
|
11
|
+
export interface ErrorCodeInvalidArgument {
|
|
12
|
+
tag: 'invalid-argument',
|
|
13
|
+
}
|
|
14
|
+
export interface ErrorCodeOutOfMemory {
|
|
15
|
+
tag: 'out-of-memory',
|
|
16
|
+
}
|
|
17
|
+
export interface ErrorCodeTimeout {
|
|
18
|
+
tag: 'timeout',
|
|
19
|
+
}
|
|
20
|
+
export interface ErrorCodeInvalidState {
|
|
21
|
+
tag: 'invalid-state',
|
|
22
|
+
}
|
|
23
|
+
export interface ErrorCodeAddressNotBindable {
|
|
24
|
+
tag: 'address-not-bindable',
|
|
25
|
+
}
|
|
26
|
+
export interface ErrorCodeAddressInUse {
|
|
27
|
+
tag: 'address-in-use',
|
|
28
|
+
}
|
|
29
|
+
export interface ErrorCodeRemoteUnreachable {
|
|
30
|
+
tag: 'remote-unreachable',
|
|
31
|
+
}
|
|
32
|
+
export interface ErrorCodeConnectionRefused {
|
|
33
|
+
tag: 'connection-refused',
|
|
34
|
+
}
|
|
35
|
+
export interface ErrorCodeConnectionBroken {
|
|
36
|
+
tag: 'connection-broken',
|
|
37
|
+
}
|
|
38
|
+
export interface ErrorCodeConnectionReset {
|
|
39
|
+
tag: 'connection-reset',
|
|
40
|
+
}
|
|
41
|
+
export interface ErrorCodeConnectionAborted {
|
|
42
|
+
tag: 'connection-aborted',
|
|
43
|
+
}
|
|
44
|
+
export interface ErrorCodeDatagramTooLarge {
|
|
45
|
+
tag: 'datagram-too-large',
|
|
46
|
+
}
|
|
47
|
+
export interface ErrorCodeOther {
|
|
48
|
+
tag: 'other',
|
|
49
|
+
val: string | undefined,
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* # Variants
|
|
53
|
+
*
|
|
54
|
+
* ## `"ipv4"`
|
|
55
|
+
*
|
|
56
|
+
* ## `"ipv6"`
|
|
57
|
+
*/
|
|
58
|
+
export type IpAddressFamily = "ipv4" | "ipv6";
|
|
59
|
+
export type Ipv4Address = [number, number, number, number];
|
|
60
|
+
export type Ipv6Address = [number, number, number, number, number, number, number, number];
|
|
61
|
+
export type IpAddress = IpAddressIpv4 | IpAddressIpv6;
|
|
62
|
+
export interface IpAddressIpv4 {
|
|
63
|
+
tag: 'ipv4',
|
|
64
|
+
val: Ipv4Address,
|
|
65
|
+
}
|
|
66
|
+
export interface IpAddressIpv6 {
|
|
67
|
+
tag: 'ipv6',
|
|
68
|
+
val: Ipv6Address,
|
|
69
|
+
}
|
|
70
|
+
export interface Ipv4SocketAddress {
|
|
71
|
+
port: number,
|
|
72
|
+
address: Ipv4Address,
|
|
73
|
+
}
|
|
74
|
+
export interface Ipv6SocketAddress {
|
|
75
|
+
port: number,
|
|
76
|
+
flowInfo: number,
|
|
77
|
+
address: Ipv6Address,
|
|
78
|
+
scopeId: number,
|
|
79
|
+
}
|
|
80
|
+
export type IpSocketAddress = IpSocketAddressIpv4 | IpSocketAddressIpv6;
|
|
81
|
+
export interface IpSocketAddressIpv4 {
|
|
82
|
+
tag: 'ipv4',
|
|
83
|
+
val: Ipv4SocketAddress,
|
|
84
|
+
}
|
|
85
|
+
export interface IpSocketAddressIpv6 {
|
|
86
|
+
tag: 'ipv6',
|
|
87
|
+
val: Ipv6SocketAddress,
|
|
88
|
+
}
|
|
89
|
+
export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
|
|
90
|
+
|
|
91
|
+
export class TcpSocket {
|
|
92
|
+
/**
|
|
93
|
+
* This type does not have a public constructor.
|
|
94
|
+
*/
|
|
95
|
+
private constructor();
|
|
96
|
+
static create(addressFamily: IpAddressFamily): TcpSocket;
|
|
97
|
+
bind(localAddress: IpSocketAddress): void;
|
|
98
|
+
connect(remoteAddress: IpSocketAddress): Promise<void>;
|
|
99
|
+
listen(): AsyncIterable<TcpSocket>;
|
|
100
|
+
send(data: AsyncIterable<number>): PromiseLike<Result<void, ErrorCode>>;
|
|
101
|
+
receive(): [AsyncIterable<number>, PromiseLike<Result<void, ErrorCode>>];
|
|
102
|
+
getLocalAddress(): IpSocketAddress;
|
|
103
|
+
getRemoteAddress(): IpSocketAddress;
|
|
104
|
+
getIsListening(): boolean;
|
|
105
|
+
getAddressFamily(): IpAddressFamily;
|
|
106
|
+
setListenBacklogSize(value: bigint): void;
|
|
107
|
+
getKeepAliveEnabled(): boolean;
|
|
108
|
+
setKeepAliveEnabled(value: boolean): void;
|
|
109
|
+
getKeepAliveIdleTime(): Duration;
|
|
110
|
+
setKeepAliveIdleTime(value: Duration): void;
|
|
111
|
+
getKeepAliveInterval(): Duration;
|
|
112
|
+
setKeepAliveInterval(value: Duration): void;
|
|
113
|
+
getKeepAliveCount(): number;
|
|
114
|
+
setKeepAliveCount(value: number): void;
|
|
115
|
+
getHopLimit(): number;
|
|
116
|
+
setHopLimit(value: number): void;
|
|
117
|
+
getReceiveBufferSize(): bigint;
|
|
118
|
+
setReceiveBufferSize(value: bigint): void;
|
|
119
|
+
getSendBufferSize(): bigint;
|
|
120
|
+
setSendBufferSize(value: bigint): void;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export class UdpSocket {
|
|
124
|
+
/**
|
|
125
|
+
* This type does not have a public constructor.
|
|
126
|
+
*/
|
|
127
|
+
private constructor();
|
|
128
|
+
static create(addressFamily: IpAddressFamily): UdpSocket;
|
|
129
|
+
bind(localAddress: IpSocketAddress): void;
|
|
130
|
+
connect(remoteAddress: IpSocketAddress): void;
|
|
131
|
+
disconnect(): void;
|
|
132
|
+
send(data: Uint8Array, remoteAddress: IpSocketAddress | undefined): Promise<void>;
|
|
133
|
+
receive(): Promise<[Uint8Array, IpSocketAddress]>;
|
|
134
|
+
getLocalAddress(): IpSocketAddress;
|
|
135
|
+
getRemoteAddress(): IpSocketAddress;
|
|
136
|
+
getAddressFamily(): IpAddressFamily;
|
|
137
|
+
getUnicastHopLimit(): number;
|
|
138
|
+
setUnicastHopLimit(value: number): void;
|
|
139
|
+
getReceiveBufferSize(): bigint;
|
|
140
|
+
setReceiveBufferSize(value: bigint): void;
|
|
141
|
+
getSendBufferSize(): bigint;
|
|
142
|
+
setSendBufferSize(value: bigint): void;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface TcpSocket extends Disposable {}
|
|
146
|
+
export interface UdpSocket extends Disposable {}
|