@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.
- package/dist/adapters/build-lambda-zip.d.ts +2 -1
- package/dist/adapters/build-lambda-zip.js +4 -1
- package/dist/adapters/deploy-output/assertDeployableServerActionsKey.d.ts +14 -0
- package/dist/adapters/deploy-output/assertDeployableServerActionsKey.js +33 -0
- package/dist/commands/upload-schema.js +23 -9
- package/dist/content-api/auth.d.ts +34 -0
- package/dist/content-api/auth.js +70 -0
- package/dist/content-api/awaitWithSignal.d.ts +2 -0
- package/dist/content-api/awaitWithSignal.js +27 -0
- package/dist/content-api/createContentApiClient.d.ts +18 -0
- package/dist/content-api/createContentApiClient.js +90 -0
- package/dist/content-api/withRateLimitRetries.d.ts +7 -0
- package/dist/content-api/withRateLimitRetries.js +45 -0
- package/dist/db-content-api/generated/content-api-types.d.ts +247 -0
- package/dist/db-content-api/index.d.ts +5 -5
- package/dist/db-content-api/index.js +46 -16
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/oauth/components/FigmaAvatar/index.js +3 -2
- package/dist/oauth/components/FigmaAvatarCell/index.js +3 -1
- package/dist/oauth/components/LoginButton/index.js +8 -4
- package/dist/oauth/components/LogoutButton/index.js +3 -2
- package/dist/oauth/defaults.js +2 -2
- package/dist/oauth/endpoints/getLoginEndpoint.js +2 -5
- package/dist/oauth/hooks/me.d.ts +4 -3
- package/dist/oauth/hooks/me.js +6 -52
- package/dist/oauth/hooks/refresh.js +9 -1
- package/dist/oauth/index.js +3 -3
- package/dist/oauth/strategy/index.d.ts +3 -0
- package/dist/oauth/strategy/index.js +49 -3
- package/dist/oauth/utilities/clearCookie.d.ts +1 -0
- package/dist/oauth/utilities/clearCookie.js +13 -9
- package/dist/oauth/utilities/clearSessionCookies.d.ts +5 -0
- package/dist/oauth/utilities/clearSessionCookies.js +17 -0
- package/dist/oauth/utilities/getAuthorizeURL.js +1 -2
- package/dist/oauth/utilities/mergeHeaders.js +11 -23
- package/dist/oauth/utilities/refreshTokens.d.ts +9 -3
- package/dist/oauth/utilities/refreshTokens.js +45 -34
- package/dist/oauth/utilities/resolvePayloadRedirect.d.ts +13 -0
- package/dist/oauth/utilities/resolvePayloadRedirect.js +30 -0
- package/dist/plugin/build-config.js +16 -13
- package/dist/plugin/cloud-limits/CloudLimitModal/index.js +1 -1
- package/dist/plugin/cloud-limits/shared.d.ts +5 -1
- package/dist/plugin/cloud-limits/utilities/toasts.d.ts +2 -1
- package/dist/plugin/dev-cookie-names.d.ts +4 -1
- package/dist/plugin/dev-cookie-names.js +6 -3
- package/dist/plugin/environment-error.d.ts +4 -0
- package/dist/plugin/environment-error.js +22 -0
- package/dist/plugin/mcp-oauth.d.ts +10 -0
- package/dist/plugin/mcp-oauth.js +24 -0
- package/dist/plugin/sandbox-upload-fetch.d.ts +5 -6
- package/dist/plugin/sandbox-upload-fetch.js +22 -14
- package/dist/scss.d.js +1 -1
- package/dist/storage-content-api/api-types.d.ts +22 -1
- package/dist/storage-content-api/api-types.js +2 -1
- package/dist/storage-content-api/client.d.ts +3 -3
- package/dist/storage-content-api/client.js +13 -35
- package/dist/storage-content-api/index.js +20 -21
- package/dist/storage-content-api/staticHandler.js +4 -1
- package/dist/storage-content-api/types.d.ts +2 -2
- package/dist/translations/ar.d.ts +9 -0
- package/dist/translations/ar.js +10 -1
- package/dist/translations/az.d.ts +9 -0
- package/dist/translations/az.js +10 -1
- package/dist/translations/bg.d.ts +9 -0
- package/dist/translations/bg.js +10 -1
- package/dist/translations/bnBd.d.ts +9 -0
- package/dist/translations/bnBd.js +10 -1
- package/dist/translations/bnIn.d.ts +9 -0
- package/dist/translations/bnIn.js +10 -1
- package/dist/translations/ca.d.ts +9 -0
- package/dist/translations/ca.js +10 -1
- package/dist/translations/cs.d.ts +9 -0
- package/dist/translations/cs.js +10 -1
- package/dist/translations/da.d.ts +9 -0
- package/dist/translations/da.js +10 -1
- package/dist/translations/de.d.ts +9 -0
- package/dist/translations/de.js +10 -1
- package/dist/translations/en.d.ts +9 -0
- package/dist/translations/en.js +10 -1
- package/dist/translations/es.d.ts +9 -0
- package/dist/translations/es.js +15 -6
- package/dist/translations/et.d.ts +9 -0
- package/dist/translations/et.js +10 -1
- package/dist/translations/fa.d.ts +9 -0
- package/dist/translations/fa.js +10 -1
- package/dist/translations/fr.d.ts +9 -0
- package/dist/translations/fr.js +10 -1
- package/dist/translations/he.d.ts +9 -0
- package/dist/translations/he.js +10 -1
- package/dist/translations/hr.d.ts +9 -0
- package/dist/translations/hr.js +10 -1
- package/dist/translations/hu.d.ts +9 -0
- package/dist/translations/hu.js +10 -1
- package/dist/translations/hy.d.ts +9 -0
- package/dist/translations/hy.js +10 -1
- package/dist/translations/id.d.ts +9 -0
- package/dist/translations/id.js +10 -1
- package/dist/translations/index.d.ts +400 -3
- package/dist/translations/is.d.ts +9 -0
- package/dist/translations/is.js +10 -1
- package/dist/translations/it.d.ts +9 -0
- package/dist/translations/it.js +10 -1
- package/dist/translations/ja.d.ts +9 -0
- package/dist/translations/ja.js +14 -5
- package/dist/translations/ko.d.ts +9 -0
- package/dist/translations/ko.js +16 -7
- package/dist/translations/lt.d.ts +9 -0
- package/dist/translations/lt.js +10 -1
- package/dist/translations/lv.d.ts +9 -0
- package/dist/translations/lv.js +10 -1
- package/dist/translations/my.d.ts +9 -0
- package/dist/translations/my.js +10 -1
- package/dist/translations/nb.d.ts +9 -0
- package/dist/translations/nb.js +10 -1
- package/dist/translations/nl.d.ts +9 -0
- package/dist/translations/nl.js +10 -1
- package/dist/translations/pl.d.ts +9 -0
- package/dist/translations/pl.js +10 -1
- package/dist/translations/pt.d.ts +9 -0
- package/dist/translations/pt.js +15 -6
- package/dist/translations/ro.d.ts +9 -0
- package/dist/translations/ro.js +10 -1
- package/dist/translations/rs.d.ts +9 -0
- package/dist/translations/rs.js +10 -1
- package/dist/translations/rsLatin.d.ts +9 -0
- package/dist/translations/rsLatin.js +10 -1
- package/dist/translations/ru.d.ts +9 -0
- package/dist/translations/ru.js +10 -1
- package/dist/translations/sk.d.ts +9 -0
- package/dist/translations/sk.js +10 -1
- package/dist/translations/sl.d.ts +9 -0
- package/dist/translations/sl.js +10 -1
- package/dist/translations/sv.d.ts +9 -0
- package/dist/translations/sv.js +10 -1
- package/dist/translations/ta.d.ts +9 -0
- package/dist/translations/ta.js +10 -1
- package/dist/translations/th.d.ts +9 -0
- package/dist/translations/th.js +10 -1
- package/dist/translations/tr.d.ts +9 -0
- package/dist/translations/tr.js +10 -1
- package/dist/translations/uk.d.ts +9 -0
- package/dist/translations/uk.js +10 -1
- package/dist/translations/vi.d.ts +9 -0
- package/dist/translations/vi.js +10 -1
- package/dist/translations/zh.d.ts +9 -0
- package/dist/translations/zh.js +10 -1
- package/dist/translations/zhTw.d.ts +9 -0
- package/dist/translations/zhTw.js +10 -1
- package/dist/utils/env-management.js +7 -0
- package/package.json +20 -22
- package/dist/db-content-api/utilities/auth.d.ts +0 -29
- 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:
|
|
15
|
-
userInfoCookieName:
|
|
17
|
+
cookieName: `${cookiePrefix}-figma-${suffix}-oauth-token`,
|
|
18
|
+
userInfoCookieName: `${cookiePrefix}-figma-${suffix}-user-info`
|
|
16
19
|
};
|
|
17
20
|
}
|
|
@@ -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
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
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
|
-
*
|
|
28
|
-
*
|
|
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
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
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
|
-
*
|
|
21
|
-
*
|
|
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
|
|
31
|
+
if (!collection.upload) {
|
|
32
32
|
return collection;
|
|
33
33
|
}
|
|
34
|
-
|
|
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
|
-
|
|
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 (
|
|
45
|
-
|
|
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
|
-
|
|
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/
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
5
|
-
export
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
staticHandler: getHandler({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
|
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 {
|
|
2
|
+
import type { ContentApiAuth } from '../content-api/auth.js';
|
|
3
3
|
export type StorageClientConfig = {
|
|
4
4
|
uploadInstructionsAccess?: UploadInstructionsAccess;
|
|
5
5
|
} & ({
|
|
6
|
-
auth:
|
|
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
|
};
|
package/dist/translations/ar.js
CHANGED
|
@@ -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
|
};
|
package/dist/translations/az.js
CHANGED
|
@@ -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
|
};
|
package/dist/translations/bg.js
CHANGED
|
@@ -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
|
};
|