@payloadcms/figma 0.1.0-alpha.1 → 0.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/dist/{utils → adapters}/asset-collection.d.ts +17 -3
- package/dist/adapters/asset-collection.js +242 -0
- package/dist/{utils → adapters}/build-lambda-zip.d.ts +8 -7
- package/dist/adapters/build-lambda-zip.js +111 -0
- package/dist/adapters/configureNextjsCache.d.ts +8 -0
- package/dist/adapters/configureNextjsCache.js +55 -0
- package/dist/adapters/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.d.ts +1 -0
- package/dist/adapters/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.js +15 -0
- package/dist/adapters/deploy-output/inspectNextjsOutput.d.ts +12 -0
- package/dist/adapters/deploy-output/inspectNextjsOutput.js +28 -0
- package/dist/adapters/deploy-output/inspectNitroOutput.d.ts +9 -0
- package/dist/adapters/deploy-output/inspectNitroOutput.js +13 -0
- package/dist/adapters/deploy-output/isFile.d.ts +1 -0
- package/dist/adapters/deploy-output/isFile.js +4 -0
- package/dist/adapters/deploy-output/readJson.d.ts +1 -0
- package/dist/adapters/deploy-output/readJson.js +9 -0
- package/dist/adapters/deploy-output/resolveNitroOutputLayout.d.ts +8 -0
- package/dist/adapters/deploy-output/resolveNitroOutputLayout.js +16 -0
- package/dist/adapters/deploy-output/resolveOutputPath.d.ts +2 -0
- package/dist/adapters/deploy-output/resolveOutputPath.js +9 -0
- package/dist/adapters/deploy-output/resolveWithin.d.ts +1 -0
- package/dist/adapters/deploy-output/resolveWithin.js +12 -0
- package/dist/adapters/fs-utils.d.ts +39 -0
- package/dist/adapters/fs-utils.js +135 -0
- package/dist/adapters/index.d.ts +4 -0
- package/dist/adapters/index.js +3 -0
- package/dist/adapters/lambda-runtime/nextjs-cache.d.ts +40 -0
- package/dist/adapters/lambda-runtime/nextjs-cache.js +174 -0
- package/dist/adapters/nextjs.d.ts +12 -0
- package/dist/adapters/nextjs.js +67 -0
- package/dist/adapters/nitro.d.ts +8 -0
- package/dist/adapters/nitro.js +193 -0
- package/dist/adapters/secret-files.d.ts +25 -0
- package/dist/adapters/secret-files.js +50 -0
- package/dist/adapters/types.d.ts +42 -0
- package/dist/adapters/types.js +1 -0
- package/dist/{utils/adapters → adapters}/vite.d.ts +2 -2
- package/dist/adapters/vite.js +33 -0
- package/dist/api/check-project-subdomain-availability.d.ts +12 -0
- package/dist/api/check-project-subdomain-availability.js +32 -0
- package/dist/api/control-plane-error.d.ts +6 -0
- package/dist/api/control-plane-error.js +8 -0
- package/dist/api/control-plane-fetch.d.ts +7 -0
- package/dist/api/control-plane-fetch.js +37 -0
- package/dist/api/control-plane.d.ts +1 -9
- package/dist/api/control-plane.js +2 -48
- package/dist/api/create-project.d.ts +18 -0
- package/dist/api/create-project.js +37 -0
- package/dist/api/list-project-workspaces.d.ts +8 -0
- package/dist/api/list-project-workspaces.js +28 -0
- package/dist/api/project-resource-type.d.ts +1 -0
- package/dist/api/project-resource-type.js +1 -0
- package/dist/auth/headless-oauth-flow.d.ts +23 -0
- package/dist/auth/headless-oauth-flow.js +69 -0
- package/dist/auth/oauth-flow.d.ts +2 -0
- package/dist/auth/oauth-flow.js +13 -8
- package/dist/auth/token-store.d.ts +4 -1
- package/dist/auth/token-store.js +14 -0
- package/dist/auth/types.d.ts +12 -0
- package/dist/cli.d.ts +39 -0
- package/dist/cli.js +71 -36
- package/dist/commands/bootstrap.js +2 -1
- package/dist/commands/build-lambda-zip.js +1 -1
- package/dist/commands/deploy.d.ts +12 -0
- package/dist/commands/deploy.js +63 -25
- package/dist/commands/detect-project-resource-type.d.ts +3 -0
- package/dist/commands/detect-project-resource-type.js +28 -0
- package/dist/commands/init.d.ts +2 -2
- package/dist/commands/init.js +164 -79
- package/dist/commands/login.d.ts +11 -1
- package/dist/commands/login.js +66 -4
- package/dist/commands/prompt-to-create-project/format-project-subdomain.d.ts +1 -0
- package/dist/commands/prompt-to-create-project/format-project-subdomain.js +3 -0
- package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.d.ts +1 -0
- package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.js +7 -0
- package/dist/commands/prompt-to-create-project/get-default-project-name.d.ts +1 -0
- package/dist/commands/prompt-to-create-project/get-default-project-name.js +13 -0
- package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.d.ts +7 -0
- package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.js +32 -0
- package/dist/commands/prompt-to-create-project/resolve-project-region.d.ts +8 -0
- package/dist/commands/prompt-to-create-project/resolve-project-region.js +27 -0
- package/dist/commands/prompt-to-create-project/resolve-project-subdomain.d.ts +9 -0
- package/dist/commands/prompt-to-create-project/resolve-project-subdomain.js +54 -0
- package/dist/commands/prompt-to-create-project/resolve-text-input.d.ts +9 -0
- package/dist/commands/prompt-to-create-project/resolve-text-input.js +23 -0
- package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.d.ts +12 -0
- package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.js +36 -0
- package/dist/commands/prompt-to-create-project/validate-subdomain.d.ts +1 -0
- package/dist/commands/prompt-to-create-project/validate-subdomain.js +9 -0
- package/dist/commands/prompt-to-create-project.d.ts +24 -0
- package/dist/commands/prompt-to-create-project.js +69 -0
- package/dist/commands/setup-agent.d.ts +12 -0
- package/dist/commands/setup-agent.js +123 -0
- package/dist/commands/write-project-configuration.d.ts +12 -0
- package/dist/commands/write-project-configuration.js +16 -0
- package/dist/db-content-api/generated/content-api-types.d.ts +6 -2
- package/dist/db-content-api/index.d.ts +1 -1
- package/dist/db-content-api/index.js +121 -72
- package/dist/db-content-api/utilities/data/index.js +2 -2
- package/dist/db-content-api/utilities/data/injectGlobalType.d.ts +6 -0
- package/dist/db-content-api/utilities/data/injectGlobalType.js +11 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +3 -11
- package/dist/db-content-api/utilities/data/removeVirtualFields.js +12 -50
- package/dist/db-content-api/utilities/isRecord.d.ts +9 -0
- package/dist/db-content-api/utilities/isRecord.js +19 -0
- package/dist/db-content-api/utilities/joins.js +5 -1
- package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.d.ts +10 -0
- package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.js +95 -0
- package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.d.ts +9 -0
- package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.js +112 -0
- package/dist/db-content-api/utilities/schema/getDocumentSchema.d.ts +3 -0
- package/dist/db-content-api/utilities/schema/getDocumentSchema.js +24 -0
- package/dist/db-content-api/utilities/where.d.ts +2 -6
- package/dist/db-content-api/utilities/where.js +20 -9
- package/dist/exports/client.d.ts +2 -0
- package/dist/exports/client.js +2 -0
- package/dist/exports/views.d.ts +1 -0
- package/dist/exports/views.js +1 -0
- package/dist/imageSizeOptions.d.ts +23 -0
- package/dist/imageSizeOptions.js +26 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/lib/write-agent-config.d.ts +12 -0
- package/dist/lib/write-agent-config.js +52 -0
- package/dist/next/image-loader.d.ts +6 -0
- package/dist/next/image-loader.js +14 -0
- package/dist/oauth/components/LoginButton/index.js +66 -19
- package/dist/oauth/components/LoginButton/index.scss +121 -15
- package/dist/oauth/defaults.js +4 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js +5 -2
- package/dist/oauth/index.js +8 -7
- package/dist/oauth/utilities/getAdminCollectionSlug.d.ts +1 -1
- package/dist/oauth/utilities/getAuthorizeURL.d.ts +1 -0
- package/dist/oauth/utilities/getAuthorizeURL.js +5 -1
- package/dist/plugin/build-config.d.ts +4 -2
- package/dist/plugin/build-config.js +95 -31
- package/dist/plugin/cache-revalidation-hooks.d.ts +6 -0
- package/dist/plugin/cache-revalidation-hooks.js +69 -0
- package/dist/plugin/cloud-limits/CloudLimitModal/index.d.ts +8 -0
- package/dist/plugin/cloud-limits/CloudLimitModal/index.js +66 -0
- package/dist/plugin/cloud-limits/CloudLimitModal/index.scss +56 -0
- package/dist/plugin/cloud-limits/CloudLimitProvider/index.d.ts +4 -0
- package/dist/plugin/cloud-limits/CloudLimitProvider/index.js +110 -0
- package/dist/plugin/cloud-limits/LimitReachedView/index.css +14 -0
- package/dist/plugin/cloud-limits/LimitReachedView/index.d.ts +4 -0
- package/dist/plugin/cloud-limits/LimitReachedView/index.js +52 -0
- package/dist/plugin/cloud-limits/SlugRegistryContext/index.d.ts +7 -0
- package/dist/plugin/cloud-limits/SlugRegistryContext/index.js +3 -0
- package/dist/plugin/cloud-limits/SlugTracker/index.d.ts +1 -0
- package/dist/plugin/cloud-limits/SlugTracker/index.js +27 -0
- package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.d.ts +2 -0
- package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.js +30 -0
- package/dist/plugin/cloud-limits/routes.d.ts +2 -0
- package/dist/plugin/cloud-limits/routes.js +4 -0
- package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.d.ts +9 -0
- package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.js +28 -0
- package/dist/plugin/cloud-limits/shared.d.ts +10 -0
- package/dist/plugin/cloud-limits/shared.js +52 -0
- package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.d.ts +2 -0
- package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.js +134 -0
- package/dist/plugin/cloud-limits/utilities/toasts.d.ts +4 -0
- package/dist/plugin/cloud-limits/utilities/toasts.js +19 -0
- package/dist/plugin/make-permission-access/make-permission-access.d.ts +8 -0
- package/dist/plugin/make-permission-access/make-permission-access.js +24 -0
- package/dist/plugin/sandbox-upload-fetch.d.ts +32 -0
- package/dist/plugin/sandbox-upload-fetch.js +53 -0
- package/dist/skills/deploy-to-figma/SKILL.md +234 -0
- package/dist/skills/deploy-to-figma/references/cli-reference.md +146 -0
- package/dist/storage-content-api/client-uploads/generate.js +2 -1
- package/dist/storage-content-api/getDownloadResponseHeaderPolicy.d.ts +11 -0
- package/dist/storage-content-api/getDownloadResponseHeaderPolicy.js +27 -0
- package/dist/storage-content-api/index.js +1 -0
- package/dist/storage-content-api/resolveDownloadResponseHeaders.d.ts +5 -0
- package/dist/storage-content-api/resolveDownloadResponseHeaders.js +13 -0
- package/dist/storage-content-api/staticHandler.js +2 -1
- package/dist/storage-content-api/types.d.ts +4 -1
- package/dist/translations/ar.d.ts +12 -0
- package/dist/translations/ar.js +12 -0
- package/dist/translations/az.d.ts +12 -0
- package/dist/translations/az.js +12 -0
- package/dist/translations/bg.d.ts +12 -0
- package/dist/translations/bg.js +12 -0
- package/dist/translations/bnBd.d.ts +12 -0
- package/dist/translations/bnBd.js +12 -0
- package/dist/translations/bnIn.d.ts +12 -0
- package/dist/translations/bnIn.js +12 -0
- package/dist/translations/ca.d.ts +12 -0
- package/dist/translations/ca.js +12 -0
- package/dist/translations/cs.d.ts +12 -0
- package/dist/translations/cs.js +12 -0
- package/dist/translations/da.d.ts +12 -0
- package/dist/translations/da.js +12 -0
- package/dist/translations/de.d.ts +12 -0
- package/dist/translations/de.js +12 -0
- package/dist/translations/en.d.ts +12 -0
- package/dist/translations/en.js +12 -0
- package/dist/translations/es.d.ts +12 -0
- package/dist/translations/es.js +12 -0
- package/dist/translations/et.d.ts +12 -0
- package/dist/translations/et.js +12 -0
- package/dist/translations/fa.d.ts +12 -0
- package/dist/translations/fa.js +12 -0
- package/dist/translations/fr.d.ts +12 -0
- package/dist/translations/fr.js +12 -0
- package/dist/translations/he.d.ts +12 -0
- package/dist/translations/he.js +12 -0
- package/dist/translations/hr.d.ts +12 -0
- package/dist/translations/hr.js +12 -0
- package/dist/translations/hu.d.ts +12 -0
- package/dist/translations/hu.js +12 -0
- package/dist/translations/hy.d.ts +12 -0
- package/dist/translations/hy.js +12 -0
- package/dist/translations/id.d.ts +12 -0
- package/dist/translations/id.js +12 -0
- package/dist/translations/index.d.ts +533 -0
- package/dist/translations/index.js +90 -0
- package/dist/translations/is.d.ts +12 -0
- package/dist/translations/is.js +12 -0
- package/dist/translations/it.d.ts +12 -0
- package/dist/translations/it.js +12 -0
- package/dist/translations/ja.d.ts +12 -0
- package/dist/translations/ja.js +12 -0
- package/dist/translations/ko.d.ts +12 -0
- package/dist/translations/ko.js +12 -0
- package/dist/translations/lt.d.ts +12 -0
- package/dist/translations/lt.js +12 -0
- package/dist/translations/lv.d.ts +12 -0
- package/dist/translations/lv.js +12 -0
- package/dist/translations/my.d.ts +12 -0
- package/dist/translations/my.js +12 -0
- package/dist/translations/nb.d.ts +12 -0
- package/dist/translations/nb.js +12 -0
- package/dist/translations/nl.d.ts +12 -0
- package/dist/translations/nl.js +12 -0
- package/dist/translations/pl.d.ts +12 -0
- package/dist/translations/pl.js +12 -0
- package/dist/translations/pt.d.ts +12 -0
- package/dist/translations/pt.js +12 -0
- package/dist/translations/ro.d.ts +12 -0
- package/dist/translations/ro.js +12 -0
- package/dist/translations/rs.d.ts +12 -0
- package/dist/translations/rs.js +12 -0
- package/dist/translations/rsLatin.d.ts +12 -0
- package/dist/translations/rsLatin.js +12 -0
- package/dist/translations/ru.d.ts +12 -0
- package/dist/translations/ru.js +12 -0
- package/dist/translations/sk.d.ts +12 -0
- package/dist/translations/sk.js +12 -0
- package/dist/translations/sl.d.ts +12 -0
- package/dist/translations/sl.js +12 -0
- package/dist/translations/sv.d.ts +12 -0
- package/dist/translations/sv.js +12 -0
- package/dist/translations/ta.d.ts +12 -0
- package/dist/translations/ta.js +12 -0
- package/dist/translations/th.d.ts +12 -0
- package/dist/translations/th.js +12 -0
- package/dist/translations/tr.d.ts +12 -0
- package/dist/translations/tr.js +12 -0
- package/dist/translations/uk.d.ts +12 -0
- package/dist/translations/uk.js +12 -0
- package/dist/translations/vi.d.ts +12 -0
- package/dist/translations/vi.js +12 -0
- package/dist/translations/zh.d.ts +12 -0
- package/dist/translations/zh.js +12 -0
- package/dist/translations/zhTw.d.ts +12 -0
- package/dist/translations/zhTw.js +12 -0
- package/dist/types.d.ts +11 -0
- package/dist/utils/assert-never.d.ts +1 -0
- package/dist/utils/assert-never.js +3 -0
- package/dist/utils/build-detection.d.ts +6 -1
- package/dist/utils/build-detection.js +68 -89
- package/dist/utils/deploy-adapter.d.ts +3 -35
- package/dist/utils/deploy-adapter.js +25 -14
- package/dist/utils/lambda-config.js +18 -23
- package/dist/utils/messages.js +24 -3
- package/dist/utils/next-image-loader-config.d.ts +2 -0
- package/dist/utils/next-image-loader-config.js +63 -0
- package/dist/utils/next-image-loader-file.d.ts +2 -0
- package/dist/utils/next-image-loader-file.js +11 -0
- package/dist/utils/payload-generate.d.ts +10 -0
- package/dist/utils/payload-generate.js +59 -0
- package/dist/utils/pnpm-builds.d.ts +14 -0
- package/dist/utils/pnpm-builds.js +125 -0
- package/dist/utils/s3-upload.js +4 -1
- package/package.json +31 -7
- package/dist/lib/download-skill.d.ts +0 -12
- package/dist/lib/download-skill.js +0 -77
- package/dist/utils/adapters/nextjs.d.ts +0 -8
- package/dist/utils/adapters/nextjs.js +0 -61
- package/dist/utils/adapters/nitro.d.ts +0 -8
- package/dist/utils/adapters/nitro.js +0 -172
- package/dist/utils/adapters/vite.js +0 -31
- package/dist/utils/asset-collection.js +0 -144
- package/dist/utils/build-lambda-zip.js +0 -90
- package/dist/utils/fs-utils.d.ts +0 -12
- package/dist/utils/fs-utils.js +0 -55
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { toast } from '@payloadcms/ui';
|
|
3
|
+
import { cloudLimitToastKeyByCode } from '../shared.js';
|
|
4
|
+
const TOAST_ID_PREFIX = 'figma-cloud-limit';
|
|
5
|
+
export function dismissSubmittingToast(label) {
|
|
6
|
+
const activeToasts = toast.getToasts();
|
|
7
|
+
for(let index = activeToasts.length - 1; index >= 0; index--){
|
|
8
|
+
const candidate = activeToasts[index];
|
|
9
|
+
if (candidate && !('dismiss' in candidate) && candidate.promise !== undefined && candidate.title === label && candidate.type === 'loading') {
|
|
10
|
+
toast.dismiss(candidate.id);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function showCloudLimitToast(code, translate) {
|
|
16
|
+
toast.info(translate(cloudLimitToastKeyByCode[code]), {
|
|
17
|
+
id: `${TOAST_ID_PREFIX}-${code}`
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Access, BaseAccess } from 'payload';
|
|
2
|
+
/**
|
|
3
|
+
* we will still let a user edit if makePermission is null or undefined, because we are
|
|
4
|
+
* specifically restricting users for a figma cloud project backed by make
|
|
5
|
+
*/
|
|
6
|
+
export declare function passesMakeViewerWriteGate(user: unknown): boolean;
|
|
7
|
+
export declare const makeViewerWriteBaseAccess: Access;
|
|
8
|
+
export declare function withMakeViewerWriteBaseAccessDefaults(existingBaseAccess?: BaseAccess): BaseAccess;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* we will still let a user edit if makePermission is null or undefined, because we are
|
|
3
|
+
* specifically restricting users for a figma cloud project backed by make
|
|
4
|
+
*/ export function passesMakeViewerWriteGate(user) {
|
|
5
|
+
const makePermission = user?.makePermission;
|
|
6
|
+
return makePermission === undefined || makePermission === null || makePermission === 'edit';
|
|
7
|
+
}
|
|
8
|
+
export const makeViewerWriteBaseAccess = ({ req })=>passesMakeViewerWriteGate(req.user);
|
|
9
|
+
export function withMakeViewerWriteBaseAccessDefaults(existingBaseAccess = {}) {
|
|
10
|
+
return {
|
|
11
|
+
...existingBaseAccess,
|
|
12
|
+
collections: {
|
|
13
|
+
...existingBaseAccess.collections,
|
|
14
|
+
create: existingBaseAccess.collections?.create ?? makeViewerWriteBaseAccess,
|
|
15
|
+
delete: existingBaseAccess.collections?.delete ?? makeViewerWriteBaseAccess,
|
|
16
|
+
unlock: existingBaseAccess.collections?.unlock ?? makeViewerWriteBaseAccess,
|
|
17
|
+
update: existingBaseAccess.collections?.update ?? makeViewerWriteBaseAccess
|
|
18
|
+
},
|
|
19
|
+
globals: {
|
|
20
|
+
...existingBaseAccess.globals,
|
|
21
|
+
update: existingBaseAccess.globals?.update ?? makeViewerWriteBaseAccess
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Config } from 'payload';
|
|
2
|
+
/**
|
|
3
|
+
* True inside the Make sandbox. agentplat injects `FIGMA=1`, absent locally and
|
|
4
|
+
* in the deployed Lambda; `FIGMA=true` matches the app template's vite config.
|
|
5
|
+
*
|
|
6
|
+
* KEEP_IN_SYNC(services/agentplat/scriptrun/script_runner.go): EnvFigma
|
|
7
|
+
*/
|
|
8
|
+
export declare function isMakeSandbox(): boolean;
|
|
9
|
+
type SandboxUploadFetchOptions = {
|
|
10
|
+
/**
|
|
11
|
+
* The app's collections before any plugin runs. `plugin-cloud-storage` later
|
|
12
|
+
* rewrites `skipSafeFetch`, erasing whether the app set `false` or nothing, so
|
|
13
|
+
* intent must be read here.
|
|
14
|
+
*/
|
|
15
|
+
userCollections: Config['collections'];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Defaults upload collections to skip `safeFetch` in the Make sandbox, where DNS
|
|
19
|
+
* maps external hostnames to unique-local IPv6 addresses (`fc00::/7`) that
|
|
20
|
+
* `safeFetch` rejects as non-unicast. A no-op elsewhere.
|
|
21
|
+
*
|
|
22
|
+
* Only a default: a collection that set `skipSafeFetch` itself keeps its value.
|
|
23
|
+
* `externalFileHeaderFilter` is left unset on purpose, since it would replace
|
|
24
|
+
* the cookie logic that forwards credentials for relative URLs.
|
|
25
|
+
*
|
|
26
|
+
* SSRF risks, bounded by the routes' auth gate and sandbox network limits:
|
|
27
|
+
* `getExternalFile` re-validates redirects only against `pasteURL.allowList`,
|
|
28
|
+
* any session can GET an arbitrary URL and read the body, and request cookies
|
|
29
|
+
* reach the target.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createSandboxUploadFetchPlugin({ userCollections }: SandboxUploadFetchOptions): (config: Config) => Config;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as log from '../utils/log.js';
|
|
2
|
+
/**
|
|
3
|
+
* True inside the Make sandbox. agentplat injects `FIGMA=1`, absent locally and
|
|
4
|
+
* in the deployed Lambda; `FIGMA=true` matches the app template's vite config.
|
|
5
|
+
*
|
|
6
|
+
* KEEP_IN_SYNC(services/agentplat/scriptrun/script_runner.go): EnvFigma
|
|
7
|
+
*/ export function isMakeSandbox() {
|
|
8
|
+
return process.env.FIGMA === '1' || process.env.FIGMA === 'true';
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Defaults upload collections to skip `safeFetch` in the Make sandbox, where DNS
|
|
12
|
+
* maps external hostnames to unique-local IPv6 addresses (`fc00::/7`) that
|
|
13
|
+
* `safeFetch` rejects as non-unicast. A no-op elsewhere.
|
|
14
|
+
*
|
|
15
|
+
* Only a default: a collection that set `skipSafeFetch` itself keeps its value.
|
|
16
|
+
* `externalFileHeaderFilter` is left unset on purpose, since it would replace
|
|
17
|
+
* the cookie logic that forwards credentials for relative URLs.
|
|
18
|
+
*
|
|
19
|
+
* SSRF risks, bounded by the routes' auth gate and sandbox network limits:
|
|
20
|
+
* `getExternalFile` re-validates redirects only against `pasteURL.allowList`,
|
|
21
|
+
* any session can GET an arbitrary URL and read the body, and request cookies
|
|
22
|
+
* reach the target.
|
|
23
|
+
*/ export function createSandboxUploadFetchPlugin({ userCollections }) {
|
|
24
|
+
const appOwnedSlugs = new Set((userCollections ?? []).filter((collection)=>typeof collection.upload === 'object' && 'skipSafeFetch' in collection.upload).map((collection)=>collection.slug));
|
|
25
|
+
return (config)=>{
|
|
26
|
+
if (!isMakeSandbox()) {
|
|
27
|
+
return config;
|
|
28
|
+
}
|
|
29
|
+
const modifiedSlugs = [];
|
|
30
|
+
const collections = (config.collections ?? []).map((collection)=>{
|
|
31
|
+
if (!collection.upload || appOwnedSlugs.has(collection.slug)) {
|
|
32
|
+
return collection;
|
|
33
|
+
}
|
|
34
|
+
modifiedSlugs.push(collection.slug);
|
|
35
|
+
const upload = collection.upload === true ? {} : collection.upload;
|
|
36
|
+
return {
|
|
37
|
+
...collection,
|
|
38
|
+
upload: {
|
|
39
|
+
...upload,
|
|
40
|
+
skipSafeFetch: true
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
if (modifiedSlugs.length === 0) {
|
|
45
|
+
return config;
|
|
46
|
+
}
|
|
47
|
+
log.debug(`Make sandbox detected: upload collections skip safeFetch (${modifiedSlugs.join(', ')})`);
|
|
48
|
+
return {
|
|
49
|
+
...config,
|
|
50
|
+
collections
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deploy-to-figma
|
|
3
|
+
description: This skill should be used when the user asks to "deploy to Figma", "publish to Figma", "ship to Figma", "deploy my app to Figma Cloud", "put this Payload site on Figma", or otherwise wants to deploy the current project to Figma Cloud. You (the agent) inspect, classify, and build the target project; the @payloadcms/figma CLI only authenticates and deploys the verified artifact you hand it.
|
|
4
|
+
version: 0.2.0
|
|
5
|
+
allowed-tools: Read, Bash, AskUserQuestion
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Deploy to Figma Cloud
|
|
9
|
+
|
|
10
|
+
Deploy a project to Figma Cloud with the `@payloadcms/figma` CLI. **You** (the
|
|
11
|
+
agent) determine the deploy shape — you inspect the project, run the build, and
|
|
12
|
+
verify the real build artifacts, then hand the CLI an explicit adapter and
|
|
13
|
+
output root you have confirmed on disk. The CLI no longer inspects the project;
|
|
14
|
+
it only authenticates and ships the artifact you point it at.
|
|
15
|
+
|
|
16
|
+
**Golden rule:** detection is your job. Read files and inspect real artifacts —
|
|
17
|
+
do not ask `@payloadcms/figma` what framework this is, and do not guess. When the
|
|
18
|
+
evidence conflicts or the shape isn't one Figma Cloud supports, **stop** before
|
|
19
|
+
touching auth or deploy.
|
|
20
|
+
|
|
21
|
+
Run the CLI with `npx @payloadcms/figma@alpha <...>` **from the target folder**.
|
|
22
|
+
If a different invocation is already established in the repo (e.g.
|
|
23
|
+
`pnpm start --`), use that instead — but `npx @payloadcms/figma@alpha` is the
|
|
24
|
+
default.
|
|
25
|
+
|
|
26
|
+
If the user's request contains **“Figma staging”** (case-insensitive), append
|
|
27
|
+
`--infra-env staging` to every CLI invocation in this flow, including login,
|
|
28
|
+
login completion, deploy, and deploy retries. Otherwise omit the flag.
|
|
29
|
+
|
|
30
|
+
## Flow overview
|
|
31
|
+
|
|
32
|
+
1. **Resolve** the target project directory.
|
|
33
|
+
2. **Inspect & classify** the deploy shape from evidence — or stop if unsupported/ambiguous.
|
|
34
|
+
3. **Build & verify** the real artifact (buildable projects); static folders skip the build.
|
|
35
|
+
4. **Detect initialization** from `target/.env`; gather creation inputs if uninitialized.
|
|
36
|
+
5. **Preflight auth** with the resumable headless flow.
|
|
37
|
+
6. **Deploy** the verified artifact with an explicit `--adapter` and `--output`.
|
|
38
|
+
7. **Report** the deployed URL.
|
|
39
|
+
|
|
40
|
+
Exact CLI contracts (flags, JSON shapes, artifact signatures) live in
|
|
41
|
+
`references/cli-reference.md` — consult it when a flag or field is unclear.
|
|
42
|
+
|
|
43
|
+
## Step 1 — Resolve the target directory
|
|
44
|
+
|
|
45
|
+
- If the prompt names a directory, that is the target.
|
|
46
|
+
- Otherwise use the current folder.
|
|
47
|
+
- In a **monorepo**, operate from the target **package** folder — not the repo
|
|
48
|
+
root. If several plausible apps exist and none is clearly the target, **ask**
|
|
49
|
+
via `AskUserQuestion` rather than guessing.
|
|
50
|
+
|
|
51
|
+
Every command and the build run **from the target folder**.
|
|
52
|
+
|
|
53
|
+
## Step 2 — Inspect and classify the deploy shape
|
|
54
|
+
|
|
55
|
+
Gather evidence yourself with `Read`/`Bash`. Do **not** rely on
|
|
56
|
+
`@payloadcms/figma` for detection. Look at:
|
|
57
|
+
|
|
58
|
+
- `package.json` — `dependencies`/`devDependencies`, `scripts.build`, and
|
|
59
|
+
`packageManager`.
|
|
60
|
+
- Lockfiles — `pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`, `bun.lockb`.
|
|
61
|
+
- Framework config — `next.config.*`, `vite.config.*`, `nitro.config.*`,
|
|
62
|
+
`nuxt.config.*`, `app.config.*`.
|
|
63
|
+
- Source layout and any build artifacts already on disk.
|
|
64
|
+
|
|
65
|
+
Map the evidence to one **supported deploy shape**:
|
|
66
|
+
|
|
67
|
+
| Evidence | Shape | `--adapter` |
|
|
68
|
+
| --- | --- | --- |
|
|
69
|
+
| `next` dependency / `next.config.*` / a `next build` script | Next.js | `nextjs` |
|
|
70
|
+
| Nitro, Nuxt, TanStack Start, or any other evidenced Nitro output | Nitro | `nitro` |
|
|
71
|
+
| A built (or buildable) Vite single-page app | Vite | `vite` |
|
|
72
|
+
| A simple static folder — `index.html` plus CSS/JS/assets, no build needed (even with **no** `package.json`) | Static | `vite`, output = that folder |
|
|
73
|
+
|
|
74
|
+
If the evidence fits **none** of these, or points at **more than one** framework
|
|
75
|
+
with no clear winner, or you otherwise can't land confidently on one supported
|
|
76
|
+
shape → **go to Step 8 and stop**. Do not build, authenticate, or deploy.
|
|
77
|
+
|
|
78
|
+
## Step 3 — Build and verify the artifact
|
|
79
|
+
|
|
80
|
+
**Buildable projects** (Next.js / Nitro / Vite): run the build **from the target
|
|
81
|
+
folder, before** any auth or project creation, with `FIGMA_EXTRACT_SCHEDULES=true`.
|
|
82
|
+
|
|
83
|
+
Pick the package manager by searching the **target folder and its ancestors**
|
|
84
|
+
(up to the repo/monorepo root) — in a monorepo the `packageManager` field and
|
|
85
|
+
the lockfile usually live at the workspace root, not in the target package.
|
|
86
|
+
Precedence: nearest `packageManager` field → nearest lockfile
|
|
87
|
+
(`pnpm-lock.yaml`→pnpm, `package-lock.json`→npm, `yarn.lock`→yarn,
|
|
88
|
+
`bun.lockb`→bun) → available tooling. Run the build itself **from the target
|
|
89
|
+
package folder** with whichever manager you resolved, e.g.:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
FIGMA_EXTRACT_SCHEDULES=true npm run build
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Then **inspect the actual artifacts** to confirm the adapter and the output
|
|
96
|
+
**root**:
|
|
97
|
+
|
|
98
|
+
- **Next.js** — the root contains `BUILD_ID` and standalone server output. Pass
|
|
99
|
+
the root (e.g. `.next`) — **never** `.next/standalone`.
|
|
100
|
+
- **Nitro** — the root contains `server/index.mjs` (typically `.output`).
|
|
101
|
+
- **Vite** — the root contains `index.html` (typically `dist`).
|
|
102
|
+
|
|
103
|
+
**Static folders** skip the build entirely. The output is the exact folder that
|
|
104
|
+
contains `index.html` (often `.`).
|
|
105
|
+
|
|
106
|
+
If the build fails, or the artifacts don't match the shape you classified (the
|
|
107
|
+
evidence now conflicts), **stop** — go to Step 8. Never pass an `--output` root
|
|
108
|
+
you have not confirmed exists on disk.
|
|
109
|
+
|
|
110
|
+
## Step 4 — Detect initialization; gather creation inputs
|
|
111
|
+
|
|
112
|
+
Detect initialization **only** by testing whether `target/.env` contains a
|
|
113
|
+
nonempty `FIGMA_PROJECT_ID`, e.g.:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
test -f .env && grep -Eq '^FIGMA_PROJECT_ID=.+' .env && echo initialized || echo uninitialized
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Do **not** print the value or dump `.env`.
|
|
120
|
+
|
|
121
|
+
**Initialized** (`FIGMA_PROJECT_ID` present) → skip this step; pass no creation flags.
|
|
122
|
+
|
|
123
|
+
**Uninitialized** → gather the five project-creation fields across **two** grouped
|
|
124
|
+
`AskUserQuestion` interactions (a single call accepts at most four questions),
|
|
125
|
+
each field offering the CLI default so the user can accept as-is:
|
|
126
|
+
|
|
127
|
+
**Interaction 1 — naming** (three questions):
|
|
128
|
+
|
|
129
|
+
| Field | CLI default | Deploy flag |
|
|
130
|
+
| --- | --- | --- |
|
|
131
|
+
| Project name | derived from the directory name | `--name` |
|
|
132
|
+
| Description | `"<name> project"` | `--description` |
|
|
133
|
+
| Subdomain | slugified from the project name | `--subdomain` |
|
|
134
|
+
|
|
135
|
+
**Interaction 2 — placement** (two questions):
|
|
136
|
+
|
|
137
|
+
| Field | CLI default | Deploy flag |
|
|
138
|
+
| --- | --- | --- |
|
|
139
|
+
| Workspace | the account's default Figma workspace | `--workspace` |
|
|
140
|
+
| Region | `us-east-1` | `--region` |
|
|
141
|
+
|
|
142
|
+
Present the defaults as the recommended option. For any field left at its
|
|
143
|
+
default, **omit** the corresponding flag and let the CLI apply the default — only
|
|
144
|
+
pass a flag when the user supplied a non-default value.
|
|
145
|
+
|
|
146
|
+
## Step 5 — Preflight authentication
|
|
147
|
+
|
|
148
|
+
The deploy command needs a valid credential and cannot open a browser in a
|
|
149
|
+
headless/agent context, so authenticate first with the resumable headless flow.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
npx @payloadcms/figma@alpha login --headless --json
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Parse `status`:
|
|
156
|
+
|
|
157
|
+
- `authenticated` — already logged in. Proceed to deploy.
|
|
158
|
+
- `authorization_required` — the JSON includes `authorizationUrl` and
|
|
159
|
+
`sessionId`. Give the user the `authorizationUrl`, ask them to open it,
|
|
160
|
+
approve, and paste back **the full redirected URL** (the
|
|
161
|
+
`http://localhost:.../callback?...` address the browser lands on). Then:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
npx @payloadcms/figma@alpha login --complete <sessionId> --callback-url '<redirect-url>' --json
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Quote the callback URL in single quotes. Expect `{"status":"authenticated",...}`.
|
|
168
|
+
|
|
169
|
+
**Handle the callback URL as a one-time secret:** pass it directly to the
|
|
170
|
+
`--complete` command and nothing else. Do not echo it back, summarize it, store
|
|
171
|
+
it in a file, or repeat it in later messages.
|
|
172
|
+
|
|
173
|
+
If completion fails, report the CLI's error and let the user retry the login
|
|
174
|
+
step; do not loop silently.
|
|
175
|
+
|
|
176
|
+
## Step 6 — Deploy
|
|
177
|
+
|
|
178
|
+
Run **from the target folder**, non-interactively with `-y`. Always pass
|
|
179
|
+
`--skip-build` (you already built, or a static folder needs no build) and the
|
|
180
|
+
explicit `--adapter` / `--output` you verified in Steps 2–3:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
npx @payloadcms/figma@alpha deploy -y --skip-build --adapter <nextjs|nitro|vite> --output <verified-root>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Add the project-creation flags from Step 4 only for an uninitialized project.
|
|
187
|
+
|
|
188
|
+
Examples:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Next.js app in a monorepo package (already initialized), built to .next
|
|
192
|
+
npx @payloadcms/figma@alpha deploy -y --skip-build --adapter nextjs --output .next
|
|
193
|
+
|
|
194
|
+
# Vite single-page app, built to dist
|
|
195
|
+
npx @payloadcms/figma@alpha deploy -y --skip-build --adapter vite --output dist
|
|
196
|
+
|
|
197
|
+
# Simple static folder (index.html at the folder root), no build
|
|
198
|
+
npx @payloadcms/figma@alpha deploy -y --skip-build --adapter vite --output .
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Deterministic retry — workspace selection
|
|
202
|
+
|
|
203
|
+
If deploy fails with a message like:
|
|
204
|
+
|
|
205
|
+
> Multiple eligible Figma workspaces. Pass --workspace `<plan-key>`. Available: Acme (plan_abc), Beta (plan_xyz)
|
|
206
|
+
|
|
207
|
+
re-run the exact same command with `--workspace <plan-key>` added, choosing the
|
|
208
|
+
plan key the user selected (ask via `AskUserQuestion` if not already known,
|
|
209
|
+
listing the workspaces from the error's `Available:` list). This is the only
|
|
210
|
+
retry to perform automatically. For other errors, surface the CLI message and stop.
|
|
211
|
+
|
|
212
|
+
## Step 7 — Report the result
|
|
213
|
+
|
|
214
|
+
On success the CLI prints a line like `URL: https://<subdomain>.<domain>`.
|
|
215
|
+
Extract that URL and report it to the user as the deployed address, noting the
|
|
216
|
+
CLI's own message that a deploy usually takes 2–3 minutes to finish.
|
|
217
|
+
|
|
218
|
+
## Step 8 — Unsupported or ambiguous → stop
|
|
219
|
+
|
|
220
|
+
If Steps 2–3 can't land confidently on one supported shape, **stop before auth
|
|
221
|
+
or deploy**. Tell the user what you found and quote the supported set:
|
|
222
|
+
|
|
223
|
+
> Figma Cloud supports Next.js, Vite single-page apps, and any Nitro-based app
|
|
224
|
+
> (including Nuxt and TanStack Start).
|
|
225
|
+
|
|
226
|
+
Never run `login` or `deploy` for an unsupported or ambiguous project. Decide
|
|
227
|
+
this **before** asking an uninitialized project's creation questions — never make
|
|
228
|
+
the user answer prompts only to fail on an unsupported framework.
|
|
229
|
+
|
|
230
|
+
## Additional resources
|
|
231
|
+
|
|
232
|
+
- **`references/cli-reference.md`** — the deploy/login flags this skill uses, the
|
|
233
|
+
`login ... --json` JSON shapes, and the on-disk artifact signatures that
|
|
234
|
+
confirm each adapter and output root.
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# @payloadcms/figma CLI reference (deploy-to-figma)
|
|
2
|
+
|
|
3
|
+
Exact contracts the orchestration depends on. Source of truth is the CLI itself
|
|
4
|
+
(`payload/payload-plugin` in figma/figma); this file mirrors the flags and shapes
|
|
5
|
+
the skill reads. If something is unclear, run the command and inspect the raw
|
|
6
|
+
output rather than guessing.
|
|
7
|
+
|
|
8
|
+
The CLI does **not** inspect the project — there is no `deploy --inspect` and no
|
|
9
|
+
project-inspection JSON API. The agent classifies the deploy shape from evidence
|
|
10
|
+
(see `SKILL.md` Steps 2–3) and hands the CLI an explicit `--adapter` and
|
|
11
|
+
`--output`.
|
|
12
|
+
|
|
13
|
+
## Classifying the deploy shape (agent-driven)
|
|
14
|
+
|
|
15
|
+
Detect the shape yourself from files on disk. Do **not** call `@payloadcms/figma`
|
|
16
|
+
to detect it.
|
|
17
|
+
|
|
18
|
+
| Evidence | adapter | typical output root |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| Next.js — `next` dep, `next.config.*`, or a `next build` script | `nextjs` | `.next` |
|
|
21
|
+
| Nitro / Nuxt / TanStack Start / other evidenced Nitro output | `nitro` | `.output` |
|
|
22
|
+
| Built Vite single-page app | `vite` | `dist` |
|
|
23
|
+
| Simple static folder — `index.html` + CSS/JS/assets, no build (no `package.json` OK) | `vite` | the folder itself (often `.`) |
|
|
24
|
+
|
|
25
|
+
Framework config hints: Next.js `distDir` (`next.config.*`), Vite `build.outDir`
|
|
26
|
+
(`vite.config.*`), Nitro/Nuxt `output.dir` (`nitro.config.*` / `nuxt.config.*`).
|
|
27
|
+
Custom output dirs mean you must confirm the real root against artifacts below.
|
|
28
|
+
|
|
29
|
+
### On-disk artifact signatures (confirm before deploy)
|
|
30
|
+
|
|
31
|
+
After building (or for a static folder, as-is), confirm the output **root** by
|
|
32
|
+
what it contains:
|
|
33
|
+
|
|
34
|
+
- **Next.js** — root contains `BUILD_ID` **and** standalone server output. Pass
|
|
35
|
+
the root such as `.next`; **never** `.next/standalone`.
|
|
36
|
+
- **Nitro** — root contains `server/index.mjs` (typically `.output`).
|
|
37
|
+
- **Vite / static** — root contains `index.html` (typically `dist`; a static
|
|
38
|
+
folder may be `.`).
|
|
39
|
+
|
|
40
|
+
If the build fails or the artifacts don't match the classified shape, **stop** —
|
|
41
|
+
do not pass an unverified `--output`.
|
|
42
|
+
|
|
43
|
+
## Building
|
|
44
|
+
|
|
45
|
+
Run the target package's build **from the target folder**, before auth, with
|
|
46
|
+
`FIGMA_EXTRACT_SCHEDULES=true`. Choose the package manager by searching the
|
|
47
|
+
target folder **and its ancestors** (up to the repo/monorepo root) — the
|
|
48
|
+
`packageManager` field and the lockfile often live at the workspace root, not
|
|
49
|
+
the target package. Precedence: nearest `packageManager` field → nearest
|
|
50
|
+
lockfile (`pnpm-lock.yaml`→pnpm, `package-lock.json`→npm, `yarn.lock`→yarn,
|
|
51
|
+
`bun.lockb`→bun) → available tooling. Even so, run the build itself from the
|
|
52
|
+
target package folder. Static folders skip the build.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
FIGMA_EXTRACT_SCHEDULES=true npm run build
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## `login --headless --json`
|
|
59
|
+
|
|
60
|
+
Starts (or short-circuits) a resumable login without a live terminal.
|
|
61
|
+
|
|
62
|
+
Already authenticated:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{ "status": "authenticated", "userId": "..." }
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Authorization required:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"status": "authorization_required",
|
|
73
|
+
"authorizationUrl": "https://www.figma.com/oauth?...",
|
|
74
|
+
"sessionId": "sess_...",
|
|
75
|
+
"expiresAt": 1730000000000
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## `login --complete <sessionId> --callback-url '<url>' --json`
|
|
80
|
+
|
|
81
|
+
Completes a pending headless login using the full redirect URL the browser
|
|
82
|
+
landed on (`http://localhost:<port>/callback?code=...&state=...`). Returns:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{ "status": "authenticated", "userId": "..." }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Treat the callback URL as a one-time secret: pass it once, never echo or persist it.
|
|
89
|
+
|
|
90
|
+
## Infrastructure environment
|
|
91
|
+
|
|
92
|
+
When the user's request contains “Figma staging” (case-insensitive), append
|
|
93
|
+
`--infra-env staging` to every CLI command, including login, login completion,
|
|
94
|
+
deploy, and deploy retries. Otherwise omit the flag.
|
|
95
|
+
|
|
96
|
+
## `deploy` flags used by this skill
|
|
97
|
+
|
|
98
|
+
The deploy command is always explicit — the agent supplies the verified adapter
|
|
99
|
+
and output root and skips the build (it already ran, or the folder is static):
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npx @payloadcms/figma@alpha deploy -y --skip-build --adapter <nextjs|nitro|vite> --output <root>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
| Flag | Purpose |
|
|
106
|
+
| --- | --- |
|
|
107
|
+
| `-y`, `--yes` | Non-interactive; safe project-creation defaults |
|
|
108
|
+
| `--infra-env staging` | Target Figma staging when explicitly requested |
|
|
109
|
+
| `--skip-build` | Always passed — deploy the artifact as-is, never rebuild |
|
|
110
|
+
| `--adapter <name>` | `nextjs` \| `vite` \| `nitro` — the shape you classified |
|
|
111
|
+
| `--output <path>` | The exact, verified build output root |
|
|
112
|
+
| `--name <name>` | Project name (uninitialized project creation) |
|
|
113
|
+
| `--description <text>` | Project description (uninitialized) |
|
|
114
|
+
| `--subdomain <sub>` | Requested subdomain (uninitialized) |
|
|
115
|
+
| `--workspace <planKey>` | Workspace plan key (uninitialized; also the retry flag) |
|
|
116
|
+
| `--region <region>` | Region, e.g. `us-east-1` (uninitialized) |
|
|
117
|
+
|
|
118
|
+
Initialization is detected only by a nonempty `FIGMA_PROJECT_ID` in `target/.env`
|
|
119
|
+
(never printed). Initialized projects pass no creation flags.
|
|
120
|
+
|
|
121
|
+
## Deterministic deploy retry
|
|
122
|
+
|
|
123
|
+
When multiple eligible workspaces exist and none is a default, non-interactive
|
|
124
|
+
deploy fails with:
|
|
125
|
+
|
|
126
|
+
```text
|
|
127
|
+
Multiple eligible Figma workspaces. Pass --workspace <plan-key>. Available: <Name> (<plan-key>), ...
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Re-run the identical command with `--workspace <plan-key>` for the chosen
|
|
131
|
+
workspace. An invalid `--workspace` value fails with:
|
|
132
|
+
|
|
133
|
+
```text
|
|
134
|
+
Workspace plan key "<key>" is not eligible. Available: <Name> (<plan-key>), ...
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Success output
|
|
138
|
+
|
|
139
|
+
On success the CLI prints:
|
|
140
|
+
|
|
141
|
+
```text
|
|
142
|
+
URL: https://<subdomain>.<domain>
|
|
143
|
+
This usually takes 2-3 minutes to complete.
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Extract the `URL:` line as the deployed address.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { APIError, Forbidden } from 'payload';
|
|
3
|
+
import { passesMakeViewerWriteGate } from '../../plugin/make-permission-access/make-permission-access.js';
|
|
3
4
|
import { getSafeFilename } from '../utilities/index.js';
|
|
4
|
-
const defaultAccess = ({ req })
|
|
5
|
+
const defaultAccess = ({ req })=>Boolean(req.user) && passesMakeViewerWriteGate(req.user);
|
|
5
6
|
/**
|
|
6
7
|
* v4 client-upload entry point. Payload core calls this from
|
|
7
8
|
* `POST /api/upload-instructions`; we sign a Content API upload URL and hand the
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const DEFAULT_MEDIA_CACHE_CONTROL = "private, no-store";
|
|
2
|
+
export declare const MAX_MEDIA_CACHE_CONTROL_LENGTH = 1024;
|
|
3
|
+
type DownloadResponseHeaderPolicy = {
|
|
4
|
+
cacheControl: string;
|
|
5
|
+
hasIgnoredHeaders: boolean;
|
|
6
|
+
rejectedCacheControlOverride: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const getDownloadResponseHeaderPolicy: ({ responseHeaders, }: {
|
|
9
|
+
responseHeaders: Headers;
|
|
10
|
+
}) => DownloadResponseHeaderPolicy;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const DEFAULT_MEDIA_CACHE_CONTROL = 'private, no-store';
|
|
2
|
+
export const MAX_MEDIA_CACHE_CONTROL_LENGTH = 1024;
|
|
3
|
+
const PRINTABLE_ASCII_REGEX = /^[\x20-\x7e]+$/;
|
|
4
|
+
export const getDownloadResponseHeaderPolicy = ({ responseHeaders })=>{
|
|
5
|
+
const configuredCacheControl = responseHeaders.get('Cache-Control')?.trim();
|
|
6
|
+
const isCacheControlValid = hasValidCacheControl(configuredCacheControl);
|
|
7
|
+
const hasIgnoredHeaders = [
|
|
8
|
+
...responseHeaders.keys()
|
|
9
|
+
].some((name)=>name !== 'cache-control');
|
|
10
|
+
return {
|
|
11
|
+
cacheControl: isCacheControlValid && configuredCacheControl ? configuredCacheControl : DEFAULT_MEDIA_CACHE_CONTROL,
|
|
12
|
+
hasIgnoredHeaders,
|
|
13
|
+
rejectedCacheControlOverride: !isCacheControlValid
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
function hasValidCacheControl(cacheControl) {
|
|
17
|
+
if (cacheControl == null) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (cacheControl.length === 0 || cacheControl.length > MAX_MEDIA_CACHE_CONTROL_LENGTH) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (!PRINTABLE_ASCII_REGEX.test(cacheControl)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DEFAULT_MEDIA_CACHE_CONTROL } from './getDownloadResponseHeaderPolicy.js';
|
|
2
|
+
export const resolveDownloadResponseHeaders = ({ collection, payloadResponseHeaders })=>{
|
|
3
|
+
let headers = new Headers(payloadResponseHeaders);
|
|
4
|
+
if (!headers.has('Cache-Control')) {
|
|
5
|
+
headers.set('Cache-Control', DEFAULT_MEDIA_CACHE_CONTROL);
|
|
6
|
+
}
|
|
7
|
+
if (collection.upload && typeof collection.upload === 'object' && typeof collection.upload.modifyResponseHeaders === 'function') {
|
|
8
|
+
headers = collection.upload.modifyResponseHeaders({
|
|
9
|
+
headers
|
|
10
|
+
}) || headers;
|
|
11
|
+
}
|
|
12
|
+
return headers;
|
|
13
|
+
};
|
|
@@ -2,6 +2,7 @@ import { getFilePrefix } from '@payloadcms/plugin-cloud-storage/utilities';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { isImage } from 'payload/shared';
|
|
4
4
|
import { parseUploadReference } from './utilities/index.js';
|
|
5
|
+
const PRESIGNED_DOWNLOAD_URL_EXPIRES_IN_SECONDS = 300;
|
|
5
6
|
export const getHandler = ({ client, collection })=>{
|
|
6
7
|
return async (req, { params: { filename, uploadReference } })=>{
|
|
7
8
|
try {
|
|
@@ -15,7 +16,7 @@ export const getHandler = ({ client, collection })=>{
|
|
|
15
16
|
const { data, error } = await client.POST('/api/v0/uploads/download/sign', {
|
|
16
17
|
body: {
|
|
17
18
|
collectionId: collection.slug,
|
|
18
|
-
expiresIn:
|
|
19
|
+
expiresIn: PRESIGNED_DOWNLOAD_URL_EXPIRES_IN_SECONDS,
|
|
19
20
|
filename: key
|
|
20
21
|
}
|
|
21
22
|
});
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { UploadInstructionsAccess } from 'payload';
|
|
1
2
|
import type { AuthMode } from '../db-content-api/utilities/auth.js';
|
|
2
3
|
export type StorageClientConfig = {
|
|
4
|
+
uploadInstructionsAccess?: UploadInstructionsAccess;
|
|
5
|
+
} & ({
|
|
3
6
|
auth: AuthMode;
|
|
4
7
|
baseUrl: string;
|
|
5
8
|
contentSystemId: string;
|
|
6
9
|
} | {
|
|
7
10
|
baseUrl: string;
|
|
8
11
|
contentApiKey: string;
|
|
9
|
-
};
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const arTranslations: {
|
|
2
|
+
figma: {
|
|
3
|
+
cloudLimitAssetStorageError: string;
|
|
4
|
+
cloudLimitDocumentCountError: string;
|
|
5
|
+
cloudLimitDocumentDataSizeError: string;
|
|
6
|
+
cloudLimitModalBody: string;
|
|
7
|
+
cloudLimitModalConfirm: string;
|
|
8
|
+
cloudLimitModalHeading: string;
|
|
9
|
+
cloudLimitModalRetry: string;
|
|
10
|
+
cloudLimitModalReviewCollection: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const arTranslations = {
|
|
2
|
+
figma: {
|
|
3
|
+
cloudLimitAssetStorageError: 'يتعذر التحميل. يرجى تحرير بعض المساحة للمتابعة.',
|
|
4
|
+
cloudLimitDocumentCountError: 'غير قادر على إنشاء وثيقة. تم الوصول إلى الحد الأقصى لسعة التخزين.',
|
|
5
|
+
cloudLimitDocumentDataSizeError: 'تعذر حفظ المستند، النص كبير جدًا.',
|
|
6
|
+
cloudLimitModalBody: 'لقد وصلت إلى الحد الأقصى لعدد الوثائق. يرجى حذف بعض الوثائق الحالية لمواصلة الإنشاء.',
|
|
7
|
+
cloudLimitModalConfirm: 'تم فهم ذلك',
|
|
8
|
+
cloudLimitModalHeading: 'تعذر حفظ المستند',
|
|
9
|
+
cloudLimitModalRetry: 'إعادة المحاولة',
|
|
10
|
+
cloudLimitModalReviewCollection: 'مراجعة {{collection}}'
|
|
11
|
+
}
|
|
12
|
+
};
|