@payloadcms/db-mongodb 4.0.0-internal.543da65 → 4.0.0-internal.567a487
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/count.d.ts.map +1 -1
- package/dist/count.js +8 -2
- package/dist/count.js.map +1 -1
- package/dist/countVersions.d.ts.map +1 -1
- package/dist/countVersions.js +10 -2
- package/dist/countVersions.js.map +1 -1
- package/dist/createGlobalVersion.d.ts.map +1 -1
- package/dist/createGlobalVersion.js +22 -0
- package/dist/createGlobalVersion.js.map +1 -1
- package/dist/createVersion.d.ts.map +1 -1
- package/dist/createVersion.js +16 -3
- package/dist/createVersion.js.map +1 -1
- package/dist/deleteBranchGlobal.d.ts +10 -0
- package/dist/deleteBranchGlobal.d.ts.map +1 -0
- package/dist/deleteBranchGlobal.js +22 -0
- package/dist/deleteBranchGlobal.js.map +1 -0
- package/dist/deleteOne.d.ts.map +1 -1
- package/dist/deleteOne.js +18 -1
- package/dist/deleteOne.js.map +1 -1
- package/dist/find.d.ts.map +1 -1
- package/dist/find.js +24 -5
- package/dist/find.js.map +1 -1
- package/dist/findDistinct.d.ts.map +1 -1
- package/dist/findDistinct.js +10 -2
- package/dist/findDistinct.js.map +1 -1
- package/dist/findGlobal.d.ts.map +1 -1
- package/dist/findGlobal.js +26 -4
- package/dist/findGlobal.js.map +1 -1
- package/dist/findGlobalVersions.d.ts.map +1 -1
- package/dist/findGlobalVersions.js +8 -2
- package/dist/findGlobalVersions.js.map +1 -1
- package/dist/findOne.d.ts.map +1 -1
- package/dist/findOne.js +24 -3
- package/dist/findOne.js.map +1 -1
- package/dist/findVersions.d.ts.map +1 -1
- package/dist/findVersions.js +17 -3
- package/dist/findVersions.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/models/buildCollectionSchema.d.ts.map +1 -1
- package/dist/models/buildGlobalModel.d.ts.map +1 -1
- package/dist/models/buildSchema.d.ts.map +1 -1
- package/dist/queries/buildQuery.d.ts.map +1 -1
- package/dist/queries/buildSortParam.d.ts.map +1 -1
- package/dist/queries/buildSortParam.spec.js +1 -1
- package/dist/queries/buildSortParam.spec.js.map +1 -1
- package/dist/queries/getBuildQueryPlugin.d.ts.map +1 -1
- package/dist/queries/getLocalizedSortProperty.d.ts.map +1 -1
- package/dist/queries/getLocalizedSortProperty.spec.js +1 -1
- package/dist/queries/getLocalizedSortProperty.spec.js.map +1 -1
- package/dist/queries/operatorMap.d.ts.map +1 -1
- package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
- package/dist/queryDrafts.d.ts.map +1 -1
- package/dist/queryDrafts.js +16 -4
- package/dist/queryDrafts.js.map +1 -1
- package/dist/testCredentials.d.ts.map +1 -1
- package/dist/transactions/beginTransaction.d.ts.map +1 -1
- package/dist/transactions/beginTransaction.js +0 -1
- package/dist/transactions/beginTransaction.js.map +1 -1
- package/dist/updateGlobal.d.ts.map +1 -1
- package/dist/updateGlobal.js +68 -7
- package/dist/updateGlobal.js.map +1 -1
- package/dist/updateJobs.d.ts.map +1 -1
- package/dist/updateJobs.js +70 -13
- package/dist/updateJobs.js.map +1 -1
- package/dist/updateOne.d.ts.map +1 -1
- package/dist/updateOne.js +26 -2
- package/dist/updateOne.js.map +1 -1
- package/dist/utilities/aggregatePaginate.d.ts.map +1 -1
- package/dist/utilities/buildJoinAggregation.d.ts +3 -2
- package/dist/utilities/buildJoinAggregation.d.ts.map +1 -1
- package/dist/utilities/buildJoinAggregation.js +31 -4
- package/dist/utilities/buildJoinAggregation.js.map +1 -1
- package/dist/utilities/buildProjectionFromSelect.d.ts.map +1 -1
- package/dist/utilities/getDBName.d.ts.map +1 -1
- package/dist/utilities/getEntity.d.ts +1 -1
- package/dist/utilities/getEntity.d.ts.map +1 -1
- package/dist/utilities/handleError.d.ts.map +1 -1
- package/dist/utilities/isObjectID.d.ts.map +1 -1
- package/dist/utilities/resolveJoins.d.ts +4 -2
- package/dist/utilities/resolveJoins.d.ts.map +1 -1
- package/dist/utilities/resolveJoins.js +16 -2
- package/dist/utilities/resolveJoins.js.map +1 -1
- package/dist/utilities/transform.d.ts.map +1 -1
- package/dist/utilities/transform.js +15 -0
- package/dist/utilities/transform.js.map +1 -1
- package/dist/utilities/transform.spec.js +67 -0
- package/dist/utilities/transform.spec.js.map +1 -1
- package/package.json +4 -4
package/dist/findGlobal.d.ts.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"findGlobal.d.ts","sourceRoot":"","sources":["../src/findGlobal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAkBzC,eAAO,MAAM,UAAU,EAAE,UAqDxB,CAAA"}
|
package/dist/findGlobal.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import { combineQueries } from 'payload';
|
|
1
|
+
import { branchGlobalNeedsBothRows, combineQueries, pickBranchGlobal, resolveBranch, resolveBranchGlobalQuery } from 'payload';
|
|
2
2
|
import { buildQuery } from './queries/buildQuery.js';
|
|
3
3
|
import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js';
|
|
4
4
|
import { getGlobal } from './utilities/getEntity.js';
|
|
5
5
|
import { getSession } from './utilities/getSession.js';
|
|
6
6
|
import { transform } from './utilities/transform.js';
|
|
7
|
-
export const findGlobal = async function findGlobal({ slug: globalSlug, locale, req, select, where = {} }) {
|
|
7
|
+
export const findGlobal = async function findGlobal({ slug: globalSlug, branch, locale, req, select, where = {} }) {
|
|
8
8
|
const { globalConfig, Model } = getGlobal({
|
|
9
9
|
adapter: this,
|
|
10
10
|
globalSlug
|
|
11
11
|
});
|
|
12
12
|
const fields = globalConfig.flattenedFields;
|
|
13
|
+
const branchedWhere = resolveBranchGlobalQuery({
|
|
14
|
+
branch,
|
|
15
|
+
globalSlug,
|
|
16
|
+
req,
|
|
17
|
+
where
|
|
18
|
+
});
|
|
13
19
|
const query = await buildQuery({
|
|
14
20
|
adapter: this,
|
|
15
21
|
fields,
|
|
@@ -19,7 +25,7 @@ export const findGlobal = async function findGlobal({ slug: globalSlug, locale,
|
|
|
19
25
|
globalType: {
|
|
20
26
|
equals: globalSlug
|
|
21
27
|
}
|
|
22
|
-
},
|
|
28
|
+
}, branchedWhere ?? {})
|
|
23
29
|
});
|
|
24
30
|
const options = {
|
|
25
31
|
lean: true,
|
|
@@ -30,7 +36,23 @@ export const findGlobal = async function findGlobal({ slug: globalSlug, locale,
|
|
|
30
36
|
}),
|
|
31
37
|
session: await getSession(this, req)
|
|
32
38
|
};
|
|
33
|
-
|
|
39
|
+
// A global is one document, so the branch's row and main's row can be fetched
|
|
40
|
+
// together and the branch's preferred in memory. There is no result set to
|
|
41
|
+
// paginate, so nothing a post-query step could get wrong.
|
|
42
|
+
let doc;
|
|
43
|
+
if (branchGlobalNeedsBothRows({
|
|
44
|
+
branch,
|
|
45
|
+
globalSlug,
|
|
46
|
+
req
|
|
47
|
+
})) {
|
|
48
|
+
const rows = await Model.find(query, {}, {
|
|
49
|
+
...options,
|
|
50
|
+
limit: 2
|
|
51
|
+
}).lean();
|
|
52
|
+
doc = pickBranchGlobal(rows, branch || resolveBranch(req));
|
|
53
|
+
} else {
|
|
54
|
+
doc = await Model.findOne(query, {}, options);
|
|
55
|
+
}
|
|
34
56
|
if (!doc) {
|
|
35
57
|
return null;
|
|
36
58
|
}
|
package/dist/findGlobal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/findGlobal.ts"],"sourcesContent":["import type { QueryOptions } from 'mongoose'\nimport type { FindGlobal } from 'payload'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/findGlobal.ts"],"sourcesContent":["import type { QueryOptions } from 'mongoose'\nimport type { FindGlobal } from 'payload'\n\nimport {\n branchGlobalNeedsBothRows,\n combineQueries,\n pickBranchGlobal,\n resolveBranch,\n resolveBranchGlobalQuery,\n} from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getGlobal } from './utilities/getEntity.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: globalSlug, branch, locale, req, select, where = {} },\n) {\n const { globalConfig, Model } = getGlobal({ adapter: this, globalSlug })\n\n const fields = globalConfig.flattenedFields\n\n const branchedWhere = resolveBranchGlobalQuery({ branch, globalSlug, req, where })\n\n const query = await buildQuery({\n adapter: this,\n fields,\n globalSlug,\n locale,\n where: combineQueries({ globalType: { equals: globalSlug } }, branchedWhere ?? {}),\n })\n\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 // A global is one document, so the branch's row and main's row can be fetched\n // together and the branch's preferred in memory. There is no result set to\n // paginate, so nothing a post-query step could get wrong.\n let doc: any\n\n if (branchGlobalNeedsBothRows({ branch, globalSlug, req })) {\n const rows = await Model.find(query, {}, { ...options, limit: 2 }).lean()\n\n doc = pickBranchGlobal(rows as Record<string, any>[], branch || resolveBranch(req as never))\n } else {\n doc = await Model.findOne(query, {}, options)\n }\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":["branchGlobalNeedsBothRows","combineQueries","pickBranchGlobal","resolveBranch","resolveBranchGlobalQuery","buildQuery","buildProjectionFromSelect","getGlobal","getSession","transform","findGlobal","slug","globalSlug","branch","locale","req","select","where","globalConfig","Model","adapter","fields","flattenedFields","branchedWhere","query","globalType","equals","options","lean","session","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OAAO;QACLe,MAAM,MAAMX,MAAMe,OAAO,CAACV,OAAO,CAAC,GAAGG;IACvC;IAEA,IAAI,CAACG,KAAK;QACR,OAAO;IACT;IAEArB,UAAU;QACRW,SAAS,IAAI;QACbe,MAAML;QACNT,QAAQH,aAAaG,MAAM;QAC3Be,WAAW;IACb;IAEA,OAAON;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;
|
|
1
|
+
{"version":3,"file":"findGlobalVersions.d.ts","sourceRoot":"","sources":["../src/findGlobalVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAkBjD,eAAO,MAAM,kBAAkB,EAAE,kBAoIhC,CAAA"}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import { buildVersionGlobalFields, flattenWhereToOperators } from 'payload';
|
|
1
|
+
import { buildVersionGlobalFields, flattenWhereToOperators, resolveBranchGlobalVersionQuery } from 'payload';
|
|
2
2
|
import { buildQuery } from './queries/buildQuery.js';
|
|
3
3
|
import { buildSortParam } from './queries/buildSortParam.js';
|
|
4
4
|
import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js';
|
|
5
5
|
import { getGlobal } from './utilities/getEntity.js';
|
|
6
6
|
import { getSession } from './utilities/getSession.js';
|
|
7
7
|
import { transform } from './utilities/transform.js';
|
|
8
|
-
export const findGlobalVersions = async function findGlobalVersions({ global: globalSlug, limit = 0, locale, page, pagination, req, select, sort: sortArg, where = {} }) {
|
|
8
|
+
export const findGlobalVersions = async function findGlobalVersions({ branch, global: globalSlug, limit = 0, locale, page, pagination, req, select, sort: sortArg, where = {} }) {
|
|
9
9
|
const { globalConfig, Model } = getGlobal({
|
|
10
10
|
adapter: this,
|
|
11
11
|
globalSlug,
|
|
12
12
|
versions: true
|
|
13
13
|
});
|
|
14
|
+
where = resolveBranchGlobalVersionQuery({
|
|
15
|
+
branch,
|
|
16
|
+
globalSlug,
|
|
17
|
+
req,
|
|
18
|
+
where
|
|
19
|
+
}) ?? {};
|
|
14
20
|
const versionFields = buildVersionGlobalFields(this.payload.config, globalConfig, true);
|
|
15
21
|
let hasNearConstraint = false;
|
|
16
22
|
if (where) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/findGlobalVersions.ts"],"sourcesContent":["import type { PaginateOptions, QueryOptions } from 'mongoose'\nimport type { FindGlobalVersions } from 'payload'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/findGlobalVersions.ts"],"sourcesContent":["import type { PaginateOptions, QueryOptions } from 'mongoose'\nimport type { FindGlobalVersions } from 'payload'\n\nimport {\n APIError,\n buildVersionGlobalFields,\n flattenWhereToOperators,\n resolveBranchGlobalVersionQuery,\n} 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 { getGlobal } from './utilities/getEntity.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 {\n branch,\n global: globalSlug,\n limit = 0,\n locale,\n page,\n pagination,\n req,\n select,\n sort: sortArg,\n where = {},\n },\n) {\n const { globalConfig, Model } = getGlobal({ adapter: this, globalSlug, versions: true })\n\n where = resolveBranchGlobalVersionQuery({ branch, globalSlug, req, where }) ?? {}\n\n const versionFields = buildVersionGlobalFields(this.payload.config, globalConfig, true)\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 adapter: this,\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 const session = await getSession(this, req)\n // Calculate skip from page for cases where pagination is disabled but offset is still needed\n const skip = typeof page === 'number' && page > 1 ? (page - 1) * (limit || 0) : undefined\n const options: QueryOptions = {\n limit,\n session,\n skip,\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 localizationConfig = this.payload.config.localization\n const defaultLocale =\n (typeof localizationConfig === 'object' && localizationConfig?.defaultLocale) || 'en'\n\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 collation: paginationOptions.collation,\n hint: { _id: 1 },\n session,\n }),\n )\n }\n } else if (!useEstimatedCount && this.collation) {\n // Workaround for mongoose-paginate-v2 bug: chaining .collation() on countDocuments breaks\n // session context in transactions (mongoose 8.x). Provide custom count function that passes\n // collation as an option instead. See: https://github.com/aravindnc/mongoose-paginate-v2/pull/240\n // TODO: Remove this workaround once mongoose-paginate-v2 is updated with the fix.\n paginationOptions.useCustomCountFn = () => {\n return Promise.resolve(\n Model.countDocuments(query, {\n collation: paginationOptions.collation,\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\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","resolveBranchGlobalVersionQuery","buildQuery","buildSortParam","buildProjectionFromSelect","getGlobal","getSession","transform","findGlobalVersions","branch","global","globalSlug","limit","locale","page","pagination","req","select","sort","sortArg","where","globalConfig","Model","adapter","versions","versionFields","payload","config","hasNearConstraint","constraints","some","prop","Object","keys","key","fields","timestamps","query","session","skip","undefined","options","useEstimatedCount","length","paginationOptions","lean","leanWithId","projection","collation","localizationConfig","localization","defaultLocale","disableIndexHints","useCustomCountFn","Promise","resolve","countDocuments","hint","_id","result","paginate","data","docs","operation"],"mappings":"AAGA,SAEEA,wBAAwB,EACxBC,uBAAuB,EACvBC,+BAA+B,QAC1B,UAAS;AAIhB,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,SAAS,QAAQ,2BAA0B;AACpD,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,qBAAyC,eAAeA,mBAEnE,EACEC,MAAM,EACNC,QAAQC,UAAU,EAClBC,QAAQ,CAAC,EACTC,MAAM,EACNC,IAAI,EACJC,UAAU,EACVC,GAAG,EACHC,MAAM,EACNC,MAAMC,OAAO,EACbC,QAAQ,CAAC,CAAC,EACX;IAED,MAAM,EAAEC,YAAY,EAAEC,KAAK,EAAE,GAAGjB,UA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AEN;QACtD0C,WAAW;IACb;IAEA,OAAOJ;AACT,EAAC"}
|
package/dist/findOne.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findOne.d.ts","sourceRoot":"","sources":["../src/findOne.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"findOne.d.ts","sourceRoot":"","sources":["../src/findOne.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,OAAO,EAGb,MAAM,SAAS,CAAA;AAahB,eAAO,MAAM,OAAO,EAAE,OAkFrB,CAAA"}
|
package/dist/findOne.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { applyBranchIDProjection, resolveBranchQuery, withBranchIDSelect } from 'payload';
|
|
1
2
|
import { buildQuery } from './queries/buildQuery.js';
|
|
2
3
|
import { aggregatePaginate } from './utilities/aggregatePaginate.js';
|
|
3
4
|
import { buildJoinAggregation } from './utilities/buildJoinAggregation.js';
|
|
@@ -6,11 +7,17 @@ import { getCollection } from './utilities/getEntity.js';
|
|
|
6
7
|
import { getSession } from './utilities/getSession.js';
|
|
7
8
|
import { resolveJoins } from './utilities/resolveJoins.js';
|
|
8
9
|
import { transform } from './utilities/transform.js';
|
|
9
|
-
export const findOne = async function findOne({ collection: collectionSlug, draftsEnabled, joins, locale, req, select, where = {} }) {
|
|
10
|
+
export const findOne = async function findOne({ branch, collection: collectionSlug, draftsEnabled, joins, locale, req, select, where = {} }) {
|
|
10
11
|
const { collectionConfig, Model } = getCollection({
|
|
11
12
|
adapter: this,
|
|
12
13
|
collectionSlug
|
|
13
14
|
});
|
|
15
|
+
where = await resolveBranchQuery({
|
|
16
|
+
branch,
|
|
17
|
+
collectionSlug,
|
|
18
|
+
req,
|
|
19
|
+
where
|
|
20
|
+
}) ?? {};
|
|
14
21
|
const query = await buildQuery({
|
|
15
22
|
adapter: this,
|
|
16
23
|
collectionSlug,
|
|
@@ -21,7 +28,12 @@ export const findOne = async function findOne({ collection: collectionSlug, draf
|
|
|
21
28
|
const projection = buildProjectionFromSelect({
|
|
22
29
|
adapter: this,
|
|
23
30
|
fields: collectionConfig.flattenedFields,
|
|
24
|
-
select
|
|
31
|
+
select: withBranchIDSelect({
|
|
32
|
+
branch,
|
|
33
|
+
collectionSlug,
|
|
34
|
+
req,
|
|
35
|
+
select
|
|
36
|
+
})
|
|
25
37
|
});
|
|
26
38
|
const aggregate = await buildJoinAggregation({
|
|
27
39
|
adapter: this,
|
|
@@ -31,7 +43,8 @@ export const findOne = async function findOne({ collection: collectionSlug, draf
|
|
|
31
43
|
joins,
|
|
32
44
|
locale,
|
|
33
45
|
projection,
|
|
34
|
-
query
|
|
46
|
+
query,
|
|
47
|
+
req
|
|
35
48
|
});
|
|
36
49
|
const session = await getSession(this, req);
|
|
37
50
|
const options = {
|
|
@@ -76,6 +89,14 @@ export const findOne = async function findOne({ collection: collectionSlug, draf
|
|
|
76
89
|
fields: collectionConfig.fields,
|
|
77
90
|
operation: 'read'
|
|
78
91
|
});
|
|
92
|
+
applyBranchIDProjection({
|
|
93
|
+
branch,
|
|
94
|
+
collectionSlug,
|
|
95
|
+
docs: [
|
|
96
|
+
doc
|
|
97
|
+
],
|
|
98
|
+
req
|
|
99
|
+
});
|
|
79
100
|
return doc;
|
|
80
101
|
};
|
|
81
102
|
|
package/dist/findOne.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/findOne.ts"],"sourcesContent":["import type { AggregateOptions, QueryOptions } from 'mongoose'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/findOne.ts"],"sourcesContent":["import type { AggregateOptions, QueryOptions } from 'mongoose'\n\nimport {\n applyBranchIDProjection,\n type FindOne,\n resolveBranchQuery,\n withBranchIDSelect,\n} from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { aggregatePaginate } from './utilities/aggregatePaginate.js'\nimport { buildJoinAggregation } from './utilities/buildJoinAggregation.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getCollection } from './utilities/getEntity.js'\nimport { getSession } from './utilities/getSession.js'\nimport { resolveJoins } from './utilities/resolveJoins.js'\nimport { transform } from './utilities/transform.js'\n\nexport const findOne: FindOne = async function findOne(\n this: MongooseAdapter,\n { branch, collection: collectionSlug, draftsEnabled, joins, locale, req, select, where = {} },\n) {\n const { collectionConfig, Model } = getCollection({ adapter: this, collectionSlug })\n\n where = (await resolveBranchQuery({ branch, collectionSlug, req, where })) ?? {}\n\n const query = await buildQuery({\n adapter: this,\n collectionSlug,\n fields: collectionConfig.flattenedFields,\n locale,\n where,\n })\n\n const projection = buildProjectionFromSelect({\n adapter: this,\n fields: collectionConfig.flattenedFields,\n select: withBranchIDSelect({ branch, collectionSlug, req, select }),\n })\n\n const aggregate = await buildJoinAggregation({\n adapter: this,\n collection: collectionSlug,\n collectionConfig,\n draftsEnabled,\n joins,\n locale,\n projection,\n query,\n req,\n })\n\n const session = await getSession(this, req)\n const options: AggregateOptions & QueryOptions = {\n lean: true,\n session,\n }\n\n let doc\n if (aggregate) {\n const { docs } = await aggregatePaginate({\n adapter: this,\n joinAggregation: aggregate,\n limit: 1,\n Model,\n pagination: false,\n projection,\n query,\n session,\n })\n doc = docs[0]\n } else {\n ;(options as Record<string, unknown>).projection = projection\n doc = await Model.findOne(query, {}, options)\n }\n\n if (doc && !this.useJoinAggregations) {\n await resolveJoins({\n adapter: this,\n collectionSlug,\n docs: [doc] as Record<string, unknown>[],\n joins,\n locale,\n })\n }\n\n if (!doc) {\n return null\n }\n\n transform({ adapter: this, data: doc, fields: collectionConfig.fields, operation: 'read' })\n\n applyBranchIDProjection({\n branch,\n collectionSlug,\n docs: [doc as Record<string, unknown>],\n req,\n })\n\n return doc\n}\n"],"names":["applyBranchIDProjection","resolveBranchQuery","withBranchIDSelect","buildQuery","aggregatePaginate","buildJoinAggregation","buildProjectionFromSelect","getCollection","getSession","resolveJoins","transform","findOne","branch","collection","collectionSlug","draftsEnabled","joins","locale","req","select","where","collectionConfig","Model","adapter","query","fields","flattenedFields","projection","aggregate","session","options","lean","doc","docs","joinAggregation","limit","pagination","useJoinAggregations","data","operation"],"mappings":"AAEA,SACEA,uBAAuB,EAEvBC,kBAAkB,EAClBC,kBAAkB,QACb,UAAS;AAIhB,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,iBAAiB,QAAQ,mCAAkC;AACpE,SAASC,oBAAoB,QAAQ,sCAAqC;AAC1E,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,aAAa,QAAQ,2BAA0B;AACxD,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,YAAY,QAAQ,8BAA6B;AAC1D,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,UAAmB,eAAeA,QAE7C,EAAEC,MAAM,EAAEC,YAAYC,cAAc,EAAEC,aAAa,EAAEC,KAAK,EAAEC,MAAM,EAAEC,GAAG,EAAEC,MAAM,EAAEC,QAAQ,CAAC,CAAC,EAAE;IAE7F,MAAM,EAAEC,gBAAgB,EAAEC,KAAK,EAAE,GAAGf,cAAc;QAAEgB,SAAS,IAAI;QAAET;IAAe;IAElFM,QAAQ,AAAC,MAAMnB,mBAAmB;QAAEW;QAAQE;QAAgBI;QAAKE;IAAM,MAAO,CAAC;IAE/E,MAAMI,QAAQ,MAAMrB,WAAW;QAC7BoB,SAAS,IAAI;QACbT;QACAW,QAAQJ,iBAAiBK,eAAe;QACxCT;QACAG;IACF;IAEA,MAAMO,aAAarB,0BAA0B;QAC3CiB,SAAS,IAAI;QACbE,QAAQJ,iBAAiBK,eAAe;QACxCP,QAAQjB,mBAAmB;YAAEU;YAAQE;YAAgBI;YAAKC;QAAO;IACnE;IAEA,MAAMS,YAAY,MAAMvB,qBAAqB;QAC3CkB,SAAS,IAAI;QACbV,YAAYC;QACZO;QACAN;QACAC;QACAC;QACAU;QACAH;QACAN;IACF;IAEA,MAAMW,UAAU,MAAMrB,WAAW,IAAI,EAAEU;IACvC,MAAMY,UAA2C;QAC/CC,MAAM;QACNF;IACF;IAEA,IAAIG;IACJ,IAAIJ,WAAW;QACb,MAAM,EAAEK,IAAI,EAAE,GAAG,MAAM7B,kBAAkB;YACvCmB,SAAS,IAAI;YACbW,iBAAiBN;YACjBO,OAAO;YACPb;YACAc,YAAY;YACZT;YACAH;YACAK;QACF;QACAG,MAAMC,IAAI,CAAC,EAAE;IACf,OAAO;;QACHH,QAAoCH,UAAU,GAAGA;QACnDK,MAAM,MAAMV,MAAMX,OAAO,CAACa,OAAO,CAAC,GAAGM;IACvC;IAEA,IAAIE,OAAO,CAAC,IAAI,CAACK,mBAAmB,EAAE;QACpC,MAAM5B,aAAa;YACjBc,SAAS,IAAI;YACbT;YACAmB,MAAM;gBAACD;aAAI;YACXhB;YACAC;QACF;IACF;IAEA,IAAI,CAACe,KAAK;QACR,OAAO;IACT;IAEAtB,UAAU;QAAEa,SAAS,IAAI;QAAEe,MAAMN;QAAKP,QAAQJ,iBAAiBI,MAAM;QAAEc,WAAW;IAAO;IAEzFvC,wBAAwB;QACtBY;QACAE;QACAmB,MAAM;YAACD;SAA+B;QACtCd;IACF;IAEA,OAAOc;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;
|
|
1
|
+
{"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../src/findVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAmB3C,eAAO,MAAM,YAAY,EAAE,YAgJ1B,CAAA"}
|
package/dist/findVersions.js
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import { buildVersionCollectionFields, flattenWhereToOperators } from 'payload';
|
|
1
|
+
import { buildVersionCollectionFields, flattenWhereToOperators, projectBranchVersionParents, resolveBranchVersionHistoryQuery, withBranchVersionSelect } from 'payload';
|
|
2
2
|
import { buildQuery } from './queries/buildQuery.js';
|
|
3
3
|
import { buildSortParam } from './queries/buildSortParam.js';
|
|
4
4
|
import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js';
|
|
5
5
|
import { getCollection } from './utilities/getEntity.js';
|
|
6
6
|
import { getSession } from './utilities/getSession.js';
|
|
7
7
|
import { transform } from './utilities/transform.js';
|
|
8
|
-
export const findVersions = async function findVersions({ collection: collectionSlug, limit = 0, locale, page, pagination, req = {}, select, sort: sortArg, where = {} }) {
|
|
8
|
+
export const findVersions = async function findVersions({ branch, collection: collectionSlug, limit = 0, locale, page, pagination, req = {}, select, sort: sortArg, where = {} }) {
|
|
9
9
|
const { collectionConfig, Model } = getCollection({
|
|
10
10
|
adapter: this,
|
|
11
11
|
collectionSlug,
|
|
12
12
|
versions: true
|
|
13
13
|
});
|
|
14
|
+
where = resolveBranchVersionHistoryQuery({
|
|
15
|
+
branch,
|
|
16
|
+
collectionSlug,
|
|
17
|
+
req,
|
|
18
|
+
where
|
|
19
|
+
}) ?? {};
|
|
14
20
|
let hasNearConstraint = false;
|
|
15
21
|
if (where) {
|
|
16
22
|
const constraints = flattenWhereToOperators(where);
|
|
@@ -54,7 +60,12 @@ export const findVersions = async function findVersions({ collection: collection
|
|
|
54
60
|
projection: buildProjectionFromSelect({
|
|
55
61
|
adapter: this,
|
|
56
62
|
fields,
|
|
57
|
-
select
|
|
63
|
+
select: withBranchVersionSelect({
|
|
64
|
+
branch,
|
|
65
|
+
collectionSlug,
|
|
66
|
+
req,
|
|
67
|
+
select
|
|
68
|
+
})
|
|
58
69
|
}),
|
|
59
70
|
sort,
|
|
60
71
|
useEstimatedCount
|
|
@@ -109,6 +120,9 @@ export const findVersions = async function findVersions({ collection: collection
|
|
|
109
120
|
fields: buildVersionCollectionFields(this.payload.config, collectionConfig),
|
|
110
121
|
operation: 'read'
|
|
111
122
|
});
|
|
123
|
+
// A branch version hangs off the shadow row, so its `parent` is that row rather
|
|
124
|
+
// than the document the history belongs to.
|
|
125
|
+
projectBranchVersionParents(result.docs);
|
|
112
126
|
return result;
|
|
113
127
|
};
|
|
114
128
|
|
package/dist/findVersions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/findVersions.ts"],"sourcesContent":["import type { PaginateOptions, QueryOptions } from 'mongoose'\nimport type { FindVersions } from 'payload'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/findVersions.ts"],"sourcesContent":["import type { PaginateOptions, QueryOptions } from 'mongoose'\nimport type { FindVersions } from 'payload'\n\nimport {\n buildVersionCollectionFields,\n flattenWhereToOperators,\n projectBranchVersionParents,\n resolveBranchVersionHistoryQuery,\n withBranchVersionSelect,\n} 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 { getCollection } from './utilities/getEntity.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 {\n branch,\n collection: collectionSlug,\n limit = 0,\n locale,\n page,\n pagination,\n req = {},\n select,\n sort: sortArg,\n where = {},\n },\n) {\n const { collectionConfig, Model } = getCollection({\n adapter: this,\n collectionSlug,\n versions: true,\n })\n\n where = resolveBranchVersionHistoryQuery({ branch, collectionSlug, req, where }) ?? {}\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 adapter: this,\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 const session = await getSession(this, req)\n // Calculate skip from page for cases where pagination is disabled but offset is still needed\n const skip = typeof page === 'number' && page > 1 ? (page - 1) * (limit || 0) : undefined\n const options: QueryOptions = {\n limit,\n session,\n skip,\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: withBranchVersionSelect({ branch, collectionSlug, req, select }),\n }),\n sort,\n useEstimatedCount,\n }\n\n if (this.collation) {\n const localizationConfig = this.payload.config.localization\n const defaultLocale =\n (typeof localizationConfig === 'object' && localizationConfig?.defaultLocale) || 'en'\n\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 collation: paginationOptions.collation,\n hint: { _id: 1 },\n session,\n }),\n )\n }\n } else if (!useEstimatedCount && this.collation) {\n // Workaround for mongoose-paginate-v2 bug: chaining .collation() on countDocuments breaks\n // session context in transactions (mongoose 8.x). Provide custom count function that passes\n // collation as an option instead. See: https://github.com/aravindnc/mongoose-paginate-v2/pull/240\n // TODO: Remove this workaround once mongoose-paginate-v2 is updated with the fix.\n paginationOptions.useCustomCountFn = () => {\n return Promise.resolve(\n Model.countDocuments(query, {\n collation: paginationOptions.collation,\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\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 // A branch version hangs off the shadow row, so its `parent` is that row rather\n // than the document the history belongs to.\n projectBranchVersionParents(result.docs as Record<string, unknown>[])\n\n return result\n}\n"],"names":["buildVersionCollectionFields","flattenWhereToOperators","projectBranchVersionParents","resolveBranchVersionHistoryQuery","withBranchVersionSelect","buildQuery","buildSortParam","buildProjectionFromSelect","getCollection","getSession","transform","findVersions","branch","collection","collectionSlug","limit","locale","page","pagination","req","select","sort","sortArg","where","collectionConfig","Model","adapter","versions","hasNearConstraint","constraints","some","prop","Object","keys","key","config","payload","fields","flattenedFields","timestamps","query","session","skip","undefined","options","useEstimatedCount","length","paginationOptions","lean","leanWithId","projection","collation","localizationConfig","localization","defaultLocale","disableIndexHints","useCustomCountFn","Promise","resolve","countDocuments","hint","_id","result","paginate","data","docs","operation"],"mappings":"AAGA,SACEA,4BAA4B,EAC5BC,uBAAuB,EACvBC,2BAA2B,EAC3BC,gCAAgC,EAChCC,uBAAuB,QAClB,UAAS;AAIhB,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,aAAa,QAAQ,2BAA0B;AACxD,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,eAA6B,eAAeA,aAEvD,EACEC,MAAM,EACNC,YAAYC,cAAc,EAC1BC,QAAQ,CAAC,EACTC,MAAM,EACNC,IAAI,EACJC,UAAU,EACVC,MAAM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AEA,MAAM4C,SAAS,MAAMrC,MAAMsC,QAAQ,CAACvB,OAAOO;IAE3CrC,UAAU;QACRgB,SAAS,IAAI;QACbsC,MAAMF,OAAOG,IAAI;QACjB5B,QAAQrC,6BAA6B,IAAI,CAACoC,OAAO,CAACD,MAAM,EAAEX;QAC1D0C,WAAW;IACb;IAEA,gFAAgF;IAChF,4CAA4C;IAC5ChE,4BAA4B4D,OAAOG,IAAI;IAEvC,OAAOH;AACT,EAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACd,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,UAAU,EAEV,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAKhB,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,eAAe,EACf,aAAa,EACb,iBAAiB,EAClB,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACd,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EACV,mBAAmB,EAC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QAEhC,SAAS,EAAE,CAAC,IAAI,EAAE;YAAE,OAAO,CAAC,EAAE,YAAY,CAAA;SAAE,GAAG,aAAa,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;QAClF,aAAa,EAAE,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EAC/C,IAAI,EAAE;YAAE,OAAO,CAAC,EAAE,YAAY,CAAA;SAAE,GAAG,iBAAiB,CAAC,CAAC,CAAC,KACpD,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAA;QAChC,0BAA0B,EAAE,OAAO,CAAA;QACnC,qBAAqB,EAAE,OAAO,CAAA;QAC9B,mBAAmB,EAAE,OAAO,CAAA;QAC5B,uBAAuB,EAAE,OAAO,CAAA;QAChC,QAAQ,EAAE;YACR,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;SAChC,CAAA;KACF;CACF;AAED,wBAAgB,eAAe,CAAC,EAC9B,qBAAqB,EACrB,mBAAmB,EACnB,mBAA2B,EAC3B,eAAuB,EACvB,iBAAwB,EACxB,+BAAuC,EACvC,SAAS,EACT,wBAA6B,EAC7B,cAAc,EACd,mBAA2B,EAC3B,iBAAyB,EACzB,aAAqB,EACrB,YAAY,EAAE,eAAe,EAC7B,iBAAiB,EACjB,cAAc,EACd,kBAAuB,EACvB,GAAG,EACH,0BAAkC,EAClC,qBAA6B,EAC7B,mBAA0B,EAC1B,uBAA8B,GAC/B,EAAE,IAAI,GAAG,kBAAkB,CAoF3B;AAED,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { createGlobal } from './createGlobal.js';
|
|
|
9
9
|
import { createGlobalVersion } from './createGlobalVersion.js';
|
|
10
10
|
import { createMigration } from './createMigration.js';
|
|
11
11
|
import { createVersion } from './createVersion.js';
|
|
12
|
+
import { deleteBranchGlobal } from './deleteBranchGlobal.js';
|
|
12
13
|
import { deleteMany } from './deleteMany.js';
|
|
13
14
|
import { deleteOne } from './deleteOne.js';
|
|
14
15
|
import { deleteVersions } from './deleteVersions.js';
|
|
@@ -76,6 +77,7 @@ export function mongooseAdapter({ afterCreateConnection, afterOpenConnection, al
|
|
|
76
77
|
createMigration,
|
|
77
78
|
createVersion,
|
|
78
79
|
defaultIDType: 'text',
|
|
80
|
+
deleteBranchGlobal,
|
|
79
81
|
deleteMany,
|
|
80
82
|
deleteOne,
|
|
81
83
|
deleteVersions,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollationOptions, TransactionOptions } from 'mongodb'\nimport type { MongoMemoryReplSet } from 'mongodb-memory-server'\nimport type {\n ClientSession,\n Connection,\n ConnectOptions,\n QueryOptions,\n SchemaOptions,\n} from 'mongoose'\nimport type {\n BaseDatabaseAdapter,\n CollectionSlug,\n DatabaseAdapterObj,\n JsonObject,\n Payload,\n TypeWithVersion,\n UpdateGlobalArgs,\n UpdateGlobalVersionArgs,\n UpdateOneArgs,\n UpdateVersionArgs,\n} from 'payload'\n\nimport mongoose from 'mongoose'\nimport { createDatabaseAdapter, defaultBeginTransaction, findMigrationDir } from 'payload'\n\nimport type {\n CollectionModel,\n GlobalModel,\n MigrateDownArgs,\n MigrateUpArgs,\n MongooseMigration,\n} from './types.js'\n\nimport { connect } from './connect.js'\nimport { count } from './count.js'\nimport { countGlobalVersions } from './countGlobalVersions.js'\nimport { countVersions } from './countVersions.js'\nimport { create } from './create.js'\nimport { createGlobal } from './createGlobal.js'\nimport { createGlobalVersion } from './createGlobalVersion.js'\nimport { createMigration } from './createMigration.js'\nimport { createVersion } from './createVersion.js'\nimport { deleteMany } from './deleteMany.js'\nimport { deleteOne } from './deleteOne.js'\nimport { deleteVersions } from './deleteVersions.js'\nimport { destroy } from './destroy.js'\nimport { find } from './find.js'\nimport { findDistinct } from './findDistinct.js'\nimport { findGlobal } from './findGlobal.js'\nimport { findGlobalVersions } from './findGlobalVersions.js'\nimport { findOne } from './findOne.js'\nimport { findVersions } from './findVersions.js'\nimport { init } from './init.js'\nimport { migrateFresh } from './migrateFresh.js'\nimport { queryDrafts } from './queryDrafts.js'\nimport { beginTransaction } from './transactions/beginTransaction.js'\nimport { commitTransaction } from './transactions/commitTransaction.js'\nimport { rollbackTransaction } from './transactions/rollbackTransaction.js'\nimport { updateGlobal } from './updateGlobal.js'\nimport { updateGlobalVersion } from './updateGlobalVersion.js'\nimport { updateJobs } from './updateJobs.js'\nimport { updateMany } from './updateMany.js'\nimport { updateOne } from './updateOne.js'\nimport { updateVersion } from './updateVersion.js'\nimport { upsert } from './upsert.js'\n\nexport type { MigrateDownArgs, MigrateUpArgs } from './types.js'\n\nexport interface Args {\n afterCreateConnection?: (adapter: MongooseAdapter) => Promise<void> | void\n afterOpenConnection?: (adapter: MongooseAdapter) => Promise<void> | void\n /**\n * By default, Payload strips all additional keys from MongoDB data that don't exist\n * in the Payload schema. If you have some data that you want to include to the result\n * but it doesn't exist in Payload, you can enable this flag\n * @default false\n */\n allowAdditionalKeys?: boolean\n /**\n * Enable this flag if you want to thread your own ID to create operation data, for example:\n * ```ts\n * import { Types } from 'mongoose'\n *\n * const id = new Types.ObjectId().toHexString()\n * const doc = await payload.create({ collection: 'posts', data: {id, title: \"my title\"}})\n * assertEq(doc.id, id)\n * ```\n */\n allowIDOnCreate?: boolean\n /** Set to false to disable auto-pluralization of collection names, Defaults to true */\n autoPluralization?: boolean\n /**\n * When true, bulk operations will process documents one at a time\n * in separate transactions instead of all at once in a single transaction.\n * Useful for avoiding transaction limitations with large datasets in DocumentDB and Cosmos DB.\n *\n * @default false\n */\n bulkOperationsSingleTransaction?: boolean\n\n /**\n * If enabled, collation allows for language-specific rules for string comparison.\n * This configuration can include the following options:\n *\n * - `strength` (number): Comparison level (1: Primary, 2: Secondary, 3: Tertiary (default), 4: Quaternary, 5: Identical)\n * - `caseLevel` (boolean): Include case comparison at strength level 1 or 2.\n * - `caseFirst` (string): Sort order of case differences during tertiary level comparisons (\"upper\", \"lower\", \"off\").\n * - `numericOrdering` (boolean): Compare numeric strings as numbers.\n * - `alternate` (string): Consider whitespace and punctuation as base characters (\"non-ignorable\", \"shifted\").\n * - `maxVariable` (string): Characters considered ignorable when `alternate` is \"shifted\" (\"punct\", \"space\").\n * - `backwards` (boolean): Sort strings with diacritics from back of the string.\n * - `normalization` (boolean): Check if text requires normalization and perform normalization.\n *\n * Available on MongoDB version 3.4 and up.\n * The locale that gets passed is your current project's locale but defaults to \"en\".\n *\n * Example:\n * {\n * strength: 3\n * }\n *\n * Defaults to disabled.\n */\n collation?: Omit<CollationOptions, 'locale'>\n\n collectionsSchemaOptions?: Partial<Record<CollectionSlug, SchemaOptions>>\n /** Extra configuration options */\n connectOptions?: ConnectOptions\n /**\n * We add a secondary sort based on `createdAt` to ensure that results are always returned in the same order when sorting by a non-unique field.\n * This is because MongoDB does not guarantee the order of results, however in very large datasets this could affect performance.\n *\n * Set to `true` to disable this behaviour.\n */\n disableFallbackSort?: boolean\n /** Set to true to disable hinting to MongoDB to use 'id' as index. This is currently done when counting documents for pagination. Disabling this optimization might fix some problems with AWS DocumentDB. Defaults to false */\n disableIndexHints?: boolean\n /**\n * Set to `true` to ensure that indexes are ready before completing connection.\n * NOTE: not recommended for production. This can slow down the initialization of Payload.\n */\n ensureIndexes?: boolean\n migrationDir?: string\n /**\n * typed as any to avoid dependency\n */\n mongoMemoryServer?: MongoMemoryReplSet\n prodMigrations?: MongooseMigration[]\n\n transactionOptions?: false | TransactionOptions\n\n /** The URL to connect to MongoDB or false to start payload and prevent connecting */\n url: false | string\n\n /**\n * Set to `true` to use an alternative `dropDatabase` implementation that calls `collection.deleteMany({})` on every collection instead of sending a raw `dropDatabase` command.\n * Payload only uses `dropDatabase` for testing purposes.\n * @default false\n */\n useAlternativeDropDatabase?: boolean\n\n /**\n * Set to `true` to use `BigInt` for custom ID fields of type `'number'`.\n * Useful for databases that don't support `double` or `int32` IDs.\n * @default false\n */\n useBigIntForNumberIDs?: boolean\n /**\n * Set to `false` to disable join aggregations (which use correlated subqueries) and instead populate join fields via multiple `find` queries.\n * @default true\n */\n useJoinAggregations?: boolean\n /**\n * Set to `false` to disable the use of `pipeline` in the `$lookup` aggregation in sorting.\n * @default true\n */\n usePipelineInSortLookup?: boolean\n}\n\nexport type MongooseAdapter = {\n afterCreateConnection?: (adapter: MongooseAdapter) => Promise<void> | void\n afterOpenConnection?: (adapter: MongooseAdapter) => Promise<void> | void\n bulkOperationsSingleTransaction: boolean\n collections: {\n [slug: string]: CollectionModel\n }\n connection: Connection\n ensureIndexes: boolean\n globals: GlobalModel\n mongoMemoryServer: MongoMemoryReplSet\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n sessions: Record<number | string, ClientSession>\n useAlternativeDropDatabase: boolean\n useBigIntForNumberIDs: boolean\n useJoinAggregations: boolean\n usePipelineInSortLookup: boolean\n versions: {\n [slug: string]: CollectionModel\n }\n} & Args &\n BaseDatabaseAdapter\n\ndeclare module 'payload' {\n export interface DatabaseAdapter\n extends Omit<BaseDatabaseAdapter, 'sessions'>,\n Omit<Args, 'migrationDir'> {\n collections: {\n [slug: string]: CollectionModel\n }\n connection: Connection\n ensureIndexes: boolean\n globals: GlobalModel\n mongoMemoryServer: MongoMemoryReplSet\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n sessions: Record<number | string, ClientSession>\n transactionOptions: TransactionOptions\n updateGlobal: <T extends Record<string, unknown>>(\n args: { options?: QueryOptions } & UpdateGlobalArgs<T>,\n ) => Promise<T>\n updateGlobalVersion: <T extends JsonObject = JsonObject>(\n args: { options?: QueryOptions } & UpdateGlobalVersionArgs<T>,\n ) => Promise<TypeWithVersion<T>>\n\n updateOne: (args: { options?: QueryOptions } & UpdateOneArgs) => Promise<Document>\n updateVersion: <T extends JsonObject = JsonObject>(\n args: { options?: QueryOptions } & UpdateVersionArgs<T>,\n ) => Promise<TypeWithVersion<T>>\n useAlternativeDropDatabase: boolean\n useBigIntForNumberIDs: boolean\n useJoinAggregations: boolean\n usePipelineInSortLookup: boolean\n versions: {\n [slug: string]: CollectionModel\n }\n }\n}\n\nexport function mongooseAdapter({\n afterCreateConnection,\n afterOpenConnection,\n allowAdditionalKeys = false,\n allowIDOnCreate = false,\n autoPluralization = true,\n bulkOperationsSingleTransaction = false,\n collation,\n collectionsSchemaOptions = {},\n connectOptions,\n disableFallbackSort = false,\n disableIndexHints = false,\n ensureIndexes = false,\n migrationDir: migrationDirArg,\n mongoMemoryServer,\n prodMigrations,\n transactionOptions = {},\n url,\n useAlternativeDropDatabase = false,\n useBigIntForNumberIDs = false,\n useJoinAggregations = true,\n usePipelineInSortLookup = true,\n}: Args): DatabaseAdapterObj {\n function adapter({ payload }: { payload: Payload }) {\n const migrationDir = findMigrationDir(migrationDirArg)\n mongoose.set('strictQuery', false)\n\n return createDatabaseAdapter<MongooseAdapter>({\n name: 'mongoose',\n\n // Mongoose-specific\n afterCreateConnection,\n afterOpenConnection,\n autoPluralization,\n bulkOperationsSingleTransaction,\n collation,\n collections: {},\n // @ts-expect-error initialize without a connection\n connection: undefined,\n connectOptions: connectOptions || {},\n disableIndexHints,\n ensureIndexes,\n // @ts-expect-error don't have globals model yet\n globals: undefined,\n // @ts-expect-error Should not be required\n mongoMemoryServer,\n sessions: {},\n transactionOptions: transactionOptions === false ? undefined : transactionOptions,\n updateJobs,\n updateMany,\n url,\n versions: {},\n // DatabaseAdapter\n allowAdditionalKeys,\n allowIDOnCreate,\n beginTransaction: transactionOptions === false ? defaultBeginTransaction() : beginTransaction,\n collectionsSchemaOptions,\n commitTransaction,\n connect,\n count,\n countGlobalVersions,\n countVersions,\n create,\n createGlobal,\n createGlobalVersion,\n createMigration,\n createVersion,\n defaultIDType: 'text',\n deleteMany,\n deleteOne,\n deleteVersions,\n destroy,\n disableFallbackSort,\n find,\n findDistinct,\n findGlobal,\n findGlobalVersions,\n findOne,\n findVersions,\n init,\n migrateFresh,\n migrationDir,\n packageName: '@payloadcms/db-mongodb',\n payload,\n prodMigrations,\n queryDrafts,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateOne,\n updateVersion,\n upsert,\n useAlternativeDropDatabase,\n useBigIntForNumberIDs,\n useJoinAggregations,\n usePipelineInSortLookup,\n })\n }\n\n return {\n name: 'mongoose',\n allowIDOnCreate,\n defaultIDType: 'text',\n init: adapter,\n }\n}\n\nexport { compatibilityOptions } from './utilities/compatibilityOptions.js'\n"],"names":["mongoose","createDatabaseAdapter","defaultBeginTransaction","findMigrationDir","connect","count","countGlobalVersions","countVersions","create","createGlobal","createGlobalVersion","createMigration","createVersion","deleteMany","deleteOne","deleteVersions","destroy","find","findDistinct","findGlobal","findGlobalVersions","findOne","findVersions","init","migrateFresh","queryDrafts","beginTransaction","commitTransaction","rollbackTransaction","updateGlobal","updateGlobalVersion","updateJobs","updateMany","updateOne","updateVersion","upsert","mongooseAdapter","afterCreateConnection","afterOpenConnection","allowAdditionalKeys","allowIDOnCreate","autoPluralization","bulkOperationsSingleTransaction","collation","collectionsSchemaOptions","connectOptions","disableFallbackSort","disableIndexHints","ensureIndexes","migrationDir","migrationDirArg","mongoMemoryServer","prodMigrations","transactionOptions","url","useAlternativeDropDatabase","useBigIntForNumberIDs","useJoinAggregations","usePipelineInSortLookup","adapter","payload","set","name","collections","connection","undefined","globals","sessions","versions","defaultIDType","packageName","compatibilityOptions"],"mappings":"AAsBA,OAAOA,cAAc,WAAU;AAC/B,SAASC,qBAAqB,EAAEC,uBAAuB,EAAEC,gBAAgB,QAAQ,UAAS;AAU1F,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,KAAK,QAAQ,aAAY;AAClC,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,MAAM,QAAQ,cAAa;AACpC,SAAS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c,EACdC,qBAAqB,CAAC,CAAC,EACvBC,GAAG,EACHC,6BAA6B,KAAK,EAClCC,wBAAwB,KAAK,EAC7BC,sBAAsB,IAAI,EAC1BC,0BAA0B,IAAI,EACzB;IACL,SAASC,QAAQ,EAAEC,OAAO,EAAwB;QAChD,MAAMX,eAAe9C,iBAAiB+C;QACtClD,SAAS6D,GAAG,CAAC,eAAe;QAE5B,OAAO5D,sBAAuC;YAC5C6D,MAAM;YAEN,oBAAoB;YACpBzB;YACAC;YACAG;YACAC;YACAC;YACAoB,aAAa,CAAC;YACd,mDAAmD;YACnDC,YAAYC;YACZpB,gBAAgBA,kBAAkB,CAAC;YACnCE;YACAC;YACA,gDAAgD;YAChDkB,SAASD;YACT,0CAA0C;YAC1Cd;YACAgB,UAAU,CAAC;YACXd,oBAAoBA,uBAAuB,QAAQY,YAAYZ;YAC/DtB;YACAC;YACAsB;YACAc,UAAU,CAAC;YACX,kBAAkB;YAClB7B;YACAC;YACAd,kBAAkB2B,uBAAuB,QAAQnD,4BAA4BwB;YAC7EkB;YACAjB;YACAvB;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAyD,eAAe;YACfxD;YACAC;YACAC;YACAC;YACA8B;YACA7B;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAyB;YACAqB,aAAa;YACbV;YACAR;YACA3B;YACAG;YACAC;YACAC;YACAG;YACAC;YACAC;YACAoB;YACAC;YACAC;YACAC;QACF;IACF;IAEA,OAAO;QACLI,MAAM;QACNtB;QACA6B,eAAe;QACf9C,MAAMoC;IACR;AACF;AAEA,SAASY,oBAAoB,QAAQ,sCAAqC"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollationOptions, TransactionOptions } from 'mongodb'\nimport type { MongoMemoryReplSet } from 'mongodb-memory-server'\nimport type {\n ClientSession,\n Connection,\n ConnectOptions,\n QueryOptions,\n SchemaOptions,\n} from 'mongoose'\nimport type {\n BaseDatabaseAdapter,\n CollectionSlug,\n DatabaseAdapterObj,\n JsonObject,\n Payload,\n TypeWithVersion,\n UpdateGlobalArgs,\n UpdateGlobalVersionArgs,\n UpdateOneArgs,\n UpdateVersionArgs,\n} from 'payload'\n\nimport mongoose from 'mongoose'\nimport { createDatabaseAdapter, defaultBeginTransaction, findMigrationDir } from 'payload'\n\nimport type {\n CollectionModel,\n GlobalModel,\n MigrateDownArgs,\n MigrateUpArgs,\n MongooseMigration,\n} from './types.js'\n\nimport { connect } from './connect.js'\nimport { count } from './count.js'\nimport { countGlobalVersions } from './countGlobalVersions.js'\nimport { countVersions } from './countVersions.js'\nimport { create } from './create.js'\nimport { createGlobal } from './createGlobal.js'\nimport { createGlobalVersion } from './createGlobalVersion.js'\nimport { createMigration } from './createMigration.js'\nimport { createVersion } from './createVersion.js'\nimport { deleteBranchGlobal } from './deleteBranchGlobal.js'\nimport { deleteMany } from './deleteMany.js'\nimport { deleteOne } from './deleteOne.js'\nimport { deleteVersions } from './deleteVersions.js'\nimport { destroy } from './destroy.js'\nimport { find } from './find.js'\nimport { findDistinct } from './findDistinct.js'\nimport { findGlobal } from './findGlobal.js'\nimport { findGlobalVersions } from './findGlobalVersions.js'\nimport { findOne } from './findOne.js'\nimport { findVersions } from './findVersions.js'\nimport { init } from './init.js'\nimport { migrateFresh } from './migrateFresh.js'\nimport { queryDrafts } from './queryDrafts.js'\nimport { beginTransaction } from './transactions/beginTransaction.js'\nimport { commitTransaction } from './transactions/commitTransaction.js'\nimport { rollbackTransaction } from './transactions/rollbackTransaction.js'\nimport { updateGlobal } from './updateGlobal.js'\nimport { updateGlobalVersion } from './updateGlobalVersion.js'\nimport { updateJobs } from './updateJobs.js'\nimport { updateMany } from './updateMany.js'\nimport { updateOne } from './updateOne.js'\nimport { updateVersion } from './updateVersion.js'\nimport { upsert } from './upsert.js'\n\nexport type { MigrateDownArgs, MigrateUpArgs } from './types.js'\n\nexport interface Args {\n afterCreateConnection?: (adapter: MongooseAdapter) => Promise<void> | void\n afterOpenConnection?: (adapter: MongooseAdapter) => Promise<void> | void\n /**\n * By default, Payload strips all additional keys from MongoDB data that don't exist\n * in the Payload schema. If you have some data that you want to include to the result\n * but it doesn't exist in Payload, you can enable this flag\n * @default false\n */\n allowAdditionalKeys?: boolean\n /**\n * Enable this flag if you want to thread your own ID to create operation data, for example:\n * ```ts\n * import { Types } from 'mongoose'\n *\n * const id = new Types.ObjectId().toHexString()\n * const doc = await payload.create({ collection: 'posts', data: {id, title: \"my title\"}})\n * assertEq(doc.id, id)\n * ```\n */\n allowIDOnCreate?: boolean\n /** Set to false to disable auto-pluralization of collection names, Defaults to true */\n autoPluralization?: boolean\n /**\n * When true, bulk operations will process documents one at a time\n * in separate transactions instead of all at once in a single transaction.\n * Useful for avoiding transaction limitations with large datasets in DocumentDB and Cosmos DB.\n *\n * @default false\n */\n bulkOperationsSingleTransaction?: boolean\n\n /**\n * If enabled, collation allows for language-specific rules for string comparison.\n * This configuration can include the following options:\n *\n * - `strength` (number): Comparison level (1: Primary, 2: Secondary, 3: Tertiary (default), 4: Quaternary, 5: Identical)\n * - `caseLevel` (boolean): Include case comparison at strength level 1 or 2.\n * - `caseFirst` (string): Sort order of case differences during tertiary level comparisons (\"upper\", \"lower\", \"off\").\n * - `numericOrdering` (boolean): Compare numeric strings as numbers.\n * - `alternate` (string): Consider whitespace and punctuation as base characters (\"non-ignorable\", \"shifted\").\n * - `maxVariable` (string): Characters considered ignorable when `alternate` is \"shifted\" (\"punct\", \"space\").\n * - `backwards` (boolean): Sort strings with diacritics from back of the string.\n * - `normalization` (boolean): Check if text requires normalization and perform normalization.\n *\n * Available on MongoDB version 3.4 and up.\n * The locale that gets passed is your current project's locale but defaults to \"en\".\n *\n * Example:\n * {\n * strength: 3\n * }\n *\n * Defaults to disabled.\n */\n collation?: Omit<CollationOptions, 'locale'>\n\n collectionsSchemaOptions?: Partial<Record<CollectionSlug, SchemaOptions>>\n /** Extra configuration options */\n connectOptions?: ConnectOptions\n /**\n * We add a secondary sort based on `createdAt` to ensure that results are always returned in the same order when sorting by a non-unique field.\n * This is because MongoDB does not guarantee the order of results, however in very large datasets this could affect performance.\n *\n * Set to `true` to disable this behaviour.\n */\n disableFallbackSort?: boolean\n /** Set to true to disable hinting to MongoDB to use 'id' as index. This is currently done when counting documents for pagination. Disabling this optimization might fix some problems with AWS DocumentDB. Defaults to false */\n disableIndexHints?: boolean\n /**\n * Set to `true` to ensure that indexes are ready before completing connection.\n * NOTE: not recommended for production. This can slow down the initialization of Payload.\n */\n ensureIndexes?: boolean\n migrationDir?: string\n /**\n * typed as any to avoid dependency\n */\n mongoMemoryServer?: MongoMemoryReplSet\n prodMigrations?: MongooseMigration[]\n\n transactionOptions?: false | TransactionOptions\n\n /** The URL to connect to MongoDB or false to start payload and prevent connecting */\n url: false | string\n\n /**\n * Set to `true` to use an alternative `dropDatabase` implementation that calls `collection.deleteMany({})` on every collection instead of sending a raw `dropDatabase` command.\n * Payload only uses `dropDatabase` for testing purposes.\n * @default false\n */\n useAlternativeDropDatabase?: boolean\n\n /**\n * Set to `true` to use `BigInt` for custom ID fields of type `'number'`.\n * Useful for databases that don't support `double` or `int32` IDs.\n * @default false\n */\n useBigIntForNumberIDs?: boolean\n /**\n * Set to `false` to disable join aggregations (which use correlated subqueries) and instead populate join fields via multiple `find` queries.\n * @default true\n */\n useJoinAggregations?: boolean\n /**\n * Set to `false` to disable the use of `pipeline` in the `$lookup` aggregation in sorting.\n * @default true\n */\n usePipelineInSortLookup?: boolean\n}\n\nexport type MongooseAdapter = {\n afterCreateConnection?: (adapter: MongooseAdapter) => Promise<void> | void\n afterOpenConnection?: (adapter: MongooseAdapter) => Promise<void> | void\n bulkOperationsSingleTransaction: boolean\n collections: {\n [slug: string]: CollectionModel\n }\n connection: Connection\n ensureIndexes: boolean\n globals: GlobalModel\n mongoMemoryServer: MongoMemoryReplSet\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n sessions: Record<number | string, ClientSession>\n useAlternativeDropDatabase: boolean\n useBigIntForNumberIDs: boolean\n useJoinAggregations: boolean\n usePipelineInSortLookup: boolean\n versions: {\n [slug: string]: CollectionModel\n }\n} & Args &\n BaseDatabaseAdapter\n\ndeclare module 'payload' {\n export interface DatabaseAdapter\n extends Omit<BaseDatabaseAdapter, 'sessions'>,\n Omit<Args, 'migrationDir'> {\n collections: {\n [slug: string]: CollectionModel\n }\n connection: Connection\n ensureIndexes: boolean\n globals: GlobalModel\n mongoMemoryServer: MongoMemoryReplSet\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n sessions: Record<number | string, ClientSession>\n transactionOptions: TransactionOptions\n updateGlobal: <T extends Record<string, unknown>>(\n args: { options?: QueryOptions } & UpdateGlobalArgs<T>,\n ) => Promise<T>\n updateGlobalVersion: <T extends JsonObject = JsonObject>(\n args: { options?: QueryOptions } & UpdateGlobalVersionArgs<T>,\n ) => Promise<TypeWithVersion<T>>\n\n updateOne: (args: { options?: QueryOptions } & UpdateOneArgs) => Promise<Document>\n updateVersion: <T extends JsonObject = JsonObject>(\n args: { options?: QueryOptions } & UpdateVersionArgs<T>,\n ) => Promise<TypeWithVersion<T>>\n useAlternativeDropDatabase: boolean\n useBigIntForNumberIDs: boolean\n useJoinAggregations: boolean\n usePipelineInSortLookup: boolean\n versions: {\n [slug: string]: CollectionModel\n }\n }\n}\n\nexport function mongooseAdapter({\n afterCreateConnection,\n afterOpenConnection,\n allowAdditionalKeys = false,\n allowIDOnCreate = false,\n autoPluralization = true,\n bulkOperationsSingleTransaction = false,\n collation,\n collectionsSchemaOptions = {},\n connectOptions,\n disableFallbackSort = false,\n disableIndexHints = false,\n ensureIndexes = false,\n migrationDir: migrationDirArg,\n mongoMemoryServer,\n prodMigrations,\n transactionOptions = {},\n url,\n useAlternativeDropDatabase = false,\n useBigIntForNumberIDs = false,\n useJoinAggregations = true,\n usePipelineInSortLookup = true,\n}: Args): DatabaseAdapterObj {\n function adapter({ payload }: { payload: Payload }) {\n const migrationDir = findMigrationDir(migrationDirArg)\n mongoose.set('strictQuery', false)\n\n return createDatabaseAdapter<MongooseAdapter>({\n name: 'mongoose',\n\n // Mongoose-specific\n afterCreateConnection,\n afterOpenConnection,\n autoPluralization,\n bulkOperationsSingleTransaction,\n collation,\n collections: {},\n // @ts-expect-error initialize without a connection\n connection: undefined,\n connectOptions: connectOptions || {},\n disableIndexHints,\n ensureIndexes,\n // @ts-expect-error don't have globals model yet\n globals: undefined,\n // @ts-expect-error Should not be required\n mongoMemoryServer,\n sessions: {},\n transactionOptions: transactionOptions === false ? undefined : transactionOptions,\n updateJobs,\n updateMany,\n url,\n versions: {},\n // DatabaseAdapter\n allowAdditionalKeys,\n allowIDOnCreate,\n beginTransaction: transactionOptions === false ? defaultBeginTransaction() : beginTransaction,\n collectionsSchemaOptions,\n commitTransaction,\n connect,\n count,\n countGlobalVersions,\n countVersions,\n create,\n createGlobal,\n createGlobalVersion,\n createMigration,\n createVersion,\n defaultIDType: 'text',\n deleteBranchGlobal,\n deleteMany,\n deleteOne,\n deleteVersions,\n destroy,\n disableFallbackSort,\n find,\n findDistinct,\n findGlobal,\n findGlobalVersions,\n findOne,\n findVersions,\n init,\n migrateFresh,\n migrationDir,\n packageName: '@payloadcms/db-mongodb',\n payload,\n prodMigrations,\n queryDrafts,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateOne,\n updateVersion,\n upsert,\n useAlternativeDropDatabase,\n useBigIntForNumberIDs,\n useJoinAggregations,\n usePipelineInSortLookup,\n })\n }\n\n return {\n name: 'mongoose',\n allowIDOnCreate,\n defaultIDType: 'text',\n init: adapter,\n }\n}\n\nexport { compatibilityOptions } from './utilities/compatibilityOptions.js'\n"],"names":["mongoose","createDatabaseAdapter","defaultBeginTransaction","findMigrationDir","connect","count","countGlobalVersions","countVersions","create","createGlobal","createGlobalVersion","createMigration","createVersion","deleteBranchGlobal","deleteMany","deleteOne","deleteVersions","destroy","find","findDistinct","findGlobal","findGlobalVersions","findOne","findVersions","init","migrateFresh","queryDrafts","beginTransaction","commitTransaction","rollbackTransaction","updateGlobal","updateGlobalVersion","updateJobs","updateMany","updateOne","updateVersion","upsert","mongooseAdapter","afterCreateConnection","afterOpenConnection","allowAdditionalKeys","allowIDOnCreate","autoPluralization","bulkOperationsSingleTransaction","collation","collectionsSchemaOptions","connectOptions","disableFallbackSort","disableIndexHints","ensureIndexes","migrationDir","migrationDirArg","mongoMemoryServer","prodMigrations","transactionOptions","url","useAlternativeDropDatabase","useBigIntForNumberIDs","useJoinAggregations","usePipelineInSortLookup","adapter","payload","set","name","collections","connection","undefined","globals","sessions","versions","defaultIDType","packageName","compatibilityOptions"],"mappings":"AAsBA,OAAOA,cAAc,WAAU;AAC/B,SAASC,qBAAqB,EAAEC,uBAAuB,EAAEC,gBAAgB,QAAQ,UAAS;AAU1F,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,KAAK,QAAQ,aAAY;AAClC,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,MAAM,QAAQ,cAAa;AACpC,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,kBAAkB,QAAQ,0BAAyB;AAC5D,SAASC,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,SAAS,QAAQ,iBAAgB;AAC1C,SAASC,cAAc,QAAQ,sBAAqB;AACpD,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,IAAI,QAAQ,YAAW;AAChC,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,kBAAkB,QAAQ,0BAAyB;AAC5D,SAASC,OAAO,QAAQ,eAAc;AACt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ChDkB,SAASD;YACT,0CAA0C;YAC1Cd;YACAgB,UAAU,CAAC;YACXd,oBAAoBA,uBAAuB,QAAQY,YAAYZ;YAC/DtB;YACAC;YACAsB;YACAc,UAAU,CAAC;YACX,kBAAkB;YAClB7B;YACAC;YACAd,kBAAkB2B,uBAAuB,QAAQpD,4BAA4ByB;YAC7EkB;YACAjB;YACAxB;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACA0D,eAAe;YACfzD;YACAC;YACAC;YACAC;YACAC;YACA8B;YACA7B;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAyB;YACAqB,aAAa;YACbV;YACAR;YACA3B;YACAG;YACAC;YACAC;YACAG;YACAC;YACAC;YACAoB;YACAC;YACAC;YACAC;QACF;IACF;IAEA,OAAO;QACLI,MAAM;QACNtB;QACA6B,eAAe;QACf9C,MAAMoC;IACR;AACF;AAEA,SAASY,oBAAoB,QAAQ,sCAAqC"}
|
|
@@ -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;AAOjE,eAAO,MAAM,qBAAqB,
|
|
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;AAOjE,eAAO,MAAM,qBAAqB,eACpB,yBAAyB,WAC5B,OAAO,yBAEf,MAoCF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildGlobalModel.d.ts","sourceRoot":"","sources":["../../src/models/buildGlobalModel.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAK9C,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"buildGlobalModel.d.ts","sourceRoot":"","sources":["../../src/models/buildGlobalModel.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAK9C,eAAO,MAAM,gBAAgB,YAAa,eAAe,KAAG,WAAW,GAAG,IAgCzE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildSchema.d.ts","sourceRoot":"","sources":["../../src/models/buildSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,MAAM,EAAE,aAAa,EAAqB,MAAM,UAAU,CAAA;AAGtF,OAAO,EAQL,KAAK,KAAK,EAEV,KAAK,cAAc,EAKnB,KAAK,OAAO,EAMZ,KAAK,sBAAsB,EAS5B,MAAM,SAAS,CAAA;AAShB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB,CAAA;AAkFD,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"buildSchema.d.ts","sourceRoot":"","sources":["../../src/models/buildSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,MAAM,EAAE,aAAa,EAAqB,MAAM,UAAU,CAAA;AAGtF,OAAO,EAQL,KAAK,KAAK,EAEV,KAAK,cAAc,EAKnB,KAAK,OAAO,EAMZ,KAAK,sBAAsB,EAS5B,MAAM,SAAS,CAAA;AAShB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB,CAAA;AAkFD,eAAO,MAAM,WAAW,SAAU;IAChC,kBAAkB,EAAE,kBAAkB,CAAA;IACtC,eAAe,CAAC,EAAE,sBAAsB,EAAE,CAAA;IAC1C,YAAY,EAAE,KAAK,EAAE,CAAA;IACrB,eAAe,CAAC,EAAE,cAAc,EAAE,CAAA;IAClC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,MAqEH,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildQuery.d.ts","sourceRoot":"","sources":["../../src/queries/buildQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAIlD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"buildQuery.d.ts","sourceRoot":"","sources":["../../src/queries/buildQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAIlD,eAAO,MAAM,UAAU,oEAOpB;IACD,OAAO,EAAE,eAAe,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,KAAK,CAAA;CACb,qCAYA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildSortParam.d.ts","sourceRoot":"","sources":["../../src/queries/buildSortParam.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAE7C,OAAO,EAEL,KAAK,cAAc,EAEnB,KAAK,eAAe,EACpB,KAAK,IAAI,EACV,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAKlD,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,MAAM,EAAE,eAAe,CAAA;IACvB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,eAAe,CAAC,EAAE,aAAa,EAAE,CAAA;IACjC,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,SAAS,EAAE,aAAa,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;CACjB,EAAE,CAAA;AAEH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAA;AAgH1C,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"buildSortParam.d.ts","sourceRoot":"","sources":["../../src/queries/buildSortParam.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAE7C,OAAO,EAEL,KAAK,cAAc,EAEnB,KAAK,eAAe,EACpB,KAAK,IAAI,EACV,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAKlD,KAAK,IAAI,GAAG;IACV,OAAO,EAAE,eAAe,CAAA;IACxB,MAAM,EAAE,eAAe,CAAA;IACvB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,eAAe,CAAC,EAAE,aAAa,EAAE,CAAA;IACjC,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,SAAS,EAAE,aAAa,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;CACjB,EAAE,CAAA;AAEH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAA;AAgH1C,eAAO,MAAM,cAAc,yGAUxB,IAAI,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAgF9B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/queries/buildSortParam.spec.ts"],"sourcesContent":["import type { Config, SanitizedConfig } from 'payload'\nimport { describe, beforeAll, it, expect } from 'vitest'\n\nimport { sanitizeConfig } from 'payload'\n\nimport { buildSortParam } from './buildSortParam.js'\nimport { MongooseAdapter } from '../index.js'\n\nlet config: SanitizedConfig\n\ndescribe('builds sort params', () => {\n beforeAll(async () => {\n config =
|
|
1
|
+
{"version":3,"sources":["../../src/queries/buildSortParam.spec.ts"],"sourcesContent":["import type { Config, SanitizedConfig } from 'payload'\nimport { describe, beforeAll, it, expect } from 'vitest'\n\nimport { sanitizeConfig } from 'payload'\n\nimport { buildSortParam } from './buildSortParam.js'\nimport { MongooseAdapter } from '../index.js'\n\nlet config: SanitizedConfig\n\ndescribe('builds sort params', () => {\n beforeAll(async () => {\n config = sanitizeConfig({\n localization: {\n defaultLocale: 'en',\n fallback: true,\n locales: ['en', 'es'],\n },\n } as Config)\n })\n it('adds a fallback on non-unique field', () => {\n const result = buildSortParam({\n config,\n parentIsLocalized: false,\n fields: [\n {\n name: 'title',\n type: 'text',\n },\n {\n name: 'order',\n type: 'number',\n },\n ],\n locale: 'en',\n sort: 'order',\n timestamps: true,\n adapter: {\n disableFallbackSort: false,\n } as MongooseAdapter,\n })\n\n expect(result).toStrictEqual({ order: 'asc', createdAt: 'desc' })\n })\n\n it('adds a fallback when sort isnt provided', () => {\n const result = buildSortParam({\n config,\n parentIsLocalized: false,\n fields: [\n {\n name: 'title',\n type: 'text',\n },\n {\n name: 'order',\n type: 'number',\n },\n ],\n locale: 'en',\n sort: undefined,\n timestamps: true,\n adapter: {\n disableFallbackSort: false,\n } as MongooseAdapter,\n })\n\n expect(result).toStrictEqual({ createdAt: 'desc' })\n })\n\n it('does not add a fallback on non-unique field when disableFallbackSort is true', () => {\n const result = buildSortParam({\n config,\n parentIsLocalized: false,\n fields: [\n {\n name: 'title',\n type: 'text',\n },\n {\n name: 'order',\n type: 'number',\n },\n ],\n locale: 'en',\n sort: 'order',\n timestamps: true,\n adapter: {\n disableFallbackSort: true,\n } as MongooseAdapter,\n })\n\n expect(result).toStrictEqual({ order: 'asc' })\n })\n\n // This test should be true even when disableFallbackSort is false\n it('does not add a fallback on unique field', () => {\n const result = buildSortParam({\n config,\n parentIsLocalized: false,\n fields: [\n {\n name: 'title',\n type: 'text',\n },\n {\n name: 'order',\n type: 'number',\n unique: true, // Marking this field as unique\n },\n ],\n locale: 'en',\n sort: 'order',\n timestamps: true,\n adapter: {\n disableFallbackSort: false,\n } as MongooseAdapter,\n })\n\n expect(result).toStrictEqual({ order: 'asc' })\n })\n})\n"],"names":["describe","beforeAll","it","expect","sanitizeConfig","buildSortParam","config","localization","defaultLocale","fallback","locales","result","parentIsLocalized","fields","name","type","locale","sort","timestamps","adapter","disableFallbackSort","toStrictEqual","order","createdAt","undefined","unique"],"mappings":"AACA,SAASA,QAAQ,EAAEC,SAAS,EAAEC,EAAE,EAAEC,MAAM,QAAQ,SAAQ;AAExD,SAASC,cAAc,QAAQ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ACEC,MAAM;oBACNC,MAAM;gBACR;gBACA;oBACED,MAAM;oBACNC,MAAM;oBACNU,QAAQ;gBACV;aACD;YACDT,QAAQ;YACRC,MAAM;YACNC,YAAY;YACZC,SAAS;gBACPC,qBAAqB;YACvB;QACF;QAEAjB,OAAOQ,QAAQU,aAAa,CAAC;YAAEC,OAAO;QAAM;IAC9C;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBuildQueryPlugin.d.ts","sourceRoot":"","sources":["../../src/queries/getBuildQueryPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAM7D,KAAK,uBAAuB,GAAG;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,cAAc,EAAE,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAKD,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"getBuildQueryPlugin.d.ts","sourceRoot":"","sources":["../../src/queries/getBuildQueryPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAM7D,KAAK,uBAAuB,GAAG;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,cAAc,EAAE,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAKD,eAAO,MAAM,mBAAmB,yCAG7B,uBAAuB,cACiB,GAAG,SAmD7C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLocalizedSortProperty.d.ts","sourceRoot":"","sources":["../../src/queries/getLocalizedSortProperty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9D,KAAK,IAAI,GAAG;IACV,MAAM,EAAE,eAAe,CAAA;IACvB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iBAAiB,EAAE,OAAO,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"getLocalizedSortProperty.d.ts","sourceRoot":"","sources":["../../src/queries/getLocalizedSortProperty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9D,KAAK,IAAI,GAAG;IACV,MAAM,EAAE,eAAe,CAAA;IACvB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iBAAiB,EAAE,OAAO,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,wBAAwB,uGAOlC,IAAI,KAAG,MA8FT,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { getLocalizedSortProperty } from './getLocalizedSortProperty.js';
|
|
|
4
4
|
let config;
|
|
5
5
|
describe('get localized sort property', ()=>{
|
|
6
6
|
beforeAll(async ()=>{
|
|
7
|
-
config =
|
|
7
|
+
config = sanitizeConfig({
|
|
8
8
|
localization: {
|
|
9
9
|
defaultLocale: 'en',
|
|
10
10
|
fallback: true,
|