@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
@@ -1,82 +0,0 @@
1
- import { getValidProjectToken } from '../../auth/project-token.js';
2
- // Module-level cache for dev JWT tokens
3
- const devJwtCache = new Map();
4
- export async function fetchDevJwt(url, contentSystemId) {
5
- const usesSuperUser = !contentSystemId || contentSystemId === 'test-system' || contentSystemId === '*';
6
- const contentSystemIdForJWT = usesSuperUser ? '*' : contentSystemId;
7
- const response = await fetch(`${url}/dev/jwt`, {
8
- body: JSON.stringify({
9
- content_system_id: contentSystemIdForJWT
10
- }),
11
- headers: {
12
- 'Content-Type': 'application/json'
13
- },
14
- method: 'POST'
15
- });
16
- if (!response.ok) {
17
- throw new Error(`Failed to get dev JWT: ${response.status} ${response.statusText}`);
18
- }
19
- const { token } = await response.json();
20
- return token;
21
- }
22
- export function createAuthMiddleware(opts) {
23
- return {
24
- async onRequest ({ request }) {
25
- if (opts.auth.mode === 'apiKey') {
26
- request.headers.set('X-Api-Key', opts.auth.apiKey);
27
- } else if (opts.auth.mode === 'tokenStore') {
28
- const token = await getValidProjectToken({
29
- tenantId: opts.contentSystemId,
30
- tokenStore: opts.auth.tokenStore
31
- });
32
- if (!token) {
33
- throw new Error('Authentication required. Run `npx @payloadcms/figma login` to authenticate.');
34
- }
35
- request.headers.set('Authorization', `Bearer ${token}`);
36
- } else {
37
- let token = devJwtCache.get(opts.contentSystemId);
38
- if (!token) {
39
- token = await fetchDevJwt(opts.url, opts.contentSystemId);
40
- devJwtCache.set(opts.contentSystemId, token);
41
- opts.logger.info(`Dev JWT acquired for content system: ${opts.contentSystemId}`);
42
- }
43
- request.headers.set('Authorization', `Bearer ${token}`);
44
- }
45
- return request;
46
- }
47
- };
48
- }
49
- export function createErrorMiddleware(opts) {
50
- return {
51
- async onResponse ({ request, response }) {
52
- if (!response.ok) {
53
- // Handle 401 retry for dev JWT
54
- if (response.status === 401 && opts.auth.mode === 'devJwt') {
55
- const retryCount = parseInt(request.headers.get('X-Retry-Count') || '0', 10);
56
- if (retryCount < 1) {
57
- opts.logger.info('Dev JWT expired, refreshing...');
58
- devJwtCache.delete(opts.contentSystemId);
59
- const newToken = await fetchDevJwt(opts.url, opts.contentSystemId);
60
- devJwtCache.set(opts.contentSystemId, newToken);
61
- // duplex: 'half' is required for Node.js fetch with streaming body
62
- const newRequest = new Request(request.url, {
63
- body: request.body,
64
- duplex: 'half',
65
- headers: new Headers(request.headers),
66
- method: request.method
67
- });
68
- newRequest.headers.set('X-Retry-Count', '1');
69
- newRequest.headers.set('Authorization', `Bearer ${newToken}`);
70
- return fetch(newRequest);
71
- }
72
- }
73
- const text = await response.clone().text();
74
- opts.logger.error({
75
- msg: `HTTP ${response.status} from ${request.url}`,
76
- response: text
77
- });
78
- }
79
- return response;
80
- }
81
- };
82
- }