Finish Phase 0: lint, codegen, contributor docs and the two remaining spikes
Repository basics: - CONTRIBUTING.md and CODE_OF_CONDUCT.md (Contributor Covenant 2.1) - SPDX AGPL-3.0-or-later headers on all hand-written sources, checked in CI - golangci-lint (shared .golangci.yml), ESLint and Prettier, all run in CI API codegen from api/openapi.yaml (npm run generate, drift fails CI): - Go types via oapi-codegen in Server/internal/api - a contract test that the router and the spec list the same routes - Dart models via Phone-App/tool/generate_api.dart; the app uses them Spike: shared Tiptap editor in a Flutter WebView (ADR-4) - @docwell/editor-bridge builds the editor into one HTML page with a versioned JSON protocol; Phone-App hosts it with webview_flutter and a native toolbar. Integration test passes on an Android API 35 emulator. - flutter_inappwebview dropped: its Android plugin fails on AGP 9. Spike: Wails v3 desktop (ADR-11) - system tray, docwell:// deep links (page and space only) with single-instance hand-off, and the built-in updater with a required ed25519 signing key. Verified on Windows. - regenerated build assets register the scheme and drop template placeholders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e717c1d69f
commit
ba394b8fac
193 files changed
+6425
-399
No files matched your search
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { ApiError, createClient, isManager } from "./index";
|
||||
|
||||
@@ -31,7 +33,10 @@ describe("createClient", () => {
|
||||
expect(err.code).toBe("validation");
|
||||
expect(err.fields).toEqual({ email: "taken" });
|
||||
|
||||
const mfa = await createClient({ baseUrl: "", fetch: vi.fn(async () => jsonResponse(401, { error: "mfa_required", mfaId: "m1" })) })
|
||||
const mfa = await createClient({
|
||||
baseUrl: "",
|
||||
fetch: vi.fn(async () => jsonResponse(401, { error: "mfa_required", mfaId: "m1" })),
|
||||
})
|
||||
.auth.login("a@b.c", "pw")
|
||||
.catch((e) => e);
|
||||
expect(mfa.mfaId).toBe("m1");
|
||||
@@ -52,7 +57,9 @@ describe("createClient", () => {
|
||||
});
|
||||
|
||||
it("sends workspace membership changes", async () => {
|
||||
const fetch = vi.fn(async () => jsonResponse(200, { user: { id: "u", email: "a@b.c", name: "A" }, role: "member" }));
|
||||
const fetch = vi.fn(async () =>
|
||||
jsonResponse(200, { user: { id: "u", email: "a@b.c", name: "A" }, role: "member" }),
|
||||
);
|
||||
await createClient({ baseUrl: "", fetch }).workspaces.setMember("w 1", "a@b.c", "member");
|
||||
const [url, init] = fetch.mock.calls[0] as unknown as [string, RequestInit];
|
||||
expect(url).toBe("/api/v1/workspaces/w%201/members");
|
||||
@@ -61,8 +68,12 @@ describe("createClient", () => {
|
||||
});
|
||||
|
||||
it("keeps the server's message", async () => {
|
||||
const fetch = vi.fn(async () => jsonResponse(409, { error: "conflict", message: "organization still has members" }));
|
||||
const err = await createClient({ baseUrl: "", fetch }).orgs.remove("o1").catch((e) => e);
|
||||
const fetch = vi.fn(async () =>
|
||||
jsonResponse(409, { error: "conflict", message: "organization still has members" }),
|
||||
);
|
||||
const err = await createClient({ baseUrl: "", fetch })
|
||||
.orgs.remove("o1")
|
||||
.catch((e) => e);
|
||||
expect(err.code).toBe("conflict");
|
||||
expect(err.serverMessage).toBe("organization still has members");
|
||||
});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import type { components } from "./schema";
|
||||
|
||||
type Schemas = components["schemas"];
|
||||
@@ -118,14 +120,16 @@ export function createClient(opts: ClientOptions) {
|
||||
list: (params: { page?: number; perPage?: number; q?: string; organization?: string } = {}) =>
|
||||
request<UserList>("GET", `/api/v1/users${query(params)}`),
|
||||
create: (input: CreateUserRequest) => post<User>("/api/v1/users", input),
|
||||
update: (id: string, patch: UpdateUserRequest) => request<User>("PATCH", `/api/v1/users/${encodeURIComponent(id)}`, patch),
|
||||
update: (id: string, patch: UpdateUserRequest) =>
|
||||
request<User>("PATCH", `/api/v1/users/${encodeURIComponent(id)}`, patch),
|
||||
remove: (id: string) => request<void>("DELETE", `/api/v1/users/${encodeURIComponent(id)}`),
|
||||
},
|
||||
|
||||
orgs: {
|
||||
list: () => request<Organization[]>("GET", "/api/v1/orgs"),
|
||||
create: (name: string) => post<Organization>("/api/v1/orgs", { name }),
|
||||
rename: (id: string, name: string) => request<Organization>("PATCH", `/api/v1/orgs/${encodeURIComponent(id)}`, { name }),
|
||||
rename: (id: string, name: string) =>
|
||||
request<Organization>("PATCH", `/api/v1/orgs/${encodeURIComponent(id)}`, { name }),
|
||||
remove: (id: string) => request<void>("DELETE", `/api/v1/orgs/${encodeURIComponent(id)}`),
|
||||
},
|
||||
|
||||
@@ -135,7 +139,8 @@ export function createClient(opts: ClientOptions) {
|
||||
rename: (id: string, name: string) =>
|
||||
request<Workspace>("PATCH", `/api/v1/workspaces/${encodeURIComponent(id)}`, { name }),
|
||||
remove: (id: string) => request<void>("DELETE", `/api/v1/workspaces/${encodeURIComponent(id)}`),
|
||||
members: (id: string) => request<WorkspaceMember[]>("GET", `/api/v1/workspaces/${encodeURIComponent(id)}/members`),
|
||||
members: (id: string) =>
|
||||
request<WorkspaceMember[]>("GET", `/api/v1/workspaces/${encodeURIComponent(id)}/members`),
|
||||
setMember: (id: string, email: string, role: WorkspaceRole) =>
|
||||
request<WorkspaceMember>("PUT", `/api/v1/workspaces/${encodeURIComponent(id)}/members`, { email, role }),
|
||||
removeMember: (id: string, userId: string) =>
|
||||
@@ -172,7 +177,10 @@ export function createClient(opts: ClientOptions) {
|
||||
request<PageContent>("PUT", `/api/v1/pages/${encodeURIComponent(id)}/content`, { content }),
|
||||
versions: (id: string) => request<PageVersion[]>("GET", `/api/v1/pages/${encodeURIComponent(id)}/versions`),
|
||||
version: (id: string, versionId: string) =>
|
||||
request<PageContent>("GET", `/api/v1/pages/${encodeURIComponent(id)}/versions/${encodeURIComponent(versionId)}`),
|
||||
request<PageContent>(
|
||||
"GET",
|
||||
`/api/v1/pages/${encodeURIComponent(id)}/versions/${encodeURIComponent(versionId)}`,
|
||||
),
|
||||
restoreVersion: (id: string, versionId: string) =>
|
||||
post<PageContent>(`/api/v1/pages/${encodeURIComponent(id)}/versions/${encodeURIComponent(versionId)}/restore`),
|
||||
move: (id: string, parent: string, index: number) =>
|
||||
|
||||
Reference in new issue
Block a user