@payloadcms/db-mongodb 3.24.0-canary.f229d8d → 3.25.0-canary.36940b2

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 (132) hide show
  1. package/dist/count.d.ts.map +1 -1
  2. package/dist/count.js +5 -2
  3. package/dist/count.js.map +1 -1
  4. package/dist/countGlobalVersions.d.ts.map +1 -1
  5. package/dist/countGlobalVersions.js +5 -3
  6. package/dist/countGlobalVersions.js.map +1 -1
  7. package/dist/countVersions.d.ts.map +1 -1
  8. package/dist/countVersions.js +5 -3
  9. package/dist/countVersions.js.map +1 -1
  10. package/dist/create.js +15 -15
  11. package/dist/create.js.map +1 -1
  12. package/dist/createGlobal.d.ts.map +1 -1
  13. package/dist/createGlobal.js +15 -14
  14. package/dist/createGlobal.js.map +1 -1
  15. package/dist/createGlobalVersion.d.ts.map +1 -1
  16. package/dist/createGlobalVersion.js +26 -23
  17. package/dist/createGlobalVersion.js.map +1 -1
  18. package/dist/createVersion.d.ts.map +1 -1
  19. package/dist/createVersion.js +26 -31
  20. package/dist/createVersion.js.map +1 -1
  21. package/dist/deleteMany.d.ts.map +1 -1
  22. package/dist/deleteMany.js +5 -2
  23. package/dist/deleteMany.js.map +1 -1
  24. package/dist/deleteOne.d.ts.map +1 -1
  25. package/dist/deleteOne.js +17 -9
  26. package/dist/deleteOne.js.map +1 -1
  27. package/dist/deleteVersions.d.ts +1 -1
  28. package/dist/deleteVersions.d.ts.map +1 -1
  29. package/dist/deleteVersions.js +5 -2
  30. package/dist/deleteVersions.js.map +1 -1
  31. package/dist/find.d.ts.map +1 -1
  32. package/dist/find.js +13 -11
  33. package/dist/find.js.map +1 -1
  34. package/dist/findGlobal.d.ts.map +1 -1
  35. package/dist/findGlobal.js +15 -11
  36. package/dist/findGlobal.js.map +1 -1
  37. package/dist/findGlobalVersions.d.ts.map +1 -1
  38. package/dist/findGlobalVersions.js +14 -13
  39. package/dist/findGlobalVersions.js.map +1 -1
  40. package/dist/findOne.d.ts.map +1 -1
  41. package/dist/findOne.js +13 -8
  42. package/dist/findOne.js.map +1 -1
  43. package/dist/findVersions.d.ts.map +1 -1
  44. package/dist/findVersions.js +14 -12
  45. package/dist/findVersions.js.map +1 -1
  46. package/dist/init.d.ts.map +1 -1
  47. package/dist/init.js +25 -17
  48. package/dist/init.js.map +1 -1
  49. package/dist/models/buildCollectionSchema.d.ts.map +1 -1
  50. package/dist/models/buildCollectionSchema.js +14 -10
  51. package/dist/models/buildCollectionSchema.js.map +1 -1
  52. package/dist/models/buildGlobalModel.d.ts.map +1 -1
  53. package/dist/models/buildGlobalModel.js +9 -5
  54. package/dist/models/buildGlobalModel.js.map +1 -1
  55. package/dist/models/buildSchema.d.ts +6 -1
  56. package/dist/models/buildSchema.d.ts.map +1 -1
  57. package/dist/models/buildSchema.js +222 -99
  58. package/dist/models/buildSchema.js.map +1 -1
  59. package/dist/predefinedMigrations/migrateRelationshipsV2_V3.d.ts.map +1 -1
  60. package/dist/predefinedMigrations/migrateRelationshipsV2_V3.js +17 -8
  61. package/dist/predefinedMigrations/migrateRelationshipsV2_V3.js.map +1 -1
  62. package/dist/queries/buildAndOrConditions.d.ts +2 -1
  63. package/dist/queries/buildAndOrConditions.d.ts.map +1 -1
  64. package/dist/queries/buildAndOrConditions.js +2 -1
  65. package/dist/queries/buildAndOrConditions.js.map +1 -1
  66. package/dist/queries/buildQuery.d.ts +6 -9
  67. package/dist/queries/buildQuery.d.ts.map +1 -1
  68. package/dist/queries/buildQuery.js +11 -34
  69. package/dist/queries/buildQuery.js.map +1 -1
  70. package/dist/queries/buildSearchParams.d.ts +2 -1
  71. package/dist/queries/buildSearchParams.d.ts.map +1 -1
  72. package/dist/queries/buildSearchParams.js +20 -1
  73. package/dist/queries/buildSearchParams.js.map +1 -1
  74. package/dist/queries/buildSortParam.d.ts +2 -1
  75. package/dist/queries/buildSortParam.d.ts.map +1 -1
  76. package/dist/queries/buildSortParam.js +2 -1
  77. package/dist/queries/buildSortParam.js.map +1 -1
  78. package/dist/queries/getBuildQueryPlugin.d.ts +14 -0
  79. package/dist/queries/getBuildQueryPlugin.d.ts.map +1 -0
  80. package/dist/queries/getBuildQueryPlugin.js +40 -0
  81. package/dist/queries/getBuildQueryPlugin.js.map +1 -0
  82. package/dist/queries/getLocalizedSortProperty.d.ts +2 -1
  83. package/dist/queries/getLocalizedSortProperty.d.ts.map +1 -1
  84. package/dist/queries/getLocalizedSortProperty.js +11 -3
  85. package/dist/queries/getLocalizedSortProperty.js.map +1 -1
  86. package/dist/queries/parseParams.d.ts +2 -1
  87. package/dist/queries/parseParams.d.ts.map +1 -1
  88. package/dist/queries/parseParams.js +3 -1
  89. package/dist/queries/parseParams.js.map +1 -1
  90. package/dist/queries/sanitizeQueryValue.d.ts +2 -1
  91. package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
  92. package/dist/queries/sanitizeQueryValue.js +6 -2
  93. package/dist/queries/sanitizeQueryValue.js.map +1 -1
  94. package/dist/queryDrafts.d.ts.map +1 -1
  95. package/dist/queryDrafts.js +19 -16
  96. package/dist/queryDrafts.js.map +1 -1
  97. package/dist/types.d.ts +1 -1
  98. package/dist/types.d.ts.map +1 -1
  99. package/dist/types.js.map +1 -1
  100. package/dist/updateGlobal.d.ts.map +1 -1
  101. package/dist/updateGlobal.js +15 -12
  102. package/dist/updateGlobal.js.map +1 -1
  103. package/dist/updateGlobalVersion.d.ts.map +1 -1
  104. package/dist/updateGlobalVersion.js +21 -15
  105. package/dist/updateGlobalVersion.js.map +1 -1
  106. package/dist/updateOne.js +20 -11
  107. package/dist/updateOne.js.map +1 -1
  108. package/dist/updateVersion.d.ts.map +1 -1
  109. package/dist/updateVersion.js +21 -15
  110. package/dist/updateVersion.js.map +1 -1
  111. package/dist/utilities/buildJoinAggregation.d.ts.map +1 -1
  112. package/dist/utilities/buildJoinAggregation.js +155 -4
  113. package/dist/utilities/buildJoinAggregation.js.map +1 -1
  114. package/dist/utilities/buildProjectionFromSelect.d.ts.map +1 -1
  115. package/dist/utilities/buildProjectionFromSelect.js +18 -17
  116. package/dist/utilities/buildProjectionFromSelect.js.map +1 -1
  117. package/dist/utilities/transform.d.ts +27 -0
  118. package/dist/utilities/transform.d.ts.map +1 -0
  119. package/dist/utilities/transform.js +224 -0
  120. package/dist/utilities/transform.js.map +1 -0
  121. package/dist/utilities/{sanitizeRelationshipIDs.spec.js → transform.spec.js} +55 -5
  122. package/dist/utilities/transform.spec.js.map +1 -0
  123. package/package.json +3 -3
  124. package/dist/utilities/sanitizeInternalFields.d.ts +0 -2
  125. package/dist/utilities/sanitizeInternalFields.d.ts.map +0 -1
  126. package/dist/utilities/sanitizeInternalFields.js +0 -20
  127. package/dist/utilities/sanitizeInternalFields.js.map +0 -1
  128. package/dist/utilities/sanitizeRelationshipIDs.d.ts +0 -9
  129. package/dist/utilities/sanitizeRelationshipIDs.d.ts.map +0 -1
  130. package/dist/utilities/sanitizeRelationshipIDs.js +0 -126
  131. package/dist/utilities/sanitizeRelationshipIDs.js.map +0 -1
  132. package/dist/utilities/sanitizeRelationshipIDs.spec.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"deleteVersions.d.ts","sourceRoot":"","sources":["../src/deleteVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAM7C,eAAO,MAAM,cAAc,EAAE,cAe5B,CAAA"}
1
+ {"version":3,"file":"deleteVersions.d.ts","sourceRoot":"","sources":["../src/deleteVersions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAO3E,eAAO,MAAM,cAAc,EAAE,cAoB5B,CAAA"}
@@ -1,10 +1,13 @@
1
+ import { buildVersionCollectionFields } from 'payload';
2
+ import { buildQuery } from './queries/buildQuery.js';
1
3
  import { getSession } from './utilities/getSession.js';
2
4
  export const deleteVersions = async function deleteVersions({ collection, locale, req, where }) {
3
5
  const VersionsModel = this.versions[collection];
4
6
  const session = await getSession(this, req);
5
- const query = await VersionsModel.buildQuery({
7
+ const query = await buildQuery({
8
+ adapter: this,
9
+ fields: buildVersionCollectionFields(this.payload.config, this.payload.collections[collection].config, true),
6
10
  locale,
7
- payload: this.payload,
8
11
  where
9
12
  });
10
13
  await VersionsModel.deleteMany(query, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/deleteVersions.ts"],"sourcesContent":["import type { DeleteVersions } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { getSession } from './utilities/getSession.js'\n\nexport const deleteVersions: DeleteVersions = async function deleteVersions(\n this: MongooseAdapter,\n { collection, locale, req, 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 where,\n })\n\n await VersionsModel.deleteMany(query, { session })\n}\n"],"names":["getSession","deleteVersions","collection","locale","req","where","VersionsModel","versions","session","query","buildQuery","payload","deleteMany"],"mappings":"AAIA,SAASA,UAAU,QAAQ,4BAA2B;AAEtD,OAAO,MAAMC,iBAAiC,eAAeA,eAE3D,EAAEC,UAAU,EAAEC,MAAM,EAAEC,GAAG,EAAEC,KAAK,EAAE;IAElC,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;QACrBN;IACF;IAEA,MAAMC,cAAcM,UAAU,CAACH,OAAO;QAAED;IAAQ;AAClD,EAAC"}
1
+ {"version":3,"sources":["../src/deleteVersions.ts"],"sourcesContent":["import { buildVersionCollectionFields, type DeleteVersions } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { getSession } from './utilities/getSession.js'\n\nexport const deleteVersions: DeleteVersions = async function deleteVersions(\n this: MongooseAdapter,\n { collection, locale, req, where },\n) {\n const VersionsModel = this.versions[collection]\n\n const session = await getSession(this, req)\n\n const query = await buildQuery({\n adapter: this,\n fields: buildVersionCollectionFields(\n this.payload.config,\n this.payload.collections[collection].config,\n true,\n ),\n locale,\n where,\n })\n\n await VersionsModel.deleteMany(query, { session })\n}\n"],"names":["buildVersionCollectionFields","buildQuery","getSession","deleteVersions","collection","locale","req","where","VersionsModel","versions","session","query","adapter","fields","payload","config","collections","deleteMany"],"mappings":"AAAA,SAASA,4BAA4B,QAA6B,UAAS;AAI3E,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,UAAU,QAAQ,4BAA2B;AAEtD,OAAO,MAAMC,iBAAiC,eAAeA,eAE3D,EAAEC,UAAU,EAAEC,MAAM,EAAEC,GAAG,EAAEC,KAAK,EAAE;IAElC,MAAMC,gBAAgB,IAAI,CAACC,QAAQ,CAACL,WAAW;IAE/C,MAAMM,UAAU,MAAMR,WAAW,IAAI,EAAEI;IAEvC,MAAMK,QAAQ,MAAMV,WAAW;QAC7BW,SAAS,IAAI;QACbC,QAAQb,6BACN,IAAI,CAACc,OAAO,CAACC,MAAM,EACnB,IAAI,CAACD,OAAO,CAACE,WAAW,CAACZ,WAAW,CAACW,MAAM,EAC3C;QAEFV;QACAE;IACF;IAEA,MAAMC,cAAcS,UAAU,CAACN,OAAO;QAAED;IAAQ;AAClD,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../src/find.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAYnC,eAAO,MAAM,IAAI,EAAE,IAgIlB,CAAA"}
1
+ {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../src/find.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAanC,eAAO,MAAM,IAAI,EAAE,IAiIlB,CAAA"}
package/dist/find.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { flattenWhereToOperators } from 'payload';
2
+ import { buildQuery } from './queries/buildQuery.js';
2
3
  import { buildSortParam } from './queries/buildSortParam.js';
3
4
  import { buildJoinAggregation } from './utilities/buildJoinAggregation.js';
4
5
  import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js';
5
6
  import { getSession } from './utilities/getSession.js';
6
- import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js';
7
+ import { transform } from './utilities/transform.js';
7
8
  export const find = async function find({ collection, joins = {}, limit = 0, locale, page, pagination, projection, req, select, sort: sortArg, where }) {
8
9
  const Model = this.collections[collection];
9
10
  const collectionConfig = this.payload.collections[collection].config;
@@ -23,9 +24,11 @@ export const find = async function find({ collection, joins = {}, limit = 0, loc
23
24
  timestamps: true
24
25
  });
25
26
  }
26
- const query = await Model.buildQuery({
27
+ const query = await buildQuery({
28
+ adapter: this,
29
+ collectionSlug: collection,
30
+ fields: this.payload.collections[collection].config.flattenedFields,
27
31
  locale,
28
- payload: this.payload,
29
32
  where
30
33
  });
31
34
  // useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.
@@ -94,14 +97,13 @@ export const find = async function find({ collection, joins = {}, limit = 0, loc
94
97
  } else {
95
98
  result = await Model.paginate(query, paginationOptions);
96
99
  }
97
- const docs = JSON.parse(JSON.stringify(result.docs));
98
- return {
99
- ...result,
100
- docs: docs.map((doc)=>{
101
- doc.id = doc._id;
102
- return sanitizeInternalFields(doc);
103
- })
104
- };
100
+ transform({
101
+ adapter: this,
102
+ data: result.docs,
103
+ fields: this.payload.collections[collection].config.fields,
104
+ operation: 'read'
105
+ });
106
+ return result;
105
107
  };
106
108
 
107
109
  //# sourceMappingURL=find.js.map
package/dist/find.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/find.ts"],"sourcesContent":["import type { PaginateOptions } from 'mongoose'\nimport type { Find } from 'payload'\n\nimport { flattenWhereToOperators } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildSortParam } from './queries/buildSortParam.js'\nimport { buildJoinAggregation } from './utilities/buildJoinAggregation.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getSession } from './utilities/getSession.js'\nimport { sanitizeInternalFields } from './utilities/sanitizeInternalFields.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 projection,\n req,\n select,\n sort: sortArg,\n where,\n },\n) {\n const Model = this.collections[collection]\n const collectionConfig = this.payload.collections[collection].config\n\n const session = await getSession(this, req)\n\n let hasNearConstraint = false\n\n if (where) {\n const constraints = flattenWhereToOperators(where)\n hasNearConstraint = constraints.some((prop) => Object.keys(prop).some((key) => key === 'near'))\n }\n\n let sort\n if (!hasNearConstraint) {\n sort = buildSortParam({\n config: this.payload.config,\n fields: collectionConfig.flattenedFields,\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 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 const paginationOptions: PaginateOptions = {\n lean: true,\n leanWithId: true,\n options: {\n session,\n },\n page,\n pagination,\n projection,\n sort,\n useEstimatedCount,\n }\n\n if (select) {\n paginationOptions.projection = buildProjectionFromSelect({\n adapter: this,\n fields: collectionConfig.flattenedFields,\n select,\n })\n }\n\n if (this.collation) {\n const defaultLocale = 'en'\n paginationOptions.collation = {\n locale: locale && locale !== 'all' && locale !== '*' ? locale : defaultLocale,\n ...this.collation,\n }\n }\n\n if (!useEstimatedCount && Object.keys(query).length === 0 && this.disableIndexHints !== true) {\n // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding\n // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,\n // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses\n // the correct indexed field\n paginationOptions.useCustomCountFn = () => {\n return Promise.resolve(\n Model.countDocuments(query, {\n hint: { _id: 1 },\n session,\n }),\n )\n }\n }\n\n if (limit >= 0) {\n paginationOptions.limit = limit\n // limit must also be set here, it's ignored when pagination is false\n paginationOptions.options.limit = limit\n\n // Disable pagination if limit is 0\n if (limit === 0) {\n paginationOptions.pagination = false\n }\n }\n\n let result\n\n const aggregate = await buildJoinAggregation({\n adapter: this,\n collection,\n collectionConfig,\n joins,\n locale,\n query,\n })\n // build join aggregation\n if (aggregate) {\n result = await Model.aggregatePaginate(Model.aggregate(aggregate), paginationOptions)\n } else {\n result = await Model.paginate(query, paginationOptions)\n }\n\n const docs = JSON.parse(JSON.stringify(result.docs))\n\n return {\n ...result,\n docs: docs.map((doc) => {\n doc.id = doc._id\n return sanitizeInternalFields(doc)\n }),\n }\n}\n"],"names":["flattenWhereToOperators","buildSortParam","buildJoinAggregation","buildProjectionFromSelect","getSession","sanitizeInternalFields","find","collection","joins","limit","locale","page","pagination","projection","req","select","sort","sortArg","where","Model","collections","collectionConfig","payload","config","session","hasNearConstraint","constraints","some","prop","Object","keys","key","fields","flattenedFields","defaultSort","timestamps","query","buildQuery","useEstimatedCount","length","paginationOptions","lean","leanWithId","options","adapter","collation","defaultLocale","disableIndexHints","useCustomCountFn","Promise","resolve","countDocuments","hint","_id","result","aggregate","aggregatePaginate","paginate","docs","JSON","parse","stringify","map","doc","id"],"mappings":"AAGA,SAASA,uBAAuB,QAAQ,UAAS;AAIjD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,oBAAoB,QAAQ,sCAAqC;AAC1E,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,sBAAsB,QAAQ,wCAAuC;AAE9E,OAAO,MAAMC,OAAa,eAAeA,KAEvC,EACEC,UAAU,EACVC,QAAQ,CAAC,CAAC,EACVC,QAAQ,CAAC,EACTC,MAAM,EACN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AMA,SAASoC;YAChE,GAAG,IAAI,CAACD,SAAS;QACnB;IACF;IAEA,IAAI,CAACP,qBAAqBT,OAAOC,IAAI,CAACM,OAAOG,MAAM,KAAK,KAAK,IAAI,CAACQ,iBAAiB,KAAK,MAAM;QAC5F,mHAAmH;QACnH,qHAAqH;QACrH,mHAAmH;QACnH,4BAA4B;QAC5BP,kBAAkBQ,gBAAgB,GAAG;YACnC,OAAOC,QAAQC,OAAO,CACpB/B,MAAMgC,cAAc,CAACf,OAAO;gBAC1BgB,MAAM;oBAAEC,KAAK;gBAAE;gBACf7B;YACF;QAEJ;IACF;IAEA,IAAIf,SAAS,GAAG;QACd+B,kBAAkB/B,KAAK,GAAGA;QAC1B,qEAAqE;QACrE+B,kBAAkBG,OAAO,CAAClC,KAAK,GAAGA;QAElC,mCAAmC;QACnC,IAAIA,UAAU,GAAG;YACf+B,kBAAkB5B,UAAU,GAAG;QACjC;IACF;IAEA,IAAI0C;IAEJ,MAAMC,YAAY,MAAMrD,qBAAqB;QAC3C0C,SAAS,IAAI;QACbrC;QACAc;QACAb;QACAE;QACA0B;IACF;IACA,yBAAyB;IACzB,IAAImB,WAAW;QACbD,SAAS,MAAMnC,MAAMqC,iBAAiB,CAACrC,MAAMoC,SAAS,CAACA,YAAYf;IACrE,OAAO;QACLc,SAAS,MAAMnC,MAAMsC,QAAQ,CAACrB,OAAOI;IACvC;IAEA,MAAMkB,OAAOC,KAAKC,KAAK,CAACD,KAAKE,SAAS,CAACP,OAAOI,IAAI;IAElD,OAAO;QACL,GAAGJ,MAAM;QACTI,MAAMA,KAAKI,GAAG,CAAC,CAACC;YACdA,IAAIC,EAAE,GAAGD,IAAIV,GAAG;YAChB,OAAOhD,uBAAuB0D;QAChC;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../src/find.ts"],"sourcesContent":["import type { PaginateOptions } from 'mongoose'\nimport type { Find } from 'payload'\n\nimport { flattenWhereToOperators } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildSortParam } from './queries/buildSortParam.js'\nimport { buildJoinAggregation } from './utilities/buildJoinAggregation.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getSession } from './utilities/getSession.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 projection,\n req,\n select,\n sort: sortArg,\n where,\n },\n) {\n const Model = this.collections[collection]\n const collectionConfig = this.payload.collections[collection].config\n\n const session = await getSession(this, req)\n\n let hasNearConstraint = false\n\n if (where) {\n const constraints = flattenWhereToOperators(where)\n hasNearConstraint = constraints.some((prop) => Object.keys(prop).some((key) => key === 'near'))\n }\n\n let sort\n if (!hasNearConstraint) {\n sort = buildSortParam({\n config: this.payload.config,\n fields: collectionConfig.flattenedFields,\n locale,\n sort: sortArg || collectionConfig.defaultSort,\n timestamps: true,\n })\n }\n\n const query = await buildQuery({\n adapter: this,\n collectionSlug: collection,\n fields: this.payload.collections[collection].config.flattenedFields,\n locale,\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 const paginationOptions: PaginateOptions = {\n lean: true,\n leanWithId: true,\n options: {\n session,\n },\n page,\n pagination,\n projection,\n sort,\n useEstimatedCount,\n }\n\n if (select) {\n paginationOptions.projection = buildProjectionFromSelect({\n adapter: this,\n fields: collectionConfig.flattenedFields,\n select,\n })\n }\n\n if (this.collation) {\n const defaultLocale = 'en'\n paginationOptions.collation = {\n locale: locale && locale !== 'all' && locale !== '*' ? locale : defaultLocale,\n ...this.collation,\n }\n }\n\n if (!useEstimatedCount && Object.keys(query).length === 0 && this.disableIndexHints !== true) {\n // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding\n // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,\n // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses\n // the correct indexed field\n paginationOptions.useCustomCountFn = () => {\n return Promise.resolve(\n Model.countDocuments(query, {\n hint: { _id: 1 },\n session,\n }),\n )\n }\n }\n\n if (limit >= 0) {\n paginationOptions.limit = limit\n // limit must also be set here, it's ignored when pagination is false\n paginationOptions.options.limit = limit\n\n // Disable pagination if limit is 0\n if (limit === 0) {\n paginationOptions.pagination = false\n }\n }\n\n let result\n\n const aggregate = await buildJoinAggregation({\n adapter: this,\n collection,\n collectionConfig,\n joins,\n locale,\n query,\n })\n // build join aggregation\n if (aggregate) {\n result = await Model.aggregatePaginate(Model.aggregate(aggregate), paginationOptions)\n } else {\n result = await Model.paginate(query, paginationOptions)\n }\n\n transform({\n adapter: this,\n data: result.docs,\n fields: this.payload.collections[collection].config.fields,\n operation: 'read',\n })\n\n return result\n}\n"],"names":["flattenWhereToOperators","buildQuery","buildSortParam","buildJoinAggregation","buildProjectionFromSelect","getSession","transform","find","collection","joins","limit","locale","page","pagination","projection","req","select","sort","sortArg","where","Model","collections","collectionConfig","payload","config","session","hasNearConstraint","constraints","some","prop","Object","keys","key","fields","flattenedFields","defaultSort","timestamps","query","adapter","collectionSlug","useEstimatedCount","length","paginationOptions","lean","leanWithId","options","collation","defaultLocale","disableIndexHints","useCustomCountFn","Promise","resolve","countDocuments","hint","_id","result","aggregate","aggregatePaginate","paginate","data","docs","operation"],"mappings":"AAGA,SAASA,uBAAuB,QAAQ,UAAS;AAIjD,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,oBAAoB,QAAQ,sCAAqC;AAC1E,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,OAAa,eAAeA,KAEvC,EACEC,UAAU,EACVC,QAAQ,CAAC,CAAC,EACVC,QAAQ,CAAC,E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AAMC,gBAAgB;QACtBL,kBAAkBI,SAAS,GAAG;YAC5BnC,QAAQA,UAAUA,WAAW,SAASA,WAAW,MAAMA,SAASoC;YAChE,GAAG,IAAI,CAACD,SAAS;QACnB;IACF;IAEA,IAAI,CAACN,qBAAqBV,OAAOC,IAAI,CAACM,OAAOI,MAAM,KAAK,KAAK,IAAI,CAACO,iBAAiB,KAAK,MAAM;QAC5F,mHAAmH;QACnH,qHAAqH;QACrH,mHAAmH;QACnH,4BAA4B;QAC5BN,kBAAkBO,gBAAgB,GAAG;YACnC,OAAOC,QAAQC,OAAO,CACpB/B,MAAMgC,cAAc,CAACf,OAAO;gBAC1BgB,MAAM;oBAAEC,KAAK;gBAAE;gBACf7B;YACF;QAEJ;IACF;IAEA,IAAIf,SAAS,GAAG;QACdgC,kBAAkBhC,KAAK,GAAGA;QAC1B,qEAAqE;QACrEgC,kBAAkBG,OAAO,CAACnC,KAAK,GAAGA;QAElC,mCAAmC;QACnC,IAAIA,UAAU,GAAG;YACfgC,kBAAkB7B,UAAU,GAAG;QACjC;IACF;IAEA,IAAI0C;IAEJ,MAAMC,YAAY,MAAMrD,qBAAqB;QAC3CmC,SAAS,IAAI;QACb9B;QACAc;QACAb;QACAE;QACA0B;IACF;IACA,yBAAyB;IACzB,IAAImB,WAAW;QACbD,SAAS,MAAMnC,MAAMqC,iBAAiB,CAACrC,MAAMoC,SAAS,CAACA,YAAYd;IACrE,OAAO;QACLa,SAAS,MAAMnC,MAAMsC,QAAQ,CAACrB,OAAOK;IACvC;IAEApC,UAAU;QACRgC,SAAS,IAAI;QACbqB,MAAMJ,OAAOK,IAAI;QACjB3B,QAAQ,IAAI,CAACV,OAAO,CAACF,WAAW,CAACb,WAAW,CAACgB,MAAM,CAACS,MAAM;QAC1D4B,WAAW;IACb;IAEA,OAAON;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"findGlobal.d.ts","sourceRoot":"","sources":["../src/findGlobal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAUzC,eAAO,MAAM,UAAU,EAAE,UAoCxB,CAAA"}
1
+ {"version":3,"file":"findGlobal.d.ts","sourceRoot":"","sources":["../src/findGlobal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAWzC,eAAO,MAAM,UAAU,EAAE,UAuCxB,CAAA"}
@@ -1,38 +1,42 @@
1
1
  import { combineQueries } from 'payload';
2
+ import { buildQuery } from './queries/buildQuery.js';
2
3
  import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js';
3
4
  import { getSession } from './utilities/getSession.js';
4
- import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js';
5
+ import { transform } from './utilities/transform.js';
5
6
  export const findGlobal = async function findGlobal({ slug, locale, req, select, where }) {
6
7
  const Model = this.globals;
8
+ const globalConfig = this.payload.globals.config.find((each)=>each.slug === slug);
9
+ const fields = globalConfig.flattenedFields;
7
10
  const options = {
8
11
  lean: true,
9
12
  select: buildProjectionFromSelect({
10
13
  adapter: this,
11
- fields: this.payload.globals.config.find((each)=>each.slug === slug).flattenedFields,
14
+ fields,
12
15
  select
13
16
  }),
14
17
  session: await getSession(this, req)
15
18
  };
16
- const query = await Model.buildQuery({
19
+ const query = await buildQuery({
20
+ adapter: this,
21
+ fields,
17
22
  globalSlug: slug,
18
23
  locale,
19
- payload: this.payload,
20
24
  where: combineQueries({
21
25
  globalType: {
22
26
  equals: slug
23
27
  }
24
28
  }, where)
25
29
  });
26
- let doc = await Model.findOne(query, {}, options);
30
+ const doc = await Model.findOne(query, {}, options);
27
31
  if (!doc) {
28
32
  return null;
29
33
  }
30
- if (doc._id) {
31
- doc.id = doc._id;
32
- delete doc._id;
33
- }
34
- doc = JSON.parse(JSON.stringify(doc));
35
- doc = sanitizeInternalFields(doc);
34
+ transform({
35
+ adapter: this,
36
+ data: doc,
37
+ fields: globalConfig.fields,
38
+ operation: 'read'
39
+ });
36
40
  return doc;
37
41
  };
38
42
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/findGlobal.ts"],"sourcesContent":["import type { QueryOptions } from 'mongoose'\nimport type { FindGlobal } from 'payload'\n\nimport { combineQueries } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getSession } from './utilities/getSession.js'\nimport { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js'\n\nexport const findGlobal: FindGlobal = async function findGlobal(\n this: MongooseAdapter,\n { slug, locale, req, select, where },\n) {\n const Model = this.globals\n const options: QueryOptions = {\n lean: true,\n select: buildProjectionFromSelect({\n adapter: this,\n fields: this.payload.globals.config.find((each) => each.slug === slug).flattenedFields,\n select,\n }),\n session: await getSession(this, req),\n }\n\n const query = await Model.buildQuery({\n globalSlug: slug,\n locale,\n payload: this.payload,\n where: combineQueries({ globalType: { equals: slug } }, where),\n })\n\n let doc = (await Model.findOne(query, {}, options)) as any\n\n if (!doc) {\n return null\n }\n if (doc._id) {\n doc.id = doc._id\n delete doc._id\n }\n\n doc = JSON.parse(JSON.stringify(doc))\n doc = sanitizeInternalFields(doc)\n\n return doc\n}\n"],"names":["combineQueries","buildProjectionFromSelect","getSession","sanitizeInternalFields","findGlobal","slug","locale","req","select","where","Model","globals","options","lean","adapter","fields","payload","config","find","each","flattenedFields","session","query","buildQuery","globalSlug","globalType","equals","doc","findOne","_id","id","JSON","parse","stringify"],"mappings":"AAGA,SAASA,cAAc,QAAQ,UAAS;AAIxC,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,sBAAsB,QAAQ,wCAAuC;AAE9E,OAAO,MAAMC,aAAyB,eAAeA,WAEnD,EAAEC,IAAI,EAAEC,MAAM,EAAEC,GAAG,EAAEC,MAAM,EAAEC,KAAK,EAAE;IAEpC,MAAMC,QAAQ,IAAI,CAACC,OAAO;IAC1B,MAAMC,UAAwB;QAC5BC,MAAM;QACNL,QAAQP,0BAA0B;YAChCa,SAAS,IAAI;YACbC,QAAQ,IAAI,CAACC,OAAO,CAACL,OAAO,CAACM,MAAM,CAACC,IAAI,CAAC,CAACC,OAASA,KAAKd,IAAI,KAAKA,MAAMe,eAAe;YACtFZ;QACF;QACAa,SAAS,MAAMnB,WAAW,IAAI,EAAEK;IAClC;IAEA,MAAMe,QAAQ,MAAMZ,MAAMa,UAAU,CAAC;QACnCC,YAAYnB;QACZC;QACAU,SAAS,IAAI,CAACA,OAAO;QACrBP,OAAOT,eAAe;YAAEyB,YAAY;gBAAEC,QAAQrB;YAAK;QAAE,GAAGI;IAC1D;IAEA,IAAIkB,MAAO,MAAMjB,MAAMkB,OAAO,CAACN,OAAO,CAAC,GAAGV;IAE1C,IAAI,CAACe,KAAK;QACR,OAAO;IACT;IACA,IAAIA,IAAIE,GAAG,EAAE;QACXF,IAAIG,EAAE,GAAGH,IAAIE,GAAG;QAChB,OAAOF,IAAIE,GAAG;IAChB;IAEAF,MAAMI,KAAKC,KAAK,CAACD,KAAKE,SAAS,CAACN;IAChCA,MAAMxB,uBAAuBwB;IAE7B,OAAOA;AACT,EAAC"}
1
+ {"version":3,"sources":["../src/findGlobal.ts"],"sourcesContent":["import type { QueryOptions } from 'mongoose'\nimport type { FindGlobal } from 'payload'\n\nimport { combineQueries } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getSession } from './utilities/getSession.js'\nimport { transform } from './utilities/transform.js'\n\nexport const findGlobal: FindGlobal = async function findGlobal(\n this: MongooseAdapter,\n { slug, locale, req, select, where },\n) {\n const Model = this.globals\n const globalConfig = this.payload.globals.config.find((each) => each.slug === slug)\n const fields = globalConfig.flattenedFields\n const options: QueryOptions = {\n lean: true,\n select: buildProjectionFromSelect({\n adapter: this,\n fields,\n select,\n }),\n session: await getSession(this, req),\n }\n\n const query = await buildQuery({\n adapter: this,\n fields,\n globalSlug: slug,\n locale,\n where: combineQueries({ globalType: { equals: slug } }, where),\n })\n\n const doc = (await Model.findOne(query, {}, options)) as any\n\n if (!doc) {\n return null\n }\n\n transform({\n adapter: this,\n data: doc,\n fields: globalConfig.fields,\n operation: 'read',\n })\n\n return doc\n}\n"],"names":["combineQueries","buildQuery","buildProjectionFromSelect","getSession","transform","findGlobal","slug","locale","req","select","where","Model","globals","globalConfig","payload","config","find","each","fields","flattenedFields","options","lean","adapter","session","query","globalSlug","globalType","equals","doc","findOne","data","operation"],"mappings":"AAGA,SAASA,cAAc,QAAQ,UAAS;AAIxC,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,aAAyB,eAAeA,WAEnD,EAAEC,IAAI,EAAEC,MAAM,EAAEC,GAAG,EAAEC,MAAM,EAAEC,KAAK,EAAE;IAEpC,MAAMC,QAAQ,IAAI,CAACC,OAAO;IAC1B,MAAMC,eAAe,IAAI,CAACC,OAAO,CAACF,OAAO,CAACG,MAAM,CAACC,IAAI,CAAC,CAACC,OAASA,KAAKX,IAAI,KAAKA;IAC9E,MAAMY,SAASL,aAAaM,eAAe;IAC3C,MAAMC,UAAwB;QAC5BC,MAAM;QACNZ,QAAQP,0BAA0B;YAChCoB,SAAS,IAAI;YACbJ;YACAT;QACF;QACAc,SAAS,MAAMpB,WAAW,IAAI,EAAEK;IAClC;IAEA,MAAMgB,QAAQ,MAAMvB,WAAW;QAC7BqB,SAAS,IAAI;QACbJ;QACAO,YAAYnB;QACZC;QACAG,OAAOV,eAAe;YAAE0B,YAAY;gBAAEC,QAAQrB;YAAK;QAAE,GAAGI;IAC1D;IAEA,MAAMkB,MAAO,MAAMjB,MAAMkB,OAAO,CAACL,OAAO,CAAC,GAAGJ;IAE5C,IAAI,CAACQ,KAAK;QACR,OAAO;IACT;IAEAxB,UAAU;QACRkB,SAAS,IAAI;QACbQ,MAAMF;QACNV,QAAQL,aAAaK,MAAM;QAC3Ba,WAAW;IACb;IAEA,OAAOH;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"findGlobalVersions.d.ts","sourceRoot":"","sources":["../src/findGlobalVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAWjD,eAAO,MAAM,kBAAkB,EAAE,kBAqGhC,CAAA"}
1
+ {"version":3,"file":"findGlobalVersions.d.ts","sourceRoot":"","sources":["../src/findGlobalVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAYjD,eAAO,MAAM,kBAAkB,EAAE,kBAkGhC,CAAA"}
@@ -1,11 +1,13 @@
1
1
  import { buildVersionGlobalFields, flattenWhereToOperators } from 'payload';
2
+ import { buildQuery } from './queries/buildQuery.js';
2
3
  import { buildSortParam } from './queries/buildSortParam.js';
3
4
  import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js';
4
5
  import { getSession } from './utilities/getSession.js';
5
- import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js';
6
+ import { transform } from './utilities/transform.js';
6
7
  export const findGlobalVersions = async function findGlobalVersions({ global, limit, locale, page, pagination, req, select, skip, sort: sortArg, where }) {
8
+ const globalConfig = this.payload.globals.config.find(({ slug })=>slug === global);
7
9
  const Model = this.versions[global];
8
- const versionFields = buildVersionGlobalFields(this.payload.config, this.payload.globals.config.find(({ slug })=>slug === global), true);
10
+ const versionFields = buildVersionGlobalFields(this.payload.config, globalConfig, true);
9
11
  const session = await getSession(this, req);
10
12
  const options = {
11
13
  limit,
@@ -27,10 +29,10 @@ export const findGlobalVersions = async function findGlobalVersions({ global, li
27
29
  timestamps: true
28
30
  });
29
31
  }
30
- const query = await Model.buildQuery({
31
- globalSlug: global,
32
+ const query = await buildQuery({
33
+ adapter: this,
34
+ fields: versionFields,
32
35
  locale,
33
- payload: this.payload,
34
36
  where
35
37
  });
36
38
  // useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.
@@ -81,14 +83,13 @@ export const findGlobalVersions = async function findGlobalVersions({ global, li
81
83
  }
82
84
  }
83
85
  const result = await Model.paginate(query, paginationOptions);
84
- const docs = JSON.parse(JSON.stringify(result.docs));
85
- return {
86
- ...result,
87
- docs: docs.map((doc)=>{
88
- doc.id = doc._id;
89
- return sanitizeInternalFields(doc);
90
- })
91
- };
86
+ transform({
87
+ adapter: this,
88
+ data: result.docs,
89
+ fields: buildVersionGlobalFields(this.payload.config, globalConfig),
90
+ operation: 'read'
91
+ });
92
+ return result;
92
93
  };
93
94
 
94
95
  //# sourceMappingURL=findGlobalVersions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/findGlobalVersions.ts"],"sourcesContent":["import type { PaginateOptions, QueryOptions } from 'mongoose'\nimport type { FindGlobalVersions } from 'payload'\n\nimport { buildVersionGlobalFields, flattenWhereToOperators } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildSortParam } from './queries/buildSortParam.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getSession } from './utilities/getSession.js'\nimport { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js'\n\nexport const findGlobalVersions: FindGlobalVersions = async function findGlobalVersions(\n this: MongooseAdapter,\n { global, limit, locale, page, pagination, req, select, skip, sort: sortArg, where },\n) {\n const Model = this.versions[global]\n const versionFields = buildVersionGlobalFields(\n this.payload.config,\n this.payload.globals.config.find(({ slug }) => slug === global),\n true,\n )\n\n const session = await getSession(this, req)\n const options: QueryOptions = {\n limit,\n session,\n skip,\n }\n\n let hasNearConstraint = false\n\n if (where) {\n const constraints = flattenWhereToOperators(where)\n hasNearConstraint = constraints.some((prop) => Object.keys(prop).some((key) => key === 'near'))\n }\n\n let sort\n if (!hasNearConstraint) {\n sort = buildSortParam({\n config: this.payload.config,\n fields: versionFields,\n locale,\n sort: sortArg || '-updatedAt',\n timestamps: true,\n })\n }\n\n const query = await Model.buildQuery({\n globalSlug: global,\n locale,\n payload: this.payload,\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 const paginationOptions: PaginateOptions = {\n lean: true,\n leanWithId: true,\n limit,\n options,\n page,\n pagination,\n projection: buildProjectionFromSelect({ adapter: this, fields: versionFields, select }),\n sort,\n useEstimatedCount,\n }\n\n if (this.collation) {\n const defaultLocale = 'en'\n paginationOptions.collation = {\n locale: locale && locale !== 'all' && locale !== '*' ? locale : defaultLocale,\n ...this.collation,\n }\n }\n\n if (!useEstimatedCount && Object.keys(query).length === 0 && this.disableIndexHints !== true) {\n // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding\n // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,\n // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses\n // the correct indexed field\n paginationOptions.useCustomCountFn = () => {\n return Promise.resolve(\n Model.countDocuments(query, {\n hint: { _id: 1 },\n session,\n }),\n )\n }\n }\n\n if (limit >= 0) {\n paginationOptions.limit = limit\n // limit must also be set here, it's ignored when pagination is false\n paginationOptions.options.limit = limit\n\n // Disable pagination if limit is 0\n if (limit === 0) {\n paginationOptions.pagination = false\n }\n }\n\n const result = await Model.paginate(query, paginationOptions)\n const docs = JSON.parse(JSON.stringify(result.docs))\n\n return {\n ...result,\n docs: docs.map((doc) => {\n doc.id = doc._id\n return sanitizeInternalFields(doc)\n }),\n }\n}\n"],"names":["buildVersionGlobalFields","flattenWhereToOperators","buildSortParam","buildProjectionFromSelect","getSession","sanitizeInternalFields","findGlobalVersions","global","limit","locale","page","pagination","req","select","skip","sort","sortArg","where","Model","versions","versionFields","payload","config","globals","find","slug","session","options","hasNearConstraint","constraints","some","prop","Object","keys","key","fields","timestamps","query","buildQuery","globalSlug","useEstimatedCount","length","paginationOptions","lean","leanWithId","projection","adapter","collation","defaultLocale","disableIndexHints","useCustomCountFn","Promise","resolve","countDocuments","hint","_id","result","paginate","docs","JSON","parse","stringify","map","doc","id"],"mappings":"AAGA,SAASA,wBAAwB,EAAEC,uBAAuB,QAAQ,UAAS;AAI3E,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,sBAAsB,QAAQ,wCAAuC;AAE9E,OAAO,MAAMC,qBAAyC,eAAeA,mBAEnE,EAAEC,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,UAAU,EAAEC,GAAG,EAAEC,MAAM,EAAEC,IAAI,EAAEC,MAAMC,OAAO,EAAEC,KAAK,EAAE;IAEpF,MAAMC,QAAQ,IAAI,CAACC,QAAQ,CAACZ,OAAO;IACnC,MAAMa,gBAAgBpB,yBACpB,IAAI,CAACqB,OAAO,CAACC,MAAM,EACnB,IAAI,CAACD,OAAO,CAACE,OAAO,CAACD,MAAM,CAACE,IAAI,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA,SAASlB,SACxD;IAGF,MAAMmB,UAAU,MAAMtB,WAAW,IAAI,EAAEQ;IACvC,MAAMe,UAAwB;QAC5BnB;QACAkB;QACAZ;IACF;IAEA,IAAIc,oBAAoB;IAExB,IAAIX,OAAO;QACT,MAAMY,cAAc5B,wBAAwBgB;QAC5CW,oBAAoBC,YAAYC,IAAI,CAAC,CAACC,OAASC,OAAOC,IAAI,CAACF,MAAMD,IAAI,CAAC,CAACI,MAAQA,QAAQ;IACzF;IAEA,IAAInB;IACJ,IAAI,CAACa,mBAAmB;QACtBb,OAAOb,eAAe;YACpBoB,QAAQ,IAAI,CAACD,OAAO,CAACC,MAAM;YAC3Ba,QAAQf;YACRX;YACAM,MAAMC,WAAW;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OAAOE,IAAI;IAElD,OAAO;QACL,GAAGF,MAAM;QACTE,MAAMA,KAAKI,GAAG,CAAC,CAACC;YACdA,IAAIC,EAAE,GAAGD,IAAIR,GAAG;YAChB,OAAOlD,uBAAuB0D;QAChC;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../src/findGlobalVersions.ts"],"sourcesContent":["import type { PaginateOptions, QueryOptions } from 'mongoose'\nimport type { FindGlobalVersions } from 'payload'\n\nimport { buildVersionGlobalFields, flattenWhereToOperators } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildSortParam } from './queries/buildSortParam.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getSession } from './utilities/getSession.js'\nimport { transform } from './utilities/transform.js'\n\nexport const findGlobalVersions: FindGlobalVersions = async function findGlobalVersions(\n this: MongooseAdapter,\n { global, limit, locale, page, pagination, req, select, skip, sort: sortArg, where },\n) {\n const globalConfig = this.payload.globals.config.find(({ slug }) => slug === global)\n const Model = this.versions[global]\n const versionFields = buildVersionGlobalFields(this.payload.config, globalConfig, true)\n\n const session = await getSession(this, req)\n const options: QueryOptions = {\n limit,\n session,\n skip,\n }\n\n let hasNearConstraint = false\n\n if (where) {\n const constraints = flattenWhereToOperators(where)\n hasNearConstraint = constraints.some((prop) => Object.keys(prop).some((key) => key === 'near'))\n }\n\n let sort\n if (!hasNearConstraint) {\n sort = buildSortParam({\n config: this.payload.config,\n fields: versionFields,\n locale,\n sort: sortArg || '-updatedAt',\n timestamps: true,\n })\n }\n\n const query = await buildQuery({\n adapter: this,\n fields: versionFields,\n locale,\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 const paginationOptions: PaginateOptions = {\n lean: true,\n leanWithId: true,\n limit,\n options,\n page,\n pagination,\n projection: buildProjectionFromSelect({ adapter: this, fields: versionFields, select }),\n sort,\n useEstimatedCount,\n }\n\n if (this.collation) {\n const defaultLocale = 'en'\n paginationOptions.collation = {\n locale: locale && locale !== 'all' && locale !== '*' ? locale : defaultLocale,\n ...this.collation,\n }\n }\n\n if (!useEstimatedCount && Object.keys(query).length === 0 && this.disableIndexHints !== true) {\n // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding\n // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,\n // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses\n // the correct indexed field\n paginationOptions.useCustomCountFn = () => {\n return Promise.resolve(\n Model.countDocuments(query, {\n hint: { _id: 1 },\n session,\n }),\n )\n }\n }\n\n if (limit >= 0) {\n paginationOptions.limit = limit\n // limit must also be set here, it's ignored when pagination is false\n paginationOptions.options.limit = limit\n\n // Disable pagination if limit is 0\n if (limit === 0) {\n paginationOptions.pagination = false\n }\n }\n\n const result = await Model.paginate(query, paginationOptions)\n\n transform({\n adapter: this,\n data: result.docs,\n fields: buildVersionGlobalFields(this.payload.config, globalConfig),\n operation: 'read',\n })\n\n return result\n}\n"],"names":["buildVersionGlobalFields","flattenWhereToOperators","buildQuery","buildSortParam","buildProjectionFromSelect","getSession","transform","findGlobalVersions","global","limit","locale","page","pagination","req","select","skip","sort","sortArg","where","globalConfig","payload","globals","config","find","slug","Model","versions","versionFields","session","options","hasNearConstraint","constraints","some","prop","Object","keys","key","fields","timestamps","query","adapter","useEstimatedCount","length","paginationOptions","lean","leanWithId","projection","collation","defaultLocale","disableIndexHints","useCustomCountFn","Promise","resolve","countDocuments","hint","_id","result","paginate","data","docs","operation"],"mappings":"AAGA,SAASA,wBAAwB,EAAEC,uBAAuB,QAAQ,UAAS;AAI3E,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,SAAS,QAAQ,2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AAeb;QAAO;QACrFE;QACAyB;IACF;IAEA,IAAI,IAAI,CAACM,SAAS,EAAE;QAClB,MAAMC,gBAAgB;QACtBL,kBAAkBI,SAAS,GAAG;YAC5BrC,QAAQA,UAAUA,WAAW,SAASA,WAAW,MAAMA,SAASsC;YAChE,GAAG,IAAI,CAACD,SAAS;QACnB;IACF;IAEA,IAAI,CAACN,qBAAqBP,OAAOC,IAAI,CAACI,OAAOG,MAAM,KAAK,KAAK,IAAI,CAACO,iBAAiB,KAAK,MAAM;QAC5F,mHAAmH;QACnH,qHAAqH;QACrH,mHAAmH;QACnH,4BAA4B;QAC5BN,kBAAkBO,gBAAgB,GAAG;YACnC,OAAOC,QAAQC,OAAO,CACpB3B,MAAM4B,cAAc,CAACd,OAAO;gBAC1Be,MAAM;oBAAEC,KAAK;gBAAE;gBACf3B;YACF;QAEJ;IACF;IAEA,IAAInB,SAAS,GAAG;QACdkC,kBAAkBlC,KAAK,GAAGA;QAC1B,qEAAqE;QACrEkC,kBAAkBd,OAAO,CAACpB,KAAK,GAAGA;QAElC,mCAAmC;QACnC,IAAIA,UAAU,GAAG;YACfkC,kBAAkB/B,UAAU,GAAG;QACjC;IACF;IAEA,MAAM4C,SAAS,MAAM/B,MAAMgC,QAAQ,CAAClB,OAAOI;IAE3CrC,UAAU;QACRkC,SAAS,IAAI;QACbkB,MAAMF,OAAOG,IAAI;QACjBtB,QAAQrC,yBAAyB,IAAI,CAACoB,OAAO,CAACE,MAAM,EAAEH;QACtDyC,WAAW;IACb;IAEA,OAAOJ;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"findOne.d.ts","sourceRoot":"","sources":["../src/findOne.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAY,OAAO,EAAE,MAAM,SAAS,CAAA;AAShD,eAAO,MAAM,OAAO,EAAE,OAsDrB,CAAA"}
1
+ {"version":3,"file":"findOne.d.ts","sourceRoot":"","sources":["../src/findOne.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAUtC,eAAO,MAAM,OAAO,EAAE,OAoDrB,CAAA"}
package/dist/findOne.js CHANGED
@@ -1,7 +1,8 @@
1
+ import { buildQuery } from './queries/buildQuery.js';
1
2
  import { buildJoinAggregation } from './utilities/buildJoinAggregation.js';
2
3
  import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js';
3
4
  import { getSession } from './utilities/getSession.js';
4
- import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js';
5
+ import { transform } from './utilities/transform.js';
5
6
  export const findOne = async function findOne({ collection, joins, locale, req, select, where }) {
6
7
  const Model = this.collections[collection];
7
8
  const collectionConfig = this.payload.collections[collection].config;
@@ -10,9 +11,11 @@ export const findOne = async function findOne({ collection, joins, locale, req,
10
11
  lean: true,
11
12
  session
12
13
  };
13
- const query = await Model.buildQuery({
14
+ const query = await buildQuery({
15
+ adapter: this,
16
+ collectionSlug: collection,
17
+ fields: collectionConfig.flattenedFields,
14
18
  locale,
15
- payload: this.payload,
16
19
  where
17
20
  });
18
21
  const projection = buildProjectionFromSelect({
@@ -44,11 +47,13 @@ export const findOne = async function findOne({ collection, joins, locale, req,
44
47
  if (!doc) {
45
48
  return null;
46
49
  }
47
- let result = JSON.parse(JSON.stringify(doc));
48
- // custom id type reset
49
- result.id = result._id;
50
- result = sanitizeInternalFields(result);
51
- return result;
50
+ transform({
51
+ adapter: this,
52
+ data: doc,
53
+ fields: collectionConfig.fields,
54
+ operation: 'read'
55
+ });
56
+ return doc;
52
57
  };
53
58
 
54
59
  //# sourceMappingURL=findOne.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/findOne.ts"],"sourcesContent":["import type { AggregateOptions, QueryOptions } from 'mongoose'\nimport type { Document, FindOne } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildJoinAggregation } from './utilities/buildJoinAggregation.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getSession } from './utilities/getSession.js'\nimport { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js'\n\nexport const findOne: FindOne = async function findOne(\n this: MongooseAdapter,\n { collection, joins, locale, req, select, where },\n) {\n const Model = this.collections[collection]\n const collectionConfig = this.payload.collections[collection].config\n const session = await getSession(this, req)\n const options: AggregateOptions & QueryOptions = {\n lean: true,\n session,\n }\n\n const query = await Model.buildQuery({\n locale,\n payload: this.payload,\n where,\n })\n\n const projection = buildProjectionFromSelect({\n adapter: this,\n fields: collectionConfig.flattenedFields,\n select,\n })\n\n const aggregate = await buildJoinAggregation({\n adapter: this,\n collection,\n collectionConfig,\n joins,\n limit: 1,\n locale,\n projection,\n query,\n })\n\n let doc\n if (aggregate) {\n ;[doc] = await Model.aggregate(aggregate, { session })\n } else {\n ;(options as Record<string, unknown>).projection = projection\n doc = await Model.findOne(query, {}, options)\n }\n\n if (!doc) {\n return null\n }\n\n let result: Document = JSON.parse(JSON.stringify(doc))\n\n // custom id type reset\n result.id = result._id\n result = sanitizeInternalFields(result)\n\n return result\n}\n"],"names":["buildJoinAggregation","buildProjectionFromSelect","getSession","sanitizeInternalFields","findOne","collection","joins","locale","req","select","where","Model","collections","collectionConfig","payload","config","session","options","lean","query","buildQuery","projection","adapter","fields","flattenedFields","aggregate","limit","doc","result","JSON","parse","stringify","id","_id"],"mappings":"AAKA,SAASA,oBAAoB,QAAQ,sCAAqC;AAC1E,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,sBAAsB,QAAQ,wCAAuC;AAE9E,OAAO,MAAMC,UAAmB,eAAeA,QAE7C,EAAEC,UAAU,EAAEC,KAAK,EAAEC,MAAM,EAAEC,GAAG,EAAEC,MAAM,EAAEC,KAAK,EAAE;IAEjD,MAAMC,QAAQ,IAAI,CAACC,WAAW,CAACP,WAAW;IAC1C,MAAMQ,mBAAmB,IAAI,CAACC,OAAO,CAACF,WAAW,CAACP,WAAW,CAACU,MAAM;IACpE,MAAMC,UAAU,MAAMd,WAAW,IAAI,EAAEM;IACvC,MAAMS,UAA2C;QAC/CC,MAAM;QACNF;IACF;IAEA,MAAMG,QAAQ,MAAMR,MAAMS,UAAU,CAAC;QACnCb;QACAO,SAAS,IAAI,CAACA,OAAO;QACrBJ;IACF;IAEA,MAAMW,aAAapB,0BAA0B;QAC3CqB,SAAS,IAAI;QACbC,QAAQV,iBAAiBW,eAAe;QACxCf;IACF;IAEA,MAAMgB,YAAY,MAAMzB,qBAAqB;QAC3CsB,SAAS,IAAI;QACbjB;QACAQ;QACAP;QACAoB,OAAO;QACPnB;QACAc;QACAF;IACF;IAEA,IAAIQ;IACJ,IAAIF,WAAW;;QACZ,CAACE,IAAI,GAAG,MAAMhB,MAAMc,SAAS,CAACA,WAAW;YAAET;QAAQ;IACtD,OAAO;;QACHC,QAAoCI,UAAU,GAAGA;QACnDM,MAAM,MAAMhB,MAAMP,OAAO,CAACe,OAAO,CAAC,GAAGF;IACvC;IAEA,IAAI,CAACU,KAAK;QACR,OAAO;IACT;IAEA,IAAIC,SAAmBC,KAAKC,KAAK,CAACD,KAAKE,SAAS,CAACJ;IAEjD,uBAAuB;IACvBC,OAAOI,EAAE,GAAGJ,OAAOK,GAAG;IACtBL,SAASzB,uBAAuByB;IAEhC,OAAOA;AACT,EAAC"}
1
+ {"version":3,"sources":["../src/findOne.ts"],"sourcesContent":["import type { AggregateOptions, QueryOptions } from 'mongoose'\nimport type { FindOne } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildJoinAggregation } from './utilities/buildJoinAggregation.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getSession } from './utilities/getSession.js'\nimport { transform } from './utilities/transform.js'\n\nexport const findOne: FindOne = async function findOne(\n this: MongooseAdapter,\n { collection, joins, locale, req, select, where },\n) {\n const Model = this.collections[collection]\n const collectionConfig = this.payload.collections[collection].config\n const session = await getSession(this, req)\n const options: AggregateOptions & QueryOptions = {\n lean: true,\n session,\n }\n\n const query = await buildQuery({\n adapter: this,\n collectionSlug: collection,\n fields: collectionConfig.flattenedFields,\n locale,\n where,\n })\n\n const projection = buildProjectionFromSelect({\n adapter: this,\n fields: collectionConfig.flattenedFields,\n select,\n })\n\n const aggregate = await buildJoinAggregation({\n adapter: this,\n collection,\n collectionConfig,\n joins,\n limit: 1,\n locale,\n projection,\n query,\n })\n\n let doc\n if (aggregate) {\n ;[doc] = await Model.aggregate(aggregate, { session })\n } else {\n ;(options as Record<string, unknown>).projection = projection\n doc = await Model.findOne(query, {}, options)\n }\n\n if (!doc) {\n return null\n }\n\n transform({ adapter: this, data: doc, fields: collectionConfig.fields, operation: 'read' })\n\n return doc\n}\n"],"names":["buildQuery","buildJoinAggregation","buildProjectionFromSelect","getSession","transform","findOne","collection","joins","locale","req","select","where","Model","collections","collectionConfig","payload","config","session","options","lean","query","adapter","collectionSlug","fields","flattenedFields","projection","aggregate","limit","doc","data","operation"],"mappings":"AAKA,SAASA,UAAU,QAAQ,0BAAyB;AACpD,SAASC,oBAAoB,QAAQ,sCAAqC;AAC1E,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,UAAmB,eAAeA,QAE7C,EAAEC,UAAU,EAAEC,KAAK,EAAEC,MAAM,EAAEC,GAAG,EAAEC,MAAM,EAAEC,KAAK,EAAE;IAEjD,MAAMC,QAAQ,IAAI,CAACC,WAAW,CAACP,WAAW;IAC1C,MAAMQ,mBAAmB,IAAI,CAACC,OAAO,CAACF,WAAW,CAACP,WAAW,CAACU,MAAM;IACpE,MAAMC,UAAU,MAAMd,WAAW,IAAI,EAAEM;IACvC,MAAMS,UAA2C;QAC/CC,MAAM;QACNF;IACF;IAEA,MAAMG,QAAQ,MAAMpB,WAAW;QAC7BqB,SAAS,IAAI;QACbC,gBAAgBhB;QAChBiB,QAAQT,iBAAiBU,eAAe;QACxChB;QACAG;IACF;IAEA,MAAMc,aAAavB,0BAA0B;QAC3CmB,SAAS,IAAI;QACbE,QAAQT,iBAAiBU,eAAe;QACxCd;IACF;IAEA,MAAMgB,YAAY,MAAMzB,qBAAqB;QAC3CoB,SAAS,IAAI;QACbf;QACAQ;QACAP;QACAoB,OAAO;QACPnB;QACAiB;QACAL;IACF;IAEA,IAAIQ;IACJ,IAAIF,WAAW;;QACZ,CAACE,IAAI,GAAG,MAAMhB,MAAMc,SAAS,CAACA,WAAW;YAAET;QAAQ;IACtD,OAAO;;QACHC,QAAoCO,UAAU,GAAGA;QACnDG,MAAM,MAAMhB,MAAMP,OAAO,CAACe,OAAO,CAAC,GAAGF;IACvC;IAEA,IAAI,CAACU,KAAK;QACR,OAAO;IACT;IAEAxB,UAAU;QAAEiB,SAAS,IAAI;QAAEQ,MAAMD;QAAKL,QAAQT,iBAAiBS,MAAM;QAAEO,WAAW;IAAO;IAEzF,OAAOF;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../src/findVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAW3C,eAAO,MAAM,YAAY,EAAE,YAmG1B,CAAA"}
1
+ {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../src/findVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAY3C,eAAO,MAAM,YAAY,EAAE,YAsG1B,CAAA"}
@@ -1,8 +1,9 @@
1
1
  import { buildVersionCollectionFields, flattenWhereToOperators } from 'payload';
2
+ import { buildQuery } from './queries/buildQuery.js';
2
3
  import { buildSortParam } from './queries/buildSortParam.js';
3
4
  import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js';
4
5
  import { getSession } from './utilities/getSession.js';
5
- import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js';
6
+ import { transform } from './utilities/transform.js';
6
7
  export const findVersions = async function findVersions({ collection, limit, locale, page, pagination, req = {}, select, skip, sort: sortArg, where }) {
7
8
  const Model = this.versions[collection];
8
9
  const collectionConfig = this.payload.collections[collection].config;
@@ -27,9 +28,11 @@ export const findVersions = async function findVersions({ collection, limit, loc
27
28
  timestamps: true
28
29
  });
29
30
  }
30
- const query = await Model.buildQuery({
31
+ const fields = buildVersionCollectionFields(this.payload.config, collectionConfig, true);
32
+ const query = await buildQuery({
33
+ adapter: this,
34
+ fields,
31
35
  locale,
32
- payload: this.payload,
33
36
  where
34
37
  });
35
38
  // useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.
@@ -43,7 +46,7 @@ export const findVersions = async function findVersions({ collection, limit, loc
43
46
  pagination,
44
47
  projection: buildProjectionFromSelect({
45
48
  adapter: this,
46
- fields: buildVersionCollectionFields(this.payload.config, collectionConfig, true),
49
+ fields,
47
50
  select
48
51
  }),
49
52
  sort,
@@ -80,14 +83,13 @@ export const findVersions = async function findVersions({ collection, limit, loc
80
83
  }
81
84
  }
82
85
  const result = await Model.paginate(query, paginationOptions);
83
- const docs = JSON.parse(JSON.stringify(result.docs));
84
- return {
85
- ...result,
86
- docs: docs.map((doc)=>{
87
- doc.id = doc._id;
88
- return sanitizeInternalFields(doc);
89
- })
90
- };
86
+ transform({
87
+ adapter: this,
88
+ data: result.docs,
89
+ fields: buildVersionCollectionFields(this.payload.config, collectionConfig),
90
+ operation: 'read'
91
+ });
92
+ return result;
91
93
  };
92
94
 
93
95
  //# sourceMappingURL=findVersions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/findVersions.ts"],"sourcesContent":["import type { PaginateOptions, QueryOptions } from 'mongoose'\nimport type { FindVersions } from 'payload'\n\nimport { buildVersionCollectionFields, flattenWhereToOperators } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildSortParam } from './queries/buildSortParam.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getSession } from './utilities/getSession.js'\nimport { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js'\n\nexport const findVersions: FindVersions = async function findVersions(\n this: MongooseAdapter,\n { collection, limit, locale, page, pagination, req = {}, select, skip, sort: sortArg, where },\n) {\n const Model = this.versions[collection]\n const collectionConfig = this.payload.collections[collection].config\n const session = await getSession(this, req)\n const options: QueryOptions = {\n limit,\n session,\n skip,\n }\n\n let hasNearConstraint = false\n\n if (where) {\n const constraints = flattenWhereToOperators(where)\n hasNearConstraint = constraints.some((prop) => Object.keys(prop).some((key) => key === 'near'))\n }\n\n let sort\n if (!hasNearConstraint) {\n sort = buildSortParam({\n config: this.payload.config,\n fields: collectionConfig.flattenedFields,\n locale,\n sort: sortArg || '-updatedAt',\n timestamps: true,\n })\n }\n\n const query = await Model.buildQuery({\n locale,\n payload: this.payload,\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 const paginationOptions: PaginateOptions = {\n lean: true,\n leanWithId: true,\n limit,\n options,\n page,\n pagination,\n projection: buildProjectionFromSelect({\n adapter: this,\n fields: buildVersionCollectionFields(this.payload.config, collectionConfig, true),\n select,\n }),\n sort,\n useEstimatedCount,\n }\n\n if (this.collation) {\n const defaultLocale = 'en'\n paginationOptions.collation = {\n locale: locale && locale !== 'all' && locale !== '*' ? locale : defaultLocale,\n ...this.collation,\n }\n }\n\n if (!useEstimatedCount && Object.keys(query).length === 0 && this.disableIndexHints !== true) {\n // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding\n // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,\n // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses\n // the correct indexed field\n paginationOptions.useCustomCountFn = () => {\n return Promise.resolve(\n Model.countDocuments(query, {\n hint: { _id: 1 },\n session,\n }),\n )\n }\n }\n\n if (limit >= 0) {\n paginationOptions.limit = limit\n // limit must also be set here, it's ignored when pagination is false\n paginationOptions.options.limit = limit\n\n // Disable pagination if limit is 0\n if (limit === 0) {\n paginationOptions.pagination = false\n }\n }\n\n const result = await Model.paginate(query, paginationOptions)\n const docs = JSON.parse(JSON.stringify(result.docs))\n\n return {\n ...result,\n docs: docs.map((doc) => {\n doc.id = doc._id\n return sanitizeInternalFields(doc)\n }),\n }\n}\n"],"names":["buildVersionCollectionFields","flattenWhereToOperators","buildSortParam","buildProjectionFromSelect","getSession","sanitizeInternalFields","findVersions","collection","limit","locale","page","pagination","req","select","skip","sort","sortArg","where","Model","versions","collectionConfig","payload","collections","config","session","options","hasNearConstraint","constraints","some","prop","Object","keys","key","fields","flattenedFields","timestamps","query","buildQuery","useEstimatedCount","length","paginationOptions","lean","leanWithId","projection","adapter","collation","defaultLocale","disableIndexHints","useCustomCountFn","Promise","resolve","countDocuments","hint","_id","result","paginate","docs","JSON","parse","stringify","map","doc","id"],"mappings":"AAGA,SAASA,4BAA4B,EAAEC,uBAAuB,QAAQ,UAAS;AAI/E,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,sBAAsB,QAAQ,wCAAuC;AAE9E,OAAO,MAAMC,eAA6B,eAAeA,aAEvD,EAAEC,UAAU,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,UAAU,EAAEC,MAAM,CAAC,CAAC,EAAEC,MAAM,EAAEC,IAAI,EAAEC,MAAMC,OAAO,EAAEC,KAAK,EAAE;IAE7F,MAAMC,QAAQ,IAAI,CAACC,QAAQ,CAACZ,WAAW;IACvC,MAAMa,mBAAmB,IAAI,CAACC,OAAO,CAACC,WAAW,CAACf,WAAW,CAACgB,MAAM;IACpE,MAAMC,UAAU,MAAMpB,WAAW,IAAI,EAAEQ;IACvC,MAAMa,UAAwB;QAC5BjB;QACAgB;QAC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AAc,CAACf,OAAO;gBAC1BgB,MAAM;oBAAEC,KAAK;gBAAE;gBACf7B;YACF;QAEJ;IACF;IAEA,IAAIhB,SAAS,GAAG;QACdgC,kBAAkBhC,KAAK,GAAGA;QAC1B,qEAAqE;QACrEgC,kBAAkBf,OAAO,CAACjB,KAAK,GAAGA;QAElC,mCAAmC;QACnC,IAAIA,UAAU,GAAG;YACfgC,kBAAkB7B,UAAU,GAAG;QACjC;IACF;IAEA,MAAM2C,SAAS,MAAMpC,MAAMqC,QAAQ,CAACnB,OAAOI;IAC3C,MAAMgB,OAAOC,KAAKC,KAAK,CAACD,KAAKE,SAAS,CAACL,OAAOE,IAAI;IAElD,OAAO;QACL,GAAGF,MAAM;QACTE,MAAMA,KAAKI,GAAG,CAAC,CAACC;YACdA,IAAIC,EAAE,GAAGD,IAAIR,GAAG;YAChB,OAAOhD,uBAAuBwD;QAChC;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../src/findVersions.ts"],"sourcesContent":["import type { PaginateOptions, QueryOptions } from 'mongoose'\nimport type { FindVersions } from 'payload'\n\nimport { buildVersionCollectionFields, flattenWhereToOperators } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildSortParam } from './queries/buildSortParam.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getSession } from './utilities/getSession.js'\nimport { transform } from './utilities/transform.js'\n\nexport const findVersions: FindVersions = async function findVersions(\n this: MongooseAdapter,\n { collection, limit, locale, page, pagination, req = {}, select, skip, sort: sortArg, where },\n) {\n const Model = this.versions[collection]\n const collectionConfig = this.payload.collections[collection].config\n const session = await getSession(this, req)\n const options: QueryOptions = {\n limit,\n session,\n skip,\n }\n\n let hasNearConstraint = false\n\n if (where) {\n const constraints = flattenWhereToOperators(where)\n hasNearConstraint = constraints.some((prop) => Object.keys(prop).some((key) => key === 'near'))\n }\n\n let sort\n if (!hasNearConstraint) {\n sort = buildSortParam({\n config: this.payload.config,\n fields: collectionConfig.flattenedFields,\n locale,\n sort: sortArg || '-updatedAt',\n timestamps: true,\n })\n }\n\n const fields = buildVersionCollectionFields(this.payload.config, collectionConfig, true)\n\n const query = await buildQuery({\n adapter: this,\n fields,\n locale,\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 const paginationOptions: PaginateOptions = {\n lean: true,\n leanWithId: true,\n limit,\n options,\n page,\n pagination,\n projection: buildProjectionFromSelect({\n adapter: this,\n fields,\n select,\n }),\n sort,\n useEstimatedCount,\n }\n\n if (this.collation) {\n const defaultLocale = 'en'\n paginationOptions.collation = {\n locale: locale && locale !== 'all' && locale !== '*' ? locale : defaultLocale,\n ...this.collation,\n }\n }\n\n if (!useEstimatedCount && Object.keys(query).length === 0 && this.disableIndexHints !== true) {\n // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding\n // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,\n // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses\n // the correct indexed field\n paginationOptions.useCustomCountFn = () => {\n return Promise.resolve(\n Model.countDocuments(query, {\n hint: { _id: 1 },\n session,\n }),\n )\n }\n }\n\n if (limit >= 0) {\n paginationOptions.limit = limit\n // limit must also be set here, it's ignored when pagination is false\n paginationOptions.options.limit = limit\n\n // Disable pagination if limit is 0\n if (limit === 0) {\n paginationOptions.pagination = false\n }\n }\n\n const result = await Model.paginate(query, paginationOptions)\n\n transform({\n adapter: this,\n data: result.docs,\n fields: buildVersionCollectionFields(this.payload.config, collectionConfig),\n operation: 'read',\n })\n\n return result\n}\n"],"names":["buildVersionCollectionFields","flattenWhereToOperators","buildQuery","buildSortParam","buildProjectionFromSelect","getSession","transform","findVersions","collection","limit","locale","page","pagination","req","select","skip","sort","sortArg","where","Model","versions","collectionConfig","payload","collections","config","session","options","hasNearConstraint","constraints","some","prop","Object","keys","key","fields","flattenedFields","timestamps","query","adapter","useEstimatedCount","length","paginationOptions","lean","leanWithId","projection","collation","defaultLocale","disableIndexHints","useCustomCountFn","Promise","resolve","countDocuments","hint","_id","result","paginate","data","docs","operation"],"mappings":"AAGA,SAASA,4BAA4B,EAAEC,uBAAuB,QAAQ,UAAS;AAI/E,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,eAA6B,eAAeA,aAEvD,EAAEC,UAAU,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,UAAU,EAAEC,MAAM,CAAC,CAAC,EAAEC,MAAM,EAAEC,IAAI,EAAEC,MAAMC,OAAO,EAAEC,KAAK,EAAE;IAE7F,MAAMC,QAAQ,IAAI,CAACC,QAAQ,CAACZ,WAAW;IACvC,MAAMa,mBAAmB,IAAI,CAACC,OAAO,CAACC,WAAW,CAACf,WAAW,CAACgB,MAAM;IACpE,MAAMC,UAAU,MAAMpB,WAAW,IAAI,EAAEQ;IACvC,MAAMa,UAAwB;QAC5BjB;QACAgB;QACAV;IACF;IAEA,IAAIY,oBAAoB;IAExB,IAAIT,OAAO;QACT,MAAMU,cAAc3B,wBAAwBiB;QAC5CS,oBAAoBC,YAAYC,IAAI,CAAC,CAACC,OAASC,OAAOC,IAAI,CAACF,MAAMD,IAAI,CAAC,CAACI,MAAQA,QAAQ;IACzF;IAEA,IAAIjB;IACJ,IAAI,CAACW,mBAAmB;QACtBX,OAAOb,eAAe;YACpBqB,QAAQ,IAAI,CAACF,OAAO,CAACE,MAAM;YAC3BU,QAAQb,iBAAiBc,eAAe;YACxCzB;YACAM,MAAMC,WAAW;YACjBmB,YAAY;QACd;IACF;IAEA,MAAMF,SAASlC,6BAA6B,IAAI,CAACsB,OAAO,CA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,CAACE,MAAM,EAAEH;QAC1DqC,WAAW;IACb;IAEA,OAAOJ;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA6B,MAAM,SAAS,CAAA;AAgB9D,eAAO,MAAM,IAAI,EAAE,IAqFlB,CAAA"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA6B,MAAM,SAAS,CAAA;AAgB9D,eAAO,MAAM,IAAI,EAAE,IA6FlB,CAAA"}
package/dist/init.js CHANGED
@@ -5,7 +5,7 @@ import { buildVersionCollectionFields, buildVersionGlobalFields } from 'payload'
5
5
  import { buildCollectionSchema } from './models/buildCollectionSchema.js';
6
6
  import { buildGlobalModel } from './models/buildGlobalModel.js';
7
7
  import { buildSchema } from './models/buildSchema.js';
8
- import { getBuildQueryPlugin } from './queries/buildQuery.js';
8
+ import { getBuildQueryPlugin } from './queries/getBuildQueryPlugin.js';
9
9
  import { getDBName } from './utilities/getDBName.js';
10
10
  export const init = function init() {
11
11
  this.payload.config.collections.forEach((collection)=>{
@@ -17,15 +17,19 @@ export const init = function init() {
17
17
  versions: true
18
18
  });
19
19
  const versionCollectionFields = buildVersionCollectionFields(this.payload.config, collection);
20
- const versionSchema = buildSchema(this.payload, versionCollectionFields, {
21
- disableUnique: true,
22
- draftsEnabled: true,
23
- indexSortableFields: this.payload.config.indexSortableFields,
24
- options: {
25
- minimize: false,
26
- timestamps: false
20
+ const versionSchema = buildSchema({
21
+ buildSchemaOptions: {
22
+ disableUnique: true,
23
+ draftsEnabled: true,
24
+ indexSortableFields: this.payload.config.indexSortableFields,
25
+ options: {
26
+ minimize: false,
27
+ timestamps: false
28
+ },
29
+ ...schemaOptions
27
30
  },
28
- ...schemaOptions
31
+ configFields: versionCollectionFields,
32
+ payload: this.payload
29
33
  });
30
34
  versionSchema.plugin(paginate, {
31
35
  useEstimatedCount: true
@@ -53,14 +57,18 @@ export const init = function init() {
53
57
  versions: true
54
58
  });
55
59
  const versionGlobalFields = buildVersionGlobalFields(this.payload.config, global);
56
- const versionSchema = buildSchema(this.payload, versionGlobalFields, {
57
- disableUnique: true,
58
- draftsEnabled: true,
59
- indexSortableFields: this.payload.config.indexSortableFields,
60
- options: {
61
- minimize: false,
62
- timestamps: false
63
- }
60
+ const versionSchema = buildSchema({
61
+ buildSchemaOptions: {
62
+ disableUnique: true,
63
+ draftsEnabled: true,
64
+ indexSortableFields: this.payload.config.indexSortableFields,
65
+ options: {
66
+ minimize: false,
67
+ timestamps: false
68
+ }
69
+ },
70
+ configFields: versionGlobalFields,
71
+ payload: this.payload
64
72
  });
65
73
  versionSchema.plugin(paginate, {
66
74
  useEstimatedCount: true
package/dist/init.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/init.ts"],"sourcesContent":["import type { PaginateOptions } from 'mongoose'\nimport type { Init, SanitizedCollectionConfig } from 'payload'\n\nimport mongoose from 'mongoose'\nimport mongooseAggregatePaginate from 'mongoose-aggregate-paginate-v2'\nimport paginate from 'mongoose-paginate-v2'\nimport { buildVersionCollectionFields, buildVersionGlobalFields } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\nimport type { CollectionModel } from './types.js'\n\nimport { buildCollectionSchema } from './models/buildCollectionSchema.js'\nimport { buildGlobalModel } from './models/buildGlobalModel.js'\nimport { buildSchema } from './models/buildSchema.js'\nimport { getBuildQueryPlugin } from './queries/buildQuery.js'\nimport { getDBName } from './utilities/getDBName.js'\n\nexport const init: Init = function init(this: MongooseAdapter) {\n this.payload.config.collections.forEach((collection: SanitizedCollectionConfig) => {\n const schemaOptions = this.collectionsSchemaOptions[collection.slug]\n\n const schema = buildCollectionSchema(collection, this.payload, schemaOptions)\n\n if (collection.versions) {\n const versionModelName = getDBName({ config: collection, versions: true })\n\n const versionCollectionFields = buildVersionCollectionFields(this.payload.config, collection)\n\n const versionSchema = buildSchema(this.payload, versionCollectionFields, {\n disableUnique: true,\n draftsEnabled: true,\n indexSortableFields: this.payload.config.indexSortableFields,\n options: {\n minimize: false,\n timestamps: false,\n },\n ...schemaOptions,\n })\n\n versionSchema.plugin<any, PaginateOptions>(paginate, { useEstimatedCount: true }).plugin(\n getBuildQueryPlugin({\n collectionSlug: collection.slug,\n versionsFields: buildVersionCollectionFields(this.payload.config, collection, true),\n }),\n )\n\n if (Object.keys(collection.joins).length > 0) {\n versionSchema.plugin(mongooseAggregatePaginate)\n }\n\n const versionCollectionName =\n this.autoPluralization === true && !collection.dbName ? undefined : versionModelName\n\n this.versions[collection.slug] = mongoose.model(\n versionModelName,\n versionSchema,\n versionCollectionName,\n ) as CollectionModel\n }\n\n const modelName = getDBName({ config: collection })\n const collectionName =\n this.autoPluralization === true && !collection.dbName ? undefined : modelName\n\n this.collections[collection.slug] = mongoose.model(\n modelName,\n schema,\n collectionName,\n ) as CollectionModel\n })\n\n this.globals = buildGlobalModel(this.payload)\n\n this.payload.config.globals.forEach((global) => {\n if (global.versions) {\n const versionModelName = getDBName({ config: global, versions: true })\n\n const versionGlobalFields = buildVersionGlobalFields(this.payload.config, global)\n\n const versionSchema = buildSchema(this.payload, versionGlobalFields, {\n disableUnique: true,\n draftsEnabled: true,\n indexSortableFields: this.payload.config.indexSortableFields,\n options: {\n minimize: false,\n timestamps: false,\n },\n })\n\n versionSchema.plugin<any, PaginateOptions>(paginate, { useEstimatedCount: true }).plugin(\n getBuildQueryPlugin({\n versionsFields: buildVersionGlobalFields(this.payload.config, global, true),\n }),\n )\n\n this.versions[global.slug] = mongoose.model(\n versionModelName,\n versionSchema,\n versionModelName,\n ) as CollectionModel\n }\n })\n}\n"],"names":["mongoose","mongooseAggregatePaginate","paginate","buildVersionCollectionFields","buildVersionGlobalFields","buildCollectionSchema","buildGlobalModel","buildSchema","getBuildQueryPlugin","getDBName","init","payload","config","collections","forEach","collection","schemaOptions","collectionsSchemaOptions","slug","schema","versions","versionModelName","versionCollectionFields","versionSchema","disableUnique","draftsEnabled","indexSortableFields","options","minimize","timestamps","plugin","useEstimatedCount","collectionSlug","versionsFields","Object","keys","joins","length","versionCollectionName","autoPluralization","dbName","undefined","model","modelName","collectionName","globals","global","versionGlobalFields"],"mappings":"AAGA,OAAOA,cAAc,WAAU;AAC/B,OAAOC,+BAA+B,iCAAgC;AACtE,OAAOC,cAAc,uBAAsB;AAC3C,SAASC,4BAA4B,EAAEC,wBAAwB,QAAQ,UAAS;AAKhF,SAASC,qBAAqB,QAAQ,oCAAmC;AACzE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,WAAW,QAAQ,0BAAyB;AACrD,SAASC,mBAAmB,QAAQ,0BAAyB;AAC7D,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,OAAa,SAASA;IACjC,IAAI,CAACC,OAAO,CAACC,MAAM,CAACC,WAAW,CAACC,OAAO,CAAC,CAACC;QACvC,MAAMC,gBAAgB,IAAI,CAACC,wBAAwB,CAACF,WAAWG,IAAI,CAAC;QAEpE,MAAMC,SAASd,sBAAsBU,YAAY,IAAI,CAACJ,OAAO,EAAEK;QAE/D,IAAID,WAAWK,QAAQ,EAAE;YACvB,MAAMC,mBAAmBZ,UAAU;gBAAEG,QAAQG;gBAAYK,UAAU;YAAK;YAExE,MAAME,0BAA0BnB,6BAA6B,IAAI,CAACQ,OAAO,CAACC,MAAM,EAAEG;YAElF,MAAMQ,gBAAgBhB,YAAY,IAAI,CAACI,OAAO,EAAEW,yBAAyB;gBACvEE,eAAe;gBACfC,eAAe;gBACfC,qBAAqB,IAAI,CAACf,OAAO,CAACC,MAAM,CAACc,mBAAmB;gBAC5DC,SAAS;oBACPC,UAAU;oBACVC,YAAY;gBACd;gBACA,GAAGb,aAAa;YAClB;YAEAO,cAAcO,MAAM,CAAuB5B,UAAU;gBAAE6B,mBAAmB;YAAK,GAAGD,MAAM,CACtFtB,oBAAoB;g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6B,mBAAmB;YAAK,GAAGD,MAAM,CACtFtB,oBAAoB;gBAClByB,gBAAgB7B,yBAAyB,IAAI,CAACO,OAAO,CAACC,MAAM,EAAEkC,QAAQ;YACxE;YAGF,IAAI,CAAC1B,QAAQ,CAAC0B,OAAO5B,IAAI,CAAC,GAAGlB,SAAS0C,KAAK,CACzCrB,kBACAE,eACAF;QAEJ;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../src/init.ts"],"sourcesContent":["import type { PaginateOptions } from 'mongoose'\nimport type { Init, SanitizedCollectionConfig } from 'payload'\n\nimport mongoose from 'mongoose'\nimport mongooseAggregatePaginate from 'mongoose-aggregate-paginate-v2'\nimport paginate from 'mongoose-paginate-v2'\nimport { buildVersionCollectionFields, buildVersionGlobalFields } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\nimport type { CollectionModel } from './types.js'\n\nimport { buildCollectionSchema } from './models/buildCollectionSchema.js'\nimport { buildGlobalModel } from './models/buildGlobalModel.js'\nimport { buildSchema } from './models/buildSchema.js'\nimport { getBuildQueryPlugin } from './queries/getBuildQueryPlugin.js'\nimport { getDBName } from './utilities/getDBName.js'\n\nexport const init: Init = function init(this: MongooseAdapter) {\n this.payload.config.collections.forEach((collection: SanitizedCollectionConfig) => {\n const schemaOptions = this.collectionsSchemaOptions[collection.slug]\n\n const schema = buildCollectionSchema(collection, this.payload, schemaOptions)\n\n if (collection.versions) {\n const versionModelName = getDBName({ config: collection, versions: true })\n\n const versionCollectionFields = buildVersionCollectionFields(this.payload.config, collection)\n\n const versionSchema = buildSchema({\n buildSchemaOptions: {\n disableUnique: true,\n draftsEnabled: true,\n indexSortableFields: this.payload.config.indexSortableFields,\n options: {\n minimize: false,\n timestamps: false,\n },\n ...schemaOptions,\n },\n configFields: versionCollectionFields,\n payload: this.payload,\n })\n\n versionSchema.plugin<any, PaginateOptions>(paginate, { useEstimatedCount: true }).plugin(\n getBuildQueryPlugin({\n collectionSlug: collection.slug,\n versionsFields: buildVersionCollectionFields(this.payload.config, collection, true),\n }),\n )\n\n if (Object.keys(collection.joins).length > 0) {\n versionSchema.plugin(mongooseAggregatePaginate)\n }\n\n const versionCollectionName =\n this.autoPluralization === true && !collection.dbName ? undefined : versionModelName\n\n this.versions[collection.slug] = mongoose.model(\n versionModelName,\n versionSchema,\n versionCollectionName,\n ) as CollectionModel\n }\n\n const modelName = getDBName({ config: collection })\n const collectionName =\n this.autoPluralization === true && !collection.dbName ? undefined : modelName\n\n this.collections[collection.slug] = mongoose.model(\n modelName,\n schema,\n collectionName,\n ) as CollectionModel\n })\n\n this.globals = buildGlobalModel(this.payload)\n\n this.payload.config.globals.forEach((global) => {\n if (global.versions) {\n const versionModelName = getDBName({ config: global, versions: true })\n\n const versionGlobalFields = buildVersionGlobalFields(this.payload.config, global)\n\n const versionSchema = buildSchema({\n buildSchemaOptions: {\n disableUnique: true,\n draftsEnabled: true,\n indexSortableFields: this.payload.config.indexSortableFields,\n options: {\n minimize: false,\n timestamps: false,\n },\n },\n configFields: versionGlobalFields,\n payload: this.payload,\n })\n\n versionSchema.plugin<any, PaginateOptions>(paginate, { useEstimatedCount: true }).plugin(\n getBuildQueryPlugin({\n versionsFields: buildVersionGlobalFields(this.payload.config, global, true),\n }),\n )\n\n this.versions[global.slug] = mongoose.model(\n versionModelName,\n versionSchema,\n versionModelName,\n ) as CollectionModel\n }\n })\n}\n"],"names":["mongoose","mongooseAggregatePaginate","paginate","buildVersionCollectionFields","buildVersionGlobalFields","buildCollectionSchema","buildGlobalModel","buildSchema","getBuildQueryPlugin","getDBName","init","payload","config","collections","forEach","collection","schemaOptions","collectionsSchemaOptions","slug","schema","versions","versionModelName","versionCollectionFields","versionSchema","buildSchemaOptions","disableUnique","draftsEnabled","indexSortableFields","options","minimize","timestamps","configFields","plugin","useEstimatedCount","collectionSlug","versionsFields","Object","keys","joins","length","versionCollectionName","autoPluralization","dbName","undefined","model","modelName","collectionName","globals","global","versionGlobalFields"],"mappings":"AAGA,OAAOA,cAAc,WAAU;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AC5B,QAAQ,CAAC4B,OAAO9B,IAAI,CAAC,GAAGlB,SAAS4C,KAAK,CACzCvB,kBACAE,eACAF;QAEJ;IACF;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildCollectionSchema.d.ts","sourceRoot":"","sources":["../../src/models/buildCollectionSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,MAAM,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAQjE,eAAO,MAAM,qBAAqB,eACpB,yBAAyB,WAC5B,OAAO,yBAEf,MAgCF,CAAA"}
1
+ {"version":3,"file":"buildCollectionSchema.d.ts","sourceRoot":"","sources":["../../src/models/buildCollectionSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,MAAM,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAQjE,eAAO,MAAM,qBAAqB,eACpB,yBAAyB,WAC5B,OAAO,yBAEf,MAyCF,CAAA"}