@payloadcms/db-postgres 3.0.0-canary.f6e77b8 → 3.0.0-canary.fb04843

Sign up to get free protection for your applications and to get access to all the features.
Files changed (370) 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 +45 -17
  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 +66 -69
  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 +196 -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 +65 -77
  47. package/dist/types.d.ts.map +1 -1
  48. package/dist/types.js.map +1 -1
  49. package/license.md +22 -0
  50. package/package.json +35 -17
  51. package/dist/count.d.ts +0 -3
  52. package/dist/count.d.ts.map +0 -1
  53. package/dist/count.js +0 -50
  54. package/dist/count.js.map +0 -1
  55. package/dist/create.d.ts +0 -3
  56. package/dist/create.d.ts.map +0 -1
  57. package/dist/create.js +0 -19
  58. package/dist/create.js.map +0 -1
  59. package/dist/createGlobal.d.ts +0 -5
  60. package/dist/createGlobal.d.ts.map +0 -1
  61. package/dist/createGlobal.js +0 -19
  62. package/dist/createGlobal.js.map +0 -1
  63. package/dist/createGlobalVersion.d.ts +0 -6
  64. package/dist/createGlobalVersion.d.ts.map +0 -1
  65. package/dist/createGlobalVersion.js +0 -33
  66. package/dist/createGlobalVersion.js.map +0 -1
  67. package/dist/createMigration.d.ts +0 -3
  68. package/dist/createMigration.d.ts.map +0 -1
  69. package/dist/createMigration.js +0 -81
  70. package/dist/createMigration.js.map +0 -1
  71. package/dist/createVersion.d.ts +0 -5
  72. package/dist/createVersion.d.ts.map +0 -1
  73. package/dist/createVersion.js +0 -44
  74. package/dist/createVersion.js.map +0 -1
  75. package/dist/deleteMany.d.ts +0 -3
  76. package/dist/deleteMany.d.ts.map +0 -1
  77. package/dist/deleteMany.js +0 -28
  78. package/dist/deleteMany.js.map +0 -1
  79. package/dist/deleteOne.d.ts +0 -3
  80. package/dist/deleteOne.d.ts.map +0 -1
  81. package/dist/deleteOne.js +0 -59
  82. package/dist/deleteOne.js.map +0 -1
  83. package/dist/deleteVersions.d.ts +0 -3
  84. package/dist/deleteVersions.d.ts.map +0 -1
  85. package/dist/deleteVersions.js +0 -31
  86. package/dist/deleteVersions.js.map +0 -1
  87. package/dist/destroy.d.ts +0 -3
  88. package/dist/destroy.d.ts.map +0 -1
  89. package/dist/destroy.js +0 -11
  90. package/dist/destroy.js.map +0 -1
  91. package/dist/find/buildFindManyArgs.d.ts +0 -13
  92. package/dist/find/buildFindManyArgs.d.ts.map +0 -1
  93. package/dist/find/buildFindManyArgs.js +0 -64
  94. package/dist/find/buildFindManyArgs.js.map +0 -1
  95. package/dist/find/chainMethods.d.ts +0 -16
  96. package/dist/find/chainMethods.d.ts.map +0 -1
  97. package/dist/find/chainMethods.js +0 -12
  98. package/dist/find/chainMethods.js.map +0 -1
  99. package/dist/find/findMany.d.ts +0 -22
  100. package/dist/find/findMany.d.ts.map +0 -1
  101. package/dist/find/findMany.js +0 -163
  102. package/dist/find/findMany.js.map +0 -1
  103. package/dist/find/traverseFields.d.ts +0 -16
  104. package/dist/find/traverseFields.d.ts.map +0 -1
  105. package/dist/find/traverseFields.js +0 -138
  106. package/dist/find/traverseFields.js.map +0 -1
  107. package/dist/find.d.ts +0 -3
  108. package/dist/find.d.ts.map +0 -1
  109. package/dist/find.js +0 -21
  110. package/dist/find.js.map +0 -1
  111. package/dist/findGlobal.d.ts +0 -3
  112. package/dist/findGlobal.d.ts.map +0 -1
  113. package/dist/findGlobal.js +0 -23
  114. package/dist/findGlobal.js.map +0 -1
  115. package/dist/findGlobalVersions.d.ts +0 -3
  116. package/dist/findGlobalVersions.d.ts.map +0 -1
  117. package/dist/findGlobalVersions.js +0 -24
  118. package/dist/findGlobalVersions.js.map +0 -1
  119. package/dist/findOne.d.ts +0 -5
  120. package/dist/findOne.d.ts.map +0 -1
  121. package/dist/findOne.js +0 -21
  122. package/dist/findOne.js.map +0 -1
  123. package/dist/findVersions.d.ts +0 -3
  124. package/dist/findVersions.d.ts.map +0 -1
  125. package/dist/findVersions.js +0 -24
  126. package/dist/findVersions.js.map +0 -1
  127. package/dist/init.d.ts +0 -3
  128. package/dist/init.d.ts.map +0 -1
  129. package/dist/init.js +0 -96
  130. package/dist/init.js.map +0 -1
  131. package/dist/migrate.d.ts +0 -3
  132. package/dist/migrate.d.ts.map +0 -1
  133. package/dist/migrate.js +0 -99
  134. package/dist/migrate.js.map +0 -1
  135. package/dist/migrateDown.d.ts +0 -3
  136. package/dist/migrateDown.d.ts.map +0 -1
  137. package/dist/migrateDown.js +0 -63
  138. package/dist/migrateDown.js.map +0 -1
  139. package/dist/migrateFresh.d.ts +0 -8
  140. package/dist/migrateFresh.d.ts.map +0 -1
  141. package/dist/migrateFresh.js +0 -72
  142. package/dist/migrateFresh.js.map +0 -1
  143. package/dist/migrateRefresh.d.ts +0 -6
  144. package/dist/migrateRefresh.d.ts.map +0 -1
  145. package/dist/migrateRefresh.js +0 -102
  146. package/dist/migrateRefresh.js.map +0 -1
  147. package/dist/migrateReset.d.ts +0 -6
  148. package/dist/migrateReset.d.ts.map +0 -1
  149. package/dist/migrateReset.js +0 -82
  150. package/dist/migrateReset.js.map +0 -1
  151. package/dist/migrateStatus.d.ts +0 -3
  152. package/dist/migrateStatus.d.ts.map +0 -1
  153. package/dist/migrateStatus.js +0 -44
  154. package/dist/migrateStatus.js.map +0 -1
  155. package/dist/queries/buildAndOrConditions.d.ts +0 -17
  156. package/dist/queries/buildAndOrConditions.d.ts.map +0 -1
  157. package/dist/queries/buildAndOrConditions.js +0 -29
  158. package/dist/queries/buildAndOrConditions.js.map +0 -1
  159. package/dist/queries/buildQuery.d.ts +0 -31
  160. package/dist/queries/buildQuery.d.ts.map +0 -1
  161. package/dist/queries/buildQuery.js +0 -76
  162. package/dist/queries/buildQuery.js.map +0 -1
  163. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts +0 -2
  164. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts.map +0 -1
  165. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +0 -14
  166. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +0 -1
  167. package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts +0 -2
  168. package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts.map +0 -1
  169. package/dist/queries/createJSONQuery/formatJSONPathSegment.js +0 -5
  170. package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +0 -1
  171. package/dist/queries/createJSONQuery/index.d.ts +0 -10
  172. package/dist/queries/createJSONQuery/index.d.ts.map +0 -1
  173. package/dist/queries/createJSONQuery/index.js +0 -54
  174. package/dist/queries/createJSONQuery/index.js.map +0 -1
  175. package/dist/queries/getTableColumnFromPath.d.ts +0 -51
  176. package/dist/queries/getTableColumnFromPath.d.ts.map +0 -1
  177. package/dist/queries/getTableColumnFromPath.js +0 -445
  178. package/dist/queries/getTableColumnFromPath.js.map +0 -1
  179. package/dist/queries/operatorMap.d.ts +0 -18
  180. package/dist/queries/operatorMap.d.ts.map +0 -1
  181. package/dist/queries/operatorMap.js +0 -24
  182. package/dist/queries/operatorMap.js.map +0 -1
  183. package/dist/queries/parseParams.d.ts +0 -17
  184. package/dist/queries/parseParams.d.ts.map +0 -1
  185. package/dist/queries/parseParams.js +0 -182
  186. package/dist/queries/parseParams.js.map +0 -1
  187. package/dist/queries/sanitizeQueryValue.d.ts +0 -15
  188. package/dist/queries/sanitizeQueryValue.d.ts.map +0 -1
  189. package/dist/queries/sanitizeQueryValue.js +0 -90
  190. package/dist/queries/sanitizeQueryValue.js.map +0 -1
  191. package/dist/queries/selectDistinct.d.ts +0 -23
  192. package/dist/queries/selectDistinct.d.ts.map +0 -1
  193. package/dist/queries/selectDistinct.js +0 -41
  194. package/dist/queries/selectDistinct.js.map +0 -1
  195. package/dist/queryDrafts.d.ts +0 -3
  196. package/dist/queryDrafts.d.ts.map +0 -1
  197. package/dist/queryDrafts.js +0 -41
  198. package/dist/queryDrafts.js.map +0 -1
  199. package/dist/schema/build.d.ts +0 -30
  200. package/dist/schema/build.d.ts.map +0 -1
  201. package/dist/schema/build.js +0 -320
  202. package/dist/schema/build.js.map +0 -1
  203. package/dist/schema/createIndex.d.ts +0 -12
  204. package/dist/schema/createIndex.d.ts.map +0 -1
  205. package/dist/schema/createIndex.js +0 -18
  206. package/dist/schema/createIndex.js.map +0 -1
  207. package/dist/schema/createTableName.d.ts +0 -30
  208. package/dist/schema/createTableName.d.ts.map +0 -1
  209. package/dist/schema/createTableName.js +0 -31
  210. package/dist/schema/createTableName.js.map +0 -1
  211. package/dist/schema/idToUUID.d.ts +0 -3
  212. package/dist/schema/idToUUID.d.ts.map +0 -1
  213. package/dist/schema/idToUUID.js +0 -11
  214. package/dist/schema/idToUUID.js.map +0 -1
  215. package/dist/schema/parentIDColumnMap.d.ts +0 -4
  216. package/dist/schema/parentIDColumnMap.d.ts.map +0 -1
  217. package/dist/schema/parentIDColumnMap.js +0 -9
  218. package/dist/schema/parentIDColumnMap.js.map +0 -1
  219. package/dist/schema/setColumnID.d.ts +0 -11
  220. package/dist/schema/setColumnID.d.ts.map +0 -1
  221. package/dist/schema/setColumnID.js +0 -24
  222. package/dist/schema/setColumnID.js.map +0 -1
  223. package/dist/schema/traverseFields.d.ts +0 -38
  224. package/dist/schema/traverseFields.d.ts.map +0 -1
  225. package/dist/schema/traverseFields.js +0 -551
  226. package/dist/schema/traverseFields.js.map +0 -1
  227. package/dist/schema/validateExistingBlockIsIdentical.d.ts +0 -12
  228. package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +0 -1
  229. package/dist/schema/validateExistingBlockIsIdentical.js +0 -76
  230. package/dist/schema/validateExistingBlockIsIdentical.js.map +0 -1
  231. package/dist/transactions/beginTransaction.d.ts +0 -3
  232. package/dist/transactions/beginTransaction.d.ts.map +0 -1
  233. package/dist/transactions/beginTransaction.js +0 -47
  234. package/dist/transactions/beginTransaction.js.map +0 -1
  235. package/dist/transactions/commitTransaction.d.ts +0 -3
  236. package/dist/transactions/commitTransaction.d.ts.map +0 -1
  237. package/dist/transactions/commitTransaction.js +0 -14
  238. package/dist/transactions/commitTransaction.js.map +0 -1
  239. package/dist/transactions/rollbackTransaction.d.ts +0 -3
  240. package/dist/transactions/rollbackTransaction.d.ts.map +0 -1
  241. package/dist/transactions/rollbackTransaction.js +0 -13
  242. package/dist/transactions/rollbackTransaction.js.map +0 -1
  243. package/dist/transform/read/hasManyNumber.d.ts +0 -10
  244. package/dist/transform/read/hasManyNumber.d.ts.map +0 -1
  245. package/dist/transform/read/hasManyNumber.js +0 -10
  246. package/dist/transform/read/hasManyNumber.js.map +0 -1
  247. package/dist/transform/read/hasManyText.d.ts +0 -10
  248. package/dist/transform/read/hasManyText.d.ts.map +0 -1
  249. package/dist/transform/read/hasManyText.js +0 -10
  250. package/dist/transform/read/hasManyText.js.map +0 -1
  251. package/dist/transform/read/index.d.ts +0 -12
  252. package/dist/transform/read/index.d.ts.map +0 -1
  253. package/dist/transform/read/index.js +0 -43
  254. package/dist/transform/read/index.js.map +0 -1
  255. package/dist/transform/read/relationship.d.ts +0 -10
  256. package/dist/transform/read/relationship.d.ts.map +0 -1
  257. package/dist/transform/read/relationship.js +0 -64
  258. package/dist/transform/read/relationship.js.map +0 -1
  259. package/dist/transform/read/traverseFields.d.ts +0 -52
  260. package/dist/transform/read/traverseFields.d.ts.map +0 -1
  261. package/dist/transform/read/traverseFields.js +0 -421
  262. package/dist/transform/read/traverseFields.js.map +0 -1
  263. package/dist/transform/write/array.d.ts +0 -26
  264. package/dist/transform/write/array.d.ts.map +0 -1
  265. package/dist/transform/write/array.js +0 -58
  266. package/dist/transform/write/array.js.map +0 -1
  267. package/dist/transform/write/blocks.d.ts +0 -25
  268. package/dist/transform/write/blocks.d.ts.map +0 -1
  269. package/dist/transform/write/blocks.js +0 -54
  270. package/dist/transform/write/blocks.js.map +0 -1
  271. package/dist/transform/write/index.d.ts +0 -13
  272. package/dist/transform/write/index.d.ts.map +0 -1
  273. package/dist/transform/write/index.js +0 -41
  274. package/dist/transform/write/index.js.map +0 -1
  275. package/dist/transform/write/numbers.d.ts +0 -8
  276. package/dist/transform/write/numbers.d.ts.map +0 -1
  277. package/dist/transform/write/numbers.js +0 -11
  278. package/dist/transform/write/numbers.js.map +0 -1
  279. package/dist/transform/write/relationships.d.ts +0 -10
  280. package/dist/transform/write/relationships.d.ts.map +0 -1
  281. package/dist/transform/write/relationships.js +0 -23
  282. package/dist/transform/write/relationships.js.map +0 -1
  283. package/dist/transform/write/selects.d.ts +0 -8
  284. package/dist/transform/write/selects.d.ts.map +0 -1
  285. package/dist/transform/write/selects.js +0 -20
  286. package/dist/transform/write/selects.js.map +0 -1
  287. package/dist/transform/write/texts.d.ts +0 -8
  288. package/dist/transform/write/texts.d.ts.map +0 -1
  289. package/dist/transform/write/texts.js +0 -11
  290. package/dist/transform/write/texts.js.map +0 -1
  291. package/dist/transform/write/traverseFields.d.ts +0 -50
  292. package/dist/transform/write/traverseFields.d.ts.map +0 -1
  293. package/dist/transform/write/traverseFields.js +0 -428
  294. package/dist/transform/write/traverseFields.js.map +0 -1
  295. package/dist/transform/write/types.d.ts +0 -43
  296. package/dist/transform/write/types.d.ts.map +0 -1
  297. package/dist/transform/write/types.js +0 -3
  298. package/dist/transform/write/types.js.map +0 -1
  299. package/dist/update.d.ts +0 -3
  300. package/dist/update.d.ts.map +0 -1
  301. package/dist/update.js +0 -55
  302. package/dist/update.js.map +0 -1
  303. package/dist/updateGlobal.d.ts +0 -5
  304. package/dist/updateGlobal.d.ts.map +0 -1
  305. package/dist/updateGlobal.js +0 -25
  306. package/dist/updateGlobal.js.map +0 -1
  307. package/dist/updateGlobalVersion.d.ts +0 -5
  308. package/dist/updateGlobalVersion.d.ts.map +0 -1
  309. package/dist/updateGlobalVersion.js +0 -36
  310. package/dist/updateGlobalVersion.js.map +0 -1
  311. package/dist/updateVersion.d.ts +0 -5
  312. package/dist/updateVersion.d.ts.map +0 -1
  313. package/dist/updateVersion.js +0 -36
  314. package/dist/updateVersion.js.map +0 -1
  315. package/dist/upsertRow/deleteExistingArrayRows.d.ts +0 -10
  316. package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +0 -1
  317. package/dist/upsertRow/deleteExistingArrayRows.js +0 -10
  318. package/dist/upsertRow/deleteExistingArrayRows.js.map +0 -1
  319. package/dist/upsertRow/deleteExistingRowsByPath.d.ts +0 -14
  320. package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +0 -1
  321. package/dist/upsertRow/deleteExistingRowsByPath.js +0 -33
  322. package/dist/upsertRow/deleteExistingRowsByPath.js.map +0 -1
  323. package/dist/upsertRow/index.d.ts +0 -4
  324. package/dist/upsertRow/index.d.ts.map +0 -1
  325. package/dist/upsertRow/index.js +0 -277
  326. package/dist/upsertRow/index.js.map +0 -1
  327. package/dist/upsertRow/insertArrays.d.ts +0 -13
  328. package/dist/upsertRow/insertArrays.d.ts.map +0 -1
  329. package/dist/upsertRow/insertArrays.js +0 -68
  330. package/dist/upsertRow/insertArrays.js.map +0 -1
  331. package/dist/upsertRow/types.d.ts +0 -27
  332. package/dist/upsertRow/types.d.ts.map +0 -1
  333. package/dist/upsertRow/types.js +0 -3
  334. package/dist/upsertRow/types.js.map +0 -1
  335. package/dist/utilities/appendPrefixToKeys.d.ts +0 -2
  336. package/dist/utilities/appendPrefixToKeys.d.ts.map +0 -1
  337. package/dist/utilities/appendPrefixToKeys.js +0 -6
  338. package/dist/utilities/appendPrefixToKeys.js.map +0 -1
  339. package/dist/utilities/createBlocksMap.d.ts +0 -5
  340. package/dist/utilities/createBlocksMap.d.ts.map +0 -1
  341. package/dist/utilities/createBlocksMap.js +0 -29
  342. package/dist/utilities/createBlocksMap.js.map +0 -1
  343. package/dist/utilities/createMigrationTable.d.ts +0 -3
  344. package/dist/utilities/createMigrationTable.d.ts.map +0 -1
  345. package/dist/utilities/createMigrationTable.js +0 -13
  346. package/dist/utilities/createMigrationTable.js.map +0 -1
  347. package/dist/utilities/createRelationshipMap.d.ts +0 -2
  348. package/dist/utilities/createRelationshipMap.d.ts.map +0 -1
  349. package/dist/utilities/createRelationshipMap.js +0 -19
  350. package/dist/utilities/createRelationshipMap.js.map +0 -1
  351. package/dist/utilities/hasLocalesTable.d.ts +0 -3
  352. package/dist/utilities/hasLocalesTable.d.ts.map +0 -1
  353. package/dist/utilities/hasLocalesTable.js +0 -11
  354. package/dist/utilities/hasLocalesTable.js.map +0 -1
  355. package/dist/utilities/isArrayOfRows.d.ts +0 -2
  356. package/dist/utilities/isArrayOfRows.d.ts.map +0 -1
  357. package/dist/utilities/isArrayOfRows.js +0 -5
  358. package/dist/utilities/isArrayOfRows.js.map +0 -1
  359. package/dist/utilities/migrationTableExists.d.ts +0 -3
  360. package/dist/utilities/migrationTableExists.d.ts.map +0 -1
  361. package/dist/utilities/migrationTableExists.js +0 -9
  362. package/dist/utilities/migrationTableExists.js.map +0 -1
  363. package/dist/utilities/parseError.d.ts +0 -5
  364. package/dist/utilities/parseError.d.ts.map +0 -1
  365. package/dist/utilities/parseError.js +0 -17
  366. package/dist/utilities/parseError.js.map +0 -1
  367. package/dist/utilities/pushDevSchema.d.ts +0 -9
  368. package/dist/utilities/pushDevSchema.d.ts.map +0 -1
  369. package/dist/utilities/pushDevSchema.js +0 -58
  370. package/dist/utilities/pushDevSchema.js.map +0 -1
package/README.md CHANGED
@@ -14,7 +14,7 @@ npm install @payloadcms/db-postgres
14
14
  ## Usage
15
15
 
16
16
  ```ts
17
- import { buildConfig } from 'payload/config'
17
+ import { buildConfig } from 'payload'
18
18
  import { postgresAdapter } from '@payloadcms/db-postgres'
19
19
 
20
20
  export default buildConfig({
package/dist/connect.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import type { Connect } from 'payload/database';
1
+ import type { Connect } from 'payload';
2
2
  export declare const connect: Connect;
3
3
  //# sourceMappingURL=connect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AA+C/C,eAAO,MAAM,OAAO,EAAE,OAgDrB,CAAA"}
1
+ {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAW,MAAM,SAAS,CAAA;AA6C/C,eAAO,MAAM,OAAO,EAAE,OA0ErB,CAAA"}
package/dist/connect.js CHANGED
@@ -1,7 +1,6 @@
1
- import { sql } from 'drizzle-orm';
1
+ import { pushDevSchema } from '@payloadcms/drizzle';
2
2
  import { drizzle } from 'drizzle-orm/node-postgres';
3
3
  import pg from 'pg';
4
- import { pushDevSchema } from './utilities/pushDevSchema.js';
5
4
  const connectWithReconnect = async function({ adapter, payload, reconnect = false }) {
6
5
  let result;
7
6
  if (!reconnect) {
@@ -9,7 +8,7 @@ const connectWithReconnect = async function({ adapter, payload, reconnect = fals
9
8
  } else {
10
9
  try {
11
10
  result = await adapter.pool.connect();
12
- } catch (err) {
11
+ } catch (ignore) {
13
12
  setTimeout(()=>{
14
13
  payload.logger.info('Reconnecting to postgres');
15
14
  void connectWithReconnect({
@@ -32,7 +31,7 @@ const connectWithReconnect = async function({ adapter, payload, reconnect = fals
32
31
  reconnect: true
33
32
  });
34
33
  }
35
- } catch (err) {
34
+ } catch (ignore) {
36
35
  // swallow error
37
36
  }
38
37
  });
@@ -42,38 +41,67 @@ export const connect = async function connect(options = {
42
41
  }) {
43
42
  const { hotReload } = options;
44
43
  this.schema = {
44
+ pgSchema: this.pgSchema,
45
45
  ...this.tables,
46
46
  ...this.relations,
47
47
  ...this.enums
48
48
  };
49
49
  try {
50
- this.pool = new pg.Pool(this.poolOptions);
51
- await connectWithReconnect({
52
- adapter: this,
53
- payload: this.payload
54
- });
50
+ if (!this.pool) {
51
+ this.pool = new pg.Pool(this.poolOptions);
52
+ await connectWithReconnect({
53
+ adapter: this,
54
+ payload: this.payload
55
+ });
56
+ }
55
57
  const logger = this.logger || false;
56
- this.drizzle = drizzle(this.pool, {
58
+ this.drizzle = drizzle({
59
+ client: this.pool,
57
60
  logger,
58
61
  schema: this.schema
59
62
  });
60
63
  if (!hotReload) {
61
64
  if (process.env.PAYLOAD_DROP_DATABASE === 'true') {
62
65
  this.payload.logger.info(`---- DROPPING TABLES SCHEMA(${this.schemaName || 'public'}) ----`);
63
- await this.drizzle.execute(sql.raw(`
64
- drop schema if exists ${this.schemaName || 'public'} cascade;
65
- create schema ${this.schemaName || 'public'};
66
- `));
66
+ await this.dropDatabase({
67
+ adapter: this
68
+ });
67
69
  this.payload.logger.info('---- DROPPED TABLES ----');
68
70
  }
69
71
  }
70
72
  } catch (err) {
71
- this.payload.logger.error(`Error: cannot connect to Postgres. Details: ${err.message}`, err);
73
+ if (err.message?.match(/database .* does not exist/i) && !this.disableCreateDatabase) {
74
+ // capitalize first char of the err msg
75
+ this.payload.logger.info(`${err.message.charAt(0).toUpperCase() + err.message.slice(1)}, creating...`);
76
+ const isCreated = await this.createDatabase();
77
+ if (isCreated) {
78
+ await this.connect(options);
79
+ return;
80
+ }
81
+ } else {
82
+ this.payload.logger.error({
83
+ err,
84
+ msg: `Error: cannot connect to Postgres. Details: ${err.message}`
85
+ });
86
+ }
87
+ if (typeof this.rejectInitializing === 'function') {
88
+ this.rejectInitializing();
89
+ }
72
90
  process.exit(1);
73
91
  }
92
+ await this.createExtensions();
74
93
  // Only push schema if not in production
75
- if (process.env.NODE_ENV === 'production' || process.env.PAYLOAD_MIGRATING === 'true' || this.push === false) return;
76
- await pushDevSchema(this);
94
+ if (process.env.NODE_ENV !== 'production' && process.env.PAYLOAD_MIGRATING !== 'true' && this.push !== false) {
95
+ await pushDevSchema(this);
96
+ }
97
+ if (typeof this.resolveInitializing === 'function') {
98
+ this.resolveInitializing();
99
+ }
100
+ if (process.env.NODE_ENV === 'production' && this.prodMigrations) {
101
+ await this.migrate({
102
+ migrations: this.prodMigrations
103
+ });
104
+ }
77
105
  };
78
106
 
79
107
  //# sourceMappingURL=connect.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connect.ts"],"sourcesContent":["import type { Payload } from 'payload'\nimport type { Connect } from 'payload/database'\n\nimport { sql } from 'drizzle-orm'\nimport { drizzle } from 'drizzle-orm/node-postgres'\nimport pg from 'pg'\n\nimport type { PostgresAdapter } from './types.js'\n\nimport { pushDevSchema } from './utilities/pushDevSchema.js'\n\nconst connectWithReconnect = async function ({\n adapter,\n payload,\n reconnect = false,\n}: {\n adapter: PostgresAdapter\n payload: Payload\n reconnect?: boolean\n}) {\n let result\n\n if (!reconnect) {\n result = await adapter.pool.connect()\n } else {\n try {\n result = await adapter.pool.connect()\n } catch (err) {\n setTimeout(() => {\n payload.logger.info('Reconnecting to postgres')\n void connectWithReconnect({ adapter, payload, reconnect: true })\n }, 1000)\n }\n }\n if (!result) {\n return\n }\n result.prependListener('error', (err) => {\n try {\n if (err.code === 'ECONNRESET') {\n void connectWithReconnect({ adapter, payload, reconnect: true })\n }\n } catch (err) {\n // swallow error\n }\n })\n}\n\nexport const connect: Connect = async function connect(\n this: PostgresAdapter,\n options = {\n hotReload: false,\n },\n) {\n const { hotReload } = options\n\n this.schema = {\n ...this.tables,\n ...this.relations,\n ...this.enums,\n }\n\n try {\n this.pool = new pg.Pool(this.poolOptions)\n await connectWithReconnect({ adapter: this, payload: this.payload })\n\n const logger = this.logger || false\n\n this.drizzle = drizzle(this.pool, { logger, schema: this.schema })\n\n if (!hotReload) {\n if (process.env.PAYLOAD_DROP_DATABASE === 'true') {\n this.payload.logger.info(`---- DROPPING TABLES SCHEMA(${this.schemaName || 'public'}) ----`)\n await this.drizzle.execute(\n sql.raw(`\n drop schema if exists ${this.schemaName || 'public'} cascade;\n create schema ${this.schemaName || 'public'};\n `),\n )\n this.payload.logger.info('---- DROPPED TABLES ----')\n }\n }\n } catch (err) {\n this.payload.logger.error(`Error: cannot connect to Postgres. Details: ${err.message}`, err)\n process.exit(1)\n }\n\n // Only push schema if not in production\n if (\n process.env.NODE_ENV === 'production' ||\n process.env.PAYLOAD_MIGRATING === 'true' ||\n this.push === false\n )\n return\n\n await pushDevSchema(this)\n}\n"],"names":["sql","drizzle","pg","pushDevSchema","connectWithReconnect","adapter","payload","reconnect","result","pool","connect","err","setTimeout","logger","info","prependListener","code","options","hotReload","schema","tables","relations","enums","Pool","poolOptions","process","env","PAYLOAD_DROP_DATABASE","schemaName","execute","raw","error","message","exit","NODE_ENV","PAYLOAD_MIGRATING","push"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,GAAG,QAAQ,cAAa;AACjC,SAASC,OAAO,QAAQ,4BAA2B;AACnD,OAAOC,QAAQ,KAAI;AAInB,SAASC,aAAa,QAAQ,+BAA8B;AAE5D,MAAMC,uBAAuB,eAAgB,EAC3CC,OAAO,EACPC,OAAO,EACPC,YAAY,KAAK,EAKlB;IACC,IAAIC;IAEJ,IAAI,CAACD,WAAW;QACdC,SAAS,MAAMH,QAAQI,IAAI,CAACC,OAAO;IACrC,OAAO;QACL,IAAI;YACFF,SAAS,MAAMH,QAAQI,IAAI,CAACC,OAAO;QACrC,EAAE,OAAOC,KAAK;YACZ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UAAU,IAAI,SAAS;wBACtC,EAAE,IAAI,CAACA,UAAU,IAAI,SAAS;QAC9C,CAAC;gBAED,IAAI,CAACtB,OAAO,CAACO,MAAM,CAACC,IAAI,CAAC;YAC3B;QACF;IACF,EAAE,OAAOH,KAAK;QACZ,IAAI,CAACL,OAAO,CAACO,MAAM,CAACkB,KAAK,CAAC,CAAC,4CAA4C,EAAEpB,IAAIqB,OAAO,CAAC,CAAC,EAAErB;QACxFc,QAAQQ,IAAI,CAAC;IACf;IAEA,wCAAwC;IACxC,IACER,QAAQC,GAAG,CAACQ,QAAQ,KAAK,gBACzBT,QAAQC,GAAG,CAACS,iBAAiB,KAAK,UAClC,IAAI,CAACC,IAAI,KAAK,OAEd;IAEF,MAAMjC,cAAc,IAAI;AAC1B,EAAC"}
1
+ {"version":3,"sources":["../src/connect.ts"],"sourcesContent":["import type { DrizzleAdapter } from '@payloadcms/drizzle/types'\nimport type { Connect, Payload } from 'payload'\n\nimport { pushDevSchema } from '@payloadcms/drizzle'\nimport { drizzle } from 'drizzle-orm/node-postgres'\nimport pg from 'pg'\n\nimport type { PostgresAdapter } from './types.js'\n\nconst connectWithReconnect = async function ({\n adapter,\n payload,\n reconnect = false,\n}: {\n adapter: PostgresAdapter\n payload: Payload\n reconnect?: boolean\n}) {\n let result\n\n if (!reconnect) {\n result = await adapter.pool.connect()\n } else {\n try {\n result = await adapter.pool.connect()\n } catch (ignore) {\n setTimeout(() => {\n payload.logger.info('Reconnecting to postgres')\n void connectWithReconnect({ adapter, payload, reconnect: true })\n }, 1000)\n }\n }\n if (!result) {\n return\n }\n result.prependListener('error', (err) => {\n try {\n if (err.code === 'ECONNRESET') {\n void connectWithReconnect({ adapter, payload, reconnect: true })\n }\n } catch (ignore) {\n // swallow error\n }\n })\n}\n\nexport const connect: Connect = async function connect(\n this: PostgresAdapter,\n options = {\n hotReload: false,\n },\n) {\n const { hotReload } = options\n\n this.schema = {\n pgSchema: this.pgSchema,\n ...this.tables,\n ...this.relations,\n ...this.enums,\n }\n\n try {\n if (!this.pool) {\n this.pool = new pg.Pool(this.poolOptions)\n await connectWithReconnect({ adapter: this, payload: this.payload })\n }\n\n const logger = this.logger || false\n this.drizzle = drizzle({ client: this.pool, logger, schema: this.schema })\n\n if (!hotReload) {\n if (process.env.PAYLOAD_DROP_DATABASE === 'true') {\n this.payload.logger.info(`---- DROPPING TABLES SCHEMA(${this.schemaName || 'public'}) ----`)\n await this.dropDatabase({ adapter: this })\n this.payload.logger.info('---- DROPPED TABLES ----')\n }\n }\n } catch (err) {\n if (err.message?.match(/database .* does not exist/i) && !this.disableCreateDatabase) {\n // capitalize first char of the err msg\n this.payload.logger.info(\n `${err.message.charAt(0).toUpperCase() + err.message.slice(1)}, creating...`,\n )\n const isCreated = await this.createDatabase()\n\n if (isCreated) {\n await this.connect(options)\n return\n }\n } else {\n this.payload.logger.error({\n err,\n msg: `Error: cannot connect to Postgres. Details: ${err.message}`,\n })\n }\n\n if (typeof this.rejectInitializing === 'function') {\n this.rejectInitializing()\n }\n process.exit(1)\n }\n\n await this.createExtensions()\n\n // Only push schema if not in production\n if (\n process.env.NODE_ENV !== 'production' &&\n process.env.PAYLOAD_MIGRATING !== 'true' &&\n this.push !== false\n ) {\n await pushDevSchema(this as unknown as DrizzleAdapter)\n }\n\n if (typeof this.resolveInitializing === 'function') {\n this.resolveInitializing()\n }\n\n if (process.env.NODE_ENV === 'production' && this.prodMigrations) {\n await this.migrate({ migrations: this.prodMigrations })\n }\n}\n"],"names":["pushDevSchema","drizzle","pg","connectWithReconnect","adapter","payload","reconnect","result","pool","connect","ignore","setTimeout","logger","info","prependListener","err","code","options","hotReload","schema","pgSchema","tables","relations","enums","Pool","poolOptions","client","process","env","PAYLOAD_DROP_DATABASE","schemaName","dropDatabase","message","match","disableCreateDatabase","charAt","toUpperCase","slice","isCreated","createDatabase","error","msg","rejectInitializing","exit","createExtensions","NODE_ENV","PAYLOAD_MIGRATING","push","resolveInitializing","prodMigrations","migrate","migrations"],"mappings":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,KAAK,gBACzBlB,QAAQC,GAAG,CAACkB,iBAAiB,KAAK,UAClC,IAAI,CAACC,IAAI,KAAK,OACd;QACA,MAAM/C,cAAc,IAAI;IAC1B;IAEA,IAAI,OAAO,IAAI,CAACgD,mBAAmB,KAAK,YAAY;QAClD,IAAI,CAACA,mBAAmB;IAC1B;IAEA,IAAIrB,QAAQC,GAAG,CAACiB,QAAQ,KAAK,gBAAgB,IAAI,CAACI,cAAc,EAAE;QAChE,MAAM,IAAI,CAACC,OAAO,CAAC;YAAEC,YAAY,IAAI,CAACF,cAAc;QAAC;IACvD;AACF,EAAC"}
@@ -0,0 +1,2 @@
1
+ export { migratePostgresV2toV3 } from '../predefinedMigrations/v2-v3/index.js';
2
+ //# sourceMappingURL=migration-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-utils.d.ts","sourceRoot":"","sources":["../../src/exports/migration-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { migratePostgresV2toV3 } from '../predefinedMigrations/v2-v3/index.js';
2
+
3
+ //# sourceMappingURL=migration-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/exports/migration-utils.ts"],"sourcesContent":["export { migratePostgresV2toV3 } from '../predefinedMigrations/v2-v3/index.js'\n"],"names":["migratePostgresV2toV3"],"mappings":"AAAA,SAASA,qBAAqB,QAAQ,yCAAwC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { DatabaseAdapterObj } from 'payload/database';
1
+ import type { DatabaseAdapterObj } from 'payload';
2
2
  import type { Args, PostgresAdapter } from './types.js';
3
- export type { MigrateDownArgs, MigrateUpArgs } from './types.js';
4
- export { sql } from 'drizzle-orm';
5
3
  export declare function postgresAdapter(args: Args): DatabaseAdapterObj<PostgresAdapter>;
4
+ export type { MigrateDownArgs, MigrateUpArgs } from '@payloadcms/drizzle/postgres';
5
+ export { sql } from 'drizzle-orm';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAM1D,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAkCvD,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEhE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEjC,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAsE/E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAW,MAAM,SAAS,CAAA;AAwD1D,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAOvD,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,kBAAkB,CAAC,eAAe,CAAC,CA0H/E;AAED,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAClF,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA"}
package/dist/index.js CHANGED
@@ -1,54 +1,67 @@
1
- import fs from 'fs';
1
+ import { beginTransaction, commitTransaction, count, countGlobalVersions, countVersions, create, createGlobal, createGlobalVersion, createVersion, deleteMany, deleteOne, deleteVersions, destroy, find, findGlobal, findGlobalVersions, findMigrationDir, findOne, findVersions, migrate, migrateDown, migrateFresh, migrateRefresh, migrateReset, migrateStatus, operatorMap, queryDrafts, rollbackTransaction, updateGlobal, updateGlobalVersion, updateOne, updateVersion } from '@payloadcms/drizzle';
2
+ import { countDistinct, createDatabase, createExtensions, createJSONQuery, createMigration, defaultDrizzleSnapshot, deleteWhere, dropDatabase, execute, getMigrationTemplate, init, insert, requireDrizzleKit } from '@payloadcms/drizzle/postgres';
3
+ import { pgEnum, pgSchema, pgTable } from 'drizzle-orm/pg-core';
2
4
  import path from 'path';
3
- import { createDatabaseAdapter } from 'payload/database';
5
+ import { createDatabaseAdapter, defaultBeginTransaction } from 'payload';
6
+ import { fileURLToPath } from 'url';
4
7
  import { connect } from './connect.js';
5
- import { count } from './count.js';
6
- import { create } from './create.js';
7
- import { createGlobal } from './createGlobal.js';
8
- import { createGlobalVersion } from './createGlobalVersion.js';
9
- import { createMigration } from './createMigration.js';
10
- import { createVersion } from './createVersion.js';
11
- import { deleteMany } from './deleteMany.js';
12
- import { deleteOne } from './deleteOne.js';
13
- import { deleteVersions } from './deleteVersions.js';
14
- import { destroy } from './destroy.js';
15
- import { find } from './find.js';
16
- import { findGlobal } from './findGlobal.js';
17
- import { findGlobalVersions } from './findGlobalVersions.js';
18
- import { findOne } from './findOne.js';
19
- import { findVersions } from './findVersions.js';
20
- import { init } from './init.js';
21
- import { migrate } from './migrate.js';
22
- import { migrateDown } from './migrateDown.js';
23
- import { migrateFresh } from './migrateFresh.js';
24
- import { migrateRefresh } from './migrateRefresh.js';
25
- import { migrateReset } from './migrateReset.js';
26
- import { migrateStatus } from './migrateStatus.js';
27
- import { queryDrafts } from './queryDrafts.js';
28
- import { beginTransaction } from './transactions/beginTransaction.js';
29
- import { commitTransaction } from './transactions/commitTransaction.js';
30
- import { rollbackTransaction } from './transactions/rollbackTransaction.js';
31
- import { updateOne } from './update.js';
32
- import { updateGlobal } from './updateGlobal.js';
33
- import { updateGlobalVersion } from './updateGlobalVersion.js';
34
- import { updateVersion } from './updateVersion.js';
35
- export { sql } from 'drizzle-orm';
8
+ const filename = fileURLToPath(import.meta.url);
9
+ const dirname = path.dirname(filename);
36
10
  export function postgresAdapter(args) {
37
11
  const postgresIDType = args.idType || 'serial';
38
12
  const payloadIDType = postgresIDType === 'serial' ? 'number' : 'text';
39
13
  function adapter({ payload }) {
40
14
  const migrationDir = findMigrationDir(args.migrationDir);
15
+ let resolveInitializing;
16
+ let rejectInitializing;
17
+ let adapterSchema;
18
+ const initializing = new Promise((res, rej)=>{
19
+ resolveInitializing = res;
20
+ rejectInitializing = rej;
21
+ });
22
+ if (args.schemaName) {
23
+ adapterSchema = pgSchema(args.schemaName);
24
+ } else {
25
+ adapterSchema = {
26
+ enum: pgEnum,
27
+ table: pgTable
28
+ };
29
+ }
30
+ const extensions = (args.extensions ?? []).reduce((acc, name)=>{
31
+ acc[name] = true;
32
+ return acc;
33
+ }, {});
41
34
  return createDatabaseAdapter({
42
35
  name: 'postgres',
36
+ afterSchemaInit: args.afterSchemaInit ?? [],
37
+ beforeSchemaInit: args.beforeSchemaInit ?? [],
38
+ createDatabase,
39
+ createExtensions,
40
+ createMigration (args) {
41
+ return createMigration.bind(this)({
42
+ ...args,
43
+ dirname
44
+ });
45
+ },
46
+ defaultDrizzleSnapshot,
47
+ disableCreateDatabase: args.disableCreateDatabase ?? false,
43
48
  drizzle: undefined,
44
49
  enums: {},
50
+ extensions,
51
+ features: {
52
+ json: true
53
+ },
45
54
  fieldConstraints: {},
55
+ getMigrationTemplate,
46
56
  idType: postgresIDType,
57
+ initializing,
47
58
  localesSuffix: args.localesSuffix || '_locales',
48
59
  logger: args.logger,
49
- pgSchema: undefined,
60
+ operators: operatorMap,
61
+ pgSchema: adapterSchema,
50
62
  pool: undefined,
51
63
  poolOptions: args.pool,
64
+ prodMigrations: args.prodMigrations,
52
65
  push: args.push,
53
66
  relations: {},
54
67
  relationshipsSuffix: args.relationshipsSuffix || '_rels',
@@ -57,28 +70,38 @@ export function postgresAdapter(args) {
57
70
  sessions: {},
58
71
  tableNameMap: new Map(),
59
72
  tables: {},
73
+ tablesFilter: args.tablesFilter,
74
+ transactionOptions: args.transactionOptions || undefined,
60
75
  versionsSuffix: args.versionsSuffix || '_v',
61
76
  // DatabaseAdapter
62
- beginTransaction,
77
+ beginTransaction: args.transactionOptions === false ? defaultBeginTransaction() : beginTransaction,
63
78
  commitTransaction,
64
79
  connect,
65
80
  count,
81
+ countDistinct,
82
+ countGlobalVersions,
83
+ countVersions,
66
84
  create,
67
85
  createGlobal,
68
86
  createGlobalVersion,
69
- createMigration,
87
+ createJSONQuery,
70
88
  createVersion,
71
89
  defaultIDType: payloadIDType,
72
90
  deleteMany,
73
91
  deleteOne,
74
92
  deleteVersions,
93
+ deleteWhere,
75
94
  destroy,
95
+ dropDatabase,
96
+ execute,
76
97
  find,
77
98
  findGlobal,
78
99
  findGlobalVersions,
79
100
  findOne,
80
101
  findVersions,
102
+ indexes: new Set(),
81
103
  init,
104
+ insert,
82
105
  migrate,
83
106
  migrateDown,
84
107
  migrateFresh,
@@ -86,13 +109,18 @@ export function postgresAdapter(args) {
86
109
  migrateReset,
87
110
  migrateStatus,
88
111
  migrationDir,
112
+ packageName: '@payloadcms/db-postgres',
89
113
  payload,
90
114
  queryDrafts,
115
+ rejectInitializing,
116
+ requireDrizzleKit,
117
+ resolveInitializing,
91
118
  rollbackTransaction,
92
119
  updateGlobal,
93
120
  updateGlobalVersion,
94
121
  updateOne,
95
- updateVersion
122
+ updateVersion,
123
+ upsert: updateOne
96
124
  });
97
125
  }
98
126
  return {
@@ -100,37 +128,6 @@ export function postgresAdapter(args) {
100
128
  init: adapter
101
129
  };
102
130
  }
103
- /**
104
- * Attempt to find migrations directory.
105
- *
106
- * Checks for the following directories in order:
107
- * - `migrationDir` argument from Payload config
108
- * - `src/migrations`
109
- * - `dist/migrations`
110
- * - `migrations`
111
- *
112
- * Defaults to `src/migrations`
113
- *
114
- * @param migrationDir
115
- * @returns
116
- */ function findMigrationDir(migrationDir) {
117
- const cwd = process.cwd();
118
- const srcDir = path.resolve(cwd, 'src/migrations');
119
- const distDir = path.resolve(cwd, 'dist/migrations');
120
- const relativeMigrations = path.resolve(cwd, 'migrations');
121
- // Use arg if provided
122
- if (migrationDir) return migrationDir;
123
- // Check other common locations
124
- if (fs.existsSync(srcDir)) {
125
- return srcDir;
126
- }
127
- if (fs.existsSync(distDir)) {
128
- return distDir;
129
- }
130
- if (fs.existsSync(relativeMigrations)) {
131
- return relativeMigrations;
132
- }
133
- return srcDir;
134
- }
131
+ export { sql } from 'drizzle-orm';
135
132
 
136
133
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Payload } from 'payload'\nimport type { DatabaseAdapterObj } from 'payload/database'\n\nimport fs from 'fs'\nimport path from 'path'\nimport { createDatabaseAdapter } from 'payload/database'\n\nimport type { Args, PostgresAdapter } from './types.js'\n\nimport { connect } from './connect.js'\nimport { count } from './count.js'\nimport { create } from './create.js'\nimport { createGlobal } from './createGlobal.js'\nimport { createGlobalVersion } from './createGlobalVersion.js'\nimport { createMigration } from './createMigration.js'\nimport { createVersion } from './createVersion.js'\nimport { deleteMany } from './deleteMany.js'\nimport { deleteOne } from './deleteOne.js'\nimport { deleteVersions } from './deleteVersions.js'\nimport { destroy } from './destroy.js'\nimport { find } from './find.js'\nimport { findGlobal } from './findGlobal.js'\nimport { findGlobalVersions } from './findGlobalVersions.js'\nimport { findOne } from './findOne.js'\nimport { findVersions } from './findVersions.js'\nimport { init } from './init.js'\nimport { migrate } from './migrate.js'\nimport { migrateDown } from './migrateDown.js'\nimport { migrateFresh } from './migrateFresh.js'\nimport { migrateRefresh } from './migrateRefresh.js'\nimport { migrateReset } from './migrateReset.js'\nimport { migrateStatus } from './migrateStatus.js'\nimport { queryDrafts } from './queryDrafts.js'\nimport { beginTransaction } from './transactions/beginTransaction.js'\nimport { commitTransaction } from './transactions/commitTransaction.js'\nimport { rollbackTransaction } from './transactions/rollbackTransaction.js'\nimport { updateOne } from './update.js'\nimport { updateGlobal } from './updateGlobal.js'\nimport { updateGlobalVersion } from './updateGlobalVersion.js'\nimport { updateVersion } from './updateVersion.js'\n\nexport type { MigrateDownArgs, MigrateUpArgs } from './types.js'\n\nexport { sql } from 'drizzle-orm'\n\nexport function postgresAdapter(args: Args): DatabaseAdapterObj<PostgresAdapter> {\n const postgresIDType = args.idType || 'serial'\n const payloadIDType = postgresIDType === 'serial' ? 'number' : 'text'\n\n function adapter({ payload }: { payload: Payload }) {\n const migrationDir = findMigrationDir(args.migrationDir)\n\n return createDatabaseAdapter<PostgresAdapter>({\n name: 'postgres',\n drizzle: undefined,\n enums: {},\n fieldConstraints: {},\n idType: postgresIDType,\n localesSuffix: args.localesSuffix || '_locales',\n logger: args.logger,\n pgSchema: undefined,\n pool: undefined,\n poolOptions: args.pool,\n push: args.push,\n relations: {},\n relationshipsSuffix: args.relationshipsSuffix || '_rels',\n schema: {},\n schemaName: args.schemaName,\n sessions: {},\n tableNameMap: new Map<string, string>(),\n tables: {},\n versionsSuffix: args.versionsSuffix || '_v',\n\n // DatabaseAdapter\n beginTransaction,\n commitTransaction,\n connect,\n count,\n create,\n createGlobal,\n createGlobalVersion,\n createMigration,\n createVersion,\n defaultIDType: payloadIDType,\n deleteMany,\n deleteOne,\n deleteVersions,\n destroy,\n find,\n findGlobal,\n findGlobalVersions,\n findOne,\n findVersions,\n init,\n migrate,\n migrateDown,\n migrateFresh,\n migrateRefresh,\n migrateReset,\n migrateStatus,\n migrationDir,\n payload,\n queryDrafts,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateOne,\n updateVersion,\n })\n }\n\n return {\n defaultIDType: payloadIDType,\n init: adapter,\n }\n}\n\n/**\n * Attempt to find migrations directory.\n *\n * Checks for the following directories in order:\n * - `migrationDir` argument from Payload config\n * - `src/migrations`\n * - `dist/migrations`\n * - `migrations`\n *\n * Defaults to `src/migrations`\n *\n * @param migrationDir\n * @returns\n */\nfunction findMigrationDir(migrationDir?: string): string {\n const cwd = process.cwd()\n const srcDir = path.resolve(cwd, 'src/migrations')\n const distDir = path.resolve(cwd, 'dist/migrations')\n const relativeMigrations = path.resolve(cwd, 'migrations')\n\n // Use arg if provided\n if (migrationDir) return migrationDir\n\n // Check other common locations\n if (fs.existsSync(srcDir)) {\n return srcDir\n }\n\n if (fs.existsSync(distDir)) {\n return distDir\n }\n\n if (fs.existsSync(relativeMigrations)) {\n return relativeMigrations\n }\n\n return srcDir\n}\n"],"names":["fs","path","createDatabaseAdapter","connect","count","create","createGlobal","createGlobalVersion","createMigration","createVersion","deleteMany","deleteOne","deleteVersions","destroy","find","findGlobal","findGlobalVersions","findOne","findVersions","init","migrate","migrateDown","migrateFresh","migrateRefresh","migrateReset","migrateStatus","queryDrafts","beginTransaction","commitTransaction","rollbackTransaction","updateOne","updateGlobal","updateGlobalVersion","updateVersion","sql","postgresAdapter","args","postgresIDType","idType","payloadIDType","adapter","payload","migrationDir","findMigrationDir","name","drizzle","undefined","enums","fieldConstraints","localesSuffix","logger","pgSchema","pool","poolOptions","push","relations","relationshipsSuffix","schema","schemaName","sessions","tableNameMap","Map","tables","versionsSuffix","defaultIDType","cwd","process","srcDir","resolve","distDir","relativeMigrations","existsSync"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AACvB,SAASC,qBAAqB,QAAQ,mBAAkB;AAIxD,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,KAAK,QAAQ,aAAY;AAClC,SAASC,MAAM,QAAQ,cAAa;AACpC,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,SAAS,QAAQ,iBAAgB;AAC1C,SAASC,cAAc,QAAQ,sBAAqB;AACpD,SAASC,OAAO,QAAQ,eAAc;AACtC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Q,CAAC;YACTC,YAAYtB,KAAKsB,UAAU;YAC3BC,UAAU,CAAC;YACXC,cAAc,IAAIC;YAClBC,QAAQ,CAAC;YACTC,gBAAgB3B,KAAK2B,cAAc,IAAI;YAEvC,kBAAkB;YAClBpC;YACAC;YACAzB;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAuD,eAAezB;YACf7B;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAiB;YACAD;YACAf;YACAG;YACAE;YACAC;YACAF;YACAG;QACF;IACF;IAEA,OAAO;QACL+B,eAAezB;QACfpB,MAAMqB;IACR;AACF;AAEA;;;;;;;;;;;;;CAaC,GACD,SAASG,iBAAiBD,YAAqB;IAC7C,MAAMuB,MAAMC,QAAQD,GAAG;IACvB,MAAME,SAASlE,KAAKmE,OAAO,CAACH,KAAK;IACjC,MAAMI,UAAUpE,KAAKmE,OAAO,CAACH,KAAK;IAClC,MAAMK,qBAAqBrE,KAAKmE,OAAO,CAACH,KAAK;IAE7C,sBAAsB;IACtB,IAAIvB,cAAc,OAAOA;IAEzB,+BAA+B;IAC/B,IAAI1C,GAAGuE,UAAU,CAACJ,SAAS;QACzB,OAAOA;IACT;IAEA,IAAInE,GAAGuE,UAAU,CAACF,UAAU;QAC1B,OAAOA;IACT;IAEA,IAAIrE,GAAGuE,UAAU,CAACD,qBAAqB;QACrC,OAAOA;IACT;IAEA,OAAOH;AACT"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { DatabaseAdapterObj, Payload } from 'payload'\n\nimport {\n beginTransaction,\n commitTransaction,\n count,\n countGlobalVersions,\n countVersions,\n create,\n createGlobal,\n createGlobalVersion,\n createVersion,\n deleteMany,\n deleteOne,\n deleteVersions,\n destroy,\n find,\n findGlobal,\n findGlobalVersions,\n findMigrationDir,\n findOne,\n findVersions,\n migrate,\n migrateDown,\n migrateFresh,\n migrateRefresh,\n migrateReset,\n migrateStatus,\n operatorMap,\n queryDrafts,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateOne,\n updateVersion,\n} from '@payloadcms/drizzle'\nimport {\n countDistinct,\n createDatabase,\n createExtensions,\n createJSONQuery,\n createMigration,\n defaultDrizzleSnapshot,\n deleteWhere,\n dropDatabase,\n execute,\n getMigrationTemplate,\n init,\n insert,\n requireDrizzleKit,\n} from '@payloadcms/drizzle/postgres'\nimport { pgEnum, pgSchema, pgTable } from 'drizzle-orm/pg-core'\nimport path from 'path'\nimport { createDatabaseAdapter, defaultBeginTransaction } from 'payload'\nimport { fileURLToPath } from 'url'\n\nimport type { Args, PostgresAdapter } from './types.js'\n\nimport { connect } from './connect.js'\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\nexport function postgresAdapter(args: Args): DatabaseAdapterObj<PostgresAdapter> {\n const postgresIDType = args.idType || 'serial'\n const payloadIDType = postgresIDType === 'serial' ? 'number' : 'text'\n\n function adapter({ payload }: { payload: Payload }) {\n const migrationDir = findMigrationDir(args.migrationDir)\n let resolveInitializing\n let rejectInitializing\n let adapterSchema: PostgresAdapter['pgSchema']\n\n const initializing = new Promise<void>((res, rej) => {\n resolveInitializing = res\n rejectInitializing = rej\n })\n\n if (args.schemaName) {\n adapterSchema = pgSchema(args.schemaName)\n } else {\n adapterSchema = { enum: pgEnum, table: pgTable }\n }\n\n const extensions = (args.extensions ?? []).reduce((acc, name) => {\n acc[name] = true\n return acc\n }, {})\n\n return createDatabaseAdapter<PostgresAdapter>({\n name: 'postgres',\n afterSchemaInit: args.afterSchemaInit ?? [],\n beforeSchemaInit: args.beforeSchemaInit ?? [],\n createDatabase,\n createExtensions,\n createMigration(args) {\n return createMigration.bind(this)({ ...args, dirname })\n },\n defaultDrizzleSnapshot,\n disableCreateDatabase: args.disableCreateDatabase ?? false,\n drizzle: undefined,\n enums: {},\n extensions,\n features: {\n json: true,\n },\n fieldConstraints: {},\n getMigrationTemplate,\n idType: postgresIDType,\n initializing,\n localesSuffix: args.localesSuffix || '_locales',\n logger: args.logger,\n operators: operatorMap,\n pgSchema: adapterSchema,\n pool: undefined,\n poolOptions: args.pool,\n prodMigrations: args.prodMigrations,\n push: args.push,\n relations: {},\n relationshipsSuffix: args.relationshipsSuffix || '_rels',\n schema: {},\n schemaName: args.schemaName,\n sessions: {},\n tableNameMap: new Map<string, string>(),\n tables: {},\n tablesFilter: args.tablesFilter,\n transactionOptions: args.transactionOptions || undefined,\n versionsSuffix: args.versionsSuffix || '_v',\n\n // DatabaseAdapter\n beginTransaction:\n args.transactionOptions === false ? defaultBeginTransaction() : beginTransaction,\n commitTransaction,\n connect,\n count,\n countDistinct,\n countGlobalVersions,\n countVersions,\n create,\n createGlobal,\n createGlobalVersion,\n createJSONQuery,\n createVersion,\n defaultIDType: payloadIDType,\n deleteMany,\n deleteOne,\n deleteVersions,\n deleteWhere,\n destroy,\n dropDatabase,\n execute,\n find,\n findGlobal,\n findGlobalVersions,\n findOne,\n findVersions,\n indexes: new Set<string>(),\n init,\n insert,\n migrate,\n migrateDown,\n migrateFresh,\n migrateRefresh,\n migrateReset,\n migrateStatus,\n migrationDir,\n packageName: '@payloadcms/db-postgres',\n payload,\n queryDrafts,\n rejectInitializing,\n requireDrizzleKit,\n resolveInitializing,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateOne,\n updateVersion,\n upsert: updateOne,\n })\n }\n\n return {\n defaultIDType: payloadIDType,\n init: adapter,\n }\n}\n\nexport type { MigrateDownArgs, MigrateUpArgs } from '@payloadcms/drizzle/postgres'\nexport { sql } from 'drizzle-orm'\n"],"names":["beginTransaction","commitTransaction","count","countGlobalVersions","countVersions","create","createGlobal","createGlobalVersion","createVersion","deleteMany","deleteOne","deleteVersions","destroy","find","findGlobal","findGlobalVersions","findMigrationDir","findOne","findVersions","migrate","migrateDown","migrateFresh","migrateRefresh","migrateReset","migrateStatus","operatorMap","queryDrafts","rollbackTransaction","updateGlobal","updateGlobalVersion","updateOne","updateVersion","countDistinct","createDatabase","createExtensions","createJSONQuery","createMigration","defaultDrizzleSnapshot","deleteWhere","dropDatabase","execute","getMigrationTemplate","init","insert","requireDrizzleKit","pgEnum","pgSchema","pgTable","path","createDatabaseAdapter","defaultBeginTransaction","fileURLToPath","connect","filename","url","dirname","postgresAdapter","args","postgresIDType","idType","payloadIDType","adapter","payload","migrationDir","resolveInitializing","rejectInitializing","adapterSchema","initializing","Promise","res","rej","schemaName","enum","table","extensions","reduce","acc","name","afterSchemaInit","beforeSchemaInit","bind","disableCreateDatabase","drizzle","undefined","enums","features","json","fieldConstraints","localesSuffix","logger","operators","pool","poolOptions","prodMigrations","push","relations","relationshipsSuffix","schema","sessions","tableNameMap","Map","tables","tablesFilter","transactionOptions","versionsSuffix","defaultIDType","indexes","Set","packageName","upsert","sql"],"mappings":"AAEA,SACEA,gBAAgB,EAChBC,iBAAiB,EACjBC,KAAK,EACLC,mBAAmB,EACnBC,aAAa,EACbC,MAAM,EACNC,YAAY,EACZC,mBAAmB,EACnBC,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,cAAc,EACdC,OAAO,EACPC,IAAI,EACJC,UAAU,EACVC,kBAAkB,EAClBC,gBAAgB,EAChBC,OAAO,EACPC,YAAY,EACZC,OAAO,EACPC,WAAW,EACXC,YAAY,EACZC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,mBAAmB,EACnBC,YAAY,EACZC,mBAAmB,EACnBC,SAAS,EACTC,aAAa,QACR,sBAAqB;AAC5B,SACEC,aAAa,EACbC,cAAc,EACdC,gBAAgB,EAChBC,eAAe,EACfC,eAAe,EACfC,sBAAsB,EACtBC,WAAW,EACXC,YAAY,EACZC,OAAO,EACPC,oBAAoB,EACpBC,IAAI,EACJC,MAAM,EACNC,iBAAiB,QACZ,+BAA8B;AACrC,SAASC,MAAM,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,sBAAqB;AAC/D,OAAOC,UAAU,O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kB,CAAC;YACnB9C;YACAkB,QAAQD;YACRS;YACAqB,eAAe/B,KAAK+B,aAAa,IAAI;YACrCC,QAAQhC,KAAKgC,MAAM;YACnBC,WAAWjE;YACXqB,UAAUoB;YACVyB,MAAMR;YACNS,aAAanC,KAAKkC,IAAI;YACtBE,gBAAgBpC,KAAKoC,cAAc;YACnCC,MAAMrC,KAAKqC,IAAI;YACfC,WAAW,CAAC;YACZC,qBAAqBvC,KAAKuC,mBAAmB,IAAI;YACjDC,QAAQ,CAAC;YACT1B,YAAYd,KAAKc,UAAU;YAC3B2B,UAAU,CAAC;YACXC,cAAc,IAAIC;YAClBC,QAAQ,CAAC;YACTC,cAAc7C,KAAK6C,YAAY;YAC/BC,oBAAoB9C,KAAK8C,kBAAkB,IAAIpB;YAC/CqB,gBAAgB/C,KAAK+C,cAAc,IAAI;YAEvC,kBAAkB;YAClBxG,kBACEyD,KAAK8C,kBAAkB,KAAK,QAAQrD,4BAA4BlD;YAClEC;YACAmD;YACAlD;YACA8B;YACA7B;YACAC;YACAC;YACAC;YACAC;YACA4B;YACA3B;YACAiG,eAAe7C;YACfnD;YACAC;YACAC;YACA2B;YACA1B;YACA2B;YACAC;YACA3B;YACAC;YACAC;YACAE;YACAC;YACAwF,SAAS,IAAIC;YACbjE;YACAC;YACAxB;YACAC;YACAC;YACAC;YACAC;YACAC;YACAuC;YACA6C,aAAa;YACb9C;YACApC;YACAuC;YACArB;YACAoB;YACArC;YACAC;YACAC;YACAC;YACAC;YACA8E,QAAQ/E;QACV;IACF;IAEA,OAAO;QACL2E,eAAe7C;QACflB,MAAMmB;IACR;AACF;AAGA,SAASiD,GAAG,QAAQ,cAAa"}
@@ -0,0 +1,4 @@
1
+ declare const imports = "import { migratePostgresV2toV3 } from '@payloadcms/db-postgres/migration-utils'";
2
+ declare const upSQL = " await migratePostgresV2toV3({\n // enables logging of changes that will be made to the database\n debug: false,\n payload,\n req,\n })\n";
3
+ export { imports, upSQL };
4
+ //# sourceMappingURL=relationships-v2-v3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relationships-v2-v3.d.ts","sourceRoot":"","sources":["../../src/predefinedMigrations/relationships-v2-v3.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,OAAO,oFAAoF,CAAA;AACjG,QAAA,MAAM,KAAK,mLAMV,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/predefinedMigrations/relationships-v2-v3.ts"],"sourcesContent":["const imports = `import { migratePostgresV2toV3 } from '@payloadcms/db-postgres/migration-utils'`\nconst upSQL = ` await migratePostgresV2toV3({\n // enables logging of changes that will be made to the database\n debug: false,\n payload,\n req,\n })\n`\n\nexport { imports, upSQL }\n"],"names":["imports","upSQL"],"mappings":"AAAA,MAAMA,UAAU,CAAC,+EAA+E,CAAC;AACjG,MAAMC,QAAQ,CAAC;;;;;;AAMf,CAAC;AAED,SAASD,OAAO,EAAEC,KAAK,GAAE"}
@@ -0,0 +1,11 @@
1
+ const imports = `import { migratePostgresV2toV3 } from '@payloadcms/db-postgres/migration-utils'`;
2
+ const upSQL = ` await migratePostgresV2toV3({
3
+ // enables logging of changes that will be made to the database
4
+ debug: false,
5
+ payload,
6
+ req,
7
+ })
8
+ `;
9
+ export { imports, upSQL };
10
+
11
+ //# sourceMappingURL=relationships-v2-v3.js.map
@@ -0,0 +1,20 @@
1
+ import type { TransactionPg } from '@payloadcms/drizzle/types';
2
+ import type { Field, Payload, PayloadRequest } from 'payload';
3
+ import type { PostgresAdapter } from '../../../types.js';
4
+ import type { DocsToResave } from '../types.js';
5
+ type Args = {
6
+ adapter: PostgresAdapter;
7
+ collectionSlug?: string;
8
+ db: TransactionPg;
9
+ debug: boolean;
10
+ docsToResave: DocsToResave;
11
+ fields: Field[];
12
+ globalSlug?: string;
13
+ isVersions: boolean;
14
+ payload: Payload;
15
+ req: PayloadRequest;
16
+ tableName: string;
17
+ };
18
+ export declare const fetchAndResave: ({ adapter, collectionSlug, db, debug, docsToResave, fields, globalSlug, isVersions, payload, req, tableName, }: Args) => Promise<void>;
19
+ export {};
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/predefinedMigrations/v2-v3/fetchAndResave/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI/C,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,EAAE,EAAE,aAAa,CAAA;IACjB,KAAK,EAAE,OAAO,CAAA;IACd,YAAY,EAAE,YAAY,CAAA;IAC1B,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,EAAE,cAAc,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,cAAc,mHAYxB,IAAI,kBAwMN,CAAA"}