@payloadcms/db-postgres 3.0.0-canary.6d9b462 → 3.0.0-canary.6de2b29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (269) hide show
  1. package/README.md +1 -1
  2. package/dist/connect.d.ts +1 -1
  3. package/dist/connect.d.ts.map +1 -1
  4. package/dist/connect.js.map +1 -1
  5. package/dist/count.d.ts +1 -1
  6. package/dist/count.d.ts.map +1 -1
  7. package/dist/count.js +1 -1
  8. package/dist/count.js.map +1 -1
  9. package/dist/create.d.ts +1 -1
  10. package/dist/create.d.ts.map +1 -1
  11. package/dist/create.js +1 -1
  12. package/dist/create.js.map +1 -1
  13. package/dist/createGlobal.d.ts +2 -3
  14. package/dist/createGlobal.d.ts.map +1 -1
  15. package/dist/createGlobal.js +1 -1
  16. package/dist/createGlobal.js.map +1 -1
  17. package/dist/createGlobalVersion.d.ts +2 -4
  18. package/dist/createGlobalVersion.d.ts.map +1 -1
  19. package/dist/createGlobalVersion.js +2 -2
  20. package/dist/createGlobalVersion.js.map +1 -1
  21. package/dist/createMigration.d.ts +1 -1
  22. package/dist/createMigration.d.ts.map +1 -1
  23. package/dist/createMigration.js +1 -1
  24. package/dist/createMigration.js.map +1 -1
  25. package/dist/createVersion.d.ts +1 -2
  26. package/dist/createVersion.d.ts.map +1 -1
  27. package/dist/createVersion.js +2 -2
  28. package/dist/createVersion.js.map +1 -1
  29. package/dist/deleteMany.d.ts +1 -1
  30. package/dist/deleteMany.d.ts.map +1 -1
  31. package/dist/deleteMany.js +1 -1
  32. package/dist/deleteMany.js.map +1 -1
  33. package/dist/deleteOne.d.ts +1 -1
  34. package/dist/deleteOne.d.ts.map +1 -1
  35. package/dist/deleteOne.js +1 -1
  36. package/dist/deleteOne.js.map +1 -1
  37. package/dist/deleteVersions.d.ts +1 -1
  38. package/dist/deleteVersions.d.ts.map +1 -1
  39. package/dist/deleteVersions.js +2 -2
  40. package/dist/deleteVersions.js.map +1 -1
  41. package/dist/destroy.d.ts +1 -1
  42. package/dist/destroy.d.ts.map +1 -1
  43. package/dist/destroy.js.map +1 -1
  44. package/dist/exports/migration-utils.js.map +1 -1
  45. package/dist/find/buildFindManyArgs.d.ts +1 -1
  46. package/dist/find/buildFindManyArgs.d.ts.map +1 -1
  47. package/dist/find/buildFindManyArgs.js.map +1 -1
  48. package/dist/find/chainMethods.d.ts.map +1 -1
  49. package/dist/find/chainMethods.js.map +1 -1
  50. package/dist/find/findMany.d.ts +1 -2
  51. package/dist/find/findMany.d.ts.map +1 -1
  52. package/dist/find/findMany.js +1 -1
  53. package/dist/find/findMany.js.map +1 -1
  54. package/dist/find/traverseFields.d.ts +1 -1
  55. package/dist/find/traverseFields.d.ts.map +1 -1
  56. package/dist/find/traverseFields.js +1 -1
  57. package/dist/find/traverseFields.js.map +1 -1
  58. package/dist/find.d.ts +1 -1
  59. package/dist/find.d.ts.map +1 -1
  60. package/dist/find.js.map +1 -1
  61. package/dist/findGlobal.d.ts +1 -1
  62. package/dist/findGlobal.d.ts.map +1 -1
  63. package/dist/findGlobal.js.map +1 -1
  64. package/dist/findGlobalVersions.d.ts +1 -1
  65. package/dist/findGlobalVersions.d.ts.map +1 -1
  66. package/dist/findGlobalVersions.js +1 -1
  67. package/dist/findGlobalVersions.js.map +1 -1
  68. package/dist/findOne.d.ts +1 -2
  69. package/dist/findOne.d.ts.map +1 -1
  70. package/dist/findOne.js.map +1 -1
  71. package/dist/findVersions.d.ts +1 -1
  72. package/dist/findVersions.d.ts.map +1 -1
  73. package/dist/findVersions.js +1 -1
  74. package/dist/findVersions.js.map +1 -1
  75. package/dist/index.d.ts +1 -1
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +1 -1
  78. package/dist/index.js.map +1 -1
  79. package/dist/init.d.ts +1 -1
  80. package/dist/init.d.ts.map +1 -1
  81. package/dist/init.js +1 -1
  82. package/dist/init.js.map +1 -1
  83. package/dist/migrate.d.ts.map +1 -1
  84. package/dist/migrate.js +1 -1
  85. package/dist/migrate.js.map +1 -1
  86. package/dist/migrateDown.js +1 -1
  87. package/dist/migrateDown.js.map +1 -1
  88. package/dist/migrateFresh.d.ts.map +1 -1
  89. package/dist/migrateFresh.js +1 -1
  90. package/dist/migrateFresh.js.map +1 -1
  91. package/dist/migrateRefresh.js +1 -1
  92. package/dist/migrateRefresh.js.map +1 -1
  93. package/dist/migrateReset.js +1 -1
  94. package/dist/migrateReset.js.map +1 -1
  95. package/dist/migrateStatus.js +1 -1
  96. package/dist/migrateStatus.js.map +1 -1
  97. package/dist/predefinedMigrations/relationships-v2-v3.js.map +1 -1
  98. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts +2 -3
  99. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -1
  100. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js +0 -1
  101. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -1
  102. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts +1 -1
  103. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts.map +1 -1
  104. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js +1 -1
  105. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js.map +1 -1
  106. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts.map +1 -1
  107. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js.map +1 -1
  108. package/dist/predefinedMigrations/v2-v3/index.d.ts +2 -3
  109. package/dist/predefinedMigrations/v2-v3/index.d.ts.map +1 -1
  110. package/dist/predefinedMigrations/v2-v3/index.js +2 -2
  111. package/dist/predefinedMigrations/v2-v3/index.js.map +1 -1
  112. package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts +2 -2
  113. package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts.map +1 -1
  114. package/dist/predefinedMigrations/v2-v3/migrateRelationships.js.map +1 -1
  115. package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts +1 -2
  116. package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts.map +1 -1
  117. package/dist/predefinedMigrations/v2-v3/traverseFields.js +1 -1
  118. package/dist/predefinedMigrations/v2-v3/traverseFields.js.map +1 -1
  119. package/dist/predefinedMigrations/v2-v3/types.js.map +1 -1
  120. package/dist/queries/buildAndOrConditions.d.ts +1 -1
  121. package/dist/queries/buildAndOrConditions.d.ts.map +1 -1
  122. package/dist/queries/buildAndOrConditions.js.map +1 -1
  123. package/dist/queries/buildQuery.d.ts +1 -1
  124. package/dist/queries/buildQuery.d.ts.map +1 -1
  125. package/dist/queries/buildQuery.js.map +1 -1
  126. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +1 -1
  127. package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +1 -1
  128. package/dist/queries/createJSONQuery/index.js.map +1 -1
  129. package/dist/queries/getTableColumnFromPath.d.ts +1 -1
  130. package/dist/queries/getTableColumnFromPath.d.ts.map +1 -1
  131. package/dist/queries/getTableColumnFromPath.js +2 -3
  132. package/dist/queries/getTableColumnFromPath.js.map +1 -1
  133. package/dist/queries/operatorMap.js.map +1 -1
  134. package/dist/queries/parseParams.d.ts +1 -1
  135. package/dist/queries/parseParams.d.ts.map +1 -1
  136. package/dist/queries/parseParams.js +2 -2
  137. package/dist/queries/parseParams.js.map +1 -1
  138. package/dist/queries/sanitizeQueryValue.d.ts +1 -1
  139. package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
  140. package/dist/queries/sanitizeQueryValue.js +2 -3
  141. package/dist/queries/sanitizeQueryValue.js.map +1 -1
  142. package/dist/queries/selectDistinct.d.ts.map +1 -1
  143. package/dist/queries/selectDistinct.js.map +1 -1
  144. package/dist/queryDrafts.d.ts +1 -1
  145. package/dist/queryDrafts.d.ts.map +1 -1
  146. package/dist/queryDrafts.js +1 -2
  147. package/dist/queryDrafts.js.map +1 -1
  148. package/dist/schema/build.d.ts +1 -1
  149. package/dist/schema/build.d.ts.map +1 -1
  150. package/dist/schema/build.js.map +1 -1
  151. package/dist/schema/createIndex.js.map +1 -1
  152. package/dist/schema/createTableName.d.ts +1 -1
  153. package/dist/schema/createTableName.d.ts.map +1 -1
  154. package/dist/schema/createTableName.js +1 -1
  155. package/dist/schema/createTableName.js.map +1 -1
  156. package/dist/schema/idToUUID.d.ts +1 -1
  157. package/dist/schema/idToUUID.d.ts.map +1 -1
  158. package/dist/schema/idToUUID.js.map +1 -1
  159. package/dist/schema/parentIDColumnMap.js.map +1 -1
  160. package/dist/schema/setColumnID.d.ts +1 -1
  161. package/dist/schema/setColumnID.d.ts.map +1 -1
  162. package/dist/schema/setColumnID.js +2 -2
  163. package/dist/schema/setColumnID.js.map +1 -1
  164. package/dist/schema/traverseFields.d.ts +1 -1
  165. package/dist/schema/traverseFields.d.ts.map +1 -1
  166. package/dist/schema/traverseFields.js +2 -2
  167. package/dist/schema/traverseFields.js.map +1 -1
  168. package/dist/schema/validateExistingBlockIsIdentical.d.ts +1 -1
  169. package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +1 -1
  170. package/dist/schema/validateExistingBlockIsIdentical.js +2 -2
  171. package/dist/schema/validateExistingBlockIsIdentical.js.map +1 -1
  172. package/dist/transactions/beginTransaction.d.ts +1 -1
  173. package/dist/transactions/beginTransaction.d.ts.map +1 -1
  174. package/dist/transactions/beginTransaction.js.map +1 -1
  175. package/dist/transactions/commitTransaction.d.ts +1 -1
  176. package/dist/transactions/commitTransaction.d.ts.map +1 -1
  177. package/dist/transactions/commitTransaction.js +1 -0
  178. package/dist/transactions/commitTransaction.js.map +1 -1
  179. package/dist/transactions/rollbackTransaction.d.ts +1 -1
  180. package/dist/transactions/rollbackTransaction.d.ts.map +1 -1
  181. package/dist/transactions/rollbackTransaction.js +5 -4
  182. package/dist/transactions/rollbackTransaction.js.map +1 -1
  183. package/dist/transform/read/hasManyNumber.d.ts +1 -1
  184. package/dist/transform/read/hasManyNumber.d.ts.map +1 -1
  185. package/dist/transform/read/hasManyNumber.js.map +1 -1
  186. package/dist/transform/read/hasManyText.d.ts +1 -1
  187. package/dist/transform/read/hasManyText.d.ts.map +1 -1
  188. package/dist/transform/read/hasManyText.js.map +1 -1
  189. package/dist/transform/read/index.d.ts +2 -3
  190. package/dist/transform/read/index.d.ts.map +1 -1
  191. package/dist/transform/read/index.js.map +1 -1
  192. package/dist/transform/read/relationship.d.ts +1 -1
  193. package/dist/transform/read/relationship.d.ts.map +1 -1
  194. package/dist/transform/read/relationship.js.map +1 -1
  195. package/dist/transform/read/traverseFields.d.ts +2 -2
  196. package/dist/transform/read/traverseFields.d.ts.map +1 -1
  197. package/dist/transform/read/traverseFields.js +1 -1
  198. package/dist/transform/read/traverseFields.js.map +1 -1
  199. package/dist/transform/write/array.d.ts +1 -1
  200. package/dist/transform/write/array.d.ts.map +1 -1
  201. package/dist/transform/write/array.js.map +1 -1
  202. package/dist/transform/write/blocks.d.ts +1 -1
  203. package/dist/transform/write/blocks.d.ts.map +1 -1
  204. package/dist/transform/write/blocks.js.map +1 -1
  205. package/dist/transform/write/index.d.ts +1 -1
  206. package/dist/transform/write/index.d.ts.map +1 -1
  207. package/dist/transform/write/index.js.map +1 -1
  208. package/dist/transform/write/numbers.js.map +1 -1
  209. package/dist/transform/write/relationships.d.ts +1 -1
  210. package/dist/transform/write/relationships.d.ts.map +1 -1
  211. package/dist/transform/write/relationships.js +1 -1
  212. package/dist/transform/write/relationships.js.map +1 -1
  213. package/dist/transform/write/selects.js.map +1 -1
  214. package/dist/transform/write/texts.js.map +1 -1
  215. package/dist/transform/write/traverseFields.d.ts +1 -1
  216. package/dist/transform/write/traverseFields.d.ts.map +1 -1
  217. package/dist/transform/write/traverseFields.js +1 -1
  218. package/dist/transform/write/traverseFields.js.map +1 -1
  219. package/dist/transform/write/types.js.map +1 -1
  220. package/dist/types.d.ts +3 -5
  221. package/dist/types.d.ts.map +1 -1
  222. package/dist/types.js.map +1 -1
  223. package/dist/update.d.ts +1 -1
  224. package/dist/update.d.ts.map +1 -1
  225. package/dist/update.js +1 -1
  226. package/dist/update.js.map +1 -1
  227. package/dist/updateGlobal.d.ts +2 -3
  228. package/dist/updateGlobal.d.ts.map +1 -1
  229. package/dist/updateGlobal.js +1 -1
  230. package/dist/updateGlobal.js.map +1 -1
  231. package/dist/updateGlobalVersion.d.ts +1 -2
  232. package/dist/updateGlobalVersion.d.ts.map +1 -1
  233. package/dist/updateGlobalVersion.js +2 -2
  234. package/dist/updateGlobalVersion.js.map +1 -1
  235. package/dist/updateVersion.d.ts +1 -2
  236. package/dist/updateVersion.d.ts.map +1 -1
  237. package/dist/updateVersion.js +2 -2
  238. package/dist/updateVersion.js.map +1 -1
  239. package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +1 -1
  240. package/dist/upsertRow/deleteExistingArrayRows.js.map +1 -1
  241. package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +1 -1
  242. package/dist/upsertRow/deleteExistingRowsByPath.js.map +1 -1
  243. package/dist/upsertRow/index.d.ts +2 -2
  244. package/dist/upsertRow/index.d.ts.map +1 -1
  245. package/dist/upsertRow/index.js +9 -7
  246. package/dist/upsertRow/index.js.map +1 -1
  247. package/dist/upsertRow/insertArrays.d.ts.map +1 -1
  248. package/dist/upsertRow/insertArrays.js.map +1 -1
  249. package/dist/upsertRow/types.d.ts +2 -2
  250. package/dist/upsertRow/types.d.ts.map +1 -1
  251. package/dist/upsertRow/types.js.map +1 -1
  252. package/dist/utilities/appendPrefixToKeys.d.ts.map +1 -1
  253. package/dist/utilities/appendPrefixToKeys.js.map +1 -1
  254. package/dist/utilities/createBlocksMap.d.ts.map +1 -1
  255. package/dist/utilities/createBlocksMap.js.map +1 -1
  256. package/dist/utilities/createMigrationTable.d.ts.map +1 -1
  257. package/dist/utilities/createMigrationTable.js.map +1 -1
  258. package/dist/utilities/createRelationshipMap.d.ts.map +1 -1
  259. package/dist/utilities/createRelationshipMap.js.map +1 -1
  260. package/dist/utilities/hasLocalesTable.d.ts +1 -1
  261. package/dist/utilities/hasLocalesTable.d.ts.map +1 -1
  262. package/dist/utilities/hasLocalesTable.js +1 -1
  263. package/dist/utilities/hasLocalesTable.js.map +1 -1
  264. package/dist/utilities/isArrayOfRows.js.map +1 -1
  265. package/dist/utilities/migrationTableExists.d.ts.map +1 -1
  266. package/dist/utilities/migrationTableExists.js.map +1 -1
  267. package/dist/utilities/parseError.js.map +1 -1
  268. package/dist/utilities/pushDevSchema.js.map +1 -1
  269. package/package.json +16 -13
@@ -1 +1 @@
1
- {"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../../src/transform/write/traverseFields.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAK1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAU1F,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,MAAM,EAAE;QACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;KACxC,CAAA;IACD;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE;QACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;KACxC,CAAA;IACD,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC3B;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAC3C;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE;QACP,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,C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AAA;IACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAC3C;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE;QACP,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAC1C,CAAA;IACD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAClC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IACxC,qBAAqB,EAAE,oBAAoB,EAAE,CAAA;IAC7C,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC5B,OAAO,EAAE;QACP,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;KAC/C,CAAA;IACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,cAAc,4OAqBxB,IAAI,SA0dN,CAAA"}
@@ -1,4 +1,4 @@
1
- /* eslint-disable no-param-reassign */ import { fieldAffectsData } from 'payload/types';
1
+ /* eslint-disable no-param-reassign */ import { fieldAffectsData } from 'payload/shared';
2
2
  import toSnakeCase from 'to-snake-case';
3
3
  import { isArrayOfRows } from '../../utilities/isArrayOfRows.js';
4
4
  import { transformArray } from './array.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/transform/write/traverseFields.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { Field } from 'payload/types'\n\nimport { fieldAffectsData } from 'payload/types'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from '../../types.js'\nimport type { ArrayRowToInsert, BlockRowToInsert, RelationshipToDelete } from './types.js'\n\nimport { isArrayOfRows } from '../../utilities/isArrayOfRows.js'\nimport { transformArray } from './array.js'\nimport { transformBlocks } from './blocks.js'\nimport { transformNumbers } from './numbers.js'\nimport { transformRelationship } from './relationships.js'\nimport { transformSelects } from './selects.js'\nimport { transformTexts } from './texts.js'\n\ntype Args = {\n adapter: PostgresAdapter\n arrays: {\n [tableName: string]: ArrayRowToInsert[]\n }\n /**\n * This is the name of the base table\n */\n baseTableName: string\n blocks: {\n [blockType: string]: BlockRowToInsert[]\n }\n blocksToDelete: Set<string>\n /**\n * A snake-case field prefix, representing prior fields\n * Ex: my_group_my_named_tab_\n */\n columnPrefix: string\n data: Record<string, unknown>\n existingLocales?: Record<string, unknown>[]\n /**\n * A prefix that will retain camel-case formatting, representing prior fields\n * Ex: myGroup_myNamedTab_\n */\n fieldPrefix: string\n fields: Field[]\n forcedLocale?: string\n locales: {\n [locale: string]: Record<string, unknown>\n }\n numbers: Record<string, unknown>[]\n /**\n * This is the name of the parent table\n */\n parentTableName: string\n path: string\n relationships: Record<string, unknown>[]\n relationshipsToDelete: RelationshipToDelete[]\n row: Record<string, unknown>\n selects: {\n [tableName: string]: Record<string, unknown>[]\n }\n texts: Record<string, unknown>[]\n}\n\nexport const traverseFields = ({\n adapter,\n arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix,\n data,\n existingLocales,\n fieldPrefix,\n fields,\n forcedLocale,\n locales,\n numbers,\n parentTableName,\n path,\n relationships,\n relationshipsToDelete,\n row,\n selects,\n texts,\n}: Args) => {\n fields.forEach((field) => {\n let columnName = ''\n let fieldName = ''\n let fieldData: unknown\n\n if (fieldAffectsData(field)) {\n columnName = `${columnPrefix || ''}${toSnakeCase(field.name)}`\n fieldName = `${fieldPrefix || ''}${field.name}`\n fieldData = data[field.name]\n }\n\n if (field.type === 'array') {\n const arrayTableName = adapter.tableNameMap.get(`${parentTableName}_${columnName}`)\n\n if (!arrays[arrayTableName]) arrays[arrayTableName] = []\n\n if (field.localized) {\n if (typeof data[field.name] === 'object' && data[field.name] !== null) {\n Object.entries(data[field.name]).forEach(([localeKey, localeData]) => {\n if (Array.isArray(localeData)) {\n const newRows = transformArray({\n adapter,\n arrayTableName,\n baseTableName,\n blocks,\n blocksToDelete,\n data: localeData,\n field,\n locale: localeKey,\n numbers,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n })\n\n arrays[arrayTableName] = arrays[arrayTableName].concat(newRows)\n }\n })\n }\n } else {\n const newRows = transformArray({\n adapter,\n arrayTableName,\n baseTableName,\n blocks,\n blocksToDelete,\n data: data[field.name],\n field,\n numbers,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n })\n\n arrays[arrayTableName] = arrays[arrayTableName].concat(newRows)\n }\n\n return\n }\n\n if (field.type === 'blocks') {\n field.blocks.forEach(({ slug }) => {\n blocksToDelete.add(toSnakeCase(slug))\n })\n\n if (field.localized) {\n if (typeof data[field.name] === 'object' && data[field.name] !== null) {\n Object.entries(data[field.name]).forEach(([localeKey, localeData]) => {\n if (Array.isArray(localeData)) {\n transformBlocks({\n adapter,\n baseTableName,\n blocks,\n blocksToDelete,\n data: localeData,\n field,\n locale: localeKey,\n numbers,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n })\n }\n })\n }\n } else if (isArrayOfRows(fieldData)) {\n transformBlocks({\n adapter,\n baseTableName,\n blocks,\n blocksToDelete,\n data: fieldData,\n field,\n numbers,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n })\n }\n\n return\n }\n\n if (field.type === 'group') {\n if (typeof data[field.name] === 'object' && data[field.name] !== null) {\n if (field.localized) {\n Object.entries(data[field.name]).forEach(([localeKey, localeData]) => {\n traverseFields({\n adapter,\n arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: `${columnName}_`,\n data: localeData as Record<string, unknown>,\n existingLocales,\n fieldPrefix: `${fieldName}_`,\n fields: field.fields,\n forcedLocale: localeKey,\n locales,\n numbers,\n parentTableName,\n path: `${path || ''}${field.name}.`,\n relationships,\n relationshipsToDelete,\n row,\n selects,\n texts,\n })\n })\n } else {\n traverseFields({\n adapter,\n arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: `${columnName}_`,\n data: data[field.name] as Record<string, unknown>,\n existingLocales,\n fieldPrefix: `${fieldName}_`,\n fields: field.fields,\n locales,\n numbers,\n parentTableName,\n path: `${path || ''}${field.name}.`,\n relationships,\n relationshipsToDelete,\n row,\n selects,\n texts,\n })\n }\n }\n\n return\n }\n\n if (field.type === 'tabs') {\n field.tabs.forEach((tab) => {\n if ('name' in tab) {\n if (typeof data[tab.name] === 'object' && data[tab.name] !== null) {\n if (tab.localized) {\n Object.entries(data[tab.name]).forEach(([localeKey, localeData]) => {\n traverseFields({\n adapter,\n arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: `${columnPrefix || ''}${toSnakeCase(tab.name)}_`,\n data: localeData as Record<string, unknown>,\n existingLocales,\n fieldPrefix: `${fieldPrefix || ''}${tab.name}_`,\n fields: tab.fields,\n forcedLocale: localeKey,\n locales,\n numbers,\n parentTableName,\n path: `${path || ''}${tab.name}.`,\n relationships,\n relationshipsToDelete,\n row,\n selects,\n texts,\n })\n })\n } else {\n traverseFields({\n adapter,\n arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: `${columnPrefix || ''}${toSnakeCase(tab.name)}_`,\n data: data[tab.name] as Record<string, unknown>,\n existingLocales,\n fieldPrefix: `${fieldPrefix || ''}${tab.name}_`,\n fields: tab.fields,\n locales,\n numbers,\n parentTableName,\n path: `${path || ''}${tab.name}.`,\n relationships,\n relationshipsToDelete,\n row,\n selects,\n texts,\n })\n }\n }\n } else {\n traverseFields({\n adapter,\n arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix,\n data,\n existingLocales,\n fieldPrefix,\n fields: tab.fields,\n locales,\n numbers,\n parentTableName,\n path,\n relationships,\n relationshipsToDelete,\n row,\n selects,\n texts,\n })\n }\n })\n }\n\n if (field.type === 'row' || field.type === 'collapsible') {\n traverseFields({\n adapter,\n arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix,\n data,\n existingLocales,\n fieldPrefix,\n fields: field.fields,\n locales,\n numbers,\n parentTableName,\n path,\n relationships,\n relationshipsToDelete,\n row,\n selects,\n texts,\n })\n }\n\n if (field.type === 'relationship' || field.type === 'upload') {\n const relationshipPath = `${path || ''}${field.name}`\n\n if (\n field.localized &&\n (Array.isArray(field.relationTo) || ('hasMany' in field && field.hasMany))\n ) {\n if (typeof fieldData === 'object') {\n Object.entries(fieldData).forEach(([localeKey, localeData]) => {\n if (localeData === null) {\n relationshipsToDelete.push({\n locale: localeKey,\n path: relationshipPath,\n })\n return\n }\n\n transformRelationship({\n baseRow: {\n locale: localeKey,\n path: relationshipPath,\n },\n data: localeData,\n field,\n relationships,\n })\n })\n }\n return\n } else if (Array.isArray(field.relationTo) || ('hasMany' in field && field.hasMany)) {\n if (fieldData === null || (Array.isArray(fieldData) && fieldData.length === 0)) {\n relationshipsToDelete.push({ path: relationshipPath })\n return\n }\n\n transformRelationship({\n baseRow: {\n path: relationshipPath,\n },\n data: fieldData,\n field,\n relationships,\n })\n return\n } else {\n if (\n !field.localized &&\n fieldData &&\n typeof fieldData === 'object' &&\n 'id' in fieldData &&\n fieldData?.id\n ) {\n fieldData = fieldData.id\n } else if (field.localized) {\n if (typeof fieldData === 'object') {\n Object.entries(fieldData).forEach(([localeKey, localeData]) => {\n if (typeof localeData === 'object') {\n if (localeData && 'id' in localeData && localeData?.id) {\n fieldData[localeKey] = localeData.id\n }\n } else {\n fieldData[localeKey] = localeData\n }\n })\n }\n }\n }\n }\n\n if (field.type === 'text' && field.hasMany) {\n const textPath = `${path || ''}${field.name}`\n\n if (field.localized) {\n if (typeof fieldData === 'object') {\n Object.entries(fieldData).forEach(([localeKey, localeData]) => {\n if (Array.isArray(localeData)) {\n transformTexts({\n baseRow: {\n locale: localeKey,\n path: textPath,\n },\n data: localeData,\n texts,\n })\n }\n })\n }\n } else if (Array.isArray(fieldData)) {\n transformTexts({\n baseRow: {\n path: textPath,\n },\n data: fieldData,\n texts,\n })\n }\n\n return\n }\n\n if (field.type === 'number' && field.hasMany) {\n const numberPath = `${path || ''}${field.name}`\n\n if (field.localized) {\n if (typeof fieldData === 'object') {\n Object.entries(fieldData).forEach(([localeKey, localeData]) => {\n if (Array.isArray(localeData)) {\n transformNumbers({\n baseRow: {\n locale: localeKey,\n path: numberPath,\n },\n data: localeData,\n numbers,\n })\n }\n })\n }\n } else if (Array.isArray(fieldData)) {\n transformNumbers({\n baseRow: {\n path: numberPath,\n },\n data: fieldData,\n numbers,\n })\n }\n\n return\n }\n\n if (field.type === 'select' && field.hasMany) {\n const selectTableName = adapter.tableNameMap.get(`${parentTableName}_${columnName}`)\n if (!selects[selectTableName]) selects[selectTableName] = []\n\n if (field.localized) {\n if (typeof data[field.name] === 'object' && data[field.name] !== null) {\n Object.entries(data[field.name]).forEach(([localeKey, localeData]) => {\n if (Array.isArray(localeData)) {\n const newRows = transformSelects({\n id: data._uuid || data.id,\n data: localeData,\n locale: localeKey,\n })\n\n selects[selectTableName] = selects[selectTableName].concat(newRows)\n }\n })\n }\n } else if (Array.isArray(data[field.name])) {\n const newRows = transformSelects({\n id: data._uuid || data.id,\n data: data[field.name],\n })\n\n selects[selectTableName] = selects[selectTableName].concat(newRows)\n }\n\n return\n }\n\n if (fieldAffectsData(field)) {\n const valuesToTransform: { localeKey?: string; ref: unknown; value: unknown }[] = []\n\n if (field.localized) {\n if (typeof fieldData === 'object' && fieldData !== null) {\n Object.entries(fieldData).forEach(([localeKey, localeData]) => {\n if (!locales[localeKey]) locales[localeKey] = {}\n\n valuesToTransform.push({\n localeKey,\n ref: locales,\n value: localeData,\n })\n })\n }\n } else {\n let ref = row\n\n if (forcedLocale) {\n if (!locales[forcedLocale]) locales[forcedLocale] = {}\n ref = locales[forcedLocale]\n }\n\n valuesToTransform.push({ ref, value: fieldData })\n }\n\n valuesToTransform.forEach(({ localeKey, ref, value }) => {\n if (typeof value !== 'undefined') {\n let formattedValue = value\n\n if (field.type === 'date' && field.name === 'updatedAt') {\n formattedValue = new Date().toISOString()\n }\n\n if (localeKey) {\n ref[localeKey][fieldName] = formattedValue\n } else {\n ref[fieldName] = formattedValue\n }\n }\n })\n }\n })\n}\n"],"names":["fieldAffectsData","toSnakeCase","isArrayOfRows","transformArray","transformBlocks","transformNumbers","transformRelationship","transformSelects","transformTexts","traverseFields","adapter","arrays","baseTableName","blocks","blocksToDelete","columnPrefix","data","existingLocales","fieldPrefix","fields","forcedLocale","locales","numbers","parentTableName","path","relationships","relationshipsToDelete","row","selects","texts","forEach","field","columnName","fieldName","fieldData","name","type","arrayTableName","tableNameMap","get","localized","Object","entries","localeKey","localeData","Array","isArray","newRows","locale","concat","slug","add","tabs","tab","relationshipPath","relationTo","hasMany","push","baseRow","length","id","textPath","numberPath","selectTableName","_uuid","valuesToTransform","ref","value","formattedValue","Date","toISOString"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ACD,aAAa,GAAG,CAAC;oBACrD8C,MAAM7C,OAAO,CAACD,aAAa;gBAC7B;gBAEA6C,kBAAkBR,IAAI,CAAC;oBAAES;oBAAKC,OAAOjC;gBAAU;YACjD;YAEA+B,kBAAkBnC,OAAO,CAAC,CAAC,EAAEa,SAAS,EAAEuB,GAAG,EAAEC,KAAK,EAAE;gBAClD,IAAI,OAAOA,UAAU,aAAa;oBAChC,IAAIC,iBAAiBD;oBAErB,IAAIpC,MAAMK,IAAI,KAAK,UAAUL,MAAMI,IAAI,KAAK,aAAa;wBACvDiC,iBAAiB,IAAIC,OAAOC,WAAW;oBACzC;oBAEA,IAAI3B,WAAW;wBACbuB,GAAG,CAACvB,UAAU,CAACV,UAAU,GAAGmC;oBAC9B,OAAO;wBACLF,GAAG,CAACjC,UAAU,GAAGmC;oBACnB;gBACF;YACF;QACF;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/transform/write/traverseFields.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { Field } from 'payload'\n\nimport { fieldAffectsData } from 'payload/shared'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from '../../types.js'\nimport type { ArrayRowToInsert, BlockRowToInsert, RelationshipToDelete } from './types.js'\n\nimport { isArrayOfRows } from '../../utilities/isArrayOfRows.js'\nimport { transformArray } from './array.js'\nimport { transformBlocks } from './blocks.js'\nimport { transformNumbers } from './numbers.js'\nimport { transformRelationship } from './relationships.js'\nimport { transformSelects } from './selects.js'\nimport { transformTexts } from './texts.js'\n\ntype Args = {\n adapter: PostgresAdapter\n arrays: {\n [tableName: string]: ArrayRowToInsert[]\n }\n /**\n * This is the name of the base table\n */\n baseTableName: string\n blocks: {\n [blockType: string]: BlockRowToInsert[]\n }\n blocksToDelete: Set<string>\n /**\n * A snake-case field prefix, representing prior fields\n * Ex: my_group_my_named_tab_\n */\n columnPrefix: string\n data: Record<string, unknown>\n existingLocales?: Record<string, unknown>[]\n /**\n * A prefix that will retain camel-case formatting, representing prior fields\n * Ex: myGroup_myNamedTab_\n */\n fieldPrefix: string\n fields: Field[]\n forcedLocale?: string\n locales: {\n [locale: string]: Record<string, unknown>\n }\n numbers: Record<string, unknown>[]\n /**\n * This is the name of the parent table\n */\n parentTableName: string\n path: string\n relationships: Record<string, unknown>[]\n relationshipsToDelete: RelationshipToDelete[]\n row: Record<string, unknown>\n selects: {\n [tableName: string]: Record<string, unknown>[]\n }\n texts: Record<string, unknown>[]\n}\n\nexport const traverseFields = ({\n adapter,\n arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix,\n data,\n existingLocales,\n fieldPrefix,\n fields,\n forcedLocale,\n locales,\n numbers,\n parentTableName,\n path,\n relationships,\n relationshipsToDelete,\n row,\n selects,\n texts,\n}: Args) => {\n fields.forEach((field) => {\n let columnName = ''\n let fieldName = ''\n let fieldData: unknown\n\n if (fieldAffectsData(field)) {\n columnName = `${columnPrefix || ''}${toSnakeCase(field.name)}`\n fieldName = `${fieldPrefix || ''}${field.name}`\n fieldData = data[field.name]\n }\n\n if (field.type === 'array') {\n const arrayTableName = adapter.tableNameMap.get(`${parentTableName}_${columnName}`)\n\n if (!arrays[arrayTableName]) arrays[arrayTableName] = []\n\n if (field.localized) {\n if (typeof data[field.name] === 'object' && data[field.name] !== null) {\n Object.entries(data[field.name]).forEach(([localeKey, localeData]) => {\n if (Array.isArray(localeData)) {\n const newRows = transformArray({\n adapter,\n arrayTableName,\n baseTableName,\n blocks,\n blocksToDelete,\n data: localeData,\n field,\n locale: localeKey,\n numbers,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n })\n\n arrays[arrayTableName] = arrays[arrayTableName].concat(newRows)\n }\n })\n }\n } else {\n const newRows = transformArray({\n adapter,\n arrayTableName,\n baseTableName,\n blocks,\n blocksToDelete,\n data: data[field.name],\n field,\n numbers,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n })\n\n arrays[arrayTableName] = arrays[arrayTableName].concat(newRows)\n }\n\n return\n }\n\n if (field.type === 'blocks') {\n field.blocks.forEach(({ slug }) => {\n blocksToDelete.add(toSnakeCase(slug))\n })\n\n if (field.localized) {\n if (typeof data[field.name] === 'object' && data[field.name] !== null) {\n Object.entries(data[field.name]).forEach(([localeKey, localeData]) => {\n if (Array.isArray(localeData)) {\n transformBlocks({\n adapter,\n baseTableName,\n blocks,\n blocksToDelete,\n data: localeData,\n field,\n locale: localeKey,\n numbers,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n })\n }\n })\n }\n } else if (isArrayOfRows(fieldData)) {\n transformBlocks({\n adapter,\n baseTableName,\n blocks,\n blocksToDelete,\n data: fieldData,\n field,\n numbers,\n path,\n relationships,\n relationshipsToDelete,\n selects,\n texts,\n })\n }\n\n return\n }\n\n if (field.type === 'group') {\n if (typeof data[field.name] === 'object' && data[field.name] !== null) {\n if (field.localized) {\n Object.entries(data[field.name]).forEach(([localeKey, localeData]) => {\n traverseFields({\n adapter,\n arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: `${columnName}_`,\n data: localeData as Record<string, unknown>,\n existingLocales,\n fieldPrefix: `${fieldName}_`,\n fields: field.fields,\n forcedLocale: localeKey,\n locales,\n numbers,\n parentTableName,\n path: `${path || ''}${field.name}.`,\n relationships,\n relationshipsToDelete,\n row,\n selects,\n texts,\n })\n })\n } else {\n traverseFields({\n adapter,\n arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: `${columnName}_`,\n data: data[field.name] as Record<string, unknown>,\n existingLocales,\n fieldPrefix: `${fieldName}_`,\n fields: field.fields,\n locales,\n numbers,\n parentTableName,\n path: `${path || ''}${field.name}.`,\n relationships,\n relationshipsToDelete,\n row,\n selects,\n texts,\n })\n }\n }\n\n return\n }\n\n if (field.type === 'tabs') {\n field.tabs.forEach((tab) => {\n if ('name' in tab) {\n if (typeof data[tab.name] === 'object' && data[tab.name] !== null) {\n if (tab.localized) {\n Object.entries(data[tab.name]).forEach(([localeKey, localeData]) => {\n traverseFields({\n adapter,\n arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: `${columnPrefix || ''}${toSnakeCase(tab.name)}_`,\n data: localeData as Record<string, unknown>,\n existingLocales,\n fieldPrefix: `${fieldPrefix || ''}${tab.name}_`,\n fields: tab.fields,\n forcedLocale: localeKey,\n locales,\n numbers,\n parentTableName,\n path: `${path || ''}${tab.name}.`,\n relationships,\n relationshipsToDelete,\n row,\n selects,\n texts,\n })\n })\n } else {\n traverseFields({\n adapter,\n arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix: `${columnPrefix || ''}${toSnakeCase(tab.name)}_`,\n data: data[tab.name] as Record<string, unknown>,\n existingLocales,\n fieldPrefix: `${fieldPrefix || ''}${tab.name}_`,\n fields: tab.fields,\n locales,\n numbers,\n parentTableName,\n path: `${path || ''}${tab.name}.`,\n relationships,\n relationshipsToDelete,\n row,\n selects,\n texts,\n })\n }\n }\n } else {\n traverseFields({\n adapter,\n arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix,\n data,\n existingLocales,\n fieldPrefix,\n fields: tab.fields,\n locales,\n numbers,\n parentTableName,\n path,\n relationships,\n relationshipsToDelete,\n row,\n selects,\n texts,\n })\n }\n })\n }\n\n if (field.type === 'row' || field.type === 'collapsible') {\n traverseFields({\n adapter,\n arrays,\n baseTableName,\n blocks,\n blocksToDelete,\n columnPrefix,\n data,\n existingLocales,\n fieldPrefix,\n fields: field.fields,\n locales,\n numbers,\n parentTableName,\n path,\n relationships,\n relationshipsToDelete,\n row,\n selects,\n texts,\n })\n }\n\n if (field.type === 'relationship' || field.type === 'upload') {\n const relationshipPath = `${path || ''}${field.name}`\n\n if (\n field.localized &&\n (Array.isArray(field.relationTo) || ('hasMany' in field && field.hasMany))\n ) {\n if (typeof fieldData === 'object') {\n Object.entries(fieldData).forEach(([localeKey, localeData]) => {\n if (localeData === null) {\n relationshipsToDelete.push({\n locale: localeKey,\n path: relationshipPath,\n })\n return\n }\n\n transformRelationship({\n baseRow: {\n locale: localeKey,\n path: relationshipPath,\n },\n data: localeData,\n field,\n relationships,\n })\n })\n }\n return\n } else if (Array.isArray(field.relationTo) || ('hasMany' in field && field.hasMany)) {\n if (fieldData === null || (Array.isArray(fieldData) && fieldData.length === 0)) {\n relationshipsToDelete.push({ path: relationshipPath })\n return\n }\n\n transformRelationship({\n baseRow: {\n path: relationshipPath,\n },\n data: fieldData,\n field,\n relationships,\n })\n return\n } else {\n if (\n !field.localized &&\n fieldData &&\n typeof fieldData === 'object' &&\n 'id' in fieldData &&\n fieldData?.id\n ) {\n fieldData = fieldData.id\n } else if (field.localized) {\n if (typeof fieldData === 'object') {\n Object.entries(fieldData).forEach(([localeKey, localeData]) => {\n if (typeof localeData === 'object') {\n if (localeData && 'id' in localeData && localeData?.id) {\n fieldData[localeKey] = localeData.id\n }\n } else {\n fieldData[localeKey] = localeData\n }\n })\n }\n }\n }\n }\n\n if (field.type === 'text' && field.hasMany) {\n const textPath = `${path || ''}${field.name}`\n\n if (field.localized) {\n if (typeof fieldData === 'object') {\n Object.entries(fieldData).forEach(([localeKey, localeData]) => {\n if (Array.isArray(localeData)) {\n transformTexts({\n baseRow: {\n locale: localeKey,\n path: textPath,\n },\n data: localeData,\n texts,\n })\n }\n })\n }\n } else if (Array.isArray(fieldData)) {\n transformTexts({\n baseRow: {\n path: textPath,\n },\n data: fieldData,\n texts,\n })\n }\n\n return\n }\n\n if (field.type === 'number' && field.hasMany) {\n const numberPath = `${path || ''}${field.name}`\n\n if (field.localized) {\n if (typeof fieldData === 'object') {\n Object.entries(fieldData).forEach(([localeKey, localeData]) => {\n if (Array.isArray(localeData)) {\n transformNumbers({\n baseRow: {\n locale: localeKey,\n path: numberPath,\n },\n data: localeData,\n numbers,\n })\n }\n })\n }\n } else if (Array.isArray(fieldData)) {\n transformNumbers({\n baseRow: {\n path: numberPath,\n },\n data: fieldData,\n numbers,\n })\n }\n\n return\n }\n\n if (field.type === 'select' && field.hasMany) {\n const selectTableName = adapter.tableNameMap.get(`${parentTableName}_${columnName}`)\n if (!selects[selectTableName]) selects[selectTableName] = []\n\n if (field.localized) {\n if (typeof data[field.name] === 'object' && data[field.name] !== null) {\n Object.entries(data[field.name]).forEach(([localeKey, localeData]) => {\n if (Array.isArray(localeData)) {\n const newRows = transformSelects({\n id: data._uuid || data.id,\n data: localeData,\n locale: localeKey,\n })\n\n selects[selectTableName] = selects[selectTableName].concat(newRows)\n }\n })\n }\n } else if (Array.isArray(data[field.name])) {\n const newRows = transformSelects({\n id: data._uuid || data.id,\n data: data[field.name],\n })\n\n selects[selectTableName] = selects[selectTableName].concat(newRows)\n }\n\n return\n }\n\n if (fieldAffectsData(field)) {\n const valuesToTransform: { localeKey?: string; ref: unknown; value: unknown }[] = []\n\n if (field.localized) {\n if (typeof fieldData === 'object' && fieldData !== null) {\n Object.entries(fieldData).forEach(([localeKey, localeData]) => {\n if (!locales[localeKey]) locales[localeKey] = {}\n\n valuesToTransform.push({\n localeKey,\n ref: locales,\n value: localeData,\n })\n })\n }\n } else {\n let ref = row\n\n if (forcedLocale) {\n if (!locales[forcedLocale]) locales[forcedLocale] = {}\n ref = locales[forcedLocale]\n }\n\n valuesToTransform.push({ ref, value: fieldData })\n }\n\n valuesToTransform.forEach(({ localeKey, ref, value }) => {\n if (typeof value !== 'undefined') {\n let formattedValue = value\n\n if (field.type === 'date' && field.name === 'updatedAt') {\n formattedValue = new Date().toISOString()\n }\n\n if (localeKey) {\n ref[localeKey][fieldName] = formattedValue\n } else {\n ref[fieldName] = formattedValue\n }\n }\n })\n }\n })\n}\n"],"names":["fieldAffectsData","toSnakeCase","isArrayOfRows","transformArray","transformBlocks","transformNumbers","transformRelationship","transformSelects","transformTexts","traverseFields","adapter","arrays","baseTableName","blocks","blocksToDelete","columnPrefix","data","existingLocales","fieldPrefix","fields","forcedLocale","locales","numbers","parentTableName","path","relationships","relationshipsToDelete","row","selects","texts","forEach","field","columnName","fieldName","fieldData","name","type","arrayTableName","tableNameMap","get","localized","Object","entries","localeKey","localeData","Array","isArray","newRows","locale","concat","slug","add","tabs","tab","relationshipPath","relationTo","hasMany","push","baseRow","length","id","textPath","numberPath","selectTableName","_uuid","valuesToTransform","ref","value","formattedValue","Date","toISOString"],"mappings":"AAAA,oCAAoC,GAGpC,SAASA,gBAAgB,QAAQ,iBAAgB;AACjD,OAAOC,iBAAiB,gBAAe;AAKvC,SAASC,aAAa,QAAQ,mCAAkC;AAChE,SAASC,cAAc,QAAQ,aAAY;AAC3C,SAASC,eAAe,QAAQ,cAAa;AAC7C,SAASC,gBAAgB,QAAQ,eAAc;AAC/C,SAASC,qBAAqB,QAAQ,qBAAoB;AAC1D,SAASC,gBAAgB,QAAQ,eAAc;AAC/C,SAASC,cAAc,QAAQ,aAAY;AA+C3C,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,OAAO,EACPC,MAAM,EACNC,aAAa,EACbC,MAAM,EACNC,cAAc,EACdC,YAAY,EACZC,IAAI,EACJC,eAAe,EACfC,WAAW,EACXC,MAAM,EACNC,YAAY,EACZC,OAAO,EACPC,OAAO,EACPC,eAAe,EACfC,IAAI,EACJC,aAAa,EACbC,qBAAqB,EACrBC,GAAG,EACHC,OAAO,EACPC,KAAK,EACA;IACLV,OAAOW,OAAO,CAAC,CAACC;QACd,IAAIC,aAAa;QACjB,IAAIC,YAAY;QAChB,IAAIC;QAEJ,IAAIlC,iBAAiB+B,QAAQ;YAC3BC,aAAa,CAAC,EAAEjB,gBAAgB,GAAG,EAAEd,YAAY8B,MAAMI,IAAI,EAAE,CAAC;YAC9DF,YAAY,CAAC,EAAEf,eAAe,GAAG,EAAEa,MAAMI,IAAI,CAAC,CAAC;YAC/CD,YAAYlB,IAAI,CAACe,MAAMI,IAAI,CAAC;QAC9B;QAEA,IAAIJ,MAAMK,IAAI,KAAK,SAAS;YAC1B,MAAMC,iBAAiB3B,QAAQ4B,YAAY,CAACC,GAAG,CAAC,CAAC,EAAEhB,gBAAgB,CAAC,EAAES,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O;gBACL,IAAIsB,MAAMvC;gBAEV,IAAIP,cAAc;oBAChB,IAAI,CAACC,OAAO,CAACD,aAAa,EAAEC,OAAO,CAACD,aAAa,GAAG,CAAC;oBACrD8C,MAAM7C,OAAO,CAACD,aAAa;gBAC7B;gBAEA6C,kBAAkBR,IAAI,CAAC;oBAAES;oBAAKC,OAAOjC;gBAAU;YACjD;YAEA+B,kBAAkBnC,OAAO,CAAC,CAAC,EAAEa,SAAS,EAAEuB,GAAG,EAAEC,KAAK,EAAE;gBAClD,IAAI,OAAOA,UAAU,aAAa;oBAChC,IAAIC,iBAAiBD;oBAErB,IAAIpC,MAAMK,IAAI,KAAK,UAAUL,MAAMI,IAAI,KAAK,aAAa;wBACvDiC,iBAAiB,IAAIC,OAAOC,WAAW;oBACzC;oBAEA,IAAI3B,WAAW;wBACbuB,GAAG,CAACvB,UAAU,CAACV,UAAU,GAAGmC;oBAC9B,OAAO;wBACLF,GAAG,CAACjC,UAAU,GAAGmC;oBACnB;gBACF;YACF;QACF;IACF;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/transform/write/types.ts"],"sourcesContent":["export type ArrayRowToInsert = {\n arrays: {\n [tableName: string]: ArrayRowToInsert[]\n }\n locales: {\n [locale: string]: Record<string, unknown>\n }\n row: Record<string, unknown>\n}\n\nexport type BlockRowToInsert = {\n arrays: {\n [tableName: string]: ArrayRowToInsert[]\n }\n locales: {\n [locale: string]: Record<string, unknown>\n }\n row: Record<string, unknown>\n}\n\nexport type RelationshipToDelete = {\n locale?: string\n path: string\n}\n\nexport type RowToInsert = {\n arrays: {\n [tableName: string]: ArrayRowToInsert[]\n }\n blocks: {\n [blockType: string]: BlockRowToInsert[]\n }\n blocksToDelete: Set<string>\n locales: {\n [locale: string]: Record<string, unknown>\n }\n numbers: Record<string, unknown>[]\n relationships: Record<string, unknown>[]\n relationshipsToDelete: RelationshipToDelete[]\n row: Record<string, unknown>\n selects: {\n [tableName: string]: Record<string, unknown>[]\n }\n texts: Record<string, unknown>[]\n}\n"],"names":[],"rangeMappings":"","mappings":"AAyBA,WAmBC"}
1
+ {"version":3,"sources":["../../../src/transform/write/types.ts"],"sourcesContent":["export type ArrayRowToInsert = {\n arrays: {\n [tableName: string]: ArrayRowToInsert[]\n }\n locales: {\n [locale: string]: Record<string, unknown>\n }\n row: Record<string, unknown>\n}\n\nexport type BlockRowToInsert = {\n arrays: {\n [tableName: string]: ArrayRowToInsert[]\n }\n locales: {\n [locale: string]: Record<string, unknown>\n }\n row: Record<string, unknown>\n}\n\nexport type RelationshipToDelete = {\n locale?: string\n path: string\n}\n\nexport type RowToInsert = {\n arrays: {\n [tableName: string]: ArrayRowToInsert[]\n }\n blocks: {\n [blockType: string]: BlockRowToInsert[]\n }\n blocksToDelete: Set<string>\n locales: {\n [locale: string]: Record<string, unknown>\n }\n numbers: Record<string, unknown>[]\n relationships: Record<string, unknown>[]\n relationshipsToDelete: RelationshipToDelete[]\n row: Record<string, unknown>\n selects: {\n [tableName: string]: Record<string, unknown>[]\n }\n texts: Record<string, unknown>[]\n}\n"],"names":[],"mappings":"AAyBA,WAmBC"}
package/dist/types.d.ts CHANGED
@@ -2,9 +2,7 @@ import type { ColumnBaseConfig, ColumnDataType, DrizzleConfig, ExtractTablesWith
2
2
  import type { NodePgDatabase, NodePgQueryResultHKT } from 'drizzle-orm/node-postgres';
3
3
  import type { PgColumn, PgEnum, PgSchema, PgTableWithColumns, PgTransaction } from 'drizzle-orm/pg-core';
4
4
  import type { PgTableFn } from 'drizzle-orm/pg-core/table';
5
- import type { Payload } from 'payload';
6
- import type { BaseDatabaseAdapter } from 'payload/database';
7
- import type { PayloadRequestWithData } from 'payload/types';
5
+ import type { BaseDatabaseAdapter, Payload, PayloadRequest } from 'payload';
8
6
  import type { Pool, PoolConfig } from 'pg';
9
7
  export type DrizzleDB = NodePgDatabase<Record<string, unknown>>;
10
8
  export type Args = {
@@ -72,11 +70,11 @@ export type PostgresAdapterResult = (args: {
72
70
  }) => PostgresAdapter;
73
71
  export type MigrateUpArgs = {
74
72
  payload: Payload;
75
- req?: Partial<PayloadRequestWithData>;
73
+ req?: Partial<PayloadRequest>;
76
74
  };
77
75
  export type MigrateDownArgs = {
78
76
  payload: Payload;
79
- req?: Partial<PayloadRequestWithData>;
77
+ req?: Partial<PayloadRequest>;
80
78
  };
81
79
  declare module 'payload' {
82
80
  interface DatabaseAdapter extends Omit<Args, 'migrationDir' | 'pool'>, BaseDatabaseAdapter {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,0BAA0B,EAC1B,QAAQ,EACR,SAAS,EACV,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrF,OAAO,KAAK,EACV,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACd,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAE1C,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;AAE/D,MAAM,MAAM,IAAI,GAAG;IACjB,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAA;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,MAAM,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;IAChC,YA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,CAAC;IACvB,UAAiB,eACf,SAAQ,IAAI,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAAC,EACzC,mBAAmB;QACrB,OAAO,EAAE,SAAS,CAAA;QAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;QAClC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;QACxD,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,IAAI,EAAE,IAAI,CAAA;QACV,IAAI,EAAE,OAAO,CAAA;QACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;QAC1C,mBAAmB,CAAC,EAAE,MAAM,CAAA;QAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,eAAe,GAAG,YAAY,CAAC,CAAA;QACpE,QAAQ,EAAE;YACR,CAAC,EAAE,EAAE,MAAM,GAAG;gBACZ,EAAE,EAAE,kBAAkB,CAAA;gBACtB,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;gBAC3B,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;aAC7B,CAAA;SACF,CAAA;QACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;QACpC,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB;CACF"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n ColumnBaseConfig,\n ColumnDataType,\n DrizzleConfig,\n ExtractTablesWithRelations,\n Relation,\n Relations,\n} from 'drizzle-orm'\nimport type { NodePgDatabase, NodePgQueryResultHKT } from 'drizzle-orm/node-postgres'\nimport type {\n PgColumn,\n PgEnum,\n PgSchema,\n PgTableWithColumns,\n PgTransaction,\n} from 'drizzle-orm/pg-core'\nimport type { PgTableFn } from 'drizzle-orm/pg-core/table'\nimport type { Payload } from 'payload'\nimport type { BaseDatabaseAdapter } from 'payload/database'\nimport type { PayloadRequestWithData } from 'payload/types'\nimport type { Pool, PoolConfig } from 'pg'\n\nexport type DrizzleDB = NodePgDatabase<Record<string, unknown>>\n\nexport type Args = {\n idType?: 'serial' | 'uuid'\n localesSuffix?: string\n logger?: DrizzleConfig['logger']\n migrationDir?: string\n pool: PoolConfig\n push?: boolean\n relationshipsSuffix?: string\n schemaName?: string\n versionsSuffix?: string\n}\n\nexport type GenericColumn = PgColumn<\n ColumnBaseConfig<ColumnDataType, string>,\n Record<string, unknown>\n>\n\nexport type GenericColumns = {\n [x: string]: GenericColumn\n}\n\nexport type GenericTable = PgTableWithColumns<{\n columns: GenericColumns\n dialect: string\n name: string\n schema: undefined\n}>\n\nexport type GenericEnum = PgEnum<[string, ...string[]]>\n\nexport type GenericRelation = Relations<string, Record<string, Relation<string>>>\n\nexport type DrizzleTransaction = PgTransaction<\n NodePgQueryResultHKT,\n Record<string, unknown>,\n ExtractTablesWithRelations<Record<string, unknown>>\n>\n\nexport type PostgresAdapter = BaseDatabaseAdapter & {\n drizzle: DrizzleDB\n enums: Record<string, GenericEnum>\n /**\n * An object keyed on each table, with a key value pair where the constraint name is the key, followed by the dot-notation field name\n * Used for returning properly formed errors from unique fields\n */\n fieldConstraints: Record<string, Record<string, string>>\n idType: Args['idType']\n initializing: Promise<void>\n localesSuffix?: string\n logger: DrizzleConfig['logger']\n pgSchema?: { table: PgTableFn } | PgSchema\n pool: Pool\n poolOptions: Args['pool']\n push: boolean\n rejectInitializing: () => void\n relations: Record<string, GenericRelation>\n relationshipsSuffix?: string\n resolveInitializing: () => void\n schema: Record<string, GenericEnum | GenericRelation | GenericTable>\n schemaName?: Args['schemaName']\n sessions: {\n [id: string]: {\n db: DrizzleTransaction\n reject: () => Promise<void>\n resolve: () => Promise<void>\n }\n }\n tableNameMap: Map<string, string>\n tables: Record<string, GenericTable | PgTableWithColumns<any>>\n versionsSuffix?: string\n}\n\nexport type IDType = 'integer' | 'numeric' | 'uuid' | 'varchar'\n\nexport type PostgresAdapterResult = (args: { payload: Payload }) => PostgresAdapter\n\nexport type MigrateUpArgs = { payload: Payload; req?: Partial<PayloadRequestWithData> }\nexport type MigrateDownArgs = { payload: Payload; req?: Partial<PayloadRequestWithData> }\n\ndeclare module 'payload' {\n export interface DatabaseAdapter\n extends Omit<Args, 'migrationDir' | 'pool'>,\n BaseDatabaseAdapter {\n drizzle: DrizzleDB\n enums: Record<string, GenericEnum>\n fieldConstraints: Record<string, Record<string, string>>\n localeSuffix?: string\n pool: Pool\n push: boolean\n relations: Record<string, GenericRelation>\n relationshipsSuffix?: string\n schema: Record<string, GenericEnum | GenericRelation | GenericTable>\n sessions: {\n [id: string]: {\n db: DrizzleTransaction\n reject: () => Promise<void>\n resolve: () => Promise<void>\n }\n }\n tables: Record<string, GenericTable>\n versionsSuffix?: string\n }\n}\n"],"names":[],"rangeMappings":"","mappings":"AAqGA,WAAyF"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n ColumnBaseConfig,\n ColumnDataType,\n DrizzleConfig,\n ExtractTablesWithRelations,\n Relation,\n Relations,\n} from 'drizzle-orm'\nimport type { NodePgDatabase, NodePgQueryResultHKT } from 'drizzle-orm/node-postgres'\nimport type {\n PgColumn,\n PgEnum,\n PgSchema,\n PgTableWithColumns,\n PgTransaction,\n} from 'drizzle-orm/pg-core'\nimport type { PgTableFn } from 'drizzle-orm/pg-core/table'\nimport type { BaseDatabaseAdapter, Payload, PayloadRequest } from 'payload'\nimport type { Pool, PoolConfig } from 'pg'\n\nexport type DrizzleDB = NodePgDatabase<Record<string, unknown>>\n\nexport type Args = {\n idType?: 'serial' | 'uuid'\n localesSuffix?: string\n logger?: DrizzleConfig['logger']\n migrationDir?: string\n pool: PoolConfig\n push?: boolean\n relationshipsSuffix?: string\n schemaName?: string\n versionsSuffix?: string\n}\n\nexport type GenericColumn = PgColumn<\n ColumnBaseConfig<ColumnDataType, string>,\n Record<string, unknown>\n>\n\nexport type GenericColumns = {\n [x: string]: GenericColumn\n}\n\nexport type GenericTable = PgTableWithColumns<{\n columns: GenericColumns\n dialect: string\n name: string\n schema: undefined\n}>\n\nexport type GenericEnum = PgEnum<[string, ...string[]]>\n\nexport type GenericRelation = Relations<string, Record<string, Relation<string>>>\n\nexport type DrizzleTransaction = PgTransaction<\n NodePgQueryResultHKT,\n Record<string, unknown>,\n ExtractTablesWithRelations<Record<string, unknown>>\n>\n\nexport type PostgresAdapter = BaseDatabaseAdapter & {\n drizzle: DrizzleDB\n enums: Record<string, GenericEnum>\n /**\n * An object keyed on each table, with a key value pair where the constraint name is the key, followed by the dot-notation field name\n * Used for returning properly formed errors from unique fields\n */\n fieldConstraints: Record<string, Record<string, string>>\n idType: Args['idType']\n initializing: Promise<void>\n localesSuffix?: string\n logger: DrizzleConfig['logger']\n pgSchema?: { table: PgTableFn } | PgSchema\n pool: Pool\n poolOptions: Args['pool']\n push: boolean\n rejectInitializing: () => void\n relations: Record<string, GenericRelation>\n relationshipsSuffix?: string\n resolveInitializing: () => void\n schema: Record<string, GenericEnum | GenericRelation | GenericTable>\n schemaName?: Args['schemaName']\n sessions: {\n [id: string]: {\n db: DrizzleTransaction\n reject: () => Promise<void>\n resolve: () => Promise<void>\n }\n }\n tableNameMap: Map<string, string>\n tables: Record<string, GenericTable | PgTableWithColumns<any>>\n versionsSuffix?: string\n}\n\nexport type IDType = 'integer' | 'numeric' | 'uuid' | 'varchar'\n\nexport type PostgresAdapterResult = (args: { payload: Payload }) => PostgresAdapter\n\nexport type MigrateUpArgs = { payload: Payload; req?: Partial<PayloadRequest> }\nexport type MigrateDownArgs = { payload: Payload; req?: Partial<PayloadRequest> }\n\ndeclare module 'payload' {\n export interface DatabaseAdapter\n extends Omit<Args, 'migrationDir' | 'pool'>,\n BaseDatabaseAdapter {\n drizzle: DrizzleDB\n enums: Record<string, GenericEnum>\n fieldConstraints: Record<string, Record<string, string>>\n localeSuffix?: string\n pool: Pool\n push: boolean\n relations: Record<string, GenericRelation>\n relationshipsSuffix?: string\n schema: Record<string, GenericEnum | GenericRelation | GenericTable>\n sessions: {\n [id: string]: {\n db: DrizzleTransaction\n reject: () => Promise<void>\n resolve: () => Promise<void>\n }\n }\n tables: Record<string, GenericTable>\n versionsSuffix?: string\n }\n}\n"],"names":[],"mappings":"AAmGA,WAAiF"}
package/dist/update.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import type { UpdateOne } from 'payload/database';
1
+ import type { UpdateOne } from 'payload';
2
2
  export declare const updateOne: UpdateOne;
3
3
  //# sourceMappingURL=update.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAUjD,eAAO,MAAM,SAAS,EAAE,SA4CvB,CAAA"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAUxC,eAAO,MAAM,SAAS,EAAE,SA4CvB,CAAA"}
package/dist/update.js CHANGED
@@ -3,7 +3,7 @@ import buildQuery from './queries/buildQuery.js';
3
3
  import { selectDistinct } from './queries/selectDistinct.js';
4
4
  import { upsertRow } from './upsertRow/index.js';
5
5
  export const updateOne = async function updateOne({ id, collection: collectionSlug, data, draft, locale, req, where: whereArg }) {
6
- const db = this.sessions[req.transactionID]?.db || this.drizzle;
6
+ const db = this.sessions[await req.transactionID]?.db || this.drizzle;
7
7
  const collection = this.payload.collections[collectionSlug].config;
8
8
  const tableName = this.tableNameMap.get(toSnakeCase(collection.slug));
9
9
  const whereToUse = whereArg || {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/update.ts"],"sourcesContent":["import type { UpdateOne } from 'payload/database'\n\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport buildQuery from './queries/buildQuery.js'\nimport { selectDistinct } from './queries/selectDistinct.js'\nimport { upsertRow } from './upsertRow/index.js'\n\nexport const updateOne: UpdateOne = async function updateOne(\n this: PostgresAdapter,\n { id, collection: collectionSlug, data, draft, locale, req, where: whereArg },\n) {\n const db = this.sessions[req.transactionID]?.db || this.drizzle\n const collection = this.payload.collections[collectionSlug].config\n const tableName = this.tableNameMap.get(toSnakeCase(collection.slug))\n const whereToUse = whereArg || { id: { equals: id } }\n let idToUpdate = id\n\n const { joins, selectFields, where } = await buildQuery({\n adapter: this,\n fields: collection.fields,\n locale,\n tableName,\n where: whereToUse,\n })\n\n const selectDistinctResult = await selectDistinct({\n adapter: this,\n chainedMethods: [{ args: [1], method: 'limit' }],\n db,\n joins,\n selectFields,\n tableName,\n where,\n })\n\n if (selectDistinctResult?.[0]?.id) {\n idToUpdate = selectDistinctResult?.[0]?.id\n }\n\n const result = await upsertRow({\n id: idToUpdate,\n adapter: this,\n data,\n db,\n fields: collection.fields,\n operation: 'update',\n req,\n tableName,\n })\n\n return result\n}\n"],"names":["toSnakeCase","buildQuery","selectDistinct","upsertRow","updateOne","id","collection","collectionSlug","data","draft","locale","req","where","whereArg","db","sessions","transactionID","drizzle","payload","collections","config","tableName","tableNameMap","get","slug","whereToUse","equals","idToUpdate","joins","selectFields","adapter","fields","selectDistinctResult","chainedMethods","args","method","result","operation"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAOA,iBAAiB,gBAAe;AAIvC,OAAOC,gBAAgB,0BAAyB;AAChD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,MAAMC,YAAuB,eAAeA,UAEjD,EAAEC,EAAE,EAAEC,YAAYC,cAAc,EAAEC,IAAI,EAAEC,KAAK,EAAEC,MAAM,EAAEC,GAAG,EAAEC,OAAOC,QAAQ,EAAE;IAE7E,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACJ,IAAIK,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMX,aAAa,IAAI,CAACY,OAAO,CAACC,WAAW,CAACZ,eAAe,CAACa,MAAM;IAClE,MAAMC,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAACvB,YAAYM,WAAWkB,IAAI;IACnE,MAAMC,aAAaZ,YAAY;QAAER,IAAI;YAAEqB,QAAQrB;QAAG;IAAE;IACpD,IAAIsB,aAAatB;IAEjB,MAAM,EAAEuB,KAAK,EAAEC,YAAY,EAAEjB,KAAK,EAAE,GAAG,MAAMX,WAAW;QACtD6B,SAAS,IAAI;QACbC,QAAQzB,WAAWyB,MAAM;QACzBrB;QACAW;QACAT,OAAOa;IACT;IAEA,MAAMO,uBAAuB,MAAM9B,eAAe;QAChD4B,SAAS,IAAI;QACbG,gBAAgB;YAAC;gBAAEC,MAAM;oBAAC;iBAAE;gBAAEC,QAAQ;YAAQ;SAAE;QAChDrB;QACAc;QACAC;QACAR;QACAT;IACF;IAEA,IAAIoB,sBAAsB,CAAC,EAAE,EAAE3B,IAAI;QACjCsB,aAAaK,sBAAsB,CAAC,EAAE,EAAE3B;IAC1C;IAEA,MAAM+B,SAAS,MAAMjC,UAAU;QAC7BE,IAAIsB;QACJG,SAAS,IAAI;QACbtB;QACAM;QACAiB,QAAQzB,WAAWyB,MAAM;QACzBM,WAAW;QACX1B;QACAU;IACF;IAEA,OAAOe;AACT,EAAC"}
1
+ {"version":3,"sources":["../src/update.ts"],"sourcesContent":["import type { UpdateOne } from 'payload'\n\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport buildQuery from './queries/buildQuery.js'\nimport { selectDistinct } from './queries/selectDistinct.js'\nimport { upsertRow } from './upsertRow/index.js'\n\nexport const updateOne: UpdateOne = async function updateOne(\n this: PostgresAdapter,\n { id, collection: collectionSlug, data, draft, locale, req, where: whereArg },\n) {\n const db = this.sessions[await req.transactionID]?.db || this.drizzle\n const collection = this.payload.collections[collectionSlug].config\n const tableName = this.tableNameMap.get(toSnakeCase(collection.slug))\n const whereToUse = whereArg || { id: { equals: id } }\n let idToUpdate = id\n\n const { joins, selectFields, where } = await buildQuery({\n adapter: this,\n fields: collection.fields,\n locale,\n tableName,\n where: whereToUse,\n })\n\n const selectDistinctResult = await selectDistinct({\n adapter: this,\n chainedMethods: [{ args: [1], method: 'limit' }],\n db,\n joins,\n selectFields,\n tableName,\n where,\n })\n\n if (selectDistinctResult?.[0]?.id) {\n idToUpdate = selectDistinctResult?.[0]?.id\n }\n\n const result = await upsertRow({\n id: idToUpdate,\n adapter: this,\n data,\n db,\n fields: collection.fields,\n operation: 'update',\n req,\n tableName,\n })\n\n return result\n}\n"],"names":["toSnakeCase","buildQuery","selectDistinct","upsertRow","updateOne","id","collection","collectionSlug","data","draft","locale","req","where","whereArg","db","sessions","transactionID","drizzle","payload","collections","config","tableName","tableNameMap","get","slug","whereToUse","equals","idToUpdate","joins","selectFields","adapter","fields","selectDistinctResult","chainedMethods","args","method","result","operation"],"mappings":"AAEA,OAAOA,iBAAiB,gBAAe;AAIvC,OAAOC,gBAAgB,0BAAyB;AAChD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,MAAMC,YAAuB,eAAeA,UAEjD,EAAEC,EAAE,EAAEC,YAAYC,cAAc,EAAEC,IAAI,EAAEC,KAAK,EAAEC,MAAM,EAAEC,GAAG,EAAEC,OAAOC,QAAQ,EAAE;IAE7E,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAAC,MAAMJ,IAAIK,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IACrE,MAAMX,aAAa,IAAI,CAACY,OAAO,CAACC,WAAW,CAACZ,eAAe,CAACa,MAAM;IAClE,MAAMC,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAACvB,YAAYM,WAAWkB,IAAI;IACnE,MAAMC,aAAaZ,YAAY;QAAER,IAAI;YAAEqB,QAAQrB;QAAG;IAAE;IACpD,IAAIsB,aAAatB;IAEjB,MAAM,EAAEuB,KAAK,EAAEC,YAAY,EAAEjB,KAAK,EAAE,GAAG,MAAMX,WAAW;QACtD6B,SAAS,IAAI;QACbC,QAAQzB,WAAWyB,MAAM;QACzBrB;QACAW;QACAT,OAAOa;IACT;IAEA,MAAMO,uBAAuB,MAAM9B,eAAe;QAChD4B,SAAS,IAAI;QACbG,gBAAgB;YAAC;gBAAEC,MAAM;oBAAC;iBAAE;gBAAEC,QAAQ;YAAQ;SAAE;QAChDrB;QACAc;QACAC;QACAR;QACAT;IACF;IAEA,IAAIoB,sBAAsB,CAAC,EAAE,EAAE3B,IAAI;QACjCsB,aAAaK,sBAAsB,CAAC,EAAE,EAAE3B;IAC1C;IAEA,MAAM+B,SAAS,MAAMjC,UAAU;QAC7BE,IAAIsB;QACJG,SAAS,IAAI;QACbtB;QACAM;QACAiB,QAAQzB,WAAWyB,MAAM;QACzBM,WAAW;QACX1B;QACAU;IACF;IAEA,OAAOe;AACT,EAAC"}
@@ -1,5 +1,4 @@
1
- import type { UpdateGlobalArgs } from 'payload/database';
2
- import type { TypeWithID } from 'payload/types';
1
+ import type { UpdateGlobalArgs } from 'payload';
3
2
  import type { PostgresAdapter } from './types.js';
4
- export declare function updateGlobal<T extends TypeWithID>(this: PostgresAdapter, { slug, data, req }: UpdateGlobalArgs): Promise<T>;
3
+ export declare function updateGlobal<T extends Record<string, unknown>>(this: PostgresAdapter, { slug, data, req }: UpdateGlobalArgs): Promise<T>;
5
4
  //# sourceMappingURL=updateGlobal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateGlobal.d.ts","sourceRoot":"","sources":["../src/updateGlobal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,KAAK,EAA0B,UAAU,EAAE,MAAM,eAAe,CAAA;AAIvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAIjD,wBAAsB,YAAY,CAAC,CAAC,SAAS,UAAU,EACrD,IAAI,EAAE,eAAe,EACrB,EAAE,IAAI,EAAE,IAAI,EAAE,GAAkC,EAAE,EAAE,gBAAgB,GACnE,OAAO,CAAC,CAAC,CAAC,CAkBZ"}
1
+ {"version":3,"file":"updateGlobal.d.ts","sourceRoot":"","sources":["../src/updateGlobal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAI/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAIjD,wBAAsB,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,IAAI,EAAE,eAAe,EACrB,EAAE,IAAI,EAAE,IAAI,EAAE,GAA0B,EAAE,EAAE,gBAAgB,GAC3D,OAAO,CAAC,CAAC,CAAC,CAkBZ"}
@@ -1,7 +1,7 @@
1
1
  import toSnakeCase from 'to-snake-case';
2
2
  import { upsertRow } from './upsertRow/index.js';
3
3
  export async function updateGlobal({ slug, data, req = {} }) {
4
- const db = this.sessions[req.transactionID]?.db || this.drizzle;
4
+ const db = this.sessions[await req.transactionID]?.db || this.drizzle;
5
5
  const globalConfig = this.payload.globals.config.find((config)=>config.slug === slug);
6
6
  const tableName = this.tableNameMap.get(toSnakeCase(globalConfig.slug));
7
7
  const existingGlobal = await db.query[tableName].findFirst({});
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/updateGlobal.ts"],"sourcesContent":["import type { UpdateGlobalArgs } from 'payload/database'\nimport type { PayloadRequestWithData, TypeWithID } from 'payload/types'\n\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport { upsertRow } from './upsertRow/index.js'\n\nexport async function updateGlobal<T extends TypeWithID>(\n this: PostgresAdapter,\n { slug, data, req = {} as PayloadRequestWithData }: UpdateGlobalArgs,\n): Promise<T> {\n const db = this.sessions[req.transactionID]?.db || this.drizzle\n const globalConfig = this.payload.globals.config.find((config) => config.slug === slug)\n const tableName = this.tableNameMap.get(toSnakeCase(globalConfig.slug))\n\n const existingGlobal = await db.query[tableName].findFirst({})\n\n const result = await upsertRow<T>({\n ...(existingGlobal ? { id: existingGlobal.id, operation: 'update' } : { operation: 'create' }),\n adapter: this,\n data,\n db,\n fields: globalConfig.fields,\n req,\n tableName,\n })\n\n return result\n}\n"],"names":["toSnakeCase","upsertRow","updateGlobal","slug","data","req","db","sessions","transactionID","drizzle","globalConfig","payload","globals","config","find","tableName","tableNameMap","get","existingGlobal","query","findFirst","result","id","operation","adapter","fields"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,OAAOA,iBAAiB,gBAAe;AAIvC,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,eAAeC,aAEpB,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,CAAC,CAA2B,EAAoB;IAEpE,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACF,IAAIG,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMC,eAAe,IAAI,CAACC,OAAO,CAACC,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOV,IAAI,KAAKA;IAClF,MAAMY,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAACjB,YAAYU,aAAaP,IAAI;IAErE,MAAMe,iBAAiB,MAAMZ,GAAGa,KAAK,CAACJ,UAAU,CAACK,SAAS,CAAC,CAAC;IAE5D,MAAMC,SAAS,MAAMpB,UAAa;QAChC,GAAIiB,iBAAiB;YAAEI,IAAIJ,eAAeI,EAAE;YAAEC,WAAW;QAAS,IAAI;YAAEA,WAAW;QAAS,CAAC;QAC7FC,SAAS,IAAI;QACbpB;QACAE;QACAmB,QAAQf,aAAae,MAAM;QAC3BpB;QACAU;IACF;IAEA,OAAOM;AACT"}
1
+ {"version":3,"sources":["../src/updateGlobal.ts"],"sourcesContent":["import type { PayloadRequest, UpdateGlobalArgs } from 'payload'\n\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport { upsertRow } from './upsertRow/index.js'\n\nexport async function updateGlobal<T extends Record<string, unknown>>(\n this: PostgresAdapter,\n { slug, data, req = {} as PayloadRequest }: UpdateGlobalArgs,\n): Promise<T> {\n const db = this.sessions[await req.transactionID]?.db || this.drizzle\n const globalConfig = this.payload.globals.config.find((config) => config.slug === slug)\n const tableName = this.tableNameMap.get(toSnakeCase(globalConfig.slug))\n\n const existingGlobal = await db.query[tableName].findFirst({})\n\n const result = await upsertRow<T>({\n ...(existingGlobal ? { id: existingGlobal.id, operation: 'update' } : { operation: 'create' }),\n adapter: this,\n data,\n db,\n fields: globalConfig.fields,\n req,\n tableName,\n })\n\n return result\n}\n"],"names":["toSnakeCase","upsertRow","updateGlobal","slug","data","req","db","sessions","transactionID","drizzle","globalConfig","payload","globals","config","find","tableName","tableNameMap","get","existingGlobal","query","findFirst","result","id","operation","adapter","fields"],"mappings":"AAEA,OAAOA,iBAAiB,gBAAe;AAIvC,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,eAAeC,aAEpB,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,CAAC,CAAmB,EAAoB;IAE5D,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAAC,MAAMF,IAAIG,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IACrE,MAAMC,eAAe,IAAI,CAACC,OAAO,CAACC,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC,CAACD,SAAWA,OAAOV,IAAI,KAAKA;IAClF,MAAMY,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAACjB,YAAYU,aAAaP,IAAI;IAErE,MAAMe,iBAAiB,MAAMZ,GAAGa,KAAK,CAACJ,UAAU,CAACK,SAAS,CAAC,CAAC;IAE5D,MAAMC,SAAS,MAAMpB,UAAa;QAChC,GAAIiB,iBAAiB;YAAEI,IAAIJ,eAAeI,EAAE;YAAEC,WAAW;QAAS,IAAI;YAAEA,WAAW;QAAS,CAAC;QAC7FC,SAAS,IAAI;QACbpB;QACAE;QACAmB,QAAQf,aAAae,MAAM;QAC3BpB;QACAU;IACF;IAEA,OAAOM;AACT"}
@@ -1,5 +1,4 @@
1
- import type { TypeWithVersion, UpdateGlobalVersionArgs } from 'payload/database';
2
- import type { TypeWithID } from 'payload/types';
1
+ import type { TypeWithID, TypeWithVersion, UpdateGlobalVersionArgs } from 'payload';
3
2
  import type { PostgresAdapter } from './types.js';
4
3
  export declare function updateGlobalVersion<T extends TypeWithID>(this: PostgresAdapter, { id, global, locale, req, versionData, where: whereArg, }: UpdateGlobalVersionArgs<T>): Promise<TypeWithVersion<T>>;
5
4
  //# sourceMappingURL=updateGlobalVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateGlobalVersion.d.ts","sourceRoot":"","sources":["../src/updateGlobalVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAChF,OAAO,KAAK,EAAiD,UAAU,EAAE,MAAM,eAAe,CAAA;AAK9F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAKjD,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAC5D,IAAI,EAAE,eAAe,EACrB,EACE,EAAE,EACF,MAAM,EACN,MAAM,EACN,GAAkC,EAClC,WAAW,EACX,KAAK,EAAE,QAAQ,GAChB,EAAE,uBAAuB,CAAC,CAAC,CAAC,+BAmC9B"}
1
+ {"version":3,"file":"updateGlobalVersion.d.ts","sourceRoot":"","sources":["../src/updateGlobalVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,UAAU,EACV,eAAe,EACf,uBAAuB,EACxB,MAAM,SAAS,CAAA;AAKhB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAKjD,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAC5D,IAAI,EAAE,eAAe,EACrB,EACE,EAAE,EACF,MAAM,EACN,MAAM,EACN,GAA0B,EAC1B,WAAW,EACX,KAAK,EAAE,QAAQ,GAChB,EAAE,uBAAuB,CAAC,CAAC,CAAC,+BAmC9B"}
@@ -1,9 +1,9 @@
1
- import { buildVersionGlobalFields } from 'payload/versions';
1
+ import { buildVersionGlobalFields } from 'payload';
2
2
  import toSnakeCase from 'to-snake-case';
3
3
  import buildQuery from './queries/buildQuery.js';
4
4
  import { upsertRow } from './upsertRow/index.js';
5
5
  export async function updateGlobalVersion({ id, global, locale, req = {}, versionData, where: whereArg }) {
6
- const db = this.sessions[req.transactionID]?.db || this.drizzle;
6
+ const db = this.sessions[await req.transactionID]?.db || this.drizzle;
7
7
  const globalConfig = this.payload.globals.config.find(({ slug })=>slug === global);
8
8
  const whereToUse = whereArg || {
9
9
  id: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/updateGlobalVersion.ts"],"sourcesContent":["import type { TypeWithVersion, UpdateGlobalVersionArgs } from 'payload/database'\nimport type { PayloadRequestWithData, SanitizedGlobalConfig, TypeWithID } from 'payload/types'\n\nimport { buildVersionGlobalFields } from 'payload/versions'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport buildQuery from './queries/buildQuery.js'\nimport { upsertRow } from './upsertRow/index.js'\n\nexport async function updateGlobalVersion<T extends TypeWithID>(\n this: PostgresAdapter,\n {\n id,\n global,\n locale,\n req = {} as PayloadRequestWithData,\n versionData,\n where: whereArg,\n }: UpdateGlobalVersionArgs<T>,\n) {\n const db = this.sessions[req.transactionID]?.db || this.drizzle\n const globalConfig: SanitizedGlobalConfig = this.payload.globals.config.find(\n ({ slug }) => slug === global,\n )\n const whereToUse = whereArg || { id: { equals: id } }\n\n const tableName = this.tableNameMap.get(\n `_${toSnakeCase(globalConfig.slug)}${this.versionsSuffix}`,\n )\n\n const fields = buildVersionGlobalFields(globalConfig)\n\n const { where } = await buildQuery({\n adapter: this,\n fields,\n locale,\n tableName,\n where: whereToUse,\n })\n\n const result = await upsertRow<TypeWithVersion<T>>({\n id,\n adapter: this,\n data: versionData,\n db,\n fields,\n operation: 'update',\n req,\n tableName,\n where,\n })\n\n return result\n}\n"],"names":["buildVersionGlobalFields","toSnakeCase","buildQuery","upsertRow","updateGlobalVersion","id","global","locale","req","versionData","where","whereArg","db","sessions","transactionID","drizzle","globalConfig","payload","globals","config","find","slug","whereToUse","equals","tableName","tableNameMap","get","versionsSuffix","fields","adapter","result","data","operation"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,wBAAwB,QAAQ,mBAAkB;AAC3D,OAAOC,iBAAiB,gBAAe;AAIvC,OAAOC,gBAAgB,0BAAyB;AAChD,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,eAAeC,oBAEpB,EACEC,EAAE,EACFC,MAAM,EACNC,MAAM,EACNC,MAAM,CAAC,CAA2B,EAClCC,WAAW,EACXC,OAAOC,QAAQ,EACY;IAE7B,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACL,IAAIM,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMC,eAAsC,IAAI,CAACC,OAAO,CAACC,OAAO,CAACC,MAAM,CAACC,IAAI,CAC1E,CAAC,EAAEC,IAAI,EAAE,GAAKA,SAASf;IAEzB,MAAMgB,aAAaX,YAAY;QAAEN,IAAI;YAAEkB,QAAQlB;QAAG;IAAE;IAEpD,MAAMmB,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CACrC,CAAC,CAAC,EAAEzB,YAAYe,aAAaK,IAAI,EAAE,EAAE,IAAI,CAACM,cAAc,CAAC,CAAC;IAG5D,MAAMC,SAAS5B,yBAAyBgB;IAExC,MAAM,EAAEN,KAAK,EAAE,GAAG,MAAMR,WAAW;QACjC2B,SAAS,IAAI;QACbD;QACArB;QACAiB;QACAd,OAAOY;IACT;IAEA,MAAMQ,SAAS,MAAM3B,UAA8B;QACjDE;QACAwB,SAAS,IAAI;QACbE,MAAMtB;QACNG;QACAgB;QACAI,WAAW;QACXxB;QACAgB;QACAd;IACF;IAEA,OAAOoB;AACT"}
1
+ {"version":3,"sources":["../src/updateGlobalVersion.ts"],"sourcesContent":["import type {\n PayloadRequest,\n SanitizedGlobalConfig,\n TypeWithID,\n TypeWithVersion,\n UpdateGlobalVersionArgs,\n} from 'payload'\n\nimport { buildVersionGlobalFields } from 'payload'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport buildQuery from './queries/buildQuery.js'\nimport { upsertRow } from './upsertRow/index.js'\n\nexport async function updateGlobalVersion<T extends TypeWithID>(\n this: PostgresAdapter,\n {\n id,\n global,\n locale,\n req = {} as PayloadRequest,\n versionData,\n where: whereArg,\n }: UpdateGlobalVersionArgs<T>,\n) {\n const db = this.sessions[await req.transactionID]?.db || this.drizzle\n const globalConfig: SanitizedGlobalConfig = this.payload.globals.config.find(\n ({ slug }) => slug === global,\n )\n const whereToUse = whereArg || { id: { equals: id } }\n\n const tableName = this.tableNameMap.get(\n `_${toSnakeCase(globalConfig.slug)}${this.versionsSuffix}`,\n )\n\n const fields = buildVersionGlobalFields(globalConfig)\n\n const { where } = await buildQuery({\n adapter: this,\n fields,\n locale,\n tableName,\n where: whereToUse,\n })\n\n const result = await upsertRow<TypeWithVersion<T>>({\n id,\n adapter: this,\n data: versionData,\n db,\n fields,\n operation: 'update',\n req,\n tableName,\n where,\n })\n\n return result\n}\n"],"names":["buildVersionGlobalFields","toSnakeCase","buildQuery","upsertRow","updateGlobalVersion","id","global","locale","req","versionData","where","whereArg","db","sessions","transactionID","drizzle","globalConfig","payload","globals","config","find","slug","whereToUse","equals","tableName","tableNameMap","get","versionsSuffix","fields","adapter","result","data","operation"],"mappings":"AAQA,SAASA,wBAAwB,QAAQ,UAAS;AAClD,OAAOC,iBAAiB,gBAAe;AAIvC,OAAOC,gBAAgB,0BAAyB;AAChD,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,eAAeC,oBAEpB,EACEC,EAAE,EACFC,MAAM,EACNC,MAAM,EACNC,MAAM,CAAC,CAAmB,EAC1BC,WAAW,EACXC,OAAOC,QAAQ,EACY;IAE7B,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAAC,MAAML,IAAIM,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IACrE,MAAMC,eAAsC,IAAI,CAACC,OAAO,CAACC,OAAO,CAACC,MAAM,CAACC,IAAI,CAC1E,CAAC,EAAEC,IAAI,EAAE,GAAKA,SAASf;IAEzB,MAAMgB,aAAaX,YAAY;QAAEN,IAAI;YAAEkB,QAAQlB;QAAG;IAAE;IAEpD,MAAMmB,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CACrC,CAAC,CAAC,EAAEzB,YAAYe,aAAaK,IAAI,EAAE,EAAE,IAAI,CAACM,cAAc,CAAC,CAAC;IAG5D,MAAMC,SAAS5B,yBAAyBgB;IAExC,MAAM,EAAEN,KAAK,EAAE,GAAG,MAAMR,WAAW;QACjC2B,SAAS,IAAI;QACbD;QACArB;QACAiB;QACAd,OAAOY;IACT;IAEA,MAAMQ,SAAS,MAAM3B,UAA8B;QACjDE;QACAwB,SAAS,IAAI;QACbE,MAAMtB;QACNG;QACAgB;QACAI,WAAW;QACXxB;QACAgB;QACAd;IACF;IAEA,OAAOoB;AACT"}
@@ -1,5 +1,4 @@
1
- import type { TypeWithVersion, UpdateVersionArgs } from 'payload/database';
2
- import type { TypeWithID } from 'payload/types';
1
+ import type { TypeWithID, TypeWithVersion, UpdateVersionArgs } from 'payload';
3
2
  import type { PostgresAdapter } from './types.js';
4
3
  export declare function updateVersion<T extends TypeWithID>(this: PostgresAdapter, { id, collection, locale, req, versionData, where: whereArg, }: UpdateVersionArgs<T>): Promise<TypeWithVersion<T>>;
5
4
  //# sourceMappingURL=updateVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateVersion.d.ts","sourceRoot":"","sources":["../src/updateVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAC1E,OAAO,KAAK,EAAqD,UAAU,EAAE,MAAM,eAAe,CAAA;AAKlG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAKjD,wBAAsB,aAAa,CAAC,CAAC,SAAS,UAAU,EACtD,IAAI,EAAE,eAAe,EACrB,EACE,EAAE,EACF,UAAU,EACV,MAAM,EACN,GAAkC,EAClC,WAAW,EACX,KAAK,EAAE,QAAQ,GAChB,EAAE,iBAAiB,CAAC,CAAC,CAAC,+BAgCxB"}
1
+ {"version":3,"file":"updateVersion.d.ts","sourceRoot":"","sources":["../src/updateVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,UAAU,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAKhB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAKjD,wBAAsB,aAAa,CAAC,CAAC,SAAS,UAAU,EACtD,IAAI,EAAE,eAAe,EACrB,EACE,EAAE,EACF,UAAU,EACV,MAAM,EACN,GAA0B,EAC1B,WAAW,EACX,KAAK,EAAE,QAAQ,GAChB,EAAE,iBAAiB,CAAC,CAAC,CAAC,+BAgCxB"}
@@ -1,9 +1,9 @@
1
- import { buildVersionCollectionFields } from 'payload/versions';
1
+ import { buildVersionCollectionFields } from 'payload';
2
2
  import toSnakeCase from 'to-snake-case';
3
3
  import buildQuery from './queries/buildQuery.js';
4
4
  import { upsertRow } from './upsertRow/index.js';
5
5
  export async function updateVersion({ id, collection, locale, req = {}, versionData, where: whereArg }) {
6
- const db = this.sessions[req.transactionID]?.db || this.drizzle;
6
+ const db = this.sessions[await req.transactionID]?.db || this.drizzle;
7
7
  const collectionConfig = this.payload.collections[collection].config;
8
8
  const whereToUse = whereArg || {
9
9
  id: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/updateVersion.ts"],"sourcesContent":["import type { TypeWithVersion, UpdateVersionArgs } from 'payload/database'\nimport type { PayloadRequestWithData, SanitizedCollectionConfig, TypeWithID } from 'payload/types'\n\nimport { buildVersionCollectionFields } from 'payload/versions'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport buildQuery from './queries/buildQuery.js'\nimport { upsertRow } from './upsertRow/index.js'\n\nexport async function updateVersion<T extends TypeWithID>(\n this: PostgresAdapter,\n {\n id,\n collection,\n locale,\n req = {} as PayloadRequestWithData,\n versionData,\n where: whereArg,\n }: UpdateVersionArgs<T>,\n) {\n const db = this.sessions[req.transactionID]?.db || this.drizzle\n const collectionConfig: SanitizedCollectionConfig = this.payload.collections[collection].config\n const whereToUse = whereArg || { id: { equals: id } }\n const tableName = this.tableNameMap.get(\n `_${toSnakeCase(collectionConfig.slug)}${this.versionsSuffix}`,\n )\n\n const fields = buildVersionCollectionFields(collectionConfig)\n\n const { where } = await buildQuery({\n adapter: this,\n fields,\n locale,\n tableName,\n where: whereToUse,\n })\n\n const result = await upsertRow<TypeWithVersion<T>>({\n id,\n adapter: this,\n data: versionData,\n db,\n fields,\n operation: 'update',\n req,\n tableName,\n where,\n })\n\n return result\n}\n"],"names":["buildVersionCollectionFields","toSnakeCase","buildQuery","upsertRow","updateVersion","id","collection","locale","req","versionData","where","whereArg","db","sessions","transactionID","drizzle","collectionConfig","payload","collections","config","whereToUse","equals","tableName","tableNameMap","get","slug","versionsSuffix","fields","adapter","result","data","operation"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,4BAA4B,QAAQ,mBAAkB;AAC/D,OAAOC,iBAAiB,gBAAe;AAIvC,OAAOC,gBAAgB,0BAAyB;AAChD,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,eAAeC,cAEpB,EACEC,EAAE,EACFC,UAAU,EACVC,MAAM,EACNC,MAAM,CAAC,CAA2B,EAClCC,WAAW,EACXC,OAAOC,QAAQ,EACM;IAEvB,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACL,IAAIM,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMC,mBAA8C,IAAI,CAACC,OAAO,CAACC,WAAW,CAACZ,WAAW,CAACa,MAAM;IAC/F,MAAMC,aAAaT,YAAY;QAAEN,IAAI;YAAEgB,QAAQhB;QAAG;IAAE;IACpD,MAAMiB,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CACrC,CAAC,CAAC,EAAEvB,YAAYe,iBAAiBS,IAAI,EAAE,EAAE,IAAI,CAACC,cAAc,CAAC,CAAC;IAGhE,MAAMC,SAAS3B,6BAA6BgB;IAE5C,MAAM,EAAEN,KAAK,EAAE,GAAG,MAAMR,WAAW;QACjC0B,SAAS,IAAI;QACbD;QACApB;QACAe;QACAZ,OAAOU;IACT;IAEA,MAAMS,SAAS,MAAM1B,UAA8B;QACjDE;QACAuB,SAAS,IAAI;QACbE,MAAMrB;QACNG;QACAe;QACAI,WAAW;QACXvB;QACAc;QACAZ;IACF;IAEA,OAAOmB;AACT"}
1
+ {"version":3,"sources":["../src/updateVersion.ts"],"sourcesContent":["import type {\n PayloadRequest,\n SanitizedCollectionConfig,\n TypeWithID,\n TypeWithVersion,\n UpdateVersionArgs,\n} from 'payload'\n\nimport { buildVersionCollectionFields } from 'payload'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport buildQuery from './queries/buildQuery.js'\nimport { upsertRow } from './upsertRow/index.js'\n\nexport async function updateVersion<T extends TypeWithID>(\n this: PostgresAdapter,\n {\n id,\n collection,\n locale,\n req = {} as PayloadRequest,\n versionData,\n where: whereArg,\n }: UpdateVersionArgs<T>,\n) {\n const db = this.sessions[await req.transactionID]?.db || this.drizzle\n const collectionConfig: SanitizedCollectionConfig = this.payload.collections[collection].config\n const whereToUse = whereArg || { id: { equals: id } }\n const tableName = this.tableNameMap.get(\n `_${toSnakeCase(collectionConfig.slug)}${this.versionsSuffix}`,\n )\n\n const fields = buildVersionCollectionFields(collectionConfig)\n\n const { where } = await buildQuery({\n adapter: this,\n fields,\n locale,\n tableName,\n where: whereToUse,\n })\n\n const result = await upsertRow<TypeWithVersion<T>>({\n id,\n adapter: this,\n data: versionData,\n db,\n fields,\n operation: 'update',\n req,\n tableName,\n where,\n })\n\n return result\n}\n"],"names":["buildVersionCollectionFields","toSnakeCase","buildQuery","upsertRow","updateVersion","id","collection","locale","req","versionData","where","whereArg","db","sessions","transactionID","drizzle","collectionConfig","payload","collections","config","whereToUse","equals","tableName","tableNameMap","get","slug","versionsSuffix","fields","adapter","result","data","operation"],"mappings":"AAQA,SAASA,4BAA4B,QAAQ,UAAS;AACtD,OAAOC,iBAAiB,gBAAe;AAIvC,OAAOC,gBAAgB,0BAAyB;AAChD,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,eAAeC,cAEpB,EACEC,EAAE,EACFC,UAAU,EACVC,MAAM,EACNC,MAAM,CAAC,CAAmB,EAC1BC,WAAW,EACXC,OAAOC,QAAQ,EACM;IAEvB,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAAC,MAAML,IAAIM,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IACrE,MAAMC,mBAA8C,IAAI,CAACC,OAAO,CAACC,WAAW,CAACZ,WAAW,CAACa,MAAM;IAC/F,MAAMC,aAAaT,YAAY;QAAEN,IAAI;YAAEgB,QAAQhB;QAAG;IAAE;IACpD,MAAMiB,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CACrC,CAAC,CAAC,EAAEvB,YAAYe,iBAAiBS,IAAI,EAAE,EAAE,IAAI,CAACC,cAAc,CAAC,CAAC;IAGhE,MAAMC,SAAS3B,6BAA6BgB;IAE5C,MAAM,EAAEN,KAAK,EAAE,GAAG,MAAMR,WAAW;QACjC0B,SAAS,IAAI;QACbD;QACApB;QACAe;QACAZ,OAAOU;IACT;IAEA,MAAMS,SAAS,MAAM1B,UAA8B;QACjDE;QACAuB,SAAS,IAAI;QACbE,MAAMrB;QACNG;QACAe;QACAI,WAAW;QACXvB;QACAc;QACAZ;IACF;IAEA,OAAOmB;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"deleteExistingArrayRows.d.ts","sourceRoot":"","sources":["../../src/upsertRow/deleteExistingArrayRows.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7D,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,EAAE,EAAE,SAAS,CAAA;IACb,QAAQ,EAAE,OAAO,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,uBAAuB,0CAKjC,IAAI,KAAG,QAAQ,IAAI,CAMrB,CAAA"}
1
+ {"version":3,"file":"deleteExistingArrayRows.d.ts","sourceRoot":"","sources":["../../src/upsertRow/deleteExistingArrayRows.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7D,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,EAAE,EAAE,SAAS,CAAA;IACb,QAAQ,EAAE,OAAO,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,uBAAuB,0CAKjC,IAAI,KAAG,OAAO,CAAC,IAAI,CAMrB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/upsertRow/deleteExistingArrayRows.ts"],"sourcesContent":["import { and, eq } from 'drizzle-orm'\n\nimport type { DrizzleDB, PostgresAdapter } from '../types.js'\n\ntype Args = {\n adapter: PostgresAdapter\n db: DrizzleDB\n parentID: unknown\n tableName: string\n}\n\nexport const deleteExistingArrayRows = async ({\n adapter,\n db,\n parentID,\n tableName,\n}: Args): Promise<void> => {\n const table = adapter.tables[tableName]\n\n const whereConstraints = [eq(table._parentID, parentID)]\n\n await db.delete(table).where(and(...whereConstraints))\n}\n"],"names":["and","eq","deleteExistingArrayRows","adapter","db","parentID","tableName","table","tables","whereConstraints","_parentID","delete","where"],"rangeMappings":";;;;;;;","mappings":"AAAA,SAASA,GAAG,EAAEC,EAAE,QAAQ,cAAa;AAWrC,OAAO,MAAMC,0BAA0B,OAAO,EAC5CC,OAAO,EACPC,EAAE,EACFC,QAAQ,EACRC,SAAS,EACJ;IACL,MAAMC,QAAQJ,QAAQK,MAAM,CAACF,UAAU;IAEvC,MAAMG,mBAAmB;QAACR,GAAGM,MAAMG,SAAS,EAAEL;KAAU;IAExD,MAAMD,GAAGO,MAAM,CAACJ,OAAOK,KAAK,CAACZ,OAAOS;AACtC,EAAC"}
1
+ {"version":3,"sources":["../../src/upsertRow/deleteExistingArrayRows.ts"],"sourcesContent":["import { and, eq } from 'drizzle-orm'\n\nimport type { DrizzleDB, PostgresAdapter } from '../types.js'\n\ntype Args = {\n adapter: PostgresAdapter\n db: DrizzleDB\n parentID: unknown\n tableName: string\n}\n\nexport const deleteExistingArrayRows = async ({\n adapter,\n db,\n parentID,\n tableName,\n}: Args): Promise<void> => {\n const table = adapter.tables[tableName]\n\n const whereConstraints = [eq(table._parentID, parentID)]\n\n await db.delete(table).where(and(...whereConstraints))\n}\n"],"names":["and","eq","deleteExistingArrayRows","adapter","db","parentID","tableName","table","tables","whereConstraints","_parentID","delete","where"],"mappings":"AAAA,SAASA,GAAG,EAAEC,EAAE,QAAQ,cAAa;AAWrC,OAAO,MAAMC,0BAA0B,OAAO,EAC5CC,OAAO,EACPC,EAAE,EACFC,QAAQ,EACRC,SAAS,EACJ;IACL,MAAMC,QAAQJ,QAAQK,MAAM,CAACF,UAAU;IAEvC,MAAMG,mBAAmB;QAACR,GAAGM,MAAMG,SAAS,EAAEL;KAAU;IAExD,MAAMD,GAAGO,MAAM,CAACJ,OAAOK,KAAK,CAACZ,OAAOS;AACtC,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"deleteExistingRowsByPath.d.ts","sourceRoot":"","sources":["../../src/upsertRow/deleteExistingRowsByPath.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7D,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,EAAE,EAAE,SAAS,CAAA;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,OAAO,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAC/B,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,wBAAwB,oGASlC,IAAI,KAAG,QAAQ,IAAI,CAkCrB,CAAA"}
1
+ {"version":3,"file":"deleteExistingRowsByPath.d.ts","sourceRoot":"","sources":["../../src/upsertRow/deleteExistingRowsByPath.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7D,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,EAAE,EAAE,SAAS,CAAA;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,OAAO,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IAC/B,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,wBAAwB,oGASlC,IAAI,KAAG,OAAO,CAAC,IAAI,CAkCrB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/upsertRow/deleteExistingRowsByPath.ts"],"sourcesContent":["import { and, eq, inArray } from 'drizzle-orm'\n\nimport type { DrizzleDB, PostgresAdapter } from '../types.js'\n\ntype Args = {\n adapter: PostgresAdapter\n db: DrizzleDB\n localeColumnName?: string\n parentColumnName?: string\n parentID: unknown\n pathColumnName?: string\n rows: Record<string, unknown>[]\n tableName: string\n}\n\nexport const deleteExistingRowsByPath = async ({\n adapter,\n db,\n localeColumnName = '_locale',\n parentColumnName = '_parentID',\n parentID,\n pathColumnName = '_path',\n rows,\n tableName,\n}: Args): Promise<void> => {\n const localizedPathsToDelete = new Set<string>()\n const pathsToDelete = new Set<string>()\n const table = adapter.tables[tableName]\n\n rows.forEach((row) => {\n const path = row[pathColumnName]\n const localeData = row[localeColumnName]\n if (typeof path === 'string') {\n if (typeof localeData === 'string') {\n localizedPathsToDelete.add(path)\n } else {\n pathsToDelete.add(path)\n }\n }\n })\n\n if (localizedPathsToDelete.size > 0) {\n const whereConstraints = [eq(table[parentColumnName], parentID)]\n\n if (pathColumnName)\n whereConstraints.push(inArray(table[pathColumnName], Array.from(localizedPathsToDelete)))\n\n await db.delete(table).where(and(...whereConstraints))\n }\n\n if (pathsToDelete.size > 0) {\n const whereConstraints = [eq(table[parentColumnName], parentID)]\n\n if (pathColumnName)\n whereConstraints.push(inArray(table[pathColumnName], Array.from(pathsToDelete)))\n\n await db.delete(table).where(and(...whereConstraints))\n }\n}\n"],"names":["and","eq","inArray","deleteExistingRowsByPath","adapter","db","localeColumnName","parentColumnName","parentID","pathColumnName","rows","tableName","localizedPathsToDelete","Set","pathsToDelete","table","tables","forEach","row","path","localeData","add","size","whereConstraints","push","Array","from","delete","where"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,GAAG,EAAEC,EAAE,EAAEC,OAAO,QAAQ,cAAa;AAe9C,OAAO,MAAMC,2BAA2B,OAAO,EAC7CC,OAAO,EACPC,EAAE,EACFC,mBAAmB,SAAS,EAC5BC,mBAAmB,WAAW,EAC9BC,QAAQ,EACRC,iBAAiB,OAAO,EACxBC,IAAI,EACJC,SAAS,EACJ;IACL,MAAMC,yBAAyB,IAAIC;IACnC,MAAMC,gBAAgB,IAAID;IAC1B,MAAME,QAAQX,QAAQY,MAAM,CAACL,UAAU;IAEvCD,KAAKO,OAAO,CAAC,CAACC;QACZ,MAAMC,OAAOD,GAAG,CAACT,eAAe;QAChC,MAAMW,aAAaF,GAAG,CAACZ,iBAAiB;QACxC,IAAI,OAAOa,SAAS,UAAU;YAC5B,IAAI,OAAOC,eAAe,UAAU;gBAClCR,uBAAuBS,GAAG,CAACF;YAC7B,OAAO;gBACLL,cAAcO,GAAG,CAACF;YACpB;QACF;IACF;IAEA,IAAIP,uBAAuBU,IAAI,GAAG,GAAG;QACnC,MAAMC,mBAAmB;YAACtB,GAAGc,KAAK,CAACR,iBAAiB,EAAEC;SAAU;QAEhE,IAAIC,gBACFc,iBAAiBC,IAAI,CAACtB,QAAQa,KAAK,CAACN,eAAe,EAAEgB,MAAMC,IAAI,CAACd;QAElE,MAAMP,GAAGsB,MAAM,CAACZ,OAAOa,KAAK,CAAC5B,OAAOuB;IACtC;IAEA,IAAIT,cAAcQ,IAAI,GAAG,GAAG;QAC1B,MAAMC,mBAAmB;YAACtB,GAAGc,KAAK,CAACR,iBAAiB,EAAEC;SAAU;QAEhE,IAAIC,gBACFc,iBAAiBC,IAAI,CAACtB,QAAQa,KAAK,CAACN,eAAe,EAAEgB,MAAMC,IAAI,CAACZ;QAElE,MAAMT,GAAGsB,MAAM,CAACZ,OAAOa,KAAK,CAAC5B,OAAOuB;IACtC;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/upsertRow/deleteExistingRowsByPath.ts"],"sourcesContent":["import { and, eq, inArray } from 'drizzle-orm'\n\nimport type { DrizzleDB, PostgresAdapter } from '../types.js'\n\ntype Args = {\n adapter: PostgresAdapter\n db: DrizzleDB\n localeColumnName?: string\n parentColumnName?: string\n parentID: unknown\n pathColumnName?: string\n rows: Record<string, unknown>[]\n tableName: string\n}\n\nexport const deleteExistingRowsByPath = async ({\n adapter,\n db,\n localeColumnName = '_locale',\n parentColumnName = '_parentID',\n parentID,\n pathColumnName = '_path',\n rows,\n tableName,\n}: Args): Promise<void> => {\n const localizedPathsToDelete = new Set<string>()\n const pathsToDelete = new Set<string>()\n const table = adapter.tables[tableName]\n\n rows.forEach((row) => {\n const path = row[pathColumnName]\n const localeData = row[localeColumnName]\n if (typeof path === 'string') {\n if (typeof localeData === 'string') {\n localizedPathsToDelete.add(path)\n } else {\n pathsToDelete.add(path)\n }\n }\n })\n\n if (localizedPathsToDelete.size > 0) {\n const whereConstraints = [eq(table[parentColumnName], parentID)]\n\n if (pathColumnName)\n whereConstraints.push(inArray(table[pathColumnName], Array.from(localizedPathsToDelete)))\n\n await db.delete(table).where(and(...whereConstraints))\n }\n\n if (pathsToDelete.size > 0) {\n const whereConstraints = [eq(table[parentColumnName], parentID)]\n\n if (pathColumnName)\n whereConstraints.push(inArray(table[pathColumnName], Array.from(pathsToDelete)))\n\n await db.delete(table).where(and(...whereConstraints))\n }\n}\n"],"names":["and","eq","inArray","deleteExistingRowsByPath","adapter","db","localeColumnName","parentColumnName","parentID","pathColumnName","rows","tableName","localizedPathsToDelete","Set","pathsToDelete","table","tables","forEach","row","path","localeData","add","size","whereConstraints","push","Array","from","delete","where"],"mappings":"AAAA,SAASA,GAAG,EAAEC,EAAE,EAAEC,OAAO,QAAQ,cAAa;AAe9C,OAAO,MAAMC,2BAA2B,OAAO,EAC7CC,OAAO,EACPC,EAAE,EACFC,mBAAmB,SAAS,EAC5BC,mBAAmB,WAAW,EAC9BC,QAAQ,EACRC,iBAAiB,OAAO,EACxBC,IAAI,EACJC,SAAS,EACJ;IACL,MAAMC,yBAAyB,IAAIC;IACnC,MAAMC,gBAAgB,IAAID;IAC1B,MAAME,QAAQX,QAAQY,MAAM,CAACL,UAAU;IAEvCD,KAAKO,OAAO,CAAC,CAACC;QACZ,MAAMC,OAAOD,GAAG,CAACT,eAAe;QAChC,MAAMW,aAAaF,GAAG,CAACZ,iBAAiB;QACxC,IAAI,OAAOa,SAAS,UAAU;YAC5B,IAAI,OAAOC,eAAe,UAAU;gBAClCR,uBAAuBS,GAAG,CAACF;YAC7B,OAAO;gBACLL,cAAcO,GAAG,CAACF;YACpB;QACF;IACF;IAEA,IAAIP,uBAAuBU,IAAI,GAAG,GAAG;QACnC,MAAMC,mBAAmB;YAACtB,GAAGc,KAAK,CAACR,iBAAiB,EAAEC;SAAU;QAEhE,IAAIC,gBACFc,iBAAiBC,IAAI,CAACtB,QAAQa,KAAK,CAACN,eAAe,EAAEgB,MAAMC,IAAI,CAACd;QAElE,MAAMP,GAAGsB,MAAM,CAACZ,OAAOa,KAAK,CAAC5B,OAAOuB;IACtC;IAEA,IAAIT,cAAcQ,IAAI,GAAG,GAAG;QAC1B,MAAMC,mBAAmB;YAACtB,GAAGc,KAAK,CAACR,iBAAiB,EAAEC;SAAU;QAEhE,IAAIC,gBACFc,iBAAiBC,IAAI,CAACtB,QAAQa,KAAK,CAACN,eAAe,EAAEgB,MAAMC,IAAI,CAACZ;QAElE,MAAMT,GAAGsB,MAAM,CAACZ,OAAOa,KAAK,CAAC5B,OAAOuB;IACtC;AACF,EAAC"}
@@ -1,4 +1,4 @@
1
- import type { TypeWithID } from 'payload/types';
1
+ import type { TypeWithID } from 'payload';
2
2
  import type { Args } from './types.js';
3
- export declare const upsertRow: <T extends TypeWithID>({ id, adapter, data, db, fields, ignoreResult, operation, path, req, tableName, upsertTarget, where, }: Args) => Promise<T>;
3
+ export declare const upsertRow: <T extends Record<string, unknown> | TypeWithID>({ id, adapter, data, db, fields, ignoreResult, operation, path, req, tableName, upsertTarget, where, }: Args) => Promise<T>;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/upsertRow/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAM/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAStC,eAAO,MAAM,SAAS,iIAanB,IAAI,KAAG,QAAQ,CAAC,CAsUlB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/upsertRow/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAMzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAStC,eAAO,MAAM,SAAS,GAAU,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,0GAa3E,IAAI,KAAG,OAAO,CAAC,CAAC,CAwUlB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-param-reassign */ import { eq } from 'drizzle-orm';
2
- import { ValidationError } from 'payload/errors';
2
+ import { ValidationError } from 'payload';
3
3
  import { buildFindManyArgs } from '../find/buildFindManyArgs.js';
4
4
  import { transform } from '../transform/read/index.js';
5
5
  import { transformForWrite } from '../transform/write/index.js';
@@ -245,12 +245,14 @@ export const upsertRow = async ({ id, adapter, data, db, fields, ignoreResult, o
245
245
  // Error Handling
246
246
  // //////////////////////////////////
247
247
  } catch (error) {
248
- throw error.code === '23505' ? new ValidationError([
249
- {
250
- field: adapter.fieldConstraints[tableName][error.constraint],
251
- message: req.t('error:valueMustBeUnique')
252
- }
253
- ], req.t) : error;
248
+ throw error.code === '23505' ? new ValidationError({
249
+ errors: [
250
+ {
251
+ field: adapter.fieldConstraints[tableName][error.constraint],
252
+ message: req.t('error:valueMustBeUnique')
253
+ }
254
+ ]
255
+ }, req.t) : error;
254
256
  }
255
257
  if (ignoreResult) return data;
256
258
  // //////////////////////////////////