payload 1.11.5 → 1.11.7
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/admin/components/elements/ArrayAction/index.js +14 -13
- package/dist/admin/components/elements/ArrayAction/index.js.map +1 -1
- package/dist/admin/components/elements/ArrayAction/types.d.ts +1 -0
- package/dist/admin/components/forms/Form/fieldReducer.js +0 -4
- package/dist/admin/components/forms/Form/fieldReducer.js.map +1 -1
- package/dist/admin/components/forms/field-types/Array/ArrayRow.d.ts +1 -0
- package/dist/admin/components/forms/field-types/Array/ArrayRow.js +2 -2
- package/dist/admin/components/forms/field-types/Array/ArrayRow.js.map +1 -1
- package/dist/admin/components/forms/field-types/Array/index.js +7 -8
- package/dist/admin/components/forms/field-types/Array/index.js.map +1 -1
- package/dist/admin/components/forms/field-types/Blocks/BlockRow.d.ts +1 -0
- package/dist/admin/components/forms/field-types/Blocks/BlockRow.js +2 -2
- package/dist/admin/components/forms/field-types/Blocks/BlockRow.js.map +1 -1
- package/dist/admin/components/forms/field-types/Blocks/RowActions.d.ts +1 -0
- package/dist/admin/components/forms/field-types/Blocks/RowActions.js +2 -2
- package/dist/admin/components/forms/field-types/Blocks/RowActions.js.map +1 -1
- package/dist/admin/components/forms/field-types/Blocks/index.js +3 -5
- package/dist/admin/components/forms/field-types/Blocks/index.js.map +1 -1
- package/dist/admin/components/forms/useField/index.js +1 -3
- package/dist/admin/components/forms/useField/index.js.map +1 -1
- package/dist/admin/hooks/useThumbnail.js +9 -7
- package/dist/admin/hooks/useThumbnail.js.map +1 -1
- package/dist/auth/operations/forgotPassword.js +2 -1
- package/dist/auth/operations/forgotPassword.js.map +1 -1
- package/dist/auth/operations/local/forgotPassword.js +2 -0
- package/dist/auth/operations/local/forgotPassword.js.map +1 -1
- package/dist/auth/operations/local/login.js +2 -0
- package/dist/auth/operations/local/login.js.map +1 -1
- package/dist/auth/operations/local/resetPassword.js +2 -0
- package/dist/auth/operations/local/resetPassword.js.map +1 -1
- package/dist/auth/operations/local/unlock.js +2 -0
- package/dist/auth/operations/local/unlock.js.map +1 -1
- package/dist/auth/operations/login.js +5 -0
- package/dist/auth/operations/login.js.map +1 -1
- package/dist/auth/operations/logout.js +1 -0
- package/dist/auth/operations/logout.js.map +1 -1
- package/dist/auth/operations/me.js +1 -0
- package/dist/auth/operations/me.js.map +1 -1
- package/dist/auth/operations/refresh.js +2 -0
- package/dist/auth/operations/refresh.js.map +1 -1
- package/dist/bundlers/webpack/configs/dev.js +2 -2
- package/dist/bundlers/webpack/configs/dev.js.map +1 -1
- package/dist/bundlers/webpack/scripts/dev.js +2 -2
- package/dist/bundlers/webpack/scripts/dev.js.map +1 -1
- package/dist/collections/config/types.d.ts +16 -2
- package/dist/collections/operations/create.js +9 -0
- package/dist/collections/operations/create.js.map +1 -1
- package/dist/collections/operations/delete.js +5 -0
- package/dist/collections/operations/delete.js.map +1 -1
- package/dist/collections/operations/deleteByID.js +5 -1
- package/dist/collections/operations/deleteByID.js.map +1 -1
- package/dist/collections/operations/find.js +4 -2
- package/dist/collections/operations/find.js.map +1 -1
- package/dist/collections/operations/findByID.js +4 -0
- package/dist/collections/operations/findByID.js.map +1 -1
- package/dist/collections/operations/findVersionByID.js +3 -0
- package/dist/collections/operations/findVersionByID.js.map +1 -1
- package/dist/collections/operations/findVersions.js +3 -2
- package/dist/collections/operations/findVersions.js.map +1 -1
- package/dist/collections/operations/local/create.d.ts +5 -1
- package/dist/collections/operations/local/create.js +3 -1
- package/dist/collections/operations/local/create.js.map +1 -1
- package/dist/collections/operations/local/delete.d.ts +5 -0
- package/dist/collections/operations/local/delete.js +3 -1
- package/dist/collections/operations/local/delete.js.map +1 -1
- package/dist/collections/operations/local/find.d.ts +5 -1
- package/dist/collections/operations/local/find.js +3 -1
- package/dist/collections/operations/local/find.js.map +1 -1
- package/dist/collections/operations/local/findByID.d.ts +5 -1
- package/dist/collections/operations/local/findByID.js +3 -1
- package/dist/collections/operations/local/findByID.js.map +1 -1
- package/dist/collections/operations/local/findVersionByID.d.ts +6 -1
- package/dist/collections/operations/local/findVersionByID.js +3 -1
- package/dist/collections/operations/local/findVersionByID.js.map +1 -1
- package/dist/collections/operations/local/findVersions.d.ts +6 -0
- package/dist/collections/operations/local/findVersions.js +3 -1
- package/dist/collections/operations/local/findVersions.js.map +1 -1
- package/dist/collections/operations/local/restoreVersion.d.ts +6 -0
- package/dist/collections/operations/local/restoreVersion.js +3 -1
- package/dist/collections/operations/local/restoreVersion.js.map +1 -1
- package/dist/collections/operations/local/update.d.ts +5 -0
- package/dist/collections/operations/local/update.js +3 -1
- package/dist/collections/operations/local/update.js.map +1 -1
- package/dist/collections/operations/restoreVersion.js +4 -0
- package/dist/collections/operations/restoreVersion.js.map +1 -1
- package/dist/collections/operations/update.js +10 -0
- package/dist/collections/operations/update.js.map +1 -1
- package/dist/collections/operations/updateByID.js +10 -0
- package/dist/collections/operations/updateByID.js.map +1 -1
- package/dist/express/admin.js +1 -1
- package/dist/express/admin.js.map +1 -1
- package/dist/express/middleware/defaultPayload.d.ts +4 -0
- package/dist/express/middleware/defaultPayload.js +9 -0
- package/dist/express/middleware/defaultPayload.js.map +1 -0
- package/dist/express/middleware/errorHandler.js +2 -2
- package/dist/express/middleware/errorHandler.js.map +1 -1
- package/dist/express/middleware/index.js +2 -0
- package/dist/express/middleware/index.js.map +1 -1
- package/dist/express/setRequestContext.d.ts +6 -0
- package/dist/express/setRequestContext.js +22 -0
- package/dist/express/setRequestContext.js.map +1 -0
- package/dist/express/types.d.ts +10 -1
- package/dist/fields/config/types.d.ts +2 -1
- package/dist/fields/config/types.js.map +1 -1
- package/dist/fields/hooks/afterChange/index.d.ts +3 -2
- package/dist/fields/hooks/afterChange/index.js +2 -1
- package/dist/fields/hooks/afterChange/index.js.map +1 -1
- package/dist/fields/hooks/afterChange/promise.d.ts +3 -2
- package/dist/fields/hooks/afterChange/promise.js +8 -1
- package/dist/fields/hooks/afterChange/promise.js.map +1 -1
- package/dist/fields/hooks/afterChange/traverseFields.d.ts +3 -2
- package/dist/fields/hooks/afterChange/traverseFields.js +2 -1
- package/dist/fields/hooks/afterChange/traverseFields.js.map +1 -1
- package/dist/fields/hooks/afterRead/index.d.ts +2 -1
- package/dist/fields/hooks/afterRead/index.js +2 -1
- package/dist/fields/hooks/afterRead/index.js.map +1 -1
- package/dist/fields/hooks/afterRead/promise.d.ts +3 -2
- package/dist/fields/hooks/afterRead/promise.js +11 -1
- package/dist/fields/hooks/afterRead/promise.js.map +1 -1
- package/dist/fields/hooks/afterRead/traverseFields.d.ts +3 -2
- package/dist/fields/hooks/afterRead/traverseFields.js +2 -1
- package/dist/fields/hooks/afterRead/traverseFields.js.map +1 -1
- package/dist/fields/hooks/beforeChange/index.d.ts +3 -2
- package/dist/fields/hooks/beforeChange/index.js +2 -1
- package/dist/fields/hooks/beforeChange/index.js.map +1 -1
- package/dist/fields/hooks/beforeChange/promise.d.ts +3 -2
- package/dist/fields/hooks/beforeChange/promise.js +8 -1
- package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
- package/dist/fields/hooks/beforeChange/traverseFields.d.ts +3 -2
- package/dist/fields/hooks/beforeChange/traverseFields.js +2 -1
- package/dist/fields/hooks/beforeChange/traverseFields.js.map +1 -1
- package/dist/fields/hooks/beforeValidate/index.d.ts +3 -2
- package/dist/fields/hooks/beforeValidate/index.js +2 -1
- package/dist/fields/hooks/beforeValidate/index.js.map +1 -1
- package/dist/fields/hooks/beforeValidate/promise.d.ts +3 -2
- package/dist/fields/hooks/beforeValidate/promise.js +8 -1
- package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
- package/dist/fields/hooks/beforeValidate/traverseFields.d.ts +3 -2
- package/dist/fields/hooks/beforeValidate/traverseFields.js +2 -1
- package/dist/fields/hooks/beforeValidate/traverseFields.js.map +1 -1
- package/dist/globals/operations/findOne.js +1 -0
- package/dist/globals/operations/findOne.js.map +1 -1
- package/dist/globals/operations/findVersionByID.js +1 -0
- package/dist/globals/operations/findVersionByID.js.map +1 -1
- package/dist/globals/operations/findVersions.js +1 -0
- package/dist/globals/operations/findVersions.js.map +1 -1
- package/dist/globals/operations/local/findOne.js +2 -0
- package/dist/globals/operations/local/findOne.js.map +1 -1
- package/dist/globals/operations/local/findVersionByID.js +2 -0
- package/dist/globals/operations/local/findVersionByID.js.map +1 -1
- package/dist/globals/operations/local/findVersions.js +2 -0
- package/dist/globals/operations/local/findVersions.js.map +1 -1
- package/dist/globals/operations/local/restoreVersion.js +2 -0
- package/dist/globals/operations/local/restoreVersion.js.map +1 -1
- package/dist/globals/operations/local/update.js +2 -0
- package/dist/globals/operations/local/update.js.map +1 -1
- package/dist/globals/operations/restoreVersion.js +2 -0
- package/dist/globals/operations/restoreVersion.js.map +1 -1
- package/dist/globals/operations/update.js +5 -0
- package/dist/globals/operations/update.js.map +1 -1
- package/dist/graphql/errorHandler.js +1 -1
- package/dist/graphql/errorHandler.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js.map +1 -1
- package/dist/uploads/generateFileData.js +2 -2
- package/dist/uploads/generateFileData.js.map +1 -1
- package/dist/uploads/imageResizer.js +1 -1
- package/dist/uploads/imageResizer.js.map +1 -1
- package/dist/uploads/types.d.ts +1 -1
- package/docs/hooks/context.mdx +127 -0
- package/docs/local-api/overview.mdx +1 -0
- package/docs/upload/overview.mdx +1 -3
- package/package.json +1 -1
|
@@ -21,6 +21,7 @@ async function findByID(incomingArgs) {
|
|
|
21
21
|
args = (await hook({
|
|
22
22
|
args,
|
|
23
23
|
operation: 'read',
|
|
24
|
+
context: args.req.context,
|
|
24
25
|
})) || args;
|
|
25
26
|
}, Promise.resolve());
|
|
26
27
|
const { depth, collection: { Model, config: collectionConfig, }, id, req, req: { t, payload, }, disableErrors, currentDepth, overrideAccess = false, showHiddenFields, draft: draftEnabled = false, } = args;
|
|
@@ -91,6 +92,7 @@ async function findByID(incomingArgs) {
|
|
|
91
92
|
req,
|
|
92
93
|
query,
|
|
93
94
|
doc: result,
|
|
95
|
+
context: req.context,
|
|
94
96
|
}) || result;
|
|
95
97
|
}, Promise.resolve());
|
|
96
98
|
// /////////////////////////////////////
|
|
@@ -104,6 +106,7 @@ async function findByID(incomingArgs) {
|
|
|
104
106
|
overrideAccess,
|
|
105
107
|
req,
|
|
106
108
|
showHiddenFields,
|
|
109
|
+
context: req.context,
|
|
107
110
|
});
|
|
108
111
|
// /////////////////////////////////////
|
|
109
112
|
// afterRead - Collection
|
|
@@ -114,6 +117,7 @@ async function findByID(incomingArgs) {
|
|
|
114
117
|
req,
|
|
115
118
|
query,
|
|
116
119
|
doc: result,
|
|
120
|
+
context: req.context,
|
|
117
121
|
}) || result;
|
|
118
122
|
}, Promise.resolve());
|
|
119
123
|
// /////////////////////////////////////
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findByID.js","sourceRoot":"","sources":["../../../src/collections/operations/findByID.ts"],"names":[],"mappings":";;;;;AAAA,yCAAyC;AACzC,kEAAoC;AAGpC,oGAA4E;AAC5E,yCAAwC;AACxC,6EAAqD;AACrD,oHAA4F;AAC5F,4DAAyD;AAczD,KAAK,UAAU,QAAQ,CACrB,YAAuB;;IAEvB,IAAI,IAAI,GAAG,YAAY,CAAC;IAExB,wCAAwC;IACxC,+BAA+B;IAC/B,wCAAwC;IAExC,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE;QAClF,MAAM,SAAS,CAAC;QAEhB,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC;YACjB,IAAI;YACJ,SAAS,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"findByID.js","sourceRoot":"","sources":["../../../src/collections/operations/findByID.ts"],"names":[],"mappings":";;;;;AAAA,yCAAyC;AACzC,kEAAoC;AAGpC,oGAA4E;AAC5E,yCAAwC;AACxC,6EAAqD;AACrD,oHAA4F;AAC5F,4DAAyD;AAczD,KAAK,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MAAM,CAAC;AAChB,CAAC;AAED,kBAAe,QAAQ,CAAC"}
|
|
@@ -60,6 +60,7 @@ async function findVersionByID(args) {
|
|
|
60
60
|
req,
|
|
61
61
|
query,
|
|
62
62
|
doc: result.version,
|
|
63
|
+
context: req.context,
|
|
63
64
|
}) || result.version;
|
|
64
65
|
}, Promise.resolve());
|
|
65
66
|
// /////////////////////////////////////
|
|
@@ -73,6 +74,7 @@ async function findVersionByID(args) {
|
|
|
73
74
|
overrideAccess,
|
|
74
75
|
req,
|
|
75
76
|
showHiddenFields,
|
|
77
|
+
context: req.context,
|
|
76
78
|
});
|
|
77
79
|
// /////////////////////////////////////
|
|
78
80
|
// afterRead - Collection
|
|
@@ -83,6 +85,7 @@ async function findVersionByID(args) {
|
|
|
83
85
|
req,
|
|
84
86
|
query,
|
|
85
87
|
doc: result.version,
|
|
88
|
+
context: req.context,
|
|
86
89
|
}) || result.version;
|
|
87
90
|
}, Promise.resolve());
|
|
88
91
|
// /////////////////////////////////////
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findVersionByID.js","sourceRoot":"","sources":["../../../src/collections/operations/findVersionByID.ts"],"names":[],"mappings":";;;;;AAAA,yCAAyC;AACzC,8DAAqC;AAGrC,oGAA4E;AAC5E,yCAA6D;AAC7D,6EAAqD;AAErD,4DAAyD;AAazD,KAAK,UAAU,eAAe,CAAqC,IAAe;IAChF,MAAM,EACJ,KAAK,EACL,UAAU,EAAE,EACV,MAAM,EAAE,gBAAgB,GACzB,EACD,EAAE,EACF,GAAG,EACH,GAAG,EAAE,EACH,CAAC,EACD,OAAO,GACR,EACD,aAAa,EACb,YAAY,EACZ,cAAc,EACd,gBAAgB,GACjB,GAAG,IAAI,CAAC;IAET,IAAI,CAAC,EAAE,EAAE;QACP,MAAM,IAAI,iBAAQ,CAAC,wBAAwB,EAAE,qBAAU,CAAC,WAAW,CAAC,CAAC;KACtE;IAED,MAAM,aAAa,GAAG,CAAC,OAAO,CAAC,QAAQ,CA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AAC,MAAM,CAAC,CAAC;IAExC,wCAAwC;IACxC,0BAA0B;IAC1B,wCAAwC;IAExC,MAAM,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE;QACvE,MAAM,SAAS,CAAC;QAEhB,MAAM,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC;YAC1B,GAAG;YACH,KAAK;YACL,GAAG,EAAE,MAAM,CAAC,OAAO;
|
|
1
|
+
{"version":3,"file":"findVersionByID.js","sourceRoot":"","sources":["../../../src/collections/operations/findVersionByID.ts"],"names":[],"mappings":";;;;;AAAA,yCAAyC;AACzC,8DAAqC;AAGrC,oGAA4E;AAC5E,yCAA6D;AAC7D,6EAAqD;AAErD,4DAAyD;AAazD,KAAK,UAAU,eAAe,CAAqC,IAAe;IAChF,MAAM,EACJ,KAAK,EACL,UAAU,EAAE,EACV,MAAM,EAAE,gBAAgB,GACzB,EACD,EAAE,EACF,GAAG,EACH,GAAG,EAAE,EACH,CAAC,EACD,OAAO,GACR,EACD,aAAa,EACb,YAAY,EACZ,cAAc,EACd,gBAAgB,GACjB,GAAG,IAAI,CAAC;IAET,IAAI,CAAC,EAAE,EAAE;QACP,MAAM,IAAI,iBAAQ,CAAC,wBAAwB,EAAE,qBAAU,CAAC,WAAW,CAAC,CAAC;KACtE;IAED,MAAM,aAAa,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAoB,CAAC;IAEnF,wCAAwC;IACxC,SAAS;IACT,wCAAwC;IAExC,MAAM,aAAa,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,IAAA,uBAAa,EAAC,EAAE,GAAG,EAAE,aAAa,EAAE,EAAE,EAAE,EAAE,gBAAgB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAErI,gEAAgE;IAChE,IAAI,aAAa,KAAK,KAAK;QAAE,OA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,OAAO;SACrB,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC;IACvB,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAEtB,wCAAwC;IACxC,qBAAqB;IACrB,wCAAwC;IAExC,MAAM,CAAC,OAAO,GAAG,MAAM,IAAA,qBAAS,EAAC;QAC/B,YAAY;QACZ,KAAK;QACL,GAAG,EAAE,MAAM,CAAC,OAAO;QACnB,YAAY,EAAE,gBAAgB;QAC9B,cAAc;QACd,GAAG;QACH,gBAAgB;QAChB,OAAO,EAAE,GAAG,CAAC,OAAO;KACrB,CAAC,CAAC;IAEH,wCAAwC;IACxC,yBAAyB;IACzB,wCAAwC;IAExC,MAAM,gBAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE;QACtE,MAAM,SAAS,CAAC;QAEhB,MAAM,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC;YAC1B,GAAG;YACH,KAAK;YACL,GAAG,EAAE,MAAM,CAAC,OAAO;YACnB,OAAO,EAAE,GAAG,CAAC,OAAO;SACrB,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC;IACvB,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAEtB,wCAAwC;IACxC,iBAAiB;IACjB,wCAAwC;IAExC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,kBAAe,eAAe,CAAC"}
|
|
@@ -65,7 +65,7 @@ async function findVersions(args) {
|
|
|
65
65
|
const docRef = JSON.parse(docString);
|
|
66
66
|
await collectionConfig.hooks.beforeRead.reduce(async (priorHook, hook) => {
|
|
67
67
|
await priorHook;
|
|
68
|
-
docRef.version = await hook({ req, query, doc: docRef.version }) || docRef.version;
|
|
68
|
+
docRef.version = await hook({ req, query, doc: docRef.version, context: req.context }) || docRef.version;
|
|
69
69
|
}, Promise.resolve());
|
|
70
70
|
return docRef;
|
|
71
71
|
})),
|
|
@@ -85,6 +85,7 @@ async function findVersions(args) {
|
|
|
85
85
|
req,
|
|
86
86
|
showHiddenFields,
|
|
87
87
|
findMany: true,
|
|
88
|
+
context: req.context,
|
|
88
89
|
}),
|
|
89
90
|
}))),
|
|
90
91
|
};
|
|
@@ -97,7 +98,7 @@ async function findVersions(args) {
|
|
|
97
98
|
const docRef = doc;
|
|
98
99
|
await collectionConfig.hooks.afterRead.reduce(async (priorHook, hook) => {
|
|
99
100
|
await priorHook;
|
|
100
|
-
docRef.version = await hook({ req, query, doc: doc.version, findMany: true }) || doc.version;
|
|
101
|
+
docRef.version = await hook({ req, query, doc: doc.version, findMany: true, context: req.context }) || doc.version;
|
|
101
102
|
}, Promise.resolve());
|
|
102
103
|
return docRef;
|
|
103
104
|
})),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findVersions.js","sourceRoot":"","sources":["../../../src/collections/operations/findVersions.ts"],"names":[],"mappings":";;;;;AAEA,6EAAqD;AACrD,oGAA4E;AAE5E,sGAA8E;AAC9E,kEAA+D;AAG/D,4DAAyD;AACzD,gFAAoF;AAcpF,KAAK,UAAU,YAAY,CACzB,IAAe;IAEf,MAAM,EACJ,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,UAAU,EAAE,EACV,MAAM,EAAE,gBAAgB,GACzB,EACD,GAAG,EACH,GAAG,EAAE,EACH,MAAM,EACN,OAAO,GACR,EACD,cAAc,EACd,gBAAgB,GACjB,GAAG,IAAI,CAAC;IAET,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAoB,CAAC;IAEjF,wCAAwC;IACxC,SAAS;IACT,wCAAwC;IAExC,IAAI,iBAAiB,GAAG,KAAK,CAAC;IAE9B,IAAI,KAAK,EAAE;QACT,MAAM,WAAW,GAAG,IAAA,iCAAuB,EAAC,KAAK,CAAC,CAAC;QAEnD,iBAAiB,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE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AAa;QAChB,IAAI,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YACtC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAErC,MAAM,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE;gBACvE,MAAM,SAAS,CAAC;gBAEhB,MAAM,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"findVersions.js","sourceRoot":"","sources":["../../../src/collections/operations/findVersions.ts"],"names":[],"mappings":";;;;;AAEA,6EAAqD;AACrD,oGAA4E;AAE5E,sGAA8E;AAC9E,kEAA+D;AAG/D,4DAAyD;AACzD,gFAAoF;AAcpF,KAAK,UAAU,YAAY,CACzB,IAAe;IAEf,MAAM,EACJ,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,UAAU,EAAE,EACV,MAAM,EAAE,gBAAgB,GACzB,EACD,GAAG,EACH,GAAG,EAAE,EACH,MAAM,EACN,OAAO,GACR,EACD,cAAc,EACd,gBAAgB,GACjB,GAAG,IAAI,CAAC;IAET,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAoB,CAAC;IAEjF,wCAAwC;IACxC,SAAS;IACT,wCAAwC;IAExC,IAAI,iBAAiB,GAAG,KAAK,CAAC;IAE9B,IAAI,KAAK,EAAE;QACT,MAAM,WAAW,GAAG,IAAA,iCAAuB,EAAC,KAAK,CAAC,CAAC;QAEnD,iBAAiB,GAAG,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wCAAwC;IACxC,yBAAyB;IACzB,wCAAwC;IAExC,MAAM,GAAG;QACP,GAAG,MAAM;QACT,IAAI,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YACpD,MAAM,MAAM,GAAG,GAAG,CAAC;YAEnB,MAAM,gBAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE;gBACtE,MAAM,SAAS,CAAC;gBAEhB,MAAM,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC;YACrH,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;YAEtB,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;KACJ,CAAC;IAEF,wCAAwC;IACxC,iBAAiB;IACjB,wCAAwC;IAExC,MAAM,GAAG;QACP,GAAG,MAAM;QACT,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,gCAAsB,EAAI,GAAG,CAAC,CAAC;KAC/D,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,kBAAe,YAAY,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Config as GeneratedTypes } from 'payload/generated-types';
|
|
2
2
|
import { MarkOptional } from 'ts-essentials';
|
|
3
3
|
import { Payload } from '../../../payload';
|
|
4
|
-
import { PayloadRequest } from '../../../express/types';
|
|
4
|
+
import { PayloadRequest, RequestContext } from '../../../express/types';
|
|
5
5
|
import { Document } from '../../../types';
|
|
6
6
|
import { File } from '../../../uploads/types';
|
|
7
7
|
export type Options<TSlug extends keyof GeneratedTypes['collections']> = {
|
|
@@ -19,5 +19,9 @@ export type Options<TSlug extends keyof GeneratedTypes['collections']> = {
|
|
|
19
19
|
overwriteExistingFiles?: boolean;
|
|
20
20
|
req?: PayloadRequest;
|
|
21
21
|
draft?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* context, which will then be passed to req.context, which can be read by hooks
|
|
24
|
+
*/
|
|
25
|
+
context?: RequestContext;
|
|
22
26
|
};
|
|
23
27
|
export default function createLocal<TSlug extends keyof GeneratedTypes['collections']>(payload: Payload, options: Options<TSlug>): Promise<GeneratedTypes['collections'][TSlug]>;
|
|
@@ -8,9 +8,11 @@ const create_1 = __importDefault(require("../create"));
|
|
|
8
8
|
const dataloader_1 = require("../../dataloader");
|
|
9
9
|
const init_1 = __importDefault(require("../../../translations/init"));
|
|
10
10
|
const errors_1 = require("../../../errors");
|
|
11
|
+
const setRequestContext_1 = require("../../../express/setRequestContext");
|
|
11
12
|
async function createLocal(payload, options) {
|
|
12
13
|
var _a, _b, _c, _d, _e;
|
|
13
|
-
const { collection: collectionSlug, depth, locale = null, fallbackLocale = null, data, user, overrideAccess = true, disableVerificationEmail, showHiddenFields, filePath, file, overwriteExistingFiles = false, req = {}, draft, } = options;
|
|
14
|
+
const { collection: collectionSlug, depth, locale = null, fallbackLocale = null, data, user, overrideAccess = true, disableVerificationEmail, showHiddenFields, filePath, file, overwriteExistingFiles = false, req = {}, draft, context, } = options;
|
|
15
|
+
(0, setRequestContext_1.setRequestContext)(req, context);
|
|
14
16
|
const collection = payload.collections[collectionSlug];
|
|
15
17
|
const defaultLocale = ((_a = payload === null || payload === void 0 ? void 0 : payload.config) === null || _a === void 0 ? void 0 : _a.localization) ? (_c = (_b = payload === null || payload === void 0 ? void 0 : payload.config) === null || _b === void 0 ? void 0 : _b.localization) === null || _c === void 0 ? void 0 : _c.defaultLocale : null;
|
|
16
18
|
if (!collection) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/create.ts"],"names":[],"mappings":";;;;;AAMA,mFAA2D;AAC3D,uDAA+B;AAC/B,iDAAiD;AAEjD,sEAA8C;AAC9C,4CAA2C;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/create.ts"],"names":[],"mappings":";;;;;AAMA,mFAA2D;AAC3D,uDAA+B;AAC/B,iDAAiD;AAEjD,sEAA8C;AAC9C,4CAA2C;AAC3C,0EAAuE;AAuBxD,KAAK,UAAU,WAAW,CACvC,OAAgB,EAChB,OAAuB;;IAEvB,MAAM,EACJ,UAAU,EAAE,cAAc,EAC1B,KAAK,EACL,MAAM,GAAG,IAAI,EACb,cAAc,GAAG,IAAI,EACrB,IAAI,EACJ,IAAI,EACJ,cAAc,GAAG,IAAI,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,QAAQ,EACR,IAAI,EACJ,sBAAsB,GAAG,KAAK,EAC9B,GAAG,GAAG,EAAoB,EAC1B,KAAK,EACL,OAAO,GACR,GAAG,OAAO,CAAC;IACZ,IAAA,qCAAiB,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAEhC,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,0CAAE,YAAY,EAAC,CAAC,CAAC,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,0CAAE,YAAY,0CAAE,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC;IAE1G,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,iBAAQ,CAAC,4BAA4B,MAAM,CAAC,cAAc,CAAC,oCAAoC,CAAC,CAAC;KAC5G;IAED,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,IAAI,OAAO,CAAC;IAC3C,GAAG,CAAC,MAAM,GAAG,MAAA,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,mCAAI,aAAa,CAAC;IACpD,GAAG,CAAC,cAAc,GAAG,MAAA,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,cAAc,mCAAI,aAAa,CAAC;IAC5E,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;IACtB,GAAG,CAAC,IAAI,GAAG,IAAA,cAAI,EAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrC,GAAG,CAAC,KAAK,GAAG;QACV,IAAI,EAAE,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,CAAC,MAAM,IAAA,uBAAa,EAAC,QAAQ,CAAC,CAAC,CAAiB;KAChE,CAAC;IAEF,IAAI,OAAO,IAAI,KAAK,WAAW;QAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;IAEjD,IAAI,CAAC,GAAG,CAAC,CAAC;QAAE,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/B,IAAI,CAAC,GAAG,CAAC,iBAAiB;QAAE,GAAG,CAAC,iBAAiB,GAAG,IAAA,0BAAa,EAAC,GAAG,CAAC,CAAC;IAEvE,OAAO,IAAA,gBAAM,EAAQ;QACnB,KAAK;QACL,IAAI;QACJ,UAAU;QACV,cAAc;QACd,wBAAwB;QACxB,gBAAgB;QAChB,sBAAsB;QACtB,KAAK;QACL,GAAG;KACJ,CAAC,CAAC;AACL,CAAC;AAvDD,8BAuDC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Config as GeneratedTypes } from '../../../generated-types';
|
|
2
2
|
import { Document, Where } from '../../../types';
|
|
3
|
+
import { RequestContext } from '../../../express/types';
|
|
3
4
|
import { Payload } from '../../../payload';
|
|
4
5
|
import { BulkOperationResult } from '../../config/types';
|
|
5
6
|
export type BaseOptions<T extends keyof GeneratedTypes['collections']> = {
|
|
@@ -10,6 +11,10 @@ export type BaseOptions<T extends keyof GeneratedTypes['collections']> = {
|
|
|
10
11
|
user?: Document;
|
|
11
12
|
overrideAccess?: boolean;
|
|
12
13
|
showHiddenFields?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* context, which will then be passed to req.context, which can be read by hooks
|
|
16
|
+
*/
|
|
17
|
+
context?: RequestContext;
|
|
13
18
|
};
|
|
14
19
|
export type ByIDOptions<T extends keyof GeneratedTypes['collections']> = BaseOptions<T> & {
|
|
15
20
|
id: string | number;
|
|
@@ -8,9 +8,10 @@ const deleteByID_1 = __importDefault(require("../deleteByID"));
|
|
|
8
8
|
const dataloader_1 = require("../../dataloader");
|
|
9
9
|
const init_1 = __importDefault(require("../../../translations/init"));
|
|
10
10
|
const errors_1 = require("../../../errors");
|
|
11
|
+
const setRequestContext_1 = require("../../../express/setRequestContext");
|
|
11
12
|
async function deleteLocal(payload, options) {
|
|
12
13
|
var _a, _b, _c;
|
|
13
|
-
const { collection: collectionSlug, depth, id, where, locale = null, fallbackLocale = null, user, overrideAccess = true, showHiddenFields, } = options;
|
|
14
|
+
const { collection: collectionSlug, depth, id, where, locale = null, fallbackLocale = null, user, overrideAccess = true, showHiddenFields, context, } = options;
|
|
14
15
|
const collection = payload.collections[collectionSlug];
|
|
15
16
|
const defaultLocale = ((_a = payload === null || payload === void 0 ? void 0 : payload.config) === null || _a === void 0 ? void 0 : _a.localization) ? (_c = (_b = payload === null || payload === void 0 ? void 0 : payload.config) === null || _b === void 0 ? void 0 : _b.localization) === null || _c === void 0 ? void 0 : _c.defaultLocale : null;
|
|
16
17
|
if (!collection) {
|
|
@@ -24,6 +25,7 @@ async function deleteLocal(payload, options) {
|
|
|
24
25
|
payload,
|
|
25
26
|
i18n: (0, init_1.default)(payload.config.i18n),
|
|
26
27
|
};
|
|
28
|
+
(0, setRequestContext_1.setRequestContext)(req, context);
|
|
27
29
|
if (!req.t)
|
|
28
30
|
req.t = req.i18n.t;
|
|
29
31
|
if (!req.payloadDataLoader)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/delete.ts"],"names":[],"mappings":";;;;;AAIA,uDAAwC;AACxC,+DAAuC;AACvC,iDAAiD;AACjD,sEAA8C;AAC9C,4CAA2C;
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/delete.ts"],"names":[],"mappings":";;;;;AAIA,uDAAwC;AACxC,+DAAuC;AACvC,iDAAiD;AACjD,sEAA8C;AAC9C,4CAA2C;AAE3C,0EAAuE;AA+BvE,KAAK,UAAU,WAAW,CAAoD,OAAgB,EAAE,OAAuB;;IACrH,MAAM,EACJ,UAAU,EAAE,cAAc,EAC1B,KAAK,EACL,EAAE,EACF,KAAK,EACL,MAAM,GAAG,IAAI,EACb,cAAc,GAAG,IAAI,EACrB,IAAI,EACJ,cAAc,GAAG,IAAI,EACrB,gBAAgB,EAChB,OAAO,GACR,GAAG,OAAO,CAAC;IAEZ,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,0CAAE,YAAY,EAAC,CAAC,CAAC,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,0CAAE,YAAY,0CAAE,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC;IAG1G,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,iBAAQ,CAAC,4BAA4B,MAAM,CAAC,cAAc,CAAC,oCAAoC,CAAC,CAAC;KAC5G;IAED,MAAM,GAAG,GAAG;QACV,IAAI;QACJ,UAAU,EAAE,OAAO;QACnB,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,aAAa;QAC/B,cAAc,EAAE,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,aAAa;QAC/C,OAAO;QACP,IAAI,EAAE,IAAA,cAAI,EAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;KACd,CAAC;IACpB,IAAA,qCAAiB,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAEhC,IAAI,CAAC,GAAG,CAAC,CAAC;QAAE,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/B,IAAI,CAAC,GAAG,CAAC,iBAAiB;QAAE,GAAG,CAAC,iBAAiB,GAAG,IAAA,0BAAa,EAAC,GAAG,CAAC,CAAC;IAEvE,MAAM,IAAI,GAAG;QACX,KAAK;QACL,EAAE;QACF,KAAK;QACL,UAAU;QACV,cAAc;QACd,gBAAgB;QAChB,GAAG;KACJ,CAAC;IAEF,IAAI,OAAO,CAAC,EAAE,EAAE;QACd,OAAO,IAAA,oBAAU,EAAQ,IAAI,CAAC,CAAC;KAChC;IACD,OAAO,IAAA,gBAAe,EAAQ,IAAI,CAAC,CAAC;AACtC,CAAC;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { Config as GeneratedTypes } from 'payload/generated-types';
|
|
|
2
2
|
import { PaginatedDocs } from '../../../mongoose/types';
|
|
3
3
|
import { Document, Where } from '../../../types';
|
|
4
4
|
import { Payload } from '../../../payload';
|
|
5
|
-
import { PayloadRequest } from '../../../express/types';
|
|
5
|
+
import { PayloadRequest, RequestContext } from '../../../express/types';
|
|
6
6
|
export type Options<T extends keyof GeneratedTypes['collections']> = {
|
|
7
7
|
collection: T;
|
|
8
8
|
depth?: number;
|
|
@@ -20,5 +20,9 @@ export type Options<T extends keyof GeneratedTypes['collections']> = {
|
|
|
20
20
|
where?: Where;
|
|
21
21
|
draft?: boolean;
|
|
22
22
|
req?: PayloadRequest;
|
|
23
|
+
/**
|
|
24
|
+
* context, which will then be passed to req.context, which can be read by hooks
|
|
25
|
+
*/
|
|
26
|
+
context?: RequestContext;
|
|
23
27
|
};
|
|
24
28
|
export default function findLocal<T extends keyof GeneratedTypes['collections']>(payload: Payload, options: Options<T>): Promise<PaginatedDocs<GeneratedTypes['collections'][T]>>;
|
|
@@ -7,9 +7,11 @@ const find_1 = __importDefault(require("../find"));
|
|
|
7
7
|
const dataloader_1 = require("../../dataloader");
|
|
8
8
|
const init_1 = __importDefault(require("../../../translations/init"));
|
|
9
9
|
const errors_1 = require("../../../errors");
|
|
10
|
+
const setRequestContext_1 = require("../../../express/setRequestContext");
|
|
10
11
|
async function findLocal(payload, options) {
|
|
11
12
|
var _a, _b, _c, _d, _e;
|
|
12
|
-
const { collection: collectionSlug, depth, currentDepth, page, limit, where, locale = null, fallbackLocale = null, user, overrideAccess = true, disableErrors, showHiddenFields, sort, draft = false, pagination = true, req = {}, } = options;
|
|
13
|
+
const { collection: collectionSlug, depth, currentDepth, page, limit, where, locale = null, fallbackLocale = null, user, overrideAccess = true, disableErrors, showHiddenFields, sort, draft = false, pagination = true, req = {}, context, } = options;
|
|
14
|
+
(0, setRequestContext_1.setRequestContext)(options.req, context);
|
|
13
15
|
const collection = payload.collections[collectionSlug];
|
|
14
16
|
const defaultLocale = ((_a = payload === null || payload === void 0 ? void 0 : payload.config) === null || _a === void 0 ? void 0 : _a.localization) ? (_c = (_b = payload === null || payload === void 0 ? void 0 : payload.config) === null || _b === void 0 ? void 0 : _b.localization) === null || _c === void 0 ? void 0 : _c.defaultLocale : null;
|
|
15
17
|
if (!collection) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/find.ts"],"names":[],"mappings":";;;;;AAKA,mDAA2B;AAC3B,iDAAiD;AACjD,sEAA8C;AAC9C,4CAA2C;
|
|
1
|
+
{"version":3,"file":"find.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/find.ts"],"names":[],"mappings":";;;;;AAKA,mDAA2B;AAC3B,iDAAiD;AACjD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C;IAC5E,GAAG,CAAC,IAAI,GAAG,IAAA,cAAI,EAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrC,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;IAEtB,IAAI,CAAC,GAAG,CAAC,CAAC;QAAE,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/B,IAAI,CAAC,GAAG,CAAC,iBAAiB;QAAE,GAAG,CAAC,iBAAiB,GAAG,IAAA,0BAAa,EAAC,GAAG,CAAC,CAAC;IAEvE,IAAI,OAAO,IAAI,KAAK,WAAW;QAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;IAEjD,OAAO,IAAA,cAAI,EAAmC;QAC5C,KAAK;QACL,YAAY;QACZ,IAAI;QACJ,IAAI;QACJ,KAAK;QACL,KAAK;QACL,UAAU;QACV,cAAc;QACd,aAAa;QACb,gBAAgB;QAChB,KAAK;QACL,UAAU;QACV,GAAG;KACJ,CAAC,CAAC;AACL,CAAC;AA1DD,4BA0DC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Config as GeneratedTypes } from 'payload/generated-types';
|
|
2
|
-
import { PayloadRequest } from '../../../express/types';
|
|
2
|
+
import { PayloadRequest, RequestContext } from '../../../express/types';
|
|
3
3
|
import { Document } from '../../../types';
|
|
4
4
|
import { Payload } from '../../../payload';
|
|
5
5
|
export type Options<T extends keyof GeneratedTypes['collections']> = {
|
|
@@ -15,5 +15,9 @@ export type Options<T extends keyof GeneratedTypes['collections']> = {
|
|
|
15
15
|
disableErrors?: boolean;
|
|
16
16
|
req?: PayloadRequest;
|
|
17
17
|
draft?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* context, which will then be passed to req.context, which can be read by hooks
|
|
20
|
+
*/
|
|
21
|
+
context?: RequestContext;
|
|
18
22
|
};
|
|
19
23
|
export default function findByIDLocal<T extends keyof GeneratedTypes['collections']>(payload: Payload, options: Options<T>): Promise<GeneratedTypes['collections'][T]>;
|
|
@@ -7,9 +7,11 @@ const findByID_1 = __importDefault(require("../findByID"));
|
|
|
7
7
|
const dataloader_1 = require("../../dataloader");
|
|
8
8
|
const init_1 = __importDefault(require("../../../translations/init"));
|
|
9
9
|
const errors_1 = require("../../../errors");
|
|
10
|
+
const setRequestContext_1 = require("../../../express/setRequestContext");
|
|
10
11
|
async function findByIDLocal(payload, options) {
|
|
11
12
|
var _a, _b, _c, _d, _e;
|
|
12
|
-
const { collection: collectionSlug, depth, currentDepth, id, locale = null, fallbackLocale = null, user, overrideAccess = true, disableErrors = false, showHiddenFields, req = {}, draft = false, } = options;
|
|
13
|
+
const { collection: collectionSlug, depth, currentDepth, id, locale = null, fallbackLocale = null, user, overrideAccess = true, disableErrors = false, showHiddenFields, req = {}, draft = false, context, } = options;
|
|
14
|
+
(0, setRequestContext_1.setRequestContext)(options.req, context);
|
|
13
15
|
const collection = payload.collections[collectionSlug];
|
|
14
16
|
const defaultLocale = ((_a = payload === null || payload === void 0 ? void 0 : payload.config) === null || _a === void 0 ? void 0 : _a.localization) ? (_c = (_b = payload === null || payload === void 0 ? void 0 : payload.config) === null || _b === void 0 ? void 0 : _b.localization) === null || _c === void 0 ? void 0 : _c.defaultLocale : null;
|
|
15
17
|
if (!collection) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findByID.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/findByID.ts"],"names":[],"mappings":";;;;;AAGA,2DAAmC;AAEnC,iDAAiD;AACjD,sEAA8C;AAC9C,4CAA2C;
|
|
1
|
+
{"version":3,"file":"findByID.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/findByID.ts"],"names":[],"mappings":";;;;;AAGA,2DAAmC;AAEnC,iDAAiD;AACjD,sEAA8C;AAC9C,4CAA2C;AAC3C,0EAAuE;AAqBxD,KAAK,UAAU,aAAa,CACzC,OAAgB,EAChB,OAAmB;;IAEnB,MAAM,EACJ,UAAU,EAAE,cAAc,EAC1B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CAAC,IAAI,GAAG,IAAI,CAAC;IAEjD,IAAI,CAAC,GAAG,CAAC,CAAC;QAAE,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/B,IAAI,CAAC,GAAG,CAAC,iBAAiB;QAAE,GAAG,CAAC,iBAAiB,GAAG,IAAA,0BAAa,EAAC,GAAG,CAAC,CAAC;IAEvE,OAAO,IAAA,kBAAQ,EAAmC;QAChD,KAAK;QACL,YAAY;QACZ,EAAE;QACF,UAAU;QACV,cAAc;QACd,aAAa;QACb,gBAAgB;QAChB,GAAG;QACH,KAAK;KACN,CAAC,CAAC;AACL,CAAC;AAlDD,gCAkDC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Config as GeneratedTypes } from 'payload/generated-types';
|
|
2
2
|
import { Payload } from '../../../payload';
|
|
3
3
|
import { Document } from '../../../types';
|
|
4
|
-
import { PayloadRequest } from '../../../express/types';
|
|
4
|
+
import { PayloadRequest, RequestContext } from '../../../express/types';
|
|
5
5
|
import { TypeWithVersion } from '../../../versions/types';
|
|
6
6
|
export type Options<T extends keyof GeneratedTypes['collections']> = {
|
|
7
7
|
collection: T;
|
|
@@ -14,5 +14,10 @@ export type Options<T extends keyof GeneratedTypes['collections']> = {
|
|
|
14
14
|
showHiddenFields?: boolean;
|
|
15
15
|
disableErrors?: boolean;
|
|
16
16
|
req?: PayloadRequest;
|
|
17
|
+
draft?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* context, which will then be passed to req.context, which can be read by hooks
|
|
20
|
+
*/
|
|
21
|
+
context?: RequestContext;
|
|
17
22
|
};
|
|
18
23
|
export default function findVersionByIDLocal<T extends keyof GeneratedTypes['collections']>(payload: Payload, options: Options<T>): Promise<TypeWithVersion<GeneratedTypes['collections'][T]>>;
|
|
@@ -7,9 +7,11 @@ const findVersionByID_1 = __importDefault(require("../findVersionByID"));
|
|
|
7
7
|
const dataloader_1 = require("../../dataloader");
|
|
8
8
|
const init_1 = __importDefault(require("../../../translations/init"));
|
|
9
9
|
const errors_1 = require("../../../errors");
|
|
10
|
+
const setRequestContext_1 = require("../../../express/setRequestContext");
|
|
10
11
|
async function findVersionByIDLocal(payload, options) {
|
|
11
12
|
var _a, _b, _c, _d, _e;
|
|
12
|
-
const { collection: collectionSlug, depth, id, locale = null, fallbackLocale = null, overrideAccess = true, disableErrors = false, showHiddenFields, req = {}, } = options;
|
|
13
|
+
const { collection: collectionSlug, depth, id, locale = null, fallbackLocale = null, overrideAccess = true, disableErrors = false, showHiddenFields, req = {}, context, } = options;
|
|
14
|
+
(0, setRequestContext_1.setRequestContext)(options.req, context);
|
|
13
15
|
const collection = payload.collections[collectionSlug];
|
|
14
16
|
const defaultLocale = ((_a = payload === null || payload === void 0 ? void 0 : payload.config) === null || _a === void 0 ? void 0 : _a.localization) ? (_c = (_b = payload === null || payload === void 0 ? void 0 : payload.config) === null || _b === void 0 ? void 0 : _b.localization) === null || _c === void 0 ? void 0 : _c.defaultLocale : null;
|
|
15
17
|
if (!collection) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findVersionByID.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/findVersionByID.ts"],"names":[],"mappings":";;;;;AAKA,yEAAiD;AACjD,iDAAiD;AACjD,sEAA8C;AAC9C,4CAA2C;
|
|
1
|
+
{"version":3,"file":"findVersionByID.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/findVersionByID.ts"],"names":[],"mappings":";;;;;AAKA,yEAAiD;AACjD,iDAAiD;AACjD,sEAA8C;AAC9C,4CAA2C;AAC3C,0EAAuE;AAoBxD,KAAK,UAAU,oBAAoB,CAChD,OAAgB,EAChB,OAAmB;;IAEnB,MAAM,EACJ,UAAU,EAAE,cAAc,EAC1B,KAAK,EACL,EAAE,EACF,MAAM,GAAG,IAAI,EACb,cAAc,GAAG,IAAI,EACrB,cAAc,GAAG,IAAI,EACrB,aAAa,GAAG,KAAK,EACrB,gBAAgB,EAChB,GA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,yBAAe,EAAC;QACrB,KAAK;QACL,EAAE;QACF,UAAU;QACV,cAAc;QACd,aAAa;QACb,gBAAgB;QAChB,GAAG;KACJ,CAAC,CAAC;AACL,CAAC;AA3CD,uCA2CC"}
|
|
@@ -3,6 +3,7 @@ import { Payload } from '../../../payload';
|
|
|
3
3
|
import { Document, Where } from '../../../types';
|
|
4
4
|
import { PaginatedDocs } from '../../../mongoose/types';
|
|
5
5
|
import { TypeWithVersion } from '../../../versions/types';
|
|
6
|
+
import { RequestContext } from '../../../express/types';
|
|
6
7
|
export type Options<T extends keyof GeneratedTypes['collections']> = {
|
|
7
8
|
collection: T;
|
|
8
9
|
depth?: number;
|
|
@@ -15,5 +16,10 @@ export type Options<T extends keyof GeneratedTypes['collections']> = {
|
|
|
15
16
|
showHiddenFields?: boolean;
|
|
16
17
|
sort?: string;
|
|
17
18
|
where?: Where;
|
|
19
|
+
draft?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* context, which will then be passed to req.context, which can be read by hooks
|
|
22
|
+
*/
|
|
23
|
+
context?: RequestContext;
|
|
18
24
|
};
|
|
19
25
|
export default function findVersionsLocal<T extends keyof GeneratedTypes['collections']>(payload: Payload, options: Options<T>): Promise<PaginatedDocs<TypeWithVersion<GeneratedTypes['collections'][T]>>>;
|
|
@@ -7,9 +7,10 @@ const findVersions_1 = __importDefault(require("../findVersions"));
|
|
|
7
7
|
const dataloader_1 = require("../../dataloader");
|
|
8
8
|
const init_1 = __importDefault(require("../../../translations/init"));
|
|
9
9
|
const errors_1 = require("../../../errors");
|
|
10
|
+
const setRequestContext_1 = require("../../../express/setRequestContext");
|
|
10
11
|
async function findVersionsLocal(payload, options) {
|
|
11
12
|
var _a, _b, _c;
|
|
12
|
-
const { collection: collectionSlug, depth, page, limit, where, locale = null, fallbackLocale = null, user, overrideAccess = true, showHiddenFields, sort, } = options;
|
|
13
|
+
const { collection: collectionSlug, depth, page, limit, where, locale = null, fallbackLocale = null, user, overrideAccess = true, showHiddenFields, sort, context, } = options;
|
|
13
14
|
const collection = payload.collections[collectionSlug];
|
|
14
15
|
const defaultLocale = ((_a = payload === null || payload === void 0 ? void 0 : payload.config) === null || _a === void 0 ? void 0 : _a.localization) ? (_c = (_b = payload === null || payload === void 0 ? void 0 : payload.config) === null || _b === void 0 ? void 0 : _b.localization) === null || _c === void 0 ? void 0 : _c.defaultLocale : null;
|
|
15
16
|
if (!collection) {
|
|
@@ -24,6 +25,7 @@ async function findVersionsLocal(payload, options) {
|
|
|
24
25
|
payload,
|
|
25
26
|
i18n,
|
|
26
27
|
};
|
|
28
|
+
(0, setRequestContext_1.setRequestContext)(req, context);
|
|
27
29
|
if (!req.t)
|
|
28
30
|
req.t = req.i18n.t;
|
|
29
31
|
if (!req.payloadDataLoader)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findVersions.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/findVersions.ts"],"names":[],"mappings":";;;;;AAMA,mEAA2C;AAC3C,iDAAiD;AACjD,sEAAkD;AAClD,4CAA2C;
|
|
1
|
+
{"version":3,"file":"findVersions.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/findVersions.ts"],"names":[],"mappings":";;;;;AAMA,mEAA2C;AAC3C,iDAAiD;AACjD,sEAAkD;AAClD,4CAA2C;AAC3C,0EAAuE;AAqBxD,KAAK,UAAU,iBAAiB,CAC7C,OAAgB,EAChB,OAAmB;;IAEnB,MAAM,EACJ,UAAU,EAAE,cAAc,EAC1B,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,MAAM,GAAG,IAAI,EACb,cAAc,GAAG,IAAI,EACrB,IAAI,EACJ,cAAc,GAAG,IAAI,EACrB,gBAAgB,EAChB,IAAI,EACJ,OAAO,GACR,GAAG,OAAO,CAAC;IAEZ,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,0CAAE,YAAY,EAAC,CAAC,CAAC,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,0CAAE,YAAY,0CAAE,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC;IAE1G,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,iBAAQ,CAAC,4BAA4B,MAAM,CAAC,cAAc,CAAC,2CAA2C,CAAC,CAAC;KACnH;IAED,MAAM,IAAI,GAAG,IAAA,cAAQ,EAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,GAAG,GAAG;QACV,IAAI;QACJ,UAAU,EAAE,OAAO;QACnB,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,aAAa;QAC/B,cAAc,EAAE,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,aAAa;QAC/C,OAAO;QACP,IAAI;KACa,CAAC;IACpB,IAAA,qCAAiB,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAEhC,IAAI,CAAC,GAAG,CAAC,CAAC;QAAE,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/B,IAAI,CAAC,GAAG,CAAC,iBAAiB;QAAE,GAAG,CAAC,iBAAiB,GAAG,IAAA,0BAAa,EAAC,GAAG,CAAC,CAAC;IAEvE,OAAO,IAAA,sBAAY,EAAC;QAClB,KAAK;QACL,IAAI;QACJ,KAAK;QACL,KAAK;QACL,UAAU;QACV,IAAI;QACJ,cAAc;QACd,gBAAgB;QAChB,GAAG;KACJ,CAAC,CAAC;AACL,CAAC;AAnDD,oCAmDC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Config as GeneratedTypes } from 'payload/generated-types';
|
|
2
2
|
import { Payload } from '../../../payload';
|
|
3
|
+
import { RequestContext } from '../../../express/types';
|
|
3
4
|
import { Document } from '../../../types';
|
|
4
5
|
export type Options<T extends keyof GeneratedTypes['collections']> = {
|
|
5
6
|
collection: T;
|
|
@@ -10,5 +11,10 @@ export type Options<T extends keyof GeneratedTypes['collections']> = {
|
|
|
10
11
|
user?: Document;
|
|
11
12
|
overrideAccess?: boolean;
|
|
12
13
|
showHiddenFields?: boolean;
|
|
14
|
+
draft?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* context, which will then be passed to req.context, which can be read by hooks
|
|
17
|
+
*/
|
|
18
|
+
context?: RequestContext;
|
|
13
19
|
};
|
|
14
20
|
export default function restoreVersionLocal<T extends keyof GeneratedTypes['collections']>(payload: Payload, options: Options<T>): Promise<GeneratedTypes['collections'][T]>;
|
|
@@ -7,9 +7,10 @@ const dataloader_1 = require("../../dataloader");
|
|
|
7
7
|
const restoreVersion_1 = __importDefault(require("../restoreVersion"));
|
|
8
8
|
const init_1 = __importDefault(require("../../../translations/init"));
|
|
9
9
|
const errors_1 = require("../../../errors");
|
|
10
|
+
const setRequestContext_1 = require("../../../express/setRequestContext");
|
|
10
11
|
async function restoreVersionLocal(payload, options) {
|
|
11
12
|
var _a;
|
|
12
|
-
const { collection: collectionSlug, depth, locale = payload.config.localization ? (_a = payload.config.localization) === null || _a === void 0 ? void 0 : _a.defaultLocale : null, fallbackLocale = null, id, user, overrideAccess = true, showHiddenFields, } = options;
|
|
13
|
+
const { collection: collectionSlug, depth, locale = payload.config.localization ? (_a = payload.config.localization) === null || _a === void 0 ? void 0 : _a.defaultLocale : null, fallbackLocale = null, id, user, overrideAccess = true, showHiddenFields, context, } = options;
|
|
13
14
|
const collection = payload.collections[collectionSlug];
|
|
14
15
|
if (!collection) {
|
|
15
16
|
throw new errors_1.APIError(`The collection with slug ${String(collectionSlug)} can't be found. Restore Version Operation.`);
|
|
@@ -24,6 +25,7 @@ async function restoreVersionLocal(payload, options) {
|
|
|
24
25
|
i18n,
|
|
25
26
|
t: i18n.t,
|
|
26
27
|
};
|
|
28
|
+
(0, setRequestContext_1.setRequestContext)(req, context);
|
|
27
29
|
if (!req.payloadDataLoader)
|
|
28
30
|
req.payloadDataLoader = (0, dataloader_1.getDataLoader)(req);
|
|
29
31
|
const args = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restoreVersion.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/restoreVersion.ts"],"names":[],"mappings":";;;;;AAIA,iDAAiD;AACjD,uEAA+C;AAC/C,sEAAkD;AAClD,4CAA2C;
|
|
1
|
+
{"version":3,"file":"restoreVersion.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/restoreVersion.ts"],"names":[],"mappings":";;;;;AAIA,iDAAiD;AACjD,uEAA+C;AAC/C,sEAAkD;AAClD,4CAA2C;AAC3C,0EAAuE;AAkBxD,KAAK,UAAU,mBAAmB,CAC/C,OAAgB,EAChB,OAAmB;;IAEnB,MAAM,EACJ,UAAU,EAAE,cAAc,EAC1B,KAAK,EACL,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,MAAA,OAAO,CAAC,MAAM,CAAC,YAAY,0CAAE,aAAa,CAAC,CAAC,CAAC,IAAI,EACxF,cAAc,GAAG,IAAI,EACrB,EAAE,EACF,IAAI,EACJ,cAAc,GAAG,IAAI,EACrB,gBAAgB,EAChB,OAAO,GACR,GAAG,OAAO,CAAC;IAEZ,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAEvD,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,iBAAQ,CAAC,4BAA4B,MAAM,CAAC,cAAc,CAAC,6CAA6C,CAAC,CAAC;KACrH;IAED,MAAM,IAAI,GAAG,IAAA,cAAQ,EAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,GAAG,GAAG;QACV,IAAI;QACJ,UAAU,EAAE,OAAO;QACnB,MAAM;QACN,cAAc;QACd,OAAO;QACP,IAAI;QACJ,CAAC,EAAE,IAAI,CAAC,CAAC;KACQ,CAAC;IACpB,IAAA,qCAAiB,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAEhC,IAAI,CAAC,GAAG,CAAC,iBAAiB;QAAE,GAAG,CAAC,iBAAiB,GAAG,IAAA,0BAAa,EAAC,GAAG,CAAC,CAAC;IAEvE,MAAM,IAAI,GAAG;QACX,OAAO;QACP,KAAK;QACL,UAAU;QACV,cAAc;QACd,EAAE;QACF,gBAAgB;QAChB,GAAG;KACJ,CAAC;IAEF,OAAO,IAAA,wBAAc,EAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AA/CD,sCA+CC"}
|
|
@@ -2,6 +2,7 @@ import { Config as GeneratedTypes } from 'payload/generated-types';
|
|
|
2
2
|
import { DeepPartial } from 'ts-essentials';
|
|
3
3
|
import { Payload } from '../../../payload';
|
|
4
4
|
import { Document, Where } from '../../../types';
|
|
5
|
+
import { RequestContext } from '../../../express/types';
|
|
5
6
|
import { File } from '../../../uploads/types';
|
|
6
7
|
import { BulkOperationResult } from '../../config/types';
|
|
7
8
|
export type BaseOptions<TSlug extends keyof GeneratedTypes['collections']> = {
|
|
@@ -18,6 +19,10 @@ export type BaseOptions<TSlug extends keyof GeneratedTypes['collections']> = {
|
|
|
18
19
|
overwriteExistingFiles?: boolean;
|
|
19
20
|
draft?: boolean;
|
|
20
21
|
autosave?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* context, which will then be passed to req.context, which can be read by hooks
|
|
24
|
+
*/
|
|
25
|
+
context?: RequestContext;
|
|
21
26
|
};
|
|
22
27
|
export type ByIDOptions<TSlug extends keyof GeneratedTypes['collections']> = BaseOptions<TSlug> & {
|
|
23
28
|
id: string | number;
|
|
@@ -9,9 +9,10 @@ const dataloader_1 = require("../../dataloader");
|
|
|
9
9
|
const init_1 = __importDefault(require("../../../translations/init"));
|
|
10
10
|
const errors_1 = require("../../../errors");
|
|
11
11
|
const updateByID_1 = __importDefault(require("../updateByID"));
|
|
12
|
+
const setRequestContext_1 = require("../../../express/setRequestContext");
|
|
12
13
|
async function updateLocal(payload, options) {
|
|
13
14
|
var _a;
|
|
14
|
-
const { collection: collectionSlug, depth, locale = null, fallbackLocale = null, data, user, overrideAccess = true, showHiddenFields, filePath, file, overwriteExistingFiles = false, draft, autosave, id, where, } = options;
|
|
15
|
+
const { collection: collectionSlug, depth, locale = null, fallbackLocale = null, data, user, overrideAccess = true, showHiddenFields, filePath, file, overwriteExistingFiles = false, draft, autosave, id, where, context, } = options;
|
|
15
16
|
const collection = payload.collections[collectionSlug];
|
|
16
17
|
if (!collection) {
|
|
17
18
|
throw new errors_1.APIError(`The collection with slug ${String(collectionSlug)} can't be found. Update Operation.`);
|
|
@@ -29,6 +30,7 @@ async function updateLocal(payload, options) {
|
|
|
29
30
|
file: file !== null && file !== void 0 ? file : await (0, getFileByPath_1.default)(filePath),
|
|
30
31
|
},
|
|
31
32
|
};
|
|
33
|
+
(0, setRequestContext_1.setRequestContext)(req, context);
|
|
32
34
|
if (!req.t)
|
|
33
35
|
req.t = req.i18n.t;
|
|
34
36
|
if (!req.payloadDataLoader)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/update.ts"],"names":[],"mappings":";;;;;AAIA,mFAA2D;AAC3D,uDAA+B;AAE/B,iDAAiD;AAEjD,sEAAkD;AAClD,4CAA2C;AAC3C,+DAAuC;
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/collections/operations/local/update.ts"],"names":[],"mappings":";;;;;AAIA,mFAA2D;AAC3D,uDAA+B;AAE/B,iDAAiD;AAEjD,sEAAkD;AAClD,4CAA2C;AAC3C,+DAAuC;AAEvC,0EAAuE;AAqCvE,KAAK,UAAU,WAAW,CAAoD,OAAgB,EAAE,OAAuB;;IACrH,MAAM,EACJ,UAAU,EAAE,cAAc,EAC1B,KAAK,EACL,MAAM,GAAG,IAAI,EACb,cAAc,GAAG,IAAI,EACrB,IAAI,EACJ,IAAI,EACJ,cAAc,GAAG,IAAI,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UAAU;QACV,cAAc;QACd,gBAAgB;QAChB,sBAAsB;QACtB,KAAK;QACL,QAAQ;QACR,OAAO;QACP,GAAG;QACH,EAAE;QACF,KAAK;KACN,CAAC;IAEF,IAAI,OAAO,CAAC,EAAE,EAAE;QACd,OAAO,IAAA,oBAAU,EAAQ,IAAI,CAAC,CAAC;KAChC;IACD,OAAO,IAAA,gBAAM,EAAQ,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -93,6 +93,7 @@ async function restoreVersion(args) {
|
|
|
93
93
|
req,
|
|
94
94
|
overrideAccess,
|
|
95
95
|
showHiddenFields,
|
|
96
|
+
context: req.context,
|
|
96
97
|
});
|
|
97
98
|
// /////////////////////////////////////
|
|
98
99
|
// afterRead - Collection
|
|
@@ -102,6 +103,7 @@ async function restoreVersion(args) {
|
|
|
102
103
|
result = await hook({
|
|
103
104
|
req,
|
|
104
105
|
doc: result,
|
|
106
|
+
context: req.context,
|
|
105
107
|
}) || result;
|
|
106
108
|
}, Promise.resolve());
|
|
107
109
|
// /////////////////////////////////////
|
|
@@ -113,6 +115,7 @@ async function restoreVersion(args) {
|
|
|
113
115
|
previousDoc: prevDocWithLocales,
|
|
114
116
|
entityConfig: collectionConfig,
|
|
115
117
|
operation: 'update',
|
|
118
|
+
context: req.context,
|
|
116
119
|
req,
|
|
117
120
|
});
|
|
118
121
|
// /////////////////////////////////////
|
|
@@ -125,6 +128,7 @@ async function restoreVersion(args) {
|
|
|
125
128
|
req,
|
|
126
129
|
previousDoc: prevDocWithLocales,
|
|
127
130
|
operation: 'update',
|
|
131
|
+
context: req.context,
|
|
128
132
|
}) || result;
|
|
129
133
|
}, Promise.resolve());
|
|
130
134
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restoreVersion.js","sourceRoot":"","sources":["../../../src/collections/operations/restoreVersion.ts"],"names":[],"mappings":";;;;;AAAA,yCAAyC;AACzC,8DAAqC;AAGrC,yCA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,EAAE,CAAC;IAE9C,OAAO,WAAW,CAAC,EAAE,CAAC;IAEtB,MAAM,YAAY,CAAC,MAAM,CAAC;QACxB,MAAM,EAAE,WAAW;QACnB,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,WAAW,CAAC,SAAS;QAChC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC,CAAC;IAEH,wCAAwC;IACxC,qBAAqB;IACrB,wCAAwC;IAExC,MAAM,GAAG,MAAM,IAAA,qBAAS,EAAC;QACvB,KAAK;QACL,GAAG,EAAE,MAAM;QACX,YAAY,EAAE,gBAAgB;QAC9B,GAAG;QACH,cAAc;QACd,gBAAgB;
|
|
1
|
+
{"version":3,"file":"restoreVersion.js","sourceRoot":"","sources":["../../../src/collections/operations/restoreVersion.ts"],"names":[],"mappings":";;;;;AAAA,yCAAyC;AACzC,8DAAqC;AAGrC,yCAA6D;AAC7D,6EAAqD;AACrD,4CAAwD;AACxD,oGAA4E;AAC5E,gEAA6D;AAC7D,4DAAyD;AACzD,0FAAuF;AAavF,KAAK,UAAU,cAAc,CAA6B,IAAe;IACvE,MAAM,EACJ,UAAU,EAAE,EACV,KAAK,EACL,MAAM,EAAE,gBAAgB,GACzB,EACD,EAAE,EACF,cAAc,GAAG,KAAK,EACtB,gBAAgB,EAChB,KAAK,EACL,GAAG,EAAE,EACH,CAAC,EACD,OAAO,GACR,EACD,GAAG,GACJ,GAAG,IAAI,CAAC;IAET,IAAI,CAAC,EAAE,EAAE;QACP,MAAM,IAAI,iBAAQ,CAAC,mCAAmC,EAAE,qBAAU,CAAC,WAAW,CAAC,CAAC;KACjF;IAED,wCAAwC;IACxC,gCAAgC;IAChC,wCAAwC;IAExC,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAE7D,IAAI,UAAU,GAAG,MAAM,YAAY,CAAC,OAAO,CA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