@payloadcms/db-mongodb 3.2.2-canary.a11698b → 3.2.2-canary.d2399ed
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/count.d.ts.map +1 -1
- package/dist/count.js +19 -21
- package/dist/count.js.map +1 -1
- package/dist/countGlobalVersions.d.ts.map +1 -1
- package/dist/countGlobalVersions.js +19 -21
- package/dist/countGlobalVersions.js.map +1 -1
- package/dist/countVersions.d.ts.map +1 -1
- package/dist/countVersions.js +19 -21
- package/dist/countVersions.js.map +1 -1
- package/dist/create.d.ts.map +1 -1
- package/dist/create.js +22 -22
- package/dist/create.js.map +1 -1
- package/dist/createGlobal.d.ts.map +1 -1
- package/dist/createGlobal.js +21 -19
- package/dist/createGlobal.js.map +1 -1
- package/dist/createGlobalVersion.d.ts.map +1 -1
- package/dist/createGlobalVersion.js +35 -30
- package/dist/createGlobalVersion.js.map +1 -1
- package/dist/createVersion.d.ts.map +1 -1
- package/dist/createVersion.js +35 -30
- package/dist/createVersion.js.map +1 -1
- package/dist/deleteMany.d.ts.map +1 -1
- package/dist/deleteMany.js +6 -6
- package/dist/deleteMany.js.map +1 -1
- package/dist/deleteOne.d.ts.map +1 -1
- package/dist/deleteOne.js +17 -13
- package/dist/deleteOne.js.map +1 -1
- package/dist/deleteVersions.d.ts.map +1 -1
- package/dist/deleteVersions.js +6 -6
- package/dist/deleteVersions.js.map +1 -1
- package/dist/find.d.ts.map +1 -1
- package/dist/find.js +41 -74
- package/dist/find.js.map +1 -1
- package/dist/findGlobal.d.ts.map +1 -1
- package/dist/findGlobal.js +19 -18
- package/dist/findGlobal.js.map +1 -1
- package/dist/findGlobalVersions.d.ts.map +1 -1
- package/dist/findGlobalVersions.js +33 -62
- package/dist/findGlobalVersions.js.map +1 -1
- package/dist/findOne.d.ts.map +1 -1
- package/dist/findOne.js +32 -19
- package/dist/findOne.js.map +1 -1
- package/dist/findVersions.d.ts.map +1 -1
- package/dist/findVersions.js +34 -62
- package/dist/findVersions.js.map +1 -1
- package/dist/{withSession.d.ts → getSession.d.ts} +2 -4
- package/dist/getSession.d.ts.map +1 -0
- package/dist/{withSession.js → getSession.js} +3 -5
- package/dist/getSession.js.map +1 -0
- package/dist/predefinedMigrations/migrateRelationshipsV2_V3.d.ts.map +1 -1
- package/dist/predefinedMigrations/migrateRelationshipsV2_V3.js +20 -16
- package/dist/predefinedMigrations/migrateRelationshipsV2_V3.js.map +1 -1
- package/dist/predefinedMigrations/migrateVersionsV1_V2.js +2 -2
- package/dist/predefinedMigrations/migrateVersionsV1_V2.js.map +1 -1
- package/dist/queries/buildAndOrConditions.d.ts +3 -1
- package/dist/queries/buildAndOrConditions.d.ts.map +1 -1
- package/dist/queries/buildAndOrConditions.js +2 -1
- package/dist/queries/buildAndOrConditions.js.map +1 -1
- package/dist/queries/buildQuery.d.ts +2 -0
- package/dist/queries/buildQuery.d.ts.map +1 -1
- package/dist/queries/buildQuery.js +2 -6
- package/dist/queries/buildQuery.js.map +1 -1
- package/dist/queries/buildSearchParams.d.ts +3 -1
- package/dist/queries/buildSearchParams.d.ts.map +1 -1
- package/dist/queries/buildSearchParams.js +14 -10
- package/dist/queries/buildSearchParams.js.map +1 -1
- package/dist/queries/buildSortParam.d.ts +1 -7
- package/dist/queries/buildSortParam.d.ts.map +1 -1
- package/dist/queries/buildSortParam.js +2 -2
- package/dist/queries/buildSortParam.js.map +1 -1
- package/dist/queries/getLocalizedSortProperty.js +2 -2
- package/dist/queries/getLocalizedSortProperty.js.map +1 -1
- package/dist/queries/parseParams.d.ts +3 -1
- package/dist/queries/parseParams.d.ts.map +1 -1
- package/dist/queries/parseParams.js +2 -1
- package/dist/queries/parseParams.js.map +1 -1
- package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
- package/dist/queries/sanitizeQueryValue.js +16 -0
- package/dist/queries/sanitizeQueryValue.js.map +1 -1
- package/dist/queryDrafts.d.ts.map +1 -1
- package/dist/queryDrafts.js +41 -65
- package/dist/queryDrafts.js.map +1 -1
- package/dist/updateGlobal.d.ts.map +1 -1
- package/dist/updateGlobal.js +25 -23
- package/dist/updateGlobal.js.map +1 -1
- package/dist/updateGlobalVersion.d.ts.map +1 -1
- package/dist/updateGlobalVersion.js +28 -27
- package/dist/updateGlobalVersion.js.map +1 -1
- package/dist/updateOne.d.ts.map +1 -1
- package/dist/updateOne.js +28 -24
- package/dist/updateOne.js.map +1 -1
- package/dist/updateVersion.d.ts.map +1 -1
- package/dist/updateVersion.js +28 -26
- package/dist/updateVersion.js.map +1 -1
- package/dist/utilities/buildJoinAggregation.d.ts +4 -4
- package/dist/utilities/buildJoinAggregation.d.ts.map +1 -1
- package/dist/utilities/buildJoinAggregation.js +7 -28
- package/dist/utilities/buildJoinAggregation.js.map +1 -1
- package/dist/utilities/buildProjectionFromSelect.d.ts.map +1 -1
- package/dist/utilities/buildProjectionFromSelect.js +18 -1
- package/dist/utilities/buildProjectionFromSelect.js.map +1 -1
- package/dist/utilities/findMany.d.ts +20 -0
- package/dist/utilities/findMany.d.ts.map +1 -0
- package/dist/utilities/findMany.js +84 -0
- package/dist/utilities/findMany.js.map +1 -0
- package/dist/utilities/getHasNearConstraint.d.ts +3 -0
- package/dist/utilities/getHasNearConstraint.d.ts.map +1 -0
- package/dist/utilities/getHasNearConstraint.js +26 -0
- package/dist/utilities/getHasNearConstraint.js.map +1 -0
- package/dist/utilities/transform.d.ts +17 -0
- package/dist/utilities/transform.d.ts.map +1 -0
- package/dist/utilities/transform.js +250 -0
- package/dist/utilities/transform.js.map +1 -0
- package/dist/utilities/{sanitizeRelationshipIDs.spec.js → transform.spec.js} +23 -7
- package/dist/utilities/transform.spec.js.map +1 -0
- package/package.json +3 -3
- package/dist/utilities/sanitizeInternalFields.d.ts +0 -2
- package/dist/utilities/sanitizeInternalFields.d.ts.map +0 -1
- package/dist/utilities/sanitizeInternalFields.js +0 -20
- package/dist/utilities/sanitizeInternalFields.js.map +0 -1
- package/dist/utilities/sanitizeRelationshipIDs.d.ts +0 -9
- package/dist/utilities/sanitizeRelationshipIDs.d.ts.map +0 -1
- package/dist/utilities/sanitizeRelationshipIDs.js +0 -125
- package/dist/utilities/sanitizeRelationshipIDs.js.map +0 -1
- package/dist/utilities/sanitizeRelationshipIDs.spec.js.map +0 -1
- package/dist/withSession.d.ts.map +0 -1
- package/dist/withSession.js.map +0 -1
package/dist/createVersion.js
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import { Types } from 'mongoose';
|
|
2
2
|
import { buildVersionCollectionFields } from 'payload';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { getSession } from './getSession.js';
|
|
4
|
+
import { transform } from './utilities/transform.js';
|
|
5
5
|
export const createVersion = async function createVersion({ autosave, collectionSlug, createdAt, parent, publishedLocale, req = {}, snapshot, updatedAt, versionData }) {
|
|
6
6
|
const VersionModel = this.versions[collectionSlug];
|
|
7
|
-
const
|
|
8
|
-
const data =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
const session = await getSession(this, req);
|
|
8
|
+
const data = {
|
|
9
|
+
autosave,
|
|
10
|
+
createdAt,
|
|
11
|
+
latest: true,
|
|
12
|
+
parent,
|
|
13
|
+
publishedLocale,
|
|
14
|
+
snapshot,
|
|
15
|
+
updatedAt,
|
|
16
|
+
version: versionData
|
|
17
|
+
};
|
|
18
|
+
const fields = buildVersionCollectionFields(this.payload.config, this.payload.collections[collectionSlug].config, true);
|
|
19
|
+
transform({
|
|
20
|
+
adapter: this,
|
|
21
|
+
data,
|
|
22
|
+
fields,
|
|
23
|
+
operation: 'create'
|
|
24
|
+
});
|
|
25
|
+
const { insertedId } = await VersionModel.collection.insertOne(data, {
|
|
26
|
+
session
|
|
21
27
|
});
|
|
22
|
-
|
|
23
|
-
data
|
|
24
|
-
], options, req);
|
|
28
|
+
data._id = insertedId;
|
|
25
29
|
const parentQuery = {
|
|
26
30
|
$or: [
|
|
27
31
|
{
|
|
@@ -38,11 +42,11 @@ export const createVersion = async function createVersion({ autosave, collection
|
|
|
38
42
|
}
|
|
39
43
|
});
|
|
40
44
|
}
|
|
41
|
-
await VersionModel.updateMany({
|
|
45
|
+
await VersionModel.collection.updateMany({
|
|
42
46
|
$and: [
|
|
43
47
|
{
|
|
44
48
|
_id: {
|
|
45
|
-
$ne:
|
|
49
|
+
$ne: insertedId
|
|
46
50
|
}
|
|
47
51
|
},
|
|
48
52
|
parentQuery,
|
|
@@ -56,15 +60,16 @@ export const createVersion = async function createVersion({ autosave, collection
|
|
|
56
60
|
$unset: {
|
|
57
61
|
latest: 1
|
|
58
62
|
}
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
}, {
|
|
64
|
+
session
|
|
65
|
+
});
|
|
66
|
+
transform({
|
|
67
|
+
adapter: this,
|
|
68
|
+
data,
|
|
69
|
+
fields,
|
|
70
|
+
operation: 'read'
|
|
71
|
+
});
|
|
72
|
+
return data;
|
|
68
73
|
};
|
|
69
74
|
|
|
70
75
|
//# sourceMappingURL=createVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/createVersion.ts"],"sourcesContent":["import { Types } from 'mongoose'\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/createVersion.ts"],"sourcesContent":["import { Types } from 'mongoose'\nimport { buildVersionCollectionFields, type CreateVersion, type PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { getSession } from './getSession.js'\nimport { transform } from './utilities/transform.js'\n\nexport const createVersion: CreateVersion = async function createVersion(\n this: MongooseAdapter,\n {\n autosave,\n collectionSlug,\n createdAt,\n parent,\n publishedLocale,\n req = {} as PayloadRequest,\n snapshot,\n updatedAt,\n versionData,\n },\n) {\n const VersionModel = this.versions[collectionSlug]\n const session = await getSession(this, req)\n\n const data: any = {\n autosave,\n createdAt,\n latest: true,\n parent,\n publishedLocale,\n snapshot,\n updatedAt,\n version: versionData,\n }\n\n const fields = buildVersionCollectionFields(\n this.payload.config,\n this.payload.collections[collectionSlug].config,\n true,\n )\n\n transform({\n adapter: this,\n data,\n fields,\n operation: 'create',\n })\n\n const { insertedId } = await VersionModel.collection.insertOne(data, { session })\n data._id = insertedId\n\n const parentQuery = {\n $or: [\n {\n parent: {\n $eq: data.parent,\n },\n },\n ],\n }\n if ((data.parent as unknown) instanceof Types.ObjectId) {\n parentQuery.$or.push({\n parent: {\n $eq: data.parent.toString(),\n },\n })\n }\n\n await VersionModel.collection.updateMany(\n {\n $and: [\n {\n _id: {\n $ne: insertedId,\n },\n },\n parentQuery,\n {\n latest: {\n $eq: true,\n },\n },\n ],\n },\n { $unset: { latest: 1 } },\n { session },\n )\n\n transform({\n adapter: this,\n data,\n fields,\n operation: 'read',\n })\n\n return data\n}\n"],"names":["Types","buildVersionCollectionFields","getSession","transform","createVersion","autosave","collectionSlug","createdAt","parent","publishedLocale","req","snapshot","updatedAt","versionData","VersionModel","versions","session","data","latest","version","fields","payload","config","collections","adapter","operation","insertedId","collection","insertOne","_id","parentQuery","$or","$eq","ObjectId","push","toString","updateMany","$and","$ne","$unset"],"mappings":"AAAA,SAASA,KAAK,QAAQ,WAAU;AAChC,SAASC,4BAA4B,QAAiD,UAAS;AAI/F,SAASC,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,gBAA+B,eAAeA,cAEzD,EACEC,QAAQ,EACRC,cAAc,EACdC,SAAS,EACTC,MAAM,EACNC,eAAe,EACfC,MAAM,CAAC,CAAmB,EAC1BC,QAAQ,EACRC,SAAS,EACTC,WAAW,EACZ;IAED,MAAMC,eAAe,IAAI,CAACC,QAAQ,CAACT,eAAe;IAClD,MAAMU,UAAU,MAAMd,WAAW,IAAI,EAAEQ;IAEvC,MAAMO,OAAY;QAChBZ;QACAE;QACAW,QAAQ;QACRV;QACAC;QACAE;QACAC;QACAO,SAASN;IACX;IAEA,MAAMO,SAASnB,6BACb,IAAI,CAACoB,OAAO,CAACC,MAAM,EACnB,IAAI,CAACD,OAAO,CAACE,WAAW,CAACjB,eAAe,CAACgB,MAAM,EAC/C;IAGFnB,UAAU;QACRqB,SAAS,IAAI;QACbP;QACAG;QACAK,WAAW;IACb;IAEA,MAAM,EAAEC,UAAU,EAAE,GAAG,MAAMZ,aAAaa,UAAU,CAACC,SAAS,CAACX,MAAM;QAAED;IAAQ;IAC/EC,KAAKY,GAAG,GAAGH;IAEX,MAAMI,cAAc;QAClBC,KAAK;YACH;gBACEvB,QAAQ;oBACNwB,KAAKf,KAAKT,MAAM;gBAClB;YACF;SACD;IACH;IACA,IAAI,AAACS,KAAKT,MAAM,YAAwBR,MAAMiC,QAAQ,EAAE;QACtDH,YAAYC,GAAG,CAACG,IAAI,CAAC;YACnB1B,QAAQ;gBACNwB,KAAKf,KAAKT,MAAM,CAAC2B,QAAQ;YAC3B;QACF;IACF;IAEA,MAAMrB,aAAaa,UAAU,CAACS,UAAU,CACtC;QACEC,MAAM;YACJ;gBACER,KAAK;oBACHS,KAAKZ;gBACP;YACF;YACAI;YACA;gBACEZ,QAAQ;oBACNc,KAAK;gBACP;YACF;SACD;IACH,GACA;QAAEO,QAAQ;YAAErB,QAAQ;QAAE;IAAE,GACxB;QAAEF;IAAQ;IAGZb,UAAU;QACRqB,SAAS,IAAI;QACbP;QACAG;QACAK,WAAW;IACb;IAEA,OAAOR;AACT,EAAC"}
|
package/dist/deleteMany.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteMany.d.ts","sourceRoot":"","sources":["../src/deleteMany.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,SAAS,CAAA;AAMzD,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"deleteMany.d.ts","sourceRoot":"","sources":["../src/deleteMany.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,SAAS,CAAA;AAMzD,eAAO,MAAM,UAAU,EAAE,UAiBxB,CAAA"}
|
package/dist/deleteMany.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getSession } from './getSession.js';
|
|
2
2
|
export const deleteMany = async function deleteMany({ collection, req = {}, where }) {
|
|
3
3
|
const Model = this.collections[collection];
|
|
4
|
-
const
|
|
5
|
-
...await withSession(this, req),
|
|
6
|
-
lean: true
|
|
7
|
-
};
|
|
4
|
+
const session = await getSession(this, req);
|
|
8
5
|
const query = await Model.buildQuery({
|
|
9
6
|
payload: this.payload,
|
|
7
|
+
session,
|
|
10
8
|
where
|
|
11
9
|
});
|
|
12
|
-
await Model.deleteMany(query,
|
|
10
|
+
await Model.collection.deleteMany(query, {
|
|
11
|
+
session
|
|
12
|
+
});
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
//# sourceMappingURL=deleteMany.js.map
|
package/dist/deleteMany.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/deleteMany.ts"],"sourcesContent":["import type { DeleteMany, PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/deleteMany.ts"],"sourcesContent":["import type { DeleteMany, PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { getSession } from './getSession.js'\n\nexport const deleteMany: DeleteMany = async function deleteMany(\n this: MongooseAdapter,\n { collection, req = {} as PayloadRequest, where },\n) {\n const Model = this.collections[collection]\n\n const session = await getSession(this, req)\n\n const query = await Model.buildQuery({\n payload: this.payload,\n session,\n where,\n })\n\n await Model.collection.deleteMany(query, {\n session,\n })\n}\n"],"names":["getSession","deleteMany","collection","req","where","Model","collections","session","query","buildQuery","payload"],"mappings":"AAIA,SAASA,UAAU,QAAQ,kBAAiB;AAE5C,OAAO,MAAMC,aAAyB,eAAeA,WAEnD,EAAEC,UAAU,EAAEC,MAAM,CAAC,CAAmB,EAAEC,KAAK,EAAE;IAEjD,MAAMC,QAAQ,IAAI,CAACC,WAAW,CAACJ,WAAW;IAE1C,MAAMK,UAAU,MAAMP,WAAW,IAAI,EAAEG;IAEvC,MAAMK,QAAQ,MAAMH,MAAMI,UAAU,CAAC;QACnCC,SAAS,IAAI,CAACA,OAAO;QACrBH;QACAH;IACF;IAEA,MAAMC,MAAMH,UAAU,CAACD,UAAU,CAACO,OAAO;QACvCD;IACF;AACF,EAAC"}
|
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,
|
|
1
|
+
{"version":3,"file":"deleteOne.d.ts","sourceRoot":"","sources":["../src/deleteOne.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,SAAS,CAAA;AAQxD,eAAO,MAAM,SAAS,EAAE,SAgCvB,CAAA"}
|
package/dist/deleteOne.js
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
|
+
import { getSession } from './getSession.js';
|
|
1
2
|
import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js';
|
|
2
|
-
import {
|
|
3
|
-
import { withSession } from './withSession.js';
|
|
3
|
+
import { transform } from './utilities/transform.js';
|
|
4
4
|
export const deleteOne = async function deleteOne({ collection, req = {}, select, where }) {
|
|
5
5
|
const Model = this.collections[collection];
|
|
6
|
-
const
|
|
6
|
+
const session = await getSession(this, req);
|
|
7
7
|
const query = await Model.buildQuery({
|
|
8
8
|
payload: this.payload,
|
|
9
|
+
session,
|
|
9
10
|
where
|
|
10
11
|
});
|
|
11
|
-
const
|
|
12
|
-
|
|
12
|
+
const fields = this.payload.collections[collection].config.flattenedFields;
|
|
13
|
+
const doc = await Model.collection.findOneAndDelete(query, {
|
|
13
14
|
projection: buildProjectionFromSelect({
|
|
14
15
|
adapter: this,
|
|
15
|
-
fields
|
|
16
|
+
fields,
|
|
16
17
|
select
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
}),
|
|
19
|
+
session
|
|
20
|
+
});
|
|
21
|
+
transform({
|
|
22
|
+
adapter: this,
|
|
23
|
+
data: doc,
|
|
24
|
+
fields,
|
|
25
|
+
operation: 'read'
|
|
26
|
+
});
|
|
27
|
+
return doc;
|
|
24
28
|
};
|
|
25
29
|
|
|
26
30
|
//# sourceMappingURL=deleteOne.js.map
|
package/dist/deleteOne.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/deleteOne.ts"],"sourcesContent":["import type { DeleteOne,
|
|
1
|
+
{"version":3,"sources":["../src/deleteOne.ts"],"sourcesContent":["import type { DeleteOne, PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { getSession } from './getSession.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { transform } from './utilities/transform.js'\n\nexport const deleteOne: DeleteOne = async function deleteOne(\n this: MongooseAdapter,\n { collection, req = {} as PayloadRequest, select, where },\n) {\n const Model = this.collections[collection]\n const session = await getSession(this, req)\n\n const query = await Model.buildQuery({\n payload: this.payload,\n session,\n where,\n })\n\n const fields = this.payload.collections[collection].config.flattenedFields\n\n const doc = await Model.collection.findOneAndDelete(query, {\n projection: buildProjectionFromSelect({\n adapter: this,\n fields,\n select,\n }),\n session,\n })\n\n transform({\n adapter: this,\n data: doc,\n fields,\n operation: 'read',\n })\n\n return doc\n}\n"],"names":["getSession","buildProjectionFromSelect","transform","deleteOne","collection","req","select","where","Model","collections","session","query","buildQuery","payload","fields","config","flattenedFields","doc","findOneAndDelete","projection","adapter","data","operation"],"mappings":"AAIA,SAASA,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,YAAuB,eAAeA,UAEjD,EAAEC,UAAU,EAAEC,MAAM,CAAC,CAAmB,EAAEC,MAAM,EAAEC,KAAK,EAAE;IAEzD,MAAMC,QAAQ,IAAI,CAACC,WAAW,CAACL,WAAW;IAC1C,MAAMM,UAAU,MAAMV,WAAW,IAAI,EAAEK;IAEvC,MAAMM,QAAQ,MAAMH,MAAMI,UAAU,CAAC;QACnCC,SAAS,IAAI,CAACA,OAAO;QACrBH;QACAH;IACF;IAEA,MAAMO,SAAS,IAAI,CAACD,OAAO,CAACJ,WAAW,CAACL,WAAW,CAACW,MAAM,CAACC,eAAe;IAE1E,MAAMC,MAAM,MAAMT,MAAMJ,UAAU,CAACc,gBAAgB,CAACP,OAAO;QACzDQ,YAAYlB,0BAA0B;YACpCmB,SAAS,IAAI;YACbN;YACAR;QACF;QACAI;IACF;IAEAR,UAAU;QACRkB,SAAS,IAAI;QACbC,MAAMJ;QACNH;QACAQ,WAAW;IACb;IAEA,OAAOL;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteVersions.d.ts","sourceRoot":"","sources":["../src/deleteVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,SAAS,CAAA;AAM7D,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"deleteVersions.d.ts","sourceRoot":"","sources":["../src/deleteVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,SAAS,CAAA;AAM7D,eAAO,MAAM,cAAc,EAAE,cAkB5B,CAAA"}
|
package/dist/deleteVersions.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getSession } from './getSession.js';
|
|
2
2
|
export const deleteVersions = async function deleteVersions({ collection, locale, req = {}, where }) {
|
|
3
3
|
const VersionsModel = this.versions[collection];
|
|
4
|
-
const
|
|
5
|
-
...await withSession(this, req),
|
|
6
|
-
lean: true
|
|
7
|
-
};
|
|
4
|
+
const session = await getSession(this, req);
|
|
8
5
|
const query = await VersionsModel.buildQuery({
|
|
9
6
|
locale,
|
|
10
7
|
payload: this.payload,
|
|
8
|
+
session,
|
|
11
9
|
where
|
|
12
10
|
});
|
|
13
|
-
await VersionsModel.deleteMany(query,
|
|
11
|
+
await VersionsModel.collection.deleteMany(query, {
|
|
12
|
+
session
|
|
13
|
+
});
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
//# sourceMappingURL=deleteVersions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/deleteVersions.ts"],"sourcesContent":["import type { DeleteVersions, PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/deleteVersions.ts"],"sourcesContent":["import type { DeleteVersions, PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { getSession } from './getSession.js'\n\nexport const deleteVersions: DeleteVersions = async function deleteVersions(\n this: MongooseAdapter,\n { collection, locale, req = {} as PayloadRequest, where },\n) {\n const VersionsModel = this.versions[collection]\n\n const session = await getSession(this, req)\n\n const query = await VersionsModel.buildQuery({\n locale,\n payload: this.payload,\n session,\n where,\n })\n\n await VersionsModel.collection.deleteMany(query, {\n session,\n })\n}\n"],"names":["getSession","deleteVersions","collection","locale","req","where","VersionsModel","versions","session","query","buildQuery","payload","deleteMany"],"mappings":"AAIA,SAASA,UAAU,QAAQ,kBAAiB;AAE5C,OAAO,MAAMC,iBAAiC,eAAeA,eAE3D,EAAEC,UAAU,EAAEC,MAAM,EAAEC,MAAM,CAAC,CAAmB,EAAEC,KAAK,EAAE;IAEzD,MAAMC,gBAAgB,IAAI,CAACC,QAAQ,CAACL,WAAW;IAE/C,MAAMM,UAAU,MAAMR,WAAW,IAAI,EAAEI;IAEvC,MAAMK,QAAQ,MAAMH,cAAcI,UAAU,CAAC;QAC3CP;QACAQ,SAAS,IAAI,CAACA,OAAO;QACrBH;QACAH;IACF;IAEA,MAAMC,cAAcJ,UAAU,CAACU,UAAU,CAACH,OAAO;QAC/CD;IACF;AACF,EAAC"}
|
package/dist/find.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../src/find.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,SAAS,CAAA;AAYnD,eAAO,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../src/find.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,SAAS,CAAA;AAYnD,eAAO,MAAM,IAAI,EAAE,IAoFlB,CAAA"}
|
package/dist/find.js
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getSession } from './getSession.js';
|
|
2
2
|
import { buildSortParam } from './queries/buildSortParam.js';
|
|
3
3
|
import { buildJoinAggregation } from './utilities/buildJoinAggregation.js';
|
|
4
4
|
import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
5
|
+
import { findMany } from './utilities/findMany.js';
|
|
6
|
+
import { getHasNearConstraint } from './utilities/getHasNearConstraint.js';
|
|
7
|
+
import { transform } from './utilities/transform.js';
|
|
8
|
+
export const find = async function find({ collection, joins = {}, limit = 0, locale, page, pagination, req = {}, select, sort: sortArg, where }) {
|
|
8
9
|
const Model = this.collections[collection];
|
|
9
10
|
const collectionConfig = this.payload.collections[collection].config;
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const constraints = flattenWhereToOperators(where);
|
|
14
|
-
hasNearConstraint = constraints.some((prop)=>Object.keys(prop).some((key)=>key === 'near'));
|
|
15
|
-
}
|
|
11
|
+
const session = await getSession(this, req);
|
|
12
|
+
const hasNearConstraint = getHasNearConstraint(where);
|
|
13
|
+
const fields = collectionConfig.flattenedFields;
|
|
16
14
|
let sort;
|
|
17
15
|
if (!hasNearConstraint) {
|
|
18
16
|
sort = buildSortParam({
|
|
19
17
|
config: this.payload.config,
|
|
20
|
-
fields
|
|
18
|
+
fields,
|
|
21
19
|
locale,
|
|
22
20
|
sort: sortArg || collectionConfig.defaultSort,
|
|
23
21
|
timestamps: true
|
|
@@ -26,80 +24,49 @@ export const find = async function find({ collection, joins = {}, limit = 0, loc
|
|
|
26
24
|
const query = await Model.buildQuery({
|
|
27
25
|
locale,
|
|
28
26
|
payload: this.payload,
|
|
27
|
+
session,
|
|
29
28
|
where
|
|
30
29
|
});
|
|
31
30
|
// useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.
|
|
32
31
|
const useEstimatedCount = hasNearConstraint || !query || Object.keys(query).length === 0;
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
const projection = buildProjectionFromSelect({
|
|
33
|
+
adapter: this,
|
|
34
|
+
fields,
|
|
35
|
+
select
|
|
36
|
+
});
|
|
37
|
+
const collation = this.collation ? {
|
|
38
|
+
locale: locale && locale !== 'all' && locale !== '*' ? locale : 'en',
|
|
39
|
+
...this.collation
|
|
40
|
+
} : undefined;
|
|
41
|
+
const joinAgreggation = await buildJoinAggregation({
|
|
42
|
+
adapter: this,
|
|
43
|
+
collection,
|
|
44
|
+
collectionConfig,
|
|
45
|
+
joins,
|
|
46
|
+
locale,
|
|
47
|
+
session
|
|
48
|
+
});
|
|
49
|
+
const result = await findMany({
|
|
50
|
+
adapter: this,
|
|
51
|
+
collation,
|
|
52
|
+
collection: Model.collection,
|
|
53
|
+
joinAgreggation,
|
|
54
|
+
limit,
|
|
37
55
|
page,
|
|
38
56
|
pagination,
|
|
39
57
|
projection,
|
|
58
|
+
query,
|
|
59
|
+
session,
|
|
40
60
|
sort,
|
|
41
61
|
useEstimatedCount
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
paginationOptions.projection = buildProjectionFromSelect({
|
|
45
|
-
adapter: this,
|
|
46
|
-
fields: collectionConfig.flattenedFields,
|
|
47
|
-
select
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
if (this.collation) {
|
|
51
|
-
const defaultLocale = 'en';
|
|
52
|
-
paginationOptions.collation = {
|
|
53
|
-
locale: locale && locale !== 'all' && locale !== '*' ? locale : defaultLocale,
|
|
54
|
-
...this.collation
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
if (!useEstimatedCount && Object.keys(query).length === 0 && this.disableIndexHints !== true) {
|
|
58
|
-
// Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding
|
|
59
|
-
// a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,
|
|
60
|
-
// which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses
|
|
61
|
-
// the correct indexed field
|
|
62
|
-
paginationOptions.useCustomCountFn = ()=>{
|
|
63
|
-
return Promise.resolve(Model.countDocuments(query, {
|
|
64
|
-
...options,
|
|
65
|
-
hint: {
|
|
66
|
-
_id: 1
|
|
67
|
-
}
|
|
68
|
-
}));
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
if (limit >= 0) {
|
|
72
|
-
paginationOptions.limit = limit;
|
|
73
|
-
// limit must also be set here, it's ignored when pagination is false
|
|
74
|
-
paginationOptions.options.limit = limit;
|
|
75
|
-
// Disable pagination if limit is 0
|
|
76
|
-
if (limit === 0) {
|
|
77
|
-
paginationOptions.pagination = false;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
let result;
|
|
81
|
-
const aggregate = await buildJoinAggregation({
|
|
62
|
+
});
|
|
63
|
+
transform({
|
|
82
64
|
adapter: this,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
locale,
|
|
87
|
-
query
|
|
65
|
+
data: result.docs,
|
|
66
|
+
fields,
|
|
67
|
+
operation: 'read'
|
|
88
68
|
});
|
|
89
|
-
|
|
90
|
-
if (aggregate) {
|
|
91
|
-
result = await Model.aggregatePaginate(Model.aggregate(aggregate), paginationOptions);
|
|
92
|
-
} else {
|
|
93
|
-
result = await Model.paginate(query, paginationOptions);
|
|
94
|
-
}
|
|
95
|
-
const docs = JSON.parse(JSON.stringify(result.docs));
|
|
96
|
-
return {
|
|
97
|
-
...result,
|
|
98
|
-
docs: docs.map((doc)=>{
|
|
99
|
-
doc.id = doc._id;
|
|
100
|
-
return sanitizeInternalFields(doc);
|
|
101
|
-
})
|
|
102
|
-
};
|
|
69
|
+
return result;
|
|
103
70
|
};
|
|
104
71
|
|
|
105
72
|
//# sourceMappingURL=find.js.map
|
package/dist/find.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/find.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/find.ts"],"sourcesContent":["import type { CollationOptions } from 'mongodb'\nimport type { Find, PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { getSession } from './getSession.js'\nimport { buildSortParam } from './queries/buildSortParam.js'\nimport { buildJoinAggregation } from './utilities/buildJoinAggregation.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { findMany } from './utilities/findMany.js'\nimport { getHasNearConstraint } from './utilities/getHasNearConstraint.js'\nimport { transform } from './utilities/transform.js'\n\nexport const find: Find = async function find(\n this: MongooseAdapter,\n {\n collection,\n joins = {},\n limit = 0,\n locale,\n page,\n pagination,\n req = {} as PayloadRequest,\n select,\n sort: sortArg,\n where,\n },\n) {\n const Model = this.collections[collection]\n const collectionConfig = this.payload.collections[collection].config\n const session = await getSession(this, req)\n\n const hasNearConstraint = getHasNearConstraint(where)\n\n const fields = collectionConfig.flattenedFields\n\n let sort\n if (!hasNearConstraint) {\n sort = buildSortParam({\n config: this.payload.config,\n fields,\n locale,\n sort: sortArg || collectionConfig.defaultSort,\n timestamps: true,\n })\n }\n\n const query = await Model.buildQuery({\n locale,\n payload: this.payload,\n session,\n where,\n })\n\n // useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.\n const useEstimatedCount = hasNearConstraint || !query || Object.keys(query).length === 0\n\n const projection = buildProjectionFromSelect({\n adapter: this,\n fields,\n select,\n })\n\n const collation: CollationOptions | undefined = this.collation\n ? {\n locale: locale && locale !== 'all' && locale !== '*' ? locale : 'en',\n ...this.collation,\n }\n : undefined\n\n const joinAgreggation = await buildJoinAggregation({\n adapter: this,\n collection,\n collectionConfig,\n joins,\n locale,\n session,\n })\n\n const result = await findMany({\n adapter: this,\n collation,\n collection: Model.collection,\n joinAgreggation,\n limit,\n page,\n pagination,\n projection,\n query,\n session,\n sort,\n useEstimatedCount,\n })\n\n transform({ adapter: this, data: result.docs, fields, operation: 'read' })\n\n return result\n}\n"],"names":["getSession","buildSortParam","buildJoinAggregation","buildProjectionFromSelect","findMany","getHasNearConstraint","transform","find","collection","joins","limit","locale","page","pagination","req","select","sort","sortArg","where","Model","collections","collectionConfig","payload","config","session","hasNearConstraint","fields","flattenedFields","defaultSort","timestamps","query","buildQuery","useEstimatedCount","Object","keys","length","projection","adapter","collation","undefined","joinAgreggation","result","data","docs","operation"],"mappings":"AAKA,SAASA,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,oBAAoB,QAAQ,sCAAqC;AAC1E,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,QAAQ,QAAQ,0BAAyB;AAClD,SAASC,oBAAoB,QAAQ,sCAAqC;AAC1E,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,OAAa,eAAeA,KAEvC,EACEC,UAAU,EACVC,QAAQ,CAAC,CAAC,EACVC,QAAQ,CAAC,EACTC,MAAM,EACNC,IAAI,EACJC,UAAU,EACVC,MAAM,CAAC,CAAmB,EAC1BC,MAAM,EACNC,MAAMC,OAAO,EACbC,KAAK,EACN;IAED,MAAMC,QAAQ,IAAI,CAACC,WAAW,CAACZ,WAAW;IAC1C,MAAMa,mBAAmB,IAAI,CAACC,OAAO,CAACF,WAAW,CAACZ,WAAW,CAACe,MAAM;IACpE,MAAMC,UAAU,MAAMxB,WAAW,IAAI,EAAEc;IAEvC,MAAMW,oBAAoBpB,qBAAqBa;IAE/C,MAAMQ,SAASL,iBAAiBM,eAAe;IAE/C,IAAIX;IACJ,IAAI,CAACS,mBAAmB;QACtBT,OAAOf,eAAe;YACpBsB,QAAQ,IAAI,CAACD,OAAO,CAACC,MAAM;YAC3BG;YACAf;YACAK,MAAMC,WAAWI,iBAAiBO,WAAW;YAC7CC,YAAY;QACd;IACF;IAEA,MAAMC,QAAQ,MAAMX,MAAMY,UAAU,CAAC;QACnCpB;QACAW,SAAS,IAAI,CAACA,OAAO;QACrBE;QACAN;IACF;IAEA,4HAA4H;IAC5H,MAAMc,oBAAoBP,qBAAqB,CAACK,SAASG,OAAOC,IAAI,CAACJ,OAAOK,MAAM,KAAK;IAEvF,MAAMC,aAAajC,0BAA0B;QAC3CkC,SAAS,IAAI;QACbX;QACAX;IACF;IAEA,MAAMuB,YAA0C,IAAI,CAACA,SAAS,GAC1D;QACE3B,QAAQA,UAAUA,WAAW,SAASA,WAAW,MAAMA,SAAS;QAChE,GAAG,IAAI,CAAC2B,SAAS;IACnB,IACAC;IAEJ,MAAMC,kBAAkB,MAAMtC,qBAAqB;QACjDmC,SAAS,IAAI;QACb7B;QACAa;QACAZ;QACAE;QACAa;IACF;IAEA,MAAMiB,SAAS,MAAMrC,SAAS;QAC5BiC,SAAS,IAAI;QACbC;QACA9B,YAAYW,MAAMX,UAAU;QAC5BgC;QACA9B;QACAE;QACAC;QACAuB;QACAN;QACAN;QACAR;QACAgB;IACF;IAEA1B,UAAU;QAAE+B,SAAS,IAAI;QAAEK,MAAMD,OAAOE,IAAI;QAAEjB;QAAQkB,WAAW;IAAO;IAExE,OAAOH;AACT,EAAC"}
|
package/dist/findGlobal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findGlobal.d.ts","sourceRoot":"","sources":["../src/findGlobal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,SAAS,CAAA;AAUzD,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"findGlobal.d.ts","sourceRoot":"","sources":["../src/findGlobal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,SAAS,CAAA;AAUzD,eAAO,MAAM,UAAU,EAAE,UAkCxB,CAAA"}
|
package/dist/findGlobal.js
CHANGED
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import { combineQueries } from 'payload';
|
|
2
|
+
import { getSession } from './getSession.js';
|
|
2
3
|
import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js';
|
|
3
|
-
import {
|
|
4
|
-
import { withSession } from './withSession.js';
|
|
4
|
+
import { transform } from './utilities/transform.js';
|
|
5
5
|
export const findGlobal = async function findGlobal({ slug, locale, req = {}, select, where }) {
|
|
6
6
|
const Model = this.globals;
|
|
7
|
-
const
|
|
8
|
-
...await withSession(this, req),
|
|
9
|
-
lean: true,
|
|
10
|
-
select: buildProjectionFromSelect({
|
|
11
|
-
adapter: this,
|
|
12
|
-
fields: this.payload.globals.config.find((each)=>each.slug === slug).flattenedFields,
|
|
13
|
-
select
|
|
14
|
-
})
|
|
15
|
-
};
|
|
7
|
+
const session = await getSession(this, req);
|
|
16
8
|
const query = await Model.buildQuery({
|
|
17
9
|
globalSlug: slug,
|
|
18
10
|
locale,
|
|
19
11
|
payload: this.payload,
|
|
12
|
+
session,
|
|
20
13
|
where: combineQueries({
|
|
21
14
|
globalType: {
|
|
22
15
|
equals: slug
|
|
23
16
|
}
|
|
24
17
|
}, where)
|
|
25
18
|
});
|
|
26
|
-
|
|
19
|
+
const fields = this.payload.globals.config.find((each)=>each.slug === slug).flattenedFields;
|
|
20
|
+
const doc = await Model.collection.findOne(query, {
|
|
21
|
+
projection: buildProjectionFromSelect({
|
|
22
|
+
adapter: this,
|
|
23
|
+
fields,
|
|
24
|
+
select
|
|
25
|
+
}),
|
|
26
|
+
session: await getSession(this, req)
|
|
27
|
+
});
|
|
27
28
|
if (!doc) {
|
|
28
29
|
return null;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
transform({
|
|
32
|
+
adapter: this,
|
|
33
|
+
data: doc,
|
|
34
|
+
fields,
|
|
35
|
+
operation: 'read'
|
|
36
|
+
});
|
|
36
37
|
return doc;
|
|
37
38
|
};
|
|
38
39
|
|
package/dist/findGlobal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/findGlobal.ts"],"sourcesContent":["import type { FindGlobal, PayloadRequest } from 'payload'\n\nimport { combineQueries } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/findGlobal.ts"],"sourcesContent":["import type { FindGlobal, PayloadRequest } from 'payload'\n\nimport { combineQueries } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { getSession } from './getSession.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { transform } from './utilities/transform.js'\n\nexport const findGlobal: FindGlobal = async function findGlobal(\n this: MongooseAdapter,\n { slug, locale, req = {} as PayloadRequest, select, where },\n) {\n const Model = this.globals\n\n const session = await getSession(this, req)\n\n const query = await Model.buildQuery({\n globalSlug: slug,\n locale,\n payload: this.payload,\n session,\n where: combineQueries({ globalType: { equals: slug } }, where),\n })\n\n const fields = this.payload.globals.config.find((each) => each.slug === slug).flattenedFields\n\n const doc = await Model.collection.findOne(query, {\n projection: buildProjectionFromSelect({\n adapter: this,\n fields,\n select,\n }),\n session: await getSession(this, req),\n })\n\n if (!doc) {\n return null\n }\n\n transform({ adapter: this, data: doc, fields, operation: 'read' })\n\n return doc as any\n}\n"],"names":["combineQueries","getSession","buildProjectionFromSelect","transform","findGlobal","slug","locale","req","select","where","Model","globals","session","query","buildQuery","globalSlug","payload","globalType","equals","fields","config","find","each","flattenedFields","doc","collection","findOne","projection","adapter","data","operation"],"mappings":"AAEA,SAASA,cAAc,QAAQ,UAAS;AAIxC,SAASC,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,aAAyB,eAAeA,WAEnD,EAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,CAAC,CAAmB,EAAEC,MAAM,EAAEC,KAAK,EAAE;IAE3D,MAAMC,QAAQ,IAAI,CAACC,OAAO;IAE1B,MAAMC,UAAU,MAAMX,WAAW,IAAI,EAAEM;IAEvC,MAAMM,QAAQ,MAAMH,MAAMI,UAAU,CAAC;QACnCC,YAAYV;QACZC;QACAU,SAAS,IAAI,CAACA,OAAO;QACrBJ;QACAH,OAAOT,eAAe;YAAEiB,YAAY;gBAAEC,QAAQb;YAAK;QAAE,GAAGI;IAC1D;IAEA,MAAMU,SAAS,IAAI,CAACH,OAAO,CAACL,OAAO,CAACS,MAAM,CAACC,IAAI,CAAC,CAACC,OAASA,KAAKjB,IAAI,KAAKA,MAAMkB,eAAe;IAE7F,MAAMC,MAAM,MAAMd,MAAMe,UAAU,CAACC,OAAO,CAACb,OAAO;QAChDc,YAAYzB,0BAA0B;YACpC0B,SAAS,IAAI;YACbT;YACAX;QACF;QACAI,SAAS,MAAMX,WAAW,IAAI,EAAEM;IAClC;IAEA,IAAI,CAACiB,KAAK;QACR,OAAO;IACT;IAEArB,UAAU;QAAEyB,SAAS,IAAI;QAAEC,MAAML;QAAKL;QAAQW,WAAW;IAAO;IAEhE,OAAON;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findGlobalVersions.d.ts","sourceRoot":"","sources":["../src/findGlobalVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"findGlobalVersions.d.ts","sourceRoot":"","sources":["../src/findGlobalVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,SAAS,CAAA;AAajE,eAAO,MAAM,kBAAkB,EAAE,kBAgFhC,CAAA"}
|