@payloadcms/db-postgres 3.0.0-alpha.18 → 3.0.0-alpha.19
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/connect.js +17 -32
- package/dist/create.js +6 -21
- package/dist/createGlobal.js +6 -21
- package/dist/createGlobalVersion.js +10 -25
- package/dist/createMigration.js +11 -26
- package/dist/createVersion.js +10 -25
- package/dist/deleteMany.js +8 -23
- package/dist/deleteOne.js +10 -25
- package/dist/deleteVersions.js +10 -25
- package/dist/destroy.js +2 -12
- package/dist/find/buildFindManyArgs.js +6 -14
- package/dist/find/chainMethods.js +2 -11
- package/dist/find/findMany.js +14 -29
- package/dist/find/traverseFields.js +8 -23
- package/dist/find.js +6 -21
- package/dist/findGlobal.js +6 -21
- package/dist/findGlobalVersions.js +8 -23
- package/dist/findOne.js +6 -21
- package/dist/findVersions.js +8 -23
- package/dist/index.js +72 -87
- package/dist/init.js +17 -32
- package/dist/migrate.js +15 -30
- package/dist/migrateDown.js +12 -22
- package/dist/migrateFresh.js +15 -28
- package/dist/migrateRefresh.js +18 -26
- package/dist/migrateReset.js +13 -21
- package/dist/migrateStatus.js +9 -19
- package/dist/queries/buildAndOrConditions.js +4 -14
- package/dist/queries/buildQuery.js +10 -20
- package/dist/queries/createJSONQuery/convertPathToJSONTraversal.js +4 -14
- package/dist/queries/createJSONQuery/formatJSONPathSegment.js +2 -12
- package/dist/queries/createJSONQuery/index.js +6 -16
- package/dist/queries/getTableColumnFromPath.js +38 -49
- package/dist/queries/operatorMap.js +17 -27
- package/dist/queries/parseParams.js +32 -42
- package/dist/queries/sanitizeQueryValue.js +8 -18
- package/dist/queryDrafts.js +10 -25
- package/dist/schema/build.js +49 -64
- package/dist/schema/createIndex.js +5 -15
- package/dist/schema/idToUUID.js +2 -12
- package/dist/schema/parentIDColumnMap.js +7 -17
- package/dist/schema/setColumnID.js +10 -20
- package/dist/schema/traverseFields.js +62 -77
- package/dist/schema/validateExistingBlockIsIdentical.js +9 -19
- package/dist/transactions/beginTransaction.js +4 -14
- package/dist/transactions/commitTransaction.js +2 -12
- package/dist/transactions/rollbackTransaction.js +2 -12
- package/dist/transform/read/hasManyNumber.js +2 -12
- package/dist/transform/read/hasManyText.js +2 -12
- package/dist/transform/read/index.js +12 -20
- package/dist/transform/read/relationship.js +2 -12
- package/dist/transform/read/traverseFields.js +15 -23
- package/dist/transform/write/array.js +6 -16
- package/dist/transform/write/blocks.js +6 -21
- package/dist/transform/write/index.js +4 -14
- package/dist/transform/write/numbers.js +2 -12
- package/dist/transform/write/relationships.js +4 -14
- package/dist/transform/write/selects.js +4 -14
- package/dist/transform/write/texts.js +2 -12
- package/dist/transform/write/traverseFields.js +30 -45
- package/dist/transform/write/types.js +2 -5
- package/dist/types.js +2 -5
- package/dist/update.js +11 -26
- package/dist/updateGlobal.js +6 -21
- package/dist/updateGlobalVersion.js +10 -25
- package/dist/updateVersion.js +10 -25
- package/dist/upsertRow/deleteExistingArrayRows.js +5 -15
- package/dist/upsertRow/deleteExistingRowsByPath.js +9 -19
- package/dist/upsertRow/index.js +24 -34
- package/dist/upsertRow/insertArrays.js +2 -12
- package/dist/upsertRow/types.js +2 -5
- package/dist/utilities/appendPrefixToKeys.js +2 -12
- package/dist/utilities/createBlocksMap.js +2 -12
- package/dist/utilities/createMigrationTable.js +4 -14
- package/dist/utilities/createRelationshipMap.js +2 -12
- package/dist/utilities/hasLocalesTable.js +5 -15
- package/dist/utilities/isArrayOfRows.js +2 -12
- package/dist/utilities/migrationTableExists.js +4 -14
- package/dist/utilities/parseError.js +6 -14
- package/package.json +4 -4
package/dist/connect.js
CHANGED
@@ -1,23 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
}
|
5
|
-
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return connect;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _drizzleorm = require("drizzle-orm");
|
12
|
-
const _nodepostgres = require("drizzle-orm/node-postgres");
|
13
|
-
const _pgcore = require("drizzle-orm/pg-core");
|
14
|
-
const _pg = require("pg");
|
15
|
-
const _prompts = /*#__PURE__*/ _interop_require_default(require("prompts"));
|
16
|
-
function _interop_require_default(obj) {
|
17
|
-
return obj && obj.__esModule ? obj : {
|
18
|
-
default: obj
|
19
|
-
};
|
20
|
-
}
|
1
|
+
import { eq, sql } from 'drizzle-orm';
|
2
|
+
import { drizzle } from 'drizzle-orm/node-postgres';
|
3
|
+
import { numeric, timestamp, varchar } from 'drizzle-orm/pg-core';
|
4
|
+
import { Pool } from 'pg';
|
5
|
+
import prompts from 'prompts';
|
21
6
|
const connectWithReconnect = async function({ adapter, payload, reconnect = false }) {
|
22
7
|
let result;
|
23
8
|
if (!reconnect) {
|
@@ -53,7 +38,7 @@ const connectWithReconnect = async function({ adapter, payload, reconnect = fals
|
|
53
38
|
}
|
54
39
|
});
|
55
40
|
};
|
56
|
-
const connect = async function connect(options = {
|
41
|
+
export const connect = async function connect(options = {
|
57
42
|
hotReload: false
|
58
43
|
}) {
|
59
44
|
const { hotReload } = options;
|
@@ -63,20 +48,20 @@ const connect = async function connect(options = {
|
|
63
48
|
...this.enums
|
64
49
|
};
|
65
50
|
try {
|
66
|
-
this.pool = new
|
51
|
+
this.pool = new Pool(this.poolOptions);
|
67
52
|
await connectWithReconnect({
|
68
53
|
adapter: this,
|
69
54
|
payload: this.payload
|
70
55
|
});
|
71
56
|
const logger = this.logger || false;
|
72
|
-
this.drizzle =
|
57
|
+
this.drizzle = drizzle(this.pool, {
|
73
58
|
logger,
|
74
59
|
schema: this.schema
|
75
60
|
});
|
76
61
|
if (!hotReload) {
|
77
62
|
if (process.env.PAYLOAD_DROP_DATABASE === 'true') {
|
78
63
|
this.payload.logger.info(`---- DROPPING TABLES SCHEMA(${this.schemaName || 'public'}) ----`);
|
79
|
-
await this.drizzle.execute(
|
64
|
+
await this.drizzle.execute(sql.raw(`
|
80
65
|
drop schema if exists ${this.schemaName || 'public'} cascade;
|
81
66
|
create schema ${this.schemaName || 'public'};
|
82
67
|
`));
|
@@ -98,7 +83,7 @@ const connect = async function connect(options = {
|
|
98
83
|
message += `DATA LOSS WARNING: Possible data loss detected if schema is pushed.\n\n`;
|
99
84
|
}
|
100
85
|
message += `Accept warnings and push schema to database?`;
|
101
|
-
const { confirm: acceptWarnings } = await (
|
86
|
+
const { confirm: acceptWarnings } = await prompts({
|
102
87
|
name: 'confirm',
|
103
88
|
type: 'confirm',
|
104
89
|
initial: false,
|
@@ -117,12 +102,12 @@ const connect = async function connect(options = {
|
|
117
102
|
await apply();
|
118
103
|
// Migration table def in order to use query using drizzle
|
119
104
|
const migrationsSchema = this.pgSchema.table('payload_migrations', {
|
120
|
-
name:
|
121
|
-
batch:
|
122
|
-
created_at:
|
123
|
-
updated_at:
|
105
|
+
name: varchar('name'),
|
106
|
+
batch: numeric('batch'),
|
107
|
+
created_at: timestamp('created_at'),
|
108
|
+
updated_at: timestamp('updated_at')
|
124
109
|
});
|
125
|
-
const devPush = await this.drizzle.select().from(migrationsSchema).where(
|
110
|
+
const devPush = await this.drizzle.select().from(migrationsSchema).where(eq(migrationsSchema.batch, '-1'));
|
126
111
|
if (!devPush.length) {
|
127
112
|
await this.drizzle.insert(migrationsSchema).values({
|
128
113
|
name: 'dev',
|
@@ -131,8 +116,8 @@ const connect = async function connect(options = {
|
|
131
116
|
} else {
|
132
117
|
await this.drizzle.update(migrationsSchema).set({
|
133
118
|
updated_at: new Date()
|
134
|
-
}).where(
|
119
|
+
}).where(eq(migrationsSchema.batch, '-1'));
|
135
120
|
}
|
136
121
|
};
|
137
122
|
|
138
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jb25uZWN0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgUGF5bG9hZCB9IGZyb20gJ3BheWxvYWQnXG5pbXBvcnQgdHlwZSB7IENvbm5lY3QgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuXG5pbXBvcnQgeyB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true,
|
7
|
-
get: function() {
|
8
|
-
return create;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
|
12
|
-
const _upsertRow = require("./upsertRow");
|
13
|
-
function _interop_require_default(obj) {
|
14
|
-
return obj && obj.__esModule ? obj : {
|
15
|
-
default: obj
|
16
|
-
};
|
17
|
-
}
|
18
|
-
const create = async function create({ collection: collectionSlug, data, req }) {
|
1
|
+
import toSnakeCase from 'to-snake-case';
|
2
|
+
import { upsertRow } from './upsertRow';
|
3
|
+
export const create = async function create({ collection: collectionSlug, data, req }) {
|
19
4
|
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
20
5
|
const collection = this.payload.collections[collectionSlug].config;
|
21
|
-
const result = await
|
6
|
+
const result = await upsertRow({
|
22
7
|
adapter: this,
|
23
8
|
data,
|
24
9
|
db,
|
25
10
|
fields: collection.fields,
|
26
11
|
operation: 'create',
|
27
|
-
tableName: (
|
12
|
+
tableName: toSnakeCase(collectionSlug),
|
28
13
|
req
|
29
14
|
});
|
30
15
|
return result;
|
31
16
|
};
|
32
17
|
|
33
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBDcmVhdGUgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuXG5pbXBvcnQgdG9TbmFrZUNhc2UgZnJvbSAndG8tc25ha2UtY2FzZSdcblxuaW1wb3J0IHR5cGUgeyBQb3N0Z3Jlc0FkYXB0ZXIgfSBmcm9tICcuL3R5cGVzJ1xuXG5pbXBvcnQgeyB1cHNlcnRSb3cgfSBmcm9tICcuL3Vwc2VydFJvdydcblxuZXhwb3J0IGNvbnN0IGNyZWF0ZTogQ3JlYXRlID0gYXN5bmMgZnVuY3Rpb24gY3JlYXRlKFxuICB0aGlzOiBQb3N0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
|
5
|
-
Object.defineProperty(exports, "createGlobal", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return createGlobal;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
|
12
|
-
const _upsertRow = require("./upsertRow");
|
13
|
-
function _interop_require_default(obj) {
|
14
|
-
return obj && obj.__esModule ? obj : {
|
15
|
-
default: obj
|
16
|
-
};
|
17
|
-
}
|
18
|
-
async function createGlobal({ data, req = {}, slug }) {
|
1
|
+
import toSnakeCase from 'to-snake-case';
|
2
|
+
import { upsertRow } from './upsertRow';
|
3
|
+
export async function createGlobal({ data, req = {}, slug }) {
|
19
4
|
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
20
5
|
const globalConfig = this.payload.globals.config.find((config)=>config.slug === slug);
|
21
|
-
const result = await
|
6
|
+
const result = await upsertRow({
|
22
7
|
adapter: this,
|
23
8
|
data,
|
24
9
|
db,
|
25
10
|
fields: globalConfig.fields,
|
26
11
|
operation: 'create',
|
27
|
-
tableName: (
|
12
|
+
tableName: toSnakeCase(slug),
|
28
13
|
req
|
29
14
|
});
|
30
15
|
return result;
|
31
16
|
}
|
32
17
|
|
33
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGVHbG9iYWwudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBDcmVhdGVHbG9iYWxBcmdzIH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcbmltcG9ydCB0eXBlIHsgUGF5bG9hZFJlcXVlc3QsIFR5cGVXaXRoSUQgfSBmcm9tICdwYXlsb2FkL3R5cGVzJ1xuXG5pbXBvcnQgdG9TbmFrZUNhc2UgZnJvbSAndG8tc25ha2UtY2FzZSdcblxuaW1wb3J0IHR5cGUgeyBQb3N0Z3Jlc0FkYXB0ZXIgfSBmcm9tICcuL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DQUFDRyxPQUFPO0lBQy9ELE1BQU1DLGVBQWUsSUFBSSxDQUFDQyxPQUFPLENBQUNDLE9BQU8sQ0FBQ0MsTUFBTSxDQUFDQyxJQUFJLENBQUMsQ0FBQ0QsU0FBV0EsT0FBT1IsSUFBSSxLQUFLQTtJQUVsRixNQUFNVSxTQUFTLE1BQU1kLFVBQWE7UUFDaENlLFNBQVMsSUFBSTtRQUNiYjtRQUNBRztRQUNBVyxRQUFRUCxhQUFhTyxNQUFNO1FBQzNCQyxXQUFXO1FBQ1hDLFdBQVduQixZQUFZSztRQUN2QkQ7SUFDRjtJQUVBLE9BQU9XO0FBQ1QifQ==
|
@@ -1,28 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
}
|
5
|
-
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return createGlobalVersion;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _drizzleorm = require("drizzle-orm");
|
12
|
-
const _versions = require("payload/versions");
|
13
|
-
const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
|
14
|
-
const _upsertRow = require("./upsertRow");
|
15
|
-
function _interop_require_default(obj) {
|
16
|
-
return obj && obj.__esModule ? obj : {
|
17
|
-
default: obj
|
18
|
-
};
|
19
|
-
}
|
20
|
-
async function createGlobalVersion({ autosave, globalSlug, req = {}, versionData }) {
|
1
|
+
import { sql } from 'drizzle-orm';
|
2
|
+
import { buildVersionGlobalFields } from 'payload/versions';
|
3
|
+
import toSnakeCase from 'to-snake-case';
|
4
|
+
import { upsertRow } from './upsertRow';
|
5
|
+
export async function createGlobalVersion({ autosave, globalSlug, req = {}, versionData }) {
|
21
6
|
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
22
7
|
const global = this.payload.globals.config.find(({ slug })=>slug === globalSlug);
|
23
|
-
const globalTableName = (
|
8
|
+
const globalTableName = toSnakeCase(globalSlug);
|
24
9
|
const tableName = `_${globalTableName}_v`;
|
25
|
-
const result = await
|
10
|
+
const result = await upsertRow({
|
26
11
|
adapter: this,
|
27
12
|
data: {
|
28
13
|
autosave,
|
@@ -30,14 +15,14 @@ async function createGlobalVersion({ autosave, globalSlug, req = {}, versionData
|
|
30
15
|
version: versionData
|
31
16
|
},
|
32
17
|
db,
|
33
|
-
fields:
|
18
|
+
fields: buildVersionGlobalFields(global),
|
34
19
|
operation: 'create',
|
35
20
|
tableName,
|
36
21
|
req
|
37
22
|
});
|
38
23
|
const table = this.tables[tableName];
|
39
24
|
if (global.versions.drafts) {
|
40
|
-
await db.execute(
|
25
|
+
await db.execute(sql`
|
41
26
|
UPDATE ${table}
|
42
27
|
SET latest = false
|
43
28
|
WHERE ${table.id} != ${result.id};
|
@@ -46,4 +31,4 @@ async function createGlobalVersion({ autosave, globalSlug, req = {}, versionData
|
|
46
31
|
return result;
|
47
32
|
}
|
48
33
|
|
49
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGVHbG9iYWxWZXJzaW9uLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgVHlwZVdpdGhWZXJzaW9uIH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcbmltcG9ydCB7IHR5cGUgQ3JlYXRlR2xvYmFsVmVyc2lvbkFyZ3MgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCwgVHlwZVdpdGhJRCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IHNxbCB9IGZyb20gJ2RyaXp6bGUtb3JtJ1xuaW1wb3J0IHsgYnVpbGRWZXJzaW9uR2xvYmFsRmllbGRzIH0gZnJvbSAncGF5bG9hZC92ZXJzaW9ucydcbmltcG9ydCB0b1NuYWtlQ2FzZSBmcm9tICd0by1zbmFrZS1jYXNlJ1xuXG5pbXBvcnQgdHlwZS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-loop */
|
2
|
-
|
3
|
-
value: true
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "createMigration", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return createMigration;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
12
|
-
const _prompts = /*#__PURE__*/ _interop_require_default(require("prompts"));
|
13
|
-
function _interop_require_default(obj) {
|
14
|
-
return obj && obj.__esModule ? obj : {
|
15
|
-
default: obj
|
16
|
-
};
|
17
|
-
}
|
1
|
+
/* eslint-disable no-restricted-syntax, no-await-in-loop */ import fs from 'fs';
|
2
|
+
import prompts from 'prompts';
|
18
3
|
const migrationTemplate = (upSQL, downSQL)=>`import { MigrateUpArgs, MigrateDownArgs } from '@payloadcms/db-postgres'
|
19
4
|
import { sql } from 'drizzle-orm'
|
20
5
|
|
@@ -46,10 +31,10 @@ const getDefaultDrizzleSnapshot = ()=>({
|
|
46
31
|
tables: {},
|
47
32
|
version: '5'
|
48
33
|
});
|
49
|
-
const createMigration = async function createMigration({ forceAcceptWarning, migrationName, payload }) {
|
34
|
+
export const createMigration = async function createMigration({ forceAcceptWarning, migrationName, payload }) {
|
50
35
|
const dir = payload.db.migrationDir;
|
51
|
-
if (!
|
52
|
-
|
36
|
+
if (!fs.existsSync(dir)) {
|
37
|
+
fs.mkdirSync(dir);
|
53
38
|
}
|
54
39
|
const { generateDrizzleJson, generateMigration } = require('drizzle-kit/payload');
|
55
40
|
const [yyymmdd, hhmmss] = new Date().toISOString().split('T');
|
@@ -60,16 +45,16 @@ const createMigration = async function createMigration({ forceAcceptWarning, mig
|
|
60
45
|
const filePath = `${dir}/${fileName}`;
|
61
46
|
let drizzleJsonBefore = getDefaultDrizzleSnapshot();
|
62
47
|
// Get latest migration snapshot
|
63
|
-
const latestSnapshot =
|
48
|
+
const latestSnapshot = fs.readdirSync(dir).filter((file)=>file.endsWith('.json')).sort().reverse()?.[0];
|
64
49
|
if (latestSnapshot) {
|
65
|
-
const latestSnapshotJSON = JSON.parse(
|
50
|
+
const latestSnapshotJSON = JSON.parse(fs.readFileSync(`${dir}/${latestSnapshot}`, 'utf8'));
|
66
51
|
drizzleJsonBefore = latestSnapshotJSON;
|
67
52
|
}
|
68
53
|
const drizzleJsonAfter = generateDrizzleJson(this.schema);
|
69
54
|
const sqlStatementsUp = await generateMigration(drizzleJsonBefore, drizzleJsonAfter);
|
70
55
|
const sqlStatementsDown = await generateMigration(drizzleJsonAfter, drizzleJsonBefore);
|
71
56
|
if (!sqlStatementsUp.length && !sqlStatementsDown.length && !forceAcceptWarning) {
|
72
|
-
const { confirm: shouldCreateBlankMigration } = await (
|
57
|
+
const { confirm: shouldCreateBlankMigration } = await prompts({
|
73
58
|
name: 'confirm',
|
74
59
|
type: 'confirm',
|
75
60
|
initial: false,
|
@@ -84,12 +69,12 @@ const createMigration = async function createMigration({ forceAcceptWarning, mig
|
|
84
69
|
}
|
85
70
|
}
|
86
71
|
// write schema
|
87
|
-
|
72
|
+
fs.writeFileSync(`${filePath}.json`, JSON.stringify(drizzleJsonAfter, null, 2));
|
88
73
|
// write migration
|
89
|
-
|
74
|
+
fs.writeFileSync(`${filePath}.ts`, migrationTemplate(sqlStatementsUp.length ? sqlStatementsUp?.join('\n') : undefined, sqlStatementsDown.length ? sqlStatementsDown?.join('\n') : undefined));
|
90
75
|
payload.logger.info({
|
91
76
|
msg: `Migration created at ${filePath}.ts`
|
92
77
|
});
|
93
78
|
};
|
94
79
|
|
95
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGVNaWdyYXRpb24udHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tcmVzdHJpY3RlZC1zeW50YXgsIG5vLWF3YWl0LWluLWxvb3AgKi9cbmltcG9ydCB0eXBlIHsgRHJpenpsZVNuYXBzaG90SlNPTiB9IGZyb20g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GFBQWEsQ0FBQyxDQUFDLEVBQUUzQixTQUFTLEtBQUssQ0FBQyxFQUFFVSxLQUFLa0IsU0FBUyxDQUFDZixrQkFBa0IsTUFBTTtJQUU1RSxrQkFBa0I7SUFDbEJsRCxHQUFHZ0UsYUFBYSxDQUNkLENBQUMsRUFBRTNCLFNBQVMsR0FBRyxDQUFDLEVBQ2hCbkMsa0JBQ0VrRCxnQkFBZ0JFLE1BQU0sR0FBR0YsaUJBQWlCYyxLQUFLLFFBQVFDLFdBQ3ZEZCxrQkFBa0JDLE1BQU0sR0FBR0QsbUJBQW1CYSxLQUFLLFFBQVFDO0lBRy9EakQsUUFBUWtELE1BQU0sQ0FBQ0MsSUFBSSxDQUFDO1FBQUVDLEtBQUssQ0FBQyxxQkFBcUIsRUFBRWpDLFNBQVMsR0FBRyxDQUFDO0lBQUM7QUFDbkUsRUFBQyJ9
|
package/dist/createVersion.js
CHANGED
@@ -1,28 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
}
|
5
|
-
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return createVersion;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _drizzleorm = require("drizzle-orm");
|
12
|
-
const _versions = require("payload/versions");
|
13
|
-
const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
|
14
|
-
const _upsertRow = require("./upsertRow");
|
15
|
-
function _interop_require_default(obj) {
|
16
|
-
return obj && obj.__esModule ? obj : {
|
17
|
-
default: obj
|
18
|
-
};
|
19
|
-
}
|
20
|
-
async function createVersion({ autosave, collectionSlug, parent, req = {}, versionData }) {
|
1
|
+
import { sql } from 'drizzle-orm';
|
2
|
+
import { buildVersionCollectionFields } from 'payload/versions';
|
3
|
+
import toSnakeCase from 'to-snake-case';
|
4
|
+
import { upsertRow } from './upsertRow';
|
5
|
+
export async function createVersion({ autosave, collectionSlug, parent, req = {}, versionData }) {
|
21
6
|
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
22
7
|
const collection = this.payload.collections[collectionSlug].config;
|
23
|
-
const collectionTableName = (
|
8
|
+
const collectionTableName = toSnakeCase(collectionSlug);
|
24
9
|
const tableName = `_${collectionTableName}_v`;
|
25
|
-
const result = await
|
10
|
+
const result = await upsertRow({
|
26
11
|
adapter: this,
|
27
12
|
data: {
|
28
13
|
autosave,
|
@@ -31,7 +16,7 @@ async function createVersion({ autosave, collectionSlug, parent, req = {}, versi
|
|
31
16
|
version: versionData
|
32
17
|
},
|
33
18
|
db,
|
34
|
-
fields:
|
19
|
+
fields: buildVersionCollectionFields(collection),
|
35
20
|
operation: 'create',
|
36
21
|
tableName,
|
37
22
|
req
|
@@ -39,7 +24,7 @@ async function createVersion({ autosave, collectionSlug, parent, req = {}, versi
|
|
39
24
|
const table = this.tables[tableName];
|
40
25
|
const relationshipsTable = this.tables[`${tableName}_rels`];
|
41
26
|
if (collection.versions.drafts) {
|
42
|
-
await db.execute(
|
27
|
+
await db.execute(sql`
|
43
28
|
UPDATE ${table}
|
44
29
|
SET latest = false
|
45
30
|
FROM ${relationshipsTable}
|
@@ -52,4 +37,4 @@ async function createVersion({ autosave, collectionSlug, parent, req = {}, versi
|
|
52
37
|
return result;
|
53
38
|
}
|
54
39
|
|
55
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGVWZXJzaW9uLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgQ3JlYXRlVmVyc2lvbkFyZ3MsIFR5cGVXaXRoVmVyc2lvbiB9IGZyb20gJ3BheWxvYWQvZGF0YWJhc2UnXG5pbXBvcnQgdHlwZSB7IFBheWxvYWRSZXF1ZXN0LCBUeXBlV2l0aElEIH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHsgc3FsIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5pbXBvcnQgeyBidWlsZFZlcnNpb25Db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@@ -1,26 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
})
|
5
|
-
Object.defineProperty(exports, "deleteMany", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return deleteMany;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _drizzleorm = require("drizzle-orm");
|
12
|
-
const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
|
13
|
-
const _findMany = require("./find/findMany");
|
14
|
-
function _interop_require_default(obj) {
|
15
|
-
return obj && obj.__esModule ? obj : {
|
16
|
-
default: obj
|
17
|
-
};
|
18
|
-
}
|
19
|
-
const deleteMany = async function deleteMany({ collection, req = {}, where }) {
|
1
|
+
import { inArray } from 'drizzle-orm';
|
2
|
+
import toSnakeCase from 'to-snake-case';
|
3
|
+
import { findMany } from './find/findMany';
|
4
|
+
export const deleteMany = async function deleteMany({ collection, req = {}, where }) {
|
20
5
|
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
21
6
|
const collectionConfig = this.payload.collections[collection].config;
|
22
|
-
const tableName = (
|
23
|
-
const result = await
|
7
|
+
const tableName = toSnakeCase(collection);
|
8
|
+
const result = await findMany({
|
24
9
|
adapter: this,
|
25
10
|
fields: collectionConfig.fields,
|
26
11
|
limit: 0,
|
@@ -36,8 +21,8 @@ const deleteMany = async function deleteMany({ collection, req = {}, where }) {
|
|
36
21
|
ids.push(data.id);
|
37
22
|
});
|
38
23
|
if (ids.length > 0) {
|
39
|
-
await db.delete(this.tables[tableName]).where(
|
24
|
+
await db.delete(this.tables[tableName]).where(inArray(this.tables[tableName].id, ids));
|
40
25
|
}
|
41
26
|
};
|
42
27
|
|
43
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9kZWxldGVNYW55LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgRGVsZXRlTWFueSB9IGZyb20gJ3BheWxvY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
|
-
return deleteOne;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
|
12
|
-
const _buildFindManyArgs = require("./find/buildFindManyArgs");
|
13
|
-
const _buildQuery = /*#__PURE__*/ _interop_require_default(require("./queries/buildQuery"));
|
14
|
-
const _read = require("./transform/read");
|
15
|
-
function _interop_require_default(obj) {
|
16
|
-
return obj && obj.__esModule ? obj : {
|
17
|
-
default: obj
|
18
|
-
};
|
19
|
-
}
|
20
|
-
const deleteOne = async function deleteOne({ collection, req = {}, where: incomingWhere }) {
|
1
|
+
import toSnakeCase from 'to-snake-case';
|
2
|
+
import { buildFindManyArgs } from './find/buildFindManyArgs';
|
3
|
+
import buildQuery from './queries/buildQuery';
|
4
|
+
import { transform } from './transform/read';
|
5
|
+
export const deleteOne = async function deleteOne({ collection, req = {}, where: incomingWhere }) {
|
21
6
|
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
22
7
|
const collectionConfig = this.payload.collections[collection].config;
|
23
|
-
const tableName = (
|
24
|
-
const { where } = await (
|
8
|
+
const tableName = toSnakeCase(collection);
|
9
|
+
const { where } = await buildQuery({
|
25
10
|
adapter: this,
|
26
11
|
fields: collectionConfig.fields,
|
27
12
|
tableName,
|
28
13
|
where: incomingWhere
|
29
14
|
});
|
30
|
-
const findManyArgs =
|
15
|
+
const findManyArgs = buildFindManyArgs({
|
31
16
|
adapter: this,
|
32
17
|
depth: 0,
|
33
18
|
fields: collectionConfig.fields,
|
@@ -35,7 +20,7 @@ const deleteOne = async function deleteOne({ collection, req = {}, where: incomi
|
|
35
20
|
});
|
36
21
|
findManyArgs.where = where;
|
37
22
|
const docToDelete = await db.query[tableName].findFirst(findManyArgs);
|
38
|
-
const result =
|
23
|
+
const result = transform({
|
39
24
|
config: this.payload.config,
|
40
25
|
data: docToDelete,
|
41
26
|
fields: collectionConfig.fields
|
@@ -44,4 +29,4 @@ const deleteOne = async function deleteOne({ collection, req = {}, where: incomi
|
|
44
29
|
return result;
|
45
30
|
};
|
46
31
|
|
47
|
-
//# sourceMappingURL=data:application/json;base64,
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9kZWxldGVPbmUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBEZWxldGVPbmUgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB0b1NuYWtlQ2FzZSBmcm9tICd0by1zbmFrZS1jYXNlJ1xuXG5pbXBvcnQgdHlwZSB7IFBvc3RncmVzQWRhcHRlciB9IGZyb20gJy4vdHlwZXMnXG5cbmltcG9ydCB7IGJ1aWxkRmluZE1hbnlBcmdzIH0gZnJvbSAnLi9maW5kL2J1aWxkRmluZE1hbnlBcmdzJ1xuaW1wb3J0IGJ1aWxkUXVlcnkgZnJvbSAnLi9xdWVyaWVzL2J1aWxkUXVlcnknXG5pbXBvcnQgeyB0cmFuc2Zvcm0gfSBmcm9tICcuL3RyYW5zZm9ybS9yZWFkJ1xuXG5leHBvcnQgY29uc3QgZGVsZXRlT25lOiBEZWxldGVPbmUgPSBhc3luYyBmdW5jdGlvbiBkZWxldGVPbmUoXG4gIHRoaXM6IFBvc3RncmVzQWRhcHRlcixcbiAgeyBjb2xsZWN0aW9uLCByZXEgPSB7fSBhcyBQYXlsb2FkUmVxdWVzdCwgd2hlcmU6IGluY29taW5nV2hlcmUgfSxcbikge1xuICBjb25zdCBkYiA9IHRoaXMuc2Vzc2lvbnNbcmVxLnRyYW5zYWN0aW9uSURdPy5kYiB8fCB0aGlzLmRyaXp6bGVcbiAgY29uc3QgY29sbGVjdGlvbkNvbmZpZyA9IHRoaXMucGF5bG9hZC5jb2xsZWN0aW9uc1tjb2xsZWN0aW9uXS5jb25maW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