@payloadcms/figma 1.0.0-beta.0 → 1.0.0-beta.2

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 (153) hide show
  1. package/dist/adapters/build-lambda-zip.d.ts +2 -1
  2. package/dist/adapters/build-lambda-zip.js +4 -1
  3. package/dist/adapters/deploy-output/assertDeployableServerActionsKey.d.ts +14 -0
  4. package/dist/adapters/deploy-output/assertDeployableServerActionsKey.js +33 -0
  5. package/dist/commands/upload-schema.js +23 -9
  6. package/dist/content-api/auth.d.ts +34 -0
  7. package/dist/content-api/auth.js +70 -0
  8. package/dist/content-api/awaitWithSignal.d.ts +2 -0
  9. package/dist/content-api/awaitWithSignal.js +27 -0
  10. package/dist/content-api/createContentApiClient.d.ts +18 -0
  11. package/dist/content-api/createContentApiClient.js +90 -0
  12. package/dist/content-api/withRateLimitRetries.d.ts +7 -0
  13. package/dist/content-api/withRateLimitRetries.js +45 -0
  14. package/dist/db-content-api/generated/content-api-types.d.ts +247 -0
  15. package/dist/db-content-api/index.d.ts +5 -5
  16. package/dist/db-content-api/index.js +46 -16
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.js +1 -0
  19. package/dist/oauth/components/FigmaAvatar/index.js +3 -2
  20. package/dist/oauth/components/FigmaAvatarCell/index.js +3 -1
  21. package/dist/oauth/components/LoginButton/index.js +8 -4
  22. package/dist/oauth/components/LogoutButton/index.js +3 -2
  23. package/dist/oauth/defaults.js +2 -2
  24. package/dist/oauth/endpoints/getLoginEndpoint.js +2 -5
  25. package/dist/oauth/hooks/me.d.ts +4 -3
  26. package/dist/oauth/hooks/me.js +6 -52
  27. package/dist/oauth/hooks/refresh.js +9 -1
  28. package/dist/oauth/index.js +3 -3
  29. package/dist/oauth/strategy/index.d.ts +3 -0
  30. package/dist/oauth/strategy/index.js +49 -3
  31. package/dist/oauth/utilities/clearCookie.d.ts +1 -0
  32. package/dist/oauth/utilities/clearCookie.js +13 -9
  33. package/dist/oauth/utilities/clearSessionCookies.d.ts +5 -0
  34. package/dist/oauth/utilities/clearSessionCookies.js +17 -0
  35. package/dist/oauth/utilities/getAuthorizeURL.js +1 -2
  36. package/dist/oauth/utilities/mergeHeaders.js +11 -23
  37. package/dist/oauth/utilities/refreshTokens.d.ts +9 -3
  38. package/dist/oauth/utilities/refreshTokens.js +45 -34
  39. package/dist/oauth/utilities/resolvePayloadRedirect.d.ts +13 -0
  40. package/dist/oauth/utilities/resolvePayloadRedirect.js +30 -0
  41. package/dist/plugin/build-config.js +16 -13
  42. package/dist/plugin/cloud-limits/CloudLimitModal/index.js +1 -1
  43. package/dist/plugin/cloud-limits/shared.d.ts +5 -1
  44. package/dist/plugin/cloud-limits/utilities/toasts.d.ts +2 -1
  45. package/dist/plugin/dev-cookie-names.d.ts +4 -1
  46. package/dist/plugin/dev-cookie-names.js +6 -3
  47. package/dist/plugin/environment-error.d.ts +4 -0
  48. package/dist/plugin/environment-error.js +22 -0
  49. package/dist/plugin/mcp-oauth.d.ts +10 -0
  50. package/dist/plugin/mcp-oauth.js +24 -0
  51. package/dist/plugin/sandbox-upload-fetch.d.ts +5 -6
  52. package/dist/plugin/sandbox-upload-fetch.js +22 -14
  53. package/dist/scss.d.js +1 -1
  54. package/dist/storage-content-api/api-types.d.ts +22 -1
  55. package/dist/storage-content-api/api-types.js +2 -1
  56. package/dist/storage-content-api/client.d.ts +3 -3
  57. package/dist/storage-content-api/client.js +13 -35
  58. package/dist/storage-content-api/index.js +20 -21
  59. package/dist/storage-content-api/staticHandler.js +4 -1
  60. package/dist/storage-content-api/types.d.ts +2 -2
  61. package/dist/translations/ar.d.ts +9 -0
  62. package/dist/translations/ar.js +10 -1
  63. package/dist/translations/az.d.ts +9 -0
  64. package/dist/translations/az.js +10 -1
  65. package/dist/translations/bg.d.ts +9 -0
  66. package/dist/translations/bg.js +10 -1
  67. package/dist/translations/bnBd.d.ts +9 -0
  68. package/dist/translations/bnBd.js +10 -1
  69. package/dist/translations/bnIn.d.ts +9 -0
  70. package/dist/translations/bnIn.js +10 -1
  71. package/dist/translations/ca.d.ts +9 -0
  72. package/dist/translations/ca.js +10 -1
  73. package/dist/translations/cs.d.ts +9 -0
  74. package/dist/translations/cs.js +10 -1
  75. package/dist/translations/da.d.ts +9 -0
  76. package/dist/translations/da.js +10 -1
  77. package/dist/translations/de.d.ts +9 -0
  78. package/dist/translations/de.js +10 -1
  79. package/dist/translations/en.d.ts +9 -0
  80. package/dist/translations/en.js +10 -1
  81. package/dist/translations/es.d.ts +9 -0
  82. package/dist/translations/es.js +15 -6
  83. package/dist/translations/et.d.ts +9 -0
  84. package/dist/translations/et.js +10 -1
  85. package/dist/translations/fa.d.ts +9 -0
  86. package/dist/translations/fa.js +10 -1
  87. package/dist/translations/fr.d.ts +9 -0
  88. package/dist/translations/fr.js +10 -1
  89. package/dist/translations/he.d.ts +9 -0
  90. package/dist/translations/he.js +10 -1
  91. package/dist/translations/hr.d.ts +9 -0
  92. package/dist/translations/hr.js +10 -1
  93. package/dist/translations/hu.d.ts +9 -0
  94. package/dist/translations/hu.js +10 -1
  95. package/dist/translations/hy.d.ts +9 -0
  96. package/dist/translations/hy.js +10 -1
  97. package/dist/translations/id.d.ts +9 -0
  98. package/dist/translations/id.js +10 -1
  99. package/dist/translations/index.d.ts +400 -3
  100. package/dist/translations/is.d.ts +9 -0
  101. package/dist/translations/is.js +10 -1
  102. package/dist/translations/it.d.ts +9 -0
  103. package/dist/translations/it.js +10 -1
  104. package/dist/translations/ja.d.ts +9 -0
  105. package/dist/translations/ja.js +14 -5
  106. package/dist/translations/ko.d.ts +9 -0
  107. package/dist/translations/ko.js +16 -7
  108. package/dist/translations/lt.d.ts +9 -0
  109. package/dist/translations/lt.js +10 -1
  110. package/dist/translations/lv.d.ts +9 -0
  111. package/dist/translations/lv.js +10 -1
  112. package/dist/translations/my.d.ts +9 -0
  113. package/dist/translations/my.js +10 -1
  114. package/dist/translations/nb.d.ts +9 -0
  115. package/dist/translations/nb.js +10 -1
  116. package/dist/translations/nl.d.ts +9 -0
  117. package/dist/translations/nl.js +10 -1
  118. package/dist/translations/pl.d.ts +9 -0
  119. package/dist/translations/pl.js +10 -1
  120. package/dist/translations/pt.d.ts +9 -0
  121. package/dist/translations/pt.js +15 -6
  122. package/dist/translations/ro.d.ts +9 -0
  123. package/dist/translations/ro.js +10 -1
  124. package/dist/translations/rs.d.ts +9 -0
  125. package/dist/translations/rs.js +10 -1
  126. package/dist/translations/rsLatin.d.ts +9 -0
  127. package/dist/translations/rsLatin.js +10 -1
  128. package/dist/translations/ru.d.ts +9 -0
  129. package/dist/translations/ru.js +10 -1
  130. package/dist/translations/sk.d.ts +9 -0
  131. package/dist/translations/sk.js +10 -1
  132. package/dist/translations/sl.d.ts +9 -0
  133. package/dist/translations/sl.js +10 -1
  134. package/dist/translations/sv.d.ts +9 -0
  135. package/dist/translations/sv.js +10 -1
  136. package/dist/translations/ta.d.ts +9 -0
  137. package/dist/translations/ta.js +10 -1
  138. package/dist/translations/th.d.ts +9 -0
  139. package/dist/translations/th.js +10 -1
  140. package/dist/translations/tr.d.ts +9 -0
  141. package/dist/translations/tr.js +10 -1
  142. package/dist/translations/uk.d.ts +9 -0
  143. package/dist/translations/uk.js +10 -1
  144. package/dist/translations/vi.d.ts +9 -0
  145. package/dist/translations/vi.js +10 -1
  146. package/dist/translations/zh.d.ts +9 -0
  147. package/dist/translations/zh.js +10 -1
  148. package/dist/translations/zhTw.d.ts +9 -0
  149. package/dist/translations/zhTw.js +10 -1
  150. package/dist/utils/env-management.js +7 -0
  151. package/package.json +20 -22
  152. package/dist/db-content-api/utilities/auth.d.ts +0 -29
  153. package/dist/db-content-api/utilities/auth.js +0 -82
@@ -6,12 +6,15 @@ import { getEnvVarSync } from '../utils/env-management.js';
6
6
  * switching environments in the same checkout; falls back to contentSystemId
7
7
  * when projectId isn't in `.env`.
8
8
  *
9
+ * Names must start with `cookiePrefix`: Payload forwards every other request
10
+ * cookie when it fetches an external upload URL.
11
+ *
9
12
  * In production, cookies are isolated by unique hostnames and this is unused.
10
- */ export function getDevCookieNames(contentSystemId) {
13
+ */ export function getDevCookieNames(contentSystemId, cookiePrefix = 'payload') {
11
14
  const projectId = process.env.FIGMA_PROJECT_ID ?? getEnvVarSync(process.cwd(), 'FIGMA_PROJECT_ID') ?? contentSystemId;
12
15
  const suffix = projectId.slice(0, 8);
13
16
  return {
14
- cookieName: `figma-${suffix}-oauth-token`,
15
- userInfoCookieName: `figma-${suffix}-user-info`
17
+ cookieName: `${cookiePrefix}-figma-${suffix}-oauth-token`,
18
+ userInfoCookieName: `${cookiePrefix}-figma-${suffix}-user-info`
16
19
  };
17
20
  }
@@ -0,0 +1,4 @@
1
+ /** Required Figma environment configuration could not be resolved. */
2
+ export declare class FigmaEnvironmentError extends Error {
3
+ name: string;
4
+ }
@@ -0,0 +1,22 @@
1
+ import * as payload from 'payload';
2
+ /** Required Figma environment configuration could not be resolved. */ export class FigmaEnvironmentError extends Error {
3
+ name = 'FigmaEnvironmentError';
4
+ }
5
+ // Older Payload versions do not expose a CLI error hook and retain their default status 1.
6
+ if ('registerCLIExitCodeHandler' in payload && typeof payload.registerCLIExitCodeHandler === 'function') {
7
+ payload.registerCLIExitCodeHandler({
8
+ handler: (error)=>{
9
+ if (!(error instanceof FigmaEnvironmentError)) {
10
+ return undefined;
11
+ }
12
+ // Figma environments inject this status so the platform can detect
13
+ // and classify environment misconfigurations.
14
+ const rawExitCode = process.env.FIGMA_DEPLOY_FAILURE_EXIT_CODE;
15
+ if (rawExitCode === undefined || !/^\d+$/.test(rawExitCode)) {
16
+ return undefined;
17
+ }
18
+ const exitCode = Number(rawExitCode);
19
+ return exitCode >= 1 && exitCode <= 255 ? exitCode : undefined;
20
+ }
21
+ });
22
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Turns off `@payloadcms/plugin-mcp`'s OAuth login in apps that use plugin-mcp, unless the app
3
+ * sets plugin-mcp's `oauth` option itself. Newer versions of plugin-mcp turn that login on by
4
+ * default, but its default tokens need Payload's password login, which Figma apps turn off, so
5
+ * MCP clients would be asked to log in and then fail. MCP clients keep using API keys.
6
+ *
7
+ * It only sets an option on plugin-mcp, so apps without plugin-mcp don't get it. Versions of
8
+ * plugin-mcp without the option ignore it.
9
+ */
10
+ export declare const createMCPOAuthPlugin: () => import("payload").Plugin;
@@ -0,0 +1,24 @@
1
+ import { definePlugin } from 'payload';
2
+ /**
3
+ * Turns off `@payloadcms/plugin-mcp`'s OAuth login in apps that use plugin-mcp, unless the app
4
+ * sets plugin-mcp's `oauth` option itself. Newer versions of plugin-mcp turn that login on by
5
+ * default, but its default tokens need Payload's password login, which Figma apps turn off, so
6
+ * MCP clients would be asked to log in and then fail. MCP clients keep using API keys.
7
+ *
8
+ * It only sets an option on plugin-mcp, so apps without plugin-mcp don't get it. Versions of
9
+ * plugin-mcp without the option ignore it.
10
+ */ export const createMCPOAuthPlugin = definePlugin({
11
+ slug: '@payloadcms/figma/mcp-oauth',
12
+ // Before @payloadcms/plugin-mcp, which runs at order 10 and reads its options then
13
+ order: 5,
14
+ plugin: ({ config, plugins })=>{
15
+ const mcp = plugins['@payloadcms/plugin-mcp'];
16
+ if (mcp && mcp.options?.oauth === undefined) {
17
+ mcp.options = {
18
+ ...mcp.options,
19
+ oauth: false
20
+ };
21
+ }
22
+ return config;
23
+ }
24
+ });
@@ -19,14 +19,13 @@ type SandboxUploadFetchOptions = {
19
19
  * maps external hostnames to unique-local IPv6 addresses (`fc00::/7`) that
20
20
  * `safeFetch` rejects as non-unicast. A no-op elsewhere.
21
21
  *
22
- * Only a default: a collection that set `skipSafeFetch` itself keeps its value.
23
- * `externalFileHeaderFilter` is left unset on purpose, since it would replace
24
- * the cookie logic that forwards credentials for relative URLs.
22
+ * A collection that sets `skipSafeFetch` keeps its value.
23
+ * The default header filter removes current and legacy OAuth cookies from
24
+ * external requests. Trusted same-origin relative URLs retain their cookies.
25
25
  *
26
26
  * SSRF risks, bounded by the routes' auth gate and sandbox network limits:
27
- * `getExternalFile` re-validates redirects only against `pasteURL.allowList`,
28
- * any session can GET an arbitrary URL and read the body, and request cookies
29
- * reach the target.
27
+ * Payload checks each redirect against `pasteURL.allowList`.
28
+ * An authenticated session can fetch an arbitrary URL and read its body.
30
29
  */
31
30
  export declare function createSandboxUploadFetchPlugin({ userCollections }: SandboxUploadFetchOptions): (config: Config) => Config;
32
31
  export {};
@@ -12,14 +12,13 @@ import * as log from '../utils/log.js';
12
12
  * maps external hostnames to unique-local IPv6 addresses (`fc00::/7`) that
13
13
  * `safeFetch` rejects as non-unicast. A no-op elsewhere.
14
14
  *
15
- * Only a default: a collection that set `skipSafeFetch` itself keeps its value.
16
- * `externalFileHeaderFilter` is left unset on purpose, since it would replace
17
- * the cookie logic that forwards credentials for relative URLs.
15
+ * A collection that sets `skipSafeFetch` keeps its value.
16
+ * The default header filter removes current and legacy OAuth cookies from
17
+ * external requests. Trusted same-origin relative URLs retain their cookies.
18
18
  *
19
19
  * SSRF risks, bounded by the routes' auth gate and sandbox network limits:
20
- * `getExternalFile` re-validates redirects only against `pasteURL.allowList`,
21
- * any session can GET an arbitrary URL and read the body, and request cookies
22
- * reach the target.
20
+ * Payload checks each redirect against `pasteURL.allowList`.
21
+ * An authenticated session can fetch an arbitrary URL and read its body.
23
22
  */ export function createSandboxUploadFetchPlugin({ userCollections }) {
24
23
  const appOwnedSlugs = new Set((userCollections ?? []).filter((collection)=>typeof collection.upload === 'object' && 'skipSafeFetch' in collection.upload).map((collection)=>collection.slug));
25
24
  return (config)=>{
@@ -27,27 +26,36 @@ import * as log from '../utils/log.js';
27
26
  return config;
28
27
  }
29
28
  const modifiedSlugs = [];
29
+ let modified = false;
30
30
  const collections = (config.collections ?? []).map((collection)=>{
31
- if (!collection.upload || appOwnedSlugs.has(collection.slug)) {
31
+ if (!collection.upload) {
32
32
  return collection;
33
33
  }
34
- modifiedSlugs.push(collection.slug);
34
+ modified = true;
35
+ if (!appOwnedSlugs.has(collection.slug)) {
36
+ modifiedSlugs.push(collection.slug);
37
+ }
35
38
  const upload = collection.upload === true ? {} : collection.upload;
36
39
  return {
37
40
  ...collection,
38
41
  upload: {
39
42
  ...upload,
40
- skipSafeFetch: true
43
+ ...!appOwnedSlugs.has(collection.slug) ? {
44
+ skipSafeFetch: true
45
+ } : {},
46
+ externalFileHeaderFilter: upload.externalFileHeaderFilter ?? ((headers, context)=>({
47
+ // Payload supplies fresh context for each redirect hop.
48
+ cookie: (headers.cookie ?? '').split(';').filter((cookie)=>context?.isSameOrigin || !cookie.trim().startsWith(config.cookiePrefix ?? 'payload') && !/^figma-.+-(?:oauth-token(?:-refresh)?|user-info)=/.test(cookie.trim())).join(';')
49
+ }))
41
50
  }
42
51
  };
43
52
  });
44
- if (modifiedSlugs.length === 0) {
45
- return config;
53
+ if (modified) {
54
+ log.debug(`Make sandbox detected: skipSafeFetch defaults applied (${modifiedSlugs.join(', ') || 'none'}); all upload collections default to forwarding CMS cookies only to trusted same-origin relative URLs. App-defined header filters are preserved.`);
46
55
  }
47
- log.debug(`Make sandbox detected: upload collections skip safeFetch (${modifiedSlugs.join(', ')})`);
48
- return {
56
+ return modified ? {
49
57
  ...config,
50
58
  collections
51
- };
59
+ } : config;
52
60
  };
53
61
  }
package/dist/scss.d.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Side-effect SCSS imports in admin components carry styling only; declaring the
2
- // module lets the type checker accept them while SWC/copyfiles handle the assets.
2
+ // module lets the type checker accept them while SWC and scripts/copy-assets.mjs handle the assets.
@@ -1,7 +1,10 @@
1
1
  /**
2
2
  * Upload API types extracted from Content API OpenAPI spec.
3
- * These are kept separate to avoid breaking changes when the main spec is regenerated.
3
+ * Existing upload types stay separate to avoid breaking changes when the main spec is
4
+ * regenerated. The transform endpoint reuses its generated request/response schemas.
4
5
  */
6
+ import type { components } from '../db-content-api/generated/content-api-types.js';
7
+ type SignImageTransformRequest = components['schemas']['SignImageTransformRequest'];
5
8
  type UploadErrorResponse = {
6
9
  content: {
7
10
  'application/json': {
@@ -182,5 +185,23 @@ export type UploadPaths = {
182
185
  } & UploadErrorResponses;
183
186
  };
184
187
  };
188
+ '/api/v0/uploads/transform/sign': {
189
+ post: {
190
+ requestBody: {
191
+ content: {
192
+ 'application/json': {
193
+ method?: SignImageTransformRequest['method'];
194
+ } & Omit<SignImageTransformRequest, 'method'>;
195
+ };
196
+ };
197
+ responses: {
198
+ 200: {
199
+ content: {
200
+ 'application/json': components['schemas']['SignImageTransformResponse'];
201
+ };
202
+ };
203
+ } & UploadErrorResponses;
204
+ };
205
+ };
185
206
  };
186
207
  export {};
@@ -1,4 +1,5 @@
1
1
  /**
2
2
  * Upload API types extracted from Content API OpenAPI spec.
3
- * These are kept separate to avoid breaking changes when the main spec is regenerated.
3
+ * Existing upload types stay separate to avoid breaking changes when the main spec is
4
+ * regenerated. The transform endpoint reuses its generated request/response schemas.
4
5
  */ export { };
@@ -1,5 +1,5 @@
1
- import createClient from 'openapi-fetch';
2
1
  import type { UploadPaths } from './api-types.js';
3
2
  import type { StorageClientConfig } from './types.js';
4
- export type StorageClient = ReturnType<typeof createClient<UploadPaths>>;
5
- export declare function createStorageClient(config: StorageClientConfig): StorageClient;
3
+ import { createContentApiClient } from '../content-api/createContentApiClient.js';
4
+ export type StorageClient = ReturnType<typeof createContentApiClient<UploadPaths>>['api'];
5
+ export declare function createStorageClient(config: StorageClientConfig, warn?: (message: string) => void): StorageClient;
@@ -1,37 +1,15 @@
1
- import createClient from 'openapi-fetch';
2
- import { getValidProjectToken } from '../auth/project-token.js';
3
- import { fetchDevJwt } from '../db-content-api/utilities/auth.js';
4
- export function createStorageClient(config) {
5
- const client = createClient({
6
- baseUrl: config.baseUrl
7
- });
8
- client.use(createStorageAuthMiddleware(config));
9
- return client;
10
- }
11
- function createStorageAuthMiddleware(config) {
12
- return {
13
- async onRequest ({ request }) {
14
- if ('contentApiKey' in config) {
15
- request.headers.set('X-Api-Key', config.contentApiKey);
16
- } else {
17
- const { auth, contentSystemId } = config;
18
- if (auth.mode === 'apiKey') {
19
- request.headers.set('X-Api-Key', auth.apiKey);
20
- } else if (auth.mode === 'tokenStore') {
21
- const token = await getValidProjectToken({
22
- tenantId: contentSystemId,
23
- tokenStore: auth.tokenStore
24
- });
25
- if (!token) {
26
- throw new Error('Authentication required. Run `npx @payloadcms/figma login` to authenticate.');
27
- }
28
- request.headers.set('Authorization', `Bearer ${token}`);
29
- } else {
30
- const token = await fetchDevJwt(config.baseUrl, contentSystemId);
31
- request.headers.set('Authorization', `Bearer ${token}`);
32
- }
33
- }
34
- return request;
1
+ import { createContentApiClient } from '../content-api/createContentApiClient.js';
2
+ import { warning } from '../utils/log.js';
3
+ export function createStorageClient(config, warn = warning) {
4
+ return createContentApiClient({
5
+ auth: 'contentApiKey' in config ? {
6
+ apiKey: config.contentApiKey,
7
+ mode: 'apiKey'
8
+ } : config.auth,
9
+ baseUrl: config.baseUrl,
10
+ contentSystemId: 'contentSystemId' in config ? config.contentSystemId : '',
11
+ logger: {
12
+ warn
35
13
  }
36
- };
14
+ }).api;
37
15
  }
@@ -7,37 +7,36 @@ import { getHandleUpload } from './handleUpload.js';
7
7
  import { getHandler } from './staticHandler.js';
8
8
  export function contentApiStorageAdapter(config) {
9
9
  return ({ collection, prefix })=>{
10
- const client = createStorageClient(config);
11
10
  const baseUrl = config.baseUrl;
12
- const deleteFile = getDeleteFile({
13
- client
14
- });
11
+ const deleteFile = (args)=>getDeleteFile({
12
+ client: createStorageClient(config, (message)=>args.req.payload.logger.warn(message))
13
+ })(args);
15
14
  return {
16
15
  name: 'content-api',
17
- copyFile: getCopyFile({
18
- client
19
- }),
16
+ copyFile: (args)=>getCopyFile({
17
+ client: createStorageClient(config, (message)=>args.req.payload.logger.warn(message))
18
+ })(args),
20
19
  deleteFile,
21
20
  generateURL: getGenerateURL({
22
21
  baseUrl
23
22
  }),
24
23
  handleDelete: deleteFile,
25
- handleUpload: getHandleUpload({
26
- client,
27
- collection
28
- }),
29
- staticHandler: getHandler({
30
- client,
31
- collection,
32
- prefix
33
- }),
24
+ handleUpload: (args)=>getHandleUpload({
25
+ client: createStorageClient(config, (message)=>args.req.payload.logger.warn(message)),
26
+ collection
27
+ })(args),
28
+ staticHandler: (req, args)=>getHandler({
29
+ client: createStorageClient(config, (message)=>req.payload.logger.warn(message)),
30
+ collection,
31
+ prefix
32
+ })(req, args),
34
33
  uploadInstructions: {
35
34
  enabled: true,
36
- generate: getGenerateUploadInstructions({
37
- access: config.uploadInstructionsAccess,
38
- client,
39
- collectionPrefix: prefix
40
- }),
35
+ generate: (args)=>getGenerateUploadInstructions({
36
+ access: config.uploadInstructionsAccess,
37
+ client: createStorageClient(config, (message)=>args.req.payload.logger.warn(message)),
38
+ collectionPrefix: prefix
39
+ })(args),
41
40
  requiresUploadReceipt: true,
42
41
  useInAdmin: true
43
42
  }
@@ -8,13 +8,16 @@ import { mediaErrorResponse } from './mediaErrorResponse.js';
8
8
  import { resolveDownloadResponseHeaders } from './resolveDownloadResponseHeaders.js';
9
9
  const PRESIGNED_DOWNLOAD_URL_EXPIRES_IN_SECONDS = 300;
10
10
  export const getHandler = ({ client, collection, prefix = '' })=>{
11
- return async (req, { doc, headers, params: { filename, operation, uploadReference } })=>{
11
+ return async (req, { doc, headers, params })=>{
12
+ const { filename, operation, uploadReference } = params;
13
+ const { isOriginal } = params;
12
14
  try {
13
15
  const prefixArgs = {
14
16
  collection,
15
17
  collectionPrefix: prefix,
16
18
  doc,
17
19
  filename,
20
+ isOriginal,
18
21
  req,
19
22
  uploadReference
20
23
  };
@@ -1,9 +1,9 @@
1
1
  import type { UploadInstructionsAccess } from 'payload';
2
- import type { AuthMode } from '../db-content-api/utilities/auth.js';
2
+ import type { ContentApiAuth } from '../content-api/auth.js';
3
3
  export type StorageClientConfig = {
4
4
  uploadInstructionsAccess?: UploadInstructionsAccess;
5
5
  } & ({
6
- auth: AuthMode;
6
+ auth: ContentApiAuth;
7
7
  baseUrl: string;
8
8
  contentSystemId: string;
9
9
  } | {
@@ -1,5 +1,6 @@
1
1
  export declare const arTranslations: {
2
2
  figma: {
3
+ avatar: string;
3
4
  cloudLimitAssetStorageError: string;
4
5
  cloudLimitDocumentCountError: string;
5
6
  cloudLimitDocumentDataSizeError: string;
@@ -8,5 +9,13 @@ export declare const arTranslations: {
8
9
  cloudLimitModalHeading: string;
9
10
  cloudLimitModalRetry: string;
10
11
  cloudLimitModalReviewCollection: string;
12
+ logInWithFigma: string;
13
+ makePermission: string;
14
+ managedByFigma: string;
15
+ profile: string;
16
+ profilePicture: string;
17
+ signingIn: string;
18
+ userGroups: string;
19
+ view: string;
11
20
  };
12
21
  };
@@ -1,5 +1,6 @@
1
1
  export const arTranslations = {
2
2
  figma: {
3
+ avatar: 'الصورة الرمزية',
3
4
  cloudLimitAssetStorageError: 'يتعذر التحميل. يرجى تحرير بعض المساحة للمتابعة.',
4
5
  cloudLimitDocumentCountError: 'غير قادر على إنشاء وثيقة. تم الوصول إلى الحد الأقصى لسعة التخزين.',
5
6
  cloudLimitDocumentDataSizeError: 'تعذر حفظ المستند، النص كبير جدًا.',
@@ -7,6 +8,14 @@ export const arTranslations = {
7
8
  cloudLimitModalConfirm: 'تم فهم ذلك',
8
9
  cloudLimitModalHeading: 'تعذر حفظ المستند',
9
10
  cloudLimitModalRetry: 'إعادة المحاولة',
10
- cloudLimitModalReviewCollection: 'مراجعة {{collection}}'
11
+ cloudLimitModalReviewCollection: 'مراجعة {{collection}}',
12
+ logInWithFigma: 'تسجيل الدخول باستخدام Figma',
13
+ makePermission: 'إذن Make',
14
+ managedByFigma: 'تتم إدارته بواسطة Figma',
15
+ profile: 'الملف الشخصي',
16
+ profilePicture: 'صورة الملف الشخصي',
17
+ signingIn: 'جارٍ تسجيل الدخول',
18
+ userGroups: 'مجموعات المستخدمين',
19
+ view: 'عرض'
11
20
  }
12
21
  };
@@ -1,5 +1,6 @@
1
1
  export declare const azTranslations: {
2
2
  figma: {
3
+ avatar: string;
3
4
  cloudLimitAssetStorageError: string;
4
5
  cloudLimitDocumentCountError: string;
5
6
  cloudLimitDocumentDataSizeError: string;
@@ -8,5 +9,13 @@ export declare const azTranslations: {
8
9
  cloudLimitModalHeading: string;
9
10
  cloudLimitModalRetry: string;
10
11
  cloudLimitModalReviewCollection: string;
12
+ logInWithFigma: string;
13
+ makePermission: string;
14
+ managedByFigma: string;
15
+ profile: string;
16
+ profilePicture: string;
17
+ signingIn: string;
18
+ userGroups: string;
19
+ view: string;
11
20
  };
12
21
  };
@@ -1,5 +1,6 @@
1
1
  export const azTranslations = {
2
2
  figma: {
3
+ avatar: 'Avatar',
3
4
  cloudLimitAssetStorageError: 'Yükləmək mümkün deyil. Davam etmək üçün yer boşaldın.',
4
5
  cloudLimitDocumentCountError: 'Sənəd yaratmaq mümkün deyil. Saxlama limiti aşılmışdır.',
5
6
  cloudLimitDocumentDataSizeError: 'Sənədi saxlamaq mümkün deyil, mətn çox böyükdür.',
@@ -7,6 +8,14 @@ export const azTranslations = {
7
8
  cloudLimitModalConfirm: 'Başa düşdüm',
8
9
  cloudLimitModalHeading: 'Sənədi yadda saxlamaq mümkün olmadı',
9
10
  cloudLimitModalRetry: 'Təkrar cəhd edin',
10
- cloudLimitModalReviewCollection: '{{collection}}-ə baxış'
11
+ cloudLimitModalReviewCollection: '{{collection}}-ə baxış',
12
+ logInWithFigma: 'Figma ilə daxil olun',
13
+ makePermission: 'Make icazəsi',
14
+ managedByFigma: 'Figma tərəfindən idarə olunur',
15
+ profile: 'Profil',
16
+ profilePicture: 'Profil şəkli',
17
+ signingIn: 'Daxil olunur',
18
+ userGroups: 'İstifadəçi qrupları',
19
+ view: 'Baxış'
11
20
  }
12
21
  };
@@ -1,5 +1,6 @@
1
1
  export declare const bgTranslations: {
2
2
  figma: {
3
+ avatar: string;
3
4
  cloudLimitAssetStorageError: string;
4
5
  cloudLimitDocumentCountError: string;
5
6
  cloudLimitDocumentDataSizeError: string;
@@ -8,5 +9,13 @@ export declare const bgTranslations: {
8
9
  cloudLimitModalHeading: string;
9
10
  cloudLimitModalRetry: string;
10
11
  cloudLimitModalReviewCollection: string;
12
+ logInWithFigma: string;
13
+ makePermission: string;
14
+ managedByFigma: string;
15
+ profile: string;
16
+ profilePicture: string;
17
+ signingIn: string;
18
+ userGroups: string;
19
+ view: string;
11
20
  };
12
21
  };
@@ -1,5 +1,6 @@
1
1
  export const bgTranslations = {
2
2
  figma: {
3
+ avatar: 'Аватар',
3
4
  cloudLimitAssetStorageError: 'Не може да се качи. Освободете пространство, за да продължите.',
4
5
  cloudLimitDocumentCountError: 'Неуспешно създаване на документ. Достигнат е лимитът за съхранение.',
5
6
  cloudLimitDocumentDataSizeError: 'Неуспешно записване на документа, текстът е твърде голям.',
@@ -7,6 +8,14 @@ export const bgTranslations = {
7
8
  cloudLimitModalConfirm: 'Разбрах',
8
9
  cloudLimitModalHeading: 'Неуспешно запазване на документа',
9
10
  cloudLimitModalRetry: 'Опитайте отново.',
10
- cloudLimitModalReviewCollection: 'Преглед на {{collection}}'
11
+ cloudLimitModalReviewCollection: 'Преглед на {{collection}}',
12
+ logInWithFigma: 'Вход с Figma',
13
+ makePermission: 'Разрешение за Make',
14
+ managedByFigma: 'Управлява се от Figma',
15
+ profile: 'Профил',
16
+ profilePicture: 'Профилна снимка',
17
+ signingIn: 'Влизане',
18
+ userGroups: 'Потребителски групи',
19
+ view: 'Преглед'
11
20
  }
12
21
  };
@@ -1,5 +1,6 @@
1
1
  export declare const bnBdTranslations: {
2
2
  figma: {
3
+ avatar: string;
3
4
  cloudLimitAssetStorageError: string;
4
5
  cloudLimitDocumentCountError: string;
5
6
  cloudLimitDocumentDataSizeError: string;
@@ -8,5 +9,13 @@ export declare const bnBdTranslations: {
8
9
  cloudLimitModalHeading: string;
9
10
  cloudLimitModalRetry: string;
10
11
  cloudLimitModalReviewCollection: string;
12
+ logInWithFigma: string;
13
+ makePermission: string;
14
+ managedByFigma: string;
15
+ profile: string;
16
+ profilePicture: string;
17
+ signingIn: string;
18
+ userGroups: string;
19
+ view: string;
11
20
  };
12
21
  };
@@ -1,5 +1,6 @@
1
1
  export const bnBdTranslations = {
2
2
  figma: {
3
+ avatar: 'অ্যাভাটার',
3
4
  cloudLimitAssetStorageError: 'আপলোড করা সম্ভব হচ্ছে না। চালিয়ে যেতে হলে স্থান খালি করুন।',
4
5
  cloudLimitDocumentCountError: 'দস্তাবেজ তৈরি করা সম্ভব নয়। সংরক্ষণ সীমা অতিক্রম করা হয়েছে।',
5
6
  cloudLimitDocumentDataSizeError: 'ডকুমেন্ট সংরক্ষণ করা সম্ভব নয়, কারণ পাঠ্যটি খুব বড়।',
@@ -7,6 +8,14 @@ export const bnBdTranslations = {
7
8
  cloudLimitModalConfirm: 'বুঝেছি',
8
9
  cloudLimitModalHeading: 'ডকুমেন্ট সংরক্ষণ করা যায়নি',
9
10
  cloudLimitModalRetry: 'পুনঃচেষ্টা করুন',
10
- cloudLimitModalReviewCollection: '{{collection}} পর্যালোচনা করুন'
11
+ cloudLimitModalReviewCollection: '{{collection}} পর্যালোচনা করুন',
12
+ logInWithFigma: 'Figma দিয়ে লগ ইন করুন',
13
+ makePermission: 'Make-এর অনুমতি',
14
+ managedByFigma: 'Figma দ্বারা পরিচালিত',
15
+ profile: 'প্রোফাইল',
16
+ profilePicture: 'প্রোফাইল ছবি',
17
+ signingIn: 'লগ ইন করা হচ্ছে',
18
+ userGroups: 'ব্যবহারকারী গোষ্ঠী',
19
+ view: 'দেখুন'
11
20
  }
12
21
  };
@@ -1,5 +1,6 @@
1
1
  export declare const bnInTranslations: {
2
2
  figma: {
3
+ avatar: string;
3
4
  cloudLimitAssetStorageError: string;
4
5
  cloudLimitDocumentCountError: string;
5
6
  cloudLimitDocumentDataSizeError: string;
@@ -8,5 +9,13 @@ export declare const bnInTranslations: {
8
9
  cloudLimitModalHeading: string;
9
10
  cloudLimitModalRetry: string;
10
11
  cloudLimitModalReviewCollection: string;
12
+ logInWithFigma: string;
13
+ makePermission: string;
14
+ managedByFigma: string;
15
+ profile: string;
16
+ profilePicture: string;
17
+ signingIn: string;
18
+ userGroups: string;
19
+ view: string;
11
20
  };
12
21
  };
@@ -1,5 +1,6 @@
1
1
  export const bnInTranslations = {
2
2
  figma: {
3
+ avatar: 'অ্যাভাটার',
3
4
  cloudLimitAssetStorageError: 'আপলোড করা সম্ভব হচ্ছে না। চালিয়ে যেতে হলে স্থান খালি করুন।',
4
5
  cloudLimitDocumentCountError: 'ডকুমেন্ট তৈরি করা সম্ভব হয়নি। সংরক্ষণ সীমা অতিক্রম করা হয়েছে।',
5
6
  cloudLimitDocumentDataSizeError: 'নথিটি সংরক্ষণ করা সম্ভব নয়, কারণ টেক্সটের আকার অত্যন্ত বড়।',
@@ -7,6 +8,14 @@ export const bnInTranslations = {
7
8
  cloudLimitModalConfirm: 'বুঝেছি',
8
9
  cloudLimitModalHeading: 'ডকুমেন্ট সংরক্ষণ করা যায়নি',
9
10
  cloudLimitModalRetry: 'পুনরায় চেষ্টা করুন',
10
- cloudLimitModalReviewCollection: '{{collection}} পর্যালোচনা করুন'
11
+ cloudLimitModalReviewCollection: '{{collection}} পর্যালোচনা করুন',
12
+ logInWithFigma: 'Figma দিয়ে লগ ইন করুন',
13
+ makePermission: 'Make-এর অনুমতি',
14
+ managedByFigma: 'Figma দ্বারা পরিচালিত',
15
+ profile: 'প্রোফাইল',
16
+ profilePicture: 'প্রোফাইল ছবি',
17
+ signingIn: 'লগ ইন করা হচ্ছে',
18
+ userGroups: 'ব্যবহারকারী গোষ্ঠী',
19
+ view: 'দেখুন'
11
20
  }
12
21
  };
@@ -1,5 +1,6 @@
1
1
  export declare const caTranslations: {
2
2
  figma: {
3
+ avatar: string;
3
4
  cloudLimitAssetStorageError: string;
4
5
  cloudLimitDocumentCountError: string;
5
6
  cloudLimitDocumentDataSizeError: string;
@@ -8,5 +9,13 @@ export declare const caTranslations: {
8
9
  cloudLimitModalHeading: string;
9
10
  cloudLimitModalRetry: string;
10
11
  cloudLimitModalReviewCollection: string;
12
+ logInWithFigma: string;
13
+ makePermission: string;
14
+ managedByFigma: string;
15
+ profile: string;
16
+ profilePicture: string;
17
+ signingIn: string;
18
+ userGroups: string;
19
+ view: string;
11
20
  };
12
21
  };