@bytecodealliance/preview2-shim 0.0.3 → 0.0.5

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 (75) hide show
  1. package/lib/browser/default-outgoing-HTTP.js +3 -0
  2. package/lib/browser/environment-preopens.js +3 -0
  3. package/lib/browser/http.js +17 -10
  4. package/lib/browser/index.js +34 -12
  5. package/lib/browser/instance-monotonic-clock.js +3 -0
  6. package/lib/browser/instance-wall-clock.js +3 -0
  7. package/lib/browser/io.js +10 -23
  8. package/lib/browser/poll.js +4 -0
  9. package/lib/browser/preopens.js +11 -0
  10. package/lib/browser/random.js +1 -1
  11. package/lib/browser/streams.js +60 -0
  12. package/lib/browser/types.js +99 -0
  13. package/lib/http/error.js +1 -1
  14. package/lib/http/make-request.js +4 -4
  15. package/lib/http/synckit/index.d.ts +71 -0
  16. package/lib/http/synckit/index.js +141 -0
  17. package/lib/http/wasi-http.js +267 -0
  18. package/lib/nodejs/default-outgoing-HTTP.js +3 -0
  19. package/lib/nodejs/environment-preopens.js +3 -0
  20. package/lib/nodejs/environment.js +4 -0
  21. package/lib/nodejs/filesystem.js +7 -5
  22. package/lib/nodejs/http.js +4 -4
  23. package/lib/nodejs/index.js +34 -12
  24. package/lib/nodejs/instance-monotonic-clock.js +3 -0
  25. package/lib/nodejs/instance-wall-clock.js +3 -0
  26. package/lib/nodejs/io.js +16 -24
  27. package/lib/nodejs/monotonic-clock.js +4 -0
  28. package/lib/nodejs/poll.js +4 -0
  29. package/lib/nodejs/preopens.js +11 -0
  30. package/lib/nodejs/random.js +1 -1
  31. package/lib/nodejs/streams.js +63 -0
  32. package/lib/nodejs/types.js +99 -0
  33. package/lib/nodejs/wall-clock.js +4 -0
  34. package/package.json +18 -3
  35. package/types/exports/HTTP.d.ts +7 -0
  36. package/types/imports/console.d.ts +17 -0
  37. package/types/imports/default-outgoing-HTTP.d.ts +9 -0
  38. package/types/imports/environment-preopens.d.ts +5 -0
  39. package/types/imports/environment.d.ts +3 -0
  40. package/types/imports/exit.d.ts +4 -0
  41. package/types/imports/filesystem.d.ts +212 -0
  42. package/types/imports/instance-monotonic-clock.d.ts +5 -0
  43. package/types/imports/instance-network.d.ts +5 -0
  44. package/types/imports/instance-wall-clock.d.ts +5 -0
  45. package/types/imports/ip-name-lookup.d.ts +19 -0
  46. package/types/imports/monotonic-clock.d.ts +10 -0
  47. package/types/imports/network.d.ts +50 -0
  48. package/types/imports/poll.d.ts +5 -0
  49. package/types/imports/preopens.d.ts +15 -0
  50. package/types/imports/random.d.ts +5 -0
  51. package/types/{wasi-stderr.d.ts → imports/stderr.d.ts} +1 -1
  52. package/types/imports/streams.d.ts +23 -0
  53. package/types/imports/tcp-create-socket.d.ts +9 -0
  54. package/types/imports/tcp.d.ts +52 -0
  55. package/types/imports/timezone.d.ts +13 -0
  56. package/types/imports/types.d.ts +119 -0
  57. package/types/imports/udp-create-socket.d.ts +9 -0
  58. package/types/imports/udp.d.ts +36 -0
  59. package/types/imports/wall-clock.d.ts +10 -0
  60. package/types/index.d.ts +8 -9
  61. package/types/wasi-proxy.d.ts +44 -0
  62. package/types/wasi-reactor.d.ts +72 -0
  63. package/lib/browser/clocks.js +0 -47
  64. package/lib/browser/default-clocks.js +0 -7
  65. package/lib/nodejs/default-clocks.js +0 -7
  66. package/types/wasi-clocks.d.ts +0 -11
  67. package/types/wasi-default-clocks.d.ts +0 -6
  68. package/types/wasi-exit.d.ts +0 -3
  69. package/types/wasi-filesystem.d.ts +0 -150
  70. package/types/wasi-http.d.ts +0 -55
  71. package/types/wasi-io.d.ts +0 -10
  72. package/types/wasi-poll.d.ts +0 -4
  73. package/types/wasi-random.d.ts +0 -3
  74. /package/lib/browser/{logging.js → console.js} +0 -0
  75. /package/lib/nodejs/{logging.js → console.js} +0 -0
@@ -0,0 +1,267 @@
1
+ // Based on:
2
+ // https://github.com/bytecodealliance/wasmtime/blob/76eb40e0756d90cc9c16b26a8d8b1e0ebf75f44d/crates/wasi-http/src/http_impl.rs
3
+
4
+ /**
5
+ * @typedef {import("../../types/imports/types").Fields} Fields
6
+ * @typedef {import("../../types/imports/types").FutureIncomingResponse} FutureIncomingResponse
7
+ * @typedef {import("../../types/imports/types").Headers} Headers
8
+ * @typedef {import("../../types/imports/types").IncomingResponse} IncomingResponse
9
+ * @typedef {import("../../types/imports/types").IncomingStream} IncomingStream
10
+ * @typedef {import("../../types/imports/types").Method} Method
11
+ * @typedef {import("../../types/imports/types").OutgoingRequest} OutgoingRequest
12
+ * @typedef {import("../../types/imports/types").RequestOptions} RequestOptions
13
+ * @typedef {import("../../types/imports/types").Scheme} Scheme
14
+ * @typedef {import("../../types/imports/types").StatusCode} StatusCode
15
+ */
16
+
17
+ import * as io from '@bytecodealliance/preview2-shim/io';
18
+ import * as http from '@bytecodealliance/preview2-shim/http';
19
+
20
+ export class WasiHttp {
21
+ requestIdBase = 1;
22
+ responseIdBase = 1;
23
+ fieldsIdBase = 1;
24
+ streamsIdBase = 3;
25
+ /** @type {Map<number,ActiveRequest>} */ requests = new Map();
26
+ /** @type {Map<number,ActiveResponse>} */ responses = new Map();
27
+ /** @type {Map<number,Map<string,string[]>>} */ fields = new Map();
28
+ /** @type {Map<number,Uint8Array>} */ streams = new Map();
29
+
30
+ constructor() {}
31
+
32
+ /**
33
+ * @param {OutgoingRequest} requestId
34
+ * @param {RequestOptions | null} options
35
+ * @returns {FutureIncomingResponse}
36
+ */
37
+ handle = (requestId, {
38
+ connectTimeoutMs: _connectTimeoutMs = 600_000,
39
+ firstByteTimeoutMs: _firstByteTimeoutMs = 600_000,
40
+ betweenBytesTimeoutMs: _betweenBytesTimeoutMs = 600_000
41
+ } = {}) => {
42
+ const request = this.requests.get(requestId);
43
+ if (!request) throw Error("not found!");
44
+
45
+ const responseId = this.responseIdBase;
46
+ this.responseIdBase += 1;
47
+ const response = new ActiveResponse(responseId);
48
+
49
+ const scheme = request.scheme.tag === "HTTP" ? "http://" : "https://";
50
+
51
+ const url = scheme + request.authority + request.path + request.query;
52
+ const headers = {
53
+ "host": request.authority,
54
+ };
55
+ for (const [key, value] of request.headers.entries()) {
56
+ headers[key] = Array.isArray(value) ? value.join(",") : value;
57
+ }
58
+ const body = this.streams.get(request.body);
59
+
60
+ const res = http.send({
61
+ method: request.method.tag,
62
+ uri: url,
63
+ headers: headers,
64
+ params: [],
65
+ body: body && body.length > 0 ? body : undefined,
66
+ });
67
+
68
+ response.status = res.status;
69
+ for (const [key, value] of res.headers) {
70
+ response.responseHeaders.set(key, [value]);
71
+ }
72
+ const buf = res.body;
73
+ response.body = this.streamsIdBase;
74
+ this.streamsIdBase = this.streamsIdBase + 1;
75
+ this.streams.set(response.body, buf);
76
+ this.responses.set(responseId, response);
77
+ return responseId;
78
+ }
79
+
80
+ /**
81
+ * @param {InputStream} stream
82
+ * @param {bigint} len
83
+ * @returns {[Uint8Array | ArrayBuffer, boolean]}
84
+ */
85
+ read = (stream, len) => {
86
+ if (stream < 3) {
87
+ return io.read(stream);
88
+ }
89
+ const s = this.streams.get(stream);
90
+ if (!s) throw Error(`stream not found: ${stream}`);
91
+ const position = Number(len);
92
+ if (position === 0) {
93
+ return [new Uint8Array(), s.byteLength > 0];
94
+ } else if (s.byteLength > position) {
95
+ this.streams.set(stream, s.slice(position, s.byteLength));
96
+ return [s.slice(0, position), false];
97
+ } else {
98
+ return [s.slice(0, position), true];
99
+ }
100
+ }
101
+
102
+ /**
103
+ * @param {InputStream} stream
104
+ * @returns {Pollable}
105
+ */
106
+ subscribeToInputStream = (_stream) => {
107
+ throw Error("unimplemented: subscribeToInputStream");
108
+ }
109
+
110
+ /**
111
+ * @param {InputStream} stream
112
+ */
113
+ dropInputStream = (stream) => {
114
+ const s = this.streams.get(stream);
115
+ if (!s) throw Error(`no such input stream ${stream}`);
116
+ s.set([]);
117
+ }
118
+
119
+ /**
120
+ * @param {OutputStream} stream
121
+ * @param {Uint8Array} buf
122
+ * @returns {bigint}
123
+ */
124
+ write = (stream, buf) => {
125
+ if (stream < 3) {
126
+ return io.write(stream, buf);
127
+ }
128
+ this.streams.set(stream, buf);
129
+ return BigInt(buf.byteLength);
130
+ }
131
+
132
+ /**
133
+ * @param {OutputStream} stream
134
+ * @returns {Pollable}
135
+ */
136
+ subscribeToOutputStream = (_stream) => {
137
+ throw Error("unimplemented: subscribeToOutputStream");
138
+ }
139
+
140
+ /**
141
+ * @param {OutputStream} stream
142
+ */
143
+ dropOutputStream = (stream) => {
144
+ const s = this.streams.get(stream);
145
+ if (!s) throw Error(`no such output stream ${stream}`);
146
+ s.set([]);
147
+ }
148
+
149
+ /**
150
+ * @param {[string, string][]} entries
151
+ * @returns {Fields}
152
+ */
153
+ newFields = (entries) => {
154
+ const map = new Map(entries);
155
+
156
+ const id = this.fieldsIdBase;
157
+ this.fieldsIdBase = id + 1;
158
+ this.fields.set(id, map);
159
+
160
+ return id;
161
+ }
162
+
163
+ /**
164
+ * @param {Fields} fields
165
+ * @returns {[string, string][]}
166
+ */
167
+ fieldsEntries = (fields) => {
168
+ return this.fields.get(fields) ?? [];
169
+ }
170
+
171
+ /**
172
+ * @param {OutgoingRequest} request
173
+ */
174
+ dropOutgoingRequest = (request) => {
175
+ this.requests.delete(request);
176
+ }
177
+
178
+ /**
179
+ * @param {Method} method
180
+ * @param {string} path
181
+ * @param {string} query
182
+ * @param {Scheme | null} scheme
183
+ * @param {string} authority
184
+ * @param {Headers} headers
185
+ * @returns {number}
186
+ */
187
+ newOutgoingRequest = (method, path, query, scheme, authority, headers) => {
188
+ const id = this.requestIdBase;
189
+ this.requestIdBase += 1;
190
+
191
+ const req = new ActiveRequest(id);
192
+ req.path = path;
193
+ req.query = query;
194
+ req.authority = authority;
195
+ req.method = method;
196
+ req.headers = this.fields.get(headers);
197
+ req.scheme = scheme;
198
+ this.requests.set(id, req);
199
+ return id;
200
+ }
201
+
202
+ /**
203
+ * @param {IncomingResponse} response
204
+ */
205
+ dropIncomingResponse = (response) => {
206
+ this.responses.delete(response);
207
+ }
208
+
209
+ /**
210
+ * @param {IncomingResponse} response
211
+ * @returns {StatusCode}
212
+ */
213
+ incomingResponseStatus = (response) => {
214
+ const r = this.responses.get(response);
215
+ return r.status;
216
+ }
217
+
218
+ /**
219
+ * @param {IncomingResponse} response
220
+ * @returns {Headers}
221
+ */
222
+ incomingResponseHeaders = (response) => {
223
+ const r = this.responses.get(response);
224
+ const id = this.fieldsIdBase;
225
+ this.fieldsIdBase = this.fieldsIdBase + 1;
226
+
227
+ this.fields.set(id, r.responseHeaders);
228
+ return id;
229
+ }
230
+
231
+ /**
232
+ * @param {IncomingResponse} response
233
+ * @returns {IncomingStream}
234
+ */
235
+ incomingResponseConsume = (response) => {
236
+ const r = this.responses.get(response);
237
+ return r.body;
238
+ }
239
+ }
240
+
241
+ class ActiveRequest {
242
+ /** @type {number} */ id;
243
+ activeRequest = false;
244
+ /** @type {Method} */ method = { tag: 'get' };
245
+ /** @type {Scheme | null} */ scheme = { tag: 'HTTP' };
246
+ path = "";
247
+ query = "";
248
+ authority = "";
249
+ /** @type {Map<string,string[]>} */ headers = new Map();
250
+ body = 3;
251
+
252
+ constructor(id) {
253
+ this.id = id;
254
+ }
255
+ }
256
+
257
+ class ActiveResponse {
258
+ /** @type {number} */ id;
259
+ activeResponse = false;
260
+ status = 0;
261
+ body = 3;
262
+ /** @type {Map<string,string[]>} */ responseHeaders = new Map();
263
+
264
+ constructor(id) {
265
+ this.id = id;
266
+ }
267
+ }
@@ -0,0 +1,3 @@
1
+ export function handle(_request, _options) {
2
+ console.log("[default-outgoing-HTTP] Handle");
3
+ }
@@ -0,0 +1,3 @@
1
+ export function preopens () {
2
+ return [];
3
+ }
@@ -1,3 +1,7 @@
1
1
  export function getEnvironment () {
2
2
  return [];
3
3
  }
4
+
5
+ export function preopens () {
6
+ return [];
7
+ }
@@ -9,7 +9,7 @@
9
9
  // ctim: Timestamp,
10
10
  // }
11
11
 
12
- export function flags(fd) {
12
+ export function getFlags(fd) {
13
13
  console.log(`[filesystem] FLAGS FOR ${fd}`);
14
14
  }
15
15
 
@@ -49,14 +49,16 @@ export function stat(fd) {
49
49
  console.log(`[filesystem] STAT: ${fd}`);
50
50
  }
51
51
 
52
- export function todoType(fd) {
52
+ export function getType(fd) {
53
53
  console.log(`[filesystem] TODO TYPE: ${fd}`);
54
54
  }
55
55
 
56
- export function dropDirEntryStream(s) {
56
+ export function dropDirectoryEntryStream(s) {
57
57
  console.log(`[filesystem] CLOSE DIR ENTRY STREAM ${s}`);
58
58
  }
59
59
 
60
- export function getPreopens () {
61
- console.log(`[filesystem] GET PREOPENS`);
60
+ // backwards compat
61
+ export function getPreopens() {
62
+ return [];
62
63
  }
64
+ export { getFlags as flags, getType as todoType, dropDirectoryEntryStream as dropDirEntryStream }
@@ -1,12 +1,12 @@
1
- import { createSyncFn } from "synckit";
2
- import path from "node:path";
3
1
  import { fileURLToPath } from "node:url";
4
2
  import { UnexpectedError } from "../http/error.js";
3
+ import { createSyncFn } from "../http/synckit/index.js";
4
+
5
+ const workerPath = fileURLToPath(new URL('../http/make-request.js', import.meta.url));
5
6
 
6
7
  export function send(req) {
7
8
  console.log(`[http] Send (nodejs) ${req.uri}`);
8
- const dirname = path.dirname(fileURLToPath(import.meta.url));
9
- const syncFn = createSyncFn(path.resolve(dirname, "../http/make-request.js"));
9
+ const syncFn = createSyncFn(workerPath);
10
10
  let rawResponse = syncFn(req);
11
11
  let response = JSON.parse(rawResponse);
12
12
  if (response.status) {
@@ -1,21 +1,43 @@
1
- import * as clocks from "./clocks.js";
2
- import * as defaultClocks from "./default-clocks.js";
1
+ import * as console from "./console.js";
2
+ import * as defaultOutgoingHttp from "./default-outgoing-HTTP.js";
3
+ import * as environment from "./environment.js";
4
+ import * as environmentPreopens from "./environment-preopens.js";
3
5
  import * as exit from "./exit.js";
4
6
  import * as filesystem from "./filesystem.js";
7
+ import * as http from "./http.js";
8
+ import * as instanceMonotonicClock from "./instance-monotonic-clock.js";
9
+ import * as instanceWallClock from "./instance-wall-clock.js";
5
10
  import * as io from "./io.js";
6
- import * as logging from "./logging.js";
11
+ import * as monotonicClock from "./monotonic-clock.js";
7
12
  import * as poll from "./poll.js";
13
+ import * as preopens from "./preopens.js";
8
14
  import * as random from "./random.js";
9
15
  import * as stderr from "./stderr.js";
16
+ import * as streams from "./streams.js";
17
+ import * as types from "./types.js";
18
+ import * as wallClock from "./wall-clock.js";
10
19
 
11
20
  export const importObject = {
12
- "wasi-clocks": clocks,
13
- "wasi-default-clocks": defaultClocks,
14
- "wasi-exit": exit,
15
- "wasi-filesystem": filesystem,
16
- "wasi-io": io,
17
- "wasi-logging": logging,
18
- "wasi-poll": poll,
19
- "wasi-random": random,
20
- "wasi-stderr": stderr,
21
+ "console": console,
22
+ "default-outgoing-HTTP": defaultOutgoingHttp,
23
+ "environment": environment,
24
+ "environment-preopens": environmentPreopens,
25
+ "exit": exit,
26
+ "filesystem": filesystem,
27
+ "http": http,
28
+ "instance-monotonic-clock": instanceMonotonicClock,
29
+ "instance-wall-clock": instanceWallClock,
30
+ "io": io,
31
+ "monotonic-clock": monotonicClock,
32
+ "poll": poll,
33
+ "preopens": preopens,
34
+ "random": random,
35
+ "stderr": stderr,
36
+ "streams": streams,
37
+ "types": types,
38
+ "wall-clock": wallClock,
21
39
  };
40
+
41
+ export { WasiHttp } from "../http/wasi-http.js";
42
+
43
+ export default importObject;
@@ -0,0 +1,3 @@
1
+ export function instanceMonotonicClock() {
2
+ return 0;
3
+ }
@@ -0,0 +1,3 @@
1
+ export function instanceWallClock() {
2
+ return 1;
3
+ }
package/lib/nodejs/io.js CHANGED
@@ -1,33 +1,25 @@
1
- export function dropInputStream(f) {
2
- console.log(`[io] Drop input stream ${f}`);
3
- }
4
-
5
- export function dropOutputStream(f) {
6
- console.log(`[io] Drop output stream ${f}`);
7
- }
8
-
9
- export function read(src, len) {
10
- console.log(`[io] Read ${src}`, len);
1
+ export function read(s, len) {
2
+ switch (s) {
3
+ case 0:
4
+ return [process.stdin.read(len), true];
5
+ default:
6
+ throw new Error(`TODO: write ${s}`);
7
+ }
11
8
  }
12
9
 
13
- export function write(dst, buf) {
14
- switch (dst) {
10
+ export function write(s, buf) {
11
+ switch (s) {
15
12
  case 0:
16
13
  throw new Error(`TODO: write stdin`);
17
- case 1:
14
+ case 1: {
18
15
  process.stdout.write(buf);
19
16
  return BigInt(buf.byteLength);
20
- case 2:
21
- throw new Error(`TODO: write stdout`);
17
+ }
18
+ case 2: {
19
+ process.stderr.write(buf);
20
+ return BigInt(buf.byteLength);
21
+ }
22
22
  default:
23
- throw new Error(`TODO: write ${dst}`);
23
+ throw new Error(`TODO: write ${s}`);
24
24
  }
25
25
  }
26
-
27
- export function skip(src, len) {
28
- console.log(`[io] Skip ${src}`, len);
29
- }
30
-
31
- export function write_repeated(dst, byte, len) {
32
- console.log(`[io] Write repeated ${dst}`, byte, len);
33
- }
@@ -12,3 +12,7 @@ export function now(clock) {
12
12
  }
13
13
  console.log("[clocks] UNKNOWN CLOCK");
14
14
  }
15
+
16
+ export function instanceMonotonicClock () {
17
+ return 0;
18
+ }
@@ -1,3 +1,7 @@
1
+ export function dropPollable(p) {
2
+ console.log(`[poll] Drop pollable ${p}`);
3
+ }
4
+
1
5
  export function pollOneoff(f) {
2
6
  console.log(`[poll] Poll oneoff ${f}`);
3
7
  }
@@ -0,0 +1,11 @@
1
+ export function getStdio () {
2
+ return {
3
+ stdin: 0,
4
+ stdout: 1,
5
+ stderr: 2,
6
+ };
7
+ }
8
+
9
+ export function getDirectories () {
10
+ return [];
11
+ }
@@ -1,5 +1,5 @@
1
1
  import { randomBytes } from "node:crypto";
2
2
 
3
3
  export function getRandomBytes(len) {
4
- return randomBytes(len);
4
+ return randomBytes(Number(len));
5
5
  }
@@ -0,0 +1,63 @@
1
+ export function read(s, len) {
2
+ switch (s) {
3
+ case 0:
4
+ return [process.stdin.read(len), true];
5
+ default:
6
+ throw new Error(`TODO: write ${s}`);
7
+ }
8
+ }
9
+ export function blockingRead(s, _len) {
10
+ console.log(`[streams] Blocking read ${s}`);
11
+ }
12
+ export function skip(s, _len) {
13
+ console.log(`[streams] Skip ${s}`);
14
+ }
15
+ export function blockingSkip(s, _len) {
16
+ console.log(`[streams] Blocking skip ${s}`);
17
+ }
18
+ export function subscribeToInputStream(s) {
19
+ console.log(`[streams] Subscribe to input stream ${s}`);
20
+ }
21
+ export function dropInputStream(s) {
22
+ console.log(`[streams] Drop input stream ${s}`);
23
+ }
24
+ export function write(s, buf) {
25
+ switch (s) {
26
+ case 0:
27
+ throw new Error(`TODO: write stdin`);
28
+ case 1: {
29
+ process.stdout.write(buf);
30
+ return BigInt(buf.byteLength);
31
+ }
32
+ case 2: {
33
+ process.stderr.write(buf);
34
+ return BigInt(buf.byteLength);
35
+ }
36
+ default:
37
+ throw new Error(`TODO: write ${s}`);
38
+ }
39
+ }
40
+ export function blockingWrite(s, _buf) {
41
+ console.log(`[streams] Blocking write ${s}`);
42
+ }
43
+ export function writeZeroes(s, _len) {
44
+ console.log(`[streams] Write zeroes ${s}`);
45
+ }
46
+ export function blockingWriteZeroes(s, _len) {
47
+ console.log(`[streams] Blocking write zeroes ${s}`);
48
+ }
49
+ export function splice(s, _src, _len) {
50
+ console.log(`[streams] Splice ${s}`);
51
+ }
52
+ export function blockingSplice(s, _src, _len) {
53
+ console.log(`[streams] Blocking splice ${s}`);
54
+ }
55
+ export function forward(s, _src) {
56
+ console.log(`[streams] Forward ${s}`);
57
+ }
58
+ export function subscribeToOutputStream(s) {
59
+ console.log(`[streams] Subscribe to output stream ${s}`);
60
+ }
61
+ export function dropOutputStream(s) {
62
+ console.log(`[streams] Drop output stream ${s}`);
63
+ }
@@ -0,0 +1,99 @@
1
+ export function dropFields(_fields) {
2
+ console.log("[types] Drop fields");
3
+ }
4
+ export function newFields(_entries) {
5
+ console.log("[types] New fields");
6
+ }
7
+ export function fieldsGet(_fields, _name) {
8
+ console.log("[types] Fields get");
9
+ }
10
+ export function fieldsSet(_fields, _name, _value) {
11
+ console.log("[types] Fields set");
12
+ }
13
+ export function fieldsDelete(_fields, _name) {
14
+ console.log("[types] Fields delete");
15
+ }
16
+ export function fieldsAppend(_fields, _name, _value) {
17
+ console.log("[types] Fields append");
18
+ }
19
+ export function fieldsEntries(_fields) {
20
+ console.log("[types] Fields entries");
21
+ }
22
+ export function fieldsClone(_fields) {
23
+ console.log("[types] Fields clone");
24
+ }
25
+ export function finishIncomingStream(s) {
26
+ console.log(`[types] Finish incoming stream ${s}`);
27
+ }
28
+ export function finishOutgoingStream(s, _trailers) {
29
+ console.log(`[types] Finish outgoing stream ${s}`);
30
+ }
31
+ export function dropIncomingRequest(_req) {
32
+ console.log("[types] Drop incoming request");
33
+ }
34
+ export function dropOutgoingRequest(_req) {
35
+ console.log("[types] Drop outgoing request");
36
+ }
37
+ export function incomingRequestMethod(_req) {
38
+ console.log("[types] Incoming request method");
39
+ }
40
+ export function incomingRequestPath(_req) {
41
+ console.log("[types] Incoming request path");
42
+ }
43
+ export function incomingRequestQuery(_req) {
44
+ console.log("[types] Incoming request query");
45
+ }
46
+ export function incomingRequestScheme(_req) {
47
+ console.log("[types] Incoming request scheme");
48
+ }
49
+ export function incomingRequestAuthority(_req) {
50
+ console.log("[types] Incoming request authority");
51
+ }
52
+ export function incomingRequestHeaders(_req) {
53
+ console.log("[types] Incoming request headers");
54
+ }
55
+ export function incomingRequestConsume(_req) {
56
+ console.log("[types] Incoming request consume");
57
+ }
58
+ export function newOutgoingRequest(_method, _path, _query, _scheme, _authority, _headers) {
59
+ console.log("[types] New outgoing request");
60
+ }
61
+ export function outgoingRequestWrite(_req) {
62
+ console.log("[types] Outgoing request write");
63
+ }
64
+ export function dropResponseOutparam(_res) {
65
+ console.log("[types] Drop response outparam");
66
+ }
67
+ export function setResponseOutparam(_response) {
68
+ console.log("[types] Drop fields");
69
+ }
70
+ export function dropIncomingResponse(_res) {
71
+ console.log("[types] Drop incoming response");
72
+ }
73
+ export function dropOutgoingResponse(_res) {
74
+ console.log("[types] Drop outgoing response");
75
+ }
76
+ export function incomingResponseStatus(_res) {
77
+ console.log("[types] Incoming response status");
78
+ }
79
+ export function incomingResponseHeaders(_res) {
80
+ console.log("[types] Incoming response headers");
81
+ }
82
+ export function incomingResponseConsume(_res) {
83
+ console.log("[types] Incoming response consume");
84
+ }
85
+ export function newOutgoingResponse(_statusCode, _headers) {
86
+ console.log("[types] New outgoing response");
87
+ }
88
+ export function outgoingResponseWrite(_res) {
89
+ console.log("[types] Outgoing response write");
90
+ }
91
+ export function dropFutureIncomingResponse(_f) {
92
+ console.log("[types] Drop future incoming response");
93
+ }
94
+ export function futureIncomingResponseGet(_f) {
95
+ console.log("[types] Future incoming response get");
96
+ }
97
+ export function listenToFutureIncomingResponse(_f) {
98
+ console.log("[types] Listen to future incoming response");
99
+ }
@@ -10,3 +10,7 @@ export function now(clock) {
10
10
  export function resolution(clock) {
11
11
  console.log(`[clocks] Wall clock resolution ${clock}`);
12
12
  }
13
+
14
+ export function instanceWallClock () {
15
+ return 1;
16
+ }