Skip to content

An open-source, self-hosted system for apps built with web technologies.

Separate service event scopes

zohayrslilehdbbb24e9b95d
diff --git a/scripts/contracts/endpoint-services.ts b/scripts/contracts/endpoint-services.ts
index 2698ef9..2244023 100644
--- a/scripts/contracts/endpoint-services.ts
+++ b/scripts/contracts/endpoint-services.ts
@@ -73,7 +73,7 @@ assert.deepEqual(lateLifecycle, [])
await assert.rejects(() => services.enable(provider, "server", "other"), /already exposes/)
await assert.rejects(() => services.enable(conflicting, "server", "counter"), /already enabled/)
-services.follow(key, "channel", "change", (_event, payload) => publications.push(payload))
+services.follow(key, "events", "change", (_event, payload) => publications.push(payload))
await services.emit(provider, "server", "ignored", 1)
await services.emit(provider, "server", "change", 2)
diff --git a/source/client/core/link-manager/auth-manager/process-manager/process-manager.ts b/source/client/core/link-manager/auth-manager/process-manager/process-manager.ts
index 8b8d4d6..01ffa05 100644
--- a/source/client/core/link-manager/auth-manager/process-manager/process-manager.ts
+++ b/source/client/core/link-manager/auth-manager/process-manager/process-manager.ts
@@ -83,7 +83,7 @@ export default class ProcessManager extends TheLink {
await this.$outbound.publish("/emit", source, event, payload)
}
- /** Changes the service exposed by the structurally identified Client Channel. */
+ /** Changes the service exposed by the structurally identified Client Context. */
public async enableService(source: string, definition: unknown) {
await this.$outbound.publishFirst("/service/enable", source, definition)
@@ -157,7 +157,7 @@ export default class ProcessManager extends TheLink {
await this.$outbound.publish("/frame/release", pane, owner)
}
- /** Register one live Channel interest for this exact frame document. */
+ /** Registers one live Context interest for this exact frame document. */
public subscribeFrame(pane: string, owner: string, subscription: string, kind: TrafficKind, event: string | null) {
return this.$outbound.publish("/frame/subscribe", pane, owner, subscription, kind, event)
diff --git a/source/client/view/components/desktop-host/host.ts b/source/client/view/components/desktop-host/host.ts
index b080b10..dac3d5b 100644
--- a/source/client/view/components/desktop-host/host.ts
+++ b/source/client/view/components/desktop-host/host.ts
@@ -183,7 +183,7 @@ export default function host(authManager: AuthManager, pane: string, desktop: ()
if (typeof subscription !== "string" || !isServiceKey(key)) return []
- if (scope !== "lifecycle" && scope !== "channel") return []
+ if (scope !== "lifecycle" && scope !== "events") return []
if (event !== null && typeof event !== "string") return []
diff --git a/source/server/core/link-manager/auth-manager/process-manager/client-process-forwarder.ts b/source/server/core/link-manager/auth-manager/process-manager/client-process-forwarder.ts
index e235df1..4455b2a 100644
--- a/source/server/core/link-manager/auth-manager/process-manager/client-process-forwarder.ts
+++ b/source/server/core/link-manager/auth-manager/process-manager/client-process-forwarder.ts
@@ -82,7 +82,7 @@ export default class ClientProcessForwarder {
this.observations.delete(subscription)
}
- /** Retain one live inbound Channel publication interest for this exact client lease. */
+ /** Retains one live inbound Context publication interest for this exact client lease. */
public subscribe(subscription: string, event: string | null) {
this.subscriptions.set(subscription, event)
diff --git a/source/server/core/link-manager/auth-manager/process-manager/endpoint-services.ts b/source/server/core/link-manager/auth-manager/process-manager/endpoint-services.ts
index 0400497..e331934 100644
--- a/source/server/core/link-manager/auth-manager/process-manager/endpoint-services.ts
+++ b/source/server/core/link-manager/auth-manager/process-manager/endpoint-services.ts
@@ -126,14 +126,14 @@ export default class EndpointServices extends TheLink {
if (!key) return Promise.resolve([])
- return this.$inbound.publish(this.event(key, "channel", event), event, payload)
+ return this.$inbound.publish(this.event(key, "events", event), event, payload)
}
public follow(key: unknown, scope: Scope, event: string | null, subscriber: Subscriber) {
const resolved = this.key(key)
- if (scope !== "lifecycle" && scope !== "channel") throw new Error("A service subscription scope is invalid")
+ if (scope !== "lifecycle" && scope !== "events") throw new Error("A service subscription scope is invalid")
const prefix = this.prefix(resolved, scope)
@@ -205,7 +205,7 @@ export type ServiceScope = Scope
export type ServiceBinding = Binding
-type Scope = "lifecycle" | "channel"
+type Scope = "lifecycle" | "events"
type Binding = Readonly<{
diff --git a/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts b/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts
index a991258..8c52c33 100644
--- a/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts
+++ b/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts
@@ -255,7 +255,7 @@ export default class ProcessManager extends TheLink {
return this.askFromOutside(binding.process.identity, event, payload, timeout, signal)
}
- public observeServiceFromOutside(key: unknown, scope: "lifecycle" | "channel", event: string | null, subscriber: (event: string, payload: unknown) => unknown) {
+ public observeServiceFromOutside(key: unknown, scope: "lifecycle" | "events", event: string | null, subscriber: (event: string, payload: unknown) => unknown) {
return this.services.follow(key, scope, event, subscriber)
}
@@ -1346,7 +1346,7 @@ export default class ProcessManager extends TheLink {
if (boundary?.owner !== owner || typeof subscription !== "string" || !isServiceKey(key)) return
- if (scope !== "lifecycle" && scope !== "channel") return
+ if (scope !== "lifecycle" && scope !== "events") return
if (event !== null && typeof event !== "string") return
@@ -1747,7 +1747,7 @@ export default class ProcessManager extends TheLink {
if (typeof subscription !== "string" || !isServiceKey(key)) return []
- if (scope !== "lifecycle" && scope !== "channel") return []
+ if (scope !== "lifecycle" && scope !== "events") return []
if (event !== null && typeof event !== "string") return []
diff --git a/source/server/view/gateway/api-request.ts b/source/server/view/gateway/api-request.ts
index ddfb425..b05c24c 100644
--- a/source/server/view/gateway/api-request.ts
+++ b/source/server/view/gateway/api-request.ts
@@ -84,7 +84,7 @@ function number(value: unknown) {
function waitForService(manager: ReturnType<typeof processes>, key: unknown, scope: string, event: string | null, signal: AbortSignal) {
- if (scope !== "lifecycle" && scope !== "channel") throw new Error("A Service wait scope must be lifecycle or channel")
+ if (scope !== "lifecycle" && scope !== "events") throw new Error("A Service wait scope must be lifecycle or events")
return new Promise((resolve, reject) => {