@payloadcms/db-mongodb 4.0.0-internal.e7d4ebc → 4.0.0-internal.ea6e8f8
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 +1 -0
- 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/create.d.ts.map +1 -1
- package/dist/create.js +2 -1
- package/dist/create.js.map +1 -1
- package/dist/createGlobalVersion.d.ts.map +1 -1
- package/dist/createGlobalVersion.js +23 -1
- package/dist/createGlobalVersion.js.map +1 -1
- package/dist/createMigration.d.ts.map +1 -1
- package/dist/createMigration.js +9 -2
- package/dist/createMigration.js.map +1 -1
- package/dist/createVersion.d.ts.map +1 -1
- package/dist/createVersion.js +17 -4
- 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/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 +34 -5
- 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 +4 -2
- package/dist/migrateFresh.d.ts.map +1 -1
- package/dist/migrateFresh.js +21 -6
- 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 +94 -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 +15 -0
- package/dist/predefinedMigrations/migrateBranching.d.ts.map +1 -0
- package/dist/predefinedMigrations/migrateBranching.js +88 -0
- package/dist/predefinedMigrations/migrateBranching.js.map +1 -0
- package/dist/predefinedMigrations/migrateRelationshipsV2_V3.d.ts.map +1 -1
- package/dist/predefinedMigrations/migrateRelationshipsV2_V3.js +4 -4
- package/dist/predefinedMigrations/migrateRelationshipsV2_V3.js.map +1 -1
- 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/buildSearchParams.d.ts +4 -2
- package/dist/queries/buildSearchParams.d.ts.map +1 -1
- package/dist/queries/buildSearchParams.js +338 -24
- 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 +38 -7
- package/dist/queryDrafts.js.map +1 -1
- package/dist/transactions/commitTransaction.d.ts.map +1 -1
- package/dist/transactions/commitTransaction.js +55 -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 +89 -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.d.ts.map +1 -1
- package/dist/updateJobs.js +71 -14
- 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 +107 -8
- 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 +114 -26
- 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/package.json +5 -5
- 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 -479
- package/dist/utilities/transform.spec.js.map +0 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import type { FlattenedField, Payload, Where } from 'payload';
|
|
2
|
-
export declare function parseParams({ collectionSlug, fields, globalSlug, locale, parentIsLocalized, payload, where, }: {
|
|
1
|
+
import type { FlattenedField, Payload, PayloadRequest, Where } from 'payload';
|
|
2
|
+
export declare function parseParams({ branch, collectionSlug, fields, globalSlug, locale, parentIsLocalized, payload, req, where, }: {
|
|
3
|
+
branch?: false | string;
|
|
3
4
|
collectionSlug?: string;
|
|
4
5
|
fields: FlattenedField[];
|
|
5
6
|
globalSlug?: string;
|
|
6
7
|
locale?: string;
|
|
7
8
|
parentIsLocalized: boolean;
|
|
8
9
|
payload: Payload;
|
|
10
|
+
req?: Partial<PayloadRequest>;
|
|
9
11
|
where: Where;
|
|
10
12
|
}): Promise<Record<string, unknown>>;
|
|
11
13
|
//# sourceMappingURL=parseParams.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseParams.d.ts","sourceRoot":"","sources":["../../src/queries/parseParams.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAY,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"parseParams.d.ts","sourceRoot":"","sources":["../../src/queries/parseParams.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAY,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAQvF,wBAAsB,WAAW,CAAC,EAChC,MAAM,EACN,cAAc,EACd,MAAM,EACN,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,OAAO,EACP,GAAG,EACH,KAAK,GACN,EAAE;IACD,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iBAAiB,EAAE,OAAO,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B,KAAK,EAAE,KAAK,CAAA;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAyFnC"}
|
|
@@ -2,7 +2,7 @@ import { deepMergeWithCombinedArrays } from 'payload';
|
|
|
2
2
|
import { validOperatorSet } from 'payload/shared';
|
|
3
3
|
import { buildAndOrConditions } from './buildAndOrConditions.js';
|
|
4
4
|
import { buildSearchParam } from './buildSearchParams.js';
|
|
5
|
-
export async function parseParams({ collectionSlug, fields, globalSlug, locale, parentIsLocalized, payload, where }) {
|
|
5
|
+
export async function parseParams({ branch, collectionSlug, fields, globalSlug, locale, parentIsLocalized, payload, req, where }) {
|
|
6
6
|
let result = {};
|
|
7
7
|
if (typeof where === 'object') {
|
|
8
8
|
// We need to determine if the whereKey is an AND, OR, or a schema path
|
|
@@ -16,12 +16,14 @@ export async function parseParams({ collectionSlug, fields, globalSlug, locale,
|
|
|
16
16
|
}
|
|
17
17
|
if (Array.isArray(condition)) {
|
|
18
18
|
const builtConditions = await buildAndOrConditions({
|
|
19
|
+
branch,
|
|
19
20
|
collectionSlug,
|
|
20
21
|
fields,
|
|
21
22
|
globalSlug,
|
|
22
23
|
locale,
|
|
23
24
|
parentIsLocalized,
|
|
24
25
|
payload,
|
|
26
|
+
req,
|
|
25
27
|
where: condition
|
|
26
28
|
});
|
|
27
29
|
if (builtConditions.length > 0 && conditionOperator !== null) {
|
|
@@ -36,6 +38,7 @@ export async function parseParams({ collectionSlug, fields, globalSlug, locale,
|
|
|
36
38
|
const validOperators = Object.keys(pathOperators).filter((operator)=>validOperatorSet.has(operator));
|
|
37
39
|
for (const operator of validOperators){
|
|
38
40
|
const searchParam = await buildSearchParam({
|
|
41
|
+
branch,
|
|
39
42
|
collectionSlug,
|
|
40
43
|
fields,
|
|
41
44
|
globalSlug,
|
|
@@ -44,6 +47,7 @@ export async function parseParams({ collectionSlug, fields, globalSlug, locale,
|
|
|
44
47
|
operator,
|
|
45
48
|
parentIsLocalized,
|
|
46
49
|
payload,
|
|
50
|
+
req,
|
|
47
51
|
val: pathOperators[operator]
|
|
48
52
|
});
|
|
49
53
|
if (searchParam?.value && searchParam?.path) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/queries/parseParams.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../src/queries/parseParams.ts"],"sourcesContent":["import type { QueryFilter } from 'mongoose'\nimport type { FlattenedField, Operator, Payload, PayloadRequest, Where } from 'payload'\n\nimport { deepMergeWithCombinedArrays } from 'payload'\nimport { validOperatorSet } from 'payload/shared'\n\nimport { buildAndOrConditions } from './buildAndOrConditions.js'\nimport { buildSearchParam } from './buildSearchParams.js'\n\nexport async function parseParams({\n branch,\n collectionSlug,\n fields,\n globalSlug,\n locale,\n parentIsLocalized,\n payload,\n req,\n where,\n}: {\n branch?: false | string\n collectionSlug?: string\n fields: FlattenedField[]\n globalSlug?: string\n locale?: string\n parentIsLocalized: boolean\n payload: Payload\n req?: Partial<PayloadRequest>\n where: Where\n}): Promise<Record<string, unknown>> {\n let result = {} as QueryFilter<any>\n\n if (typeof where === 'object') {\n // We need to determine if the whereKey is an AND, OR, or a schema path\n for (const relationOrPath of Object.keys(where)) {\n const condition = where[relationOrPath]\n let conditionOperator: '$and' | '$or' | null = null\n if (relationOrPath.toLowerCase() === 'and') {\n conditionOperator = '$and'\n } else if (relationOrPath.toLowerCase() === 'or') {\n conditionOperator = '$or'\n }\n if (Array.isArray(condition)) {\n const builtConditions = await buildAndOrConditions({\n branch,\n collectionSlug,\n fields,\n globalSlug,\n locale,\n parentIsLocalized,\n payload,\n req,\n where: condition,\n })\n if (builtConditions.length > 0 && conditionOperator !== null) {\n result[conditionOperator] = builtConditions\n }\n } else {\n // It's a path - and there can be multiple comparisons on a single path.\n // For example - title like 'test' and title not equal to 'tester'\n // So we need to loop on keys again here to handle each operator independently\n const pathOperators = where[relationOrPath]\n if (typeof pathOperators === 'object') {\n const validOperators: Operator[] = Object.keys(pathOperators).filter((operator) =>\n validOperatorSet.has(operator as Operator),\n ) as Operator[]\n\n for (const operator of validOperators) {\n const searchParam = await buildSearchParam({\n branch,\n collectionSlug,\n fields,\n globalSlug,\n incomingPath: relationOrPath,\n locale,\n operator,\n parentIsLocalized,\n payload,\n req,\n val: (pathOperators as Record<string, Where>)[operator],\n })\n\n if (searchParam?.value && searchParam?.path) {\n if (validOperators.length > 1) {\n if (!result.$and) {\n result.$and = []\n }\n result.$and.push({\n [searchParam.path]: searchParam.value,\n })\n } else {\n if (result[searchParam.path]) {\n if (!result.$and) {\n result.$and = []\n }\n\n result.$and.push({ [searchParam.path]: result[searchParam.path] })\n result.$and.push({\n [searchParam.path]: searchParam.value,\n })\n delete result[searchParam.path]\n } else {\n result[searchParam.path] = searchParam.value\n }\n }\n } else if (typeof searchParam?.value === 'object') {\n result = deepMergeWithCombinedArrays(result, searchParam.value ?? {}, {\n // dont clone Types.ObjectIDs\n clone: false,\n })\n }\n }\n }\n }\n }\n }\n\n return result\n}\n"],"names":["deepMergeWithCombinedArrays","validOperatorSet","buildAndOrConditions","buildSearchParam","parseParams","branch","collectionSlug","fields","globalSlug","locale","parentIsLocalized","payload","req","where","result","relationOrPath","Object","keys","condition","conditionOperator","toLowerCase","Array","isArray","builtConditions","length","pathOperators","validOperators","filter","operator","has","searchParam","incomingPath","val","value","path","$and","push","clone"],"mappings":"AAGA,SAASA,2BAA2B,QAAQ,UAAS;AACrD,SAASC,gBAAgB,QAAQ,iBAAgB;AAEjD,SAASC,oBAAoB,QAAQ,4BAA2B;AAChE,SAASC,gBAAgB,QAAQ,yBAAwB;AAEzD,OAAO,eAAeC,YAAY,EAChCC,MAAM,EACNC,cAAc,EACdC,MAAM,EACNC,UAAU,EACVC,MAAM,EACNC,iBAAiB,EACjBC,OAAO,EACPC,GAAG,EACHC,KAAK,EAWN;IACC,IAAIC,SAAS,CAAC;IAEd,IAAI,OAAOD,UAAU,UAAU;QAC7B,uEAAuE;QACvE,KAAK,MAAME,kBAAkBC,OAAOC,IAAI,CAACJ,OAAQ;YAC/C,MAAMK,YAAYL,KAAK,CAACE,eAAe;YACvC,IAAII,oBAA2C;YAC/C,IAAIJ,eAAeK,WAAW,OAAO,OAAO;gBAC1CD,oBAAoB;YACtB,OAAO,IAAIJ,eAAeK,WAAW,OAAO,MAAM;gBAChDD,oBAAoB;YACtB;YACA,IAAIE,MAAMC,OAAO,CAACJ,YAAY;gBAC5B,MAAMK,kBAAkB,MAAMrB,qBAAqB;oBACjDG;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC,OAAOK;gBACT;gBACA,IAAIK,gBAAgBC,MAAM,GAAG,KAAKL,sBAAsB,MAAM;oBAC5DL,MAAM,CAACK,kBAAkB,GAAGI;gBAC9B;YACF,OAAO;gBACL,wEA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AU,UAAU;4BACjDnB,SAASd,4BAA4Bc,QAAQgB,YAAYG,KAAK,IAAI,CAAC,GAAG;gCACpE,6BAA6B;gCAC7BI,OAAO;4BACT;wBACF;oBACF;gBACF;YACF;QACF;IACF;IAEA,OAAOvB;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryDrafts.d.ts","sourceRoot":"","sources":["../src/queryDrafts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"queryDrafts.d.ts","sourceRoot":"","sources":["../src/queryDrafts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AA0B1C,eAAO,MAAM,WAAW,EAAE,WA4MzB,CAAA"}
|
package/dist/queryDrafts.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { buildVersionCollectionFields, combineQueries, flattenWhereToOperators } from 'payload';
|
|
1
|
+
import { buildVersionCollectionFields, combineQueries, flattenWhereToOperators, projectBranchVersionParent, resolveBranchReadState, resolveBranchVersionQuery, 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';
|
|
4
5
|
import { aggregatePaginate } from './utilities/aggregatePaginate.js';
|
|
@@ -8,12 +9,17 @@ import { getCollection } from './utilities/getEntity.js';
|
|
|
8
9
|
import { getSession } from './utilities/getSession.js';
|
|
9
10
|
import { resolveJoins } from './utilities/resolveJoins.js';
|
|
10
11
|
import { transform } from './utilities/transform.js';
|
|
11
|
-
export const queryDrafts = async function queryDrafts({ collection: collectionSlug, joins, limit, locale, page, pagination, req, select, sort: sortArg, where = {} }) {
|
|
12
|
+
export const queryDrafts = async function queryDrafts({ branch, collection: collectionSlug, joins, limit, locale, page, pagination, req, select, sort: sortArg, where = {} }) {
|
|
12
13
|
const { collectionConfig, Model } = getCollection({
|
|
13
14
|
adapter: this,
|
|
14
15
|
collectionSlug,
|
|
15
16
|
versions: true
|
|
16
17
|
});
|
|
18
|
+
const branchReadState = resolveBranchReadState({
|
|
19
|
+
branch,
|
|
20
|
+
collectionSlug,
|
|
21
|
+
req
|
|
22
|
+
});
|
|
17
23
|
let hasNearConstraint;
|
|
18
24
|
let sort;
|
|
19
25
|
if (where) {
|
|
@@ -34,28 +40,46 @@ export const queryDrafts = async function queryDrafts({ collection: collectionSl
|
|
|
34
40
|
versions: true
|
|
35
41
|
});
|
|
36
42
|
}
|
|
43
|
+
const branchedWhere = branchReadState.useBranching ? rewriteBranchVersionParents(where) : await resolveBranchVersionQuery({
|
|
44
|
+
branch,
|
|
45
|
+
collectionSlug,
|
|
46
|
+
req,
|
|
47
|
+
where
|
|
48
|
+
});
|
|
49
|
+
const branchVisibility = branchReadState.useBranching ? buildBranchVisibilityStages({
|
|
50
|
+
adapter: this,
|
|
51
|
+
branch: branchReadState.branch,
|
|
52
|
+
collectionSlug,
|
|
53
|
+
mode: 'drafts'
|
|
54
|
+
}) : [];
|
|
37
55
|
const combinedWhere = combineQueries({
|
|
38
56
|
latest: {
|
|
39
57
|
equals: true
|
|
40
58
|
}
|
|
41
|
-
},
|
|
59
|
+
}, branchedWhere ?? {});
|
|
42
60
|
const versionQuery = await buildQuery({
|
|
43
61
|
adapter: this,
|
|
62
|
+
branch,
|
|
44
63
|
fields,
|
|
45
64
|
locale,
|
|
65
|
+
req,
|
|
46
66
|
where: combinedWhere
|
|
47
67
|
});
|
|
48
68
|
const projection = buildProjectionFromSelect({
|
|
49
69
|
adapter: this,
|
|
50
70
|
fields,
|
|
51
|
-
select
|
|
71
|
+
select: withBranchVersionSelect({
|
|
72
|
+
collectionSlug,
|
|
73
|
+
req,
|
|
74
|
+
select
|
|
75
|
+
})
|
|
52
76
|
});
|
|
53
77
|
const session = await getSession(this, req);
|
|
54
78
|
const options = {
|
|
55
79
|
session
|
|
56
80
|
};
|
|
57
81
|
// useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.
|
|
58
|
-
const useEstimatedCount = hasNearConstraint || !versionQuery || Object.keys(versionQuery).length === 0;
|
|
82
|
+
const useEstimatedCount = !branchVisibility.length && (hasNearConstraint || !versionQuery || Object.keys(versionQuery).length === 0);
|
|
59
83
|
const paginationOptions = {
|
|
60
84
|
lean: true,
|
|
61
85
|
leanWithId: true,
|
|
@@ -97,17 +121,20 @@ export const queryDrafts = async function queryDrafts({ collection: collectionSl
|
|
|
97
121
|
let result;
|
|
98
122
|
const aggregate = await buildJoinAggregation({
|
|
99
123
|
adapter: this,
|
|
124
|
+
branch,
|
|
100
125
|
collection: collectionSlug,
|
|
101
126
|
collectionConfig,
|
|
102
127
|
joins,
|
|
103
128
|
locale,
|
|
104
129
|
projection,
|
|
105
130
|
query: versionQuery,
|
|
131
|
+
req,
|
|
106
132
|
versions: true
|
|
107
133
|
});
|
|
108
|
-
if (aggregate || sortAggregation.length > 0) {
|
|
134
|
+
if (aggregate.length > 0 || branchVisibility.length > 0 || sortAggregation.length > 0) {
|
|
109
135
|
result = await aggregatePaginate({
|
|
110
136
|
adapter: this,
|
|
137
|
+
branchVisibility,
|
|
111
138
|
collation: paginationOptions.collation,
|
|
112
139
|
joinAggregation: aggregate,
|
|
113
140
|
limit: paginationOptions.limit,
|
|
@@ -127,10 +154,12 @@ export const queryDrafts = async function queryDrafts({ collection: collectionSl
|
|
|
127
154
|
if (!this.useJoinAggregations) {
|
|
128
155
|
await resolveJoins({
|
|
129
156
|
adapter: this,
|
|
157
|
+
branch,
|
|
130
158
|
collectionSlug,
|
|
131
159
|
docs: result.docs,
|
|
132
160
|
joins,
|
|
133
161
|
locale,
|
|
162
|
+
req,
|
|
134
163
|
versions: true
|
|
135
164
|
});
|
|
136
165
|
}
|
|
@@ -141,7 +170,9 @@ export const queryDrafts = async function queryDrafts({ collection: collectionSl
|
|
|
141
170
|
operation: 'read'
|
|
142
171
|
});
|
|
143
172
|
for(let i = 0; i < result.docs.length; i++){
|
|
144
|
-
|
|
173
|
+
// A branch version's `parent` is the shadow row's primary key, so the
|
|
174
|
+
// canonical document ID comes from `_branchParent` when present.
|
|
175
|
+
const id = projectBranchVersionParent(result.docs[i]);
|
|
145
176
|
result.docs[i] = result.docs[i].version ?? {};
|
|
146
177
|
result.docs[i].id = id;
|
|
147
178
|
}
|
package/dist/queryDrafts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/queryDrafts.ts"],"sourcesContent":["import type { PaginateOptions, PipelineStage, QueryOptions } from 'mongoose'\nimport type { QueryDrafts } from 'payload'\n\nimport { buildVersionCollectionFields, combineQueries, flattenWhereToOperators } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildSortParam } from './queries/buildSortParam.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 queryDrafts: QueryDrafts = async function queryDrafts(\n this: MongooseAdapter,\n {\n collection: collectionSlug,\n joins,\n limit,\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\n let sort\n\n if (where) {\n const constraints = flattenWhereToOperators(where)\n hasNearConstraint = constraints.some((prop) => Object.keys(prop).some((key) => key === 'near'))\n }\n\n const fields = buildVersionCollectionFields(this.payload.config, collectionConfig, true)\n\n const sortAggregation: PipelineStage[] = []\n if (!hasNearConstraint) {\n sort = buildSortParam({\n adapter: this,\n config: this.payload.config,\n fields,\n locale,\n sort: sortArg || collectionConfig.defaultSort,\n sortAggregation,\n timestamps: true,\n versions: true,\n })\n }\n\n const combinedWhere = combineQueries({ latest: { equals: true } }, where)\n\n const versionQuery = await buildQuery({\n adapter: this,\n fields,\n locale,\n where: combinedWhere,\n })\n\n const projection = buildProjectionFromSelect({\n adapter: this,\n fields,\n select,\n })\n\n const session = await getSession(this, req)\n const options: QueryOptions = {\n session,\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 hasNearConstraint || !versionQuery || Object.keys(versionQuery).length === 0\n const paginationOptions: PaginateOptions = {\n lean: true,\n leanWithId: true,\n options,\n page,\n pagination,\n projection,\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 (\n !useEstimatedCount &&\n Object.keys(versionQuery).length === 0 &&\n this.disableIndexHints !== true\n ) {\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(versionQuery, {\n collation: paginationOptions.collation,\n hint: { _id: 1 },\n session,\n }),\n )\n }\n }\n\n if (limit && 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\n let result\n\n const aggregate = await buildJoinAggregation({\n adapter: this,\n collection: collectionSlug,\n collectionConfig,\n joins,\n locale,\n projection,\n query: versionQuery,\n versions: true,\n })\n\n if (aggregate || sortAggregation.length > 0) {\n result = await aggregatePaginate({\n adapter: this,\n collation: paginationOptions.collation,\n joinAggregation: aggregate,\n limit: paginationOptions.limit,\n Model,\n page: paginationOptions.page,\n pagination: paginationOptions.pagination,\n projection: paginationOptions.projection,\n query: versionQuery,\n session: paginationOptions.options?.session ?? undefined,\n sort: paginationOptions.sort as object,\n sortAggregation,\n useEstimatedCount: paginationOptions.useEstimatedCount,\n })\n } else {\n result = await Model.paginate(versionQuery, paginationOptions)\n }\n\n if (!this.useJoinAggregations) {\n await resolveJoins({\n adapter: this,\n collectionSlug,\n docs: result.docs as Record<string, unknown>[],\n joins,\n locale,\n versions: true,\n })\n }\n\n transform({\n adapter: this,\n data: result.docs,\n fields: buildVersionCollectionFields(this.payload.config, collectionConfig),\n operation: 'read',\n })\n\n for (let i = 0; i < result.docs.length; i++) {\n const id = result.docs[i].parent\n result.docs[i] = result.docs[i].version ?? {}\n result.docs[i].id = id\n }\n\n return result\n}\n"],"names":["buildVersionCollectionFields","combineQueries","flattenWhereToOperators","buildQuery","buildSortParam","aggregatePaginate","buildJoinAggregation","buildProjectionFromSelect","getCollection","getSession","resolveJoins","transform","queryDrafts","collection","collectionSlug","joins","limit","locale","page","pagination","req","select","sort","sortArg","where","collectionConfig","Model","adapter","versions","hasNearConstraint","constraints","some","prop","Object","keys","key","fields","payload","config","sortAggregation","defaultSort","timestamps","combinedWhere","latest","equals","versionQuery","projection","session","options","useEstimatedCount","length","paginationOptions","lean","leanWithId","collation","localizationConfig","localization","defaultLocale","disableIndexHints","useCustomCountFn","Promise","resolve","countDocuments","hint","_id","result","aggregate","query","joinAggregation","undefined","paginate","useJoinAggregations","docs","data","operation","i","id","parent","version"],"mappings":"AAGA,SAASA,4BAA4B,EAAEC,cAAc,EAAEC,uBAAuB,QAAQ,UAAS;AAI/F,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,iBAAiB,QAAQ,mCAAkC;AACpE,SAASC,oBAAoB,QAA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BW,MAAM,GAAG,GAAG;QAC3Ce,SAAS,MAAM5D,kBAAkB;YAC/BsB,SAAS,IAAI;YACb2B,WAAWH,kBAAkBG,SAAS;YACtCc,iBAAiBF;YACjBlD,OAAOmC,kBAAkBnC,KAAK;YAC9BU;YACAR,MAAMiC,kBAAkBjC,IAAI;YAC5BC,YAAYgC,kBAAkBhC,UAAU;YACxC2B,YAAYK,kBAAkBL,UAAU;YACxCqB,OAAOtB;YACPE,SAASI,kBAAkBH,OAAO,EAAED,WAAWsB;YAC/C/C,MAAM6B,kBAAkB7B,IAAI;YAC5BiB;YACAU,mBAAmBE,kBAAkBF,iBAAiB;QACxD;IACF,OAAO;QACLgB,SAAS,MAAMvC,MAAM4C,QAAQ,CAACzB,cAAcM;IAC9C;IAEA,IAAI,CAAC,IAAI,CAACoB,mBAAmB,EAAE;QAC7B,MAAM7D,aAAa;YACjBiB,SAAS,IAAI;YACbb;YACA0D,MAAMP,OAAOO,IAAI;YACjBzD;YACAE;YACAW,UAAU;QACZ;IACF;IAEAjB,UAAU;QACRgB,SAAS,IAAI;QACb8C,MAAMR,OAAOO,IAAI;QACjBpC,QAAQpC,6BAA6B,IAAI,CAACqC,OAAO,CAACC,MAAM,EAAEb;QAC1DiD,WAAW;IACb;IAEA,IAAK,IAAIC,IAAI,GAAGA,IAAIV,OAAOO,IAAI,CAACtB,MAAM,EAAEyB,IAAK;QAC3C,MAAMC,KAAKX,OAAOO,IAAI,CAACG,EAAE,CAACE,MAAM;QAChCZ,OAAOO,IAAI,CAACG,EAAE,GAAGV,OAAOO,IAAI,CAACG,EAAE,CAACG,OAAO,IAAI,CAAC;QAC5Cb,OAAOO,IAAI,CAACG,EAAE,CAACC,EAAE,GAAGA;IACtB;IAEA,OAAOX;AACT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../src/queryDrafts.ts"],"sourcesContent":["import type { PaginateOptions, PipelineStage, QueryOptions } from 'mongoose'\nimport type { QueryDrafts } from 'payload'\n\nimport {\n buildVersionCollectionFields,\n combineQueries,\n flattenWhereToOperators,\n projectBranchVersionParent,\n resolveBranchReadState,\n resolveBranchVersionQuery,\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 { 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 queryDrafts: QueryDrafts = async function queryDrafts(\n this: MongooseAdapter,\n {\n branch,\n collection: collectionSlug,\n joins,\n limit,\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 let hasNearConstraint\n let sort\n\n if (where) {\n const constraints = flattenWhereToOperators(where)\n hasNearConstraint = constraints.some((prop) => Object.keys(prop).some((key) => key === 'near'))\n }\n\n const fields = buildVersionCollectionFields(this.payload.config, collectionConfig, true)\n\n const sortAggregation: PipelineStage[] = []\n if (!hasNearConstraint) {\n sort = buildSortParam({\n adapter: this,\n config: this.payload.config,\n fields,\n locale,\n sort: sortArg || collectionConfig.defaultSort,\n sortAggregation,\n timestamps: true,\n versions: true,\n })\n }\n\n const branchedWhere = branchReadState.useBranching\n ? rewriteBranchVersionParents(where)\n : await resolveBranchVersionQuery({\n branch,\n collectionSlug,\n req,\n where,\n })\n const branchVisibility = branchReadState.useBranching\n ? buildBranchVisibilityStages({\n adapter: this,\n branch: branchReadState.branch,\n collectionSlug,\n mode: 'drafts',\n })\n : []\n\n const combinedWhere = combineQueries({ latest: { equals: true } }, branchedWhere ?? {})\n\n const versionQuery = await buildQuery({\n adapter: this,\n branch,\n fields,\n locale,\n req,\n where: combinedWhere,\n })\n\n const projection = buildProjectionFromSelect({\n adapter: this,\n fields,\n select: withBranchVersionSelect({ collectionSlug, req, select }),\n })\n\n const session = await getSession(this, req)\n const options: QueryOptions = {\n session,\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 &&\n (hasNearConstraint || !versionQuery || Object.keys(versionQuery).length === 0)\n const paginationOptions: PaginateOptions = {\n lean: true,\n leanWithId: true,\n options,\n page,\n pagination,\n projection,\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 (\n !useEstimatedCount &&\n Object.keys(versionQuery).length === 0 &&\n this.disableIndexHints !== true\n ) {\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(versionQuery, {\n collation: paginationOptions.collation,\n hint: { _id: 1 },\n session,\n }),\n )\n }\n }\n\n if (limit && 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\n let result\n\n const aggregate = await buildJoinAggregation({\n adapter: this,\n branch,\n collection: collectionSlug,\n collectionConfig,\n joins,\n locale,\n projection,\n query: versionQuery,\n req,\n versions: true,\n })\n\n if (aggregate.length > 0 || branchVisibility.length > 0 || sortAggregation.length > 0) {\n result = await aggregatePaginate({\n adapter: this,\n branchVisibility,\n collation: paginationOptions.collation,\n joinAggregation: aggregate,\n limit: paginationOptions.limit,\n Model,\n page: paginationOptions.page,\n pagination: paginationOptions.pagination,\n projection: paginationOptions.projection,\n query: versionQuery,\n session: paginationOptions.options?.session ?? undefined,\n sort: paginationOptions.sort as object,\n sortAggregation,\n useEstimatedCount: paginationOptions.useEstimatedCount,\n })\n } else {\n result = await Model.paginate(versionQuery, paginationOptions)\n }\n\n if (!this.useJoinAggregations) {\n await resolveJoins({\n adapter: this,\n branch,\n collectionSlug,\n docs: result.docs as Record<string, unknown>[],\n joins,\n locale,\n req,\n versions: true,\n })\n }\n\n transform({\n adapter: this,\n data: result.docs,\n fields: buildVersionCollectionFields(this.payload.config, collectionConfig),\n operation: 'read',\n })\n\n for (let i = 0; i < result.docs.length; i++) {\n // A branch version's `parent` is the shadow row's primary key, so the\n // canonical document ID comes from `_branchParent` when present.\n const id = projectBranchVersionParent(result.docs[i] as Record<string, unknown>)\n result.docs[i] = result.docs[i].version ?? {}\n result.docs[i].id = id\n }\n\n return result\n}\n"],"names":["buildVersionCollectionFields","combineQueries","flattenWhereToOperators","projectBranchVersionParent","resolveBranchReadState","resolveBranchVersionQuery","rewriteBranchVersionParents","withBranchVersionSelect","buildBranchVisibilityStages","buildQuery","buildSortParam","aggregatePaginate","buildJoinAggregation","buildProjectionFromSelect","getCollection","getSession","resolveJoins","transform","queryDrafts","branch","collection","collectionSlug","joins","limit","locale","page","pagination","req","select","sort","sortArg","where","collectionConfig","Model","adapter","versions","branchReadState","hasNearConstraint","constraints","some","prop","Object","keys","key","fields","payload","config","sortAggregation","defaultSort","timestamps","branchedWhere","useBranching","branchVisibility","mode","combinedWhere","latest","equals","versionQuery","projection","session","options","useEstimatedCount","length","paginationOptions","lean","leanWithId","collation","localizationConfig","localization","defaultLocale","disableIndexHints","useCustomCountFn","Promise","resolve","countDocuments","hint","_id","result","aggregate","query","joinAggregation","undefined","paginate","useJoinAggreg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E,kBAAkBF,iBAAiB;QACxD;IACF,OAAO;QACLgB,SAAS,MAAM5C,MAAMiD,QAAQ,CAACzB,cAAcM;IAC9C;IAEA,IAAI,CAAC,IAAI,CAACoB,mBAAmB,EAAE;QAC7B,MAAMnE,aAAa;YACjBkB,SAAS,IAAI;YACbf;YACAE;YACA+D,MAAMP,OAAOO,IAAI;YACjB9D;YACAE;YACAG;YACAQ,UAAU;QACZ;IACF;IAEAlB,UAAU;QACRiB,SAAS,IAAI;QACbmD,MAAMR,OAAOO,IAAI;QACjBxC,QAAQ5C,6BAA6B,IAAI,CAAC6C,OAAO,CAACC,MAAM,EAAEd;QAC1DsD,WAAW;IACb;IAEA,IAAK,IAAIC,IAAI,GAAGA,IAAIV,OAAOO,IAAI,CAACtB,MAAM,EAAEyB,IAAK;QAC3C,sEAAsE;QACtE,iEAAiE;QACjE,MAAMC,KAAKrF,2BAA2B0E,OAAOO,IAAI,CAACG,EAAE;QACpDV,OAAOO,IAAI,CAACG,EAAE,GAAGV,OAAOO,IAAI,CAACG,EAAE,CAACE,OAAO,IAAI,CAAC;QAC5CZ,OAAOO,IAAI,CAACG,EAAE,CAACC,EAAE,GAAGA;IACtB;IAEA,OAAOX;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commitTransaction.d.ts","sourceRoot":"","sources":["../../src/transactions/commitTransaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commitTransaction.d.ts","sourceRoot":"","sources":["../../src/transactions/commitTransaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAShD,eAAO,MAAM,iBAAiB,EAAE,iBAiD/B,CAAA"}
|
|
@@ -1,23 +1,71 @@
|
|
|
1
|
+
const unknownCommitRetryTimeoutMilliseconds = 120_000;
|
|
2
|
+
const unknownCommitRetryInitialDelayMilliseconds = 5;
|
|
3
|
+
const unknownCommitRetryMaximumDelayMilliseconds = 500;
|
|
4
|
+
const unknownCommitRetryGrowth = 1.5;
|
|
1
5
|
export const commitTransaction = async function commitTransaction(incomingID = '') {
|
|
2
6
|
const transactionID = incomingID instanceof Promise ? await incomingID : incomingID;
|
|
3
7
|
if (!this.sessions[transactionID]) {
|
|
4
8
|
return;
|
|
5
9
|
}
|
|
6
10
|
if (!this.sessions[transactionID]?.inTransaction()) {
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
await endRegisteredSession({
|
|
12
|
+
adapter: this,
|
|
13
|
+
session: this.sessions[transactionID],
|
|
14
|
+
transactionID
|
|
15
|
+
});
|
|
9
16
|
return;
|
|
10
17
|
}
|
|
11
18
|
const session = this.sessions[transactionID];
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
const retryDeadline = Date.now() + unknownCommitRetryTimeoutMilliseconds;
|
|
20
|
+
let retryIndex = 0;
|
|
21
|
+
while(true){
|
|
22
|
+
try {
|
|
23
|
+
await session.commitTransaction();
|
|
24
|
+
await endRegisteredSession({
|
|
25
|
+
adapter: this,
|
|
26
|
+
session,
|
|
27
|
+
transactionID
|
|
28
|
+
});
|
|
29
|
+
return;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
if (!isUnknownTransactionCommitResult(error)) {
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
const retryDelayMilliseconds = Math.random() * Math.min(unknownCommitRetryInitialDelayMilliseconds * unknownCommitRetryGrowth ** retryIndex, unknownCommitRetryMaximumDelayMilliseconds);
|
|
35
|
+
if (isMaxTimeExpiredError(error) || Date.now() + retryDelayMilliseconds >= retryDeadline) {
|
|
36
|
+
await endRegisteredSession({
|
|
37
|
+
adapter: this,
|
|
38
|
+
session,
|
|
39
|
+
transactionID
|
|
40
|
+
});
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
await new Promise((resolve)=>setTimeout(resolve, retryDelayMilliseconds));
|
|
44
|
+
retryIndex += 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const endRegisteredSession = async ({ adapter, session, transactionID })=>{
|
|
49
|
+
delete adapter.sessions[transactionID];
|
|
16
50
|
try {
|
|
17
51
|
await session.endSession();
|
|
18
52
|
} catch (_) {
|
|
19
|
-
//
|
|
53
|
+
// Ending the session is best effort after commit succeeds or its result remains unknown.
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const isMaxTimeExpiredError = (error)=>{
|
|
57
|
+
if (!error || typeof error !== 'object') {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
const mongoError = error;
|
|
61
|
+
return mongoError.code === 50 || mongoError.codeName === 'MaxTimeMSExpired';
|
|
62
|
+
};
|
|
63
|
+
const isUnknownTransactionCommitResult = (error)=>{
|
|
64
|
+
if (!error || typeof error !== 'object') {
|
|
65
|
+
return false;
|
|
20
66
|
}
|
|
67
|
+
const labeledError = error;
|
|
68
|
+
return labeledError.hasErrorLabel?.('UnknownTransactionCommitResult') === true || labeledError.errorLabels?.includes('UnknownTransactionCommitResult') === true;
|
|
21
69
|
};
|
|
22
70
|
|
|
23
71
|
//# sourceMappingURL=commitTransaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/commitTransaction.ts"],"sourcesContent":["import type { CommitTransaction } from 'payload'\n\nimport type { MongooseAdapter } from '../index.js'\n\nexport const commitTransaction: CommitTransaction = async function commitTransaction(\n this: MongooseAdapter,\n incomingID = '',\n) {\n const transactionID = incomingID instanceof Promise ? await incomingID : incomingID\n\n if (!this.sessions[transactionID]) {\n return\n }\n\n if (!this.sessions[transactionID]?.inTransaction()) {\n
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/commitTransaction.ts"],"sourcesContent":["import type { ClientSession } from 'mongodb'\nimport type { CommitTransaction } from 'payload'\n\nimport type { MongooseAdapter } from '../index.js'\n\nconst unknownCommitRetryTimeoutMilliseconds = 120_000\nconst unknownCommitRetryInitialDelayMilliseconds = 5\nconst unknownCommitRetryMaximumDelayMilliseconds = 500\nconst unknownCommitRetryGrowth = 1.5\n\nexport const commitTransaction: CommitTransaction = async function commitTransaction(\n this: MongooseAdapter,\n incomingID = '',\n) {\n const transactionID = incomingID instanceof Promise ? await incomingID : incomingID\n\n if (!this.sessions[transactionID]) {\n return\n }\n\n if (!this.sessions[transactionID]?.inTransaction()) {\n await endRegisteredSession({\n adapter: this,\n session: this.sessions[transactionID],\n transactionID,\n })\n return\n }\n\n const session = this.sessions[transactionID]\n const retryDeadline = Date.now() + unknownCommitRetryTimeoutMilliseconds\n let retryIndex = 0\n\n while (true) {\n try {\n await session.commitTransaction()\n await endRegisteredSession({ adapter: this, session, transactionID })\n return\n } catch (error) {\n if (!isUnknownTransactionCommitResult(error)) {\n throw error\n }\n\n const retryDelayMilliseconds =\n Math.random() *\n Math.min(\n unknownCommitRetryInitialDelayMilliseconds * unknownCommitRetryGrowth ** retryIndex,\n unknownCommitRetryMaximumDelayMilliseconds,\n )\n\n if (isMaxTimeExpiredError(error) || Date.now() + retryDelayMilliseconds >= retryDeadline) {\n await endRegisteredSession({ adapter: this, session, transactionID })\n throw error\n }\n\n await new Promise((resolve) => setTimeout(resolve, retryDelayMilliseconds))\n retryIndex += 1\n }\n }\n}\n\nconst endRegisteredSession = async ({\n adapter,\n session,\n transactionID,\n}: {\n adapter: MongooseAdapter\n session: ClientSession\n transactionID: number | string\n}): Promise<void> => {\n delete adapter.sessions[transactionID]\n\n try {\n await session.endSession()\n } catch (_) {\n // Ending the session is best effort after commit succeeds or its result remains unknown.\n }\n}\n\nconst isMaxTimeExpiredError = (error: unknown): boolean => {\n if (!error || typeof error !== 'object') {\n return false\n }\n\n const mongoError = error as { code?: number; codeName?: string }\n\n return mongoError.code === 50 || mongoError.codeName === 'MaxTimeMSExpired'\n}\n\nconst isUnknownTransactionCommitResult = (error: unknown): boolean => {\n if (!error || typeof error !== 'object') {\n return false\n }\n\n const labeledError = error as {\n errorLabels?: string[]\n hasErrorLabel?: (label: string) => boolean\n }\n\n return (\n labeledError.hasErrorLabel?.('UnknownTransactionCommitResult') === true ||\n labeledError.errorLabels?.includes('UnknownTransactionCommitResult') === true\n )\n}\n"],"names":["unknownCommitRetryTimeoutMilliseconds","unknownCommitRetryInitialDelayMilliseconds","unknownCommitRetryMaximumDelayMilliseconds","unknownCommitRetryGrowth","commitTransaction","incomingID","transactionID","Promise","sessions","inTransaction","endRegisteredSession","adapter","session","retryDeadline","Date","now","retryIndex","error","isUnknownTransactionCommitResult","retryDelayMilliseconds","Math","random","min","isMaxTimeExpiredError","resolve","setTimeout","endSession","_","mongoError","code","codeName","labeledError","hasErrorLabel","errorLabels","includes"],"mappings":"AAKA,MAAMA,wCAAwC;AAC9C,MAAMC,6CAA6C;AACnD,MAAMC,6CAA6C;AACnD,MAAMC,2BAA2B;AAEjC,OAAO,MAAMC,oBAAuC,eAAeA,kBAEjEC,aAAa,EAAE;IAEf,MAAMC,gBAAgBD,sBAAsBE,UAAU,MAAMF,aAAaA;IAEzE,IAAI,CAAC,IAAI,CAACG,QAAQ,CAACF,cAAc,EAAE;QACjC;IACF;IAEA,IAAI,CAAC,IAAI,CAACE,QAAQ,CAACF,cAAc,EAAEG,iBAAiB;QAClD,MAAMC,qBAAqB;YACzBC,SAAS,IAAI;YACbC,SAAS,IAAI,CAACJ,QAAQ,CAACF,cAAc;YACrCA;QACF;QACA;IACF;IAEA,MAAMM,UAAU,IAAI,CAACJ,QAAQ,CAACF,cAAc;IAC5C,MAAMO,gBAAgBC,KAAKC,GAAG,KAAKf;IACnC,IAAIgB,aAAa;IAEjB,MAAO,KAAM;QACX,IAAI;YACF,MAAMJ,QAAQR,iBAAiB;YAC/B,MAAMM,qBAAqB;gBAAEC,SAAS,IAAI;gBAAEC;gBAASN;YAAc;YACnE;QACF,EAAE,OAAOW,OAAO;YACd,IAAI,CAACC,iCAAiCD,QAAQ;gBAC5C,MAAMA;YACR;YAEA,MAAME,yBACJC,KAAKC,MAAM,KACXD,KAAKE,GAAG,CACNrB,6CAA6CE,4BAA4Ba,YACzEd;YAGJ,IAAIqB,sBAAsBN,UAAUH,KAAKC,GAAG,KAAKI,0BAA0BN,eAAe;gBACxF,MAAMH,qBAAqB;oBAAEC,SAAS,IAAI;oBAAEC;oBAASN;gBAAc;gBACnE,MAAMW;YACR;YAEA,MAAM,IAAIV,QAAQ,CAACiB,UAAYC,WAAWD,SAASL;YACnDH,cAAc;QAChB;IACF;AACF,EAAC;AAED,MAAMN,uBAAuB,OAAO,EAClCC,OAAO,EACPC,OAAO,EACPN,aAAa,EAKd;IACC,OAAOK,QAAQH,QAAQ,CAACF,cAAc;IAEtC,IAAI;QACF,MAAMM,QAAQc,UAAU;IAC1B,EAAE,OAAOC,GAAG;IACV,yFAAyF;IAC3F;AACF;AAEA,MAAMJ,wBAAwB,CAACN;IAC7B,IAAI,CAACA,SAAS,OAAOA,UAAU,UAAU;QACvC,OAAO;IACT;IAEA,MAAMW,aAAaX;IAEnB,OAAOW,WAAWC,IAAI,KAAK,MAAMD,WAAWE,QAAQ,KAAK;AAC3D;AAEA,MAAMZ,mCAAmC,CAACD;IACxC,IAAI,CAACA,SAAS,OAAOA,UAAU,UAAU;QACvC,OAAO;IACT;IAEA,MAAMc,eAAed;IAKrB,OACEc,aAAaC,aAAa,GAAG,sCAAsC,QACnED,aAAaE,WAAW,EAAEC,SAAS,sCAAsC;AAE7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollbackTransaction.d.ts","sourceRoot":"","sources":["../../src/transactions/rollbackTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAIlD,eAAO,MAAM,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"rollbackTransaction.d.ts","sourceRoot":"","sources":["../../src/transactions/rollbackTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAIlD,eAAO,MAAM,mBAAmB,EAAE,mBAiCjC,CAAA"}
|
|
@@ -5,22 +5,23 @@ export const rollbackTransaction = async function rollbackTransaction(incomingID
|
|
|
5
5
|
if (!this.sessions[transactionID]) {
|
|
6
6
|
return;
|
|
7
7
|
}
|
|
8
|
-
// when session exists but is not inTransaction something unexpected is happening to the session
|
|
9
|
-
if (!this.sessions[transactionID]?.inTransaction()) {
|
|
10
|
-
this.payload.logger.warn('rollbackTransaction called when no transaction exists');
|
|
11
|
-
delete this.sessions[transactionID];
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
8
|
const session = this.sessions[transactionID];
|
|
15
9
|
// Delete from registry FIRST to prevent race conditions
|
|
16
10
|
// This ensures other operations can't retrieve this session while we're aborting it
|
|
17
11
|
delete this.sessions[transactionID];
|
|
18
|
-
|
|
12
|
+
if (session.inTransaction()) {
|
|
13
|
+
try {
|
|
14
|
+
await session.abortTransaction();
|
|
15
|
+
} catch (_error) {
|
|
16
|
+
// ignore the error as it is likely a race condition from multiple errors
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
this.payload.logger.warn('rollbackTransaction called when no transaction exists');
|
|
20
|
+
}
|
|
19
21
|
try {
|
|
20
|
-
await session.abortTransaction();
|
|
21
22
|
await session.endSession();
|
|
22
23
|
} catch (_error) {
|
|
23
|
-
//
|
|
24
|
+
// ending a session is best effort after its transaction has failed or been aborted
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
27
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/rollbackTransaction.ts"],"sourcesContent":["import type { RollbackTransaction } from 'payload'\n\nimport type { MongooseAdapter } from '../index.js'\n\nexport const rollbackTransaction: RollbackTransaction = async function rollbackTransaction(\n this: MongooseAdapter,\n incomingID = '',\n) {\n const transactionID = incomingID instanceof Promise ? await incomingID : incomingID\n\n // if multiple operations are using the same transaction, the first will flow through and delete the session.\n // subsequent calls should be ignored.\n if (!this.sessions[transactionID]) {\n return\n }\n\n
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/rollbackTransaction.ts"],"sourcesContent":["import type { RollbackTransaction } from 'payload'\n\nimport type { MongooseAdapter } from '../index.js'\n\nexport const rollbackTransaction: RollbackTransaction = async function rollbackTransaction(\n this: MongooseAdapter,\n incomingID = '',\n) {\n const transactionID = incomingID instanceof Promise ? await incomingID : incomingID\n\n // if multiple operations are using the same transaction, the first will flow through and delete the session.\n // subsequent calls should be ignored.\n if (!this.sessions[transactionID]) {\n return\n }\n\n const session = this.sessions[transactionID]\n\n // Delete from registry FIRST to prevent race conditions\n // This ensures other operations can't retrieve this session while we're aborting it\n delete this.sessions[transactionID]\n\n if (session.inTransaction()) {\n try {\n await session.abortTransaction()\n } catch (_error) {\n // ignore the error as it is likely a race condition from multiple errors\n }\n } else {\n this.payload.logger.warn('rollbackTransaction called when no transaction exists')\n }\n\n try {\n await session.endSession()\n } catch (_error) {\n // ending a session is best effort after its transaction has failed or been aborted\n }\n}\n"],"names":["rollbackTransaction","incomingID","transactionID","Promise","sessions","session","inTransaction","abortTransaction","_error","payload","logger","warn","endSession"],"mappings":"AAIA,OAAO,MAAMA,sBAA2C,eAAeA,oBAErEC,aAAa,EAAE;IAEf,MAAMC,gBAAgBD,sBAAsBE,UAAU,MAAMF,aAAaA;IAEzE,6GAA6G;IAC7G,sCAAsC;IACtC,IAAI,CAAC,IAAI,CAACG,QAAQ,CAACF,cAAc,EAAE;QACjC;IACF;IAEA,MAAMG,UAAU,IAAI,CAACD,QAAQ,CAACF,cAAc;IAE5C,wDAAwD;IACxD,oFAAoF;IACpF,OAAO,IAAI,CAACE,QAAQ,CAACF,cAAc;IAEnC,IAAIG,QAAQC,aAAa,IAAI;QAC3B,IAAI;YACF,MAAMD,QAAQE,gBAAgB;QAChC,EAAE,OAAOC,QAAQ;QACf,yEAAyE;QAC3E;IACF,OAAO;QACL,IAAI,CAACC,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC;IAC3B;IAEA,IAAI;QACF,MAAMN,QAAQO,UAAU;IAC1B,EAAE,OAAOJ,QAAQ;IACf,mFAAmF;IACrF;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateGlobal.d.ts","sourceRoot":"","sources":["../src/updateGlobal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"updateGlobal.d.ts","sourceRoot":"","sources":["../src/updateGlobal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,SAAS,CAAA;AAe7D,eAAO,MAAM,YAAY,EAAE,YA8F1B,CAAA"}
|
package/dist/updateGlobal.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { resolveBranchGlobalWrite } from 'payload';
|
|
1
2
|
import { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js';
|
|
2
3
|
import { getGlobal } from './utilities/getEntity.js';
|
|
3
4
|
import { getSession } from './utilities/getSession.js';
|
|
4
5
|
import { transform } from './utilities/transform.js';
|
|
5
|
-
export const updateGlobal = async function updateGlobal(
|
|
6
|
+
export const updateGlobal = async function updateGlobal(args) {
|
|
7
|
+
const { slug: globalSlug, branch, branchConflictData, data, options: optionsArgs = {}, req, returning, select } = args;
|
|
6
8
|
const { globalConfig, Model } = getGlobal({
|
|
7
9
|
adapter: this,
|
|
8
10
|
globalSlug
|
|
@@ -15,6 +17,15 @@ export const updateGlobal = async function updateGlobal({ slug: globalSlug, data
|
|
|
15
17
|
globalSlug,
|
|
16
18
|
operation: 'write'
|
|
17
19
|
});
|
|
20
|
+
if (branchConflictData) {
|
|
21
|
+
transform({
|
|
22
|
+
adapter: this,
|
|
23
|
+
data: branchConflictData,
|
|
24
|
+
fields,
|
|
25
|
+
globalSlug,
|
|
26
|
+
operation: 'write'
|
|
27
|
+
});
|
|
28
|
+
}
|
|
18
29
|
const baseOptions = {
|
|
19
30
|
...optionsArgs,
|
|
20
31
|
session: await getSession(this, req),
|
|
@@ -24,22 +35,91 @@ export const updateGlobal = async function updateGlobal({ slug: globalSlug, data
|
|
|
24
35
|
const findOptions = {
|
|
25
36
|
...baseOptions,
|
|
26
37
|
lean: true,
|
|
27
|
-
new: true,
|
|
28
38
|
projection: buildProjectionFromSelect({
|
|
29
39
|
adapter: this,
|
|
30
40
|
fields: globalConfig.flattenedFields,
|
|
31
41
|
select
|
|
32
|
-
})
|
|
42
|
+
}),
|
|
43
|
+
returnDocument: 'after'
|
|
33
44
|
};
|
|
34
|
-
|
|
35
|
-
|
|
45
|
+
const writeBranch = resolveBranchGlobalWrite({
|
|
46
|
+
branch,
|
|
47
|
+
globalSlug,
|
|
48
|
+
req
|
|
49
|
+
});
|
|
50
|
+
const isBranchableGlobal = this.payload.config.branching?.branchableGlobals.has(globalSlug);
|
|
51
|
+
// On a branch the write targets that branch's own row, upserting it from
|
|
52
|
+
// main's current content the first time the global is touched.
|
|
53
|
+
const filter = writeBranch ? {
|
|
54
|
+
_branch: {
|
|
55
|
+
$eq: writeBranch
|
|
56
|
+
},
|
|
57
|
+
globalType: globalSlug
|
|
58
|
+
} : isBranchableGlobal ? {
|
|
59
|
+
_branch: {
|
|
60
|
+
$eq: 'main'
|
|
61
|
+
},
|
|
62
|
+
globalType: globalSlug
|
|
63
|
+
} : {
|
|
64
|
+
globalType: globalSlug
|
|
65
|
+
};
|
|
66
|
+
if (writeBranch) {
|
|
67
|
+
const mainDoc = await Model.findOne({
|
|
68
|
+
_branch: {
|
|
69
|
+
$eq: 'main'
|
|
70
|
+
},
|
|
36
71
|
globalType: globalSlug
|
|
37
|
-
},
|
|
72
|
+
}, {}, baseOptions).lean();
|
|
73
|
+
const { _id, __v, ...mainData } = mainDoc ?? {};
|
|
74
|
+
const writeData = {
|
|
75
|
+
...branchConflictData ?? data,
|
|
76
|
+
_branch: writeBranch
|
|
77
|
+
};
|
|
78
|
+
const insertData = {
|
|
79
|
+
...mainData,
|
|
80
|
+
globalType: globalSlug
|
|
81
|
+
};
|
|
82
|
+
for (const key of Object.keys(writeData)){
|
|
83
|
+
delete insertData[key];
|
|
84
|
+
}
|
|
85
|
+
const upsertOptions = {
|
|
86
|
+
...findOptions,
|
|
87
|
+
upsert: true
|
|
88
|
+
};
|
|
89
|
+
const update = {
|
|
90
|
+
$set: writeData,
|
|
91
|
+
$setOnInsert: insertData
|
|
92
|
+
};
|
|
93
|
+
if (returning === false) {
|
|
94
|
+
await Model.findOneAndUpdate(filter, update, {
|
|
95
|
+
...baseOptions,
|
|
96
|
+
upsert: true
|
|
97
|
+
});
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
const result = await Model.findOneAndUpdate(filter, update, upsertOptions);
|
|
101
|
+
transform({
|
|
102
|
+
adapter: this,
|
|
103
|
+
data: result,
|
|
104
|
+
fields,
|
|
105
|
+
globalSlug,
|
|
106
|
+
operation: 'read'
|
|
107
|
+
});
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
// `_branch` is forced rather than taken from `data`. The incoming document is a
|
|
111
|
+
// round-trip of a read, and `_branch` is stripped from reads — so the field's
|
|
112
|
+
// `main` default silently refills it, and writing that back would flip the
|
|
113
|
+
// branch's row onto main and leave two rows claiming to be production.
|
|
114
|
+
const writeData = writeBranch ? {
|
|
115
|
+
...data,
|
|
116
|
+
_branch: writeBranch
|
|
117
|
+
} : data;
|
|
118
|
+
if (returning === false) {
|
|
119
|
+
await Model.updateOne(filter, writeData, baseOptions);
|
|
38
120
|
return null;
|
|
39
121
|
}
|
|
40
|
-
const result = await Model.findOneAndUpdate(
|
|
41
|
-
globalType: globalSlug
|
|
42
|
-
}, data, findOptions);
|
|
122
|
+
const result = await Model.findOneAndUpdate(filter, writeData, findOptions);
|
|
43
123
|
transform({
|
|
44
124
|
adapter: this,
|
|
45
125
|
data: result,
|
package/dist/updateGlobal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/updateGlobal.ts"],"sourcesContent":["import type { QueryOptions } from 'mongoose'\nimport type { UpdateGlobal } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\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 updateGlobal: UpdateGlobal = async function updateGlobal(
|
|
1
|
+
{"version":3,"sources":["../src/updateGlobal.ts"],"sourcesContent":["import type { QueryOptions } from 'mongoose'\nimport type { UpdateGlobal, UpdateGlobalArgs } from 'payload'\n\nimport { resolveBranchGlobalWrite } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\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\ntype BranchUpdateGlobalArgs = {\n branchConflictData?: Record<string, unknown>\n} & UpdateGlobalArgs\n\nexport const updateGlobal: UpdateGlobal = async function updateGlobal(this: MongooseAdapter, args) {\n const {\n slug: globalSlug,\n branch,\n branchConflictData,\n data,\n options: optionsArgs = {},\n req,\n returning,\n select,\n } = args as BranchUpdateGlobalArgs\n const { globalConfig, Model } = getGlobal({ adapter: this, globalSlug })\n\n const fields = globalConfig.fields\n\n transform({ adapter: this, data, fields, globalSlug, operation: 'write' })\n if (branchConflictData) {\n transform({ adapter: this, data: branchConflictData, fields, globalSlug, operation: 'write' })\n }\n\n const baseOptions = {\n ...optionsArgs,\n session: await getSession(this, req),\n // Timestamps are manually added by the write transform\n timestamps: false,\n } satisfies QueryOptions\n\n const findOptions: QueryOptions = {\n ...baseOptions,\n lean: true,\n projection: buildProjectionFromSelect({\n adapter: this,\n fields: globalConfig.flattenedFields,\n select,\n }),\n returnDocument: 'after',\n }\n\n const writeBranch = resolveBranchGlobalWrite({ branch, globalSlug, req })\n const isBranchableGlobal = this.payload.config.branching?.branchableGlobals.has(globalSlug)\n\n // On a branch the write targets that branch's own row, upserting it from\n // main's current content the first time the global is touched.\n const filter = writeBranch\n ? { _branch: { $eq: writeBranch }, globalType: globalSlug }\n : isBranchableGlobal\n ? { _branch: { $eq: 'main' }, globalType: globalSlug }\n : { globalType: globalSlug }\n\n if (writeBranch) {\n const mainDoc: any = await Model.findOne(\n { _branch: { $eq: 'main' }, globalType: globalSlug },\n {},\n baseOptions,\n ).lean()\n const { _id, __v, ...mainData } = (mainDoc ?? {}) as Record<string, unknown>\n const writeData = { ...((branchConflictData ?? data) as object), _branch: writeBranch }\n const insertData: Record<string, unknown> = { ...mainData, globalType: globalSlug }\n\n for (const key of Object.keys(writeData)) {\n delete insertData[key]\n }\n\n const upsertOptions = { ...findOptions, upsert: true }\n const update = { $set: writeData, $setOnInsert: insertData }\n\n if (returning === false) {\n await Model.findOneAndUpdate(filter, update, { ...baseOptions, upsert: true })\n return null\n }\n\n const result: any = await Model.findOneAndUpdate(filter, update, upsertOptions)\n\n transform({ adapter: this, data: result, fields, globalSlug, operation: 'read' })\n\n return result\n }\n\n // `_branch` is forced rather than taken from `data`. The incoming document is a\n // round-trip of a read, and `_branch` is stripped from reads — so the field's\n // `main` default silently refills it, and writing that back would flip the\n // branch's row onto main and leave two rows claiming to be production.\n const writeData = writeBranch ? { ...(data as object), _branch: writeBranch } : data\n\n if (returning === false) {\n await Model.updateOne(filter, writeData, baseOptions)\n return null\n }\n\n const result: any = await Model.findOneAndUpdate(filter, writeData, findOptions)\n\n transform({ adapter: this, data: result, fields, globalSlug, operation: 'read' })\n\n return result\n}\n"],"names":["resolveBranchGlobalWrite","buildProjectionFromSelect","getGlobal","getSession","transform","updateGlobal","args","slug","globalSlug","branch","branchConflictData","data","options","optionsArgs","req","returning","select","globalConfig","Model","adapter","fields","operation","baseOptions","session","timestamps","findOptions","lean","projection","flattenedFields","returnDocument","writeBranch","isBranchableGlobal","payload","config","branching","branchableGlobals","has","filter","_branch","$eq","globalType","mainDoc","findOne","_id","__v","mainData","writeData","insertData","key","Object","keys","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WAAWxB;QACzC,OAAO;IACT;IAEA,MAAMmC,SAAc,MAAMvC,MAAMsC,gBAAgB,CAACnB,QAAQS,WAAWrB;IAEpErB,UAAU;QAAEe,SAAS,IAAI;QAAER,MAAM8C;QAAQrC;QAAQZ;QAAYa,WAAW;IAAO;IAE/E,OAAOoC;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateGlobalVersion.d.ts","sourceRoot":"","sources":["../src/updateGlobalVersion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAIlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAQjD,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EACzE,IAAI,EAAE,eAAe,EACrB,EACE,EAAE,EACF,MAAM,EAAE,UAAU,EAClB,MAAM,EACN,OAAO,EAAE,WAAgB,EACzB,GAAG,EACH,SAAS,EACT,MAAM,EACN,WAAW,EACX,KAAK,GACN,EAAE,uBAAuB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"updateGlobalVersion.d.ts","sourceRoot":"","sources":["../src/updateGlobalVersion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAIlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAQjD,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EACzE,IAAI,EAAE,eAAe,EACrB,EACE,EAAE,EACF,MAAM,EAAE,UAAU,EAClB,MAAM,EACN,OAAO,EAAE,WAAgB,EACzB,GAAG,EACH,SAAS,EACT,MAAM,EACN,WAAW,EACX,KAAK,GACN,EAAE,uBAAuB,CAAC,CAAC,CAAC,gBAkD9B"}
|