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.

feat: Import project via CLI (#5828)

Oleg Isonenb194d3e0b3eb
diff --git a/.github/actions/vercel/action.yaml b/.github/actions/vercel/action.yaml
index 7bab9a9a31..dcf47f5f0d 100644
--- a/.github/actions/vercel/action.yaml
+++ b/.github/actions/vercel/action.yaml
@@ -69,7 +69,7 @@ runs:
"framework": "remix",
"devCommand": "pnpm dev",
"installCommand": "pnpm install",
- "buildCommand": "pnpm --filter=@webstudio-is/http-client build && pnpm --filter=@webstudio-is/builder build",
+ "buildCommand": "pnpm --filter=@webstudio-is/builder build",
"outputDirectory": null,
"rootDirectory": "apps/builder",
"directoryListing": false,
diff --git a/apps/builder/app/services/build-router.server.ts b/apps/builder/app/services/build-router.server.ts
index c35a9c7bef..6b8b0074a9 100644
--- a/apps/builder/app/services/build-router.server.ts
+++ b/apps/builder/app/services/build-router.server.ts
@@ -17,15 +17,23 @@ import {
toPatchResult,
} from "~/shared/sync/patch/patch-service.server";
import { normalizePatchRequest } from "~/shared/sync/patch/patch-normalize.server";
-import * as projectApi from "@webstudio-is/project/index.server";
+import { loadById } from "@webstudio-is/project/index.server";
import type { BuildPatchTransaction } from "@webstudio-is/project/index.server";
import { loadDevBuildByProjectId } from "@webstudio-is/project-build/index.server";
import { serializePages } from "@webstudio-is/project-migrations/pages";
import { loadAssetsByProject } from "@webstudio-is/asset-uploader/index.server";
import {
- loadPublishedProjectDataByBuildId,
- loadPublishedProjectDataByProjectId,
+ checkProjectBuildPermissionInputSchema,
+ importProjectBundleInputSchema,
+} from "@webstudio-is/protocol";
+import {
+ loadPublishedProjectBundleByBuildId,
+ loadPublishedProjectBundleByProjectId,
} from "~/shared/db";
+import {
+ assertProjectBuildPermit,
+ importPublishedProjectBundle,
+} from "./project-bundle-import.server";
const patchEntryInput = z.object({
seq: z.number().optional(),
@@ -104,7 +112,7 @@ export const loadBuilderDataByProjectId = async (
projectId: string,
ctx: AppContext
) => {
- const project = await projectApi.loadById(projectId, ctx);
+ const project = await loadById(projectId, ctx);
if (project === null) {
throw new Error(`Project "${projectId}" not found`);
}
@@ -131,16 +139,34 @@ export const buildRouter = router({
return await loadBuilderDataByProjectId(input.projectId, ctx);
}),
- loadProjectDataByBuildId: procedure
+ loadProjectBundleByBuildId: procedure
.input(z.object({ buildId: z.string() }))
.query(async ({ ctx, input }) => {
- return await loadPublishedProjectDataByBuildId(input.buildId, ctx);
+ return await loadPublishedProjectBundleByBuildId(input.buildId, ctx);
}),
- loadProjectDataByProjectId: procedure
+ loadProjectBundleByProjectId: procedure
.input(z.object({ projectId: z.string() }))
.query(async ({ ctx, input }) => {
- return await loadPublishedProjectDataByProjectId(input.projectId, ctx);
+ return await loadPublishedProjectBundleByProjectId(input.projectId, ctx);
+ }),
+
+ checkProjectBuildPermission: procedure
+ .input(checkProjectBuildPermissionInputSchema)
+ .query(async ({ ctx, input }) => {
+ await assertProjectBuildPermit({ ctx, projectId: input.projectId });
+ }),
+
+ importProjectBundle: procedure
+ .input(importProjectBundleInputSchema)
+ .mutation(async ({ ctx, input }) => {
+ return await importPublishedProjectBundle({
+ ctx,
+ assetFiles: input.assetFiles,
+ data: input.data,
+ ignoreVersionCheck: input.ignoreVersionCheck,
+ projectId: input.projectId,
+ });
}),
createCollabToken: procedure
diff --git a/apps/builder/app/services/project-bundle-import.server.test.ts b/apps/builder/app/services/project-bundle-import.server.test.ts
new file mode 100644
index 0000000000..87947200f4
--- /dev/null
+++ b/apps/builder/app/services/project-bundle-import.server.test.ts
@@ -0,0 +1,605 @@
+import { Buffer } from "node:buffer";
+import { beforeEach, describe, expect, test, vi } from "vitest";
+import {
+ createImageAssetFixture,
+ createPageFixture,
+ createPublishedProjectBundleFixture,
+} from "@webstudio-is/protocol/fixtures";
+import { type PublishedProjectBundle } from "@webstudio-is/protocol";
+import {
+ __testing__,
+ importPublishedProjectBundle,
+} from "./project-bundle-import.server";
+
+const createData = (
+ overrides: Partial<PublishedProjectBundle> = {}
+): PublishedProjectBundle => {
+ const page = createPageFixture({ meta: { socialImageAssetId: "asset-1" } });
+ return createPublishedProjectBundleFixture({
+ assets: [
+ createImageAssetFixture({
+ id: "asset-1",
+ filename: "Image",
+ description: "Hero image",
+ }),
+ ],
+ build: {
+ version: 3,
+ breakpoints: [["base", { id: "base", label: "Base" }]],
+ styleSources: [["source-1", { id: "source-1", type: "local" }]],
+ styleSourceSelections: [
+ ["root", { instanceId: "root", values: ["source-1"] }],
+ ],
+ props: [
+ [
+ "prop-1",
+ {
+ id: "prop-1",
+ instanceId: "root",
+ name: "id",
+ type: "string",
+ value: "hero",
+ },
+ ],
+ ],
+ instances: [
+ [
+ "root",
+ {
+ type: "instance",
+ id: "root",
+ component: "Body",
+ children: [],
+ },
+ ],
+ ],
+ },
+ buildPages: {
+ meta: {},
+ pages: [page],
+ folders: [
+ {
+ id: "root-folder",
+ name: "Root",
+ slug: "",
+ children: ["home"],
+ },
+ ],
+ },
+ page,
+ ...overrides,
+ });
+};
+
+const createPostgrestClient = (
+ calls: string[],
+ options: { existingFileNames?: string[] } = {}
+) => ({
+ from: (table: string) => {
+ if (table === "File") {
+ return {
+ select: () => ({
+ in: async () => {
+ calls.push("files-select");
+ return {
+ data: (options.existingFileNames ?? []).map((name) => ({
+ name,
+ })),
+ error: undefined,
+ };
+ },
+ }),
+ update: () => ({
+ in: async () => {
+ calls.push("files-restore");
+ return { error: undefined };
+ },
+ }),
+ insert: async () => {
+ calls.push("files-insert");
+ return { error: undefined };
+ },
+ };
+ }
+
+ if (table === "Build") {
+ return {
+ update: () => ({
+ match: async () => {
+ calls.push("build-update");
+ return { count: 1, error: undefined };
+ },
+ }),
+ };
+ }
+
+ if (table === "Project") {
+ return {
+ update: (data: { previewImageAssetId: string | null }) => ({
+ eq: async () => {
+ calls.push(
+ data.previewImageAssetId === null
+ ? "project-preview-reset"
+ : "project-preview-update"
+ );
+ return { error: undefined };
+ },
+ }),
+ };
+ }
+
+ if (table === "Asset") {
+ return {
+ delete: () => ({
+ eq: async () => {
+ calls.push("assets-delete");
+ return { error: undefined };
+ },
+ }),
+ insert: async () => {
+ calls.push("assets-insert");
+ return { error: undefined };
+ },
+ };
+ }
+
+ throw new Error(`Unexpected table ${table}`);
+ },
+});
+
+describe("build import helpers", () => {
+ const createAssetClient = vi.fn();
+ const hasProjectPermit = vi.fn();
+ const loadDevBuildByProjectId = vi.fn();
+ const uploadImportedAssetFiles = vi.fn();
+
+ beforeEach(() => {
+ vi.clearAllMocks();
+ createAssetClient.mockReturnValue({ uploadFile: vi.fn() });
+ hasProjectPermit.mockResolvedValue(true);
+ loadDevBuildByProjectId.mockResolvedValue({
+ id: "target-build",
+ projectId: "target-project",
+ version: 3,
+ });
+ uploadImportedAssetFiles.mockResolvedValue(undefined);
+ });
+
+ test("rejects missing synced data version with compatibility message", () => {
+ expect(() =>
+ __testing__.assertBundleVersion(
+ {} as Pick<PublishedProjectBundle, "bundleVersion">
+ )
+ ).toThrow("Sync with a compatible API/CLI version");
+ });
+
+ test("rejects missing build permission", async () => {
+ hasProjectPermit.mockResolvedValue(false);
+
+ await expect(
+ __testing__.assertProjectBuildPermit({
+ ctx: {} as never,
+ hasProjectPermit,
+ projectId: "target-project",
+ })
+ ).rejects.toThrow("You don't have permission to build this project.");
+ expect(hasProjectPermit).toHaveBeenCalledWith(
+ { projectId: "target-project", permit: "build" },
+ {}
+ );
+ });
+
+ test("serializes imported build data into compact build columns", () => {
+ const update = __testing__.createBuildImportUpdate({
+ data: createData(),
+ lastTransactionId: "import-tx",
+ updatedAt: "2024-02-01T00:00:00.000Z",
+ version: 4,
+ });
+
+ expect(update).toMatchObject({
+ version: 4,
+ lastTransactionId: "import-tx",
+ updatedAt: "2024-02-01T00:00:00.000Z",
+ });
+ expect(JSON.parse(update.breakpoints)).toEqual([
+ { id: "base", label: "Base" },
+ ]);
+ expect(JSON.parse(update.styleSources)).toEqual([
+ { id: "source-1", type: "local" },
+ ]);
+ expect(JSON.parse(update.styleSourceSelections)).toEqual([
+ { instanceId: "root", values: ["source-1"] },
+ ]);
+ expect(JSON.parse(update.props)).toEqual([
+ {
+ id: "prop-1",
+ instanceId: "root",
+ name: "id",
+ type: "string",
+ value: "hero",
+ },
+ ]);
+ });
+
+ test("uses imported home social image only when corresponding asset exists", () => {
+ expect(__testing__.getImportedPreviewImageAssetId(createData())).toBe(
+ "asset-1"
+ );
+
+ expect(
+ __testing__.getImportedPreviewImageAssetId(createData({ assets: [] }))
+ ).toBeNull();
+ });
+
+ test("remaps imported asset rows to destination project", () => {
+ expect(
+ __testing__.createImportedAssetRows({
+ assets: [
+ createData().assets[0],
+ {
+ ...createData().assets[0],
+ id: "asset-2",
+ filename: undefined,
+ description: undefined,
+ },
+ ],
+ projectId: "destination-project",
+ })
+ ).toEqual([
+ {
+ id: "asset-1",
+ projectId: "destination-project",
+ name: "image.png",
+ filename: "Image",
+ description: "Hero image",
+ },
+ {
+ id: "asset-2",
+ projectId: "destination-project",
+ name: "image.png",
+ filename: null,
+ description: null,
+ },
+ ]);
+ });
+
+ test("creates imported file rows from asset metadata", () => {
+ expect(
+ __testing__.createImportedFileRows({
+ assets: [createData().assets[0]],
+ projectId: "destination-project",
+ })
+ ).toEqual([
+ {
+ name: "image.png",
+ status: "UPLOADED",
+ format: "png",
+ size: 100,
+ meta: JSON.stringify({ width: 100, height: 100 }),
+ createdAt: "2024-01-01T00:00:00.000Z",
+ uploaderProjectId: "destination-project",
+ isDeleted: false,
+ },
+ ]);
+ });
+
+ test("updates the build before replacing existing asset rows", async () => {
+ const calls: string[] = [];
+ uploadImportedAssetFiles.mockImplementation(async () => {
+ calls.push("asset-files-upload");
+ });
+
+ await importPublishedProjectBundle(
+ {
+ assetFiles: [{ name: "image.png", data: "aGVsbG8=" }],
+ ctx: {
+ postgrest: {
+ client: createPostgrestClient(calls),
+ },
+ } as never,
+ data: createData(),
+ projectId: "target-project",
+ },
+ {
+ createAssetClient,
+ hasProjectPermit,
+ loadDevBuildByProjectId,
+ uploadImportedAssetFiles,
+ }
+ );
+
+ expect(calls).toEqual([
+ "files-select",
+ "asset-files-upload",
+ "files-insert",
+ "build-update",
+ "project-preview-reset",
+ "assets-delete",
+ "assets-insert",
+ "project-preview-update",
+ ]);
+ });
+
+ test("allows importing data without version when check is explicitly ignored", async () => {
+ const calls: string[] = [];
+
+ await importPublishedProjectBundle(
+ {
+ ctx: {
+ postgrest: {
+ client: createPostgrestClient(calls),
+ },
+ } as never,
+ data: createData({ assets: [], bundleVersion: undefined }),
+ ignoreVersionCheck: true,
+ projectId: "target-project",
+ },
+ {
+ createAssetClient,
+ hasProjectPermit,
+ loadDevBuildByProjectId,
+ uploadImportedAssetFiles,
+ }
+ );
+
+ expect(calls).toContain("build-update");
+ });
+
+ test("rejects import with assets when asset files are missing", async () => {
+ await expect(
+ importPublishedProjectBundle(
+ {
+ ctx: {
+ postgrest: {
+ client: createPostgrestClient([]),
+ },
+ } as never,
+ data: createData(),
+ projectId: "target-project",
+ },
+ {
+ createAssetClient,
+ hasProjectPermit,
+ loadDevBuildByProjectId,
+ uploadImportedAssetFiles,
+ }
+ )
+ ).rejects.toThrow("Imported asset files are required.");
+ });
+
+ test("uploads missing imported asset files before creating file rows", async () => {
+ const calls: string[] = [];
+ uploadImportedAssetFiles.mockImplementation(async () => {
+ calls.push("asset-files-upload");
+ });
+
+ await importPublishedProjectBundle(
+ {
+ assetFiles: [{ name: "image.png", data: "aGVsbG8=" }],
+ ctx: {
+ postgrest: {
+ client: createPostgrestClient(calls),
+ },
+ } as never,
+ data: createData(),
+ projectId: "target-project",
+ },
+ {
+ createAssetClient,
+ hasProjectPermit,
+ loadDevBuildByProjectId,
+ uploadImportedAssetFiles,
+ }
+ );
+
+ expect(uploadImportedAssetFiles).toHaveBeenCalledWith({
+ assetClient: expect.objectContaining({
+ uploadFile: expect.any(Function),
+ }),
+ assetFiles: [{ name: "image.png", data: "aGVsbG8=" }],
+ assets: createData().assets,
+ });
+ expect(calls.indexOf("files-select")).toBeLessThan(
+ calls.indexOf("asset-files-upload")
+ );
+ expect(calls.indexOf("asset-files-upload")).toBeLessThan(
+ calls.indexOf("files-insert")
+ );
+ });
+
+ test("loads existing imported file rows by global file name", async () => {
+ const calls: string[] = [];
+
+ await expect(
+ __testing__.loadExistingImportedAssetFileNames({
+ assets: createData().assets,
+ ctx: {
+ postgrest: {
+ client: createPostgrestClient(calls, {
+ existingFileNames: ["image.png"],
+ }),
+ },
+ } as never,
+ })
+ ).resolves.toEqual(new Set(["image.png"]));
+
+ expect(calls).toEqual(["files-select"]);
+ });
+
+ test("restores imported file rows by global file name", async () => {
+ const calls: string[] = [];
+ uploadImportedAssetFiles.mockImplementation(async () => {
+ calls.push("asset-files-upload");
+ });
+
+ await importPublishedProjectBundle(
+ {
+ assetFiles: [{ name: "image.png", data: "aGVsbG8=" }],
+ ctx: {
+ postgrest: {
+ client: createPostgrestClient(calls, {
+ existingFileNames: ["image.png"],
+ }),
+ },
+ } as never,
+ data: createData(),
+ projectId: "target-project",
+ },
+ {
+ createAssetClient,
+ hasProjectPermit,
+ loadDevBuildByProjectId,
+ uploadImportedAssetFiles,
+ }
+ );
+
+ expect(calls).toContain("files-restore");
+ });
+
+ test("uploads imported asset files even when file rows already exist", async () => {
+ const calls: string[] = [];
+
+ await importPublishedProjectBundle(
+ {
+ assetFiles: [{ name: "image.png", data: "aGVsbG8=" }],
+ ctx: {
+ postgrest: {
+ client: createPostgrestClient(calls, {
+ existingFileNames: ["image.png"],
+ }),
+ },
+ } as never,
+ data: createData(),
+ projectId: "target-project",
+ },
+ {
+ createAssetClient,
+ hasProjectPermit,
+ loadDevBuildByProjectId,
+ uploadImportedAssetFiles,
+ }
+ );
+
+ expect(uploadImportedAssetFiles).toHaveBeenCalledWith({
+ assetClient: expect.objectContaining({
+ uploadFile: expect.any(Function),
+ }),
+ assetFiles: [{ name: "image.png", data: "aGVsbG8=" }],
+ assets: createData().assets,
+ });
+ expect(calls).not.toContain("files-insert");
+ });
+
+ test("uploads imported asset file bytes through asset client", async () => {
+ type AssetClient = ReturnType<
+ typeof import("~/shared/asset-client").createAssetClient
+ >;
+ const uploadFile = vi.fn<AssetClient["uploadFile"]>(async () => ({
+ format: "png",
+ meta: { width: 100, height: 100 },
+ size: 5,
+ }));
+
+ await __testing__.uploadImportedAssetFiles({
+ assetClient: { uploadFile },
+ assetFiles: [{ name: "image.png", data: "aGVsbG8=" }],
+ assets: createData().assets,
+ });
+
+ expect(uploadFile).toHaveBeenCalledWith(
+ "image.png",
+ "image",
+ expect.anything(),
+ { width: 100, height: 100, format: "png" }
+ );
+ const stream = uploadFile.mock.calls[0][2] as AsyncIterable<Uint8Array>;
+ const chunks: Uint8Array[] = [];
+ for await (const chunk of stream) {
+ chunks.push(chunk);
+ }
+ expect(Buffer.concat(chunks).toString("utf8")).toBe("hello");
+ });
+
+ test("rejects partial imported asset file payloads", () => {
+ expect(() =>
+ __testing__.assertAssetFilesMatchAssets({
+ assetFiles: [],
+ assets: createData().assets,
+ })
+ ).toThrow("Imported asset file is missing: image.png");
+ });
+
+ test("rejects missing imported asset file payload", () => {
+ expect(() =>
+ __testing__.assertAssetFilesMatchAssets({
+ assetFiles: undefined,
+ assets: createData().assets,
+ })
+ ).toThrow("Imported asset files are required.");
+ });
+
+ test("rejects imported asset files not present in data assets", () => {
+ expect(() =>
+ __testing__.assertAssetFilesMatchAssets({
+ assetFiles: [{ name: "other.png", data: "aGVsbG8=" }],
+ assets: createData().assets,
+ })
+ ).toThrow("Imported asset file does not exist in data assets: other.png");
+ });
+
+ test("rejects imported asset names with path separators", () => {
+ expect(() =>
+ __testing__.assertImportedAssetNames([
+ { ...createData().assets[0], name: "../image.png" },
+ ])
+ ).toThrow("Imported asset name is invalid: ../image.png");
+ });
+
+ test("rejects duplicated imported asset names", () => {
+ expect(() =>
+ __testing__.assertImportedAssetNames([
+ createData().assets[0],
+ { ...createData().assets[0], id: "asset-2" },
+ ])
+ ).toThrow("Imported asset name is duplicated: image.png");
+ });
+
+ test("rejects duplicated imported asset ids", () => {
+ expect(() =>
+ __testing__.assertImportedAssetNames([
+ createData().assets[0],
+ { ...createData().assets[0], name: "other.png" },
+ ])
+ ).toThrow("Imported asset id is duplicated: asset-1");
+ });
+
+ test("rejects empty imported asset ids", () => {
+ expect(() =>
+ __testing__.assertImportedAssetNames([
+ { ...createData().assets[0], id: "" },
+ ])
+ ).toThrow("Imported asset id is invalid.");
+ });
+
+ test("rejects duplicated imported asset file payloads", () => {
+ expect(() =>
+ __testing__.assertAssetFilesMatchAssets({
+ assetFiles: [
+ { name: "image.png", data: "aGVsbG8=" },
+ { name: "image.png", data: "aGVsbG8=" },
+ ],
+ assets: createData().assets,
+ })
+ ).toThrow("Imported asset file is duplicated: image.png");
+ });
+
+ test("rejects invalid imported asset file data", () => {
+ expect(() =>
+ __testing__.assertAssetFilesMatchAssets({
+ assetFiles: [{ name: "image.png", data: "not base64" }],
+ assets: createData().assets,
+ })
+ ).toThrow("Imported asset file data is invalid: image.png");
+ });
+});
diff --git a/apps/builder/app/services/project-bundle-import.server.ts b/apps/builder/app/services/project-bundle-import.server.ts
new file mode 100644
index 0000000000..952414fc31
--- /dev/null
+++ b/apps/builder/app/services/project-bundle-import.server.ts
@@ -0,0 +1,466 @@
+import { Buffer } from "node:buffer";
+import {
+ AuthorizationError,
+ authorizeProject,
+ type AppContext,
+} from "@webstudio-is/trpc-interface/index.server";
+import {
+ loadDevBuildByProjectId,
+ serializeData,
+} from "@webstudio-is/project-build/index.server";
+import { migratePages } from "@webstudio-is/project-migrations/pages";
+import { serializeStyles } from "@webstudio-is/project-build/styles.server";
+import { serializeStyleSourceSelections } from "@webstudio-is/project-build/style-source-selections.server";
+import {
+ isAssetFileName,
+ isAssetFileDataString,
+ getBundleVersionMismatchMessage,
+ bundleVersion,
+ type AssetFileData,
+ type PublishedProjectBundle,
+ type ProjectBundle,
+} from "@webstudio-is/protocol";
+import { createAssetClient } from "~/shared/asset-client";
+import {
+ getHomePage,
+ type Asset,
+ type Breakpoint,
+ type DataSource,
+ type Instance,
+ type Prop,
+ type Resource,
+ type StyleSource,
+} from "@webstudio-is/sdk";
+
+const toMap = <Key extends string, Value>(entries: [Key, Value][]) =>
+ new Map<Key, Value>(entries);
+
+const assertBundleVersion = (
+ data: Pick<PublishedProjectBundle, "bundleVersion">
+) => {
+ if (data.bundleVersion !== bundleVersion) {
+ throw new Error(
+ getBundleVersionMismatchMessage({
+ ignoreVersionCheckHint:
+ "explicitly ignore the version check if you know the source and target data formats are compatible",
+ receivedVersion: data.bundleVersion,
+ })
+ );
+ }
+};
+
+export const assertProjectBuildPermit = async ({
+ ctx,
+ hasProjectPermit = authorizeProject.hasProjectPermit,
+ projectId,
+}: {
+ ctx: AppContext;
+ hasProjectPermit?: typeof authorizeProject.hasProjectPermit;
+ projectId: string;
+}) => {
+ const canBuild = await hasProjectPermit({ projectId, permit: "build" }, ctx);
+ if (canBuild === false) {
+ throw new AuthorizationError(
+ "You don't have permission to build this project."
+ );
+ }
+};
+
+const createBuildImportUpdate = ({
+ data,
+ lastTransactionId,
+ updatedAt,
+ version,
+}: {
+ data: ProjectBundle;
+ lastTransactionId: string;
+ updatedAt: string;
+ version: number;
+}) => ({
+ version,
+ lastTransactionId,
+ updatedAt,
+ pages: JSON.stringify(data.build.pages),
+ breakpoints: serializeData<Breakpoint>(toMap(data.build.breakpoints)),
+ styles: serializeStyles(toMap(data.build.styles)),
+ styleSources: serializeData<StyleSource>(toMap(data.build.styleSources)),
+ styleSourceSelections: serializeStyleSourceSelections(
+ toMap(data.build.styleSourceSelections)
+ ),
+ props: serializeData<Prop>(toMap(data.build.props)),
+ dataSources: serializeData<DataSource>(toMap(data.build.dataSources)),
+ resources: serializeData<Resource>(toMap(data.build.resources)),
+ instances: serializeData<Instance>(toMap(data.build.instances)),
+});
+
+const getImportedPreviewImageAssetId = (data: ProjectBundle) => {
+ const socialImageAssetId = getHomePage(migratePages(data.build.pages)).meta
+ .socialImageAssetId;
+ if (socialImageAssetId === undefined) {
+ return null;
+ }
+ const importedAssetIds = new Set(data.assets.map((asset) => asset.id));
+ return importedAssetIds.has(socialImageAssetId) ? socialImageAssetId : null;
+};
+
+const createImportedFileRows = ({
+ assets,
+ projectId,
+}: {
+ assets: Asset[];
+ projectId: string;
+}) =>
+ assets.map((asset) => ({
+ name: asset.name,
+ status: "UPLOADED" as const,
+ format: asset.format,
+ size: asset.size,
+ meta: JSON.stringify(asset.meta),
+ createdAt: asset.createdAt,
+ uploaderProjectId: projectId,
+ isDeleted: false,
+ }));
+
+const toByteStream = async function* (data: Uint8Array) {
+ yield data;
+};
+
+const getAssetInfoFallback = (asset: Asset) => {
+ if (asset.type !== "image") {
+ return;
+ }
+ return {
+ width: asset.meta.width,
+ height: asset.meta.height,
+ format: asset.format,
+ };
+};
+
+const assertImportedAssetNames = (assets: Asset[]) => {
+ const assetIds = new Set<string>();
+ const assetNames = new Set<string>();
+
+ for (const asset of assets) {
+ if (asset.id === "") {
+ throw new Error("Imported asset id is invalid.");
+ }
+ if (assetIds.has(asset.id)) {
+ throw new Error(`Imported asset id is duplicated: ${asset.id}`);
+ }
+ if (isAssetFileName(asset.name) === false) {
+ throw new Error(`Imported asset name is invalid: ${asset.name}`);
+ }
+ if (assetNames.has(asset.name)) {
+ throw new Error(`Imported asset name is duplicated: ${asset.name}`);
+ }
+ assetIds.add(asset.id);
+ assetNames.add(asset.name);
+ }
+};
+
+const assertAssetFilesMatchAssets = ({
+ assetFiles,
+ assets,
+}: {
+ assetFiles: AssetFileData[] | undefined;
+ assets: Asset[];
+}) => {
+ assertImportedAssetNames(assets);
+
+ if (assetFiles === undefined) {
+ if (assets.length > 0) {
+ throw new Error("Imported asset files are required.");
+ }
+ return;
+ }
+
+ const assetNames = new Set(assets.map((asset) => asset.name));
+ const assetFilesByName = new Map<string, AssetFileData>();
+
+ for (const assetFile of assetFiles) {
+ if (isAssetFileDataString(assetFile.data) === false) {
+ throw new Error(`Imported asset file data is invalid: ${assetFile.name}`);
+ }
+ if (assetFilesByName.has(assetFile.name)) {
+ throw new Error(`Imported asset file is duplicated: ${assetFile.name}`);
+ }
+ if (assetNames.has(assetFile.name) === false) {
+ throw new Error(
+ `Imported asset file does not exist in data assets: ${assetFile.name}`
+ );
+ }
+ assetFilesByName.set(assetFile.name, assetFile);
+ }
+
+ for (const assetName of assetNames) {
+ if (assetFilesByName.has(assetName) === false) {
+ throw new Error(`Imported asset file is missing: ${assetName}`);
+ }
+ }
+};
+
+const uploadImportedAssetFiles = async ({
+ assetClient,
+ assetFiles,
+ assets,
+}: {
+ assetClient: ReturnType<typeof createAssetClient>;
+ assetFiles: AssetFileData[];
+ assets: Asset[];
+}) => {
+ const assetsByName = new Map(assets.map((asset) => [asset.name, asset]));
+
+ for (const assetFile of assetFiles) {
+ const asset = assetsByName.get(assetFile.name)!;
+ await assetClient.uploadFile(
+ asset.name,
+ asset.type,
+ toByteStream(Buffer.from(assetFile.data, "base64")),
+ getAssetInfoFallback(asset)
+ );
+ }
+};
+
+const loadExistingImportedAssetFileNames = async ({
+ assets,
+ ctx,
+}: {
+ assets: Asset[];
+ ctx: AppContext;
+}) => {
+ if (assets.length === 0) {
+ return new Set<string>();
+ }
+
+ const files = await ctx.postgrest.client
+ .from("File")
+ .select("name")
+ .in(
+ "name",
+ assets.map((asset) => asset.name)
+ );
+
+ if (files.error) {
+ throw files.error;
+ }
+
+ return new Set((files.data ?? []).map((file) => file.name));
+};
+
+const ensureImportedAssetFiles = async ({
+ assets,
+ ctx,
+ existingFileNames,
+ projectId,
+}: {
+ assets: Asset[];
+ ctx: AppContext;
+ existingFileNames: Set<string>;
+ projectId: string;
+}) => {
+ if (assets.length === 0) {
+ return;
+ }
+
+ const missingAssets = assets.filter(
+ (asset) => existingFileNames.has(asset.name) === false
+ );
+
+ if (existingFileNames.size > 0) {
+ const restoreFiles = await ctx.postgrest.client
+ .from("File")
+ .update({ isDeleted: false })
+ .in("name", Array.from(existingFileNames));
+ if (restoreFiles.error) {
+ throw restoreFiles.error;
+ }
+ }
+
+ if (missingAssets.length === 0) {
+ return;
+ }
+
+ const insertedFiles = await ctx.postgrest.client.from("File").insert(
+ createImportedFileRows({
+ assets: missingAssets,
+ projectId,
+ })
+ );
+ if (insertedFiles.error) {
+ throw insertedFiles.error;
+ }
+};
+
+const replaceProjectAssetRows = async ({
+ assets,
+ ctx,
+ projectId,
+}: {
+ assets: Asset[];
+ ctx: AppContext;
+ projectId: string;
+}) => {
+ const resetPreviewImage = await ctx.postgrest.client
+ .from("Project")
+ .update({ previewImageAssetId: null })
+ .eq("id", projectId);
+ if (resetPreviewImage.error) {
+ throw resetPreviewImage.error;
+ }
+
+ const deletedAssets = await ctx.postgrest.client
+ .from("Asset")
+ .delete()
+ .eq("projectId", projectId);
+ if (deletedAssets.error) {
+ throw deletedAssets.error;
+ }
+
+ if (assets.length === 0) {
+ return;
+ }
+
+ const insertedAssets = await ctx.postgrest.client
+ .from("Asset")
+ .insert(createImportedAssetRows({ assets, projectId }));
+ if (insertedAssets.error) {
+ throw insertedAssets.error;
+ }
+};
+
+const createImportedAssetRows = ({
+ assets,
+ projectId,
+}: {
+ assets: Asset[];
+ projectId: string;
+}) =>
+ assets.map((asset) => ({
+ id: asset.id,
+ projectId,
+ name: asset.name,
+ filename: asset.filename ?? null,
+ description: asset.description ?? null,
+ }));
+
+const updateProjectPreviewImage = async ({
+ assetId,
+ ctx,
+ projectId,
+}: {
+ assetId: string | null;
+ ctx: AppContext;
+ projectId: string;
+}) => {
+ const updatedProject = await ctx.postgrest.client
+ .from("Project")
+ .update({ previewImageAssetId: assetId })
+ .eq("id", projectId);
+ if (updatedProject.error) {
+ throw updatedProject.error;
+ }
+};
+
+export const importPublishedProjectBundle = async (
+ {
+ assetFiles,
+ ctx,
+ data,
+ ignoreVersionCheck = false,
+ projectId,
+ }: {
+ assetFiles?: AssetFileData[];
+ ctx: AppContext;
+ data: PublishedProjectBundle;
+ ignoreVersionCheck?: boolean;
+ projectId: string;
+ },
+ dependencies = {
+ createAssetClient,
+ hasProjectPermit: authorizeProject.hasProjectPermit,
+ loadDevBuildByProjectId,
+ uploadImportedAssetFiles,
+ }
+) => {
+ if (ignoreVersionCheck === false) {
+ assertBundleVersion(data);
+ }
+
+ await assertProjectBuildPermit({
+ ctx,
+ hasProjectPermit: dependencies.hasProjectPermit,
+ projectId,
+ });
+
+ const build = await dependencies.loadDevBuildByProjectId(ctx, projectId);
+ const nextVersion = build.version + 1;
+
+ assertAssetFilesMatchAssets({ assetFiles, assets: data.assets });
+
+ const existingFileNames = await loadExistingImportedAssetFileNames({
+ assets: data.assets,
+ ctx,
+ });
+
+ if (assetFiles !== undefined && assetFiles.length > 0) {
+ await dependencies.uploadImportedAssetFiles({
+ assetClient: dependencies.createAssetClient(),
+ assetFiles,
+ assets: data.assets,
+ });
+ }
+
+ await ensureImportedAssetFiles({
+ assets: data.assets,
+ ctx,
+ existingFileNames,
+ projectId,
+ });
+
+ const update = await ctx.postgrest.client
+ .from("Build")
+ .update(
+ createBuildImportUpdate({
+ data,
+ lastTransactionId: crypto.randomUUID(),
+ updatedAt: new Date().toISOString(),
+ version: nextVersion,
+ }),
+ { count: "exact" }
+ )
+ .match({
+ id: build.id,
+ projectId,
+ version: build.version,
+ });
+
+ if (update.error) {
+ throw update.error;
+ }
+ if (update.count !== 1) {
+ throw new Error("Unable to import project bundle because build changed.");
+ }
+
+ await replaceProjectAssetRows({ assets: data.assets, ctx, projectId });
+
+ await updateProjectPreviewImage({
+ assetId: getImportedPreviewImageAssetId(data),
+ ctx,
+ projectId,
+ });
+
+ return { version: nextVersion };
+};
+
+export const __testing__ = {
+ assertProjectBuildPermit,
+ assertBundleVersion,
+ createImportedFileRows,
+ createImportedAssetRows,
+ createBuildImportUpdate,
+ getImportedPreviewImageAssetId,
+ assertImportedAssetNames,
+ assertAssetFilesMatchAssets,
+ loadExistingImportedAssetFileNames,
+ uploadImportedAssetFiles,
+};
diff --git a/apps/builder/app/shared/db/canvas.server.ts b/apps/builder/app/shared/db/canvas.server.ts
index 002ce55b2c..166287f99a 100644
--- a/apps/builder/app/shared/db/canvas.server.ts
+++ b/apps/builder/app/shared/db/canvas.server.ts
@@ -1,4 +1,8 @@
-import type { Data } from "@webstudio-is/http-client";
+import {
+ bundleVersion,
+ type PublishedProjectBundle,
+ type ProjectBundle,
+} from "@webstudio-is/protocol";
import { loadBuildById } from "@webstudio-is/project-build/index.server";
import { loadAssetsByProject } from "@webstudio-is/asset-uploader/index.server";
import type { AppContext } from "@webstudio-is/trpc-interface/index.server";
@@ -8,27 +12,21 @@ import {
getStyleDeclKey,
} from "@webstudio-is/sdk";
import { serializePages } from "@webstudio-is/project-migrations/pages";
-import * as projectApi from "@webstudio-is/project/index.server";
-import { getUserById, type User } from "./user.server";
-
-export type PublishedProjectData = Data & {
- user: { email: User["email"] } | undefined;
- projectDomain: string;
- projectTitle: string;
-};
+import { loadById } from "@webstudio-is/project/index.server";
+import { getUserById } from "./user.server";
const getPair = <Item extends { id: string }>(item: Item): [string, Item] => [
item.id,
item,
];
-type Project = NonNullable<Awaited<ReturnType<typeof projectApi.loadById>>>;
+type Project = NonNullable<Awaited<ReturnType<typeof loadById>>>;
const loadProductionCanvasDataAndProject = async (
buildId: string,
context: AppContext,
project?: Project
-): Promise<{ data: Data; project: Project }> => {
+): Promise<{ data: ProjectBundle; project: Project }> => {
const build = await loadBuildById(context, buildId);
if (build === undefined) {
@@ -41,7 +39,7 @@ const loadProductionCanvasDataAndProject = async (
throw new Error("The project is not published");
}
- project = project ?? (await projectApi.loadById(build.projectId, context));
+ project = project ?? (await loadById(build.projectId, context));
if (project === null) {
throw new Error(`Project "${build.projectId}" not found`);
}
@@ -120,10 +118,10 @@ const loadProductionCanvasDataAndProject = async (
};
const addProjectMetadata = async (
- data: Data,
+ data: ProjectBundle,
project: Project,
context: AppContext
-): Promise<PublishedProjectData> => {
+): Promise<PublishedProjectBundle> => {
const user =
project.userId === null
? undefined
@@ -131,6 +129,7 @@ const addProjectMetadata = async (
return {
...data,
+ bundleVersion,
user: user ? { email: user.email } : undefined,
projectDomain: project.domain,
projectTitle: project.title,
@@ -140,15 +139,15 @@ const addProjectMetadata = async (
export const loadProductionCanvasData = async (
buildId: string,
context: AppContext
-): Promise<Data> => {
+): Promise<ProjectBundle> => {
const { data } = await loadProductionCanvasDataAndProject(buildId, context);
return data;
};
-export const loadPublishedProjectDataByBuildId = async (
+export const loadPublishedProjectBundleByBuildId = async (
buildId: string,
context: AppContext
-): Promise<PublishedProjectData> => {
+): Promise<PublishedProjectBundle> => {
const { data, project } = await loadProductionCanvasDataAndProject(
buildId,
context
@@ -156,11 +155,11 @@ export const loadPublishedProjectDataByBuildId = async (
return await addProjectMetadata(data, project, context);
};
-export const loadPublishedProjectDataByProjectId = async (
+export const loadPublishedProjectBundleByProjectId = async (
projectId: string,
context: AppContext
-): Promise<PublishedProjectData> => {
- const project = await projectApi.loadById(projectId, context);
+): Promise<PublishedProjectBundle> => {
+ const project = await loadById(projectId, context);
if (project === null) {
throw new Error(`Project "${projectId}" not found`);
}
diff --git a/apps/builder/e2e/run-local.sh b/apps/builder/e2e/run-local.sh
index 03d2d2a259..d8d80a0ee0 100644
--- a/apps/builder/e2e/run-local.sh
+++ b/apps/builder/e2e/run-local.sh
@@ -20,7 +20,6 @@ export E2E_MIGRATIONS_TIMEOUT_SECONDS="${E2E_MIGRATIONS_TIMEOUT_SECONDS:-300}"
export E2E_INSTALL_PLAYWRIGHT="${E2E_INSTALL_PLAYWRIGHT:-auto}"
export E2E_PLAYWRIGHT_INSTALL_TIMEOUT_SECONDS="${E2E_PLAYWRIGHT_INSTALL_TIMEOUT_SECONDS:-300}"
export E2E_RUN_TESTS="${E2E_RUN_TESTS:-true}"
-export E2E_PACKAGE_BUILD_TIMEOUT_SECONDS="${E2E_PACKAGE_BUILD_TIMEOUT_SECONDS:-120}"
export E2E_BUILDER_BUILD_TIMEOUT_SECONDS="${E2E_BUILDER_BUILD_TIMEOUT_SECONDS:-600}"
export E2E_TEST_COMMAND_TIMEOUT_SECONDS="${E2E_TEST_COMMAND_TIMEOUT_SECONDS:-900}"
export E2E_WRITE_SCHEMA_SNAPSHOT="${E2E_WRITE_SCHEMA_SNAPSHOT:-false}"
@@ -197,10 +196,6 @@ install_playwright_chromium() {
esac
}
-build_builder_package_entries() {
- pnpm --dir "$ROOT_DIR" --filter=@webstudio-is/http-client build
-}
-
build_builder_app() {
pnpm --dir "$ROOT_DIR" --filter=@webstudio-is/builder build
}
@@ -231,10 +226,6 @@ if [ "$E2E_RUN_TESTS" = "true" ]; then
run_step "install playwright chromium" "$E2E_PLAYWRIGHT_INSTALL_TIMEOUT_SECONDS" \
install_playwright_chromium &
install_playwright_chromium_pid="$!"
-
- run_step "build builder package entries" "$E2E_PACKAGE_BUILD_TIMEOUT_SECONDS" \
- build_builder_package_entries &
- build_builder_package_entries_pid="$!"
fi
run_step "wait for e2e database" "$E2E_DOCKER_TIMEOUT_SECONDS" \
@@ -247,7 +238,6 @@ wait_for_step "generate prisma client" "$generate_prisma_client_pid"
if [ "$E2E_RUN_TESTS" = "true" ]; then
wait_for_step "install playwright chromium" "$install_playwright_chromium_pid"
- wait_for_step "build builder package entries" "$build_builder_package_entries_pid"
run_step "start e2e postgrest" "$E2E_DOCKER_TIMEOUT_SECONDS" \
docker compose -f "$COMPOSE_FILE" up -d postgrest
diff --git a/apps/builder/package.json b/apps/builder/package.json
index 3c6ed9ad04..7289946dd5 100644
--- a/apps/builder/package.json
+++ b/apps/builder/package.json
@@ -5,7 +5,7 @@
"description": "Webstudio Builder UI as a service",
"type": "module",
"scripts": {
- "prebuild": "which remix",
+ "prebuild": "pnpm --filter=@webstudio-is/http-client... build && which remix",
"build": "remix vite:build",
"css-to-ws": "tsx --conditions=webstudio ../../packages/css-data/bin/css-to-ws.ts",
"build:webflow-presets": "pnpm css-to-ws ./app/shared/copy-paste/plugin-webflow/style-presets.css ./app/shared/copy-paste/plugin-webflow/__generated__/style-presets.ts",
@@ -60,6 +60,7 @@
"@tsndr/cloudflare-worker-jwt": "^2.5.3",
"@unocss/core": "66.6.8",
"@vercel/remix": "2.15.3",
+ "@webstudio-is/protocol": "workspace:*",
"@webstudio-is/asset-uploader": "workspace:*",
"@webstudio-is/authorization-token": "workspace:*",
"@webstudio-is/css-data": "workspace:*",
diff --git a/fixtures/react-router-cloudflare/.webstudio/data.json b/fixtures/react-router-cloudflare/.webstudio/data.json
index 2aff4e5951..fa42e3680a 100644
--- a/fixtures/react-router-cloudflare/.webstudio/data.json
+++ b/fixtures/react-router-cloudflare/.webstudio/data.json
@@ -1,4 +1,5 @@
{
+ "bundleVersion": "bundle-0.0.0-a6dad953",
"build": {
"id": "f565d527-32e7-4731-bc71-aca9e9574587",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
@@ -98,8 +99,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:display:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "display",
"value": {
"type": "keyword",
@@ -110,8 +111,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:alignItems:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "alignItems",
"value": {
"type": "keyword",
@@ -122,8 +123,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:justifyContent:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "justifyContent",
"value": {
"type": "keyword",
@@ -134,8 +135,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:flexDirection:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "flexDirection",
"value": {
"type": "keyword",
@@ -146,8 +147,8 @@
[
"0KA68BwP9gdTzE1ESO2Zp:rKj-wYctg3-GnqL3WHN9I:marginBottom:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "0KA68BwP9gdTzE1ESO2Zp",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "marginBottom",
"value": {
"type": "unit",
@@ -159,8 +160,8 @@
[
"mf2C07UBmGT7y_G4Du3yg:rKj-wYctg3-GnqL3WHN9I:width:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "mf2C07UBmGT7y_G4Du3yg",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "width",
"value": {
"type": "unit",
@@ -268,27 +269,6 @@
}
]
],
- "dataSources": [
- [
- "2KT4-bRzToj9cAGAN_woK",
- {
- "type": "parameter",
- "id": "2KT4-bRzToj9cAGAN_woK",
- "scopeInstanceId": "MMimeobf_zi4ZkRGXapju",
- "name": "system"
- }
- ],
- [
- "tdXe9gFf83hSo9BLWU6xl",
- {
- "type": "parameter",
- "id": "tdXe9gFf83hSo9BLWU6xl",
- "scopeInstanceId": "n_VBMr7klpx25buS0NV7R",
- "name": "system"
- }
- ]
- ],
- "resources": [],
"instances": [
[
"MMimeobf_zi4ZkRGXapju",
@@ -410,6 +390,27 @@
}
]
],
+ "dataSources": [
+ [
+ "2KT4-bRzToj9cAGAN_woK",
+ {
+ "type": "parameter",
+ "id": "2KT4-bRzToj9cAGAN_woK",
+ "scopeInstanceId": "MMimeobf_zi4ZkRGXapju",
+ "name": "system"
+ }
+ ],
+ [
+ "tdXe9gFf83hSo9BLWU6xl",
+ {
+ "type": "parameter",
+ "id": "tdXe9gFf83hSo9BLWU6xl",
+ "scopeInstanceId": "n_VBMr7klpx25buS0NV7R",
+ "name": "system"
+ }
+ ]
+ ],
+ "resources": [],
"deployment": {
"destination": "saas",
"domains": ["cli-basic-test-d0osr"],
@@ -467,29 +468,29 @@
"assets": [
{
"id": "1d8bf4398f643f5333d415091507d778aaed62f28883642636cbed0be156a0ee",
- "name": "iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
"size": 999,
- "type": "image",
- "format": "svg",
+ "name": "iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg",
"createdAt": "2024-07-26T13:39:48.678+00:00",
+ "format": "svg",
"meta": {
"width": 14,
"height": 16
- }
+ },
+ "type": "image"
},
{
"id": "d0974db9300c1a3b0fb8b291dd9fabd45ad136478908394280af2f7087e3aecd",
- "name": "147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
"size": 64701,
- "type": "image",
- "format": "jpg",
+ "name": "147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg",
"createdAt": "2024-12-06T14:36:07.046+00:00",
+ "format": "jpg",
"meta": {
"width": 820,
"height": 985
- }
+ },
+ "type": "image"
}
],
"user": {
diff --git a/fixtures/react-router-docker/.webstudio/data.json b/fixtures/react-router-docker/.webstudio/data.json
index 2aff4e5951..fa42e3680a 100644
--- a/fixtures/react-router-docker/.webstudio/data.json
+++ b/fixtures/react-router-docker/.webstudio/data.json
@@ -1,4 +1,5 @@
{
+ "bundleVersion": "bundle-0.0.0-a6dad953",
"build": {
"id": "f565d527-32e7-4731-bc71-aca9e9574587",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
@@ -98,8 +99,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:display:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "display",
"value": {
"type": "keyword",
@@ -110,8 +111,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:alignItems:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "alignItems",
"value": {
"type": "keyword",
@@ -122,8 +123,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:justifyContent:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "justifyContent",
"value": {
"type": "keyword",
@@ -134,8 +135,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:flexDirection:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "flexDirection",
"value": {
"type": "keyword",
@@ -146,8 +147,8 @@
[
"0KA68BwP9gdTzE1ESO2Zp:rKj-wYctg3-GnqL3WHN9I:marginBottom:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "0KA68BwP9gdTzE1ESO2Zp",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "marginBottom",
"value": {
"type": "unit",
@@ -159,8 +160,8 @@
[
"mf2C07UBmGT7y_G4Du3yg:rKj-wYctg3-GnqL3WHN9I:width:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "mf2C07UBmGT7y_G4Du3yg",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "width",
"value": {
"type": "unit",
@@ -268,27 +269,6 @@
}
]
],
- "dataSources": [
- [
- "2KT4-bRzToj9cAGAN_woK",
- {
- "type": "parameter",
- "id": "2KT4-bRzToj9cAGAN_woK",
- "scopeInstanceId": "MMimeobf_zi4ZkRGXapju",
- "name": "system"
- }
- ],
- [
- "tdXe9gFf83hSo9BLWU6xl",
- {
- "type": "parameter",
- "id": "tdXe9gFf83hSo9BLWU6xl",
- "scopeInstanceId": "n_VBMr7klpx25buS0NV7R",
- "name": "system"
- }
- ]
- ],
- "resources": [],
"instances": [
[
"MMimeobf_zi4ZkRGXapju",
@@ -410,6 +390,27 @@
}
]
],
+ "dataSources": [
+ [
+ "2KT4-bRzToj9cAGAN_woK",
+ {
+ "type": "parameter",
+ "id": "2KT4-bRzToj9cAGAN_woK",
+ "scopeInstanceId": "MMimeobf_zi4ZkRGXapju",
+ "name": "system"
+ }
+ ],
+ [
+ "tdXe9gFf83hSo9BLWU6xl",
+ {
+ "type": "parameter",
+ "id": "tdXe9gFf83hSo9BLWU6xl",
+ "scopeInstanceId": "n_VBMr7klpx25buS0NV7R",
+ "name": "system"
+ }
+ ]
+ ],
+ "resources": [],
"deployment": {
"destination": "saas",
"domains": ["cli-basic-test-d0osr"],
@@ -467,29 +468,29 @@
"assets": [
{
"id": "1d8bf4398f643f5333d415091507d778aaed62f28883642636cbed0be156a0ee",
- "name": "iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
"size": 999,
- "type": "image",
- "format": "svg",
+ "name": "iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg",
"createdAt": "2024-07-26T13:39:48.678+00:00",
+ "format": "svg",
"meta": {
"width": 14,
"height": 16
- }
+ },
+ "type": "image"
},
{
"id": "d0974db9300c1a3b0fb8b291dd9fabd45ad136478908394280af2f7087e3aecd",
- "name": "147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
"size": 64701,
- "type": "image",
- "format": "jpg",
+ "name": "147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg",
"createdAt": "2024-12-06T14:36:07.046+00:00",
+ "format": "jpg",
"meta": {
"width": 820,
"height": 985
- }
+ },
+ "type": "image"
}
],
"user": {
diff --git a/fixtures/react-router-netlify/.webstudio/data.json b/fixtures/react-router-netlify/.webstudio/data.json
index 2aff4e5951..fa42e3680a 100644
--- a/fixtures/react-router-netlify/.webstudio/data.json
+++ b/fixtures/react-router-netlify/.webstudio/data.json
@@ -1,4 +1,5 @@
{
+ "bundleVersion": "bundle-0.0.0-a6dad953",
"build": {
"id": "f565d527-32e7-4731-bc71-aca9e9574587",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
@@ -98,8 +99,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:display:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "display",
"value": {
"type": "keyword",
@@ -110,8 +111,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:alignItems:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "alignItems",
"value": {
"type": "keyword",
@@ -122,8 +123,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:justifyContent:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "justifyContent",
"value": {
"type": "keyword",
@@ -134,8 +135,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:flexDirection:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "flexDirection",
"value": {
"type": "keyword",
@@ -146,8 +147,8 @@
[
"0KA68BwP9gdTzE1ESO2Zp:rKj-wYctg3-GnqL3WHN9I:marginBottom:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "0KA68BwP9gdTzE1ESO2Zp",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "marginBottom",
"value": {
"type": "unit",
@@ -159,8 +160,8 @@
[
"mf2C07UBmGT7y_G4Du3yg:rKj-wYctg3-GnqL3WHN9I:width:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "mf2C07UBmGT7y_G4Du3yg",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "width",
"value": {
"type": "unit",
@@ -268,27 +269,6 @@
}
]
],
- "dataSources": [
- [
- "2KT4-bRzToj9cAGAN_woK",
- {
- "type": "parameter",
- "id": "2KT4-bRzToj9cAGAN_woK",
- "scopeInstanceId": "MMimeobf_zi4ZkRGXapju",
- "name": "system"
- }
- ],
- [
- "tdXe9gFf83hSo9BLWU6xl",
- {
- "type": "parameter",
- "id": "tdXe9gFf83hSo9BLWU6xl",
- "scopeInstanceId": "n_VBMr7klpx25buS0NV7R",
- "name": "system"
- }
- ]
- ],
- "resources": [],
"instances": [
[
"MMimeobf_zi4ZkRGXapju",
@@ -410,6 +390,27 @@
}
]
],
+ "dataSources": [
+ [
+ "2KT4-bRzToj9cAGAN_woK",
+ {
+ "type": "parameter",
+ "id": "2KT4-bRzToj9cAGAN_woK",
+ "scopeInstanceId": "MMimeobf_zi4ZkRGXapju",
+ "name": "system"
+ }
+ ],
+ [
+ "tdXe9gFf83hSo9BLWU6xl",
+ {
+ "type": "parameter",
+ "id": "tdXe9gFf83hSo9BLWU6xl",
+ "scopeInstanceId": "n_VBMr7klpx25buS0NV7R",
+ "name": "system"
+ }
+ ]
+ ],
+ "resources": [],
"deployment": {
"destination": "saas",
"domains": ["cli-basic-test-d0osr"],
@@ -467,29 +468,29 @@
"assets": [
{
"id": "1d8bf4398f643f5333d415091507d778aaed62f28883642636cbed0be156a0ee",
- "name": "iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
"size": 999,
- "type": "image",
- "format": "svg",
+ "name": "iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg",
"createdAt": "2024-07-26T13:39:48.678+00:00",
+ "format": "svg",
"meta": {
"width": 14,
"height": 16
- }
+ },
+ "type": "image"
},
{
"id": "d0974db9300c1a3b0fb8b291dd9fabd45ad136478908394280af2f7087e3aecd",
- "name": "147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
"size": 64701,
- "type": "image",
- "format": "jpg",
+ "name": "147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg",
"createdAt": "2024-12-06T14:36:07.046+00:00",
+ "format": "jpg",
"meta": {
"width": 820,
"height": 985
- }
+ },
+ "type": "image"
}
],
"user": {
diff --git a/fixtures/react-router-vercel/.webstudio/data.json b/fixtures/react-router-vercel/.webstudio/data.json
index 2aff4e5951..fa42e3680a 100644
--- a/fixtures/react-router-vercel/.webstudio/data.json
+++ b/fixtures/react-router-vercel/.webstudio/data.json
@@ -1,4 +1,5 @@
{
+ "bundleVersion": "bundle-0.0.0-a6dad953",
"build": {
"id": "f565d527-32e7-4731-bc71-aca9e9574587",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
@@ -98,8 +99,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:display:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "display",
"value": {
"type": "keyword",
@@ -110,8 +111,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:alignItems:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "alignItems",
"value": {
"type": "keyword",
@@ -122,8 +123,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:justifyContent:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "justifyContent",
"value": {
"type": "keyword",
@@ -134,8 +135,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:flexDirection:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "flexDirection",
"value": {
"type": "keyword",
@@ -146,8 +147,8 @@
[
"0KA68BwP9gdTzE1ESO2Zp:rKj-wYctg3-GnqL3WHN9I:marginBottom:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "0KA68BwP9gdTzE1ESO2Zp",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "marginBottom",
"value": {
"type": "unit",
@@ -159,8 +160,8 @@
[
"mf2C07UBmGT7y_G4Du3yg:rKj-wYctg3-GnqL3WHN9I:width:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "mf2C07UBmGT7y_G4Du3yg",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "width",
"value": {
"type": "unit",
@@ -268,27 +269,6 @@
}
]
],
- "dataSources": [
- [
- "2KT4-bRzToj9cAGAN_woK",
- {
- "type": "parameter",
- "id": "2KT4-bRzToj9cAGAN_woK",
- "scopeInstanceId": "MMimeobf_zi4ZkRGXapju",
- "name": "system"
- }
- ],
- [
- "tdXe9gFf83hSo9BLWU6xl",
- {
- "type": "parameter",
- "id": "tdXe9gFf83hSo9BLWU6xl",
- "scopeInstanceId": "n_VBMr7klpx25buS0NV7R",
- "name": "system"
- }
- ]
- ],
- "resources": [],
"instances": [
[
"MMimeobf_zi4ZkRGXapju",
@@ -410,6 +390,27 @@
}
]
],
+ "dataSources": [
+ [
+ "2KT4-bRzToj9cAGAN_woK",
+ {
+ "type": "parameter",
+ "id": "2KT4-bRzToj9cAGAN_woK",
+ "scopeInstanceId": "MMimeobf_zi4ZkRGXapju",
+ "name": "system"
+ }
+ ],
+ [
+ "tdXe9gFf83hSo9BLWU6xl",
+ {
+ "type": "parameter",
+ "id": "tdXe9gFf83hSo9BLWU6xl",
+ "scopeInstanceId": "n_VBMr7klpx25buS0NV7R",
+ "name": "system"
+ }
+ ]
+ ],
+ "resources": [],
"deployment": {
"destination": "saas",
"domains": ["cli-basic-test-d0osr"],
@@ -467,29 +468,29 @@
"assets": [
{
"id": "1d8bf4398f643f5333d415091507d778aaed62f28883642636cbed0be156a0ee",
- "name": "iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
"size": 999,
- "type": "image",
- "format": "svg",
+ "name": "iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg",
"createdAt": "2024-07-26T13:39:48.678+00:00",
+ "format": "svg",
"meta": {
"width": 14,
"height": 16
- }
+ },
+ "type": "image"
},
{
"id": "d0974db9300c1a3b0fb8b291dd9fabd45ad136478908394280af2f7087e3aecd",
- "name": "147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
"size": 64701,
- "type": "image",
- "format": "jpg",
+ "name": "147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg",
"createdAt": "2024-12-06T14:36:07.046+00:00",
+ "format": "jpg",
"meta": {
"width": 820,
"height": 985
- }
+ },
+ "type": "image"
}
],
"user": {
diff --git a/fixtures/ssg-cloudflare-pages/.webstudio/data.json b/fixtures/ssg-cloudflare-pages/.webstudio/data.json
index 2aac0b843f..60d774896f 100644
--- a/fixtures/ssg-cloudflare-pages/.webstudio/data.json
+++ b/fixtures/ssg-cloudflare-pages/.webstudio/data.json
@@ -1,4 +1,5 @@
{
+ "bundleVersion": "bundle-0.0.0-a6dad953",
"build": {
"id": "a2e8de30-03d5-4514-a3a6-406b3266a3af",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
@@ -98,8 +99,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:display:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "display",
"value": {
"type": "keyword",
@@ -110,8 +111,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:alignItems:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "alignItems",
"value": {
"type": "keyword",
@@ -122,8 +123,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:justifyContent:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "justifyContent",
"value": {
"type": "keyword",
@@ -134,8 +135,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:flexDirection:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "flexDirection",
"value": {
"type": "keyword",
@@ -146,8 +147,8 @@
[
"0KA68BwP9gdTzE1ESO2Zp:rKj-wYctg3-GnqL3WHN9I:marginBottom:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "0KA68BwP9gdTzE1ESO2Zp",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "marginBottom",
"value": {
"type": "unit",
@@ -159,8 +160,8 @@
[
"mf2C07UBmGT7y_G4Du3yg:rKj-wYctg3-GnqL3WHN9I:width:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "mf2C07UBmGT7y_G4Du3yg",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "width",
"value": {
"type": "unit",
@@ -268,27 +269,6 @@
}
]
],
- "dataSources": [
- [
- "2KT4-bRzToj9cAGAN_woK",
- {
- "type": "parameter",
- "id": "2KT4-bRzToj9cAGAN_woK",
- "scopeInstanceId": "MMimeobf_zi4ZkRGXapju",
- "name": "system"
- }
- ],
- [
- "tdXe9gFf83hSo9BLWU6xl",
- {
- "type": "parameter",
- "id": "tdXe9gFf83hSo9BLWU6xl",
- "scopeInstanceId": "n_VBMr7klpx25buS0NV7R",
- "name": "system"
- }
- ]
- ],
- "resources": [],
"instances": [
[
"MMimeobf_zi4ZkRGXapju",
@@ -410,6 +390,27 @@
}
]
],
+ "dataSources": [
+ [
+ "2KT4-bRzToj9cAGAN_woK",
+ {
+ "type": "parameter",
+ "id": "2KT4-bRzToj9cAGAN_woK",
+ "scopeInstanceId": "MMimeobf_zi4ZkRGXapju",
+ "name": "system"
+ }
+ ],
+ [
+ "tdXe9gFf83hSo9BLWU6xl",
+ {
+ "type": "parameter",
+ "id": "tdXe9gFf83hSo9BLWU6xl",
+ "scopeInstanceId": "n_VBMr7klpx25buS0NV7R",
+ "name": "system"
+ }
+ ]
+ ],
+ "resources": [],
"deployment": {
"domains": [],
"projectDomain": "cli-basic-test-d0osr"
@@ -465,29 +466,29 @@
"assets": [
{
"id": "1d8bf4398f643f5333d415091507d778aaed62f28883642636cbed0be156a0ee",
- "name": "iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
"size": 999,
- "type": "image",
- "format": "svg",
+ "name": "iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg",
"createdAt": "2024-07-26T13:39:48.678+00:00",
+ "format": "svg",
"meta": {
"width": 14,
"height": 16
- }
+ },
+ "type": "image"
},
{
"id": "d0974db9300c1a3b0fb8b291dd9fabd45ad136478908394280af2f7087e3aecd",
- "name": "147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
"size": 64701,
- "type": "image",
- "format": "jpg",
+ "name": "147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg",
"createdAt": "2024-12-06T14:36:07.046+00:00",
+ "format": "jpg",
"meta": {
"width": 820,
"height": 985
- }
+ },
+ "type": "image"
}
],
"user": {
diff --git a/fixtures/ssg-netlify-by-project-id/.webstudio/data.json b/fixtures/ssg-netlify-by-project-id/.webstudio/data.json
index 8ecd222a0a..6c0bd92dba 100644
--- a/fixtures/ssg-netlify-by-project-id/.webstudio/data.json
+++ b/fixtures/ssg-netlify-by-project-id/.webstudio/data.json
@@ -1,4 +1,5 @@
{
+ "bundleVersion": "bundle-0.0.0-a6dad953",
"build": {
"id": "8f0fdff2-e76b-4f86-9203-ea7df5f1143c",
"projectId": "8a7358b1-7de3-459d-b7b1-56dddfb6ce1e",
@@ -92,18 +93,6 @@
"styleSources": [],
"styleSourceSelections": [],
"props": [],
- "dataSources": [
- [
- "XE93KQdVwfiA3TCf8hQAQ",
- {
- "id": "XE93KQdVwfiA3TCf8hQAQ",
- "scopeInstanceId": "iavYtlaxaMTf7HB5DBf8e",
- "name": "system",
- "type": "parameter"
- }
- ]
- ],
- "resources": [],
"instances": [
[
"iavYtlaxaMTf7HB5DBf8e",
@@ -144,6 +133,18 @@
}
]
],
+ "dataSources": [
+ [
+ "XE93KQdVwfiA3TCf8hQAQ",
+ {
+ "type": "parameter",
+ "id": "XE93KQdVwfiA3TCf8hQAQ",
+ "scopeInstanceId": "iavYtlaxaMTf7HB5DBf8e",
+ "name": "system"
+ }
+ ]
+ ],
+ "resources": [],
"deployment": {
"destination": "saas",
"domains": ["fixture-client-do-not-touch-wsmel"],
diff --git a/fixtures/webstudio-cloudflare-template/.webstudio/data.json b/fixtures/webstudio-cloudflare-template/.webstudio/data.json
index 2aac0b843f..60d774896f 100644
--- a/fixtures/webstudio-cloudflare-template/.webstudio/data.json
+++ b/fixtures/webstudio-cloudflare-template/.webstudio/data.json
@@ -1,4 +1,5 @@
{
+ "bundleVersion": "bundle-0.0.0-a6dad953",
"build": {
"id": "a2e8de30-03d5-4514-a3a6-406b3266a3af",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
@@ -98,8 +99,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:display:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "display",
"value": {
"type": "keyword",
@@ -110,8 +111,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:alignItems:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "alignItems",
"value": {
"type": "keyword",
@@ -122,8 +123,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:justifyContent:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "justifyContent",
"value": {
"type": "keyword",
@@ -134,8 +135,8 @@
[
"7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:flexDirection:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "flexDirection",
"value": {
"type": "keyword",
@@ -146,8 +147,8 @@
[
"0KA68BwP9gdTzE1ESO2Zp:rKj-wYctg3-GnqL3WHN9I:marginBottom:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "0KA68BwP9gdTzE1ESO2Zp",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "marginBottom",
"value": {
"type": "unit",
@@ -159,8 +160,8 @@
[
"mf2C07UBmGT7y_G4Du3yg:rKj-wYctg3-GnqL3WHN9I:width:",
{
- "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"styleSourceId": "mf2C07UBmGT7y_G4Du3yg",
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
"property": "width",
"value": {
"type": "unit",
@@ -268,27 +269,6 @@
}
]
],
- "dataSources": [
- [
- "2KT4-bRzToj9cAGAN_woK",
- {
- "type": "parameter",
- "id": "2KT4-bRzToj9cAGAN_woK",
- "scopeInstanceId": "MMimeobf_zi4ZkRGXapju",
- "name": "system"
- }
- ],
- [
- "tdXe9gFf83hSo9BLWU6xl",
- {
- "type": "parameter",
- "id": "tdXe9gFf83hSo9BLWU6xl",
- "scopeInstanceId": "n_VBMr7klpx25buS0NV7R",
- "name": "system"
- }
- ]
- ],
- "resources": [],
"instances": [
[
"MMimeobf_zi4ZkRGXapju",
@@ -410,6 +390,27 @@
}
]
],
+ "dataSources": [
+ [
+ "2KT4-bRzToj9cAGAN_woK",
+ {
+ "type": "parameter",
+ "id": "2KT4-bRzToj9cAGAN_woK",
+ "scopeInstanceId": "MMimeobf_zi4ZkRGXapju",
+ "name": "system"
+ }
+ ],
+ [
+ "tdXe9gFf83hSo9BLWU6xl",
+ {
+ "type": "parameter",
+ "id": "tdXe9gFf83hSo9BLWU6xl",
+ "scopeInstanceId": "n_VBMr7klpx25buS0NV7R",
+ "name": "system"
+ }
+ ]
+ ],
+ "resources": [],
"deployment": {
"domains": [],
"projectDomain": "cli-basic-test-d0osr"
@@ -465,29 +466,29 @@
"assets": [
{
"id": "1d8bf4398f643f5333d415091507d778aaed62f28883642636cbed0be156a0ee",
- "name": "iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
"size": 999,
- "type": "image",
- "format": "svg",
+ "name": "iconly_svg_converted-converted_zMaMiAAutUl8XrITgz7d1.svg",
"createdAt": "2024-07-26T13:39:48.678+00:00",
+ "format": "svg",
"meta": {
"width": 14,
"height": 16
- }
+ },
+ "type": "image"
},
{
"id": "d0974db9300c1a3b0fb8b291dd9fabd45ad136478908394280af2f7087e3aecd",
- "name": "147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
"size": 64701,
- "type": "image",
- "format": "jpg",
+ "name": "147-1478573_cat-icon-png-black-cat-png-icon.png_ZJ6-qJjk1RlFzuYwyCXdp.jpeg",
"createdAt": "2024-12-06T14:36:07.046+00:00",
+ "format": "jpg",
"meta": {
"width": 820,
"height": 985
- }
+ },
+ "type": "image"
}
],
"user": {
diff --git a/fixtures/webstudio-features/.webstudio/data.json b/fixtures/webstudio-features/.webstudio/data.json
index bd9c6deb97..2fff004310 100644
--- a/fixtures/webstudio-features/.webstudio/data.json
+++ b/fixtures/webstudio-features/.webstudio/data.json
@@ -1,4 +1,5 @@
{
+ "bundleVersion": "bundle-0.0.0-a6dad953",
"build": {
"id": "1b66ee06-8ea5-4420-9a0e-e0d3a67aca32",
"projectId": "cddc1d44-af37-4cb6-a430-d300cf6f932d",
@@ -382,8 +383,8 @@
[
"y3sBN2gB0KCBXkheM6GMm:UoTkWyaFuTYJihS3MFYK5:fontSize:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "y3sBN2gB0KCBXkheM6GMm",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "fontSize",
"value": {
"type": "unit",
@@ -395,8 +396,8 @@
[
"NeVTA8c7vqOjhHotkd0Dv:UoTkWyaFuTYJihS3MFYK5:display:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "NeVTA8c7vqOjhHotkd0Dv",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "display",
"value": {
"type": "keyword",
@@ -407,8 +408,8 @@
[
"NeVTA8c7vqOjhHotkd0Dv:UoTkWyaFuTYJihS3MFYK5:justifyContent:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "NeVTA8c7vqOjhHotkd0Dv",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "justifyContent",
"value": {
"type": "keyword",
@@ -419,8 +420,8 @@
[
"ureLSWiLGOYeWpki2JUeu:UoTkWyaFuTYJihS3MFYK5:minWidth:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "ureLSWiLGOYeWpki2JUeu",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "minWidth",
"value": {
"type": "unit",
@@ -432,8 +433,8 @@
[
"7HeiD-PCsn4VW6_fz5Skr:UoTkWyaFuTYJihS3MFYK5:minWidth:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "7HeiD-PCsn4VW6_fz5Skr",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "minWidth",
"value": {
"type": "unit",
@@ -445,60 +446,60 @@
[
"ureLSWiLGOYeWpki2JUeu:UoTkWyaFuTYJihS3MFYK5:flexGrow:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "ureLSWiLGOYeWpki2JUeu",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexGrow",
"value": {
"type": "unit",
- "value": 1,
- "unit": "number"
+ "unit": "number",
+ "value": 1
}
}
],
[
"ureLSWiLGOYeWpki2JUeu:UoTkWyaFuTYJihS3MFYK5:flexShrink:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "ureLSWiLGOYeWpki2JUeu",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexShrink",
"value": {
"type": "unit",
- "value": 0,
- "unit": "number"
+ "unit": "number",
+ "value": 0
}
}
],
[
"7HeiD-PCsn4VW6_fz5Skr:UoTkWyaFuTYJihS3MFYK5:flexGrow:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "7HeiD-PCsn4VW6_fz5Skr",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexGrow",
"value": {
"type": "unit",
- "value": 1,
- "unit": "number"
+ "unit": "number",
+ "value": 1
}
}
],
[
"7HeiD-PCsn4VW6_fz5Skr:UoTkWyaFuTYJihS3MFYK5:flexShrink:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "7HeiD-PCsn4VW6_fz5Skr",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexShrink",
"value": {
"type": "unit",
- "value": 0,
- "unit": "number"
+ "unit": "number",
+ "value": 0
}
}
],
[
"ureLSWiLGOYeWpki2JUeu:UoTkWyaFuTYJihS3MFYK5:flexBasis:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "ureLSWiLGOYeWpki2JUeu",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexBasis",
"value": {
"type": "unit",
@@ -510,8 +511,8 @@
[
"7HeiD-PCsn4VW6_fz5Skr:UoTkWyaFuTYJihS3MFYK5:flexBasis:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "7HeiD-PCsn4VW6_fz5Skr",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexBasis",
"value": {
"type": "unit",
@@ -523,8 +524,8 @@
[
"NeVTA8c7vqOjhHotkd0Dv:UoTkWyaFuTYJihS3MFYK5:alignItems:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "NeVTA8c7vqOjhHotkd0Dv",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "alignItems",
"value": {
"type": "keyword",
@@ -535,8 +536,8 @@
[
"8VVhDFG7dmCfwcwD4DH8D:UoTkWyaFuTYJihS3MFYK5:aspectRatio:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "8VVhDFG7dmCfwcwD4DH8D",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "aspectRatio",
"value": {
"type": "unit",
@@ -548,8 +549,8 @@
[
"_t7PW0R2Naz9Zy7J1f8eQ:UoTkWyaFuTYJihS3MFYK5:paddingTop:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "_t7PW0R2Naz9Zy7J1f8eQ",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "paddingTop",
"value": {
"type": "unit",
@@ -561,8 +562,8 @@
[
"_t7PW0R2Naz9Zy7J1f8eQ:UoTkWyaFuTYJihS3MFYK5:paddingRight:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "_t7PW0R2Naz9Zy7J1f8eQ",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "paddingRight",
"value": {
"type": "unit",
@@ -574,8 +575,8 @@
[
"_t7PW0R2Naz9Zy7J1f8eQ:UoTkWyaFuTYJihS3MFYK5:paddingLeft:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "_t7PW0R2Naz9Zy7J1f8eQ",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "paddingLeft",
"value": {
"type": "unit",
@@ -587,8 +588,8 @@
[
"_t7PW0R2Naz9Zy7J1f8eQ:UoTkWyaFuTYJihS3MFYK5:paddingBottom:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "_t7PW0R2Naz9Zy7J1f8eQ",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "paddingBottom",
"value": {
"type": "unit",
@@ -600,8 +601,8 @@
[
"dPMbxwoxmuFjloniiOQb-:UoTkWyaFuTYJihS3MFYK5:borderBottomWidth:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "dPMbxwoxmuFjloniiOQb-",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "borderBottomWidth",
"value": {
"type": "unit",
@@ -613,8 +614,8 @@
[
"dPMbxwoxmuFjloniiOQb-:UoTkWyaFuTYJihS3MFYK5:borderBottomStyle:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "dPMbxwoxmuFjloniiOQb-",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "borderBottomStyle",
"value": {
"type": "keyword",
@@ -625,23 +626,23 @@
[
"dPMbxwoxmuFjloniiOQb-:UoTkWyaFuTYJihS3MFYK5:borderBottomColor:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "dPMbxwoxmuFjloniiOQb-",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "borderBottomColor",
"value": {
"type": "rgb",
- "alpha": 1,
"r": 226,
"g": 232,
- "b": 240
+ "b": 240,
+ "alpha": 1
}
}
],
[
"wVw5XxXIHCKE0ye-4HNeK:UoTkWyaFuTYJihS3MFYK5:display:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "wVw5XxXIHCKE0ye-4HNeK",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "display",
"value": {
"type": "keyword",
@@ -652,8 +653,8 @@
[
"h9BV0WW02L74rm4w_yY7e:UoTkWyaFuTYJihS3MFYK5:display:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "h9BV0WW02L74rm4w_yY7e",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "display",
"value": {
"type": "keyword",
@@ -664,47 +665,47 @@
[
"h9BV0WW02L74rm4w_yY7e:UoTkWyaFuTYJihS3MFYK5:flexGrow:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "h9BV0WW02L74rm4w_yY7e",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexGrow",
"value": {
"type": "unit",
- "value": 1,
- "unit": "number"
+ "unit": "number",
+ "value": 1
}
}
],
[
"h9BV0WW02L74rm4w_yY7e:UoTkWyaFuTYJihS3MFYK5:flexShrink:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "h9BV0WW02L74rm4w_yY7e",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexShrink",
"value": {
"type": "unit",
- "value": 1,
- "unit": "number"
+ "unit": "number",
+ "value": 1
}
}
],
[
"h9BV0WW02L74rm4w_yY7e:UoTkWyaFuTYJihS3MFYK5:flexBasis:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "h9BV0WW02L74rm4w_yY7e",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexBasis",
"value": {
"type": "unit",
- "value": 0,
- "unit": "%"
+ "unit": "%",
+ "value": 0
}
}
],
[
"h9BV0WW02L74rm4w_yY7e:UoTkWyaFuTYJihS3MFYK5:alignItems:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "h9BV0WW02L74rm4w_yY7e",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "alignItems",
"value": {
"type": "keyword",
@@ -715,8 +716,8 @@
[
"h9BV0WW02L74rm4w_yY7e:UoTkWyaFuTYJihS3MFYK5:justifyContent:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "h9BV0WW02L74rm4w_yY7e",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "justifyContent",
"value": {
"type": "keyword",
@@ -727,8 +728,8 @@
[
"h9BV0WW02L74rm4w_yY7e:UoTkWyaFuTYJihS3MFYK5:paddingTop:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "h9BV0WW02L74rm4w_yY7e",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "paddingTop",
"value": {
"type": "unit",
@@ -740,8 +741,8 @@
[
"h9BV0WW02L74rm4w_yY7e:UoTkWyaFuTYJihS3MFYK5:paddingBottom:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "h9BV0WW02L74rm4w_yY7e",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "paddingBottom",
"value": {
"type": "unit",
@@ -753,8 +754,8 @@
[
"h9BV0WW02L74rm4w_yY7e:UoTkWyaFuTYJihS3MFYK5:fontWeight:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "h9BV0WW02L74rm4w_yY7e",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "fontWeight",
"value": {
"type": "keyword",
@@ -765,8 +766,8 @@
[
"h9BV0WW02L74rm4w_yY7e:UoTkWyaFuTYJihS3MFYK5:textDecorationLine::hover",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "h9BV0WW02L74rm4w_yY7e",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"state": ":hover",
"property": "textDecorationLine",
"value": {
@@ -778,8 +779,8 @@
[
"h9BV0WW02L74rm4w_yY7e:UoTkWyaFuTYJihS3MFYK5:--accordion-trigger-icon-transform:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "h9BV0WW02L74rm4w_yY7e",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "--accordion-trigger-icon-transform",
"value": {
"type": "unparsed",
@@ -790,8 +791,8 @@
[
"h9BV0WW02L74rm4w_yY7e:UoTkWyaFuTYJihS3MFYK5:--accordion-trigger-icon-transform:[data-state=open]",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "h9BV0WW02L74rm4w_yY7e",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"state": "[data-state=open]",
"property": "--accordion-trigger-icon-transform",
"value": {
@@ -803,21 +804,20 @@
[
"8Mg2sVpRQaHDWI8DG7Qjz:UoTkWyaFuTYJihS3MFYK5:rotate:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "8Mg2sVpRQaHDWI8DG7Qjz",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "rotate",
"value": {
"type": "var",
- "value": "accordion-trigger-icon-transform",
- "fallbacks": []
+ "value": "accordion-trigger-icon-transform"
}
}
],
[
"8Mg2sVpRQaHDWI8DG7Qjz:UoTkWyaFuTYJihS3MFYK5:height:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "8Mg2sVpRQaHDWI8DG7Qjz",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "height",
"value": {
"type": "unit",
@@ -829,8 +829,8 @@
[
"8Mg2sVpRQaHDWI8DG7Qjz:UoTkWyaFuTYJihS3MFYK5:width:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "8Mg2sVpRQaHDWI8DG7Qjz",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "width",
"value": {
"type": "unit",
@@ -842,21 +842,21 @@
[
"8Mg2sVpRQaHDWI8DG7Qjz:UoTkWyaFuTYJihS3MFYK5:flexGrow:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "8Mg2sVpRQaHDWI8DG7Qjz",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexGrow",
"value": {
"type": "unit",
- "value": 0,
- "unit": "number"
+ "unit": "number",
+ "value": 0
}
}
],
[
"8Mg2sVpRQaHDWI8DG7Qjz:UoTkWyaFuTYJihS3MFYK5:transitionProperty:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "8Mg2sVpRQaHDWI8DG7Qjz",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "transitionProperty",
"value": {
"type": "keyword",
@@ -867,8 +867,8 @@
[
"8Mg2sVpRQaHDWI8DG7Qjz:UoTkWyaFuTYJihS3MFYK5:transitionTimingFunction:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "8Mg2sVpRQaHDWI8DG7Qjz",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "transitionTimingFunction",
"value": {
"type": "unparsed",
@@ -879,21 +879,21 @@
[
"8Mg2sVpRQaHDWI8DG7Qjz:UoTkWyaFuTYJihS3MFYK5:transitionDuration:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "8Mg2sVpRQaHDWI8DG7Qjz",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "transitionDuration",
"value": {
"type": "unit",
- "value": 200,
- "unit": "ms"
+ "unit": "ms",
+ "value": 200
}
}
],
[
"ZLyayr_Puk3HM35c44F2J:UoTkWyaFuTYJihS3MFYK5:fontSize:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "ZLyayr_Puk3HM35c44F2J",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "fontSize",
"value": {
"type": "unit",
@@ -905,8 +905,8 @@
[
"ZLyayr_Puk3HM35c44F2J:UoTkWyaFuTYJihS3MFYK5:lineHeight:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "ZLyayr_Puk3HM35c44F2J",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "lineHeight",
"value": {
"type": "unit",
@@ -918,8 +918,8 @@
[
"ZLyayr_Puk3HM35c44F2J:UoTkWyaFuTYJihS3MFYK5:paddingBottom:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "ZLyayr_Puk3HM35c44F2J",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "paddingBottom",
"value": {
"type": "unit",
@@ -931,8 +931,8 @@
[
"n6w3ORlRsss2eBGMq3bW1:UoTkWyaFuTYJihS3MFYK5:borderBottomWidth:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "n6w3ORlRsss2eBGMq3bW1",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "borderBottomWidth",
"value": {
"type": "unit",
@@ -944,8 +944,8 @@
[
"n6w3ORlRsss2eBGMq3bW1:UoTkWyaFuTYJihS3MFYK5:borderBottomStyle:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "n6w3ORlRsss2eBGMq3bW1",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "borderBottomStyle",
"value": {
"type": "keyword",
@@ -956,23 +956,23 @@
[
"n6w3ORlRsss2eBGMq3bW1:UoTkWyaFuTYJihS3MFYK5:borderBottomColor:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "n6w3ORlRsss2eBGMq3bW1",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "borderBottomColor",
"value": {
"type": "rgb",
- "alpha": 1,
"r": 226,
"g": 232,
- "b": 240
+ "b": 240,
+ "alpha": 1
}
}
],
[
"ANkU37d5ZGfcSzPhzwnGD:UoTkWyaFuTYJihS3MFYK5:display:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "ANkU37d5ZGfcSzPhzwnGD",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "display",
"value": {
"type": "keyword",
@@ -983,8 +983,8 @@
[
"s6cuBxkGT20NUG_kWpsQI:UoTkWyaFuTYJihS3MFYK5:display:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "s6cuBxkGT20NUG_kWpsQI",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "display",
"value": {
"type": "keyword",
@@ -995,47 +995,47 @@
[
"s6cuBxkGT20NUG_kWpsQI:UoTkWyaFuTYJihS3MFYK5:flexGrow:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "s6cuBxkGT20NUG_kWpsQI",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexGrow",
"value": {
"type": "unit",
- "value": 1,
- "unit": "number"
+ "unit": "number",
+ "value": 1
}
}
],
[
"s6cuBxkGT20NUG_kWpsQI:UoTkWyaFuTYJihS3MFYK5:flexShrink:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "s6cuBxkGT20NUG_kWpsQI",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexShrink",
"value": {
"type": "unit",
- "value": 1,
- "unit": "number"
+ "unit": "number",
+ "value": 1
}
}
],
[
"s6cuBxkGT20NUG_kWpsQI:UoTkWyaFuTYJihS3MFYK5:flexBasis:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "s6cuBxkGT20NUG_kWpsQI",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexBasis",
"value": {
"type": "unit",
- "value": 0,
- "unit": "%"
+ "unit": "%",
+ "value": 0
}
}
],
[
"s6cuBxkGT20NUG_kWpsQI:UoTkWyaFuTYJihS3MFYK5:alignItems:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "s6cuBxkGT20NUG_kWpsQI",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "alignItems",
"value": {
"type": "keyword",
@@ -1046,8 +1046,8 @@
[
"s6cuBxkGT20NUG_kWpsQI:UoTkWyaFuTYJihS3MFYK5:justifyContent:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "s6cuBxkGT20NUG_kWpsQI",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "justifyContent",
"value": {
"type": "keyword",
@@ -1058,8 +1058,8 @@
[
"s6cuBxkGT20NUG_kWpsQI:UoTkWyaFuTYJihS3MFYK5:paddingTop:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "s6cuBxkGT20NUG_kWpsQI",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "paddingTop",
"value": {
"type": "unit",
@@ -1071,8 +1071,8 @@
[
"s6cuBxkGT20NUG_kWpsQI:UoTkWyaFuTYJihS3MFYK5:paddingBottom:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "s6cuBxkGT20NUG_kWpsQI",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "paddingBottom",
"value": {
"type": "unit",
@@ -1084,8 +1084,8 @@
[
"s6cuBxkGT20NUG_kWpsQI:UoTkWyaFuTYJihS3MFYK5:fontWeight:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "s6cuBxkGT20NUG_kWpsQI",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "fontWeight",
"value": {
"type": "keyword",
@@ -1096,8 +1096,8 @@
[
"s6cuBxkGT20NUG_kWpsQI:UoTkWyaFuTYJihS3MFYK5:textDecorationLine::hover",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "s6cuBxkGT20NUG_kWpsQI",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"state": ":hover",
"property": "textDecorationLine",
"value": {
@@ -1109,8 +1109,8 @@
[
"s6cuBxkGT20NUG_kWpsQI:UoTkWyaFuTYJihS3MFYK5:--accordion-trigger-icon-transform:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "s6cuBxkGT20NUG_kWpsQI",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "--accordion-trigger-icon-transform",
"value": {
"type": "unparsed",
@@ -1121,8 +1121,8 @@
[
"s6cuBxkGT20NUG_kWpsQI:UoTkWyaFuTYJihS3MFYK5:--accordion-trigger-icon-transform:[data-state=open]",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "s6cuBxkGT20NUG_kWpsQI",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"state": "[data-state=open]",
"property": "--accordion-trigger-icon-transform",
"value": {
@@ -1134,21 +1134,20 @@
[
"eIzOGCjVa5lQceZUhtIVK:UoTkWyaFuTYJihS3MFYK5:rotate:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "eIzOGCjVa5lQceZUhtIVK",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "rotate",
"value": {
"type": "var",
- "value": "accordion-trigger-icon-transform",
- "fallbacks": []
+ "value": "accordion-trigger-icon-transform"
}
}
],
[
"eIzOGCjVa5lQceZUhtIVK:UoTkWyaFuTYJihS3MFYK5:height:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "eIzOGCjVa5lQceZUhtIVK",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "height",
"value": {
"type": "unit",
@@ -1160,8 +1159,8 @@
[
"eIzOGCjVa5lQceZUhtIVK:UoTkWyaFuTYJihS3MFYK5:width:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "eIzOGCjVa5lQceZUhtIVK",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "width",
"value": {
"type": "unit",
@@ -1173,21 +1172,21 @@
[
"eIzOGCjVa5lQceZUhtIVK:UoTkWyaFuTYJihS3MFYK5:flexGrow:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "eIzOGCjVa5lQceZUhtIVK",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexGrow",
"value": {
"type": "unit",
- "value": 0,
- "unit": "number"
+ "unit": "number",
+ "value": 0
}
}
],
[
"eIzOGCjVa5lQceZUhtIVK:UoTkWyaFuTYJihS3MFYK5:transitionProperty:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "eIzOGCjVa5lQceZUhtIVK",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "transitionProperty",
"value": {
"type": "keyword",
@@ -1198,8 +1197,8 @@
[
"eIzOGCjVa5lQceZUhtIVK:UoTkWyaFuTYJihS3MFYK5:transitionTimingFunction:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "eIzOGCjVa5lQceZUhtIVK",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "transitionTimingFunction",
"value": {
"type": "unparsed",
@@ -1210,21 +1209,21 @@
[
"eIzOGCjVa5lQceZUhtIVK:UoTkWyaFuTYJihS3MFYK5:transitionDuration:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "eIzOGCjVa5lQceZUhtIVK",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "transitionDuration",
"value": {
"type": "unit",
- "value": 200,
- "unit": "ms"
+ "unit": "ms",
+ "value": 200
}
}
],
[
"4pgxDxhhX5AvMmL4olZw0:UoTkWyaFuTYJihS3MFYK5:fontSize:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "4pgxDxhhX5AvMmL4olZw0",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "fontSize",
"value": {
"type": "unit",
@@ -1236,8 +1235,8 @@
[
"4pgxDxhhX5AvMmL4olZw0:UoTkWyaFuTYJihS3MFYK5:lineHeight:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "4pgxDxhhX5AvMmL4olZw0",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "lineHeight",
"value": {
"type": "unit",
@@ -1249,8 +1248,8 @@
[
"4pgxDxhhX5AvMmL4olZw0:UoTkWyaFuTYJihS3MFYK5:paddingBottom:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "4pgxDxhhX5AvMmL4olZw0",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "paddingBottom",
"value": {
"type": "unit",
@@ -1262,8 +1261,8 @@
[
"dWnaFMuWYYTjdOgCbt0LQ:UoTkWyaFuTYJihS3MFYK5:borderBottomWidth:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "dWnaFMuWYYTjdOgCbt0LQ",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "borderBottomWidth",
"value": {
"type": "unit",
@@ -1275,8 +1274,8 @@
[
"dWnaFMuWYYTjdOgCbt0LQ:UoTkWyaFuTYJihS3MFYK5:borderBottomStyle:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "dWnaFMuWYYTjdOgCbt0LQ",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "borderBottomStyle",
"value": {
"type": "keyword",
@@ -1287,23 +1286,23 @@
[
"dWnaFMuWYYTjdOgCbt0LQ:UoTkWyaFuTYJihS3MFYK5:borderBottomColor:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "dWnaFMuWYYTjdOgCbt0LQ",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "borderBottomColor",
"value": {
"type": "rgb",
- "alpha": 1,
"r": 226,
"g": 232,
- "b": 240
+ "b": 240,
+ "alpha": 1
}
}
],
[
"rpyoufLHt2eYUBYVUvsvU:UoTkWyaFuTYJihS3MFYK5:display:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "rpyoufLHt2eYUBYVUvsvU",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "display",
"value": {
"type": "keyword",
@@ -1314,8 +1313,8 @@
[
"T633SDU2F_Tk_BEOYeis6:UoTkWyaFuTYJihS3MFYK5:display:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "T633SDU2F_Tk_BEOYeis6",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "display",
"value": {
"type": "keyword",
@@ -1326,47 +1325,47 @@
[
"T633SDU2F_Tk_BEOYeis6:UoTkWyaFuTYJihS3MFYK5:flexGrow:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "T633SDU2F_Tk_BEOYeis6",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexGrow",
"value": {
"type": "unit",
- "value": 1,
- "unit": "number"
+ "unit": "number",
+ "value": 1
}
}
],
[
"T633SDU2F_Tk_BEOYeis6:UoTkWyaFuTYJihS3MFYK5:flexShrink:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "T633SDU2F_Tk_BEOYeis6",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexShrink",
"value": {
"type": "unit",
- "value": 1,
- "unit": "number"
+ "unit": "number",
+ "value": 1
}
}
],
[
"T633SDU2F_Tk_BEOYeis6:UoTkWyaFuTYJihS3MFYK5:flexBasis:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "T633SDU2F_Tk_BEOYeis6",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexBasis",
"value": {
"type": "unit",
- "value": 0,
- "unit": "%"
+ "unit": "%",
+ "value": 0
}
}
],
[
"T633SDU2F_Tk_BEOYeis6:UoTkWyaFuTYJihS3MFYK5:alignItems:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "T633SDU2F_Tk_BEOYeis6",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "alignItems",
"value": {
"type": "keyword",
@@ -1377,8 +1376,8 @@
[
"T633SDU2F_Tk_BEOYeis6:UoTkWyaFuTYJihS3MFYK5:justifyContent:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "T633SDU2F_Tk_BEOYeis6",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "justifyContent",
"value": {
"type": "keyword",
@@ -1389,8 +1388,8 @@
[
"T633SDU2F_Tk_BEOYeis6:UoTkWyaFuTYJihS3MFYK5:paddingTop:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "T633SDU2F_Tk_BEOYeis6",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "paddingTop",
"value": {
"type": "unit",
@@ -1402,8 +1401,8 @@
[
"T633SDU2F_Tk_BEOYeis6:UoTkWyaFuTYJihS3MFYK5:paddingBottom:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "T633SDU2F_Tk_BEOYeis6",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "paddingBottom",
"value": {
"type": "unit",
@@ -1415,8 +1414,8 @@
[
"T633SDU2F_Tk_BEOYeis6:UoTkWyaFuTYJihS3MFYK5:fontWeight:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "T633SDU2F_Tk_BEOYeis6",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "fontWeight",
"value": {
"type": "keyword",
@@ -1427,8 +1426,8 @@
[
"T633SDU2F_Tk_BEOYeis6:UoTkWyaFuTYJihS3MFYK5:textDecorationLine::hover",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "T633SDU2F_Tk_BEOYeis6",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"state": ":hover",
"property": "textDecorationLine",
"value": {
@@ -1440,8 +1439,8 @@
[
"T633SDU2F_Tk_BEOYeis6:UoTkWyaFuTYJihS3MFYK5:--accordion-trigger-icon-transform:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "T633SDU2F_Tk_BEOYeis6",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "--accordion-trigger-icon-transform",
"value": {
"type": "unparsed",
@@ -1452,8 +1451,8 @@
[
"T633SDU2F_Tk_BEOYeis6:UoTkWyaFuTYJihS3MFYK5:--accordion-trigger-icon-transform:[data-state=open]",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "T633SDU2F_Tk_BEOYeis6",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"state": "[data-state=open]",
"property": "--accordion-trigger-icon-transform",
"value": {
@@ -1465,21 +1464,20 @@
[
"-tj0IHwf7a17jeBULU-OR:UoTkWyaFuTYJihS3MFYK5:rotate:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "-tj0IHwf7a17jeBULU-OR",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "rotate",
"value": {
"type": "var",
- "value": "accordion-trigger-icon-transform",
- "fallbacks": []
+ "value": "accordion-trigger-icon-transform"
}
}
],
[
"-tj0IHwf7a17jeBULU-OR:UoTkWyaFuTYJihS3MFYK5:height:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "-tj0IHwf7a17jeBULU-OR",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "height",
"value": {
"type": "unit",
@@ -1491,8 +1489,8 @@
[
"-tj0IHwf7a17jeBULU-OR:UoTkWyaFuTYJihS3MFYK5:width:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "-tj0IHwf7a17jeBULU-OR",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "width",
"value": {
"type": "unit",
@@ -1504,21 +1502,21 @@
[
"-tj0IHwf7a17jeBULU-OR:UoTkWyaFuTYJihS3MFYK5:flexGrow:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "-tj0IHwf7a17jeBULU-OR",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "flexGrow",
"value": {
"type": "unit",
- "value": 0,
- "unit": "number"
+ "unit": "number",
+ "value": 0
}
}
],
[
"-tj0IHwf7a17jeBULU-OR:UoTkWyaFuTYJihS3MFYK5:transitionProperty:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "-tj0IHwf7a17jeBULU-OR",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "transitionProperty",
"value": {
"type": "keyword",
@@ -1529,8 +1527,8 @@
[
"-tj0IHwf7a17jeBULU-OR:UoTkWyaFuTYJihS3MFYK5:transitionTimingFunction:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "-tj0IHwf7a17jeBULU-OR",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "transitionTimingFunction",
"value": {
"type": "unparsed",
@@ -1541,21 +1539,21 @@
[
"-tj0IHwf7a17jeBULU-OR:UoTkWyaFuTYJihS3MFYK5:transitionDuration:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "-tj0IHwf7a17jeBULU-OR",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "transitionDuration",
"value": {
"type": "unit",
- "value": 200,
- "unit": "ms"
+ "unit": "ms",
+ "value": 200
}
}
],
[
"EG1HUMyU4Rw4xD2pnGi28:UoTkWyaFuTYJihS3MFYK5:fontSize:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "EG1HUMyU4Rw4xD2pnGi28",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "fontSize",
"value": {
"type": "unit",
@@ -1567,8 +1565,8 @@
[
"EG1HUMyU4Rw4xD2pnGi28:UoTkWyaFuTYJihS3MFYK5:lineHeight:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "EG1HUMyU4Rw4xD2pnGi28",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "lineHeight",
"value": {
"type": "unit",
@@ -1580,8 +1578,8 @@
[
"EG1HUMyU4Rw4xD2pnGi28:UoTkWyaFuTYJihS3MFYK5:paddingBottom:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "EG1HUMyU4Rw4xD2pnGi28",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "paddingBottom",
"value": {
"type": "unit",
@@ -1593,8 +1591,8 @@
[
"49DYl_wcHv6juFsJK5Qv3:UoTkWyaFuTYJihS3MFYK5:aspectRatio:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "49DYl_wcHv6juFsJK5Qv3",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "aspectRatio",
"value": {
"type": "unit",
@@ -1606,8 +1604,8 @@
[
"USUcfFPW4YwsvbvNORkpm:UoTkWyaFuTYJihS3MFYK5:display:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "USUcfFPW4YwsvbvNORkpm",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "display",
"value": {
"type": "keyword",
@@ -1618,8 +1616,8 @@
[
"y8DFYnVCeQ_smp3u6CSTn:UoTkWyaFuTYJihS3MFYK5:display:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "y8DFYnVCeQ_smp3u6CSTn",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "display",
"value": {
"type": "keyword",
@@ -1630,8 +1628,8 @@
[
"ZLyayr_Puk3HM35c44F2J:UoTkWyaFuTYJihS3MFYK5:overflowX:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "ZLyayr_Puk3HM35c44F2J",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "overflowX",
"value": {
"type": "keyword",
@@ -1642,8 +1640,8 @@
[
"ZLyayr_Puk3HM35c44F2J:UoTkWyaFuTYJihS3MFYK5:overflowY:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "ZLyayr_Puk3HM35c44F2J",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "overflowY",
"value": {
"type": "keyword",
@@ -1654,8 +1652,8 @@
[
"4pgxDxhhX5AvMmL4olZw0:UoTkWyaFuTYJihS3MFYK5:overflowX:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "4pgxDxhhX5AvMmL4olZw0",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "overflowX",
"value": {
"type": "keyword",
@@ -1666,8 +1664,8 @@
[
"4pgxDxhhX5AvMmL4olZw0:UoTkWyaFuTYJihS3MFYK5:overflowY:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "4pgxDxhhX5AvMmL4olZw0",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "overflowY",
"value": {
"type": "keyword",
@@ -1678,8 +1676,8 @@
[
"EG1HUMyU4Rw4xD2pnGi28:UoTkWyaFuTYJihS3MFYK5:overflowX:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "EG1HUMyU4Rw4xD2pnGi28",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "overflowX",
"value": {
"type": "keyword",
@@ -1690,8 +1688,8 @@
[
"EG1HUMyU4Rw4xD2pnGi28:UoTkWyaFuTYJihS3MFYK5:overflowY:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "EG1HUMyU4Rw4xD2pnGi28",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "overflowY",
"value": {
"type": "keyword",
@@ -1702,8 +1700,8 @@
[
"o9VRyqmvIarF6HrGMccU8:UoTkWyaFuTYJihS3MFYK5:width:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "o9VRyqmvIarF6HrGMccU8",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "width",
"value": {
"type": "unit",
@@ -1715,13 +1713,13 @@
[
"g6Z7dAxi6LYB-XtI6SaRR:UoTkWyaFuTYJihS3MFYK5:marginTop:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "g6Z7dAxi6LYB-XtI6SaRR",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "marginTop",
"value": {
"type": "unit",
- "value": 12,
- "unit": "px"
+ "unit": "px",
+ "value": 12
}
}
],
@@ -1754,8 +1752,8 @@
[
"MX5X3_9QBk2KNCj9_oKWA:UoTkWyaFuTYJihS3MFYK5:fontSize:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "MX5X3_9QBk2KNCj9_oKWA",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "fontSize",
"value": {
"type": "unit",
@@ -1767,8 +1765,8 @@
[
"9manQUfGxXPqfUvJR7nx_:UoTkWyaFuTYJihS3MFYK5:backgroundColor:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "9manQUfGxXPqfUvJR7nx_",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "backgroundColor",
"value": {
"type": "rgb",
@@ -1795,8 +1793,8 @@
[
"FdQDnQuBGdJjsbJJkurgl:UoTkWyaFuTYJihS3MFYK5:backgroundColor:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "FdQDnQuBGdJjsbJJkurgl",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "backgroundColor",
"value": {
"type": "rgb",
@@ -1823,8 +1821,8 @@
[
"2fMK05sbKQLCp_N7ES5cH:UoTkWyaFuTYJihS3MFYK5:backgroundColor:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "2fMK05sbKQLCp_N7ES5cH",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "backgroundColor",
"value": {
"type": "rgb",
@@ -1851,8 +1849,8 @@
[
"nlUHVVdPJqX4ucX3QvPHQ:UoTkWyaFuTYJihS3MFYK5:backgroundColor:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "nlUHVVdPJqX4ucX3QvPHQ",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "backgroundColor",
"value": {
"type": "rgb",
@@ -1866,8 +1864,8 @@
[
"Eboa64A1ivGBt9vVhHdkx:UoTkWyaFuTYJihS3MFYK5:height:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "Eboa64A1ivGBt9vVhHdkx",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "height",
"value": {
"type": "unit",
@@ -1879,8 +1877,8 @@
[
"Eboa64A1ivGBt9vVhHdkx:UoTkWyaFuTYJihS3MFYK5:display:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "Eboa64A1ivGBt9vVhHdkx",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "display",
"value": {
"type": "keyword",
@@ -1891,8 +1889,8 @@
[
"Eboa64A1ivGBt9vVhHdkx:UoTkWyaFuTYJihS3MFYK5:alignItems:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "Eboa64A1ivGBt9vVhHdkx",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "alignItems",
"value": {
"type": "keyword",
@@ -1903,8 +1901,8 @@
[
"Eboa64A1ivGBt9vVhHdkx:UoTkWyaFuTYJihS3MFYK5:justifyContent:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "Eboa64A1ivGBt9vVhHdkx",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "justifyContent",
"value": {
"type": "keyword",
@@ -1964,8 +1962,8 @@
[
"iseTqeMVub0Y6Q_3eOQ0S:Z8WjyXWkCrr35PXgjHdpY:maxWidth:",
{
- "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"styleSourceId": "iseTqeMVub0Y6Q_3eOQ0S",
+ "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"property": "maxWidth",
"value": {
"type": "unit",
@@ -1977,8 +1975,8 @@
[
"iseTqeMVub0Y6Q_3eOQ0S:Z8WjyXWkCrr35PXgjHdpY:width:",
{
- "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"styleSourceId": "iseTqeMVub0Y6Q_3eOQ0S",
+ "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"property": "width",
"value": {
"type": "unit",
@@ -1990,8 +1988,8 @@
[
"iseTqeMVub0Y6Q_3eOQ0S:Z8WjyXWkCrr35PXgjHdpY:minWidth:",
{
- "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"styleSourceId": "iseTqeMVub0Y6Q_3eOQ0S",
+ "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"property": "minWidth",
"value": {
"type": "unit",
@@ -2003,8 +2001,8 @@
[
"iseTqeMVub0Y6Q_3eOQ0S:Z8WjyXWkCrr35PXgjHdpY:justifySelf:",
{
- "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"styleSourceId": "iseTqeMVub0Y6Q_3eOQ0S",
+ "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"property": "justifySelf",
"value": {
"type": "keyword",
@@ -2016,8 +2014,8 @@
[
"Uhs5fZ65aKJ2wz5eB2fCJ:Z8WjyXWkCrr35PXgjHdpY:display:",
{
- "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"styleSourceId": "Uhs5fZ65aKJ2wz5eB2fCJ",
+ "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"property": "display",
"value": {
"type": "keyword",
@@ -2029,8 +2027,8 @@
[
"Uhs5fZ65aKJ2wz5eB2fCJ:Z8WjyXWkCrr35PXgjHdpY:gridAutoFlow:",
{
- "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"styleSourceId": "Uhs5fZ65aKJ2wz5eB2fCJ",
+ "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"property": "gridAutoFlow",
"value": {
"type": "keyword",
@@ -2042,8 +2040,8 @@
[
"Uhs5fZ65aKJ2wz5eB2fCJ:Z8WjyXWkCrr35PXgjHdpY:gridAutoColumns:",
{
- "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"styleSourceId": "Uhs5fZ65aKJ2wz5eB2fCJ",
+ "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"property": "gridAutoColumns",
"value": {
"type": "unit",
@@ -2096,8 +2094,8 @@
[
"mcplLi9TYqk__JBKYzuss:Z8WjyXWkCrr35PXgjHdpY:height:",
{
- "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"styleSourceId": "mcplLi9TYqk__JBKYzuss",
+ "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"property": "height",
"value": {
"type": "unit",
@@ -2109,8 +2107,8 @@
[
"Uhs5fZ65aKJ2wz5eB2fCJ:Z8WjyXWkCrr35PXgjHdpY:alignItems:",
{
- "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"styleSourceId": "Uhs5fZ65aKJ2wz5eB2fCJ",
+ "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"property": "alignItems",
"value": {
"type": "keyword",
@@ -2122,8 +2120,8 @@
[
"Uhs5fZ65aKJ2wz5eB2fCJ:Z8WjyXWkCrr35PXgjHdpY:alignContent:",
{
- "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"styleSourceId": "Uhs5fZ65aKJ2wz5eB2fCJ",
+ "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"property": "alignContent",
"value": {
"type": "keyword",
@@ -2135,8 +2133,8 @@
[
"8WyGOidmbyXhMWoXUdEkK:Z8WjyXWkCrr35PXgjHdpY:marginTop:",
{
- "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"styleSourceId": "8WyGOidmbyXhMWoXUdEkK",
+ "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"property": "marginTop",
"value": {
"type": "unit",
@@ -2148,8 +2146,8 @@
[
"8WyGOidmbyXhMWoXUdEkK:Z8WjyXWkCrr35PXgjHdpY:marginBottom:",
{
- "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"styleSourceId": "8WyGOidmbyXhMWoXUdEkK",
+ "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"property": "marginBottom",
"value": {
"type": "unit",
@@ -2161,8 +2159,8 @@
[
"hSMd0d2O_5ogkTfvV8g8B:Z8WjyXWkCrr35PXgjHdpY:marginTop:",
{
- "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"styleSourceId": "hSMd0d2O_5ogkTfvV8g8B",
+ "breakpointId": "Z8WjyXWkCrr35PXgjHdpY",
"property": "marginTop",
"value": {
"type": "unit",
@@ -2198,8 +2196,8 @@
[
"U6kV-2LTnN9kR4jWfLb1c:UoTkWyaFuTYJihS3MFYK5:display:",
{
- "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"styleSourceId": "U6kV-2LTnN9kR4jWfLb1c",
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
"property": "display",
"value": {
"type": "keyword",
@@ -4208,461 +4206,188 @@
}
]
],
- "dataSources": [
- [
- "RR_FthRebEUcAKUJIXl0j",
- {
- "type": "variable",
- "id": "RR_FthRebEUcAKUJIXl0j",
- "scopeInstanceId": "AM9fD6dv2Ftc3Xjcsd7Uc",
- "name": "accordionValue",
- "value": {
- "type": "string",
- "value": "0"
- }
- }
- ],
+ "instances": [
[
- "KvfuNNCNslj7nAGsD69Fl",
+ "On9cvWCxr5rdZtY9O1Bv0",
{
- "type": "variable",
- "id": "KvfuNNCNslj7nAGsD69Fl",
- "scopeInstanceId": "isNSM3wXcnHFikwNPlEOL",
- "name": "formState",
- "value": {
- "type": "string",
- "value": "initial"
- }
+ "type": "instance",
+ "id": "On9cvWCxr5rdZtY9O1Bv0",
+ "component": "Body",
+ "children": [
+ {
+ "type": "id",
+ "value": "nVMWvMsaLCcb0o1wuNQgg"
+ },
+ {
+ "type": "id",
+ "value": "f0kF-WmL7DQg7MSyRvqY1"
+ }
+ ]
}
],
[
- "Ip0FRY7L24QrIMdtuMN5j",
+ "nVMWvMsaLCcb0o1wuNQgg",
{
- "type": "variable",
- "id": "Ip0FRY7L24QrIMdtuMN5j",
- "scopeInstanceId": "-1RvizaBcVpHsjvnYxn1c",
- "name": "formState",
- "value": {
- "type": "string",
- "value": "initial"
- }
+ "type": "instance",
+ "id": "nVMWvMsaLCcb0o1wuNQgg",
+ "component": "Heading",
+ "children": [
+ {
+ "type": "text",
+ "value": "DO NOT TOUCH THIS PROJECT, IT'S USED FOR FIXTURES"
+ }
+ ]
}
],
[
- "PgXFOzhK1YDdnv2BuvlwR",
+ "f0kF-WmL7DQg7MSyRvqY1",
{
- "type": "resource",
- "id": "PgXFOzhK1YDdnv2BuvlwR",
- "scopeInstanceId": "AWY2qZfpbykoiWELeJhse",
- "name": "list",
- "resourceId": "1vX6SQdaCjJN6MvJlG_cQ"
+ "type": "instance",
+ "id": "f0kF-WmL7DQg7MSyRvqY1",
+ "component": "Box",
+ "children": [
+ {
+ "type": "id",
+ "value": "5XDbqPrZDeCwq4YJ3CHsc"
+ },
+ {
+ "type": "id",
+ "value": "qPnkiFGDj8dITWb1kmpGl"
+ }
+ ]
}
],
[
- "MShox7Ngja3P8_t6XGMBw",
+ "5XDbqPrZDeCwq4YJ3CHsc",
{
- "type": "parameter",
- "id": "MShox7Ngja3P8_t6XGMBw",
- "scopeInstanceId": "WGSZGPAhyIuWhM1DJ7HbZ",
- "name": "collectionItem"
+ "type": "instance",
+ "id": "5XDbqPrZDeCwq4YJ3CHsc",
+ "component": "Box",
+ "children": [
+ {
+ "type": "id",
+ "value": "oLXYe1UQiVMhVnZGvJSMr"
+ },
+ {
+ "type": "id",
+ "value": "p34JHWcU6UNrd9FVnY80Q"
+ },
+ {
+ "type": "id",
+ "value": "Ol5bklKKxyJaS7Q3jcCfD"
+ },
+ {
+ "type": "id",
+ "value": "D8wLZzLWQfxH9uaKsn-0L"
+ },
+ {
+ "type": "id",
+ "value": "8AXawjUE3fJoOH_1qOAoq"
+ },
+ {
+ "type": "id",
+ "value": "82HYqzxZeahPxSDFNWem5"
+ },
+ {
+ "type": "id",
+ "value": "9I4GRU1sev48hREkQcKQ-"
+ },
+ {
+ "type": "id",
+ "value": "81ejLVXyFEV1SxiJrWhyw"
+ }
+ ]
}
],
[
- "u9wtUkt2-E0RDaljl_I6E",
+ "qPnkiFGDj8dITWb1kmpGl",
{
- "type": "parameter",
- "id": "u9wtUkt2-E0RDaljl_I6E",
- "scopeInstanceId": "On9cvWCxr5rdZtY9O1Bv0",
- "name": "system"
+ "type": "instance",
+ "id": "qPnkiFGDj8dITWb1kmpGl",
+ "component": "Box",
+ "children": [
+ {
+ "type": "id",
+ "value": "pX1ovPI7NdC0HRjkw6Kpw"
+ }
+ ]
}
],
[
- "GqDH_PSDF_8QXqPW2A0un",
+ "oLXYe1UQiVMhVnZGvJSMr",
{
- "type": "parameter",
- "id": "GqDH_PSDF_8QXqPW2A0un",
- "scopeInstanceId": "uKWGyE9JY3cPwY-xI9vk6",
- "name": "system"
+ "type": "instance",
+ "id": "oLXYe1UQiVMhVnZGvJSMr",
+ "component": "Heading",
+ "children": [
+ {
+ "type": "text",
+ "value": "Heading"
+ }
+ ]
}
],
[
- "UiZtSC5BK8Ub-Ow7-XOdW",
+ "p34JHWcU6UNrd9FVnY80Q",
{
- "type": "parameter",
- "id": "UiZtSC5BK8Ub-Ow7-XOdW",
- "scopeInstanceId": "EDEfpMPRqDejthtwkH7ws",
- "name": "system"
+ "type": "instance",
+ "id": "p34JHWcU6UNrd9FVnY80Q",
+ "component": "Paragraph",
+ "children": [
+ {
+ "type": "text",
+ "value": "a little kitten painted in black and white gouache with a thick brush"
+ }
+ ]
}
],
[
- "-CX9SNsPSue42RkfxjL8_",
+ "pX1ovPI7NdC0HRjkw6Kpw",
{
- "type": "parameter",
- "id": "-CX9SNsPSue42RkfxjL8_",
- "scopeInstanceId": "a-4nDFkaWy4px1fn38XWJ",
- "name": "system"
+ "type": "instance",
+ "id": "pX1ovPI7NdC0HRjkw6Kpw",
+ "component": "Image",
+ "children": []
}
],
[
- "Q6XrK4-ZZUdXsocdiWqVk",
+ "uKWGyE9JY3cPwY-xI9vk6",
{
- "type": "parameter",
- "id": "Q6XrK4-ZZUdXsocdiWqVk",
- "scopeInstanceId": "O-ljaGZQ0iRNTlEshMkgE",
- "name": "system"
+ "type": "instance",
+ "id": "uKWGyE9JY3cPwY-xI9vk6",
+ "component": "Body",
+ "children": [
+ {
+ "type": "id",
+ "value": "AM9fD6dv2Ftc3Xjcsd7Uc"
+ }
+ ]
}
],
[
- "keP0A66msOpEL6HbrC9OJ",
+ "AM9fD6dv2Ftc3Xjcsd7Uc",
{
- "type": "parameter",
- "id": "keP0A66msOpEL6HbrC9OJ",
- "scopeInstanceId": "AWY2qZfpbykoiWELeJhse",
- "name": "system"
+ "type": "instance",
+ "id": "AM9fD6dv2Ftc3Xjcsd7Uc",
+ "component": "@webstudio-is/sdk-components-react-radix:Accordion",
+ "children": [
+ {
+ "type": "id",
+ "value": "zJ927zk9txwUbYycKB7QA"
+ },
+ {
+ "type": "id",
+ "value": "C838wkvIcA1BQu30Xu2G8"
+ },
+ {
+ "type": "id",
+ "value": "65djoTmSBGemZ2L5izQ5M"
+ }
+ ]
}
],
[
- "8qqAbq6TEA3ccoCagjlZL",
- {
- "type": "parameter",
- "id": "8qqAbq6TEA3ccoCagjlZL",
- "scopeInstanceId": "L0ZXd5F9xk9Rsl9ORzIkJ",
- "name": "system"
- }
- ],
- [
- "8tTIagkgzmdy4T4qzKXqd",
- {
- "type": "parameter",
- "id": "8tTIagkgzmdy4T4qzKXqd",
- "scopeInstanceId": "MTUwXTcUJcWmr9iGvdcoH",
- "name": "system"
- }
- ],
- [
- "LYqm_7uq8W4T7BKky9zcj",
- {
- "type": "resource",
- "id": "LYqm_7uq8W4T7BKky9zcj",
- "scopeInstanceId": "MTUwXTcUJcWmr9iGvdcoH",
- "name": "jsonResourceVariable",
- "resourceId": "fjMzCru8O2U31xY2P1Ovr"
- }
- ],
- [
- "KqMdUAQ4YmObkN1ofVzeO",
- {
- "type": "variable",
- "id": "KqMdUAQ4YmObkN1ofVzeO",
- "scopeInstanceId": "MTUwXTcUJcWmr9iGvdcoH",
- "name": "jsonVar",
- "value": {
- "type": "json",
- "value": {
- "hello": "world"
- }
- }
- }
- ],
- [
- "5o_tom3ekCqphQfInC6NH",
- {
- "type": "parameter",
- "id": "5o_tom3ekCqphQfInC6NH",
- "scopeInstanceId": "mdyCS8QnKx3fL1MLXifmy",
- "name": "system"
- }
- ],
- [
- "FG6camSaR89vSBREAV9PT",
- {
- "type": "variable",
- "id": "FG6camSaR89vSBREAV9PT",
- "scopeInstanceId": "mdyCS8QnKx3fL1MLXifmy",
- "name": "classVar",
- "value": {
- "type": "string",
- "value": "varClass"
- }
- }
- ],
- [
- "NB_R8mrrGxFXCCsAtL8QK",
- {
- "type": "parameter",
- "id": "NB_R8mrrGxFXCCsAtL8QK",
- "scopeInstanceId": "z4Gp8noJpB4NS3JmdXh1Y",
- "name": "system"
- }
- ],
- [
- "2pjBK-2keQ15QSbnjLOk1",
- {
- "type": "parameter",
- "id": "2pjBK-2keQ15QSbnjLOk1",
- "scopeInstanceId": "zJkrskDJhaEk-nOSRWrGg",
- "name": "url"
- }
- ],
- [
- "F3zbkztYW_mJNC5EOkopM",
- {
- "type": "parameter",
- "id": "F3zbkztYW_mJNC5EOkopM",
- "scopeInstanceId": "-BW4QOi3PJTZ1sDCY8LW6",
- "name": "system"
- }
- ],
- [
- "XYfrcSJVN66CpmamKON1m",
- {
- "type": "parameter",
- "id": "XYfrcSJVN66CpmamKON1m",
- "scopeInstanceId": "1NipO5NmaHukA_dxzfVRF",
- "name": "system"
- }
- ],
- [
- "rKNaaGjEYnq4XPiTrSlfe",
- {
- "type": "variable",
- "id": "rKNaaGjEYnq4XPiTrSlfe",
- "scopeInstanceId": ":root",
- "name": "globalVariable",
- "value": {
- "type": "string",
- "value": "globalValue"
- }
- }
- ],
- [
- "BV-6Do0Ww17cqZ0zP7Io3",
- {
- "type": "resource",
- "id": "BV-6Do0Ww17cqZ0zP7Io3",
- "scopeInstanceId": "jVzCxkeTMBCb0S3JUhDsQ",
- "name": "assets",
- "resourceId": "oIYuHoIwG7GM5J9cCSsai"
- }
- ]
- ],
- "resources": [
- [
- "1vX6SQdaCjJN6MvJlG_cQ",
- {
- "id": "1vX6SQdaCjJN6MvJlG_cQ",
- "name": "list",
- "method": "get",
- "url": "\"https://gist.githubusercontent.com/TrySound/56507c301ec85669db5f1541406a9259/raw/a49548730ab592c86b9e7781f5b29beec4765494/collection.json\"",
- "headers": [],
- "body": ""
- }
- ],
- [
- "fjMzCru8O2U31xY2P1Ovr",
- {
- "id": "fjMzCru8O2U31xY2P1Ovr",
- "name": "jsonResourceVariable",
- "method": "get",
- "url": "\"https://httpbin.org/get?hello=world\"",
- "headers": []
- }
- ],
- [
- "oIYuHoIwG7GM5J9cCSsai",
- {
- "id": "oIYuHoIwG7GM5J9cCSsai",
- "name": "assets",
- "control": "system",
- "method": "get",
- "url": "\"/$resources/assets\"",
- "searchParams": [],
- "headers": []
- }
- ]
- ],
- "instances": [
- [
- "On9cvWCxr5rdZtY9O1Bv0",
- {
- "type": "instance",
- "id": "On9cvWCxr5rdZtY9O1Bv0",
- "component": "Body",
- "children": [
- {
- "type": "id",
- "value": "nVMWvMsaLCcb0o1wuNQgg"
- },
- {
- "type": "id",
- "value": "f0kF-WmL7DQg7MSyRvqY1"
- }
- ]
- }
- ],
- [
- "nVMWvMsaLCcb0o1wuNQgg",
- {
- "type": "instance",
- "id": "nVMWvMsaLCcb0o1wuNQgg",
- "component": "Heading",
- "children": [
- {
- "type": "text",
- "value": "DO NOT TOUCH THIS PROJECT, IT'S USED FOR FIXTURES"
- }
- ]
- }
- ],
- [
- "f0kF-WmL7DQg7MSyRvqY1",
- {
- "type": "instance",
- "id": "f0kF-WmL7DQg7MSyRvqY1",
- "component": "Box",
- "children": [
- {
- "type": "id",
- "value": "5XDbqPrZDeCwq4YJ3CHsc"
- },
- {
- "type": "id",
- "value": "qPnkiFGDj8dITWb1kmpGl"
- }
- ]
- }
- ],
- [
- "5XDbqPrZDeCwq4YJ3CHsc",
- {
- "type": "instance",
- "id": "5XDbqPrZDeCwq4YJ3CHsc",
- "component": "Box",
- "children": [
- {
- "type": "id",
- "value": "oLXYe1UQiVMhVnZGvJSMr"
- },
- {
- "type": "id",
- "value": "p34JHWcU6UNrd9FVnY80Q"
- },
- {
- "type": "id",
- "value": "Ol5bklKKxyJaS7Q3jcCfD"
- },
- {
- "type": "id",
- "value": "D8wLZzLWQfxH9uaKsn-0L"
- },
- {
- "type": "id",
- "value": "8AXawjUE3fJoOH_1qOAoq"
- },
- {
- "type": "id",
- "value": "82HYqzxZeahPxSDFNWem5"
- },
- {
- "type": "id",
- "value": "9I4GRU1sev48hREkQcKQ-"
- },
- {
- "type": "id",
- "value": "81ejLVXyFEV1SxiJrWhyw"
- }
- ]
- }
- ],
- [
- "qPnkiFGDj8dITWb1kmpGl",
- {
- "type": "instance",
- "id": "qPnkiFGDj8dITWb1kmpGl",
- "component": "Box",
- "children": [
- {
- "type": "id",
- "value": "pX1ovPI7NdC0HRjkw6Kpw"
- }
- ]
- }
- ],
- [
- "oLXYe1UQiVMhVnZGvJSMr",
- {
- "type": "instance",
- "id": "oLXYe1UQiVMhVnZGvJSMr",
- "component": "Heading",
- "children": [
- {
- "type": "text",
- "value": "Heading"
- }
- ]
- }
- ],
- [
- "p34JHWcU6UNrd9FVnY80Q",
- {
- "type": "instance",
- "id": "p34JHWcU6UNrd9FVnY80Q",
- "component": "Paragraph",
- "children": [
- {
- "type": "text",
- "value": "a little kitten painted in black and white gouache with a thick brush"
- }
- ]
- }
- ],
- [
- "pX1ovPI7NdC0HRjkw6Kpw",
- {
- "type": "instance",
- "id": "pX1ovPI7NdC0HRjkw6Kpw",
- "component": "Image",
- "children": []
- }
- ],
- [
- "uKWGyE9JY3cPwY-xI9vk6",
- {
- "type": "instance",
- "id": "uKWGyE9JY3cPwY-xI9vk6",
- "component": "Body",
- "children": [
- {
- "type": "id",
- "value": "AM9fD6dv2Ftc3Xjcsd7Uc"
- }
- ]
- }
- ],
- [
- "AM9fD6dv2Ftc3Xjcsd7Uc",
- {
- "type": "instance",
- "id": "AM9fD6dv2Ftc3Xjcsd7Uc",
- "component": "@webstudio-is/sdk-components-react-radix:Accordion",
- "children": [
- {
- "type": "id",
- "value": "zJ927zk9txwUbYycKB7QA"
- },
- {
- "type": "id",
- "value": "C838wkvIcA1BQu30Xu2G8"
- },
- {
- "type": "id",
- "value": "65djoTmSBGemZ2L5izQ5M"
- }
- ]
- }
- ],
- [
- "zJ927zk9txwUbYycKB7QA",
+ "zJ927zk9txwUbYycKB7QA",
{
"type": "instance",
"id": "zJ927zk9txwUbYycKB7QA",
@@ -6587,303 +6312,576 @@
}
],
[
- "tYYYhZkINGVL853ry_940",
+ "tYYYhZkINGVL853ry_940",
+ {
+ "type": "instance",
+ "id": "tYYYhZkINGVL853ry_940",
+ "component": "Box",
+ "label": "AnimCol",
+ "children": [
+ {
+ "type": "id",
+ "value": "ed6Q3Y2M1MXZf7E8rMwwW"
+ }
+ ]
+ }
+ ],
+ [
+ "ed6Q3Y2M1MXZf7E8rMwwW",
+ {
+ "type": "instance",
+ "id": "ed6Q3Y2M1MXZf7E8rMwwW",
+ "component": "@webstudio-is/sdk-components-animation:AnimateChildren",
+ "children": [
+ {
+ "type": "id",
+ "value": "GRj9UMUzk-HAWRctEcfFH"
+ }
+ ]
+ }
+ ],
+ [
+ "EHq0nc3KxVSs35jB5udcn",
+ {
+ "type": "instance",
+ "id": "EHq0nc3KxVSs35jB5udcn",
+ "component": "Box",
+ "children": [
+ {
+ "type": "text",
+ "value": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed tellus at nisi feugiat accumsan. Aliquam tristique vitae augue eget lacinia. "
+ }
+ ]
+ }
+ ],
+ [
+ "GRj9UMUzk-HAWRctEcfFH",
+ {
+ "type": "instance",
+ "id": "GRj9UMUzk-HAWRctEcfFH",
+ "component": "@webstudio-is/sdk-components-animation:AnimateText",
+ "children": [
+ {
+ "type": "id",
+ "value": "hi1l-ro0pCVQpHFIwIhFO"
+ },
+ {
+ "type": "id",
+ "value": "oRr8wiz8x-p2kEhV0zBnt"
+ }
+ ]
+ }
+ ],
+ [
+ "hi1l-ro0pCVQpHFIwIhFO",
+ {
+ "type": "instance",
+ "id": "hi1l-ro0pCVQpHFIwIhFO",
+ "component": "Heading",
+ "label": "Animated H0",
+ "children": [
+ {
+ "type": "text",
+ "value": "ANIMATED CHILD 1"
+ }
+ ]
+ }
+ ],
+ [
+ "oRr8wiz8x-p2kEhV0zBnt",
+ {
+ "type": "instance",
+ "id": "oRr8wiz8x-p2kEhV0zBnt",
+ "component": "Box",
+ "children": [
+ {
+ "type": "text",
+ "value": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed tellus at nisi feugiat accumsan. Aliquam tristique vitae augue eget lacinia. "
+ }
+ ]
+ }
+ ],
+ [
+ "81TW-o_0QLHlfmBAKFyCQ",
+ {
+ "type": "instance",
+ "id": "81TW-o_0QLHlfmBAKFyCQ",
+ "component": "Box",
+ "label": "Spacer",
+ "children": []
+ }
+ ],
+ [
+ "Lmn0VIRtr_Yn9AvDyjgZG",
+ {
+ "type": "instance",
+ "id": "Lmn0VIRtr_Yn9AvDyjgZG",
+ "component": "Body",
+ "children": [
+ {
+ "type": "id",
+ "value": "Iz65PDmd9YjqrIy5fGtWt"
+ }
+ ]
+ }
+ ],
+ [
+ "Iz65PDmd9YjqrIy5fGtWt",
+ {
+ "type": "instance",
+ "id": "Iz65PDmd9YjqrIy5fGtWt",
+ "component": "@webstudio-is/sdk-components-animation:AnimateChildren",
+ "children": [
+ {
+ "type": "id",
+ "value": "tOdjbQbLEf52thwmubL7R"
+ }
+ ]
+ }
+ ],
+ [
+ "tOdjbQbLEf52thwmubL7R",
+ {
+ "type": "instance",
+ "id": "tOdjbQbLEf52thwmubL7R",
+ "component": "Heading",
+ "children": [
+ {
+ "type": "text",
+ "value": "HELLO WORLD"
+ },
+ {
+ "type": "text",
+ "value": "\n"
+ },
+ {
+ "type": "text",
+ "value": "GOOD"
+ },
+ {
+ "type": "text",
+ "value": "\n"
+ },
+ {
+ "type": "text",
+ "value": "BAD"
+ },
+ {
+ "type": "text",
+ "value": "\n"
+ },
+ {
+ "type": "text",
+ "value": "UGLY"
+ }
+ ]
+ }
+ ],
+ [
+ "LTaU1Znm6P4yt3S8kAZi-",
{
"type": "instance",
- "id": "tYYYhZkINGVL853ry_940",
- "component": "Box",
- "label": "AnimCol",
+ "id": "LTaU1Znm6P4yt3S8kAZi-",
+ "component": "Body",
"children": [
{
"type": "id",
- "value": "ed6Q3Y2M1MXZf7E8rMwwW"
+ "value": "Z4ogkQT54jFVlCIFkXKmb"
}
]
}
],
[
- "ed6Q3Y2M1MXZf7E8rMwwW",
+ "Z4ogkQT54jFVlCIFkXKmb",
{
"type": "instance",
- "id": "ed6Q3Y2M1MXZf7E8rMwwW",
+ "id": "Z4ogkQT54jFVlCIFkXKmb",
"component": "@webstudio-is/sdk-components-animation:AnimateChildren",
"children": [
{
"type": "id",
- "value": "GRj9UMUzk-HAWRctEcfFH"
+ "value": "aqJaUhJ3xDmbIDws8d1TS"
}
]
}
],
[
- "EHq0nc3KxVSs35jB5udcn",
+ "aqJaUhJ3xDmbIDws8d1TS",
{
"type": "instance",
- "id": "EHq0nc3KxVSs35jB5udcn",
- "component": "Box",
+ "id": "aqJaUhJ3xDmbIDws8d1TS",
+ "component": "@webstudio-is/sdk-components-animation:AnimateText",
"children": [
{
- "type": "text",
- "value": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed tellus at nisi feugiat accumsan. Aliquam tristique vitae augue eget lacinia. "
+ "type": "id",
+ "value": "g__o13UKOkD0KImnp-sWp"
}
]
}
],
[
- "GRj9UMUzk-HAWRctEcfFH",
+ "g__o13UKOkD0KImnp-sWp",
{
"type": "instance",
- "id": "GRj9UMUzk-HAWRctEcfFH",
- "component": "@webstudio-is/sdk-components-animation:AnimateText",
+ "id": "g__o13UKOkD0KImnp-sWp",
+ "component": "Heading",
"children": [
{
- "type": "id",
- "value": "hi1l-ro0pCVQpHFIwIhFO"
+ "type": "text",
+ "value": "HELLO WORLD"
},
{
- "type": "id",
- "value": "oRr8wiz8x-p2kEhV0zBnt"
+ "type": "text",
+ "value": "\n"
+ },
+ {
+ "type": "text",
+ "value": "GOOD"
+ },
+ {
+ "type": "text",
+ "value": "\n"
+ },
+ {
+ "type": "text",
+ "value": "BAD"
+ },
+ {
+ "type": "text",
+ "value": "\n"
+ },
+ {
+ "type": "text",
+ "value": "UGLY"
}
]
}
],
[
- "hi1l-ro0pCVQpHFIwIhFO",
+ "Ol5bklKKxyJaS7Q3jcCfD",
{
"type": "instance",
- "id": "hi1l-ro0pCVQpHFIwIhFO",
- "component": "Heading",
- "label": "Animated H0",
+ "id": "Ol5bklKKxyJaS7Q3jcCfD",
+ "component": "ws:element",
+ "tag": "a",
"children": [
{
"type": "text",
- "value": "ANIMATED CHILD 1"
+ "value": "Click here to adore more kittens"
}
]
}
],
[
- "oRr8wiz8x-p2kEhV0zBnt",
+ "jVzCxkeTMBCb0S3JUhDsQ",
{
"type": "instance",
- "id": "oRr8wiz8x-p2kEhV0zBnt",
- "component": "Box",
+ "id": "jVzCxkeTMBCb0S3JUhDsQ",
+ "component": "ws:element",
+ "tag": "body",
"children": [
{
- "type": "text",
- "value": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed tellus at nisi feugiat accumsan. Aliquam tristique vitae augue eget lacinia. "
+ "type": "id",
+ "value": "a94S1sqeP8lT7aeVPBv6c"
+ },
+ {
+ "type": "id",
+ "value": "aAVR8Rg52_1qq8NV5rKKe"
}
]
}
],
[
- "81TW-o_0QLHlfmBAKFyCQ",
+ "a94S1sqeP8lT7aeVPBv6c",
{
"type": "instance",
- "id": "81TW-o_0QLHlfmBAKFyCQ",
- "component": "Box",
- "label": "Spacer",
+ "id": "a94S1sqeP8lT7aeVPBv6c",
+ "component": "ws:element",
+ "tag": "audio",
"children": []
}
],
[
- "Lmn0VIRtr_Yn9AvDyjgZG",
+ "aAVR8Rg52_1qq8NV5rKKe",
{
"type": "instance",
- "id": "Lmn0VIRtr_Yn9AvDyjgZG",
- "component": "Body",
- "children": [
- {
- "type": "id",
- "value": "Iz65PDmd9YjqrIy5fGtWt"
+ "id": "aAVR8Rg52_1qq8NV5rKKe",
+ "component": "ws:element",
+ "tag": "video",
+ "children": []
+ }
+ ]
+ ],
+ "dataSources": [
+ [
+ "RR_FthRebEUcAKUJIXl0j",
+ {
+ "type": "variable",
+ "id": "RR_FthRebEUcAKUJIXl0j",
+ "scopeInstanceId": "AM9fD6dv2Ftc3Xjcsd7Uc",
+ "name": "accordionValue",
+ "value": {
+ "type": "string",
+ "value": "0"
+ }
+ }
+ ],
+ [
+ "KvfuNNCNslj7nAGsD69Fl",
+ {
+ "type": "variable",
+ "id": "KvfuNNCNslj7nAGsD69Fl",
+ "scopeInstanceId": "isNSM3wXcnHFikwNPlEOL",
+ "name": "formState",
+ "value": {
+ "type": "string",
+ "value": "initial"
+ }
+ }
+ ],
+ [
+ "Ip0FRY7L24QrIMdtuMN5j",
+ {
+ "type": "variable",
+ "id": "Ip0FRY7L24QrIMdtuMN5j",
+ "scopeInstanceId": "-1RvizaBcVpHsjvnYxn1c",
+ "name": "formState",
+ "value": {
+ "type": "string",
+ "value": "initial"
+ }
+ }
+ ],
+ [
+ "PgXFOzhK1YDdnv2BuvlwR",
+ {
+ "type": "resource",
+ "id": "PgXFOzhK1YDdnv2BuvlwR",
+ "scopeInstanceId": "AWY2qZfpbykoiWELeJhse",
+ "name": "list",
+ "resourceId": "1vX6SQdaCjJN6MvJlG_cQ"
+ }
+ ],
+ [
+ "MShox7Ngja3P8_t6XGMBw",
+ {
+ "type": "parameter",
+ "id": "MShox7Ngja3P8_t6XGMBw",
+ "scopeInstanceId": "WGSZGPAhyIuWhM1DJ7HbZ",
+ "name": "collectionItem"
+ }
+ ],
+ [
+ "u9wtUkt2-E0RDaljl_I6E",
+ {
+ "type": "parameter",
+ "id": "u9wtUkt2-E0RDaljl_I6E",
+ "scopeInstanceId": "On9cvWCxr5rdZtY9O1Bv0",
+ "name": "system"
+ }
+ ],
+ [
+ "GqDH_PSDF_8QXqPW2A0un",
+ {
+ "type": "parameter",
+ "id": "GqDH_PSDF_8QXqPW2A0un",
+ "scopeInstanceId": "uKWGyE9JY3cPwY-xI9vk6",
+ "name": "system"
+ }
+ ],
+ [
+ "UiZtSC5BK8Ub-Ow7-XOdW",
+ {
+ "type": "parameter",
+ "id": "UiZtSC5BK8Ub-Ow7-XOdW",
+ "scopeInstanceId": "EDEfpMPRqDejthtwkH7ws",
+ "name": "system"
+ }
+ ],
+ [
+ "-CX9SNsPSue42RkfxjL8_",
+ {
+ "type": "parameter",
+ "id": "-CX9SNsPSue42RkfxjL8_",
+ "scopeInstanceId": "a-4nDFkaWy4px1fn38XWJ",
+ "name": "system"
+ }
+ ],
+ [
+ "Q6XrK4-ZZUdXsocdiWqVk",
+ {
+ "type": "parameter",
+ "id": "Q6XrK4-ZZUdXsocdiWqVk",
+ "scopeInstanceId": "O-ljaGZQ0iRNTlEshMkgE",
+ "name": "system"
+ }
+ ],
+ [
+ "keP0A66msOpEL6HbrC9OJ",
+ {
+ "type": "parameter",
+ "id": "keP0A66msOpEL6HbrC9OJ",
+ "scopeInstanceId": "AWY2qZfpbykoiWELeJhse",
+ "name": "system"
+ }
+ ],
+ [
+ "8qqAbq6TEA3ccoCagjlZL",
+ {
+ "type": "parameter",
+ "id": "8qqAbq6TEA3ccoCagjlZL",
+ "scopeInstanceId": "L0ZXd5F9xk9Rsl9ORzIkJ",
+ "name": "system"
+ }
+ ],
+ [
+ "8tTIagkgzmdy4T4qzKXqd",
+ {
+ "type": "parameter",
+ "id": "8tTIagkgzmdy4T4qzKXqd",
+ "scopeInstanceId": "MTUwXTcUJcWmr9iGvdcoH",
+ "name": "system"
+ }
+ ],
+ [
+ "LYqm_7uq8W4T7BKky9zcj",
+ {
+ "type": "resource",
+ "id": "LYqm_7uq8W4T7BKky9zcj",
+ "scopeInstanceId": "MTUwXTcUJcWmr9iGvdcoH",
+ "name": "jsonResourceVariable",
+ "resourceId": "fjMzCru8O2U31xY2P1Ovr"
+ }
+ ],
+ [
+ "KqMdUAQ4YmObkN1ofVzeO",
+ {
+ "type": "variable",
+ "id": "KqMdUAQ4YmObkN1ofVzeO",
+ "scopeInstanceId": "MTUwXTcUJcWmr9iGvdcoH",
+ "name": "jsonVar",
+ "value": {
+ "type": "json",
+ "value": {
+ "hello": "world"
}
- ]
+ }
}
],
[
- "Iz65PDmd9YjqrIy5fGtWt",
+ "5o_tom3ekCqphQfInC6NH",
{
- "type": "instance",
- "id": "Iz65PDmd9YjqrIy5fGtWt",
- "component": "@webstudio-is/sdk-components-animation:AnimateChildren",
- "children": [
- {
- "type": "id",
- "value": "tOdjbQbLEf52thwmubL7R"
- }
- ]
+ "type": "parameter",
+ "id": "5o_tom3ekCqphQfInC6NH",
+ "scopeInstanceId": "mdyCS8QnKx3fL1MLXifmy",
+ "name": "system"
}
],
[
- "tOdjbQbLEf52thwmubL7R",
+ "FG6camSaR89vSBREAV9PT",
{
- "type": "instance",
- "id": "tOdjbQbLEf52thwmubL7R",
- "component": "Heading",
- "children": [
- {
- "type": "text",
- "value": "HELLO WORLD"
- },
- {
- "type": "text",
- "value": "\n"
- },
- {
- "type": "text",
- "value": "GOOD"
- },
- {
- "type": "text",
- "value": "\n"
- },
- {
- "type": "text",
- "value": "BAD"
- },
- {
- "type": "text",
- "value": "\n"
- },
- {
- "type": "text",
- "value": "UGLY"
- }
- ]
+ "type": "variable",
+ "id": "FG6camSaR89vSBREAV9PT",
+ "scopeInstanceId": "mdyCS8QnKx3fL1MLXifmy",
+ "name": "classVar",
+ "value": {
+ "type": "string",
+ "value": "varClass"
+ }
}
],
[
- "LTaU1Znm6P4yt3S8kAZi-",
+ "NB_R8mrrGxFXCCsAtL8QK",
{
- "type": "instance",
- "id": "LTaU1Znm6P4yt3S8kAZi-",
- "component": "Body",
- "children": [
- {
- "type": "id",
- "value": "Z4ogkQT54jFVlCIFkXKmb"
- }
- ]
+ "type": "parameter",
+ "id": "NB_R8mrrGxFXCCsAtL8QK",
+ "scopeInstanceId": "z4Gp8noJpB4NS3JmdXh1Y",
+ "name": "system"
}
],
[
- "Z4ogkQT54jFVlCIFkXKmb",
+ "2pjBK-2keQ15QSbnjLOk1",
{
- "type": "instance",
- "id": "Z4ogkQT54jFVlCIFkXKmb",
- "component": "@webstudio-is/sdk-components-animation:AnimateChildren",
- "children": [
- {
- "type": "id",
- "value": "aqJaUhJ3xDmbIDws8d1TS"
- }
- ]
+ "type": "parameter",
+ "id": "2pjBK-2keQ15QSbnjLOk1",
+ "scopeInstanceId": "zJkrskDJhaEk-nOSRWrGg",
+ "name": "url"
}
],
[
- "aqJaUhJ3xDmbIDws8d1TS",
+ "F3zbkztYW_mJNC5EOkopM",
{
- "type": "instance",
- "id": "aqJaUhJ3xDmbIDws8d1TS",
- "component": "@webstudio-is/sdk-components-animation:AnimateText",
- "children": [
- {
- "type": "id",
- "value": "g__o13UKOkD0KImnp-sWp"
- }
- ]
+ "type": "parameter",
+ "id": "F3zbkztYW_mJNC5EOkopM",
+ "scopeInstanceId": "-BW4QOi3PJTZ1sDCY8LW6",
+ "name": "system"
}
],
[
- "g__o13UKOkD0KImnp-sWp",
+ "XYfrcSJVN66CpmamKON1m",
{
- "type": "instance",
- "id": "g__o13UKOkD0KImnp-sWp",
- "component": "Heading",
- "children": [
- {
- "type": "text",
- "value": "HELLO WORLD"
- },
- {
- "type": "text",
- "value": "\n"
- },
- {
- "type": "text",
- "value": "GOOD"
- },
- {
- "type": "text",
- "value": "\n"
- },
- {
- "type": "text",
- "value": "BAD"
- },
- {
- "type": "text",
- "value": "\n"
- },
- {
- "type": "text",
- "value": "UGLY"
- }
- ]
+ "type": "parameter",
+ "id": "XYfrcSJVN66CpmamKON1m",
+ "scopeInstanceId": "1NipO5NmaHukA_dxzfVRF",
+ "name": "system"
}
],
[
- "Ol5bklKKxyJaS7Q3jcCfD",
+ "rKNaaGjEYnq4XPiTrSlfe",
{
- "type": "instance",
- "id": "Ol5bklKKxyJaS7Q3jcCfD",
- "component": "ws:element",
- "tag": "a",
- "children": [
- {
- "type": "text",
- "value": "Click here to adore more kittens"
- }
- ]
+ "type": "variable",
+ "id": "rKNaaGjEYnq4XPiTrSlfe",
+ "scopeInstanceId": ":root",
+ "name": "globalVariable",
+ "value": {
+ "type": "string",
+ "value": "globalValue"
+ }
}
],
[
- "jVzCxkeTMBCb0S3JUhDsQ",
+ "BV-6Do0Ww17cqZ0zP7Io3",
{
- "type": "instance",
- "id": "jVzCxkeTMBCb0S3JUhDsQ",
- "component": "ws:element",
- "tag": "body",
- "children": [
- {
- "type": "id",
- "value": "a94S1sqeP8lT7aeVPBv6c"
- },
- {
- "type": "id",
- "value": "aAVR8Rg52_1qq8NV5rKKe"
- }
- ]
+ "type": "resource",
+ "id": "BV-6Do0Ww17cqZ0zP7Io3",
+ "scopeInstanceId": "jVzCxkeTMBCb0S3JUhDsQ",
+ "name": "assets",
+ "resourceId": "oIYuHoIwG7GM5J9cCSsai"
+ }
+ ]
+ ],
+ "resources": [
+ [
+ "1vX6SQdaCjJN6MvJlG_cQ",
+ {
+ "id": "1vX6SQdaCjJN6MvJlG_cQ",
+ "name": "list",
+ "method": "get",
+ "url": "\"https://gist.githubusercontent.com/TrySound/56507c301ec85669db5f1541406a9259/raw/a49548730ab592c86b9e7781f5b29beec4765494/collection.json\"",
+ "headers": [],
+ "body": ""
}
],
[
- "a94S1sqeP8lT7aeVPBv6c",
+ "fjMzCru8O2U31xY2P1Ovr",
{
- "type": "instance",
- "id": "a94S1sqeP8lT7aeVPBv6c",
- "component": "ws:element",
- "tag": "audio",
- "children": []
+ "id": "fjMzCru8O2U31xY2P1Ovr",
+ "name": "jsonResourceVariable",
+ "method": "get",
+ "url": "\"https://httpbin.org/get?hello=world\"",
+ "headers": []
}
],
[
- "aAVR8Rg52_1qq8NV5rKKe",
+ "oIYuHoIwG7GM5J9cCSsai",
{
- "type": "instance",
- "id": "aAVR8Rg52_1qq8NV5rKKe",
- "component": "ws:element",
- "tag": "video",
- "children": []
+ "id": "oIYuHoIwG7GM5J9cCSsai",
+ "name": "assets",
+ "control": "system",
+ "method": "get",
+ "url": "\"/$resources/assets\"",
+ "searchParams": [],
+ "headers": []
}
]
],
@@ -7222,72 +7220,72 @@
"assets": [
{
"id": "2b151fc7b4b0324e6ab78c40f72c7f59273f81fb1be3d08b3f9976428601b95e",
- "name": "e-mail-39993_vrxyjxQv3j67Krs62Vz7Y.mp3",
"projectId": "cddc1d44-af37-4cb6-a430-d300cf6f932d",
"size": 19680,
- "type": "file",
- "format": "mp3",
+ "name": "e-mail-39993_vrxyjxQv3j67Krs62Vz7Y.mp3",
"createdAt": "2026-01-14T01:59:48.958+00:00",
- "meta": {}
+ "format": "mp3",
+ "meta": {},
+ "type": "file"
},
{
"id": "4afe692f78ec0530e355a551a3860302c4478037db7b25a3bdae82c32c78634d",
- "name": "webm-example_2r_6VmRBjhAy3ldaqz0gk.webm",
"projectId": "cddc1d44-af37-4cb6-a430-d300cf6f932d",
"size": 901185,
- "type": "file",
- "format": "webm",
+ "name": "webm-example_2r_6VmRBjhAy3ldaqz0gk.webm",
"createdAt": "2026-01-14T02:59:19.806+00:00",
- "meta": {}
+ "format": "webm",
+ "meta": {},
+ "type": "file"
},
{
"id": "7cf5892080fa66b5e6175ffd2d27c304ee6b09ce1f21847a95000225ad1afa59",
- "name": "cat_silhouette_BDpTbUFSpVbfUWQZNxbBG.png",
"projectId": "cddc1d44-af37-4cb6-a430-d300cf6f932d",
"size": 268326,
- "type": "image",
- "format": "png",
+ "name": "cat_silhouette_BDpTbUFSpVbfUWQZNxbBG.png",
"createdAt": "2025-06-20T17:59:02.94+00:00",
+ "format": "png",
"meta": {
"width": 790,
"height": 786
- }
+ },
+ "type": "image"
},
{
"id": "9a8bc926-7804-4d3f-af81-69196b1d2ed8",
- "name": "small-avif-kitty_FnabJsioMWpBtXZSGf4DR.webp",
"projectId": "cddc1d44-af37-4cb6-a430-d300cf6f932d",
"size": 2906,
- "type": "image",
- "format": "webp",
+ "name": "small-avif-kitty_FnabJsioMWpBtXZSGf4DR.webp",
"createdAt": "2023-09-12T09:44:22.12+00:00",
+ "format": "webp",
"meta": {
"width": 100,
"height": 100
- }
+ },
+ "type": "image"
},
{
"id": "cbf6b1b052e52b256cef54a032a546bf43bf3f5441be4d1c5eeaabce26903d78",
- "name": "video_QamtUWsD-ShifhzZLoNIv_ald_1xtyEb3uHhFb7nCQa.mp4",
"projectId": "cddc1d44-af37-4cb6-a430-d300cf6f932d",
"size": 170479,
- "type": "file",
- "format": "mp4",
+ "name": "video_QamtUWsD-ShifhzZLoNIv_ald_1xtyEb3uHhFb7nCQa.mp4",
"createdAt": "2026-01-14T02:59:28.168+00:00",
- "meta": {}
+ "format": "mp4",
+ "meta": {},
+ "type": "file"
},
{
"id": "cd939c56-bcdd-4e64-bd9c-567a9bccd3da",
- "name": "_937084ed-a798-49fe-8664-df93a2af605e_uiBk3o6UWdqolyakMvQJ9.jpeg",
"projectId": "cddc1d44-af37-4cb6-a430-d300cf6f932d",
"size": 210614,
- "type": "image",
- "format": "jpeg",
+ "name": "_937084ed-a798-49fe-8664-df93a2af605e_uiBk3o6UWdqolyakMvQJ9.jpeg",
"createdAt": "2023-09-06T11:28:43.031+00:00",
+ "format": "jpeg",
"meta": {
"width": 1024,
"height": 1024
- }
+ },
+ "type": "image"
}
],
"user": {
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 2a45e7cec5..8b93141472 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -34,6 +34,7 @@
"@clack/prompts": "^0.10.0",
"@emotion/hash": "^0.9.2",
"@trpc/client": "^10.45.2",
+ "@webstudio-is/protocol": "workspace:*",
"@webstudio-is/project-migrations": "workspace:*",
"@webstudio-is/trpc-interface": "workspace:*",
"acorn": "^8.14.1",
diff --git a/packages/cli/src/asset-files.test.ts b/packages/cli/src/asset-files.test.ts
new file mode 100644
index 0000000000..1e3d6871bf
--- /dev/null
+++ b/packages/cli/src/asset-files.test.ts
@@ -0,0 +1,124 @@
+import { afterEach, beforeEach, expect, test, vi } from "vitest";
+import {
+ access,
+ mkdir,
+ mkdtemp,
+ readFile,
+ rm,
+ writeFile,
+} from "node:fs/promises";
+import { join } from "node:path";
+import { tmpdir } from "node:os";
+import type { Asset } from "@webstudio-is/sdk";
+import { getLocalAssetPath, materializeAssetFile } from "./asset-files";
+
+const originalCwd = process.cwd();
+let tempDir: string;
+
+const asset = {
+ id: "asset-1",
+ projectId: "project-1",
+ name: "image.png",
+ type: "image",
+ createdAt: "2024-01-01T00:00:00.000Z",
+ format: "png",
+ size: 6,
+ meta: { width: 1, height: 1 },
+} satisfies Asset;
+
+beforeEach(async () => {
+ tempDir = await mkdtemp(join(tmpdir(), "webstudio-assets-"));
+ process.chdir(tempDir);
+});
+
+afterEach(async () => {
+ process.chdir(originalCwd);
+ await rm(tempDir, { recursive: true, force: true });
+ vi.restoreAllMocks();
+});
+
+test("rejects asset paths outside the asset directory", () => {
+ expect(() => getLocalAssetPath("../image.png")).toThrow(
+ "Asset path escapes .webstudio/assets"
+ );
+ expect(() => getLocalAssetPath("folder\\image.png")).toThrow(
+ "Asset path escapes .webstudio/assets"
+ );
+});
+
+test("materializes asset files from the synced asset cache before fetching", async () => {
+ await mkdir(".webstudio/assets", { recursive: true });
+ await writeFile(".webstudio/assets/image.png", "synced", "utf8");
+ const fetch = vi.fn();
+ globalThis.fetch = fetch;
+
+ await materializeAssetFile({
+ asset,
+ origin: "https://example.com",
+ targetAssetsDirectory: "public/assets",
+ });
+
+ await expect(readFile("public/assets/image.png", "utf8")).resolves.toBe(
+ "synced"
+ );
+ expect(fetch).not.toHaveBeenCalled();
+});
+
+test("downloads asset files when they are missing from the synced asset cache", async () => {
+ const fetch = vi.fn(async () => new Response("downloaded"));
+ globalThis.fetch = fetch;
+
+ await materializeAssetFile({
+ asset,
+ origin: "https://example.com",
+ targetAssetsDirectory: "public/assets",
+ });
+
+ await expect(readFile("public/assets/image.png", "utf8")).resolves.toBe(
+ "downloaded"
+ );
+ expect(fetch).toHaveBeenCalledWith(
+ "https://example.com/cgi/image/image.png?format=raw"
+ );
+});
+
+test("removes temporary files when asset download fails", async () => {
+ const fetch = vi.fn(
+ async () =>
+ new Response(
+ new ReadableStream({
+ pull(controller) {
+ controller.error(new Error("download failed"));
+ },
+ })
+ )
+ );
+ globalThis.fetch = fetch;
+
+ await expect(
+ materializeAssetFile({
+ asset,
+ origin: "https://example.com",
+ targetAssetsDirectory: "public/assets",
+ })
+ ).rejects.toThrow("download failed");
+
+ await expect(access("public/assets/image.png")).rejects.toThrow();
+ await expect(access("public/assets/image.png.tmp")).rejects.toThrow();
+});
+
+test("fails clearly when asset download response has no body", async () => {
+ const fetch = vi.fn(async () => new Response(null));
+ globalThis.fetch = fetch;
+
+ await expect(
+ materializeAssetFile({
+ asset,
+ origin: "https://example.com",
+ targetAssetsDirectory: "public/assets",
+ })
+ ).rejects.toThrow("response body is empty");
+
+ await expect(access("public/assets/image.png")).rejects.toThrow();
+ await expect(access("public/assets/image.png.tmp")).rejects.toThrow();
+});
diff --git a/packages/cli/src/asset-files.ts b/packages/cli/src/asset-files.ts
new file mode 100644
index 0000000000..257344129a
--- /dev/null
+++ b/packages/cli/src/asset-files.ts
@@ -0,0 +1,203 @@
+import { constants, createWriteStream } from "node:fs";
+import { copyFile, readFile, rename, rm } from "node:fs/promises";
+import { dirname, resolve, sep } from "node:path";
+import { pipeline } from "node:stream/promises";
+import pLimit from "p-limit";
+import { getAssetUrl, type Asset } from "@webstudio-is/sdk";
+import { createFolderIfNotExists, isFileExists } from "./fs-utils";
+import { isAssetFileName, type AssetFileData } from "@webstudio-is/protocol";
+
+export const LOCAL_ASSETS_DIR = ".webstudio/assets";
+
+const limit = pLimit(10);
+
+const runAssetTasks = async ({
+ assets,
+ continueOnError = false,
+ operation,
+ task,
+}: {
+ assets: Asset[];
+ continueOnError?: boolean;
+ operation: string;
+ task: (asset: Asset) => Promise<void>;
+}) => {
+ await Promise.all(
+ assets.map((asset) =>
+ limit(async () => {
+ try {
+ await task(asset);
+ } catch (error) {
+ if (continueOnError) {
+ console.error(`Error ${operation} file ${asset.name} \n ${error}`);
+ return;
+ }
+ throw error;
+ }
+ })
+ )
+ );
+};
+
+export const getLocalAssetPath = (
+ assetName: string,
+ assetsDirectory = LOCAL_ASSETS_DIR
+) => {
+ if (isAssetFileName(assetName) === false) {
+ throw new Error(`Asset path escapes ${assetsDirectory}: ${assetName}`);
+ }
+ const basePath = resolve(assetsDirectory);
+ const assetPath = resolve(basePath, assetName);
+ if (assetPath !== basePath && assetPath.startsWith(`${basePath}${sep}`)) {
+ return assetPath;
+ }
+ throw new Error(`Asset path escapes ${assetsDirectory}: ${assetName}`);
+};
+
+const downloadUrlToFile = async (url: string, filePath: string) => {
+ const tempFilePath = `${filePath}.tmp`;
+
+ if (await isFileExists(filePath)) {
+ return;
+ }
+
+ await createFolderIfNotExists(dirname(filePath));
+
+ try {
+ const response = await fetch(url);
+ if (!response.ok) {
+ throw new Error(`Failed to fetch ${url}: ${response.statusText}`);
+ }
+ if (response.body === null) {
+ throw new Error(`Failed to fetch ${url}: response body is empty`);
+ }
+
+ const writableStream = createWriteStream(tempFilePath);
+ await pipeline(
+ response.body as unknown as NodeJS.ReadableStream,
+ writableStream
+ );
+
+ await rename(tempFilePath, filePath);
+ } catch (error) {
+ await rm(tempFilePath, { force: true });
+ throw error;
+ }
+};
+
+export const downloadAssetFile = async ({
+ asset,
+ assetsDirectory = LOCAL_ASSETS_DIR,
+ origin,
+}: {
+ asset: Asset;
+ assetsDirectory?: string;
+ origin: string;
+}) => {
+ await downloadUrlToFile(
+ getAssetUrl(asset, origin).href,
+ getLocalAssetPath(asset.name, assetsDirectory)
+ );
+};
+
+export const downloadAssetFiles = async ({
+ assets,
+ assetsDirectory = LOCAL_ASSETS_DIR,
+ continueOnError = false,
+ origin,
+}: {
+ assets: Asset[];
+ assetsDirectory?: string;
+ continueOnError?: boolean;
+ origin: string;
+}) => {
+ await runAssetTasks({
+ assets,
+ continueOnError,
+ operation: "downloading",
+ task: (asset) => downloadAssetFile({ asset, assetsDirectory, origin }),
+ });
+};
+
+export const materializeAssetFile = async ({
+ asset,
+ origin,
+ sourceAssetsDirectory = LOCAL_ASSETS_DIR,
+ targetAssetsDirectory,
+}: {
+ asset: Asset;
+ origin: string;
+ sourceAssetsDirectory?: string;
+ targetAssetsDirectory: string;
+}) => {
+ const targetPath = getLocalAssetPath(asset.name, targetAssetsDirectory);
+
+ if (await isFileExists(targetPath)) {
+ return;
+ }
+
+ await createFolderIfNotExists(dirname(targetPath));
+
+ const sourcePath = getLocalAssetPath(asset.name, sourceAssetsDirectory);
+ if (await isFileExists(sourcePath)) {
+ try {
+ await copyFile(sourcePath, targetPath, constants.COPYFILE_FICLONE);
+ } catch {
+ await copyFile(sourcePath, targetPath);
+ }
+ return;
+ }
+
+ await downloadAssetFile({
+ asset,
+ assetsDirectory: targetAssetsDirectory,
+ origin,
+ });
+};
+
+export const materializeAssetFiles = async ({
+ assets,
+ continueOnError = false,
+ origin,
+ sourceAssetsDirectory,
+ targetAssetsDirectory,
+}: {
+ assets: Asset[];
+ continueOnError?: boolean;
+ origin: string;
+ sourceAssetsDirectory?: string;
+ targetAssetsDirectory: string;
+}) => {
+ await runAssetTasks({
+ assets,
+ continueOnError,
+ operation: "materializing",
+ task: (asset) =>
+ materializeAssetFile({
+ asset,
+ origin,
+ sourceAssetsDirectory,
+ targetAssetsDirectory,
+ }),
+ });
+};
+
+export const loadAssetFiles = async ({
+ assets,
+ assetsDirectory = LOCAL_ASSETS_DIR,
+}: {
+ assets: Asset[];
+ assetsDirectory?: string;
+}): Promise<AssetFileData[]> => {
+ const files: AssetFileData[] = [];
+
+ for (const asset of assets) {
+ const data = await readFile(
+ getLocalAssetPath(asset.name, assetsDirectory),
+ "base64"
+ );
+ files.push({ name: asset.name, data });
+ }
+
+ return files;
+};
diff --git a/packages/cli/src/auth-config.test.ts b/packages/cli/src/auth-config.test.ts
new file mode 100644
index 0000000000..08e84ec831
--- /dev/null
+++ b/packages/cli/src/auth-config.test.ts
@@ -0,0 +1,104 @@
+import { existsSync, readdirSync, readFileSync } from "node:fs";
+import { dirname, join, resolve } from "node:path";
+import { fileURLToPath } from "node:url";
+import { describe, expect, test } from "vitest";
+import { createPublishedProjectBundleFixture } from "@webstudio-is/protocol/fixtures";
+import { migratePages } from "@webstudio-is/project-migrations/pages";
+import {
+ assertAuthConfigMatchesBundle,
+ createAuthConfigResources,
+ createAuthConfigContentFromBundle,
+ LOCAL_AUTH_FILE,
+} from "./auth-config";
+
+const root = resolve(dirname(fileURLToPath(import.meta.url)), "../../..");
+const fixturesRoot = join(root, "fixtures");
+
+const getFixtureBundleFiles = () =>
+ readdirSync(fixturesRoot, { withFileTypes: true })
+ .filter((entry) => entry.isDirectory())
+ .map((entry) => ({
+ fixtureName: entry.name,
+ authFile: join(fixturesRoot, entry.name, LOCAL_AUTH_FILE),
+ dataFile: join(fixturesRoot, entry.name, ".webstudio/data.json"),
+ }))
+ .filter(
+ ({ authFile, dataFile }) => existsSync(authFile) && existsSync(dataFile)
+ );
+
+describe("auth config", () => {
+ test("creates auth config content from bundle data", () => {
+ expect(
+ JSON.parse(
+ createAuthConfigContentFromBundle(createPublishedProjectBundleFixture())
+ )
+ ).toEqual({
+ version: 1,
+ routes: {},
+ });
+ });
+
+ test("skips pages without auth when creating auth resources", () => {
+ const pages = migratePages(
+ createPublishedProjectBundleFixture().build.pages
+ );
+ const page = pages.pages.get(pages.homePageId);
+ if (page === undefined) {
+ throw new Error("Home page is missing");
+ }
+ page.meta.auth = {
+ method: "basic",
+ login: "admin",
+ password: "secret",
+ };
+
+ expect(createAuthConfigResources(pages).routes).toEqual([
+ {
+ route: "/",
+ auth: {
+ method: "basic",
+ login: "admin",
+ password: "secret",
+ credentials: "admin:secret",
+ },
+ },
+ ]);
+ });
+
+ test("rejects malformed auth json", () => {
+ expect(() =>
+ assertAuthConfigMatchesBundle({
+ authFileContent: "{",
+ data: createPublishedProjectBundleFixture(),
+ })
+ ).toThrow(`${LOCAL_AUTH_FILE} is invalid JSON`);
+ });
+
+ test("rejects auth config content that does not match bundle data", () => {
+ expect(() =>
+ assertAuthConfigMatchesBundle({
+ authFileContent: JSON.stringify({
+ version: 1,
+ routes: {
+ "/private": {
+ method: "basic",
+ login: "admin",
+ password: "secret",
+ },
+ },
+ }),
+ data: createPublishedProjectBundleFixture(),
+ })
+ ).toThrow(`${LOCAL_AUTH_FILE} does not match .webstudio/data.json`);
+ });
+
+ test.each(getFixtureBundleFiles())(
+ "$fixtureName auth config matches bundle data",
+ ({ authFile, dataFile }) => {
+ assertAuthConfigMatchesBundle({
+ authFileContent: readFileSync(authFile, "utf8"),
+ data: JSON.parse(readFileSync(dataFile, "utf8")),
+ });
+ }
+ );
+});
diff --git a/packages/cli/src/auth-config.ts b/packages/cli/src/auth-config.ts
new file mode 100644
index 0000000000..9b59f97b78
--- /dev/null
+++ b/packages/cli/src/auth-config.ts
@@ -0,0 +1,65 @@
+import { readFile } from "node:fs/promises";
+import { isDeepStrictEqual } from "node:util";
+import { getAllPages, getPagePath, type Pages } from "@webstudio-is/sdk";
+import { createWsAuthResources } from "@webstudio-is/wsauth";
+import { migratePages } from "@webstudio-is/project-migrations/pages";
+import type { PublishedProjectBundle } from "@webstudio-is/protocol";
+
+export const LOCAL_AUTH_FILE = ".webstudio/auth.json";
+
+export const createAuthConfigResources = (pages: Pages) =>
+ createWsAuthResources({
+ projectContent: pages.meta?.auth,
+ pages: getAllPages(pages)
+ .filter((page) => page.meta.auth !== undefined)
+ .map((page) => ({
+ route: getPagePath(page.id, pages),
+ auth: page.meta.auth,
+ })),
+ });
+
+export const createAuthConfigContentFromBundle = (
+ data: Pick<PublishedProjectBundle, "build">
+) => createAuthConfigResources(migratePages(data.build.pages)).content;
+
+export const assertAuthConfigMatchesBundle = ({
+ authFileContent,
+ data,
+}: {
+ authFileContent: string;
+ data: Pick<PublishedProjectBundle, "build">;
+}) => {
+ let actual: unknown;
+ try {
+ actual = JSON.parse(authFileContent);
+ } catch {
+ throw new Error(`${LOCAL_AUTH_FILE} is invalid JSON`);
+ }
+
+ const expected = JSON.parse(createAuthConfigContentFromBundle(data));
+ if (isDeepStrictEqual(actual, expected) === false) {
+ throw new Error(`${LOCAL_AUTH_FILE} does not match .webstudio/data.json`);
+ }
+};
+
+export const validateAuthConfigFile = async ({
+ data,
+ filePath,
+}: {
+ data: Pick<PublishedProjectBundle, "build">;
+ filePath: string;
+}) => {
+ const authFileContent = await readFile(filePath, "utf8").catch((error) => {
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") {
+ return;
+ }
+ throw error;
+ });
+
+ if (authFileContent === undefined) {
+ return false;
+ }
+
+ assertAuthConfigMatchesBundle({ authFileContent, data });
+ return true;
+};
diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts
index 12e8430b3a..5ce8bbee1e 100644
--- a/packages/cli/src/cli.ts
+++ b/packages/cli/src/cli.ts
@@ -4,6 +4,7 @@ import { GLOBAL_CONFIG_FILE } from "./config";
import { createFileIfNotExists } from "./fs-utils";
import { link, linkOptions } from "./commands/link";
import { sync, syncOptions } from "./commands/sync";
+import { importOptions, importProject } from "./commands/import";
import { build, buildOptions } from "./commands/build";
import { initFlow } from "./commands/init-flow";
import makeCLI from "yargs";
@@ -58,6 +59,12 @@ export const main = async () => {
);
cmd.command(["link"], "Link the project with the cloud", linkOptions, link);
cmd.command(["sync"], "Sync your project", syncOptions, sync);
+ cmd.command(
+ ["import"],
+ "Import project bundle into another project",
+ importOptions,
+ importProject
+ );
cmd.command(["$0", "init"], "Setup the project", buildOptions, initFlow);
await cmd.parse();
diff --git a/packages/cli/src/commands/api.ts b/packages/cli/src/commands/api.ts
new file mode 100644
index 0000000000..0cd25d30cd
--- /dev/null
+++ b/packages/cli/src/commands/api.ts
@@ -0,0 +1,41 @@
+import { spinner } from "@clack/prompts";
+import {
+ apiClientHeader,
+ apiClientVersionHeader,
+ getApiCompatibilityPayload,
+} from "@webstudio-is/trpc-interface/api-compatibility";
+import packageJson from "../../package.json";
+
+export const apiCompatibilityHeaders = {
+ [apiClientHeader]: "cli",
+ [apiClientVersionHeader]: packageJson.version,
+};
+
+const updateCliCommand = "npm install -g webstudio@latest";
+
+const getCliCompatibilityMessage = (error: unknown, command: string) => {
+ const payload = getApiCompatibilityPayload(error);
+ if (payload?.action.type !== "updateCli") {
+ return;
+ }
+
+ return `${payload.message}
+
+Update the CLI with:
+ ${updateCliCommand}
+
+Or run the latest version once with:
+ npx webstudio@latest ${command}`;
+};
+
+export const stopSpinnerWithError = (
+ indicator: ReturnType<typeof spinner>,
+ error: unknown,
+ fallbackMessage: string,
+ command: string
+) => {
+ const compatibilityMessage = getCliCompatibilityMessage(error, command);
+ const message = error instanceof Error ? error.message : fallbackMessage;
+ indicator.stop(compatibilityMessage ?? message, 2);
+ return compatibilityMessage;
+};
diff --git a/packages/cli/src/commands/import.test.ts b/packages/cli/src/commands/import.test.ts
new file mode 100644
index 0000000000..f7ac22d3d0
--- /dev/null
+++ b/packages/cli/src/commands/import.test.ts
@@ -0,0 +1,552 @@
+import { afterEach, beforeEach, expect, test, vi } from "vitest";
+import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
+import { join } from "node:path";
+import { tmpdir } from "node:os";
+import makeCLI from "yargs";
+import { createApiCompatibilityPayload } from "@webstudio-is/trpc-interface/api-compatibility";
+import { bundleVersion } from "@webstudio-is/protocol";
+import {
+ createImageAssetFixture,
+ createPublishedProjectBundleFixture,
+} from "@webstudio-is/protocol/fixtures";
+import { loadJSONFile } from "../fs-utils";
+import { loadAssetFiles } from "../asset-files";
+import {
+ createAuthConfigContentFromBundle,
+ LOCAL_AUTH_FILE,
+} from "../auth-config";
+import { importOptions, importProject } from "./import";
+import type { CommonYargsArgv } from "./yargs-types";
+
+const originalCwd = process.cwd();
+let tempDir: string;
+const destinationProjectId = "090e6e14-ae50-4b2e-bd22-71733cec05bb";
+const destinationShareLink = `https://p-${destinationProjectId}-dot-example.com/?authToken=token-1`;
+const destinationRequest = {
+ projectId: destinationProjectId,
+ authToken: "token-1",
+ origin: "https://example.com",
+ headers: expect.objectContaining({
+ "x-webstudio-client": "cli",
+ }),
+};
+const imageAsset = createImageAssetFixture({
+ size: 5,
+ meta: { width: 1, height: 1 },
+});
+const log = {
+ info: vi.fn(),
+};
+const indicator = {
+ start: vi.fn(),
+ message: vi.fn(),
+ stop: vi.fn(),
+};
+const checkProjectBuildPermission = vi.fn();
+const importProjectBundle = vi.fn();
+const promptText = vi.fn();
+const dependencies = {
+ checkProjectBuildPermission,
+ importProjectBundle,
+ loadAssetFiles,
+ loadJSONFile,
+ text: promptText,
+ isInteractive: false,
+ log,
+ spinner: () => indicator,
+};
+
+const createSyncedData = (data = {}) =>
+ createPublishedProjectBundleFixture({
+ assets: [],
+ projectDomain: "example.com",
+ ...data,
+ });
+
+const writeSyncedData = async (data = {}) => {
+ const syncedData = createSyncedData(data);
+ await writeFile(".webstudio/data.json", JSON.stringify(syncedData), "utf8");
+ return syncedData;
+};
+
+beforeEach(async () => {
+ tempDir = await mkdtemp(join(tmpdir(), "webstudio-import-"));
+ process.chdir(tempDir);
+ await mkdir(".webstudio", { recursive: true });
+ checkProjectBuildPermission.mockResolvedValue(undefined);
+ importProjectBundle.mockResolvedValue({ version: 1 });
+ promptText.mockResolvedValue(destinationShareLink);
+ checkProjectBuildPermission.mockClear();
+ promptText.mockClear();
+ log.info.mockClear();
+ indicator.start.mockClear();
+ indicator.message.mockClear();
+ indicator.stop.mockClear();
+});
+
+afterEach(async () => {
+ process.chdir(originalCwd);
+ await rm(tempDir, { recursive: true, force: true });
+ vi.clearAllMocks();
+});
+
+test("imports local synced data into destination project", async () => {
+ await writeSyncedData();
+
+ await importProject({ to: destinationShareLink }, dependencies);
+
+ expect(checkProjectBuildPermission).toHaveBeenCalledWith(destinationRequest);
+ expect(importProjectBundle).toHaveBeenCalledWith({
+ ...destinationRequest,
+ data: createSyncedData(),
+ assetFiles: [],
+ ignoreVersionCheck: undefined,
+ });
+ expect(indicator.stop).toHaveBeenCalledWith(
+ "Project bundle imported successfully"
+ );
+ expect(indicator.message).toHaveBeenCalledWith(
+ "Reading .webstudio/data.json"
+ );
+ expect(log.info).toHaveBeenCalledWith("Read .webstudio/data.json");
+ expect(log.info).toHaveBeenCalledWith(
+ `Destination project: ${destinationProjectId}`
+ );
+ expect(log.info).toHaveBeenCalledWith(
+ "Destination origin: https://example.com"
+ );
+ expect(indicator.message).toHaveBeenCalledWith(
+ "Checking destination build permission"
+ );
+ expect(indicator.message).toHaveBeenCalledWith(
+ `Waiting for API response while importing into ${destinationProjectId}`
+ );
+});
+
+test("prompts for destination share link when running interactively", async () => {
+ await writeSyncedData();
+
+ await importProject(
+ {},
+ {
+ ...dependencies,
+ isInteractive: true,
+ }
+ );
+
+ expect(promptText).toHaveBeenCalledWith({
+ message: "Please paste a destination share link with build permissions",
+ validate: expect.any(Function),
+ });
+ expect(checkProjectBuildPermission).toHaveBeenCalledWith(
+ expect.objectContaining({
+ projectId: destinationProjectId,
+ authToken: "token-1",
+ origin: "https://example.com",
+ })
+ );
+ expect(importProjectBundle).toHaveBeenCalledWith(
+ expect.objectContaining({
+ projectId: destinationProjectId,
+ })
+ );
+});
+
+test("stops when destination share link is missing in non-interactive mode", async () => {
+ const loadJSONFile = vi.fn();
+
+ await expect(
+ importProject(
+ {},
+ {
+ ...dependencies,
+ loadJSONFile,
+ }
+ )
+ ).rejects.toThrow("Handled CLI error");
+
+ expect(loadJSONFile).not.toHaveBeenCalled();
+ expect(promptText).not.toHaveBeenCalled();
+ expect(checkProjectBuildPermission).not.toHaveBeenCalled();
+ expect(importProjectBundle).not.toHaveBeenCalled();
+ expect(indicator.stop).toHaveBeenCalledWith(
+ "Please specify a destination share link with --to",
+ 2
+ );
+});
+
+test("requires destination share link before running non-interactive command", async () => {
+ const parser = importOptions(
+ makeCLI([])
+ .exitProcess(false)
+ .fail((message, error) => {
+ throw error ?? new Error(message);
+ }) as CommonYargsArgv
+ );
+
+ expect(() => parser.parse([])).toThrow(
+ "Please specify a destination share link with --to"
+ );
+});
+
+test("stops with sync instruction when local data is missing", async () => {
+ await expect(
+ importProject(
+ {
+ to: destinationShareLink,
+ },
+ dependencies
+ )
+ ).rejects.toThrow("Handled CLI error");
+
+ expect(importProjectBundle).not.toHaveBeenCalled();
+ expect(checkProjectBuildPermission).not.toHaveBeenCalled();
+ expect(indicator.stop).toHaveBeenCalledWith(
+ "Project bundle is missing. Please run webstudio sync before importing.",
+ 2
+ );
+});
+
+test("stops with invalid data message when local data is malformed JSON", async () => {
+ await writeFile(".webstudio/data.json", "{", "utf8");
+
+ await expect(
+ importProject(
+ {
+ to: destinationShareLink,
+ },
+ dependencies
+ )
+ ).rejects.toThrow("Handled CLI error");
+
+ expect(importProjectBundle).not.toHaveBeenCalled();
+ expect(checkProjectBuildPermission).not.toHaveBeenCalled();
+ expect(indicator.stop).toHaveBeenCalledWith(
+ "Project bundle is invalid. Please run webstudio sync before importing.",
+ 2
+ );
+});
+
+test("does not prompt for destination when local data is missing", async () => {
+ await expect(
+ importProject(
+ {},
+ {
+ ...dependencies,
+ isInteractive: true,
+ }
+ )
+ ).rejects.toThrow("Handled CLI error");
+
+ expect(promptText).not.toHaveBeenCalled();
+ expect(checkProjectBuildPermission).not.toHaveBeenCalled();
+ expect(importProjectBundle).not.toHaveBeenCalled();
+ expect(indicator.stop).toHaveBeenCalledWith(
+ "Project bundle is missing. Please run webstudio sync before importing.",
+ 2
+ );
+});
+
+test("stops before API request when local data is from old format", async () => {
+ await writeSyncedData({ bundleVersion: undefined });
+
+ await expect(
+ importProject(
+ {
+ to: destinationShareLink,
+ },
+ dependencies
+ )
+ ).rejects.toThrow("Handled CLI error");
+
+ expect(importProjectBundle).not.toHaveBeenCalled();
+ expect(checkProjectBuildPermission).not.toHaveBeenCalled();
+ expect(indicator.stop).toHaveBeenCalledWith(
+ `Project bundle format is incompatible. Expected version ${bundleVersion}, received missing. Sync with a compatible API/CLI version and retry, or pass --ignore-version-check if you know the source and target data formats are compatible.`,
+ 2
+ );
+});
+
+test("imports old local data when version check is explicitly ignored", async () => {
+ await writeSyncedData({ bundleVersion: undefined });
+
+ await importProject(
+ {
+ to: destinationShareLink,
+ ignoreVersionCheck: true,
+ },
+ dependencies
+ );
+
+ expect(importProjectBundle).toHaveBeenCalledWith(
+ expect.objectContaining({
+ ignoreVersionCheck: true,
+ data: createSyncedData({ bundleVersion: undefined }),
+ assetFiles: [],
+ })
+ );
+ expect(indicator.stop).toHaveBeenCalledWith(
+ "Project bundle imported successfully"
+ );
+});
+
+test("stops before API request when ignored-version data is missing assets", async () => {
+ await writeSyncedData({
+ assets: undefined,
+ bundleVersion: undefined,
+ });
+
+ await expect(
+ importProject(
+ {
+ to: destinationShareLink,
+ ignoreVersionCheck: true,
+ },
+ dependencies
+ )
+ ).rejects.toThrow("Handled CLI error");
+
+ expect(checkProjectBuildPermission).not.toHaveBeenCalled();
+ expect(importProjectBundle).not.toHaveBeenCalled();
+ expect(indicator.stop).toHaveBeenCalledWith(
+ "Project bundle is invalid. Please run webstudio sync before importing. Invalid fields: assets: Required",
+ 2
+ );
+});
+
+test("stops before API request when ignored-version data is missing published metadata", async () => {
+ await writeSyncedData({
+ projectTitle: undefined,
+ bundleVersion: undefined,
+ });
+
+ await expect(
+ importProject(
+ {
+ to: destinationShareLink,
+ ignoreVersionCheck: true,
+ },
+ dependencies
+ )
+ ).rejects.toThrow("Handled CLI error");
+
+ expect(checkProjectBuildPermission).not.toHaveBeenCalled();
+ expect(importProjectBundle).not.toHaveBeenCalled();
+ expect(indicator.stop).toHaveBeenCalledWith(
+ "Project bundle is invalid. Please run webstudio sync before importing. Invalid fields: projectTitle: Required",
+ 2
+ );
+});
+
+test("passes version-check bypass to target API", async () => {
+ await writeSyncedData();
+
+ await importProject(
+ {
+ to: destinationShareLink,
+ ignoreVersionCheck: true,
+ },
+ dependencies
+ );
+
+ expect(importProjectBundle).toHaveBeenCalledWith(
+ expect.objectContaining({
+ ignoreVersionCheck: true,
+ })
+ );
+});
+
+test("loads local asset files for import", async () => {
+ await mkdir(".webstudio/assets", { recursive: true });
+ await writeSyncedData({
+ assets: [imageAsset],
+ });
+ await writeFile(".webstudio/assets/image.png", "hello", "utf8");
+
+ await importProject({ to: destinationShareLink }, dependencies);
+
+ expect(importProjectBundle).toHaveBeenCalledWith(
+ expect.objectContaining({
+ assetFiles: [{ name: "image.png", data: "aGVsbG8=" }],
+ })
+ );
+});
+
+test("validates exported auth config before importing", async () => {
+ const syncedData = await writeSyncedData();
+ await writeFile(
+ LOCAL_AUTH_FILE,
+ createAuthConfigContentFromBundle(syncedData),
+ "utf8"
+ );
+
+ await importProject({ to: destinationShareLink }, dependencies);
+
+ expect(importProjectBundle).toHaveBeenCalledWith(
+ expect.objectContaining({
+ data: syncedData,
+ })
+ );
+ expect(log.info).toHaveBeenCalledWith(`Read ${LOCAL_AUTH_FILE}`);
+});
+
+test("stops before API request when exported auth config is malformed", async () => {
+ await writeSyncedData();
+ await writeFile(LOCAL_AUTH_FILE, "{", "utf8");
+
+ await expect(
+ importProject({ to: destinationShareLink }, dependencies)
+ ).rejects.toThrow("Handled CLI error");
+
+ expect(checkProjectBuildPermission).not.toHaveBeenCalled();
+ expect(importProjectBundle).not.toHaveBeenCalled();
+ expect(indicator.stop).toHaveBeenCalledWith(
+ `Project bundle auth config is invalid. Please run webstudio prebuild before importing. ${LOCAL_AUTH_FILE} is invalid JSON`,
+ 2
+ );
+});
+
+test("stops before API request when exported auth config does not match data", async () => {
+ await writeSyncedData();
+ await writeFile(
+ LOCAL_AUTH_FILE,
+ JSON.stringify({
+ version: 1,
+ routes: {
+ "/private": {
+ method: "basic",
+ login: "admin",
+ password: "secret",
+ },
+ },
+ }),
+ "utf8"
+ );
+
+ await expect(
+ importProject({ to: destinationShareLink }, dependencies)
+ ).rejects.toThrow("Handled CLI error");
+
+ expect(checkProjectBuildPermission).not.toHaveBeenCalled();
+ expect(importProjectBundle).not.toHaveBeenCalled();
+ expect(indicator.stop).toHaveBeenCalledWith(
+ `Project bundle auth config is invalid. Please run webstudio prebuild before importing. ${LOCAL_AUTH_FILE} does not match .webstudio/data.json`,
+ 2
+ );
+});
+
+test("stops before API request when destination link is invalid", async () => {
+ await writeSyncedData();
+
+ await expect(
+ importProject(
+ {
+ to: "https://example.com",
+ },
+ dependencies
+ )
+ ).rejects.toThrow("Handled CLI error");
+
+ expect(importProjectBundle).not.toHaveBeenCalled();
+ expect(checkProjectBuildPermission).not.toHaveBeenCalled();
+ expect(indicator.stop).toHaveBeenCalledWith(
+ "Destination share link is invalid.",
+ 2
+ );
+});
+
+test("stops before API request when current local data is malformed", async () => {
+ await writeSyncedData({ assets: undefined });
+
+ await expect(
+ importProject(
+ {
+ to: destinationShareLink,
+ },
+ dependencies
+ )
+ ).rejects.toThrow("Handled CLI error");
+
+ expect(checkProjectBuildPermission).not.toHaveBeenCalled();
+ expect(importProjectBundle).not.toHaveBeenCalled();
+ expect(indicator.stop).toHaveBeenCalledWith(
+ "Project bundle is invalid. Please run webstudio sync before importing. Invalid fields: assets: Required",
+ 2
+ );
+});
+
+test("stops before API request when current local data is missing published metadata", async () => {
+ await writeSyncedData({ projectTitle: undefined });
+
+ await expect(
+ importProject(
+ {
+ to: destinationShareLink,
+ },
+ dependencies
+ )
+ ).rejects.toThrow("Handled CLI error");
+
+ expect(checkProjectBuildPermission).not.toHaveBeenCalled();
+ expect(importProjectBundle).not.toHaveBeenCalled();
+ expect(indicator.stop).toHaveBeenCalledWith(
+ "Project bundle is invalid. Please run webstudio sync before importing. Invalid fields: projectTitle: Required",
+ 2
+ );
+});
+
+test("stops before reading asset files when destination permission check fails", async () => {
+ await writeSyncedData({
+ assets: [imageAsset],
+ });
+ const loadAssetFiles = vi.fn();
+ checkProjectBuildPermission.mockRejectedValue(
+ new Error("You don't have permission to build this project")
+ );
+
+ await expect(
+ importProject(
+ {
+ to: destinationShareLink,
+ },
+ {
+ ...dependencies,
+ loadAssetFiles,
+ }
+ )
+ ).rejects.toThrow("Handled CLI error");
+
+ expect(checkProjectBuildPermission).toHaveBeenCalledWith(destinationRequest);
+ expect(loadAssetFiles).not.toHaveBeenCalled();
+ expect(importProjectBundle).not.toHaveBeenCalled();
+ expect(indicator.stop).toHaveBeenCalledWith(
+ "You don't have permission to build this project",
+ 2
+ );
+});
+
+test("prints import command in CLI compatibility guidance", async () => {
+ await writeSyncedData();
+ importProjectBundle.mockRejectedValue(
+ new Error("Version mismatch", {
+ cause: createApiCompatibilityPayload({
+ reason: "apiProcedureNotFound",
+ target: "cli",
+ }),
+ })
+ );
+
+ await expect(
+ importProject(
+ {
+ to: destinationShareLink,
+ },
+ dependencies
+ )
+ ).rejects.toThrow("Handled CLI error");
+
+ expect(indicator.stop).toHaveBeenCalledWith(
+ expect.stringContaining("npx webstudio@latest import"),
+ 2
+ );
+});
diff --git a/packages/cli/src/commands/import.ts b/packages/cli/src/commands/import.ts
new file mode 100644
index 0000000000..63b366d221
--- /dev/null
+++ b/packages/cli/src/commands/import.ts
@@ -0,0 +1,252 @@
+import { cwd, stdin, stdout } from "node:process";
+import { join } from "node:path";
+import { cancel, isCancel, log, spinner, text } from "@clack/prompts";
+import {
+ getBundleVersion,
+ getBundleVersionMismatchMessage,
+ publishedProjectBundleSchema,
+ bundleVersion,
+} from "@webstudio-is/protocol";
+import {
+ checkProjectBuildPermission,
+ importProjectBundle,
+} from "@webstudio-is/http-client";
+import { LOCAL_DATA_FILE } from "../config";
+import { loadJSONFile } from "../fs-utils";
+import { HandledCliError } from "../errors";
+import { loadAssetFiles } from "../asset-files";
+import { LOCAL_AUTH_FILE, validateAuthConfigFile } from "../auth-config";
+import { apiCompatibilityHeaders, stopSpinnerWithError } from "./api";
+import { parseShareLink, validateShareLink } from "./link";
+import { formatZodIssues } from "../zod-utils";
+import type {
+ CommonYargsArgv,
+ StrictYargsOptionsToInterface,
+} from "./yargs-types";
+
+type ImportProjectDependencies = {
+ checkProjectBuildPermission: typeof checkProjectBuildPermission;
+ importProjectBundle: typeof importProjectBundle;
+ loadAssetFiles: typeof loadAssetFiles;
+ loadJSONFile: typeof loadJSONFile;
+ text: typeof text;
+ isInteractive: boolean;
+ log: Pick<typeof log, "info">;
+ spinner: typeof spinner;
+};
+
+const isInteractiveTerminal = () =>
+ stdin.isTTY === true && stdout.isTTY === true;
+
+const defaultDependencies: ImportProjectDependencies = {
+ checkProjectBuildPermission,
+ importProjectBundle,
+ loadAssetFiles,
+ loadJSONFile,
+ text,
+ isInteractive: isInteractiveTerminal(),
+ log,
+ spinner,
+};
+
+const missingDestinationMessage =
+ "Please specify a destination share link with --to";
+const missingProjectBundleMessage =
+ "Project bundle is missing. Please run webstudio sync before importing.";
+const invalidProjectBundleMessage =
+ "Project bundle is invalid. Please run webstudio sync before importing.";
+const invalidAuthConfigMessage =
+ "Project bundle auth config is invalid. Please run webstudio prebuild before importing.";
+const invalidDestinationMessage = "Destination share link is invalid.";
+
+export const importOptions = (yargs: CommonYargsArgv) =>
+ yargs
+ .option("to", {
+ type: "string",
+ describe: "Share link with build permissions to import synced data into",
+ })
+ .option("ignore-version-check", {
+ type: "boolean",
+ describe:
+ "Import data without a compatible data version; import may fail if source and target API data formats differ",
+ })
+ .check((options) => {
+ if (options.to === undefined && isInteractiveTerminal() === false) {
+ return missingDestinationMessage;
+ }
+ return true;
+ });
+
+type ImportOptions = Pick<
+ Partial<StrictYargsOptionsToInterface<typeof importOptions>>,
+ "ignoreVersionCheck"
+> & {
+ to?: string;
+};
+
+export const importProject = async (
+ options: ImportOptions,
+ dependencies = defaultDependencies
+) => {
+ const importing = dependencies.spinner();
+ importing.start("Importing project bundle");
+
+ if (options.to === undefined && dependencies.isInteractive === false) {
+ importing.stop(missingDestinationMessage, 2);
+ throw new HandledCliError();
+ }
+
+ importing.message(`Reading ${LOCAL_DATA_FILE}`);
+
+ let data: unknown | null;
+ try {
+ data = await dependencies.loadJSONFile<unknown>(
+ join(cwd(), LOCAL_DATA_FILE)
+ );
+ } catch {
+ importing.stop(invalidProjectBundleMessage, 2);
+ throw new HandledCliError();
+ }
+ if (data === null) {
+ importing.stop(missingProjectBundleMessage, 2);
+ throw new HandledCliError();
+ }
+ const localBundleVersion = getBundleVersion(data);
+ if (
+ localBundleVersion !== bundleVersion &&
+ options.ignoreVersionCheck !== true
+ ) {
+ importing.stop(
+ getBundleVersionMismatchMessage({
+ ignoreVersionCheckHint:
+ "pass --ignore-version-check if you know the source and target data formats are compatible",
+ receivedVersion: localBundleVersion,
+ }),
+ 2
+ );
+ throw new HandledCliError();
+ }
+ const parsedData = publishedProjectBundleSchema.safeParse(data);
+ if (parsedData.success === false) {
+ importing.stop(
+ `${invalidProjectBundleMessage} Invalid fields: ${formatZodIssues(
+ parsedData.error.issues
+ )}`,
+ 2
+ );
+ throw new HandledCliError();
+ }
+ const importData = parsedData.data;
+
+ importing.message(`Reading ${LOCAL_AUTH_FILE}`);
+ try {
+ if (
+ await validateAuthConfigFile({
+ data: importData,
+ filePath: join(cwd(), LOCAL_AUTH_FILE),
+ })
+ ) {
+ dependencies.log.info(`Read ${LOCAL_AUTH_FILE}`);
+ }
+ } catch (error) {
+ importing.stop(
+ error instanceof Error
+ ? `${invalidAuthConfigMessage} ${error.message}`
+ : invalidAuthConfigMessage,
+ 2
+ );
+ throw new HandledCliError();
+ }
+
+ let destinationShareLink = options.to;
+ if (
+ destinationShareLink === undefined &&
+ dependencies.isInteractive === true
+ ) {
+ importing.stop(`Read ${LOCAL_DATA_FILE}`);
+ const shareLink = await dependencies.text({
+ message: "Please paste a destination share link with build permissions",
+ validate: validateShareLink,
+ });
+ if (isCancel(shareLink)) {
+ cancel("Project import is cancelled");
+ throw new HandledCliError();
+ }
+ destinationShareLink = shareLink;
+ importing.start("Importing project bundle");
+ }
+ if (destinationShareLink === undefined) {
+ importing.stop(missingDestinationMessage, 2);
+ throw new HandledCliError();
+ }
+
+ let destination;
+ try {
+ destination = parseShareLink(destinationShareLink);
+ } catch {
+ importing.stop(invalidDestinationMessage, 2);
+ throw new HandledCliError();
+ }
+
+ dependencies.log.info(`Read ${LOCAL_DATA_FILE}`);
+ dependencies.log.info(`Destination project: ${destination.projectId}`);
+ dependencies.log.info(`Destination origin: ${destination.origin}`);
+ const destinationRequest = {
+ projectId: destination.projectId,
+ authToken: destination.token,
+ origin: destination.origin,
+ headers: apiCompatibilityHeaders,
+ };
+
+ importing.message("Checking destination build permission");
+ try {
+ await dependencies.checkProjectBuildPermission(destinationRequest);
+ } catch (error) {
+ stopSpinnerWithError(
+ importing,
+ error,
+ "Unable to check destination build permission",
+ "import"
+ );
+ throw new HandledCliError();
+ }
+
+ importing.message(`Reading ${importData.assets.length} local asset files`);
+ let assetFiles;
+ try {
+ assetFiles = await dependencies.loadAssetFiles({
+ assets: importData.assets,
+ });
+ } catch (error) {
+ importing.stop(
+ error instanceof Error
+ ? `Unable to read project bundle asset files: ${error.message}`
+ : "Unable to read project bundle asset files",
+ 2
+ );
+ throw new HandledCliError();
+ }
+
+ importing.message(
+ `Waiting for API response while importing into ${destination.projectId}`
+ );
+
+ try {
+ await dependencies.importProjectBundle({
+ ...destinationRequest,
+ data: importData,
+ assetFiles,
+ ignoreVersionCheck: options.ignoreVersionCheck,
+ });
+ } catch (error) {
+ stopSpinnerWithError(
+ importing,
+ error,
+ "Unable to import project bundle",
+ "import"
+ );
+ throw new HandledCliError();
+ }
+
+ importing.stop("Project bundle imported successfully");
+};
diff --git a/packages/cli/src/commands/link.ts b/packages/cli/src/commands/link.ts
index e6252f94fc..15e57c6f57 100644
--- a/packages/cli/src/commands/link.ts
+++ b/packages/cli/src/commands/link.ts
@@ -52,7 +52,7 @@ const writeConfigFile = async (content: string) => {
await rename(temporaryFile, GLOBAL_CONFIG_FILE);
};
-const parseShareLink = (value: string) => {
+export const parseShareLink = (value: string) => {
// value.replaceAll("'", "") is used to remove single quotes from the URL on Windows.
// This is necessary because the following pnpm script works on macOS and Linux but fails here on Windows:
// "fixtures:link": "pnpm cli link --link https://p-cddc1d44-af37-4cb6-a430-d300cf6f932d-dot-${BUILDER_HOST:-main.development.webstudio.is}'?authToken=1cdc6026-dd5b-4624-b89b-9bd45e9bcc3d'",
diff --git a/packages/cli/src/commands/sync.test.ts b/packages/cli/src/commands/sync.test.ts
new file mode 100644
index 0000000000..594c27a7b8
--- /dev/null
+++ b/packages/cli/src/commands/sync.test.ts
@@ -0,0 +1,174 @@
+import { afterEach, beforeEach, expect, test, vi } from "vitest";
+import { access, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
+import { join } from "node:path";
+import { tmpdir } from "node:os";
+import { bundleVersion } from "@webstudio-is/protocol";
+import {
+ createImageAssetFixture,
+ createPublishedProjectBundleFixture,
+} from "@webstudio-is/protocol/fixtures";
+import { createFileIfNotExists, isFileExists } from "../fs-utils";
+import { sync } from "./sync";
+
+const originalCwd = process.cwd();
+let tempDir: string;
+const indicator = {
+ start: vi.fn(),
+ message: vi.fn(),
+ stop: vi.fn(),
+};
+const loadProjectBundleByBuildId = vi.fn();
+const loadProjectBundleByProjectId = vi.fn();
+const downloadAssetFiles = vi.fn();
+const dependencies = {
+ createFileIfNotExists,
+ downloadAssetFiles,
+ isFileExists,
+ loadProjectBundleByBuildId,
+ loadProjectBundleByProjectId,
+ readFile,
+ spinner: () => indicator,
+ writeFile,
+};
+
+type ProjectBundleFixtureOptions = Parameters<
+ typeof createPublishedProjectBundleFixture
+>[0];
+
+const createProjectBundle = (data: ProjectBundleFixtureOptions = {}) =>
+ createPublishedProjectBundleFixture(data);
+
+beforeEach(async () => {
+ tempDir = await mkdtemp(join(tmpdir(), "webstudio-sync-"));
+ process.chdir(tempDir);
+ loadProjectBundleByBuildId.mockResolvedValue(createProjectBundle());
+ loadProjectBundleByProjectId.mockResolvedValue(createProjectBundle());
+ downloadAssetFiles.mockResolvedValue(undefined);
+ indicator.start.mockClear();
+ indicator.message.mockClear();
+ indicator.stop.mockClear();
+});
+
+afterEach(async () => {
+ process.chdir(originalCwd);
+ await rm(tempDir, { recursive: true, force: true });
+ vi.clearAllMocks();
+});
+
+test("preserves synchronized data version from the API", async () => {
+ await sync(
+ {
+ authToken: "token-1",
+ buildId: "build-1",
+ origin: "https://example.com",
+ },
+ dependencies
+ );
+
+ const data = JSON.parse(await readFile(".webstudio/data.json", "utf8"));
+
+ expect(data).toMatchObject({
+ build: { id: "build-1" },
+ origin: "https://example.com",
+ bundleVersion,
+ });
+ expect(indicator.stop).toHaveBeenCalledWith(
+ "Project bundle synchronized successfully"
+ );
+});
+
+test("adds current bundle version when synchronizing data from old API", async () => {
+ loadProjectBundleByBuildId.mockResolvedValue(
+ createProjectBundle({
+ bundleVersion: undefined,
+ build: {
+ styles: [
+ [
+ "style-1",
+ {
+ breakpointId: "breakpoint-1",
+ styleSourceId: "style-source-1",
+ property: "display",
+ value: { type: "keyword", value: "block" },
+ },
+ ],
+ ],
+ },
+ })
+ );
+
+ await sync(
+ {
+ authToken: "token-1",
+ buildId: "build-1",
+ origin: "https://example.com",
+ },
+ dependencies
+ );
+
+ const data = await readFile(".webstudio/data.json", "utf8");
+
+ expect(JSON.parse(data)).toMatchObject({ bundleVersion });
+ expect(data.startsWith(`{\n "bundleVersion":`)).toBe(true);
+ expect(data.indexOf(`"build"`)).toBeLessThan(data.indexOf(`"page"`));
+ expect(data.indexOf(`"styleSourceId"`)).toBeLessThan(
+ data.indexOf(`"breakpointId"`)
+ );
+});
+
+test("downloads project bundle asset files into local project bundle", async () => {
+ const assets = [createImageAssetFixture()];
+ loadProjectBundleByBuildId.mockResolvedValue(createProjectBundle({ assets }));
+
+ await sync(
+ {
+ authToken: "token-1",
+ buildId: "build-1",
+ origin: "https://example.com",
+ },
+ dependencies
+ );
+
+ expect(downloadAssetFiles).toHaveBeenCalledWith({
+ assets,
+ origin: "https://example.com",
+ });
+ expect(indicator.message).toHaveBeenCalledWith("Downloading 1 asset files");
+});
+
+test("does not write local data when synchronized asset download fails", async () => {
+ const assets = [createImageAssetFixture()];
+ loadProjectBundleByBuildId.mockResolvedValue(createProjectBundle({ assets }));
+ downloadAssetFiles.mockRejectedValue(new Error("download failed"));
+
+ await expect(
+ sync(
+ {
+ authToken: "token-1",
+ buildId: "build-1",
+ origin: "https://example.com",
+ },
+ dependencies
+ )
+ ).rejects.toThrow("Handled CLI error");
+
+ await expect(access(".webstudio/data.json")).rejects.toThrow();
+ expect(indicator.stop).toHaveBeenCalledWith("download failed", 2);
+});
+
+test("throws handled error when local project config is missing", async () => {
+ await expect(
+ sync(
+ {},
+ {
+ ...dependencies,
+ readFile: vi.fn(async () => "{}") as unknown as typeof readFile,
+ }
+ )
+ ).rejects.toThrow("Handled CLI error");
+
+ expect(indicator.stop).toHaveBeenCalledWith(
+ "Local config file is not found. Please make sure current directory is a webstudio project",
+ 2
+ );
+});
diff --git a/packages/cli/src/commands/sync.ts b/packages/cli/src/commands/sync.ts
index 91caf44068..41613f685a 100644
--- a/packages/cli/src/commands/sync.ts
+++ b/packages/cli/src/commands/sync.ts
@@ -4,16 +4,14 @@ import { join } from "node:path";
import pc from "picocolors";
import { spinner } from "@clack/prompts";
import {
- apiClientHeader,
- apiClientVersionHeader,
- getApiCompatibilityPayload,
-} from "@webstudio-is/trpc-interface/api-compatibility";
+ bundleVersion,
+ publishedProjectBundleSchema,
+ type PublishedProjectBundle,
+} from "@webstudio-is/protocol";
import {
- type Data,
- loadProjectDataByBuildId,
- loadProjectDataByProjectId,
+ loadProjectBundleByBuildId,
+ loadProjectBundleByProjectId,
} from "@webstudio-is/http-client";
-import packageJson from "../../package.json";
import { createFileIfNotExists, isFileExists } from "../fs-utils";
import {
GLOBAL_CONFIG_FILE,
@@ -27,40 +25,55 @@ import type {
StrictYargsOptionsToInterface,
} from "./yargs-types";
import { HandledCliError } from "../errors";
-
-const apiCompatibilityHeaders = {
- [apiClientHeader]: "cli",
- [apiClientVersionHeader]: packageJson.version,
+import { apiCompatibilityHeaders, stopSpinnerWithError } from "./api";
+import { downloadAssetFiles } from "../asset-files";
+
+type SyncDependencies = {
+ createFileIfNotExists: typeof createFileIfNotExists;
+ downloadAssetFiles: typeof downloadAssetFiles;
+ isFileExists: typeof isFileExists;
+ loadProjectBundleByBuildId: typeof loadProjectBundleByBuildId;
+ loadProjectBundleByProjectId: typeof loadProjectBundleByProjectId;
+ readFile: typeof readFile;
+ spinner: typeof spinner;
+ writeFile: typeof writeFile;
};
-const updateCliCommand = "npm install -g webstudio@latest";
-
-const getCliCompatibilityMessage = (error: unknown) => {
- const payload = getApiCompatibilityPayload(error);
- if (payload?.action.type !== "updateCli") {
- return;
- }
-
- return `${payload.message}
-
-Update the CLI with:
- ${updateCliCommand}
-
-Or run the latest version once with:
- npx webstudio@latest sync`;
+const defaultDependencies: SyncDependencies = {
+ createFileIfNotExists,
+ downloadAssetFiles,
+ isFileExists,
+ loadProjectBundleByBuildId,
+ loadProjectBundleByProjectId,
+ readFile,
+ spinner,
+ writeFile,
};
-const stopSyncingWithError = (
- syncing: ReturnType<typeof spinner>,
- error: unknown
-) => {
- const compatibilityMessage = getCliCompatibilityMessage(error);
- const message =
- error instanceof Error
- ? error.message
- : "Unable to synchronize project data";
- syncing.stop(compatibilityMessage ?? message, 2);
- return compatibilityMessage;
+const toLocalProjectBundle = (project: PublishedProjectBundle) => {
+ const normalizedProject = publishedProjectBundleSchema.parse(project);
+ const {
+ assets,
+ build,
+ bundleVersion: synchronizedBundleVersion,
+ origin,
+ page,
+ pages,
+ projectDomain,
+ projectTitle,
+ user,
+ } = normalizedProject;
+ return {
+ bundleVersion: synchronizedBundleVersion ?? bundleVersion,
+ build,
+ page,
+ pages,
+ assets,
+ user,
+ projectDomain,
+ projectTitle,
+ origin,
+ };
};
export const syncOptions = (yargs: CommonYargsArgv) =>
@@ -78,48 +91,59 @@ export const syncOptions = (yargs: CommonYargsArgv) =>
describe: "[Experimental] Service token",
});
+type SyncOptions = Partial<StrictYargsOptionsToInterface<typeof syncOptions>>;
+
export const sync = async (
- options: StrictYargsOptionsToInterface<typeof syncOptions>
+ options: SyncOptions,
+ dependencies = defaultDependencies
) => {
- const syncing = spinner();
+ const syncing = dependencies.spinner();
- let project: Data | undefined;
- syncing.start(`Synchronizing project data`);
+ let project: PublishedProjectBundle | undefined;
+ syncing.start(`Synchronizing project bundle`);
if (
options.buildId !== undefined &&
options.origin !== undefined &&
options.authToken !== undefined
) {
- syncing.message(`Synchronizing project data from ${options.origin}`);
+ syncing.message(`Synchronizing project bundle from ${options.origin}`);
try {
- project = await loadProjectDataByBuildId({
+ project = await dependencies.loadProjectBundleByBuildId({
buildId: options.buildId,
- seviceToken: options.authToken,
+ serviceToken: options.authToken,
origin: options.origin,
headers: apiCompatibilityHeaders,
});
project.origin = options.origin;
} catch (error) {
- const compatibilityMessage = stopSyncingWithError(syncing, error);
+ const compatibilityMessage = stopSpinnerWithError(
+ syncing,
+ error,
+ "Unable to synchronize project bundle",
+ "sync"
+ );
if (compatibilityMessage !== undefined) {
throw new HandledCliError();
}
throw error;
}
} else {
- const globalConfigText = await readFile(GLOBAL_CONFIG_FILE, "utf-8");
+ const globalConfigText = await dependencies.readFile(
+ GLOBAL_CONFIG_FILE,
+ "utf-8"
+ );
const globalConfig = jsonToGlobalConfig(JSON.parse(globalConfigText));
- if ((await isFileExists(LOCAL_CONFIG_FILE)) === false) {
+ if ((await dependencies.isFileExists(LOCAL_CONFIG_FILE)) === false) {
syncing.stop(
`Local config file is not found. Please make sure current directory is a webstudio project`,
2
);
- return;
+ throw new HandledCliError();
}
- const localConfigText = await readFile(
+ const localConfigText = await dependencies.readFile(
join(cwd(), LOCAL_CONFIG_FILE),
"utf-8"
);
@@ -133,22 +157,22 @@ export const sync = async (
`Project config is not found, please run ${pc.dim("webstudio link")}`,
2
);
- return;
+ throw new HandledCliError();
}
const { origin, token } = projectConfig;
- syncing.message(`Synchronizing project data from ${origin}`);
+ syncing.message(`Synchronizing project bundle from ${origin}`);
try {
project =
options.buildId !== undefined
- ? await loadProjectDataByBuildId({
+ ? await dependencies.loadProjectBundleByBuildId({
buildId: options.buildId,
authToken: token,
origin,
headers: apiCompatibilityHeaders,
})
- : await loadProjectDataByProjectId({
+ : await dependencies.loadProjectBundleByProjectId({
projectId: localConfig.projectId,
authToken: token,
origin,
@@ -157,7 +181,12 @@ export const sync = async (
project.origin = origin;
} catch (error) {
// catch errors about unpublished project
- const compatibilityMessage = stopSyncingWithError(syncing, error);
+ const compatibilityMessage = stopSpinnerWithError(
+ syncing,
+ error,
+ "Unable to synchronize project bundle",
+ "sync"
+ );
if (compatibilityMessage !== undefined) {
throw new HandledCliError();
}
@@ -167,11 +196,37 @@ export const sync = async (
}
// Check that project defined
- project satisfies Data;
+ project satisfies PublishedProjectBundle;
- const localBuildFilePath = join(cwd(), LOCAL_DATA_FILE);
- await createFileIfNotExists(localBuildFilePath);
- await writeFile(localBuildFilePath, JSON.stringify(project, null, 2), "utf8");
+ if (project.assets.length > 0) {
+ syncing.message(`Downloading ${project.assets.length} asset files`);
+ if (project.origin === undefined) {
+ syncing.stop("Asset origin is missing from project bundle", 2);
+ throw new HandledCliError();
+ }
+ try {
+ await dependencies.downloadAssetFiles({
+ assets: project.assets,
+ origin: project.origin,
+ });
+ } catch (error) {
+ stopSpinnerWithError(
+ syncing,
+ error,
+ "Unable to synchronize project asset files",
+ "sync"
+ );
+ throw new HandledCliError();
+ }
+ }
- syncing.stop("Project data synchronized successfully");
+ const localBuildFilePath = join(cwd(), LOCAL_DATA_FILE);
+ await dependencies.createFileIfNotExists(localBuildFilePath);
+ await dependencies.writeFile(
+ localBuildFilePath,
+ JSON.stringify(toLocalProjectBundle(project), null, 2),
+ "utf8"
+ );
+
+ syncing.stop("Project bundle synchronized successfully");
};
diff --git a/packages/cli/src/fs-utils.test.ts b/packages/cli/src/fs-utils.test.ts
new file mode 100644
index 0000000000..8ce07497cb
--- /dev/null
+++ b/packages/cli/src/fs-utils.test.ts
@@ -0,0 +1,34 @@
+import { afterEach, beforeEach, expect, test } from "vitest";
+import { mkdtemp, rm, writeFile } from "node:fs/promises";
+import { join } from "node:path";
+import { tmpdir } from "node:os";
+import { loadJSONFile } from "./fs-utils";
+
+const originalCwd = process.cwd();
+let tempDir: string;
+
+beforeEach(async () => {
+ tempDir = await mkdtemp(join(tmpdir(), "webstudio-fs-utils-"));
+ process.chdir(tempDir);
+});
+
+afterEach(async () => {
+ process.chdir(originalCwd);
+ await rm(tempDir, { recursive: true, force: true });
+});
+
+test("returns null for missing JSON file", async () => {
+ await expect(loadJSONFile("missing.json")).resolves.toBeNull();
+});
+
+test("loads JSON file content", async () => {
+ await writeFile("data.json", JSON.stringify({ value: 1 }), "utf8");
+
+ await expect(loadJSONFile("data.json")).resolves.toEqual({ value: 1 });
+});
+
+test("throws for malformed JSON file", async () => {
+ await writeFile("data.json", "{", "utf8");
+
+ await expect(loadJSONFile("data.json")).rejects.toThrow();
+});
diff --git a/packages/cli/src/fs-utils.ts b/packages/cli/src/fs-utils.ts
index c8dae8658f..6adbdc7748 100644
--- a/packages/cli/src/fs-utils.ts
+++ b/packages/cli/src/fs-utils.ts
@@ -27,7 +27,7 @@ export const createFileIfNotExists = async (
try {
await access(filePath, constants.F_OK);
} catch {
- await writeFile(filePath, content || "", "utf8");
+ await writeFile(filePath, content ?? "", "utf8");
}
};
@@ -44,6 +44,9 @@ export const loadJSONFile = async <T>(filePath: string): Promise<T | null> => {
const content = await readFile(filePath, "utf8");
return JSON.parse(content) as T;
} catch (error) {
- return null;
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") {
+ return null;
+ }
+ throw error;
}
};
diff --git a/packages/cli/src/prebuild.test.ts b/packages/cli/src/prebuild.test.ts
index 46d177d82d..3ca58b3ca1 100644
--- a/packages/cli/src/prebuild.test.ts
+++ b/packages/cli/src/prebuild.test.ts
@@ -9,7 +9,8 @@ import {
} from "node:fs/promises";
import { join } from "node:path";
import { tmpdir } from "node:os";
-import { downloadAsset, generateRedirectsModule, prebuild } from "./prebuild";
+import { bundleVersion } from "@webstudio-is/protocol";
+import { generateRedirectsModule, prebuild } from "./prebuild";
const originalCwd = process.cwd();
const originalFetch = globalThis.fetch;
@@ -47,6 +48,7 @@ const createSiteData = (
[
string,
{
+ type?: "instance";
id: string;
component: string;
tag?: string;
@@ -70,14 +72,19 @@ const createSiteData = (
];
return {
+ bundleVersion,
origin: "https://assets.example",
projectDomain: "example.com",
+ projectTitle: "Example",
user: {
},
+ page: pages[0],
+ pages,
assets: [
{
id: "asset-image",
+ projectId: "project-id",
name: "image.png",
type: "image",
format: "png",
@@ -91,7 +98,9 @@ const createSiteData = (
},
],
build: {
+ id: "build-id",
projectId: "project-id",
+ version: 1,
createdAt: "2024-01-01T00:00:00.000Z",
updatedAt: "2024-01-02T00:00:00.000Z",
pages: {
@@ -127,18 +136,21 @@ const createSiteData = (
],
},
props: [],
- instances: overrides.instances ?? [
- [
- "root",
- {
- id: "root",
- component: "Box",
- children: [],
- },
- ],
- ],
+ instances: (
+ overrides.instances ?? [
+ [
+ "root",
+ {
+ id: "root",
+ component: "Box",
+ children: [],
+ },
+ ],
+ ]
+ ).map(([id, instance]) => [id, { type: "instance", ...instance }]),
dataSources: [],
resources: [],
+ styleSources: [],
styleSourceSelections: [],
styles: [],
breakpoints: [],
@@ -241,47 +253,6 @@ describe("generateRedirectsModule", () => {
});
});
-describe("downloadAsset", () => {
- test("does not fetch assets that already exist", async () => {
- await mkdir("public/assets", { recursive: true });
- await writeFile("public/assets/image.png", "existing", "utf8");
- const fetch = vi.fn();
- globalThis.fetch = fetch;
-
- await downloadAsset(
- "https://assets.example/image.png",
- "image.png",
- "assets"
- );
-
- expect(fetch).not.toHaveBeenCalled();
- });
-
- test("logs fetch failures without throwing", async () => {
- const fetch = vi.fn(async () => ({
- ok: false,
- statusText: "Not Found",
- }));
- globalThis.fetch = fetch as unknown as typeof globalThis.fetch;
- const consoleError = vi
- .spyOn(console, "error")
- .mockImplementation(() => {});
-
- await expect(
- downloadAsset(
- "https://assets.example/missing.png",
- "missing.png",
- "assets"
- )
- ).resolves.toBeUndefined();
-
- expect(fetch).toHaveBeenCalledWith("https://assets.example/missing.png");
- expect(consoleError).toHaveBeenCalledWith(
- expect.stringContaining("Error in downloading file missing.png")
- );
- });
-});
-
describe("prebuild", () => {
test("scaffolds generated files and stores redirects as data", async () => {
await mkdir("app/__generated__", { recursive: true });
@@ -556,10 +527,27 @@ describe("prebuild", () => {
);
expect(consoleWarn).not.toHaveBeenCalled();
expect(consoleError).toHaveBeenCalledWith(
- expect.stringContaining("Error in downloading file image.png")
+ expect.stringContaining("Error materializing file image.png")
);
});
+ test("uses synced asset files before downloading during prebuild", async () => {
+ await mkdir(".webstudio/assets", { recursive: true });
+ await writeFile(".webstudio/assets/image.png", "synced", "utf8");
+ const fetch = vi.fn();
+ globalThis.fetch = fetch;
+
+ await prebuild({
+ assets: true,
+ template: ["defaults"],
+ });
+
+ await expect(readFile("public/assets/image.png", "utf8")).resolves.toBe(
+ "synced"
+ );
+ expect(fetch).not.toHaveBeenCalled();
+ });
+
test("merges package and tsconfig from every template", async () => {
const localTemplate = join(tempDir, "local-template");
await mkdir(localTemplate, { recursive: true });
@@ -631,7 +619,7 @@ describe("prebuild", () => {
});
});
- test("throws when project data is missing", async () => {
+ test("throws when project bundle is missing", async () => {
await rm(".webstudio/data.json", { force: true });
await expect(
@@ -639,6 +627,19 @@ describe("prebuild", () => {
assets: false,
template: ["defaults"],
})
- ).rejects.toThrow("Project data is missing");
+ ).rejects.toThrow("Project bundle is missing");
+ });
+
+ test("throws when project bundle is invalid", async () => {
+ await writeFile(".webstudio/data.json", JSON.stringify({ assets: [] }));
+
+ await expect(
+ prebuild({
+ assets: false,
+ template: ["defaults"],
+ })
+ ).rejects.toThrow(
+ "Project bundle is invalid, please make sure the project is synced. Invalid fields: page: Required"
+ );
});
});
diff --git a/packages/cli/src/prebuild.ts b/packages/cli/src/prebuild.ts
index 5ae6310f3a..442725bc23 100644
--- a/packages/cli/src/prebuild.ts
+++ b/packages/cli/src/prebuild.ts
@@ -1,18 +1,8 @@
import { basename, dirname, join, normalize, relative } from "node:path";
-import { createWriteStream, existsSync } from "node:fs";
-import {
- rm,
- access,
- rename,
- cp,
- readFile,
- writeFile,
- readdir,
-} from "node:fs/promises";
-import { pipeline } from "node:stream/promises";
+import { existsSync } from "node:fs";
+import { rm, cp, readFile, writeFile, readdir } from "node:fs/promises";
import { cwd, exit } from "node:process";
import { fileURLToPath, pathToFileURL } from "node:url";
-import pLimit from "p-limit";
import { log, spinner } from "@clack/prompts";
import merge from "deepmerge";
import {
@@ -48,27 +38,30 @@ import {
generateCss,
ROOT_INSTANCE_ID,
elementComponent,
- getAssetUrl,
toRuntimeAsset,
} from "@webstudio-is/sdk";
-import { createWsAuthResources } from "@webstudio-is/wsauth";
import { migratePages } from "@webstudio-is/project-migrations/pages";
-import type { Data } from "@webstudio-is/http-client";
+import { publishedProjectBundleSchema } from "@webstudio-is/protocol";
+import { createAuthConfigResources, LOCAL_AUTH_FILE } from "./auth-config";
import { LOCAL_DATA_FILE } from "./config";
import {
createFileIfNotExists,
createFolderIfNotExists,
loadJSONFile,
} from "./fs-utils";
-import type * as sharedConstants from "../templates/defaults/app/constants.mjs";
import { htmlToJsx } from "./html-to-jsx";
-import { createFramework as createRemixFramework } from "./framework-remix";
-import { createFramework as createReactRouterFramework } from "./framework-react-router";
-import { createFramework as createVikeSsgFramework } from "./framework-vike-ssg";
import { compareMedia } from "@webstudio-is/css-engine";
+import { materializeAssetFiles } from "./asset-files";
+import { formatZodIssues } from "./zod-utils";
+
+const createRemixFramework = async () =>
+ (await import("./framework-remix")).createFramework();
-const limit = pLimit(10);
-const wsAuthFile = ".webstudio/auth.json";
+const createReactRouterFramework = async () =>
+ (await import("./framework-react-router")).createFramework();
+
+const createVikeSsgFramework = async () =>
+ (await import("./framework-vike-ssg")).createFramework();
type SiteDataByPage = {
[id: Page["id"]]: {
@@ -86,45 +79,6 @@ type SiteDataByPage = {
};
};
-export const downloadAsset = async (
- url: string,
- name: string,
- assetBaseUrl: string
-) => {
- const assetPath = join("public", assetBaseUrl, name);
- // fs.rename cannot be used to move a file to a different mount point or drive
- // Error: EXDEV: cross-device link not permitted
- const tempAssetPath = `${assetPath}.tmp`;
-
- try {
- await access(assetPath);
- } catch {
- await createFolderIfNotExists(dirname(assetPath));
-
- try {
- const response = await fetch(url);
- if (!response.ok) {
- throw new Error(`Failed to fetch ${url}: ${response.statusText}`);
- }
-
- const writableStream = createWriteStream(tempAssetPath);
- /*
- We need to cast the response body to a NodeJS.ReadableStream.
- Since the node typings for `@types/node` doesn't add typings for fetch.
- And it inherits types from lib.dom.d.ts
- */
- await pipeline(
- response.body as unknown as NodeJS.ReadableStream,
- writableStream
- );
-
- await rename(tempAssetPath, assetPath);
- } catch (error) {
- console.error(`Error in downloading file ${name} \n ${error}`);
- }
- }
-};
-
const mergeJsonInto = async (sourcePath: string, destinationPath: string) => {
const sourceJson = await readFile(sourcePath, "utf8");
const destinationJson = await readFile(destinationPath, "utf8").catch(
@@ -152,33 +106,9 @@ const mergeJsonInto = async (sourcePath: string, destinationPath: string) => {
};
const writeWsAuthResources = async (generatedDir: string, pages: Pages) => {
- console.info("[wsauth] prebuild create auth config", {
- file: wsAuthFile,
- projectAuthContentLength: pages.meta?.auth?.length ?? 0,
- projectAuthContent: pages.meta?.auth,
- pages: getAllPages(pages).map((page) => ({
- id: page.id,
- name: page.name,
- route: getPagePath(page.id, pages),
- auth: page.meta.auth,
- })),
- });
- const { content, module } = createWsAuthResources({
- projectContent: pages.meta?.auth,
- pages: getAllPages(pages).map((page) => ({
- route: getPagePath(page.id, pages),
- auth: page.meta.auth,
- })),
- });
- console.info("[wsauth] prebuild write auth config", {
- file: wsAuthFile,
- contentLength: content.length,
- content,
- generatedModulePath: join(generatedDir, "$resources.wsauth.server.ts"),
- generatedModule: module,
- });
- await createFolderIfNotExists(dirname(wsAuthFile));
- await writeFile(wsAuthFile, content);
+ const { content, module } = createAuthConfigResources(pages);
+ await createFolderIfNotExists(dirname(LOCAL_AUTH_FILE));
+ await writeFile(LOCAL_AUTH_FILE, content);
await createFileIfNotExists(
join(generatedDir, "$resources.wsauth.server.ts"),
module
@@ -323,21 +253,25 @@ export const prebuild = async (options: {
framework = await createRemixFramework();
}
- const constants: typeof sharedConstants = await import(
- pathToFileURL(join(cwd(), "app/constants.mjs")).href
- );
+ const constants: typeof import("../templates/defaults/app/constants.mjs") =
+ await import(pathToFileURL(join(cwd(), "app/constants.mjs")).href);
const { assetBaseUrl } = constants;
- const siteData = await loadJSONFile<
- Data & { user?: { email: string | null } }
- >(LOCAL_DATA_FILE);
+ const loadedSiteData = await loadJSONFile<unknown>(LOCAL_DATA_FILE);
- if (siteData === null) {
+ if (loadedSiteData === null) {
+ throw new Error(
+ `Project bundle is missing, please make sure the project is synced.`
+ );
+ }
+ const parsedSiteData = publishedProjectBundleSchema.safeParse(loadedSiteData);
+ if (parsedSiteData.success === false) {
throw new Error(
- `Project data is missing, please make sure you the project is synced.`
+ `Project bundle is invalid, please make sure the project is synced. Invalid fields: ${formatZodIssues(parsedSiteData.error.issues)}`
);
}
+ const siteData = parsedSiteData.data;
const usedMetas = new Map<Instance["component"], WsComponentMeta>(
Object.entries(coreMetas)
@@ -479,26 +413,11 @@ export const prebuild = async (options: {
backgroundImageAssetsByPage[page.id] = backgroundImageAssets;
}
- const assetsToDownload: Promise<void>[] = [];
-
if (options.assets === true) {
const assetOrigin = siteData.origin;
if (!assetOrigin) {
- console.warn("Warning: Asset origin is not defined in project data.");
- }
-
- for (const asset of siteData.assets) {
- // Download all assets (images, fonts, videos, audio, documents, etc.)
- assetsToDownload.push(
- limit(() =>
- downloadAsset(
- getAssetUrl(asset, assetOrigin || "").href,
- asset.name,
- assetBaseUrl
- )
- )
- );
+ console.warn("Warning: Asset origin is not defined in project bundle.");
}
}
@@ -813,10 +732,15 @@ export const prebuild = async (options: {
generateRedirectsModule(pages.redirects)
);
- if (assetsToDownload.length > 0) {
+ if (options.assets === true && siteData.assets.length > 0) {
const downloading = spinner();
downloading.start("Downloading fonts and images");
- await Promise.all(assetsToDownload);
+ await materializeAssetFiles({
+ assets: siteData.assets,
+ continueOnError: true,
+ origin: siteData.origin || "",
+ targetAssetsDirectory: join("public", assetBaseUrl),
+ });
downloading.stop("Downloaded fonts and images");
}
diff --git a/packages/cli/src/zod-utils.test.ts b/packages/cli/src/zod-utils.test.ts
new file mode 100644
index 0000000000..2e2c76a14c
--- /dev/null
+++ b/packages/cli/src/zod-utils.test.ts
@@ -0,0 +1,34 @@
+import { expect, test } from "vitest";
+import { z } from "zod";
+import { formatZodIssues } from "./zod-utils";
+
+test("formats zod issues with readable field paths", () => {
+ const result = z
+ .object({
+ assets: z.array(z.object({ name: z.string() })),
+ projectTitle: z.string(),
+ })
+ .safeParse({ assets: [{}] });
+
+ expect(result.success).toBe(false);
+ if (result.success) {
+ return;
+ }
+
+ expect(formatZodIssues(result.error.issues)).toBe(
+ "assets.0.name: Required, projectTitle: Required"
+ );
+});
+
+test("formats root zod issues with their message", () => {
+ const result = z.string().safeParse(1);
+
+ expect(result.success).toBe(false);
+ if (result.success) {
+ return;
+ }
+
+ expect(formatZodIssues(result.error.issues)).toBe(
+ "Expected string, received number"
+ );
+});
diff --git a/packages/cli/src/zod-utils.ts b/packages/cli/src/zod-utils.ts
new file mode 100644
index 0000000000..1129b6b75a
--- /dev/null
+++ b/packages/cli/src/zod-utils.ts
@@ -0,0 +1,9 @@
+import type { z } from "zod";
+
+export const formatZodIssues = (issues: z.ZodIssue[]) =>
+ issues
+ .map((issue) => {
+ const path = issue.path.join(".");
+ return path === "" ? issue.message : `${path}: ${issue.message}`;
+ })
+ .join(", ");
diff --git a/packages/domain/src/trpc/domain.ts b/packages/domain/src/trpc/domain.ts
index 97fd20d059..4333af2a19 100644
--- a/packages/domain/src/trpc/domain.ts
+++ b/packages/domain/src/trpc/domain.ts
@@ -135,7 +135,7 @@ export const domainRouter = router({
}
const result = await deploymentTrpc.publish.mutate({
- // used to load build data from the builder with build.loadProjectDataByBuildId
+ // used to load build data from the builder with build.loadProjectBundleByBuildId
builderOrigin: env.BUILDER_ORIGIN,
githubSha: env.GITHUB_SHA,
buildId: build.id,
diff --git a/packages/http-client/package.json b/packages/http-client/package.json
index e277397cdb..f0b9489f13 100644
--- a/packages/http-client/package.json
+++ b/packages/http-client/package.json
@@ -13,8 +13,7 @@
},
"dependencies": {
"@trpc/client": "^10.45.2",
- "@webstudio-is/project-migrations": "workspace:*",
- "@webstudio-is/sdk": "workspace:*"
+ "@webstudio-is/protocol": "workspace:*"
},
"devDependencies": {
"@webstudio-is/tsconfig": "workspace:*",
diff --git a/packages/http-client/src/index.ts b/packages/http-client/src/index.ts
index 1fa68c025c..f4201199f7 100644
--- a/packages/http-client/src/index.ts
+++ b/packages/http-client/src/index.ts
@@ -1,44 +1,21 @@
-import type {
- Asset,
- Breakpoint,
- DataSource,
- Deployment,
- Instance,
- Page,
- Prop,
- Resource,
- StyleDecl,
- StyleDeclKey,
- StyleSource,
- StyleSourceSelection,
-} from "@webstudio-is/sdk";
-import type { SerializedPages } from "@webstudio-is/project-migrations/pages";
import { createTRPCUntypedClient, httpBatchLink } from "@trpc/client";
-
-export type Data = {
- page: Page;
- pages: Array<Page>;
- build: {
- id: string;
- projectId: string;
- version: number;
- createdAt: string;
- updatedAt: string;
- pages: SerializedPages;
- breakpoints: [Breakpoint["id"], Breakpoint][];
- styles: [StyleDeclKey, StyleDecl][];
- styleSources: [StyleSource["id"], StyleSource][];
- styleSourceSelections: [Instance["id"], StyleSourceSelection][];
- props: [Prop["id"], Prop][];
- instances: [Instance["id"], Instance][];
- dataSources: [DataSource["id"], DataSource][];
- resources: [Resource["id"], Resource][];
- deployment?: Deployment | undefined;
- };
- assets: Array<Asset>;
- projectDomain?: string;
- origin?: string;
-};
+import {
+ importProjectBundleResultSchema,
+ publishedProjectBundleSchema,
+ type AssetFileData,
+ type ImportProjectBundleResult,
+ type PublishedProjectBundle,
+} from "@webstudio-is/protocol";
+export {
+ getBundleVersion,
+ isAssetFileDataString,
+ bundleVersion,
+} from "@webstudio-is/protocol";
+export type {
+ AssetFileData,
+ PublishedProjectBundle,
+ ProjectBundle,
+} from "@webstudio-is/protocol";
const createTrpcClient = (
origin: string,
@@ -57,43 +34,90 @@ const createTrpcClient = (
});
};
-export const loadProjectDataByBuildId = async (
+const createAuthTrpcClient = (params: {
+ origin: string;
+ authToken: string;
+ headers?: Record<string, string | undefined>;
+}) =>
+ createTrpcClient(params.origin, {
+ ...params.headers,
+ "x-auth-token": params.authToken,
+ });
+
+export const loadProjectBundleByBuildId = async (
params: {
buildId: string;
origin: string;
headers?: Record<string, string | undefined>;
} & (
| {
- seviceToken: string;
+ serviceToken: string;
}
| { authToken: string }
)
-): Promise<Data> => {
+): Promise<PublishedProjectBundle> => {
const headers: Record<string, string | undefined> =
- "seviceToken" in params
- ? { Authorization: params.seviceToken }
+ "serviceToken" in params
+ ? { Authorization: params.serviceToken }
: { "x-auth-token": params.authToken };
- return (await createTrpcClient(params.origin, {
+ const data = await createTrpcClient(params.origin, {
...params.headers,
...headers,
- }).query("build.loadProjectDataByBuildId", {
+ }).query("build.loadProjectBundleByBuildId", {
buildId: params.buildId,
- })) as Data;
+ });
+ return publishedProjectBundleSchema.parse(data);
};
-export const loadProjectDataByProjectId = async (params: {
+export const loadProjectBundleByProjectId = async (params: {
projectId: string;
origin: string;
authToken: string;
headers?: Record<string, string | undefined>;
-}): Promise<Data> => {
- return (await createTrpcClient(params.origin, {
- ...params.headers,
- "x-auth-token": params.authToken,
- }).query("build.loadProjectDataByProjectId", {
- projectId: params.projectId,
- })) as Data;
+}): Promise<PublishedProjectBundle> => {
+ const data = await createAuthTrpcClient(params).query(
+ "build.loadProjectBundleByProjectId",
+ {
+ projectId: params.projectId,
+ }
+ );
+ return publishedProjectBundleSchema.parse(data);
+};
+
+export const checkProjectBuildPermission = async (params: {
+ projectId: string;
+ origin: string;
+ authToken: string;
+ headers?: Record<string, string | undefined>;
+}): Promise<void> => {
+ await createAuthTrpcClient(params).query(
+ "build.checkProjectBuildPermission",
+ {
+ projectId: params.projectId,
+ }
+ );
+};
+
+export const importProjectBundle = async (params: {
+ projectId: string;
+ origin: string;
+ authToken: string;
+ data: PublishedProjectBundle;
+ assetFiles?: AssetFileData[];
+ ignoreVersionCheck?: boolean;
+ headers?: Record<string, string | undefined>;
+}): Promise<ImportProjectBundleResult> => {
+ const result = await createAuthTrpcClient(params).mutation(
+ "build.importProjectBundle",
+ {
+ projectId: params.projectId,
+ data: params.data,
+ assetFiles: params.assetFiles,
+ ignoreVersionCheck: params.ignoreVersionCheck,
+ }
+ );
+ return importProjectBundleResultSchema.parse(result);
};
// For easier detecting the builder URL
diff --git a/packages/project-build/package.json b/packages/project-build/package.json
index 252824a100..64c4f3b104 100644
--- a/packages/project-build/package.json
+++ b/packages/project-build/package.json
@@ -12,6 +12,11 @@
"webstudio": "./src/index.ts",
"partykit": "./src/index.ts"
},
+ "./schema": {
+ "webstudio": "./src/schema.ts",
+ "import": "./src/schema.ts",
+ "default": "./src/schema.ts"
+ },
"./index.server": {
"webstudio": "./src/index.server.ts"
},
diff --git a/packages/project-build/src/schema.ts b/packages/project-build/src/schema.ts
new file mode 100644
index 0000000000..0398676751
--- /dev/null
+++ b/packages/project-build/src/schema.ts
@@ -0,0 +1,51 @@
+import {
+ Breakpoint,
+ DataSource,
+ Deployment,
+ Instance,
+ Prop,
+ Resource,
+ StyleDecl,
+ StyleSource,
+ StyleSourceSelection,
+} from "@webstudio-is/sdk/schema";
+import {
+ SerializedPagesSchema,
+ type SerializedPages,
+} from "@webstudio-is/project-migrations/pages";
+import { z } from "zod";
+import type { Build } from "./types";
+
+const entrySchema = <Value extends z.ZodTypeAny>(value: Value) =>
+ z.tuple([z.string(), value]);
+
+type SchemaShape<Value extends object> = {
+ [Key in keyof Required<Value>]: z.ZodType<Value[Key], z.ZodTypeDef, unknown>;
+};
+
+export type SerializedBuild = Omit<Build, "marketplaceProduct" | "pages"> & {
+ pages: SerializedPages;
+};
+
+const serializedBuildShape: SchemaShape<SerializedBuild> = {
+ id: z.string(),
+ projectId: z.string(),
+ version: z.number(),
+ createdAt: z.string(),
+ updatedAt: z.string(),
+ pages: SerializedPagesSchema,
+ breakpoints: z.array(entrySchema(Breakpoint)),
+ styles: z.array(entrySchema(StyleDecl)),
+ styleSources: z.array(entrySchema(StyleSource)),
+ styleSourceSelections: z.array(entrySchema(StyleSourceSelection)),
+ props: z.array(entrySchema(Prop)),
+ instances: z.array(entrySchema(Instance)),
+ dataSources: z.array(entrySchema(DataSource)),
+ resources: z.array(entrySchema(Resource)),
+ deployment: Deployment.optional(),
+};
+
+// Canonical project-build schema entrypoint for API-facing serialized builds.
+// API packages compose this schema; they should not copy or maintain it.
+export const SerializedBuildSchema: z.ZodObject<typeof serializedBuildShape> =
+ z.object(serializedBuildShape);
diff --git a/packages/project-build/src/types.ts b/packages/project-build/src/types.ts
index 7577c7d2f9..a5a9a4e1e4 100644
--- a/packages/project-build/src/types.ts
+++ b/packages/project-build/src/types.ts
@@ -1,15 +1,15 @@
import type {
- Pages,
Breakpoint,
+ DataSource,
+ Deployment,
+ Instance,
+ Pages,
+ Prop,
+ Resource,
StyleDecl,
StyleDeclKey,
StyleSource,
- Instance,
- Prop,
StyleSourceSelection,
- Deployment,
- DataSource,
- Resource,
} from "@webstudio-is/sdk";
import type { MarketplaceProduct } from "./shared/marketplace";
diff --git a/packages/project-migrations/package.json b/packages/project-migrations/package.json
index 0de7df81f8..d65903ee56 100644
--- a/packages/project-migrations/package.json
+++ b/packages/project-migrations/package.json
@@ -32,7 +32,8 @@
"dependencies": {
"@webstudio-is/css-data": "workspace:*",
"@webstudio-is/css-engine": "workspace:*",
- "@webstudio-is/sdk": "workspace:*"
+ "@webstudio-is/sdk": "workspace:*",
+ "zod": "^3.24.2"
},
"devDependencies": {
"@webstudio-is/tsconfig": "workspace:*",
diff --git a/packages/project-migrations/src/pages.ts b/packages/project-migrations/src/pages.ts
index b93ad9054d..aa7d6ea0da 100644
--- a/packages/project-migrations/src/pages.ts
+++ b/packages/project-migrations/src/pages.ts
@@ -1,12 +1,14 @@
import {
- Pages as PagesSchema,
- type Folder,
- type Page,
- type PageTemplate,
- type Pages,
- isRootFolder,
- ROOT_FOLDER_ID,
-} from "@webstudio-is/sdk";
+ CompilerSettings,
+ Folder,
+ Page,
+ PageTemplate,
+ ProjectMeta,
+ PageRedirect,
+ Pages,
+} from "@webstudio-is/sdk/schema";
+import { isRootFolder, ROOT_FOLDER_ID } from "@webstudio-is/sdk";
+import { z } from "zod";
type LegacyPages = {
meta?: Pages["meta"];
@@ -26,6 +28,23 @@ export type SerializedPages = Omit<
folders: Folder[];
};
+export const SerializedPagesSchema: z.ZodType<
+ SerializedPages,
+ z.ZodTypeDef,
+ unknown
+> = z.object({
+ meta: ProjectMeta.optional(),
+ compiler: CompilerSettings.optional(),
+ redirects: z.array(PageRedirect).optional(),
+ homePageId: z.string(),
+ rootFolderId: z.string(),
+ pages: z.array(Page),
+ pageTemplates: z
+ .union([z.array(PageTemplate), z.record(PageTemplate)])
+ .optional(),
+ folders: z.array(Folder),
+});
+
type MigratablePages = Omit<Pages, "pages" | "pageTemplates" | "folders"> & {
pages: Page[] | Record<Page["id"], Page> | Map<Page["id"], Page>;
pageTemplates?:
@@ -92,7 +111,7 @@ const removeOrphanFolderChildren = (
};
export const serializePages = (pages: Pages): SerializedPages => {
- const parsedPages = PagesSchema.parse(pages);
+ const parsedPages = Pages.parse(pages);
return {
meta: parsedPages.meta,
compiler: parsedPages.compiler,
@@ -115,7 +134,7 @@ export const migratePages = (pages: unknown): Pages => {
pages.folders instanceof Map
) {
const currentPages = pages as Pages;
- const result = PagesSchema.safeParse(currentPages);
+ const result = Pages.safeParse(currentPages);
if (result.success && currentPages.pageTemplates !== undefined) {
return currentPages;
}
diff --git a/packages/protocol/README.md b/packages/protocol/README.md
new file mode 100644
index 0000000000..2621156c03
--- /dev/null
+++ b/packages/protocol/README.md
@@ -0,0 +1,12 @@
+# Protocol
+
+`@webstudio-is/protocol` owns Webstudio data exchange protocols.
+
+The project bundle is the external export/import artifact used by sync, local
+`.webstudio/data.json`, project import, transferred asset files, and prebuild.
+This package owns the assembled bundle schemas, transfer RPC payloads, and
+bundle compatibility/version helpers.
+
+Domain models such as pages, assets, and serialized builds remain owned by
+their domain packages and are composed here through schema-only entrypoints.
+Do not copy those schemas into this package.
diff --git a/packages/protocol/package.json b/packages/protocol/package.json
new file mode 100644
index 0000000000..891d7f4250
--- /dev/null
+++ b/packages/protocol/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@webstudio-is/protocol",
+ "version": "0.0.0-webstudio-version",
+ "description": "Webstudio data exchange protocol contracts",
+ "author": "Webstudio <[email protected]>",
+ "homepage": "https://webstudio.is",
+ "type": "module",
+ "scripts": {
+ "build": "rm -rf lib && esbuild src/index.ts src/fixtures.ts --outdir=lib --bundle --format=esm --packages=external",
+ "dts": "tsc --project tsconfig.dts.json",
+ "test": "vitest run",
+ "typecheck": "tsgo --noEmit"
+ },
+ "dependencies": {
+ "@webstudio-is/project-build": "workspace:*",
+ "@webstudio-is/sdk": "workspace:*",
+ "@webstudio-is/wsauth": "workspace:*",
+ "zod": "^3.24.2"
+ },
+ "devDependencies": {
+ "@webstudio-is/tsconfig": "workspace:*",
+ "vitest": "^3.1.2"
+ },
+ "exports": {
+ ".": {
+ "webstudio": "./src/index.ts",
+ "types": "./lib/types/index.d.ts",
+ "import": "./lib/index.js",
+ "default": "./src/index.ts"
+ },
+ "./fixtures": {
+ "webstudio": "./src/fixtures.ts",
+ "types": "./lib/types/fixtures.d.ts",
+ "import": "./lib/fixtures.js",
+ "default": "./src/fixtures.ts"
+ }
+ },
+ "files": [
+ "lib/*",
+ "!*.{test,stories}.*"
+ ],
+ "license": "AGPL-3.0-or-later",
+ "private": false,
+ "sideEffects": false
+}
diff --git a/packages/protocol/src/contract-version.test.ts b/packages/protocol/src/contract-version.test.ts
new file mode 100644
index 0000000000..c1c7061421
--- /dev/null
+++ b/packages/protocol/src/contract-version.test.ts
@@ -0,0 +1,105 @@
+import { describe, expect, test } from "vitest";
+import { z } from "zod";
+import { createContractVersion } from "./contract-version";
+
+type StringRefinement = z.RefinementEffect<string>["refinement"];
+
+const createLengthRefinement = ({
+ contractLength,
+ validateLength = contractLength,
+}: {
+ contractLength: number;
+ validateLength?: number;
+}) =>
+ Object.assign(
+ (value: string, context: z.RefinementCtx) => {
+ if (value.length < validateLength) {
+ context.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: `Must be at least ${validateLength} characters`,
+ });
+ }
+ },
+ { contract: { minLength: contractLength } }
+ );
+
+const versionForRefinement = (refinement: StringRefinement) =>
+ createContractVersion(z.string().superRefine(refinement), "1");
+
+describe("contract version", () => {
+ test("changes when schema shape changes", () => {
+ expect(
+ createContractVersion(z.object({ value: z.string() }), "1")
+ ).not.toBe(createContractVersion(z.object({ value: z.number() }), "1"));
+ });
+
+ test("changes when explicit refinement contract changes", () => {
+ expect(
+ versionForRefinement(createLengthRefinement({ contractLength: 2 }))
+ ).not.toBe(
+ versionForRefinement(createLengthRefinement({ contractLength: 3 }))
+ );
+ });
+
+ test("ignores refinement function source", () => {
+ expect(
+ versionForRefinement(
+ createLengthRefinement({ contractLength: 2, validateLength: 2 })
+ )
+ ).toBe(
+ versionForRefinement(
+ createLengthRefinement({ contractLength: 2, validateLength: 3 })
+ )
+ );
+
+ expect(
+ createContractVersion(
+ z.string().superRefine((value, context) => {
+ if (value.length < 2) {
+ context.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: "Must be at least 2 characters",
+ });
+ }
+ }),
+ "1"
+ )
+ ).toBe(
+ createContractVersion(
+ z.string().superRefine((value, context) => {
+ if (value.length < 3) {
+ context.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: "Must be at least 3 characters",
+ });
+ }
+ }),
+ "1"
+ )
+ );
+ });
+
+ test("changes when package version changes", () => {
+ const schema = z.object({ value: z.string() });
+
+ expect(createContractVersion(schema, "1.0.0")).not.toBe(
+ createContractVersion(schema, "1.0.1")
+ );
+ });
+
+ test("changes when extra schemas change", () => {
+ const schema = z.object({ value: z.string() });
+
+ expect(
+ createContractVersion(schema, "1", [z.object({ auth: z.literal(1) })])
+ ).not.toBe(
+ createContractVersion(schema, "1", [z.object({ auth: z.literal(2) })])
+ );
+ });
+
+ test("uses short bundle package version", () => {
+ expect(
+ createContractVersion(z.string(), "0.0.0-webstudio-version")
+ ).toMatch(/^bundle-0\.0\.0-[0-9a-f]{8}$/);
+ });
+});
diff --git a/packages/protocol/src/contract-version.ts b/packages/protocol/src/contract-version.ts
new file mode 100644
index 0000000000..602c19d1b5
--- /dev/null
+++ b/packages/protocol/src/contract-version.ts
@@ -0,0 +1,215 @@
+import { z } from "zod";
+
+type ContractFunction = ((...args: never[]) => unknown) & {
+ contract?: unknown;
+};
+
+const getFunctionContract = (value: unknown) => {
+ if (typeof value !== "function") {
+ return;
+ }
+ const contractFunction = value as ContractFunction;
+ if (contractFunction.contract !== undefined) {
+ return { contract: contractFunction.contract };
+ }
+ // Function source is transformed differently by test, build, and runtime
+ // loaders. Refinements must attach explicit contract metadata to affect the
+ // bundle version.
+ return { contract: "unversioned-function" };
+};
+
+const getSchemaContract = (
+ schema: z.ZodTypeAny,
+ seen = new Map<z.ZodTypeAny, number>()
+): unknown => {
+ const schemaId = seen.get(schema);
+ if (schemaId !== undefined) {
+ return { type: "ref", id: schemaId };
+ }
+ seen.set(schema, seen.size);
+
+ const definition = schema._def;
+ switch (definition.typeName) {
+ case z.ZodFirstPartyTypeKind.ZodArray:
+ return {
+ type: "array",
+ value: getSchemaContract(definition.type, seen),
+ checks: {
+ exactLength: definition.exactLength,
+ maxLength: definition.maxLength,
+ minLength: definition.minLength,
+ },
+ };
+ case z.ZodFirstPartyTypeKind.ZodBoolean:
+ return {
+ type: "boolean",
+ };
+ case z.ZodFirstPartyTypeKind.ZodDefault:
+ return {
+ type: "default",
+ value: getSchemaContract(definition.innerType, seen),
+ };
+ case z.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
+ return {
+ type: "discriminatedUnion",
+ discriminator: definition.discriminator,
+ options: definition.options.map((option: z.ZodTypeAny) =>
+ getSchemaContract(option, seen)
+ ),
+ };
+ case z.ZodFirstPartyTypeKind.ZodEffects:
+ return {
+ type: "effects",
+ effect: definition.effect.type,
+ source: getFunctionContract(
+ definition.effect.refinement ?? definition.effect.transform
+ ),
+ value: getSchemaContract(definition.schema, seen),
+ };
+ case z.ZodFirstPartyTypeKind.ZodEnum:
+ return {
+ type: "enum",
+ values: definition.values,
+ };
+ case z.ZodFirstPartyTypeKind.ZodLiteral:
+ return {
+ type: "literal",
+ value: definition.value,
+ };
+ case z.ZodFirstPartyTypeKind.ZodLazy:
+ return {
+ type: "lazy",
+ value: getSchemaContract(definition.getter(), seen),
+ };
+ case z.ZodFirstPartyTypeKind.ZodMap:
+ return {
+ type: "map",
+ key: getSchemaContract(definition.keyType, seen),
+ value: getSchemaContract(definition.valueType, seen),
+ };
+ case z.ZodFirstPartyTypeKind.ZodNativeEnum:
+ return {
+ type: "nativeEnum",
+ values: definition.values,
+ };
+ case z.ZodFirstPartyTypeKind.ZodNever:
+ return {
+ type: "never",
+ };
+ case z.ZodFirstPartyTypeKind.ZodNull:
+ return {
+ type: "null",
+ };
+ case z.ZodFirstPartyTypeKind.ZodNullable:
+ return {
+ type: "nullable",
+ value: getSchemaContract(definition.innerType, seen),
+ };
+ case z.ZodFirstPartyTypeKind.ZodNumber:
+ return {
+ type: "number",
+ checks: definition.checks,
+ };
+ case z.ZodFirstPartyTypeKind.ZodObject:
+ return {
+ type: "object",
+ unknownKeys: definition.unknownKeys,
+ catchall: getSchemaContract(definition.catchall, seen),
+ shape: Object.fromEntries(
+ Object.entries(definition.shape())
+ .sort(([left], [right]) => left.localeCompare(right))
+ .map(([key, value]) => [
+ key,
+ getSchemaContract(value as z.ZodTypeAny, seen),
+ ])
+ ),
+ };
+ case z.ZodFirstPartyTypeKind.ZodOptional:
+ return {
+ type: "optional",
+ value: getSchemaContract(definition.innerType, seen),
+ };
+ case z.ZodFirstPartyTypeKind.ZodRecord:
+ return {
+ type: "record",
+ key: getSchemaContract(definition.keyType, seen),
+ value: getSchemaContract(definition.valueType, seen),
+ };
+ case z.ZodFirstPartyTypeKind.ZodString:
+ return {
+ type: "string",
+ checks: definition.checks,
+ };
+ case z.ZodFirstPartyTypeKind.ZodTuple:
+ return {
+ type: "tuple",
+ items: definition.items.map((item: z.ZodTypeAny) =>
+ getSchemaContract(item, seen)
+ ),
+ rest:
+ definition.rest === null
+ ? undefined
+ : getSchemaContract(definition.rest, seen),
+ };
+ case z.ZodFirstPartyTypeKind.ZodUndefined:
+ return {
+ type: "undefined",
+ };
+ case z.ZodFirstPartyTypeKind.ZodUnknown:
+ return {
+ type: "unknown",
+ };
+ case z.ZodFirstPartyTypeKind.ZodUnion:
+ return {
+ type: "union",
+ options: definition.options.map((option: z.ZodTypeAny) =>
+ getSchemaContract(option, seen)
+ ),
+ };
+ default:
+ throw new Error(
+ `Unsupported schema contract type: ${definition.typeName}`
+ );
+ }
+};
+
+const stableStringify = (value: unknown): string => {
+ if (value === undefined) {
+ return "undefined";
+ }
+ if (value instanceof RegExp) {
+ return stableStringify({
+ source: value.source,
+ flags: value.flags,
+ });
+ }
+ if (Array.isArray(value)) {
+ return `[${value.map(stableStringify).join(",")}]`;
+ }
+ if (value !== null && typeof value === "object") {
+ return `{${Object.entries(value)
+ .sort(([left], [right]) => left.localeCompare(right))
+ .map(([key, item]) => `${JSON.stringify(key)}:${stableStringify(item)}`)
+ .join(",")}}`;
+ }
+ return JSON.stringify(value);
+};
+
+export const createContractVersion = (
+ schema: z.ZodTypeAny,
+ version: string,
+ additionalSchemas: z.ZodTypeAny[] = []
+) => {
+ const bundlePackageVersion = version.replace(/-webstudio-version$/, "");
+ let hash = 0x811c9dc5;
+ for (const char of stableStringify({
+ additionalSchemas: additionalSchemas.map((schema) =>
+ getSchemaContract(schema)
+ ),
+ schema: getSchemaContract(schema),
+ })) {
+ hash ^= char.charCodeAt(0);
+ hash = Math.imul(hash, 0x01000193);
+ }
+ return `bundle-${bundlePackageVersion}-${(hash >>> 0).toString(16).padStart(8, "0")}` as const;
+};
diff --git a/packages/protocol/src/fixture-projects.test.ts b/packages/protocol/src/fixture-projects.test.ts
new file mode 100644
index 0000000000..37959d00cd
--- /dev/null
+++ b/packages/protocol/src/fixture-projects.test.ts
@@ -0,0 +1,69 @@
+import { existsSync, readdirSync, readFileSync } from "node:fs";
+import { dirname, join, resolve } from "node:path";
+import { fileURLToPath } from "node:url";
+import { describe, expect, test } from "vitest";
+import { bundleVersion, publishedProjectBundleSchema } from "./schema";
+
+const root = resolve(dirname(fileURLToPath(import.meta.url)), "../../..");
+const fixturesRoot = join(root, "fixtures");
+
+const assetDirectories = [
+ ".webstudio/assets",
+ "public/assets",
+ "build/client/assets",
+ "dist/client/assets",
+] as const;
+
+const getFixtureDataFiles = () =>
+ readdirSync(fixturesRoot, { withFileTypes: true })
+ .filter((entry) => entry.isDirectory())
+ .map((entry) => ({
+ fixtureName: entry.name,
+ fixtureDirectory: join(fixturesRoot, entry.name),
+ dataFile: join(fixturesRoot, entry.name, ".webstudio/data.json"),
+ }))
+ .filter(({ dataFile }) => existsSync(dataFile));
+
+const readFixtureData = (dataFile: string) =>
+ JSON.parse(readFileSync(dataFile, "utf8"));
+
+const hasFixtureAssetFile = (fixtureDirectory: string, assetName: string) =>
+ assetDirectories.some((directory) =>
+ existsSync(join(fixtureDirectory, directory, assetName))
+ );
+
+describe("fixture project bundles", () => {
+ const fixtureDataFiles = getFixtureDataFiles();
+
+ test("keeps at least one project fixture covered", () => {
+ expect(fixtureDataFiles.length).toBeGreaterThan(0);
+ });
+
+ test.each(fixtureDataFiles)(
+ "$fixtureName has current bundle-compatible data",
+ ({ dataFile }) => {
+ const data = publishedProjectBundleSchema.parse(
+ readFixtureData(dataFile)
+ );
+
+ expect(data.bundleVersion).toBe(bundleVersion);
+ }
+ );
+
+ test.each(fixtureDataFiles)(
+ "$fixtureName asset records point at fixture files",
+ ({ dataFile, fixtureDirectory }) => {
+ const data = publishedProjectBundleSchema.parse(
+ readFixtureData(dataFile)
+ );
+ const missingAssetFiles = data.assets
+ .map((asset) => asset.name)
+ .filter(
+ (assetName) =>
+ hasFixtureAssetFile(fixtureDirectory, assetName) === false
+ );
+
+ expect(missingAssetFiles).toEqual([]);
+ }
+ );
+});
diff --git a/packages/protocol/src/fixtures.ts b/packages/protocol/src/fixtures.ts
new file mode 100644
index 0000000000..737329db55
--- /dev/null
+++ b/packages/protocol/src/fixtures.ts
@@ -0,0 +1,121 @@
+import type { Asset, Page } from "@webstudio-is/sdk/schema";
+import { bundleVersion, type PublishedProjectBundle } from "./schema";
+
+type SerializedBuild = PublishedProjectBundle["build"];
+type SerializedPages = SerializedBuild["pages"];
+type ImageAsset = Extract<Asset, { type: "image" }>;
+type SerializedBuildFixtureOptions = Partial<Omit<SerializedBuild, "pages">> & {
+ pages?: Partial<SerializedPages>;
+};
+
+export const createPageFixture = (overrides: Partial<Page> = {}): Page => ({
+ id: "home",
+ name: "Home",
+ path: "",
+ title: "Home",
+ meta: {},
+ rootInstanceId: "root",
+ ...overrides,
+});
+
+export const createImageAssetFixture = (
+ overrides: Partial<ImageAsset> = {}
+): ImageAsset => ({
+ id: "asset-1",
+ projectId: "source-project",
+ name: "image.png",
+ type: "image",
+ createdAt: "2024-01-01T00:00:00.000Z",
+ format: "png",
+ size: 100,
+ meta: { width: 100, height: 100 },
+ ...overrides,
+});
+
+export const createSerializedBuildFixture = ({
+ pages,
+ ...overrides
+}: SerializedBuildFixtureOptions = {}): SerializedBuild => {
+ const page = createPageFixture();
+ return {
+ id: "build-1",
+ projectId: "source-project",
+ version: 1,
+ createdAt: "2024-01-01T00:00:00.000Z",
+ updatedAt: "2024-01-01T00:00:00.000Z",
+ pages: {
+ homePageId: page.id,
+ rootFolderId: "root-folder",
+ pages: [page],
+ folders: [
+ {
+ id: "root-folder",
+ name: "Root",
+ slug: "",
+ children: [page.id],
+ },
+ ],
+ ...pages,
+ } as SerializedPages,
+ breakpoints: [],
+ styles: [],
+ styleSources: [],
+ styleSourceSelections: [],
+ props: [],
+ instances: [],
+ dataSources: [],
+ resources: [],
+ ...overrides,
+ };
+};
+
+type PublishedProjectBundleFixtureOptions = Partial<
+ Omit<PublishedProjectBundle, "assets" | "build" | "page" | "pages">
+> & {
+ build?: SerializedBuildFixtureOptions;
+ buildPages?: Partial<SerializedPages>;
+ page?: Partial<Page>;
+ assets?: Asset[];
+ pages?: Page[];
+};
+
+export const createPublishedProjectBundleFixture = (
+ options: PublishedProjectBundleFixtureOptions = {}
+): PublishedProjectBundle => {
+ const {
+ assets,
+ build,
+ buildPages,
+ page: pageOverrides,
+ pages,
+ ...overrides
+ } = options;
+ const page = createPageFixture(pageOverrides);
+ return {
+ bundleVersion,
+ origin: "https://example.com",
+ projectDomain: "example",
+ projectTitle: "Example",
+ page,
+ pages: "pages" in options ? (pages as Page[]) : [page],
+ assets: "assets" in options ? (assets as Asset[]) : [],
+ build: createSerializedBuildFixture({
+ ...build,
+ pages: {
+ homePageId: page.id,
+ pages: [page],
+ folders: [
+ {
+ id: "root-folder",
+ name: "Root",
+ slug: "",
+ children: [page.id],
+ },
+ ],
+ ...build?.pages,
+ ...buildPages,
+ },
+ }),
+ ...overrides,
+ };
+};
diff --git a/packages/protocol/src/index.ts b/packages/protocol/src/index.ts
new file mode 100644
index 0000000000..68c78b1bdb
--- /dev/null
+++ b/packages/protocol/src/index.ts
@@ -0,0 +1,6 @@
+// Webstudio protocol contract layer.
+// This package owns external data exchange protocols such as the project
+// bundle/import-export artifact and transfer RPC payloads. Domain model schemas
+// stay owned by their packages and are imported through schema-only entrypoints
+// instead of being copied here.
+export * from "./schema";
diff --git a/packages/protocol/src/schema.test.ts b/packages/protocol/src/schema.test.ts
new file mode 100644
index 0000000000..47371dd649
--- /dev/null
+++ b/packages/protocol/src/schema.test.ts
@@ -0,0 +1,76 @@
+import { describe, expect, test } from "vitest";
+import {
+ isAssetFileName,
+ isAssetFileDataString,
+ getBundleVersionMismatchMessage,
+ importProjectBundleInputSchema,
+ publishedProjectBundleSchema,
+ bundleVersion,
+} from "./schema";
+import { createPublishedProjectBundleFixture } from "./fixtures";
+
+describe("project bundle contract", () => {
+ test("validates base64 asset file data", () => {
+ expect(isAssetFileDataString("aGVsbG8=")).toBe(true);
+ expect(isAssetFileDataString("")).toBe(true);
+ expect(isAssetFileDataString("not base64")).toBe(false);
+ expect(isAssetFileDataString("a===")).toBe(false);
+ });
+
+ test("validates asset file names", () => {
+ expect(isAssetFileName("image.png")).toBe(true);
+ expect(isAssetFileName("")).toBe(false);
+ expect(isAssetFileName(".")).toBe(false);
+ expect(isAssetFileName("..")).toBe(false);
+ expect(isAssetFileName("../image.png")).toBe(false);
+ expect(isAssetFileName("folder\\image.png")).toBe(false);
+ });
+
+ test("preserves published project metadata", () => {
+ expect(
+ publishedProjectBundleSchema.parse(
+ createPublishedProjectBundleFixture({
+ user: { email: "[email protected]" },
+ })
+ )
+ ).toMatchObject({
+ projectDomain: "example",
+ projectTitle: "Example",
+ user: { email: "[email protected]" },
+ });
+ });
+
+ test("requires published project metadata", () => {
+ const data = createPublishedProjectBundleFixture();
+ delete (data as Partial<typeof data>).projectTitle;
+
+ expect(() => publishedProjectBundleSchema.parse(data)).toThrow();
+ });
+
+ test("requires published project bundle when importing", () => {
+ const data = createPublishedProjectBundleFixture();
+ delete (data as Partial<typeof data>).projectTitle;
+
+ expect(() =>
+ importProjectBundleInputSchema.parse({
+ projectId: "project",
+ data,
+ })
+ ).toThrow();
+ });
+
+ test("generates the current bundle version", () => {
+ expect(bundleVersion).toMatch(/^bundle-0\.0\.0-[0-9a-f]{8}$/);
+ });
+
+ test("formats project bundle version mismatch messages", () => {
+ expect(
+ getBundleVersionMismatchMessage({
+ ignoreVersionCheckHint: "override the check",
+ receivedVersion: undefined,
+ })
+ ).toBe(
+ `Project bundle format is incompatible. Expected version ${bundleVersion}, received missing. Sync with a compatible API/CLI version and retry, or override the check.`
+ );
+ });
+});
diff --git a/packages/protocol/src/schema.ts b/packages/protocol/src/schema.ts
new file mode 100644
index 0000000000..78bdf07ad3
--- /dev/null
+++ b/packages/protocol/src/schema.ts
@@ -0,0 +1,124 @@
+import { Asset, Page } from "@webstudio-is/sdk/schema";
+import { SerializedBuildSchema } from "@webstudio-is/project-build/schema";
+import { wsAuthConfigSchema } from "@webstudio-is/wsauth/schema";
+import { z } from "zod";
+import packageJson from "../package.json";
+import { createContractVersion } from "./contract-version";
+
+// Bundle owns the assembled external project import/export format.
+// Domain schemas stay owned by their packages (sdk, project-build, etc.) and
+// are imported through schema-only entrypoints to avoid duplicating model
+// definitions or pulling non-schema runtime code into bundle consumers.
+
+export const assetFileDataPattern = /^[A-Za-z0-9+/]*={0,2}$/;
+
+export const isAssetFileDataString = (value: string) => {
+ if (value.length % 4 !== 0) {
+ return false;
+ }
+ if (assetFileDataPattern.test(value) === false) {
+ return false;
+ }
+ const paddingIndex = value.indexOf("=");
+ return paddingIndex === -1 || paddingIndex >= value.length - 2;
+};
+
+const assertAssetFileDataString: z.RefinementEffect<string>["refinement"] =
+ Object.assign(
+ (value: string, context: z.RefinementCtx) => {
+ if (isAssetFileDataString(value)) {
+ return;
+ }
+ context.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: "Invalid asset file data",
+ });
+ },
+ {
+ contract: {
+ encoding: "base64",
+ length: "multiple-of-4",
+ padding: "only-last-two-characters",
+ pattern: assetFileDataPattern,
+ },
+ }
+ );
+
+const assetFileNameSchema = z
+ .string()
+ .min(1)
+ .regex(/^(?!\.{1,2}$)[^/\\]+$/);
+
+export const isAssetFileName = (value: string) =>
+ assetFileNameSchema.safeParse(value).success;
+
+export const assetFileDataSchema = z.object({
+ name: assetFileNameSchema,
+ data: z.string().superRefine(assertAssetFileDataString),
+});
+export type AssetFileData = z.infer<typeof assetFileDataSchema>;
+
+export const projectBundleSchema = z.object({
+ page: Page,
+ pages: z.array(Page),
+ build: SerializedBuildSchema,
+ assets: z.array(Asset),
+ origin: z.string().optional(),
+});
+export type ProjectBundle = z.infer<typeof projectBundleSchema>;
+
+export const publishedProjectBundleSchema = projectBundleSchema.extend({
+ bundleVersion: z.union([z.string(), z.number()]).optional(),
+ user: z.object({ email: z.string().nullable() }).optional(),
+ projectDomain: z.string(),
+ projectTitle: z.string(),
+});
+export type PublishedProjectBundle = z.infer<
+ typeof publishedProjectBundleSchema
+>;
+
+export const importProjectBundleInputSchema = z.object({
+ projectId: z.string(),
+ data: publishedProjectBundleSchema,
+ assetFiles: z.array(assetFileDataSchema).optional(),
+ ignoreVersionCheck: z.boolean().optional(),
+});
+export type ImportProjectBundleInput = z.infer<
+ typeof importProjectBundleInputSchema
+>;
+
+export const importProjectBundleResultSchema = z.object({
+ version: z.number(),
+});
+export type ImportProjectBundleResult = z.infer<
+ typeof importProjectBundleResultSchema
+>;
+
+export const checkProjectBuildPermissionInputSchema = z.object({
+ projectId: z.string(),
+});
+
+export const bundleVersion = createContractVersion(
+ publishedProjectBundleSchema,
+ packageJson.version,
+ [wsAuthConfigSchema]
+);
+
+export const getBundleVersion = (data: unknown) => {
+ if (typeof data !== "object" || data === null) {
+ return;
+ }
+ const version = (data as { bundleVersion?: unknown }).bundleVersion;
+ return typeof version === "number" || typeof version === "string"
+ ? version
+ : undefined;
+};
+
+export const getBundleVersionMismatchMessage = ({
+ ignoreVersionCheckHint,
+ receivedVersion,
+}: {
+ ignoreVersionCheckHint: string;
+ receivedVersion: number | string | undefined;
+}) =>
+ `Project bundle format is incompatible. Expected version ${bundleVersion}, received ${receivedVersion ?? "missing"}. Sync with a compatible API/CLI version and retry, or ${ignoreVersionCheckHint}.`;
diff --git a/packages/protocol/tsconfig.dts.json b/packages/protocol/tsconfig.dts.json
new file mode 100644
index 0000000000..2df90ca42a
--- /dev/null
+++ b/packages/protocol/tsconfig.dts.json
@@ -0,0 +1,13 @@
+{
+ "extends": "./tsconfig.json",
+ "include": ["src"],
+ "exclude": [
+ "**/*.test.ts",
+ "**/*.test.tsx",
+ "**/*.stories.ts",
+ "**/*.stories.tsx"
+ ],
+ "compilerOptions": {
+ "declarationDir": "lib/types"
+ }
+}
diff --git a/packages/protocol/tsconfig.json b/packages/protocol/tsconfig.json
new file mode 100644
index 0000000000..d2e5040f8f
--- /dev/null
+++ b/packages/protocol/tsconfig.json
@@ -0,0 +1,3 @@
+{
+ "extends": "@webstudio-is/tsconfig/base.json"
+}
diff --git a/packages/sdk/package.json b/packages/sdk/package.json
index 3af7413cc1..4b5fd6108f 100644
--- a/packages/sdk/package.json
+++ b/packages/sdk/package.json
@@ -23,6 +23,11 @@
"types": "./lib/types/link-utils.d.ts",
"import": "./lib/link-utils.js"
},
+ "./schema": {
+ "webstudio": "./src/schema.ts",
+ "types": "./lib/types/schema.d.ts",
+ "import": "./lib/schema.js"
+ },
"./normalize.css": {
"webstudio": "./src/__generated__/normalize.css.ts",
"types": "./lib/types/__generated__/normalize.css.d.ts",
@@ -46,7 +51,7 @@
"typecheck": "tsgo --noEmit -p tsconfig.typecheck.json",
"test": "vitest run",
"build:normalize.css": "tsx --conditions=webstudio ./scripts/normalize.css.ts && prettier --write src/__generated__/normalize.css.ts",
- "build": "rm -rf lib && esbuild src/index.ts src/runtime.ts src/link-utils.ts src/__generated__/normalize.css.ts src/core-templates.tsx --outdir=lib --bundle --format=esm --packages=external",
+ "build": "rm -rf lib && esbuild src/index.ts src/runtime.ts src/link-utils.ts src/schema.ts src/__generated__/normalize.css.ts src/core-templates.tsx --outdir=lib --bundle --format=esm --packages=external",
"dts": "tsc --project tsconfig.dts.json"
},
"dependencies": {
diff --git a/packages/sdk/src/page-utils.ts b/packages/sdk/src/page-utils.ts
index 0da5a9c75e..a2c0c631c4 100644
--- a/packages/sdk/src/page-utils.ts
+++ b/packages/sdk/src/page-utils.ts
@@ -1,5 +1,10 @@
import { executeExpression } from "./expression";
-import type { Folder, Page, PageTemplate, Pages } from "./schema/pages";
+import {
+ type Folder,
+ type Page,
+ type PageTemplate,
+ type Pages,
+} from "./schema/pages";
import { isPathnamePattern } from "./url-pattern";
export const ROOT_FOLDER_ID = "root";
diff --git a/packages/sdk/src/schema.ts b/packages/sdk/src/schema.ts
new file mode 100644
index 0000000000..24b2e3ac93
--- /dev/null
+++ b/packages/sdk/src/schema.ts
@@ -0,0 +1,14 @@
+// Schema-only public entrypoint.
+// API contracts should import domain models from this file instead of the
+// package root so they do not pull SDK runtime helpers into API consumers.
+export * from "./schema/assets";
+export * from "./schema/breakpoints";
+export * from "./schema/data-sources";
+export * from "./schema/deployment";
+export * from "./schema/instances";
+export * from "./schema/pages";
+export * from "./schema/props";
+export * from "./schema/resources";
+export * from "./schema/style-source-selections";
+export * from "./schema/style-sources";
+export * from "./schema/styles";
diff --git a/packages/sdk/src/schema/pages.ts b/packages/sdk/src/schema/pages.ts
index d04df06e47..7f6dbf52c3 100644
--- a/packages/sdk/src/schema/pages.ts
+++ b/packages/sdk/src/schema/pages.ts
@@ -194,7 +194,7 @@ export const PagePath = DefaultPagePage.refine(
"Must start with a / or a full URL e.g. https://website.org"
);
-const Page = z.object({
+export const Page = z.object({
...commonPageFields,
path: z.union([HomePagePath, PagePath]),
});
@@ -210,7 +210,7 @@ export const PageTemplate = z.object({
export type PageTemplate = z.infer<typeof PageTemplate>;
-const ProjectMeta = z.object({
+export const ProjectMeta = z.object({
// All fields are optional to ensure consistency and allow for the addition of new fields without requiring migration
siteName: z.string().optional(),
contactEmail: z.string().optional(),
diff --git a/packages/sdk/tsconfig.dts.json b/packages/sdk/tsconfig.dts.json
index 4de0c60956..10902749fb 100644
--- a/packages/sdk/tsconfig.dts.json
+++ b/packages/sdk/tsconfig.dts.json
@@ -5,6 +5,7 @@
"src/index.ts",
"src/runtime.ts",
"src/link-utils.ts",
+ "src/schema.ts",
"src/__generated__/normalize.css.ts"
],
"compilerOptions": {
diff --git a/packages/trpc-interface/src/shared/deployment.ts b/packages/trpc-interface/src/shared/deployment.ts
index fa81839eb6..9508fc034a 100644
--- a/packages/trpc-interface/src/shared/deployment.ts
+++ b/packages/trpc-interface/src/shared/deployment.ts
@@ -3,7 +3,7 @@ import { router, procedure } from "./trpc";
// Has corresponding type in saas
export const PublishInput = z.object({
- // used to load build data from the builder with build.loadProjectDataByBuildId
+ // used to load build data from the builder with build.loadProjectBundleByBuildId
buildId: z.string(),
builderOrigin: z.string(),
githubSha: z.string().optional(),
diff --git a/packages/wsauth/package.json b/packages/wsauth/package.json
index 1eb19d635e..4e2b479bf3 100644
--- a/packages/wsauth/package.json
+++ b/packages/wsauth/package.json
@@ -6,11 +6,14 @@
"homepage": "https://webstudio.is",
"type": "module",
"scripts": {
- "build": "rm -rf lib && esbuild src/index.ts --outdir=lib --bundle --format=esm --packages=external",
+ "build": "rm -rf lib && esbuild src/index.ts src/schema.ts --outdir=lib --bundle --format=esm --packages=external",
"dts": "tsc --project tsconfig.dts.json",
"typecheck": "tsgo --noEmit",
"test": "vitest run"
},
+ "dependencies": {
+ "zod": "^3.24.2"
+ },
"devDependencies": {
"@webstudio-is/tsconfig": "workspace:*",
"vitest": "^3.1.2"
@@ -20,6 +23,11 @@
"webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js"
+ },
+ "./schema": {
+ "webstudio": "./src/schema.ts",
+ "types": "./lib/types/schema.d.ts",
+ "import": "./lib/schema.js"
}
},
"files": [
diff --git a/packages/wsauth/src/index.ts b/packages/wsauth/src/index.ts
index 61891b38a1..d38da8f774 100644
--- a/packages/wsauth/src/index.ts
+++ b/packages/wsauth/src/index.ts
@@ -1,3 +1,6 @@
+import type { BasicAuthInput, WsAuthConfig } from "./schema";
+export type { BasicAuthInput, WsAuthConfig } from "./schema";
+
export type BasicAuthRule = {
method: "basic";
login: string;
@@ -37,23 +40,6 @@ export type WsAuthBuildResult = {
content: string;
};
-export type WsAuthConfig = {
- version: 1;
- routes: Record<string, BasicAuthInput>;
-};
-
-export type BasicAuthInput =
- | {
- method: "basic";
- login: string;
- password: string;
- }
- | {
- type: "basic";
- login: string;
- password: string;
- };
-
export type WsAuthPageInput = {
route: string;
auth?: BasicAuthInput;
@@ -395,16 +381,6 @@ export const createWsAuthResources = ({
{ name: projectSourceName, content: projectContent },
{ name: generatedSourceName, routes: generatedRoutes },
]);
- console.info("[wsauth] create resources", {
- projectContentLength: projectContent.length,
- projectContent,
- pageCount: pages.length,
- pages,
- generatedRouteCount: generatedRoutes.length,
- generatedRoutes,
- routeCount: result.routes.length,
- routes: result.routes,
- });
return {
...result,
module: [
@@ -494,22 +470,8 @@ export const matchWsAuthRoute = (route: string, pathname: string) => {
return matchSegments(0, 0);
};
-export const findWsAuthRoute = (
- authRoutes: WsAuthRoute[],
- pathname: string
-) => {
- const authRoute = authRoutes.find(({ route }) =>
- matchWsAuthRoute(route, pathname)
- );
- console.info("[wsauth] find route", {
- pathname,
- routeCount: authRoutes.length,
- authRoutes,
- matchedRoute: authRoute?.route,
- matchedAuth: authRoute?.auth,
- });
- return authRoute;
-};
+export const findWsAuthRoute = (authRoutes: WsAuthRoute[], pathname: string) =>
+ authRoutes.find(({ route }) => matchWsAuthRoute(route, pathname));
export const authenticateRequest = (
request: Request,
@@ -517,53 +479,15 @@ export const authenticateRequest = (
) => {
const url = new URL(request.url);
const authorization = request.headers.get("Authorization");
- console.info("[wsauth] authenticate request", {
- method: request.method,
- url: url.href,
- pathname: url.pathname,
- routeCount: authRoutes.length,
- authRoutes,
- hasAuthorization: authorization !== null,
- authorization,
- authorizationScheme: authorization?.split(/\s+/, 1)[0]?.toLowerCase(),
- });
const authRoute = findWsAuthRoute(authRoutes, url.pathname);
if (authRoute === undefined) {
- console.info("[wsauth] authenticate result", {
- pathname: url.pathname,
- result: "not-protected",
- });
return;
}
if (authRoute.auth.method === "basic") {
const credentials = getBasicAuthCredentials(authorization);
if (credentials === authRoute.auth.credentials) {
- console.info("[wsauth] authenticate result", {
- pathname: url.pathname,
- route: authRoute.route,
- method: authRoute.auth.method,
- result: "authorized",
- hasParsedCredentials: credentials !== undefined,
- parsedCredentials: credentials,
- expectedCredentials: authRoute.auth.credentials,
- expectedLogin: authRoute.auth.login,
- expectedPassword: authRoute.auth.password,
- });
return authRoute;
}
- console.warn("[wsauth] authenticate result", {
- pathname: url.pathname,
- route: authRoute.route,
- method: authRoute.auth.method,
- result: "unauthorized",
- hasAuthorization: authorization !== null,
- hasParsedCredentials: credentials !== undefined,
- authorization,
- parsedCredentials: credentials,
- expectedCredentials: authRoute.auth.credentials,
- expectedLogin: authRoute.auth.login,
- expectedPassword: authRoute.auth.password,
- });
throw new Response("Authentication required", {
status: 401,
headers: {
diff --git a/packages/wsauth/src/schema.ts b/packages/wsauth/src/schema.ts
new file mode 100644
index 0000000000..bc67d28455
--- /dev/null
+++ b/packages/wsauth/src/schema.ts
@@ -0,0 +1,22 @@
+import { z } from "zod";
+
+export const basicAuthInputSchema = z.union([
+ z.object({
+ method: z.literal("basic"),
+ login: z.string(),
+ password: z.string(),
+ }),
+ z.object({
+ type: z.literal("basic"),
+ login: z.string(),
+ password: z.string(),
+ }),
+]);
+
+export type BasicAuthInput = z.infer<typeof basicAuthInputSchema>;
+
+export const wsAuthConfigSchema = z.object({
+ version: z.literal(1),
+ routes: z.record(basicAuthInputSchema),
+});
+export type WsAuthConfig = z.infer<typeof wsAuthConfigSchema>;
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 93c28461af..98679d603d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -274,6 +274,9 @@ importers:
'@webstudio-is/project-migrations':
specifier: workspace:*
version: link:../../packages/project-migrations
+ '@webstudio-is/protocol':
+ specifier: workspace:*
+ version: link:../../packages/protocol
'@webstudio-is/react-sdk':
specifier: workspace:*
version: link:../../packages/react-sdk
@@ -1134,6 +1137,9 @@ importers:
'@webstudio-is/project-migrations':
specifier: workspace:*
version: link:../project-migrations
+ '@webstudio-is/protocol':
+ specifier: workspace:*
+ version: link:../protocol
'@webstudio-is/trpc-interface':
specifier: workspace:*
version: link:../trpc-interface
@@ -1687,12 +1693,9 @@ importers:
'@trpc/client':
specifier: ^10.45.2
version: 10.45.2(@trpc/[email protected])
- '@webstudio-is/project-migrations':
+ '@webstudio-is/protocol':
specifier: workspace:*
- version: link:../project-migrations
- '@webstudio-is/sdk':
- specifier: workspace:*
- version: link:../sdk
+ version: link:../protocol
devDependencies:
'@webstudio-is/tsconfig':
specifier: workspace:*
@@ -1931,6 +1934,9 @@ importers:
'@webstudio-is/sdk':
specifier: workspace:*
version: link:../sdk
+ zod:
+ specifier: ^3.24.2
+ version: 3.24.2
devDependencies:
'@webstudio-is/tsconfig':
specifier: workspace:*
@@ -1945,6 +1951,28 @@ importers:
specifier: ^3.1.2
+ packages/protocol:
+ dependencies:
+ '@webstudio-is/project-build':
+ specifier: workspace:*
+ version: link:../project-build
+ '@webstudio-is/sdk':
+ specifier: workspace:*
+ version: link:../sdk
+ '@webstudio-is/wsauth':
+ specifier: workspace:*
+ version: link:../wsauth
+ zod:
+ specifier: ^3.24.2
+ version: 3.24.2
+ devDependencies:
+ '@webstudio-is/tsconfig':
+ specifier: workspace:*
+ version: link:../tsconfig
+ vitest:
+ specifier: ^3.1.2
+
packages/react-sdk:
dependencies:
'@webstudio-is/css-engine':
@@ -2460,6 +2488,10 @@ importers:
packages/tsconfig: {}
packages/wsauth:
+ dependencies:
+ zod:
+ specifier: ^3.24.2
+ version: 3.24.2
devDependencies:
'@webstudio-is/tsconfig':
specifier: workspace:*