@mostra/protocol 0.9.0 → 0.10.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/dist/actions.d.ts +30 -4
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +14 -4
- package/dist/actions.js.map +1 -1
- package/dist/artifact.d.ts +2 -1
- package/dist/artifact.d.ts.map +1 -1
- package/dist/artifact.js +2 -1
- package/dist/artifact.js.map +1 -1
- package/dist/browser.d.ts +5 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +7 -2
- package/dist/browser.js.map +1 -1
- package/dist/capability.d.ts +0 -9
- package/dist/capability.d.ts.map +1 -1
- package/dist/capability.js +1 -17
- package/dist/capability.js.map +1 -1
- package/dist/diagnostics/codes/artifact.d.ts +1 -1
- package/dist/diagnostics/codes/artifact.d.ts.map +1 -1
- package/dist/diagnostics/codes/artifact.js +12 -1
- package/dist/diagnostics/codes/artifact.js.map +1 -1
- package/dist/diagnostics/codes/home.d.ts +1 -1
- package/dist/diagnostics/codes/home.d.ts.map +1 -1
- package/dist/diagnostics/codes/home.js +12 -1
- package/dist/diagnostics/codes/home.js.map +1 -1
- package/dist/diagnostics/codes/index.d.ts +3 -2
- package/dist/diagnostics/codes/index.d.ts.map +1 -1
- package/dist/diagnostics/codes/index.js +3 -1
- package/dist/diagnostics/codes/index.js.map +1 -1
- package/dist/diagnostics/codes/remote.d.ts +8 -0
- package/dist/diagnostics/codes/remote.d.ts.map +1 -0
- package/dist/diagnostics/codes/remote.js +99 -0
- package/dist/diagnostics/codes/remote.js.map +1 -0
- package/dist/diagnostics/diagnostic.d.ts +1 -1
- package/dist/diagnostics/diagnostic.d.ts.map +1 -1
- package/dist/diagnostics/diagnostic.js +2 -1
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/duration.d.ts +13 -0
- package/dist/duration.d.ts.map +1 -0
- package/dist/duration.js +27 -0
- package/dist/duration.js.map +1 -0
- package/dist/ids.d.ts +17 -1
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +9 -1
- package/dist/ids.js.map +1 -1
- package/dist/index.d.ts +30 -8
- package/dist/index.js +30 -8
- package/dist/interaction.d.ts +28 -2
- package/dist/interaction.d.ts.map +1 -1
- package/dist/interaction.js +20 -5
- package/dist/interaction.js.map +1 -1
- package/dist/manifest.d.ts +59 -14
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +63 -15
- package/dist/manifest.js.map +1 -1
- package/dist/methods/artifact/export.d.ts +40 -0
- package/dist/methods/artifact/export.d.ts.map +1 -0
- package/dist/methods/artifact/export.js +36 -0
- package/dist/methods/artifact/export.js.map +1 -0
- package/dist/methods/artifact/import.d.ts +23 -0
- package/dist/methods/artifact/import.d.ts.map +1 -0
- package/dist/methods/artifact/import.js +25 -0
- package/dist/methods/artifact/import.js.map +1 -0
- package/dist/methods/artifact/publish.d.ts +2 -1
- package/dist/methods/artifact/publish.d.ts.map +1 -1
- package/dist/methods/artifact/publish.js +1 -1
- package/dist/methods/hosted/push.d.ts +76 -0
- package/dist/methods/hosted/push.d.ts.map +1 -0
- package/dist/methods/hosted/push.js +71 -0
- package/dist/methods/hosted/push.js.map +1 -0
- package/dist/methods/hosted/submission.d.ts +18 -0
- package/dist/methods/hosted/submission.d.ts.map +1 -0
- package/dist/methods/hosted/submission.js +23 -0
- package/dist/methods/hosted/submission.js.map +1 -0
- package/dist/methods/index.d.ts.map +1 -1
- package/dist/methods/index.js +38 -2
- package/dist/methods/index.js.map +1 -1
- package/dist/methods/instance/status.d.ts +3 -0
- package/dist/methods/instance/status.d.ts.map +1 -1
- package/dist/methods/instance/status.js +3 -1
- package/dist/methods/instance/status.js.map +1 -1
- package/dist/methods/mostra/initialize.d.ts +17 -3
- package/dist/methods/mostra/initialize.d.ts.map +1 -1
- package/dist/methods/mostra/initialize.js +11 -3
- package/dist/methods/mostra/initialize.js.map +1 -1
- package/dist/methods/port/relay-call.d.ts +33 -0
- package/dist/methods/port/relay-call.d.ts.map +1 -0
- package/dist/methods/port/relay-call.js +31 -0
- package/dist/methods/port/relay-call.js.map +1 -0
- package/dist/methods/port/relay-cancel.d.ts +16 -0
- package/dist/methods/port/relay-cancel.d.ts.map +1 -0
- package/dist/methods/port/relay-cancel.js +21 -0
- package/dist/methods/port/relay-cancel.js.map +1 -0
- package/dist/methods/port/relay-live.d.ts +25 -0
- package/dist/methods/port/relay-live.d.ts.map +1 -0
- package/dist/methods/port/relay-live.js +32 -0
- package/dist/methods/port/relay-live.js.map +1 -0
- package/dist/methods/port/relay-reconcile.d.ts +39 -0
- package/dist/methods/port/relay-reconcile.d.ts.map +1 -0
- package/dist/methods/port/relay-reconcile.js +35 -0
- package/dist/methods/port/relay-reconcile.js.map +1 -0
- package/dist/methods/port/relay-run.d.ts +47 -0
- package/dist/methods/port/relay-run.d.ts.map +1 -0
- package/dist/methods/port/relay-run.js +41 -0
- package/dist/methods/port/relay-run.js.map +1 -0
- package/dist/methods/port/submissions-deliver.d.ts +8 -0
- package/dist/methods/port/submissions-deliver.d.ts.map +1 -1
- package/dist/methods/port/submissions-deliver.js +4 -2
- package/dist/methods/port/submissions-deliver.js.map +1 -1
- package/dist/methods/relay/call-batch.d.ts +26 -0
- package/dist/methods/relay/call-batch.d.ts.map +1 -0
- package/dist/methods/relay/call-batch.js +30 -0
- package/dist/methods/relay/call-batch.js.map +1 -0
- package/dist/methods/relay/effect.d.ts +31 -0
- package/dist/methods/relay/effect.d.ts.map +1 -0
- package/dist/methods/relay/effect.js +30 -0
- package/dist/methods/relay/effect.js.map +1 -0
- package/dist/methods/relay/live-value.d.ts +33 -0
- package/dist/methods/relay/live-value.d.ts.map +1 -0
- package/dist/methods/relay/live-value.js +32 -0
- package/dist/methods/relay/live-value.js.map +1 -0
- package/dist/methods/relay/run-update.d.ts +46 -0
- package/dist/methods/relay/run-update.d.ts.map +1 -0
- package/dist/methods/relay/run-update.js +45 -0
- package/dist/methods/relay/run-update.js.map +1 -0
- package/dist/methods/remote/login-wait.d.ts +30 -0
- package/dist/methods/remote/login-wait.d.ts.map +1 -0
- package/dist/methods/remote/login-wait.js +36 -0
- package/dist/methods/remote/login-wait.js.map +1 -0
- package/dist/methods/remote/login.d.ts +41 -0
- package/dist/methods/remote/login.d.ts.map +1 -0
- package/dist/methods/remote/login.js +37 -0
- package/dist/methods/remote/login.js.map +1 -0
- package/dist/methods/remote/logout.d.ts +25 -0
- package/dist/methods/remote/logout.d.ts.map +1 -0
- package/dist/methods/remote/logout.js +28 -0
- package/dist/methods/remote/logout.js.map +1 -0
- package/dist/methods/remote/status.d.ts +14 -0
- package/dist/methods/remote/status.d.ts.map +1 -0
- package/dist/methods/remote/status.js +22 -0
- package/dist/methods/remote/status.js.map +1 -0
- package/dist/methods/remote/token.d.ts +19 -0
- package/dist/methods/remote/token.d.ts.map +1 -0
- package/dist/methods/remote/token.js +24 -0
- package/dist/methods/remote/token.js.map +1 -0
- package/dist/methods/share/start.d.ts +5 -2
- package/dist/methods/share/start.d.ts.map +1 -1
- package/dist/methods/share/start.js +6 -3
- package/dist/methods/share/start.js.map +1 -1
- package/dist/methods/state/patch.d.ts +7 -0
- package/dist/methods/state/patch.d.ts.map +1 -1
- package/dist/methods/state/patch.js +2 -1
- package/dist/methods/state/patch.js.map +1 -1
- package/dist/methods/view/url.d.ts +2 -1
- package/dist/methods/view/url.d.ts.map +1 -1
- package/dist/methods/view/url.js +2 -1
- package/dist/methods/view/url.js.map +1 -1
- package/dist/policy.d.ts +18 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +23 -0
- package/dist/policy.js.map +1 -0
- package/dist/remote.d.ts +55 -0
- package/dist/remote.d.ts.map +1 -0
- package/dist/remote.js +52 -0
- package/dist/remote.js.map +1 -0
- package/dist/view.d.ts +1 -1
- package/dist/view.js +1 -1
- package/dist/view.js.map +1 -1
- package/package.json +2 -2
- package/schemas/protocol.draft-07.json +1607 -126
- package/schemas/protocol.schema.json +1543 -126
- package/src/actions.ts +45 -5
- package/src/browser.ts +6 -0
- package/src/capability.ts +0 -23
- package/src/diagnostics/codes/artifact.ts +12 -0
- package/src/diagnostics/codes/home.ts +12 -0
- package/src/diagnostics/codes/index.ts +6 -2
- package/src/diagnostics/codes/remote.ts +113 -0
- package/src/diagnostics/diagnostic.ts +3 -1
- package/src/duration.ts +29 -0
- package/src/ids.ts +33 -1
- package/src/index.ts +124 -8
- package/src/interaction.ts +42 -2
- package/src/manifest.ts +115 -24
- package/src/methods/artifact/export.ts +68 -0
- package/src/methods/artifact/import.ts +39 -0
- package/src/methods/hosted/push.ts +146 -0
- package/src/methods/hosted/submission.ts +34 -0
- package/src/methods/index.ts +36 -0
- package/src/methods/instance/status.ts +4 -0
- package/src/methods/mostra/initialize.ts +19 -3
- package/src/methods/port/relay-call.ts +58 -0
- package/src/methods/port/relay-cancel.ts +33 -0
- package/src/methods/port/relay-live.ts +48 -0
- package/src/methods/port/relay-reconcile.ts +71 -0
- package/src/methods/port/relay-run.ts +80 -0
- package/src/methods/port/submissions-deliver.ts +13 -1
- package/src/methods/relay/call-batch.ts +52 -0
- package/src/methods/relay/effect.ts +55 -0
- package/src/methods/relay/live-value.ts +54 -0
- package/src/methods/relay/run-update.ts +81 -0
- package/src/methods/remote/login-wait.ts +55 -0
- package/src/methods/remote/login.ts +72 -0
- package/src/methods/remote/logout.ts +42 -0
- package/src/methods/remote/status.ts +34 -0
- package/src/methods/remote/token.ts +39 -0
- package/src/methods/share/start.ts +12 -4
- package/src/methods/state/patch.ts +6 -0
- package/src/methods/view/url.ts +2 -1
- package/src/policy.ts +30 -0
- package/src/remote.ts +89 -0
- package/src/view.ts +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Batches } from "../../actions.js";
|
|
2
|
+
import { MethodDefinition } from "../../method.js";
|
|
3
|
+
import { RelayViewer } from "./relay-run.js";
|
|
4
|
+
//#region src/methods/port/relay-call.d.ts
|
|
5
|
+
/** The params of `port/relay.call` (INTERFACES §18.3). */
|
|
6
|
+
export interface PortRelayCallParams {
|
|
7
|
+
/** The hosted home's ID for this call: its batches come back as `relay/call.batch`. */
|
|
8
|
+
readonly callId: string;
|
|
9
|
+
/** The artifact, by its own ID. */
|
|
10
|
+
readonly artifactId: string;
|
|
11
|
+
/** The version whose server code answers it: the view's. */
|
|
12
|
+
readonly versionId: string;
|
|
13
|
+
/** The server function. */
|
|
14
|
+
readonly fnId: string;
|
|
15
|
+
/** Its serialized arguments. */
|
|
16
|
+
readonly args: Batches;
|
|
17
|
+
/** Who called it. */
|
|
18
|
+
readonly viewer?: RelayViewer;
|
|
19
|
+
/** The hosted view that called it. */
|
|
20
|
+
readonly viewId?: string;
|
|
21
|
+
}
|
|
22
|
+
/** The result of `port/relay.call`. */
|
|
23
|
+
export interface PortRelayCallResult {
|
|
24
|
+
/** Always `true`: the owner's worker has the call. */
|
|
25
|
+
readonly accepted: true;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* `port/relay.call`: a plain call relayed to the owner while it is connected (D165 item 4); it
|
|
29
|
+
* leaves no record, and its batches and end come back as `relay/call.batch`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const portRelayCallMethod: MethodDefinition<PortRelayCallParams, PortRelayCallResult>;
|
|
32
|
+
//#endregion
|
|
33
|
+
//# sourceMappingURL=relay-call.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-call.d.ts","names":[],"sources":["../../../src/methods/port/relay-call.ts"],"mappings":";;;;;iBAOiB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,MAAM;;WAEN,SAAS;;WAET;;;iBAIM;;WAEN;;;;;;qBAuBE,qBAAqB,iBAAiB,qBAAqB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { Batches } from "../../actions.js";
|
|
3
|
+
import { defineMethod } from "../../method.js";
|
|
4
|
+
import { RelayViewer } from "./relay-run.js";
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
//#region src/methods/port/relay-call.ts
|
|
7
|
+
const params = z.object({
|
|
8
|
+
callId: z.string().min(1),
|
|
9
|
+
artifactId: z.string().min(1),
|
|
10
|
+
versionId: z.string().min(1),
|
|
11
|
+
fnId: z.string().min(1),
|
|
12
|
+
args: Batches,
|
|
13
|
+
viewer: RelayViewer.exactOptional(),
|
|
14
|
+
viewId: z.string().exactOptional()
|
|
15
|
+
}).register(wireRegistry, { id: "PortRelayCallParams" });
|
|
16
|
+
const result = z.object({ accepted: z.literal(true) }).register(wireRegistry, { id: "PortRelayCallResult" });
|
|
17
|
+
/**
|
|
18
|
+
* `port/relay.call`: a plain call relayed to the owner while it is connected (D165 item 4); it
|
|
19
|
+
* leaves no record, and its batches and end come back as `relay/call.batch`.
|
|
20
|
+
*/
|
|
21
|
+
const portRelayCallMethod = defineMethod({
|
|
22
|
+
method: "port/relay.call",
|
|
23
|
+
direction: "instance-to-host",
|
|
24
|
+
mutating: false,
|
|
25
|
+
params,
|
|
26
|
+
result
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
export { portRelayCallMethod };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=relay-call.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-call.js","names":[],"sources":["../../../src/methods/port/relay-call.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { Batches } from \"../../actions.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\nimport { RelayViewer } from \"./relay-run.ts\";\n\n/** The params of `port/relay.call` (INTERFACES §18.3). */\nexport interface PortRelayCallParams {\n /** The hosted home's ID for this call: its batches come back as `relay/call.batch`. */\n readonly callId: string;\n /** The artifact, by its own ID. */\n readonly artifactId: string;\n /** The version whose server code answers it: the view's. */\n readonly versionId: string;\n /** The server function. */\n readonly fnId: string;\n /** Its serialized arguments. */\n readonly args: Batches;\n /** Who called it. */\n readonly viewer?: RelayViewer;\n /** The hosted view that called it. */\n readonly viewId?: string;\n}\n\n/** The result of `port/relay.call`. */\nexport interface PortRelayCallResult {\n /** Always `true`: the owner's worker has the call. */\n readonly accepted: true;\n}\n\nconst params: z.ZodType<PortRelayCallParams> = z\n .object({\n callId: z.string().min(1),\n artifactId: z.string().min(1),\n versionId: z.string().min(1),\n fnId: z.string().min(1),\n args: Batches,\n viewer: RelayViewer.exactOptional(),\n viewId: z.string().exactOptional(),\n })\n .register(wireRegistry, { id: \"PortRelayCallParams\" });\n\nconst result: z.ZodType<PortRelayCallResult> = z\n .object({ accepted: z.literal(true) })\n .register(wireRegistry, { id: \"PortRelayCallResult\" });\n\n/**\n * `port/relay.call`: a plain call relayed to the owner while it is connected (D165 item 4); it\n * leaves no record, and its batches and end come back as `relay/call.batch`.\n */\nexport const portRelayCallMethod: MethodDefinition<PortRelayCallParams, PortRelayCallResult> =\n defineMethod({\n method: \"port/relay.call\",\n direction: \"instance-to-host\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;;AA8BA,MAAM,SAAyC,EAC5C,OAAO;CACN,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACxB,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC5B,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC3B,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACtB,MAAM;CACN,QAAQ,YAAY,cAAc;CAClC,QAAQ,EAAE,OAAO,CAAC,CAAC,cAAc;AACnC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,sBAAsB,CAAC;AAEvD,MAAM,SAAyC,EAC5C,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC,CACrC,SAAS,cAAc,EAAE,IAAI,sBAAsB,CAAC;;;;;AAMvD,MAAa,sBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MethodDefinition } from "../../method.js";
|
|
2
|
+
//#region src/methods/port/relay-cancel.d.ts
|
|
3
|
+
/** The params of `port/relay.cancel` (INTERFACES §18.3). */
|
|
4
|
+
export interface PortRelayCancelParams {
|
|
5
|
+
/** The hosted run to cancel. */
|
|
6
|
+
readonly runId: string;
|
|
7
|
+
}
|
|
8
|
+
/** The result of `port/relay.cancel`. */
|
|
9
|
+
export type PortRelayCancelResult = Record<string, never>;
|
|
10
|
+
/**
|
|
11
|
+
* `port/relay.cancel`: a viewer cancelled a relayed run; the owner fires its `abortSignal` if it
|
|
12
|
+
* still runs (AC-04). A cancel made while the owner was away arrives on reconnect.
|
|
13
|
+
*/
|
|
14
|
+
export declare const portRelayCancelMethod: MethodDefinition<PortRelayCancelParams, PortRelayCancelResult>;
|
|
15
|
+
//#endregion
|
|
16
|
+
//# sourceMappingURL=relay-cancel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-cancel.d.ts","names":[],"sources":["../../../src/methods/port/relay-cancel.ts"],"mappings":";;;iBAKiB;;WAEN;;;YAIC,wBAAwB;;;;;qBAcvB,uBAAuB,iBAAiB,uBAAuB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { defineMethod } from "../../method.js";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/methods/port/relay-cancel.ts
|
|
5
|
+
const params = z.object({ runId: z.string().min(1) }).register(wireRegistry, { id: "PortRelayCancelParams" });
|
|
6
|
+
const result = z.object({}).register(wireRegistry, { id: "PortRelayCancelResult" });
|
|
7
|
+
/**
|
|
8
|
+
* `port/relay.cancel`: a viewer cancelled a relayed run; the owner fires its `abortSignal` if it
|
|
9
|
+
* still runs (AC-04). A cancel made while the owner was away arrives on reconnect.
|
|
10
|
+
*/
|
|
11
|
+
const portRelayCancelMethod = defineMethod({
|
|
12
|
+
method: "port/relay.cancel",
|
|
13
|
+
direction: "instance-to-host",
|
|
14
|
+
mutating: false,
|
|
15
|
+
params,
|
|
16
|
+
result
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
export { portRelayCancelMethod };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=relay-cancel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-cancel.js","names":[],"sources":["../../../src/methods/port/relay-cancel.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `port/relay.cancel` (INTERFACES §18.3). */\nexport interface PortRelayCancelParams {\n /** The hosted run to cancel. */\n readonly runId: string;\n}\n\n/** The result of `port/relay.cancel`. */\nexport type PortRelayCancelResult = Record<string, never>;\n\nconst params: z.ZodType<PortRelayCancelParams> = z\n .object({ runId: z.string().min(1) })\n .register(wireRegistry, { id: \"PortRelayCancelParams\" });\n\nconst result: z.ZodType<PortRelayCancelResult> = z\n .object({})\n .register(wireRegistry, { id: \"PortRelayCancelResult\" });\n\n/**\n * `port/relay.cancel`: a viewer cancelled a relayed run; the owner fires its `abortSignal` if it\n * still runs (AC-04). A cancel made while the owner was away arrives on reconnect.\n */\nexport const portRelayCancelMethod: MethodDefinition<PortRelayCancelParams, PortRelayCancelResult> =\n defineMethod({\n method: \"port/relay.cancel\",\n direction: \"instance-to-host\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;AAaA,MAAM,SAA2C,EAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CACpC,SAAS,cAAc,EAAE,IAAI,wBAAwB,CAAC;AAEzD,MAAM,SAA2C,EAC9C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,wBAAwB,CAAC;;;;;AAMzD,MAAa,wBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MethodDefinition } from "../../method.js";
|
|
2
|
+
//#region src/methods/port/relay-live.d.ts
|
|
3
|
+
/** The params of `port/relay.live` (INTERFACES §18.3). */
|
|
4
|
+
export interface PortRelayLiveParams {
|
|
5
|
+
/** The artifact, by its own ID. */
|
|
6
|
+
readonly artifactId: string;
|
|
7
|
+
/** The version whose producers are wanted: the artifact's latest on the hosted home. */
|
|
8
|
+
readonly versionId: string;
|
|
9
|
+
/**
|
|
10
|
+
* `start` and `renew` keep the producers of `keys` running for a minute; `stop` lets them stop;
|
|
11
|
+
* `refresh` asks them to load again now.
|
|
12
|
+
*/
|
|
13
|
+
readonly interest: "start" | "renew" | "stop" | "refresh";
|
|
14
|
+
/** The live sources' keys. */
|
|
15
|
+
readonly keys: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
/** The result of `port/relay.live`. */
|
|
18
|
+
export type PortRelayLiveResult = Record<string, never>;
|
|
19
|
+
/**
|
|
20
|
+
* `port/relay.live`: viewers of a hosted page want (or no longer want) its live sources, so their
|
|
21
|
+
* producers run on the owner instance while someone views (D165 item 4).
|
|
22
|
+
*/
|
|
23
|
+
export declare const portRelayLiveMethod: MethodDefinition<PortRelayLiveParams, PortRelayLiveResult>;
|
|
24
|
+
//#endregion
|
|
25
|
+
//# sourceMappingURL=relay-live.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-live.d.ts","names":[],"sources":["../../../src/methods/port/relay-live.ts"],"mappings":";;;iBAMiB;;WAEN;;WAEA;;;;;WAKA;;WAEA;;;YAIC,sBAAsB;;;;;qBAmBrB,qBAAqB,iBAAiB,qBAAqB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { LIVE_KEY_PATTERN } from "../../actions.js";
|
|
3
|
+
import { defineMethod } from "../../method.js";
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
//#region src/methods/port/relay-live.ts
|
|
6
|
+
const params = z.object({
|
|
7
|
+
artifactId: z.string().min(1),
|
|
8
|
+
versionId: z.string().min(1),
|
|
9
|
+
interest: z.enum([
|
|
10
|
+
"start",
|
|
11
|
+
"renew",
|
|
12
|
+
"stop",
|
|
13
|
+
"refresh"
|
|
14
|
+
]),
|
|
15
|
+
keys: z.array(z.string().regex(LIVE_KEY_PATTERN)).max(1e3).readonly()
|
|
16
|
+
}).register(wireRegistry, { id: "PortRelayLiveParams" });
|
|
17
|
+
const result = z.object({}).register(wireRegistry, { id: "PortRelayLiveResult" });
|
|
18
|
+
/**
|
|
19
|
+
* `port/relay.live`: viewers of a hosted page want (or no longer want) its live sources, so their
|
|
20
|
+
* producers run on the owner instance while someone views (D165 item 4).
|
|
21
|
+
*/
|
|
22
|
+
const portRelayLiveMethod = defineMethod({
|
|
23
|
+
method: "port/relay.live",
|
|
24
|
+
direction: "instance-to-host",
|
|
25
|
+
mutating: false,
|
|
26
|
+
params,
|
|
27
|
+
result
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
export { portRelayLiveMethod };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=relay-live.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-live.js","names":[],"sources":["../../../src/methods/port/relay-live.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { LIVE_KEY_PATTERN } from \"../../actions.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `port/relay.live` (INTERFACES §18.3). */\nexport interface PortRelayLiveParams {\n /** The artifact, by its own ID. */\n readonly artifactId: string;\n /** The version whose producers are wanted: the artifact's latest on the hosted home. */\n readonly versionId: string;\n /**\n * `start` and `renew` keep the producers of `keys` running for a minute; `stop` lets them stop;\n * `refresh` asks them to load again now.\n */\n readonly interest: \"start\" | \"renew\" | \"stop\" | \"refresh\";\n /** The live sources' keys. */\n readonly keys: readonly string[];\n}\n\n/** The result of `port/relay.live`. */\nexport type PortRelayLiveResult = Record<string, never>;\n\nconst params: z.ZodType<PortRelayLiveParams> = z\n .object({\n artifactId: z.string().min(1),\n versionId: z.string().min(1),\n interest: z.enum([\"start\", \"renew\", \"stop\", \"refresh\"]),\n keys: z.array(z.string().regex(LIVE_KEY_PATTERN)).max(1000).readonly(),\n })\n .register(wireRegistry, { id: \"PortRelayLiveParams\" });\n\nconst result: z.ZodType<PortRelayLiveResult> = z\n .object({})\n .register(wireRegistry, { id: \"PortRelayLiveResult\" });\n\n/**\n * `port/relay.live`: viewers of a hosted page want (or no longer want) its live sources, so their\n * producers run on the owner instance while someone views (D165 item 4).\n */\nexport const portRelayLiveMethod: MethodDefinition<PortRelayLiveParams, PortRelayLiveResult> =\n defineMethod({\n method: \"port/relay.live\",\n direction: \"instance-to-host\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;AAuBA,MAAM,SAAyC,EAC5C,OAAO;CACN,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC5B,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC3B,UAAU,EAAE,KAAK;EAAC;EAAS;EAAS;EAAQ;CAAS,CAAC;CACtD,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,MAAM,gBAAgB,CAAC,CAAC,CAAC,IAAI,GAAI,CAAC,CAAC,SAAS;AACvE,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,sBAAsB,CAAC;AAEvD,MAAM,SAAyC,EAC5C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,sBAAsB,CAAC;;;;;AAMvD,MAAa,sBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { RunState } from "../../actions.js";
|
|
2
|
+
import { MethodDefinition } from "../../method.js";
|
|
3
|
+
//#region src/methods/port/relay-reconcile.d.ts
|
|
4
|
+
/** What the hosted home holds of a run already, so the owner answers only what is newer. */
|
|
5
|
+
export interface RelayHeld {
|
|
6
|
+
/** The run. */
|
|
7
|
+
readonly runId: string;
|
|
8
|
+
/** How many log lines it holds. */
|
|
9
|
+
readonly log: number;
|
|
10
|
+
/** How many result batches it holds. */
|
|
11
|
+
readonly batches: number;
|
|
12
|
+
}
|
|
13
|
+
/** The params of `port/relay.reconcile` (INTERFACES §18.3). */
|
|
14
|
+
export interface PortRelayReconcileParams {
|
|
15
|
+
/** The runs the owner accepted and the hosted home holds no end for. */
|
|
16
|
+
readonly runs: readonly string[];
|
|
17
|
+
/** What the hosted home holds of each (additive: the owner answers from there). */
|
|
18
|
+
readonly held?: readonly RelayHeld[];
|
|
19
|
+
}
|
|
20
|
+
/** One run as the owner knows it, or `unknown-to-owner` when its ledger has no such run. */
|
|
21
|
+
export interface RelayReconciled {
|
|
22
|
+
/** The run. */
|
|
23
|
+
readonly runId: string;
|
|
24
|
+
/** Its state from the held positions on, or `unknown-to-owner`. */
|
|
25
|
+
readonly state: RunState | "unknown-to-owner";
|
|
26
|
+
}
|
|
27
|
+
/** The result of `port/relay.reconcile`. */
|
|
28
|
+
export interface PortRelayReconcileResult {
|
|
29
|
+
/** One answer per run asked about. */
|
|
30
|
+
readonly runs: readonly RelayReconciled[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* `port/relay.reconcile`: after every reconnect, before any waiting run drains, the hosted home
|
|
34
|
+
* asks its owner for the runs it accepted and hasn't finished (D165 item 4); a run the owner
|
|
35
|
+
* doesn't know becomes `unknown` and is never sent again.
|
|
36
|
+
*/
|
|
37
|
+
export declare const portRelayReconcileMethod: MethodDefinition<PortRelayReconcileParams, PortRelayReconcileResult>;
|
|
38
|
+
//#endregion
|
|
39
|
+
//# sourceMappingURL=relay-reconcile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-reconcile.d.ts","names":[],"sources":["../../../src/methods/port/relay-reconcile.ts"],"mappings":";;;;iBAMiB;;WAEN;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA,gBAAgB;;;iBAIV;;WAEN;;WAEA,OAAO;;;iBAID;;WAEN,eAAe;;;;;;;qBA2Bb,0BAA0B,iBACrC,0BACA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { RunState } from "../../actions.js";
|
|
3
|
+
import { defineMethod } from "../../method.js";
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
//#region src/methods/port/relay-reconcile.ts
|
|
6
|
+
const held = z.object({
|
|
7
|
+
runId: z.string().min(1),
|
|
8
|
+
log: z.int().min(0),
|
|
9
|
+
batches: z.int().min(0)
|
|
10
|
+
}).register(wireRegistry, { id: "RelayHeld" });
|
|
11
|
+
const params = z.object({
|
|
12
|
+
runs: z.array(z.string().min(1)).max(1e4).readonly(),
|
|
13
|
+
held: z.array(held).max(1e4).readonly().exactOptional()
|
|
14
|
+
}).register(wireRegistry, { id: "PortRelayReconcileParams" });
|
|
15
|
+
const reconciled = z.object({
|
|
16
|
+
runId: z.string(),
|
|
17
|
+
state: z.union([RunState, z.literal("unknown-to-owner")])
|
|
18
|
+
}).register(wireRegistry, { id: "RelayReconciled" });
|
|
19
|
+
const result = z.object({ runs: z.array(reconciled).readonly() }).register(wireRegistry, { id: "PortRelayReconcileResult" });
|
|
20
|
+
/**
|
|
21
|
+
* `port/relay.reconcile`: after every reconnect, before any waiting run drains, the hosted home
|
|
22
|
+
* asks its owner for the runs it accepted and hasn't finished (D165 item 4); a run the owner
|
|
23
|
+
* doesn't know becomes `unknown` and is never sent again.
|
|
24
|
+
*/
|
|
25
|
+
const portRelayReconcileMethod = defineMethod({
|
|
26
|
+
method: "port/relay.reconcile",
|
|
27
|
+
direction: "instance-to-host",
|
|
28
|
+
mutating: false,
|
|
29
|
+
params,
|
|
30
|
+
result
|
|
31
|
+
});
|
|
32
|
+
//#endregion
|
|
33
|
+
export { portRelayReconcileMethod };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=relay-reconcile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-reconcile.js","names":[],"sources":["../../../src/methods/port/relay-reconcile.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { RunState } from \"../../actions.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** What the hosted home holds of a run already, so the owner answers only what is newer. */\nexport interface RelayHeld {\n /** The run. */\n readonly runId: string;\n /** How many log lines it holds. */\n readonly log: number;\n /** How many result batches it holds. */\n readonly batches: number;\n}\n\n/** The params of `port/relay.reconcile` (INTERFACES §18.3). */\nexport interface PortRelayReconcileParams {\n /** The runs the owner accepted and the hosted home holds no end for. */\n readonly runs: readonly string[];\n /** What the hosted home holds of each (additive: the owner answers from there). */\n readonly held?: readonly RelayHeld[];\n}\n\n/** One run as the owner knows it, or `unknown-to-owner` when its ledger has no such run. */\nexport interface RelayReconciled {\n /** The run. */\n readonly runId: string;\n /** Its state from the held positions on, or `unknown-to-owner`. */\n readonly state: RunState | \"unknown-to-owner\";\n}\n\n/** The result of `port/relay.reconcile`. */\nexport interface PortRelayReconcileResult {\n /** One answer per run asked about. */\n readonly runs: readonly RelayReconciled[];\n}\n\nconst held: z.ZodType<RelayHeld> = z\n .object({ runId: z.string().min(1), log: z.int().min(0), batches: z.int().min(0) })\n .register(wireRegistry, { id: \"RelayHeld\" });\n\nconst params: z.ZodType<PortRelayReconcileParams> = z\n .object({\n runs: z.array(z.string().min(1)).max(10_000).readonly(),\n held: z.array(held).max(10_000).readonly().exactOptional(),\n })\n .register(wireRegistry, { id: \"PortRelayReconcileParams\" });\n\nconst reconciled: z.ZodType<RelayReconciled> = z\n .object({ runId: z.string(), state: z.union([RunState, z.literal(\"unknown-to-owner\")]) })\n .register(wireRegistry, { id: \"RelayReconciled\" });\n\nconst result: z.ZodType<PortRelayReconcileResult> = z\n .object({ runs: z.array(reconciled).readonly() })\n .register(wireRegistry, { id: \"PortRelayReconcileResult\" });\n\n/**\n * `port/relay.reconcile`: after every reconnect, before any waiting run drains, the hosted home\n * asks its owner for the runs it accepted and hasn't finished (D165 item 4); a run the owner\n * doesn't know becomes `unknown` and is never sent again.\n */\nexport const portRelayReconcileMethod: MethodDefinition<\n PortRelayReconcileParams,\n PortRelayReconcileResult\n> = defineMethod({\n method: \"port/relay.reconcile\",\n direction: \"instance-to-host\",\n mutating: false,\n params,\n result,\n});\n"],"mappings":";;;;;AAqCA,MAAM,OAA6B,EAChC,OAAO;CAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAAG,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAAG,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AAAE,CAAC,CAAC,CAClF,SAAS,cAAc,EAAE,IAAI,YAAY,CAAC;AAE7C,MAAM,SAA8C,EACjD,OAAO;CACN,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,GAAM,CAAC,CAAC,SAAS;CACtD,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC,IAAI,GAAM,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;AAC3D,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,2BAA2B,CAAC;AAE5D,MAAM,aAAyC,EAC5C,OAAO;CAAE,OAAO,EAAE,OAAO;CAAG,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,QAAQ,kBAAkB,CAAC,CAAC;AAAE,CAAC,CAAC,CACxF,SAAS,cAAc,EAAE,IAAI,kBAAkB,CAAC;AAEnD,MAAM,SAA8C,EACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAChD,SAAS,cAAc,EAAE,IAAI,2BAA2B,CAAC;;;;;;AAO5D,MAAa,2BAGT,aAAa;CACf,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Batches } from "../../actions.js";
|
|
2
|
+
import { MethodDefinition } from "../../method.js";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/methods/port/relay-run.d.ts
|
|
5
|
+
/** Who pressed a relayed action, as its server code's `viewer()` reads it. */
|
|
6
|
+
export interface RelayViewer {
|
|
7
|
+
/** The hosted home's viewer ID. */
|
|
8
|
+
readonly id: string;
|
|
9
|
+
/** The display name, when one is known. */
|
|
10
|
+
readonly name?: string;
|
|
11
|
+
}
|
|
12
|
+
/** The Zod schema of the `RelayViewer` type. */
|
|
13
|
+
export declare const RelayViewer: z.ZodType<RelayViewer>;
|
|
14
|
+
/** The params of `port/relay.run` (INTERFACES §18.3). */
|
|
15
|
+
export interface PortRelayRunParams {
|
|
16
|
+
/** The hosted home's run ID: the owner records the run under it, so a repeat joins it. */
|
|
17
|
+
readonly runId: string;
|
|
18
|
+
/** The run's relay sequence, unique per owner link and growing (the owner's `relayMark`). */
|
|
19
|
+
readonly seq: number;
|
|
20
|
+
/** The artifact, by its own ID. */
|
|
21
|
+
readonly artifactId: string;
|
|
22
|
+
/** The version whose server code runs it: the view's. */
|
|
23
|
+
readonly versionId: string;
|
|
24
|
+
/** The server function: `<module path>#<export>`. */
|
|
25
|
+
readonly fnId: string;
|
|
26
|
+
/** Its serialized arguments. */
|
|
27
|
+
readonly args: Batches;
|
|
28
|
+
/** The run's idempotency key, which the hosted home checked (D130). */
|
|
29
|
+
readonly key?: string;
|
|
30
|
+
/** Who pressed it. */
|
|
31
|
+
readonly viewer?: RelayViewer;
|
|
32
|
+
/** The hosted view that started it. */
|
|
33
|
+
readonly viewId?: string;
|
|
34
|
+
}
|
|
35
|
+
/** The result of `port/relay.run`: the owner recorded the run, so it happens at most once. */
|
|
36
|
+
export interface PortRelayRunResult {
|
|
37
|
+
/** Always `true`: a run the owner can't record is an error. */
|
|
38
|
+
readonly accepted: true;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* `port/relay.run`: a hosted home hands its owner instance a run to execute (D165 item 4), answered
|
|
42
|
+
* once the owner recorded it under the hosted run's ID; its progress, log, result and end come back
|
|
43
|
+
* as `relay/run.update`.
|
|
44
|
+
*/
|
|
45
|
+
export declare const portRelayRunMethod: MethodDefinition<PortRelayRunParams, PortRelayRunResult>;
|
|
46
|
+
//#endregion
|
|
47
|
+
//# sourceMappingURL=relay-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-run.d.ts","names":[],"sources":["../../../src/methods/port/relay-run.ts"],"mappings":";;;;;iBAMiB;;WAEN;;WAEA;;;qBAIE,aAAa,EAAE,QAAQ;;iBAQnB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,MAAM;;WAEN;;WAEA,SAAS;;WAET;;;iBAIM;;WAEN;;;;;;;qBA0BE,oBAAoB,iBAAiB,oBAAoB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { Batches } from "../../actions.js";
|
|
3
|
+
import { defineMethod } from "../../method.js";
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
//#region src/methods/port/relay-run.ts
|
|
6
|
+
/** The Zod schema of the `RelayViewer` type. */
|
|
7
|
+
const RelayViewer = z.object({
|
|
8
|
+
id: z.string().min(1),
|
|
9
|
+
name: z.string().exactOptional()
|
|
10
|
+
}).register(wireRegistry, {
|
|
11
|
+
id: "RelayViewer",
|
|
12
|
+
description: "The viewer a relayed run or call acts for: the hosted home's viewer ID and name."
|
|
13
|
+
});
|
|
14
|
+
const params = z.object({
|
|
15
|
+
runId: z.string().min(1),
|
|
16
|
+
seq: z.int().min(1),
|
|
17
|
+
artifactId: z.string().min(1),
|
|
18
|
+
versionId: z.string().min(1),
|
|
19
|
+
fnId: z.string().min(1),
|
|
20
|
+
args: Batches,
|
|
21
|
+
key: z.string().exactOptional(),
|
|
22
|
+
viewer: RelayViewer.exactOptional(),
|
|
23
|
+
viewId: z.string().exactOptional()
|
|
24
|
+
}).register(wireRegistry, { id: "PortRelayRunParams" });
|
|
25
|
+
const result = z.object({ accepted: z.literal(true) }).register(wireRegistry, { id: "PortRelayRunResult" });
|
|
26
|
+
/**
|
|
27
|
+
* `port/relay.run`: a hosted home hands its owner instance a run to execute (D165 item 4), answered
|
|
28
|
+
* once the owner recorded it under the hosted run's ID; its progress, log, result and end come back
|
|
29
|
+
* as `relay/run.update`.
|
|
30
|
+
*/
|
|
31
|
+
const portRelayRunMethod = defineMethod({
|
|
32
|
+
method: "port/relay.run",
|
|
33
|
+
direction: "instance-to-host",
|
|
34
|
+
mutating: false,
|
|
35
|
+
params,
|
|
36
|
+
result
|
|
37
|
+
});
|
|
38
|
+
//#endregion
|
|
39
|
+
export { RelayViewer, portRelayRunMethod };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=relay-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-run.js","names":[],"sources":["../../../src/methods/port/relay-run.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { Batches } from \"../../actions.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** Who pressed a relayed action, as its server code's `viewer()` reads it. */\nexport interface RelayViewer {\n /** The hosted home's viewer ID. */\n readonly id: string;\n /** The display name, when one is known. */\n readonly name?: string;\n}\n\n/** The Zod schema of the `RelayViewer` type. */\nexport const RelayViewer: z.ZodType<RelayViewer> = z\n .object({ id: z.string().min(1), name: z.string().exactOptional() })\n .register(wireRegistry, {\n id: \"RelayViewer\",\n description: \"The viewer a relayed run or call acts for: the hosted home's viewer ID and name.\",\n });\n\n/** The params of `port/relay.run` (INTERFACES §18.3). */\nexport interface PortRelayRunParams {\n /** The hosted home's run ID: the owner records the run under it, so a repeat joins it. */\n readonly runId: string;\n /** The run's relay sequence, unique per owner link and growing (the owner's `relayMark`). */\n readonly seq: number;\n /** The artifact, by its own ID. */\n readonly artifactId: string;\n /** The version whose server code runs it: the view's. */\n readonly versionId: string;\n /** The server function: `<module path>#<export>`. */\n readonly fnId: string;\n /** Its serialized arguments. */\n readonly args: Batches;\n /** The run's idempotency key, which the hosted home checked (D130). */\n readonly key?: string;\n /** Who pressed it. */\n readonly viewer?: RelayViewer;\n /** The hosted view that started it. */\n readonly viewId?: string;\n}\n\n/** The result of `port/relay.run`: the owner recorded the run, so it happens at most once. */\nexport interface PortRelayRunResult {\n /** Always `true`: a run the owner can't record is an error. */\n readonly accepted: true;\n}\n\nconst params: z.ZodType<PortRelayRunParams> = z\n .object({\n runId: z.string().min(1),\n seq: z.int().min(1),\n artifactId: z.string().min(1),\n versionId: z.string().min(1),\n fnId: z.string().min(1),\n args: Batches,\n key: z.string().exactOptional(),\n viewer: RelayViewer.exactOptional(),\n viewId: z.string().exactOptional(),\n })\n .register(wireRegistry, { id: \"PortRelayRunParams\" });\n\nconst result: z.ZodType<PortRelayRunResult> = z\n .object({ accepted: z.literal(true) })\n .register(wireRegistry, { id: \"PortRelayRunResult\" });\n\n/**\n * `port/relay.run`: a hosted home hands its owner instance a run to execute (D165 item 4), answered\n * once the owner recorded it under the hosted run's ID; its progress, log, result and end come back\n * as `relay/run.update`.\n */\nexport const portRelayRunMethod: MethodDefinition<PortRelayRunParams, PortRelayRunResult> =\n defineMethod({\n method: \"port/relay.run\",\n direction: \"instance-to-host\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;;AAcA,MAAa,cAAsC,EAChD,OAAO;CAAE,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAAG,MAAM,EAAE,OAAO,CAAC,CAAC,cAAc;AAAE,CAAC,CAAC,CACnE,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AA8BH,MAAM,SAAwC,EAC3C,OAAO;CACN,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACvB,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC5B,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC3B,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACtB,MAAM;CACN,KAAK,EAAE,OAAO,CAAC,CAAC,cAAc;CAC9B,QAAQ,YAAY,cAAc;CAClC,QAAQ,EAAE,OAAO,CAAC,CAAC,cAAc;AACnC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,qBAAqB,CAAC;AAEtD,MAAM,SAAwC,EAC3C,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC,CACrC,SAAS,cAAc,EAAE,IAAI,qBAAqB,CAAC;;;;;;AAOtD,MAAa,qBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Cursor } from "../../ids.js";
|
|
1
2
|
import { Results } from "../../interaction.js";
|
|
2
3
|
import { MethodDefinition } from "../../method.js";
|
|
3
4
|
import * as z from "zod";
|
|
@@ -16,6 +17,13 @@ export interface SubmissionEnvelope {
|
|
|
16
17
|
readonly attempt: number;
|
|
17
18
|
/** The complete submission (INTERFACES §8), built from the immutable submission alone. */
|
|
18
19
|
readonly results: Results;
|
|
20
|
+
/**
|
|
21
|
+
* The submission's stored snapshot, its canonical text, whose SHA-256 is `results.submission.digest`.
|
|
22
|
+
* A hosted home sends it to its owner instance, which keeps the same submission (D165 item 1).
|
|
23
|
+
*/
|
|
24
|
+
readonly snapshot?: string;
|
|
25
|
+
/** With `snapshot`: the cursor of the submission's `submission.created` in the hosted home. */
|
|
26
|
+
readonly cursor?: Cursor;
|
|
19
27
|
}
|
|
20
28
|
/** What a host answers a delivery. */
|
|
21
29
|
export type SubmissionsDeliverResult = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submissions-deliver.d.ts","names":[],"sources":["../../../src/methods/port/submissions-deliver.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"submissions-deliver.d.ts","names":[],"sources":["../../../src/methods/port/submissions-deliver.ts"],"mappings":";;;;;;iBAOiB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,SAAS;;;;;WAKT;;WAEA,SAAS;;;YAIR;WACG;;WAEA;;WAEA;;WAEA;;;qBAIF,oBAAoB,EAAE,QAAQ;;;;;qBA+B9B,8BAA8B,iBACzC,oBACA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
-
import { ArtifactId, DeliveryId, SubmissionId } from "../../ids.js";
|
|
2
|
+
import { ArtifactId, Cursor, DeliveryId, SubmissionId } from "../../ids.js";
|
|
3
3
|
import { Results } from "../../interaction.js";
|
|
4
4
|
import { defineMethod } from "../../method.js";
|
|
5
5
|
import * as z from "zod";
|
|
@@ -11,7 +11,9 @@ const SubmissionEnvelope = z.object({
|
|
|
11
11
|
submissionId: SubmissionId.schema,
|
|
12
12
|
artifactId: ArtifactId.schema,
|
|
13
13
|
attempt: z.int().min(1),
|
|
14
|
-
results: Results
|
|
14
|
+
results: Results,
|
|
15
|
+
snapshot: z.string().max(41943040).exactOptional(),
|
|
16
|
+
cursor: Cursor.schema.exactOptional()
|
|
15
17
|
}).register(wireRegistry, {
|
|
16
18
|
id: "SubmissionEnvelope",
|
|
17
19
|
description: "One submission delivered to a host: delivery ID, attempt and the complete results."
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submissions-deliver.js","names":[],"sources":["../../../src/methods/port/submissions-deliver.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactId, DeliveryId, SubmissionId } from \"../../ids.ts\";\nimport { Results } from \"../../interaction.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** One submission delivered to a host (INTERFACES §7, D105). */\nexport interface SubmissionEnvelope {\n /** Always `submission`: a draft never arrives through this port (IN-06). */\n readonly kind: \"submission\";\n /** Stable across redeliveries: treat a repeated ID as the same delivery (H-03). */\n readonly deliveryId: string;\n /** The submission. */\n readonly submissionId: string;\n /** Its artifact. */\n readonly artifactId: string;\n /** 1 for the first attempt; more after retries and restarts. */\n readonly attempt: number;\n /** The complete submission (INTERFACES §8), built from the immutable submission alone. */\n readonly results: Results;\n}\n\n/** What a host answers a delivery. */\nexport type SubmissionsDeliverResult =\n | { readonly accepted: true }\n | {\n readonly accepted: false;\n /** `duplicate` (already held), `undeliverable` (terminal, shown to the viewer), or the host's own. */\n readonly reason: string;\n /** `true` keeps the delivery pending and retries it with backoff. */\n readonly retry: boolean;\n };\n\n/** The Zod schema of the `SubmissionEnvelope` type. */\nexport const SubmissionEnvelope: z.ZodType<SubmissionEnvelope> = z\n .object({\n kind: z.literal(\"submission\"),\n deliveryId: DeliveryId.schema,\n submissionId: SubmissionId.schema,\n artifactId: ArtifactId.schema,\n attempt: z.int().min(1),\n results: Results,\n })\n .register(wireRegistry, {\n id: \"SubmissionEnvelope\",\n description:\n \"One submission delivered to a host: delivery ID, attempt and the complete results.\",\n });\n\nconst result: z.ZodType<SubmissionsDeliverResult> = z\n .union([\n z.object({ accepted: z.literal(true) }),\n z.object({ accepted: z.literal(false), reason: z.string().min(1), retry: z.boolean() }),\n ])\n .register(wireRegistry, { id: \"PortSubmissionsDeliverResult\" });\n\n/**\n * `port/submissions.deliver`: Mostra delivers one submission to the host that registered the\n * submissions port, after the submission is durable (IN-12), one at a time in submission order.\n */\nexport const portSubmissionsDeliverMethod: MethodDefinition<\n SubmissionEnvelope,\n SubmissionsDeliverResult\n> = defineMethod({\n method: \"port/submissions.deliver\",\n direction: \"instance-to-host\",\n mutating: false,\n params: SubmissionEnvelope,\n result,\n});\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"submissions-deliver.js","names":[],"sources":["../../../src/methods/port/submissions-deliver.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactId, Cursor, DeliveryId, SubmissionId } from \"../../ids.ts\";\nimport { Results } from \"../../interaction.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** One submission delivered to a host (INTERFACES §7, D105). */\nexport interface SubmissionEnvelope {\n /** Always `submission`: a draft never arrives through this port (IN-06). */\n readonly kind: \"submission\";\n /** Stable across redeliveries: treat a repeated ID as the same delivery (H-03). */\n readonly deliveryId: string;\n /** The submission. */\n readonly submissionId: string;\n /** Its artifact. */\n readonly artifactId: string;\n /** 1 for the first attempt; more after retries and restarts. */\n readonly attempt: number;\n /** The complete submission (INTERFACES §8), built from the immutable submission alone. */\n readonly results: Results;\n /**\n * The submission's stored snapshot, its canonical text, whose SHA-256 is `results.submission.digest`.\n * A hosted home sends it to its owner instance, which keeps the same submission (D165 item 1).\n */\n readonly snapshot?: string;\n /** With `snapshot`: the cursor of the submission's `submission.created` in the hosted home. */\n readonly cursor?: Cursor;\n}\n\n/** What a host answers a delivery. */\nexport type SubmissionsDeliverResult =\n | { readonly accepted: true }\n | {\n readonly accepted: false;\n /** `duplicate` (already held), `undeliverable` (terminal, shown to the viewer), or the host's own. */\n readonly reason: string;\n /** `true` keeps the delivery pending and retries it with backoff. */\n readonly retry: boolean;\n };\n\n/** The Zod schema of the `SubmissionEnvelope` type. */\nexport const SubmissionEnvelope: z.ZodType<SubmissionEnvelope> = z\n .object({\n kind: z.literal(\"submission\"),\n deliveryId: DeliveryId.schema,\n submissionId: SubmissionId.schema,\n artifactId: ArtifactId.schema,\n attempt: z.int().min(1),\n results: Results,\n snapshot: z\n .string()\n .max(40 * 1024 * 1024)\n .exactOptional(),\n cursor: Cursor.schema.exactOptional(),\n })\n .register(wireRegistry, {\n id: \"SubmissionEnvelope\",\n description:\n \"One submission delivered to a host: delivery ID, attempt and the complete results.\",\n });\n\nconst result: z.ZodType<SubmissionsDeliverResult> = z\n .union([\n z.object({ accepted: z.literal(true) }),\n z.object({ accepted: z.literal(false), reason: z.string().min(1), retry: z.boolean() }),\n ])\n .register(wireRegistry, { id: \"PortSubmissionsDeliverResult\" });\n\n/**\n * `port/submissions.deliver`: Mostra delivers one submission to the host that registered the\n * submissions port, after the submission is durable (IN-12), one at a time in submission order.\n */\nexport const portSubmissionsDeliverMethod: MethodDefinition<\n SubmissionEnvelope,\n SubmissionsDeliverResult\n> = defineMethod({\n method: \"port/submissions.deliver\",\n direction: \"instance-to-host\",\n mutating: false,\n params: SubmissionEnvelope,\n result,\n});\n"],"mappings":";;;;;;;AAyCA,MAAa,qBAAoD,EAC9D,OAAO;CACN,MAAM,EAAE,QAAQ,YAAY;CAC5B,YAAY,WAAW;CACvB,cAAc,aAAa;CAC3B,YAAY,WAAW;CACvB,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,SAAS;CACT,UAAU,EACP,OAAO,CAAC,CACR,IAAI,QAAgB,CAAC,CACrB,cAAc;CACjB,QAAQ,OAAO,OAAO,cAAc;AACtC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;AAEH,MAAM,SAA8C,EACjD,MAAM,CACL,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,CAAC,GACtC,EAAE,OAAO;CAAE,UAAU,EAAE,QAAQ,KAAK;CAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAAG,OAAO,EAAE,QAAQ;AAAE,CAAC,CACxF,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,+BAA+B,CAAC;;;;;AAMhE,MAAa,+BAGT,aAAa;CACf,QAAQ;CACR,WAAW;CACX,UAAU;CACV,QAAQ;CACR;AACF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Batches } from "../../actions.js";
|
|
2
|
+
import { MethodDefinition } from "../../method.js";
|
|
3
|
+
//#region src/methods/relay/call-batch.d.ts
|
|
4
|
+
/** The params of `relay/call.batch` (INTERFACES §18.3). */
|
|
5
|
+
export interface RelayCallBatchParams {
|
|
6
|
+
/** The hosted home's call. */
|
|
7
|
+
readonly callId: string;
|
|
8
|
+
/** Grows by one per message of the call. */
|
|
9
|
+
readonly seq: number;
|
|
10
|
+
/** Serialized batches of the result, in order. */
|
|
11
|
+
readonly batches?: Batches;
|
|
12
|
+
/** The call's end: the last message. */
|
|
13
|
+
readonly end?: {
|
|
14
|
+
readonly status: "succeeded" | "failed";
|
|
15
|
+
readonly error?: {
|
|
16
|
+
readonly message: string;
|
|
17
|
+
readonly code?: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** The result of `relay/call.batch`. */
|
|
22
|
+
export type RelayCallBatchResult = Record<string, never>;
|
|
23
|
+
/** `relay/call.batch`: the owner streams a relayed plain call's result back, then its end. */
|
|
24
|
+
export declare const relayCallBatchMethod: MethodDefinition<RelayCallBatchParams, RelayCallBatchResult>;
|
|
25
|
+
//#endregion
|
|
26
|
+
//# sourceMappingURL=call-batch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-batch.d.ts","names":[],"sources":["../../../src/methods/relay/call-batch.ts"],"mappings":";;;;iBAMiB;;WAEN;;WAEA;;WAEA,UAAU;;WAEV;aACE;aACA;eAAmB;eAA0B;;;;;YAK9C,uBAAuB;;qBAuBtB,sBAAsB,iBAAiB,sBAAsB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { Batches } from "../../actions.js";
|
|
3
|
+
import { defineMethod } from "../../method.js";
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
//#region src/methods/relay/call-batch.ts
|
|
6
|
+
const params = z.object({
|
|
7
|
+
callId: z.string().min(1),
|
|
8
|
+
seq: z.int().min(1),
|
|
9
|
+
batches: Batches.exactOptional(),
|
|
10
|
+
end: z.object({
|
|
11
|
+
status: z.enum(["succeeded", "failed"]),
|
|
12
|
+
error: z.object({
|
|
13
|
+
message: z.string().max(1e4),
|
|
14
|
+
code: z.string().max(200).exactOptional()
|
|
15
|
+
}).exactOptional()
|
|
16
|
+
}).exactOptional()
|
|
17
|
+
}).register(wireRegistry, { id: "RelayCallBatchParams" });
|
|
18
|
+
const result = z.object({}).register(wireRegistry, { id: "RelayCallBatchResult" });
|
|
19
|
+
/** `relay/call.batch`: the owner streams a relayed plain call's result back, then its end. */
|
|
20
|
+
const relayCallBatchMethod = defineMethod({
|
|
21
|
+
method: "relay/call.batch",
|
|
22
|
+
direction: "client-to-instance",
|
|
23
|
+
mutating: false,
|
|
24
|
+
params,
|
|
25
|
+
result
|
|
26
|
+
});
|
|
27
|
+
//#endregion
|
|
28
|
+
export { relayCallBatchMethod };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=call-batch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-batch.js","names":[],"sources":["../../../src/methods/relay/call-batch.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { Batches } from \"../../actions.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `relay/call.batch` (INTERFACES §18.3). */\nexport interface RelayCallBatchParams {\n /** The hosted home's call. */\n readonly callId: string;\n /** Grows by one per message of the call. */\n readonly seq: number;\n /** Serialized batches of the result, in order. */\n readonly batches?: Batches;\n /** The call's end: the last message. */\n readonly end?: {\n readonly status: \"succeeded\" | \"failed\";\n readonly error?: { readonly message: string; readonly code?: string };\n };\n}\n\n/** The result of `relay/call.batch`. */\nexport type RelayCallBatchResult = Record<string, never>;\n\nconst params: z.ZodType<RelayCallBatchParams> = z\n .object({\n callId: z.string().min(1),\n seq: z.int().min(1),\n batches: Batches.exactOptional(),\n end: z\n .object({\n status: z.enum([\"succeeded\", \"failed\"]),\n error: z\n .object({ message: z.string().max(10_000), code: z.string().max(200).exactOptional() })\n .exactOptional(),\n })\n .exactOptional(),\n })\n .register(wireRegistry, { id: \"RelayCallBatchParams\" });\n\nconst result: z.ZodType<RelayCallBatchResult> = z\n .object({})\n .register(wireRegistry, { id: \"RelayCallBatchResult\" });\n\n/** `relay/call.batch`: the owner streams a relayed plain call's result back, then its end. */\nexport const relayCallBatchMethod: MethodDefinition<RelayCallBatchParams, RelayCallBatchResult> =\n defineMethod({\n method: \"relay/call.batch\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;AAuBA,MAAM,SAA0C,EAC7C,OAAO;CACN,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACxB,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,SAAS,QAAQ,cAAc;CAC/B,KAAK,EACF,OAAO;EACN,QAAQ,EAAE,KAAK,CAAC,aAAa,QAAQ,CAAC;EACtC,OAAO,EACJ,OAAO;GAAE,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,GAAM;GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,cAAc;EAAE,CAAC,CAAC,CACtF,cAAc;CACnB,CAAC,CAAC,CACD,cAAc;AACnB,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;AAExD,MAAM,SAA0C,EAC7C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;;AAGxD,MAAa,uBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Cursor } from "../../ids.js";
|
|
2
|
+
import { MethodDefinition } from "../../method.js";
|
|
3
|
+
//#region src/methods/relay/effect.d.ts
|
|
4
|
+
/** The params of `relay/effect` (INTERFACES §18.3). */
|
|
5
|
+
export interface RelayEffectParams {
|
|
6
|
+
/** The artifact, by its own ID. */
|
|
7
|
+
readonly artifactId: string;
|
|
8
|
+
/** The relayed run whose server code raised it. */
|
|
9
|
+
readonly runId?: string;
|
|
10
|
+
/** Or the relayed plain call. */
|
|
11
|
+
readonly callId?: string;
|
|
12
|
+
/** `signal()` or `emit()` (§2.4). */
|
|
13
|
+
readonly kind: "signal" | "emit";
|
|
14
|
+
/** The signal's name, or the host event's type (`host.…`). */
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/** Its JSON payload, at most 64 KiB. */
|
|
17
|
+
readonly payload?: unknown;
|
|
18
|
+
}
|
|
19
|
+
/** The result of `relay/effect`: the event's cursor in the hosted home. */
|
|
20
|
+
export interface RelayEffectResult {
|
|
21
|
+
/** Where the hosted home appended it. */
|
|
22
|
+
readonly cursor: Cursor;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* `relay/effect`: a relayed run's or call's server code raised a signal or emitted a host event;
|
|
26
|
+
* the hosted home appends it with the run's causation and the viewer who pressed it (D165 item 4),
|
|
27
|
+
* where the page and the owner's follow see it.
|
|
28
|
+
*/
|
|
29
|
+
export declare const relayEffectMethod: MethodDefinition<RelayEffectParams, RelayEffectResult>;
|
|
30
|
+
//#endregion
|
|
31
|
+
//# sourceMappingURL=effect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effect.d.ts","names":[],"sources":["../../../src/methods/relay/effect.ts"],"mappings":";;;;iBAMiB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;iBAIM;;WAEN,QAAQ;;;;;;;qBAuBN,mBAAmB,iBAAiB,mBAAmB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { Cursor } from "../../ids.js";
|
|
3
|
+
import { defineMethod } from "../../method.js";
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
//#region src/methods/relay/effect.ts
|
|
6
|
+
const params = z.object({
|
|
7
|
+
artifactId: z.string().min(1),
|
|
8
|
+
runId: z.string().exactOptional(),
|
|
9
|
+
callId: z.string().exactOptional(),
|
|
10
|
+
kind: z.enum(["signal", "emit"]),
|
|
11
|
+
name: z.string().min(1).max(200),
|
|
12
|
+
payload: z.unknown().exactOptional()
|
|
13
|
+
}).register(wireRegistry, { id: "RelayEffectParams" });
|
|
14
|
+
const result = z.object({ cursor: Cursor.schema }).register(wireRegistry, { id: "RelayEffectResult" });
|
|
15
|
+
/**
|
|
16
|
+
* `relay/effect`: a relayed run's or call's server code raised a signal or emitted a host event;
|
|
17
|
+
* the hosted home appends it with the run's causation and the viewer who pressed it (D165 item 4),
|
|
18
|
+
* where the page and the owner's follow see it.
|
|
19
|
+
*/
|
|
20
|
+
const relayEffectMethod = defineMethod({
|
|
21
|
+
method: "relay/effect",
|
|
22
|
+
direction: "client-to-instance",
|
|
23
|
+
mutating: true,
|
|
24
|
+
params,
|
|
25
|
+
result
|
|
26
|
+
});
|
|
27
|
+
//#endregion
|
|
28
|
+
export { relayEffectMethod };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=effect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effect.js","names":[],"sources":["../../../src/methods/relay/effect.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { Cursor } from \"../../ids.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `relay/effect` (INTERFACES §18.3). */\nexport interface RelayEffectParams {\n /** The artifact, by its own ID. */\n readonly artifactId: string;\n /** The relayed run whose server code raised it. */\n readonly runId?: string;\n /** Or the relayed plain call. */\n readonly callId?: string;\n /** `signal()` or `emit()` (§2.4). */\n readonly kind: \"signal\" | \"emit\";\n /** The signal's name, or the host event's type (`host.…`). */\n readonly name: string;\n /** Its JSON payload, at most 64 KiB. */\n readonly payload?: unknown;\n}\n\n/** The result of `relay/effect`: the event's cursor in the hosted home. */\nexport interface RelayEffectResult {\n /** Where the hosted home appended it. */\n readonly cursor: Cursor;\n}\n\nconst params: z.ZodType<RelayEffectParams> = z\n .object({\n artifactId: z.string().min(1),\n runId: z.string().exactOptional(),\n callId: z.string().exactOptional(),\n kind: z.enum([\"signal\", \"emit\"]),\n name: z.string().min(1).max(200),\n payload: z.unknown().exactOptional(),\n })\n .register(wireRegistry, { id: \"RelayEffectParams\" });\n\nconst result: z.ZodType<RelayEffectResult> = z\n .object({ cursor: Cursor.schema })\n .register(wireRegistry, { id: \"RelayEffectResult\" });\n\n/**\n * `relay/effect`: a relayed run's or call's server code raised a signal or emitted a host event;\n * the hosted home appends it with the run's causation and the viewer who pressed it (D165 item 4),\n * where the page and the owner's follow see it.\n */\nexport const relayEffectMethod: MethodDefinition<RelayEffectParams, RelayEffectResult> =\n defineMethod({\n method: \"relay/effect\",\n direction: \"client-to-instance\",\n mutating: true,\n params,\n result,\n });\n"],"mappings":";;;;;AA2BA,MAAM,SAAuC,EAC1C,OAAO;CACN,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC5B,OAAO,EAAE,OAAO,CAAC,CAAC,cAAc;CAChC,QAAQ,EAAE,OAAO,CAAC,CAAC,cAAc;CACjC,MAAM,EAAE,KAAK,CAAC,UAAU,MAAM,CAAC;CAC/B,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CAC/B,SAAS,EAAE,QAAQ,CAAC,CAAC,cAAc;AACrC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,oBAAoB,CAAC;AAErD,MAAM,SAAuC,EAC1C,OAAO,EAAE,QAAQ,OAAO,OAAO,CAAC,CAAC,CACjC,SAAS,cAAc,EAAE,IAAI,oBAAoB,CAAC;;;;;;AAOrD,MAAa,oBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|