@payloadcms/figma 0.0.1-alpha.38-2 → 0.0.1-alpha.4

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 (264) hide show
  1. package/dist/api/control-plane.d.ts +1 -22
  2. package/dist/api/control-plane.d.ts.map +1 -1
  3. package/dist/api/control-plane.js +22 -55
  4. package/dist/api/control-plane.js.map +1 -1
  5. package/dist/api/figma-api.d.ts.map +1 -1
  6. package/dist/api/figma-api.js +26 -45
  7. package/dist/api/figma-api.js.map +1 -1
  8. package/dist/auth/callback-server.d.ts.map +1 -1
  9. package/dist/auth/callback-server.js +1 -2
  10. package/dist/auth/callback-server.js.map +1 -1
  11. package/dist/auth/crypto-utils.d.ts.map +1 -1
  12. package/dist/auth/crypto-utils.js +5 -5
  13. package/dist/auth/crypto-utils.js.map +1 -1
  14. package/dist/auth/jwt-validator.d.ts +1 -2
  15. package/dist/auth/jwt-validator.d.ts.map +1 -1
  16. package/dist/auth/jwt-validator.js +2 -2
  17. package/dist/auth/jwt-validator.js.map +1 -1
  18. package/dist/auth/oauth-flow.d.ts +1 -1
  19. package/dist/auth/oauth-flow.d.ts.map +1 -1
  20. package/dist/auth/oauth-flow.js +8 -9
  21. package/dist/auth/oauth-flow.js.map +1 -1
  22. package/dist/auth/project-token.d.ts.map +1 -1
  23. package/dist/auth/project-token.js +4 -9
  24. package/dist/auth/project-token.js.map +1 -1
  25. package/dist/auth/refresh.d.ts.map +1 -1
  26. package/dist/auth/refresh.js +9 -14
  27. package/dist/auth/refresh.js.map +1 -1
  28. package/dist/auth/token-store.d.ts +0 -10
  29. package/dist/auth/token-store.d.ts.map +1 -1
  30. package/dist/auth/token-store.js +0 -20
  31. package/dist/auth/token-store.js.map +1 -1
  32. package/dist/cli.d.ts.map +1 -1
  33. package/dist/cli.js +0 -22
  34. package/dist/cli.js.map +1 -1
  35. package/dist/commands/deploy.d.ts +0 -4
  36. package/dist/commands/deploy.d.ts.map +1 -1
  37. package/dist/commands/deploy.js +129 -71
  38. package/dist/commands/deploy.js.map +1 -1
  39. package/dist/commands/init.d.ts +5 -1
  40. package/dist/commands/init.d.ts.map +1 -1
  41. package/dist/commands/init.js +85 -90
  42. package/dist/commands/init.js.map +1 -1
  43. package/dist/commands/list-tokens.d.ts.map +1 -1
  44. package/dist/commands/list-tokens.js +3 -6
  45. package/dist/commands/list-tokens.js.map +1 -1
  46. package/dist/commands/login.d.ts +1 -8
  47. package/dist/commands/login.d.ts.map +1 -1
  48. package/dist/commands/login.js +11 -21
  49. package/dist/commands/login.js.map +1 -1
  50. package/dist/commands/logout.js +2 -2
  51. package/dist/commands/logout.js.map +1 -1
  52. package/dist/config/oauth.d.ts +14 -4
  53. package/dist/config/oauth.d.ts.map +1 -1
  54. package/dist/config/oauth.js +40 -19
  55. package/dist/config/oauth.js.map +1 -1
  56. package/dist/constants.d.ts +18 -26
  57. package/dist/constants.d.ts.map +1 -1
  58. package/dist/constants.js +20 -34
  59. package/dist/constants.js.map +1 -1
  60. package/dist/index.d.ts +1 -2
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +1 -3
  63. package/dist/index.js.map +1 -1
  64. package/dist/oauth/components/LoginButton/index.d.ts.map +1 -1
  65. package/dist/oauth/components/LoginButton/index.js +6 -50
  66. package/dist/oauth/components/LoginButton/index.js.map +1 -1
  67. package/dist/oauth/components/LoginButton/index.scss +3 -50
  68. package/dist/oauth/components/LogoutButton/index.d.ts.map +1 -1
  69. package/dist/oauth/components/LogoutButton/index.js +1 -0
  70. package/dist/oauth/components/LogoutButton/index.js.map +1 -1
  71. package/dist/oauth/defaults.d.ts.map +1 -1
  72. package/dist/oauth/defaults.js +5 -29
  73. package/dist/oauth/defaults.js.map +1 -1
  74. package/dist/oauth/endpoints/getLoginEndpoint.d.ts.map +1 -1
  75. package/dist/oauth/endpoints/getLoginEndpoint.js +4 -4
  76. package/dist/oauth/endpoints/getLoginEndpoint.js.map +1 -1
  77. package/dist/oauth/index.d.ts.map +1 -1
  78. package/dist/oauth/index.js +7 -42
  79. package/dist/oauth/index.js.map +1 -1
  80. package/dist/oauth/strategy/index.d.ts +2 -0
  81. package/dist/oauth/strategy/index.d.ts.map +1 -1
  82. package/dist/oauth/strategy/index.js +15 -38
  83. package/dist/oauth/strategy/index.js.map +1 -1
  84. package/dist/oauth/types.d.ts +6 -6
  85. package/dist/oauth/types.d.ts.map +1 -1
  86. package/dist/oauth/types.js.map +1 -1
  87. package/dist/oauth/utilities/createCookieOptions.d.ts.map +1 -1
  88. package/dist/oauth/utilities/createCookieOptions.js.map +1 -1
  89. package/dist/oauth/utilities/refreshTokens.d.ts.map +1 -1
  90. package/dist/oauth/utilities/refreshTokens.js +1 -1
  91. package/dist/oauth/utilities/refreshTokens.js.map +1 -1
  92. package/dist/plugin/build-config.d.ts +4 -21
  93. package/dist/plugin/build-config.d.ts.map +1 -1
  94. package/dist/plugin/build-config.js +8 -114
  95. package/dist/plugin/build-config.js.map +1 -1
  96. package/dist/types.d.ts +0 -1
  97. package/dist/types.d.ts.map +1 -1
  98. package/dist/types.js.map +1 -1
  99. package/dist/utils/asset-collection.d.ts +6 -3
  100. package/dist/utils/asset-collection.d.ts.map +1 -1
  101. package/dist/utils/asset-collection.js +34 -10
  102. package/dist/utils/asset-collection.js.map +1 -1
  103. package/dist/utils/config.js +1 -1
  104. package/dist/utils/config.js.map +1 -1
  105. package/dist/utils/env-management.d.ts +8 -9
  106. package/dist/utils/env-management.d.ts.map +1 -1
  107. package/dist/utils/env-management.js +74 -73
  108. package/dist/utils/env-management.js.map +1 -1
  109. package/dist/utils/formatter.d.ts.map +1 -1
  110. package/dist/utils/formatter.js +5 -3
  111. package/dist/utils/formatter.js.map +1 -1
  112. package/dist/utils/lambda-config.d.ts +1 -3
  113. package/dist/utils/lambda-config.d.ts.map +1 -1
  114. package/dist/utils/lambda-config.js +21 -13
  115. package/dist/utils/lambda-config.js.map +1 -1
  116. package/dist/utils/messages.js +7 -7
  117. package/dist/utils/messages.js.map +1 -1
  118. package/dist/utils/payload-config-ast.d.ts +3 -22
  119. package/dist/utils/payload-config-ast.d.ts.map +1 -1
  120. package/dist/utils/payload-config-ast.js +31 -89
  121. package/dist/utils/payload-config-ast.js.map +1 -1
  122. package/dist/utils/payload-config-finder.d.ts +2 -2
  123. package/dist/utils/payload-config-finder.d.ts.map +1 -1
  124. package/dist/utils/payload-config-finder.js +9 -48
  125. package/dist/utils/payload-config-finder.js.map +1 -1
  126. package/dist/utils/payload-config-modifier.d.ts.map +1 -1
  127. package/dist/utils/payload-config-modifier.js +6 -54
  128. package/dist/utils/payload-config-modifier.js.map +1 -1
  129. package/dist/utils/payload-package-check.d.ts +1 -12
  130. package/dist/utils/payload-package-check.d.ts.map +1 -1
  131. package/dist/utils/payload-package-check.js +5 -63
  132. package/dist/utils/payload-package-check.js.map +1 -1
  133. package/dist/utils/project.d.ts.map +1 -1
  134. package/dist/utils/project.js +5 -8
  135. package/dist/utils/project.js.map +1 -1
  136. package/dist/utils/s3-upload.d.ts +1 -0
  137. package/dist/utils/s3-upload.d.ts.map +1 -1
  138. package/dist/utils/s3-upload.js +3 -10
  139. package/dist/utils/s3-upload.js.map +1 -1
  140. package/dist/utils/token-display.d.ts.map +1 -1
  141. package/dist/utils/token-display.js +5 -11
  142. package/dist/utils/token-display.js.map +1 -1
  143. package/dist/utils/typescript-validator.d.ts.map +1 -1
  144. package/dist/utils/typescript-validator.js +6 -4
  145. package/dist/utils/typescript-validator.js.map +1 -1
  146. package/package.json +7 -31
  147. package/dist/commands/build-lambda-zip.d.ts +0 -5
  148. package/dist/commands/build-lambda-zip.d.ts.map +0 -1
  149. package/dist/commands/build-lambda-zip.js +0 -19
  150. package/dist/commands/build-lambda-zip.js.map +0 -1
  151. package/dist/db-content-api/README.md +0 -98
  152. package/dist/db-content-api/generated/content-api-types.d.ts +0 -3848
  153. package/dist/db-content-api/generated/content-api-types.d.ts.map +0 -1
  154. package/dist/db-content-api/generated/content-api-types.js +0 -7
  155. package/dist/db-content-api/generated/content-api-types.js.map +0 -1
  156. package/dist/db-content-api/index.d.ts +0 -18
  157. package/dist/db-content-api/index.d.ts.map +0 -1
  158. package/dist/db-content-api/index.js +0 -571
  159. package/dist/db-content-api/index.js.map +0 -1
  160. package/dist/db-content-api/temp-utilities/pagination.d.ts +0 -13
  161. package/dist/db-content-api/temp-utilities/pagination.d.ts.map +0 -1
  162. package/dist/db-content-api/temp-utilities/pagination.js +0 -45
  163. package/dist/db-content-api/temp-utilities/pagination.js.map +0 -1
  164. package/dist/db-content-api/temp-utilities/slug.d.ts +0 -2
  165. package/dist/db-content-api/temp-utilities/slug.d.ts.map +0 -1
  166. package/dist/db-content-api/temp-utilities/slug.js +0 -3
  167. package/dist/db-content-api/temp-utilities/slug.js.map +0 -1
  168. package/dist/db-content-api/temp-utilities/sorting.d.ts +0 -3
  169. package/dist/db-content-api/temp-utilities/sorting.d.ts.map +0 -1
  170. package/dist/db-content-api/temp-utilities/sorting.js +0 -32
  171. package/dist/db-content-api/temp-utilities/sorting.js.map +0 -1
  172. package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +0 -4
  173. package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts.map +0 -1
  174. package/dist/db-content-api/temp-utilities/unwrapDocument.js +0 -53
  175. package/dist/db-content-api/temp-utilities/unwrapDocument.js.map +0 -1
  176. package/dist/db-content-api/utilities/auth.d.ts +0 -30
  177. package/dist/db-content-api/utilities/auth.d.ts.map +0 -1
  178. package/dist/db-content-api/utilities/auth.js +0 -81
  179. package/dist/db-content-api/utilities/auth.js.map +0 -1
  180. package/dist/db-content-api/utilities/data/applyDefaults.d.ts +0 -7
  181. package/dist/db-content-api/utilities/data/applyDefaults.d.ts.map +0 -1
  182. package/dist/db-content-api/utilities/data/applyDefaults.js +0 -59
  183. package/dist/db-content-api/utilities/data/applyDefaults.js.map +0 -1
  184. package/dist/db-content-api/utilities/data/castFieldValue.d.ts +0 -11
  185. package/dist/db-content-api/utilities/data/castFieldValue.d.ts.map +0 -1
  186. package/dist/db-content-api/utilities/data/castFieldValue.js +0 -66
  187. package/dist/db-content-api/utilities/data/castFieldValue.js.map +0 -1
  188. package/dist/db-content-api/utilities/data/index.d.ts +0 -30
  189. package/dist/db-content-api/utilities/data/index.d.ts.map +0 -1
  190. package/dist/db-content-api/utilities/data/index.js +0 -173
  191. package/dist/db-content-api/utilities/data/index.js.map +0 -1
  192. package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +0 -12
  193. package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts.map +0 -1
  194. package/dist/db-content-api/utilities/data/removeVirtualFields.js +0 -54
  195. package/dist/db-content-api/utilities/data/removeVirtualFields.js.map +0 -1
  196. package/dist/db-content-api/utilities/data/stripFields.d.ts +0 -48
  197. package/dist/db-content-api/utilities/data/stripFields.d.ts.map +0 -1
  198. package/dist/db-content-api/utilities/data/stripFields.js +0 -195
  199. package/dist/db-content-api/utilities/data/stripFields.js.map +0 -1
  200. package/dist/db-content-api/utilities/joins.d.ts +0 -55
  201. package/dist/db-content-api/utilities/joins.d.ts.map +0 -1
  202. package/dist/db-content-api/utilities/joins.js +0 -136
  203. package/dist/db-content-api/utilities/joins.js.map +0 -1
  204. package/dist/db-content-api/utilities/where.d.ts +0 -12
  205. package/dist/db-content-api/utilities/where.d.ts.map +0 -1
  206. package/dist/db-content-api/utilities/where.js +0 -107
  207. package/dist/db-content-api/utilities/where.js.map +0 -1
  208. package/dist/endpoints/health.d.ts +0 -3
  209. package/dist/endpoints/health.d.ts.map +0 -1
  210. package/dist/endpoints/health.js +0 -11
  211. package/dist/endpoints/health.js.map +0 -1
  212. package/dist/exports/client.d.ts +0 -4
  213. package/dist/exports/client.d.ts.map +0 -1
  214. package/dist/exports/client.js +0 -5
  215. package/dist/exports/client.js.map +0 -1
  216. package/dist/oauth/utilities/isDuplicateKeyError.d.ts +0 -7
  217. package/dist/oauth/utilities/isDuplicateKeyError.d.ts.map +0 -1
  218. package/dist/oauth/utilities/isDuplicateKeyError.js +0 -14
  219. package/dist/oauth/utilities/isDuplicateKeyError.js.map +0 -1
  220. package/dist/storage-content-api/api-types.d.ts +0 -161
  221. package/dist/storage-content-api/api-types.d.ts.map +0 -1
  222. package/dist/storage-content-api/api-types.js +0 -6
  223. package/dist/storage-content-api/api-types.js.map +0 -1
  224. package/dist/storage-content-api/client-uploads/ClientUploadHandler.d.ts +0 -9
  225. package/dist/storage-content-api/client-uploads/ClientUploadHandler.d.ts.map +0 -1
  226. package/dist/storage-content-api/client-uploads/ClientUploadHandler.js +0 -42
  227. package/dist/storage-content-api/client-uploads/ClientUploadHandler.js.map +0 -1
  228. package/dist/storage-content-api/client-uploads/generateSignedURL.d.ts +0 -13
  229. package/dist/storage-content-api/client-uploads/generateSignedURL.d.ts.map +0 -1
  230. package/dist/storage-content-api/client-uploads/generateSignedURL.js +0 -31
  231. package/dist/storage-content-api/client-uploads/generateSignedURL.js.map +0 -1
  232. package/dist/storage-content-api/client.d.ts +0 -6
  233. package/dist/storage-content-api/client.d.ts.map +0 -1
  234. package/dist/storage-content-api/client.js +0 -36
  235. package/dist/storage-content-api/client.js.map +0 -1
  236. package/dist/storage-content-api/generateURL.d.ts +0 -7
  237. package/dist/storage-content-api/generateURL.d.ts.map +0 -1
  238. package/dist/storage-content-api/generateURL.js +0 -7
  239. package/dist/storage-content-api/generateURL.js.map +0 -1
  240. package/dist/storage-content-api/handleDelete.d.ts +0 -8
  241. package/dist/storage-content-api/handleDelete.d.ts.map +0 -1
  242. package/dist/storage-content-api/handleDelete.js +0 -15
  243. package/dist/storage-content-api/handleDelete.js.map +0 -1
  244. package/dist/storage-content-api/handleUpload.d.ts +0 -11
  245. package/dist/storage-content-api/handleUpload.d.ts.map +0 -1
  246. package/dist/storage-content-api/handleUpload.js +0 -136
  247. package/dist/storage-content-api/handleUpload.js.map +0 -1
  248. package/dist/storage-content-api/index.d.ts +0 -5
  249. package/dist/storage-content-api/index.d.ts.map +0 -1
  250. package/dist/storage-content-api/index.js +0 -31
  251. package/dist/storage-content-api/index.js.map +0 -1
  252. package/dist/storage-content-api/staticHandler.d.ts +0 -10
  253. package/dist/storage-content-api/staticHandler.d.ts.map +0 -1
  254. package/dist/storage-content-api/staticHandler.js +0 -55
  255. package/dist/storage-content-api/staticHandler.js.map +0 -1
  256. package/dist/storage-content-api/types.d.ts +0 -10
  257. package/dist/storage-content-api/types.d.ts.map +0 -1
  258. package/dist/storage-content-api/types.js +0 -3
  259. package/dist/storage-content-api/types.js.map +0 -1
  260. package/dist/templates/README.md +0 -19
  261. package/dist/utils/build-lambda-zip.d.ts +0 -14
  262. package/dist/utils/build-lambda-zip.d.ts.map +0 -1
  263. package/dist/utils/build-lambda-zip.js +0 -81
  264. package/dist/utils/build-lambda-zip.js.map +0 -1
@@ -1,136 +0,0 @@
1
- import { addFallbackSort } from '../temp-utilities/sorting.js';
2
- import { convertPayloadWhereToContentAPI } from './where.js';
3
- /**
4
- * Convert Payload's JoinQuery to Content API's join format.
5
- *
6
- * ## Content API Join Limitations
7
- *
8
- * The following Payload join features are NOT YET supported by Content API:
9
- *
10
- * 1. **hasMany relationships** - Content API's join uses `data#>'{path}'#>>'{}'` to extract
11
- * a single ID. HasMany relationships store arrays `["id1", "id2"]` which can't match.
12
- *
13
- * 2. **Array field relationships** - `on: 'array.category'` expects iteration over array
14
- * elements, but Content API treats the path as a single JSONB extraction.
15
- *
16
- * 3. **Polymorphic relationships** - Stored as `{ relationTo, value }` objects, but
17
- * Content API expects a simple ID string.
18
- *
19
- * 4. **Localized relationship fields** - Locale-aware joins not implemented.
20
- *
21
- * Note: "Where querying through joins" (e.g., `where: { 'relatedPosts.title': { equals: 'x' } }`)
22
- * is a separate Payload feature that filters documents based on joined data. This is NOT
23
- * a join feature but a where clause feature, and would need separate Content API support.
24
- *
25
- * Payload's JoinQuery format (at runtime):
26
- * {
27
- * 'group.relatedPosts': { // joinPath - where results go in the document
28
- * sort: '-title',
29
- * limit: 10,
30
- * page: 2, // page-based pagination
31
- * where: { ... }, // Payload where format
32
- * count: true
33
- * }
34
- * }
35
- *
36
- * Content API's join format:
37
- * [{
38
- * collectionId: 'posts', // collection to join FROM
39
- * on: 'group.category', // field in joined collection pointing to this doc
40
- * path: 'group.relatedPosts', // where to put results
41
- * count: false,
42
- * where: { ... }, // Content API where format
43
- * sort: '-title',
44
- * limit: 10,
45
- * offset: 10 // offset-based pagination
46
- * }]
47
- *
48
- * The mapping requires the collection config to resolve:
49
- * - Which collection each join field refers to
50
- * - What the 'on' field is for each join
51
- */ export function convertPayloadJoinsToContentAPI(payload, collectionSlug, joins) {
52
- const collectionConfig = payload.config.collections.find((c)=>c.slug === collectionSlug);
53
- if (!collectionConfig) {
54
- return undefined;
55
- }
56
- // joins === false means explicitly disable all joins
57
- // joins === undefined means use defaults (no custom query params)
58
- if (joins === false || !joins) {
59
- return undefined;
60
- }
61
- const result = [];
62
- // Iterate through all join paths in the query
63
- for (const [joinPath, joinQueryValue] of Object.entries(joins)){
64
- // joinQuery === false means skip this specific join
65
- if (joinQueryValue === false) {
66
- continue;
67
- }
68
- // Normalize undefined/empty to empty object
69
- const joinQuery = joinQueryValue ?? {};
70
- // Find the SanitizedJoin config for this joinPath
71
- // SanitizedJoins is indexed by the collection being joined FROM
72
- let foundJoin;
73
- // Search through all collections in the joins config
74
- for (const [collectionSlug, sanitizedJoins] of Object.entries(collectionConfig.joins)){
75
- for (const sanitizedJoin of sanitizedJoins){
76
- if (sanitizedJoin.joinPath === joinPath) {
77
- foundJoin = {
78
- collectionSlug,
79
- on: sanitizedJoin.field.on
80
- };
81
- break;
82
- }
83
- }
84
- if (foundJoin) {
85
- break;
86
- }
87
- }
88
- // Also check polymorphic joins
89
- if (!foundJoin) {
90
- for (const sanitizedJoin of collectionConfig.polymorphicJoins){
91
- if (sanitizedJoin.joinPath === joinPath) {
92
- // For polymorphic joins, collection is an array - use first one
93
- const collections = sanitizedJoin.field.collection;
94
- foundJoin = {
95
- collectionSlug: Array.isArray(collections) ? collections[0] : collections,
96
- on: sanitizedJoin.field.on
97
- };
98
- break;
99
- }
100
- }
101
- }
102
- if (!foundJoin) {
103
- payload.logger.warn(`Join path '${joinPath}' not found in collection config for '${collectionConfig.slug}'`);
104
- continue;
105
- }
106
- // Convert pagination: Payload uses page, Content API JoinClause uses offset
107
- let offset;
108
- if (joinQuery.page && joinQuery.page > 1 && joinQuery.limit) {
109
- offset = (joinQuery.page - 1) * joinQuery.limit;
110
- }
111
- // Add fallback sort for the joined collection
112
- const sortWithFallback = addFallbackSort(joinQuery.sort, payload, foundJoin.collectionSlug);
113
- const contentAPIJoin = {
114
- collectionId: foundJoin.collectionSlug,
115
- count: joinQuery.count ?? false,
116
- on: foundJoin.on,
117
- path: joinPath,
118
- ...joinQuery.limit !== undefined && {
119
- limit: joinQuery.limit
120
- },
121
- ...offset !== undefined && {
122
- offset
123
- },
124
- ...sortWithFallback && {
125
- sort: sortWithFallback
126
- },
127
- ...joinQuery.where && {
128
- where: convertPayloadWhereToContentAPI(joinQuery.where)
129
- }
130
- };
131
- result.push(contentAPIJoin);
132
- }
133
- return result.length > 0 ? result : undefined;
134
- }
135
-
136
- //# sourceMappingURL=joins.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/db-content-api/utilities/joins.ts"],"sourcesContent":["import type { JoinQuery, Payload } from 'payload'\n\nimport type { components } from '../generated/content-api-types.js'\n\nimport { addFallbackSort } from '../temp-utilities/sorting.js'\nimport { convertPayloadWhereToContentAPI } from './where.js'\n\n// JoinClause is an array type, so we extract the element type\ntype ContentAPIJoin = components['schemas']['JoinClause'][number]\n\n/**\n * Convert Payload's JoinQuery to Content API's join format.\n *\n * ## Content API Join Limitations\n *\n * The following Payload join features are NOT YET supported by Content API:\n *\n * 1. **hasMany relationships** - Content API's join uses `data#>'{path}'#>>'{}'` to extract\n * a single ID. HasMany relationships store arrays `[\"id1\", \"id2\"]` which can't match.\n *\n * 2. **Array field relationships** - `on: 'array.category'` expects iteration over array\n * elements, but Content API treats the path as a single JSONB extraction.\n *\n * 3. **Polymorphic relationships** - Stored as `{ relationTo, value }` objects, but\n * Content API expects a simple ID string.\n *\n * 4. **Localized relationship fields** - Locale-aware joins not implemented.\n *\n * Note: \"Where querying through joins\" (e.g., `where: { 'relatedPosts.title': { equals: 'x' } }`)\n * is a separate Payload feature that filters documents based on joined data. This is NOT\n * a join feature but a where clause feature, and would need separate Content API support.\n *\n * Payload's JoinQuery format (at runtime):\n * {\n * 'group.relatedPosts': { // joinPath - where results go in the document\n * sort: '-title',\n * limit: 10,\n * page: 2, // page-based pagination\n * where: { ... }, // Payload where format\n * count: true\n * }\n * }\n *\n * Content API's join format:\n * [{\n * collectionId: 'posts', // collection to join FROM\n * on: 'group.category', // field in joined collection pointing to this doc\n * path: 'group.relatedPosts', // where to put results\n * count: false,\n * where: { ... }, // Content API where format\n * sort: '-title',\n * limit: 10,\n * offset: 10 // offset-based pagination\n * }]\n *\n * The mapping requires the collection config to resolve:\n * - Which collection each join field refers to\n * - What the 'on' field is for each join\n */\nexport function convertPayloadJoinsToContentAPI(\n payload: Payload,\n collectionSlug: string,\n joins: false | JoinQuery | undefined,\n): ContentAPIJoin[] | undefined {\n const collectionConfig = payload.config.collections.find((c) => c.slug === collectionSlug)\n if (!collectionConfig) {\n return undefined\n }\n // joins === false means explicitly disable all joins\n // joins === undefined means use defaults (no custom query params)\n if (joins === false || !joins) {\n return undefined\n }\n\n const result: ContentAPIJoin[] = []\n\n // Iterate through all join paths in the query\n for (const [joinPath, joinQueryValue] of Object.entries(joins)) {\n // joinQuery === false means skip this specific join\n if (joinQueryValue === false) {\n continue\n }\n\n // Normalize undefined/empty to empty object\n const joinQuery = joinQueryValue ?? {}\n\n // Find the SanitizedJoin config for this joinPath\n // SanitizedJoins is indexed by the collection being joined FROM\n let foundJoin: { collectionSlug: string; on: string } | undefined\n\n // Search through all collections in the joins config\n for (const [collectionSlug, sanitizedJoins] of Object.entries(collectionConfig.joins)) {\n for (const sanitizedJoin of sanitizedJoins) {\n if (sanitizedJoin.joinPath === joinPath) {\n foundJoin = {\n collectionSlug,\n on: sanitizedJoin.field.on,\n }\n break\n }\n }\n if (foundJoin) {\n break\n }\n }\n\n // Also check polymorphic joins\n if (!foundJoin) {\n for (const sanitizedJoin of collectionConfig.polymorphicJoins) {\n if (sanitizedJoin.joinPath === joinPath) {\n // For polymorphic joins, collection is an array - use first one\n const collections = sanitizedJoin.field.collection\n foundJoin = {\n collectionSlug: Array.isArray(collections) ? collections[0] : collections,\n on: sanitizedJoin.field.on,\n }\n break\n }\n }\n }\n\n if (!foundJoin) {\n payload.logger.warn(\n `Join path '${joinPath}' not found in collection config for '${collectionConfig.slug}'`,\n )\n continue\n }\n\n // Convert pagination: Payload uses page, Content API JoinClause uses offset\n let offset: number | undefined\n if (joinQuery.page && joinQuery.page > 1 && joinQuery.limit) {\n offset = (joinQuery.page - 1) * joinQuery.limit\n }\n\n // Add fallback sort for the joined collection\n const sortWithFallback = addFallbackSort(joinQuery.sort, payload, foundJoin.collectionSlug)\n\n const contentAPIJoin: ContentAPIJoin = {\n collectionId: foundJoin.collectionSlug,\n count: joinQuery.count ?? false,\n on: foundJoin.on,\n path: joinPath,\n ...(joinQuery.limit !== undefined && { limit: joinQuery.limit }),\n ...(offset !== undefined && { offset }),\n ...(sortWithFallback && { sort: sortWithFallback }),\n ...(joinQuery.where && { where: convertPayloadWhereToContentAPI(joinQuery.where) }),\n }\n\n result.push(contentAPIJoin)\n }\n\n return result.length > 0 ? result : undefined\n}\n"],"names":["addFallbackSort","convertPayloadWhereToContentAPI","convertPayloadJoinsToContentAPI","payload","collectionSlug","joins","collectionConfig","config","collections","find","c","slug","undefined","result","joinPath","joinQueryValue","Object","entries","joinQuery","foundJoin","sanitizedJoins","sanitizedJoin","on","field","polymorphicJoins","collection","Array","isArray","logger","warn","offset","page","limit","sortWithFallback","sort","contentAPIJoin","collectionId","count","path","where","push","length"],"mappings":"AAIA,SAASA,eAAe,QAAQ,+BAA8B;AAC9D,SAASC,+BAA+B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9Dc,IAAID,cAAcE,KAAK,CAACD,EAAE;oBAC5B;oBACA;gBACF;YACF;QACF;QAEA,IAAI,CAACH,WAAW;YACdhB,QAAQyB,MAAM,CAACC,IAAI,CACjB,CAAC,WAAW,EAAEf,SAAS,sCAAsC,EAAER,iBAAiBK,IAAI,CAAC,CAAC,CAAC;YAEzF;QACF;QAEA,4EAA4E;QAC5E,IAAImB;QACJ,IAAIZ,UAAUa,IAAI,IAAIb,UAAUa,IAAI,GAAG,KAAKb,UAAUc,KAAK,EAAE;YAC3DF,SAAS,AAACZ,CAAAA,UAAUa,IAAI,GAAG,CAAA,IAAKb,UAAUc,KAAK;QACjD;QAEA,8CAA8C;QAC9C,MAAMC,mBAAmBjC,gBAAgBkB,UAAUgB,IAAI,EAAE/B,SAASgB,UAAUf,cAAc;QAE1F,MAAM+B,iBAAiC;YACrCC,cAAcjB,UAAUf,cAAc;YACtCiC,OAAOnB,UAAUmB,KAAK,IAAI;YAC1Bf,IAAIH,UAAUG,EAAE;YAChBgB,MAAMxB;YACN,GAAII,UAAUc,KAAK,KAAKpB,aAAa;gBAAEoB,OAAOd,UAAUc,KAAK;YAAC,CAAC;YAC/D,GAAIF,WAAWlB,aAAa;gBAAEkB;YAAO,CAAC;YACtC,GAAIG,oBAAoB;gBAAEC,MAAMD;YAAiB,CAAC;YAClD,GAAIf,UAAUqB,KAAK,IAAI;gBAAEA,OAAOtC,gCAAgCiB,UAAUqB,KAAK;YAAE,CAAC;QACpF;QAEA1B,OAAO2B,IAAI,CAACL;IACd;IAEA,OAAOtB,OAAO4B,MAAM,GAAG,IAAI5B,SAASD;AACtC"}
@@ -1,12 +0,0 @@
1
- import type { Where } from 'payload';
2
- import type { components } from '../generated/content-api-types.js';
3
- type WhereClause = components['schemas']['WhereClause'];
4
- type ConvertOptions = {
5
- /** Internal flag to track if we're inside a logical operator (and/or) */
6
- insideLogicalOperator?: boolean;
7
- /** If true, transform 'parent' field to 'documentId' (used for version queries) */
8
- parentToDocumentId?: boolean;
9
- };
10
- export declare function convertPayloadWhereToContentAPI(where: undefined | Where, options?: ConvertOptions): WhereClause;
11
- export {};
12
- //# sourceMappingURL=where.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"where.d.ts","sourceRoot":"","sources":["../../../src/db-content-api/utilities/where.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,KAAK,WAAW,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC,CAAA;AASvD,KAAK,cAAc,GAAG;IACpB,yEAAyE;IACzE,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,mFAAmF;IACnF,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,SAAS,GAAG,KAAK,EACxB,OAAO,GAAE,cAAmB,GAC3B,WAAW,CA4Gb"}
@@ -1,107 +0,0 @@
1
- export function convertPayloadWhereToContentAPI(where, options = {}) {
2
- // Empty where {} should be { and: [] } not undefined
3
- // Content API requires a where clause structure even for "no filter"
4
- if (!where || Object.keys(where).length === 0) {
5
- return {
6
- and: []
7
- };
8
- }
9
- const conditions = [];
10
- for (const [key, value] of Object.entries(where)){
11
- if (key === 'and') {
12
- // Recursively convert nested 'and' conditions, preserving options
13
- const nestedConditions = value.map((item)=>convertPayloadWhereToContentAPI(item, {
14
- ...options,
15
- insideLogicalOperator: true
16
- }))// TODO: A better solution would be to make the `where` schema of `zod` in `content-api`
17
- // more permissive. For now I'll do it this way because I have an idea to simplify
18
- // everything we're doing with `where` (Post EAP) anyway.
19
- // Filter out empty conditions { and: [] } that would be invalid
20
- .filter((condition)=>{
21
- if ('and' in condition) {
22
- return condition.and.length > 0;
23
- }
24
- if ('or' in condition) {
25
- return condition.or.length > 0;
26
- }
27
- return true // Keep path/operator/value conditions
28
- ;
29
- });
30
- // If filtering resulted in no conditions, return empty and
31
- if (nestedConditions.length === 0) {
32
- return {
33
- and: []
34
- };
35
- }
36
- return {
37
- and: nestedConditions
38
- };
39
- } else if (key === 'or') {
40
- // Recursively convert nested 'or' conditions, preserving options
41
- const nestedConditions = value.map((item)=>convertPayloadWhereToContentAPI(item, {
42
- ...options,
43
- insideLogicalOperator: true
44
- }))// Filter out empty conditions { and: [] } or { or: [] } that would be invalid
45
- .filter((condition)=>{
46
- if ('and' in condition) {
47
- return condition.and.length > 0;
48
- }
49
- if ('or' in condition) {
50
- return condition.or.length > 0;
51
- }
52
- return true // Keep path/operator/value conditions
53
- ;
54
- });
55
- // If filtering resulted in no conditions, return empty and
56
- if (nestedConditions.length === 0) {
57
- return {
58
- and: []
59
- };
60
- }
61
- return {
62
- or: nestedConditions
63
- };
64
- } else {
65
- // TODO: fix this in content api
66
- // WORKAROUND: Payload uses 'parent' for version queries, but Content API expects 'documentId'
67
- let fieldPath = key;
68
- if (options.parentToDocumentId && key === 'parent') {
69
- fieldPath = 'documentId';
70
- }
71
- // Convert field conditions: { fieldName: { operator: value } }
72
- // to: { path: fieldName, operator, value }
73
- const operators = value;
74
- // Skip empty operator objects { fieldName: {} }
75
- if (Object.keys(operators).length === 0) {
76
- continue;
77
- }
78
- for (const [op, operatorValue] of Object.entries(operators)){
79
- // Skip operators with undefined values (e.g., { equals: undefined })
80
- // This can happen when Payload sends incomplete where clauses
81
- if (operatorValue === undefined) {
82
- continue;
83
- }
84
- let finalValue = operatorValue;
85
- // Add wildcards for contains/like operators (Payload doesn't add them)
86
- if ((op === 'contains' || op === 'like') && typeof operatorValue === 'string') {
87
- finalValue = `%${operatorValue}%`;
88
- }
89
- conditions.push({
90
- operator: op,
91
- path: fieldPath,
92
- value: finalValue
93
- });
94
- }
95
- }
96
- }
97
- // If inside a logical operator (and/or), return conditions directly
98
- // Otherwise, wrap in 'and' to match WhereClause type
99
- if (options.insideLogicalOperator && conditions.length === 1) {
100
- return conditions[0];
101
- }
102
- return {
103
- and: conditions
104
- };
105
- }
106
-
107
- //# sourceMappingURL=where.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/db-content-api/utilities/where.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport type { components } from '../generated/content-api-types.js'\n\ntype WhereClause = components['schemas']['WhereClause']\n\n// Payload's format: { fieldName: { operator: value }, and: [...], or: [...] }\n// Content API expects: { and: [{ path, operator, value }], or: [{ path, operator, value }] }\n//\n// The format stays different. This allows the Content API to evolve its filter schema,\n// for example to support composite types like Point, which are not lexicographically sortable.\n// Semantics must remain identical to Payload.\n\ntype ConvertOptions = {\n /** Internal flag to track if we're inside a logical operator (and/or) */\n insideLogicalOperator?: boolean\n /** If true, transform 'parent' field to 'documentId' (used for version queries) */\n parentToDocumentId?: boolean\n}\n\nexport function convertPayloadWhereToContentAPI(\n where: undefined | Where,\n options: ConvertOptions = {},\n): WhereClause {\n // Empty where {} should be { and: [] } not undefined\n // Content API requires a where clause structure even for \"no filter\"\n if (!where || Object.keys(where).length === 0) {\n return { and: [] }\n }\n\n // Extract the condition type (the variant with 'path', 'operator', 'value') from WhereClause union\n type WhereCondition = Extract<WhereClause, { path: string }>\n const conditions: WhereClause[] = []\n\n for (const [key, value] of Object.entries(where)) {\n if (key === 'and') {\n // Recursively convert nested 'and' conditions, preserving options\n const nestedConditions = (value as Where[])\n .map((item) =>\n convertPayloadWhereToContentAPI(item, { ...options, insideLogicalOperator: true }),\n )\n // TODO: A better solution would be to make the `where` schema of `zod` in `content-api`\n // more permissive. For now I'll do it this way because I have an idea to simplify\n // everything we're doing with `where` (Post EAP) anyway.\n // Filter out empty conditions { and: [] } that would be invalid\n .filter((condition) => {\n if ('and' in condition) {\n return condition.and.length > 0\n }\n if ('or' in condition) {\n return condition.or.length > 0\n }\n return true // Keep path/operator/value conditions\n })\n\n // If filtering resulted in no conditions, return empty and\n if (nestedConditions.length === 0) {\n return { and: [] }\n }\n\n return { and: nestedConditions }\n } else if (key === 'or') {\n // Recursively convert nested 'or' conditions, preserving options\n const nestedConditions = (value as Where[])\n .map((item) =>\n convertPayloadWhereToContentAPI(item, { ...options, insideLogicalOperator: true }),\n )\n // Filter out empty conditions { and: [] } or { or: [] } that would be invalid\n .filter((condition) => {\n if ('and' in condition) {\n return condition.and.length > 0\n }\n if ('or' in condition) {\n return condition.or.length > 0\n }\n return true // Keep path/operator/value conditions\n })\n\n // If filtering resulted in no conditions, return empty and\n if (nestedConditions.length === 0) {\n return { and: [] }\n }\n\n return { or: nestedConditions }\n } else {\n // TODO: fix this in content api\n // WORKAROUND: Payload uses 'parent' for version queries, but Content API expects 'documentId'\n let fieldPath = key\n if (options.parentToDocumentId && key === 'parent') {\n fieldPath = 'documentId'\n }\n\n // Convert field conditions: { fieldName: { operator: value } }\n // to: { path: fieldName, operator, value }\n const operators = value as Record<string, unknown>\n\n // Skip empty operator objects { fieldName: {} }\n if (Object.keys(operators).length === 0) {\n continue\n }\n\n for (const [op, operatorValue] of Object.entries(operators)) {\n // Skip operators with undefined values (e.g., { equals: undefined })\n // This can happen when Payload sends incomplete where clauses\n if (operatorValue === undefined) {\n continue\n }\n\n let finalValue = operatorValue\n\n // Add wildcards for contains/like operators (Payload doesn't add them)\n if ((op === 'contains' || op === 'like') && typeof operatorValue === 'string') {\n finalValue = `%${operatorValue}%`\n }\n\n conditions.push({\n operator: op as WhereCondition['operator'],\n path: fieldPath,\n value: finalValue,\n } as WhereCondition)\n }\n }\n }\n\n // If inside a logical operator (and/or), return conditions directly\n // Otherwise, wrap in 'and' to match WhereClause type\n if (options.insideLogicalOperator && conditions.length === 1) {\n return conditions[0]\n }\n\n return { and: conditions }\n}\n"],"names":["convertPayloadWhereToContentAPI","where","options","Object","keys","length","and","conditions","key","value","entries","nestedConditions","map","item","insideLogicalOperator","filter","condition","or","fieldPath","parentToDocumentId","operators","op","operatorValue","undefined","finalValue","push","operator","path"],"mappings":"AAoBA,OAAO,SAASA,gCACdC,KAAwB,EACxBC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D;YAEF,2DAA2D;YAC3D,IAAIM,iBAAiBN,MAAM,KAAK,GAAG;gBACjC,OAAO;oBAAEC,KAAK,EAAE;gBAAC;YACnB;YAEA,OAAO;gBAAEW,IAAIN;YAAiB;QAChC,OAAO;YACL,gCAAgC;YAChC,8FAA8F;YAC9F,IAAIO,YAAYV;YAChB,IAAIN,QAAQiB,kBAAkB,IAAIX,QAAQ,UAAU;gBAClDU,YAAY;YACd;YAEA,+DAA+D;YAC/D,2CAA2C;YAC3C,MAAME,YAAYX;YAElB,gDAAgD;YAChD,IAAIN,OAAOC,IAAI,CAACgB,WAAWf,MAAM,KAAK,GAAG;gBACvC;YACF;YAEA,KAAK,MAAM,CAACgB,IAAIC,cAAc,IAAInB,OAAOO,OAAO,CAACU,WAAY;gBAC3D,qEAAqE;gBACrE,8DAA8D;gBAC9D,IAAIE,kBAAkBC,WAAW;oBAC/B;gBACF;gBAEA,IAAIC,aAAaF;gBAEjB,uEAAuE;gBACvE,IAAI,AAACD,CAAAA,OAAO,cAAcA,OAAO,MAAK,KAAM,OAAOC,kBAAkB,UAAU;oBAC7EE,aAAa,CAAC,CAAC,EAAEF,cAAc,CAAC,CAAC;gBACnC;gBAEAf,WAAWkB,IAAI,CAAC;oBACdC,UAAUL;oBACVM,MAAMT;oBACNT,OAAOe;gBACT;YACF;QACF;IACF;IAEA,oEAAoE;IACpE,qDAAqD;IACrD,IAAItB,QAAQY,qBAAqB,IAAIP,WAAWF,MAAM,KAAK,GAAG;QAC5D,OAAOE,UAAU,CAAC,EAAE;IACtB;IAEA,OAAO;QAAED,KAAKC;IAAW;AAC3B"}
@@ -1,3 +0,0 @@
1
- import type { Endpoint } from 'payload';
2
- export declare const health: Endpoint;
3
- //# sourceMappingURL=health.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/endpoints/health.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,eAAO,MAAM,MAAM,EAAE,QAMpB,CAAA"}
@@ -1,11 +0,0 @@
1
- export const health = {
2
- handler: ()=>{
3
- return Response.json({
4
- status: 200
5
- });
6
- },
7
- method: 'get',
8
- path: '/health'
9
- };
10
-
11
- //# sourceMappingURL=health.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/endpoints/health.ts"],"sourcesContent":["import type { Endpoint } from 'payload'\n\nexport const health: Endpoint = {\n handler: () => {\n return Response.json({ status: 200 })\n },\n method: 'get',\n path: '/health',\n}\n"],"names":["health","handler","Response","json","status","method","path"],"mappings":"AAEA,OAAO,MAAMA,SAAmB;IAC9BC,SAAS;QACP,OAAOC,SAASC,IAAI,CAAC;YAAEC,QAAQ;QAAI;IACrC;IACAC,QAAQ;IACRC,MAAM;AACR,EAAC"}
@@ -1,4 +0,0 @@
1
- export { DefaultLoginButton } from '../oauth/components/LoginButton/index.js';
2
- export { LogoutButton } from '../oauth/components/LogoutButton/index.js';
3
- export { ContentApiClientUploadHandler } from '../storage-content-api/client-uploads/ClientUploadHandler.js';
4
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAA;AACxE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8DAA8D,CAAA"}
@@ -1,5 +0,0 @@
1
- export { DefaultLoginButton } from '../oauth/components/LoginButton/index.js';
2
- export { LogoutButton } from '../oauth/components/LogoutButton/index.js';
3
- export { ContentApiClientUploadHandler } from '../storage-content-api/client-uploads/ClientUploadHandler.js';
4
-
5
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["export { DefaultLoginButton } from '../oauth/components/LoginButton/index.js'\nexport { LogoutButton } from '../oauth/components/LogoutButton/index.js'\nexport { ContentApiClientUploadHandler } from '../storage-content-api/client-uploads/ClientUploadHandler.js'\n"],"names":["DefaultLoginButton","LogoutButton","ContentApiClientUploadHandler"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,2CAA0C;AAC7E,SAASC,YAAY,QAAQ,4CAA2C;AACxE,SAASC,6BAA6B,QAAQ,+DAA8D"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Check if an error is a duplicate key/unique constraint violation from Content API.
3
- *
4
- * Content API returns HTTP 409 with "conflict" or "already exists" in the message.
5
- */
6
- export declare function isDuplicateKeyError(error: unknown): boolean;
7
- //# sourceMappingURL=isDuplicateKeyError.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isDuplicateKeyError.d.ts","sourceRoot":"","sources":["../../../src/oauth/utilities/isDuplicateKeyError.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAa3D"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Check if an error is a duplicate key/unique constraint violation from Content API.
3
- *
4
- * Content API returns HTTP 409 with "conflict" or "already exists" in the message.
5
- */ export function isDuplicateKeyError(error) {
6
- if (!error || typeof error !== 'object') {
7
- return false;
8
- }
9
- const err = error;
10
- const message = typeof err.message === 'string' ? err.message : '';
11
- return message.includes('409') || message.toLowerCase().includes('conflict') || message.toLowerCase().includes('already exists');
12
- }
13
-
14
- //# sourceMappingURL=isDuplicateKeyError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/oauth/utilities/isDuplicateKeyError.ts"],"sourcesContent":["/**\n * Check if an error is a duplicate key/unique constraint violation from Content API.\n *\n * Content API returns HTTP 409 with \"conflict\" or \"already exists\" in the message.\n */\nexport function isDuplicateKeyError(error: unknown): boolean {\n if (!error || typeof error !== 'object') {\n return false\n }\n\n const err = error as { message?: unknown }\n const message = typeof err.message === 'string' ? err.message : ''\n\n return (\n message.includes('409') ||\n message.toLowerCase().includes('conflict') ||\n message.toLowerCase().includes('already exists')\n )\n}\n"],"names":["isDuplicateKeyError","error","err","message","includes","toLowerCase"],"mappings":"AAAA;;;;CAIC,GACD,OAAO,SAASA,oBAAoBC,KAAc;IAChD,IAAI,CAACA,SAAS,OAAOA,UAAU,UAAU;QACvC,OAAO;IACT;IAEA,MAAMC,MAAMD;IACZ,MAAME,UAAU,OAAOD,IAAIC,OAAO,KAAK,WAAWD,IAAIC,OAAO,GAAG;IAEhE,OACEA,QAAQC,QAAQ,CAAC,UACjBD,QAAQE,WAAW,GAAGD,QAAQ,CAAC,eAC/BD,QAAQE,WAAW,GAAGD,QAAQ,CAAC;AAEnC"}
@@ -1,161 +0,0 @@
1
- /**
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.
4
- */
5
- export type UploadPaths = {
6
- '/api/v0/uploads/{filename}': {
7
- delete: {
8
- parameters: {
9
- path: {
10
- filename: string;
11
- };
12
- };
13
- responses: {
14
- 200: {
15
- content: {
16
- 'application/json': {
17
- success: true;
18
- };
19
- };
20
- };
21
- };
22
- };
23
- };
24
- '/api/v0/uploads/download/sign': {
25
- post: {
26
- requestBody: {
27
- content: {
28
- 'application/json': {
29
- expiresIn: number;
30
- filename: string;
31
- };
32
- };
33
- };
34
- responses: {
35
- 200: {
36
- content: {
37
- 'application/json': {
38
- url: string;
39
- };
40
- };
41
- };
42
- };
43
- };
44
- };
45
- '/api/v0/uploads/multipart/abort': {
46
- post: {
47
- requestBody: {
48
- content: {
49
- 'application/json': {
50
- filename: string;
51
- uploadId: string;
52
- };
53
- };
54
- };
55
- responses: {
56
- 200: {
57
- content: {
58
- 'application/json': {
59
- success: true;
60
- };
61
- };
62
- };
63
- };
64
- };
65
- };
66
- '/api/v0/uploads/multipart/complete': {
67
- post: {
68
- requestBody: {
69
- content: {
70
- 'application/json': {
71
- filename: string;
72
- parts: Array<{
73
- ETag: string;
74
- PartNumber: number;
75
- }>;
76
- uploadId: string;
77
- };
78
- };
79
- };
80
- responses: {
81
- 200: {
82
- content: {
83
- 'application/json': {
84
- success: true;
85
- };
86
- };
87
- };
88
- };
89
- };
90
- };
91
- '/api/v0/uploads/multipart/initiate': {
92
- post: {
93
- requestBody: {
94
- content: {
95
- 'application/json': {
96
- contentType: string;
97
- filename: string;
98
- };
99
- };
100
- };
101
- responses: {
102
- 200: {
103
- content: {
104
- 'application/json': {
105
- uploadId: string;
106
- };
107
- };
108
- };
109
- };
110
- };
111
- };
112
- '/api/v0/uploads/multipart/parts': {
113
- post: {
114
- requestBody: {
115
- content: {
116
- 'application/json': {
117
- expiresIn: number;
118
- filename: string;
119
- partNumbers: number[];
120
- uploadId: string;
121
- };
122
- };
123
- };
124
- responses: {
125
- 200: {
126
- content: {
127
- 'application/json': {
128
- parts: Array<{
129
- partNumber: number;
130
- url: string;
131
- }>;
132
- };
133
- };
134
- };
135
- };
136
- };
137
- };
138
- '/api/v0/uploads/sign': {
139
- post: {
140
- requestBody: {
141
- content: {
142
- 'application/json': {
143
- contentType?: string;
144
- expiresIn: number;
145
- filename: string;
146
- };
147
- };
148
- };
149
- responses: {
150
- 200: {
151
- content: {
152
- 'application/json': {
153
- url: string;
154
- };
155
- };
156
- };
157
- };
158
- };
159
- };
160
- };
161
- //# sourceMappingURL=api-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-types.d.ts","sourceRoot":"","sources":["../../src/storage-content-api/api-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,WAAW,GAAG;IACxB,4BAA4B,EAAE;QAC5B,MAAM,EAAE;YACN,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,QAAQ,EAAE,MAAM,CAAA;iBACjB,CAAA;aACF,CAAA;YACD,SAAS,EAAE;gBACT,GAAG,EAAE;oBACH,OAAO,EAAE;wBACP,kBAAkB,EAAE;4BAAE,OAAO,EAAE,IAAI,CAAA;yBAAE,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BACP,kBAAkB,EAAE;4BAAE,GAAG,EAAE,MAAM,CAAA;yBAAE,CAAA;qBACpC,CAAA;iBACF,CAAA;aACF,CAAA;SACF,CAAA;KACF,CAAA;CACF,CAAA"}
@@ -1,6 +0,0 @@
1
- /**
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.
4
- */ export { };
5
-
6
- //# sourceMappingURL=api-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/storage-content-api/api-types.ts"],"sourcesContent":["/**\n * Upload API types extracted from Content API OpenAPI spec.\n * These are kept separate to avoid breaking changes when the main spec is regenerated.\n */\n\nexport type UploadPaths = {\n '/api/v0/uploads/{filename}': {\n delete: {\n parameters: {\n path: {\n filename: string\n }\n }\n responses: {\n 200: {\n content: {\n 'application/json': { success: true }\n }\n }\n }\n }\n }\n '/api/v0/uploads/download/sign': {\n post: {\n requestBody: {\n content: {\n 'application/json': {\n expiresIn: number\n filename: string\n }\n }\n }\n responses: {\n 200: {\n content: {\n 'application/json': { url: string }\n }\n }\n }\n }\n }\n '/api/v0/uploads/multipart/abort': {\n post: {\n requestBody: {\n content: {\n 'application/json': {\n filename: string\n uploadId: string\n }\n }\n }\n responses: {\n 200: {\n content: {\n 'application/json': { success: true }\n }\n }\n }\n }\n }\n '/api/v0/uploads/multipart/complete': {\n post: {\n requestBody: {\n content: {\n 'application/json': {\n filename: string\n parts: Array<{ ETag: string; PartNumber: number }>\n uploadId: string\n }\n }\n }\n responses: {\n 200: {\n content: {\n 'application/json': { success: true }\n }\n }\n }\n }\n }\n '/api/v0/uploads/multipart/initiate': {\n post: {\n requestBody: {\n content: {\n 'application/json': {\n contentType: string\n filename: string\n }\n }\n }\n responses: {\n 200: {\n content: {\n 'application/json': { uploadId: string }\n }\n }\n }\n }\n }\n '/api/v0/uploads/multipart/parts': {\n post: {\n requestBody: {\n content: {\n 'application/json': {\n expiresIn: number\n filename: string\n partNumbers: number[]\n uploadId: string\n }\n }\n }\n responses: {\n 200: {\n content: {\n 'application/json': {\n parts: Array<{ partNumber: number; url: string }>\n }\n }\n }\n }\n }\n }\n '/api/v0/uploads/sign': {\n post: {\n requestBody: {\n content: {\n 'application/json': {\n contentType?: string\n expiresIn: number\n filename: string\n }\n }\n }\n responses: {\n 200: {\n content: {\n 'application/json': { url: string }\n }\n }\n }\n }\n }\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAED,WAyIC"}
@@ -1,9 +0,0 @@
1
- export declare const ContentApiClientUploadHandler: ({ children, collectionSlug, enabled, extra, prefix, serverHandlerPath, }: {
2
- children: import("react").ReactNode;
3
- collectionSlug: import("payload").UploadCollectionSlug;
4
- enabled?: boolean;
5
- extra: Record<string, unknown>;
6
- prefix?: string;
7
- serverHandlerPath: `/${string}`;
8
- }) => import("react").JSX.Element;
9
- //# sourceMappingURL=ClientUploadHandler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ClientUploadHandler.d.ts","sourceRoot":"","sources":["../../../src/storage-content-api/client-uploads/ClientUploadHandler.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,6BAA6B;;;;;;;aAoBf,OAAO,aAiBhC,CAAA"}
@@ -1,42 +0,0 @@
1
- 'use client';
2
- import { createClientUploadHandler } from '@payloadcms/plugin-cloud-storage/client';
3
- export const ContentApiClientUploadHandler = createClientUploadHandler({
4
- handler: async ({ apiRoute, collectionSlug, file, prefix, serverHandlerPath, serverURL })=>{
5
- // Build endpoint URL: serverURL + apiRoute + serverHandlerPath
6
- const endpointRoute = `${serverURL}${apiRoute}${serverHandlerPath}`;
7
- const response = await fetch(endpointRoute, {
8
- body: JSON.stringify({
9
- collectionSlug,
10
- filename: file.name,
11
- mimeType: file.type
12
- }),
13
- credentials: 'include',
14
- headers: {
15
- 'Content-Type': 'application/json'
16
- },
17
- method: 'POST'
18
- });
19
- if (!response.ok) {
20
- throw new Error(`Failed to get presigned URL: ${response.status} ${response.statusText}`);
21
- }
22
- const { url } = await response.json();
23
- const uploadResponse = await fetch(url, {
24
- body: file,
25
- headers: {
26
- 'Content-Type': file.type
27
- },
28
- method: 'PUT'
29
- });
30
- if (!uploadResponse.ok) {
31
- throw new Error(`Failed to upload to S3: ${uploadResponse.status} ${uploadResponse.statusText}`);
32
- }
33
- // Include original filename so handleUpload can distinguish from resized versions
34
- return {
35
- clientUploaded: true,
36
- filename: file.name,
37
- prefix
38
- };
39
- }
40
- });
41
-
42
- //# sourceMappingURL=ClientUploadHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/storage-content-api/client-uploads/ClientUploadHandler.tsx"],"sourcesContent":["'use client'\nimport { createClientUploadHandler } from '@payloadcms/plugin-cloud-storage/client'\n\nexport const ContentApiClientUploadHandler = createClientUploadHandler({\n handler: async ({ apiRoute, collectionSlug, file, prefix, serverHandlerPath, serverURL }) => {\n // Build endpoint URL: serverURL + apiRoute + serverHandlerPath\n const endpointRoute = `${serverURL}${apiRoute}${serverHandlerPath}`\n\n const response = await fetch(endpointRoute, {\n body: JSON.stringify({\n collectionSlug,\n filename: file.name,\n mimeType: file.type,\n }),\n credentials: 'include',\n headers: { 'Content-Type': 'application/json' },\n method: 'POST',\n })\n\n if (!response.ok) {\n throw new Error(`Failed to get presigned URL: ${response.status} ${response.statusText}`)\n }\n\n const { url } = (await response.json()) as { url: string }\n\n const uploadResponse = await fetch(url, {\n body: file,\n headers: { 'Content-Type': file.type },\n method: 'PUT',\n })\n\n if (!uploadResponse.ok) {\n throw new Error(\n `Failed to upload to S3: ${uploadResponse.status} ${uploadResponse.statusText}`,\n )\n }\n\n // Include original filename so handleUpload can distinguish from resized versions\n return { clientUploaded: true, filename: file.name, prefix }\n },\n})\n"],"names":["createClientUploadHandler","ContentApiClientUploadHandler","handler","apiRoute","collectionSlug","file","prefix","serverHandlerPath","serverURL","endpointRoute","response","fetch","body","JSON","stringify","filename","name","mimeType","type","credentials","headers","method","ok","Error","status","statusText","url","json","uploadResponse","clientUploaded"],"mappings":"AAAA;AACA,SAASA,yBAAyB,QAAQ,0CAAyC;AAEnF,OAAO,MAAMC,gCAAgCD,0BAA0B;IACrEE,SAAS,OAAO,EAAEC,QAAQ,EAAEC,cAAc,EAAEC,IAAI,EAAEC,MAAM,EAAEC,iBAAiB,EAAEC,SAAS,EAAE;QACtF,+DAA+D;QAC/D,MAAMC,gBAAgB,GAAGD,YAAYL,WAAWI,mBAAmB;QAEnE,MAAMG,WAAW,MAAMC,MAAMF,eAAe;YAC1CG,MAAMC,KAAKC,SAAS,CAAC;gBACnBV;gBACAW,UAAUV,KAAKW,IAAI;gBACnBC,UAAUZ,KAAKa,IAAI;YACrB;YACAC,aAAa;YACbC,SAAS;gBAAE,gBAAgB;YAAmB;YAC9CC,QAAQ;QACV;QAEA,IAAI,CAACX,SAASY,EAAE,EAAE;YAChB,MAAM,IAAIC,MAAM,CAAC,6BAA6B,EAAEb,SAASc,MAAM,CAAC,CAAC,EAAEd,SAASe,UAAU,EAAE;QAC1F;QAEA,MAAM,EAAEC,GAAG,EAAE,GAAI,MAAMhB,SAASiB,IAAI;QAEpC,MAAMC,iBAAiB,MAAMjB,MAAMe,KAAK;YACtCd,MAAMP;YACNe,SAAS;gBAAE,gBAAgBf,KAAKa,IAAI;YAAC;YACrCG,QAAQ;QACV;QAEA,IAAI,CAACO,eAAeN,EAAE,EAAE;YACtB,MAAM,IAAIC,MACR,CAAC,wBAAwB,EAAEK,eAAeJ,MAAM,CAAC,CAAC,EAAEI,eAAeH,UAAU,EAAE;QAEnF;QAEA,kFAAkF;QAClF,OAAO;YAAEI,gBAAgB;YAAMd,UAAUV,KAAKW,IAAI;YAAEV;QAAO;IAC7D;AACF,GAAE"}