@payloadcms/db-postgres 3.0.0-beta.11 → 3.0.0-beta.110

Sign up to get free protection for your applications and to get access to all the features.
Files changed (366) 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 +32 -16
  5. package/dist/connect.js.map +1 -1
  6. package/dist/exports/migration-utils.d.ts +2 -0
  7. package/dist/exports/migration-utils.d.ts.map +1 -0
  8. package/dist/exports/migration-utils.js +3 -0
  9. package/dist/exports/migration-utils.js.map +1 -0
  10. package/dist/index.d.ts +3 -3
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +49 -71
  13. package/dist/index.js.map +1 -1
  14. package/dist/predefinedMigrations/relationships-v2-v3.d.ts +4 -0
  15. package/dist/predefinedMigrations/relationships-v2-v3.d.ts.map +1 -0
  16. package/dist/predefinedMigrations/relationships-v2-v3.js.map +1 -0
  17. package/dist/predefinedMigrations/relationships-v2-v3.mjs +11 -0
  18. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts +20 -0
  19. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -0
  20. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js +169 -0
  21. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -0
  22. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts +11 -0
  23. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts.map +1 -0
  24. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js +193 -0
  25. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js.map +1 -0
  26. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts +3 -0
  27. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts.map +1 -0
  28. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js +56 -0
  29. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js.map +1 -0
  30. package/dist/predefinedMigrations/v2-v3/index.d.ts +23 -0
  31. package/dist/predefinedMigrations/v2-v3/index.d.ts.map +1 -0
  32. package/dist/predefinedMigrations/v2-v3/index.js +211 -0
  33. package/dist/predefinedMigrations/v2-v3/index.js.map +1 -0
  34. package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts +20 -0
  35. package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts.map +1 -0
  36. package/dist/predefinedMigrations/v2-v3/migrateRelationships.js +63 -0
  37. package/dist/predefinedMigrations/v2-v3/migrateRelationships.js.map +1 -0
  38. package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts +23 -0
  39. package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts.map +1 -0
  40. package/dist/predefinedMigrations/v2-v3/traverseFields.js +85 -0
  41. package/dist/predefinedMigrations/v2-v3/traverseFields.js.map +1 -0
  42. package/dist/predefinedMigrations/v2-v3/types.d.ts +9 -0
  43. package/dist/predefinedMigrations/v2-v3/types.d.ts.map +1 -0
  44. package/dist/predefinedMigrations/v2-v3/types.js +6 -0
  45. package/dist/predefinedMigrations/v2-v3/types.js.map +1 -0
  46. package/dist/types.d.ts +56 -80
  47. package/dist/types.d.ts.map +1 -1
  48. package/dist/types.js.map +1 -1
  49. package/package.json +39 -32
  50. package/dist/create.d.ts +0 -3
  51. package/dist/create.d.ts.map +0 -1
  52. package/dist/create.js +0 -21
  53. package/dist/create.js.map +0 -1
  54. package/dist/createGlobal.d.ts +0 -5
  55. package/dist/createGlobal.d.ts.map +0 -1
  56. package/dist/createGlobal.js +0 -21
  57. package/dist/createGlobal.js.map +0 -1
  58. package/dist/createGlobalVersion.d.ts +0 -6
  59. package/dist/createGlobalVersion.d.ts.map +0 -1
  60. package/dist/createGlobalVersion.js +0 -37
  61. package/dist/createGlobalVersion.js.map +0 -1
  62. package/dist/createMigration.d.ts +0 -3
  63. package/dist/createMigration.d.ts.map +0 -1
  64. package/dist/createMigration.js +0 -81
  65. package/dist/createMigration.js.map +0 -1
  66. package/dist/createVersion.d.ts +0 -5
  67. package/dist/createVersion.d.ts.map +0 -1
  68. package/dist/createVersion.js +0 -48
  69. package/dist/createVersion.js.map +0 -1
  70. package/dist/deleteMany.d.ts +0 -3
  71. package/dist/deleteMany.d.ts.map +0 -1
  72. package/dist/deleteMany.js +0 -31
  73. package/dist/deleteMany.js.map +0 -1
  74. package/dist/deleteOne.d.ts +0 -3
  75. package/dist/deleteOne.d.ts.map +0 -1
  76. package/dist/deleteOne.js +0 -62
  77. package/dist/deleteOne.js.map +0 -1
  78. package/dist/deleteVersions.d.ts +0 -3
  79. package/dist/deleteVersions.d.ts.map +0 -1
  80. package/dist/deleteVersions.js +0 -35
  81. package/dist/deleteVersions.js.map +0 -1
  82. package/dist/destroy.d.ts +0 -3
  83. package/dist/destroy.d.ts.map +0 -1
  84. package/dist/destroy.js +0 -11
  85. package/dist/destroy.js.map +0 -1
  86. package/dist/find/buildFindManyArgs.d.ts +0 -13
  87. package/dist/find/buildFindManyArgs.d.ts.map +0 -1
  88. package/dist/find/buildFindManyArgs.js +0 -64
  89. package/dist/find/buildFindManyArgs.js.map +0 -1
  90. package/dist/find/chainMethods.d.ts +0 -16
  91. package/dist/find/chainMethods.d.ts.map +0 -1
  92. package/dist/find/chainMethods.js +0 -12
  93. package/dist/find/chainMethods.js.map +0 -1
  94. package/dist/find/findMany.d.ts +0 -22
  95. package/dist/find/findMany.d.ts.map +0 -1
  96. package/dist/find/findMany.js +0 -163
  97. package/dist/find/findMany.js.map +0 -1
  98. package/dist/find/traverseFields.d.ts +0 -16
  99. package/dist/find/traverseFields.d.ts.map +0 -1
  100. package/dist/find/traverseFields.js +0 -154
  101. package/dist/find/traverseFields.js.map +0 -1
  102. package/dist/find.d.ts +0 -3
  103. package/dist/find.d.ts.map +0 -1
  104. package/dist/find.js +0 -24
  105. package/dist/find.js.map +0 -1
  106. package/dist/findGlobal.d.ts +0 -3
  107. package/dist/findGlobal.d.ts.map +0 -1
  108. package/dist/findGlobal.js +0 -26
  109. package/dist/findGlobal.js.map +0 -1
  110. package/dist/findGlobalVersions.d.ts +0 -3
  111. package/dist/findGlobalVersions.d.ts.map +0 -1
  112. package/dist/findGlobalVersions.js +0 -28
  113. package/dist/findGlobalVersions.js.map +0 -1
  114. package/dist/findOne.d.ts +0 -5
  115. package/dist/findOne.d.ts.map +0 -1
  116. package/dist/findOne.js +0 -24
  117. package/dist/findOne.js.map +0 -1
  118. package/dist/findVersions.d.ts +0 -3
  119. package/dist/findVersions.d.ts.map +0 -1
  120. package/dist/findVersions.js +0 -28
  121. package/dist/findVersions.js.map +0 -1
  122. package/dist/init.d.ts +0 -3
  123. package/dist/init.d.ts.map +0 -1
  124. package/dist/init.js +0 -94
  125. package/dist/init.js.map +0 -1
  126. package/dist/migrate.d.ts +0 -3
  127. package/dist/migrate.d.ts.map +0 -1
  128. package/dist/migrate.js +0 -99
  129. package/dist/migrate.js.map +0 -1
  130. package/dist/migrateDown.d.ts +0 -3
  131. package/dist/migrateDown.d.ts.map +0 -1
  132. package/dist/migrateDown.js +0 -63
  133. package/dist/migrateDown.js.map +0 -1
  134. package/dist/migrateFresh.d.ts +0 -8
  135. package/dist/migrateFresh.d.ts.map +0 -1
  136. package/dist/migrateFresh.js +0 -72
  137. package/dist/migrateFresh.js.map +0 -1
  138. package/dist/migrateRefresh.d.ts +0 -6
  139. package/dist/migrateRefresh.d.ts.map +0 -1
  140. package/dist/migrateRefresh.js +0 -102
  141. package/dist/migrateRefresh.js.map +0 -1
  142. package/dist/migrateReset.d.ts +0 -6
  143. package/dist/migrateReset.d.ts.map +0 -1
  144. package/dist/migrateReset.js +0 -82
  145. package/dist/migrateReset.js.map +0 -1
  146. package/dist/migrateStatus.d.ts +0 -3
  147. package/dist/migrateStatus.d.ts.map +0 -1
  148. package/dist/migrateStatus.js +0 -44
  149. package/dist/migrateStatus.js.map +0 -1
  150. package/dist/queries/buildAndOrConditions.d.ts +0 -17
  151. package/dist/queries/buildAndOrConditions.d.ts.map +0 -1
  152. package/dist/queries/buildAndOrConditions.js +0 -29
  153. package/dist/queries/buildAndOrConditions.js.map +0 -1
  154. package/dist/queries/buildQuery.d.ts +0 -31
  155. package/dist/queries/buildQuery.d.ts.map +0 -1
  156. package/dist/queries/buildQuery.js +0 -76
  157. package/dist/queries/buildQuery.js.map +0 -1
  158. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts +0 -2
  159. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts.map +0 -1
  160. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +0 -14
  161. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +0 -1
  162. package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts +0 -2
  163. package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts.map +0 -1
  164. package/dist/queries/createJSONQuery/formatJSONPathSegment.js +0 -5
  165. package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +0 -1
  166. package/dist/queries/createJSONQuery/index.d.ts +0 -10
  167. package/dist/queries/createJSONQuery/index.d.ts.map +0 -1
  168. package/dist/queries/createJSONQuery/index.js +0 -54
  169. package/dist/queries/createJSONQuery/index.js.map +0 -1
  170. package/dist/queries/getTableColumnFromPath.d.ts +0 -51
  171. package/dist/queries/getTableColumnFromPath.d.ts.map +0 -1
  172. package/dist/queries/getTableColumnFromPath.js +0 -412
  173. package/dist/queries/getTableColumnFromPath.js.map +0 -1
  174. package/dist/queries/operatorMap.d.ts +0 -18
  175. package/dist/queries/operatorMap.d.ts.map +0 -1
  176. package/dist/queries/operatorMap.js +0 -24
  177. package/dist/queries/operatorMap.js.map +0 -1
  178. package/dist/queries/parseParams.d.ts +0 -17
  179. package/dist/queries/parseParams.d.ts.map +0 -1
  180. package/dist/queries/parseParams.js +0 -182
  181. package/dist/queries/parseParams.js.map +0 -1
  182. package/dist/queries/sanitizeQueryValue.d.ts +0 -15
  183. package/dist/queries/sanitizeQueryValue.d.ts.map +0 -1
  184. package/dist/queries/sanitizeQueryValue.js +0 -90
  185. package/dist/queries/sanitizeQueryValue.js.map +0 -1
  186. package/dist/queries/selectDistinct.d.ts +0 -23
  187. package/dist/queries/selectDistinct.d.ts.map +0 -1
  188. package/dist/queries/selectDistinct.js +0 -41
  189. package/dist/queries/selectDistinct.js.map +0 -1
  190. package/dist/queryDrafts.d.ts +0 -3
  191. package/dist/queryDrafts.d.ts.map +0 -1
  192. package/dist/queryDrafts.js +0 -45
  193. package/dist/queryDrafts.js.map +0 -1
  194. package/dist/schema/build.d.ts +0 -29
  195. package/dist/schema/build.d.ts.map +0 -1
  196. package/dist/schema/build.js +0 -279
  197. package/dist/schema/build.js.map +0 -1
  198. package/dist/schema/createIndex.d.ts +0 -12
  199. package/dist/schema/createIndex.d.ts.map +0 -1
  200. package/dist/schema/createIndex.js +0 -18
  201. package/dist/schema/createIndex.js.map +0 -1
  202. package/dist/schema/getTableName.d.ts +0 -32
  203. package/dist/schema/getTableName.d.ts.map +0 -1
  204. package/dist/schema/getTableName.js +0 -31
  205. package/dist/schema/getTableName.js.map +0 -1
  206. package/dist/schema/idToUUID.d.ts +0 -3
  207. package/dist/schema/idToUUID.d.ts.map +0 -1
  208. package/dist/schema/idToUUID.js +0 -11
  209. package/dist/schema/idToUUID.js.map +0 -1
  210. package/dist/schema/parentIDColumnMap.d.ts +0 -4
  211. package/dist/schema/parentIDColumnMap.d.ts.map +0 -1
  212. package/dist/schema/parentIDColumnMap.js +0 -9
  213. package/dist/schema/parentIDColumnMap.js.map +0 -1
  214. package/dist/schema/setColumnID.d.ts +0 -11
  215. package/dist/schema/setColumnID.d.ts.map +0 -1
  216. package/dist/schema/setColumnID.js +0 -24
  217. package/dist/schema/setColumnID.js.map +0 -1
  218. package/dist/schema/traverseFields.d.ts +0 -38
  219. package/dist/schema/traverseFields.d.ts.map +0 -1
  220. package/dist/schema/traverseFields.js +0 -530
  221. package/dist/schema/traverseFields.js.map +0 -1
  222. package/dist/schema/validateExistingBlockIsIdentical.d.ts +0 -11
  223. package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +0 -1
  224. package/dist/schema/validateExistingBlockIsIdentical.js +0 -70
  225. package/dist/schema/validateExistingBlockIsIdentical.js.map +0 -1
  226. package/dist/transactions/beginTransaction.d.ts +0 -3
  227. package/dist/transactions/beginTransaction.d.ts.map +0 -1
  228. package/dist/transactions/beginTransaction.js +0 -47
  229. package/dist/transactions/beginTransaction.js.map +0 -1
  230. package/dist/transactions/commitTransaction.d.ts +0 -3
  231. package/dist/transactions/commitTransaction.d.ts.map +0 -1
  232. package/dist/transactions/commitTransaction.js +0 -14
  233. package/dist/transactions/commitTransaction.js.map +0 -1
  234. package/dist/transactions/rollbackTransaction.d.ts +0 -3
  235. package/dist/transactions/rollbackTransaction.d.ts.map +0 -1
  236. package/dist/transactions/rollbackTransaction.js +0 -13
  237. package/dist/transactions/rollbackTransaction.js.map +0 -1
  238. package/dist/transform/read/hasManyNumber.d.ts +0 -10
  239. package/dist/transform/read/hasManyNumber.d.ts.map +0 -1
  240. package/dist/transform/read/hasManyNumber.js +0 -10
  241. package/dist/transform/read/hasManyNumber.js.map +0 -1
  242. package/dist/transform/read/hasManyText.d.ts +0 -10
  243. package/dist/transform/read/hasManyText.d.ts.map +0 -1
  244. package/dist/transform/read/hasManyText.js +0 -10
  245. package/dist/transform/read/hasManyText.js.map +0 -1
  246. package/dist/transform/read/index.d.ts +0 -12
  247. package/dist/transform/read/index.d.ts.map +0 -1
  248. package/dist/transform/read/index.js +0 -43
  249. package/dist/transform/read/index.js.map +0 -1
  250. package/dist/transform/read/relationship.d.ts +0 -10
  251. package/dist/transform/read/relationship.d.ts.map +0 -1
  252. package/dist/transform/read/relationship.js +0 -64
  253. package/dist/transform/read/relationship.js.map +0 -1
  254. package/dist/transform/read/traverseFields.d.ts +0 -52
  255. package/dist/transform/read/traverseFields.d.ts.map +0 -1
  256. package/dist/transform/read/traverseFields.js +0 -421
  257. package/dist/transform/read/traverseFields.js.map +0 -1
  258. package/dist/transform/write/array.d.ts +0 -26
  259. package/dist/transform/write/array.d.ts.map +0 -1
  260. package/dist/transform/write/array.js +0 -58
  261. package/dist/transform/write/array.js.map +0 -1
  262. package/dist/transform/write/blocks.d.ts +0 -25
  263. package/dist/transform/write/blocks.d.ts.map +0 -1
  264. package/dist/transform/write/blocks.js +0 -54
  265. package/dist/transform/write/blocks.js.map +0 -1
  266. package/dist/transform/write/index.d.ts +0 -13
  267. package/dist/transform/write/index.d.ts.map +0 -1
  268. package/dist/transform/write/index.js +0 -41
  269. package/dist/transform/write/index.js.map +0 -1
  270. package/dist/transform/write/numbers.d.ts +0 -8
  271. package/dist/transform/write/numbers.d.ts.map +0 -1
  272. package/dist/transform/write/numbers.js +0 -11
  273. package/dist/transform/write/numbers.js.map +0 -1
  274. package/dist/transform/write/relationships.d.ts +0 -10
  275. package/dist/transform/write/relationships.d.ts.map +0 -1
  276. package/dist/transform/write/relationships.js +0 -23
  277. package/dist/transform/write/relationships.js.map +0 -1
  278. package/dist/transform/write/selects.d.ts +0 -8
  279. package/dist/transform/write/selects.d.ts.map +0 -1
  280. package/dist/transform/write/selects.js +0 -20
  281. package/dist/transform/write/selects.js.map +0 -1
  282. package/dist/transform/write/texts.d.ts +0 -8
  283. package/dist/transform/write/texts.d.ts.map +0 -1
  284. package/dist/transform/write/texts.js +0 -11
  285. package/dist/transform/write/texts.js.map +0 -1
  286. package/dist/transform/write/traverseFields.d.ts +0 -50
  287. package/dist/transform/write/traverseFields.d.ts.map +0 -1
  288. package/dist/transform/write/traverseFields.js +0 -428
  289. package/dist/transform/write/traverseFields.js.map +0 -1
  290. package/dist/transform/write/types.d.ts +0 -43
  291. package/dist/transform/write/types.d.ts.map +0 -1
  292. package/dist/transform/write/types.js +0 -3
  293. package/dist/transform/write/types.js.map +0 -1
  294. package/dist/update.d.ts +0 -3
  295. package/dist/update.d.ts.map +0 -1
  296. package/dist/update.js +0 -58
  297. package/dist/update.js.map +0 -1
  298. package/dist/updateGlobal.d.ts +0 -5
  299. package/dist/updateGlobal.d.ts.map +0 -1
  300. package/dist/updateGlobal.js +0 -28
  301. package/dist/updateGlobal.js.map +0 -1
  302. package/dist/updateGlobalVersion.d.ts +0 -5
  303. package/dist/updateGlobalVersion.d.ts.map +0 -1
  304. package/dist/updateGlobalVersion.js +0 -40
  305. package/dist/updateGlobalVersion.js.map +0 -1
  306. package/dist/updateVersion.d.ts +0 -5
  307. package/dist/updateVersion.d.ts.map +0 -1
  308. package/dist/updateVersion.js +0 -40
  309. package/dist/updateVersion.js.map +0 -1
  310. package/dist/upsertRow/deleteExistingArrayRows.d.ts +0 -10
  311. package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +0 -1
  312. package/dist/upsertRow/deleteExistingArrayRows.js +0 -10
  313. package/dist/upsertRow/deleteExistingArrayRows.js.map +0 -1
  314. package/dist/upsertRow/deleteExistingRowsByPath.d.ts +0 -14
  315. package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +0 -1
  316. package/dist/upsertRow/deleteExistingRowsByPath.js +0 -33
  317. package/dist/upsertRow/deleteExistingRowsByPath.js.map +0 -1
  318. package/dist/upsertRow/index.d.ts +0 -4
  319. package/dist/upsertRow/index.d.ts.map +0 -1
  320. package/dist/upsertRow/index.js +0 -276
  321. package/dist/upsertRow/index.js.map +0 -1
  322. package/dist/upsertRow/insertArrays.d.ts +0 -13
  323. package/dist/upsertRow/insertArrays.d.ts.map +0 -1
  324. package/dist/upsertRow/insertArrays.js +0 -68
  325. package/dist/upsertRow/insertArrays.js.map +0 -1
  326. package/dist/upsertRow/types.d.ts +0 -27
  327. package/dist/upsertRow/types.d.ts.map +0 -1
  328. package/dist/upsertRow/types.js +0 -3
  329. package/dist/upsertRow/types.js.map +0 -1
  330. package/dist/utilities/appendPrefixToKeys.d.ts +0 -2
  331. package/dist/utilities/appendPrefixToKeys.d.ts.map +0 -1
  332. package/dist/utilities/appendPrefixToKeys.js +0 -6
  333. package/dist/utilities/appendPrefixToKeys.js.map +0 -1
  334. package/dist/utilities/createBlocksMap.d.ts +0 -5
  335. package/dist/utilities/createBlocksMap.d.ts.map +0 -1
  336. package/dist/utilities/createBlocksMap.js +0 -29
  337. package/dist/utilities/createBlocksMap.js.map +0 -1
  338. package/dist/utilities/createMigrationTable.d.ts +0 -3
  339. package/dist/utilities/createMigrationTable.d.ts.map +0 -1
  340. package/dist/utilities/createMigrationTable.js +0 -13
  341. package/dist/utilities/createMigrationTable.js.map +0 -1
  342. package/dist/utilities/createRelationshipMap.d.ts +0 -2
  343. package/dist/utilities/createRelationshipMap.d.ts.map +0 -1
  344. package/dist/utilities/createRelationshipMap.js +0 -19
  345. package/dist/utilities/createRelationshipMap.js.map +0 -1
  346. package/dist/utilities/hasLocalesTable.d.ts +0 -3
  347. package/dist/utilities/hasLocalesTable.d.ts.map +0 -1
  348. package/dist/utilities/hasLocalesTable.js +0 -11
  349. package/dist/utilities/hasLocalesTable.js.map +0 -1
  350. package/dist/utilities/isArrayOfRows.d.ts +0 -2
  351. package/dist/utilities/isArrayOfRows.d.ts.map +0 -1
  352. package/dist/utilities/isArrayOfRows.js +0 -5
  353. package/dist/utilities/isArrayOfRows.js.map +0 -1
  354. package/dist/utilities/migrationTableExists.d.ts +0 -3
  355. package/dist/utilities/migrationTableExists.d.ts.map +0 -1
  356. package/dist/utilities/migrationTableExists.js +0 -9
  357. package/dist/utilities/migrationTableExists.js.map +0 -1
  358. package/dist/utilities/parseError.d.ts +0 -5
  359. package/dist/utilities/parseError.d.ts.map +0 -1
  360. package/dist/utilities/parseError.js +0 -17
  361. package/dist/utilities/parseError.js.map +0 -1
  362. package/dist/utilities/pushDevSchema.d.ts +0 -9
  363. package/dist/utilities/pushDevSchema.d.ts.map +0 -1
  364. package/dist/utilities/pushDevSchema.js +0 -58
  365. package/dist/utilities/pushDevSchema.js.map +0 -1
  366. package/src/index.ts +0 -155
@@ -1,428 +0,0 @@
1
- /* eslint-disable no-param-reassign */ import { fieldAffectsData } from 'payload/types';
2
- import toSnakeCase from 'to-snake-case';
3
- import { isArrayOfRows } from '../../utilities/isArrayOfRows.js';
4
- import { transformArray } from './array.js';
5
- import { transformBlocks } from './blocks.js';
6
- import { transformNumbers } from './numbers.js';
7
- import { transformRelationship } from './relationships.js';
8
- import { transformSelects } from './selects.js';
9
- import { transformTexts } from './texts.js';
10
- export const traverseFields = ({ adapter, arrays, baseTableName, blocks, blocksToDelete, columnPrefix, data, existingLocales, fieldPrefix, fields, forcedLocale, locales, numbers, parentTableName, path, relationships, relationshipsToDelete, row, selects, texts })=>{
11
- fields.forEach((field)=>{
12
- let columnName = '';
13
- let fieldName = '';
14
- let fieldData;
15
- if (fieldAffectsData(field)) {
16
- columnName = `${columnPrefix || ''}${toSnakeCase(field.name)}`;
17
- fieldName = `${fieldPrefix || ''}${field.name}`;
18
- fieldData = data[field.name];
19
- }
20
- if (field.type === 'array') {
21
- const arrayTableName = `${parentTableName}_${columnName}`;
22
- if (!arrays[arrayTableName]) arrays[arrayTableName] = [];
23
- if (field.localized) {
24
- if (typeof data[field.name] === 'object' && data[field.name] !== null) {
25
- Object.entries(data[field.name]).forEach(([localeKey, localeData])=>{
26
- if (Array.isArray(localeData)) {
27
- const newRows = transformArray({
28
- adapter,
29
- arrayTableName,
30
- baseTableName,
31
- blocks,
32
- blocksToDelete,
33
- data: localeData,
34
- field,
35
- locale: localeKey,
36
- numbers,
37
- path,
38
- relationships,
39
- relationshipsToDelete,
40
- selects,
41
- texts
42
- });
43
- arrays[arrayTableName] = arrays[arrayTableName].concat(newRows);
44
- }
45
- });
46
- }
47
- } else {
48
- const newRows = transformArray({
49
- adapter,
50
- arrayTableName,
51
- baseTableName,
52
- blocks,
53
- blocksToDelete,
54
- data: data[field.name],
55
- field,
56
- numbers,
57
- path,
58
- relationships,
59
- relationshipsToDelete,
60
- selects,
61
- texts
62
- });
63
- arrays[arrayTableName] = arrays[arrayTableName].concat(newRows);
64
- }
65
- return;
66
- }
67
- if (field.type === 'blocks') {
68
- field.blocks.forEach(({ slug })=>{
69
- blocksToDelete.add(toSnakeCase(slug));
70
- });
71
- if (field.localized) {
72
- if (typeof data[field.name] === 'object' && data[field.name] !== null) {
73
- Object.entries(data[field.name]).forEach(([localeKey, localeData])=>{
74
- if (Array.isArray(localeData)) {
75
- transformBlocks({
76
- adapter,
77
- baseTableName,
78
- blocks,
79
- blocksToDelete,
80
- data: localeData,
81
- field,
82
- locale: localeKey,
83
- numbers,
84
- path,
85
- relationships,
86
- relationshipsToDelete,
87
- selects,
88
- texts
89
- });
90
- }
91
- });
92
- }
93
- } else if (isArrayOfRows(fieldData)) {
94
- transformBlocks({
95
- adapter,
96
- baseTableName,
97
- blocks,
98
- blocksToDelete,
99
- data: fieldData,
100
- field,
101
- numbers,
102
- path,
103
- relationships,
104
- relationshipsToDelete,
105
- selects,
106
- texts
107
- });
108
- }
109
- return;
110
- }
111
- if (field.type === 'group') {
112
- if (typeof data[field.name] === 'object' && data[field.name] !== null) {
113
- if (field.localized) {
114
- Object.entries(data[field.name]).forEach(([localeKey, localeData])=>{
115
- traverseFields({
116
- adapter,
117
- arrays,
118
- baseTableName,
119
- blocks,
120
- blocksToDelete,
121
- columnPrefix: `${columnName}_`,
122
- data: localeData,
123
- existingLocales,
124
- fieldPrefix: `${fieldName}_`,
125
- fields: field.fields,
126
- forcedLocale: localeKey,
127
- locales,
128
- numbers,
129
- parentTableName,
130
- path: `${path || ''}${field.name}.`,
131
- relationships,
132
- relationshipsToDelete,
133
- row,
134
- selects,
135
- texts
136
- });
137
- });
138
- } else {
139
- traverseFields({
140
- adapter,
141
- arrays,
142
- baseTableName,
143
- blocks,
144
- blocksToDelete,
145
- columnPrefix: `${columnName}_`,
146
- data: data[field.name],
147
- existingLocales,
148
- fieldPrefix: `${fieldName}_`,
149
- fields: field.fields,
150
- locales,
151
- numbers,
152
- parentTableName,
153
- path: `${path || ''}${field.name}.`,
154
- relationships,
155
- relationshipsToDelete,
156
- row,
157
- selects,
158
- texts
159
- });
160
- }
161
- }
162
- return;
163
- }
164
- if (field.type === 'tabs') {
165
- field.tabs.forEach((tab)=>{
166
- if ('name' in tab) {
167
- if (typeof data[tab.name] === 'object' && data[tab.name] !== null) {
168
- if (tab.localized) {
169
- Object.entries(data[tab.name]).forEach(([localeKey, localeData])=>{
170
- traverseFields({
171
- adapter,
172
- arrays,
173
- baseTableName,
174
- blocks,
175
- blocksToDelete,
176
- columnPrefix: `${columnPrefix || ''}${toSnakeCase(tab.name)}_`,
177
- data: localeData,
178
- existingLocales,
179
- fieldPrefix: `${fieldPrefix || ''}${tab.name}_`,
180
- fields: tab.fields,
181
- forcedLocale: localeKey,
182
- locales,
183
- numbers,
184
- parentTableName,
185
- path: `${path || ''}${tab.name}.`,
186
- relationships,
187
- relationshipsToDelete,
188
- row,
189
- selects,
190
- texts
191
- });
192
- });
193
- } else {
194
- traverseFields({
195
- adapter,
196
- arrays,
197
- baseTableName,
198
- blocks,
199
- blocksToDelete,
200
- columnPrefix: `${columnPrefix || ''}${toSnakeCase(tab.name)}_`,
201
- data: data[tab.name],
202
- existingLocales,
203
- fieldPrefix: `${fieldPrefix || ''}${tab.name}_`,
204
- fields: tab.fields,
205
- locales,
206
- numbers,
207
- parentTableName,
208
- path: `${path || ''}${tab.name}.`,
209
- relationships,
210
- relationshipsToDelete,
211
- row,
212
- selects,
213
- texts
214
- });
215
- }
216
- }
217
- } else {
218
- traverseFields({
219
- adapter,
220
- arrays,
221
- baseTableName,
222
- blocks,
223
- blocksToDelete,
224
- columnPrefix,
225
- data,
226
- existingLocales,
227
- fieldPrefix,
228
- fields: tab.fields,
229
- locales,
230
- numbers,
231
- parentTableName,
232
- path,
233
- relationships,
234
- relationshipsToDelete,
235
- row,
236
- selects,
237
- texts
238
- });
239
- }
240
- });
241
- }
242
- if (field.type === 'row' || field.type === 'collapsible') {
243
- traverseFields({
244
- adapter,
245
- arrays,
246
- baseTableName,
247
- blocks,
248
- blocksToDelete,
249
- columnPrefix,
250
- data,
251
- existingLocales,
252
- fieldPrefix,
253
- fields: field.fields,
254
- locales,
255
- numbers,
256
- parentTableName,
257
- path,
258
- relationships,
259
- relationshipsToDelete,
260
- row,
261
- selects,
262
- texts
263
- });
264
- }
265
- if (field.type === 'relationship' || field.type === 'upload') {
266
- const relationshipPath = `${path || ''}${field.name}`;
267
- if (field.localized) {
268
- if (typeof fieldData === 'object') {
269
- Object.entries(fieldData).forEach(([localeKey, localeData])=>{
270
- if (localeData === null) {
271
- relationshipsToDelete.push({
272
- locale: localeKey,
273
- path: relationshipPath
274
- });
275
- return;
276
- }
277
- transformRelationship({
278
- baseRow: {
279
- locale: localeKey,
280
- path: relationshipPath
281
- },
282
- data: localeData,
283
- field,
284
- relationships
285
- });
286
- });
287
- }
288
- } else {
289
- if (fieldData === null || Array.isArray(fieldData) && fieldData.length === 0) {
290
- relationshipsToDelete.push({
291
- path: relationshipPath
292
- });
293
- return;
294
- }
295
- transformRelationship({
296
- baseRow: {
297
- path: relationshipPath
298
- },
299
- data: fieldData,
300
- field,
301
- relationships
302
- });
303
- }
304
- return;
305
- }
306
- if (field.type === 'text' && field.hasMany) {
307
- const textPath = `${path || ''}${field.name}`;
308
- if (field.localized) {
309
- if (typeof fieldData === 'object') {
310
- Object.entries(fieldData).forEach(([localeKey, localeData])=>{
311
- if (Array.isArray(localeData)) {
312
- transformTexts({
313
- baseRow: {
314
- locale: localeKey,
315
- path: textPath
316
- },
317
- data: localeData,
318
- texts
319
- });
320
- }
321
- });
322
- }
323
- } else if (Array.isArray(fieldData)) {
324
- transformTexts({
325
- baseRow: {
326
- path: textPath
327
- },
328
- data: fieldData,
329
- texts
330
- });
331
- }
332
- return;
333
- }
334
- if (field.type === 'number' && field.hasMany) {
335
- const numberPath = `${path || ''}${field.name}`;
336
- if (field.localized) {
337
- if (typeof fieldData === 'object') {
338
- Object.entries(fieldData).forEach(([localeKey, localeData])=>{
339
- if (Array.isArray(localeData)) {
340
- transformNumbers({
341
- baseRow: {
342
- locale: localeKey,
343
- path: numberPath
344
- },
345
- data: localeData,
346
- numbers
347
- });
348
- }
349
- });
350
- }
351
- } else if (Array.isArray(fieldData)) {
352
- transformNumbers({
353
- baseRow: {
354
- path: numberPath
355
- },
356
- data: fieldData,
357
- numbers
358
- });
359
- }
360
- return;
361
- }
362
- if (field.type === 'select' && field.hasMany) {
363
- const selectTableName = `${parentTableName}_${columnName}`;
364
- if (!selects[selectTableName]) selects[selectTableName] = [];
365
- if (field.localized) {
366
- if (typeof data[field.name] === 'object' && data[field.name] !== null) {
367
- Object.entries(data[field.name]).forEach(([localeKey, localeData])=>{
368
- if (Array.isArray(localeData)) {
369
- const newRows = transformSelects({
370
- id: data._uuid || data.id,
371
- data: localeData,
372
- locale: localeKey
373
- });
374
- selects[selectTableName] = selects[selectTableName].concat(newRows);
375
- }
376
- });
377
- }
378
- } else if (Array.isArray(data[field.name])) {
379
- const newRows = transformSelects({
380
- id: data._uuid || data.id,
381
- data: data[field.name]
382
- });
383
- selects[selectTableName] = selects[selectTableName].concat(newRows);
384
- }
385
- return;
386
- }
387
- if (fieldAffectsData(field)) {
388
- const valuesToTransform = [];
389
- if (field.localized) {
390
- if (typeof fieldData === 'object' && fieldData !== null) {
391
- Object.entries(fieldData).forEach(([localeKey, localeData])=>{
392
- if (!locales[localeKey]) locales[localeKey] = {};
393
- valuesToTransform.push({
394
- localeKey,
395
- ref: locales,
396
- value: localeData
397
- });
398
- });
399
- }
400
- } else {
401
- let ref = row;
402
- if (forcedLocale) {
403
- if (!locales[forcedLocale]) locales[forcedLocale] = {};
404
- ref = locales[forcedLocale];
405
- }
406
- valuesToTransform.push({
407
- ref,
408
- value: fieldData
409
- });
410
- }
411
- valuesToTransform.forEach(({ localeKey, ref, value })=>{
412
- if (typeof value !== 'undefined') {
413
- let formattedValue = value;
414
- if (field.type === 'date' && field.name === 'updatedAt') {
415
- formattedValue = new Date().toISOString();
416
- }
417
- if (localeKey) {
418
- ref[localeKey][fieldName] = formattedValue;
419
- } else {
420
- ref[fieldName] = formattedValue;
421
- }
422
- }
423
- });
424
- }
425
- });
426
- };
427
-
428
- //# sourceMappingURL=traverseFields.js.map
@@ -1 +0,0 @@
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 = `${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 (field.localized) {\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 } else {\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 }\n\n return\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 = `${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","localized","Object","entries","localeKey","localeData","Array","isArray","newRows","locale","concat","slug","add","tabs","tab","relationshipPath","push","baseRow","length","hasMany","textPath","numberPath","selectTableName","id","_uuid","valuesToTransform","ref","value","formattedValue","Date","toISOString"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,oCAAoC,GAGpC,SAASA,gBAAgB,QAAQ,gBAAe;AAChD,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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AAU,GAAG,CAAC;wBAE/CqB,kBAAkBT,IAAI,CAAC;4BACrBZ;4BACAsB,KAAK1C;4BACL2C,OAAOtB;wBACT;oBACF;gBACF;YACF,OAAO;gBACL,IAAIqB,MAAMpC;gBAEV,IAAIP,cAAc;oBAChB,IAAI,CAACC,OAAO,CAACD,aAAa,EAAEC,OAAO,CAACD,aAAa,GAAG,CAAC;oBACrD2C,MAAM1C,OAAO,CAACD,aAAa;gBAC7B;gBAEA0C,kBAAkBT,IAAI,CAAC;oBAAEU;oBAAKC,OAAO9B;gBAAU;YACjD;YAEA4B,kBAAkBhC,OAAO,CAAC,CAAC,EAAEW,SAAS,EAAEsB,GAAG,EAAEC,KAAK,EAAE;gBAClD,IAAI,OAAOA,UAAU,aAAa;oBAChC,IAAIC,iBAAiBD;oBAErB,IAAIjC,MAAMK,IAAI,KAAK,UAAUL,MAAMI,IAAI,KAAK,aAAa;wBACvD8B,iBAAiB,IAAIC,OAAOC,WAAW;oBACzC;oBAEA,IAAI1B,WAAW;wBACbsB,GAAG,CAACtB,UAAU,CAACR,UAAU,GAAGgC;oBAC9B,OAAO;wBACLF,GAAG,CAAC9B,UAAU,GAAGgC;oBACnB;gBACF;YACF;QACF;IACF;AACF,EAAC"}
@@ -1,43 +0,0 @@
1
- export type ArrayRowToInsert = {
2
- arrays: {
3
- [tableName: string]: ArrayRowToInsert[];
4
- };
5
- locales: {
6
- [locale: string]: Record<string, unknown>;
7
- };
8
- row: Record<string, unknown>;
9
- };
10
- export type BlockRowToInsert = {
11
- arrays: {
12
- [tableName: string]: ArrayRowToInsert[];
13
- };
14
- locales: {
15
- [locale: string]: Record<string, unknown>;
16
- };
17
- row: Record<string, unknown>;
18
- };
19
- export type RelationshipToDelete = {
20
- locale?: string;
21
- path: string;
22
- };
23
- export type RowToInsert = {
24
- arrays: {
25
- [tableName: string]: ArrayRowToInsert[];
26
- };
27
- blocks: {
28
- [blockType: string]: BlockRowToInsert[];
29
- };
30
- blocksToDelete: Set<string>;
31
- locales: {
32
- [locale: string]: Record<string, unknown>;
33
- };
34
- numbers: Record<string, unknown>[];
35
- relationships: Record<string, unknown>[];
36
- relationshipsToDelete: RelationshipToDelete[];
37
- row: Record<string, unknown>;
38
- selects: {
39
- [tableName: string]: Record<string, unknown>[];
40
- };
41
- texts: Record<string, unknown>[];
42
- };
43
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/transform/write/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE;QACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;KACxC,CAAA;IACD,OAAO,EAAE;QACP,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAC1C,CAAA;IACD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE;QACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;KACxC,CAAA;IACD,OAAO,EAAE;QACP,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAC1C,CAAA;IACD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE;QACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;KACxC,CAAA;IACD,MAAM,EAAE;QACN,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAA;KACxC,CAAA;IACD,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC3B,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,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"}
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
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"}
package/dist/update.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { UpdateOne } from 'payload/database';
2
- export declare const updateOne: UpdateOne;
3
- //# sourceMappingURL=update.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AASjD,eAAO,MAAM,SAAS,EAAE,SAgDvB,CAAA"}
package/dist/update.js DELETED
@@ -1,58 +0,0 @@
1
- import buildQuery from './queries/buildQuery.js';
2
- import { selectDistinct } from './queries/selectDistinct.js';
3
- import { getTableName } from './schema/getTableName.js';
4
- import { upsertRow } from './upsertRow/index.js';
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;
7
- const collection = this.payload.collections[collectionSlug].config;
8
- const tableName = getTableName({
9
- adapter: this,
10
- config: collection
11
- });
12
- const whereToUse = whereArg || {
13
- id: {
14
- equals: id
15
- }
16
- };
17
- let idToUpdate = id;
18
- const { joinAliases, joins, selectFields, where } = await buildQuery({
19
- adapter: this,
20
- fields: collection.fields,
21
- locale,
22
- tableName,
23
- where: whereToUse
24
- });
25
- const selectDistinctResult = await selectDistinct({
26
- adapter: this,
27
- chainedMethods: [
28
- {
29
- args: [
30
- 1
31
- ],
32
- method: 'limit'
33
- }
34
- ],
35
- db,
36
- joinAliases,
37
- joins,
38
- selectFields,
39
- tableName,
40
- where
41
- });
42
- if (selectDistinctResult?.[0]?.id) {
43
- idToUpdate = selectDistinctResult?.[0]?.id;
44
- }
45
- const result = await upsertRow({
46
- id: idToUpdate,
47
- adapter: this,
48
- data,
49
- db,
50
- fields: collection.fields,
51
- operation: 'update',
52
- req,
53
- tableName
54
- });
55
- return result;
56
- };
57
-
58
- //# sourceMappingURL=update.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/update.ts"],"sourcesContent":["import type { UpdateOne } from 'payload/database'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport buildQuery from './queries/buildQuery.js'\nimport { selectDistinct } from './queries/selectDistinct.js'\nimport { getTableName } from './schema/getTableName.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 = getTableName({\n adapter: this,\n config: collection,\n })\n const whereToUse = whereArg || { id: { equals: id } }\n let idToUpdate = id\n\n const { joinAliases, 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 joinAliases,\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":["buildQuery","selectDistinct","getTableName","upsertRow","updateOne","id","collection","collectionSlug","data","draft","locale","req","where","whereArg","db","sessions","transactionID","drizzle","payload","collections","config","tableName","adapter","whereToUse","equals","idToUpdate","joinAliases","joins","selectFields","fields","selectDistinctResult","chainedMethods","args","method","result","operation"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,OAAOA,gBAAgB,0BAAyB;AAChD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,YAAY,QAAQ,2BAA0B;AACvD,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,YAAYnB,aAAa;QAC7BoB,SAAS,IAAI;QACbF,QAAQd;IACV;IACA,MAAMiB,aAAaV,YAAY;QAAER,IAAI;YAAEmB,QAAQnB;QAAG;IAAE;IACpD,IAAIoB,aAAapB;IAEjB,MAAM,EAAEqB,WAAW,EAAEC,KAAK,EAAEC,YAAY,EAAEhB,KAAK,EAAE,GAAG,MAAMZ,WAAW;QACnEsB,SAAS,IAAI;QACbO,QAAQvB,WAAWuB,MAAM;QACzBnB;QACAW;QACAT,OAAOW;IACT;IAEA,MAAMO,uBAAuB,MAAM7B,eAAe;QAChDqB,SAAS,IAAI;QACbS,gBAAgB;YAAC;gBAAEC,MAAM;oBAAC;iBAAE;gBAAEC,QAAQ;YAAQ;SAAE;QAChDnB;QACAY;QACAC;QACAC;QACAP;QACAT;IACF;IAEA,IAAIkB,sBAAsB,CAAC,EAAE,EAAEzB,IAAI;QACjCoB,aAAaK,sBAAsB,CAAC,EAAE,EAAEzB;IAC1C;IAEA,MAAM6B,SAAS,MAAM/B,UAAU;QAC7BE,IAAIoB;QACJH,SAAS,IAAI;QACbd;QACAM;QACAe,QAAQvB,WAAWuB,MAAM;QACzBM,WAAW;QACXxB;QACAU;IACF;IAEA,OAAOa;AACT,EAAC"}
@@ -1,5 +0,0 @@
1
- import type { UpdateGlobalArgs } from 'payload/database';
2
- import type { TypeWithID } from 'payload/types';
3
- import type { PostgresAdapter } from './types.js';
4
- export declare function updateGlobal<T extends TypeWithID>(this: PostgresAdapter, { slug, data, req }: UpdateGlobalArgs): Promise<T>;
5
- //# sourceMappingURL=updateGlobal.d.ts.map
@@ -1 +0,0 @@
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,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAKjD,wBAAsB,YAAY,CAAC,CAAC,SAAS,UAAU,EACrD,IAAI,EAAE,eAAe,EACrB,EAAE,IAAI,EAAE,IAAI,EAAE,GAA0B,EAAE,EAAE,gBAAgB,GAC3D,OAAO,CAAC,CAAC,CAAC,CAqBZ"}
@@ -1,28 +0,0 @@
1
- import { getTableName } from './schema/getTableName.js';
2
- import { upsertRow } from './upsertRow/index.js';
3
- export async function updateGlobal({ slug, data, req = {} }) {
4
- const db = this.sessions[req.transactionID]?.db || this.drizzle;
5
- const globalConfig = this.payload.globals.config.find((config)=>config.slug === slug);
6
- const tableName = getTableName({
7
- adapter: this,
8
- config: globalConfig
9
- });
10
- const existingGlobal = await db.query[tableName].findFirst({});
11
- const result = await upsertRow({
12
- ...existingGlobal ? {
13
- id: existingGlobal.id,
14
- operation: 'update'
15
- } : {
16
- operation: 'create'
17
- },
18
- adapter: this,
19
- data,
20
- db,
21
- fields: globalConfig.fields,
22
- req,
23
- tableName
24
- });
25
- return result;
26
- }
27
-
28
- //# sourceMappingURL=updateGlobal.js.map