Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

chore: msw testing helpers (#5683)

Oleg Isonen8b5fa7ef15a7
diff --git a/packages/asset-uploader/package.json b/packages/asset-uploader/package.json
index 49aabc732e..b502889643 100644
--- a/packages/asset-uploader/package.json
+++ b/packages/asset-uploader/package.json
@@ -23,7 +23,9 @@
},
"devDependencies": {
"@types/fontkit": "^2.0.8",
+ "@webstudio-is/postgrest": "workspace:*",
"@webstudio-is/tsconfig": "workspace:*",
+ "msw": "^2.13.2",
"vitest": "^3.1.2",
"zod": "^3.24.2"
},
diff --git a/packages/asset-uploader/src/db/load.test.ts b/packages/asset-uploader/src/db/load.test.ts
new file mode 100644
index 0000000000..11dd22e1a7
--- /dev/null
+++ b/packages/asset-uploader/src/db/load.test.ts
@@ -0,0 +1,94 @@
+import { describe, test, expect } from "vitest";
+import {
+ createTestServer,
+ db,
+ json,
+ testContext,
+} from "@webstudio-is/postgrest/testing";
+import type { AppContext } from "@webstudio-is/trpc-interface/index.server";
+import { AuthorizationError } from "@webstudio-is/trpc-interface/index.server";
+import { loadAssetsByProject } from "./load";
+
+const server = createTestServer();
+
+const createContext = (): AppContext =>
+ ({
+ ...testContext,
+ authorization: { type: "user", userId: "user-1" },
+ getOwnerPlanFeatures: () => Promise.resolve({}),
+ }) as unknown as AppContext;
+
+/**
+ * hasProjectPermit checks direct ownership via:
+ * GET /Project?id=eq.{id}&userId=eq.{userId}
+ * Returning a row grants access. Include this in each test that needs
+ * hasProjectPermit to pass.
+ */
+const projectOwnershipHandler = db.get("Project", () => json({ id: "proj-1" }));
+
+// Asset row with File join as PostgREST returns it (select alias `assetId:id`
+// causes the column to appear as `assetId` in the response).
+const assetRow = {
+ assetId: "asset-1",
+ projectId: "proj-1",
+ filename: "photo.jpg",
+ description: null,
+ file: {
+ name: "photo.jpg",
+ format: "jpg",
+ description: null,
+ size: 12345,
+ createdAt: "2024-01-01T00:00:00.000Z",
+ meta: JSON.stringify({ width: 800, height: 600 }),
+ status: "UPLOADED",
+ },
+};
+
+describe("loadAssetsByProject (msw)", () => {
+ test("returns formatted assets for an authorised project", async () => {
+ server.use(
+ projectOwnershipHandler,
+ db.get("Asset", ({ request }) => {
+ const url = new URL(request.url);
+ expect(url.searchParams.get("projectId")).toBe("eq.proj-1");
+ expect(url.searchParams.get("file.status")).toBe("eq.UPLOADED");
+ return json([assetRow]);
+ })
+ );
+
+ const result = await loadAssetsByProject("proj-1", createContext());
+ expect(result).toHaveLength(1);
+ expect(result[0]).toMatchObject({
+ id: "asset-1",
+ projectId: "proj-1",
+ type: "image",
+ meta: { width: 800, height: 600 },
+ });
+ });
+
+ test("returns empty array when project has no uploaded assets", async () => {
+ server.use(
+ projectOwnershipHandler,
+ db.get("Asset", () => json([]))
+ );
+
+ const result = await loadAssetsByProject("proj-1", createContext());
+ expect(result).toEqual([]);
+ });
+
+ test("throws AuthorizationError when caller lacks access", async () => {
+ // Use a project the test user does not own ("proj-denied") so hasProjectPermit
+ // returns false. We cannot reuse "proj-1" here because hasProjectPermit is
+ // memoized and previous tests have already cached allowed=true for that id.
+ server.use(
+ // Ownership check: no row found for proj-denied
+ db.get("Project", () => json(null)),
+ // Workspace fallback: no workspace membership
+ db.get("WorkspaceProjectAuthorization", () => json([]))
+ );
+
+ await expect(
+ loadAssetsByProject("proj-denied", createContext())
+ ).rejects.toThrow(AuthorizationError);
+ });
+});
diff --git a/packages/authorization-token/package.json b/packages/authorization-token/package.json
index b3928fba6b..347fb8d3dc 100644
--- a/packages/authorization-token/package.json
+++ b/packages/authorization-token/package.json
@@ -6,7 +6,8 @@
"homepage": "https://webstudio.is",
"type": "module",
"scripts": {
- "typecheck": "tsgo --noEmit"
+ "typecheck": "tsgo --noEmit",
+ "test": "vitest run"
},
"dependencies": {
"@webstudio-is/postgrest": "workspace:*",
@@ -15,7 +16,9 @@
},
"devDependencies": {
"@webstudio-is/tsconfig": "workspace:*",
- "type-fest": "^4.37.0"
+ "msw": "^2.13.2",
+ "type-fest": "^4.37.0",
+ "vitest": "^3.1.2"
},
"exports": {
".": {
diff --git a/packages/authorization-token/src/db/authorization-token.test.ts b/packages/authorization-token/src/db/authorization-token.test.ts
new file mode 100644
index 0000000000..f4c532c94d
--- /dev/null
+++ b/packages/authorization-token/src/db/authorization-token.test.ts
@@ -0,0 +1,204 @@
+import { describe, test, expect } from "vitest";
+import {
+ createTestServer,
+ db,
+ json,
+ testContext,
+} from "@webstudio-is/postgrest/testing";
+import type { AppContext } from "@webstudio-is/trpc-interface/index.server";
+import {
+ findMany,
+ getTokenInfo,
+ create,
+ update,
+ remove,
+ __testing__,
+} from "./authorization-token";
+
+const { applyTokenPermissions } = __testing__;
+
+// ---------------------------------------------------------------------------
+// applyTokenPermissions — pure logic tests
+// Verifies the business rules that override stored DB values by relation.
+// ---------------------------------------------------------------------------
+
+const baseToken = {
+ token: "tok-1",
+ projectId: "proj-1",
+ name: "test",
+ createdAt: "2024-01-01T00:00:00.000Z",
+ canClone: false,
+ canCopy: false,
+ canPublish: true,
+};
+
+describe("applyTokenPermissions", () => {
+ test("viewers: canPublish forced to false, canClone/canCopy unchanged", () => {
+ const result = applyTokenPermissions({ ...baseToken, relation: "viewers" });
+ expect(result.canPublish).toBe(false);
+ expect(result.canClone).toBe(false);
+ expect(result.canCopy).toBe(false);
+ });
+
+ test("editors: canClone and canCopy forced to true, canPublish unchanged", () => {
+ const result = applyTokenPermissions({
+ ...baseToken,
+ relation: "editors",
+ canPublish: false,
+ });
+ expect(result.canClone).toBe(true);
+ expect(result.canCopy).toBe(true);
+ expect(result.canPublish).toBe(false);
+ });
+
+ test("builders: canClone/canCopy true, canPublish forced to false", () => {
+ const result = applyTokenPermissions({
+ ...baseToken,
+ relation: "builders",
+ canPublish: true,
+ });
+ expect(result.canClone).toBe(true);
+ expect(result.canCopy).toBe(true);
+ expect(result.canPublish).toBe(false);
+ });
+
+ test("administrators: canClone/canCopy true, canPublish forced to true", () => {
+ const result = applyTokenPermissions({
+ ...baseToken,
+ relation: "administrators",
+ canPublish: false,
+ });
+ expect(result.canClone).toBe(true);
+ expect(result.canCopy).toBe(true);
+ expect(result.canPublish).toBe(true);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// MSW integration tests — verifies actual DB queries
+// ---------------------------------------------------------------------------
+
+const server = createTestServer();
+
+const createContext = (): AppContext =>
+ ({
+ ...testContext,
+ authorization: { type: "user", userId: "user-1" },
+ getOwnerPlanFeatures: () => Promise.resolve({}),
+ }) as unknown as AppContext;
+
+/**
+ * hasProjectPermit checks direct ownership via:
+ * GET /Project?id=eq.{id}&userId=eq.{userId}&select=id
+ * Returning a row makes it return true for any permit.
+ * Include this in server.use() for every test that calls a function
+ * gated by authorizeProject.hasProjectPermit.
+ */
+const projectOwnershipHandler = db.get("Project", () => json({ id: "proj-1" }));
+
+const tokenRow = {
+ token: "tok-abc",
+ projectId: "proj-1",
+ name: "My Token",
+ relation: "builders",
+ canClone: false,
+ canCopy: false,
+ canPublish: true,
+ createdAt: "2024-01-01T00:00:00.000Z",
+};
+
+describe("getTokenInfo (msw)", () => {
+ // getTokenInfo does not call hasProjectPermit — no Project handler needed.
+ test("returns token with permissions applied for builders relation", async () => {
+ server.use(db.get("AuthorizationToken", () => json(tokenRow)));
+
+ const result = await getTokenInfo("tok-abc", createContext());
+ // builders rule: canClone=true, canCopy=true, canPublish=false
+ expect(result.canClone).toBe(true);
+ expect(result.canCopy).toBe(true);
+ expect(result.canPublish).toBe(false);
+ });
+
+ test("throws AuthorizationError when token not found", async () => {
+ server.use(db.get("AuthorizationToken", () => json(null)));
+
+ await expect(getTokenInfo("unknown", createContext())).rejects.toThrow(
+ "Authorization token not found"
+ );
+ });
+});
+
+describe("findMany (msw)", () => {
+ test("returns tokens with permissions applied, ordered by createdAt", async () => {
+ server.use(
+ projectOwnershipHandler,
+ db.get("AuthorizationToken", ({ request }) => {
+ const url = new URL(request.url);
+ expect(url.searchParams.get("projectId")).toBe("eq.proj-1");
+ return json([
+ { ...tokenRow, relation: "administrators", canPublish: false },
+ ]);
+ })
+ );
+
+ const result = await findMany({ projectId: "proj-1" }, createContext());
+ expect(result).toHaveLength(1);
+ // administrators rule: canPublish=true
+ expect(result[0].canPublish).toBe(true);
+ });
+});
+
+describe("create (msw)", () => {
+ test("inserts a new token and returns the rows", async () => {
+ const newRow = {
+ ...tokenRow,
+ relation: "viewers" as const,
+ token: "tok-new",
+ };
+ server.use(
+ projectOwnershipHandler,
+ db.post("AuthorizationToken", () => json([newRow], { status: 201 }))
+ );
+
+ const result = await create(
+ { projectId: "proj-1", relation: "viewers", name: "Viewer Token" },
+ createContext()
+ );
+ expect(result[0].token).toBe("tok-new");
+ });
+});
+
+describe("update (msw)", () => {
+ test("updates token relation and returns updated row", async () => {
+ const updatedRow = { ...tokenRow, relation: "editors" as const };
+ server.use(
+ projectOwnershipHandler,
+ // previous token fetch
+ db.get("AuthorizationToken", () => json(tokenRow)),
+ // update
+ db.patch("AuthorizationToken", () => json(updatedRow))
+ );
+
+ const result = await update(
+ "proj-1",
+ { token: "tok-abc", relation: "editors" },
+ createContext()
+ );
+ expect(result.relation).toBe("editors");
+ });
+});
+
+describe("remove (msw)", () => {
+ test("deletes token and returns deleted row", async () => {
+ server.use(
+ projectOwnershipHandler,
+ db.delete("AuthorizationToken", () => json(tokenRow))
+ );
+
+ const result = await remove(
+ { projectId: "proj-1", token: "tok-abc" },
+ createContext()
+ );
+ expect(result.token).toBe("tok-abc");
+ });
+});
diff --git a/packages/authorization-token/src/db/authorization-token.ts b/packages/authorization-token/src/db/authorization-token.ts
index cd560c7b58..e857a85bd7 100644
--- a/packages/authorization-token/src/db/authorization-token.ts
+++ b/packages/authorization-token/src/db/authorization-token.ts
@@ -242,3 +242,5 @@ export const remove = async (
return dbToken.data;
};
+
+export const __testing__ = { applyTokenPermissions };
diff --git a/packages/dashboard/package.json b/packages/dashboard/package.json
index 9da7e5d6cb..af2cd9276d 100644
--- a/packages/dashboard/package.json
+++ b/packages/dashboard/package.json
@@ -6,7 +6,8 @@
"homepage": "https://webstudio.is",
"type": "module",
"scripts": {
- "typecheck": "tsgo --noEmit"
+ "typecheck": "tsgo --noEmit",
+ "test": "vitest run"
},
"dependencies": {
"@webstudio-is/feature-flags": "workspace:*",
@@ -16,7 +17,10 @@
"zod": "^3.24.2"
},
"devDependencies": {
- "@webstudio-is/tsconfig": "workspace:*"
+ "@webstudio-is/postgrest": "workspace:*",
+ "@webstudio-is/tsconfig": "workspace:*",
+ "msw": "^2.13.2",
+ "vitest": "^3.1.2"
},
"exports": {
".": {
diff --git a/packages/dashboard/src/db/projects.test.ts b/packages/dashboard/src/db/projects.test.ts
new file mode 100644
index 0000000000..0f77ed8c2e
--- /dev/null
+++ b/packages/dashboard/src/db/projects.test.ts
@@ -0,0 +1,114 @@
+import { describe, test, expect } from "vitest";
+import {
+ createTestServer,
+ db,
+ json,
+ empty,
+ testContext,
+} from "@webstudio-is/postgrest/testing";
+import type { AppContext } from "@webstudio-is/trpc-interface/index.server";
+import { AuthorizationError } from "@webstudio-is/trpc-interface/index.server";
+import { findMany, countByUserId } from "./projects";
+
+const server = createTestServer();
+
+const createContext = (userId = "user-1"): AppContext =>
+ ({
+ ...testContext,
+ authorization: { type: "user", userId },
+ }) as unknown as AppContext;
+
+const projectRow = {
+ id: "proj-1",
+ title: "My Project",
+ domain: "my-project",
+ userId: "user-1",
+ workspaceId: null,
+ isDeleted: false,
+ createdAt: "2024-01-01T00:00:00.000Z",
+ previewImageAsset: null,
+ latestBuildVirtual: null,
+};
+
+// ---------------------------------------------------------------------------
+// countByUserId
+// ---------------------------------------------------------------------------
+
+describe("countByUserId (msw)", () => {
+ test("returns project count from Content-Range header", async () => {
+ server.use(
+ db.head("Project", ({ request }) => {
+ const url = new URL(request.url);
+ expect(url.searchParams.get("userId")).toBe("eq.user-1");
+ expect(url.searchParams.get("isDeleted")).toBe("eq.false");
+ return empty({
+ headers: { "Content-Range": "*/7" },
+ });
+ })
+ );
+
+ const count = await countByUserId({
+ userId: "user-1",
+ context: createContext(),
+ });
+ expect(count).toBe(7);
+ });
+
+ test("throws AuthorizationError when userId does not match caller", async () => {
+ await expect(
+ countByUserId({ userId: "other-user", context: createContext("user-1") })
+ ).rejects.toThrow(AuthorizationError);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// findMany
+// ---------------------------------------------------------------------------
+
+describe("findMany (msw)", () => {
+ test("returns projects with empty domainsVirtual when no domains exist", async () => {
+ server.use(
+ db.get("DashboardProject", ({ request }) => {
+ const url = new URL(request.url);
+ expect(url.searchParams.get("userId")).toBe("eq.user-1");
+ expect(url.searchParams.get("isDeleted")).toBe("eq.false");
+ return json([projectRow]);
+ }),
+ db.get("ProjectDomain", () => json([]))
+ );
+
+ const result = await findMany({
+ userId: "user-1",
+ context: createContext(),
+ });
+ expect(result).toHaveLength(1);
+ expect(result[0].id).toBe("proj-1");
+ expect(result[0].domainsVirtual).toEqual([]);
+ });
+
+ test("throws AuthorizationError when userId does not match caller", async () => {
+ await expect(
+ findMany({ userId: "other-user", context: createContext("user-1") })
+ ).rejects.toThrow(AuthorizationError);
+ });
+
+ test("filters by workspaceId when provided and caller is owner", async () => {
+ server.use(
+ db.get("Workspace", () => json({ id: "ws-1", userId: "user-1" })),
+ db.get("DashboardProject", ({ request }) => {
+ const url = new URL(request.url);
+ expect(url.searchParams.get("workspaceId")).toBe("eq.ws-1");
+ return json([{ ...projectRow, workspaceId: "ws-1" }]);
+ }),
+ db.get("ProjectDomain", () => json([]))
+ );
+
+ const result = await findMany({
+ userId: "user-1",
+ context: createContext(),
+ workspaceId: "ws-1",
+ });
+ expect(result).toHaveLength(1);
+ expect(result[0].workspaceId).toBe("ws-1");
+ });
+});
diff --git a/packages/domain/package.json b/packages/domain/package.json
index 3ef76f7c69..d3f0b95584 100644
--- a/packages/domain/package.json
+++ b/packages/domain/package.json
@@ -6,7 +6,8 @@
"homepage": "https://webstudio.is",
"type": "module",
"scripts": {
- "typecheck": "tsgo --noEmit"
+ "typecheck": "tsgo --noEmit",
+ "test": "vitest run"
},
"dependencies": {
"@webstudio-is/postgrest": "workspace:*",
@@ -19,7 +20,9 @@
"zod": "^3.24.2"
},
"devDependencies": {
- "@webstudio-is/tsconfig": "workspace:*"
+ "@webstudio-is/tsconfig": "workspace:*",
+ "msw": "^2.13.2",
+ "vitest": "^3.1.2"
},
"exports": {
".": {
diff --git a/packages/domain/src/db/domain.test.ts b/packages/domain/src/db/domain.test.ts
new file mode 100644
index 0000000000..8b13b8ad8e
--- /dev/null
+++ b/packages/domain/src/db/domain.test.ts
@@ -0,0 +1,126 @@
+import { describe, test, expect } from "vitest";
+import {
+ createTestServer,
+ db,
+ json,
+ empty,
+ testContext,
+} from "@webstudio-is/postgrest/testing";
+import type { AppContext } from "@webstudio-is/trpc-interface/index.server";
+import { countTotalDomains, create } from "./domain";
+
+const server = createTestServer();
+
+const createContext = (): AppContext =>
+ ({
+ ...testContext,
+ authorization: { type: "user", userId: "owner-1" },
+ getOwnerPlanFeatures: () => Promise.resolve({}),
+ domain: {},
+ deployment: {},
+ entri: {},
+ }) as unknown as AppContext;
+
+/**
+ * hasProjectPermit checks ownership via:
+ * GET /Project?id=eq.{id}&userId=eq.{userId}
+ * Returning a row grants access.
+ *
+ * loadById (called inside domain.create) queries:
+ * GET /Project?id=eq.{id}&isDeleted=eq.false&select=*,...
+ * We dispatch on whether the userId param is present.
+ */
+const projectHandler = db.get("Project", ({ request }) => {
+ const url = new URL(request.url);
+ if (url.searchParams.has("userId")) {
+ // ownership check — confirm user-1 owns proj-1
+ return json({ id: "proj-1" });
+ }
+ // loadById full select
+ return json({
+ id: "proj-1",
+ userId: "owner-1",
+ title: "Test",
+ domain: "test",
+ isDeleted: false,
+ previewImageAsset: null,
+ latestBuildVirtual: null,
+ domainsVirtual: [],
+ latestStaticBuild: [],
+ });
+});
+
+// ---------------------------------------------------------------------------
+// countTotalDomains
+// Verifies the JOIN-based HEAD query hits the right table and filter.
+// ---------------------------------------------------------------------------
+
+describe("countTotalDomains (msw)", () => {
+ test("returns count from Content-Range header", async () => {
+ server.use(
+ db.head("Domain", ({ request }) => {
+ const url = new URL(request.url);
+ expect(url.searchParams.get("Project.userId")).toBe("eq.owner-1");
+ expect(url.searchParams.get("Project.isDeleted")).toBe("eq.false");
+ return empty({ headers: { "Content-Range": "*/3" } });
+ })
+ );
+
+ const count = await countTotalDomains("owner-1", createContext());
+ expect(count).toBe(3);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// create — domain limit guard
+// Verifies that reaching maxDomainsAllowedPerUser returns an error without
+// touching the Domain or ProjectDomain tables.
+// ---------------------------------------------------------------------------
+
+describe("create — domain limit guard (msw)", () => {
+ test("returns error when owner is at the domain limit", async () => {
+ server.use(
+ projectHandler,
+ db.head("Domain", () => empty({ headers: { "Content-Range": "*/5" } }))
+ );
+
+ const result = await create(
+ {
+ projectId: "proj-1",
+ domain: "example.com",
+ maxDomainsAllowedPerUser: 5,
+ },
+ createContext()
+ );
+
+ expect(result).toEqual({
+ success: false,
+ error: expect.stringContaining("maximum number of allowed domains"),
+ });
+ });
+
+ test("creates domain entries when under the limit", async () => {
+ server.use(
+ projectHandler,
+ // countTotalDomains — owner has 0
+ db.head("Domain", () => empty({ headers: { "Content-Range": "*/0" } })),
+ // upsert into Domain (ignoreDuplicates)
+ db.post("Domain", () => empty({ status: 204 })),
+ // fetch domain id after upsert
+ db.get("Domain", () => json({ id: "domain-id-1" })),
+ // insert into ProjectDomain
+ db.post("ProjectDomain", () => empty({ status: 201 }))
+ );
+
+ const result = await create(
+ {
+ projectId: "proj-1",
+ domain: "example.com",
+ maxDomainsAllowedPerUser: 5,
+ },
+ createContext()
+ );
+
+ expect(result).toEqual({ success: true });
+ });
+});
diff --git a/packages/domain/src/db/validate.test.ts b/packages/domain/src/db/validate.test.ts
new file mode 100644
index 0000000000..4798780ae1
--- /dev/null
+++ b/packages/domain/src/db/validate.test.ts
@@ -0,0 +1,42 @@
+import { describe, test, expect } from "vitest";
+import { validateDomain } from "./validate";
+
+describe("validateDomain", () => {
+ test("accepts a valid two-level domain", () => {
+ expect(validateDomain("example.com")).toEqual({
+ success: true,
+ domain: "example.com",
+ });
+ });
+
+ test("accepts a valid three-level domain", () => {
+ expect(validateDomain("sub.example.com")).toEqual({
+ success: true,
+ domain: "sub.example.com",
+ });
+ });
+
+ test("accepts a valid four-level domain", () => {
+ expect(validateDomain("a.b.example.com")).toEqual({
+ success: true,
+ domain: "a.b.example.com",
+ });
+ });
+
+ test("rejects a single-level domain (no dot)", () => {
+ const result = validateDomain("localhost");
+ expect(result.success).toBe(false);
+ expect((result as { error: string }).error).toMatch("at least two levels");
+ });
+
+ test("rejects a five-level domain", () => {
+ const result = validateDomain("a.b.c.example.com");
+ expect(result.success).toBe(false);
+ expect((result as { error: string }).error).toMatch("at most four levels");
+ });
+
+ test("rejects obviously invalid input", () => {
+ const result = validateDomain("not a domain!!!");
+ expect(result.success).toBe(false);
+ });
+});
diff --git a/packages/postgrest/package.json b/packages/postgrest/package.json
index bed139cbab..56c4663b44 100644
--- a/packages/postgrest/package.json
+++ b/packages/postgrest/package.json
@@ -11,6 +11,10 @@
"./index.server": {
"webstudio": "./src/index.server.ts",
"import": "./src/index.server.ts"
+ },
+ "./testing": {
+ "webstudio": "./src/testing.ts",
+ "import": "./src/testing.ts"
}
},
"sideEffects": false,
@@ -24,6 +28,8 @@
"@supabase/postgrest-js": "^1.19.3"
},
"devDependencies": {
- "@webstudio-is/tsconfig": "workspace:*"
+ "@webstudio-is/tsconfig": "workspace:*",
+ "msw": "^2.13.2",
+ "vitest": "^3.1.2"
}
}
diff --git a/packages/postgrest/src/testing.ts b/packages/postgrest/src/testing.ts
new file mode 100644
index 0000000000..f88dd3ef16
--- /dev/null
+++ b/packages/postgrest/src/testing.ts
@@ -0,0 +1,72 @@
+import { beforeAll, afterEach, afterAll } from "vitest";
+import { setupServer } from "msw/node";
+import {
+ http,
+ HttpResponse,
+ type HttpResponseResolver,
+ type PathParams,
+ type DefaultBodyType,
+} from "msw";
+import { createClient } from "./index.server";
+
+/** Shorthand for `HttpResponse.json(body, init)` */
+export const json: typeof HttpResponse.json = (body, init) =>
+ HttpResponse.json(body, init);
+
+/** Shorthand for `new HttpResponse(null, init)` — use for HEAD/empty responses */
+export const empty = (init?: ConstructorParameters<typeof HttpResponse>[1]) =>
+ new HttpResponse(null, init);
+
+const POSTGREST_URL = "http://test-postgrest";
+
+/**
+ * Spreadable partial context with `postgrest` pre-filled.
+ * @example
+ * const createContext = (): AppContext =>
+ * ({ ...testContext, authorization: { type: "user", userId: "user-1" } }) as unknown as AppContext;
+ */
+export const testContext = {
+ postgrest: { client: createClient(POSTGREST_URL, "test-key") },
+};
+
+type Resolver = HttpResponseResolver<PathParams, DefaultBodyType, undefined>;
+
+/**
+ * Shorthand handlers for PostgREST table endpoints.
+ * Eliminates the need to reference POSTGREST_URL in test files.
+ *
+ * @example
+ * server.use(
+ * db.get("Project", () => HttpResponse.json(row)),
+ * db.head("Project", () => new HttpResponse(null, { headers: { "Content-Range": "* /3" } })),
+ * db.post("Project", () => HttpResponse.json(row, { status: 201 })),
+ * );
+ */
+export const db = {
+ get: (table: string, resolver: Resolver) =>
+ http.get(`${POSTGREST_URL}/${table}`, resolver),
+ head: (table: string, resolver: Resolver) =>
+ http.head(`${POSTGREST_URL}/${table}`, resolver),
+ post: (table: string, resolver: Resolver) =>
+ http.post(`${POSTGREST_URL}/${table}`, resolver),
+ patch: (table: string, resolver: Resolver) =>
+ http.patch(`${POSTGREST_URL}/${table}`, resolver),
+ delete: (table: string, resolver: Resolver) =>
+ http.delete(`${POSTGREST_URL}/${table}`, resolver),
+};
+
+/**
+ * Creates an MSW server and registers the standard vitest lifecycle hooks.
+ * Call this at the top level of a test file (outside any describe block).
+ *
+ * @example
+ * const server = createTestServer();
+ * server.use(db.get("Project", () => HttpResponse.json(row)));
+ */
+export const createTestServer = () => {
+ const server = setupServer();
+ beforeAll(() => server.listen({ onUnhandledRequest: "error" }));
+ afterEach(() => server.resetHandlers());
+ afterAll(() => server.close());
+ return server;
+};
diff --git a/packages/project/package.json b/packages/project/package.json
index ee5d9c49f0..6654405fc2 100644
--- a/packages/project/package.json
+++ b/packages/project/package.json
@@ -24,6 +24,7 @@
},
"devDependencies": {
"@webstudio-is/tsconfig": "workspace:*",
+ "msw": "^2.13.2",
"vitest": "^3.1.2"
},
"exports": {
diff --git a/packages/project/src/db/notification.test.ts b/packages/project/src/db/notification.test.ts
index 92e65ad2a7..bde759cf47 100644
--- a/packages/project/src/db/notification.test.ts
+++ b/packages/project/src/db/notification.test.ts
@@ -1,5 +1,14 @@
import { describe, test, expect } from "vitest";
-import { __testing__ } from "./notification";
+import {
+ createTestServer,
+ db,
+ json,
+ empty,
+ testContext,
+} from "@webstudio-is/postgrest/testing";
+import type { AppContext } from "@webstudio-is/trpc-interface/index.server";
+import { defaultPlanFeatures } from "@webstudio-is/trpc-interface/plan-features";
+import { accept, __testing__ } from "./notification";
const { describeNotification } = __testing__;
@@ -86,3 +95,96 @@ describe("describeNotification", () => {
).toBe("You have a new notification");
});
});
+
+// ---------------------------------------------------------------------------
+// accept() — domain guard (MSW integration)
+// Verifies the correct table and filter are used in the ProjectDomain query.
+// ---------------------------------------------------------------------------
+
+const server = createTestServer();
+
+const makeAcceptCtx = (
+ planOverrides: Partial<typeof defaultPlanFeatures> = {}
+): AppContext =>
+ ({
+ authorization: { type: "user", userId: "recipient-1" },
+ planFeatures: defaultPlanFeatures,
+ purchases: [],
+ trpcCache: new Map(),
+ domain: {},
+ deployment: {},
+ entri: {},
+ ...testContext,
+ createTokenContext: () => {},
+ getOwnerPlanFeatures: async () => ({
+ ...defaultPlanFeatures,
+ ...planOverrides,
+ }),
+ }) as unknown as AppContext;
+
+const notificationRow = {
+ id: "notif-1",
+ type: "projectTransfer",
+ status: "pending",
+ senderId: "sender-1",
+ recipientId: "recipient-1",
+ createdAt: new Date(Date.now() - 1000).toISOString(),
+ respondedAt: null,
+ payload: { projectId: "proj-1" },
+};
+
+/** Handlers shared by all accept() tests: notification load + claim */
+const baseHandlers = [
+ db.get("Notification", () => json(notificationRow)),
+ db.patch("Notification", () => json({ id: "notif-1" })),
+ // existence check — project exists, sender owns it
+ db.get("Project", () => json({ id: "proj-1", userId: "sender-1" })),
+ // receiver's project count — 0 projects owned
+ db.head("Project", () => empty({ headers: { "Content-Range": "*/0" } })),
+];
+
+describe("accept — domain guard (msw)", () => {
+ test("throws when free receiver tries to accept a project with a custom domain", async () => {
+ server.use(
+ ...baseHandlers,
+ // ProjectDomain count — 1 domain attached
+ db.head("ProjectDomain", ({ request }) => {
+ const url = new URL(request.url);
+ expect(url.searchParams.get("projectId")).toBe("eq.proj-1");
+ return empty({ headers: { "Content-Range": "*/1" } });
+ })
+ );
+
+ const ctx = makeAcceptCtx({
+ maxDomainsAllowedPerUser: 0,
+ maxProjectsAllowedPerUser: 100,
+ });
+
+ await expect(accept({ notificationId: "notif-1" }, ctx)).rejects.toThrow(
+ "custom domains attached"
+ );
+ });
+
+ test("succeeds when free receiver accepts a project with no custom domains", async () => {
+ server.use(
+ ...baseHandlers,
+ // ProjectDomain count — 0 domains
+ db.head("ProjectDomain", () =>
+ empty({ headers: { "Content-Range": "*/0" } })
+ ),
+ // default workspace lookup
+ db.get("Workspace", () => json({ id: "ws-1" })),
+ // project reassign
+ db.patch("Project", () => json({ id: "proj-1" }))
+ );
+
+ const ctx = makeAcceptCtx({
+ maxDomainsAllowedPerUser: 0,
+ maxProjectsAllowedPerUser: 100,
+ });
+
+ await expect(
+ accept({ notificationId: "notif-1" }, ctx)
+ ).resolves.toBeUndefined();
+ });
+});
diff --git a/packages/project/src/db/notification.ts b/packages/project/src/db/notification.ts
index 29800ac15e..edc59b4ea1 100644
--- a/packages/project/src/db/notification.ts
+++ b/packages/project/src/db/notification.ts
@@ -607,6 +607,28 @@ const performAcceptSideEffect = async ({
);
}
+ // Block transfer if the project has custom domains and the receiver's plan
+ // does not include domain support.
+ if (receiverPlan.maxDomainsAllowedPerUser === 0) {
+ const domainCount = await context.postgrest.client
+ .from("ProjectDomain")
+ .select("domainId", { count: "exact", head: true })
+ .eq("projectId", parsed.projectId);
+
+ if (domainCount.error) {
+ throw domainCount.error;
+ }
+
+ if (
+ receiverPlan.maxDomainsAllowedPerUser === 0 &&
+ (domainCount.count ?? 0) > 0
+ ) {
+ throw new Error(
+ "This project has custom domains attached. Upgrade your plan to accept projects with custom domains."
+ );
+ }
+ }
+
// Determine the target workspace: use the one from the notification payload,
// or fall back to the one provided by the receiver at accept time.
const resolvedWorkspaceId = parsed.targetWorkspaceId ?? targetWorkspaceId;
diff --git a/packages/project/src/db/project.test.ts b/packages/project/src/db/project.test.ts
new file mode 100644
index 0000000000..c4e4cadb58
--- /dev/null
+++ b/packages/project/src/db/project.test.ts
@@ -0,0 +1,74 @@
+import { describe, test, expect } from "vitest";
+import {
+ createTestServer,
+ db,
+ json,
+ empty,
+ testContext,
+} from "@webstudio-is/postgrest/testing";
+import type { AppContext } from "@webstudio-is/trpc-interface/index.server";
+import { defaultPlanFeatures } from "@webstudio-is/trpc-interface/plan-features";
+import { create } from "./project";
+
+const server = createTestServer();
+
+const createContext = (
+ planOverrides: Partial<typeof defaultPlanFeatures> = {}
+): AppContext =>
+ ({
+ authorization: { type: "user", userId: "owner-1" },
+ planFeatures: defaultPlanFeatures,
+ purchases: [],
+ trpcCache: new Map(),
+ domain: {},
+ deployment: {},
+ entri: {},
+ ...testContext,
+ createTokenContext: () => {},
+ getOwnerPlanFeatures: async () => ({
+ ...defaultPlanFeatures,
+ ...planOverrides,
+ }),
+ }) as unknown as AppContext;
+
+describe("create — maxProjectsAllowedPerUser guard", () => {
+ test("throws when owner is at the project limit", async () => {
+ server.use(
+ // Project count HEAD — owner already has 100 projects
+ db.head("Project", () => empty({ headers: { "Content-Range": "*/100" } }))
+ );
+
+ const ctx = createContext({ maxProjectsAllowedPerUser: 100 });
+
+ await expect(create({ title: "New Project" }, ctx)).rejects.toThrow(
+ "You've reached the project limit"
+ );
+ });
+
+ test("proceeds when owner is under the project limit", async () => {
+ const projectRow = {
+ id: "proj-new",
+ title: "New Project",
+ userId: "owner-1",
+ workspaceId: null,
+ domain: "new-project",
+ isDeleted: false,
+ };
+
+ server.use(
+ // Project count HEAD — owner has 99 projects, limit is 100
+ db.head("Project", () => empty({ headers: { "Content-Range": "*/99" } })),
+ // Project insert
+ db.post("Project", () => json([projectRow], { status: 201 })),
+ // Project update (assign userId)
+ db.patch("Project", () => json(projectRow)),
+ // createBuild inserts into Build table
+ db.post("Build", () => empty({ status: 201 }))
+ );
+
+ const ctx = createContext({ maxProjectsAllowedPerUser: 100 });
+
+ const result = await create({ title: "New Project" }, ctx);
+ expect(result).toMatchObject({ id: "proj-new", title: "New Project" });
+ });
+});
diff --git a/packages/project/src/db/project.ts b/packages/project/src/db/project.ts
index 87b9eafbbb..c84f3dcecb 100644
--- a/packages/project/src/db/project.ts
+++ b/packages/project/src/db/project.ts
@@ -149,6 +149,24 @@ export const create = async (
projectOwnerUserId = workspace.data.userId;
}
+ // Enforce the per-user project limit before creating anything
+ const ownerPlan = await context.getOwnerPlanFeatures(projectOwnerUserId);
+ const projectCountResult = await context.postgrest.client
+ .from("Project")
+ .select("id", { count: "exact", head: true })
+ .eq("userId", projectOwnerUserId)
+ .eq("isDeleted", false);
+
+ if (projectCountResult.error) {
+ throw projectCountResult.error;
+ }
+
+ if ((projectCountResult.count ?? 0) >= ownerPlan.maxProjectsAllowedPerUser) {
+ throw new Error(
+ "You've reached the project limit for your plan. Upgrade or delete a project to create a new one."
+ );
+ }
+
// create project without user first
// and set user only after build is successfully created
// this way to make project creation transactional
diff --git a/packages/trpc-interface/src/shared/plan-features.ts b/packages/trpc-interface/src/shared/plan-features.ts
index 3206280f23..38e0538064 100644
--- a/packages/trpc-interface/src/shared/plan-features.ts
+++ b/packages/trpc-interface/src/shared/plan-features.ts
@@ -43,7 +43,7 @@ export const defaultPlanFeatures: PlanFeatures = {
maxDomainsAllowedPerUser: 0,
maxDailyPublishesPerUser: 10,
maxWorkspaces: 1,
- maxProjectsAllowedPerUser: 2,
+ maxProjectsAllowedPerUser: 100,
maxAssetsPerProject: 50,
minSeats: 0,
maxSeatsPerWorkspace: 0,
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c4fe11921d..0719867396 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -472,7 +472,7 @@ importers:
vitest:
specifier: ^3.1.2
fixtures/react-router-cloudflare:
dependencies:
@@ -1031,12 +1031,18 @@ importers:
'@types/fontkit':
specifier: ^2.0.8
version: 2.0.8
+ '@webstudio-is/postgrest':
+ specifier: workspace:*
+ version: link:../postgrest
'@webstudio-is/tsconfig':
specifier: workspace:*
version: link:../tsconfig
+ msw:
+ specifier: ^2.13.2
+ version: 2.13.2(@types/[email protected])([email protected])
vitest:
specifier: ^3.1.2
zod:
specifier: ^3.24.2
version: 3.24.2
@@ -1056,9 +1062,15 @@ importers:
'@webstudio-is/tsconfig':
specifier: workspace:*
version: link:../tsconfig
+ msw:
+ specifier: ^2.13.2
+ version: 2.13.2(@types/[email protected])([email protected])
type-fest:
specifier: ^4.37.0
version: 4.37.0
+ vitest:
+ specifier: ^3.1.2
packages/cli:
dependencies:
@@ -1221,7 +1233,7 @@ importers:
vitest:
specifier: ^3.1.2
wrangler:
specifier: ^3.63.2
version: 3.63.2(@cloudflare/[email protected])
@@ -1258,7 +1270,7 @@ importers:
version: 2.23.0
vitest:
specifier: ^3.1.2
zod:
specifier: ^3.24.2
version: 3.24.2
@@ -1298,7 +1310,7 @@ importers:
version: 18.3.0-canary-14898b6a9-20240318([email protected])
vitest:
specifier: ^3.1.2
packages/dashboard:
dependencies:
@@ -1318,9 +1330,18 @@ importers:
specifier: ^3.24.2
version: 3.24.2
devDependencies:
+ '@webstudio-is/postgrest':
+ specifier: workspace:*
+ version: link:../postgrest
'@webstudio-is/tsconfig':
specifier: workspace:*
version: link:../tsconfig
+ msw:
+ specifier: ^2.13.2
+ version: 2.13.2(@types/[email protected])([email protected])
+ vitest:
+ specifier: ^3.1.2
packages/design-system:
dependencies:
@@ -1486,7 +1507,7 @@ importers:
version: 18.3.0-canary-14898b6a9-20240318([email protected])
vitest:
specifier: ^3.1.2
zod:
specifier: ^3.24.2
version: 3.24.2
@@ -1521,6 +1542,12 @@ importers:
'@webstudio-is/tsconfig':
specifier: workspace:*
version: link:../tsconfig
+ msw:
+ specifier: ^2.13.2
+ version: 2.13.2(@types/[email protected])([email protected])
+ vitest:
+ specifier: ^3.1.2
packages/feature-flags:
devDependencies:
@@ -1535,7 +1562,7 @@ importers:
version: link:../tsconfig
vitest:
specifier: ^3.1.2
zod:
specifier: ^3.24.2
version: 3.24.2
@@ -1603,7 +1630,7 @@ importers:
version: link:../tsconfig
vitest:
specifier: ^3.1.2
packages/icons:
devDependencies:
@@ -1664,7 +1691,7 @@ importers:
version: 18.3.0-canary-14898b6a9-20240318([email protected])
vitest:
specifier: ^3.1.2
packages/postgrest:
dependencies:
@@ -1675,6 +1702,12 @@ importers:
'@webstudio-is/tsconfig':
specifier: workspace:*
version: link:../tsconfig
+ msw:
+ specifier: ^2.13.2
+ version: 2.13.2(@types/[email protected])([email protected])
+ vitest:
+ specifier: ^3.1.2
packages/prisma-client:
dependencies:
@@ -1740,9 +1773,12 @@ importers:
'@webstudio-is/tsconfig':
specifier: workspace:*
version: link:../tsconfig
+ msw:
+ specifier: ^2.13.2
+ version: 2.13.2(@types/[email protected])([email protected])
vitest:
specifier: ^3.1.2
packages/project-build:
dependencies:
@@ -1773,7 +1809,7 @@ importers:
version: link:../tsconfig
vitest:
specifier: ^3.1.2
packages/react-sdk:
dependencies:
@@ -1828,7 +1864,7 @@ importers:
version: 4.37.0
vitest:
specifier: ^3.1.2
zod:
specifier: ^3.24.2
version: 3.24.2
@@ -1883,7 +1919,7 @@ importers:
version: 4.0.0
vitest:
specifier: ^3.1.2
packages/sdk-cli:
dependencies:
@@ -1939,7 +1975,7 @@ importers:
version: 18.2.25
'@vitest/browser':
specifier: ^3.0.8
'@webstudio-is/css-data':
specifier: workspace:*
version: link:../css-data
@@ -1978,7 +2014,7 @@ importers:
version: 4.37.0
vitest:
specifier: ^3.1.2
zod:
specifier: ^3.24.2
version: 3.24.2
@@ -2051,7 +2087,7 @@ importers:
version: 18.3.0-canary-14898b6a9-20240318([email protected])
vitest:
specifier: ^3.1.2
packages/sdk-components-react-radix:
dependencies:
@@ -2223,7 +2259,7 @@ importers:
version: link:../tsconfig
vitest:
specifier: ^3.1.2
packages/trpc-interface:
dependencies:
@@ -2254,7 +2290,7 @@ importers:
version: link:../tsconfig
vitest:
specifier: ^3.1.2
packages/tsconfig: {}
@@ -2526,15 +2562,6 @@ packages:
'@brillout/[email protected]':
resolution: {integrity: sha512-gqvJVRFU85IexXj/4I580VgQt+cZLGd7jwUqA+3OXEyJTvj2nUcW34cpKB1wJEiNItwL1g9lscamuxZ8JrYn+g==}
- '@bundled-es-modules/[email protected]':
- resolution: {integrity: sha512-8o+5fRPLNbjbdGRRmJj3h6Hh1AQJf2dk3qQ/5ZFb+PXkRNiSoMGGUKlsgLfrxneb72axVJyIYji64E2+nNfYyw==}
-
- '@bundled-es-modules/[email protected]':
- resolution: {integrity: sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==}
-
- '@bundled-es-modules/[email protected]':
- resolution: {integrity: sha512-dvMHbL464C0zI+Yqxbz6kZ5TOEp7GLW+pry/RWndAR8MJQAXZ2rPmIs8tziTZjeIyhSNZgZbCePtfSbdWqStJw==}
-
resolution: {integrity: sha512-Pxhij4UXg8KSr7rPek6Zowm+5M22rbd2g1nfojHJkxp5YkFqiZ2+YLEM/XGVIzvGOcM0nqjIFxrpDwWRZYWYjA==}
@@ -3879,8 +3906,8 @@ packages:
'@mjackson/[email protected]':
resolution: {integrity: sha512-EMlH1e30yzmTpGLQjlFmaDAjyOeZhng1/XCd7DExR8PNAnG/G1tyruZxEoUe11ClnwGhGrtsdnyyUx1frSzjng==}
- '@mswjs/[email protected]':
- resolution: {integrity: sha512-wK+5pLK5XFmgtH3aQ2YVvA3HohS3xqV/OxuVOdNx9Wpnz7VE/fnC+e1A7ln6LFYeck7gOJ/dsZV6OLplOtAJ2w==}
+ '@mswjs/[email protected]':
+ resolution: {integrity: sha512-cXu86tF4VQVfwz8W1SPbhoRyHJkti6mjH/XJIxp40jhO4j2k1m4KYrEykxqWPkFF3vrK4rgQppBh//AwyGSXPA==}
engines: {node: '>=18'}
'@nanostores/[email protected]':
@@ -5522,11 +5549,8 @@ packages:
resolution: {integrity: sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==}
- '@types/[email protected]':
- resolution: {integrity: sha512-jmIUGWrAiwu3dZpxntxieC+1n/5c3mjrImkmOSQ2NC5uP6cYO4aAZDdSmRcI5C1oiTmqlZGHC+/NmJrKogbP5A==}
-
- '@types/[email protected]':
- resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-xMAgYwceFhRA2zY+XbEA7mxYbA093wdiW8Vu6gZPGWy9cmOyU9XesH1tNcEWsKFd5Vzrqx5T3D38PWx1FIIXkA==}
resolution: {integrity: sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==}
@@ -6146,6 +6170,10 @@ packages:
resolution: {integrity: sha512-Xd8lFX4LM9QEEwxQpF9J9NTUh8pmdJO0cyRJhFiDoLTk2eH8FXlRv2IFGYVadZpqI3j8fhNrSdKCeYPxiAhLXw==}
engines: {node: '>=18'}
+ resolution: {integrity: sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
@@ -6777,8 +6805,8 @@ packages:
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==}
- resolution: {integrity: sha512-AjqGKbDGUFRKIRCP9tCKiIGHyriz2oHEbPIbEtcSLSs4YjReZOIPQQWek4+6hjw62H9QShXHyaGivGiYVLeYFQ==}
+ resolution: {integrity: sha512-5bJ+nf/UCpAjHM8i06fl7eLyVC9iuNAjm9qzkiu2ZGhM0VscSvS6WDPfAwkdkBuoXGM9FJSbKl6wylMwP9Ktig==}
engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0}
@@ -7632,8 +7660,8 @@ packages:
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
- resolution: {integrity: sha512-+mycXv8l2fEAjFZ5sjrtjJDmm2ceKGjrNbBr1durRg6VkU9fNUE/gsmQ51hWbHqs+l35W1iM+ZsmOD9Fd6lspw==}
+ resolution: {integrity: sha512-go2H1TIERKkC48pXiwec5l6sbNqYuvqOk3/vHGo1Zd+pq/H63oFawDQerH+WQdUw/flJFHDG7F+QdWMwhntA/A==}
engines: {node: '>=18'}
hasBin: true
peerDependencies:
@@ -8379,6 +8407,9 @@ packages:
resolution: {integrity: sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==}
engines: {node: '>= 4'}
+ resolution: {integrity: sha512-uyDrIlUEH37cinabq0AX4QbgV4HbFZ/gqoiunWQ1UqBtRvTTytwhNYjE++pO/MjPTZL5KQCf2bEoJ/BJNVQ5Kw==}
+
resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==}
engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
@@ -8564,6 +8595,10 @@ packages:
resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==}
engines: {node: '>= 0.8'}
+ resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==}
+ engines: {node: '>= 0.8'}
+
resolution: {integrity: sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw==}
@@ -8672,6 +8707,10 @@ packages:
resolution: {integrity: sha512-ulAk51I9UVUyJgxlv9M6lFot2WP3e7t8Kz9+IS6D4rVba1tR9kON+Ey69f+1R4Q8cd45Lod6a4IcJIxnzGc/zA==}
engines: {node: '>=18'}
+ resolution: {integrity: sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng==}
+ engines: {node: '>=20'}
+
resolution: {integrity: sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==}
@@ -8722,6 +8761,13 @@ packages:
resolution: {integrity: sha512-I/nkcBo73mO42Idfv08jhInV61IMb61OdIFxk+B4Gu1oBjWBPOLmhZdsli+oJCVaD+86pYQA93cJfFt224ZFAA==}
+ resolution: {integrity: sha512-7W5Efjhsc3chVdFhqtaU0KtK32J37Zcr9RKtID54nG+tIpcY79CQK/veYPODxtD/LJ4Lue66jvrQzIX2Z2/pUQ==}
+
+ resolution: {integrity: sha512-+Zg3vWhRUv8B1maGSTFdev9mjoo8Etn2Ayfs4cnjlD3CsGkxXX4QyW3j2WJ0wdjYcYmy7Lx2RDsZMhgCWafKIw==}
+ hasBin: true
+
resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==}
engines: {node: '>=4'}
@@ -8750,6 +8796,10 @@ packages:
resolution: {integrity: sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==}
engines: {node: '>=6'}
+ resolution: {integrity: sha512-LktZQb3IeoUWB9lqR5EWTHgW/VTITCXg4D21M+lvybRVdylLrRMnqaIONLVb5mav8vM19m44HIcGq4qASeu2Qw==}
+ engines: {node: '>=16'}
+
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
@@ -8813,6 +8863,10 @@ packages:
resolution: {integrity: sha512-S/5/0kFftkq27FPNye0XM1e2NsnoD/3FS+pBmbjmmtLT6I+i344KoOf7pvXreaFsDamWeaJX55nczA1m5PsBDg==}
engines: {node: '>=16'}
+ resolution: {integrity: sha512-PlBfpQwiUvGViBNX84Yxwjsdhd1TUlXr6zjX7eoirtCPIr08NAmxwa+fcYBTeRQxHo9YC9wwF3m9i700sHma8g==}
+ engines: {node: '>=20'}
+
resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==}
engines: {node: '>= 0.6'}
@@ -8973,6 +9027,9 @@ packages:
uploadthing:
optional: true
+ resolution: {integrity: sha512-IiSk4HlzAMqTUseHHe3VhIGyuFmN90zMTpD3Z3y8jeQbzLIq500MVM7Jq2vUAnTKAFPJrqwkzr6PoTcPhGcOiw==}
+
resolution: {integrity: sha512-4luGP9LMYszMRZwsvyUd9MrxgEGZdZuZgpVQHEEX0lCYFESasVRvZd0EYpCkOIbJKHMuv0LskpXc/8Un+MJzEQ==}
hasBin: true
@@ -9806,22 +9863,6 @@ snapshots:
'@brillout/import': 0.2.6
'@brillout/picocolors': 1.0.26
- '@bundled-es-modules/[email protected]':
- dependencies:
- cookie: 0.7.2
- optional: true
-
- '@bundled-es-modules/[email protected]':
- dependencies:
- statuses: 2.0.1
- optional: true
-
- '@bundled-es-modules/[email protected]':
- dependencies:
- '@types/tough-cookie': 4.0.5
- tough-cookie: 4.1.4
- optional: true
-
dependencies:
picocolors: 1.1.1
@@ -10575,7 +10616,6 @@ snapshots:
'@inquirer/type': 3.0.4(@types/[email protected])
optionalDependencies:
'@types/node': 22.13.10
- optional: true
dependencies:
@@ -10589,15 +10629,12 @@ snapshots:
yoctocolors-cjs: 2.1.2
optionalDependencies:
'@types/node': 22.13.10
- optional: true
- '@inquirer/[email protected]':
- optional: true
+ '@inquirer/[email protected]': {}
optionalDependencies:
'@types/node': 22.13.10
- optional: true
'@isaacs/[email protected]':
dependencies:
@@ -10890,7 +10927,7 @@ snapshots:
'@mjackson/[email protected]': {}
- '@mswjs/[email protected]':
+ '@mswjs/[email protected]':
dependencies:
'@open-draft/deferred-promise': 2.2.0
'@open-draft/logger': 0.3.0
@@ -10898,7 +10935,6 @@ snapshots:
is-node-process: 1.2.0
outvariant: 1.4.3
strict-event-emitter: 0.5.1
- optional: true
dependencies:
@@ -10965,17 +11001,14 @@ snapshots:
dependencies:
which: 3.0.1
- '@open-draft/[email protected]':
- optional: true
+ '@open-draft/[email protected]': {}
'@open-draft/[email protected]':
dependencies:
is-node-process: 1.2.0
outvariant: 1.4.3
- optional: true
- '@open-draft/[email protected]':
- optional: true
+ '@open-draft/[email protected]': {}
'@oslojs/[email protected]':
dependencies:
@@ -12672,11 +12705,7 @@ snapshots:
'@types/[email protected]': {}
- '@types/[email protected]':
- optional: true
-
- '@types/[email protected]':
- optional: true
+ '@types/[email protected]': {}
'@types/[email protected]': {}
@@ -12847,16 +12876,16 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
'@testing-library/dom': 10.4.0
'@testing-library/user-event': 14.6.1(@testing-library/[email protected])
'@vitest/utils': 3.1.2
magic-string: 0.30.17
sirv: 3.0.1
tinyrainbow: 2.0.0
ws: 8.18.1
optionalDependencies:
playwright: 1.50.1
@@ -12880,9 +12909,9 @@ snapshots:
std-env: 3.9.0
test-exclude: 7.0.1
tinyrainbow: 2.0.0
optionalDependencies:
transitivePeerDependencies:
- supports-color
@@ -12893,13 +12922,13 @@ snapshots:
chai: 5.2.0
tinyrainbow: 2.0.0
dependencies:
'@vitest/spy': 3.1.2
estree-walker: 3.0.3
magic-string: 0.30.17
optionalDependencies:
+ msw: 2.13.2(@types/[email protected])([email protected])
'@vitest/[email protected]':
@@ -12998,7 +13027,6 @@ snapshots:
dependencies:
type-fest: 0.21.3
- optional: true
@@ -13281,8 +13309,7 @@ snapshots:
- optional: true
dependencies:
@@ -13394,6 +13421,8 @@ snapshots:
+
@@ -14160,8 +14189,7 @@ snapshots:
- optional: true
dependencies:
@@ -14237,8 +14265,7 @@ snapshots:
'@preact/signals-core': 1.14.0
colorjs.io: 0.6.1
- optional: true
dependencies:
@@ -14425,8 +14452,7 @@ snapshots:
- optional: true
@@ -15350,36 +15376,34 @@ snapshots:
dependencies:
- '@bundled-es-modules/cookie': 2.0.1
- '@bundled-es-modules/statuses': 1.0.1
- '@bundled-es-modules/tough-cookie': 0.1.6
'@inquirer/confirm': 5.1.5(@types/[email protected])
- '@mswjs/interceptors': 0.37.6
+ '@mswjs/interceptors': 0.41.3
'@open-draft/deferred-promise': 2.2.0
- '@open-draft/until': 2.1.0
- '@types/cookie': 0.6.0
- '@types/statuses': 2.0.5
- graphql: 16.10.0
+ '@types/statuses': 2.0.6
+ cookie: 1.1.1
+ graphql: 16.13.2
headers-polyfill: 4.0.3
is-node-process: 1.2.0
outvariant: 1.4.3
path-to-regexp: 6.3.0
picocolors: 1.1.1
+ rettime: 0.10.1
+ statuses: 2.0.2
strict-event-emitter: 0.5.1
- type-fest: 4.37.0
+ tough-cookie: 6.0.1
+ type-fest: 5.5.0
+ until-async: 3.0.2
yargs: 17.7.2
optionalDependencies:
typescript: 5.8.2
transitivePeerDependencies:
- '@types/node'
- optional: true
- optional: true
dependencies:
@@ -15521,8 +15545,7 @@ snapshots:
- optional: true
optionalDependencies:
@@ -16102,6 +16125,8 @@ snapshots:
+
@@ -16330,6 +16355,8 @@ snapshots:
+
@@ -16350,8 +16377,7 @@ snapshots:
- optional: true
@@ -16436,6 +16462,8 @@ snapshots:
+
dependencies:
chownr: 1.1.4
@@ -16492,6 +16520,12 @@ snapshots:
+
+ dependencies:
+ tldts-core: 7.0.28
+
@@ -16516,6 +16550,10 @@ snapshots:
url-parse: 1.5.10
optional: true
+ dependencies:
+ tldts: 7.0.28
+
@@ -16561,13 +16599,16 @@ snapshots:
- optional: true
+ dependencies:
+ tagged-tag: 1.0.0
+
dependencies:
media-typer: 0.3.0
@@ -16702,6 +16743,8 @@ snapshots:
ofetch: 1.4.1
ufo: 1.5.4
+
dependencies:
citty: 0.1.6
@@ -16921,10 +16964,10 @@ snapshots:
jiti: 2.4.2
tsx: 4.19.3
dependencies:
'@vitest/expect': 3.1.2
'@vitest/pretty-format': 3.1.2
'@vitest/runner': 3.1.2
'@vitest/snapshot': 3.1.2
@@ -16947,7 +16990,7 @@ snapshots:
optionalDependencies:
'@types/debug': 4.1.12
'@types/node': 22.13.10
jsdom: 20.0.3
transitivePeerDependencies:
- jiti
@@ -17100,7 +17143,6 @@ snapshots:
ansi-styles: 4.3.0
string-width: 4.2.3
strip-ansi: 6.0.1
- optional: true
dependencies:
@@ -17165,8 +17207,7 @@ snapshots:
- optional: true
dependencies: