@payloadcms/figma 0.1.0-internal.10c3b07 → 0.1.0-internal.fbdc0d3

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 (149) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/{utils → adapters}/asset-collection.d.ts +10 -4
  3. package/dist/{utils → adapters}/asset-collection.js +58 -17
  4. package/dist/{utils → adapters}/build-lambda-zip.d.ts +4 -2
  5. package/dist/adapters/build-lambda-zip.js +111 -0
  6. package/dist/adapters/configureNextjsCache.d.ts +8 -0
  7. package/dist/adapters/configureNextjsCache.js +55 -0
  8. package/dist/{utils → adapters}/deploy-output/resolveOutputPath.d.ts +1 -1
  9. package/dist/adapters/fs-utils.d.ts +39 -0
  10. package/dist/adapters/fs-utils.js +135 -0
  11. package/dist/adapters/index.d.ts +4 -0
  12. package/dist/adapters/index.js +3 -0
  13. package/dist/adapters/lambda-runtime/nextjs-cache.d.ts +40 -0
  14. package/dist/adapters/lambda-runtime/nextjs-cache.js +174 -0
  15. package/dist/adapters/nextjs.d.ts +12 -0
  16. package/dist/adapters/nextjs.js +67 -0
  17. package/dist/{utils/adapters → adapters}/nitro.d.ts +2 -2
  18. package/dist/{utils/adapters → adapters}/nitro.js +54 -29
  19. package/dist/adapters/secret-files.d.ts +25 -0
  20. package/dist/adapters/secret-files.js +50 -0
  21. package/dist/adapters/types.d.ts +42 -0
  22. package/dist/adapters/types.js +1 -0
  23. package/dist/{utils/adapters → adapters}/vite.d.ts +1 -1
  24. package/dist/{utils/adapters → adapters}/vite.js +4 -3
  25. package/dist/api/control-plane.d.ts +11 -0
  26. package/dist/api/control-plane.js +26 -0
  27. package/dist/auth/headless-oauth-flow.js +4 -0
  28. package/dist/auth/oauth-flow.js +17 -0
  29. package/dist/auth/refresh.js +12 -12
  30. package/dist/auth/requested-scopes.d.ts +1 -0
  31. package/dist/auth/requested-scopes.js +3 -0
  32. package/dist/auth/token-store.d.ts +16 -0
  33. package/dist/auth/token-store.js +33 -0
  34. package/dist/auth/types.d.ts +5 -3
  35. package/dist/commands/bootstrap.js +3 -0
  36. package/dist/commands/build-lambda-zip.js +1 -1
  37. package/dist/commands/deploy.js +2 -2
  38. package/dist/commands/init.js +72 -2
  39. package/dist/commands/upgrade.js +65 -1
  40. package/dist/commands/upload-schema.js +3 -4
  41. package/dist/config/oauth.js +6 -1
  42. package/dist/constants.d.ts +0 -2
  43. package/dist/constants.js +0 -3
  44. package/dist/db-content-api/generated/content-api-types.d.ts +6 -2
  45. package/dist/db-content-api/utilities/auth.d.ts +1 -4
  46. package/dist/db-content-api/utilities/auth.js +1 -1
  47. package/dist/db-content-api/utilities/data/index.js +8 -2
  48. package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +3 -11
  49. package/dist/db-content-api/utilities/data/removeVirtualFields.js +12 -50
  50. package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +9 -4
  51. package/dist/index.d.ts +1 -0
  52. package/dist/index.js +2 -0
  53. package/dist/next/image-loader.d.ts +6 -0
  54. package/dist/next/image-loader.js +14 -0
  55. package/dist/oauth/components/LoginButton/index.js +66 -19
  56. package/dist/oauth/components/LoginButton/index.scss +121 -15
  57. package/dist/oauth/defaults.js +4 -1
  58. package/dist/plugin/build-config.d.ts +13 -3
  59. package/dist/plugin/build-config.js +198 -59
  60. package/dist/plugin/cache-revalidation-hooks.d.ts +6 -0
  61. package/dist/plugin/cache-revalidation-hooks.js +69 -0
  62. package/dist/plugin/cloud-limits/CloudLimitModal/index.d.ts +2 -1
  63. package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.d.ts +2 -1
  64. package/dist/plugin/make-permission-access/make-permission-access.d.ts +8 -0
  65. package/dist/plugin/make-permission-access/make-permission-access.js +24 -0
  66. package/dist/storage-content-api/api-types.d.ts +5 -2
  67. package/dist/storage-content-api/buildBaseMediaResponseHeaders.d.ts +1 -1
  68. package/dist/storage-content-api/buildBaseMediaResponseHeaders.js +3 -1
  69. package/dist/storage-content-api/buildClientUploadFetchBackHeaders.d.ts +8 -6
  70. package/dist/storage-content-api/buildClientUploadFetchBackHeaders.js +17 -12
  71. package/dist/storage-content-api/buildMediaRequestHeaders.d.ts +1 -0
  72. package/dist/storage-content-api/buildMediaRequestHeaders.js +14 -0
  73. package/dist/storage-content-api/buildMediaResponseHeaders.d.ts +3 -3
  74. package/dist/storage-content-api/buildMediaResponseHeaders.js +25 -18
  75. package/dist/storage-content-api/client-uploads/generate.d.ts +7 -3
  76. package/dist/storage-content-api/client-uploads/generate.js +22 -21
  77. package/dist/storage-content-api/client.d.ts +0 -2
  78. package/dist/storage-content-api/client.js +2 -2
  79. package/dist/storage-content-api/copyFile.d.ts +16 -0
  80. package/dist/storage-content-api/copyFile.js +90 -0
  81. package/dist/storage-content-api/deleteFile.d.ts +8 -0
  82. package/dist/storage-content-api/deleteFile.js +18 -0
  83. package/dist/storage-content-api/getDownloadResponseHeaderPolicy.d.ts +11 -0
  84. package/dist/storage-content-api/getDownloadResponseHeaderPolicy.js +33 -0
  85. package/dist/storage-content-api/getMediaType.d.ts +1 -0
  86. package/dist/storage-content-api/getMediaType.js +3 -0
  87. package/dist/storage-content-api/handleUpload.d.ts +1 -2
  88. package/dist/storage-content-api/handleUpload.js +13 -157
  89. package/dist/storage-content-api/hasSupportedContentEncoding.d.ts +1 -1
  90. package/dist/storage-content-api/hasSupportedContentEncoding.js +4 -2
  91. package/dist/storage-content-api/index.js +17 -8
  92. package/dist/storage-content-api/mediaErrorResponse.d.ts +1 -1
  93. package/dist/storage-content-api/mediaErrorResponse.js +2 -2
  94. package/dist/storage-content-api/resolveDownloadResponseHeaders.d.ts +5 -0
  95. package/dist/storage-content-api/resolveDownloadResponseHeaders.js +13 -0
  96. package/dist/storage-content-api/shouldAttachMedia.d.ts +1 -0
  97. package/dist/storage-content-api/{getInlineContentType.js → shouldAttachMedia.js} +8 -7
  98. package/dist/storage-content-api/staticHandler.d.ts +2 -1
  99. package/dist/storage-content-api/staticHandler.js +47 -53
  100. package/dist/storage-content-api/types.d.ts +4 -1
  101. package/dist/storage-content-api/uploadFileData.d.ts +10 -0
  102. package/dist/storage-content-api/uploadFileData.js +145 -0
  103. package/dist/utils/build-detection.js +3 -3
  104. package/dist/utils/cache-bootstrap.js +1 -0
  105. package/dist/utils/deploy-adapter.d.ts +2 -34
  106. package/dist/utils/deploy-adapter.js +16 -9
  107. package/dist/utils/env-management.d.ts +15 -0
  108. package/dist/utils/env-management.js +47 -0
  109. package/dist/utils/lambda-config.js +14 -9
  110. package/dist/utils/load-payload-config.js +1 -6
  111. package/dist/utils/next-image-loader-config.d.ts +2 -0
  112. package/dist/utils/next-image-loader-config.js +63 -0
  113. package/dist/utils/next-image-loader-file.d.ts +2 -0
  114. package/dist/utils/next-image-loader-file.js +11 -0
  115. package/dist/utils/payload-config-ast.d.ts +5 -0
  116. package/dist/utils/payload-config-ast.js +73 -4
  117. package/dist/utils/payload-config-modifier.js +3 -0
  118. package/dist/utils/payload-secret.d.ts +28 -0
  119. package/dist/utils/payload-secret.js +34 -0
  120. package/package.json +22 -10
  121. package/dist/storage-content-api/getInlineContentType.d.ts +0 -1
  122. package/dist/storage-content-api/handleDelete.d.ts +0 -7
  123. package/dist/storage-content-api/handleDelete.js +0 -15
  124. package/dist/storage-content-api/utilities/getSafeFilename.d.ts +0 -11
  125. package/dist/storage-content-api/utilities/getSafeFilename.js +0 -59
  126. package/dist/storage-content-api/utilities/index.d.ts +0 -2
  127. package/dist/storage-content-api/utilities/index.js +0 -2
  128. package/dist/storage-content-api/utilities/parseUploadReference.d.ts +0 -17
  129. package/dist/storage-content-api/utilities/parseUploadReference.js +0 -27
  130. package/dist/utils/adapters/nextjs.d.ts +0 -8
  131. package/dist/utils/adapters/nextjs.js +0 -64
  132. package/dist/utils/build-lambda-zip.js +0 -73
  133. package/dist/utils/fs-utils.d.ts +0 -12
  134. package/dist/utils/fs-utils.js +0 -55
  135. /package/dist/{utils → adapters}/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.d.ts +0 -0
  136. /package/dist/{utils → adapters}/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.js +0 -0
  137. /package/dist/{utils → adapters}/deploy-output/inspectNextjsOutput.d.ts +0 -0
  138. /package/dist/{utils → adapters}/deploy-output/inspectNextjsOutput.js +0 -0
  139. /package/dist/{utils → adapters}/deploy-output/inspectNitroOutput.d.ts +0 -0
  140. /package/dist/{utils → adapters}/deploy-output/inspectNitroOutput.js +0 -0
  141. /package/dist/{utils → adapters}/deploy-output/isFile.d.ts +0 -0
  142. /package/dist/{utils → adapters}/deploy-output/isFile.js +0 -0
  143. /package/dist/{utils → adapters}/deploy-output/readJson.d.ts +0 -0
  144. /package/dist/{utils → adapters}/deploy-output/readJson.js +0 -0
  145. /package/dist/{utils → adapters}/deploy-output/resolveNitroOutputLayout.d.ts +0 -0
  146. /package/dist/{utils → adapters}/deploy-output/resolveNitroOutputLayout.js +0 -0
  147. /package/dist/{utils → adapters}/deploy-output/resolveOutputPath.js +0 -0
  148. /package/dist/{utils → adapters}/deploy-output/resolveWithin.d.ts +0 -0
  149. /package/dist/{utils → adapters}/deploy-output/resolveWithin.js +0 -0
@@ -1,73 +0,0 @@
1
- import archiver from 'archiver';
2
- import { createWriteStream } from 'fs';
3
- import fs from 'fs/promises';
4
- import path from 'path';
5
- import { inspectNextjsOutput } from './deploy-output/inspectNextjsOutput.js';
6
- import { resolveOutputPath } from './deploy-output/resolveOutputPath.js';
7
- import { getDirectorySize } from './fs-utils.js';
8
- /**
9
- * AWS Lambda's hard limit on unzipped deployment code size (250 MB). The unzipped
10
- * total must be strictly less than this value, so a bundle exactly equal to it is
11
- * rejected. The server enforces this too and now returns a clear message, so a
12
- * client-side check against this value is an early-exit convenience, not the
13
- * source of truth.
14
- */ export const LAMBDA_MAX_UNZIPPED_BYTES = 250 * 1024 * 1024;
15
- /**
16
- * Build Lambda deployment zip using pure Node.js
17
- *
18
- * Cross-platform replacement for build_for_lambda.sh:
19
- * 1. Adds a generated run.sh directly to the archive
20
- * 2. Creates lambda.zip from the standalone output
21
- *
22
- * The output's static/ and the project's public/ directories are not copied into the zip. Those
23
- * files are uploaded separately and served by Gatekeeper, not the Lambda function.
24
- *
25
- * @param projectPath - Path to project root
26
- * @returns The built bundle: its unzipped byte size and the absolute zip path.
27
- * @throws Error if standalone directory missing or zip creation fails
28
- */ export async function buildLambdaZip(projectPath, output) {
29
- const outputPath = resolveOutputPath(projectPath, 'nextjs', output);
30
- const layout = await inspectNextjsOutput(outputPath);
31
- if (!layout) {
32
- throw new Error(`Standalone build not found at ${outputPath}`);
33
- }
34
- const serverEntry = path.relative(layout.standalonePath, layout.serverEntryPath).split(path.sep).join('/');
35
- const runScript = createRunScript(serverEntry);
36
- const zipPath = path.join(projectPath, 'lambda.zip');
37
- const existingRunScriptBytes = await getFileSize(path.join(layout.standalonePath, 'run.sh'));
38
- const unzippedBytes = await getDirectorySize(layout.standalonePath) - existingRunScriptBytes + Buffer.byteLength(runScript);
39
- await createZip(layout.standalonePath, zipPath, runScript);
40
- return {
41
- unzippedBytes,
42
- zipPath
43
- };
44
- }
45
- function createRunScript(serverEntry) {
46
- const escapedEntry = serverEntry.replaceAll("'", "'\\''");
47
- return `#!/bin/bash -x
48
- [ ! -d '/tmp/cache' ] && mkdir -p /tmp/cache
49
- NODE_ENV=production exec node '${escapedEntry}'
50
- `;
51
- }
52
- async function getFileSize(filePath) {
53
- return fs.stat(filePath).then((stat)=>stat.isFile() ? stat.size : 0).catch(()=>0);
54
- }
55
- function createZip(sourceDir, zipPath, runScript) {
56
- return new Promise((resolve, reject)=>{
57
- const output = createWriteStream(zipPath);
58
- const archive = archiver('zip', {
59
- zlib: {
60
- level: 9
61
- }
62
- });
63
- output.on('close', ()=>resolve());
64
- archive.on('error', (err)=>reject(err));
65
- archive.pipe(output);
66
- archive.directory(sourceDir, false, (entry)=>entry.name === 'run.sh' ? false : entry);
67
- archive.append(runScript, {
68
- name: 'run.sh',
69
- mode: 0o755
70
- });
71
- void archive.finalize();
72
- });
73
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * Recursively collect all file paths under a directory,
3
- * returned as forward-slash-separated paths relative to baseDir.
4
- */
5
- export declare function collectFilesRecursive(dir: string, baseDir: string): Promise<string[]>;
6
- /**
7
- * Recursively sum the byte size of all files under a directory.
8
- * Returns 0 for a missing or unreadable directory. Symlinks are not
9
- * followed. Files that disappear or become unreadable between readdir
10
- * and stat are skipped (treated as 0 bytes).
11
- */
12
- export declare function getDirectorySize(dir: string): Promise<number>;
@@ -1,55 +0,0 @@
1
- import fs from 'fs/promises';
2
- import path from 'path';
3
- /**
4
- * Recursively collect all file paths under a directory,
5
- * returned as forward-slash-separated paths relative to baseDir.
6
- */ export async function collectFilesRecursive(dir, baseDir) {
7
- const files = [];
8
- try {
9
- const entries = await fs.readdir(dir, {
10
- withFileTypes: true
11
- });
12
- for (const entry of entries){
13
- const fullPath = path.join(dir, entry.name);
14
- if (entry.isDirectory()) {
15
- const subFiles = await collectFilesRecursive(fullPath, baseDir);
16
- files.push(...subFiles);
17
- } else if (entry.isFile()) {
18
- files.push(path.relative(baseDir, fullPath).split(path.sep).join('/'));
19
- }
20
- }
21
- } catch {
22
- // Not accessible
23
- }
24
- return files;
25
- }
26
- /**
27
- * Recursively sum the byte size of all files under a directory.
28
- * Returns 0 for a missing or unreadable directory. Symlinks are not
29
- * followed. Files that disappear or become unreadable between readdir
30
- * and stat are skipped (treated as 0 bytes).
31
- */ export async function getDirectorySize(dir) {
32
- let entries;
33
- try {
34
- entries = await fs.readdir(dir, {
35
- withFileTypes: true
36
- });
37
- } catch {
38
- return 0;
39
- }
40
- let total = 0;
41
- for (const entry of entries){
42
- const fullPath = path.join(dir, entry.name);
43
- if (entry.isDirectory()) {
44
- total += await getDirectorySize(fullPath);
45
- } else if (entry.isFile()) {
46
- try {
47
- const stats = await fs.stat(fullPath);
48
- total += stats.size;
49
- } catch {
50
- // File vanished or is unreadable between readdir and stat — skip it.
51
- }
52
- }
53
- }
54
- return total;
55
- }