@payloadcms/db-mongodb 3.65.0-canary.10 → 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.
Files changed (48) hide show
  1. package/dist/count.js +3 -3
  2. package/dist/count.js.map +1 -1
  3. package/dist/countGlobalVersions.js +3 -3
  4. package/dist/countGlobalVersions.js.map +1 -1
  5. package/dist/countVersions.js +3 -3
  6. package/dist/countVersions.js.map +1 -1
  7. package/dist/create.js +5 -5
  8. package/dist/create.js.map +1 -1
  9. package/dist/createGlobalVersion.js +5 -5
  10. package/dist/createGlobalVersion.js.map +1 -1
  11. package/dist/createVersion.js +5 -5
  12. package/dist/createVersion.js.map +1 -1
  13. package/dist/deleteMany.js +3 -3
  14. package/dist/deleteMany.js.map +1 -1
  15. package/dist/deleteOne.js +6 -6
  16. package/dist/deleteOne.js.map +1 -1
  17. package/dist/deleteVersions.js +1 -1
  18. package/dist/deleteVersions.js.map +1 -1
  19. package/dist/find.js +1 -1
  20. package/dist/find.js.map +1 -1
  21. package/dist/findDistinct.js +1 -1
  22. package/dist/findDistinct.js.map +1 -1
  23. package/dist/findGlobal.d.ts.map +1 -1
  24. package/dist/findGlobal.js +9 -9
  25. package/dist/findGlobal.js.map +1 -1
  26. package/dist/findGlobalVersions.js +6 -6
  27. package/dist/findGlobalVersions.js.map +1 -1
  28. package/dist/findOne.js +5 -5
  29. package/dist/findOne.js.map +1 -1
  30. package/dist/findVersions.js +6 -6
  31. package/dist/findVersions.js.map +1 -1
  32. package/dist/queryDrafts.d.ts.map +1 -1
  33. package/dist/queryDrafts.js +4 -3
  34. package/dist/queryDrafts.js.map +1 -1
  35. package/dist/updateGlobal.js +7 -7
  36. package/dist/updateGlobal.js.map +1 -1
  37. package/dist/updateGlobalVersion.d.ts.map +1 -1
  38. package/dist/updateGlobalVersion.js +12 -12
  39. package/dist/updateGlobalVersion.js.map +1 -1
  40. package/dist/updateJobs.js +7 -7
  41. package/dist/updateJobs.js.map +1 -1
  42. package/dist/updateMany.js +13 -13
  43. package/dist/updateMany.js.map +1 -1
  44. package/dist/updateOne.js +13 -13
  45. package/dist/updateOne.js.map +1 -1
  46. package/dist/updateVersion.js +12 -12
  47. package/dist/updateVersion.js.map +1 -1
  48. package/package.json +3 -3
@@ -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 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 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","lean","new","projection","session","timestamps","query","data","operation","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,MAAMP,UAAsC;QAC1C,GAAGC,WAAW;QACdgB,MAAM;QACNC,KAAK;QACLC,YAAY5B,0BAA0B;YACpCkB,SAAS,IAAI;YACbI,QAAQG;YACRZ;QACF;QACAgB,SAAS,MAAM3B,WAAW,IAAI,EAAES;QAChC,uDAAuD;QACvDmB,YAAY;IACd;IAEA,MAAMC,QAAQ,MAAMhC,WAAW;QAC7BmB,SAAS,IAAI;QACbI,QAAQG;QACRjB;QACAO,OAAOK;IACT;IAEAjB,UAAU;QAAEe,SAAS,IAAI;QAAEc,MAAMlB;QAAaQ;QAAQW,WAAW;IAAQ;IAEzE,IAAIrB,cAAc,OAAO;QACvB,MAAMK,MAAMiB,SAAS,CAACH,OAAOjB,aAAaL;QAC1C,OAAO;IACT;IAEA,MAAM0B,MAAM,MAAMlB,MAAMmB,gBAAgB,CAACL,OAAOjB,aAAaL;IAE7D,IAAI,CAAC0B,KAAK;QACR,OAAO;IACT;IAEAhC,UAAU;QAAEe,SAAS,IAAI;QAAEc,MAAMG;QAAKb;QAAQW,WAAW;IAAO;IAEhE,OAAOE;AACT,EAAC"}
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,c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version": "3.65.0-canary.10",
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.10"
58
+ "payload": "3.65.0-canary.12"
59
59
  },
60
60
  "peerDependencies": {
61
- "payload": "3.65.0-canary.10"
61
+ "payload": "3.65.0-canary.12"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "pnpm build:types && pnpm build:swc",