@payloadcms/db-mongodb 3.65.0-canary.11 → 3.65.0-canary.12
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.js +3 -3
- package/dist/count.js.map +1 -1
- package/dist/countGlobalVersions.js +3 -3
- package/dist/countGlobalVersions.js.map +1 -1
- package/dist/countVersions.js +3 -3
- package/dist/countVersions.js.map +1 -1
- package/dist/create.js +5 -5
- package/dist/create.js.map +1 -1
- package/dist/createGlobalVersion.js +5 -5
- package/dist/createGlobalVersion.js.map +1 -1
- package/dist/createVersion.js +5 -5
- package/dist/createVersion.js.map +1 -1
- package/dist/deleteMany.js +3 -3
- package/dist/deleteMany.js.map +1 -1
- package/dist/deleteOne.js +6 -6
- package/dist/deleteOne.js.map +1 -1
- package/dist/deleteVersions.js +1 -1
- package/dist/deleteVersions.js.map +1 -1
- package/dist/find.js +1 -1
- package/dist/find.js.map +1 -1
- package/dist/findDistinct.js +1 -1
- package/dist/findDistinct.js.map +1 -1
- package/dist/findGlobal.d.ts.map +1 -1
- package/dist/findGlobal.js +9 -9
- package/dist/findGlobal.js.map +1 -1
- package/dist/findGlobalVersions.js +6 -6
- package/dist/findGlobalVersions.js.map +1 -1
- package/dist/findOne.js +5 -5
- package/dist/findOne.js.map +1 -1
- package/dist/findVersions.js +6 -6
- package/dist/findVersions.js.map +1 -1
- package/dist/queryDrafts.d.ts.map +1 -1
- package/dist/queryDrafts.js +4 -3
- package/dist/queryDrafts.js.map +1 -1
- package/dist/updateGlobal.js +7 -7
- package/dist/updateGlobal.js.map +1 -1
- package/dist/updateGlobalVersion.d.ts.map +1 -1
- package/dist/updateGlobalVersion.js +12 -12
- package/dist/updateGlobalVersion.js.map +1 -1
- package/dist/updateJobs.js +7 -7
- package/dist/updateJobs.js.map +1 -1
- package/dist/updateMany.js +13 -13
- package/dist/updateMany.js.map +1 -1
- package/dist/updateOne.js +13 -13
- package/dist/updateOne.js.map +1 -1
- package/dist/updateVersion.js +12 -12
- package/dist/updateVersion.js.map +1 -1
- package/package.json +3 -3
package/dist/updateVersion.js
CHANGED
|
@@ -17,6 +17,18 @@ export const updateVersion = async function updateVersion({ id, collection: coll
|
|
|
17
17
|
};
|
|
18
18
|
const fields = buildVersionCollectionFields(this.payload.config, collectionConfig);
|
|
19
19
|
const flattenedFields = buildVersionCollectionFields(this.payload.config, collectionConfig, true);
|
|
20
|
+
const query = await buildQuery({
|
|
21
|
+
adapter: this,
|
|
22
|
+
fields: flattenedFields,
|
|
23
|
+
locale,
|
|
24
|
+
where: whereToUse
|
|
25
|
+
});
|
|
26
|
+
transform({
|
|
27
|
+
adapter: this,
|
|
28
|
+
data: versionData,
|
|
29
|
+
fields,
|
|
30
|
+
operation: 'write'
|
|
31
|
+
});
|
|
20
32
|
const options = {
|
|
21
33
|
...optionsArgs,
|
|
22
34
|
lean: true,
|
|
@@ -30,18 +42,6 @@ export const updateVersion = async function updateVersion({ id, collection: coll
|
|
|
30
42
|
// Timestamps are manually added by the write transform
|
|
31
43
|
timestamps: false
|
|
32
44
|
};
|
|
33
|
-
const query = await buildQuery({
|
|
34
|
-
adapter: this,
|
|
35
|
-
fields: flattenedFields,
|
|
36
|
-
locale,
|
|
37
|
-
where: whereToUse
|
|
38
|
-
});
|
|
39
|
-
transform({
|
|
40
|
-
adapter: this,
|
|
41
|
-
data: versionData,
|
|
42
|
-
fields,
|
|
43
|
-
operation: 'write'
|
|
44
|
-
});
|
|
45
45
|
if (returning === false) {
|
|
46
46
|
await Model.updateOne(query, versionData, options);
|
|
47
47
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/updateVersion.ts"],"sourcesContent":["import type { MongooseUpdateQueryOptions } from 'mongoose'\n\nimport { buildVersionCollectionFields, type UpdateVersion } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getCollection } from './utilities/getEntity.js'\nimport { getSession } from './utilities/getSession.js'\nimport { transform } from './utilities/transform.js'\n\nexport const updateVersion: UpdateVersion = async function updateVersion(\n this: MongooseAdapter,\n {\n id,\n collection: collectionSlug,\n locale,\n options: optionsArgs = {},\n req,\n returning,\n select,\n versionData,\n where,\n },\n) {\n const { collectionConfig, Model } = getCollection({\n adapter: this,\n collectionSlug,\n versions: true,\n })\n\n const whereToUse = where || { id: { equals: id } }\n const fields = buildVersionCollectionFields(this.payload.config, collectionConfig)\n\n const flattenedFields = buildVersionCollectionFields(this.payload.config, collectionConfig, true)\n\n const options: MongooseUpdateQueryOptions = {\n ...optionsArgs,\n lean: true,\n new: true,\n projection: buildProjectionFromSelect({\n adapter: this,\n fields: flattenedFields,\n select,\n }),\n session: await getSession(this, req),\n // Timestamps are manually added by the write transform\n timestamps: false,\n }\n\n
|
|
1
|
+
{"version":3,"sources":["../src/updateVersion.ts"],"sourcesContent":["import type { MongooseUpdateQueryOptions } from 'mongoose'\n\nimport { buildVersionCollectionFields, type UpdateVersion } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getCollection } from './utilities/getEntity.js'\nimport { getSession } from './utilities/getSession.js'\nimport { transform } from './utilities/transform.js'\n\nexport const updateVersion: UpdateVersion = async function updateVersion(\n this: MongooseAdapter,\n {\n id,\n collection: collectionSlug,\n locale,\n options: optionsArgs = {},\n req,\n returning,\n select,\n versionData,\n where,\n },\n) {\n const { collectionConfig, Model } = getCollection({\n adapter: this,\n collectionSlug,\n versions: true,\n })\n\n const whereToUse = where || { id: { equals: id } }\n const fields = buildVersionCollectionFields(this.payload.config, collectionConfig)\n\n const flattenedFields = buildVersionCollectionFields(this.payload.config, collectionConfig, true)\n\n const query = await buildQuery({\n adapter: this,\n fields: flattenedFields,\n locale,\n where: whereToUse,\n })\n\n transform({ adapter: this, data: versionData, fields, operation: 'write' })\n\n const options: MongooseUpdateQueryOptions = {\n ...optionsArgs,\n lean: true,\n new: true,\n projection: buildProjectionFromSelect({\n adapter: this,\n fields: flattenedFields,\n select,\n }),\n session: await getSession(this, req),\n // Timestamps are manually added by the write transform\n timestamps: false,\n }\n\n if (returning === false) {\n await Model.updateOne(query, versionData, options)\n return null\n }\n\n const doc = await Model.findOneAndUpdate(query, versionData, options)\n\n if (!doc) {\n return null\n }\n\n transform({ adapter: this, data: doc, fields, operation: 'read' })\n\n return doc\n}\n"],"names":["buildVersionCollectionFields","buildQuery","buildProjectionFromSelect","getCollection","getSession","transform","updateVersion","id","collection","collectionSlug","locale","options","optionsArgs","req","returning","select","versionData","where","collectionConfig","Model","adapter","versions","whereToUse","equals","fields","payload","config","flattenedFields","query","data","operation","lean","new","projection","session","timestamps","updateOne","doc","findOneAndUpdate"],"mappings":"AAEA,SAASA,4BAA4B,QAA4B,UAAS;AAI1E,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,aAAa,QAAQ,2BAA0B;AACxD,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,gBAA+B,eAAeA,cAEzD,EACEC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,MAAM,EACNC,SAASC,cAAc,CAAC,CAAC,EACzBC,GAAG,EACHC,SAAS,EACTC,MAAM,EACNC,WAAW,EACXC,KAAK,EACN;IAED,MAAM,EAAEC,gBAAgB,EAAEC,KAAK,EAAE,GAAGhB,cAAc;QAChDiB,SAAS,IAAI;QACbX;QACAY,UAAU;IACZ;IAEA,MAAMC,aAAaL,SAAS;QAAEV,IAAI;YAAEgB,QAAQhB;QAAG;IAAE;IACjD,MAAMiB,SAASxB,6BAA6B,IAAI,CAACyB,OAAO,CAACC,MAAM,EAAER;IAEjE,MAAMS,kBAAkB3B,6BAA6B,IAAI,CAACyB,OAAO,CAACC,MAAM,EAAER,kBAAkB;IAE5F,MAAMU,QAAQ,MAAM3B,WAAW;QAC7BmB,SAAS,IAAI;QACbI,QAAQG;QACRjB;QACAO,OAAOK;IACT;IAEAjB,UAAU;QAAEe,SAAS,IAAI;QAAES,MAAMb;QAAaQ;QAAQM,WAAW;IAAQ;IAEzE,MAAMnB,UAAsC;QAC1C,GAAGC,WAAW;QACdmB,MAAM;QACNC,KAAK;QACLC,YAAY/B,0BAA0B;YACpCkB,SAAS,IAAI;YACbI,QAAQG;YACRZ;QACF;QACAmB,SAAS,MAAM9B,WAAW,IAAI,EAAES;QAChC,uDAAuD;QACvDsB,YAAY;IACd;IAEA,IAAIrB,cAAc,OAAO;QACvB,MAAMK,MAAMiB,SAAS,CAACR,OAAOZ,aAAaL;QAC1C,OAAO;IACT;IAEA,MAAM0B,MAAM,MAAMlB,MAAMmB,gBAAgB,CAACV,OAAOZ,aAAaL;IAE7D,IAAI,CAAC0B,KAAK;QACR,OAAO;IACT;IAEAhC,UAAU;QAAEe,SAAS,IAAI;QAAES,MAAMQ;QAAKb;QAAQM,WAAW;IAAO;IAEhE,OAAOO;AACT,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/db-mongodb",
|
|
3
|
-
"version": "3.65.0-canary.
|
|
3
|
+
"version": "3.65.0-canary.12",
|
|
4
4
|
"description": "The officially supported MongoDB database adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"mongodb": "6.16.0",
|
|
56
56
|
"mongodb-memory-server": "10.1.4",
|
|
57
57
|
"@payloadcms/eslint-config": "3.28.0",
|
|
58
|
-
"payload": "3.65.0-canary.
|
|
58
|
+
"payload": "3.65.0-canary.12"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"payload": "3.65.0-canary.
|
|
61
|
+
"payload": "3.65.0-canary.12"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "pnpm build:types && pnpm build:swc",
|