@eryx-org/eryx 0.15.0 → 0.15.1

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.
Binary file
Binary file
package/eryx-sandbox.d.ts CHANGED
@@ -52,6 +52,9 @@ import type * as WasiSocketsUdpCreateSocket from './interfaces/wasi-sockets-udp-
52
52
  import type * as WasiSocketsUdp from './interfaces/wasi-sockets-udp.js'; // wasi:sockets/udp@0.2.0
53
53
  export interface ImportObject {
54
54
  invoke: {
55
+ /**
56
+ * @throws {string} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
57
+ */
55
58
  "default"(name: string, argumentsJson: string): Promise<string>,
56
59
  },
57
60
  sleep: {
@@ -98,12 +101,24 @@ export interface ImportObject {
98
101
  "wasi:sockets/udp@0.2.0": typeof WasiSocketsUdp,
99
102
  }
100
103
  export interface Root {
104
+ /**
105
+ * @throws {Error & { payload: ExecuteError }} The error of the result, as the `payload` of the thrown error.
106
+ */
101
107
  execute(code: string): Promise<ExecuteOutput>,
108
+ /**
109
+ * @throws {Error & { payload: string }} The error of the result, as the `payload` of the thrown error.
110
+ */
102
111
  snapshotState(): Promise<StateSnapshot>,
112
+ /**
113
+ * @throws {Error & { payload: string }} The error of the result, as the `payload` of the thrown error.
114
+ */
103
115
  restoreState(data: Uint8Array): Promise<void>,
104
116
  clearState(): Promise<void>,
105
117
  finalizePreinit(): void,
106
118
  setResultVariable(name: string): Promise<void>,
119
+ /** Permanently stop this instance and dispose guest-owned host resources. */
120
+ readonly _util: { stop(): void; whenIdle(): Promise<void>; /** Test whether a value is a declared WIT result error from this instance. */
121
+ isComponentError(value: unknown): value is Error & { readonly payload: unknown }; };
107
122
  }
108
123
  export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
109
124
 
@@ -111,6 +126,13 @@ export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
111
126
  * Options accepted by `instantiate`.
112
127
  */
113
128
  export interface InstantiateOptions {
129
+ /**
130
+ * Called with each trap of this instance as it happens, in whichever
131
+ * task: including one a guest left running, which no call of the host's
132
+ * would otherwise fail for. Not called for stopping the instance, which
133
+ * it may do itself.
134
+ */
135
+ onTrap?: (error: WebAssembly.RuntimeError) => void;
114
136
  /** Runtime overrides for this instance. */
115
137
  shim?: {
116
138
  /** Platform globals used instead of those on `globalThis`. */