diff --git a/functions/src/publicCloudQueries.ts b/functions/src/publicCloudQueries.ts index 3dc9b66..1179362 100644 --- a/functions/src/publicCloudQueries.ts +++ b/functions/src/publicCloudQueries.ts @@ -7,6 +7,24 @@ const intechstudioApiKey = defineSecret("X_INTECHSTUDIO_KEY"); admin.initializeApp(); const db = admin.firestore(); +const publicProfileFields = [ + "id", + "modifiedAt", + "createdAt", + "name", + "description", + "type", + "version", + "configType", + "configs", + "owner", + "virtualPath", + "temporaryGraphPath", + "displayName", + "access", + "public", +] as const; + // Helper function to validate API key function validateApiKey( req: Request, @@ -40,6 +58,7 @@ export const readAllProfiles = onRequest( } db.collection("configs") + .select(...publicProfileFields) .where("public", "==", true) .get() .then((snapshot) => { @@ -66,6 +85,7 @@ export const readUserProfiles = onRequest( } db.collection("configs") + .select(...publicProfileFields) .where("owner", "==", userId) .where("public", "==", true) .get() @@ -91,6 +111,7 @@ export const readSingleProfile = onRequest( console.log(profileId); db.collection("configs") + .select(...publicProfileFields) .where("id", "==", profileId) .where("public", "==", true) .get() diff --git a/package-lock.json b/package-lock.json index 545122e..3387218 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.1", "dependencies": { "@intechstudio/grid-protocol": "1.20250305.1735", - "@intechstudio/grid-uikit": "^1.20260206.1447", + "@intechstudio/grid-uikit": "^1.20260626.1305", "@melt-ui/svelte": "^0.86.6", "firebase": "^12.2.1", "marked": "^12.0.2", @@ -1252,9 +1252,9 @@ "integrity": "sha512-pAnLVlkiAk8zz+yBc99TdeUiH2wXPuNwWb0ZBgqcqtcIT8bUh7zMY2s7ll0KQsI9HsVP/3IwB2htNHCyNIWCsg==" }, "node_modules/@intechstudio/grid-uikit": { - "version": "1.20260206.1447", - "resolved": "https://registry.npmjs.org/@intechstudio/grid-uikit/-/grid-uikit-1.20260206.1447.tgz", - "integrity": "sha512-nYBE1IvL0ZnlMMsdc5WEtKWX5d0gdS9G64t4bPVqxk90Lv4tMLipPQaJNNeM02MEEYz2U5jQOImzTPpHfsDxJw==", + "version": "1.20260626.1305", + "resolved": "https://registry.npmjs.org/@intechstudio/grid-uikit/-/grid-uikit-1.20260626.1305.tgz", + "integrity": "sha512-obTptIp9E87S02LyK76VGf2vusiWg1ZxxxfD5XPfEwoXt0fpzd+mMmlK4LtKaTciDmakq+Mofb45biRkslkHYA==", "dependencies": { "@melt-ui/svelte": "^0.86.6", "color-convert": "^2.0.1", @@ -3263,18 +3263,6 @@ "dev": true, "license": "ISC" }, - "node_modules/jiti": { - "version": "1.21.7", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz", - "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "bin": { - "jiti": "bin/jiti.js" - } - }, "node_modules/js-yaml": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", @@ -4240,21 +4228,6 @@ } } }, - "node_modules/svelte-check/node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/svelte-check/node_modules/readdirp": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", @@ -4825,21 +4798,6 @@ "node": ">=10" } }, - "node_modules/yaml": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz", - "integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==", - "dev": true, - "license": "ISC", - "optional": true, - "peer": true, - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14.6" - } - }, "node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", diff --git a/package.json b/package.json index d8bf74a..33a1976 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "type": "module", "dependencies": { "@intechstudio/grid-protocol": "1.20250305.1735", - "@intechstudio/grid-uikit": "^1.20260206.1447", + "@intechstudio/grid-uikit": "^1.20260626.1305", "@melt-ui/svelte": "^0.86.6", "firebase": "^12.2.1", "marked": "^12.0.2", diff --git a/src/lib/schemas.ts b/src/lib/schemas.ts index f58dae3..cd1b652 100644 --- a/src/lib/schemas.ts +++ b/src/lib/schemas.ts @@ -2,6 +2,14 @@ import { ElementType, ModuleType } from "@intechstudio/grid-protocol"; import { Timestamp } from "firebase/firestore"; import { z } from "zod"; +export const ConfigFileSchema = z.object({ + name: z.string(), + content: z.string(), + mimeType: z.string().optional(), +}); + +export type ConfigFile = z.infer; + export const BaseConfigSchema = z.object({ id: z.string(), modifiedAt: z.coerce.date().default(new Date()), @@ -27,6 +35,7 @@ export const BaseConfigSchema = z.object({ virtualPath: z.string().optional(), temporaryGraphPath: z.string().optional(), displayName: z.string().optional(), + files: z.array(ConfigFileSchema).optional(), }); export type BaseConfig = z.infer; diff --git a/src/routes/ConfigCardDisplay.svelte b/src/routes/ConfigCardDisplay.svelte index 5bec184..1366237 100644 --- a/src/routes/ConfigCardDisplay.svelte +++ b/src/routes/ConfigCardDisplay.svelte @@ -165,7 +165,6 @@ }); }} /> - Folder: + {#if data.files && data.files.length > 0} +
+ + + + + + + + + {#each data.files as file} + + + + + {/each} + +
Page files for File ManagerSize
+
+ + {file.name} +
+
+ {new TextEncoder().encode(file.content).length}b +
+
+ {/if}
diff --git a/src/routes/EditorLayout.svelte b/src/routes/EditorLayout.svelte index 9208e5c..b872bfd 100644 --- a/src/routes/EditorLayout.svelte +++ b/src/routes/EditorLayout.svelte @@ -154,6 +154,11 @@ }); configResponse.data.name = name; + console.log( + "[WCPC] This is what we got from editor", + configResponse.data, + ); + const config = BaseConfigSchema.parse(configResponse.data); config.createdAt = new Date(); const cm = get(config_manager); @@ -207,6 +212,7 @@ type: editorConfig.type, version: editorConfig.version, configType: editorConfig.configType, + files: editorConfig?.files, }; if (newConfig.type !== config.type) { diff --git a/vite.postbuild.ts b/vite.postbuild.ts index c862716..c0b81c4 100644 --- a/vite.postbuild.ts +++ b/vite.postbuild.ts @@ -6,6 +6,7 @@ export function notifyEditorAfterBuildPlugin(): PluginOption { name: "postbuild-notify-editor", closeBundle: () => new Promise((resolve) => { + console.log("notify start"); if ( process.env.WEB_COMPONENT_NAME && process.env.WEB_COMPONENT_NAME != "profile-cloud-dev" @@ -19,6 +20,7 @@ export function notifyEditorAfterBuildPlugin(): PluginOption { }, 3000); let ws = new WebSocket("ws://localhost:9000"); ws.on("open", () => { + console.log("Websocket message sent!"); ws.send( JSON.stringify({ type: "developer-package",