@payloadcms/figma 0.0.1-alpha.8 → 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 +381 -18
- 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
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// Built-in document fields the Content API manages itself (stored as columns and
|
|
2
|
+
// injected into every schema). They must never be sent as declared fields, so any
|
|
3
|
+
// top-level field with one of these names is dropped.
|
|
4
|
+
const BUILT_IN_FIELD_NAMES = new Set([
|
|
5
|
+
'createdAt',
|
|
6
|
+
'id',
|
|
7
|
+
'updatedAt'
|
|
8
|
+
]);
|
|
9
|
+
export function buildDocumentSchema(config) {
|
|
10
|
+
const collections = {};
|
|
11
|
+
const blocksBySlug = new Map();
|
|
12
|
+
for (const block of config.blocks ?? []){
|
|
13
|
+
blocksBySlug.set(block.slug, block);
|
|
14
|
+
}
|
|
15
|
+
for (const collection of config.collections ?? []){
|
|
16
|
+
collections[collection.slug] = buildCollectionSchema(collection.slug, collection.fields, blocksBySlug);
|
|
17
|
+
}
|
|
18
|
+
for (const global of config.globals ?? []){
|
|
19
|
+
const slug = `_global-${global.slug}`;
|
|
20
|
+
collections[slug] = buildCollectionSchema(slug, global.fields, blocksBySlug);
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
collections,
|
|
24
|
+
version: 1
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function buildCollectionSchema(name, fields, blocksBySlug) {
|
|
28
|
+
const paths = {};
|
|
29
|
+
collectPaths(fields, '', false, paths, blocksBySlug);
|
|
30
|
+
// `_payloadAutosave` marks a version as an autosave draft. The Content API wraps
|
|
31
|
+
// version schemas under the `version` envelope, so this becomes `version._payloadAutosave`
|
|
32
|
+
// there. This adds the field to both the document and document version schemas as there
|
|
33
|
+
// is no way to add it to just one. However, fields present in the collection schema but
|
|
34
|
+
// not in the request payload are ignored, so this is safe to add to both.
|
|
35
|
+
if (!('_payloadAutosave' in paths)) {
|
|
36
|
+
paths._payloadAutosave = {
|
|
37
|
+
type: 'checkbox',
|
|
38
|
+
localized: false
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
name,
|
|
43
|
+
hints: [],
|
|
44
|
+
paths
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function collectPaths(fields, prefix, absorbed, paths, blocksBySlug) {
|
|
48
|
+
for (const field of fields){
|
|
49
|
+
if (field.type === 'row' || field.type === 'collapsible' || field.type === 'group' && (!('name' in field) || !field.name)) {
|
|
50
|
+
collectPaths(field.fields, prefix, absorbed, paths, blocksBySlug);
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (field.type === 'tabs') {
|
|
54
|
+
for (const tab of field.tabs){
|
|
55
|
+
const tabOwnLocalized = 'localized' in tab && tab.localized === true;
|
|
56
|
+
if ('name' in tab && tab.name) {
|
|
57
|
+
paths[`${prefix}${tab.name}`] = {
|
|
58
|
+
type: 'group',
|
|
59
|
+
hasMany: false,
|
|
60
|
+
localized: tabOwnLocalized && !absorbed
|
|
61
|
+
};
|
|
62
|
+
collectPaths(tab.fields, `${prefix}${tab.name}.`, absorbed || tabOwnLocalized, paths, blocksBySlug);
|
|
63
|
+
} else {
|
|
64
|
+
collectPaths(tab.fields, prefix, absorbed, paths, blocksBySlug);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (field.type === 'ui' || !('name' in field) || !field.name) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
collectNamedField(field, prefix, absorbed, paths, blocksBySlug);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function collectNamedField(field, prefix, absorbed, paths, blocksBySlug) {
|
|
76
|
+
if (!('name' in field) || !field.name) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
// Built-in fields are supplied by the Content API, never declared here.
|
|
80
|
+
if (prefix === '' && BUILT_IN_FIELD_NAMES.has(field.name)) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const path = `${prefix}${field.name}`;
|
|
84
|
+
const localized = 'localized' in field && field.localized === true && !absorbed;
|
|
85
|
+
const childAbsorbed = absorbed || 'localized' in field && field.localized === true;
|
|
86
|
+
const hasMany = 'hasMany' in field ? Boolean(field.hasMany) : false;
|
|
87
|
+
const unique = 'unique' in field ? Boolean(field.unique) : false;
|
|
88
|
+
switch(field.type){
|
|
89
|
+
case 'array':
|
|
90
|
+
paths[path] = {
|
|
91
|
+
type: 'array',
|
|
92
|
+
localized
|
|
93
|
+
};
|
|
94
|
+
collectPaths(field.fields, `${path}.`, childAbsorbed, paths, blocksBySlug);
|
|
95
|
+
return;
|
|
96
|
+
case 'blocks':
|
|
97
|
+
{
|
|
98
|
+
paths[path] = {
|
|
99
|
+
type: 'blocks',
|
|
100
|
+
localized
|
|
101
|
+
};
|
|
102
|
+
paths[`${path}.blockType`] = {
|
|
103
|
+
type: 'text',
|
|
104
|
+
hasMany: false,
|
|
105
|
+
localized: false,
|
|
106
|
+
unique: false
|
|
107
|
+
};
|
|
108
|
+
const blockFields = [];
|
|
109
|
+
for (const block of field.blocks){
|
|
110
|
+
const resolved = typeof block === 'string' ? blocksBySlug.get(block) : block;
|
|
111
|
+
if (resolved) {
|
|
112
|
+
blockFields.push(...resolved.fields);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
collectPaths(blockFields, `${path}.`, childAbsorbed, paths, blocksBySlug);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
case 'checkbox':
|
|
119
|
+
case 'date':
|
|
120
|
+
case 'json':
|
|
121
|
+
case 'radio':
|
|
122
|
+
paths[path] = {
|
|
123
|
+
type: field.type,
|
|
124
|
+
localized
|
|
125
|
+
};
|
|
126
|
+
return;
|
|
127
|
+
case 'code':
|
|
128
|
+
case 'email':
|
|
129
|
+
case 'point':
|
|
130
|
+
case 'textarea':
|
|
131
|
+
paths[path] = {
|
|
132
|
+
type: field.type,
|
|
133
|
+
localized,
|
|
134
|
+
unique
|
|
135
|
+
};
|
|
136
|
+
return;
|
|
137
|
+
case 'group':
|
|
138
|
+
paths[path] = {
|
|
139
|
+
type: 'group',
|
|
140
|
+
hasMany,
|
|
141
|
+
localized
|
|
142
|
+
};
|
|
143
|
+
collectPaths(field.fields, `${path}.`, childAbsorbed, paths, blocksBySlug);
|
|
144
|
+
return;
|
|
145
|
+
case 'join':
|
|
146
|
+
paths[path] = {
|
|
147
|
+
type: 'join',
|
|
148
|
+
collection: field.collection,
|
|
149
|
+
on: field.on
|
|
150
|
+
};
|
|
151
|
+
return;
|
|
152
|
+
case 'number':
|
|
153
|
+
case 'select':
|
|
154
|
+
case 'text':
|
|
155
|
+
paths[path] = {
|
|
156
|
+
type: field.type,
|
|
157
|
+
hasMany,
|
|
158
|
+
localized,
|
|
159
|
+
unique
|
|
160
|
+
};
|
|
161
|
+
return;
|
|
162
|
+
case 'relationship':
|
|
163
|
+
case 'upload':
|
|
164
|
+
paths[path] = {
|
|
165
|
+
type: field.type,
|
|
166
|
+
collection: field.relationTo,
|
|
167
|
+
hasMany,
|
|
168
|
+
localized,
|
|
169
|
+
unique
|
|
170
|
+
};
|
|
171
|
+
return;
|
|
172
|
+
case 'richText':
|
|
173
|
+
paths[path] = {
|
|
174
|
+
type: 'richText',
|
|
175
|
+
format: 'lexical',
|
|
176
|
+
localized
|
|
177
|
+
};
|
|
178
|
+
return;
|
|
179
|
+
default:
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Where } from 'payload';
|
|
2
|
+
import type { components } from '../generated/content-api-types.js';
|
|
3
|
+
type WhereClause = components['schemas']['WhereClause'];
|
|
4
|
+
type ConvertOptions = {
|
|
5
|
+
/** Internal flag to track if we're inside a logical operator (and/or) */
|
|
6
|
+
insideLogicalOperator?: boolean;
|
|
7
|
+
/** If true, transform 'parent' field to 'documentId' (used for version queries) */
|
|
8
|
+
parentToDocumentId?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* If true, strip 'version.' prefix from field paths (used for version queries).
|
|
11
|
+
*
|
|
12
|
+
* Payload queries version content with paths like 'version._status.en', but Content API
|
|
13
|
+
* stores version data directly in the 'data' column (not nested under 'version').
|
|
14
|
+
* The 'version' wrapper is only added in API responses for client compatibility.
|
|
15
|
+
*/
|
|
16
|
+
stripVersionPrefix?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare function convertPayloadWhereToContentAPI(where: undefined | Where, options?: ConvertOptions): WhereClause;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
export function convertPayloadWhereToContentAPI(where, options = {}) {
|
|
2
|
+
// Empty where {} should be { and: [] } not undefined
|
|
3
|
+
// Content API requires a where clause structure even for "no filter"
|
|
4
|
+
if (!where || Object.keys(where).length === 0) {
|
|
5
|
+
return {
|
|
6
|
+
and: []
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
const conditions = [];
|
|
10
|
+
for (const [key, value] of Object.entries(where)){
|
|
11
|
+
const keyLower = key.toLowerCase();
|
|
12
|
+
if (keyLower === 'and' || keyLower === 'or') {
|
|
13
|
+
const nestedConditions = value.map((item)=>convertPayloadWhereToContentAPI(item, {
|
|
14
|
+
...options,
|
|
15
|
+
insideLogicalOperator: true
|
|
16
|
+
})).filter((condition)=>{
|
|
17
|
+
if ('and' in condition) {
|
|
18
|
+
return condition.and.length > 0;
|
|
19
|
+
}
|
|
20
|
+
if ('or' in condition) {
|
|
21
|
+
return condition.or.length > 0;
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
});
|
|
25
|
+
if (keyLower === 'and') {
|
|
26
|
+
conditions.push(...nestedConditions);
|
|
27
|
+
} else if (nestedConditions.length > 0) {
|
|
28
|
+
conditions.push({
|
|
29
|
+
or: nestedConditions
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
// TODO: fix this in content api
|
|
34
|
+
// WORKAROUND: Payload uses 'parent' for version queries, but Content API expects 'documentId'
|
|
35
|
+
let fieldPath = key.replace(/__/g, '.');
|
|
36
|
+
if (options.parentToDocumentId && key === 'parent') {
|
|
37
|
+
fieldPath = 'documentId';
|
|
38
|
+
}
|
|
39
|
+
// Strip 'version.' prefix from field paths for version queries
|
|
40
|
+
// Payload uses paths like 'version._status.en' but Content API stores version data
|
|
41
|
+
// directly in the 'data' column, not nested under 'version'
|
|
42
|
+
if (options.stripVersionPrefix && fieldPath.startsWith('version.')) {
|
|
43
|
+
fieldPath = fieldPath.slice('version.'.length);
|
|
44
|
+
}
|
|
45
|
+
// Convert field conditions: { fieldName: { operator: value } }
|
|
46
|
+
// to: { path: fieldName, operator, value }
|
|
47
|
+
// Handle Payload's shorthand: { fieldName: value } → { fieldName: { equals: value } }
|
|
48
|
+
// If value is a primitive (string, number, boolean, null) or not a plain object,
|
|
49
|
+
// treat it as an implicit 'equals' operator
|
|
50
|
+
const isPrimitive = value === null || typeof value !== 'object' || Array.isArray(value);
|
|
51
|
+
if (isPrimitive) {
|
|
52
|
+
// Shorthand format: { id: "some-value" } means { id: { equals: "some-value" } }
|
|
53
|
+
conditions.push({
|
|
54
|
+
operator: 'equals',
|
|
55
|
+
path: fieldPath,
|
|
56
|
+
value: fieldPath === 'id' && typeof value === 'number' ? String(value) : value
|
|
57
|
+
});
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const operators = value;
|
|
61
|
+
// Skip empty operator objects { fieldName: {} }
|
|
62
|
+
if (Object.keys(operators).length === 0) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
for (const [op, operatorValue] of Object.entries(operators)){
|
|
66
|
+
// Skip operators with undefined values (e.g., { equals: undefined })
|
|
67
|
+
// This can happen when Payload sends incomplete where clauses
|
|
68
|
+
if (operatorValue === undefined) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
let finalValue = operatorValue;
|
|
72
|
+
// Convert string booleans to actual booleans for exists operator
|
|
73
|
+
// REST API sends "true"/"false" as strings, but Content API requires boolean
|
|
74
|
+
if (op === 'exists' && typeof operatorValue === 'string') {
|
|
75
|
+
finalValue = operatorValue === 'true';
|
|
76
|
+
}
|
|
77
|
+
// REST API sends "null" as a string; convert to actual null
|
|
78
|
+
if (finalValue === 'null') {
|
|
79
|
+
finalValue = null;
|
|
80
|
+
}
|
|
81
|
+
// Content API stores all document IDs as strings.
|
|
82
|
+
// Payload sends numeric values for collections with custom numeric ID fields,
|
|
83
|
+
// so we must stringify to match.
|
|
84
|
+
if (fieldPath === 'id' && typeof finalValue === 'number') {
|
|
85
|
+
finalValue = String(finalValue);
|
|
86
|
+
}
|
|
87
|
+
conditions.push({
|
|
88
|
+
operator: op,
|
|
89
|
+
path: fieldPath,
|
|
90
|
+
value: finalValue
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (conditions.length === 0) {
|
|
96
|
+
return {
|
|
97
|
+
and: []
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
if (options.insideLogicalOperator && conditions.length === 1) {
|
|
101
|
+
return conditions[0];
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
and: conditions
|
|
105
|
+
};
|
|
106
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Config } from 'payload';
|
|
2
|
+
/**
|
|
3
|
+
* Payload plugin that extracts cron schedule metadata and writes
|
|
4
|
+
* `.next/static/payload-schedules.json` during `figma deploy` builds.
|
|
5
|
+
*
|
|
6
|
+
* Only runs when `FIGMA_EXTRACT_SCHEDULES=true`, which is set exclusively by
|
|
7
|
+
* the deploy CLI before spawning `next build`. At Lambda runtime and during
|
|
8
|
+
* local development the env var is absent and this plugin is a no-op.
|
|
9
|
+
*/
|
|
10
|
+
export declare function scheduleExtractPlugin(): (config: Config) => Config;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
/**
|
|
4
|
+
* Payload plugin that extracts cron schedule metadata and writes
|
|
5
|
+
* `.next/static/payload-schedules.json` during `figma deploy` builds.
|
|
6
|
+
*
|
|
7
|
+
* Only runs when `FIGMA_EXTRACT_SCHEDULES=true`, which is set exclusively by
|
|
8
|
+
* the deploy CLI before spawning `next build`. At Lambda runtime and during
|
|
9
|
+
* local development the env var is absent and this plugin is a no-op.
|
|
10
|
+
*/ export function scheduleExtractPlugin() {
|
|
11
|
+
return (config)=>{
|
|
12
|
+
if (process.env.FIGMA_EXTRACT_SCHEDULES !== 'true') {
|
|
13
|
+
return config;
|
|
14
|
+
}
|
|
15
|
+
const schedules = [
|
|
16
|
+
...(config.jobs?.tasks ?? []).flatMap((task)=>(task.schedule ?? []).map((sched)=>({
|
|
17
|
+
slug: task.slug,
|
|
18
|
+
cron: sched.cron
|
|
19
|
+
}))),
|
|
20
|
+
...(config.jobs?.workflows ?? []).flatMap((workflow)=>(workflow.schedule ?? []).map((sched)=>({
|
|
21
|
+
slug: workflow.slug,
|
|
22
|
+
cron: sched.cron
|
|
23
|
+
})))
|
|
24
|
+
];
|
|
25
|
+
const outDir = path.join(process.cwd(), '.next', 'static');
|
|
26
|
+
fs.mkdirSync(outDir, {
|
|
27
|
+
recursive: true
|
|
28
|
+
});
|
|
29
|
+
fs.writeFileSync(path.join(outDir, 'payload-schedules.json'), JSON.stringify(schedules));
|
|
30
|
+
return config;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import crypto from 'crypto';
|
|
2
|
+
import { configToJSONSchema } from 'payload';
|
|
3
|
+
export const schema = {
|
|
4
|
+
handler: (req)=>{
|
|
5
|
+
if (!req.user) {
|
|
6
|
+
return Response.json({
|
|
7
|
+
error: 'Unauthorized'
|
|
8
|
+
}, {
|
|
9
|
+
status: 401
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
const format = req.query?.format;
|
|
13
|
+
const { jsonSchema } = configToJSONSchema(req.payload.config);
|
|
14
|
+
const hash = crypto.createHash('sha256').update(JSON.stringify(jsonSchema)).digest('hex');
|
|
15
|
+
if (format === 'hash') {
|
|
16
|
+
return Response.json({
|
|
17
|
+
hash
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return Response.json({
|
|
21
|
+
hash,
|
|
22
|
+
schema: jsonSchema
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
method: 'get',
|
|
26
|
+
path: '/figma/schema'
|
|
27
|
+
};
|
package/dist/exports/client.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { FigmaAvatar } from '../oauth/components/FigmaAvatar/index.js';
|
|
2
|
+
export { FigmaAvatarCell } from '../oauth/components/FigmaAvatarCell/index.js';
|
|
1
3
|
export { DefaultLoginButton } from '../oauth/components/LoginButton/index.js';
|
|
2
4
|
export { LogoutButton } from '../oauth/components/LogoutButton/index.js';
|
|
3
|
-
//# sourceMappingURL=client.d.ts.map
|
package/dist/exports/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
export { FigmaAvatar } from '../oauth/components/FigmaAvatar/index.js';
|
|
2
|
+
export { FigmaAvatarCell } from '../oauth/components/FigmaAvatarCell/index.js';
|
|
1
3
|
export { DefaultLoginButton } from '../oauth/components/LoginButton/index.js';
|
|
2
4
|
export { LogoutButton } from '../oauth/components/LogoutButton/index.js';
|
|
3
|
-
|
|
4
|
-
//# sourceMappingURL=client.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
export { contentAPIAdapter } from './db-content-api/index.js';
|
|
1
2
|
export { figmaContentSystem } from './plugin/adapter.js';
|
|
2
3
|
export type { FigmaContentSystemOptions } from './plugin/adapter.js';
|
|
3
|
-
export {
|
|
4
|
+
export { buildFigmaConfig } from './plugin/build-config.js';
|
|
4
5
|
export type { FigmaConfig } from './plugin/build-config.js';
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
// Export contentAPIAdapter for testing use cases
|
|
2
|
+
export { contentAPIAdapter } from './db-content-api/index.js';
|
|
1
3
|
// Export database adapter for advanced use cases
|
|
2
4
|
export { figmaContentSystem } from './plugin/adapter.js';
|
|
3
5
|
// Export buildConfig wrapper and its config type
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
6
|
+
export { buildFigmaConfig } from './plugin/build-config.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type DownloadSkillResult = {
|
|
2
|
+
detail?: string;
|
|
3
|
+
ok: false;
|
|
4
|
+
reason: 'already-installed' | 'empty-extract' | 'error' | 'fetch-failed';
|
|
5
|
+
} | {
|
|
6
|
+
ok: true;
|
|
7
|
+
};
|
|
8
|
+
export declare function downloadSkill(args: {
|
|
9
|
+
branch?: string;
|
|
10
|
+
debug?: boolean;
|
|
11
|
+
projectDir: string;
|
|
12
|
+
}): Promise<DownloadSkillResult>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import { Readable } from 'node:stream';
|
|
3
|
+
import { pipeline } from 'node:stream/promises';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { x } from 'tar';
|
|
6
|
+
export async function downloadSkill(args) {
|
|
7
|
+
const { branch = 'main', debug, projectDir } = args;
|
|
8
|
+
const destDir = path.join(projectDir, '.claude', 'skills', 'payload');
|
|
9
|
+
if (await pathExists(path.join(destDir, 'SKILL.md'))) {
|
|
10
|
+
return {
|
|
11
|
+
ok: false,
|
|
12
|
+
reason: 'already-installed'
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const url = `https://codeload.github.com/payloadcms/payload/tar.gz/${branch}`;
|
|
16
|
+
const filter = `payload-${branch.replace(/^v/, '').replaceAll('/', '-')}/tools/claude-plugin/skills/payload/`;
|
|
17
|
+
if (debug) {
|
|
18
|
+
// eslint-disable-next-line no-console
|
|
19
|
+
console.log(`[download-skill] url=${url} dest=${destDir}`);
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const res = await fetch(url);
|
|
23
|
+
if (!res.ok) {
|
|
24
|
+
return {
|
|
25
|
+
detail: `${res.status} ${res.statusText}`,
|
|
26
|
+
ok: false,
|
|
27
|
+
reason: 'fetch-failed'
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (!res.body) {
|
|
31
|
+
return {
|
|
32
|
+
detail: 'empty response body',
|
|
33
|
+
ok: false,
|
|
34
|
+
reason: 'fetch-failed'
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
await fs.mkdir(destDir, {
|
|
38
|
+
recursive: true
|
|
39
|
+
});
|
|
40
|
+
await pipeline(Readable.from(res.body), x({
|
|
41
|
+
cwd: destDir,
|
|
42
|
+
filter: (p)=>p.includes(filter),
|
|
43
|
+
strip: filter.split('/').length - 1
|
|
44
|
+
}));
|
|
45
|
+
if (!await pathExists(path.join(destDir, 'SKILL.md'))) {
|
|
46
|
+
await fs.rm(destDir, {
|
|
47
|
+
force: true,
|
|
48
|
+
recursive: true
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
ok: false,
|
|
52
|
+
reason: 'empty-extract'
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
ok: true
|
|
57
|
+
};
|
|
58
|
+
} catch (err) {
|
|
59
|
+
await fs.rm(destDir, {
|
|
60
|
+
force: true,
|
|
61
|
+
recursive: true
|
|
62
|
+
}).catch(()=>{});
|
|
63
|
+
return {
|
|
64
|
+
detail: err instanceof Error ? err.message : String(err),
|
|
65
|
+
ok: false,
|
|
66
|
+
reason: 'error'
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function pathExists(p) {
|
|
71
|
+
try {
|
|
72
|
+
await fs.access(p);
|
|
73
|
+
return true;
|
|
74
|
+
} catch {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useAuth } from '@payloadcms/ui';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { FigmaAvatarPlaceholder, isValidImageUrl } from '../FigmaAvatarPlaceholder/index.js';
|
|
6
|
+
import './index.scss';
|
|
7
|
+
const baseClass = 'figma-avatar';
|
|
8
|
+
export const FigmaAvatar = ()=>{
|
|
9
|
+
const { user } = useAuth();
|
|
10
|
+
const [hasError, setHasError] = useState(false);
|
|
11
|
+
const figmaImageUrl = user?.figmaImageUrl;
|
|
12
|
+
if (!figmaImageUrl || hasError || !isValidImageUrl(figmaImageUrl)) {
|
|
13
|
+
return /*#__PURE__*/ _jsx(FigmaAvatarPlaceholder, {
|
|
14
|
+
size: 25
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return /*#__PURE__*/ _jsx("img", {
|
|
18
|
+
alt: "Profile",
|
|
19
|
+
className: `${baseClass}__image`,
|
|
20
|
+
height: 25,
|
|
21
|
+
onError: ()=>setHasError(true),
|
|
22
|
+
src: figmaImageUrl,
|
|
23
|
+
width: 25
|
|
24
|
+
});
|
|
25
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { FigmaAvatarPlaceholder, isValidImageUrl } from '../FigmaAvatarPlaceholder/index.js';
|
|
5
|
+
import './index.scss';
|
|
6
|
+
const baseClass = 'figma-avatar-cell';
|
|
7
|
+
export const FigmaAvatarCell = ({ cellData })=>{
|
|
8
|
+
const [hasError, setHasError] = useState(false);
|
|
9
|
+
const figmaImageUrl = cellData;
|
|
10
|
+
if (!figmaImageUrl || hasError || !isValidImageUrl(figmaImageUrl)) {
|
|
11
|
+
return /*#__PURE__*/ _jsx(FigmaAvatarPlaceholder, {
|
|
12
|
+
size: 20
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return /*#__PURE__*/ _jsx("img", {
|
|
16
|
+
alt: "Avatar",
|
|
17
|
+
className: `${baseClass}__image`,
|
|
18
|
+
height: 20,
|
|
19
|
+
onError: ()=>setHasError(true),
|
|
20
|
+
src: figmaImageUrl,
|
|
21
|
+
width: 20
|
|
22
|
+
});
|
|
23
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import './index.scss';
|
|
3
|
+
type FigmaAvatarPlaceholderProps = {
|
|
4
|
+
size?: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const FigmaAvatarPlaceholder: React.FC<FigmaAvatarPlaceholderProps>;
|
|
7
|
+
export declare function isValidImageUrl(url: string): boolean;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import './index.scss';
|
|
3
|
+
const baseClass = 'figma-avatar-placeholder';
|
|
4
|
+
export const FigmaAvatarPlaceholder = ({ size = 25 })=>/*#__PURE__*/ _jsxs("svg", {
|
|
5
|
+
className: baseClass,
|
|
6
|
+
height: size,
|
|
7
|
+
viewBox: "0 0 25 25",
|
|
8
|
+
width: size,
|
|
9
|
+
children: [
|
|
10
|
+
/*#__PURE__*/ _jsx("circle", {
|
|
11
|
+
className: `${baseClass}__bg`,
|
|
12
|
+
cx: "12.5",
|
|
13
|
+
cy: "12.5",
|
|
14
|
+
r: "11.5"
|
|
15
|
+
}),
|
|
16
|
+
/*#__PURE__*/ _jsx("circle", {
|
|
17
|
+
className: `${baseClass}__head`,
|
|
18
|
+
cx: "12.5",
|
|
19
|
+
cy: "10",
|
|
20
|
+
r: "4"
|
|
21
|
+
}),
|
|
22
|
+
/*#__PURE__*/ _jsx("path", {
|
|
23
|
+
className: `${baseClass}__body`,
|
|
24
|
+
d: "M12.5 15c-4 0-7 2-7 4.5v1h14v-1c0-2.5-3-4.5-7-4.5z"
|
|
25
|
+
})
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
export function isValidImageUrl(url) {
|
|
29
|
+
try {
|
|
30
|
+
const parsed = new URL(url);
|
|
31
|
+
return parsed.protocol === 'https:' || parsed.protocol === 'http:';
|
|
32
|
+
} catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|