@payloadcms/db-postgres 3.0.0-canary.6041f49 → 3.0.0-canary.6d066c2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (400) 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 +16 -13
  5. package/dist/connect.js.map +1 -1
  6. package/dist/countDistinct.d.ts +3 -0
  7. package/dist/countDistinct.d.ts.map +1 -0
  8. package/dist/countDistinct.js +24 -0
  9. package/dist/countDistinct.js.map +1 -0
  10. package/dist/createJSONQuery/convertPathToJSONTraversal.d.ts.map +1 -0
  11. package/dist/createJSONQuery/convertPathToJSONTraversal.js.map +1 -0
  12. package/dist/createJSONQuery/formatJSONPathSegment.d.ts.map +1 -0
  13. package/dist/createJSONQuery/formatJSONPathSegment.js.map +1 -0
  14. package/dist/createJSONQuery/index.d.ts.map +1 -0
  15. package/dist/createJSONQuery/index.js.map +1 -0
  16. package/dist/createMigration.d.ts +1 -1
  17. package/dist/createMigration.d.ts.map +1 -1
  18. package/dist/createMigration.js +56 -57
  19. package/dist/createMigration.js.map +1 -1
  20. package/dist/defaultSnapshot.d.ts +3 -0
  21. package/dist/defaultSnapshot.d.ts.map +1 -0
  22. package/dist/defaultSnapshot.js +16 -0
  23. package/dist/defaultSnapshot.js.map +1 -0
  24. package/dist/deleteWhere.d.ts +3 -0
  25. package/dist/deleteWhere.d.ts.map +1 -0
  26. package/dist/deleteWhere.js +6 -0
  27. package/dist/deleteWhere.js.map +1 -0
  28. package/dist/dropDatabase.d.ts +3 -0
  29. package/dist/dropDatabase.d.ts.map +1 -0
  30. package/dist/dropDatabase.js +9 -0
  31. package/dist/dropDatabase.js.map +1 -0
  32. package/dist/execute.d.ts +3 -0
  33. package/dist/execute.d.ts.map +1 -0
  34. package/dist/execute.js +11 -0
  35. package/dist/execute.js.map +1 -0
  36. package/dist/exports/migration-utils.d.ts +2 -0
  37. package/dist/exports/migration-utils.d.ts.map +1 -0
  38. package/dist/exports/migration-utils.js +3 -0
  39. package/dist/exports/migration-utils.js.map +1 -0
  40. package/dist/getMigrationTemplate.d.ts +3 -0
  41. package/dist/getMigrationTemplate.d.ts.map +1 -0
  42. package/dist/getMigrationTemplate.js +12 -0
  43. package/dist/getMigrationTemplate.js.map +1 -0
  44. package/dist/index.d.ts +1 -1
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +37 -64
  47. package/dist/index.js.map +1 -1
  48. package/dist/init.d.ts +1 -1
  49. package/dist/init.d.ts.map +1 -1
  50. package/dist/init.js +17 -22
  51. package/dist/init.js.map +1 -1
  52. package/dist/insert.d.ts +3 -0
  53. package/dist/insert.d.ts.map +1 -0
  54. package/dist/insert.js +12 -0
  55. package/dist/insert.js.map +1 -0
  56. package/dist/predefinedMigrations/relationships-v2-v3.d.ts +4 -0
  57. package/dist/predefinedMigrations/relationships-v2-v3.d.ts.map +1 -0
  58. package/dist/predefinedMigrations/relationships-v2-v3.js.map +1 -0
  59. package/dist/predefinedMigrations/relationships-v2-v3.mjs +11 -0
  60. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts +20 -0
  61. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -0
  62. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js +169 -0
  63. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -0
  64. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts +11 -0
  65. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.d.ts.map +1 -0
  66. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js +191 -0
  67. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js.map +1 -0
  68. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts +3 -0
  69. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts.map +1 -0
  70. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js +56 -0
  71. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js.map +1 -0
  72. package/dist/predefinedMigrations/v2-v3/index.d.ts +23 -0
  73. package/dist/predefinedMigrations/v2-v3/index.d.ts.map +1 -0
  74. package/dist/predefinedMigrations/v2-v3/index.js +211 -0
  75. package/dist/predefinedMigrations/v2-v3/index.js.map +1 -0
  76. package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts +20 -0
  77. package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts.map +1 -0
  78. package/dist/predefinedMigrations/v2-v3/migrateRelationships.js +57 -0
  79. package/dist/predefinedMigrations/v2-v3/migrateRelationships.js.map +1 -0
  80. package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts +23 -0
  81. package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts.map +1 -0
  82. package/dist/predefinedMigrations/v2-v3/traverseFields.js +85 -0
  83. package/dist/predefinedMigrations/v2-v3/traverseFields.js.map +1 -0
  84. package/dist/predefinedMigrations/v2-v3/types.d.ts +9 -0
  85. package/dist/predefinedMigrations/v2-v3/types.d.ts.map +1 -0
  86. package/dist/predefinedMigrations/v2-v3/types.js +6 -0
  87. package/dist/predefinedMigrations/v2-v3/types.js.map +1 -0
  88. package/dist/requireDrizzleKit.d.ts +3 -0
  89. package/dist/requireDrizzleKit.d.ts.map +1 -0
  90. package/dist/requireDrizzleKit.js +5 -0
  91. package/dist/requireDrizzleKit.js.map +1 -0
  92. package/dist/schema/build.d.ts +9 -5
  93. package/dist/schema/build.d.ts.map +1 -1
  94. package/dist/schema/build.js +163 -114
  95. package/dist/schema/build.js.map +1 -1
  96. package/dist/schema/createIndex.js.map +1 -1
  97. package/dist/schema/idToUUID.d.ts +1 -1
  98. package/dist/schema/idToUUID.d.ts.map +1 -1
  99. package/dist/schema/idToUUID.js.map +1 -1
  100. package/dist/schema/parentIDColumnMap.js.map +1 -1
  101. package/dist/schema/setColumnID.d.ts +1 -1
  102. package/dist/schema/setColumnID.d.ts.map +1 -1
  103. package/dist/schema/setColumnID.js +2 -2
  104. package/dist/schema/setColumnID.js.map +1 -1
  105. package/dist/schema/traverseFields.d.ts +5 -7
  106. package/dist/schema/traverseFields.d.ts.map +1 -1
  107. package/dist/schema/traverseFields.js +107 -46
  108. package/dist/schema/traverseFields.js.map +1 -1
  109. package/dist/types.d.ts +78 -32
  110. package/dist/types.d.ts.map +1 -1
  111. package/dist/types.js.map +1 -1
  112. package/package.json +22 -13
  113. package/dist/count.d.ts +0 -3
  114. package/dist/count.d.ts.map +0 -1
  115. package/dist/count.js +0 -50
  116. package/dist/count.js.map +0 -1
  117. package/dist/create.d.ts +0 -3
  118. package/dist/create.d.ts.map +0 -1
  119. package/dist/create.js +0 -19
  120. package/dist/create.js.map +0 -1
  121. package/dist/createGlobal.d.ts +0 -5
  122. package/dist/createGlobal.d.ts.map +0 -1
  123. package/dist/createGlobal.js +0 -19
  124. package/dist/createGlobal.js.map +0 -1
  125. package/dist/createGlobalVersion.d.ts +0 -6
  126. package/dist/createGlobalVersion.d.ts.map +0 -1
  127. package/dist/createGlobalVersion.js +0 -33
  128. package/dist/createGlobalVersion.js.map +0 -1
  129. package/dist/createVersion.d.ts +0 -5
  130. package/dist/createVersion.d.ts.map +0 -1
  131. package/dist/createVersion.js +0 -44
  132. package/dist/createVersion.js.map +0 -1
  133. package/dist/deleteMany.d.ts +0 -3
  134. package/dist/deleteMany.d.ts.map +0 -1
  135. package/dist/deleteMany.js +0 -28
  136. package/dist/deleteMany.js.map +0 -1
  137. package/dist/deleteOne.d.ts +0 -3
  138. package/dist/deleteOne.d.ts.map +0 -1
  139. package/dist/deleteOne.js +0 -59
  140. package/dist/deleteOne.js.map +0 -1
  141. package/dist/deleteVersions.d.ts +0 -3
  142. package/dist/deleteVersions.d.ts.map +0 -1
  143. package/dist/deleteVersions.js +0 -31
  144. package/dist/deleteVersions.js.map +0 -1
  145. package/dist/destroy.d.ts +0 -3
  146. package/dist/destroy.d.ts.map +0 -1
  147. package/dist/destroy.js +0 -11
  148. package/dist/destroy.js.map +0 -1
  149. package/dist/find/buildFindManyArgs.d.ts +0 -13
  150. package/dist/find/buildFindManyArgs.d.ts.map +0 -1
  151. package/dist/find/buildFindManyArgs.js +0 -64
  152. package/dist/find/buildFindManyArgs.js.map +0 -1
  153. package/dist/find/chainMethods.d.ts +0 -16
  154. package/dist/find/chainMethods.d.ts.map +0 -1
  155. package/dist/find/chainMethods.js +0 -12
  156. package/dist/find/chainMethods.js.map +0 -1
  157. package/dist/find/findMany.d.ts +0 -22
  158. package/dist/find/findMany.d.ts.map +0 -1
  159. package/dist/find/findMany.js +0 -163
  160. package/dist/find/findMany.js.map +0 -1
  161. package/dist/find/traverseFields.d.ts +0 -16
  162. package/dist/find/traverseFields.d.ts.map +0 -1
  163. package/dist/find/traverseFields.js +0 -138
  164. package/dist/find/traverseFields.js.map +0 -1
  165. package/dist/find.d.ts +0 -3
  166. package/dist/find.d.ts.map +0 -1
  167. package/dist/find.js +0 -21
  168. package/dist/find.js.map +0 -1
  169. package/dist/findGlobal.d.ts +0 -3
  170. package/dist/findGlobal.d.ts.map +0 -1
  171. package/dist/findGlobal.js +0 -23
  172. package/dist/findGlobal.js.map +0 -1
  173. package/dist/findGlobalVersions.d.ts +0 -3
  174. package/dist/findGlobalVersions.d.ts.map +0 -1
  175. package/dist/findGlobalVersions.js +0 -24
  176. package/dist/findGlobalVersions.js.map +0 -1
  177. package/dist/findOne.d.ts +0 -5
  178. package/dist/findOne.d.ts.map +0 -1
  179. package/dist/findOne.js +0 -21
  180. package/dist/findOne.js.map +0 -1
  181. package/dist/findVersions.d.ts +0 -3
  182. package/dist/findVersions.d.ts.map +0 -1
  183. package/dist/findVersions.js +0 -24
  184. package/dist/findVersions.js.map +0 -1
  185. package/dist/migrate.d.ts +0 -3
  186. package/dist/migrate.d.ts.map +0 -1
  187. package/dist/migrate.js +0 -99
  188. package/dist/migrate.js.map +0 -1
  189. package/dist/migrateDown.d.ts +0 -3
  190. package/dist/migrateDown.d.ts.map +0 -1
  191. package/dist/migrateDown.js +0 -63
  192. package/dist/migrateDown.js.map +0 -1
  193. package/dist/migrateFresh.d.ts +0 -8
  194. package/dist/migrateFresh.d.ts.map +0 -1
  195. package/dist/migrateFresh.js +0 -72
  196. package/dist/migrateFresh.js.map +0 -1
  197. package/dist/migrateRefresh.d.ts +0 -6
  198. package/dist/migrateRefresh.d.ts.map +0 -1
  199. package/dist/migrateRefresh.js +0 -102
  200. package/dist/migrateRefresh.js.map +0 -1
  201. package/dist/migrateReset.d.ts +0 -6
  202. package/dist/migrateReset.d.ts.map +0 -1
  203. package/dist/migrateReset.js +0 -82
  204. package/dist/migrateReset.js.map +0 -1
  205. package/dist/migrateStatus.d.ts +0 -3
  206. package/dist/migrateStatus.d.ts.map +0 -1
  207. package/dist/migrateStatus.js +0 -44
  208. package/dist/migrateStatus.js.map +0 -1
  209. package/dist/queries/buildAndOrConditions.d.ts +0 -17
  210. package/dist/queries/buildAndOrConditions.d.ts.map +0 -1
  211. package/dist/queries/buildAndOrConditions.js +0 -29
  212. package/dist/queries/buildAndOrConditions.js.map +0 -1
  213. package/dist/queries/buildQuery.d.ts +0 -31
  214. package/dist/queries/buildQuery.d.ts.map +0 -1
  215. package/dist/queries/buildQuery.js +0 -76
  216. package/dist/queries/buildQuery.js.map +0 -1
  217. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts.map +0 -1
  218. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +0 -1
  219. package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts.map +0 -1
  220. package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +0 -1
  221. package/dist/queries/createJSONQuery/index.d.ts.map +0 -1
  222. package/dist/queries/createJSONQuery/index.js.map +0 -1
  223. package/dist/queries/getTableColumnFromPath.d.ts +0 -51
  224. package/dist/queries/getTableColumnFromPath.d.ts.map +0 -1
  225. package/dist/queries/getTableColumnFromPath.js +0 -445
  226. package/dist/queries/getTableColumnFromPath.js.map +0 -1
  227. package/dist/queries/operatorMap.d.ts +0 -18
  228. package/dist/queries/operatorMap.d.ts.map +0 -1
  229. package/dist/queries/operatorMap.js +0 -24
  230. package/dist/queries/operatorMap.js.map +0 -1
  231. package/dist/queries/parseParams.d.ts +0 -17
  232. package/dist/queries/parseParams.d.ts.map +0 -1
  233. package/dist/queries/parseParams.js +0 -182
  234. package/dist/queries/parseParams.js.map +0 -1
  235. package/dist/queries/sanitizeQueryValue.d.ts +0 -15
  236. package/dist/queries/sanitizeQueryValue.d.ts.map +0 -1
  237. package/dist/queries/sanitizeQueryValue.js +0 -90
  238. package/dist/queries/sanitizeQueryValue.js.map +0 -1
  239. package/dist/queries/selectDistinct.d.ts +0 -23
  240. package/dist/queries/selectDistinct.d.ts.map +0 -1
  241. package/dist/queries/selectDistinct.js +0 -41
  242. package/dist/queries/selectDistinct.js.map +0 -1
  243. package/dist/queryDrafts.d.ts +0 -3
  244. package/dist/queryDrafts.d.ts.map +0 -1
  245. package/dist/queryDrafts.js +0 -41
  246. package/dist/queryDrafts.js.map +0 -1
  247. package/dist/schema/createTableName.d.ts +0 -30
  248. package/dist/schema/createTableName.d.ts.map +0 -1
  249. package/dist/schema/createTableName.js +0 -31
  250. package/dist/schema/createTableName.js.map +0 -1
  251. package/dist/schema/validateExistingBlockIsIdentical.d.ts +0 -12
  252. package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +0 -1
  253. package/dist/schema/validateExistingBlockIsIdentical.js +0 -76
  254. package/dist/schema/validateExistingBlockIsIdentical.js.map +0 -1
  255. package/dist/transactions/beginTransaction.d.ts +0 -3
  256. package/dist/transactions/beginTransaction.d.ts.map +0 -1
  257. package/dist/transactions/beginTransaction.js +0 -47
  258. package/dist/transactions/beginTransaction.js.map +0 -1
  259. package/dist/transactions/commitTransaction.d.ts +0 -3
  260. package/dist/transactions/commitTransaction.d.ts.map +0 -1
  261. package/dist/transactions/commitTransaction.js +0 -14
  262. package/dist/transactions/commitTransaction.js.map +0 -1
  263. package/dist/transactions/rollbackTransaction.d.ts +0 -3
  264. package/dist/transactions/rollbackTransaction.d.ts.map +0 -1
  265. package/dist/transactions/rollbackTransaction.js +0 -13
  266. package/dist/transactions/rollbackTransaction.js.map +0 -1
  267. package/dist/transform/read/hasManyNumber.d.ts +0 -10
  268. package/dist/transform/read/hasManyNumber.d.ts.map +0 -1
  269. package/dist/transform/read/hasManyNumber.js +0 -10
  270. package/dist/transform/read/hasManyNumber.js.map +0 -1
  271. package/dist/transform/read/hasManyText.d.ts +0 -10
  272. package/dist/transform/read/hasManyText.d.ts.map +0 -1
  273. package/dist/transform/read/hasManyText.js +0 -10
  274. package/dist/transform/read/hasManyText.js.map +0 -1
  275. package/dist/transform/read/index.d.ts +0 -12
  276. package/dist/transform/read/index.d.ts.map +0 -1
  277. package/dist/transform/read/index.js +0 -43
  278. package/dist/transform/read/index.js.map +0 -1
  279. package/dist/transform/read/relationship.d.ts +0 -10
  280. package/dist/transform/read/relationship.d.ts.map +0 -1
  281. package/dist/transform/read/relationship.js +0 -64
  282. package/dist/transform/read/relationship.js.map +0 -1
  283. package/dist/transform/read/traverseFields.d.ts +0 -52
  284. package/dist/transform/read/traverseFields.d.ts.map +0 -1
  285. package/dist/transform/read/traverseFields.js +0 -421
  286. package/dist/transform/read/traverseFields.js.map +0 -1
  287. package/dist/transform/write/array.d.ts +0 -26
  288. package/dist/transform/write/array.d.ts.map +0 -1
  289. package/dist/transform/write/array.js +0 -58
  290. package/dist/transform/write/array.js.map +0 -1
  291. package/dist/transform/write/blocks.d.ts +0 -25
  292. package/dist/transform/write/blocks.d.ts.map +0 -1
  293. package/dist/transform/write/blocks.js +0 -54
  294. package/dist/transform/write/blocks.js.map +0 -1
  295. package/dist/transform/write/index.d.ts +0 -13
  296. package/dist/transform/write/index.d.ts.map +0 -1
  297. package/dist/transform/write/index.js +0 -41
  298. package/dist/transform/write/index.js.map +0 -1
  299. package/dist/transform/write/numbers.d.ts +0 -8
  300. package/dist/transform/write/numbers.d.ts.map +0 -1
  301. package/dist/transform/write/numbers.js +0 -11
  302. package/dist/transform/write/numbers.js.map +0 -1
  303. package/dist/transform/write/relationships.d.ts +0 -10
  304. package/dist/transform/write/relationships.d.ts.map +0 -1
  305. package/dist/transform/write/relationships.js +0 -23
  306. package/dist/transform/write/relationships.js.map +0 -1
  307. package/dist/transform/write/selects.d.ts +0 -8
  308. package/dist/transform/write/selects.d.ts.map +0 -1
  309. package/dist/transform/write/selects.js +0 -20
  310. package/dist/transform/write/selects.js.map +0 -1
  311. package/dist/transform/write/texts.d.ts +0 -8
  312. package/dist/transform/write/texts.d.ts.map +0 -1
  313. package/dist/transform/write/texts.js +0 -11
  314. package/dist/transform/write/texts.js.map +0 -1
  315. package/dist/transform/write/traverseFields.d.ts +0 -50
  316. package/dist/transform/write/traverseFields.d.ts.map +0 -1
  317. package/dist/transform/write/traverseFields.js +0 -428
  318. package/dist/transform/write/traverseFields.js.map +0 -1
  319. package/dist/transform/write/types.d.ts +0 -43
  320. package/dist/transform/write/types.d.ts.map +0 -1
  321. package/dist/transform/write/types.js +0 -3
  322. package/dist/transform/write/types.js.map +0 -1
  323. package/dist/update.d.ts +0 -3
  324. package/dist/update.d.ts.map +0 -1
  325. package/dist/update.js +0 -55
  326. package/dist/update.js.map +0 -1
  327. package/dist/updateGlobal.d.ts +0 -5
  328. package/dist/updateGlobal.d.ts.map +0 -1
  329. package/dist/updateGlobal.js +0 -25
  330. package/dist/updateGlobal.js.map +0 -1
  331. package/dist/updateGlobalVersion.d.ts +0 -5
  332. package/dist/updateGlobalVersion.d.ts.map +0 -1
  333. package/dist/updateGlobalVersion.js +0 -36
  334. package/dist/updateGlobalVersion.js.map +0 -1
  335. package/dist/updateVersion.d.ts +0 -5
  336. package/dist/updateVersion.d.ts.map +0 -1
  337. package/dist/updateVersion.js +0 -36
  338. package/dist/updateVersion.js.map +0 -1
  339. package/dist/upsertRow/deleteExistingArrayRows.d.ts +0 -10
  340. package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +0 -1
  341. package/dist/upsertRow/deleteExistingArrayRows.js +0 -10
  342. package/dist/upsertRow/deleteExistingArrayRows.js.map +0 -1
  343. package/dist/upsertRow/deleteExistingRowsByPath.d.ts +0 -14
  344. package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +0 -1
  345. package/dist/upsertRow/deleteExistingRowsByPath.js +0 -33
  346. package/dist/upsertRow/deleteExistingRowsByPath.js.map +0 -1
  347. package/dist/upsertRow/index.d.ts +0 -4
  348. package/dist/upsertRow/index.d.ts.map +0 -1
  349. package/dist/upsertRow/index.js +0 -277
  350. package/dist/upsertRow/index.js.map +0 -1
  351. package/dist/upsertRow/insertArrays.d.ts +0 -13
  352. package/dist/upsertRow/insertArrays.d.ts.map +0 -1
  353. package/dist/upsertRow/insertArrays.js +0 -68
  354. package/dist/upsertRow/insertArrays.js.map +0 -1
  355. package/dist/upsertRow/types.d.ts +0 -27
  356. package/dist/upsertRow/types.d.ts.map +0 -1
  357. package/dist/upsertRow/types.js +0 -3
  358. package/dist/upsertRow/types.js.map +0 -1
  359. package/dist/utilities/appendPrefixToKeys.d.ts +0 -2
  360. package/dist/utilities/appendPrefixToKeys.d.ts.map +0 -1
  361. package/dist/utilities/appendPrefixToKeys.js +0 -6
  362. package/dist/utilities/appendPrefixToKeys.js.map +0 -1
  363. package/dist/utilities/createBlocksMap.d.ts +0 -5
  364. package/dist/utilities/createBlocksMap.d.ts.map +0 -1
  365. package/dist/utilities/createBlocksMap.js +0 -29
  366. package/dist/utilities/createBlocksMap.js.map +0 -1
  367. package/dist/utilities/createMigrationTable.d.ts +0 -3
  368. package/dist/utilities/createMigrationTable.d.ts.map +0 -1
  369. package/dist/utilities/createMigrationTable.js +0 -13
  370. package/dist/utilities/createMigrationTable.js.map +0 -1
  371. package/dist/utilities/createRelationshipMap.d.ts +0 -2
  372. package/dist/utilities/createRelationshipMap.d.ts.map +0 -1
  373. package/dist/utilities/createRelationshipMap.js +0 -19
  374. package/dist/utilities/createRelationshipMap.js.map +0 -1
  375. package/dist/utilities/hasLocalesTable.d.ts +0 -3
  376. package/dist/utilities/hasLocalesTable.d.ts.map +0 -1
  377. package/dist/utilities/hasLocalesTable.js +0 -11
  378. package/dist/utilities/hasLocalesTable.js.map +0 -1
  379. package/dist/utilities/isArrayOfRows.d.ts +0 -2
  380. package/dist/utilities/isArrayOfRows.d.ts.map +0 -1
  381. package/dist/utilities/isArrayOfRows.js +0 -5
  382. package/dist/utilities/isArrayOfRows.js.map +0 -1
  383. package/dist/utilities/migrationTableExists.d.ts +0 -3
  384. package/dist/utilities/migrationTableExists.d.ts.map +0 -1
  385. package/dist/utilities/migrationTableExists.js +0 -9
  386. package/dist/utilities/migrationTableExists.js.map +0 -1
  387. package/dist/utilities/parseError.d.ts +0 -5
  388. package/dist/utilities/parseError.d.ts.map +0 -1
  389. package/dist/utilities/parseError.js +0 -17
  390. package/dist/utilities/parseError.js.map +0 -1
  391. package/dist/utilities/pushDevSchema.d.ts +0 -9
  392. package/dist/utilities/pushDevSchema.d.ts.map +0 -1
  393. package/dist/utilities/pushDevSchema.js +0 -58
  394. package/dist/utilities/pushDevSchema.js.map +0 -1
  395. /package/dist/{queries/createJSONQuery → createJSONQuery}/convertPathToJSONTraversal.d.ts +0 -0
  396. /package/dist/{queries/createJSONQuery → createJSONQuery}/convertPathToJSONTraversal.js +0 -0
  397. /package/dist/{queries/createJSONQuery → createJSONQuery}/formatJSONPathSegment.d.ts +0 -0
  398. /package/dist/{queries/createJSONQuery → createJSONQuery}/formatJSONPathSegment.js +0 -0
  399. /package/dist/{queries/createJSONQuery → createJSONQuery}/index.d.ts +0 -0
  400. /package/dist/{queries/createJSONQuery → createJSONQuery}/index.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/schema/traverseFields.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { Relation } from 'drizzle-orm'\nimport type { IndexBuilder, PgColumnBuilder } from 'drizzle-orm/pg-core'\nimport type { Field, TabAsField } from 'payload/types'\n\nimport { relations } from 'drizzle-orm'\nimport {\n PgNumericBuilder,\n PgUUIDBuilder,\n PgVarcharBuilder,\n boolean,\n foreignKey,\n index,\n integer,\n jsonb,\n numeric,\n pgEnum,\n text,\n timestamp,\n varchar,\n} from 'drizzle-orm/pg-core'\nimport { InvalidConfiguration } from 'payload/errors'\nimport { fieldAffectsData, optionIsObject } from 'payload/types'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { GenericColumns, IDType, PostgresAdapter } from '../types.js'\nimport type { BaseExtraConfig } from './build.js'\n\nimport { hasLocalesTable } from '../utilities/hasLocalesTable.js'\nimport { buildTable } from './build.js'\nimport { createIndex } from './createIndex.js'\nimport { createTableName } from './createTableName.js'\nimport { idToUUID } from './idToUUID.js'\nimport { parentIDColumnMap } from './parentIDColumnMap.js'\nimport { validateExistingBlockIsIdentical } from './validateExistingBlockIsIdentical.js'\n\ntype Args = {\n adapter: PostgresAdapter\n buildNumbers: boolean\n buildRelationships: boolean\n buildTexts: boolean\n columnPrefix?: string\n columns: Record<string, PgColumnBuilder>\n disableNotNull: boolean\n disableUnique?: boolean\n fieldPrefix?: string\n fields: (Field | TabAsField)[]\n forceLocalized?: boolean\n indexes: Record<string, (cols: GenericColumns) => IndexBuilder>\n localesColumns: Record<string, PgColumnBuilder>\n localesIndexes: Record<string, (cols: GenericColumns) => IndexBuilder>\n newTableName: string\n parentTableName: string\n relationsToBuild: Map<string, string>\n relationships: Set<string>\n rootRelationsToBuild?: Map<string, string>\n rootTableIDColType: string\n rootTableName: string\n versions: boolean\n}\n\ntype Result = {\n hasLocalizedField: boolean\n hasLocalizedManyNumberField: boolean\n hasLocalizedManyTextField: boolean\n hasLocalizedRelationshipField: boolean\n hasManyNumberField: 'index' | boolean\n hasManyTextField: 'index' | boolean\n}\n\nexport const traverseFields = ({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columnPrefix,\n columns,\n disableNotNull,\n disableUnique = false,\n fieldPrefix,\n fields,\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n versions,\n}: Args): Result => {\n const throwValidationError = true\n let hasLocalizedField = false\n let hasLocalizedRelationshipField = false\n let hasManyTextField: 'index' | boolean = false\n let hasLocalizedManyTextField = false\n let hasManyNumberField: 'index' | boolean = false\n let hasLocalizedManyNumberField = false\n\n let parentIDColType: IDType = 'integer'\n if (columns.id instanceof PgUUIDBuilder) parentIDColType = 'uuid'\n if (columns.id instanceof PgNumericBuilder) parentIDColType = 'numeric'\n if (columns.id instanceof PgVarcharBuilder) parentIDColType = 'varchar'\n\n fields.forEach((field) => {\n if ('name' in field && field.name === 'id') return\n let columnName: string\n let fieldName: string\n\n let targetTable = columns\n let targetIndexes = indexes\n\n if (fieldAffectsData(field)) {\n columnName = `${columnPrefix || ''}${field.name[0] === '_' ? '_' : ''}${toSnakeCase(\n field.name,\n )}`\n fieldName = `${fieldPrefix?.replace('.', '_') || ''}${field.name}`\n\n // If field is localized,\n // add the column to the locale table instead of main table\n if (adapter.payload.config.localization && (field.localized || forceLocalized)) {\n hasLocalizedField = true\n targetTable = localesColumns\n targetIndexes = localesIndexes\n }\n\n if (\n (field.unique || field.index) &&\n !['array', 'blocks', 'group', 'point', 'relationship', 'upload'].includes(field.type) &&\n !('hasMany' in field && field.hasMany === true)\n ) {\n const unique = disableUnique !== true && field.unique\n if (unique) {\n const constraintValue = `${fieldPrefix || ''}${field.name}`\n if (!adapter.fieldConstraints?.[rootTableName]) {\n adapter.fieldConstraints[rootTableName] = {}\n }\n adapter.fieldConstraints[rootTableName][`${columnName}_idx`] = constraintValue\n }\n targetIndexes[`${newTableName}_${field.name}Idx`] = createIndex({\n name: fieldName,\n columnName,\n tableName: newTableName,\n unique,\n })\n }\n }\n\n switch (field.type) {\n case 'text': {\n if (field.hasMany) {\n if (field.localized) {\n hasLocalizedManyTextField = true\n }\n\n if (field.index) {\n hasManyTextField = 'index'\n } else if (!hasManyTextField) {\n hasManyTextField = true\n }\n\n if (field.unique) {\n throw new InvalidConfiguration(\n 'Unique is not supported in Postgres for hasMany text fields.',\n )\n }\n } else {\n targetTable[fieldName] = varchar(columnName)\n }\n break\n }\n case 'email':\n case 'code':\n case 'textarea': {\n targetTable[fieldName] = varchar(columnName)\n break\n }\n\n case 'number': {\n if (field.hasMany) {\n if (field.localized) {\n hasLocalizedManyNumberField = true\n }\n\n if (field.index) {\n hasManyNumberField = 'index'\n } else if (!hasManyNumberField) {\n hasManyNumberField = true\n }\n\n if (field.unique) {\n throw new InvalidConfiguration(\n 'Unique is not supported in Postgres for hasMany number fields.',\n )\n }\n } else {\n targetTable[fieldName] = numeric(columnName)\n }\n break\n }\n\n case 'richText':\n case 'json': {\n targetTable[fieldName] = jsonb(columnName)\n break\n }\n\n case 'date': {\n targetTable[fieldName] = timestamp(columnName, {\n mode: 'string',\n precision: 3,\n withTimezone: true,\n })\n break\n }\n\n case 'point': {\n break\n }\n\n case 'radio':\n case 'select': {\n const enumName = createTableName({\n adapter,\n config: field,\n parentTableName: newTableName,\n prefix: `enum_${newTableName}_`,\n target: 'enumName',\n throwValidationError,\n })\n\n adapter.enums[enumName] = pgEnum(\n enumName,\n field.options.map((option) => {\n if (optionIsObject(option)) {\n return option.value\n }\n\n return option\n }) as [string, ...string[]],\n )\n\n if (field.type === 'select' && field.hasMany) {\n const selectTableName = createTableName({\n adapter,\n config: field,\n parentTableName: newTableName,\n prefix: `${newTableName}_`,\n throwValidationError,\n })\n const baseColumns: Record<string, PgColumnBuilder> = {\n order: integer('order').notNull(),\n parent: parentIDColumnMap[parentIDColType]('parent_id').notNull(),\n value: adapter.enums[enumName]('value'),\n }\n\n const baseExtraConfig: BaseExtraConfig = {\n orderIdx: (cols) => index(`${selectTableName}_order_idx`).on(cols.order),\n parentFk: (cols) =>\n foreignKey({\n name: `${selectTableName}_parent_fk`,\n columns: [cols.parent],\n foreignColumns: [adapter.tables[parentTableName].id],\n }),\n parentIdx: (cols) => index(`${selectTableName}_parent_idx`).on(cols.parent),\n }\n\n if (field.localized) {\n baseColumns.locale = adapter.enums.enum__locales('locale').notNull()\n baseExtraConfig.localeIdx = (cols) =>\n index(`${selectTableName}_locale_idx`).on(cols.locale)\n }\n\n if (field.index) {\n baseExtraConfig.value = (cols) => index(`${selectTableName}_value_idx`).on(cols.value)\n }\n\n buildTable({\n adapter,\n baseColumns,\n baseExtraConfig,\n disableNotNull,\n disableUnique,\n fields: [],\n tableName: selectTableName,\n versions,\n })\n\n relationsToBuild.set(fieldName, selectTableName)\n\n const selectTableRelations = relations(adapter.tables[selectTableName], ({ one }) => {\n const result: Record<string, Relation<string>> = {\n parent: one(adapter.tables[parentTableName], {\n fields: [adapter.tables[selectTableName].parent],\n references: [adapter.tables[parentTableName].id],\n }),\n }\n\n return result\n })\n\n adapter.relations[`relation_${selectTableName}`] = selectTableRelations\n } else {\n targetTable[fieldName] = adapter.enums[enumName](fieldName)\n }\n break\n }\n\n case 'checkbox': {\n targetTable[fieldName] = boolean(columnName)\n break\n }\n\n case 'array': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n const arrayTableName = createTableName({\n adapter,\n config: field,\n parentTableName: newTableName,\n prefix: `${newTableName}_`,\n throwValidationError,\n versionsCustomName: versions,\n })\n\n const baseColumns: Record<string, PgColumnBuilder> = {\n _order: integer('_order').notNull(),\n _parentID: parentIDColumnMap[parentIDColType]('_parent_id').notNull(),\n }\n\n const baseExtraConfig: BaseExtraConfig = {\n _orderIdx: (cols) => index(`${arrayTableName}_order_idx`).on(cols._order),\n _parentIDFk: (cols) =>\n foreignKey({\n name: `${arrayTableName}_parent_id_fk`,\n columns: [cols['_parentID']],\n foreignColumns: [adapter.tables[parentTableName].id],\n }).onDelete('cascade'),\n _parentIDIdx: (cols) => index(`${arrayTableName}_parent_id_idx`).on(cols._parentID),\n }\n\n if (field.localized && adapter.payload.config.localization) {\n baseColumns._locale = adapter.enums.enum__locales('_locale').notNull()\n baseExtraConfig._localeIdx = (cols) =>\n index(`${arrayTableName}_locale_idx`).on(cols._locale)\n }\n\n const {\n hasManyNumberField: subHasManyNumberField,\n hasManyTextField: subHasManyTextField,\n relationsToBuild: subRelationsToBuild,\n } = buildTable({\n adapter,\n baseColumns,\n baseExtraConfig,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fields: disableUnique ? idToUUID(field.fields) : field.fields,\n rootRelationsToBuild,\n rootRelationships: relationships,\n rootTableIDColType,\n rootTableName,\n tableName: arrayTableName,\n versions,\n })\n\n if (subHasManyTextField) {\n if (!hasManyTextField || subHasManyTextField === 'index')\n hasManyTextField = subHasManyTextField\n }\n if (subHasManyNumberField) {\n if (!hasManyNumberField || subHasManyNumberField === 'index')\n hasManyNumberField = subHasManyNumberField\n }\n\n relationsToBuild.set(fieldName, arrayTableName)\n\n const arrayTableRelations = relations(adapter.tables[arrayTableName], ({ many, one }) => {\n const result: Record<string, Relation<string>> = {\n _parentID: one(adapter.tables[parentTableName], {\n fields: [adapter.tables[arrayTableName]._parentID],\n references: [adapter.tables[parentTableName].id],\n }),\n }\n\n if (hasLocalesTable(field.fields)) {\n result._locales = many(adapter.tables[`${arrayTableName}${adapter.localesSuffix}`])\n }\n\n subRelationsToBuild.forEach((val, key) => {\n result[key] = many(adapter.tables[val])\n })\n\n return result\n })\n\n adapter.relations[`relations_${arrayTableName}`] = arrayTableRelations\n\n break\n }\n\n case 'blocks': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n field.blocks.forEach((block) => {\n const blockTableName = createTableName({\n adapter,\n config: block,\n parentTableName: rootTableName,\n prefix: `${rootTableName}_blocks_`,\n throwValidationError,\n versionsCustomName: versions,\n })\n if (!adapter.tables[blockTableName]) {\n const baseColumns: Record<string, PgColumnBuilder> = {\n _order: integer('_order').notNull(),\n _parentID: parentIDColumnMap[rootTableIDColType]('_parent_id').notNull(),\n _path: text('_path').notNull(),\n }\n\n const baseExtraConfig: BaseExtraConfig = {\n _orderIdx: (cols) => index(`${blockTableName}_order_idx`).on(cols._order),\n _parentIDIdx: (cols) => index(`${blockTableName}_parent_id_idx`).on(cols._parentID),\n _parentIdFk: (cols) =>\n foreignKey({\n name: `${blockTableName}_parent_id_fk`,\n columns: [cols._parentID],\n foreignColumns: [adapter.tables[rootTableName].id],\n }).onDelete('cascade'),\n _pathIdx: (cols) => index(`${blockTableName}_path_idx`).on(cols._path),\n }\n\n if (field.localized && adapter.payload.config.localization) {\n baseColumns._locale = adapter.enums.enum__locales('_locale').notNull()\n baseExtraConfig._localeIdx = (cols) =>\n index(`${blockTableName}_locale_idx`).on(cols._locale)\n }\n\n const {\n hasManyNumberField: subHasManyNumberField,\n hasManyTextField: subHasManyTextField,\n relationsToBuild: subRelationsToBuild,\n } = buildTable({\n adapter,\n baseColumns,\n baseExtraConfig,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fields: disableUnique ? idToUUID(block.fields) : block.fields,\n rootRelationsToBuild,\n rootRelationships: relationships,\n rootTableIDColType,\n rootTableName,\n tableName: blockTableName,\n versions,\n })\n\n if (subHasManyTextField) {\n if (!hasManyTextField || subHasManyTextField === 'index')\n hasManyTextField = subHasManyTextField\n }\n\n if (subHasManyNumberField) {\n if (!hasManyNumberField || subHasManyNumberField === 'index')\n hasManyNumberField = subHasManyNumberField\n }\n\n const blockTableRelations = relations(\n adapter.tables[blockTableName],\n ({ many, one }) => {\n const result: Record<string, Relation<string>> = {\n _parentID: one(adapter.tables[rootTableName], {\n fields: [adapter.tables[blockTableName]._parentID],\n references: [adapter.tables[rootTableName].id],\n }),\n }\n\n if (hasLocalesTable(block.fields)) {\n result._locales = many(\n adapter.tables[`${blockTableName}${adapter.localesSuffix}`],\n )\n }\n\n subRelationsToBuild.forEach((val, key) => {\n result[key] = many(adapter.tables[val])\n })\n\n return result\n },\n )\n\n adapter.relations[`relations_${blockTableName}`] = blockTableRelations\n } else if (process.env.NODE_ENV !== 'production' && !versions) {\n validateExistingBlockIsIdentical({\n block,\n localized: field.localized,\n rootTableName,\n table: adapter.tables[blockTableName],\n tableLocales: adapter.tables[`${blockTableName}${adapter.localesSuffix}`],\n })\n }\n rootRelationsToBuild.set(`_blocks_${block.slug}`, blockTableName)\n })\n\n break\n }\n\n case 'tab':\n case 'group': {\n if (!('name' in field)) {\n const {\n hasLocalizedField: groupHasLocalizedField,\n hasLocalizedManyNumberField: groupHasLocalizedManyNumberField,\n hasLocalizedManyTextField: groupHasLocalizedManyTextField,\n hasLocalizedRelationshipField: groupHasLocalizedRelationshipField,\n hasManyNumberField: groupHasManyNumberField,\n hasManyTextField: groupHasManyTextField,\n } = traverseFields({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columnPrefix,\n columns,\n disableNotNull,\n disableUnique,\n fieldPrefix,\n fields: field.fields,\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n versions,\n })\n\n if (groupHasLocalizedField) hasLocalizedField = true\n if (groupHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (groupHasManyTextField) hasManyTextField = true\n if (groupHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (groupHasManyNumberField) hasManyNumberField = true\n if (groupHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n const {\n hasLocalizedField: groupHasLocalizedField,\n hasLocalizedManyNumberField: groupHasLocalizedManyNumberField,\n hasLocalizedManyTextField: groupHasLocalizedManyTextField,\n hasLocalizedRelationshipField: groupHasLocalizedRelationshipField,\n hasManyNumberField: groupHasManyNumberField,\n hasManyTextField: groupHasManyTextField,\n } = traverseFields({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columnPrefix: `${columnName}_`,\n columns,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fieldPrefix: `${fieldName}.`,\n fields: field.fields,\n forceLocalized: field.localized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName: `${parentTableName}_${columnName}`,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n versions,\n })\n\n if (groupHasLocalizedField) hasLocalizedField = true\n if (groupHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (groupHasManyTextField) hasManyTextField = true\n if (groupHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (groupHasManyNumberField) hasManyNumberField = true\n if (groupHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n case 'tabs': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n const {\n hasLocalizedField: tabHasLocalizedField,\n hasLocalizedManyNumberField: tabHasLocalizedManyNumberField,\n hasLocalizedManyTextField: tabHasLocalizedManyTextField,\n hasLocalizedRelationshipField: tabHasLocalizedRelationshipField,\n hasManyNumberField: tabHasManyNumberField,\n hasManyTextField: tabHasManyTextField,\n } = traverseFields({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columnPrefix,\n columns,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fieldPrefix,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n versions,\n })\n\n if (tabHasLocalizedField) hasLocalizedField = true\n if (tabHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (tabHasManyTextField) hasManyTextField = true\n if (tabHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (tabHasManyNumberField) hasManyNumberField = true\n if (tabHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n case 'row':\n case 'collapsible': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n const {\n hasLocalizedField: rowHasLocalizedField,\n hasLocalizedManyNumberField: rowHasLocalizedManyNumberField,\n hasLocalizedManyTextField: rowHasLocalizedManyTextField,\n hasLocalizedRelationshipField: rowHasLocalizedRelationshipField,\n hasManyNumberField: rowHasManyNumberField,\n hasManyTextField: rowHasManyTextField,\n } = traverseFields({\n adapter,\n buildNumbers,\n buildRelationships,\n buildTexts,\n columnPrefix,\n columns,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fieldPrefix,\n fields: field.fields,\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n versions,\n })\n\n if (rowHasLocalizedField) hasLocalizedField = true\n if (rowHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (rowHasManyTextField) hasManyTextField = true\n if (rowHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (rowHasManyNumberField) hasManyNumberField = true\n if (rowHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n case 'relationship':\n case 'upload':\n if (Array.isArray(field.relationTo)) {\n field.relationTo.forEach((relation) => relationships.add(relation))\n } else {\n relationships.add(field.relationTo)\n }\n\n if (field.localized && adapter.payload.config.localization) {\n hasLocalizedRelationshipField = true\n }\n break\n\n default:\n break\n }\n\n const condition = field.admin && field.admin.condition\n\n if (\n !disableNotNull &&\n targetTable[fieldName] &&\n 'required' in field &&\n field.required &&\n !condition\n ) {\n targetTable[fieldName].notNull()\n }\n })\n\n return {\n hasLocalizedField,\n hasLocalizedManyNumberField,\n hasLocalizedManyTextField,\n hasLocalizedRelationshipField,\n hasManyNumberField,\n hasManyTextField,\n }\n}\n"],"names":["relations","PgNumericBuilder","PgUUIDBuilder","PgVarcharBuilder","boolean","foreignKey","index","integer","jsonb","numeric","pgEnum","text","timestamp","varchar","InvalidConfiguration","fieldAffectsData","optionIsObject","toSnakeCase","hasLocalesTable","buildTable","createIndex","createTableName","idToUUID","parentIDColumnMap","validateExistingBlockIsIdentical","traverseFields","adapter","buildNumbers","buildRelationships","buildTexts","columnPrefix","columns","disableNotNull","disableUnique","fieldPrefix","fields","forceLocalized","indexes","localesColumns","localesIndexes","newTableName","parentTableName","relationsToBuild","relationships","rootRelationsToBuild","rootTableIDColType","rootTableName","versions","throwValidationError","hasLocalizedField","hasLocalizedRelationshipField","hasManyTextField","hasLocalizedManyTextField","hasManyNumberField","hasLocalizedManyNumberField","parentIDColType","id","forEach","field","name","columnName","fieldName","targetTable","targetIndexes","replace","payload","config","localization","localized","unique","includes","type","hasMany","constraintValue","fieldConstraints","tableName","mode","precision","withTimezone","enumName","prefix","target","enums","options","map","option","value","selectTableName","baseColumns","order","notNull","parent","baseExtraConfig","orderIdx","cols","on","parentFk","foreignColumns","tables","parentIdx","locale","enum__locales","localeIdx","set","selectTableRelations","one","result","references","disableNotNullFromHere","Boolean","admin","condition","arrayTableName","versionsCustomName","_order","_parentID","_orderIdx","_parentIDFk","onDelete","_parentIDIdx","_locale","_localeIdx","subHasManyNumberField","subHasManyTextField","subRelationsToBuild","rootRelationships","arrayTableRelations","many","_locales","localesSuffix","val","key","blocks","block","blockTableName","_path","_parentIdFk","_pathIdx","blockTableRelations","process","env","NODE_ENV","table","tableLocales","slug","groupHasLocalizedField","groupHasLocalizedManyNumberField","groupHasLocalizedManyTextField","groupHasLocalizedRelationshipField","groupHasManyNumberField","groupHasManyTextField","tabHasLocalizedField","tabHasLocalizedManyNumberField","tabHasLocalizedManyTextField","tabHasLocalizedRelationshipField","tabHasManyNumberField","tabHasManyTextField","tabs","tab","rowHasLocalizedField","rowHasLocalizedManyNumberField","rowHasLocalizedManyTextField","rowHasLocalizedRelationshipField","rowHasManyNumberField","rowHasManyTextField","Array","isArray","relationTo","relation","add","required"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC,gBAAgB4E;wBAChB3E;wBACAC;wBACAC,QAAQuB,MAAMvB,MAAM;wBACpBC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;oBACF;oBAEA,IAAIgH,sBAAsB9G,oBAAoB;oBAC9C,IAAIiH,kCAAkChH,gCAAgC;oBACtE,IAAIkH,qBAAqBjH,mBAAmB;oBAC5C,IAAI8G,8BAA8B7G,4BAA4B;oBAC9D,IAAI+G,uBAAuB9G,qBAAqB;oBAChD,IAAI2G,gCAAgC1G,8BAA8B;oBAClE;gBACF;YAEA,KAAK;YACL,KAAK;gBACH,IAAI+G,MAAMC,OAAO,CAAC5G,MAAM6G,UAAU,GAAG;oBACnC7G,MAAM6G,UAAU,CAAC9G,OAAO,CAAC,CAAC+G,WAAa7H,cAAc8H,GAAG,CAACD;gBAC3D,OAAO;oBACL7H,cAAc8H,GAAG,CAAC/G,MAAM6G,UAAU;gBACpC;gBAEA,IAAI7G,MAAMU,SAAS,IAAI1C,QAAQuC,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;oBAC1DjB,gCAAgC;gBAClC;gBACA;YAEF;gBACE;QACJ;QAEA,MAAM6D,YAAYrD,MAAMoD,KAAK,IAAIpD,MAAMoD,KAAK,CAACC,SAAS;QAEtD,IACE,CAAC/E,kBACD8B,WAAW,CAACD,UAAU,IACtB,cAAcH,SACdA,MAAMgH,QAAQ,IACd,CAAC3D,WACD;YACAjD,WAAW,CAACD,UAAU,CAAC6B,OAAO;QAChC;IACF;IAEA,OAAO;QACLzC;QACAK;QACAF;QACAF;QACAG;QACAF;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/schema/traverseFields.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { Relation } from 'drizzle-orm'\nimport type { IndexBuilder, PgColumnBuilder } from 'drizzle-orm/pg-core'\nimport type { Field, TabAsField } from 'payload'\n\nimport {\n createTableName,\n hasLocalesTable,\n validateExistingBlockIsIdentical,\n} from '@payloadcms/drizzle'\nimport { relations } from 'drizzle-orm'\nimport {\n PgNumericBuilder,\n PgUUIDBuilder,\n PgVarcharBuilder,\n boolean,\n foreignKey,\n index,\n integer,\n jsonb,\n numeric,\n pgEnum,\n text,\n timestamp,\n varchar,\n} from 'drizzle-orm/pg-core'\nimport { InvalidConfiguration } from 'payload'\nimport { fieldAffectsData, optionIsObject } from 'payload/shared'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { GenericColumns, IDType, PostgresAdapter } from '../types.js'\nimport type { BaseExtraConfig, RelationMap } from './build.js'\n\nimport { buildTable } from './build.js'\nimport { createIndex } from './createIndex.js'\nimport { idToUUID } from './idToUUID.js'\nimport { parentIDColumnMap } from './parentIDColumnMap.js'\n\ntype Args = {\n adapter: PostgresAdapter\n columnPrefix?: string\n columns: Record<string, PgColumnBuilder>\n disableNotNull: boolean\n disableUnique?: boolean\n fieldPrefix?: string\n fields: (Field | TabAsField)[]\n forceLocalized?: boolean\n indexes: Record<string, (cols: GenericColumns) => IndexBuilder>\n localesColumns: Record<string, PgColumnBuilder>\n localesIndexes: Record<string, (cols: GenericColumns) => IndexBuilder>\n newTableName: string\n parentTableName: string\n relationsToBuild: RelationMap\n relationships: Set<string>\n rootRelationsToBuild?: RelationMap\n rootTableIDColType: string\n rootTableName: string\n versions: boolean\n}\n\ntype Result = {\n hasLocalizedField: boolean\n hasLocalizedManyNumberField: boolean\n hasLocalizedManyTextField: boolean\n hasLocalizedRelationshipField: boolean\n hasManyNumberField: 'index' | boolean\n hasManyTextField: 'index' | boolean\n}\n\nexport const traverseFields = ({\n adapter,\n columnPrefix,\n columns,\n disableNotNull,\n disableUnique = false,\n fieldPrefix,\n fields,\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n versions,\n}: Args): Result => {\n const throwValidationError = true\n let hasLocalizedField = false\n let hasLocalizedRelationshipField = false\n let hasManyTextField: 'index' | boolean = false\n let hasLocalizedManyTextField = false\n let hasManyNumberField: 'index' | boolean = false\n let hasLocalizedManyNumberField = false\n\n let parentIDColType: IDType = 'integer'\n if (columns.id instanceof PgUUIDBuilder) parentIDColType = 'uuid'\n if (columns.id instanceof PgNumericBuilder) parentIDColType = 'numeric'\n if (columns.id instanceof PgVarcharBuilder) parentIDColType = 'varchar'\n\n fields.forEach((field) => {\n if ('name' in field && field.name === 'id') return\n let columnName: string\n let fieldName: string\n\n let targetTable = columns\n let targetIndexes = indexes\n\n if (fieldAffectsData(field)) {\n columnName = `${columnPrefix || ''}${field.name[0] === '_' ? '_' : ''}${toSnakeCase(\n field.name,\n )}`\n fieldName = `${fieldPrefix?.replace('.', '_') || ''}${field.name}`\n\n // If field is localized,\n // add the column to the locale table instead of main table\n if (\n adapter.payload.config.localization &&\n (field.localized || forceLocalized) &&\n field.type !== 'array' &&\n field.type !== 'blocks' &&\n (('hasMany' in field && field.hasMany !== true) || !('hasMany' in field))\n ) {\n hasLocalizedField = true\n targetTable = localesColumns\n targetIndexes = localesIndexes\n }\n\n if (\n (field.unique || field.index) &&\n !['array', 'blocks', 'group', 'point', 'relationship', 'upload'].includes(field.type) &&\n !('hasMany' in field && field.hasMany === true)\n ) {\n const unique = disableUnique !== true && field.unique\n if (unique) {\n const constraintValue = `${fieldPrefix || ''}${field.name}`\n if (!adapter.fieldConstraints?.[rootTableName]) {\n adapter.fieldConstraints[rootTableName] = {}\n }\n adapter.fieldConstraints[rootTableName][`${columnName}_idx`] = constraintValue\n }\n targetIndexes[`${newTableName}_${field.name}Idx`] = createIndex({\n name: fieldName,\n columnName,\n tableName: newTableName,\n unique,\n })\n }\n }\n\n switch (field.type) {\n case 'text': {\n if (field.hasMany) {\n if (field.localized) {\n hasLocalizedManyTextField = true\n }\n\n if (field.index) {\n hasManyTextField = 'index'\n } else if (!hasManyTextField) {\n hasManyTextField = true\n }\n\n if (field.unique) {\n throw new InvalidConfiguration(\n 'Unique is not supported in Postgres for hasMany text fields.',\n )\n }\n } else {\n targetTable[fieldName] = varchar(columnName)\n }\n break\n }\n case 'email':\n case 'code':\n case 'textarea': {\n targetTable[fieldName] = varchar(columnName)\n break\n }\n\n case 'number': {\n if (field.hasMany) {\n if (field.localized) {\n hasLocalizedManyNumberField = true\n }\n\n if (field.index) {\n hasManyNumberField = 'index'\n } else if (!hasManyNumberField) {\n hasManyNumberField = true\n }\n\n if (field.unique) {\n throw new InvalidConfiguration(\n 'Unique is not supported in Postgres for hasMany number fields.',\n )\n }\n } else {\n targetTable[fieldName] = numeric(columnName)\n }\n break\n }\n\n case 'richText':\n case 'json': {\n targetTable[fieldName] = jsonb(columnName)\n break\n }\n\n case 'date': {\n targetTable[fieldName] = timestamp(columnName, {\n mode: 'string',\n precision: 3,\n withTimezone: true,\n })\n break\n }\n\n case 'point': {\n break\n }\n\n case 'radio':\n case 'select': {\n const enumName = createTableName({\n adapter,\n config: field,\n parentTableName: newTableName,\n prefix: `enum_${newTableName}_`,\n target: 'enumName',\n throwValidationError,\n })\n\n adapter.enums[enumName] = pgEnum(\n enumName,\n field.options.map((option) => {\n if (optionIsObject(option)) {\n return option.value\n }\n\n return option\n }) as [string, ...string[]],\n )\n\n if (field.type === 'select' && field.hasMany) {\n const selectTableName = createTableName({\n adapter,\n config: field,\n parentTableName: newTableName,\n prefix: `${newTableName}_`,\n throwValidationError,\n versionsCustomName: versions,\n })\n const baseColumns: Record<string, PgColumnBuilder> = {\n order: integer('order').notNull(),\n parent: parentIDColumnMap[parentIDColType]('parent_id').notNull(),\n value: adapter.enums[enumName]('value'),\n }\n\n const baseExtraConfig: BaseExtraConfig = {\n orderIdx: (cols) => index(`${selectTableName}_order_idx`).on(cols.order),\n parentFk: (cols) =>\n foreignKey({\n name: `${selectTableName}_parent_fk`,\n columns: [cols.parent],\n foreignColumns: [adapter.tables[parentTableName].id],\n }).onDelete('cascade'),\n parentIdx: (cols) => index(`${selectTableName}_parent_idx`).on(cols.parent),\n }\n\n if (field.localized) {\n baseColumns.locale = adapter.enums.enum__locales('locale').notNull()\n baseExtraConfig.localeIdx = (cols) =>\n index(`${selectTableName}_locale_idx`).on(cols.locale)\n }\n\n if (field.index) {\n baseExtraConfig.value = (cols) => index(`${selectTableName}_value_idx`).on(cols.value)\n }\n\n buildTable({\n adapter,\n baseColumns,\n baseExtraConfig,\n disableNotNull,\n disableUnique,\n fields: [],\n rootTableName,\n tableName: selectTableName,\n versions,\n })\n\n relationsToBuild.set(fieldName, {\n type: 'many',\n // selects have their own localized table, independent of the base table.\n localized: false,\n target: selectTableName,\n })\n\n adapter.relations[`relations_${selectTableName}`] = relations(\n adapter.tables[selectTableName],\n ({ one }) => ({\n parent: one(adapter.tables[parentTableName], {\n fields: [adapter.tables[selectTableName].parent],\n references: [adapter.tables[parentTableName].id],\n relationName: fieldName,\n }),\n }),\n )\n } else {\n targetTable[fieldName] = adapter.enums[enumName](fieldName)\n }\n break\n }\n\n case 'checkbox': {\n targetTable[fieldName] = boolean(columnName)\n break\n }\n\n case 'array': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n const arrayTableName = createTableName({\n adapter,\n config: field,\n parentTableName: newTableName,\n prefix: `${newTableName}_`,\n throwValidationError,\n versionsCustomName: versions,\n })\n\n const baseColumns: Record<string, PgColumnBuilder> = {\n _order: integer('_order').notNull(),\n _parentID: parentIDColumnMap[parentIDColType]('_parent_id').notNull(),\n }\n\n const baseExtraConfig: BaseExtraConfig = {\n _orderIdx: (cols) => index(`${arrayTableName}_order_idx`).on(cols._order),\n _parentIDFk: (cols) =>\n foreignKey({\n name: `${arrayTableName}_parent_id_fk`,\n columns: [cols['_parentID']],\n foreignColumns: [adapter.tables[parentTableName].id],\n }).onDelete('cascade'),\n _parentIDIdx: (cols) => index(`${arrayTableName}_parent_id_idx`).on(cols._parentID),\n }\n\n if (field.localized && adapter.payload.config.localization) {\n baseColumns._locale = adapter.enums.enum__locales('_locale').notNull()\n baseExtraConfig._localeIdx = (cols) =>\n index(`${arrayTableName}_locale_idx`).on(cols._locale)\n }\n\n const {\n hasManyNumberField: subHasManyNumberField,\n hasManyTextField: subHasManyTextField,\n relationsToBuild: subRelationsToBuild,\n } = buildTable({\n adapter,\n baseColumns,\n baseExtraConfig,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fields: disableUnique ? idToUUID(field.fields) : field.fields,\n rootRelationsToBuild,\n rootRelationships: relationships,\n rootTableIDColType,\n rootTableName,\n tableName: arrayTableName,\n versions,\n })\n\n if (subHasManyTextField) {\n if (!hasManyTextField || subHasManyTextField === 'index')\n hasManyTextField = subHasManyTextField\n }\n if (subHasManyNumberField) {\n if (!hasManyNumberField || subHasManyNumberField === 'index')\n hasManyNumberField = subHasManyNumberField\n }\n\n relationsToBuild.set(fieldName, {\n type: 'many',\n // arrays have their own localized table, independent of the base table.\n localized: false,\n target: arrayTableName,\n })\n\n adapter.relations[`relations_${arrayTableName}`] = relations(\n adapter.tables[arrayTableName],\n ({ many, one }) => {\n const result: Record<string, Relation<string>> = {\n _parentID: one(adapter.tables[parentTableName], {\n fields: [adapter.tables[arrayTableName]._parentID],\n references: [adapter.tables[parentTableName].id],\n relationName: fieldName,\n }),\n }\n\n if (hasLocalesTable(field.fields)) {\n result._locales = many(adapter.tables[`${arrayTableName}${adapter.localesSuffix}`], {\n relationName: '_locales',\n })\n }\n\n subRelationsToBuild.forEach(({ type, localized, target }, key) => {\n if (type === 'one') {\n const arrayWithLocalized = localized\n ? `${arrayTableName}${adapter.localesSuffix}`\n : arrayTableName\n result[key] = one(adapter.tables[target], {\n fields: [adapter.tables[arrayWithLocalized][key]],\n references: [adapter.tables[target].id],\n relationName: key,\n })\n }\n if (type === 'many') {\n result[key] = many(adapter.tables[target], { relationName: key })\n }\n })\n\n return result\n },\n )\n\n break\n }\n\n case 'blocks': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n field.blocks.forEach((block) => {\n const blockTableName = createTableName({\n adapter,\n config: block,\n parentTableName: rootTableName,\n prefix: `${rootTableName}_blocks_`,\n throwValidationError,\n versionsCustomName: versions,\n })\n if (!adapter.tables[blockTableName]) {\n const baseColumns: Record<string, PgColumnBuilder> = {\n _order: integer('_order').notNull(),\n _parentID: parentIDColumnMap[rootTableIDColType]('_parent_id').notNull(),\n _path: text('_path').notNull(),\n }\n\n const baseExtraConfig: BaseExtraConfig = {\n _orderIdx: (cols) => index(`${blockTableName}_order_idx`).on(cols._order),\n _parentIDIdx: (cols) => index(`${blockTableName}_parent_id_idx`).on(cols._parentID),\n _parentIdFk: (cols) =>\n foreignKey({\n name: `${blockTableName}_parent_id_fk`,\n columns: [cols._parentID],\n foreignColumns: [adapter.tables[rootTableName].id],\n }).onDelete('cascade'),\n _pathIdx: (cols) => index(`${blockTableName}_path_idx`).on(cols._path),\n }\n\n if (field.localized && adapter.payload.config.localization) {\n baseColumns._locale = adapter.enums.enum__locales('_locale').notNull()\n baseExtraConfig._localeIdx = (cols) =>\n index(`${blockTableName}_locale_idx`).on(cols._locale)\n }\n\n const {\n hasManyNumberField: subHasManyNumberField,\n hasManyTextField: subHasManyTextField,\n relationsToBuild: subRelationsToBuild,\n } = buildTable({\n adapter,\n baseColumns,\n baseExtraConfig,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fields: disableUnique ? idToUUID(block.fields) : block.fields,\n rootRelationsToBuild,\n rootRelationships: relationships,\n rootTableIDColType,\n rootTableName,\n tableName: blockTableName,\n versions,\n })\n\n if (subHasManyTextField) {\n if (!hasManyTextField || subHasManyTextField === 'index')\n hasManyTextField = subHasManyTextField\n }\n\n if (subHasManyNumberField) {\n if (!hasManyNumberField || subHasManyNumberField === 'index')\n hasManyNumberField = subHasManyNumberField\n }\n\n adapter.relations[`relations_${blockTableName}`] = relations(\n adapter.tables[blockTableName],\n ({ many, one }) => {\n const result: Record<string, Relation<string>> = {\n _parentID: one(adapter.tables[rootTableName], {\n fields: [adapter.tables[blockTableName]._parentID],\n references: [adapter.tables[rootTableName].id],\n relationName: `_blocks_${block.slug}`,\n }),\n }\n\n if (hasLocalesTable(block.fields)) {\n result._locales = many(\n adapter.tables[`${blockTableName}${adapter.localesSuffix}`],\n { relationName: '_locales' },\n )\n }\n\n subRelationsToBuild.forEach(({ type, localized, target }, key) => {\n if (type === 'one') {\n const blockWithLocalized = localized\n ? `${blockTableName}${adapter.localesSuffix}`\n : blockTableName\n result[key] = one(adapter.tables[target], {\n fields: [adapter.tables[blockWithLocalized][key]],\n references: [adapter.tables[target].id],\n relationName: key,\n })\n }\n if (type === 'many') {\n result[key] = many(adapter.tables[target], { relationName: key })\n }\n })\n\n return result\n },\n )\n } else if (process.env.NODE_ENV !== 'production' && !versions) {\n validateExistingBlockIsIdentical({\n block,\n localized: field.localized,\n rootTableName,\n table: adapter.tables[blockTableName],\n tableLocales: adapter.tables[`${blockTableName}${adapter.localesSuffix}`],\n })\n }\n // blocks relationships are defined from the collection or globals table down to the block, bypassing any subBlocks\n rootRelationsToBuild.set(`_blocks_${block.slug}`, {\n type: 'many',\n // blocks are not localized on the parent table\n localized: false,\n target: blockTableName,\n })\n })\n\n break\n }\n\n case 'tab':\n case 'group': {\n if (!('name' in field)) {\n const {\n hasLocalizedField: groupHasLocalizedField,\n hasLocalizedManyNumberField: groupHasLocalizedManyNumberField,\n hasLocalizedManyTextField: groupHasLocalizedManyTextField,\n hasLocalizedRelationshipField: groupHasLocalizedRelationshipField,\n hasManyNumberField: groupHasManyNumberField,\n hasManyTextField: groupHasManyTextField,\n } = traverseFields({\n adapter,\n columnPrefix,\n columns,\n disableNotNull,\n disableUnique,\n fieldPrefix,\n fields: field.fields,\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n versions,\n })\n\n if (groupHasLocalizedField) hasLocalizedField = true\n if (groupHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (groupHasManyTextField) hasManyTextField = true\n if (groupHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (groupHasManyNumberField) hasManyNumberField = true\n if (groupHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n const {\n hasLocalizedField: groupHasLocalizedField,\n hasLocalizedManyNumberField: groupHasLocalizedManyNumberField,\n hasLocalizedManyTextField: groupHasLocalizedManyTextField,\n hasLocalizedRelationshipField: groupHasLocalizedRelationshipField,\n hasManyNumberField: groupHasManyNumberField,\n hasManyTextField: groupHasManyTextField,\n } = traverseFields({\n adapter,\n columnPrefix: `${columnName}_`,\n columns,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fieldPrefix: `${fieldName}.`,\n fields: field.fields,\n forceLocalized: field.localized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName: `${parentTableName}_${columnName}`,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n versions,\n })\n\n if (groupHasLocalizedField) hasLocalizedField = true\n if (groupHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (groupHasManyTextField) hasManyTextField = true\n if (groupHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (groupHasManyNumberField) hasManyNumberField = true\n if (groupHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n case 'tabs': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n\n const {\n hasLocalizedField: tabHasLocalizedField,\n hasLocalizedManyNumberField: tabHasLocalizedManyNumberField,\n hasLocalizedManyTextField: tabHasLocalizedManyTextField,\n hasLocalizedRelationshipField: tabHasLocalizedRelationshipField,\n hasManyNumberField: tabHasManyNumberField,\n hasManyTextField: tabHasManyTextField,\n } = traverseFields({\n adapter,\n columnPrefix,\n columns,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fieldPrefix,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n versions,\n })\n\n if (tabHasLocalizedField) hasLocalizedField = true\n if (tabHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (tabHasManyTextField) hasManyTextField = true\n if (tabHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (tabHasManyNumberField) hasManyNumberField = true\n if (tabHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n case 'row':\n case 'collapsible': {\n const disableNotNullFromHere = Boolean(field.admin?.condition) || disableNotNull\n const {\n hasLocalizedField: rowHasLocalizedField,\n hasLocalizedManyNumberField: rowHasLocalizedManyNumberField,\n hasLocalizedManyTextField: rowHasLocalizedManyTextField,\n hasLocalizedRelationshipField: rowHasLocalizedRelationshipField,\n hasManyNumberField: rowHasManyNumberField,\n hasManyTextField: rowHasManyTextField,\n } = traverseFields({\n adapter,\n columnPrefix,\n columns,\n disableNotNull: disableNotNullFromHere,\n disableUnique,\n fieldPrefix,\n fields: field.fields,\n forceLocalized,\n indexes,\n localesColumns,\n localesIndexes,\n newTableName,\n parentTableName,\n relationsToBuild,\n relationships,\n rootRelationsToBuild,\n rootTableIDColType,\n rootTableName,\n versions,\n })\n\n if (rowHasLocalizedField) hasLocalizedField = true\n if (rowHasLocalizedRelationshipField) hasLocalizedRelationshipField = true\n if (rowHasManyTextField) hasManyTextField = true\n if (rowHasLocalizedManyTextField) hasLocalizedManyTextField = true\n if (rowHasManyNumberField) hasManyNumberField = true\n if (rowHasLocalizedManyNumberField) hasLocalizedManyNumberField = true\n break\n }\n\n case 'relationship':\n case 'upload':\n if (Array.isArray(field.relationTo)) {\n field.relationTo.forEach((relation) => relationships.add(relation))\n } else if (field.type === 'relationship' && field.hasMany) {\n relationships.add(field.relationTo)\n } else {\n // simple relationships get a column on the targetTable with a foreign key to the relationTo table\n const relationshipConfig = adapter.payload.collections[field.relationTo].config\n\n const tableName = adapter.tableNameMap.get(toSnakeCase(field.relationTo))\n\n // get the id type of the related collection\n let colType = adapter.idType === 'uuid' ? 'uuid' : 'integer'\n const relatedCollectionCustomID = relationshipConfig.fields.find(\n (field) => fieldAffectsData(field) && field.name === 'id',\n )\n if (relatedCollectionCustomID?.type === 'number') colType = 'numeric'\n if (relatedCollectionCustomID?.type === 'text') colType = 'varchar'\n\n // make the foreign key column for relationship using the correct id column type\n targetTable[fieldName] = parentIDColumnMap[colType](`${columnName}_id`).references(\n () => adapter.tables[tableName].id,\n { onDelete: 'set null' },\n )\n\n // add relationship to table\n relationsToBuild.set(fieldName, {\n type: 'one',\n localized: adapter.payload.config.localization && field.localized,\n target: tableName,\n })\n\n // add notNull when not required\n if (!disableNotNull && field.required && !field.admin?.condition) {\n targetTable[fieldName].notNull()\n }\n break\n }\n if (adapter.payload.config.localization && field.localized) {\n hasLocalizedRelationshipField = true\n }\n\n break\n\n default:\n break\n }\n\n const condition = field.admin && field.admin.condition\n\n if (\n !disableNotNull &&\n targetTable[fieldName] &&\n 'required' in field &&\n field.required &&\n !condition\n ) {\n targetTable[fieldName].notNull()\n }\n })\n\n return {\n hasLocalizedField,\n hasLocalizedManyNumberField,\n hasLocalizedManyTextField,\n hasLocalizedRelationshipField,\n hasManyNumberField,\n hasManyTextField,\n }\n}\n"],"names":["createTableName","hasLocalesTable","validateExistingBlockIsIdentical","relations","PgNumericBuilder","PgUUIDBuilder","PgVarcharBuilder","boolean","foreignKey","index","integer","jsonb","numeric","pgEnum","text","timestamp","varchar","InvalidConfiguration","fieldAffectsData","optionIsObject","toSnakeCase","buildTable","createIndex","idToUUID","parentIDColumnMap","traverseFields","adapter","columnPrefix","columns","disableNotNull","disableUnique","fieldPrefix","fields","forceLocalized","indexes","localesColumns","localesIndexes","newTableName","parentTableName","relationsToBuild","relationships","rootRelationsToBuild","rootTableIDColType","rootTableName","versions","throwValidationError","hasLocalizedField","hasLocalizedRelationshipField","hasManyTextField","hasLocalizedManyTextField","hasManyNumberField","hasLocalizedManyNumberField","parentIDColType","id","forEach","field","name","columnName","fieldName","targetTable","targetIndexes","replace","payload","config","localization","localized","type","hasMany","unique","includes","constraintValue","fieldConstraints","tableName","mode","precision","withTimezone","enumName","prefix","target","enums","options","map","option","value","selectTableName","versionsCustomName","baseColumns","order","notNull","parent","baseExtraConfig","orderIdx","cols","on","parentFk","foreignColumns","tables","onDelete","parentIdx","locale","enum__locales","localeIdx","set","one","references","relationName","disableNotNullFromHere","Boolean","admin","condition","arrayTableName","_order","_parentID","_orderIdx","_parentIDFk","_parentIDIdx","_locale","_localeIdx","subHasManyNumberField","subHasManyTextField","subRelationsToBuild","rootRelationships","many","result","_locales","localesSuffix","key","arrayWithLocalized","blocks","block","blockTableName","_path","_parentIdFk","_pathIdx","slug","blockWithLocalized","process","env","NODE_ENV","table","tableLocales","groupHasLocalizedField","groupHasLocalizedManyNumberField","groupHasLocalizedManyTextField","groupHasLocalizedRelationshipField","groupHasManyNumberField","groupHasManyTextField","tabHasLocalizedField","tabHasLocalizedManyNumberField","tabHasLocalizedManyTextField","tabHasLocalizedRelationshipField","tabHasManyNumberField","tabHasManyTextField","tabs","tab","rowHasLocalizedField","rowHasLocalizedManyNumberField","rowHasLocalizedManyTextField","rowHasLocalizedRelationshipField","rowHasManyNumberField","rowHasManyTextField","Array","isArray","relationTo","relation","add","relationshipConfig","collections","tableNameMap","get","colType","idType","relatedCollectionCustomID","find","required"],"mappings":"AAAA,oCAAoC,GAKpC,SACEA,eAAe,EACfC,eAAe,EACfC,gCAAgC,QAC3B,sBAAqB;AAC5B,SAASC,SAAS,QAAQ,cAAa;AACvC,SACEC,gBAAgB,EAChBC,aAAa,EACbC,gBAAgB,EAChBC,OAAO,EACPC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,KAAK,EACLC,OAAO,EACPC,MAAM,EACNC,IAAI,EACJC,SAAS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,IACd,CAACjE,WACD;YACAlD,WAAW,CAACD,UAAU,CAAC8B,OAAO;QAChC;IACF;IAEA,OAAO;QACL1C;QACAK;QACAF;QACAF;QACAG;QACAF;IACF;AACF,EAAC"}
package/dist/types.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import type { ColumnBaseConfig, ColumnDataType, DrizzleConfig, ExtractTablesWithRelations, Relation, Relations } from 'drizzle-orm';
2
- import type { NodePgDatabase, NodePgQueryResultHKT } from 'drizzle-orm/node-postgres';
3
- import type { PgColumn, PgEnum, PgSchema, PgTableWithColumns, PgTransaction } from 'drizzle-orm/pg-core';
1
+ import type { Operators } from '@payloadcms/drizzle';
2
+ import type { BuildQueryJoinAliases, DrizzleAdapter, TransactionPg } from '@payloadcms/drizzle/types';
3
+ import type { DrizzleSnapshotJSON } from 'drizzle-kit/payload';
4
+ import type { ColumnBaseConfig, ColumnDataType, DrizzleConfig, Relation, Relations, SQL } from 'drizzle-orm';
5
+ import type { NodePgDatabase } from 'drizzle-orm/node-postgres';
6
+ import type { PgColumn, PgEnum, PgInsertOnConflictDoUpdateConfig, PgSchema, PgTableWithColumns, PgTransactionConfig } from 'drizzle-orm/pg-core';
4
7
  import type { PgTableFn } from 'drizzle-orm/pg-core/table';
5
- import type { Payload } from 'payload';
6
- import type { BaseDatabaseAdapter } from 'payload/database';
7
- import type { PayloadRequestWithData } from 'payload/types';
8
- import type { Pool, PoolConfig } from 'pg';
9
- export type DrizzleDB = NodePgDatabase<Record<string, unknown>>;
8
+ import type { Payload, PayloadRequest } from 'payload';
9
+ import type { Pool, PoolConfig, QueryResult } from 'pg';
10
10
  export type Args = {
11
11
  idType?: 'serial' | 'uuid';
12
12
  localesSuffix?: string;
@@ -15,7 +15,12 @@ export type Args = {
15
15
  pool: PoolConfig;
16
16
  push?: boolean;
17
17
  relationshipsSuffix?: string;
18
+ /**
19
+ * The schema name to use for the database
20
+ * @experimental This only works when there are not other tables or enums of the same name in the database under a different schema. Awaiting fix from Drizzle.
21
+ */
18
22
  schemaName?: string;
23
+ transactionOptions?: PgTransactionConfig | false;
19
24
  versionsSuffix?: string;
20
25
  };
21
26
  export type GenericColumn = PgColumn<ColumnBaseConfig<ColumnDataType, string>, Record<string, unknown>>;
@@ -26,75 +31,116 @@ export type GenericTable = PgTableWithColumns<{
26
31
  columns: GenericColumns;
27
32
  dialect: string;
28
33
  name: string;
29
- schema: undefined;
34
+ schema: string;
30
35
  }>;
31
36
  export type GenericEnum = PgEnum<[string, ...string[]]>;
32
37
  export type GenericRelation = Relations<string, Record<string, Relation<string>>>;
33
- export type DrizzleTransaction = PgTransaction<NodePgQueryResultHKT, Record<string, unknown>, ExtractTablesWithRelations<Record<string, unknown>>>;
34
- export type PostgresAdapter = BaseDatabaseAdapter & {
35
- drizzle: DrizzleDB;
38
+ export type PostgresDB = NodePgDatabase<Record<string, unknown>>;
39
+ export type CountDistinct = (args: {
40
+ db: PostgresDB | TransactionPg;
41
+ joins: BuildQueryJoinAliases;
42
+ tableName: string;
43
+ where: SQL;
44
+ }) => Promise<number>;
45
+ export type DeleteWhere = (args: {
46
+ db: PostgresDB | TransactionPg;
47
+ tableName: string;
48
+ where: SQL;
49
+ }) => Promise<void>;
50
+ export type DropDatabase = (args: {
51
+ adapter: PostgresAdapter;
52
+ }) => Promise<void>;
53
+ export type Execute<T> = (args: {
54
+ db?: PostgresDB | TransactionPg;
55
+ drizzle?: PostgresDB;
56
+ raw?: string;
57
+ sql?: SQL<unknown>;
58
+ }) => Promise<QueryResult<Record<string, T>>>;
59
+ export type Insert = (args: {
60
+ db: PostgresDB | TransactionPg;
61
+ onConflictDoUpdate?: PgInsertOnConflictDoUpdateConfig<any>;
62
+ tableName: string;
63
+ values: Record<string, unknown> | Record<string, unknown>[];
64
+ }) => Promise<Record<string, unknown>[]>;
65
+ type PostgresDrizzleAdapter = Omit<DrizzleAdapter, 'countDistinct' | 'deleteWhere' | 'drizzle' | 'dropDatabase' | 'execute' | 'insert' | 'operators' | 'relations'>;
66
+ export type PostgresAdapter = {
67
+ countDistinct: CountDistinct;
68
+ defaultDrizzleSnapshot: DrizzleSnapshotJSON;
69
+ deleteWhere: DeleteWhere;
70
+ drizzle: PostgresDB;
71
+ dropDatabase: DropDatabase;
36
72
  enums: Record<string, GenericEnum>;
73
+ execute: Execute<unknown>;
37
74
  /**
38
75
  * An object keyed on each table, with a key value pair where the constraint name is the key, followed by the dot-notation field name
39
76
  * Used for returning properly formed errors from unique fields
40
77
  */
41
78
  fieldConstraints: Record<string, Record<string, string>>;
42
79
  idType: Args['idType'];
80
+ initializing: Promise<void>;
81
+ insert: Insert;
43
82
  localesSuffix?: string;
44
83
  logger: DrizzleConfig['logger'];
84
+ operators: Operators;
45
85
  pgSchema?: {
46
86
  table: PgTableFn;
47
87
  } | PgSchema;
48
88
  pool: Pool;
49
89
  poolOptions: Args['pool'];
50
90
  push: boolean;
91
+ rejectInitializing: () => void;
51
92
  relations: Record<string, GenericRelation>;
52
93
  relationshipsSuffix?: string;
94
+ resolveInitializing: () => void;
53
95
  schema: Record<string, GenericEnum | GenericRelation | GenericTable>;
54
96
  schemaName?: Args['schemaName'];
55
97
  sessions: {
56
98
  [id: string]: {
57
- db: DrizzleTransaction;
99
+ db: PostgresDB | TransactionPg;
58
100
  reject: () => Promise<void>;
59
101
  resolve: () => Promise<void>;
60
102
  };
61
103
  };
62
104
  tableNameMap: Map<string, string>;
63
- tables: Record<string, GenericTable | PgTableWithColumns<any>>;
105
+ tables: Record<string, GenericTable>;
64
106
  versionsSuffix?: string;
65
- };
107
+ } & PostgresDrizzleAdapter;
66
108
  export type IDType = 'integer' | 'numeric' | 'uuid' | 'varchar';
67
- export type PostgresAdapterResult = (args: {
68
- payload: Payload;
69
- }) => PostgresAdapter;
70
109
  export type MigrateUpArgs = {
71
110
  payload: Payload;
72
- req?: Partial<PayloadRequestWithData>;
111
+ req?: Partial<PayloadRequest>;
73
112
  };
74
113
  export type MigrateDownArgs = {
75
114
  payload: Payload;
76
- req?: Partial<PayloadRequestWithData>;
115
+ req?: Partial<PayloadRequest>;
77
116
  };
78
117
  declare module 'payload' {
79
- interface DatabaseAdapter extends Omit<Args, 'migrationDir' | 'pool'>, BaseDatabaseAdapter {
80
- drizzle: DrizzleDB;
118
+ interface DatabaseAdapter extends Omit<Args, 'idType' | 'logger' | 'migrationDir' | 'pool'>, DrizzleAdapter {
119
+ drizzle: PostgresDB;
81
120
  enums: Record<string, GenericEnum>;
121
+ /**
122
+ * An object keyed on each table, with a key value pair where the constraint name is the key, followed by the dot-notation field name
123
+ * Used for returning properly formed errors from unique fields
124
+ */
82
125
  fieldConstraints: Record<string, Record<string, string>>;
83
- localeSuffix?: string;
126
+ idType: Args['idType'];
127
+ initializing: Promise<void>;
128
+ localesSuffix?: string;
129
+ logger: DrizzleConfig['logger'];
130
+ pgSchema?: {
131
+ table: PgTableFn;
132
+ } | PgSchema;
84
133
  pool: Pool;
134
+ poolOptions: Args['pool'];
85
135
  push: boolean;
86
- relations: Record<string, GenericRelation>;
136
+ rejectInitializing: () => void;
87
137
  relationshipsSuffix?: string;
138
+ resolveInitializing: () => void;
88
139
  schema: Record<string, GenericEnum | GenericRelation | GenericTable>;
89
- sessions: {
90
- [id: string]: {
91
- db: DrizzleTransaction;
92
- reject: () => Promise<void>;
93
- resolve: () => Promise<void>;
94
- };
95
- };
96
- tables: Record<string, GenericTable>;
140
+ schemaName?: Args['schemaName'];
141
+ tableNameMap: Map<string, string>;
97
142
  versionsSuffix?: string;
98
143
  }
99
144
  }
145
+ export {};
100
146
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,0BAA0B,EAC1B,QAAQ,EACR,SAAS,EACV,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACr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I,CAAC,QAAQ,CAAC,CAAA;QACtB,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;QAC3B,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;QAC/B,QAAQ,CAAC,EAAE;YAAE,KAAK,EAAE,SAAS,CAAA;SAAE,GAAG,QAAQ,CAAA;QAC1C,IAAI,EAAE,IAAI,CAAA;QACV,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QACzB,IAAI,EAAE,OAAO,CAAA;QACb,kBAAkB,EAAE,MAAM,IAAI,CAAA;QAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAA;QAC5B,mBAAmB,EAAE,MAAM,IAAI,CAAA;QAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,eAAe,GAAG,YAAY,CAAC,CAAA;QACpE,UAAU,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;QAC/B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QACjC,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB;CACF"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n ColumnBaseConfig,\n ColumnDataType,\n DrizzleConfig,\n ExtractTablesWithRelations,\n Relation,\n Relations,\n} from 'drizzle-orm'\nimport type { NodePgDatabase, NodePgQueryResultHKT } from 'drizzle-orm/node-postgres'\nimport type {\n PgColumn,\n PgEnum,\n PgSchema,\n PgTableWithColumns,\n PgTransaction,\n} from 'drizzle-orm/pg-core'\nimport type { PgTableFn } from 'drizzle-orm/pg-core/table'\nimport type { Payload } from 'payload'\nimport type { BaseDatabaseAdapter } from 'payload/database'\nimport type { PayloadRequestWithData } from 'payload/types'\nimport type { Pool, PoolConfig } from 'pg'\n\nexport type DrizzleDB = NodePgDatabase<Record<string, unknown>>\n\nexport type Args = {\n idType?: 'serial' | 'uuid'\n localesSuffix?: string\n logger?: DrizzleConfig['logger']\n migrationDir?: string\n pool: PoolConfig\n push?: boolean\n relationshipsSuffix?: string\n schemaName?: string\n versionsSuffix?: string\n}\n\nexport type GenericColumn = PgColumn<\n ColumnBaseConfig<ColumnDataType, string>,\n Record<string, unknown>\n>\n\nexport type GenericColumns = {\n [x: string]: GenericColumn\n}\n\nexport type GenericTable = PgTableWithColumns<{\n columns: GenericColumns\n dialect: string\n name: string\n schema: undefined\n}>\n\nexport type GenericEnum = PgEnum<[string, ...string[]]>\n\nexport type GenericRelation = Relations<string, Record<string, Relation<string>>>\n\nexport type DrizzleTransaction = PgTransaction<\n NodePgQueryResultHKT,\n Record<string, unknown>,\n ExtractTablesWithRelations<Record<string, unknown>>\n>\n\nexport type PostgresAdapter = BaseDatabaseAdapter & {\n drizzle: DrizzleDB\n enums: Record<string, GenericEnum>\n /**\n * An object keyed on each table, with a key value pair where the constraint name is the key, followed by the dot-notation field name\n * Used for returning properly formed errors from unique fields\n */\n fieldConstraints: Record<string, Record<string, string>>\n idType: Args['idType']\n localesSuffix?: string\n logger: DrizzleConfig['logger']\n pgSchema?: { table: PgTableFn } | PgSchema\n pool: Pool\n poolOptions: Args['pool']\n push: boolean\n relations: Record<string, GenericRelation>\n relationshipsSuffix?: string\n schema: Record<string, GenericEnum | GenericRelation | GenericTable>\n schemaName?: Args['schemaName']\n sessions: {\n [id: string]: {\n db: DrizzleTransaction\n reject: () => Promise<void>\n resolve: () => Promise<void>\n }\n }\n tableNameMap: Map<string, string>\n tables: Record<string, GenericTable | PgTableWithColumns<any>>\n versionsSuffix?: string\n}\n\nexport type IDType = 'integer' | 'numeric' | 'uuid' | 'varchar'\n\nexport type PostgresAdapterResult = (args: { payload: Payload }) => PostgresAdapter\n\nexport type MigrateUpArgs = { payload: Payload; req?: Partial<PayloadRequestWithData> }\nexport type MigrateDownArgs = { payload: Payload; req?: Partial<PayloadRequestWithData> }\n\ndeclare module 'payload' {\n export interface DatabaseAdapter\n extends Omit<Args, 'migrationDir' | 'pool'>,\n BaseDatabaseAdapter {\n drizzle: DrizzleDB\n enums: Record<string, GenericEnum>\n fieldConstraints: Record<string, Record<string, string>>\n localeSuffix?: string\n pool: Pool\n push: boolean\n relations: Record<string, GenericRelation>\n relationshipsSuffix?: string\n schema: Record<string, GenericEnum | GenericRelation | GenericTable>\n sessions: {\n [id: string]: {\n db: DrizzleTransaction\n reject: () => Promise<void>\n resolve: () => Promise<void>\n }\n }\n tables: Record<string, GenericTable>\n versionsSuffix?: string\n }\n}\n"],"names":[],"rangeMappings":"","mappings":"AAkGA,WAAyF"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { Operators } from '@payloadcms/drizzle'\nimport type {\n BuildQueryJoinAliases,\n DrizzleAdapter,\n TransactionPg,\n} from '@payloadcms/drizzle/types'\nimport type { DrizzleSnapshotJSON } from 'drizzle-kit/payload'\nimport type {\n ColumnBaseConfig,\n ColumnDataType,\n DrizzleConfig,\n Relation,\n Relations,\n SQL,\n} from 'drizzle-orm'\nimport type { NodePgDatabase } from 'drizzle-orm/node-postgres'\nimport type {\n PgColumn,\n PgEnum,\n PgInsertOnConflictDoUpdateConfig,\n PgSchema,\n PgTableWithColumns,\n PgTransactionConfig,\n} from 'drizzle-orm/pg-core'\nimport type { PgTableFn } from 'drizzle-orm/pg-core/table'\nimport type { Payload, PayloadRequest } from 'payload'\nimport type { Pool, PoolConfig, QueryResult } from 'pg'\n\nexport type Args = {\n idType?: 'serial' | 'uuid'\n localesSuffix?: string\n logger?: DrizzleConfig['logger']\n migrationDir?: string\n pool: PoolConfig\n push?: boolean\n relationshipsSuffix?: string\n /**\n * The schema name to use for the database\n * @experimental This only works when there are not other tables or enums of the same name in the database under a different schema. Awaiting fix from Drizzle.\n */\n schemaName?: string\n transactionOptions?: PgTransactionConfig | false\n versionsSuffix?: string\n}\n\nexport type GenericColumn = PgColumn<\n ColumnBaseConfig<ColumnDataType, string>,\n Record<string, unknown>\n>\n\nexport type GenericColumns = {\n [x: string]: GenericColumn\n}\n\nexport type GenericTable = PgTableWithColumns<{\n columns: GenericColumns\n dialect: string\n name: string\n schema: string\n}>\n\nexport type GenericEnum = PgEnum<[string, ...string[]]>\n\nexport type GenericRelation = Relations<string, Record<string, Relation<string>>>\n\nexport type PostgresDB = NodePgDatabase<Record<string, unknown>>\n\nexport type CountDistinct = (args: {\n db: PostgresDB | TransactionPg\n joins: BuildQueryJoinAliases\n tableName: string\n where: SQL\n}) => Promise<number>\n\nexport type DeleteWhere = (args: {\n db: PostgresDB | TransactionPg\n tableName: string\n where: SQL\n}) => Promise<void>\n\nexport type DropDatabase = (args: { adapter: PostgresAdapter }) => Promise<void>\n\nexport type Execute<T> = (args: {\n db?: PostgresDB | TransactionPg\n drizzle?: PostgresDB\n raw?: string\n sql?: SQL<unknown>\n}) => Promise<QueryResult<Record<string, T>>>\n\nexport type Insert = (args: {\n db: PostgresDB | TransactionPg\n onConflictDoUpdate?: PgInsertOnConflictDoUpdateConfig<any>\n tableName: string\n values: Record<string, unknown> | Record<string, unknown>[]\n}) => Promise<Record<string, unknown>[]>\n\ntype PostgresDrizzleAdapter = Omit<\n DrizzleAdapter,\n | 'countDistinct'\n | 'deleteWhere'\n | 'drizzle'\n | 'dropDatabase'\n | 'execute'\n | 'insert'\n | 'operators'\n | 'relations'\n>\n\nexport type PostgresAdapter = {\n countDistinct: CountDistinct\n defaultDrizzleSnapshot: DrizzleSnapshotJSON\n deleteWhere: DeleteWhere\n drizzle: PostgresDB\n dropDatabase: DropDatabase\n enums: Record<string, GenericEnum>\n execute: Execute<unknown>\n /**\n * An object keyed on each table, with a key value pair where the constraint name is the key, followed by the dot-notation field name\n * Used for returning properly formed errors from unique fields\n */\n fieldConstraints: Record<string, Record<string, string>>\n idType: Args['idType']\n initializing: Promise<void>\n insert: Insert\n localesSuffix?: string\n logger: DrizzleConfig['logger']\n operators: Operators\n pgSchema?: { table: PgTableFn } | PgSchema\n pool: Pool\n poolOptions: Args['pool']\n push: boolean\n rejectInitializing: () => void\n relations: Record<string, GenericRelation>\n relationshipsSuffix?: string\n resolveInitializing: () => void\n schema: Record<string, GenericEnum | GenericRelation | GenericTable>\n schemaName?: Args['schemaName']\n sessions: {\n [id: string]: {\n db: PostgresDB | TransactionPg\n reject: () => Promise<void>\n resolve: () => Promise<void>\n }\n }\n tableNameMap: Map<string, string>\n tables: Record<string, GenericTable>\n versionsSuffix?: string\n} & PostgresDrizzleAdapter\n\nexport type IDType = 'integer' | 'numeric' | 'uuid' | 'varchar'\n\nexport type MigrateUpArgs = { payload: Payload; req?: Partial<PayloadRequest> }\nexport type MigrateDownArgs = { payload: Payload; req?: Partial<PayloadRequest> }\n\ndeclare module 'payload' {\n export interface DatabaseAdapter\n extends Omit<Args, 'idType' | 'logger' | 'migrationDir' | 'pool'>,\n DrizzleAdapter {\n drizzle: PostgresDB\n enums: Record<string, GenericEnum>\n /**\n * An object keyed on each table, with a key value pair where the constraint name is the key, followed by the dot-notation field name\n * Used for returning properly formed errors from unique fields\n */\n fieldConstraints: Record<string, Record<string, string>>\n idType: Args['idType']\n initializing: Promise<void>\n localesSuffix?: string\n logger: DrizzleConfig['logger']\n pgSchema?: { table: PgTableFn } | PgSchema\n pool: Pool\n poolOptions: Args['pool']\n push: boolean\n rejectInitializing: () => void\n relationshipsSuffix?: string\n resolveInitializing: () => void\n schema: Record<string, GenericEnum | GenericRelation | GenericTable>\n schemaName?: Args['schemaName']\n tableNameMap: Map<string, string>\n versionsSuffix?: string\n }\n}\n"],"names":[],"mappings":"AAwJA,WAAiF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/db-postgres",
3
- "version": "3.0.0-canary.6041f49",
3
+ "version": "3.0.0-canary.6d066c2",
4
4
  "description": "The officially supported Postgres database adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -14,13 +14,18 @@
14
14
  "exports": {
15
15
  ".": {
16
16
  "import": "./dist/index.js",
17
- "require": "./dist/index.js",
18
- "types": "./dist/index.d.ts"
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
19
  },
20
20
  "./types": {
21
21
  "import": "./dist/types.js",
22
- "require": "./dist/types.js",
23
- "types": "./dist/types.d.ts"
22
+ "types": "./dist/types.d.ts",
23
+ "default": "./dist/types.js"
24
+ },
25
+ "./migration-utils": {
26
+ "import": "./dist/exports/migration-utils.js",
27
+ "types": "./dist/exports/migration-utils.d.ts",
28
+ "default": "./dist/exports/migration-utils.js"
24
29
  }
25
30
  },
26
31
  "main": "./dist/index.js",
@@ -30,28 +35,32 @@
30
35
  "mock.js"
31
36
  ],
32
37
  "dependencies": {
33
- "@libsql/client": "^0.5.2",
34
38
  "console-table-printer": "2.11.2",
35
39
  "drizzle-kit": "0.20.14-1f2c838",
36
40
  "drizzle-orm": "0.29.4",
37
41
  "pg": "8.11.3",
38
42
  "prompts": "2.4.2",
39
43
  "to-snake-case": "1.0.0",
40
- "uuid": "9.0.0"
44
+ "uuid": "10.0.0",
45
+ "@payloadcms/drizzle": "3.0.0-canary.6d066c2"
41
46
  },
42
47
  "devDependencies": {
48
+ "@hyrious/esbuild-plugin-commonjs": "^0.2.4",
43
49
  "@types/pg": "8.10.2",
44
50
  "@types/to-snake-case": "1.0.0",
45
- "@payloadcms/eslint-config": "1.1.1",
46
- "payload": "3.0.0-canary.6041f49"
51
+ "esbuild": "0.23.0",
52
+ "@payloadcms/eslint-config": "3.0.0-beta.59",
53
+ "payload": "3.0.0-canary.6d066c2"
47
54
  },
48
55
  "peerDependencies": {
49
- "payload": "3.0.0-canary.6041f49"
56
+ "payload": "3.0.0-canary.6d066c2"
50
57
  },
51
58
  "scripts": {
52
- "build": "pnpm build:swc && pnpm build:types",
53
- "build:swc": "swc ./src -d ./dist --config-file .swcrc",
59
+ "build": "rimraf .dist && rimraf tsconfig.tsbuildinfo && pnpm build:types && pnpm build:swc && pnpm build:esbuild && pnpm renamePredefinedMigrations",
60
+ "build:esbuild": "echo skipping esbuild",
61
+ "build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
54
62
  "build:types": "tsc --emitDeclarationOnly --outDir dist",
55
- "clean": "rimraf {dist,*.tsbuildinfo}"
63
+ "clean": "rimraf {dist,*.tsbuildinfo}",
64
+ "renamePredefinedMigrations": "tsx ./scripts/renamePredefinedMigrations.ts"
56
65
  }
57
66
  }
package/dist/count.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { Count } from 'payload/database';
2
- export declare const count: Count;
3
- //# sourceMappingURL=count.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../src/count.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAY7C,eAAO,MAAM,KAAK,EAAE,KAiDnB,CAAA"}
package/dist/count.js DELETED
@@ -1,50 +0,0 @@
1
- import { sql } from 'drizzle-orm';
2
- import toSnakeCase from 'to-snake-case';
3
- import { chainMethods } from './find/chainMethods.js';
4
- import buildQuery from './queries/buildQuery.js';
5
- export const count = async function count({ collection, locale, req, where: whereArg }) {
6
- const collectionConfig = this.payload.collections[collection].config;
7
- const tableName = this.tableNameMap.get(toSnakeCase(collectionConfig.slug));
8
- const db = this.sessions[req.transactionID]?.db || this.drizzle;
9
- const table = this.tables[tableName];
10
- const { joinAliases, joins, where } = await buildQuery({
11
- adapter: this,
12
- fields: collectionConfig.fields,
13
- locale,
14
- tableName,
15
- where: whereArg
16
- });
17
- const selectCountMethods = [];
18
- joinAliases.forEach(({ condition, table })=>{
19
- selectCountMethods.push({
20
- args: [
21
- table,
22
- condition
23
- ],
24
- method: 'leftJoin'
25
- });
26
- });
27
- Object.entries(joins).forEach(([joinTable, condition])=>{
28
- if (joinTable) {
29
- selectCountMethods.push({
30
- args: [
31
- this.tables[joinTable],
32
- condition
33
- ],
34
- method: 'leftJoin'
35
- });
36
- }
37
- });
38
- const countResult = await chainMethods({
39
- methods: selectCountMethods,
40
- query: db.select({
41
- count: sql`count
42
- (DISTINCT ${this.tables[tableName].id})`
43
- }).from(table).where(where)
44
- });
45
- return {
46
- totalDocs: Number(countResult[0].count)
47
- };
48
- };
49
-
50
- //# sourceMappingURL=count.js.map
package/dist/count.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/count.ts"],"sourcesContent":["import type { Count } from 'payload/database'\nimport type { SanitizedCollectionConfig } from 'payload/types'\n\nimport { sql } from 'drizzle-orm'\nimport toSnakeCase from 'to-snake-case'\n\nimport type { ChainedMethods } from './find/chainMethods.js'\nimport type { PostgresAdapter } from './types.js'\n\nimport { chainMethods } from './find/chainMethods.js'\nimport buildQuery from './queries/buildQuery.js'\n\nexport const count: Count = async function count(\n this: PostgresAdapter,\n { collection, locale, req, where: whereArg },\n) {\n const collectionConfig: SanitizedCollectionConfig = this.payload.collections[collection].config\n\n const tableName = this.tableNameMap.get(toSnakeCase(collectionConfig.slug))\n\n const db = this.sessions[req.transactionID]?.db || this.drizzle\n const table = this.tables[tableName]\n\n const { joinAliases, joins, where } = await buildQuery({\n adapter: this,\n fields: collectionConfig.fields,\n locale,\n tableName,\n where: whereArg,\n })\n\n const selectCountMethods: ChainedMethods = []\n\n joinAliases.forEach(({ condition, table }) => {\n selectCountMethods.push({\n args: [table, condition],\n method: 'leftJoin',\n })\n })\n\n Object.entries(joins).forEach(([joinTable, condition]) => {\n if (joinTable) {\n selectCountMethods.push({\n args: [this.tables[joinTable], condition],\n method: 'leftJoin',\n })\n }\n })\n\n const countResult = await chainMethods({\n methods: selectCountMethods,\n query: db\n .select({\n count: sql<number>`count\n (DISTINCT ${this.tables[tableName].id})`,\n })\n .from(table)\n .where(where),\n })\n\n return { totalDocs: Number(countResult[0].count) }\n}\n"],"names":["sql","toSnakeCase","chainMethods","buildQuery","count","collection","locale","req","where","whereArg","collectionConfig","payload","collections","config","tableName","tableNameMap","get","slug","db","sessions","transactionID","drizzle","table","tables","joinAliases","joins","adapter","fields","selectCountMethods","forEach","condition","push","args","method","Object","entries","joinTable","countResult","methods","query","select","id","from","totalDocs","Number"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,GAAG,QAAQ,cAAa;AACjC,OAAOC,iBAAiB,gBAAe;AAKvC,SAASC,YAAY,QAAQ,yBAAwB;AACrD,OAAOC,gBAAgB,0BAAyB;AAEhD,OAAO,MAAMC,QAAe,eAAeA,MAEzC,EAAEC,UAAU,EAAEC,MAAM,EAAEC,GAAG,EAAEC,OAAOC,QAAQ,EAAE;IAE5C,MAAMC,mBAA8C,IAAI,CAACC,OAAO,CAACC,WAAW,CAACP,WAAW,CAACQ,MAAM;IAE/F,MAAMC,YAAY,IAAI,CAACC,YAAY,CAACC,GAAG,CAACf,YAAYS,iBAAiBO,IAAI;IAEzE,MAAMC,KAAK,IAAI,CAACC,QAAQ,CAACZ,IAAIa,aAAa,CAAC,EAAEF,MAAM,IAAI,CAACG,OAAO;IAC/D,MAAMC,QAAQ,IAAI,CAACC,MAAM,CAACT,UAAU;IAEpC,MAAM,EAAEU,WAAW,EAAEC,KAAK,EAAEjB,KAAK,EAAE,GAAG,MAAML,WAAW;QACrDuB,SAAS,IAAI;QACbC,QAAQjB,iBAAiBiB,MAAM;QAC/BrB;QACAQ;QACAN,OAAOC;IACT;IAEA,MAAMmB,qBAAqC,EAAE;IAE7CJ,YAAYK,OAAO,CAAC,CAAC,EAAEC,SAAS,EAAER,KAAK,EAAE;QACvCM,mBAAmBG,IAAI,CAAC;YACtBC,MAAM;gBAACV;gBAAOQ;aAAU;YACxBG,QAAQ;QACV;IACF;IAEAC,OAAOC,OAAO,CAACV,OAAOI,OAAO,CAAC,CAAC,CAACO,WAAWN,UAAU;QACnD,IAAIM,WAAW;YACbR,mBAAmBG,IAAI,CAAC;gBACtBC,MAAM;oBAAC,IAAI,CAACT,MAAM,CAACa,UAAU;oBAAEN;iBAAU;gBACzCG,QAAQ;YACV;QACF;IACF;IAEA,MAAMI,cAAc,MAAMnC,aAAa;QACrCoC,SAASV;QACTW,OAAOrB,GACJsB,MAAM,CAAC;YACNpC,OAAOJ,GAAW,CAAC;sBACL,EAAE,IAAI,CAACuB,MAAM,CAACT,UAAU,CAAC2B,EAAE,CAAC,CAAC,CAAC;QAC9C,GACCC,IAAI,CAACpB,OACLd,KAAK,CAACA;IACX;IAEA,OAAO;QAAEmC,WAAWC,OAAOP,WAAW,CAAC,EAAE,CAACjC,KAAK;IAAE;AACnD,EAAC"}
package/dist/create.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { Create } from 'payload/database';
2
- export declare const create: Create;
3
- //# sourceMappingURL=create.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAQ9C,eAAO,MAAM,MAAM,EAAE,MAoBpB,CAAA"}