send-to-paseo 2.1.0 → 2.2.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/package.json +1 -1
- package/server/browser-bridge.ts +4 -3
- package/shared/contracts.ts +1 -1
package/package.json
CHANGED
package/server/browser-bridge.ts
CHANGED
|
@@ -12,7 +12,7 @@ export const browserExchange = z.object({
|
|
|
12
12
|
});
|
|
13
13
|
type Exchange = z.infer<typeof browserExchange>;
|
|
14
14
|
const turns = new Map<string, number>();
|
|
15
|
-
type Route = { routeId: string; serverId: string | null; label: string; available: boolean; jobs: unknown[]; accepted: string[] };
|
|
15
|
+
type Route = { routeId: string; serverId: string | null; label: string; available: boolean; repositories?: string[]; jobs: unknown[]; accepted: string[] };
|
|
16
16
|
|
|
17
17
|
/** Each route gets its own consent scopes. A proxy can never widen them. */
|
|
18
18
|
export async function exchangeBrowser(input: Exchange, localOnly: boolean) {
|
|
@@ -31,8 +31,9 @@ export async function exchangeBrowser(input: Exchange, localOnly: boolean) {
|
|
|
31
31
|
clientId: `send:${input.clientId}`, ready: input.ready && !!localScope?.repositories.length,
|
|
32
32
|
acceptJobs: input.acceptJobs && selected === "local", repositories: localScope?.repositories ?? [],
|
|
33
33
|
results: input.results.filter(r => r.routeId === "local").map(({ routeId: _, ...r }) => r),
|
|
34
|
-
}) as { jobs?: unknown[]; accepted?: string[] };
|
|
34
|
+
}) as { jobs?: unknown[]; accepted?: string[]; repositories?: unknown };
|
|
35
35
|
local.available = true;
|
|
36
|
+
if (Array.isArray(answer.repositories)) local.repositories = [...new Set(answer.repositories.filter((r): r is string => repo.safeParse(r).success).map(r => r.toLowerCase()))].slice(0, 100);
|
|
36
37
|
local.jobs = Array.isArray(answer.jobs) ? answer.jobs : [];
|
|
37
38
|
local.accepted = Array.isArray(answer.accepted) ? answer.accepted : [];
|
|
38
39
|
} catch { /* Follow Up is optional, including older versions. */ }
|
|
@@ -43,7 +44,7 @@ export async function exchangeBrowser(input: Exchange, localOnly: boolean) {
|
|
|
43
44
|
const scope = input.routes.find(r => r.routeId === machine.id);
|
|
44
45
|
const response = await exchangeBrowserOnMachine(machine, { ...input, acceptJobs: input.acceptJobs && selected === machine.id, routes: scope ? [{ ...scope, routeId: "local" }] : [], results: input.results.filter(r => r.routeId === machine.id).map(r => ({ ...r, routeId: "local" })) }) as { routes?: Route[] };
|
|
45
46
|
const remote = response.routes?.find(r => r.routeId === "local");
|
|
46
|
-
if (remote) { route.serverId = remote.serverId; route.available = remote.available; route.jobs = remote.jobs; route.accepted = remote.accepted; }
|
|
47
|
+
if (remote) { route.serverId = remote.serverId; route.available = remote.available; route.repositories = remote.repositories; route.jobs = remote.jobs; route.accepted = remote.accepted; }
|
|
47
48
|
} catch { /* A sleeping peer cannot disable local sends. */ }
|
|
48
49
|
return route;
|
|
49
50
|
}));
|
package/shared/contracts.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { z } from "zod";
|
|
|
9
9
|
|
|
10
10
|
/** Advertised in `GET /v1/ping`. Keep in step with `package.json`. */
|
|
11
11
|
export const PLUGIN_NAME = "send-to-paseo";
|
|
12
|
-
export const PLUGIN_VERSION = "2.
|
|
12
|
+
export const PLUGIN_VERSION = "2.2.0";
|
|
13
13
|
/** Bumped only for an incompatible bridge API; the paths stay `/v1`. */
|
|
14
14
|
export const CONTRACT_VERSION = 1;
|
|
15
15
|
|