@payloadcms/figma 0.0.1-alpha.9 → 0.1.0-alpha.0
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/dist/api/control-plane.d.ts +56 -7
- package/dist/api/control-plane.js +188 -74
- package/dist/api/error-response.d.ts +36 -0
- package/dist/api/error-response.js +66 -0
- package/dist/api/figma-api.d.ts +24 -3
- package/dist/api/figma-api.js +110 -34
- package/dist/auth/browser.d.ts +0 -1
- package/dist/auth/browser.js +0 -2
- package/dist/auth/callback-server.d.ts +19 -8
- package/dist/auth/callback-server.js +72 -32
- package/dist/auth/credentials.d.ts +20 -0
- package/dist/auth/credentials.js +19 -0
- package/dist/auth/crypto-utils.d.ts +28 -1
- package/dist/auth/crypto-utils.js +132 -23
- package/dist/auth/jwt-validator.d.ts +23 -6
- package/dist/auth/jwt-validator.js +35 -9
- package/dist/auth/oauth-flow.d.ts +19 -4
- package/dist/auth/oauth-flow.js +151 -34
- package/dist/auth/paste-code.d.ts +33 -0
- package/dist/auth/paste-code.js +87 -0
- package/dist/auth/pkce.d.ts +0 -1
- package/dist/auth/pkce.js +0 -2
- package/dist/auth/project-token.d.ts +32 -17
- package/dist/auth/project-token.js +176 -68
- package/dist/auth/refresh.d.ts +2 -2
- package/dist/auth/refresh.js +25 -14
- package/dist/auth/token-store-migration.d.ts +57 -0
- package/dist/auth/token-store-migration.js +154 -0
- package/dist/auth/token-store.d.ts +63 -98
- package/dist/auth/token-store.js +405 -124
- package/dist/auth/types.d.ts +40 -6
- package/dist/auth/types.js +1 -3
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +102 -8
- package/dist/commands/bootstrap.d.ts +17 -0
- package/dist/commands/bootstrap.js +88 -0
- package/dist/commands/build-lambda-zip.d.ts +4 -0
- package/dist/commands/build-lambda-zip.js +17 -0
- package/dist/commands/debug.d.ts +7 -0
- package/dist/commands/debug.js +178 -0
- package/dist/commands/deploy.d.ts +11 -1
- package/dist/commands/deploy.js +193 -153
- package/dist/commands/dump-tokens.d.ts +11 -0
- package/dist/commands/dump-tokens.js +67 -0
- package/dist/commands/env.d.ts +12 -0
- package/dist/commands/env.js +86 -0
- package/dist/commands/init.d.ts +9 -6
- package/dist/commands/init.js +232 -152
- package/dist/commands/list-tokens.d.ts +3 -4
- package/dist/commands/list-tokens.js +24 -11
- package/dist/commands/login.d.ts +8 -2
- package/dist/commands/login.js +34 -18
- package/dist/commands/logout.d.ts +5 -5
- package/dist/commands/logout.js +77 -17
- package/dist/commands/upgrade.d.ts +4 -0
- package/dist/commands/upgrade.js +329 -0
- package/dist/commands/upload-schema.d.ts +8 -0
- package/dist/commands/upload-schema.js +91 -0
- package/dist/config/oauth.d.ts +17 -12
- package/dist/config/oauth.js +38 -39
- package/dist/constants.d.ts +63 -19
- package/dist/constants.js +158 -20
- package/dist/db-content-api/generated/content-api-types.d.ts +7574 -0
- package/dist/db-content-api/generated/content-api-types.js +5 -0
- package/dist/db-content-api/index.d.ts +37 -0
- package/dist/db-content-api/index.js +938 -0
- package/dist/db-content-api/temp-utilities/slug.d.ts +1 -0
- package/dist/db-content-api/temp-utilities/slug.js +1 -0
- package/dist/db-content-api/temp-utilities/sorting.d.ts +2 -0
- package/dist/db-content-api/temp-utilities/sorting.js +37 -0
- package/dist/db-content-api/temp-utilities/types.d.ts +21 -0
- package/dist/db-content-api/temp-utilities/types.js +13 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +38 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.js +62 -0
- package/dist/db-content-api/utilities/auth.d.ts +29 -0
- package/dist/db-content-api/utilities/auth.js +82 -0
- package/dist/db-content-api/utilities/data/applyDefaults.d.ts +6 -0
- package/dist/db-content-api/utilities/data/applyDefaults.js +75 -0
- package/dist/db-content-api/utilities/data/castFieldValue.d.ts +10 -0
- package/dist/db-content-api/utilities/data/castFieldValue.js +66 -0
- package/dist/db-content-api/utilities/data/index.d.ts +48 -0
- package/dist/db-content-api/utilities/data/index.js +299 -0
- package/dist/db-content-api/utilities/data/pointShape.d.ts +3 -0
- package/dist/db-content-api/utilities/data/pointShape.js +43 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +11 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.js +52 -0
- package/dist/db-content-api/utilities/data/richTextShape.d.ts +3 -0
- package/dist/db-content-api/utilities/data/richTextShape.js +56 -0
- package/dist/db-content-api/utilities/data/stripFields.d.ts +47 -0
- package/dist/db-content-api/utilities/data/stripFields.js +170 -0
- package/dist/db-content-api/utilities/data/transformPublishedLocale.d.ts +22 -0
- package/dist/db-content-api/utilities/data/transformPublishedLocale.js +40 -0
- package/dist/db-content-api/utilities/data/validateRelationships.d.ts +6 -0
- package/dist/db-content-api/utilities/data/validateRelationships.js +100 -0
- package/dist/db-content-api/utilities/joins.d.ts +52 -0
- package/dist/db-content-api/utilities/joins.js +137 -0
- package/dist/db-content-api/utilities/locale/index.d.ts +9 -0
- package/dist/db-content-api/utilities/locale/index.js +19 -0
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.d.ts +10 -0
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.js +71 -0
- package/dist/db-content-api/utilities/meta/buildMeta.d.ts +41 -0
- package/dist/db-content-api/utilities/meta/buildMeta.js +39 -0
- package/dist/db-content-api/utilities/meta/buildPathTypes.d.ts +16 -0
- package/dist/db-content-api/utilities/meta/buildPathTypes.js +243 -0
- package/dist/db-content-api/utilities/meta/buildUniquePaths.d.ts +12 -0
- package/dist/db-content-api/utilities/meta/buildUniquePaths.js +60 -0
- package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.d.ts +9 -0
- package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.js +100 -0
- package/dist/db-content-api/utilities/resolveBlocks.d.ts +19 -0
- package/dist/db-content-api/utilities/resolveBlocks.js +31 -0
- package/dist/db-content-api/utilities/schema/buildDocumentSchema.d.ts +55 -0
- package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +182 -0
- package/dist/db-content-api/utilities/where.d.ts +19 -0
- package/dist/db-content-api/utilities/where.js +106 -0
- package/dist/deploy/schedule-extract-plugin.d.ts +10 -0
- package/dist/deploy/schedule-extract-plugin.js +32 -0
- package/dist/endpoints/health.d.ts +2 -0
- package/dist/endpoints/health.js +9 -0
- package/dist/endpoints/schema.d.ts +2 -0
- package/dist/endpoints/schema.js +27 -0
- package/dist/exports/client.d.ts +2 -1
- package/dist/exports/client.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/lib/download-skill.d.ts +12 -0
- package/dist/lib/download-skill.js +77 -0
- package/dist/oauth/components/FigmaAvatar/index.d.ts +3 -0
- package/dist/oauth/components/FigmaAvatar/index.js +25 -0
- package/dist/oauth/components/FigmaAvatar/index.scss +12 -0
- package/dist/oauth/components/FigmaAvatarCell/index.d.ts +4 -0
- package/dist/oauth/components/FigmaAvatarCell/index.js +23 -0
- package/dist/oauth/components/FigmaAvatarCell/index.scss +5 -0
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.d.ts +8 -0
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.js +35 -0
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.scss +28 -0
- package/dist/oauth/components/LoginButton/iframeAutoLogin.d.ts +81 -0
- package/dist/oauth/components/LoginButton/iframeAutoLogin.js +168 -0
- package/dist/oauth/components/LoginButton/index.d.ts +0 -1
- package/dist/oauth/components/LoginButton/index.js +156 -18
- package/dist/oauth/components/LoginButton/index.scss +75 -3
- package/dist/oauth/components/LogoutButton/index.d.ts +0 -1
- package/dist/oauth/components/LogoutButton/index.js +20 -9
- package/dist/oauth/defaults.d.ts +3 -2
- package/dist/oauth/defaults.js +79 -12
- package/dist/oauth/endpoints/getLoginEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js +87 -84
- package/dist/oauth/endpoints/getLogoutEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getLogoutEndpoint.js +7 -6
- package/dist/oauth/endpoints/getMetaEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getMetaEndpoint.js +18 -5
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js +11 -4
- package/dist/oauth/exports/client.d.ts +0 -1
- package/dist/oauth/exports/client.js +0 -2
- package/dist/oauth/hooks/afterLogout.d.ts +0 -1
- package/dist/oauth/hooks/afterLogout.js +0 -2
- package/dist/oauth/hooks/me.d.ts +0 -1
- package/dist/oauth/hooks/me.js +0 -2
- package/dist/oauth/hooks/refresh.d.ts +0 -1
- package/dist/oauth/hooks/refresh.js +2 -3
- package/dist/oauth/index.d.ts +0 -1
- package/dist/oauth/index.js +27 -7
- package/dist/oauth/strategy/index.d.ts +0 -3
- package/dist/oauth/strategy/index.js +55 -34
- package/dist/oauth/types.d.ts +23 -7
- package/dist/oauth/types.js +0 -2
- package/dist/oauth/utilities/buildUnauthorizedRedirect.d.ts +14 -0
- package/dist/oauth/utilities/buildUnauthorizedRedirect.js +28 -0
- package/dist/oauth/utilities/clearCookie.d.ts +0 -1
- package/dist/oauth/utilities/clearCookie.js +5 -3
- package/dist/oauth/utilities/createCookieOptions.d.ts +0 -1
- package/dist/oauth/utilities/createCookieOptions.js +9 -4
- package/dist/oauth/utilities/createDebugLogger.d.ts +0 -1
- package/dist/oauth/utilities/createDebugLogger.js +0 -2
- package/dist/oauth/utilities/establishSession.d.ts +22 -0
- package/dist/oauth/utilities/establishSession.js +80 -0
- package/dist/oauth/utilities/exchangeCodeForAccessToken.d.ts +23 -0
- package/dist/oauth/utilities/exchangeCodeForAccessToken.js +26 -0
- package/dist/oauth/utilities/extractOrigin.d.ts +0 -1
- package/dist/oauth/utilities/extractOrigin.js +0 -2
- package/dist/oauth/utilities/figmaHostnames.d.ts +2 -0
- package/dist/oauth/utilities/figmaHostnames.js +24 -0
- package/dist/oauth/utilities/getAdminCollectionSlug.d.ts +0 -1
- package/dist/oauth/utilities/getAdminCollectionSlug.js +0 -2
- package/dist/oauth/utilities/getAuthorizeURL.d.ts +65 -2
- package/dist/oauth/utilities/getAuthorizeURL.js +57 -4
- package/dist/oauth/utilities/getCookieExpiration.d.ts +0 -1
- package/dist/oauth/utilities/getCookieExpiration.js +0 -2
- package/dist/oauth/utilities/getSecondsFromTokenExp.d.ts +0 -1
- package/dist/oauth/utilities/getSecondsFromTokenExp.js +0 -2
- package/dist/oauth/utilities/getTokenExp.d.ts +0 -1
- package/dist/oauth/utilities/getTokenExp.js +0 -2
- package/dist/oauth/utilities/getUsernameField.d.ts +0 -1
- package/dist/oauth/utilities/getUsernameField.js +0 -2
- package/dist/oauth/utilities/hasUserTokenPropsChanged.d.ts +0 -1
- package/dist/oauth/utilities/hasUserTokenPropsChanged.js +0 -2
- package/dist/oauth/utilities/isAbsoluteURL.d.ts +1 -0
- package/dist/oauth/utilities/isAbsoluteURL.js +1 -0
- package/dist/oauth/utilities/isDuplicateKeyError.d.ts +6 -0
- package/dist/oauth/utilities/isDuplicateKeyError.js +12 -0
- package/dist/oauth/utilities/mergeHeaders.d.ts +0 -1
- package/dist/oauth/utilities/mergeHeaders.js +0 -2
- package/dist/oauth/utilities/refreshTokens.d.ts +0 -1
- package/dist/oauth/utilities/refreshTokens.js +21 -13
- package/dist/oauth/utilities/withPartitionedCookie.d.ts +19 -0
- package/dist/oauth/utilities/withPartitionedCookie.js +26 -0
- package/dist/oauth/utils/getSearchParam.d.ts +17 -0
- package/dist/oauth/utils/getSearchParam.js +22 -0
- package/dist/plugin/adapter.d.ts +0 -1
- package/dist/plugin/adapter.js +0 -2
- package/dist/plugin/auth-preflight.d.ts +7 -0
- package/dist/plugin/auth-preflight.js +18 -0
- package/dist/plugin/bootstrap-preflight.d.ts +22 -0
- package/dist/plugin/bootstrap-preflight.js +43 -0
- package/dist/plugin/build-config.d.ts +27 -15
- package/dist/plugin/build-config.js +380 -16
- package/dist/plugin/dev-cookie-names.d.ts +13 -0
- package/dist/plugin/dev-cookie-names.js +17 -0
- package/dist/scss.d.js +2 -0
- package/dist/storage-content-api/api-types.d.ts +183 -0
- package/dist/storage-content-api/api-types.js +4 -0
- package/dist/storage-content-api/client-uploads/generate.d.ts +14 -0
- package/dist/storage-content-api/client-uploads/generate.js +69 -0
- package/dist/storage-content-api/client.d.ts +5 -0
- package/dist/storage-content-api/client.js +37 -0
- package/dist/storage-content-api/generateURL.d.ts +6 -0
- package/dist/storage-content-api/generateURL.js +6 -0
- package/dist/storage-content-api/handleDelete.d.ts +7 -0
- package/dist/storage-content-api/handleDelete.js +15 -0
- package/dist/storage-content-api/handleUpload.d.ts +10 -0
- package/dist/storage-content-api/handleUpload.js +162 -0
- package/dist/storage-content-api/index.d.ts +4 -0
- package/dist/storage-content-api/index.js +37 -0
- package/dist/storage-content-api/staticHandler.d.ts +9 -0
- package/dist/storage-content-api/staticHandler.js +61 -0
- package/dist/storage-content-api/types.d.ts +9 -0
- package/dist/storage-content-api/types.js +1 -0
- package/dist/storage-content-api/utilities/getSafeFilename.d.ts +11 -0
- package/dist/storage-content-api/utilities/getSafeFilename.js +59 -0
- package/dist/storage-content-api/utilities/index.d.ts +2 -0
- package/dist/storage-content-api/utilities/index.js +2 -0
- package/dist/storage-content-api/utilities/parseUploadReference.d.ts +17 -0
- package/dist/storage-content-api/utilities/parseUploadReference.js +27 -0
- package/dist/templates/.env.example +5 -0
- package/dist/templates/README.md +19 -0
- package/dist/types/config.d.ts +2 -2
- package/dist/types/config.js +0 -4
- package/dist/types.d.ts +10 -2
- package/dist/types.js +0 -2
- package/dist/utils/adapters/nextjs.d.ts +8 -0
- package/dist/utils/adapters/nextjs.js +61 -0
- package/dist/utils/adapters/nitro.d.ts +8 -0
- package/dist/utils/adapters/nitro.js +172 -0
- package/dist/utils/adapters/vite.d.ts +9 -0
- package/dist/utils/adapters/vite.js +31 -0
- package/dist/utils/asset-collection.d.ts +27 -7
- package/dist/utils/asset-collection.js +59 -32
- package/dist/utils/build-detection.d.ts +5 -12
- package/dist/utils/build-detection.js +74 -13
- package/dist/utils/build-lambda-zip.d.ts +25 -0
- package/dist/utils/build-lambda-zip.js +90 -0
- package/dist/utils/cache-bootstrap.d.ts +7 -0
- package/dist/utils/cache-bootstrap.js +16 -0
- package/dist/utils/config.d.ts +0 -1
- package/dist/utils/config.js +1 -3
- package/dist/utils/deploy-adapter.d.ts +45 -0
- package/dist/utils/deploy-adapter.js +56 -0
- package/dist/utils/download-template.d.ts +9 -2
- package/dist/utils/download-template.js +24 -20
- package/dist/utils/env-management.d.ts +24 -8
- package/dist/utils/env-management.js +119 -66
- package/dist/utils/format-env-suffix.d.ts +11 -0
- package/dist/utils/format-env-suffix.js +11 -0
- package/dist/utils/format.d.ts +0 -1
- package/dist/utils/format.js +0 -2
- package/dist/utils/formatter.d.ts +0 -1
- package/dist/utils/formatter.js +23 -13
- package/dist/utils/fs-utils.d.ts +12 -0
- package/dist/utils/fs-utils.js +55 -0
- package/dist/utils/git.d.ts +0 -1
- package/dist/utils/git.js +0 -2
- package/dist/utils/handle-upgrade.d.ts +8 -0
- package/dist/utils/handle-upgrade.js +39 -0
- package/dist/utils/is-debug.d.ts +0 -1
- package/dist/utils/is-debug.js +0 -2
- package/dist/utils/lambda-config.d.ts +3 -2
- package/dist/utils/lambda-config.js +75 -80
- package/dist/utils/load-payload-config.d.ts +9 -0
- package/dist/utils/load-payload-config.js +27 -0
- package/dist/utils/log.d.ts +0 -1
- package/dist/utils/log.js +0 -2
- package/dist/utils/messages.d.ts +1 -3
- package/dist/utils/messages.js +47 -13
- package/dist/utils/package-manager.d.ts +24 -1
- package/dist/utils/package-manager.js +53 -2
- package/dist/utils/parse-template-spec.d.ts +11 -0
- package/dist/utils/parse-template-spec.js +60 -0
- package/dist/utils/payload-config-ast.d.ts +27 -7
- package/dist/utils/payload-config-ast.js +106 -60
- package/dist/utils/payload-config-finder.d.ts +2 -3
- package/dist/utils/payload-config-finder.js +48 -11
- package/dist/utils/payload-config-modifier.d.ts +1 -2
- package/dist/utils/payload-config-modifier.js +114 -68
- package/dist/utils/payload-package-check.d.ts +28 -3
- package/dist/utils/payload-package-check.js +90 -31
- package/dist/utils/project.d.ts +8 -4
- package/dist/utils/project.js +63 -37
- package/dist/utils/resolve-environment.d.ts +13 -0
- package/dist/utils/resolve-environment.js +29 -0
- package/dist/utils/s3-upload.d.ts +7 -3
- package/dist/utils/s3-upload.js +44 -9
- package/dist/utils/token-display.d.ts +5 -2
- package/dist/utils/token-display.js +49 -24
- package/dist/utils/typescript-validator.d.ts +0 -1
- package/dist/utils/typescript-validator.js +4 -8
- package/dist/utils/version-check.d.ts +2 -0
- package/dist/utils/version-check.js +43 -0
- package/package.json +47 -16
- package/dist/api/control-plane.d.ts.map +0 -1
- package/dist/api/control-plane.js.map +0 -1
- package/dist/api/figma-api.d.ts.map +0 -1
- package/dist/api/figma-api.js.map +0 -1
- package/dist/auth/browser.d.ts.map +0 -1
- package/dist/auth/browser.js.map +0 -1
- package/dist/auth/callback-server.d.ts.map +0 -1
- package/dist/auth/callback-server.js.map +0 -1
- package/dist/auth/crypto-utils.d.ts.map +0 -1
- package/dist/auth/crypto-utils.js.map +0 -1
- package/dist/auth/jwt-validator.d.ts.map +0 -1
- package/dist/auth/jwt-validator.js.map +0 -1
- package/dist/auth/oauth-flow.d.ts.map +0 -1
- package/dist/auth/oauth-flow.js.map +0 -1
- package/dist/auth/pkce.d.ts.map +0 -1
- package/dist/auth/pkce.js.map +0 -1
- package/dist/auth/project-token.d.ts.map +0 -1
- package/dist/auth/project-token.js.map +0 -1
- package/dist/auth/refresh.d.ts.map +0 -1
- package/dist/auth/refresh.js.map +0 -1
- package/dist/auth/token-store.d.ts.map +0 -1
- package/dist/auth/token-store.js.map +0 -1
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/types.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/deploy.d.ts.map +0 -1
- package/dist/commands/deploy.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/list-tokens.d.ts.map +0 -1
- package/dist/commands/list-tokens.js.map +0 -1
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js.map +0 -1
- package/dist/config/oauth.d.ts.map +0 -1
- package/dist/config/oauth.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/exports/client.d.ts.map +0 -1
- package/dist/exports/client.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/oauth/components/LoginButton/index.d.ts.map +0 -1
- package/dist/oauth/components/LoginButton/index.js.map +0 -1
- package/dist/oauth/components/LogoutButton/index.d.ts.map +0 -1
- package/dist/oauth/components/LogoutButton/index.js.map +0 -1
- package/dist/oauth/defaults.d.ts.map +0 -1
- package/dist/oauth/defaults.js.map +0 -1
- package/dist/oauth/endpoints/getLoginEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js.map +0 -1
- package/dist/oauth/endpoints/getLogoutEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getLogoutEndpoint.js.map +0 -1
- package/dist/oauth/endpoints/getMetaEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getMetaEndpoint.js.map +0 -1
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js.map +0 -1
- package/dist/oauth/exports/client.d.ts.map +0 -1
- package/dist/oauth/exports/client.js.map +0 -1
- package/dist/oauth/hooks/afterLogout.d.ts.map +0 -1
- package/dist/oauth/hooks/afterLogout.js.map +0 -1
- package/dist/oauth/hooks/me.d.ts.map +0 -1
- package/dist/oauth/hooks/me.js.map +0 -1
- package/dist/oauth/hooks/refresh.d.ts.map +0 -1
- package/dist/oauth/hooks/refresh.js.map +0 -1
- package/dist/oauth/index.d.ts.map +0 -1
- package/dist/oauth/index.js.map +0 -1
- package/dist/oauth/strategy/index.d.ts.map +0 -1
- package/dist/oauth/strategy/index.js.map +0 -1
- package/dist/oauth/types.d.ts.map +0 -1
- package/dist/oauth/types.js.map +0 -1
- package/dist/oauth/utilities/clearCookie.d.ts.map +0 -1
- package/dist/oauth/utilities/clearCookie.js.map +0 -1
- package/dist/oauth/utilities/createCookieOptions.d.ts.map +0 -1
- package/dist/oauth/utilities/createCookieOptions.js.map +0 -1
- package/dist/oauth/utilities/createDebugLogger.d.ts.map +0 -1
- package/dist/oauth/utilities/createDebugLogger.js.map +0 -1
- package/dist/oauth/utilities/extractOrigin.d.ts.map +0 -1
- package/dist/oauth/utilities/extractOrigin.js.map +0 -1
- package/dist/oauth/utilities/getAdminCollectionSlug.d.ts.map +0 -1
- package/dist/oauth/utilities/getAdminCollectionSlug.js.map +0 -1
- package/dist/oauth/utilities/getAdminPath.d.ts +0 -8
- package/dist/oauth/utilities/getAdminPath.d.ts.map +0 -1
- package/dist/oauth/utilities/getAdminPath.js +0 -9
- package/dist/oauth/utilities/getAdminPath.js.map +0 -1
- package/dist/oauth/utilities/getAuthorizeURL.d.ts.map +0 -1
- package/dist/oauth/utilities/getAuthorizeURL.js.map +0 -1
- package/dist/oauth/utilities/getCookieExpiration.d.ts.map +0 -1
- package/dist/oauth/utilities/getCookieExpiration.js.map +0 -1
- package/dist/oauth/utilities/getSecondsFromTokenExp.d.ts.map +0 -1
- package/dist/oauth/utilities/getSecondsFromTokenExp.js.map +0 -1
- package/dist/oauth/utilities/getTokenExp.d.ts.map +0 -1
- package/dist/oauth/utilities/getTokenExp.js.map +0 -1
- package/dist/oauth/utilities/getUsernameField.d.ts.map +0 -1
- package/dist/oauth/utilities/getUsernameField.js.map +0 -1
- package/dist/oauth/utilities/hasUserTokenPropsChanged.d.ts.map +0 -1
- package/dist/oauth/utilities/hasUserTokenPropsChanged.js.map +0 -1
- package/dist/oauth/utilities/mergeHeaders.d.ts.map +0 -1
- package/dist/oauth/utilities/mergeHeaders.js.map +0 -1
- package/dist/oauth/utilities/refreshTokens.d.ts.map +0 -1
- package/dist/oauth/utilities/refreshTokens.js.map +0 -1
- package/dist/plugin/adapter.d.ts.map +0 -1
- package/dist/plugin/adapter.js.map +0 -1
- package/dist/plugin/build-config.d.ts.map +0 -1
- package/dist/plugin/build-config.js.map +0 -1
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/config.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/asset-collection.d.ts.map +0 -1
- package/dist/utils/asset-collection.js.map +0 -1
- package/dist/utils/build-detection.d.ts.map +0 -1
- package/dist/utils/build-detection.js.map +0 -1
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js.map +0 -1
- package/dist/utils/download-template.d.ts.map +0 -1
- package/dist/utils/download-template.js.map +0 -1
- package/dist/utils/env-management.d.ts.map +0 -1
- package/dist/utils/env-management.js.map +0 -1
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/formatter.d.ts.map +0 -1
- package/dist/utils/formatter.js.map +0 -1
- package/dist/utils/git.d.ts.map +0 -1
- package/dist/utils/git.js.map +0 -1
- package/dist/utils/is-debug.d.ts.map +0 -1
- package/dist/utils/is-debug.js.map +0 -1
- package/dist/utils/lambda-config.d.ts.map +0 -1
- package/dist/utils/lambda-config.js.map +0 -1
- package/dist/utils/log.d.ts.map +0 -1
- package/dist/utils/log.js.map +0 -1
- package/dist/utils/messages.d.ts.map +0 -1
- package/dist/utils/messages.js.map +0 -1
- package/dist/utils/package-manager.d.ts.map +0 -1
- package/dist/utils/package-manager.js.map +0 -1
- package/dist/utils/payload-config-ast.d.ts.map +0 -1
- package/dist/utils/payload-config-ast.js.map +0 -1
- package/dist/utils/payload-config-finder.d.ts.map +0 -1
- package/dist/utils/payload-config-finder.js.map +0 -1
- package/dist/utils/payload-config-modifier.d.ts.map +0 -1
- package/dist/utils/payload-config-modifier.js.map +0 -1
- package/dist/utils/payload-package-check.d.ts.map +0 -1
- package/dist/utils/payload-package-check.js.map +0 -1
- package/dist/utils/project.d.ts.map +0 -1
- package/dist/utils/project.js.map +0 -1
- package/dist/utils/s3-upload.d.ts.map +0 -1
- package/dist/utils/s3-upload.js.map +0 -1
- package/dist/utils/token-display.d.ts.map +0 -1
- package/dist/utils/token-display.js.map +0 -1
- package/dist/utils/typescript-validator.d.ts.map +0 -1
- package/dist/utils/typescript-validator.js.map +0 -1
|
@@ -1,26 +1,374 @@
|
|
|
1
|
+
import { cloudStoragePlugin } from '@payloadcms/plugin-cloud-storage';
|
|
1
2
|
import { lexicalEditor } from '@payloadcms/richtext-lexical';
|
|
2
3
|
import { buildConfig as payloadBuildConfig } from 'payload';
|
|
4
|
+
import { getBootstrapInfo } from '../api/control-plane.js';
|
|
5
|
+
import { getValidCredential } from '../auth/oauth-flow.js';
|
|
6
|
+
import { getTokenStore } from '../auth/token-store.js';
|
|
7
|
+
import { getEnvConfig } from '../constants.js';
|
|
8
|
+
import { contentAPIAdapter } from '../db-content-api/index.js';
|
|
9
|
+
import { scheduleExtractPlugin } from '../deploy/schedule-extract-plugin.js';
|
|
10
|
+
import { health } from '../endpoints/health.js';
|
|
11
|
+
import { schema } from '../endpoints/schema.js';
|
|
3
12
|
import { oAuth2Plugin } from '../oauth/index.js';
|
|
4
|
-
import {
|
|
13
|
+
import { createStorageClient } from '../storage-content-api/client.js';
|
|
14
|
+
import { contentApiStorageAdapter } from '../storage-content-api/index.js';
|
|
15
|
+
import { cacheAllEnvironments } from '../utils/cache-bootstrap.js';
|
|
16
|
+
import { getEnvVarSync } from '../utils/env-management.js';
|
|
17
|
+
import * as log from '../utils/log.js';
|
|
18
|
+
import { logMissingCliAuth } from './auth-preflight.js';
|
|
19
|
+
import { logMissingContentSystemId } from './bootstrap-preflight.js';
|
|
20
|
+
import { getDevCookieNames } from './dev-cookie-names.js';
|
|
5
21
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* - Default lexicalEditor (if no custom editor specified)
|
|
22
|
+
* Worker-trusted marker injected by Figma's sites-worker after it validates the
|
|
23
|
+
* X-Figma-Job-Queues-Auth-Bypass secret on a Payload jobs endpoint. The default
|
|
24
|
+
* `jobs.access.run` below honors this marker so Sinatra (async-job-workflow)
|
|
25
|
+
* can drive job runs without the bypass secret ever reaching tenant code.
|
|
11
26
|
*
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
27
|
+
* KEEP_IN_SYNC(cloudflare/wrangler/sites-worker/src/auth.ts): FIGMA_INTERNAL_FORWARDED_HAS_AUTH_BYPASS_HEADER
|
|
28
|
+
*/ export const FIGMA_INTERNAL_FORWARDED_HAS_AUTH_BYPASS_HEADER = 'figma-internal-forwarded-has-auth-bypass';
|
|
29
|
+
/**
|
|
30
|
+
* Fields added to users collection for Figma profile info
|
|
31
|
+
*/ const figmaUserFields = [
|
|
32
|
+
{
|
|
33
|
+
name: 'figmaHandle',
|
|
34
|
+
type: 'text',
|
|
35
|
+
admin: {
|
|
36
|
+
readOnly: true
|
|
37
|
+
},
|
|
38
|
+
label: 'Name'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'figmaImageUrl',
|
|
42
|
+
type: 'text',
|
|
43
|
+
admin: {
|
|
44
|
+
components: {
|
|
45
|
+
Cell: '@payloadcms/figma/client#FigmaAvatarCell'
|
|
46
|
+
},
|
|
47
|
+
disabled: {
|
|
48
|
+
bulkEdit: true
|
|
49
|
+
},
|
|
50
|
+
hidden: true,
|
|
51
|
+
readOnly: true
|
|
52
|
+
},
|
|
53
|
+
label: 'Profile Picture'
|
|
54
|
+
},
|
|
55
|
+
// Virtual (never persisted): populated per-request from the session JWT. The
|
|
56
|
+
// afterRead hook surfaces the claim on the requester's OWN user record only —
|
|
57
|
+
// a JWT describes its bearer, so these are meaningful for req.user, not for
|
|
58
|
+
// reads of other users. See defaults.ts (defaultVerify) which attaches the
|
|
59
|
+
// live claim to req.user.
|
|
60
|
+
{
|
|
61
|
+
name: 'userGroups',
|
|
62
|
+
type: 'text',
|
|
63
|
+
access: {
|
|
64
|
+
read: ({ id, req })=>req.user?.id === id
|
|
65
|
+
},
|
|
66
|
+
admin: {
|
|
67
|
+
readOnly: true
|
|
68
|
+
},
|
|
69
|
+
hasMany: true,
|
|
70
|
+
hooks: {
|
|
71
|
+
afterRead: [
|
|
72
|
+
({ data, req })=>data?.id !== undefined && req.user?.id === data.id ? req.user.userGroups : undefined
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
label: 'User Groups',
|
|
76
|
+
virtual: true
|
|
77
|
+
},
|
|
78
|
+
// KEEP_IN_SYNC(sinatra/controllers/api/api_payload_control_plane.rb) — resolve_make_permission
|
|
79
|
+
{
|
|
80
|
+
name: 'makePermission',
|
|
81
|
+
type: 'select',
|
|
82
|
+
access: {
|
|
83
|
+
read: ({ id, req })=>req.user?.id === id
|
|
84
|
+
},
|
|
85
|
+
admin: {
|
|
86
|
+
readOnly: true
|
|
87
|
+
},
|
|
88
|
+
hooks: {
|
|
89
|
+
afterRead: [
|
|
90
|
+
({ data, req })=>data?.id !== undefined && req.user?.id === data.id ? req.user.makePermission : undefined
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
label: 'Make Permission',
|
|
94
|
+
options: [
|
|
95
|
+
{
|
|
96
|
+
label: 'View',
|
|
97
|
+
value: 'view'
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: 'Edit',
|
|
101
|
+
value: 'edit'
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
virtual: true
|
|
105
|
+
}
|
|
106
|
+
];
|
|
107
|
+
function missingOAuthCredential(name) {
|
|
108
|
+
log.warning(`${name} could not be resolved. OAuth login will not work until this is configured. ` + 'Run `npx @payloadcms/figma init` to set up your project.');
|
|
109
|
+
return '';
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Fetch bootstrap data from the API and cache all environments locally.
|
|
113
|
+
* Returns the requested environment's data, or a typed failure reason.
|
|
114
|
+
*/ async function resolveAndCacheBootstrap(store, projectId, environmentName) {
|
|
115
|
+
let credential;
|
|
116
|
+
try {
|
|
117
|
+
credential = await getValidCredential(store);
|
|
118
|
+
} catch (error) {
|
|
119
|
+
return {
|
|
120
|
+
ok: false,
|
|
121
|
+
reason: {
|
|
122
|
+
kind: 'network',
|
|
123
|
+
message: messageOf(error)
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
if (!credential) {
|
|
128
|
+
return {
|
|
129
|
+
ok: false,
|
|
130
|
+
reason: {
|
|
131
|
+
kind: 'unauthenticated'
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
const bootstrapInfo = await getBootstrapInfo(credential, projectId);
|
|
137
|
+
cacheAllEnvironments(store, projectId, bootstrapInfo);
|
|
138
|
+
} catch (error) {
|
|
139
|
+
return {
|
|
140
|
+
ok: false,
|
|
141
|
+
reason: {
|
|
142
|
+
kind: 'network',
|
|
143
|
+
message: messageOf(error)
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
const data = store.getBootstrapData(projectId, environmentName);
|
|
148
|
+
if (!data) {
|
|
149
|
+
return {
|
|
150
|
+
ok: false,
|
|
151
|
+
reason: {
|
|
152
|
+
environmentName,
|
|
153
|
+
kind: 'environment-not-found',
|
|
154
|
+
projectId
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
data,
|
|
160
|
+
ok: true
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function messageOf(error) {
|
|
164
|
+
return error instanceof Error ? error.message : 'Unknown error';
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Creates storage configuration for upload collections
|
|
168
|
+
*/ function createStorageConfig(url, contentSystemId) {
|
|
169
|
+
const storageConfig = process.env.FIGMA_CONTENT_API_ACCESS_KEY ? {
|
|
170
|
+
baseUrl: url,
|
|
171
|
+
contentApiKey: process.env.FIGMA_CONTENT_API_ACCESS_KEY
|
|
172
|
+
} : process.env.FIGMA_DEV_JWT === 'true' ? {
|
|
173
|
+
auth: {
|
|
174
|
+
mode: 'devJwt'
|
|
175
|
+
},
|
|
176
|
+
baseUrl: url,
|
|
177
|
+
contentSystemId
|
|
178
|
+
} : {
|
|
179
|
+
auth: {
|
|
180
|
+
mode: 'tokenStore',
|
|
181
|
+
tokenStore: getTokenStore()
|
|
182
|
+
},
|
|
183
|
+
baseUrl: url,
|
|
184
|
+
contentSystemId
|
|
185
|
+
};
|
|
186
|
+
const adapter = contentApiStorageAdapter(storageConfig);
|
|
187
|
+
const storageClient = createStorageClient(storageConfig);
|
|
188
|
+
return {
|
|
189
|
+
adapter,
|
|
190
|
+
storageClient
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Plugin that applies cloud storage configuration to all upload-enabled collections.
|
|
195
|
+
* Runs at the end of the plugin chain so it sees collections added by user plugins too.
|
|
196
|
+
*/ function createStoragePlugin(url, contentSystemId) {
|
|
197
|
+
return (incomingConfig)=>{
|
|
198
|
+
const uploadCollections = (incomingConfig.collections || []).filter((c)=>c.upload);
|
|
199
|
+
if (uploadCollections.length === 0) {
|
|
200
|
+
return incomingConfig;
|
|
201
|
+
}
|
|
202
|
+
const { adapter } = createStorageConfig(url, contentSystemId);
|
|
203
|
+
const collectionsMap = uploadCollections.reduce((acc, c)=>{
|
|
204
|
+
acc[c.slug] = {
|
|
205
|
+
adapter,
|
|
206
|
+
disableLocalStorage: true
|
|
207
|
+
};
|
|
208
|
+
return acc;
|
|
209
|
+
}, {});
|
|
210
|
+
const storagePlugin = cloudStoragePlugin({
|
|
211
|
+
collections: collectionsMap
|
|
212
|
+
});
|
|
213
|
+
return storagePlugin(incomingConfig);
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
export async function buildFigmaConfig(config) {
|
|
217
|
+
const envConfig = getEnvConfig();
|
|
218
|
+
// Resolve contentSystemId: config first, env var, then local store fallback (dev)
|
|
219
|
+
let { contentSystemId } = config.figma;
|
|
220
|
+
let environmentId = config.figma.environmentId ?? process.env.FIGMA_EID;
|
|
221
|
+
contentSystemId ??= process.env.FIGMA_CONTENT_API_CONTENT_SYSTEM_ID;
|
|
222
|
+
let bootstrapData = null;
|
|
223
|
+
let bootstrapReason = null;
|
|
224
|
+
// Local dev: resolve from project ID + bootstrap cache
|
|
225
|
+
// Use getEnvVarSync fallback because Next.js evaluates config before dotenv populates process.env
|
|
226
|
+
if (!contentSystemId) {
|
|
227
|
+
const projectId = process.env.FIGMA_PROJECT_ID ?? getEnvVarSync(process.cwd(), 'FIGMA_PROJECT_ID');
|
|
228
|
+
const environmentName = process.env.FIGMA_ENVIRONMENT_NAME ?? getEnvVarSync(process.cwd(), 'FIGMA_ENVIRONMENT_NAME');
|
|
229
|
+
if (!projectId || !environmentName) {
|
|
230
|
+
bootstrapReason = {
|
|
231
|
+
kind: 'no-config'
|
|
232
|
+
};
|
|
233
|
+
} else {
|
|
234
|
+
const store = getTokenStore();
|
|
235
|
+
bootstrapData = store.getBootstrapData(projectId, environmentName);
|
|
236
|
+
// Runtime fallback: fetch from API if not cached (e.g. environment switch without re-init)
|
|
237
|
+
if (!bootstrapData) {
|
|
238
|
+
const resolution = await resolveAndCacheBootstrap(store, projectId, environmentName);
|
|
239
|
+
if (resolution.ok) {
|
|
240
|
+
bootstrapData = resolution.data;
|
|
241
|
+
} else {
|
|
242
|
+
bootstrapReason = resolution.reason;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (bootstrapData) {
|
|
246
|
+
contentSystemId = bootstrapData.contentSystemId;
|
|
247
|
+
environmentId ??= bootstrapData.tenantInstanceId;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (!environmentId) {
|
|
252
|
+
const projectId = process.env.FIGMA_PROJECT_ID ?? getEnvVarSync(process.cwd(), 'FIGMA_PROJECT_ID');
|
|
253
|
+
const environmentName = process.env.FIGMA_ENVIRONMENT_NAME ?? getEnvVarSync(process.cwd(), 'FIGMA_ENVIRONMENT_NAME');
|
|
254
|
+
if (projectId && environmentName) {
|
|
255
|
+
bootstrapData ??= getTokenStore().getBootstrapData(projectId, environmentName);
|
|
256
|
+
environmentId = bootstrapData?.tenantInstanceId;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if (!environmentId) {
|
|
260
|
+
throw new Error('Environment ID could not be resolved. Set FIGMA_EID or initialize the project.');
|
|
261
|
+
}
|
|
262
|
+
if (!contentSystemId) {
|
|
263
|
+
logMissingContentSystemId(bootstrapReason ?? {
|
|
264
|
+
kind: 'no-config'
|
|
265
|
+
});
|
|
266
|
+
throw new Error('Content System ID could not be resolved. ' + 'Run `npx @payloadcms/figma init` to set up your project.');
|
|
267
|
+
}
|
|
268
|
+
const url = process.env.FIGMA_CONTENT_API_URL || envConfig.contentApiUrl;
|
|
269
|
+
const isProduction = process.env.NODE_ENV === 'production';
|
|
270
|
+
// The deployed Lambda runs all queued jobs; locally there is no runner, so the db adapter logs
|
|
271
|
+
// a heads-up whenever a job is queued. Deployed environments set DISABLE_LOCAL_JOB_QUEUE_NOTIFICATIONS=true
|
|
272
|
+
// (injected by the control plane); end-users can also set it locally to silence the notice.
|
|
273
|
+
const notifyLocalJobQueue = process.env.DISABLE_LOCAL_JOB_QUEUE_NOTIFICATIONS !== 'true';
|
|
274
|
+
const usesTokenStoreAuth = !process.env.FIGMA_CONTENT_API_ACCESS_KEY && process.env.FIGMA_DEV_JWT !== 'true';
|
|
275
|
+
if (usesTokenStoreAuth) {
|
|
276
|
+
logMissingCliAuth(getTokenStore());
|
|
277
|
+
}
|
|
278
|
+
// Determine database adapter based on environment
|
|
279
|
+
let db;
|
|
280
|
+
if (config.figma.useContentSystem === false) {
|
|
281
|
+
db = config.db;
|
|
282
|
+
} else if (process.env.FIGMA_CONTENT_API_ACCESS_KEY) {
|
|
283
|
+
db = contentAPIAdapter({
|
|
284
|
+
auth: {
|
|
285
|
+
apiKey: process.env.FIGMA_CONTENT_API_ACCESS_KEY,
|
|
286
|
+
mode: 'apiKey'
|
|
287
|
+
},
|
|
288
|
+
contentSystemId,
|
|
289
|
+
environmentName: process.env.FIGMA_ENVIRONMENT_NAME,
|
|
290
|
+
notifyLocalJobQueue,
|
|
291
|
+
url
|
|
292
|
+
});
|
|
293
|
+
} else if (process.env.FIGMA_DEV_JWT === 'true') {
|
|
294
|
+
db = contentAPIAdapter({
|
|
295
|
+
auth: {
|
|
296
|
+
mode: 'devJwt'
|
|
297
|
+
},
|
|
298
|
+
contentSystemId,
|
|
299
|
+
environmentName: process.env.FIGMA_ENVIRONMENT_NAME,
|
|
300
|
+
notifyLocalJobQueue,
|
|
301
|
+
url
|
|
302
|
+
});
|
|
303
|
+
} else {
|
|
304
|
+
db = contentAPIAdapter({
|
|
305
|
+
auth: {
|
|
306
|
+
mode: 'tokenStore',
|
|
307
|
+
tokenStore: getTokenStore()
|
|
308
|
+
},
|
|
309
|
+
contentSystemId,
|
|
310
|
+
environmentName: process.env.FIGMA_ENVIRONMENT_NAME,
|
|
311
|
+
notifyLocalJobQueue,
|
|
312
|
+
url
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
const userJobsAccessRun = config.jobs?.access?.run;
|
|
15
316
|
// Build complete config with Figma platform defaults
|
|
16
317
|
const configWithFigmaDefaults = {
|
|
17
318
|
...config,
|
|
18
|
-
|
|
319
|
+
admin: {
|
|
320
|
+
// Auto-refresh tokens before expiry to prevent unexpected logouts.
|
|
321
|
+
autoRefresh: true,
|
|
322
|
+
avatar: {
|
|
323
|
+
Component: '@payloadcms/figma/client#FigmaAvatar'
|
|
324
|
+
},
|
|
325
|
+
...config.admin
|
|
326
|
+
},
|
|
327
|
+
custom: {
|
|
328
|
+
figma: {
|
|
329
|
+
...config.figma,
|
|
330
|
+
contentSystemId,
|
|
331
|
+
environmentId
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
db,
|
|
19
335
|
editor: config.editor ?? lexicalEditor(),
|
|
336
|
+
endpoints: [
|
|
337
|
+
...config.endpoints ?? [],
|
|
338
|
+
health,
|
|
339
|
+
schema
|
|
340
|
+
],
|
|
341
|
+
// Gate /api/payload-jobs/run and /api/payload-jobs/handle-schedules. Honor the
|
|
342
|
+
// sites-worker trust marker so Figma infra job runs never break, defer to the
|
|
343
|
+
// tenant's jobs.access.run if they set one, otherwise fall back to Payload's
|
|
344
|
+
// "logged-in user" default so the admin "Run jobs" UI keeps working.
|
|
345
|
+
jobs: {
|
|
346
|
+
...config.jobs ?? {},
|
|
347
|
+
access: {
|
|
348
|
+
...config.jobs?.access ?? {},
|
|
349
|
+
run: (args)=>{
|
|
350
|
+
if (args.req.headers.get(FIGMA_INTERNAL_FORWARDED_HAS_AUTH_BYPASS_HEADER) === '1') {
|
|
351
|
+
return true;
|
|
352
|
+
}
|
|
353
|
+
if (userJobsAccessRun) {
|
|
354
|
+
return userJobsAccessRun(args);
|
|
355
|
+
}
|
|
356
|
+
return !!args.req.user;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
...isProduction && !config.logger ? {
|
|
361
|
+
logger: {
|
|
362
|
+
options: {}
|
|
363
|
+
}
|
|
364
|
+
} : {},
|
|
20
365
|
secret: 'MY_SECRET',
|
|
21
366
|
// Add oauth to plugins if not already present
|
|
22
367
|
plugins: [
|
|
23
368
|
...config.plugins ?? [],
|
|
369
|
+
...config.figma.storage !== false ? [
|
|
370
|
+
createStoragePlugin(url, contentSystemId)
|
|
371
|
+
] : [],
|
|
24
372
|
oAuth2Plugin({
|
|
25
373
|
collections: [
|
|
26
374
|
{
|
|
@@ -30,9 +378,9 @@ import { figmaContentSystem } from './adapter.js';
|
|
|
30
378
|
response_mode: 'query',
|
|
31
379
|
response_type: 'code'
|
|
32
380
|
},
|
|
33
|
-
clientID: process.env.FIGMA_OAUTH_CLIENT_ID,
|
|
34
|
-
clientSecret: process.env.FIGMA_OAUTH_CLIENT_SECRET,
|
|
35
|
-
identityMetadata:
|
|
381
|
+
clientID: process.env.FIGMA_OAUTH_CLIENT_ID ?? bootstrapData?.oauthClientId ?? missingOAuthCredential('FIGMA_OAUTH_CLIENT_ID'),
|
|
382
|
+
clientSecret: process.env.FIGMA_OAUTH_CLIENT_SECRET ?? bootstrapData?.oauthClientSecret,
|
|
383
|
+
identityMetadata: envConfig.identityMetadata,
|
|
36
384
|
scope: [
|
|
37
385
|
'current_user:read'
|
|
38
386
|
],
|
|
@@ -40,13 +388,29 @@ import { figmaContentSystem } from './adapter.js';
|
|
|
40
388
|
usernameField: 'email'
|
|
41
389
|
}
|
|
42
390
|
],
|
|
391
|
+
...isProduction ? {} : getDevCookieNames(contentSystemId),
|
|
43
392
|
debug: !!process.env.DEBUG,
|
|
44
393
|
disabled: false
|
|
45
|
-
})
|
|
394
|
+
}),
|
|
395
|
+
scheduleExtractPlugin()
|
|
46
396
|
]
|
|
47
397
|
};
|
|
398
|
+
// Inject figma fields into users collection
|
|
399
|
+
const collections = configWithFigmaDefaults.collections?.map((col)=>{
|
|
400
|
+
if (col.slug === 'users') {
|
|
401
|
+
return {
|
|
402
|
+
...col,
|
|
403
|
+
fields: [
|
|
404
|
+
...col.fields || [],
|
|
405
|
+
...figmaUserFields
|
|
406
|
+
]
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
return col;
|
|
410
|
+
});
|
|
411
|
+
if (collections) {
|
|
412
|
+
configWithFigmaDefaults.collections = collections;
|
|
413
|
+
}
|
|
48
414
|
// Delegate to Payload's buildConfig
|
|
49
415
|
return await payloadBuildConfig(configWithFigmaDefaults);
|
|
50
416
|
}
|
|
51
|
-
|
|
52
|
-
//# sourceMappingURL=build-config.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Namespace OAuth cookies per-app in local dev so multiple Payload apps
|
|
3
|
+
* running on localhost (shared cookie jar across ports) don't clobber each
|
|
4
|
+
* other's sessions on logout. Uses projectId so the cookie stays stable when
|
|
5
|
+
* switching environments in the same checkout; falls back to contentSystemId
|
|
6
|
+
* when projectId isn't in `.env`.
|
|
7
|
+
*
|
|
8
|
+
* In production, cookies are isolated by unique hostnames and this is unused.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getDevCookieNames(contentSystemId: string): {
|
|
11
|
+
cookieName: string;
|
|
12
|
+
userInfoCookieName: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getEnvVarSync } from '../utils/env-management.js';
|
|
2
|
+
/**
|
|
3
|
+
* Namespace OAuth cookies per-app in local dev so multiple Payload apps
|
|
4
|
+
* running on localhost (shared cookie jar across ports) don't clobber each
|
|
5
|
+
* other's sessions on logout. Uses projectId so the cookie stays stable when
|
|
6
|
+
* switching environments in the same checkout; falls back to contentSystemId
|
|
7
|
+
* when projectId isn't in `.env`.
|
|
8
|
+
*
|
|
9
|
+
* In production, cookies are isolated by unique hostnames and this is unused.
|
|
10
|
+
*/ export function getDevCookieNames(contentSystemId) {
|
|
11
|
+
const projectId = process.env.FIGMA_PROJECT_ID ?? getEnvVarSync(process.cwd(), 'FIGMA_PROJECT_ID') ?? contentSystemId;
|
|
12
|
+
const suffix = projectId.slice(0, 8);
|
|
13
|
+
return {
|
|
14
|
+
cookieName: `figma-${suffix}-oauth-token`,
|
|
15
|
+
userInfoCookieName: `figma-${suffix}-user-info`
|
|
16
|
+
};
|
|
17
|
+
}
|
package/dist/scss.d.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upload API types extracted from Content API OpenAPI spec.
|
|
3
|
+
* These are kept separate to avoid breaking changes when the main spec is regenerated.
|
|
4
|
+
*/
|
|
5
|
+
type UploadErrorResponse = {
|
|
6
|
+
content: {
|
|
7
|
+
'application/json': {
|
|
8
|
+
code?: string;
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
type UploadErrorResponses = {
|
|
14
|
+
400: UploadErrorResponse;
|
|
15
|
+
401: UploadErrorResponse;
|
|
16
|
+
403: UploadErrorResponse;
|
|
17
|
+
404: UploadErrorResponse;
|
|
18
|
+
503: UploadErrorResponse;
|
|
19
|
+
};
|
|
20
|
+
export type UploadPaths = {
|
|
21
|
+
'/api/v0/uploads/{collectionId}/{filename}': {
|
|
22
|
+
delete: {
|
|
23
|
+
parameters: {
|
|
24
|
+
path: {
|
|
25
|
+
collectionId: string;
|
|
26
|
+
filename: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
responses: {
|
|
30
|
+
200: {
|
|
31
|
+
content: {
|
|
32
|
+
'application/json': {
|
|
33
|
+
success: true;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
'/api/v0/uploads/download/sign': {
|
|
41
|
+
post: {
|
|
42
|
+
requestBody: {
|
|
43
|
+
content: {
|
|
44
|
+
'application/json': {
|
|
45
|
+
collectionId: string;
|
|
46
|
+
expiresIn: number;
|
|
47
|
+
filename: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
responses: {
|
|
52
|
+
200: {
|
|
53
|
+
content: {
|
|
54
|
+
'application/json': {
|
|
55
|
+
url: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
'/api/v0/uploads/multipart/abort': {
|
|
63
|
+
post: {
|
|
64
|
+
requestBody: {
|
|
65
|
+
content: {
|
|
66
|
+
'application/json': {
|
|
67
|
+
collectionId: string;
|
|
68
|
+
filename: string;
|
|
69
|
+
uploadId: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
responses: {
|
|
74
|
+
200: {
|
|
75
|
+
content: {
|
|
76
|
+
'application/json': {
|
|
77
|
+
success: true;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
} & UploadErrorResponses;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
'/api/v0/uploads/multipart/complete': {
|
|
85
|
+
post: {
|
|
86
|
+
requestBody: {
|
|
87
|
+
content: {
|
|
88
|
+
'application/json': {
|
|
89
|
+
collectionId: string;
|
|
90
|
+
filename: string;
|
|
91
|
+
parts: Array<{
|
|
92
|
+
ETag: string;
|
|
93
|
+
PartNumber: number;
|
|
94
|
+
}>;
|
|
95
|
+
uploadId: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
responses: {
|
|
100
|
+
200: {
|
|
101
|
+
content: {
|
|
102
|
+
'application/json': {
|
|
103
|
+
success: true;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
} & UploadErrorResponses;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
'/api/v0/uploads/multipart/initiate': {
|
|
111
|
+
post: {
|
|
112
|
+
requestBody: {
|
|
113
|
+
content: {
|
|
114
|
+
'application/json': {
|
|
115
|
+
collectionId: string;
|
|
116
|
+
contentType: string;
|
|
117
|
+
filename: string;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
responses: {
|
|
122
|
+
200: {
|
|
123
|
+
content: {
|
|
124
|
+
'application/json': {
|
|
125
|
+
uploadId: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
} & UploadErrorResponses;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
'/api/v0/uploads/multipart/parts': {
|
|
133
|
+
post: {
|
|
134
|
+
requestBody: {
|
|
135
|
+
content: {
|
|
136
|
+
'application/json': {
|
|
137
|
+
collectionId: string;
|
|
138
|
+
expiresIn: number;
|
|
139
|
+
filename: string;
|
|
140
|
+
partNumbers: number[];
|
|
141
|
+
uploadId: string;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
responses: {
|
|
146
|
+
200: {
|
|
147
|
+
content: {
|
|
148
|
+
'application/json': {
|
|
149
|
+
parts: Array<{
|
|
150
|
+
partNumber: number;
|
|
151
|
+
url: string;
|
|
152
|
+
}>;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
} & UploadErrorResponses;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
'/api/v0/uploads/sign': {
|
|
160
|
+
post: {
|
|
161
|
+
requestBody: {
|
|
162
|
+
content: {
|
|
163
|
+
'application/json': {
|
|
164
|
+
collectionId: string;
|
|
165
|
+
contentType?: string;
|
|
166
|
+
expiresIn: number;
|
|
167
|
+
filename: string;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
responses: {
|
|
172
|
+
200: {
|
|
173
|
+
content: {
|
|
174
|
+
'application/json': {
|
|
175
|
+
url: string;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
} & UploadErrorResponses;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GenerateUploadInstructions, UploadInstructionsAccess } from 'payload';
|
|
2
|
+
import type { StorageClient } from '../client.js';
|
|
3
|
+
type Args = {
|
|
4
|
+
access?: UploadInstructionsAccess;
|
|
5
|
+
client: StorageClient;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* v4 client-upload entry point. Payload core calls this from
|
|
9
|
+
* `POST /api/upload-instructions`; we sign a Content API upload URL and hand the
|
|
10
|
+
* browser an `http` PUT instruction plus an `uploadReference` that
|
|
11
|
+
* `handleUpload`/`staticHandler` use to recognize the already-uploaded file.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getGenerateUploadInstructions: ({ access, client, }: Args) => GenerateUploadInstructions;
|
|
14
|
+
export {};
|