@payloadcms/db-mongodb 4.0.0-internal.fec2230 → 4.0.0-internal.ff27d6e
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/connect.d.ts.map +1 -1
- package/dist/connect.js +9 -2
- package/dist/connect.js.map +1 -1
- package/dist/count.d.ts.map +1 -1
- package/dist/count.js +33 -4
- package/dist/count.js.map +1 -1
- package/dist/countGlobalVersions.d.ts.map +1 -1
- package/dist/countGlobalVersions.js +10 -2
- package/dist/countGlobalVersions.js.map +1 -1
- package/dist/countVersions.d.ts.map +1 -1
- package/dist/countVersions.js +36 -4
- package/dist/countVersions.js.map +1 -1
- package/dist/createGlobalVersion.d.ts +1 -1
- package/dist/createGlobalVersion.d.ts.map +1 -1
- package/dist/createGlobalVersion.js +24 -1
- 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 +26 -0
- package/dist/deleteBranchGlobal.js.map +1 -0
- package/dist/deleteMany.d.ts.map +1 -1
- package/dist/deleteMany.js +1 -0
- package/dist/deleteMany.js.map +1 -1
- package/dist/deleteOne.d.ts.map +1 -1
- package/dist/deleteOne.js +20 -1
- package/dist/deleteOne.js.map +1 -1
- package/dist/deleteVersions.d.ts.map +1 -1
- package/dist/deleteVersions.js +1 -0
- package/dist/deleteVersions.js.map +1 -1
- package/dist/exports/migration-utils.d.ts +2 -0
- package/dist/exports/migration-utils.d.ts.map +1 -1
- package/dist/exports/migration-utils.js +2 -0
- package/dist/exports/migration-utils.js.map +1 -1
- package/dist/find.d.ts.map +1 -1
- package/dist/find.js +44 -8
- package/dist/find.js.map +1 -1
- package/dist/findDistinct.d.ts.map +1 -1
- package/dist/findDistinct.js +115 -12
- package/dist/findDistinct.js.map +1 -1
- package/dist/findGlobal.d.ts.map +1 -1
- package/dist/findGlobal.js +48 -9
- package/dist/findGlobal.js.map +1 -1
- package/dist/findGlobalVersions.d.ts.map +1 -1
- package/dist/findGlobalVersions.js +10 -2
- package/dist/findGlobalVersions.js.map +1 -1
- package/dist/findOne.d.ts.map +1 -1
- package/dist/findOne.js +43 -5
- package/dist/findOne.js.map +1 -1
- package/dist/findVersions.d.ts.map +1 -1
- package/dist/findVersions.js +49 -5
- package/dist/findVersions.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +89 -67
- package/dist/init.js.map +1 -1
- package/dist/migrateFresh.d.ts.map +1 -1
- package/dist/migrateFresh.js +1 -0
- package/dist/migrateFresh.js.map +1 -1
- package/dist/models/buildCollectionSchema.d.ts +8 -2
- package/dist/models/buildCollectionSchema.d.ts.map +1 -1
- package/dist/models/buildCollectionSchema.js +4 -2
- package/dist/models/buildCollectionSchema.js.map +1 -1
- package/dist/models/buildGlobalModel.d.ts +5 -1
- package/dist/models/buildGlobalModel.d.ts.map +1 -1
- package/dist/models/buildGlobalModel.js +34 -3
- package/dist/models/buildGlobalModel.js.map +1 -1
- package/dist/models/buildSchema.d.ts +4 -0
- package/dist/models/buildSchema.d.ts.map +1 -1
- package/dist/models/buildSchema.js +100 -36
- package/dist/models/buildSchema.js.map +1 -1
- package/dist/models/schemaBuildContext.d.ts +21 -0
- package/dist/models/schemaBuildContext.d.ts.map +1 -0
- package/dist/models/schemaBuildContext.js +29 -0
- package/dist/models/schemaBuildContext.js.map +1 -0
- package/dist/predefinedMigrations/branching.d.ts +4 -0
- package/dist/predefinedMigrations/branching.d.ts.map +1 -0
- package/dist/predefinedMigrations/branching.js +9 -0
- package/dist/predefinedMigrations/branching.js.map +1 -0
- package/dist/predefinedMigrations/migrateBranching.d.ts +17 -0
- package/dist/predefinedMigrations/migrateBranching.d.ts.map +1 -0
- package/dist/predefinedMigrations/migrateBranching.js +90 -0
- package/dist/predefinedMigrations/migrateBranching.js.map +1 -0
- package/dist/predefinedMigrations/migrateSizesToVariants.d.ts +13 -0
- package/dist/predefinedMigrations/migrateSizesToVariants.d.ts.map +1 -0
- package/dist/predefinedMigrations/migrateSizesToVariants.js +368 -0
- package/dist/predefinedMigrations/migrateSizesToVariants.js.map +1 -0
- package/dist/predefinedMigrations/sizes-to-variants.d.ts +5 -0
- package/dist/predefinedMigrations/sizes-to-variants.d.ts.map +1 -0
- package/dist/predefinedMigrations/sizes-to-variants.js +8 -0
- package/dist/predefinedMigrations/sizes-to-variants.js.map +1 -0
- package/dist/queries/buildAndOrConditions.d.ts +4 -2
- package/dist/queries/buildAndOrConditions.d.ts.map +1 -1
- package/dist/queries/buildAndOrConditions.js +3 -1
- package/dist/queries/buildAndOrConditions.js.map +1 -1
- package/dist/queries/buildBranchVisibility.d.ts +11 -0
- package/dist/queries/buildBranchVisibility.d.ts.map +1 -0
- package/dist/queries/buildBranchVisibility.js +204 -0
- package/dist/queries/buildBranchVisibility.js.map +1 -0
- package/dist/queries/buildQuery.d.ts +4 -2
- package/dist/queries/buildQuery.d.ts.map +1 -1
- package/dist/queries/buildQuery.js +3 -1
- package/dist/queries/buildQuery.js.map +1 -1
- package/dist/queries/buildRelatedQueryPipeline.d.ts +7 -0
- package/dist/queries/buildRelatedQueryPipeline.d.ts.map +1 -0
- package/dist/queries/buildRelatedQueryPipeline.js +56 -0
- package/dist/queries/buildRelatedQueryPipeline.js.map +1 -0
- package/dist/queries/buildSearchParams.d.ts +4 -2
- package/dist/queries/buildSearchParams.d.ts.map +1 -1
- package/dist/queries/buildSearchParams.js +223 -41
- package/dist/queries/buildSearchParams.js.map +1 -1
- package/dist/queries/getBuildQueryPlugin.d.ts +3 -1
- package/dist/queries/getBuildQueryPlugin.d.ts.map +1 -1
- package/dist/queries/getBuildQueryPlugin.js +3 -1
- package/dist/queries/getBuildQueryPlugin.js.map +1 -1
- package/dist/queries/parseParams.d.ts +4 -2
- package/dist/queries/parseParams.d.ts.map +1 -1
- package/dist/queries/parseParams.js +5 -1
- package/dist/queries/parseParams.js.map +1 -1
- package/dist/queryDrafts.d.ts.map +1 -1
- package/dist/queryDrafts.js +39 -7
- package/dist/queryDrafts.js.map +1 -1
- package/dist/transactions/commitTransaction.d.ts.map +1 -1
- package/dist/transactions/commitTransaction.js +68 -7
- package/dist/transactions/commitTransaction.js.map +1 -1
- package/dist/transactions/rollbackTransaction.d.ts.map +1 -1
- package/dist/transactions/rollbackTransaction.js +10 -9
- package/dist/transactions/rollbackTransaction.js.map +1 -1
- package/dist/updateGlobal.d.ts.map +1 -1
- package/dist/updateGlobal.js +91 -9
- package/dist/updateGlobal.js.map +1 -1
- package/dist/updateGlobalVersion.d.ts.map +1 -1
- package/dist/updateGlobalVersion.js +3 -2
- package/dist/updateGlobalVersion.js.map +1 -1
- package/dist/updateJobs.js +1 -1
- package/dist/updateJobs.js.map +1 -1
- package/dist/updateMany.d.ts.map +1 -1
- package/dist/updateMany.js +3 -2
- package/dist/updateMany.js.map +1 -1
- package/dist/updateOne.d.ts.map +1 -1
- package/dist/updateOne.js +30 -4
- package/dist/updateOne.js.map +1 -1
- package/dist/updateVersion.d.ts.map +1 -1
- package/dist/updateVersion.js +3 -2
- package/dist/updateVersion.js.map +1 -1
- package/dist/upsertBranchGlobalChange.d.ts +3 -0
- package/dist/upsertBranchGlobalChange.d.ts.map +1 -0
- package/dist/upsertBranchGlobalChange.js +28 -0
- package/dist/upsertBranchGlobalChange.js.map +1 -0
- package/dist/utilities/aggregatePaginate.d.ts +2 -1
- package/dist/utilities/aggregatePaginate.d.ts.map +1 -1
- package/dist/utilities/aggregatePaginate.js +21 -5
- package/dist/utilities/aggregatePaginate.js.map +1 -1
- package/dist/utilities/buildJoinAggregation.d.ts +4 -2
- package/dist/utilities/buildJoinAggregation.d.ts.map +1 -1
- package/dist/utilities/buildJoinAggregation.js +158 -24
- package/dist/utilities/buildJoinAggregation.js.map +1 -1
- package/dist/utilities/resolveJoins.d.ts +6 -2
- package/dist/utilities/resolveJoins.d.ts.map +1 -1
- package/dist/utilities/resolveJoins.js +115 -26
- package/dist/utilities/resolveJoins.js.map +1 -1
- package/package.json +16 -19
- package/dist/queries/buildSortParam.spec.js +0 -123
- package/dist/queries/buildSortParam.spec.js.map +0 -1
- package/dist/queries/getLocalizedSortProperty.spec.js +0 -215
- package/dist/queries/getLocalizedSortProperty.spec.js.map +0 -1
- package/dist/utilities/transform.spec.js +0 -546
- package/dist/utilities/transform.spec.js.map +0 -1
package/dist/findGlobal.js
CHANGED
|
@@ -1,36 +1,75 @@
|
|
|
1
|
-
import { combineQueries } from 'payload';
|
|
1
|
+
import { branchGlobalNeedsBothRows, combineQueries, pickBranchGlobal, resolveBranch, resolveBranchGlobalQuery, withBranchGlobalSelect } 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,
|
|
21
|
+
branch,
|
|
15
22
|
fields,
|
|
16
23
|
globalSlug,
|
|
17
24
|
locale,
|
|
25
|
+
req,
|
|
18
26
|
where: combineQueries({
|
|
19
27
|
globalType: {
|
|
20
28
|
equals: globalSlug
|
|
21
29
|
}
|
|
22
|
-
},
|
|
30
|
+
}, branchedWhere ?? {})
|
|
31
|
+
});
|
|
32
|
+
const projection = buildProjectionFromSelect({
|
|
33
|
+
adapter: this,
|
|
34
|
+
fields,
|
|
35
|
+
select: withBranchGlobalSelect({
|
|
36
|
+
branch,
|
|
37
|
+
globalSlug,
|
|
38
|
+
req,
|
|
39
|
+
select
|
|
40
|
+
})
|
|
23
41
|
});
|
|
42
|
+
if (projection && branchGlobalNeedsBothRows({
|
|
43
|
+
branch,
|
|
44
|
+
globalSlug,
|
|
45
|
+
req
|
|
46
|
+
})) {
|
|
47
|
+
projection._branch = true;
|
|
48
|
+
}
|
|
24
49
|
const options = {
|
|
25
50
|
lean: true,
|
|
26
|
-
select:
|
|
27
|
-
adapter: this,
|
|
28
|
-
fields,
|
|
29
|
-
select
|
|
30
|
-
}),
|
|
51
|
+
select: projection,
|
|
31
52
|
session: await getSession(this, req)
|
|
32
53
|
};
|
|
33
|
-
|
|
54
|
+
// A global is one document, so the branch's row and main's row can be fetched
|
|
55
|
+
// together and the branch's preferred in memory. There is no result set to
|
|
56
|
+
// paginate, so nothing a post-query step could get wrong.
|
|
57
|
+
let doc;
|
|
58
|
+
if (branchGlobalNeedsBothRows({
|
|
59
|
+
branch,
|
|
60
|
+
globalSlug,
|
|
61
|
+
req
|
|
62
|
+
})) {
|
|
63
|
+
const rows = await Model.find(query, {}, {
|
|
64
|
+
...options,
|
|
65
|
+
limit: 2
|
|
66
|
+
}).lean();
|
|
67
|
+
doc = pickBranchGlobal(rows, branch || resolveBranch({
|
|
68
|
+
req: req
|
|
69
|
+
}));
|
|
70
|
+
} else {
|
|
71
|
+
doc = await Model.findOne(query, {}, options).lean();
|
|
72
|
+
}
|
|
34
73
|
if (!doc) {
|
|
35
74
|
return null;
|
|
36
75
|
}
|
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, FindGlobalArgs } from 'payload'\n\nimport {\n branchGlobalNeedsBothRows,\n combineQueries,\n pickBranchGlobal,\n resolveBranch,\n resolveBranchGlobalQuery,\n withBranchGlobalSelect,\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<T extends Record<string, unknown>>(\n this: MongooseAdapter,\n { slug: globalSlug, branch, locale, req, select, where = {} }: FindGlobalArgs,\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 branch,\n fields,\n globalSlug,\n locale,\n req,\n where: combineQueries({ globalType: { equals: globalSlug } }, branchedWhere ?? {}),\n })\n\n const projection = buildProjectionFromSelect({\n adapter: this,\n fields,\n select: withBranchGlobalSelect({ branch, globalSlug, req, select }),\n })\n\n if (projection && branchGlobalNeedsBothRows({ branch, globalSlug, req })) {\n projection._branch = true\n }\n\n const options: QueryOptions = {\n lean: true,\n select: projection,\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: T | undefined\n\n if (branchGlobalNeedsBothRows({ branch, globalSlug, req })) {\n const rows = await Model.find(query, {}, { ...options, limit: 2 }).lean<T[]>()\n\n doc = pickBranchGlobal(rows, branch || resolveBranch({ req: req as never }))\n } else {\n doc = (await Model.findOne(query, {}, options).lean<T>()) as T\n }\n\n if (!doc) {\n return null as unknown as T\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","withBranchGlobalSelect","buildQuery","buildProjectionFromSelect","getGlobal","getSession","transform","findGlobal","slug","globalSlug","branch","locale","req","select","where","globalConfig","Model","adapter","fields","flattenedFields","branchedWhere","query","globalType","equals","projection","_branch","options","lean","session","doc","rows","find","limit","findOne","data","operation"],"mappings":"AAGA,SACEA,yBAAyB,EACzBC,cAAc,EACdC,gBAAgB,EAChBC,aAAa,EACbC,wBAAwB,EACxBC,sBAAsB,QACjB,UAAS;AAIhB,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,SAAS,QAAQ,2BAA0B;AACpD,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,aAAyB,eAAeA,WAEnD,EAAEC,MAAMC,UAAU,EAAEC,MAAM,EAAEC,MAAM,EAAEC,GAAG,EAAEC,MAAM,EAAEC,QAAQ,CAAC,CAAC,EAAkB;IAE7E,MAAM,EAAEC,YAAY,EAAEC,KAAK,EAAE,GAAGZ,UAAU;QAAEa,SAAS,IAAI;QAAER;IAAW;IAEtE,MAAMS,SAASH,aAAaI,eAAe;IAE3C,MAAMC,gBAAgBpB,yBAAyB;QAAEU;QAAQD;QAAYG;QAAKE;IAAM;IAEhF,MAAMO,QAAQ,MAAMnB,WAAW;QAC7Be,SAAS,IAAI;QACbP;QACAQ;QACAT;QACAE;QACAC;QACAE,OAAOjB,eAAe;YAAEyB,YAAY;gBAAEC,QAAQd;YAAW;QAAE,GAAGW,iBAAiB,CAAC;IAClF;IAEA,MAAMI,aAAarB,0BAA0B;QAC3Cc,SAAS,IAAI;QACbC;QACAL,QAAQZ,uBAAuB;YAAES;YAAQD;YAAYG;YAAKC;QAAO;IACnE;IAEA,IAAIW,cAAc5B,0BAA0B;QAAEc;QAAQD;QAAYG;IAAI,IAAI;QACxEY,WAAWC,OAAO,GAAG;IACvB;IAEA,MAAMC,UAAwB;QAC5BC,MAAM;QACNd,QAAQW;QACRI,SAAS,MAAMvB,WAAW,IAAI,EAAEO;IAClC;IAEA,8EAA8E;IAC9E,2EAA2E;IAC3E,0DAA0D;IAC1D,IAAIiB;IAEJ,IAAIjC,0BAA0B;QAAEc;QAAQD;QAAYG;IAAI,IAAI;QAC1D,MAAMkB,OAAO,MAAMd,MAAMe,IAAI,CAACV,OAAO,CAAC,GAAG;YAAE,GAAGK,OAAO;YAAEM,OAAO;QAAE,GAAGL,IAAI;QAEvEE,MAAM/B,iBAAiBgC,MAAMpB,UAAUX,cAAc;YAAEa,KAAKA;QAAa;IAC3E,OAAO;QACLiB,MAAO,MAAMb,MAAMiB,OAAO,CAACZ,OAAO,CAAC,GAAGK,SAASC,IAAI;IACrD;IAEA,IAAI,CAACE,KAAK;QACR,OAAO;IACT;IAEAvB,UAAU;QACRW,SAAS,IAAI;QACbiB,MAAML;QACNX,QAAQH,aAAaG,MAAM;QAC3BiB,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;AAiBjD,eAAO,MAAM,kBAAkB,EAAE,kBAsIhC,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) {
|
|
@@ -30,8 +36,10 @@ export const findGlobalVersions = async function findGlobalVersions({ global: gl
|
|
|
30
36
|
}
|
|
31
37
|
const query = await buildQuery({
|
|
32
38
|
adapter: this,
|
|
39
|
+
branch,
|
|
33
40
|
fields: versionFields,
|
|
34
41
|
locale,
|
|
42
|
+
req,
|
|
35
43
|
where
|
|
36
44
|
});
|
|
37
45
|
const session = await getSession(this, req);
|
|
@@ -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 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 branch,\n fields: versionFields,\n locale,\n req,\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,SACEA,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,UAAU;QAAEkB,SAAS,IAAI;QAAEZ;QAAYa,UAAU;IAAK;IAEtFJ,QAAQnB,gCAAgC;QAAEQ;QAAQE;QAAYK;QAAKI;IAAM,MAAM,CAAC;IAEhF,MAAMK,gBAAgB1B,yBAAyB,IAAI,CAAC2B,OAAO,CAACC,MAAM,EAAEN,cAAc;IAElF,IAAIO,oBAAoB;IAExB,IAAIR,OAAO;QACT,MAAMS,cAAc7B,wBAAwBoB;QAC5CQ,oBAAoBC,YAAYC,IAAI,CAAC,CAACC,OAASC,O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AAiB,KAAK,MAAM;QAC5F,mHAAmH;QACnH,qHAAqH;QACrH,mHAAmH;QACnH,4BAA4B;QAC5BR,kBAAkBS,gBAAgB,GAAG;YACnC,OAAOC,QAAQC,OAAO,CACpBjC,MAAMkC,cAAc,CAACnB,OAAO;gBAC1BW,WAAWJ,kBAAkBI,SAAS;gBACtCS,MAAM;oBAAEC,KAAK;gBAAE;gBACfpB;YACF;QAEJ;IACF,OAAO,IAAI,CAACI,qBAAqB,IAAI,CAACM,SAAS,EAAE;QAC/C,0FAA0F;QAC1F,4FAA4F;QAC5F,kGAAkG;QAClG,kFAAkF;QAClFJ,kBAAkBS,gBAAgB,GAAG;YACnC,OAAOC,QAAQC,OAAO,CACpBjC,MAAMkC,cAAc,CAACnB,OAAO;gBAC1BW,WAAWJ,kBAAkBI,SAAS;gBACtCV;YACF;QAEJ;IACF;IAEA,IAAI1B,SAAS,GAAG;QACdgC,kBAAkBhC,KAAK,GAAGA;QAC1B,qEAAqE;QAErEgC,kBAAkBH,OAAO,CAAE7B,KAAK,GAAGA;QAEnC,mCAAmC;QACnC,IAAIA,UAAU,GAAG;YACfgC,kBAAkB7B,UAAU,GAAG;QACjC;IACF;IAEA,MAAM4C,SAAS,MAAMrC,MAAMsC,QAAQ,CAACvB,OAAOO;IAE3CrC,UAAU;QACRgB,SAAS,IAAI;QACbsC,MAAMF,OAAOG,IAAI;QACjB3B,QAAQpC,yBAAyB,IAAI,CAAC2B,OAAO,CAACC,MAAM,EAAEN;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,EAKb,MAAM,SAAS,CAAA;AAchB,eAAO,MAAM,OAAO,EAAE,OAkGrB,CAAA"}
|
package/dist/findOne.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { applyBranchIDProjection, resolveBranchQuery, resolveBranchReadState, rewriteBranchIDs, withBranchIDSelect } from 'payload';
|
|
2
|
+
import { buildBranchVisibilityStages } from './queries/buildBranchVisibility.js';
|
|
1
3
|
import { buildQuery } from './queries/buildQuery.js';
|
|
2
4
|
import { aggregatePaginate } from './utilities/aggregatePaginate.js';
|
|
3
5
|
import { buildJoinAggregation } from './utilities/buildJoinAggregation.js';
|
|
@@ -6,32 +8,57 @@ import { getCollection } from './utilities/getEntity.js';
|
|
|
6
8
|
import { getSession } from './utilities/getSession.js';
|
|
7
9
|
import { resolveJoins } from './utilities/resolveJoins.js';
|
|
8
10
|
import { transform } from './utilities/transform.js';
|
|
9
|
-
export const findOne = async function findOne({ collection: collectionSlug, draftsEnabled, joins, locale, req, select, where = {} }) {
|
|
11
|
+
export const findOne = async function findOne({ branch, collection: collectionSlug, draftsEnabled, joins, locale, req, select, where = {} }) {
|
|
10
12
|
const { collectionConfig, Model } = getCollection({
|
|
11
13
|
adapter: this,
|
|
12
14
|
collectionSlug
|
|
13
15
|
});
|
|
16
|
+
const branchReadState = resolveBranchReadState({
|
|
17
|
+
branch,
|
|
18
|
+
collectionSlug,
|
|
19
|
+
req
|
|
20
|
+
});
|
|
21
|
+
where = branchReadState.useBranching ? rewriteBranchIDs(where) ?? {} : await resolveBranchQuery({
|
|
22
|
+
branch,
|
|
23
|
+
collectionSlug,
|
|
24
|
+
req,
|
|
25
|
+
where
|
|
26
|
+
}) ?? {};
|
|
27
|
+
const branchVisibility = branchReadState.useBranching ? buildBranchVisibilityStages({
|
|
28
|
+
adapter: this,
|
|
29
|
+
branch: branchReadState.branch,
|
|
30
|
+
collectionSlug
|
|
31
|
+
}) : [];
|
|
14
32
|
const query = await buildQuery({
|
|
15
33
|
adapter: this,
|
|
34
|
+
branch,
|
|
16
35
|
collectionSlug,
|
|
17
36
|
fields: collectionConfig.flattenedFields,
|
|
18
37
|
locale,
|
|
38
|
+
req,
|
|
19
39
|
where
|
|
20
40
|
});
|
|
21
41
|
const projection = buildProjectionFromSelect({
|
|
22
42
|
adapter: this,
|
|
23
43
|
fields: collectionConfig.flattenedFields,
|
|
24
|
-
select
|
|
44
|
+
select: withBranchIDSelect({
|
|
45
|
+
branch,
|
|
46
|
+
collectionSlug,
|
|
47
|
+
req,
|
|
48
|
+
select
|
|
49
|
+
})
|
|
25
50
|
});
|
|
26
51
|
const aggregate = await buildJoinAggregation({
|
|
27
52
|
adapter: this,
|
|
53
|
+
branch,
|
|
28
54
|
collection: collectionSlug,
|
|
29
55
|
collectionConfig,
|
|
30
56
|
draftsEnabled,
|
|
31
57
|
joins,
|
|
32
58
|
locale,
|
|
33
59
|
projection,
|
|
34
|
-
query
|
|
60
|
+
query,
|
|
61
|
+
req
|
|
35
62
|
});
|
|
36
63
|
const session = await getSession(this, req);
|
|
37
64
|
const options = {
|
|
@@ -39,9 +66,10 @@ export const findOne = async function findOne({ collection: collectionSlug, draf
|
|
|
39
66
|
session
|
|
40
67
|
};
|
|
41
68
|
let doc;
|
|
42
|
-
if (aggregate.length > 0) {
|
|
69
|
+
if (aggregate.length > 0 || branchVisibility.length > 0) {
|
|
43
70
|
const { docs } = await aggregatePaginate({
|
|
44
71
|
adapter: this,
|
|
72
|
+
branchVisibility,
|
|
45
73
|
joinAggregation: aggregate,
|
|
46
74
|
limit: 1,
|
|
47
75
|
Model,
|
|
@@ -59,12 +87,14 @@ export const findOne = async function findOne({ collection: collectionSlug, draf
|
|
|
59
87
|
if (doc && !this.useJoinAggregations) {
|
|
60
88
|
await resolveJoins({
|
|
61
89
|
adapter: this,
|
|
90
|
+
branch,
|
|
62
91
|
collectionSlug,
|
|
63
92
|
docs: [
|
|
64
93
|
doc
|
|
65
94
|
],
|
|
66
95
|
joins,
|
|
67
|
-
locale
|
|
96
|
+
locale,
|
|
97
|
+
req
|
|
68
98
|
});
|
|
69
99
|
}
|
|
70
100
|
if (!doc) {
|
|
@@ -76,6 +106,14 @@ export const findOne = async function findOne({ collection: collectionSlug, draf
|
|
|
76
106
|
fields: collectionConfig.fields,
|
|
77
107
|
operation: 'read'
|
|
78
108
|
});
|
|
109
|
+
applyBranchIDProjection({
|
|
110
|
+
branch,
|
|
111
|
+
collectionSlug,
|
|
112
|
+
docs: [
|
|
113
|
+
doc
|
|
114
|
+
],
|
|
115
|
+
req
|
|
116
|
+
});
|
|
79
117
|
return doc;
|
|
80
118
|
};
|
|
81
119
|
|
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 resolveBranchReadState,\n rewriteBranchIDs,\n withBranchIDSelect,\n} from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildBranchVisibilityStages } from './queries/buildBranchVisibility.js'\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 const branchReadState = resolveBranchReadState({ branch, collectionSlug, req })\n\n where = branchReadState.useBranching\n ? (rewriteBranchIDs(where) ?? {})\n : ((await resolveBranchQuery({ branch, collectionSlug, req, where })) ?? {})\n const branchVisibility = branchReadState.useBranching\n ? buildBranchVisibilityStages({\n adapter: this,\n branch: branchReadState.branch,\n collectionSlug,\n })\n : []\n\n const query = await buildQuery({\n adapter: this,\n branch,\n collectionSlug,\n fields: collectionConfig.flattenedFields,\n locale,\n req,\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 branch,\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.length > 0 || branchVisibility.length > 0) {\n const { docs } = await aggregatePaginate({\n adapter: this,\n branchVisibility,\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 branch,\n collectionSlug,\n docs: [doc] as Record<string, unknown>[],\n joins,\n locale,\n req,\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","resolveBranchReadState","rewriteBranchIDs","withBranchIDSelect","buildBranchVisibilityStages","buildQuery","aggregatePaginate","buildJoinAggregation","buildProjectionFromSelect","getCollection","getSession","resolveJoins","transform","findOne","branch","collection","collectionSlug","draftsEnabled","joins","locale","req","select","where","collectionConfig","Model","adapter","branchReadState","useBranching","branchVisibility","query","fields","flattenedFields","projection","aggregate","session","options","lean","doc","length","docs","joinAggregation","limit","pagination","useJoinAggregations","data","operation"],"mappings":"AAEA,SACEA,uBAAuB,EAEvBC,kBAAkB,EAClBC,sBAAsB,EACtBC,gBAAgB,EAChBC,kBAAkB,QACb,UAAS;AAIhB,SAASC,2BAA2B,QAAQ,qCAAoC;AAChF,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;IAClF,MAAMU,kBAAkBzB,uBAAuB;QAAEa;QAAQE;QAAgBI;IAAI;IAE7EE,QAAQI,gBAAgBC,YAAY,GAC/BzB,iBAAiBoB,UAAU,CAAC,IAC5B,AAAC,MAAMtB,mBAAmB;QAAEc;QAAQE;QAAgBI;QAAKE;IAAM,MAAO,CAAC;IAC5E,MAAMM,mBAAmBF,gBAAgBC,YAAY,GACjDvB,4BAA4B;QAC1BqB,SAAS,IAAI;QACbX,QAAQY,gBAAgBZ,MAAM;QAC9BE;IACF,KACA,EAAE;IAEN,MAAMa,QAAQ,MAAMxB,WAAW;QAC7BoB,SAAS,IAAI;QACbX;QACAE;QACAc,QAAQP,iBAAiBQ,eAAe;QACxCZ;QACAC;QACAE;IACF;IAEA,MAAMU,aAAaxB,0BAA0B;QAC3CiB,SAAS,IAAI;QACbK,QAAQP,iBAAiBQ,eAAe;QACxCV,QAAQlB,mBAAmB;YAAEW;YAAQE;YAAgBI;YAAKC;QAAO;IACnE;IAEA,MAAMY,YAAY,MAAM1B,qBAAqB;QAC3CkB,SAAS,IAAI;QACbX;QACAC,YAAYC;QACZO;QACAN;QACAC;QACAC;QACAa;QACAH;QACAT;IACF;IAEA,MAAMc,UAAU,MAAMxB,WAAW,IAAI,EAAEU;IACvC,MAAMe,UAA2C;QAC/CC,MAAM;QACNF;IACF;IAEA,IAAIG;IACJ,IAAIJ,UAAUK,MAAM,GAAG,KAAKV,iBAAiBU,MAAM,GAAG,GAAG;QACvD,MAAM,EAAEC,IAAI,EAAE,GAAG,MAAMjC,kBAAkB;YACvCmB,SAAS,IAAI;YACbG;YACAY,iBAAiBP;YACjBQ,OAAO;YACPjB;YACAkB,YAAY;YACZV;YACAH;YACAK;QACF;QACAG,MAAME,IAAI,CAAC,EAAE;IACf,OAAO;;QACHJ,QAAoCH,UAAU,GAAGA;QACnDK,MAAM,MAAMb,MAAMX,OAAO,CAACgB,OAAO,CAAC,GAAGM;IACvC;IAEA,IAAIE,OAAO,CAAC,IAAI,CAACM,mBAAmB,EAAE;QACpC,MAAMhC,aAAa;YACjBc,SAAS,IAAI;YACbX;YACAE;YACAuB,MAAM;gBAACF;aAAI;YACXnB;YACAC;YACAC;QACF;IACF;IAEA,IAAI,CAACiB,KAAK;QACR,OAAO;IACT;IAEAzB,UAAU;QAAEa,SAAS,IAAI;QAAEmB,MAAMP;QAAKP,QAAQP,iBAAiBO,MAAM;QAAEe,WAAW;IAAO;IAEzF9C,wBAAwB;QACtBe;QACAE;QACAuB,MAAM;YAACF;SAA+B;QACtCjB;IACF;IAEA,OAAOiB;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;AAuB3C,eAAO,MAAM,YAAY,EAAE,YA+K1B,CAAA"}
|
package/dist/findVersions.js
CHANGED
|
@@ -1,16 +1,35 @@
|
|
|
1
|
-
import { buildVersionCollectionFields, flattenWhereToOperators } from 'payload';
|
|
1
|
+
import { buildVersionCollectionFields, flattenWhereToOperators, projectBranchVersionParents, resolveBranchReadState, resolveBranchVersionHistoryQuery, rewriteBranchVersionParents, withBranchVersionSelect } from 'payload';
|
|
2
|
+
import { buildBranchVisibilityStages } from './queries/buildBranchVisibility.js';
|
|
2
3
|
import { buildQuery } from './queries/buildQuery.js';
|
|
3
4
|
import { buildSortParam } from './queries/buildSortParam.js';
|
|
5
|
+
import { aggregatePaginate } from './utilities/aggregatePaginate.js';
|
|
4
6
|
import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js';
|
|
5
7
|
import { getCollection } from './utilities/getEntity.js';
|
|
6
8
|
import { getSession } from './utilities/getSession.js';
|
|
7
9
|
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 = {} }) {
|
|
10
|
+
export const findVersions = async function findVersions({ branch, collection: collectionSlug, limit = 0, locale, page, pagination, req = {}, select, sort: sortArg, where = {} }) {
|
|
9
11
|
const { collectionConfig, Model } = getCollection({
|
|
10
12
|
adapter: this,
|
|
11
13
|
collectionSlug,
|
|
12
14
|
versions: true
|
|
13
15
|
});
|
|
16
|
+
const branchReadState = resolveBranchReadState({
|
|
17
|
+
branch,
|
|
18
|
+
collectionSlug,
|
|
19
|
+
req
|
|
20
|
+
});
|
|
21
|
+
where = branchReadState.useBranching ? rewriteBranchVersionParents(where) ?? {} : await resolveBranchVersionHistoryQuery({
|
|
22
|
+
branch,
|
|
23
|
+
collectionSlug,
|
|
24
|
+
req,
|
|
25
|
+
where
|
|
26
|
+
}) ?? {};
|
|
27
|
+
const branchVisibility = branchReadState.useBranching ? buildBranchVisibilityStages({
|
|
28
|
+
adapter: this,
|
|
29
|
+
branch: branchReadState.branch,
|
|
30
|
+
collectionSlug,
|
|
31
|
+
mode: 'history'
|
|
32
|
+
}) : [];
|
|
14
33
|
let hasNearConstraint = false;
|
|
15
34
|
if (where) {
|
|
16
35
|
const constraints = flattenWhereToOperators(where);
|
|
@@ -30,8 +49,10 @@ export const findVersions = async function findVersions({ collection: collection
|
|
|
30
49
|
const fields = buildVersionCollectionFields(this.payload.config, collectionConfig, true);
|
|
31
50
|
const query = await buildQuery({
|
|
32
51
|
adapter: this,
|
|
52
|
+
branch,
|
|
33
53
|
fields,
|
|
34
54
|
locale,
|
|
55
|
+
req,
|
|
35
56
|
where
|
|
36
57
|
});
|
|
37
58
|
const session = await getSession(this, req);
|
|
@@ -43,7 +64,7 @@ export const findVersions = async function findVersions({ collection: collection
|
|
|
43
64
|
skip
|
|
44
65
|
};
|
|
45
66
|
// useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.
|
|
46
|
-
const useEstimatedCount = hasNearConstraint || !query || Object.keys(query).length === 0;
|
|
67
|
+
const useEstimatedCount = !branchVisibility.length && (hasNearConstraint || !query || Object.keys(query).length === 0);
|
|
47
68
|
const paginationOptions = {
|
|
48
69
|
lean: true,
|
|
49
70
|
leanWithId: true,
|
|
@@ -54,7 +75,12 @@ export const findVersions = async function findVersions({ collection: collection
|
|
|
54
75
|
projection: buildProjectionFromSelect({
|
|
55
76
|
adapter: this,
|
|
56
77
|
fields,
|
|
57
|
-
select
|
|
78
|
+
select: withBranchVersionSelect({
|
|
79
|
+
branch,
|
|
80
|
+
collectionSlug,
|
|
81
|
+
req,
|
|
82
|
+
select
|
|
83
|
+
})
|
|
58
84
|
}),
|
|
59
85
|
sort,
|
|
60
86
|
useEstimatedCount
|
|
@@ -102,13 +128,31 @@ export const findVersions = async function findVersions({ collection: collection
|
|
|
102
128
|
paginationOptions.pagination = false;
|
|
103
129
|
}
|
|
104
130
|
}
|
|
105
|
-
const result = await
|
|
131
|
+
const result = branchVisibility.length ? await aggregatePaginate({
|
|
132
|
+
adapter: this,
|
|
133
|
+
branchVisibility,
|
|
134
|
+
collation: paginationOptions.collation,
|
|
135
|
+
limit: paginationOptions.limit,
|
|
136
|
+
Model,
|
|
137
|
+
page: paginationOptions.page,
|
|
138
|
+
pagination: paginationOptions.pagination,
|
|
139
|
+
projection: paginationOptions.projection,
|
|
140
|
+
query,
|
|
141
|
+
session: paginationOptions.options?.session ?? undefined,
|
|
142
|
+
sort: paginationOptions.sort,
|
|
143
|
+
useEstimatedCount: false
|
|
144
|
+
}) : await Model.paginate(query, paginationOptions);
|
|
106
145
|
transform({
|
|
107
146
|
adapter: this,
|
|
108
147
|
data: result.docs,
|
|
109
148
|
fields: buildVersionCollectionFields(this.payload.config, collectionConfig),
|
|
110
149
|
operation: 'read'
|
|
111
150
|
});
|
|
151
|
+
if (branchReadState.useBranching) {
|
|
152
|
+
// A branch version hangs off the shadow row, so its `parent` is that row rather
|
|
153
|
+
// than the document the history belongs to.
|
|
154
|
+
projectBranchVersionParents(result.docs);
|
|
155
|
+
}
|
|
112
156
|
return result;
|
|
113
157
|
};
|
|
114
158
|
|
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 { 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 { 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 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 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,\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 return result\n}\n"],"names":["buildVersionCollectionFields","flattenWhereToOperators","buildQuery","buildSortParam","buildProjectionFromSelect","getCollection","getSession","transform","findVersions","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,SAASA,4BAA4B,EAAEC,uBAAuB,QAAQ,UAAS;AAI/E,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,yBAAyB,QAAQ,2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CAAE7B,KAAK,GAAGA;QAEnC,mCAAmC;QACnC,IAAIA,UAAU,GAAG;YACfgC,kBAAkB7B,UAAU,GAAG;QACjC;IACF;IAEA,MAAM4C,SAAS,MAAMrC,MAAMsC,QAAQ,CAACvB,OAAOO;IAE3CpC,UAAU;QACRe,SAAS,IAAI;QACbsC,MAAMF,OAAOG,IAAI;QACjB5B,QAAQjC,6BAA6B,IAAI,CAACgC,OAAO,CAACD,MAAM,EAAEX;QAC1D0C,WAAW;IACb;IAEA,OAAOJ;AACT,EAAC"}
|
|
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 resolveBranchReadState,\n resolveBranchVersionHistoryQuery,\n rewriteBranchVersionParents,\n withBranchVersionSelect,\n} from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildBranchVisibilityStages } from './queries/buildBranchVisibility.js'\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildSortParam } from './queries/buildSortParam.js'\nimport { aggregatePaginate } from './utilities/aggregatePaginate.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 const branchReadState = resolveBranchReadState({ branch, collectionSlug, req })\n\n where = branchReadState.useBranching\n ? (rewriteBranchVersionParents(where) ?? {})\n : ((await resolveBranchVersionHistoryQuery({ branch, collectionSlug, req, where })) ?? {})\n const branchVisibility = branchReadState.useBranching\n ? buildBranchVisibilityStages({\n adapter: this,\n branch: branchReadState.branch,\n collectionSlug,\n mode: 'history',\n })\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 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 branch,\n fields,\n locale,\n req,\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 =\n !branchVisibility.length && (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 = branchVisibility.length\n ? await aggregatePaginate({\n adapter: this,\n branchVisibility,\n collation: paginationOptions.collation,\n limit: paginationOptions.limit,\n Model,\n page: paginationOptions.page,\n pagination: paginationOptions.pagination,\n projection: paginationOptions.projection,\n query,\n session: paginationOptions.options?.session ?? undefined,\n sort: paginationOptions.sort as object,\n useEstimatedCount: false,\n })\n : 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 if (branchReadState.useBranching) {\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\n return result\n}\n"],"names":["buildVersionCollectionFields","flattenWhereToOperators","projectBranchVersionParents","resolveBranchReadState","resolveBranchVersionHistoryQuery","rewriteBranchVersionParents","withBranchVersionSelect","buildBranchVisibilityStages","buildQuery","buildSortParam","aggregatePaginate","buildProjectionFromSelect","getCollection","getSession","transform","findVersions","branch","collection","collectionSlug","limit","locale","page","pagination","req","select","sort","sortArg","where","collectionConfig","Model","adapter","versions","branchReadState","useBranching","branchVisibility","mode","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,sBAAsB,EACtBC,gCAAgC,EAChCC,2BAA2B,EAC3BC,uBAAuB,QAClB,UAAS;AAIhB,SAASC,2BAA2B,QAAQ,qCAAoC;AAChF,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,iBAAiB,QAAQ,mCAAkC;AACpE,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,CAAC,CAAC,EACRC,MAAM,EACNC,MAAMC,OAAO,EACbC,QAAQ,CAAC,CAAC,EACX;IAED,MAAM,EAAEC,gBAAgB,EAAEC,KAAK,EAAE,GAAGjB,cAAc;QAChDkB,SAAS,IAAI;QACbZ;QACAa,UAAU;IACZ;IACA,MAAMC,kBAAkB7B,uBAAuB;QAAEa;QAAQE;QAAgBK;IAAI;IAE7EI,QAAQK,gBAAgBC,YAAY,GAC/B5B,4BAA4BsB,UAAU,CAAC,IACvC,AAAC,MAAMvB,iCAAiC;QAAEY;QAAQE;QAAgBK;QAAKI;IAAM,MAAO,CAAC;IAC1F,MAAMO,mBAAmBF,gBAAgBC,YAAY,GACjD1B,4BAA4B;QAC1BuB,SAAS,IAAI;QACbd,QA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OoC,kBAAkBpC,KAAK;QAC9BU;QACAR,MAAMkC,kBAAkBlC,IAAI;QAC5BC,YAAYiC,kBAAkBjC,UAAU;QACxCoC,YAAYH,kBAAkBG,UAAU;QACxCV;QACAC,SAASM,kBAAkBH,OAAO,EAAEH,WAAWE;QAC/C1B,MAAM8B,kBAAkB9B,IAAI;QAC5B4B,mBAAmB;IACrB,KACA,MAAMxB,MAAM0C,QAAQ,CAACvB,OAAOO;IAEhCzC,UAAU;QACRgB,SAAS,IAAI;QACb0C,MAAMF,OAAOG,IAAI;QACjB5B,QAAQ7C,6BAA6B,IAAI,CAAC4C,OAAO,CAACD,MAAM,EAAEf;QAC1D8C,WAAW;IACb;IAEA,IAAI1C,gBAAgBC,YAAY,EAAE;QAChC,gFAAgF;QAChF,4CAA4C;QAC5C/B,4BAA4BoE,OAAOG,IAAI;IACzC;IAEA,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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AA"}
|
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';
|
|
@@ -32,6 +33,7 @@ import { updateMany } from './updateMany.js';
|
|
|
32
33
|
import { updateOne } from './updateOne.js';
|
|
33
34
|
import { updateVersion } from './updateVersion.js';
|
|
34
35
|
import { upsert } from './upsert.js';
|
|
36
|
+
import { upsertBranchGlobalChange } from './upsertBranchGlobalChange.js';
|
|
35
37
|
export function mongooseAdapter({ afterCreateConnection, afterOpenConnection, allowAdditionalKeys = false, allowIDOnCreate = false, autoPluralization = true, bulkOperationsSingleTransaction = false, collation, collectionsSchemaOptions = {}, connectOptions, disableFallbackSort = false, disableIndexHints = false, ensureIndexes = false, migrationDir: migrationDirArg, mongoMemoryServer, prodMigrations, transactionOptions = {}, url, useAlternativeDropDatabase = false, useBigIntForNumberIDs = false, useJoinAggregations = true, usePipelineInSortLookup = true }) {
|
|
36
38
|
function adapter({ payload }) {
|
|
37
39
|
const migrationDir = findMigrationDir(migrationDirArg);
|
|
@@ -76,6 +78,7 @@ export function mongooseAdapter({ afterCreateConnection, afterOpenConnection, al
|
|
|
76
78
|
createMigration,
|
|
77
79
|
createVersion,
|
|
78
80
|
defaultIDType: 'text',
|
|
81
|
+
deleteBranchGlobal,
|
|
79
82
|
deleteMany,
|
|
80
83
|
deleteOne,
|
|
81
84
|
deleteVersions,
|
|
@@ -100,6 +103,7 @@ export function mongooseAdapter({ afterCreateConnection, afterOpenConnection, al
|
|
|
100
103
|
updateOne,
|
|
101
104
|
updateVersion,
|
|
102
105
|
upsert,
|
|
106
|
+
upsertBranchGlobalChange,
|
|
103
107
|
useAlternativeDropDatabase,
|
|
104
108
|
useBigIntForNumberIDs,
|
|
105
109
|
useJoinAggregations,
|