@payloadcms/db-postgres 0.7.1 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/count.d.ts +3 -0
- package/dist/count.d.ts.map +1 -0
- package/dist/count.js +68 -0
- package/dist/create.d.ts.map +1 -1
- package/dist/create.js +7 -9
- package/dist/createGlobal.d.ts +1 -1
- package/dist/createGlobal.d.ts.map +1 -1
- package/dist/createGlobal.js +8 -10
- package/dist/createGlobalVersion.d.ts +1 -1
- package/dist/createGlobalVersion.d.ts.map +1 -1
- package/dist/createGlobalVersion.js +12 -14
- package/dist/createVersion.d.ts.map +1 -1
- package/dist/createVersion.js +22 -19
- package/dist/deleteMany.js +6 -8
- package/dist/deleteOne.d.ts.map +1 -1
- package/dist/deleteOne.js +6 -3
- package/dist/deleteVersions.d.ts.map +1 -1
- package/dist/deleteVersions.js +7 -8
- package/dist/find/buildFindManyArgs.js +3 -3
- package/dist/find/findMany.js +2 -2
- package/dist/find/traverseFields.d.ts.map +1 -1
- package/dist/find/traverseFields.js +23 -11
- package/dist/find.d.ts.map +1 -1
- package/dist/find.js +10 -11
- package/dist/findGlobal.d.ts.map +1 -1
- package/dist/findGlobal.js +7 -9
- package/dist/findGlobalVersions.d.ts.map +1 -1
- package/dist/findGlobalVersions.js +7 -8
- package/dist/findOne.d.ts +1 -1
- package/dist/findOne.d.ts.map +1 -1
- package/dist/findOne.js +9 -10
- package/dist/findVersions.d.ts.map +1 -1
- package/dist/findVersions.js +7 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +28 -15
- package/dist/queries/getTableColumnFromPath.d.ts.map +1 -1
- package/dist/queries/getTableColumnFromPath.js +148 -42
- package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
- package/dist/queries/sanitizeQueryValue.js +5 -2
- package/dist/queryDrafts.d.ts.map +1 -1
- package/dist/queryDrafts.js +7 -8
- package/dist/schema/build.d.ts +2 -1
- package/dist/schema/build.d.ts.map +1 -1
- package/dist/schema/build.js +19 -14
- package/dist/schema/getTableName.d.ts +32 -0
- package/dist/schema/getTableName.d.ts.map +1 -0
- package/dist/schema/getTableName.js +43 -0
- package/dist/schema/traverseFields.d.ts +2 -1
- package/dist/schema/traverseFields.d.ts.map +1 -1
- package/dist/schema/traverseFields.js +54 -18
- package/dist/schema/validateExistingBlockIsIdentical.d.ts +2 -1
- package/dist/schema/validateExistingBlockIsIdentical.d.ts.map +1 -1
- package/dist/schema/validateExistingBlockIsIdentical.js +14 -8
- package/dist/transform/write/blocks.d.ts +2 -2
- package/dist/transform/write/blocks.d.ts.map +1 -1
- package/dist/transform/write/blocks.js +4 -4
- package/dist/transform/write/traverseFields.d.ts +2 -2
- package/dist/transform/write/traverseFields.d.ts.map +1 -1
- package/dist/transform/write/traverseFields.js +34 -25
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/update.d.ts.map +1 -1
- package/dist/update.js +7 -4
- package/dist/updateGlobal.d.ts +1 -1
- package/dist/updateGlobal.d.ts.map +1 -1
- package/dist/updateGlobal.js +9 -11
- package/dist/updateGlobalVersion.d.ts.map +1 -1
- package/dist/updateGlobalVersion.js +9 -5
- package/dist/updateVersion.d.ts.map +1 -1
- package/dist/updateVersion.js +9 -5
- package/dist/upsertRow/index.d.ts.map +1 -1
- package/dist/upsertRow/index.js +7 -6
- package/dist/upsertRow/insertArrays.d.ts.map +1 -1
- package/dist/upsertRow/insertArrays.js +3 -3
- package/dist/upsertRow/types.d.ts +1 -1
- package/dist/upsertRow/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/count.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../src/count.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAY7C,eAAO,MAAM,KAAK,EAAE,KAoDnB,CAAA"}
|
package/dist/count.js
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "count", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return count;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _drizzleorm = require("drizzle-orm");
|
12
|
+
const _chainMethods = require("./find/chainMethods");
|
13
|
+
const _buildQuery = /*#__PURE__*/ _interop_require_default(require("./queries/buildQuery"));
|
14
|
+
const _getTableName = require("./schema/getTableName");
|
15
|
+
function _interop_require_default(obj) {
|
16
|
+
return obj && obj.__esModule ? obj : {
|
17
|
+
default: obj
|
18
|
+
};
|
19
|
+
}
|
20
|
+
const count = async function count({ collection, locale, req, where: whereArg }) {
|
21
|
+
const collectionConfig = this.payload.collections[collection].config;
|
22
|
+
const tableName = (0, _getTableName.getTableName)({
|
23
|
+
adapter: this,
|
24
|
+
config: collectionConfig
|
25
|
+
});
|
26
|
+
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
27
|
+
const table = this.tables[tableName];
|
28
|
+
const { joinAliases, joins, where } = await (0, _buildQuery.default)({
|
29
|
+
adapter: this,
|
30
|
+
fields: collectionConfig.fields,
|
31
|
+
locale,
|
32
|
+
tableName,
|
33
|
+
where: whereArg
|
34
|
+
});
|
35
|
+
const selectCountMethods = [];
|
36
|
+
joinAliases.forEach(({ condition, table })=>{
|
37
|
+
selectCountMethods.push({
|
38
|
+
args: [
|
39
|
+
table,
|
40
|
+
condition
|
41
|
+
],
|
42
|
+
method: 'leftJoin'
|
43
|
+
});
|
44
|
+
});
|
45
|
+
Object.entries(joins).forEach(([joinTable, condition])=>{
|
46
|
+
if (joinTable) {
|
47
|
+
selectCountMethods.push({
|
48
|
+
args: [
|
49
|
+
this.tables[joinTable],
|
50
|
+
condition
|
51
|
+
],
|
52
|
+
method: 'leftJoin'
|
53
|
+
});
|
54
|
+
}
|
55
|
+
});
|
56
|
+
const countResult = await (0, _chainMethods.chainMethods)({
|
57
|
+
methods: selectCountMethods,
|
58
|
+
query: db.select({
|
59
|
+
count: (0, _drizzleorm.sql)`count
|
60
|
+
(DISTINCT ${this.tables[tableName].id})`
|
61
|
+
}).from(table).where(where)
|
62
|
+
});
|
63
|
+
return {
|
64
|
+
totalDocs: Number(countResult[0].count)
|
65
|
+
};
|
66
|
+
};
|
67
|
+
|
68
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jb3VudC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IENvdW50IH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcbmltcG9ydCB0eXBlIHsgU2FuaXRpemVkQ29sbGVjdGlvbkNvbmZpZyB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IHNxbCB9IGZyb20gJ2RyaXp6bGUtb3JtJ1xuXG5pbXBvcnQgdHlwZSB7IENoYWluZWRNZXRob2RzIH0gZnJvbSAnLi9maW5kL2NoYWluTWV0aG9kcydcbmltcG9ydCB0eXBlIHsgUG9zdGdyZXNBZGFwdGVyIH0gZnJvbSAnLi90eXBlcydcblxuaW1wb3J0IHsgY2hhaW5NZXRob2RzIH0gZnJvbSAnLi9maW5kL2NoYWluTWV0aG9kcydcbmltcG9ydCBidWlsZFF1ZXJ5IGZyb20gJy4vcXVlcmllcy9idWlsZFF1ZXJ5J1xuaW1wb3J0IHsgZ2V0VGFibGVOYW1lIH0gZnJvbSAnLi9zY2hlbWEvZ2V0VGFibGVOYW1lJ1xuXG5leHBvcnQgY29uc3QgY291bnQ6IENvdW50ID0gYXN5bmMgZnVuY3Rpb24gY291bnQoXG4gIHRoaXM6IFBvc3RncmVzQWRhcHRlcixcbiAgeyBjb2xsZWN0aW9uLCBsb2NhbGUsIHJlcSwgd2hlcmU6IHdoZXJlQXJnIH0sXG4pIHtcbiAgY29uc3QgY29sbGVjdGlvb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yxXQUFXTixVQUFVO1FBQ25ELElBQUlNLFdBQVc7WUFDYlIsbUJBQW1CRyxJQUFJLENBQUM7Z0JBQ3RCQyxNQUFNO29CQUFDLElBQUksQ0FBQ1QsTUFBTSxDQUFDYSxVQUFVO29CQUFFTjtpQkFBVTtnQkFDekNHLFFBQVE7WUFDVjtRQUNGO0lBQ0Y7SUFFQSxNQUFNSSxjQUFjLE1BQU1DLElBQUFBLDBCQUFZLEVBQUM7UUFDckNDLFNBQVNYO1FBQ1RZLE9BQU90QixHQUNKdUIsTUFBTSxDQUFDO1lBQ05wQyxPQUFPcUMsSUFBQUEsZUFBRyxDQUFRLENBQUM7c0JBQ0wsRUFBRSxJQUFJLENBQUNuQixNQUFNLENBQUNSLFVBQVUsQ0FBQzRCLEVBQUUsQ0FBQyxDQUFDLENBQUM7UUFDOUMsR0FDQ0MsSUFBSSxDQUFDdEIsT0FDTGIsS0FBSyxDQUFDQTtJQUNYO0lBRUEsT0FBTztRQUFFb0MsV0FBV0MsT0FBT1QsV0FBVyxDQUFDLEVBQUUsQ0FBQ2hDLEtBQUs7SUFBRTtBQUNuRCJ9
|
package/dist/create.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAO9C,eAAO,MAAM,MAAM,EAAE,MAqBpB,CAAA"}
|
package/dist/create.js
CHANGED
@@ -8,13 +8,8 @@ Object.defineProperty(exports, "create", {
|
|
8
8
|
return create;
|
9
9
|
}
|
10
10
|
});
|
11
|
-
const
|
11
|
+
const _getTableName = require("./schema/getTableName");
|
12
12
|
const _upsertRow = require("./upsertRow");
|
13
|
-
function _interop_require_default(obj) {
|
14
|
-
return obj && obj.__esModule ? obj : {
|
15
|
-
default: obj
|
16
|
-
};
|
17
|
-
}
|
18
13
|
const create = async function create({ collection: collectionSlug, data, req }) {
|
19
14
|
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
20
15
|
const collection = this.payload.collections[collectionSlug].config;
|
@@ -24,10 +19,13 @@ const create = async function create({ collection: collectionSlug, data, req })
|
|
24
19
|
db,
|
25
20
|
fields: collection.fields,
|
26
21
|
operation: 'create',
|
27
|
-
|
28
|
-
|
22
|
+
req,
|
23
|
+
tableName: (0, _getTableName.getTableName)({
|
24
|
+
adapter: this,
|
25
|
+
config: collection
|
26
|
+
})
|
29
27
|
});
|
30
28
|
return result;
|
31
29
|
};
|
32
30
|
|
33
|
-
//# sourceMappingURL=data:application/json;base64,
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBDcmVhdGUgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuXG5pbXBvcnQgdHlwZSB7IFBvc3RncmVzQWRhcHRlciB9IGZyb20gJy4vdHlwZXMnXG5cbmltcG9ydCB7IGdldFRhYmxlTmFtZSB9IGZyb20gJy4vc2NoZW1hL2dldFRhYmxlTmFtZSdcbmltcG9ydCB7IHVwc2VydFJvdyB9IGZyb20gJy4vdXBzZXJ0Um93J1xuXG5leHBvcnQgY29uc3QgY3JlYXRlOiBDcmVhdGUgPSBhc3luYyBmdW5jdGlvbiBjcmVhdGUoXG4gIHRoaXM6IFBvc3RncmVzQWRhcHRlcixcbiAgeyBjb2xsZWN0aW9uOiBjb2xsZWN0aW9uU2x1ZywgZGF0YSwgcmVxIH0sXG4pIHtcbiAgY29uc3QgZGIgPSB0aGlzLnNlc3Npb25zW3JlcS50cmFuc2FjdGlvbklEXT8uZGIgfHwgdGhpcy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MsV0FBVyxDQUFDUixlQUFlLENBQUNTLE1BQU07SUFFbEUsTUFBTUMsU0FBUyxNQUFNQyxJQUFBQSxvQkFBUyxFQUFDO1FBQzdCQyxTQUFTLElBQUk7UUFDYlg7UUFDQUU7UUFDQVUsUUFBUWQsV0FBV2MsTUFBTTtRQUN6QkMsV0FBVztRQUNYWjtRQUNBYSxXQUFXQyxJQUFBQSwwQkFBWSxFQUFDO1lBQ3RCSixTQUFTLElBQUk7WUFDYkgsUUFBUVY7UUFDVjtJQUNGO0lBRUEsT0FBT1c7QUFDVCJ9
|
package/dist/createGlobal.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { CreateGlobalArgs } from 'payload/database';
|
2
2
|
import type { TypeWithID } from 'payload/types';
|
3
3
|
import type { PostgresAdapter } from './types';
|
4
|
-
export declare function createGlobal<T extends TypeWithID>(this: PostgresAdapter, { data, req
|
4
|
+
export declare function createGlobal<T extends TypeWithID>(this: PostgresAdapter, { slug, data, req }: CreateGlobalArgs): Promise<T>;
|
5
5
|
//# sourceMappingURL=createGlobal.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createGlobal.d.ts","sourceRoot":"","sources":["../src/createGlobal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAA;
|
1
|
+
{"version":3,"file":"createGlobal.d.ts","sourceRoot":"","sources":["../src/createGlobal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C,wBAAsB,YAAY,CAAC,CAAC,SAAS,UAAU,EACrD,IAAI,EAAE,eAAe,EACrB,EAAE,IAAI,EAAE,IAAI,EAAE,GAA0B,EAAE,EAAE,gBAAgB,GAC3D,OAAO,CAAC,CAAC,CAAC,CAkBZ"}
|
package/dist/createGlobal.js
CHANGED
@@ -8,14 +8,9 @@ Object.defineProperty(exports, "createGlobal", {
|
|
8
8
|
return createGlobal;
|
9
9
|
}
|
10
10
|
});
|
11
|
-
const
|
11
|
+
const _getTableName = require("./schema/getTableName");
|
12
12
|
const _upsertRow = require("./upsertRow");
|
13
|
-
function
|
14
|
-
return obj && obj.__esModule ? obj : {
|
15
|
-
default: obj
|
16
|
-
};
|
17
|
-
}
|
18
|
-
async function createGlobal({ data, req = {}, slug }) {
|
13
|
+
async function createGlobal({ slug, data, req = {} }) {
|
19
14
|
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
20
15
|
const globalConfig = this.payload.globals.config.find((config)=>config.slug === slug);
|
21
16
|
const result = await (0, _upsertRow.upsertRow)({
|
@@ -24,10 +19,13 @@ async function createGlobal({ data, req = {}, slug }) {
|
|
24
19
|
db,
|
25
20
|
fields: globalConfig.fields,
|
26
21
|
operation: 'create',
|
27
|
-
|
28
|
-
|
22
|
+
req,
|
23
|
+
tableName: (0, _getTableName.getTableName)({
|
24
|
+
adapter: this,
|
25
|
+
config: globalConfig
|
26
|
+
})
|
29
27
|
});
|
30
28
|
return result;
|
31
29
|
}
|
32
30
|
|
33
|
-
//# sourceMappingURL=data:application/json;base64,
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGVHbG9iYWwudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBDcmVhdGVHbG9iYWxBcmdzIH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcbmltcG9ydCB0eXBlIHsgUGF5bG9hZFJlcXVlc3QsIFR5cGVXaXRoSUQgfSBmcm9tICdwYXlsb2FkL3R5cGVzJ1xuXG5pbXBvcnQgdHlwZSB7IFBvc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iwiZ2xvYmFsQ29uZmlnIiwicGF5bG9hZCIsImdsb2JhbHMiLCJjb25maWciLCJmaW5kIiwicmVzdWx0IiwidXBzZXJ0Um93IiwiYWRhcHRlciIsImZpZWxkcyIsIm9wZXJhdGlvbiIsInRhYmxlTmFtZSIsImdldFRhYmxlTmFtZSJdLCJtYXBwaW5ncyI6Ijs7OzsrQkFRc0JBOzs7ZUFBQUE7Ozs4QkFITzsyQkFDSDtBQUVuQixlQUFlQSxhQUVwQixFQUFFQyxJQUFJLEVBQUVDLElBQUksRUFBRUMsTUFBTSxDQUFDLENBQW1CLEVBQW9CO0lBRTVELE1BQU1DLEtBQUssSUFBSSxDQUFDQyxRQUFRLENBQUNGLElBQUlHLGFBQWEsQ0FBQyxFQUFFRixNQUFNLElBQUksQ0FBQ0csT0FBTztJQUMvRCxNQUFNQyxlQUFlLElBQUksQ0FBQ0MsT0FBTyxDQUFDQyxPQUFPLENBQUNDLE1BQU0sQ0FBQ0MsSUFBSSxDQUFDLENBQUNELFNBQVdBLE9BQU9WLElBQUksS0FBS0E7SUFFbEYsTUFBTVksU0FBUyxNQUFNQyxJQUFBQSxvQkFBUyxFQUFJO1FBQ2hDQyxTQUFTLElBQUk7UUFDYmI7UUFDQUU7UUFDQVksUUFBUVIsYUFBYVEsTUFBTTtRQUMzQkMsV0FBVztRQUNYZDtRQUNBZSxXQUFXQyxJQUFBQSwwQkFBWSxFQUFDO1lBQ3RCSixTQUFTLElBQUk7WUFDYkosUUFBUUg7UUFDVjtJQUNGO0lBRUEsT0FBT0s7QUFDVCJ9
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { TypeWithVersion } from 'payload/database';
|
2
|
-
import { type CreateGlobalVersionArgs } from 'payload/database';
|
3
2
|
import type { TypeWithID } from 'payload/types';
|
3
|
+
import { type CreateGlobalVersionArgs } from 'payload/database';
|
4
4
|
import type { PostgresAdapter } from './types';
|
5
5
|
export declare function createGlobalVersion<T extends TypeWithID>(this: PostgresAdapter, { autosave, globalSlug, req, versionData }: CreateGlobalVersionArgs): Promise<TypeWithVersion<T>>;
|
6
6
|
//# sourceMappingURL=createGlobalVersion.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createGlobalVersion.d.ts","sourceRoot":"","sources":["../src/createGlobalVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,
|
1
|
+
{"version":3,"file":"createGlobalVersion.d.ts","sourceRoot":"","sources":["../src/createGlobalVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAA;AAG/D,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAG/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAC5D,IAAI,EAAE,eAAe,EACrB,EAAE,QAAQ,EAAE,UAAU,EAAE,GAA0B,EAAE,WAAW,EAAE,EAAE,uBAAuB,+BAmC3F"}
|
@@ -10,18 +10,16 @@ Object.defineProperty(exports, "createGlobalVersion", {
|
|
10
10
|
});
|
11
11
|
const _drizzleorm = require("drizzle-orm");
|
12
12
|
const _versions = require("payload/versions");
|
13
|
-
const
|
13
|
+
const _getTableName = require("./schema/getTableName");
|
14
14
|
const _upsertRow = require("./upsertRow");
|
15
|
-
function _interop_require_default(obj) {
|
16
|
-
return obj && obj.__esModule ? obj : {
|
17
|
-
default: obj
|
18
|
-
};
|
19
|
-
}
|
20
15
|
async function createGlobalVersion({ autosave, globalSlug, req = {}, versionData }) {
|
21
16
|
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
22
17
|
const global = this.payload.globals.config.find(({ slug })=>slug === globalSlug);
|
23
|
-
const
|
24
|
-
|
18
|
+
const tableName = (0, _getTableName.getTableName)({
|
19
|
+
adapter: this,
|
20
|
+
config: global,
|
21
|
+
versions: true
|
22
|
+
});
|
25
23
|
const result = await (0, _upsertRow.upsertRow)({
|
26
24
|
adapter: this,
|
27
25
|
data: {
|
@@ -32,18 +30,18 @@ async function createGlobalVersion({ autosave, globalSlug, req = {}, versionData
|
|
32
30
|
db,
|
33
31
|
fields: (0, _versions.buildVersionGlobalFields)(global),
|
34
32
|
operation: 'create',
|
35
|
-
|
36
|
-
|
33
|
+
req,
|
34
|
+
tableName
|
37
35
|
});
|
38
36
|
const table = this.tables[tableName];
|
39
37
|
if (global.versions.drafts) {
|
40
38
|
await db.execute((0, _drizzleorm.sql)`
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
UPDATE ${table}
|
40
|
+
SET latest = false
|
41
|
+
WHERE ${table.id} != ${result.id};
|
44
42
|
`);
|
45
43
|
}
|
46
44
|
return result;
|
47
45
|
}
|
48
46
|
|
49
|
-
//# sourceMappingURL=data:application/json;base64,
|
47
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGVHbG9iYWxWZXJzaW9uLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgVHlwZVdpdGhWZXJzaW9uIH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcbmltcG9ydCB0eXBlIHsgUGF5bG9hZFJlcXVlc3QsIFR5cGVXaXRoSUQgfSBmcm9tICdwYXlsb2FkL3R5cGVzJ1xuXG5pbXBvcnQgeyBzcWwgfSBmcm9tICdkcml6emxlLW9ybSdcbmltcG9ydCB7IHR5cGUgQ3JlYXRlR2xvYmFsVmVyc2lvbkFyZ3MgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuaW1wb3J0IHsgYnVpbGRWZXJzaW9uR2xvYmFsRmllbGRzIH0gZnJvbSAncGF5bG9hZC92ZXJzaW9ucydcblxuaW1wb3J0IHR5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AiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAC1E,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAA;
|
1
|
+
{"version":3,"file":"createVersion.d.ts","sourceRoot":"","sources":["../src/createVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAC1E,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,eAAe,CAAA;AAK/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C,wBAAsB,aAAa,CAAC,CAAC,SAAS,UAAU,EACtD,IAAI,EAAE,eAAe,EACrB,EACE,QAAQ,EACR,cAAc,EACd,MAAM,EACN,GAA0B,EAC1B,WAAW,GACZ,EAAE,iBAAiB,CAAC,CAAC,CAAC,+BAiDxB"}
|
package/dist/createVersion.js
CHANGED
@@ -10,18 +10,16 @@ Object.defineProperty(exports, "createVersion", {
|
|
10
10
|
});
|
11
11
|
const _drizzleorm = require("drizzle-orm");
|
12
12
|
const _versions = require("payload/versions");
|
13
|
-
const
|
13
|
+
const _getTableName = require("./schema/getTableName");
|
14
14
|
const _upsertRow = require("./upsertRow");
|
15
|
-
function _interop_require_default(obj) {
|
16
|
-
return obj && obj.__esModule ? obj : {
|
17
|
-
default: obj
|
18
|
-
};
|
19
|
-
}
|
20
15
|
async function createVersion({ autosave, collectionSlug, parent, req = {}, versionData }) {
|
21
16
|
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
22
17
|
const collection = this.payload.collections[collectionSlug].config;
|
23
|
-
const
|
24
|
-
|
18
|
+
const tableName = (0, _getTableName.getTableName)({
|
19
|
+
adapter: this,
|
20
|
+
config: collection,
|
21
|
+
versions: true
|
22
|
+
});
|
25
23
|
const result = await (0, _upsertRow.upsertRow)({
|
26
24
|
adapter: this,
|
27
25
|
data: {
|
@@ -33,23 +31,28 @@ async function createVersion({ autosave, collectionSlug, parent, req = {}, versi
|
|
33
31
|
db,
|
34
32
|
fields: (0, _versions.buildVersionCollectionFields)(collection),
|
35
33
|
operation: 'create',
|
36
|
-
|
37
|
-
|
34
|
+
req,
|
35
|
+
tableName
|
38
36
|
});
|
39
37
|
const table = this.tables[tableName];
|
40
|
-
const relationshipsTable = this.tables[
|
38
|
+
const relationshipsTable = this.tables[(0, _getTableName.getTableName)({
|
39
|
+
adapter: this,
|
40
|
+
config: collection,
|
41
|
+
relationships: true,
|
42
|
+
versions: true
|
43
|
+
})];
|
41
44
|
if (collection.versions.drafts) {
|
42
45
|
await db.execute((0, _drizzleorm.sql)`
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
UPDATE ${table}
|
47
|
+
SET latest = false
|
48
|
+
FROM ${relationshipsTable}
|
49
|
+
WHERE ${table.id} = ${relationshipsTable.parent}
|
50
|
+
AND ${relationshipsTable.path} = ${'parent'}
|
51
|
+
AND ${relationshipsTable[`${collectionSlug}ID`]} = ${parent}
|
52
|
+
AND ${table.id} != ${result.id};
|
50
53
|
`);
|
51
54
|
}
|
52
55
|
return result;
|
53
56
|
}
|
54
57
|
|
55
|
-
//# sourceMappingURL=data:application/json;base64,
|
58
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGVWZXJzaW9uLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgQ3JlYXRlVmVyc2lvbkFyZ3MsIFR5cGVXaXRoVmVyc2lvbiB9IGZyb20gJ3BheWxvYWQvZGF0YWJhc2UnXG5pbXBvcnQgdHlwZSB7IFBheWxvYWRSZXF1ZXN0LCBUeXBlV2l0aElEIH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHsgc3FsIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5pbXBvcnQgeyBidWlsZFZlcnNpb25Db2xsZWN0a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{
|
|
9
9
|
}
|
10
10
|
});
|
11
11
|
const _drizzleorm = require("drizzle-orm");
|
12
|
-
const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
|
13
12
|
const _findMany = require("./find/findMany");
|
14
|
-
|
15
|
-
return obj && obj.__esModule ? obj : {
|
16
|
-
default: obj
|
17
|
-
};
|
18
|
-
}
|
13
|
+
const _getTableName = require("./schema/getTableName");
|
19
14
|
const deleteMany = async function deleteMany({ collection, req = {}, where }) {
|
20
15
|
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
21
16
|
const collectionConfig = this.payload.collections[collection].config;
|
22
|
-
const tableName = (0,
|
17
|
+
const tableName = (0, _getTableName.getTableName)({
|
18
|
+
adapter: this,
|
19
|
+
config: collectionConfig
|
20
|
+
});
|
23
21
|
const result = await (0, _findMany.findMany)({
|
24
22
|
adapter: this,
|
25
23
|
fields: collectionConfig.fields,
|
@@ -40,4 +38,4 @@ const deleteMany = async function deleteMany({ collection, req = {}, where }) {
|
|
40
38
|
}
|
41
39
|
};
|
42
40
|
|
43
|
-
//# sourceMappingURL=data:application/json;base64,
|
41
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9kZWxldGVNYW55LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgRGVsZXRlTWFueSB9IGZyb20gJ3BheWxvYWQvZGF0YWJhc2UnXG5pbXBvcnQgdHlwZSB7IFBheWxvYWRSZXF1ZXN0IH0gZnJvbSAncGF5bG9hZC90eXBlcydcblxuaW1wb3J0IHsgaW5BcnJheSB9IGZyb20gJ2RyaXp6bGUtb3JtJ1xuXG5pbXBvcnQgdHlwZSB7IFBvc3RncmVzQWRhcHRlciB9IGZyb20gJy4vdHlwZXMnXG5cbmltcG9ydCB7IGZpbmRNYW55IH0gZnJvbSAnLi9maW5kL2ZpbmRNYW55J1xuaW1wb3J0IHsgZ2V0VGFibGVOY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y9CQyxPQUFPO1FBQ1BDLFFBQVFqQixJQUFJaUIsTUFBTTtRQUNsQkMsTUFBTTtRQUNOQyxZQUFZO1FBQ1puQjtRQUNBVTtRQUNBVDtJQUNGO0lBRUEsTUFBTW1CLE1BQU0sRUFBRTtJQUVkUCxPQUFPUSxJQUFJLENBQUNDLE9BQU8sQ0FBQyxDQUFDQztRQUNuQkgsSUFBSUksSUFBSSxDQUFDRCxLQUFLRSxFQUFFO0lBQ2xCO0lBRUEsSUFBSUwsSUFBSU0sTUFBTSxHQUFHLEdBQUc7UUFDbEIsTUFBTXhCLEdBQUd5QixNQUFNLENBQUMsSUFBSSxDQUFDQyxNQUFNLENBQUNsQixVQUFVLEVBQUVULEtBQUssQ0FBQzRCLElBQUFBLG1CQUFPLEVBQUMsSUFBSSxDQUFDRCxNQUFNLENBQUNsQixVQUFVLENBQUNlLEVBQUUsRUFBRUw7SUFDbkY7QUFDRiJ9
|
package/dist/deleteOne.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"deleteOne.d.ts","sourceRoot":"","sources":["../src/deleteOne.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAajD,eAAO,MAAM,SAAS,EAAE,
|
1
|
+
{"version":3,"file":"deleteOne.d.ts","sourceRoot":"","sources":["../src/deleteOne.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAajD,eAAO,MAAM,SAAS,EAAE,SAyDvB,CAAA"}
|
package/dist/deleteOne.js
CHANGED
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "deleteOne", {
|
|
9
9
|
}
|
10
10
|
});
|
11
11
|
const _drizzleorm = require("drizzle-orm");
|
12
|
-
const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
|
13
12
|
const _buildFindManyArgs = require("./find/buildFindManyArgs");
|
14
13
|
const _buildQuery = /*#__PURE__*/ _interop_require_default(require("./queries/buildQuery"));
|
15
14
|
const _selectDistinct = require("./queries/selectDistinct");
|
15
|
+
const _getTableName = require("./schema/getTableName");
|
16
16
|
const _read = require("./transform/read");
|
17
17
|
function _interop_require_default(obj) {
|
18
18
|
return obj && obj.__esModule ? obj : {
|
@@ -22,7 +22,10 @@ function _interop_require_default(obj) {
|
|
22
22
|
const deleteOne = async function deleteOne({ collection: collectionSlug, req = {}, where: whereArg }) {
|
23
23
|
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
24
24
|
const collection = this.payload.collections[collectionSlug].config;
|
25
|
-
const tableName = (0,
|
25
|
+
const tableName = (0, _getTableName.getTableName)({
|
26
|
+
adapter: this,
|
27
|
+
config: collection
|
28
|
+
});
|
26
29
|
let docToDelete;
|
27
30
|
const { joinAliases, joins, selectFields, where } = await (0, _buildQuery.default)({
|
28
31
|
adapter: this,
|
@@ -71,4 +74,4 @@ const deleteOne = async function deleteOne({ collection: collectionSlug, req = {
|
|
71
74
|
return result;
|
72
75
|
};
|
73
76
|
|
74
|
-
//# sourceMappingURL=data:application/json;base64,
|
77
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9kZWxldGVPbmUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBEZWxldGVPbmUgfSBmcm9tICdwYXlsb2FkL2RhdGFiYXNlJ1xuaW1wb3J0IHR5cGUgeyBQYXlsb2FkUmVxdWVzdCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB7IGVxIH0gZnJvbSAnZHJpenpsZS1vcm0nXG5cbmltcG9ydCB0eXBlIHsgUG9zdGdyZXNBZGFwdGVyIH0gZnJvbSAnLi90eXBlcydcblxuaW1wb3J0IHsgYnVpbGRGaW5kTWFueUFyZ3MgfSBmcm9tICcuL2ZpbmQvYnVpbGRGaW5kTWFueUFyZ3MnXG5pbXBvcnQgYnVp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FNSyxlQUFlQyxJQUFBQSxvQ0FBaUIsRUFBQztZQUNyQ25CLFNBQVMsSUFBSTtZQUNib0IsT0FBTztZQUNQZCxRQUFRcEIsV0FBV29CLE1BQU07WUFDekJSO1FBQ0Y7UUFFQW9CLGFBQWE3QixLQUFLLEdBQUdBO1FBRXJCWSxjQUFjLE1BQU1WLEdBQUd1QixLQUFLLENBQUNoQixVQUFVLENBQUNpQixTQUFTLENBQUNHO0lBQ3BEO0lBRUEsTUFBTUcsU0FBU0MsSUFBQUEsZUFBUyxFQUFDO1FBQ3ZCekIsUUFBUSxJQUFJLENBQUNGLE9BQU8sQ0FBQ0UsTUFBTTtRQUMzQjBCLE1BQU10QjtRQUNOSyxRQUFRcEIsV0FBV29CLE1BQU07SUFDM0I7SUFFQSxNQUFNZixHQUFHaUMsTUFBTSxDQUFDLElBQUksQ0FBQ1AsTUFBTSxDQUFDbkIsVUFBVSxFQUFFVCxLQUFLLENBQUMyQixJQUFBQSxjQUFFLEVBQUMsSUFBSSxDQUFDQyxNQUFNLENBQUNuQixVQUFVLENBQUNlLEVBQUUsRUFBRVosWUFBWVksRUFBRTtJQUUxRixPQUFPUTtBQUNUIn0=
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"deleteVersions.d.ts","sourceRoot":"","sources":["../src/deleteVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAWtD,eAAO,MAAM,cAAc,EAAE,
|
1
|
+
{"version":3,"file":"deleteVersions.d.ts","sourceRoot":"","sources":["../src/deleteVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAWtD,eAAO,MAAM,cAAc,EAAE,cAqC5B,CAAA"}
|
package/dist/deleteVersions.js
CHANGED
@@ -10,17 +10,16 @@ Object.defineProperty(exports, "deleteVersions", {
|
|
10
10
|
});
|
11
11
|
const _drizzleorm = require("drizzle-orm");
|
12
12
|
const _versions = require("payload/versions");
|
13
|
-
const _tosnakecase = /*#__PURE__*/ _interop_require_default(require("to-snake-case"));
|
14
13
|
const _findMany = require("./find/findMany");
|
15
|
-
|
16
|
-
return obj && obj.__esModule ? obj : {
|
17
|
-
default: obj
|
18
|
-
};
|
19
|
-
}
|
14
|
+
const _getTableName = require("./schema/getTableName");
|
20
15
|
const deleteVersions = async function deleteVersion({ collection, locale, req = {}, where: where }) {
|
21
16
|
const db = this.sessions[req.transactionID]?.db || this.drizzle;
|
22
17
|
const collectionConfig = this.payload.collections[collection].config;
|
23
|
-
const tableName =
|
18
|
+
const tableName = (0, _getTableName.getTableName)({
|
19
|
+
adapter: this,
|
20
|
+
config: collectionConfig,
|
21
|
+
versions: true
|
22
|
+
});
|
24
23
|
const fields = (0, _versions.buildVersionCollectionFields)(collectionConfig);
|
25
24
|
const { docs } = await (0, _findMany.findMany)({
|
26
25
|
adapter: this,
|
@@ -43,4 +42,4 @@ const deleteVersions = async function deleteVersion({ collection, locale, req =
|
|
43
42
|
return docs;
|
44
43
|
};
|
45
44
|
|
46
|
-
//# sourceMappingURL=data:application/json;base64,
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9kZWxldGVWZXJzaW9ucy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IERlbGV0ZVZlcnNpb25zIH0gZnJvbSAncGF5bG9hZC9kYXRhYmFzZSdcbmltcG9ydCB0eXBlIHsgUGF5bG9hZFJlcXVlc3QsIFNhbml0aXplZENvbGxlY3Rpb25Db25maWcgfSBmcm9tICdwYXlsb2FkL3R5cGVzJ1xuXG5pbXBvcnQgeyBpbkFycmF5IH0gZnJvbSAnZHJpenpsZS1vcm0nXG5pbXBvcnQgeyBidWlsZFZlcnNpb25Db2xsZWN0aW9uRmllbGRzIH0gZnJvbSAncGF5bG9hZC92ZXJzaW9ucydcblxuaW1wb3J0IHR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
if (adapter.tables[`${tableName}${adapter.relationshipsSuffix}`]) {
|
45
45
|
result.with._rels = {
|
46
46
|
columns: {
|
47
47
|
id: false,
|
@@ -52,7 +52,7 @@ const buildFindManyArgs = ({ adapter, depth, fields, tableName })=>{
|
|
52
52
|
]
|
53
53
|
};
|
54
54
|
}
|
55
|
-
if (adapter.tables[`${tableName}
|
55
|
+
if (adapter.tables[`${tableName}${adapter.localesSuffix}`]) {
|
56
56
|
result.with._locales = _locales;
|
57
57
|
}
|
58
58
|
(0, _traverseFields.traverseFields)({
|
@@ -69,4 +69,4 @@ const buildFindManyArgs = ({ adapter, depth, fields, tableName })=>{
|
|
69
69
|
return result;
|
70
70
|
};
|
71
71
|
|
72
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9maW5kL2J1aWxkRmluZE1hbnlBcmdzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgREJRdWVyeUNvbmZpZyB9IGZyb20gJ2RyaXp6bGUtb3JtJ1xuaW1wb3J0IHR5cGUgeyBGaWVsZCB9IGZyb20gJ3BheWxvYWQvdHlwZXMnXG5cbmltcG9ydCB0eXBlIHsgUG9zdGdyZXNBZGFwdGVyIH0gZnJvbSAnLi4vdHlwZXMnXG5cbmltcG9ydCB7IHRyYXZlcnNlRmllbGRzIH0gZnJvbSAnLi90cmF2ZXJzZUZpZWxkcydcblxudHlwZSBCdWlsZEZpbmRRdWVyeUFyZ3MgPSB7XG4gIGFkYXB0ZXI6IFBvc3RncmVzQWRhcHRlclxuICBkZXB0aDogbnVtYmVyXG4gIGZpZWxkczogRmllbGRbXVxuICB0YWJsZU5hbWU6IHN0cmluZ1xufVxuXG5leHBvcnQgdHlwZSBSZXN1bHQgPSBEQlF1ZXJ5Q29uZmlnPCdtYW55JywgdHJ1ZSwgYW55LCBhbnk+
|
72
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW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