@payloadcms/db-postgres 3.0.0-canary.03427d3 → 3.0.0-canary.0cf6f1e

Sign up to get free protection for your applications and to get access to all the features.
Files changed (378) hide show
  1. package/dist/connect.d.ts.map +1 -1
  2. package/dist/connect.js +5 -6
  3. package/dist/connect.js.map +1 -1
  4. package/dist/countDistinct.d.ts +3 -0
  5. package/dist/countDistinct.d.ts.map +1 -0
  6. package/dist/countDistinct.js +24 -0
  7. package/dist/countDistinct.js.map +1 -0
  8. package/dist/createJSONQuery/convertPathToJSONTraversal.d.ts.map +1 -0
  9. package/dist/createJSONQuery/convertPathToJSONTraversal.js.map +1 -0
  10. package/dist/createJSONQuery/formatJSONPathSegment.d.ts.map +1 -0
  11. package/dist/createJSONQuery/formatJSONPathSegment.js.map +1 -0
  12. package/dist/createJSONQuery/index.d.ts.map +1 -0
  13. package/dist/createJSONQuery/index.js.map +1 -0
  14. package/dist/createMigration.d.ts.map +1 -1
  15. package/dist/createMigration.js +19 -31
  16. package/dist/createMigration.js.map +1 -1
  17. package/dist/defaultSnapshot.d.ts +3 -0
  18. package/dist/defaultSnapshot.d.ts.map +1 -0
  19. package/dist/defaultSnapshot.js +17 -0
  20. package/dist/defaultSnapshot.js.map +1 -0
  21. package/dist/deleteWhere.d.ts +3 -0
  22. package/dist/deleteWhere.d.ts.map +1 -0
  23. package/dist/deleteWhere.js +6 -0
  24. package/dist/deleteWhere.js.map +1 -0
  25. package/dist/dropDatabase.d.ts +3 -0
  26. package/dist/dropDatabase.d.ts.map +1 -0
  27. package/dist/dropDatabase.js +9 -0
  28. package/dist/dropDatabase.js.map +1 -0
  29. package/dist/execute.d.ts +3 -0
  30. package/dist/execute.d.ts.map +1 -0
  31. package/dist/execute.js +11 -0
  32. package/dist/execute.js.map +1 -0
  33. package/dist/exports/migration-utils.js.map +1 -1
  34. package/dist/getMigrationTemplate.d.ts +3 -0
  35. package/dist/getMigrationTemplate.d.ts.map +1 -0
  36. package/dist/getMigrationTemplate.js +12 -0
  37. package/dist/getMigrationTemplate.js.map +1 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +38 -64
  40. package/dist/index.js.map +1 -1
  41. package/dist/init.d.ts.map +1 -1
  42. package/dist/init.js +2 -10
  43. package/dist/init.js.map +1 -1
  44. package/dist/insert.d.ts +3 -0
  45. package/dist/insert.d.ts.map +1 -0
  46. package/dist/insert.js +12 -0
  47. package/dist/insert.js.map +1 -0
  48. package/dist/predefinedMigrations/relationships-v2-v3.js.map +1 -1
  49. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts +5 -4
  50. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.d.ts.map +1 -1
  51. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js +1 -2
  52. package/dist/predefinedMigrations/v2-v3/fetchAndResave/index.js.map +1 -1
  53. package/dist/predefinedMigrations/v2-v3/fetchAndResave/traverseFields.js.map +1 -1
  54. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.d.ts.map +1 -1
  55. package/dist/predefinedMigrations/v2-v3/groupUpSQLStatements.js.map +1 -1
  56. package/dist/predefinedMigrations/v2-v3/index.d.ts +2 -2
  57. package/dist/predefinedMigrations/v2-v3/index.d.ts.map +1 -1
  58. package/dist/predefinedMigrations/v2-v3/index.js +2 -2
  59. package/dist/predefinedMigrations/v2-v3/index.js.map +1 -1
  60. package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts +5 -4
  61. package/dist/predefinedMigrations/v2-v3/migrateRelationships.d.ts.map +1 -1
  62. package/dist/predefinedMigrations/v2-v3/migrateRelationships.js.map +1 -1
  63. package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts +3 -2
  64. package/dist/predefinedMigrations/v2-v3/traverseFields.d.ts.map +1 -1
  65. package/dist/predefinedMigrations/v2-v3/traverseFields.js.map +1 -1
  66. package/dist/predefinedMigrations/v2-v3/types.js.map +1 -1
  67. package/dist/requireDrizzleKit.d.ts +3 -0
  68. package/dist/requireDrizzleKit.d.ts.map +1 -0
  69. package/dist/requireDrizzleKit.js +5 -0
  70. package/dist/requireDrizzleKit.js.map +1 -0
  71. package/dist/schema/build.d.ts.map +1 -1
  72. package/dist/schema/build.js +2 -2
  73. package/dist/schema/build.js.map +1 -1
  74. package/dist/schema/createIndex.d.ts.map +1 -1
  75. package/dist/schema/createIndex.js +1 -1
  76. package/dist/schema/createIndex.js.map +1 -1
  77. package/dist/schema/idToUUID.js.map +1 -1
  78. package/dist/schema/parentIDColumnMap.js.map +1 -1
  79. package/dist/schema/setColumnID.js.map +1 -1
  80. package/dist/schema/traverseFields.d.ts.map +1 -1
  81. package/dist/schema/traverseFields.js +13 -14
  82. package/dist/schema/traverseFields.js.map +1 -1
  83. package/dist/schema/withDefault.d.ts +4 -0
  84. package/dist/schema/withDefault.d.ts.map +1 -0
  85. package/dist/schema/withDefault.js +10 -0
  86. package/dist/schema/withDefault.js.map +1 -0
  87. package/dist/types.d.ts +82 -35
  88. package/dist/types.d.ts.map +1 -1
  89. package/dist/types.js.map +1 -1
  90. package/package.json +15 -15
  91. package/dist/count.d.ts +0 -3
  92. package/dist/count.d.ts.map +0 -1
  93. package/dist/count.js +0 -41
  94. package/dist/count.js.map +0 -1
  95. package/dist/create.d.ts +0 -3
  96. package/dist/create.d.ts.map +0 -1
  97. package/dist/create.js +0 -19
  98. package/dist/create.js.map +0 -1
  99. package/dist/createGlobal.d.ts +0 -4
  100. package/dist/createGlobal.d.ts.map +0 -1
  101. package/dist/createGlobal.js +0 -19
  102. package/dist/createGlobal.js.map +0 -1
  103. package/dist/createGlobalVersion.d.ts +0 -5
  104. package/dist/createGlobalVersion.d.ts.map +0 -1
  105. package/dist/createGlobalVersion.js +0 -33
  106. package/dist/createGlobalVersion.js.map +0 -1
  107. package/dist/createVersion.d.ts +0 -4
  108. package/dist/createVersion.d.ts.map +0 -1
  109. package/dist/createVersion.js +0 -40
  110. package/dist/createVersion.js.map +0 -1
  111. package/dist/deleteMany.d.ts +0 -3
  112. package/dist/deleteMany.d.ts.map +0 -1
  113. package/dist/deleteMany.js +0 -28
  114. package/dist/deleteMany.js.map +0 -1
  115. package/dist/deleteOne.d.ts +0 -3
  116. package/dist/deleteOne.d.ts.map +0 -1
  117. package/dist/deleteOne.js +0 -59
  118. package/dist/deleteOne.js.map +0 -1
  119. package/dist/deleteVersions.d.ts +0 -3
  120. package/dist/deleteVersions.d.ts.map +0 -1
  121. package/dist/deleteVersions.js +0 -31
  122. package/dist/deleteVersions.js.map +0 -1
  123. package/dist/destroy.d.ts +0 -3
  124. package/dist/destroy.d.ts.map +0 -1
  125. package/dist/destroy.js +0 -15
  126. package/dist/destroy.js.map +0 -1
  127. package/dist/find/buildFindManyArgs.d.ts +0 -17
  128. package/dist/find/buildFindManyArgs.d.ts.map +0 -1
  129. package/dist/find/buildFindManyArgs.js +0 -65
  130. package/dist/find/buildFindManyArgs.js.map +0 -1
  131. package/dist/find/chainMethods.d.ts +0 -16
  132. package/dist/find/chainMethods.d.ts.map +0 -1
  133. package/dist/find/chainMethods.js +0 -12
  134. package/dist/find/chainMethods.js.map +0 -1
  135. package/dist/find/findMany.d.ts +0 -21
  136. package/dist/find/findMany.d.ts.map +0 -1
  137. package/dist/find/findMany.js +0 -152
  138. package/dist/find/findMany.js.map +0 -1
  139. package/dist/find/traverseFields.d.ts +0 -17
  140. package/dist/find/traverseFields.d.ts.map +0 -1
  141. package/dist/find/traverseFields.js +0 -156
  142. package/dist/find/traverseFields.js.map +0 -1
  143. package/dist/find.d.ts +0 -3
  144. package/dist/find.d.ts.map +0 -1
  145. package/dist/find.js +0 -21
  146. package/dist/find.js.map +0 -1
  147. package/dist/findGlobal.d.ts +0 -3
  148. package/dist/findGlobal.d.ts.map +0 -1
  149. package/dist/findGlobal.js +0 -23
  150. package/dist/findGlobal.js.map +0 -1
  151. package/dist/findGlobalVersions.d.ts +0 -3
  152. package/dist/findGlobalVersions.d.ts.map +0 -1
  153. package/dist/findGlobalVersions.js +0 -24
  154. package/dist/findGlobalVersions.js.map +0 -1
  155. package/dist/findOne.d.ts +0 -4
  156. package/dist/findOne.d.ts.map +0 -1
  157. package/dist/findOne.js +0 -21
  158. package/dist/findOne.js.map +0 -1
  159. package/dist/findVersions.d.ts +0 -3
  160. package/dist/findVersions.d.ts.map +0 -1
  161. package/dist/findVersions.js +0 -24
  162. package/dist/findVersions.js.map +0 -1
  163. package/dist/migrate.d.ts +0 -3
  164. package/dist/migrate.d.ts.map +0 -1
  165. package/dist/migrate.js +0 -99
  166. package/dist/migrate.js.map +0 -1
  167. package/dist/migrateDown.d.ts +0 -3
  168. package/dist/migrateDown.d.ts.map +0 -1
  169. package/dist/migrateDown.js +0 -63
  170. package/dist/migrateDown.js.map +0 -1
  171. package/dist/migrateFresh.d.ts +0 -8
  172. package/dist/migrateFresh.d.ts.map +0 -1
  173. package/dist/migrateFresh.js +0 -72
  174. package/dist/migrateFresh.js.map +0 -1
  175. package/dist/migrateRefresh.d.ts +0 -6
  176. package/dist/migrateRefresh.d.ts.map +0 -1
  177. package/dist/migrateRefresh.js +0 -102
  178. package/dist/migrateRefresh.js.map +0 -1
  179. package/dist/migrateReset.d.ts +0 -6
  180. package/dist/migrateReset.d.ts.map +0 -1
  181. package/dist/migrateReset.js +0 -82
  182. package/dist/migrateReset.js.map +0 -1
  183. package/dist/migrateStatus.d.ts +0 -3
  184. package/dist/migrateStatus.d.ts.map +0 -1
  185. package/dist/migrateStatus.js +0 -44
  186. package/dist/migrateStatus.js.map +0 -1
  187. package/dist/queries/buildAndOrConditions.d.ts +0 -16
  188. package/dist/queries/buildAndOrConditions.d.ts.map +0 -1
  189. package/dist/queries/buildAndOrConditions.js +0 -28
  190. package/dist/queries/buildAndOrConditions.js.map +0 -1
  191. package/dist/queries/buildQuery.d.ts +0 -30
  192. package/dist/queries/buildQuery.d.ts.map +0 -1
  193. package/dist/queries/buildQuery.js +0 -72
  194. package/dist/queries/buildQuery.js.map +0 -1
  195. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts.map +0 -1
  196. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js.map +0 -1
  197. package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts.map +0 -1
  198. package/dist/queries/createJSONQuery/formatJSONPathSegment.js.map +0 -1
  199. package/dist/queries/createJSONQuery/index.d.ts.map +0 -1
  200. package/dist/queries/createJSONQuery/index.js.map +0 -1
  201. package/dist/queries/getTableColumnFromPath.d.ts +0 -50
  202. package/dist/queries/getTableColumnFromPath.d.ts.map +0 -1
  203. package/dist/queries/getTableColumnFromPath.js +0 -516
  204. package/dist/queries/getTableColumnFromPath.js.map +0 -1
  205. package/dist/queries/operatorMap.d.ts +0 -18
  206. package/dist/queries/operatorMap.d.ts.map +0 -1
  207. package/dist/queries/operatorMap.js +0 -24
  208. package/dist/queries/operatorMap.js.map +0 -1
  209. package/dist/queries/parseParams.d.ts +0 -16
  210. package/dist/queries/parseParams.d.ts.map +0 -1
  211. package/dist/queries/parseParams.js +0 -183
  212. package/dist/queries/parseParams.js.map +0 -1
  213. package/dist/queries/sanitizeQueryValue.d.ts +0 -15
  214. package/dist/queries/sanitizeQueryValue.d.ts.map +0 -1
  215. package/dist/queries/sanitizeQueryValue.js +0 -89
  216. package/dist/queries/sanitizeQueryValue.js.map +0 -1
  217. package/dist/queries/selectDistinct.d.ts +0 -22
  218. package/dist/queries/selectDistinct.d.ts.map +0 -1
  219. package/dist/queries/selectDistinct.js +0 -30
  220. package/dist/queries/selectDistinct.js.map +0 -1
  221. package/dist/queryDrafts.d.ts +0 -3
  222. package/dist/queryDrafts.d.ts.map +0 -1
  223. package/dist/queryDrafts.js +0 -40
  224. package/dist/queryDrafts.js.map +0 -1
  225. package/dist/schema/createTableName.d.ts +0 -30
  226. package/dist/schema/createTableName.d.ts.map +0 -1
  227. package/dist/schema/createTableName.js +0 -31
  228. package/dist/schema/createTableName.js.map +0 -1
  229. package/dist/schema/validateExistingBlockIsIdentical.d.ts +0 -12
  230. package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +0 -1
  231. package/dist/schema/validateExistingBlockIsIdentical.js +0 -76
  232. package/dist/schema/validateExistingBlockIsIdentical.js.map +0 -1
  233. package/dist/transactions/beginTransaction.d.ts +0 -3
  234. package/dist/transactions/beginTransaction.d.ts.map +0 -1
  235. package/dist/transactions/beginTransaction.js +0 -51
  236. package/dist/transactions/beginTransaction.js.map +0 -1
  237. package/dist/transactions/commitTransaction.d.ts +0 -3
  238. package/dist/transactions/commitTransaction.d.ts.map +0 -1
  239. package/dist/transactions/commitTransaction.js +0 -14
  240. package/dist/transactions/commitTransaction.js.map +0 -1
  241. package/dist/transactions/rollbackTransaction.d.ts +0 -3
  242. package/dist/transactions/rollbackTransaction.d.ts.map +0 -1
  243. package/dist/transactions/rollbackTransaction.js +0 -13
  244. package/dist/transactions/rollbackTransaction.js.map +0 -1
  245. package/dist/transform/read/hasManyNumber.d.ts +0 -10
  246. package/dist/transform/read/hasManyNumber.d.ts.map +0 -1
  247. package/dist/transform/read/hasManyNumber.js +0 -10
  248. package/dist/transform/read/hasManyNumber.js.map +0 -1
  249. package/dist/transform/read/hasManyText.d.ts +0 -10
  250. package/dist/transform/read/hasManyText.d.ts.map +0 -1
  251. package/dist/transform/read/hasManyText.js +0 -10
  252. package/dist/transform/read/hasManyText.js.map +0 -1
  253. package/dist/transform/read/index.d.ts +0 -14
  254. package/dist/transform/read/index.d.ts.map +0 -1
  255. package/dist/transform/read/index.js +0 -44
  256. package/dist/transform/read/index.js.map +0 -1
  257. package/dist/transform/read/relationship.d.ts +0 -10
  258. package/dist/transform/read/relationship.d.ts.map +0 -1
  259. package/dist/transform/read/relationship.js +0 -60
  260. package/dist/transform/read/relationship.js.map +0 -1
  261. package/dist/transform/read/traverseFields.d.ts +0 -57
  262. package/dist/transform/read/traverseFields.d.ts.map +0 -1
  263. package/dist/transform/read/traverseFields.js +0 -435
  264. package/dist/transform/read/traverseFields.js.map +0 -1
  265. package/dist/transform/write/array.d.ts +0 -26
  266. package/dist/transform/write/array.d.ts.map +0 -1
  267. package/dist/transform/write/array.js +0 -58
  268. package/dist/transform/write/array.js.map +0 -1
  269. package/dist/transform/write/blocks.d.ts +0 -25
  270. package/dist/transform/write/blocks.d.ts.map +0 -1
  271. package/dist/transform/write/blocks.js +0 -54
  272. package/dist/transform/write/blocks.js.map +0 -1
  273. package/dist/transform/write/index.d.ts +0 -13
  274. package/dist/transform/write/index.d.ts.map +0 -1
  275. package/dist/transform/write/index.js +0 -41
  276. package/dist/transform/write/index.js.map +0 -1
  277. package/dist/transform/write/numbers.d.ts +0 -8
  278. package/dist/transform/write/numbers.d.ts.map +0 -1
  279. package/dist/transform/write/numbers.js +0 -11
  280. package/dist/transform/write/numbers.js.map +0 -1
  281. package/dist/transform/write/relationships.d.ts +0 -10
  282. package/dist/transform/write/relationships.d.ts.map +0 -1
  283. package/dist/transform/write/relationships.js +0 -23
  284. package/dist/transform/write/relationships.js.map +0 -1
  285. package/dist/transform/write/selects.d.ts +0 -8
  286. package/dist/transform/write/selects.d.ts.map +0 -1
  287. package/dist/transform/write/selects.js +0 -20
  288. package/dist/transform/write/selects.js.map +0 -1
  289. package/dist/transform/write/texts.d.ts +0 -8
  290. package/dist/transform/write/texts.d.ts.map +0 -1
  291. package/dist/transform/write/texts.js +0 -11
  292. package/dist/transform/write/texts.js.map +0 -1
  293. package/dist/transform/write/traverseFields.d.ts +0 -50
  294. package/dist/transform/write/traverseFields.d.ts.map +0 -1
  295. package/dist/transform/write/traverseFields.js +0 -445
  296. package/dist/transform/write/traverseFields.js.map +0 -1
  297. package/dist/transform/write/types.d.ts +0 -43
  298. package/dist/transform/write/types.d.ts.map +0 -1
  299. package/dist/transform/write/types.js +0 -3
  300. package/dist/transform/write/types.js.map +0 -1
  301. package/dist/update.d.ts +0 -3
  302. package/dist/update.d.ts.map +0 -1
  303. package/dist/update.js +0 -54
  304. package/dist/update.js.map +0 -1
  305. package/dist/updateGlobal.d.ts +0 -4
  306. package/dist/updateGlobal.d.ts.map +0 -1
  307. package/dist/updateGlobal.js +0 -25
  308. package/dist/updateGlobal.js.map +0 -1
  309. package/dist/updateGlobalVersion.d.ts +0 -4
  310. package/dist/updateGlobalVersion.d.ts.map +0 -1
  311. package/dist/updateGlobalVersion.js +0 -36
  312. package/dist/updateGlobalVersion.js.map +0 -1
  313. package/dist/updateVersion.d.ts +0 -4
  314. package/dist/updateVersion.d.ts.map +0 -1
  315. package/dist/updateVersion.js +0 -36
  316. package/dist/updateVersion.js.map +0 -1
  317. package/dist/upsertRow/deleteExistingArrayRows.d.ts +0 -10
  318. package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +0 -1
  319. package/dist/upsertRow/deleteExistingArrayRows.js +0 -10
  320. package/dist/upsertRow/deleteExistingArrayRows.js.map +0 -1
  321. package/dist/upsertRow/deleteExistingRowsByPath.d.ts +0 -14
  322. package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +0 -1
  323. package/dist/upsertRow/deleteExistingRowsByPath.js +0 -33
  324. package/dist/upsertRow/deleteExistingRowsByPath.js.map +0 -1
  325. package/dist/upsertRow/index.d.ts +0 -4
  326. package/dist/upsertRow/index.d.ts.map +0 -1
  327. package/dist/upsertRow/index.js +0 -279
  328. package/dist/upsertRow/index.js.map +0 -1
  329. package/dist/upsertRow/insertArrays.d.ts +0 -13
  330. package/dist/upsertRow/insertArrays.d.ts.map +0 -1
  331. package/dist/upsertRow/insertArrays.js +0 -68
  332. package/dist/upsertRow/insertArrays.js.map +0 -1
  333. package/dist/upsertRow/types.d.ts +0 -32
  334. package/dist/upsertRow/types.d.ts.map +0 -1
  335. package/dist/upsertRow/types.js +0 -3
  336. package/dist/upsertRow/types.js.map +0 -1
  337. package/dist/utilities/appendPrefixToKeys.d.ts +0 -2
  338. package/dist/utilities/appendPrefixToKeys.d.ts.map +0 -1
  339. package/dist/utilities/appendPrefixToKeys.js +0 -6
  340. package/dist/utilities/appendPrefixToKeys.js.map +0 -1
  341. package/dist/utilities/createBlocksMap.d.ts +0 -5
  342. package/dist/utilities/createBlocksMap.d.ts.map +0 -1
  343. package/dist/utilities/createBlocksMap.js +0 -29
  344. package/dist/utilities/createBlocksMap.js.map +0 -1
  345. package/dist/utilities/createMigrationTable.d.ts +0 -3
  346. package/dist/utilities/createMigrationTable.d.ts.map +0 -1
  347. package/dist/utilities/createMigrationTable.js +0 -13
  348. package/dist/utilities/createMigrationTable.js.map +0 -1
  349. package/dist/utilities/createRelationshipMap.d.ts +0 -2
  350. package/dist/utilities/createRelationshipMap.d.ts.map +0 -1
  351. package/dist/utilities/createRelationshipMap.js +0 -19
  352. package/dist/utilities/createRelationshipMap.js.map +0 -1
  353. package/dist/utilities/hasLocalesTable.d.ts +0 -3
  354. package/dist/utilities/hasLocalesTable.d.ts.map +0 -1
  355. package/dist/utilities/hasLocalesTable.js +0 -11
  356. package/dist/utilities/hasLocalesTable.js.map +0 -1
  357. package/dist/utilities/isArrayOfRows.d.ts +0 -2
  358. package/dist/utilities/isArrayOfRows.d.ts.map +0 -1
  359. package/dist/utilities/isArrayOfRows.js +0 -5
  360. package/dist/utilities/isArrayOfRows.js.map +0 -1
  361. package/dist/utilities/migrationTableExists.d.ts +0 -3
  362. package/dist/utilities/migrationTableExists.d.ts.map +0 -1
  363. package/dist/utilities/migrationTableExists.js +0 -9
  364. package/dist/utilities/migrationTableExists.js.map +0 -1
  365. package/dist/utilities/parseError.d.ts +0 -5
  366. package/dist/utilities/parseError.d.ts.map +0 -1
  367. package/dist/utilities/parseError.js +0 -17
  368. package/dist/utilities/parseError.js.map +0 -1
  369. package/dist/utilities/pushDevSchema.d.ts +0 -9
  370. package/dist/utilities/pushDevSchema.d.ts.map +0 -1
  371. package/dist/utilities/pushDevSchema.js +0 -58
  372. package/dist/utilities/pushDevSchema.js.map +0 -1
  373. /package/dist/{queries/createJSONQuery → createJSONQuery}/convertPathToJSONTraversal.d.ts +0 -0
  374. /package/dist/{queries/createJSONQuery → createJSONQuery}/convertPathToJSONTraversal.js +0 -0
  375. /package/dist/{queries/createJSONQuery → createJSONQuery}/formatJSONPathSegment.d.ts +0 -0
  376. /package/dist/{queries/createJSONQuery → createJSONQuery}/formatJSONPathSegment.js +0 -0
  377. /package/dist/{queries/createJSONQuery → createJSONQuery}/index.d.ts +0 -0
  378. /package/dist/{queries/createJSONQuery → createJSONQuery}/index.js +0 -0
@@ -1,68 +0,0 @@
1
- /* eslint-disable no-param-reassign */ export const insertArrays = async ({ adapter, arrays, db, parentRows })=>{
2
- // Maintain a map of flattened rows by table
3
- const rowsByTable = {};
4
- arrays.forEach((arraysByTable, parentRowIndex)=>{
5
- Object.entries(arraysByTable).forEach(([tableName, arrayRows])=>{
6
- // If the table doesn't exist in map, initialize it
7
- if (!rowsByTable[tableName]) {
8
- rowsByTable[tableName] = {
9
- arrays: [],
10
- locales: [],
11
- rows: []
12
- };
13
- }
14
- const parentID = parentRows[parentRowIndex].id;
15
- // Add any sub arrays that need to be created
16
- // We will call this recursively below
17
- arrayRows.forEach((arrayRow, i)=>{
18
- if (Object.keys(arrayRow.arrays).length > 0) {
19
- rowsByTable[tableName].arrays.push(arrayRow.arrays);
20
- }
21
- // Set up parent IDs for both row and locale row
22
- arrayRow.row._parentID = parentID;
23
- rowsByTable[tableName].rows.push(arrayRow.row);
24
- Object.entries(arrayRow.locales).forEach(([arrayRowLocale, arrayRowLocaleData])=>{
25
- arrayRowLocaleData._parentID = arrayRow.row.id;
26
- arrayRowLocaleData._locale = arrayRowLocale;
27
- rowsByTable[tableName].locales.push(arrayRowLocaleData);
28
- if (!arrayRow.row.id) {
29
- arrayRowLocaleData._getParentID = (rows)=>rows[i].id;
30
- }
31
- });
32
- });
33
- });
34
- });
35
- // Insert all corresponding arrays
36
- // (one insert per array table)
37
- for (const [tableName, row] of Object.entries(rowsByTable)){
38
- // the nested arrays need the ID for the parentID foreign key
39
- let insertedRows;
40
- if (row.rows.length > 0) {
41
- insertedRows = await db.insert(adapter.tables[tableName]).values(row.rows).returning();
42
- }
43
- // Insert locale rows
44
- if (adapter.tables[`${tableName}${adapter.localesSuffix}`] && row.locales.length > 0) {
45
- if (!row.locales[0]._parentID) {
46
- row.locales = row.locales.map((localeRow)=>{
47
- if (typeof localeRow._getParentID === 'function') {
48
- localeRow._parentID = localeRow._getParentID(insertedRows);
49
- delete localeRow._getParentID;
50
- }
51
- return localeRow;
52
- });
53
- }
54
- await db.insert(adapter.tables[`${tableName}${adapter.localesSuffix}`]).values(row.locales).returning();
55
- }
56
- // If there are sub arrays, call this function recursively
57
- if (row.arrays.length > 0) {
58
- await insertArrays({
59
- adapter,
60
- arrays: row.arrays,
61
- db,
62
- parentRows: insertedRows
63
- });
64
- }
65
- }
66
- };
67
-
68
- //# sourceMappingURL=insertArrays.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/upsertRow/insertArrays.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport type { ArrayRowToInsert } from '../transform/write/types.js'\nimport type { DrizzleDB, PostgresAdapter } from '../types.js'\n\ntype Args = {\n adapter: PostgresAdapter\n arrays: {\n [tableName: string]: ArrayRowToInsert[]\n }[]\n db: DrizzleDB\n parentRows: Record<string, unknown>[]\n}\n\ntype RowsByTable = {\n [tableName: string]: {\n arrays: {\n [tableName: string]: ArrayRowToInsert[]\n }[]\n locales: Record<string, unknown>[]\n rows: Record<string, unknown>[]\n }\n}\n\nexport const insertArrays = async ({ adapter, arrays, db, parentRows }: Args): Promise<void> => {\n // Maintain a map of flattened rows by table\n const rowsByTable: RowsByTable = {}\n\n arrays.forEach((arraysByTable, parentRowIndex) => {\n Object.entries(arraysByTable).forEach(([tableName, arrayRows]) => {\n // If the table doesn't exist in map, initialize it\n if (!rowsByTable[tableName]) {\n rowsByTable[tableName] = {\n arrays: [],\n locales: [],\n rows: [],\n }\n }\n\n const parentID = parentRows[parentRowIndex].id\n\n // Add any sub arrays that need to be created\n // We will call this recursively below\n arrayRows.forEach((arrayRow, i) => {\n if (Object.keys(arrayRow.arrays).length > 0) {\n rowsByTable[tableName].arrays.push(arrayRow.arrays)\n }\n\n // Set up parent IDs for both row and locale row\n arrayRow.row._parentID = parentID\n rowsByTable[tableName].rows.push(arrayRow.row)\n\n Object.entries(arrayRow.locales).forEach(([arrayRowLocale, arrayRowLocaleData]) => {\n arrayRowLocaleData._parentID = arrayRow.row.id\n arrayRowLocaleData._locale = arrayRowLocale\n rowsByTable[tableName].locales.push(arrayRowLocaleData)\n if (!arrayRow.row.id) {\n arrayRowLocaleData._getParentID = (rows) => rows[i].id\n }\n })\n })\n })\n })\n\n // Insert all corresponding arrays\n // (one insert per array table)\n for (const [tableName, row] of Object.entries(rowsByTable)) {\n // the nested arrays need the ID for the parentID foreign key\n let insertedRows: Args['parentRows']\n if (row.rows.length > 0) {\n insertedRows = await db.insert(adapter.tables[tableName]).values(row.rows).returning()\n }\n\n // Insert locale rows\n if (adapter.tables[`${tableName}${adapter.localesSuffix}`] && row.locales.length > 0) {\n if (!row.locales[0]._parentID) {\n row.locales = row.locales.map((localeRow) => {\n if (typeof localeRow._getParentID === 'function') {\n localeRow._parentID = localeRow._getParentID(insertedRows)\n delete localeRow._getParentID\n }\n return localeRow\n })\n }\n await db\n .insert(adapter.tables[`${tableName}${adapter.localesSuffix}`])\n .values(row.locales)\n .returning()\n }\n\n // If there are sub arrays, call this function recursively\n if (row.arrays.length > 0) {\n await insertArrays({\n adapter,\n arrays: row.arrays,\n db,\n parentRows: insertedRows,\n })\n }\n }\n}\n"],"names":["insertArrays","adapter","arrays","db","parentRows","rowsByTable","forEach","arraysByTable","parentRowIndex","Object","entries","tableName","arrayRows","locales","rows","parentID","id","arrayRow","i","keys","length","push","row","_parentID","arrayRowLocale","arrayRowLocaleData","_locale","_getParentID","insertedRows","insert","tables","values","returning","localesSuffix","map","localeRow"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,oCAAoC,GAuBpC,OAAO,MAAMA,eAAe,OAAO,EAAEC,OAAO,EAAEC,MAAM,EAAEC,EAAE,EAAEC,UAAU,EAAQ;IAC1E,4CAA4C;IAC5C,MAAMC,cAA2B,CAAC;IAElCH,OAAOI,OAAO,CAAC,CAACC,eAAeC;QAC7BC,OAAOC,OAAO,CAACH,eAAeD,OAAO,CAAC,CAAC,CAACK,WAAWC,UAAU;YAC3D,mDAAmD;YACnD,IAAI,CAACP,WAAW,CAACM,UAAU,EAAE;gBAC3BN,WAAW,CAACM,UAAU,GAAG;oBACvBT,QAAQ,EAAE;oBACVW,SAAS,EAAE;oBACXC,MAAM,EAAE;gBACV;YACF;YAEA,MAAMC,WAAWX,UAAU,CAACI,eAAe,CAACQ,EAAE;YAE9C,6CAA6C;YAC7C,sCAAsC;YACtCJ,UAAUN,OAAO,CAAC,CAACW,UAAUC;gBAC3B,IAAIT,OAAOU,IAAI,CAACF,SAASf,MAAM,EAAEkB,MAAM,GAAG,GAAG;oBAC3Cf,WAAW,CAACM,UAAU,CAACT,MAAM,CAACmB,IAAI,CAACJ,SAASf,MAAM;gBACpD;gBAEA,gDAAgD;gBAChDe,SAASK,GAAG,CAACC,SAAS,GAAGR;gBACzBV,WAAW,CAACM,UAAU,CAACG,IAAI,CAACO,IAAI,CAACJ,SAASK,GAAG;gBAE7Cb,OAAOC,OAAO,CAACO,SAASJ,OAAO,EAAEP,OAAO,CAAC,CAAC,CAACkB,gBAAgBC,mBAAmB;oBAC5EA,mBAAmBF,SAAS,GAAGN,SAASK,GAAG,CAACN,EAAE;oBAC9CS,mBAAmBC,OAAO,GAAGF;oBAC7BnB,WAAW,CAACM,UAAU,CAACE,OAAO,CAACQ,IAAI,CAACI;oBACpC,IAAI,CAACR,SAASK,GAAG,CAACN,EAAE,EAAE;wBACpBS,mBAAmBE,YAAY,GAAG,CAACb,OAASA,IAAI,CAACI,EAAE,CAACF,EAAE;oBACxD;gBACF;YACF;QACF;IACF;IAEA,kCAAkC;IAClC,+BAA+B;IAC/B,KAAK,MAAM,CAACL,WAAWW,IAAI,IAAIb,OAAOC,OAAO,CAACL,aAAc;QAC1D,6DAA6D;QAC7D,IAAIuB;QACJ,IAAIN,IAAIR,IAAI,CAACM,MAAM,GAAG,GAAG;YACvBQ,eAAe,MAAMzB,GAAG0B,MAAM,CAAC5B,QAAQ6B,MAAM,CAACnB,UAAU,EAAEoB,MAAM,CAACT,IAAIR,IAAI,EAAEkB,SAAS;QACtF;QAEA,qBAAqB;QACrB,IAAI/B,QAAQ6B,MAAM,CAAC,CAAC,EAAEnB,UAAU,EAAEV,QAAQgC,aAAa,CAAC,CAAC,CAAC,IAAIX,IAAIT,OAAO,CAACO,MAAM,GAAG,GAAG;YACpF,IAAI,CAACE,IAAIT,OAAO,CAAC,EAAE,CAACU,SAAS,EAAE;gBAC7BD,IAAIT,OAAO,GAAGS,IAAIT,OAAO,CAACqB,GAAG,CAAC,CAACC;oBAC7B,IAAI,OAAOA,UAAUR,YAAY,KAAK,YAAY;wBAChDQ,UAAUZ,SAAS,GAAGY,UAAUR,YAAY,CAACC;wBAC7C,OAAOO,UAAUR,YAAY;oBAC/B;oBACA,OAAOQ;gBACT;YACF;YACA,MAAMhC,GACH0B,MAAM,CAAC5B,QAAQ6B,MAAM,CAAC,CAAC,EAAEnB,UAAU,EAAEV,QAAQgC,aAAa,CAAC,CAAC,CAAC,EAC7DF,MAAM,CAACT,IAAIT,OAAO,EAClBmB,SAAS;QACd;QAEA,0DAA0D;QAC1D,IAAIV,IAAIpB,MAAM,CAACkB,MAAM,GAAG,GAAG;YACzB,MAAMpB,aAAa;gBACjBC;gBACAC,QAAQoB,IAAIpB,MAAM;gBAClBC;gBACAC,YAAYwB;YACd;QACF;IACF;AACF,EAAC"}
@@ -1,32 +0,0 @@
1
- import type { SQL } from 'drizzle-orm';
2
- import type { Field, PayloadRequestWithData } from 'payload';
3
- import type { DrizzleDB, GenericColumn, PostgresAdapter } from '../types.js';
4
- type BaseArgs = {
5
- adapter: PostgresAdapter;
6
- data: Record<string, unknown>;
7
- db: DrizzleDB;
8
- fields: Field[];
9
- /**
10
- * When true, skips reading the data back from the database and returns the input data
11
- * @default false
12
- */
13
- ignoreResult?: boolean;
14
- path?: string;
15
- req: PayloadRequestWithData;
16
- tableName: string;
17
- };
18
- type CreateArgs = BaseArgs & {
19
- id?: never;
20
- operation: 'create';
21
- upsertTarget?: never;
22
- where?: never;
23
- };
24
- type UpdateArgs = BaseArgs & {
25
- id?: number | string;
26
- operation: 'update';
27
- upsertTarget?: GenericColumn;
28
- where?: SQL<unknown>;
29
- };
30
- export type Args = CreateArgs | UpdateArgs;
31
- export {};
32
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/upsertRow/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE5E,KAAK,QAAQ,GAAG;IACd,OAAO,EAAE,eAAe,CAAA;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,EAAE,EAAE,SAAS,CAAA;IACb,MAAM,EAAE,KAAK,EAAE,CAAA;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,sBAAsB,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,KAAK,UAAU,GAAG,QAAQ,GAAG;IAC3B,EAAE,CAAC,EAAE,KAAK,CAAA;IACV,SAAS,EAAE,QAAQ,CAAA;IACnB,YAAY,CAAC,EAAE,KAAK,CAAA;IACpB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,KAAK,UAAU,GAAG,QAAQ,GAAG;IAC3B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,SAAS,EAAE,QAAQ,CAAA;IACnB,YAAY,CAAC,EAAE,aAAa,CAAA;IAC5B,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAA"}
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/upsertRow/types.ts"],"sourcesContent":["import type { SQL } from 'drizzle-orm'\nimport type { Field, PayloadRequestWithData } from 'payload'\n\nimport type { DrizzleDB, GenericColumn, PostgresAdapter } from '../types.js'\n\ntype BaseArgs = {\n adapter: PostgresAdapter\n data: Record<string, unknown>\n db: DrizzleDB\n fields: Field[]\n /**\n * When true, skips reading the data back from the database and returns the input data\n * @default false\n */\n ignoreResult?: boolean\n path?: string\n req: PayloadRequestWithData\n tableName: string\n}\n\ntype CreateArgs = BaseArgs & {\n id?: never\n operation: 'create'\n upsertTarget?: never\n where?: never\n}\n\ntype UpdateArgs = BaseArgs & {\n id?: number | string\n operation: 'update'\n upsertTarget?: GenericColumn\n where?: SQL<unknown>\n}\n\nexport type Args = CreateArgs | UpdateArgs\n"],"names":[],"rangeMappings":"","mappings":"AAkCA,WAA0C"}
@@ -1,2 +0,0 @@
1
- export declare const appendPrefixToObjectKeys: <T>(obj: Record<string, unknown>, prefix: string) => T;
2
- //# sourceMappingURL=appendPrefixToKeys.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"appendPrefixToKeys.d.ts","sourceRoot":"","sources":["../../src/utilities/appendPrefixToKeys.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,WAAY,OAAO,MAAM,EAAE,OAAO,CAAC,UAAU,MAAM,KAAG,CAI9E,CAAA"}
@@ -1,6 +0,0 @@
1
- export const appendPrefixToObjectKeys = (obj, prefix)=>Object.entries(obj).reduce((res, [key, val])=>{
2
- res[`${prefix}_${key}`] = val;
3
- return res;
4
- }, {});
5
-
6
- //# sourceMappingURL=appendPrefixToKeys.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/appendPrefixToKeys.ts"],"sourcesContent":["export const appendPrefixToObjectKeys = <T>(obj: Record<string, unknown>, prefix: string): T =>\n Object.entries(obj).reduce((res, [key, val]) => {\n res[`${prefix}_${key}`] = val\n return res\n }, {} as T)\n"],"names":["appendPrefixToObjectKeys","obj","prefix","Object","entries","reduce","res","key","val"],"rangeMappings":";;;","mappings":"AAAA,OAAO,MAAMA,2BAA2B,CAAIC,KAA8BC,SACxEC,OAAOC,OAAO,CAACH,KAAKI,MAAM,CAAC,CAACC,KAAK,CAACC,KAAKC,IAAI;QACzCF,GAAG,CAAC,CAAC,EAAEJ,OAAO,CAAC,EAAEK,IAAI,CAAC,CAAC,GAAGC;QAC1B,OAAOF;IACT,GAAG,CAAC,GAAO"}
@@ -1,5 +0,0 @@
1
- export type BlocksMap = {
2
- [path: string]: Record<string, unknown>[];
3
- };
4
- export declare const createBlocksMap: (data: Record<string, unknown>) => BlocksMap;
5
- //# sourceMappingURL=createBlocksMap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createBlocksMap.d.ts","sourceRoot":"","sources":["../../src/utilities/createBlocksMap.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;CAC1C,CAAA;AAED,eAAO,MAAM,eAAe,SAAU,OAAO,MAAM,EAAE,OAAO,CAAC,KAAG,SAmC/D,CAAA"}
@@ -1,29 +0,0 @@
1
- /* eslint-disable no-param-reassign */ export const createBlocksMap = (data)=>{
2
- const blocksMap = {};
3
- Object.entries(data).forEach(([key, rows])=>{
4
- if (key.startsWith('_blocks_') && Array.isArray(rows)) {
5
- const blockType = key.replace('_blocks_', '');
6
- rows.forEach((row)=>{
7
- if ('_path' in row) {
8
- if (!(row._path in blocksMap)) blocksMap[row._path] = [];
9
- row.blockType = blockType;
10
- blocksMap[row._path].push(row);
11
- delete row._path;
12
- }
13
- });
14
- delete data[key];
15
- }
16
- });
17
- Object.entries(blocksMap).reduce((sortedBlocksMap, [path, blocks])=>{
18
- sortedBlocksMap[path] = blocks.sort((a, b)=>{
19
- if (typeof a._order === 'number' && typeof b._order === 'number') {
20
- return a._order - b._order;
21
- }
22
- return 0;
23
- });
24
- return sortedBlocksMap;
25
- }, {});
26
- return blocksMap;
27
- };
28
-
29
- //# sourceMappingURL=createBlocksMap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/createBlocksMap.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nexport type BlocksMap = {\n [path: string]: Record<string, unknown>[]\n}\n\nexport const createBlocksMap = (data: Record<string, unknown>): BlocksMap => {\n const blocksMap: BlocksMap = {}\n\n Object.entries(data).forEach(([key, rows]) => {\n if (key.startsWith('_blocks_') && Array.isArray(rows)) {\n const blockType = key.replace('_blocks_', '')\n\n rows.forEach((row) => {\n if ('_path' in row) {\n if (!(row._path in blocksMap)) blocksMap[row._path] = []\n\n row.blockType = blockType\n blocksMap[row._path].push(row)\n\n delete row._path\n }\n })\n\n delete data[key]\n }\n })\n\n Object.entries(blocksMap).reduce((sortedBlocksMap, [path, blocks]) => {\n sortedBlocksMap[path] = blocks.sort((a, b) => {\n if (typeof a._order === 'number' && typeof b._order === 'number') {\n return a._order - b._order\n }\n\n return 0\n })\n\n return sortedBlocksMap\n }, {})\n\n return blocksMap\n}\n"],"names":["createBlocksMap","data","blocksMap","Object","entries","forEach","key","rows","startsWith","Array","isArray","blockType","replace","row","_path","push","reduce","sortedBlocksMap","path","blocks","sort","a","b","_order"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,oCAAoC,GAKpC,OAAO,MAAMA,kBAAkB,CAACC;IAC9B,MAAMC,YAAuB,CAAC;IAE9BC,OAAOC,OAAO,CAACH,MAAMI,OAAO,CAAC,CAAC,CAACC,KAAKC,KAAK;QACvC,IAAID,IAAIE,UAAU,CAAC,eAAeC,MAAMC,OAAO,CAACH,OAAO;YACrD,MAAMI,YAAYL,IAAIM,OAAO,CAAC,YAAY;YAE1CL,KAAKF,OAAO,CAAC,CAACQ;gBACZ,IAAI,WAAWA,KAAK;oBAClB,IAAI,CAAEA,CAAAA,IAAIC,KAAK,IAAIZ,SAAQ,GAAIA,SAAS,CAACW,IAAIC,KAAK,CAAC,GAAG,EAAE;oBAExDD,IAAIF,SAAS,GAAGA;oBAChBT,SAAS,CAACW,IAAIC,KAAK,CAAC,CAACC,IAAI,CAACF;oBAE1B,OAAOA,IAAIC,KAAK;gBAClB;YACF;YAEA,OAAOb,IAAI,CAACK,IAAI;QAClB;IACF;IAEAH,OAAOC,OAAO,CAACF,WAAWc,MAAM,CAAC,CAACC,iBAAiB,CAACC,MAAMC,OAAO;QAC/DF,eAAe,CAACC,KAAK,GAAGC,OAAOC,IAAI,CAAC,CAACC,GAAGC;YACtC,IAAI,OAAOD,EAAEE,MAAM,KAAK,YAAY,OAAOD,EAAEC,MAAM,KAAK,UAAU;gBAChE,OAAOF,EAAEE,MAAM,GAAGD,EAAEC,MAAM;YAC5B;YAEA,OAAO;QACT;QAEA,OAAON;IACT,GAAG,CAAC;IAEJ,OAAOf;AACT,EAAC"}
@@ -1,3 +0,0 @@
1
- import type { PostgresAdapter } from '../types.js';
2
- export declare const createMigrationTable: (adapter: PostgresAdapter) => Promise<void>;
3
- //# sourceMappingURL=createMigrationTable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createMigrationTable.d.ts","sourceRoot":"","sources":["../../src/utilities/createMigrationTable.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,eAAO,MAAM,oBAAoB,YAAmB,eAAe,KAAG,QAAQ,IAAI,CAYjF,CAAA"}
@@ -1,13 +0,0 @@
1
- import { sql } from 'drizzle-orm';
2
- export const createMigrationTable = async (adapter)=>{
3
- const prependSchema = adapter.schemaName ? `"${adapter.schemaName}".` : '';
4
- await adapter.drizzle.execute(sql.raw(`CREATE TABLE IF NOT EXISTS ${prependSchema}"payload_migrations" (
5
- "id" serial PRIMARY KEY NOT NULL,
6
- "name" varchar,
7
- "batch" numeric,
8
- "updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
9
- "created_at" timestamp(3) with time zone DEFAULT now() NOT NULL
10
- );`));
11
- };
12
-
13
- //# sourceMappingURL=createMigrationTable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/createMigrationTable.ts"],"sourcesContent":["import { sql } from 'drizzle-orm'\n\nimport type { PostgresAdapter } from '../types.js'\n\nexport const createMigrationTable = async (adapter: PostgresAdapter): Promise<void> => {\n const prependSchema = adapter.schemaName ? `\"${adapter.schemaName}\".` : ''\n\n await adapter.drizzle.execute(\n sql.raw(`CREATE TABLE IF NOT EXISTS ${prependSchema}\"payload_migrations\" (\n \"id\" serial PRIMARY KEY NOT NULL,\n \"name\" varchar,\n \"batch\" numeric,\n \"updated_at\" timestamp(3) with time zone DEFAULT now() NOT NULL,\n \"created_at\" timestamp(3) with time zone DEFAULT now() NOT NULL\n);`),\n )\n}\n"],"names":["sql","createMigrationTable","adapter","prependSchema","schemaName","drizzle","execute","raw"],"rangeMappings":";;;;;;;;;;","mappings":"AAAA,SAASA,GAAG,QAAQ,cAAa;AAIjC,OAAO,MAAMC,uBAAuB,OAAOC;IACzC,MAAMC,gBAAgBD,QAAQE,UAAU,GAAG,CAAC,CAAC,EAAEF,QAAQE,UAAU,CAAC,EAAE,CAAC,GAAG;IAExE,MAAMF,QAAQG,OAAO,CAACC,OAAO,CAC3BN,IAAIO,GAAG,CAAC,CAAC,2BAA2B,EAAEJ,cAAc;;;;;;EAMtD,CAAC;AAEH,EAAC"}
@@ -1,2 +0,0 @@
1
- export declare const createPathMap: (rows: unknown) => Record<string, Record<string, unknown>[]>;
2
- //# sourceMappingURL=createRelationshipMap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createRelationshipMap.d.ts","sourceRoot":"","sources":["../../src/utilities/createRelationshipMap.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,SAAU,OAAO,KAAG,OAAO,MAAM,EAAE,OAAO,MAAM,EAAE,OAAO,CAAC,EAAE,CAmBrF,CAAA"}
@@ -1,19 +0,0 @@
1
- // Flatten rows to object with path keys
2
- // for easier retrieval
3
- export const createPathMap = (rows)=>{
4
- let rowsByPath = {};
5
- if (Array.isArray(rows)) {
6
- rowsByPath = rows.reduce((res, row)=>{
7
- const formattedRow = {
8
- ...row
9
- };
10
- delete formattedRow.path;
11
- if (!res[row.path]) res[row.path] = [];
12
- res[row.path].push(row);
13
- return res;
14
- }, {});
15
- }
16
- return rowsByPath;
17
- };
18
-
19
- //# sourceMappingURL=createRelationshipMap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/createRelationshipMap.ts"],"sourcesContent":["// Flatten rows to object with path keys\n// for easier retrieval\nexport const createPathMap = (rows: unknown): Record<string, Record<string, unknown>[]> => {\n let rowsByPath = {}\n\n if (Array.isArray(rows)) {\n rowsByPath = rows.reduce((res, row) => {\n const formattedRow = {\n ...row,\n }\n\n delete formattedRow.path\n\n if (!res[row.path]) res[row.path] = []\n res[row.path].push(row)\n\n return res\n }, {})\n }\n\n return rowsByPath\n}\n"],"names":["createPathMap","rows","rowsByPath","Array","isArray","reduce","res","row","formattedRow","path","push"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAAA,wCAAwC;AACxC,uBAAuB;AACvB,OAAO,MAAMA,gBAAgB,CAACC;IAC5B,IAAIC,aAAa,CAAC;IAElB,IAAIC,MAAMC,OAAO,CAACH,OAAO;QACvBC,aAAaD,KAAKI,MAAM,CAAC,CAACC,KAAKC;YAC7B,MAAMC,eAAe;gBACnB,GAAGD,GAAG;YACR;YAEA,OAAOC,aAAaC,IAAI;YAExB,IAAI,CAACH,GAAG,CAACC,IAAIE,IAAI,CAAC,EAAEH,GAAG,CAACC,IAAIE,IAAI,CAAC,GAAG,EAAE;YACtCH,GAAG,CAACC,IAAIE,IAAI,CAAC,CAACC,IAAI,CAACH;YAEnB,OAAOD;QACT,GAAG,CAAC;IACN;IAEA,OAAOJ;AACT,EAAC"}
@@ -1,3 +0,0 @@
1
- import type { Field } from 'payload';
2
- export declare const hasLocalesTable: (fields: Field[]) => boolean;
3
- //# sourceMappingURL=hasLocalesTable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hasLocalesTable.d.ts","sourceRoot":"","sources":["../../src/utilities/hasLocalesTable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAIpC,eAAO,MAAM,eAAe,WAAY,KAAK,EAAE,KAAG,OAOjD,CAAA"}
@@ -1,11 +0,0 @@
1
- import { fieldAffectsData, fieldHasSubFields } from 'payload/shared';
2
- export const hasLocalesTable = (fields)=>{
3
- return fields.some((field)=>{
4
- if (fieldAffectsData(field) && field.localized) return true;
5
- if (fieldHasSubFields(field) && field.type !== 'array') return hasLocalesTable(field.fields);
6
- if (field.type === 'tabs') return field.tabs.some((tab)=>hasLocalesTable(tab.fields));
7
- return false;
8
- });
9
- };
10
-
11
- //# sourceMappingURL=hasLocalesTable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/hasLocalesTable.ts"],"sourcesContent":["import type { Field } from 'payload'\n\nimport { fieldAffectsData, fieldHasSubFields } from 'payload/shared'\n\nexport const hasLocalesTable = (fields: Field[]): boolean => {\n return fields.some((field) => {\n if (fieldAffectsData(field) && field.localized) return true\n if (fieldHasSubFields(field) && field.type !== 'array') return hasLocalesTable(field.fields)\n if (field.type === 'tabs') return field.tabs.some((tab) => hasLocalesTable(tab.fields))\n return false\n })\n}\n"],"names":["fieldAffectsData","fieldHasSubFields","hasLocalesTable","fields","some","field","localized","type","tabs","tab"],"rangeMappings":";;;;;;;;","mappings":"AAEA,SAASA,gBAAgB,EAAEC,iBAAiB,QAAQ,iBAAgB;AAEpE,OAAO,MAAMC,kBAAkB,CAACC;IAC9B,OAAOA,OAAOC,IAAI,CAAC,CAACC;QAClB,IAAIL,iBAAiBK,UAAUA,MAAMC,SAAS,EAAE,OAAO;QACvD,IAAIL,kBAAkBI,UAAUA,MAAME,IAAI,KAAK,SAAS,OAAOL,gBAAgBG,MAAMF,MAAM;QAC3F,IAAIE,MAAME,IAAI,KAAK,QAAQ,OAAOF,MAAMG,IAAI,CAACJ,IAAI,CAAC,CAACK,MAAQP,gBAAgBO,IAAIN,MAAM;QACrF,OAAO;IACT;AACF,EAAC"}
@@ -1,2 +0,0 @@
1
- export declare function isArrayOfRows(data: unknown): data is Record<string, unknown>[];
2
- //# sourceMappingURL=isArrayOfRows.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isArrayOfRows.d.ts","sourceRoot":"","sources":["../../src/utilities/isArrayOfRows.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAE9E"}
@@ -1,5 +0,0 @@
1
- export function isArrayOfRows(data) {
2
- return Array.isArray(data);
3
- }
4
-
5
- //# sourceMappingURL=isArrayOfRows.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/isArrayOfRows.ts"],"sourcesContent":["export function isArrayOfRows(data: unknown): data is Record<string, unknown>[] {\n return Array.isArray(data)\n}\n"],"names":["isArrayOfRows","data","Array","isArray"],"rangeMappings":";;","mappings":"AAAA,OAAO,SAASA,cAAcC,IAAa;IACzC,OAAOC,MAAMC,OAAO,CAACF;AACvB"}
@@ -1,3 +0,0 @@
1
- import type { DrizzleDB } from '../types.js';
2
- export declare const migrationTableExists: (db: DrizzleDB) => Promise<boolean>;
3
- //# sourceMappingURL=migrationTableExists.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migrationTableExists.d.ts","sourceRoot":"","sources":["../../src/utilities/migrationTableExists.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,eAAO,MAAM,oBAAoB,qBAA0B,QAAQ,OAAO,CAMzE,CAAA"}
@@ -1,9 +0,0 @@
1
- import { sql } from 'drizzle-orm';
2
- export const migrationTableExists = async (db)=>{
3
- const queryRes = await db.execute(sql`SELECT to_regclass('public.payload_migrations');`);
4
- // Returns table name 'payload_migrations' or null
5
- const exists = queryRes.rows?.[0]?.to_regclass === 'payload_migrations';
6
- return exists;
7
- };
8
-
9
- //# sourceMappingURL=migrationTableExists.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/migrationTableExists.ts"],"sourcesContent":["import { sql } from 'drizzle-orm'\n\nimport type { DrizzleDB } from '../types.js'\n\nexport const migrationTableExists = async (db: DrizzleDB): Promise<boolean> => {\n const queryRes = await db.execute(sql`SELECT to_regclass('public.payload_migrations');`)\n\n // Returns table name 'payload_migrations' or null\n const exists = queryRes.rows?.[0]?.to_regclass === 'payload_migrations'\n return exists\n}\n"],"names":["sql","migrationTableExists","db","queryRes","execute","exists","rows","to_regclass"],"rangeMappings":";;;;;;","mappings":"AAAA,SAASA,GAAG,QAAQ,cAAa;AAIjC,OAAO,MAAMC,uBAAuB,OAAOC;IACzC,MAAMC,WAAW,MAAMD,GAAGE,OAAO,CAACJ,GAAG,CAAC,gDAAgD,CAAC;IAEvF,kDAAkD;IAClD,MAAMK,SAASF,SAASG,IAAI,EAAE,CAAC,EAAE,EAAEC,gBAAgB;IACnD,OAAOF;AACT,EAAC"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Format error message with hint if available
3
- */
4
- export declare const parseError: (err: unknown, msg: string) => string;
5
- //# sourceMappingURL=parseError.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseError.d.ts","sourceRoot":"","sources":["../../src/utilities/parseError.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,UAAU,QAAS,OAAO,OAAO,MAAM,KAAG,MAUtD,CAAA"}
@@ -1,17 +0,0 @@
1
- import pg from 'pg';
2
- const { DatabaseError } = pg;
3
- /**
4
- * Format error message with hint if available
5
- */ export const parseError = (err, msg)=>{
6
- let formattedMsg = `${msg}`;
7
- if (err instanceof Error) {
8
- formattedMsg += ` ${err.message}.`;
9
- if (err instanceof DatabaseError) {
10
- msg += `: ${err.message}`;
11
- if (err.hint) msg += ` ${err.hint}.`;
12
- }
13
- }
14
- return formattedMsg;
15
- };
16
-
17
- //# sourceMappingURL=parseError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/parseError.ts"],"sourcesContent":["import pg from 'pg'\nconst { DatabaseError } = pg\n\n/**\n * Format error message with hint if available\n */\nexport const parseError = (err: unknown, msg: string): string => {\n let formattedMsg = `${msg}`\n if (err instanceof Error) {\n formattedMsg += ` ${err.message}.`\n if (err instanceof DatabaseError) {\n msg += `: ${err.message}`\n if (err.hint) msg += ` ${err.hint}.`\n }\n }\n return formattedMsg\n}\n"],"names":["pg","DatabaseError","parseError","err","msg","formattedMsg","Error","message","hint"],"rangeMappings":";;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,MAAM,EAAEC,aAAa,EAAE,GAAGD;AAE1B;;CAEC,GACD,OAAO,MAAME,aAAa,CAACC,KAAcC;IACvC,IAAIC,eAAe,CAAC,EAAED,IAAI,CAAC;IAC3B,IAAID,eAAeG,OAAO;QACxBD,gBAAgB,CAAC,CAAC,EAAEF,IAAII,OAAO,CAAC,CAAC,CAAC;QAClC,IAAIJ,eAAeF,eAAe;YAChCG,OAAO,CAAC,EAAE,EAAED,IAAII,OAAO,CAAC,CAAC;YACzB,IAAIJ,IAAIK,IAAI,EAAEJ,OAAO,CAAC,CAAC,EAAED,IAAIK,IAAI,CAAC,CAAC,CAAC;QACtC;IACF;IACA,OAAOH;AACT,EAAC"}
@@ -1,9 +0,0 @@
1
- import type { PostgresAdapter } from '../types.js';
2
- /**
3
- * Pushes the development schema to the database using Drizzle.
4
- *
5
- * @param {PostgresAdapter} db - The PostgresAdapter instance connected to the database.
6
- * @returns {Promise<void>} - A promise that resolves once the schema push is complete.
7
- */
8
- export declare const pushDevSchema: (db: PostgresAdapter) => Promise<void>;
9
- //# sourceMappingURL=pushDevSchema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pushDevSchema.d.ts","sourceRoot":"","sources":["../../src/utilities/pushDevSchema.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAIlD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,OAAc,eAAe,kBAgEtD,CAAA"}
@@ -1,58 +0,0 @@
1
- import { eq } from 'drizzle-orm';
2
- import { numeric, timestamp, varchar } from 'drizzle-orm/pg-core';
3
- import { createRequire } from 'module';
4
- import prompts from 'prompts';
5
- const require = createRequire(import.meta.url);
6
- /**
7
- * Pushes the development schema to the database using Drizzle.
8
- *
9
- * @param {PostgresAdapter} db - The PostgresAdapter instance connected to the database.
10
- * @returns {Promise<void>} - A promise that resolves once the schema push is complete.
11
- */ export const pushDevSchema = async (db)=>{
12
- const { pushSchema } = require('drizzle-kit/payload');
13
- // This will prompt if clarifications are needed for Drizzle to push new schema
14
- const { apply, hasDataLoss, warnings } = await pushSchema(db.schema, db.drizzle);
15
- if (warnings.length) {
16
- let message = `Warnings detected during schema push: \n\n${warnings.join('\n')}\n\n`;
17
- if (hasDataLoss) {
18
- message += `DATA LOSS WARNING: Possible data loss detected if schema is pushed.\n\n`;
19
- }
20
- message += `Accept warnings and push schema to database?`;
21
- const { confirm: acceptWarnings } = await prompts({
22
- name: 'confirm',
23
- type: 'confirm',
24
- initial: false,
25
- message
26
- }, {
27
- onCancel: ()=>{
28
- process.exit(0);
29
- }
30
- });
31
- // Exit if user does not accept warnings.
32
- // Q: Is this the right type of exit for this interaction?
33
- if (!acceptWarnings) {
34
- process.exit(0);
35
- }
36
- }
37
- await apply();
38
- // Migration table def in order to use query using drizzle
39
- const migrationsSchema = db.pgSchema.table('payload_migrations', {
40
- name: varchar('name'),
41
- batch: numeric('batch'),
42
- created_at: timestamp('created_at'),
43
- updated_at: timestamp('updated_at')
44
- });
45
- const devPush = await db.drizzle.select().from(migrationsSchema).where(eq(migrationsSchema.batch, '-1'));
46
- if (!devPush.length) {
47
- await db.drizzle.insert(migrationsSchema).values({
48
- name: 'dev',
49
- batch: '-1'
50
- });
51
- } else {
52
- await db.drizzle.update(migrationsSchema).set({
53
- updated_at: new Date()
54
- }).where(eq(migrationsSchema.batch, '-1'));
55
- }
56
- };
57
-
58
- //# sourceMappingURL=pushDevSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/pushDevSchema.ts"],"sourcesContent":["import { eq } from 'drizzle-orm'\nimport { numeric, timestamp, varchar } from 'drizzle-orm/pg-core'\nimport { createRequire } from 'module'\nimport prompts from 'prompts'\n\nimport type { PostgresAdapter } from '../types.js'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Pushes the development schema to the database using Drizzle.\n *\n * @param {PostgresAdapter} db - The PostgresAdapter instance connected to the database.\n * @returns {Promise<void>} - A promise that resolves once the schema push is complete.\n */\nexport const pushDevSchema = async (db: PostgresAdapter) => {\n const { pushSchema } = require('drizzle-kit/payload')\n\n // This will prompt if clarifications are needed for Drizzle to push new schema\n const { apply, hasDataLoss, warnings } = await pushSchema(db.schema, db.drizzle)\n\n if (warnings.length) {\n let message = `Warnings detected during schema push: \\n\\n${warnings.join('\\n')}\\n\\n`\n\n if (hasDataLoss) {\n message += `DATA LOSS WARNING: Possible data loss detected if schema is pushed.\\n\\n`\n }\n\n message += `Accept warnings and push schema to database?`\n\n const { confirm: acceptWarnings } = await prompts(\n {\n name: 'confirm',\n type: 'confirm',\n initial: false,\n message,\n },\n {\n onCancel: () => {\n process.exit(0)\n },\n },\n )\n\n // Exit if user does not accept warnings.\n // Q: Is this the right type of exit for this interaction?\n if (!acceptWarnings) {\n process.exit(0)\n }\n }\n\n await apply()\n\n // Migration table def in order to use query using drizzle\n const migrationsSchema = db.pgSchema.table('payload_migrations', {\n name: varchar('name'),\n batch: numeric('batch'),\n created_at: timestamp('created_at'),\n updated_at: timestamp('updated_at'),\n })\n\n const devPush = await db.drizzle\n .select()\n .from(migrationsSchema)\n .where(eq(migrationsSchema.batch, '-1'))\n\n if (!devPush.length) {\n await db.drizzle.insert(migrationsSchema).values({\n name: 'dev',\n batch: '-1',\n })\n } else {\n await db.drizzle\n .update(migrationsSchema)\n .set({\n updated_at: new Date(),\n })\n .where(eq(migrationsSchema.batch, '-1'))\n }\n}\n"],"names":["eq","numeric","timestamp","varchar","createRequire","prompts","require","url","pushDevSchema","db","pushSchema","apply","hasDataLoss","warnings","schema","drizzle","length","message","join","confirm","acceptWarnings","name","type","initial","onCancel","process","exit","migrationsSchema","pgSchema","table","batch","created_at","updated_at","devPush","select","from","where","insert","values","update","set","Date"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,EAAE,QAAQ,cAAa;AAChC,SAASC,OAAO,EAAEC,SAAS,EAAEC,OAAO,QAAQ,sBAAqB;AACjE,SAASC,aAAa,QAAQ,SAAQ;AACtC,OAAOC,aAAa,UAAS;AAI7B,MAAMC,UAAUF,cAAc,YAAYG,GAAG;AAE7C;;;;;CAKC,GACD,OAAO,MAAMC,gBAAgB,OAAOC;IAClC,MAAM,EAAEC,UAAU,EAAE,GAAGJ,QAAQ;IAE/B,+EAA+E;IAC/E,MAAM,EAAEK,KAAK,EAAEC,WAAW,EAAEC,QAAQ,EAAE,GAAG,MAAMH,WAAWD,GAAGK,MAAM,EAAEL,GAAGM,OAAO;IAE/E,IAAIF,SAASG,MAAM,EAAE;QACnB,IAAIC,UAAU,CAAC,0CAA0C,EAAEJ,SAASK,IAAI,CAAC,MAAM,IAAI,CAAC;QAEpF,IAAIN,aAAa;YACfK,WAAW,CAAC,uEAAuE,CAAC;QACtF;QAEAA,WAAW,CAAC,4CAA4C,CAAC;QAEzD,MAAM,EAAEE,SAASC,cAAc,EAAE,GAAG,MAAMf,QACxC;YACEgB,MAAM;YACNC,MAAM;YACNC,SAAS;YACTN;QACF,GACA;YACEO,UAAU;gBACRC,QAAQC,IAAI,CAAC;YACf;QACF;QAGF,yCAAyC;QACzC,0DAA0D;QAC1D,IAAI,CAACN,gBAAgB;YACnBK,QAAQC,IAAI,CAAC;QACf;IACF;IAEA,MAAMf;IAEN,0DAA0D;IAC1D,MAAMgB,mBAAmBlB,GAAGmB,QAAQ,CAACC,KAAK,CAAC,sBAAsB;QAC/DR,MAAMlB,QAAQ;QACd2B,OAAO7B,QAAQ;QACf8B,YAAY7B,UAAU;QACtB8B,YAAY9B,UAAU;IACxB;IAEA,MAAM+B,UAAU,MAAMxB,GAAGM,OAAO,CAC7BmB,MAAM,GACNC,IAAI,CAACR,kBACLS,KAAK,CAACpC,GAAG2B,iBAAiBG,KAAK,EAAE;IAEpC,IAAI,CAACG,QAAQjB,MAAM,EAAE;QACnB,MAAMP,GAAGM,OAAO,CAACsB,MAAM,CAACV,kBAAkBW,MAAM,CAAC;YAC/CjB,MAAM;YACNS,OAAO;QACT;IACF,OAAO;QACL,MAAMrB,GAAGM,OAAO,CACbwB,MAAM,CAACZ,kBACPa,GAAG,CAAC;YACHR,YAAY,IAAIS;QAClB,GACCL,KAAK,CAACpC,GAAG2B,iBAAiBG,KAAK,EAAE;IACtC;AACF,EAAC"}