refactor: make setup the primary wizard surface

This commit is contained in:
Peter Steinberger
2026-03-15 21:59:51 -07:00
parent 98877dc413
commit 5c120cb36c
37 changed files with 115 additions and 495 deletions

View File

@@ -1,24 +0,0 @@
import { describe, expect, it } from "vitest";
import { parseIMessageAllowFromEntries } from "../../../../extensions/imessage/src/setup-surface.js";
describe("parseIMessageAllowFromEntries", () => {
it("parses handles and chat targets", () => {
expect(parseIMessageAllowFromEntries("+15555550123, chat_id:123, chat_guid:abc")).toEqual({
entries: ["+15555550123", "chat_id:123", "chat_guid:abc"],
});
});
it("returns validation errors for invalid chat_id", () => {
expect(parseIMessageAllowFromEntries("chat_id:abc")).toEqual({
entries: [],
error: "Invalid chat_id: chat_id:abc",
});
});
it("returns validation errors for invalid chat_identifier entries", () => {
expect(parseIMessageAllowFromEntries("chat_identifier:")).toEqual({
entries: [],
error: "Invalid chat_identifier entry",
});
});
});

View File

@@ -1,42 +0,0 @@
import { describe, expect, it } from "vitest";
import {
normalizeSignalAccountInput,
parseSignalAllowFromEntries,
} from "../../../../extensions/signal/src/setup-surface.js";
describe("normalizeSignalAccountInput", () => {
it("normalizes valid E.164 numbers", () => {
expect(normalizeSignalAccountInput(" +1 (555) 555-0123 ")).toBe("+15555550123");
});
it("rejects invalid values", () => {
expect(normalizeSignalAccountInput("abc")).toBeNull();
});
});
describe("parseSignalAllowFromEntries", () => {
it("parses e164, uuid and wildcard entries", () => {
expect(
parseSignalAllowFromEntries("+15555550123, uuid:123e4567-e89b-12d3-a456-426614174000, *"),
).toEqual({
entries: ["+15555550123", "uuid:123e4567-e89b-12d3-a456-426614174000", "*"],
});
});
it("normalizes bare uuid values", () => {
expect(parseSignalAllowFromEntries("123e4567-e89b-12d3-a456-426614174000")).toEqual({
entries: ["uuid:123e4567-e89b-12d3-a456-426614174000"],
});
});
it("returns validation errors for invalid entries", () => {
expect(parseSignalAllowFromEntries("uuid:")).toEqual({
entries: [],
error: "Invalid uuid entry",
});
expect(parseSignalAllowFromEntries("invalid")).toEqual({
entries: [],
error: "Invalid entry: invalid",
});
});
});

View File

@@ -4,7 +4,7 @@ import type { ChannelId, ChannelOutboundAdapter } from "../types.js";
// Channel docking: outbound sends should stay cheap to import.
//
// The full channel plugins (src/channels/plugins/*.ts) pull in status,
// onboarding, gateway monitors, etc. Outbound delivery only needs chunking +
// setup, gateway monitors, etc. Outbound delivery only needs chunking +
// send primitives, so we keep a dedicated, lightweight loader here.
const loadOutboundAdapterFromRegistry = createChannelRegistryLoader<ChannelOutboundAdapter>(
(entry) => entry.plugin.outbound,