@isoloop/protocol 0.0.0-next.5bbb503 → 0.0.0-next.61245db

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/dist/index.d.ts CHANGED
@@ -13,13 +13,20 @@ export type Envelope<T extends string, P> = {
13
13
  id?: string;
14
14
  /** Id of the message this replies to. */
15
15
  re?: string;
16
+ /**
17
+ * The pool member a message is for (host → worker) or from (worker → host),
18
+ * on a pooled worker's isolate port (M2c, ADR 0001). Absent on an own
19
+ * worker's port, and on messages about the whole worker (`beat`).
20
+ */
21
+ isolate?: string;
16
22
  p: P;
17
23
  };
18
24
  /** Any envelope, before its type is known. */
19
25
  export type AnyEnvelope = Envelope<string, unknown>;
20
26
  /**
21
27
  * True for a well-formed envelope this build can read: `v` is a supported
22
- * version, `t` is a string, `id`/`re` are absent or strings, and `p` is present.
28
+ * version, `t` is a string, `id`/`re`/`isolate` are absent or strings, and `p`
29
+ * is present.
23
30
  * Says nothing about whether `t` is known; see the per-port guards.
24
31
  */
25
32
  export declare function isEnvelope(x: unknown): x is AnyEnvelope;
@@ -192,6 +199,7 @@ export type IsolateToHost = Envelope<"ready", {
192
199
  lagMs: number;
193
200
  heapBytes?: number;
194
201
  idle?: IdleReport;
202
+ members?: Record<string, IdleReport>;
195
203
  }> | Envelope<"error", ErrorPayload> | Envelope<"bye", Record<string, never>>;
196
204
  export declare const HOST_TO_ISOLATE: MessageTypes<HostToIsolate>;
197
205
  export declare const ISOLATE_TO_HOST: MessageTypes<IsolateToHost>;
package/dist/index.js CHANGED
@@ -8,11 +8,12 @@ const isRecord = (x) => typeof x === "object" && x !== null && !Array.isArray(x)
8
8
  const isOptionalString = (x) => x === void 0 || typeof x === "string";
9
9
  /**
10
10
  * True for a well-formed envelope this build can read: `v` is a supported
11
- * version, `t` is a string, `id`/`re` are absent or strings, and `p` is present.
11
+ * version, `t` is a string, `id`/`re`/`isolate` are absent or strings, and `p`
12
+ * is present.
12
13
  * Says nothing about whether `t` is known; see the per-port guards.
13
14
  */
14
15
  function isEnvelope(x) {
15
- return isRecord(x) && x["v"] === PROTOCOL.v && typeof x["t"] === "string" && "p" in x && isOptionalString(x["id"]) && isOptionalString(x["re"]);
16
+ return isRecord(x) && x["v"] === PROTOCOL.v && typeof x["t"] === "string" && "p" in x && isOptionalString(x["id"]) && isOptionalString(x["re"]) && isOptionalString(x["isolate"]);
16
17
  }
17
18
  /**
18
19
  * Builds a guard for one port's union from its message types. Each side drops
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isoloop/protocol",
3
- "version": "0.0.0-next.5bbb503",
3
+ "version": "0.0.0-next.61245db",
4
4
  "description": "Wire protocol types and guards shared by every Isoloop package.",
5
5
  "license": "MIT",
6
6
  "type": "module",