@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
package/dist/utils/project.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Project detection and scaffolding utilities
|
|
3
|
-
*/ import
|
|
3
|
+
*/ import spawn from 'cross-spawn';
|
|
4
4
|
import fs from 'fs/promises';
|
|
5
5
|
import path from 'path';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
6
7
|
import { ensureGitignore } from './config.js';
|
|
7
8
|
import { downloadTemplateFromGitHub } from './download-template.js';
|
|
8
|
-
import { manageEnvFiles } from './env-management.js';
|
|
9
9
|
import { tryInitRepoAndCommit } from './git.js';
|
|
10
10
|
import { applyLambdaModifications } from './lambda-config.js';
|
|
11
|
+
import { getRunCommand } from './package-manager.js';
|
|
12
|
+
import { getOwnVersion } from './version-check.js';
|
|
11
13
|
/**
|
|
12
14
|
* Detect if current directory has a Payload project
|
|
13
15
|
*
|
|
@@ -51,63 +53,76 @@ import { applyLambdaModifications } from './lambda-config.js';
|
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
/**
|
|
54
|
-
* Validate Payload version (must be
|
|
56
|
+
* Validate Payload version (must be 4.x or newer)
|
|
55
57
|
*
|
|
56
58
|
* @param version - Version string from package.json
|
|
57
59
|
* @returns True if version is valid
|
|
58
60
|
*/ export function validatePayloadVersion(version) {
|
|
59
|
-
// Extract major version (handle ^
|
|
61
|
+
// Extract major version (handle ^4.0.0, ~4.0.0, 4.0.0, 4.0.0-canary.16, etc.)
|
|
60
62
|
const match = version.match(/(\d+)/);
|
|
61
63
|
if (!match) {
|
|
62
64
|
return false;
|
|
63
65
|
}
|
|
64
66
|
const majorVersion = parseInt(match[1], 10);
|
|
65
|
-
return majorVersion
|
|
67
|
+
return majorVersion >= 4;
|
|
66
68
|
}
|
|
67
69
|
/**
|
|
68
|
-
*
|
|
70
|
+
* Resolve a package version from an npm dist-tag or an explicit version.
|
|
69
71
|
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
* A value matching a published dist-tag (e.g. 'latest', 'canary') resolves to
|
|
73
|
+
* that tag's concrete version. Any other value is treated as an explicit version
|
|
74
|
+
* and verified against the registry.
|
|
75
|
+
*
|
|
76
|
+
* @param packageName - Package name to look up
|
|
77
|
+
* @param versionOrTag - npm dist-tag or explicit semver version; defaults to 'latest'
|
|
78
|
+
* @returns The concrete version string to pin
|
|
79
|
+
*/ async function resolvePackageVersion(packageName, versionOrTag = 'latest') {
|
|
80
|
+
const distTagsResponse = await fetch(`https://registry.npmjs.org/-/package/${packageName}/dist-tags`);
|
|
81
|
+
if (!distTagsResponse.ok) {
|
|
82
|
+
throw new Error(`Failed to fetch versions for ${packageName}: ${distTagsResponse.statusText}`);
|
|
83
|
+
}
|
|
84
|
+
const distTags = await distTagsResponse.json();
|
|
85
|
+
const tagged = distTags[versionOrTag];
|
|
86
|
+
if (typeof tagged === 'string') {
|
|
87
|
+
return tagged;
|
|
76
88
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
89
|
+
// Not a dist-tag — treat as an explicit version and verify it's published.
|
|
90
|
+
const versionResponse = await fetch(`https://registry.npmjs.org/${packageName}/${versionOrTag}`);
|
|
91
|
+
if (versionResponse.ok) {
|
|
92
|
+
return versionOrTag;
|
|
80
93
|
}
|
|
81
|
-
|
|
94
|
+
throw new Error(`No "${versionOrTag}" version or dist-tag published for ${packageName}. Available dist-tags: ${Object.keys(distTags).join(', ')}`);
|
|
82
95
|
}
|
|
83
96
|
/**
|
|
84
97
|
* Replace workspace versions in package.json with actual versions
|
|
85
98
|
*
|
|
86
99
|
* @param packageJson - Package JSON object to update
|
|
87
|
-
* @param
|
|
88
|
-
*/ function replaceWorkspaceVersions(packageJson,
|
|
100
|
+
* @param coreVersion - Resolved core Payload version to use
|
|
101
|
+
*/ function replaceWorkspaceVersions(packageJson, coreVersion, figmaVersion) {
|
|
89
102
|
const deps = packageJson.dependencies;
|
|
90
103
|
if (!deps) {
|
|
91
104
|
return;
|
|
92
105
|
}
|
|
93
106
|
for (const [key, value] of Object.entries(deps)){
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
107
|
+
if (key === '@payloadcms/figma') {
|
|
108
|
+
deps[key] = figmaVersion;
|
|
109
|
+
} else if (typeof value === 'string' && value.startsWith('workspace:')) {
|
|
110
|
+
deps[key] = coreVersion;
|
|
97
111
|
} else if (key === 'payload' || key.startsWith('@payloadcms/')) {
|
|
98
|
-
deps[key] =
|
|
112
|
+
deps[key] = coreVersion;
|
|
99
113
|
}
|
|
100
114
|
}
|
|
101
|
-
// Also handle devDependencies if present
|
|
102
115
|
const devDeps = packageJson.devDependencies;
|
|
103
116
|
if (!devDeps) {
|
|
104
117
|
return;
|
|
105
118
|
}
|
|
106
119
|
for (const [key, value] of Object.entries(devDeps)){
|
|
107
|
-
if (
|
|
108
|
-
devDeps[key] =
|
|
120
|
+
if (key === '@payloadcms/figma') {
|
|
121
|
+
devDeps[key] = figmaVersion;
|
|
122
|
+
} else if (typeof value === 'string' && value.startsWith('workspace:')) {
|
|
123
|
+
devDeps[key] = coreVersion;
|
|
109
124
|
} else if (key === 'payload' || key.startsWith('@payloadcms/')) {
|
|
110
|
-
devDeps[key] =
|
|
125
|
+
devDeps[key] = coreVersion;
|
|
111
126
|
}
|
|
112
127
|
}
|
|
113
128
|
}
|
|
@@ -116,18 +131,24 @@ import { applyLambdaModifications } from './lambda-config.js';
|
|
|
116
131
|
*
|
|
117
132
|
* @param projectPath - Path where to create the project
|
|
118
133
|
* @param projectName - Name for the project
|
|
119
|
-
|
|
134
|
+
* @param packageManager - Package manager to use
|
|
135
|
+
* @param templateSource - Optional template source override
|
|
136
|
+
* @param payloadVersion - npm dist-tag or explicit version for core payload packages (default 'canary')
|
|
137
|
+
*/ export async function scaffoldProject(projectPath, projectName, packageManager = 'npm', templateSource, payloadVersion = 'canary') {
|
|
120
138
|
// Create project directory if it doesn't exist
|
|
121
139
|
await fs.mkdir(projectPath, {
|
|
122
140
|
recursive: true
|
|
123
141
|
});
|
|
124
142
|
// Download template from GitHub
|
|
125
|
-
await downloadTemplateFromGitHub(projectPath);
|
|
143
|
+
await downloadTemplateFromGitHub(projectPath, templateSource);
|
|
126
144
|
// Apply Lambda modifications BEFORE updating package.json
|
|
127
145
|
// This ensures we don't overwrite version replacements
|
|
128
|
-
await applyLambdaModifications(projectPath);
|
|
129
|
-
//
|
|
130
|
-
const
|
|
146
|
+
await applyLambdaModifications(projectPath, packageManager);
|
|
147
|
+
// Resolve core Payload version from the selected dist-tag or version; figma uses CLI version
|
|
148
|
+
const [coreVersion, figmaVersion] = await Promise.all([
|
|
149
|
+
resolvePackageVersion('payload', payloadVersion),
|
|
150
|
+
getOwnVersion()
|
|
151
|
+
]);
|
|
131
152
|
// Delete any existing lock files from template (they reference workspace:* versions)
|
|
132
153
|
// This ensures pnpm install creates a fresh lock file with actual versions
|
|
133
154
|
const lockFiles = [
|
|
@@ -149,16 +170,24 @@ import { applyLambdaModifications } from './lambda-config.js';
|
|
|
149
170
|
const packageJson = JSON.parse(packageJsonContent);
|
|
150
171
|
packageJson.name = projectName;
|
|
151
172
|
// Replace workspace:* versions with actual versions
|
|
152
|
-
replaceWorkspaceVersions(packageJson,
|
|
173
|
+
replaceWorkspaceVersions(packageJson, coreVersion, figmaVersion);
|
|
153
174
|
await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8');
|
|
154
|
-
// Manage environment files (generate PAYLOAD_SECRET)
|
|
155
|
-
await manageEnvFiles(projectPath);
|
|
156
175
|
// Ensure .gitignore has required entries
|
|
176
|
+
// Note: .env file is created by init command with FIGMA_CONTENT_API_CONTENT_SYSTEM_ID
|
|
157
177
|
await ensureGitignore(projectPath, [
|
|
158
178
|
'.env',
|
|
159
179
|
'.env.local',
|
|
160
180
|
'lambda.zip'
|
|
161
181
|
]);
|
|
182
|
+
// Replace README with Figma-specific version
|
|
183
|
+
const readmeTemplatePath = fileURLToPath(new URL('../templates/README.md', import.meta.url));
|
|
184
|
+
let readmeContent = await fs.readFile(readmeTemplatePath, 'utf-8');
|
|
185
|
+
readmeContent = readmeContent.replace(/\{\{PROJECT_NAME\}\}/g, projectName);
|
|
186
|
+
readmeContent = readmeContent.replace(/\{\{RUN_COMMAND\}\}/g, getRunCommand(packageManager));
|
|
187
|
+
await fs.writeFile(path.join(projectPath, 'README.md'), readmeContent, 'utf-8');
|
|
188
|
+
// Copy .env.example template
|
|
189
|
+
const envExampleTemplatePath = fileURLToPath(new URL('../templates/.env.example', import.meta.url));
|
|
190
|
+
await fs.copyFile(envExampleTemplatePath, path.join(projectPath, '.env.example'));
|
|
162
191
|
}
|
|
163
192
|
/**
|
|
164
193
|
* Initialize git repository after all setup is complete
|
|
@@ -181,7 +210,6 @@ import { applyLambdaModifications } from './lambda-config.js';
|
|
|
181
210
|
'install'
|
|
182
211
|
], {
|
|
183
212
|
cwd: projectPath,
|
|
184
|
-
shell: true,
|
|
185
213
|
stdio: 'pipe'
|
|
186
214
|
});
|
|
187
215
|
let stdout = '';
|
|
@@ -246,5 +274,3 @@ import { applyLambdaModifications } from './lambda-config.js';
|
|
|
246
274
|
return false;
|
|
247
275
|
}
|
|
248
276
|
}
|
|
249
|
-
|
|
250
|
-
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BootstrapEnvironment } from '../api/control-plane.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve which environment to use from the bootstrap response.
|
|
4
|
+
*
|
|
5
|
+
* - Single environment: auto-select (environmentName optional, validated if provided)
|
|
6
|
+
* - Multiple environments: environmentName required, must match
|
|
7
|
+
*
|
|
8
|
+
* @throws Error if resolution fails (with available environment names)
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveEnvironment(params: {
|
|
11
|
+
environmentName?: string;
|
|
12
|
+
environments: BootstrapEnvironment[];
|
|
13
|
+
}): BootstrapEnvironment;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve which environment to use from the bootstrap response.
|
|
3
|
+
*
|
|
4
|
+
* - Single environment: auto-select (environmentName optional, validated if provided)
|
|
5
|
+
* - Multiple environments: environmentName required, must match
|
|
6
|
+
*
|
|
7
|
+
* @throws Error if resolution fails (with available environment names)
|
|
8
|
+
*/ export function resolveEnvironment(params) {
|
|
9
|
+
const { environmentName, environments } = params;
|
|
10
|
+
if (environments.length === 0) {
|
|
11
|
+
throw new Error('No environments found for this project.');
|
|
12
|
+
}
|
|
13
|
+
if (environments.length === 1) {
|
|
14
|
+
if (environmentName && environments[0].name !== environmentName) {
|
|
15
|
+
throw new Error(`Environment "${environmentName}" not found. Available: ${environments[0].name}`);
|
|
16
|
+
}
|
|
17
|
+
return environments[0];
|
|
18
|
+
}
|
|
19
|
+
// Multiple environments — name required
|
|
20
|
+
const availableNames = environments.map((e)=>e.name).join(', ');
|
|
21
|
+
if (!environmentName) {
|
|
22
|
+
throw new Error(`Multiple environments available. Use --env to specify one: ${availableNames}`);
|
|
23
|
+
}
|
|
24
|
+
const matched = environments.find((e)=>e.name === environmentName);
|
|
25
|
+
if (!matched) {
|
|
26
|
+
throw new Error(`Environment "${environmentName}" not found. Available: ${availableNames}`);
|
|
27
|
+
}
|
|
28
|
+
return matched;
|
|
29
|
+
}
|
|
@@ -18,7 +18,6 @@ export interface UploadResults {
|
|
|
18
18
|
*
|
|
19
19
|
* @param filePath - Absolute path to file to upload
|
|
20
20
|
* @param signedUrl - Signed S3 upload URL
|
|
21
|
-
* @param contentType - MIME type (optional)
|
|
22
21
|
* @throws Error if upload fails after retries
|
|
23
22
|
*/
|
|
24
23
|
export declare function uploadFile(filePath: string, signedUrl: string, contentType?: string): Promise<void>;
|
|
@@ -39,5 +38,10 @@ export declare function uploadLambdaZip(zipPath: string, signedUrl: string): Pro
|
|
|
39
38
|
* @param onProgress - Optional callback for progress updates (uploaded, total)
|
|
40
39
|
* @returns Upload results with counts
|
|
41
40
|
*/
|
|
42
|
-
export declare function uploadStaticAssets(
|
|
43
|
-
|
|
41
|
+
export declare function uploadStaticAssets(params: {
|
|
42
|
+
assetUrls: Record<string, string>;
|
|
43
|
+
onProgress?: (uploaded: number, total: number) => void;
|
|
44
|
+
/** Map of S3 key → relative filesystem path (overrides default _next/ → .next/ resolution) */
|
|
45
|
+
pathMap?: Record<string, string>;
|
|
46
|
+
projectPath: string;
|
|
47
|
+
}): Promise<UploadResults>;
|
package/dist/utils/s3-upload.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { parseS3Error } from '../api/error-response.js';
|
|
3
4
|
import * as log from './log.js';
|
|
4
5
|
/**
|
|
5
6
|
* Retry configuration
|
|
@@ -11,6 +12,37 @@ const INITIAL_RETRY_DELAY = 1000 // 1 second
|
|
|
11
12
|
*/ function sleep(ms) {
|
|
12
13
|
return new Promise((resolve)=>setTimeout(resolve, ms));
|
|
13
14
|
}
|
|
15
|
+
/** Common MIME types for web assets, keyed by file extension */ const MIME_TYPES = {
|
|
16
|
+
'.avif': 'image/avif',
|
|
17
|
+
'.css': 'text/css',
|
|
18
|
+
'.csv': 'text/csv',
|
|
19
|
+
'.eot': 'application/vnd.ms-fontobject',
|
|
20
|
+
'.gif': 'image/gif',
|
|
21
|
+
'.html': 'text/html',
|
|
22
|
+
'.ico': 'image/x-icon',
|
|
23
|
+
'.jpeg': 'image/jpeg',
|
|
24
|
+
'.jpg': 'image/jpeg',
|
|
25
|
+
'.js': 'application/javascript',
|
|
26
|
+
'.json': 'application/json',
|
|
27
|
+
'.map': 'application/json',
|
|
28
|
+
'.meta': 'application/json',
|
|
29
|
+
'.mjs': 'application/javascript',
|
|
30
|
+
'.mp4': 'video/mp4',
|
|
31
|
+
'.otf': 'font/otf',
|
|
32
|
+
'.pdf': 'application/pdf',
|
|
33
|
+
'.png': 'image/png',
|
|
34
|
+
'.rsc': 'text/x-component',
|
|
35
|
+
'.svg': 'image/svg+xml',
|
|
36
|
+
'.ttf': 'font/ttf',
|
|
37
|
+
'.txt': 'text/plain',
|
|
38
|
+
'.wasm': 'application/wasm',
|
|
39
|
+
'.webm': 'video/webm',
|
|
40
|
+
'.webp': 'image/webp',
|
|
41
|
+
'.woff': 'font/woff',
|
|
42
|
+
'.woff2': 'font/woff2',
|
|
43
|
+
'.xml': 'application/xml',
|
|
44
|
+
'.zip': 'application/zip'
|
|
45
|
+
};
|
|
14
46
|
/**
|
|
15
47
|
* Check if a signed URL is a mock URL
|
|
16
48
|
*/ function isMockUrl(signedUrl) {
|
|
@@ -23,7 +55,6 @@ const INITIAL_RETRY_DELAY = 1000 // 1 second
|
|
|
23
55
|
*
|
|
24
56
|
* @param filePath - Absolute path to file to upload
|
|
25
57
|
* @param signedUrl - Signed S3 upload URL
|
|
26
|
-
* @param contentType - MIME type (optional)
|
|
27
58
|
* @throws Error if upload fails after retries
|
|
28
59
|
*/ export async function uploadFile(filePath, signedUrl, contentType) {
|
|
29
60
|
// Skip actual upload for mock URLs
|
|
@@ -45,17 +76,22 @@ const INITIAL_RETRY_DELAY = 1000 // 1 second
|
|
|
45
76
|
let lastError = null;
|
|
46
77
|
for(let attempt = 0; attempt < MAX_RETRIES; attempt++){
|
|
47
78
|
try {
|
|
79
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
80
|
+
const determinedContentType = contentType ?? MIME_TYPES[ext];
|
|
48
81
|
const response = await fetch(signedUrl, {
|
|
49
82
|
body: fileBuffer,
|
|
50
|
-
headers:
|
|
51
|
-
'Content-Type':
|
|
83
|
+
headers: determinedContentType ? {
|
|
84
|
+
'Content-Type': determinedContentType
|
|
52
85
|
} : {},
|
|
53
86
|
method: 'PUT'
|
|
54
87
|
});
|
|
55
88
|
if (response.ok) {
|
|
56
89
|
return; // Success
|
|
57
90
|
}
|
|
58
|
-
lastError = new Error(
|
|
91
|
+
lastError = new Error(await parseS3Error({
|
|
92
|
+
context: `upload ${path.basename(filePath)}`,
|
|
93
|
+
response
|
|
94
|
+
}));
|
|
59
95
|
} catch (error) {
|
|
60
96
|
lastError = error instanceof Error ? error : new Error('Unknown error');
|
|
61
97
|
}
|
|
@@ -83,7 +119,8 @@ const INITIAL_RETRY_DELAY = 1000 // 1 second
|
|
|
83
119
|
* @param assetUrls - Map of asset paths to signed URLs
|
|
84
120
|
* @param onProgress - Optional callback for progress updates (uploaded, total)
|
|
85
121
|
* @returns Upload results with counts
|
|
86
|
-
*/ export async function uploadStaticAssets(
|
|
122
|
+
*/ export async function uploadStaticAssets(params) {
|
|
123
|
+
const { assetUrls, onProgress, pathMap, projectPath } = params;
|
|
87
124
|
const results = {
|
|
88
125
|
assetsFailed: 0,
|
|
89
126
|
assetsUploaded: 0,
|
|
@@ -100,8 +137,8 @@ const INITIAL_RETRY_DELAY = 1000 // 1 second
|
|
|
100
137
|
const batch = assetPaths.slice(i, i + CONCURRENCY);
|
|
101
138
|
await Promise.all(batch.map(async (assetPath)=>{
|
|
102
139
|
try {
|
|
103
|
-
//
|
|
104
|
-
const fsPath = assetPath.replace(/^_next\//, '.next/');
|
|
140
|
+
// Resolve filesystem path: use pathMap if available, else default _next/ → .next/
|
|
141
|
+
const fsPath = pathMap?.[assetPath] ?? assetPath.replace(/^_next\//, '.next/');
|
|
105
142
|
const fullPath = path.join(projectPath, fsPath);
|
|
106
143
|
const signedUrl = assetUrls[assetPath];
|
|
107
144
|
await uploadFile(fullPath, signedUrl);
|
|
@@ -119,5 +156,3 @@ const INITIAL_RETRY_DELAY = 1000 // 1 second
|
|
|
119
156
|
}
|
|
120
157
|
return results;
|
|
121
158
|
}
|
|
122
|
-
|
|
123
|
-
//# sourceMappingURL=s3-upload.js.map
|
|
@@ -8,7 +8,10 @@ export declare function maskToken(token: string): string;
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function formatTimestamp(timestamp: number): string;
|
|
10
10
|
/**
|
|
11
|
-
* Show
|
|
11
|
+
* Show the project token for the current project + environment scope.
|
|
12
|
+
*
|
|
13
|
+
* Resolves `projectId` and `environmentName` from env vars
|
|
14
|
+
* (`FIGMA_PROJECT_ID`, `FIGMA_ENVIRONMENT_NAME`) — the *user's* project
|
|
15
|
+
* environment, which is independent of the infra env (production/staging).
|
|
12
16
|
*/
|
|
13
17
|
export declare function showProjectTokens(tokenStore: TokenStore): void;
|
|
14
|
-
//# sourceMappingURL=token-display.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as p from '@clack/prompts';
|
|
2
2
|
import pc from 'picocolors';
|
|
3
|
+
import { getEnvVarSync } from './env-management.js';
|
|
3
4
|
import { isDebug } from './is-debug.js';
|
|
4
5
|
/**
|
|
5
6
|
* Mask token for display (show first 4 and last 4 characters)
|
|
@@ -32,32 +33,56 @@ import { isDebug } from './is-debug.js';
|
|
|
32
33
|
return pc.red(`${minutes}m`);
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
|
-
* Show
|
|
36
|
+
* Show the project token for the current project + environment scope.
|
|
37
|
+
*
|
|
38
|
+
* Resolves `projectId` and `environmentName` from env vars
|
|
39
|
+
* (`FIGMA_PROJECT_ID`, `FIGMA_ENVIRONMENT_NAME`) — the *user's* project
|
|
40
|
+
* environment, which is independent of the infra env (production/staging).
|
|
36
41
|
*/ export function showProjectTokens(tokenStore) {
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
p.note(
|
|
42
|
+
const cwd = process.cwd();
|
|
43
|
+
const projectId = getEnvVarSync(cwd, 'FIGMA_PROJECT_ID');
|
|
44
|
+
const environmentName = getEnvVarSync(cwd, 'FIGMA_ENVIRONMENT_NAME');
|
|
45
|
+
if (!projectId || !environmentName) {
|
|
46
|
+
p.note(pc.dim('Set FIGMA_PROJECT_ID and FIGMA_ENVIRONMENT_NAME in your .env to view project tokens.'), 'Project Tokens');
|
|
42
47
|
return;
|
|
43
48
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
const header = [
|
|
50
|
+
`Project ID: ${projectId}`,
|
|
51
|
+
`Environment: ${environmentName}`
|
|
52
|
+
];
|
|
53
|
+
const bootstrapData = tokenStore.getBootstrapData(projectId, environmentName);
|
|
54
|
+
if (!bootstrapData) {
|
|
55
|
+
p.note([
|
|
56
|
+
...header,
|
|
57
|
+
pc.dim('No bootstrap data. Run `@payloadcms/figma init` to set up.')
|
|
58
|
+
].join('\n'), 'Project Token');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const projectInfo = {
|
|
62
|
+
environmentName,
|
|
63
|
+
projectId
|
|
64
|
+
};
|
|
65
|
+
const projectToken = tokenStore.getProjectToken({
|
|
66
|
+
projectInfo
|
|
67
|
+
});
|
|
68
|
+
if (!projectToken) {
|
|
69
|
+
p.note([
|
|
70
|
+
...header,
|
|
71
|
+
`Tenant ID: ${bootstrapData.contentSystemId}`,
|
|
72
|
+
pc.dim('No stored token.')
|
|
73
|
+
].join('\n'), 'Project Token');
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const isValid = tokenStore.hasValidProjectToken({
|
|
77
|
+
projectInfo
|
|
59
78
|
});
|
|
60
|
-
|
|
79
|
+
const status = isValid ? pc.green('✓ Valid') : pc.red('✗ Expired');
|
|
80
|
+
const projectTokenLines = [
|
|
81
|
+
...header,
|
|
82
|
+
`Tenant ID: ${bootstrapData.contentSystemId}`,
|
|
83
|
+
`Status: ${status}`,
|
|
84
|
+
`Token: ${isDebug() ? projectToken.token : maskToken(projectToken.token)}`,
|
|
85
|
+
`Expires: ${formatTimestamp(projectToken.expiresAt)}`
|
|
86
|
+
];
|
|
87
|
+
p.note(projectTokenLines.join('\n'), 'Project Token');
|
|
61
88
|
}
|
|
62
|
-
|
|
63
|
-
//# sourceMappingURL=token-display.js.map
|
|
@@ -8,4 +8,3 @@ export type TypeScriptCheckResult = {
|
|
|
8
8
|
* Skips silently if TypeScript not available
|
|
9
9
|
*/
|
|
10
10
|
export declare function runTypeScriptCheck(projectPath: string, packageManager: PackageManager): Promise<TypeScriptCheckResult>;
|
|
11
|
-
//# sourceMappingURL=typescript-validator.d.ts.map
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import spawn from 'cross-spawn';
|
|
2
2
|
/**
|
|
3
3
|
* Run TypeScript type checking (tsc --noEmit)
|
|
4
4
|
* Skips silently if TypeScript not available
|
|
5
5
|
*/ export async function runTypeScriptCheck(projectPath, packageManager) {
|
|
6
6
|
return new Promise((resolve)=>{
|
|
7
7
|
try {
|
|
8
|
-
const
|
|
8
|
+
const child = spawn(packageManager, [
|
|
9
9
|
'exec',
|
|
10
10
|
'tsc',
|
|
11
11
|
'--noEmit'
|
|
12
|
-
]
|
|
13
|
-
const child = spawn(packageManager, args, {
|
|
12
|
+
], {
|
|
14
13
|
cwd: projectPath,
|
|
15
|
-
shell: true,
|
|
16
14
|
stdio: 'pipe'
|
|
17
15
|
});
|
|
18
16
|
let output = '';
|
|
@@ -52,7 +50,5 @@ import { spawn } from 'child_process';
|
|
|
52
50
|
/**
|
|
53
51
|
* Parse TypeScript error output
|
|
54
52
|
*/ function parseTypeScriptErrors(output) {
|
|
55
|
-
return output.split(
|
|
53
|
+
return output.split(/\r?\n/).filter((line)=>line.includes('error TS')).map((line)=>line.trim());
|
|
56
54
|
}
|
|
57
|
-
|
|
58
|
-
//# sourceMappingURL=typescript-validator.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as p from '@clack/prompts';
|
|
2
|
+
import fs from 'fs/promises';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import pc from 'picocolors';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
const REGISTRY_URL = 'https://registry.npmjs.org/@payloadcms/figma';
|
|
7
|
+
const TIMEOUT_MS = 3000;
|
|
8
|
+
export async function checkForUpdates(currentVersion) {
|
|
9
|
+
try {
|
|
10
|
+
const controller = new AbortController();
|
|
11
|
+
const timeoutId = setTimeout(()=>controller.abort(), TIMEOUT_MS);
|
|
12
|
+
const response = await fetch(REGISTRY_URL, {
|
|
13
|
+
signal: controller.signal
|
|
14
|
+
});
|
|
15
|
+
clearTimeout(timeoutId);
|
|
16
|
+
if (!response.ok) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const data = await response.json();
|
|
20
|
+
const latestVersion = data['dist-tags']?.latest;
|
|
21
|
+
if (!latestVersion || latestVersion === currentVersion) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
p.log.warn(pc.yellow(`@payloadcms/figma ${currentVersion} differs from latest. Latest: ${latestVersion}`));
|
|
25
|
+
p.log.message(pc.dim(` Run: npx @payloadcms/figma@${latestVersion} init --id <your-id>`));
|
|
26
|
+
} catch {
|
|
27
|
+
// Silent catch - network errors, timeouts, parse errors should not interrupt CLI
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export async function getOwnVersion() {
|
|
31
|
+
// Test/CI seam: e2e runs scaffold with the CLI's own version, but a locally
|
|
32
|
+
// built (unpublished) version isn't npm-resolvable. Allow overriding with a
|
|
33
|
+
// published version so `init`'s dependency install resolves.
|
|
34
|
+
const override = process.env.FIGMA_CLI_VERSION_OVERRIDE;
|
|
35
|
+
if (override) {
|
|
36
|
+
return override;
|
|
37
|
+
}
|
|
38
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
39
|
+
const packageJsonPath = path.join(__dirname, '../../package.json');
|
|
40
|
+
const content = await fs.readFile(packageJsonPath, 'utf-8');
|
|
41
|
+
const pkg = JSON.parse(content);
|
|
42
|
+
return pkg.version;
|
|
43
|
+
}
|