@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.
- package/dist/connect.d.ts +3 -0
- package/dist/connect.d.ts.map +1 -0
- package/dist/connect.js +12 -12
- package/dist/create.d.ts +3 -0
- package/dist/create.d.ts.map +1 -0
- package/dist/create.js +2 -2
- package/dist/createGlobal.d.ts +5 -0
- package/dist/createGlobal.d.ts.map +1 -0
- package/dist/createGlobal.js +2 -2
- package/dist/createGlobalVersion.d.ts +6 -0
- package/dist/createGlobalVersion.d.ts.map +1 -0
- package/dist/createGlobalVersion.js +2 -2
- package/dist/createMigration.d.ts +3 -0
- package/dist/createMigration.d.ts.map +1 -0
- package/dist/createMigration.js +6 -6
- package/dist/createVersion.d.ts +5 -0
- package/dist/createVersion.d.ts.map +1 -0
- package/dist/createVersion.js +2 -2
- package/dist/deleteMany.d.ts +3 -0
- package/dist/deleteMany.d.ts.map +1 -0
- package/dist/deleteMany.js +2 -3
- package/dist/deleteOne.d.ts +3 -0
- package/dist/deleteOne.d.ts.map +1 -0
- package/dist/deleteOne.js +2 -2
- package/dist/deleteVersions.d.ts +3 -0
- package/dist/deleteVersions.d.ts.map +1 -0
- package/dist/deleteVersions.js +2 -2
- package/dist/destroy.d.ts +3 -0
- package/dist/destroy.d.ts.map +1 -0
- package/dist/extendViteConfig.d.ts +4 -0
- package/dist/extendViteConfig.d.ts.map +1 -0
- package/dist/extendViteConfig.js +38 -0
- package/dist/extendWebpackConfig.d.ts +4 -0
- package/dist/extendWebpackConfig.d.ts.map +1 -0
- package/dist/extendWebpackConfig.js +45 -0
- package/dist/find/buildFindManyArgs.d.ts +13 -0
- package/dist/find/buildFindManyArgs.d.ts.map +1 -0
- package/dist/find/chainMethods.d.ts +15 -0
- package/dist/find/chainMethods.d.ts.map +1 -0
- package/dist/find/findMany.d.ts +22 -0
- package/dist/find/findMany.d.ts.map +1 -0
- package/dist/find/findMany.js +2 -2
- package/dist/find/traverseFields.d.ts +16 -0
- package/dist/find/traverseFields.d.ts.map +1 -0
- package/dist/find.d.ts +3 -0
- package/dist/find.d.ts.map +1 -0
- package/dist/findGlobal.d.ts +3 -0
- package/dist/findGlobal.d.ts.map +1 -0
- package/dist/findGlobalVersions.d.ts +3 -0
- package/dist/findGlobalVersions.d.ts.map +1 -0
- package/dist/findOne.d.ts +5 -0
- package/dist/findOne.d.ts.map +1 -0
- package/dist/findOne.js +2 -2
- package/dist/findVersions.d.ts +3 -0
- package/dist/findVersions.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -6
- package/dist/init.d.ts +3 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +3 -4
- package/dist/migrate.d.ts +3 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +4 -5
- package/dist/migrateStatus.d.ts +3 -0
- package/dist/migrateStatus.d.ts.map +1 -0
- package/dist/migrateStatus.js +2 -2
- package/dist/queries/buildAndOrConditions.d.ts +17 -0
- package/dist/queries/buildAndOrConditions.d.ts.map +1 -0
- package/dist/queries/buildQuery.d.ts +30 -0
- package/dist/queries/buildQuery.d.ts.map +1 -0
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts +2 -0
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.d.ts.map +1 -0
- package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts +2 -0
- package/dist/queries/createJSONQuery/formatJSONPathSegment.d.ts.map +1 -0
- package/dist/queries/createJSONQuery/index.d.ts +10 -0
- package/dist/queries/createJSONQuery/index.d.ts.map +1 -0
- package/dist/queries/getTableColumnFromPath.d.ts +40 -0
- package/dist/queries/getTableColumnFromPath.d.ts.map +1 -0
- package/dist/queries/operatorMap.d.ts +18 -0
- package/dist/queries/operatorMap.d.ts.map +1 -0
- package/dist/queries/parseParams.d.ts +17 -0
- package/dist/queries/parseParams.d.ts.map +1 -0
- package/dist/queries/parseParams.js +1 -1
- package/dist/queries/sanitizeQueryValue.d.ts +12 -0
- package/dist/queries/sanitizeQueryValue.d.ts.map +1 -0
- package/dist/queryDrafts.d.ts +3 -0
- package/dist/queryDrafts.d.ts.map +1 -0
- package/dist/reference.d.ts +2 -0
- package/dist/reference.d.ts.map +1 -0
- package/dist/schema/build.d.ts +23 -0
- package/dist/schema/build.d.ts.map +1 -0
- package/dist/schema/build.js +6 -5
- package/dist/schema/createIndex.d.ts +11 -0
- package/dist/schema/createIndex.d.ts.map +1 -0
- package/dist/schema/createIndex.js +12 -3
- package/dist/schema/parentIDColumnMap.d.ts +7 -0
- package/dist/schema/parentIDColumnMap.d.ts.map +1 -0
- package/dist/schema/traverseFields.d.ts +33 -0
- package/dist/schema/traverseFields.d.ts.map +1 -0
- package/dist/schema/traverseFields.js +25 -9
- package/dist/schema/validateExistingBlockIsIdentical.d.ts +11 -0
- package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +1 -0
- package/dist/transactions/beginTransaction.d.ts +3 -0
- package/dist/transactions/beginTransaction.d.ts.map +1 -0
- package/dist/transactions/beginTransaction.js +2 -2
- package/dist/transactions/commitTransaction.d.ts +3 -0
- package/dist/transactions/commitTransaction.d.ts.map +1 -0
- package/dist/transactions/rollbackTransaction.d.ts +3 -0
- package/dist/transactions/rollbackTransaction.d.ts.map +1 -0
- package/dist/transform/read/hasManyNumber.d.ts +10 -0
- package/dist/transform/read/hasManyNumber.d.ts.map +1 -0
- package/dist/transform/read/index.d.ts +12 -0
- package/dist/transform/read/index.d.ts.map +1 -0
- package/dist/transform/read/relationship.d.ts +10 -0
- package/dist/transform/read/relationship.d.ts.map +1 -0
- package/dist/transform/read/traverseFields.d.ts +44 -0
- package/dist/transform/read/traverseFields.d.ts.map +1 -0
- package/dist/transform/write/array.d.ts +22 -0
- package/dist/transform/write/array.d.ts.map +1 -0
- package/dist/transform/write/blocks.d.ts +21 -0
- package/dist/transform/write/blocks.d.ts.map +1 -0
- package/dist/transform/write/index.d.ts +11 -0
- package/dist/transform/write/index.d.ts.map +1 -0
- package/dist/transform/write/numbers.d.ts +8 -0
- package/dist/transform/write/numbers.d.ts.map +1 -0
- package/dist/transform/write/relationships.d.ts +10 -0
- package/dist/transform/write/relationships.d.ts.map +1 -0
- package/dist/transform/write/selects.d.ts +7 -0
- package/dist/transform/write/selects.d.ts.map +1 -0
- package/dist/transform/write/traverseFields.d.ts +46 -0
- package/dist/transform/write/traverseFields.d.ts.map +1 -0
- package/dist/transform/write/types.d.ts +41 -0
- package/dist/transform/write/types.d.ts.map +1 -0
- package/dist/types.d.ts +67 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/update.d.ts +3 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +2 -2
- package/dist/updateGlobal.d.ts +5 -0
- package/dist/updateGlobal.d.ts.map +1 -0
- package/dist/updateGlobal.js +2 -2
- package/dist/updateGlobalVersion.d.ts +6 -0
- package/dist/updateGlobalVersion.d.ts.map +1 -0
- package/dist/updateGlobalVersion.js +2 -2
- package/dist/updateVersion.d.ts +5 -0
- package/dist/updateVersion.d.ts.map +1 -0
- package/dist/updateVersion.js +2 -2
- package/dist/upsertRow/deleteExistingArrayRows.d.ts +10 -0
- package/dist/upsertRow/deleteExistingArrayRows.d.ts.map +1 -0
- package/dist/upsertRow/deleteExistingRowsByPath.d.ts +14 -0
- package/dist/upsertRow/deleteExistingRowsByPath.d.ts.map +1 -0
- package/dist/upsertRow/index.d.ts +4 -0
- package/dist/upsertRow/index.d.ts.map +1 -0
- package/dist/upsertRow/insertArrays.d.ts +13 -0
- package/dist/upsertRow/insertArrays.d.ts.map +1 -0
- package/dist/upsertRow/types.d.ts +26 -0
- package/dist/upsertRow/types.d.ts.map +1 -0
- package/dist/utilities/appendPrefixToKeys.d.ts +2 -0
- package/dist/utilities/appendPrefixToKeys.d.ts.map +1 -0
- package/dist/utilities/createBlocksMap.d.ts +5 -0
- package/dist/utilities/createBlocksMap.d.ts.map +1 -0
- package/dist/utilities/createMigrationTable.d.ts +3 -0
- package/dist/utilities/createMigrationTable.d.ts.map +1 -0
- package/dist/utilities/createRelationshipMap.d.ts +2 -0
- package/dist/utilities/createRelationshipMap.d.ts.map +1 -0
- package/dist/utilities/hasLocalesTable.d.ts +3 -0
- package/dist/utilities/hasLocalesTable.d.ts.map +1 -0
- package/dist/utilities/isArrayOfRows.d.ts +2 -0
- package/dist/utilities/isArrayOfRows.d.ts.map +1 -0
- package/dist/utilities/migrationTableExists.d.ts +3 -0
- package/dist/utilities/migrationTableExists.d.ts.map +1 -0
- package/mock.js +1 -0
- package/package.json +16 -17
- package/src/index.ts +93 -0
- package/dist/mock.js +0 -13
- 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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy93ZWJwYWNrLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgV2VicGFjayB9IGZyb20gJ3BheWxvYWQvZGF0YWJhc2UnXG5cbmltcG9ydCBwYXRoIGZyb20gJ3BhdGgnXG5cbmV4cG9ydCBjb25zdCB3ZWJwYWNrOiBXZWJwYWNrID0gKGNvbmZpZykgPT4ge1xuICByZXR1cm4ge1xuICAgIC4uLmNvbmZpZyxcbiAgICByZXNvbHZlOiB7XG4gICAgICAuLi4oY29uZmlnLnJlc29sdmUgfHwge30pLFxuICAgICAgYWxpYXM6IHtcbiAgICAgICAgLi4uKGNvbmZpZy5yZXNvbHZlPy5hbGlhcyB8fCB7fSksXG4gICAgICAgIFtwYXRoLnJlc29sdmUoX19kaXJuYW1lLCAnLi9pbmRleCcpXTogcGF0aC5yZXNvbHZlKF9fZGlybmFtZSwgJ21vY2suanMnKSxcbiAgICAgIH0sXG4gICAgfSxcbiAgfVxufVxuIl0sIm5hbWVzIjpbIndlYnBhY2siLCJjb25maWciLCJyZXNvbHZlIiwiYWxpYXMiLCJwYXRoIiwiX19kaXJuYW1lIl0sIm1hcHBpbmdzIjoiOzs7OytCQUlhQTs7O2VBQUFBOzs7NkRBRkk7Ozs7OztBQUVWLE1BQU1BLFVBQW1CLENBQUNDO0lBQy9CLE9BQU87UUFDTCxHQUFHQSxNQUFNO1FBQ1RDLFNBQVM7WUFDUCxHQUFJRCxPQUFPQyxPQUFPLElBQUksQ0FBQyxDQUFDO1lBQ3hCQyxPQUFPO2dCQUNMLEdBQUlGLE9BQU9DLE9BQU8sRUFBRUMsU0FBUyxDQUFDLENBQUM7Z0JBQy9CLENBQUNDLGFBQUksQ0FBQ0YsT0FBTyxDQUFDRyxXQUFXLFdBQVcsRUFBRUQsYUFBSSxDQUFDRixPQUFPLENBQUNHLFdBQVc7WUFDaEU7UUFDRjtJQUNGO0FBQ0YifQ==
|