@payloadcms/db-postgres 0.1.0-beta.0 → 0.1.0-beta.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. package/dist/connect.d.ts +3 -0
  2. package/dist/connect.d.ts.map +1 -0
  3. package/dist/connect.js +12 -12
  4. package/dist/create.d.ts +3 -0
  5. package/dist/create.d.ts.map +1 -0
  6. package/dist/create.js +2 -2
  7. package/dist/createGlobal.d.ts +5 -0
  8. package/dist/createGlobal.d.ts.map +1 -0
  9. package/dist/createGlobal.js +2 -2
  10. package/dist/createGlobalVersion.d.ts +6 -0
  11. package/dist/createGlobalVersion.d.ts.map +1 -0
  12. package/dist/createGlobalVersion.js +2 -2
  13. package/dist/createMigration.d.ts +3 -0
  14. package/dist/createMigration.d.ts.map +1 -0
  15. package/dist/createMigration.js +6 -6
  16. package/dist/createVersion.d.ts +5 -0
  17. package/dist/createVersion.d.ts.map +1 -0
  18. package/dist/createVersion.js +2 -2
  19. package/dist/deleteMany.d.ts +3 -0
  20. package/dist/deleteMany.d.ts.map +1 -0
  21. package/dist/deleteMany.js +2 -3
  22. package/dist/deleteOne.d.ts +3 -0
  23. package/dist/deleteOne.d.ts.map +1 -0
  24. package/dist/deleteOne.js +2 -2
  25. package/dist/deleteVersions.d.ts +3 -0
  26. package/dist/deleteVersions.d.ts.map +1 -0
  27. package/dist/deleteVersions.js +2 -2
  28. package/dist/destroy.d.ts +3 -0
  29. package/dist/destroy.d.ts.map +1 -0
  30. package/dist/extendViteConfig.d.ts +4 -0
  31. package/dist/extendViteConfig.d.ts.map +1 -0
  32. package/dist/extendViteConfig.js +38 -0
  33. package/dist/extendWebpackConfig.d.ts +4 -0
  34. package/dist/extendWebpackConfig.d.ts.map +1 -0
  35. package/dist/extendWebpackConfig.js +45 -0
  36. package/dist/find/buildFindManyArgs.d.ts +13 -0
  37. package/dist/find/buildFindManyArgs.d.ts.map +1 -0
  38. package/dist/find/chainMethods.d.ts +15 -0
  39. package/dist/find/chainMethods.d.ts.map +1 -0
  40. package/dist/find/findMany.d.ts +22 -0
  41. package/dist/find/findMany.d.ts.map +1 -0
  42. package/dist/find/findMany.js +2 -2
  43. package/dist/find/traverseFields.d.ts +16 -0
  44. package/dist/find/traverseFields.d.ts.map +1 -0
  45. package/dist/find.d.ts +3 -0
  46. package/dist/find.d.ts.map +1 -0
  47. package/dist/findGlobal.d.ts +3 -0
  48. package/dist/findGlobal.d.ts.map +1 -0
  49. package/dist/findGlobalVersions.d.ts +3 -0
  50. package/dist/findGlobalVersions.d.ts.map +1 -0
  51. package/dist/findOne.d.ts +5 -0
  52. package/dist/findOne.d.ts.map +1 -0
  53. package/dist/findOne.js +2 -2
  54. package/dist/findVersions.d.ts +3 -0
  55. package/dist/findVersions.d.ts.map +1 -0
  56. package/dist/index.d.ts +4 -0
  57. package/dist/index.d.ts.map +1 -0
  58. package/dist/index.js +8 -6
  59. package/dist/init.d.ts +3 -0
  60. package/dist/init.d.ts.map +1 -0
  61. package/dist/init.js +3 -4
  62. package/dist/migrate.d.ts +3 -0
  63. package/dist/migrate.d.ts.map +1 -0
  64. package/dist/migrate.js +4 -5
  65. package/dist/migrateStatus.d.ts +3 -0
  66. package/dist/migrateStatus.d.ts.map +1 -0
  67. package/dist/migrateStatus.js +2 -2
  68. package/dist/queries/buildAndOrConditions.d.ts +17 -0
  69. package/dist/queries/buildAndOrConditions.d.ts.map +1 -0
  70. package/dist/queries/buildQuery.d.ts +30 -0
  71. package/dist/queries/buildQuery.d.ts.map +1 -0
  72. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts +2 -0
  73. package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts.map +1 -0
  74. package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts +2 -0
  75. package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts.map +1 -0
  76. package/dist/queries/createJSONQuery/index.d.ts +10 -0
  77. package/dist/queries/createJSONQuery/index.d.ts.map +1 -0
  78. package/dist/queries/getTableColumnFromPath.d.ts +40 -0
  79. package/dist/queries/getTableColumnFromPath.d.ts.map +1 -0
  80. package/dist/queries/operatorMap.d.ts +18 -0
  81. package/dist/queries/operatorMap.d.ts.map +1 -0
  82. package/dist/queries/parseParams.d.ts +17 -0
  83. package/dist/queries/parseParams.d.ts.map +1 -0
  84. package/dist/queries/parseParams.js +1 -1
  85. package/dist/queries/sanitizeQueryValue.d.ts +12 -0
  86. package/dist/queries/sanitizeQueryValue.d.ts.map +1 -0
  87. package/dist/queryDrafts.d.ts +3 -0
  88. package/dist/queryDrafts.d.ts.map +1 -0
  89. package/dist/reference.d.ts +2 -0
  90. package/dist/reference.d.ts.map +1 -0
  91. package/dist/schema/build.d.ts +23 -0
  92. package/dist/schema/build.d.ts.map +1 -0
  93. package/dist/schema/build.js +6 -5
  94. package/dist/schema/createIndex.d.ts +11 -0
  95. package/dist/schema/createIndex.d.ts.map +1 -0
  96. package/dist/schema/createIndex.js +12 -3
  97. package/dist/schema/parentIDColumnMap.d.ts +7 -0
  98. package/dist/schema/parentIDColumnMap.d.ts.map +1 -0
  99. package/dist/schema/traverseFields.d.ts +33 -0
  100. package/dist/schema/traverseFields.d.ts.map +1 -0
  101. package/dist/schema/traverseFields.js +25 -9
  102. package/dist/schema/validateExistingBlockIsIdentical.d.ts +11 -0
  103. package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +1 -0
  104. package/dist/transactions/beginTransaction.d.ts +3 -0
  105. package/dist/transactions/beginTransaction.d.ts.map +1 -0
  106. package/dist/transactions/beginTransaction.js +2 -2
  107. package/dist/transactions/commitTransaction.d.ts +3 -0
  108. package/dist/transactions/commitTransaction.d.ts.map +1 -0
  109. package/dist/transactions/rollbackTransaction.d.ts +3 -0
  110. package/dist/transactions/rollbackTransaction.d.ts.map +1 -0
  111. package/dist/transform/read/hasManyNumber.d.ts +10 -0
  112. package/dist/transform/read/hasManyNumber.d.ts.map +1 -0
  113. package/dist/transform/read/index.d.ts +12 -0
  114. package/dist/transform/read/index.d.ts.map +1 -0
  115. package/dist/transform/read/relationship.d.ts +10 -0
  116. package/dist/transform/read/relationship.d.ts.map +1 -0
  117. package/dist/transform/read/traverseFields.d.ts +44 -0
  118. package/dist/transform/read/traverseFields.d.ts.map +1 -0
  119. package/dist/transform/write/array.d.ts +22 -0
  120. package/dist/transform/write/array.d.ts.map +1 -0
  121. package/dist/transform/write/blocks.d.ts +21 -0
  122. package/dist/transform/write/blocks.d.ts.map +1 -0
  123. package/dist/transform/write/index.d.ts +11 -0
  124. package/dist/transform/write/index.d.ts.map +1 -0
  125. package/dist/transform/write/numbers.d.ts +8 -0
  126. package/dist/transform/write/numbers.d.ts.map +1 -0
  127. package/dist/transform/write/relationships.d.ts +10 -0
  128. package/dist/transform/write/relationships.d.ts.map +1 -0
  129. package/dist/transform/write/selects.d.ts +7 -0
  130. package/dist/transform/write/selects.d.ts.map +1 -0
  131. package/dist/transform/write/traverseFields.d.ts +46 -0
  132. package/dist/transform/write/traverseFields.d.ts.map +1 -0
  133. package/dist/transform/write/types.d.ts +41 -0
  134. package/dist/transform/write/types.d.ts.map +1 -0
  135. package/dist/types.d.ts +67 -0
  136. package/dist/types.d.ts.map +1 -0
  137. package/dist/update.d.ts +3 -0
  138. package/dist/update.d.ts.map +1 -0
  139. package/dist/update.js +2 -2
  140. package/dist/updateGlobal.d.ts +5 -0
  141. package/dist/updateGlobal.d.ts.map +1 -0
  142. package/dist/updateGlobal.js +2 -2
  143. package/dist/updateGlobalVersion.d.ts +6 -0
  144. package/dist/updateGlobalVersion.d.ts.map +1 -0
  145. package/dist/updateGlobalVersion.js +2 -2
  146. package/dist/updateVersion.d.ts +5 -0
  147. package/dist/updateVersion.d.ts.map +1 -0
  148. package/dist/updateVersion.js +2 -2
  149. package/dist/upsertRow/deleteExistingArrayRows.d.ts +10 -0
  150. package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +1 -0
  151. package/dist/upsertRow/deleteExistingRowsByPath.d.ts +14 -0
  152. package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +1 -0
  153. package/dist/upsertRow/index.d.ts +4 -0
  154. package/dist/upsertRow/index.d.ts.map +1 -0
  155. package/dist/upsertRow/insertArrays.d.ts +13 -0
  156. package/dist/upsertRow/insertArrays.d.ts.map +1 -0
  157. package/dist/upsertRow/types.d.ts +26 -0
  158. package/dist/upsertRow/types.d.ts.map +1 -0
  159. package/dist/utilities/appendPrefixToKeys.d.ts +2 -0
  160. package/dist/utilities/appendPrefixToKeys.d.ts.map +1 -0
  161. package/dist/utilities/createBlocksMap.d.ts +5 -0
  162. package/dist/utilities/createBlocksMap.d.ts.map +1 -0
  163. package/dist/utilities/createMigrationTable.d.ts +3 -0
  164. package/dist/utilities/createMigrationTable.d.ts.map +1 -0
  165. package/dist/utilities/createRelationshipMap.d.ts +2 -0
  166. package/dist/utilities/createRelationshipMap.d.ts.map +1 -0
  167. package/dist/utilities/hasLocalesTable.d.ts +3 -0
  168. package/dist/utilities/hasLocalesTable.d.ts.map +1 -0
  169. package/dist/utilities/isArrayOfRows.d.ts +2 -0
  170. package/dist/utilities/isArrayOfRows.d.ts.map +1 -0
  171. package/dist/utilities/migrationTableExists.d.ts +3 -0
  172. package/dist/utilities/migrationTableExists.d.ts.map +1 -0
  173. package/mock.js +1 -0
  174. package/package.json +16 -17
  175. package/src/index.ts +93 -0
  176. package/dist/mock.js +0 -13
  177. package/dist/webpack.js +0 -30
package/src/index.ts ADDED
@@ -0,0 +1,93 @@
1
+ import type { Payload } from 'payload'
2
+
3
+ import path from 'path'
4
+ import { createDatabaseAdapter } from 'payload/database'
5
+
6
+ import type { Args, PostgresAdapter, PostgresAdapterResult } from './types'
7
+
8
+ export type { MigrateDownArgs, MigrateUpArgs } from './types'
9
+
10
+ import { connect } from './connect'
11
+ import { create } from './create'
12
+ import { createGlobal } from './createGlobal'
13
+ import { createGlobalVersion } from './createGlobalVersion'
14
+ import { createMigration } from './createMigration'
15
+ import { createVersion } from './createVersion'
16
+ import { deleteMany } from './deleteMany'
17
+ import { deleteOne } from './deleteOne'
18
+ import { deleteVersions } from './deleteVersions'
19
+ import { destroy } from './destroy'
20
+ import { extendViteConfig } from './extendViteConfig'
21
+ import { extendWebpackConfig } from './extendWebpackConfig'
22
+ import { find } from './find'
23
+ import { findGlobal } from './findGlobal'
24
+ import { findGlobalVersions } from './findGlobalVersions'
25
+ import { findOne } from './findOne'
26
+ import { findVersions } from './findVersions'
27
+ import { init } from './init'
28
+ import { migrate } from './migrate'
29
+ import { migrateStatus } from './migrateStatus'
30
+ import { queryDrafts } from './queryDrafts'
31
+ import { beginTransaction } from './transactions/beginTransaction'
32
+ import { commitTransaction } from './transactions/commitTransaction'
33
+ import { rollbackTransaction } from './transactions/rollbackTransaction'
34
+ import { updateOne } from './update'
35
+ import { updateGlobal } from './updateGlobal'
36
+ import { updateGlobalVersion } from './updateGlobalVersion'
37
+ import { updateVersion } from './updateVersion'
38
+
39
+ export function postgresAdapter(args: Args): PostgresAdapterResult {
40
+ function adapter({ payload }: { payload: Payload }) {
41
+ const migrationDir = args.migrationDir || path.resolve(process.cwd(), 'src/migrations')
42
+
43
+ extendWebpackConfig(payload.config)
44
+ extendViteConfig(payload.config)
45
+
46
+ return createDatabaseAdapter<PostgresAdapter>({
47
+ ...args,
48
+ name: 'postgres',
49
+
50
+ // Postgres-specific
51
+ drizzle: undefined,
52
+ enums: {},
53
+ pool: undefined,
54
+ relations: {},
55
+ schema: {},
56
+ sessions: {},
57
+ tables: {},
58
+
59
+ // DatabaseAdapter
60
+ beginTransaction,
61
+ commitTransaction,
62
+ connect,
63
+ create,
64
+ createGlobal,
65
+ createGlobalVersion,
66
+ createMigration,
67
+ createVersion,
68
+ defaultIDType: 'number',
69
+ deleteMany,
70
+ deleteOne,
71
+ deleteVersions,
72
+ destroy,
73
+ find,
74
+ findGlobal,
75
+ findGlobalVersions,
76
+ findOne,
77
+ findVersions,
78
+ init,
79
+ migrate,
80
+ migrateStatus,
81
+ migrationDir,
82
+ payload,
83
+ queryDrafts,
84
+ rollbackTransaction,
85
+ updateGlobal,
86
+ updateGlobalVersion,
87
+ updateOne,
88
+ updateVersion,
89
+ })
90
+ }
91
+
92
+ return adapter
93
+ }
package/dist/mock.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "postgresAdapter", {
6
- enumerable: true,
7
- get: function() {
8
- return postgresAdapter;
9
- }
10
- });
11
- const postgresAdapter = ()=>({});
12
-
13
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9tb2NrLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBwb3N0Z3Jlc0FkYXB0ZXIgPSAoKSA9PiAoe30pXG4iXSwibmFtZXMiOlsicG9zdGdyZXNBZGFwdGVyIl0sIm1hcHBpbmdzIjoiOzs7OytCQUFhQTs7O2VBQUFBOzs7QUFBTixNQUFNQSxrQkFBa0IsSUFBTyxDQUFBLENBQUMsQ0FBQSJ9
package/dist/webpack.js DELETED
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "webpack", {
6
- enumerable: true,
7
- get: function() {
8
- return webpack;
9
- }
10
- });
11
- const _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
- function _interop_require_default(obj) {
13
- return obj && obj.__esModule ? obj : {
14
- default: obj
15
- };
16
- }
17
- const webpack = (config)=>{
18
- return {
19
- ...config,
20
- resolve: {
21
- ...config.resolve || {},
22
- alias: {
23
- ...config.resolve?.alias || {},
24
- [_path.default.resolve(__dirname, './index')]: _path.default.resolve(__dirname, 'mock.js')
25
- }
26
- }
27
- };
28
- };
29
-
30
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy93ZWJwYWNrLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHs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