@payloadcms/figma 0.0.1-alpha.42 → 0.0.1-alpha.6

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.
Files changed (286) hide show
  1. package/dist/api/control-plane.d.ts +1 -22
  2. package/dist/api/control-plane.d.ts.map +1 -1
  3. package/dist/api/control-plane.js +22 -55
  4. package/dist/api/control-plane.js.map +1 -1
  5. package/dist/api/figma-api.d.ts.map +1 -1
  6. package/dist/api/figma-api.js +21 -45
  7. package/dist/api/figma-api.js.map +1 -1
  8. package/dist/auth/callback-server.d.ts.map +1 -1
  9. package/dist/auth/callback-server.js +1 -2
  10. package/dist/auth/callback-server.js.map +1 -1
  11. package/dist/auth/crypto-utils.d.ts.map +1 -1
  12. package/dist/auth/crypto-utils.js +5 -5
  13. package/dist/auth/crypto-utils.js.map +1 -1
  14. package/dist/auth/jwt-validator.d.ts +1 -2
  15. package/dist/auth/jwt-validator.d.ts.map +1 -1
  16. package/dist/auth/jwt-validator.js +2 -2
  17. package/dist/auth/jwt-validator.js.map +1 -1
  18. package/dist/auth/oauth-flow.d.ts +1 -1
  19. package/dist/auth/oauth-flow.d.ts.map +1 -1
  20. package/dist/auth/oauth-flow.js +11 -15
  21. package/dist/auth/oauth-flow.js.map +1 -1
  22. package/dist/auth/project-token.d.ts.map +1 -1
  23. package/dist/auth/project-token.js +4 -9
  24. package/dist/auth/project-token.js.map +1 -1
  25. package/dist/auth/refresh.d.ts +1 -2
  26. package/dist/auth/refresh.d.ts.map +1 -1
  27. package/dist/auth/refresh.js +12 -25
  28. package/dist/auth/refresh.js.map +1 -1
  29. package/dist/auth/token-store.d.ts +0 -12
  30. package/dist/auth/token-store.d.ts.map +1 -1
  31. package/dist/auth/token-store.js +5 -28
  32. package/dist/auth/token-store.js.map +1 -1
  33. package/dist/auth/types.d.ts +4 -7
  34. package/dist/auth/types.d.ts.map +1 -1
  35. package/dist/auth/types.js.map +1 -1
  36. package/dist/cli.d.ts.map +1 -1
  37. package/dist/cli.js +6 -39
  38. package/dist/cli.js.map +1 -1
  39. package/dist/commands/deploy.d.ts +0 -4
  40. package/dist/commands/deploy.d.ts.map +1 -1
  41. package/dist/commands/deploy.js +129 -72
  42. package/dist/commands/deploy.js.map +1 -1
  43. package/dist/commands/init.d.ts +5 -1
  44. package/dist/commands/init.d.ts.map +1 -1
  45. package/dist/commands/init.js +85 -105
  46. package/dist/commands/init.js.map +1 -1
  47. package/dist/commands/list-tokens.d.ts +3 -3
  48. package/dist/commands/list-tokens.d.ts.map +1 -1
  49. package/dist/commands/list-tokens.js +7 -22
  50. package/dist/commands/list-tokens.js.map +1 -1
  51. package/dist/commands/login.d.ts +1 -8
  52. package/dist/commands/login.d.ts.map +1 -1
  53. package/dist/commands/login.js +12 -30
  54. package/dist/commands/login.js.map +1 -1
  55. package/dist/commands/logout.d.ts +4 -5
  56. package/dist/commands/logout.d.ts.map +1 -1
  57. package/dist/commands/logout.js +13 -56
  58. package/dist/commands/logout.js.map +1 -1
  59. package/dist/config/oauth.d.ts +14 -4
  60. package/dist/config/oauth.d.ts.map +1 -1
  61. package/dist/config/oauth.js +40 -19
  62. package/dist/config/oauth.js.map +1 -1
  63. package/dist/constants.d.ts +18 -26
  64. package/dist/constants.d.ts.map +1 -1
  65. package/dist/constants.js +20 -34
  66. package/dist/constants.js.map +1 -1
  67. package/dist/exports/client.d.ts +0 -1
  68. package/dist/exports/client.d.ts.map +1 -1
  69. package/dist/exports/client.js +0 -1
  70. package/dist/exports/client.js.map +1 -1
  71. package/dist/index.d.ts +1 -2
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +1 -3
  74. package/dist/index.js.map +1 -1
  75. package/dist/oauth/components/LoginButton/index.d.ts.map +1 -1
  76. package/dist/oauth/components/LoginButton/index.js +6 -50
  77. package/dist/oauth/components/LoginButton/index.js.map +1 -1
  78. package/dist/oauth/components/LoginButton/index.scss +3 -50
  79. package/dist/oauth/components/LogoutButton/index.d.ts.map +1 -1
  80. package/dist/oauth/components/LogoutButton/index.js +4 -5
  81. package/dist/oauth/components/LogoutButton/index.js.map +1 -1
  82. package/dist/oauth/defaults.d.ts.map +1 -1
  83. package/dist/oauth/defaults.js +5 -29
  84. package/dist/oauth/defaults.js.map +1 -1
  85. package/dist/oauth/endpoints/getLoginEndpoint.d.ts.map +1 -1
  86. package/dist/oauth/endpoints/getLoginEndpoint.js +11 -21
  87. package/dist/oauth/endpoints/getLoginEndpoint.js.map +1 -1
  88. package/dist/oauth/endpoints/getLogoutEndpoint.d.ts.map +1 -1
  89. package/dist/oauth/endpoints/getLogoutEndpoint.js +4 -7
  90. package/dist/oauth/endpoints/getLogoutEndpoint.js.map +1 -1
  91. package/dist/oauth/index.d.ts.map +1 -1
  92. package/dist/oauth/index.js +13 -40
  93. package/dist/oauth/index.js.map +1 -1
  94. package/dist/oauth/strategy/index.d.ts +2 -0
  95. package/dist/oauth/strategy/index.d.ts.map +1 -1
  96. package/dist/oauth/strategy/index.js +15 -38
  97. package/dist/oauth/strategy/index.js.map +1 -1
  98. package/dist/oauth/types.d.ts +6 -6
  99. package/dist/oauth/types.d.ts.map +1 -1
  100. package/dist/oauth/types.js.map +1 -1
  101. package/dist/oauth/utilities/createCookieOptions.d.ts.map +1 -1
  102. package/dist/oauth/utilities/createCookieOptions.js.map +1 -1
  103. package/dist/oauth/utilities/getAdminPath.d.ts +8 -0
  104. package/dist/oauth/utilities/getAdminPath.d.ts.map +1 -0
  105. package/dist/oauth/utilities/getAdminPath.js +9 -0
  106. package/dist/oauth/utilities/getAdminPath.js.map +1 -0
  107. package/dist/oauth/utilities/refreshTokens.d.ts.map +1 -1
  108. package/dist/oauth/utilities/refreshTokens.js +1 -1
  109. package/dist/oauth/utilities/refreshTokens.js.map +1 -1
  110. package/dist/plugin/build-config.d.ts +4 -21
  111. package/dist/plugin/build-config.d.ts.map +1 -1
  112. package/dist/plugin/build-config.js +7 -113
  113. package/dist/plugin/build-config.js.map +1 -1
  114. package/dist/types.d.ts +0 -1
  115. package/dist/types.d.ts.map +1 -1
  116. package/dist/types.js.map +1 -1
  117. package/dist/utils/asset-collection.d.ts +6 -3
  118. package/dist/utils/asset-collection.d.ts.map +1 -1
  119. package/dist/utils/asset-collection.js +34 -10
  120. package/dist/utils/asset-collection.js.map +1 -1
  121. package/dist/utils/config.js +1 -1
  122. package/dist/utils/config.js.map +1 -1
  123. package/dist/utils/env-management.d.ts +8 -9
  124. package/dist/utils/env-management.d.ts.map +1 -1
  125. package/dist/utils/env-management.js +74 -73
  126. package/dist/utils/env-management.js.map +1 -1
  127. package/dist/utils/formatter.d.ts.map +1 -1
  128. package/dist/utils/formatter.js +5 -3
  129. package/dist/utils/formatter.js.map +1 -1
  130. package/dist/utils/lambda-config.d.ts +1 -3
  131. package/dist/utils/lambda-config.d.ts.map +1 -1
  132. package/dist/utils/lambda-config.js +32 -38
  133. package/dist/utils/lambda-config.js.map +1 -1
  134. package/dist/utils/messages.js +8 -8
  135. package/dist/utils/messages.js.map +1 -1
  136. package/dist/utils/payload-config-ast.d.ts +3 -22
  137. package/dist/utils/payload-config-ast.d.ts.map +1 -1
  138. package/dist/utils/payload-config-ast.js +31 -89
  139. package/dist/utils/payload-config-ast.js.map +1 -1
  140. package/dist/utils/payload-config-finder.d.ts +2 -2
  141. package/dist/utils/payload-config-finder.d.ts.map +1 -1
  142. package/dist/utils/payload-config-finder.js +9 -48
  143. package/dist/utils/payload-config-finder.js.map +1 -1
  144. package/dist/utils/payload-config-modifier.d.ts.map +1 -1
  145. package/dist/utils/payload-config-modifier.js +6 -54
  146. package/dist/utils/payload-config-modifier.js.map +1 -1
  147. package/dist/utils/payload-package-check.d.ts +1 -12
  148. package/dist/utils/payload-package-check.d.ts.map +1 -1
  149. package/dist/utils/payload-package-check.js +5 -63
  150. package/dist/utils/payload-package-check.js.map +1 -1
  151. package/dist/utils/project.d.ts.map +1 -1
  152. package/dist/utils/project.js +5 -8
  153. package/dist/utils/project.js.map +1 -1
  154. package/dist/utils/s3-upload.d.ts +1 -0
  155. package/dist/utils/s3-upload.d.ts.map +1 -1
  156. package/dist/utils/s3-upload.js +3 -10
  157. package/dist/utils/s3-upload.js.map +1 -1
  158. package/dist/utils/token-display.d.ts.map +1 -1
  159. package/dist/utils/token-display.js +5 -11
  160. package/dist/utils/token-display.js.map +1 -1
  161. package/dist/utils/typescript-validator.d.ts.map +1 -1
  162. package/dist/utils/typescript-validator.js +6 -4
  163. package/dist/utils/typescript-validator.js.map +1 -1
  164. package/package.json +9 -27
  165. package/dist/commands/build-lambda-zip.d.ts +0 -5
  166. package/dist/commands/build-lambda-zip.d.ts.map +0 -1
  167. package/dist/commands/build-lambda-zip.js +0 -19
  168. package/dist/commands/build-lambda-zip.js.map +0 -1
  169. package/dist/db-content-api/README.md +0 -98
  170. package/dist/db-content-api/generated/content-api-types.d.ts +0 -3914
  171. package/dist/db-content-api/generated/content-api-types.d.ts.map +0 -1
  172. package/dist/db-content-api/generated/content-api-types.js +0 -7
  173. package/dist/db-content-api/generated/content-api-types.js.map +0 -1
  174. package/dist/db-content-api/index.d.ts +0 -18
  175. package/dist/db-content-api/index.d.ts.map +0 -1
  176. package/dist/db-content-api/index.js +0 -586
  177. package/dist/db-content-api/index.js.map +0 -1
  178. package/dist/db-content-api/temp-utilities/slug.d.ts +0 -2
  179. package/dist/db-content-api/temp-utilities/slug.d.ts.map +0 -1
  180. package/dist/db-content-api/temp-utilities/slug.js +0 -3
  181. package/dist/db-content-api/temp-utilities/slug.js.map +0 -1
  182. package/dist/db-content-api/temp-utilities/sorting.d.ts +0 -3
  183. package/dist/db-content-api/temp-utilities/sorting.d.ts.map +0 -1
  184. package/dist/db-content-api/temp-utilities/sorting.js +0 -32
  185. package/dist/db-content-api/temp-utilities/sorting.js.map +0 -1
  186. package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +0 -34
  187. package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts.map +0 -1
  188. package/dist/db-content-api/temp-utilities/unwrapDocument.js +0 -53
  189. package/dist/db-content-api/temp-utilities/unwrapDocument.js.map +0 -1
  190. package/dist/db-content-api/utilities/auth.d.ts +0 -30
  191. package/dist/db-content-api/utilities/auth.d.ts.map +0 -1
  192. package/dist/db-content-api/utilities/auth.js +0 -81
  193. package/dist/db-content-api/utilities/auth.js.map +0 -1
  194. package/dist/db-content-api/utilities/buildPathTypes.d.ts +0 -12
  195. package/dist/db-content-api/utilities/buildPathTypes.d.ts.map +0 -1
  196. package/dist/db-content-api/utilities/buildPathTypes.js +0 -157
  197. package/dist/db-content-api/utilities/buildPathTypes.js.map +0 -1
  198. package/dist/db-content-api/utilities/data/applyDefaults.d.ts +0 -7
  199. package/dist/db-content-api/utilities/data/applyDefaults.d.ts.map +0 -1
  200. package/dist/db-content-api/utilities/data/applyDefaults.js +0 -59
  201. package/dist/db-content-api/utilities/data/applyDefaults.js.map +0 -1
  202. package/dist/db-content-api/utilities/data/castFieldValue.d.ts +0 -11
  203. package/dist/db-content-api/utilities/data/castFieldValue.d.ts.map +0 -1
  204. package/dist/db-content-api/utilities/data/castFieldValue.js +0 -66
  205. package/dist/db-content-api/utilities/data/castFieldValue.js.map +0 -1
  206. package/dist/db-content-api/utilities/data/index.d.ts +0 -32
  207. package/dist/db-content-api/utilities/data/index.d.ts.map +0 -1
  208. package/dist/db-content-api/utilities/data/index.js +0 -190
  209. package/dist/db-content-api/utilities/data/index.js.map +0 -1
  210. package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +0 -12
  211. package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts.map +0 -1
  212. package/dist/db-content-api/utilities/data/removeVirtualFields.js +0 -54
  213. package/dist/db-content-api/utilities/data/removeVirtualFields.js.map +0 -1
  214. package/dist/db-content-api/utilities/data/stripFields.d.ts +0 -48
  215. package/dist/db-content-api/utilities/data/stripFields.d.ts.map +0 -1
  216. package/dist/db-content-api/utilities/data/stripFields.js +0 -195
  217. package/dist/db-content-api/utilities/data/stripFields.js.map +0 -1
  218. package/dist/db-content-api/utilities/joins.d.ts +0 -55
  219. package/dist/db-content-api/utilities/joins.d.ts.map +0 -1
  220. package/dist/db-content-api/utilities/joins.js +0 -136
  221. package/dist/db-content-api/utilities/joins.js.map +0 -1
  222. package/dist/db-content-api/utilities/where.d.ts +0 -12
  223. package/dist/db-content-api/utilities/where.d.ts.map +0 -1
  224. package/dist/db-content-api/utilities/where.js +0 -121
  225. package/dist/db-content-api/utilities/where.js.map +0 -1
  226. package/dist/endpoints/health.d.ts +0 -3
  227. package/dist/endpoints/health.d.ts.map +0 -1
  228. package/dist/endpoints/health.js +0 -11
  229. package/dist/endpoints/health.js.map +0 -1
  230. package/dist/oauth/utilities/isDuplicateKeyError.d.ts +0 -7
  231. package/dist/oauth/utilities/isDuplicateKeyError.d.ts.map +0 -1
  232. package/dist/oauth/utilities/isDuplicateKeyError.js +0 -14
  233. package/dist/oauth/utilities/isDuplicateKeyError.js.map +0 -1
  234. package/dist/storage-content-api/api-types.d.ts +0 -168
  235. package/dist/storage-content-api/api-types.d.ts.map +0 -1
  236. package/dist/storage-content-api/api-types.js +0 -6
  237. package/dist/storage-content-api/api-types.js.map +0 -1
  238. package/dist/storage-content-api/client-uploads/ClientUploadHandler.d.ts +0 -9
  239. package/dist/storage-content-api/client-uploads/ClientUploadHandler.d.ts.map +0 -1
  240. package/dist/storage-content-api/client-uploads/ClientUploadHandler.js +0 -42
  241. package/dist/storage-content-api/client-uploads/ClientUploadHandler.js.map +0 -1
  242. package/dist/storage-content-api/client-uploads/generateSignedURL.d.ts +0 -13
  243. package/dist/storage-content-api/client-uploads/generateSignedURL.d.ts.map +0 -1
  244. package/dist/storage-content-api/client-uploads/generateSignedURL.js +0 -32
  245. package/dist/storage-content-api/client-uploads/generateSignedURL.js.map +0 -1
  246. package/dist/storage-content-api/client.d.ts +0 -6
  247. package/dist/storage-content-api/client.d.ts.map +0 -1
  248. package/dist/storage-content-api/client.js +0 -36
  249. package/dist/storage-content-api/client.js.map +0 -1
  250. package/dist/storage-content-api/generateURL.d.ts +0 -7
  251. package/dist/storage-content-api/generateURL.d.ts.map +0 -1
  252. package/dist/storage-content-api/generateURL.js +0 -8
  253. package/dist/storage-content-api/generateURL.js.map +0 -1
  254. package/dist/storage-content-api/handleDelete.d.ts +0 -8
  255. package/dist/storage-content-api/handleDelete.d.ts.map +0 -1
  256. package/dist/storage-content-api/handleDelete.js +0 -17
  257. package/dist/storage-content-api/handleDelete.js.map +0 -1
  258. package/dist/storage-content-api/handleUpload.d.ts +0 -11
  259. package/dist/storage-content-api/handleUpload.d.ts.map +0 -1
  260. package/dist/storage-content-api/handleUpload.js +0 -144
  261. package/dist/storage-content-api/handleUpload.js.map +0 -1
  262. package/dist/storage-content-api/index.d.ts +0 -5
  263. package/dist/storage-content-api/index.d.ts.map +0 -1
  264. package/dist/storage-content-api/index.js +0 -31
  265. package/dist/storage-content-api/index.js.map +0 -1
  266. package/dist/storage-content-api/staticHandler.d.ts +0 -10
  267. package/dist/storage-content-api/staticHandler.d.ts.map +0 -1
  268. package/dist/storage-content-api/staticHandler.js +0 -56
  269. package/dist/storage-content-api/staticHandler.js.map +0 -1
  270. package/dist/storage-content-api/types.d.ts +0 -10
  271. package/dist/storage-content-api/types.d.ts.map +0 -1
  272. package/dist/storage-content-api/types.js +0 -3
  273. package/dist/storage-content-api/types.js.map +0 -1
  274. package/dist/templates/README.md +0 -19
  275. package/dist/utils/build-lambda-zip.d.ts +0 -14
  276. package/dist/utils/build-lambda-zip.d.ts.map +0 -1
  277. package/dist/utils/build-lambda-zip.js +0 -81
  278. package/dist/utils/build-lambda-zip.js.map +0 -1
  279. package/dist/utils/format-env-suffix.d.ts +0 -12
  280. package/dist/utils/format-env-suffix.d.ts.map +0 -1
  281. package/dist/utils/format-env-suffix.js +0 -13
  282. package/dist/utils/format-env-suffix.js.map +0 -1
  283. package/dist/utils/version-check.d.ts +0 -3
  284. package/dist/utils/version-check.d.ts.map +0 -1
  285. package/dist/utils/version-check.js +0 -38
  286. package/dist/utils/version-check.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/storage-content-api/handleUpload.ts"],"sourcesContent":["import type { HandleUpload } from '@payloadcms/plugin-cloud-storage/types'\nimport type { CollectionConfig } from 'payload'\n\nimport fs from 'fs'\nimport path from 'path'\n\nimport type { StorageClient } from './client.js'\n\ntype Args = {\n client: StorageClient\n collection: CollectionConfig\n prefix?: string\n}\n\nconst PART_SIZE = 64 * 1024 * 1024 // 64MB per part\nconst MAX_FILE_SIZE_BEFORE_MULTIPART = 100 * 1024 * 1024 // 100MB\n\nexport const getHandleUpload = ({ client, collection, prefix = '' }: Args): HandleUpload => {\n return async ({ clientUploadContext, data, file }) => {\n // Skip if client already uploaded THIS SPECIFIC file\n // clientUploadContext.filename contains the original filename that was client-uploaded\n // Resized versions (different filename) should still be uploaded\n const clientUploadedFilename =\n clientUploadContext &&\n typeof clientUploadContext === 'object' &&\n 'filename' in clientUploadContext\n ? clientUploadContext.filename\n : undefined\n\n const isOriginalClientUploaded =\n clientUploadContext &&\n typeof clientUploadContext === 'object' &&\n 'clientUploaded' in clientUploadContext &&\n clientUploadContext.clientUploaded &&\n file.filename === clientUploadedFilename\n\n if (isOriginalClientUploaded) {\n return data\n }\n\n const collectionId = collection.slug\n const fileKey = path.posix.join(data.prefix || prefix, file.filename)\n const fileData = file.tempFilePath ? fs.readFileSync(file.tempFilePath) : file.buffer\n const fileSize = file.filesize || fileData.length\n\n if (fileSize > MAX_FILE_SIZE_BEFORE_MULTIPART) {\n await uploadMultipart({ client, collectionId, fileData, fileKey, mimeType: file.mimeType })\n } else {\n await uploadSingleFile({ client, collectionId, fileData, fileKey, mimeType: file.mimeType })\n }\n\n return data\n }\n}\n\nasync function uploadSingleFile({\n client,\n collectionId,\n fileData,\n fileKey,\n mimeType,\n}: {\n client: StorageClient\n collectionId: string\n fileData: Buffer\n fileKey: string\n mimeType: string\n}): Promise<void> {\n const { data, error } = await client.POST('/api/v0/uploads/sign', {\n body: { collectionId, contentType: mimeType, expiresIn: 3600, filename: fileKey },\n })\n\n if (error || !data) {\n throw new Error(`Failed to get presigned upload URL: ${JSON.stringify(error)}`)\n }\n\n const uploadResponse = await fetch(data.url, {\n body: fileData,\n headers: { 'Content-Type': mimeType },\n method: 'PUT',\n })\n\n if (!uploadResponse.ok) {\n throw new Error(`Failed to upload to S3: ${uploadResponse.status} ${uploadResponse.statusText}`)\n }\n}\n\nasync function uploadMultipart({\n client,\n collectionId,\n fileData,\n fileKey,\n mimeType,\n}: {\n client: StorageClient\n collectionId: string\n fileData: Buffer\n fileKey: string\n mimeType: string\n}): Promise<void> {\n const { data: initiateData, error: initiateError } = await client.POST(\n '/api/v0/uploads/multipart/initiate',\n {\n body: { collectionId, contentType: mimeType, filename: fileKey },\n },\n )\n\n if (initiateError || !initiateData) {\n throw new Error(`Failed to initiate multipart upload: ${JSON.stringify(initiateError)}`)\n }\n\n const { uploadId } = initiateData\n\n try {\n const numParts = Math.ceil(fileData.length / PART_SIZE)\n const partNumbers = Array.from({ length: numParts }, (_, i) => i + 1)\n\n const { data: partsData, error: partsError } = await client.POST(\n '/api/v0/uploads/multipart/parts',\n {\n body: { collectionId, expiresIn: 3600, filename: fileKey, partNumbers, uploadId },\n },\n )\n\n if (partsError || !partsData) {\n throw new Error(`Failed to get part URLs: ${JSON.stringify(partsError)}`)\n }\n\n const { parts } = partsData\n\n if (!parts || !Array.isArray(parts)) {\n throw new Error('Invalid response from part URLs endpoint: parts is not an array')\n }\n\n const uploadedParts = await Promise.all(\n parts.map(async ({ partNumber, url }) => {\n const start = (partNumber - 1) * PART_SIZE\n const end = Math.min(start + PART_SIZE, fileData.length)\n const partData = fileData.slice(start, end)\n\n const uploadResponse = await fetch(url, {\n body: partData,\n headers: { 'Content-Type': mimeType },\n method: 'PUT',\n })\n\n const etag = uploadResponse.headers.get('ETag')\n if (!etag) {\n throw new Error(`No ETag returned for part ${partNumber}`)\n }\n\n return { ETag: etag, PartNumber: partNumber }\n }),\n )\n\n const { error: completeError } = await client.POST('/api/v0/uploads/multipart/complete', {\n body: { collectionId, filename: fileKey, parts: uploadedParts, uploadId },\n })\n\n if (completeError) {\n throw new Error(`Failed to complete multipart upload: ${JSON.stringify(completeError)}`)\n }\n } catch (error) {\n try {\n await client.POST('/api/v0/uploads/multipart/abort', {\n body: { collectionId, filename: fileKey, uploadId },\n })\n } catch {\n // Ignore abort errors\n }\n throw error\n }\n}\n"],"names":["fs","path","PART_SIZE","MAX_FILE_SIZE_BEFORE_MULTIPART","getHandleUpload","client","collection","prefix","clientUploadContext","data","file","clientUploadedFilename","filename","undefined","isOriginalClientUploaded","clientUploaded","collectionId","slug","fileKey","posix","join","fileData","tempFilePath","readFileSync","buffer","fileSize","filesize","length","uploadMultipart","mimeType","uploadSingleFile","error","POST","body","contentType","expiresIn","Error","JSON","stringify","uploadResponse","fetch","url","headers","method","ok","status","statusText","initiateData","initiateError","uploadId","numParts","Math","ceil","partNumbers","Array","from","_","i","partsData","partsError","parts","isArray","uploadedParts","Promise","all","map","partNumber","start","end","min","partData","slice","etag","get","ETag","PartNumber","completeError"],"mappings":"AAGA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AAUvB,MAAMC,YAAY,KAAK,OAAO,KAAK,gBAAgB;;AACnD,MAAMC,iCAAiC,MAAM,OAAO,KAAK,QAAQ;;AAEjE,OAAO,MAAMC,kBAAkB,CAAC,EAAEC,MAAM,EAAEC,UAAU,EAAEC,SAAS,EAAE,EAAQ;IACvE,OAAO,OAAO,EAAEC,mBAAmB,EAAEC,IAAI,EAAEC,IAAI,EAAE;QAC/C,qDAAqD;QACrD,uFAAuF;QACvF,iEAAiE;QACjE,MAAMC,yBACJH,uBACA,OAAOA,wBAAwB,YAC/B,cAAcA,sBACVA,oBAAoBI,QAAQ,GAC5BC;QAEN,MAAMC,2BACJN,uBACA,OAAOA,wBAAwB,YAC/B,oBAAoBA,uBACpBA,oBAAoBO,cAAc,IAClCL,KAAKE,QAAQ,KAAKD;QAEpB,IAAIG,0BA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E,WAAWmB,SAASM,MAAM;YACvD,MAAM2C,WAAWjD,SAASkD,KAAK,CAACJ,OAAOC;YAEvC,MAAM7B,iBAAiB,MAAMC,MAAMC,KAAK;gBACtCR,MAAMqC;gBACN5B,SAAS;oBAAE,gBAAgBb;gBAAS;gBACpCc,QAAQ;YACV;YAEA,MAAM6B,OAAOjC,eAAeG,OAAO,CAAC+B,GAAG,CAAC;YACxC,IAAI,CAACD,MAAM;gBACT,MAAM,IAAIpC,MAAM,CAAC,0BAA0B,EAAE8B,YAAY;YAC3D;YAEA,OAAO;gBAAEQ,MAAMF;gBAAMG,YAAYT;YAAW;QAC9C;QAGF,MAAM,EAAEnC,OAAO6C,aAAa,EAAE,GAAG,MAAMvE,OAAO2B,IAAI,CAAC,sCAAsC;YACvFC,MAAM;gBAAEjB;gBAAcJ,UAAUM;gBAAS0C,OAAOE;gBAAeb;YAAS;QAC1E;QAEA,IAAI2B,eAAe;YACjB,MAAM,IAAIxC,MAAM,CAAC,qCAAqC,EAAEC,KAAKC,SAAS,CAACsC,gBAAgB;QACzF;IACF,EAAE,OAAO7C,OAAO;QACd,IAAI;YACF,MAAM1B,OAAO2B,IAAI,CAAC,mCAAmC;gBACnDC,MAAM;oBAAEjB;oBAAcJ,UAAUM;oBAAS+B;gBAAS;YACpD;QACF,EAAE,OAAM;QACN,sBAAsB;QACxB;QACA,MAAMlB;IACR;AACF"}
@@ -1,5 +0,0 @@
1
- import type { Adapter } from '@payloadcms/plugin-cloud-storage/types';
2
- import type { StorageClientConfig } from './types.js';
3
- export type { StorageClientConfig } from './types.js';
4
- export declare function contentApiStorageAdapter(config: StorageClientConfig): Adapter;
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage-content-api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAoB,MAAM,wCAAwC,CAAA;AAEvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAQrD,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAa7E"}
@@ -1,31 +0,0 @@
1
- import { createStorageClient } from './client.js';
2
- import { getGenerateURL } from './generateURL.js';
3
- import { getHandleDelete } from './handleDelete.js';
4
- import { getHandleUpload } from './handleUpload.js';
5
- import { getHandler } from './staticHandler.js';
6
- export function contentApiStorageAdapter(config) {
7
- return ({ collection, prefix })=>{
8
- const client = createStorageClient(config);
9
- const baseUrl = config.baseUrl;
10
- return {
11
- name: 'content-api',
12
- generateURL: getGenerateURL({
13
- baseUrl
14
- }),
15
- handleDelete: getHandleDelete({
16
- client
17
- }),
18
- handleUpload: getHandleUpload({
19
- client,
20
- collection,
21
- prefix
22
- }),
23
- staticHandler: getHandler({
24
- client,
25
- collection
26
- })
27
- };
28
- };
29
- }
30
-
31
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/storage-content-api/index.ts"],"sourcesContent":["import type { Adapter, GeneratedAdapter } from '@payloadcms/plugin-cloud-storage/types'\n\nimport type { StorageClientConfig } from './types.js'\n\nimport { createStorageClient } from './client.js'\nimport { getGenerateURL } from './generateURL.js'\nimport { getHandleDelete } from './handleDelete.js'\nimport { getHandleUpload } from './handleUpload.js'\nimport { getHandler } from './staticHandler.js'\n\nexport type { StorageClientConfig } from './types.js'\n\nexport function contentApiStorageAdapter(config: StorageClientConfig): Adapter {\n return ({ collection, prefix }): GeneratedAdapter => {\n const client = createStorageClient(config)\n const baseUrl = config.baseUrl\n\n return {\n name: 'content-api',\n generateURL: getGenerateURL({ baseUrl }),\n handleDelete: getHandleDelete({ client }),\n handleUpload: getHandleUpload({ client, collection, prefix }),\n staticHandler: getHandler({ client, collection }),\n }\n }\n}\n"],"names":["createStorageClient","getGenerateURL","getHandleDelete","getHandleUpload","getHandler","contentApiStorageAdapter","config","collection","prefix","client","baseUrl","name","generateURL","handleDelete","handleUpload","staticHandler"],"mappings":"AAIA,SAASA,mBAAmB,QAAQ,cAAa;AACjD,SAASC,cAAc,QAAQ,mBAAkB;AACjD,SAASC,eAAe,QAAQ,oBAAmB;AACnD,SAASC,eAAe,QAAQ,oBAAmB;AACnD,SAASC,UAAU,QAAQ,qBAAoB;AAI/C,OAAO,SAASC,yBAAyBC,MAA2B;IAClE,OAAO,CAAC,EAAEC,UAAU,EAAEC,MAAM,EAAE;QAC5B,MAAMC,SAAST,oBAAoBM;QACnC,MAAMI,UAAUJ,OAAOI,OAAO;QAE9B,OAAO;YACLC,MAAM;YACNC,aAAaX,eAAe;gBAAES;YAAQ;YACtCG,cAAcX,gBAAgB;gBAAEO;YAAO;YACvCK,cAAcX,gBAAgB;gBAAEM;gBAAQF;gBAAYC;YAAO;YAC3DO,eAAeX,WAAW;gBAAEK;gBAAQF;YAAW;QACjD;IACF;AACF"}
@@ -1,10 +0,0 @@
1
- import type { StaticHandler } from '@payloadcms/plugin-cloud-storage/types';
2
- import type { CollectionConfig } from 'payload';
3
- import type { StorageClient } from './client.js';
4
- type Args = {
5
- client: StorageClient;
6
- collection: CollectionConfig;
7
- };
8
- export declare const getHandler: ({ client, collection }: Args) => StaticHandler;
9
- export {};
10
- //# sourceMappingURL=staticHandler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"staticHandler.d.ts","sourceRoot":"","sources":["../../src/storage-content-api/staticHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAK/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,KAAK,IAAI,GAAG;IACV,MAAM,EAAE,aAAa,CAAA;IACrB,UAAU,EAAE,gBAAgB,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,UAAU,2BAA4B,IAAI,KAAG,aAuCzD,CAAA"}
@@ -1,56 +0,0 @@
1
- import { getFilePrefix } from '@payloadcms/plugin-cloud-storage/utilities';
2
- import path from 'path';
3
- export const getHandler = ({ client, collection })=>{
4
- return async (req, { params: { clientUploadContext, filename } })=>{
5
- try {
6
- const prefix = await getFilePrefix({
7
- clientUploadContext,
8
- collection,
9
- filename,
10
- req
11
- });
12
- const key = path.posix.join(prefix, filename);
13
- const { data, error } = await client.POST('/api/v0/uploads/download/sign', {
14
- body: {
15
- collectionId: collection.slug,
16
- expiresIn: 7200,
17
- filename: key
18
- }
19
- });
20
- if (error || !data) {
21
- req.payload.logger.error(`Failed to get signed download URL: ${JSON.stringify(error)}`);
22
- return new Response('Internal Server Error', {
23
- status: 500
24
- });
25
- }
26
- // Fetch file bytes from S3 (required for Payload's image processing)
27
- const fileResponse = await fetch(data.url);
28
- if (!fileResponse.ok) {
29
- req.payload.logger.error(`S3 fetch failed: ${fileResponse.status} ${fileResponse.statusText}`);
30
- return new Response('Failed to fetch file from storage', {
31
- status: 502
32
- });
33
- }
34
- const contentType = fileResponse.headers.get('content-type') || 'application/octet-stream';
35
- const contentLength = fileResponse.headers.get('content-length');
36
- return new Response(fileResponse.body, {
37
- headers: {
38
- 'Content-Type': contentType,
39
- ...contentLength && {
40
- 'Content-Length': contentLength
41
- }
42
- }
43
- });
44
- } catch (err) {
45
- req.payload.logger.error({
46
- err,
47
- msg: 'Error in staticHandler'
48
- });
49
- return new Response('Internal Server Error', {
50
- status: 500
51
- });
52
- }
53
- };
54
- };
55
-
56
- //# sourceMappingURL=staticHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/storage-content-api/staticHandler.ts"],"sourcesContent":["import type { StaticHandler } from '@payloadcms/plugin-cloud-storage/types'\nimport type { CollectionConfig } from 'payload'\n\nimport { getFilePrefix } from '@payloadcms/plugin-cloud-storage/utilities'\nimport path from 'path'\n\nimport type { StorageClient } from './client.js'\n\ntype Args = {\n client: StorageClient\n collection: CollectionConfig\n}\n\nexport const getHandler = ({ client, collection }: Args): StaticHandler => {\n return async (req, { params: { clientUploadContext, filename } }) => {\n try {\n const prefix = await getFilePrefix({ clientUploadContext, collection, filename, req })\n const key = path.posix.join(prefix, filename)\n\n const { data, error } = await client.POST('/api/v0/uploads/download/sign', {\n body: { collectionId: collection.slug, expiresIn: 7200, filename: key },\n })\n\n if (error || !data) {\n req.payload.logger.error(`Failed to get signed download URL: ${JSON.stringify(error)}`)\n return new Response('Internal Server Error', { status: 500 })\n }\n\n // Fetch file bytes from S3 (required for Payload's image processing)\n const fileResponse = await fetch(data.url)\n\n if (!fileResponse.ok) {\n req.payload.logger.error(\n `S3 fetch failed: ${fileResponse.status} ${fileResponse.statusText}`,\n )\n return new Response('Failed to fetch file from storage', { status: 502 })\n }\n\n const contentType = fileResponse.headers.get('content-type') || 'application/octet-stream'\n const contentLength = fileResponse.headers.get('content-length')\n\n return new Response(fileResponse.body, {\n headers: {\n 'Content-Type': contentType,\n ...(contentLength && { 'Content-Length': contentLength }),\n },\n })\n } catch (err) {\n req.payload.logger.error({ err, msg: 'Error in staticHandler' })\n return new Response('Internal Server Error', { status: 500 })\n }\n }\n}\n"],"names":["getFilePrefix","path","getHandler","client","collection","req","params","clientUploadContext","filename","prefix","key","posix","join","data","error","POST","body","collectionId","slug","expiresIn","payload","logger","JSON","stringify","Response","status","fileResponse","fetch","url","ok","statusText","contentType","headers","get","contentLength","err","msg"],"mappings":"AAGA,SAASA,aAAa,QAAQ,6CAA4C;AAC1E,OAAOC,UAAU,OAAM;AASvB,OAAO,MAAMC,aAAa,CAAC,EAAEC,MAAM,EAAEC,UAAU,EAAQ;IACrD,OAAO,OAAOC,KAAK,EAAEC,QAAQ,EAAEC,mBAAmB,EAAEC,QAAQ,EAAE,EAAE;QAC9D,IAAI;YACF,MAAMC,SAAS,MAAMT,cAAc;gBAAEO;gBAAqBH;gBAAYI;gBAAUH;YAAI;YACpF,MAAMK,MAAMT,KAAKU,KAAK,CAAC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string;
5
- contentSystemId: string;
6
- } | {
7
- baseUrl: string;
8
- contentApiKey: string;
9
- };
10
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/storage-content-api/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAA;AAEnE,MAAM,MAAM,mBAAmB,GAC3B;IACE,IAAI,EAAE,QAAQ,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,MAAM,CAAA;CACxB,GACD;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAA"}
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/storage-content-api/types.ts"],"sourcesContent":["import type { AuthMode } from '../db-content-api/utilities/auth.js'\n\nexport type StorageClientConfig =\n | {\n auth: AuthMode\n baseUrl: string\n contentSystemId: string\n }\n | { baseUrl: string; contentApiKey: string }\n"],"names":[],"mappings":"AAEA,WAM8C"}
@@ -1,19 +0,0 @@
1
- # {{PROJECT_NAME}}
2
-
3
- A Payload project configured for running on Figma infrastructure.
4
-
5
- ## Getting Started
6
-
7
- pnpm dev
8
-
9
- Open http://localhost:3000/admin to access the admin panel.
10
-
11
- ## Deployment
12
-
13
- npx @payloadcms/figma deploy
14
-
15
- Deploys to Figma infrastructure.
16
-
17
- ## Resources
18
-
19
- - [Payload Docs](https://payloadcms.com/docs)
@@ -1,14 +0,0 @@
1
- /**
2
- * Build Lambda deployment zip using pure Node.js
3
- *
4
- * Cross-platform replacement for build_for_lambda.sh:
5
- * 1. Copies .next/static to .next/standalone/.next/static
6
- * 2. Copies run.sh to .next/standalone/run.sh
7
- * 3. Copies public/ to .next/standalone/public/ (if exists)
8
- * 4. Creates lambda.zip from .next/standalone/
9
- *
10
- * @param projectPath - Path to project root
11
- * @throws Error if standalone directory missing or zip creation fails
12
- */
13
- export declare function buildLambdaZip(projectPath: string): Promise<void>;
14
- //# sourceMappingURL=build-lambda-zip.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-lambda-zip.d.ts","sourceRoot":"","sources":["../../src/utils/build-lambda-zip.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BvE"}
@@ -1,81 +0,0 @@
1
- import archiver from 'archiver';
2
- import { createWriteStream } from 'fs';
3
- import fs from 'fs/promises';
4
- import path from 'path';
5
- /**
6
- * Build Lambda deployment zip using pure Node.js
7
- *
8
- * Cross-platform replacement for build_for_lambda.sh:
9
- * 1. Copies .next/static to .next/standalone/.next/static
10
- * 2. Copies run.sh to .next/standalone/run.sh
11
- * 3. Copies public/ to .next/standalone/public/ (if exists)
12
- * 4. Creates lambda.zip from .next/standalone/
13
- *
14
- * @param projectPath - Path to project root
15
- * @throws Error if standalone directory missing or zip creation fails
16
- */ export async function buildLambdaZip(projectPath) {
17
- const standalonePath = path.join(projectPath, '.next', 'standalone');
18
- const staticPath = path.join(projectPath, '.next', 'static');
19
- const publicPath = path.join(projectPath, 'public');
20
- const runShPath = path.join(projectPath, 'run.sh');
21
- const zipPath = path.join(projectPath, 'lambda.zip');
22
- if (!await isDirectory(standalonePath)) {
23
- throw new Error('Standalone build not found at .next/standalone. ' + 'Ensure next.config.js has output: "standalone" and run build first.');
24
- }
25
- if (await isDirectory(staticPath)) {
26
- const destStatic = path.join(standalonePath, '.next', 'static');
27
- await copyDirectory(staticPath, destStatic);
28
- }
29
- try {
30
- await fs.copyFile(runShPath, path.join(standalonePath, 'run.sh'));
31
- } catch {
32
- // run.sh may not exist in all setups
33
- }
34
- if (await isDirectory(publicPath)) {
35
- const destPublic = path.join(standalonePath, 'public');
36
- await copyDirectory(publicPath, destPublic);
37
- }
38
- await createZip(standalonePath, zipPath);
39
- }
40
- async function isDirectory(dirPath) {
41
- try {
42
- const stats = await fs.stat(dirPath);
43
- return stats.isDirectory();
44
- } catch {
45
- return false;
46
- }
47
- }
48
- async function copyDirectory(src, dest) {
49
- await fs.mkdir(dest, {
50
- recursive: true
51
- });
52
- const entries = await fs.readdir(src, {
53
- withFileTypes: true
54
- });
55
- for (const entry of entries){
56
- const srcPath = path.join(src, entry.name);
57
- const destPath = path.join(dest, entry.name);
58
- if (entry.isDirectory()) {
59
- await copyDirectory(srcPath, destPath);
60
- } else {
61
- await fs.copyFile(srcPath, destPath);
62
- }
63
- }
64
- }
65
- function createZip(sourceDir, zipPath) {
66
- return new Promise((resolve, reject)=>{
67
- const output = createWriteStream(zipPath);
68
- const archive = archiver('zip', {
69
- zlib: {
70
- level: 9
71
- }
72
- });
73
- output.on('close', ()=>resolve());
74
- archive.on('error', (err)=>reject(err));
75
- archive.pipe(output);
76
- archive.directory(sourceDir, false);
77
- void archive.finalize();
78
- });
79
- }
80
-
81
- //# sourceMappingURL=build-lambda-zip.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/build-lambda-zip.ts"],"sourcesContent":["import archiver from 'archiver'\nimport { createWriteStream } from 'fs'\nimport fs from 'fs/promises'\nimport path from 'path'\n\n/**\n * Build Lambda deployment zip using pure Node.js\n *\n * Cross-platform replacement for build_for_lambda.sh:\n * 1. Copies .next/static to .next/standalone/.next/static\n * 2. Copies run.sh to .next/standalone/run.sh\n * 3. Copies public/ to .next/standalone/public/ (if exists)\n * 4. Creates lambda.zip from .next/standalone/\n *\n * @param projectPath - Path to project root\n * @throws Error if standalone directory missing or zip creation fails\n */\nexport async function buildLambdaZip(projectPath: string): Promise<void> {\n const standalonePath = path.join(projectPath, '.next', 'standalone')\n const staticPath = path.join(projectPath, '.next', 'static')\n const publicPath = path.join(projectPath, 'public')\n const runShPath = path.join(projectPath, 'run.sh')\n const zipPath = path.join(projectPath, 'lambda.zip')\n\n if (!(await isDirectory(standalonePath))) {\n throw new Error(\n 'Standalone build not found at .next/standalone. ' +\n 'Ensure next.config.js has output: \"standalone\" and run build first.',\n )\n }\n\n if (await isDirectory(staticPath)) {\n const destStatic = path.join(standalonePath, '.next', 'static')\n await copyDirectory(staticPath, destStatic)\n }\n\n try {\n await fs.copyFile(runShPath, path.join(standalonePath, 'run.sh'))\n } catch {\n // run.sh may not exist in all setups\n }\n\n if (await isDirectory(publicPath)) {\n const destPublic = path.join(standalonePath, 'public')\n await copyDirectory(publicPath, destPublic)\n }\n\n await createZip(standalonePath, zipPath)\n}\n\nasync function isDirectory(dirPath: string): Promise<boolean> {\n try {\n const stats = await fs.stat(dirPath)\n return stats.isDirectory()\n } catch {\n return false\n }\n}\n\nasync function copyDirectory(src: string, dest: string): Promise<void> {\n await fs.mkdir(dest, { recursive: true })\n const entries = await fs.readdir(src, { withFileTypes: true })\n\n for (const entry of entries) {\n const srcPath = path.join(src, entry.name)\n const destPath = path.join(dest, entry.name)\n\n if (entry.isDirectory()) {\n await copyDirectory(srcPath, destPath)\n } else {\n await fs.copyFile(srcPath, destPath)\n }\n }\n}\n\nfunction createZip(sourceDir: string, zipPath: string): Promise<void> {\n return new Promise((resolve, reject) => {\n const output = createWriteStream(zipPath)\n const archive = archiver('zip', { zlib: { level: 9 } })\n\n output.on('close', () => resolve())\n archive.on('error', (err) => reject(err))\n\n archive.pipe(output)\n archive.directory(sourceDir, false)\n\n void archive.finalize()\n })\n}\n"],"names":["archiver","createWriteStream","fs","path","buildLambdaZip","projectPath","standalonePath","join","staticPath","publicPath","runShPath","zipPath","isDirectory","Error","destStatic","copyDirectory","copyFile","destPublic","createZip","dirPath","stats","stat","src","dest","mkdir","recursive","entries","readdir","withFileTypes","entry","srcPath","name","destPath","sourceDir","Promise","resolve","reject","output","archive","zlib","level","on","err","pipe","directory","finalize"],"mappings":"AAAA,OAAOA,cAAc,WAAU;AAC/B,SAASC,iBAAiB,QAAQ,KAAI;AACtC,OAAOC,QAAQ,c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MAAMC,WAAW7B,KAAKI,IAAI,CAACgB,MAAMM,MAAME,IAAI;QAE3C,IAAIF,MAAMjB,WAAW,IAAI;YACvB,MAAMG,cAAce,SAASE;QAC/B,OAAO;YACL,MAAM9B,GAAGc,QAAQ,CAACc,SAASE;QAC7B;IACF;AACF;AAEA,SAASd,UAAUe,SAAiB,EAAEtB,OAAe;IACnD,OAAO,IAAIuB,QAAQ,CAACC,SAASC;QAC3B,MAAMC,SAASpC,kBAAkBU;QACjC,MAAM2B,UAAUtC,SAAS,OAAO;YAAEuC,MAAM;gBAAEC,OAAO;YAAE;QAAE;QAErDH,OAAOI,EAAE,CAAC,SAAS,IAAMN;QACzBG,QAAQG,EAAE,CAAC,SAAS,CAACC,MAAQN,OAAOM;QAEpCJ,QAAQK,IAAI,CAACN;QACbC,QAAQM,SAAS,CAACX,WAAW;QAE7B,KAAKK,QAAQO,QAAQ;IACvB;AACF"}
@@ -1,12 +0,0 @@
1
- import type { Environment } from '../constants.js';
2
- /**
3
- * Format environment suffix for user-facing messages.
4
- * Returns empty string for production (default), suffix for other environments.
5
- *
6
- * @param env - The environment
7
- * @param prefix - Prefix before environment name (default: ' to ')
8
- * @param suffix - Suffix after environment name (default: '')
9
- * @returns Formatted string or empty string for production
10
- */
11
- export declare function formatEnvSuffix(env: Environment, prefix?: string, suffix?: string): string;
12
- //# sourceMappingURL=format-env-suffix.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"format-env-suffix.d.ts","sourceRoot":"","sources":["../../src/utils/format-env-suffix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAElD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,SAAS,EAAE,MAAM,SAAK,GAAG,MAAM,CAEtF"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Format environment suffix for user-facing messages.
3
- * Returns empty string for production (default), suffix for other environments.
4
- *
5
- * @param env - The environment
6
- * @param prefix - Prefix before environment name (default: ' to ')
7
- * @param suffix - Suffix after environment name (default: '')
8
- * @returns Formatted string or empty string for production
9
- */ export function formatEnvSuffix(env, prefix = ' to ', suffix = '') {
10
- return env !== 'production' ? `${prefix}${env}${suffix}` : '';
11
- }
12
-
13
- //# sourceMappingURL=format-env-suffix.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/format-env-suffix.ts"],"sourcesContent":["import type { Environment } from '../constants.js'\n\n/**\n * Format environment suffix for user-facing messages.\n * Returns empty string for production (default), suffix for other environments.\n *\n * @param env - The environment\n * @param prefix - Prefix before environment name (default: ' to ')\n * @param suffix - Suffix after environment name (default: '')\n * @returns Formatted string or empty string for production\n */\nexport function formatEnvSuffix(env: Environment, prefix = ' to ', suffix = ''): string {\n return env !== 'production' ? `${prefix}${env}${suffix}` : ''\n}\n"],"names":["formatEnvSuffix","env","prefix","suffix"],"mappings":"AAEA;;;;;;;;CAQC,GACD,OAAO,SAASA,gBAAgBC,GAAgB,EAAEC,SAAS,MAAM,EAAEC,SAAS,EAAE;IAC5E,OAAOF,QAAQ,eAAe,GAAGC,SAASD,MAAME,QAAQ,GAAG;AAC7D"}
@@ -1,3 +0,0 @@
1
- export declare function checkForUpdates(currentVersion: string): Promise<void>;
2
- export declare function getOwnVersion(): Promise<string>;
3
- //# sourceMappingURL=version-check.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version-check.d.ts","sourceRoot":"","sources":["../../src/utils/version-check.ts"],"names":[],"mappings":"AASA,wBAAsB,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0B3E;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAMrD"}
@@ -1,38 +0,0 @@
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} is outdated. 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
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
32
- const packageJsonPath = path.join(__dirname, '../../package.json');
33
- const content = await fs.readFile(packageJsonPath, 'utf-8');
34
- const pkg = JSON.parse(content);
35
- return pkg.version;
36
- }
37
-
38
- //# sourceMappingURL=version-check.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/version-check.ts"],"sourcesContent":["import * as p from '@clack/prompts'\nimport fs from 'fs/promises'\nimport path from 'path'\nimport pc from 'picocolors'\nimport { fileURLToPath } from 'url'\n\nconst REGISTRY_URL = 'https://registry.npmjs.org/@payloadcms/figma'\nconst TIMEOUT_MS = 3000\n\nexport async function checkForUpdates(currentVersion: string): Promise<void> {\n try {\n const controller = new AbortController()\n const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS)\n\n const response = await fetch(REGISTRY_URL, { signal: controller.signal })\n clearTimeout(timeoutId)\n\n if (!response.ok) {\n return\n }\n\n const data = await response.json()\n const latestVersion = data['dist-tags']?.latest\n\n if (!latestVersion || latestVersion === currentVersion) {\n return\n }\n\n p.log.warn(\n pc.yellow(`@payloadcms/figma ${currentVersion} is outdated. Latest: ${latestVersion}`),\n )\n p.log.message(pc.dim(` Run: npx @payloadcms/figma@${latestVersion} init --id <your-id>`))\n } catch {\n // Silent catch - network errors, timeouts, parse errors should not interrupt CLI\n }\n}\n\nexport async function getOwnVersion(): Promise<string> {\n const __dirname = path.dirname(fileURLToPath(import.meta.url))\n const packageJsonPath = path.join(__dirname, '../../package.json')\n const content = await fs.readFile(packageJsonPath, 'utf-8')\n const pkg = JSON.parse(content)\n return pkg.version\n}\n"],"names":["p","fs","path","pc","fileURLToPath","REGISTRY_URL","TIMEOUT_MS","checkForUpdates","currentVersion","controller","AbortController","timeoutId","setTimeout","abort","response","fetch","signal","clearTimeout","ok","data","json","latestVersion","latest","log","warn","yellow","message","dim","getOwnVersion","__dirname","dirname","url","packageJsonPath","join","content","readFile","pkg","JSON","parse","version"],"mappings":"AAAA,YAAYA,OAAO,iBAAgB;AACnC,OAAOC,QAAQ,cAAa;AAC5B,OAAOC,UAAU,OAAM;AACvB,OAAOC,QAAQ,aAAY;AAC3B,SAASC,aAAa,QAAQ,MAAK;AAEnC,MAAMC,eAAe;AACrB,MAAMC,aAAa;AAEnB,OAAO,eAAeC,gBAAgBC,cAAsB;IAC1D,IAAI;QACF,MAAMC,aAAa,IAAIC;QACvB,MAAMC,YAAYC,WAAW,IAAMH,WAAWI,KAAK,IAAIP;QAEvD,MAAMQ,WAAW,MAAMC,MAAMV,cAAc;YAAEW,QAAQP,WAAWO,MAAM;QAAC;QACvEC,aAAaN;QAEb,IAAI,CAACG,SAASI,EAAE,EAAE;YAChB;QACF;QAEA,MAAMC,OAAO,MAAML,SAASM,IAAI;QAChC,MAAMC,gBAAgBF,IAAI,CAAC,YAAY,EAAEG;QAEzC,IAAI,CAACD,iBAAiBA,kBAAkBb,gBAAgB;YACtD;QACF;QAEAR,EAAEuB,GAAG,CAACC,IAAI,CACRrB,GAAGsB,MAAM,CAAC,CAAC,kBAAkB,EAAEjB,eAAe,sBAAsB,EAAEa,eAAe;QAEvFrB,EAAEuB,GAAG,CAACG,OAAO,CAACvB,GAAGwB,GAAG,CAAC,CAAC,6BAA6B,EAAEN,cAAc,oBAAoB,CAAC;IAC1F,EAAE,OAAM;IACN,iFAAiF;IACnF;AACF;AAEA,OAAO,eAAeO;IACpB,MAAMC,YAAY3B,KAAK4B,OAAO,CAAC1B,cAAc,YAAY2B,GAAG;IAC5D,MAAMC,kBAAkB9B,KAAK+B,IAAI,CAACJ,WAAW;IAC7C,MAAMK,UAAU,MAAMjC,GAAGkC,QAAQ,CAACH,iBAAiB;IACnD,MAAMI,MAAMC,KAAKC,KAAK,CAACJ;IACvB,OAAOE,IAAIG,OAAO;AACpB"}