@payloadcms/figma 0.1.0-alpha.1 → 0.1.0-alpha.11
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 +10 -9
- package/dist/api/control-plane.js +27 -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 +20 -1
- package/dist/auth/token-store.js +47 -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 +235 -80
- 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/upgrade.js +65 -1
- 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 +8 -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/buildDocumentSchema.js +9 -4
- 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 +13 -3
- package/dist/plugin/build-config.js +181 -36
- 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 +9 -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 +3 -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/api-types.d.ts +3 -0
- package/dist/storage-content-api/buildBaseMediaResponseHeaders.d.ts +1 -0
- package/dist/storage-content-api/buildBaseMediaResponseHeaders.js +8 -0
- package/dist/storage-content-api/buildClientUploadFetchBackHeaders.d.ts +12 -0
- package/dist/storage-content-api/buildClientUploadFetchBackHeaders.js +26 -0
- package/dist/storage-content-api/buildMediaRequestHeaders.d.ts +1 -0
- package/dist/storage-content-api/buildMediaRequestHeaders.js +14 -0
- package/dist/storage-content-api/buildMediaResponseHeaders.d.ts +4 -0
- package/dist/storage-content-api/buildMediaResponseHeaders.js +52 -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 +33 -0
- package/dist/storage-content-api/getMediaType.d.ts +1 -0
- package/dist/storage-content-api/getMediaType.js +3 -0
- package/dist/storage-content-api/hasSupportedContentEncoding.d.ts +1 -0
- package/dist/storage-content-api/hasSupportedContentEncoding.js +6 -0
- package/dist/storage-content-api/index.js +1 -0
- package/dist/storage-content-api/mediaErrorResponse.d.ts +1 -0
- package/dist/storage-content-api/mediaErrorResponse.js +12 -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/shouldAttachMedia.d.ts +1 -0
- package/dist/storage-content-api/shouldAttachMedia.js +34 -0
- package/dist/storage-content-api/staticHandler.js +93 -25
- 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/env-management.d.ts +15 -0
- package/dist/utils/env-management.js +47 -0
- 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-config-ast.js +5 -2
- package/dist/utils/payload-generate.d.ts +10 -0
- package/dist/utils/payload-generate.js +59 -0
- package/dist/utils/payload-secret.d.ts +28 -0
- package/dist/utils/payload-secret.js +34 -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 +33 -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,12 @@
|
|
|
1
|
+
export type WriteAgentConfigResult = {
|
|
2
|
+
agentsMd: 'appended' | 'created' | 'unchanged';
|
|
3
|
+
claudeMd: 'appended' | 'created' | 'unchanged';
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Write the root AI-agent pointer files so assistants can find the Payload
|
|
7
|
+
* skill bundled in node_modules. Idempotent: creates when absent, appends the
|
|
8
|
+
* pointer when a file exists without it, and no-ops when already present.
|
|
9
|
+
*/
|
|
10
|
+
export declare function writeAgentConfigFiles(args: {
|
|
11
|
+
projectDir: string;
|
|
12
|
+
}): Promise<WriteAgentConfigResult>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
const SKILL_POINTER_PATH = 'node_modules/payload/skills/payload/SKILL.md';
|
|
4
|
+
const AGENTS_BLOCK = `# AI Agent
|
|
5
|
+
|
|
6
|
+
For any Payload-related work, reference the skill at
|
|
7
|
+
\`${SKILL_POINTER_PATH}\`.
|
|
8
|
+
`;
|
|
9
|
+
const CLAUDE_IMPORT = '@AGENTS.md';
|
|
10
|
+
/**
|
|
11
|
+
* Write the root AI-agent pointer files so assistants can find the Payload
|
|
12
|
+
* skill bundled in node_modules. Idempotent: creates when absent, appends the
|
|
13
|
+
* pointer when a file exists without it, and no-ops when already present.
|
|
14
|
+
*/ export async function writeAgentConfigFiles(args) {
|
|
15
|
+
const agentsMd = await ensureFileContains({
|
|
16
|
+
content: AGENTS_BLOCK,
|
|
17
|
+
filePath: path.join(args.projectDir, 'AGENTS.md'),
|
|
18
|
+
marker: SKILL_POINTER_PATH
|
|
19
|
+
});
|
|
20
|
+
const claudeMd = await ensureFileContains({
|
|
21
|
+
content: `${CLAUDE_IMPORT}\n`,
|
|
22
|
+
filePath: path.join(args.projectDir, 'CLAUDE.md'),
|
|
23
|
+
marker: CLAUDE_IMPORT
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
agentsMd,
|
|
27
|
+
claudeMd
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
async function ensureFileContains(args) {
|
|
31
|
+
const existing = await readFileOrNull(args.filePath);
|
|
32
|
+
if (existing === null) {
|
|
33
|
+
await fs.writeFile(args.filePath, args.content, 'utf8');
|
|
34
|
+
return 'created';
|
|
35
|
+
}
|
|
36
|
+
if (existing.includes(args.marker)) {
|
|
37
|
+
return 'unchanged';
|
|
38
|
+
}
|
|
39
|
+
const separator = existing.endsWith('\n') ? '\n' : '\n\n';
|
|
40
|
+
await fs.writeFile(args.filePath, `${existing}${separator}${args.content}`, 'utf8');
|
|
41
|
+
return 'appended';
|
|
42
|
+
}
|
|
43
|
+
async function readFileOrNull(filePath) {
|
|
44
|
+
try {
|
|
45
|
+
return await fs.readFile(filePath, 'utf8');
|
|
46
|
+
} catch (err) {
|
|
47
|
+
if (err instanceof Error && 'code' in err && err.code === 'ENOENT') {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
throw err;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
const PAYLOAD_FILE_PATH_PATTERN = /^\/(?!\/)(?:.+\/)?api\/[^/]+\/file\/.+$/;
|
|
3
|
+
export function figmaNextImageLoader({ quality, src, width }) {
|
|
4
|
+
const [pathname, search = ''] = src.split('?');
|
|
5
|
+
if (!PAYLOAD_FILE_PATH_PATTERN.test(pathname)) {
|
|
6
|
+
return src;
|
|
7
|
+
}
|
|
8
|
+
const searchParams = new URLSearchParams(search);
|
|
9
|
+
searchParams.set('w', String(width));
|
|
10
|
+
if (quality !== undefined) {
|
|
11
|
+
searchParams.set('q', String(quality));
|
|
12
|
+
}
|
|
13
|
+
return `${pathname}?${searchParams}`;
|
|
14
|
+
}
|
|
@@ -6,6 +6,17 @@ import { getSearchParam } from '../../utils/getSearchParam.js';
|
|
|
6
6
|
import { resolveParentTargetOrigin, setupIframeAutoLogin } from './iframeAutoLogin.js';
|
|
7
7
|
import './index.scss';
|
|
8
8
|
const baseClass = 'oauth-login';
|
|
9
|
+
const COLLECTION_SKELETON_KEYS = [
|
|
10
|
+
'collection-1',
|
|
11
|
+
'collection-2',
|
|
12
|
+
'collection-3',
|
|
13
|
+
'collection-4'
|
|
14
|
+
];
|
|
15
|
+
const GLOBAL_SKELETON_KEYS = [
|
|
16
|
+
'global-1',
|
|
17
|
+
'global-2',
|
|
18
|
+
'global-3'
|
|
19
|
+
];
|
|
9
20
|
// Max time we wait for the parent (figma.com) to respond with a code after
|
|
10
21
|
// posting `mint-cms-oauth-code`. If we hit this without a reply, we assume
|
|
11
22
|
// the parent isn't going to respond and fall back to the manual login button.
|
|
@@ -49,6 +60,57 @@ const FigmaIcon = ()=>/*#__PURE__*/ _jsx("svg", {
|
|
|
49
60
|
fillRule: "evenodd"
|
|
50
61
|
})
|
|
51
62
|
});
|
|
63
|
+
const PayloadAdminLoadingShimmer = ()=>/*#__PURE__*/ _jsx("div", {
|
|
64
|
+
"aria-label": "Signing in",
|
|
65
|
+
"aria-live": "polite",
|
|
66
|
+
className: `${baseClass}__admin-shimmer`,
|
|
67
|
+
role: "status",
|
|
68
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
69
|
+
"aria-hidden": "true",
|
|
70
|
+
className: `${baseClass}__admin-shimmer-main`,
|
|
71
|
+
children: [
|
|
72
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
73
|
+
className: `${baseClass}__shimmer-heading-row`,
|
|
74
|
+
children: [
|
|
75
|
+
/*#__PURE__*/ _jsx("div", {
|
|
76
|
+
className: `${baseClass}__shimmer-block ${baseClass}__shimmer-heading-icon`
|
|
77
|
+
}),
|
|
78
|
+
/*#__PURE__*/ _jsx("div", {
|
|
79
|
+
className: `${baseClass}__shimmer-block ${baseClass}__shimmer-heading-label`
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
}),
|
|
83
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
84
|
+
className: `${baseClass}__shimmer-section`,
|
|
85
|
+
children: [
|
|
86
|
+
/*#__PURE__*/ _jsx("div", {
|
|
87
|
+
className: `${baseClass}__shimmer-block ${baseClass}__shimmer-section-label`
|
|
88
|
+
}),
|
|
89
|
+
/*#__PURE__*/ _jsx("div", {
|
|
90
|
+
className: `${baseClass}__shimmer-card-grid`,
|
|
91
|
+
children: COLLECTION_SKELETON_KEYS.map((key)=>/*#__PURE__*/ _jsx("div", {
|
|
92
|
+
className: `${baseClass}__shimmer-block ${baseClass}__shimmer-card`
|
|
93
|
+
}, key))
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
}),
|
|
97
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
98
|
+
className: `${baseClass}__shimmer-section`,
|
|
99
|
+
children: [
|
|
100
|
+
/*#__PURE__*/ _jsx("div", {
|
|
101
|
+
className: `${baseClass}__shimmer-block ${baseClass}__shimmer-section-label`
|
|
102
|
+
}),
|
|
103
|
+
/*#__PURE__*/ _jsx("div", {
|
|
104
|
+
className: `${baseClass}__shimmer-card-grid`,
|
|
105
|
+
children: GLOBAL_SKELETON_KEYS.map((key)=>/*#__PURE__*/ _jsx("div", {
|
|
106
|
+
className: `${baseClass}__shimmer-block ${baseClass}__shimmer-card`
|
|
107
|
+
}, key))
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
})
|
|
111
|
+
]
|
|
112
|
+
})
|
|
113
|
+
});
|
|
52
114
|
export const DefaultLoginButton = ({ disabled, endpointSlug })=>{
|
|
53
115
|
const { config: { admin: { user: userSlug }, routes: { api }, serverURL } } = useConfig();
|
|
54
116
|
const [authorizeURL, setAuthorizeURL] = useState('');
|
|
@@ -150,26 +212,11 @@ export const DefaultLoginButton = ({ disabled, endpointSlug })=>{
|
|
|
150
212
|
endpointSlug
|
|
151
213
|
]);
|
|
152
214
|
if (!shouldRenderButton) {
|
|
153
|
-
// In the iframe auto-login window, show a
|
|
154
|
-
//
|
|
155
|
-
//
|
|
215
|
+
// In the iframe auto-login window, show a Payload admin-shaped shimmer
|
|
216
|
+
// until the flow either navigates them away or times out into the manual
|
|
217
|
+
// button.
|
|
156
218
|
if (isInIframe === true && !disabled) {
|
|
157
|
-
return /*#__PURE__*/ _jsx(
|
|
158
|
-
className: baseClass,
|
|
159
|
-
children: /*#__PURE__*/ _jsxs("div", {
|
|
160
|
-
className: `${baseClass}__signing-in`,
|
|
161
|
-
role: "status",
|
|
162
|
-
children: [
|
|
163
|
-
/*#__PURE__*/ _jsx("span", {
|
|
164
|
-
children: "Signing in"
|
|
165
|
-
}),
|
|
166
|
-
/*#__PURE__*/ _jsx("div", {
|
|
167
|
-
"aria-hidden": "true",
|
|
168
|
-
className: `${baseClass}__spinner`
|
|
169
|
-
})
|
|
170
|
-
]
|
|
171
|
-
})
|
|
172
|
-
});
|
|
219
|
+
return /*#__PURE__*/ _jsx(PayloadAdminLoadingShimmer, {});
|
|
173
220
|
}
|
|
174
221
|
return null;
|
|
175
222
|
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
.oauth-login,
|
|
2
|
+
.oauth-login__admin-shimmer {
|
|
3
|
+
--oauth-login-shimmer-bg: var(--theme-bg, var(--theme-elevation-0, #ffffff));
|
|
4
|
+
--oauth-login-shimmer-block: var(--theme-elevation-100, #efefef);
|
|
5
|
+
--oauth-login-shimmer-highlight: var(--theme-elevation-200, #f7f7f7);
|
|
6
|
+
}
|
|
7
|
+
|
|
1
8
|
.oauth-login {
|
|
2
9
|
display: flex;
|
|
3
10
|
justify-content: center;
|
|
@@ -55,28 +62,127 @@
|
|
|
55
62
|
Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
56
63
|
}
|
|
57
64
|
|
|
58
|
-
&
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
&__admin-shimmer {
|
|
66
|
+
position: fixed;
|
|
67
|
+
inset: 0;
|
|
68
|
+
z-index: 1000;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
background: var(--oauth-login-shimmer-bg);
|
|
64
71
|
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
65
72
|
Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
66
73
|
}
|
|
67
74
|
|
|
68
|
-
&
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
&__admin-shimmer-main {
|
|
76
|
+
padding: 2rem 2.5rem;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&__shimmer-block {
|
|
80
|
+
position: relative;
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
border-radius: 0.25rem;
|
|
83
|
+
background-color: var(--oauth-login-shimmer-block);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&__shimmer-block::after {
|
|
87
|
+
content: '';
|
|
88
|
+
position: absolute;
|
|
89
|
+
inset: 0;
|
|
90
|
+
border-radius: inherit;
|
|
91
|
+
background-image: linear-gradient(
|
|
92
|
+
100deg,
|
|
93
|
+
transparent 0%,
|
|
94
|
+
transparent 35%,
|
|
95
|
+
var(--oauth-login-shimmer-highlight) 50%,
|
|
96
|
+
transparent 65%,
|
|
97
|
+
transparent 100%
|
|
98
|
+
);
|
|
99
|
+
pointer-events: none;
|
|
100
|
+
transform: translateX(-100%);
|
|
101
|
+
animation: oauth-login-shimmer 1.45s linear infinite;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&__shimmer-heading-row {
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
gap: 0.5rem;
|
|
108
|
+
height: 1.75rem;
|
|
109
|
+
margin-bottom: 1rem;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&__shimmer-heading-icon {
|
|
113
|
+
width: 1.5rem;
|
|
114
|
+
height: 1.5rem;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&__shimmer-heading-label {
|
|
118
|
+
width: 7.5rem;
|
|
119
|
+
height: 1.25rem;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&__shimmer-section {
|
|
123
|
+
margin-bottom: 1.5rem;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&__shimmer-section-label {
|
|
127
|
+
width: 7.5rem;
|
|
128
|
+
height: 1.25rem;
|
|
129
|
+
margin-bottom: 0.5rem;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&__shimmer-card-grid {
|
|
133
|
+
display: grid;
|
|
134
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
135
|
+
gap: 1rem;
|
|
136
|
+
max-width: 51.625rem;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&__shimmer-card {
|
|
140
|
+
height: 4rem;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@media (prefers-color-scheme: dark) {
|
|
145
|
+
.oauth-login,
|
|
146
|
+
.oauth-login__admin-shimmer {
|
|
147
|
+
--oauth-login-shimmer-bg: var(--theme-bg, var(--theme-elevation-0, #2b2b2b));
|
|
148
|
+
--oauth-login-shimmer-block: var(--theme-elevation-100, #383838);
|
|
149
|
+
--oauth-login-shimmer-highlight: var(--theme-elevation-200, #444444);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@media (max-width: 48rem) {
|
|
154
|
+
.oauth-login {
|
|
155
|
+
&__shimmer-card-grid {
|
|
156
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
157
|
+
}
|
|
75
158
|
}
|
|
76
159
|
}
|
|
77
160
|
|
|
78
|
-
@
|
|
161
|
+
@media (max-width: 30rem) {
|
|
162
|
+
.oauth-login {
|
|
163
|
+
&__admin-shimmer-main {
|
|
164
|
+
padding-right: 0.75rem;
|
|
165
|
+
padding-left: 0.75rem;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
&__shimmer-card-grid {
|
|
169
|
+
grid-template-columns: 1fr;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@media (prefers-reduced-motion: reduce) {
|
|
175
|
+
.oauth-login__shimmer-block::after {
|
|
176
|
+
animation: none;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@keyframes oauth-login-shimmer {
|
|
181
|
+
from {
|
|
182
|
+
transform: translateX(-100%);
|
|
183
|
+
}
|
|
184
|
+
|
|
79
185
|
to {
|
|
80
|
-
transform:
|
|
186
|
+
transform: translateX(100%);
|
|
81
187
|
}
|
|
82
188
|
}
|
package/dist/oauth/defaults.js
CHANGED
|
@@ -56,6 +56,7 @@ export const defaultVerify = ({ collection, strategyName, userInfoCookieName = D
|
|
|
56
56
|
collection: collection.slug,
|
|
57
57
|
depth,
|
|
58
58
|
limit: 1,
|
|
59
|
+
overrideAccess: true,
|
|
59
60
|
pagination: false,
|
|
60
61
|
where: {
|
|
61
62
|
[usernameField.name]: {
|
|
@@ -79,7 +80,8 @@ export const defaultVerify = ({ collection, strategyName, userInfoCookieName = D
|
|
|
79
80
|
figmaImageUrl: figmaUserInfo.img_url
|
|
80
81
|
}
|
|
81
82
|
},
|
|
82
|
-
depth
|
|
83
|
+
depth,
|
|
84
|
+
overrideAccess: true
|
|
83
85
|
});
|
|
84
86
|
}
|
|
85
87
|
} else {
|
|
@@ -109,6 +111,7 @@ export const defaultVerify = ({ collection, strategyName, userInfoCookieName = D
|
|
|
109
111
|
collection: collection.slug,
|
|
110
112
|
depth,
|
|
111
113
|
limit: 1,
|
|
114
|
+
overrideAccess: true,
|
|
112
115
|
pagination: false,
|
|
113
116
|
where: {
|
|
114
117
|
[usernameField.name]: {
|
|
@@ -6,7 +6,7 @@ import { createDebugLogger } from '../utilities/createDebugLogger.js';
|
|
|
6
6
|
import { establishSession } from '../utilities/establishSession.js';
|
|
7
7
|
import { exchangeCodeForAccessToken } from '../utilities/exchangeCodeForAccessToken.js';
|
|
8
8
|
import { extractOrigin } from '../utilities/extractOrigin.js';
|
|
9
|
-
import { buildCsrfCookieClearHeader, OAUTH_STATE_CSRF_COOKIE_NAME } from '../utilities/getAuthorizeURL.js';
|
|
9
|
+
import { buildCsrfCookieClearHeader, getOAuthCallbackPath, OAUTH_STATE_CSRF_COOKIE_NAME } from '../utilities/getAuthorizeURL.js';
|
|
10
10
|
import { isAbsoluteURL } from '../utilities/isAbsoluteURL.js';
|
|
11
11
|
export const getLoginEndpoint = ({ collection, collectionOptions, endpointSlug, pluginOptions, strategy })=>({
|
|
12
12
|
handler: async (req)=>{
|
|
@@ -151,7 +151,10 @@ export const getLoginEndpoint = ({ collection, collectionOptions, endpointSlug,
|
|
|
151
151
|
}
|
|
152
152
|
const redirectUri = formatAdminURL({
|
|
153
153
|
apiRoute: config.routes?.api || '/api',
|
|
154
|
-
path:
|
|
154
|
+
path: getOAuthCallbackPath({
|
|
155
|
+
collection,
|
|
156
|
+
endpointSlug
|
|
157
|
+
}),
|
|
155
158
|
serverURL: redirectServerURL
|
|
156
159
|
});
|
|
157
160
|
debugLogger.info({
|
package/dist/oauth/index.js
CHANGED
|
@@ -148,6 +148,13 @@ export const oAuth2Plugin = (pluginOptions)=>(config)=>{
|
|
|
148
148
|
usernameField
|
|
149
149
|
})
|
|
150
150
|
});
|
|
151
|
+
const loginEndpoint = getLoginEndpoint({
|
|
152
|
+
collection: existingCollection,
|
|
153
|
+
collectionOptions,
|
|
154
|
+
endpointSlug,
|
|
155
|
+
pluginOptions,
|
|
156
|
+
strategy
|
|
157
|
+
});
|
|
151
158
|
const authStrategy = {
|
|
152
159
|
name: `${existingCollection.slug}-${strategyName}`,
|
|
153
160
|
// Bind 'this' to ensure the authenticate function has the correct context
|
|
@@ -180,13 +187,7 @@ export const oAuth2Plugin = (pluginOptions)=>(config)=>{
|
|
|
180
187
|
},
|
|
181
188
|
endpoints: [
|
|
182
189
|
...existingCollection.endpoints || [],
|
|
183
|
-
|
|
184
|
-
collection: existingCollection,
|
|
185
|
-
collectionOptions,
|
|
186
|
-
endpointSlug,
|
|
187
|
-
pluginOptions,
|
|
188
|
-
strategy
|
|
189
|
-
}),
|
|
190
|
+
loginEndpoint,
|
|
190
191
|
getMetaEndpoint({
|
|
191
192
|
collection: existingCollection,
|
|
192
193
|
collectionOptions,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Config } from 'payload';
|
|
2
|
-
export declare const getAdminCollectionSlug: (config: Config) => string;
|
|
2
|
+
export declare const getAdminCollectionSlug: (config: Pick<Config, "admin" | "collections">) => string;
|
|
@@ -45,6 +45,7 @@ export interface AuthorizeURLResult {
|
|
|
45
45
|
csrfNonce: string;
|
|
46
46
|
params: AuthorizeURLParams;
|
|
47
47
|
}
|
|
48
|
+
export declare const getOAuthCallbackPath: ({ collection, endpointSlug, }: Pick<Args, "collection" | "endpointSlug">) => `/${string}`;
|
|
48
49
|
export declare const getAuthorizeURL: ({ collection, collectionOptions, endpointSlug, existingCsrfNonce, failedRedirect, payload, pluginOptions, redirect, serverURLOverride, strategy, }: Args) => Promise<AuthorizeURLResult>;
|
|
49
50
|
/**
|
|
50
51
|
* Name of the HttpOnly cookie that carries the browser-bound CSRF nonce
|
|
@@ -2,6 +2,7 @@ import crypto from 'crypto';
|
|
|
2
2
|
import * as QueryString from 'qs-esm';
|
|
3
3
|
import { v4 as uuid } from 'uuid';
|
|
4
4
|
import { defaultScope } from '../defaults.js';
|
|
5
|
+
export const getOAuthCallbackPath = ({ collection, endpointSlug })=>`/${collection.slug}/${endpointSlug}/login`;
|
|
5
6
|
export const getAuthorizeURL = async ({ collection, collectionOptions, endpointSlug, existingCsrfNonce, failedRedirect, payload, pluginOptions, redirect, serverURLOverride, strategy })=>{
|
|
6
7
|
const { redirectServerURL } = pluginOptions;
|
|
7
8
|
await strategy.ensureMeta();
|
|
@@ -30,7 +31,10 @@ export const getAuthorizeURL = async ({ collection, collectionOptions, endpointS
|
|
|
30
31
|
state.failedRedirect = failedRedirect;
|
|
31
32
|
}
|
|
32
33
|
const baseRedirectURL = redirectServerURL || payload.config.serverURL || state.serverURL;
|
|
33
|
-
const loginRedirectURL = encodeURI(`${baseRedirectURL}${payload.config.routes?.api || '/api'}
|
|
34
|
+
const loginRedirectURL = encodeURI(`${baseRedirectURL}${payload.config.routes?.api || '/api'}${getOAuthCallbackPath({
|
|
35
|
+
collection,
|
|
36
|
+
endpointSlug
|
|
37
|
+
})}`);
|
|
34
38
|
const params = {
|
|
35
39
|
client_id: collectionOptions.clientID,
|
|
36
40
|
code_challenge,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config, SanitizedConfig } from 'payload';
|
|
1
|
+
import type { Config, SanitizedConfig, UploadInstructionsAccess } from 'payload';
|
|
2
2
|
/**
|
|
3
3
|
* Worker-trusted marker injected by Figma's sites-worker after it validates the
|
|
4
4
|
* X-Figma-Job-Queues-Auth-Bypass secret on a Payload jobs endpoint. The default
|
|
@@ -13,7 +13,15 @@ export declare const FIGMA_INTERNAL_FORWARDED_HAS_AUTH_BYPASS_HEADER = "figma-in
|
|
|
13
13
|
*
|
|
14
14
|
* Differences from standard Payload Config:
|
|
15
15
|
* - `db`: Omitted (auto-injected by Figma platform)
|
|
16
|
-
* - `secret`: Omitted
|
|
16
|
+
* - `secret`: Omitted. The platform owns `PAYLOAD_SECRET`. `init`'s AST
|
|
17
|
+
* modifier strips this line from the tenant's config, and this type
|
|
18
|
+
* doesn't accept it back in. `buildFigmaConfig` injects the value at
|
|
19
|
+
* runtime from `process.env.PAYLOAD_SECRET` (Lambda) or the encrypted
|
|
20
|
+
* TokenStore cache (local dev) — never written to `.env`.
|
|
21
|
+
* - `previousSecrets`: The plugin appends its own compatibility entry so
|
|
22
|
+
* data written under the old shared hosted secret keeps decrypting after
|
|
23
|
+
* the platform switched to per-tenant secrets; any tenant-supplied entries
|
|
24
|
+
* are preserved in order.
|
|
17
25
|
* - `editor`: Optional (defaults to lexicalEditor() if not provided)
|
|
18
26
|
* - `contentSystemId`: Optional (resolved automatically from env vars or bootstrap cache)
|
|
19
27
|
*
|
|
@@ -48,7 +56,9 @@ export type FigmaConfig = {
|
|
|
48
56
|
figma: {
|
|
49
57
|
contentSystemId?: string;
|
|
50
58
|
environmentId?: string;
|
|
51
|
-
storage?:
|
|
59
|
+
storage?: {
|
|
60
|
+
uploadInstructionsAccess?: UploadInstructionsAccess;
|
|
61
|
+
} | boolean;
|
|
52
62
|
useContentSystem?: boolean;
|
|
53
63
|
};
|
|
54
64
|
} & Omit<Config, 'db' | 'editor' | 'secret'> & Partial<Pick<Config, 'db'>>;
|