payload 4.0.0-beta.10 → 4.0.0-beta.11
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/database/sanitizeJoinQuery.d.ts +2 -2
- package/dist/database/sanitizeJoinQuery.d.ts.map +1 -1
- package/dist/database/sanitizeJoinQuery.js +26 -1
- package/dist/database/sanitizeJoinQuery.js.map +1 -1
- package/dist/fields/mergeBaseFields.d.ts.map +1 -1
- package/dist/fields/mergeBaseFields.js +24 -0
- package/dist/fields/mergeBaseFields.js.map +1 -1
- package/dist/hierarchy/utils/findUseAsTitle.js +11 -11
- package/dist/hierarchy/utils/findUseAsTitle.js.map +1 -1
- package/dist/index.bundled.d.ts +55 -4
- package/dist/uploads/generateFileData/plan/planUploadStages.d.ts.map +1 -1
- package/dist/uploads/generateFileData/plan/planUploadStages.js +2 -0
- package/dist/uploads/generateFileData/plan/planUploadStages.js.map +1 -1
- package/dist/uploads/getBaseFields.d.ts.map +1 -1
- package/dist/uploads/getBaseFields.js +4 -1
- package/dist/uploads/getBaseFields.js.map +1 -1
- package/dist/uploads/transformState/planUpload.d.ts +4 -1
- package/dist/uploads/transformState/planUpload.d.ts.map +1 -1
- package/dist/uploads/transformState/planUpload.js +52 -2
- package/dist/uploads/transformState/planUpload.js.map +1 -1
- package/dist/utilities/deepMerge.d.ts +55 -3
- package/dist/utilities/deepMerge.d.ts.map +1 -1
- package/dist/utilities/deepMerge.js +104 -9
- package/dist/utilities/deepMerge.js.map +1 -1
- package/package.json +2 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SanitizedCollectionConfig } from '../collections/config/types.js';
|
|
2
|
-
import type { JoinQuery, PayloadRequest } from '../types/index.js';
|
|
2
|
+
import type { JoinQuery, PayloadRequest, Where } from '../types/index.js';
|
|
3
3
|
type Args = {
|
|
4
4
|
collectionConfig: SanitizedCollectionConfig;
|
|
5
5
|
joins?: JoinQuery;
|
|
@@ -17,7 +17,7 @@ export declare const sanitizeJoinQuery: ({ collectionConfig, joins: joinsQuery,
|
|
|
17
17
|
limit?: number;
|
|
18
18
|
page?: number;
|
|
19
19
|
sort?: string;
|
|
20
|
-
where?:
|
|
20
|
+
where?: Where;
|
|
21
21
|
};
|
|
22
22
|
}>>;
|
|
23
23
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeJoinQuery.d.ts","sourceRoot":"","sources":["../../src/database/sanitizeJoinQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAiB,MAAM,gCAAgC,CAAA;AAC9F,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"sanitizeJoinQuery.d.ts","sourceRoot":"","sources":["../../src/database/sanitizeJoinQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAiB,MAAM,gCAAgC,CAAA;AAC9F,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAUzE,KAAK,IAAI,GAAG;IACV,gBAAgB,EAAE,yBAAyB,CAAA;IAC3C,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,cAAc,EAAE,OAAO,CAAA;IACvB,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAmFD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,kEAK3B,IAAI;;;;;;;;GA4EN,CAAA"}
|
|
@@ -83,17 +83,42 @@ const sanitizeJoinFieldQuery = async ({ collectionSlug, errors, join, joinsQuery
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
for (const join of collectionConfig.polymorphicJoins){
|
|
86
|
+
const joinQuery = joinsQuery[join.joinPath];
|
|
87
|
+
// Preserve joins explicitly disabled by the caller.
|
|
88
|
+
if (joinQuery === false) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const readableCollections = [];
|
|
86
92
|
for (const collectionSlug of join.field.collection){
|
|
93
|
+
const collectionJoins = {
|
|
94
|
+
[join.joinPath]: deepCopyObjectSimple(joinQuery || {})
|
|
95
|
+
};
|
|
87
96
|
await sanitizeJoinFieldQuery({
|
|
88
97
|
collectionSlug,
|
|
89
98
|
errors,
|
|
90
99
|
join,
|
|
91
|
-
joinsQuery,
|
|
100
|
+
joinsQuery: collectionJoins,
|
|
92
101
|
overrideAccess,
|
|
93
102
|
promises,
|
|
94
103
|
req
|
|
95
104
|
});
|
|
105
|
+
const collectionQuery = collectionJoins[join.joinPath];
|
|
106
|
+
// Include only targets the current user can read.
|
|
107
|
+
if (collectionQuery !== false) {
|
|
108
|
+
readableCollections.push(combineQueries(collectionQuery?.where || {}, {
|
|
109
|
+
relationTo: {
|
|
110
|
+
equals: collectionSlug
|
|
111
|
+
}
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
96
114
|
}
|
|
115
|
+
// Disable the join when none of its targets are readable.
|
|
116
|
+
joinsQuery[join.joinPath] = readableCollections.length ? {
|
|
117
|
+
...joinQuery,
|
|
118
|
+
where: {
|
|
119
|
+
or: readableCollections
|
|
120
|
+
}
|
|
121
|
+
} : false;
|
|
97
122
|
}
|
|
98
123
|
await Promise.all(promises);
|
|
99
124
|
if (errors.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/database/sanitizeJoinQuery.ts"],"sourcesContent":["import type { SanitizedCollectionConfig, SanitizedJoin } from '../collections/config/types.js'\nimport type { JoinQuery, PayloadRequest } from '../types/index.js'\n\nimport { executeAccess } from '../auth/executeAccess.js'\nimport { QueryError } from '../errors/QueryError.js'\nimport { deepCopyObjectSimple } from '../utilities/deepCopyObject.js'\nimport { combineQueries } from './combineQueries.js'\nimport { validateQueryPaths } from './queryValidation/validateQueryPaths.js'\nimport { validateSortQuery } from './queryValidation/validateSortQuery.js'\nimport { sanitizeWhereQuery } from './sanitizeWhereQuery.js'\n\ntype Args = {\n collectionConfig: SanitizedCollectionConfig\n joins?: JoinQuery\n overrideAccess: boolean\n req: PayloadRequest\n}\n\nconst sanitizeJoinFieldQuery = async ({\n collectionSlug,\n errors,\n join,\n joinsQuery,\n overrideAccess,\n promises,\n req,\n}: {\n collectionSlug: string\n errors: { path: string }[]\n join: SanitizedJoin\n joinsQuery: JoinQuery\n overrideAccess: boolean\n promises: Promise<void>[]\n req: PayloadRequest\n}) => {\n const { joinPath } = join\n\n // TODO: fix any's in joinsQuery[joinPath]\n\n if ((joinsQuery as any)[joinPath] === false) {\n return\n }\n\n const joinCollectionConfig = req.payload.collections[collectionSlug]!.config\n\n const accessResult = !overrideAccess\n ? await executeAccess(\n { slug: joinCollectionConfig.slug, disableErrors: true, req },\n joinCollectionConfig.access.read,\n )\n : true\n\n if (accessResult === false) {\n ;(joinsQuery as any)[joinPath] = false\n return\n }\n\n if (!(joinsQuery as any)[joinPath]) {\n ;(joinsQuery as any)[joinPath] = {}\n }\n\n const joinQuery = (joinsQuery as any)[joinPath]\n\n if (!joinQuery.where) {\n joinQuery.where = {}\n }\n\n if (join.field.where) {\n joinQuery.where = combineQueries(joinQuery.where, deepCopyObjectSimple(join.field.where))\n }\n\n promises.push(\n validateQueryPaths({\n collectionConfig: joinCollectionConfig,\n errors,\n overrideAccess,\n polymorphicJoin: Array.isArray(join.field.collection),\n req,\n // incoming where input, but we shouldn't validate generated from the access control.\n where: joinQuery.where,\n }),\n validateSortQuery({\n collectionConfig: joinCollectionConfig,\n overrideAccess,\n req,\n sort: joinQuery.sort || join.field.defaultSort || joinCollectionConfig.defaultSort,\n }),\n )\n\n if (typeof accessResult === 'object') {\n sanitizeWhereQuery({\n fields: joinCollectionConfig.flattenedFields,\n payload: req.payload,\n where: accessResult,\n })\n joinQuery.where = combineQueries(joinQuery.where, accessResult)\n }\n}\n\n/**\n * * Validates `where` for each join\n * * Combines the access result for joined collection\n * * Combines the default join's `where`\n */\nexport const sanitizeJoinQuery = async ({\n collectionConfig,\n joins: joinsQuery,\n overrideAccess,\n req,\n}: Args) => {\n if (joinsQuery === false) {\n return false\n }\n\n if (!joinsQuery) {\n joinsQuery = {}\n }\n\n const errors: { path: string }[] = []\n const promises: Promise<void>[] = []\n\n for (const collectionSlug in collectionConfig.joins) {\n for (const join of collectionConfig.joins[collectionSlug]!) {\n await sanitizeJoinFieldQuery({\n collectionSlug,\n errors,\n join,\n joinsQuery,\n overrideAccess,\n promises,\n req,\n })\n }\n }\n\n for (const join of collectionConfig.polymorphicJoins) {\n for (const collectionSlug of join.field.collection) {\n await sanitizeJoinFieldQuery({\n collectionSlug,\n errors,\n join,\n joinsQuery,\n overrideAccess,\n promises,\n req,\n })\n }\n }\n\n await Promise.all(promises)\n\n if (errors.length > 0) {\n throw new QueryError(errors)\n }\n\n return joinsQuery\n}\n"],"names":["executeAccess","QueryError","deepCopyObjectSimple","combineQueries","validateQueryPaths","validateSortQuery","sanitizeWhereQuery","sanitizeJoinFieldQuery","collectionSlug","errors","join","joinsQuery","overrideAccess","promises","req","joinPath","joinCollectionConfig","payload","collections","config","accessResult","slug","disableErrors","access","read","joinQuery","where","field","push","collectionConfig","polymorphicJoin","Array","isArray","collection","sort","defaultSort","fields","flattenedFields","sanitizeJoinQuery","joins","polymorphicJoins","
|
|
1
|
+
{"version":3,"sources":["../../src/database/sanitizeJoinQuery.ts"],"sourcesContent":["import type { SanitizedCollectionConfig, SanitizedJoin } from '../collections/config/types.js'\nimport type { JoinQuery, PayloadRequest, Where } from '../types/index.js'\n\nimport { executeAccess } from '../auth/executeAccess.js'\nimport { QueryError } from '../errors/QueryError.js'\nimport { deepCopyObjectSimple } from '../utilities/deepCopyObject.js'\nimport { combineQueries } from './combineQueries.js'\nimport { validateQueryPaths } from './queryValidation/validateQueryPaths.js'\nimport { validateSortQuery } from './queryValidation/validateSortQuery.js'\nimport { sanitizeWhereQuery } from './sanitizeWhereQuery.js'\n\ntype Args = {\n collectionConfig: SanitizedCollectionConfig\n joins?: JoinQuery\n overrideAccess: boolean\n req: PayloadRequest\n}\n\nconst sanitizeJoinFieldQuery = async ({\n collectionSlug,\n errors,\n join,\n joinsQuery,\n overrideAccess,\n promises,\n req,\n}: {\n collectionSlug: string\n errors: { path: string }[]\n join: SanitizedJoin\n joinsQuery: JoinQuery\n overrideAccess: boolean\n promises: Promise<void>[]\n req: PayloadRequest\n}) => {\n const { joinPath } = join\n\n // TODO: fix any's in joinsQuery[joinPath]\n\n if ((joinsQuery as any)[joinPath] === false) {\n return\n }\n\n const joinCollectionConfig = req.payload.collections[collectionSlug]!.config\n\n const accessResult = !overrideAccess\n ? await executeAccess(\n { slug: joinCollectionConfig.slug, disableErrors: true, req },\n joinCollectionConfig.access.read,\n )\n : true\n\n if (accessResult === false) {\n ;(joinsQuery as any)[joinPath] = false\n return\n }\n\n if (!(joinsQuery as any)[joinPath]) {\n ;(joinsQuery as any)[joinPath] = {}\n }\n\n const joinQuery = (joinsQuery as any)[joinPath]\n\n if (!joinQuery.where) {\n joinQuery.where = {}\n }\n\n if (join.field.where) {\n joinQuery.where = combineQueries(joinQuery.where, deepCopyObjectSimple(join.field.where))\n }\n\n promises.push(\n validateQueryPaths({\n collectionConfig: joinCollectionConfig,\n errors,\n overrideAccess,\n polymorphicJoin: Array.isArray(join.field.collection),\n req,\n // incoming where input, but we shouldn't validate generated from the access control.\n where: joinQuery.where,\n }),\n validateSortQuery({\n collectionConfig: joinCollectionConfig,\n overrideAccess,\n req,\n sort: joinQuery.sort || join.field.defaultSort || joinCollectionConfig.defaultSort,\n }),\n )\n\n if (typeof accessResult === 'object') {\n sanitizeWhereQuery({\n fields: joinCollectionConfig.flattenedFields,\n payload: req.payload,\n where: accessResult,\n })\n joinQuery.where = combineQueries(joinQuery.where, accessResult)\n }\n}\n\n/**\n * * Validates `where` for each join\n * * Combines the access result for joined collection\n * * Combines the default join's `where`\n */\nexport const sanitizeJoinQuery = async ({\n collectionConfig,\n joins: joinsQuery,\n overrideAccess,\n req,\n}: Args) => {\n if (joinsQuery === false) {\n return false\n }\n\n if (!joinsQuery) {\n joinsQuery = {}\n }\n\n const errors: { path: string }[] = []\n const promises: Promise<void>[] = []\n\n for (const collectionSlug in collectionConfig.joins) {\n for (const join of collectionConfig.joins[collectionSlug]!) {\n await sanitizeJoinFieldQuery({\n collectionSlug,\n errors,\n join,\n joinsQuery,\n overrideAccess,\n promises,\n req,\n })\n }\n }\n\n for (const join of collectionConfig.polymorphicJoins) {\n const joinQuery = joinsQuery[join.joinPath]\n\n // Preserve joins explicitly disabled by the caller.\n if (joinQuery === false) {\n continue\n }\n\n const readableCollections: Where[] = []\n\n for (const collectionSlug of join.field.collection) {\n const collectionJoins: JoinQuery = {\n [join.joinPath]: deepCopyObjectSimple(joinQuery || {}),\n }\n\n await sanitizeJoinFieldQuery({\n collectionSlug,\n errors,\n join,\n joinsQuery: collectionJoins,\n overrideAccess,\n promises,\n req,\n })\n\n const collectionQuery = collectionJoins[join.joinPath]\n\n // Include only targets the current user can read.\n if (collectionQuery !== false) {\n readableCollections.push(\n combineQueries(collectionQuery?.where || {}, {\n relationTo: { equals: collectionSlug },\n }),\n )\n }\n }\n\n // Disable the join when none of its targets are readable.\n joinsQuery[join.joinPath] = readableCollections.length\n ? { ...joinQuery, where: { or: readableCollections } }\n : false\n }\n\n await Promise.all(promises)\n\n if (errors.length > 0) {\n throw new QueryError(errors)\n }\n\n return joinsQuery\n}\n"],"names":["executeAccess","QueryError","deepCopyObjectSimple","combineQueries","validateQueryPaths","validateSortQuery","sanitizeWhereQuery","sanitizeJoinFieldQuery","collectionSlug","errors","join","joinsQuery","overrideAccess","promises","req","joinPath","joinCollectionConfig","payload","collections","config","accessResult","slug","disableErrors","access","read","joinQuery","where","field","push","collectionConfig","polymorphicJoin","Array","isArray","collection","sort","defaultSort","fields","flattenedFields","sanitizeJoinQuery","joins","polymorphicJoins","readableCollections","collectionJoins","collectionQuery","relationTo","equals","length","or","Promise","all"],"mappings":"AAGA,SAASA,aAAa,QAAQ,2BAA0B;AACxD,SAASC,UAA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;gBACAC;gBACAC,YAAY+B;gBACZ9B;gBACAC;gBACAC;YACF;YAEA,MAAM6B,kBAAkBD,eAAe,CAAChC,KAAKK,QAAQ,CAAC;YAEtD,kDAAkD;YAClD,IAAI4B,oBAAoB,OAAO;gBAC7BF,oBAAoBb,IAAI,CACtBzB,eAAewC,iBAAiBjB,SAAS,CAAC,GAAG;oBAC3CkB,YAAY;wBAAEC,QAAQrC;oBAAe;gBACvC;YAEJ;QACF;QAEA,0DAA0D;QAC1DG,UAAU,CAACD,KAAKK,QAAQ,CAAC,GAAG0B,oBAAoBK,MAAM,GAClD;YAAE,GAAGrB,SAAS;YAAEC,OAAO;gBAAEqB,IAAIN;YAAoB;QAAE,IACnD;IACN;IAEA,MAAMO,QAAQC,GAAG,CAACpC;IAElB,IAAIJ,OAAOqC,MAAM,GAAG,GAAG;QACrB,MAAM,IAAI7C,WAAWQ;IACvB;IAEA,OAAOE;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeBaseFields.d.ts","sourceRoot":"","sources":["../../src/fields/mergeBaseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"mergeBaseFields.d.ts","sourceRoot":"","sources":["../../src/fields/mergeBaseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAuD,MAAM,mBAAmB,CAAA;AAKnG,eAAO,MAAM,eAAe,WAAY,KAAK,EAAE,cAAc,KAAK,EAAE,KAAG,KAAK,EA4C3E,CAAA"}
|
|
@@ -20,6 +20,13 @@ export const mergeBaseFields = (fields, baseFields)=>{
|
|
|
20
20
|
};
|
|
21
21
|
mergedFields.splice(matchedIndex, 1);
|
|
22
22
|
const mergedField = deepMergeWithReactComponents(baseField, matchCopy);
|
|
23
|
+
if (fieldHasOptions(baseField) && fieldHasOptions(matchCopy)) {
|
|
24
|
+
;
|
|
25
|
+
mergedField.options = mergeOptionsByValue({
|
|
26
|
+
baseOptions: baseField.options,
|
|
27
|
+
overrideOptions: matchCopy.options
|
|
28
|
+
});
|
|
29
|
+
}
|
|
23
30
|
if (fieldHasSubFields(baseField) && fieldHasSubFields(matchCopy)) {
|
|
24
31
|
;
|
|
25
32
|
mergedField.fields = mergeBaseFields(matchCopy.fields, baseField.fields);
|
|
@@ -32,5 +39,22 @@ export const mergeBaseFields = (fields, baseFields)=>{
|
|
|
32
39
|
});
|
|
33
40
|
return mergedFields;
|
|
34
41
|
};
|
|
42
|
+
const fieldHasOptions = (field)=>(field.type === 'radio' || field.type === 'select') && Array.isArray(field.options);
|
|
43
|
+
const getOptionValue = (option)=>typeof option === 'string' ? option : option.value;
|
|
44
|
+
/**
|
|
45
|
+
* Keeps every base option, lets an override replace a base option with the same value
|
|
46
|
+
* (e.g. to change its label), and appends override options the base does not have.
|
|
47
|
+
* Concatenating instead would duplicate values, which produces invalid database enums.
|
|
48
|
+
*/ const mergeOptionsByValue = ({ baseOptions, overrideOptions })=>{
|
|
49
|
+
const overridesByValue = new Map(overrideOptions.map((option)=>[
|
|
50
|
+
getOptionValue(option),
|
|
51
|
+
option
|
|
52
|
+
]));
|
|
53
|
+
const baseValues = new Set(baseOptions.map(getOptionValue));
|
|
54
|
+
return [
|
|
55
|
+
...baseOptions.map((option)=>overridesByValue.get(getOptionValue(option)) ?? option),
|
|
56
|
+
...overrideOptions.filter((option)=>!baseValues.has(getOptionValue(option)))
|
|
57
|
+
];
|
|
58
|
+
};
|
|
35
59
|
|
|
36
60
|
//# sourceMappingURL=mergeBaseFields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/fields/mergeBaseFields.ts"],"sourcesContent":["import type { Field, FieldWithSubFields } from './config/types.js'\n\nimport { deepMergeWithReactComponents } from '../utilities/deepMerge.js'\nimport { fieldAffectsData, fieldHasSubFields } from './config/types.js'\n\nexport const mergeBaseFields = (fields: Field[], baseFields: Field[]): Field[] => {\n const mergedFields = [...(fields || [])]\n\n baseFields.forEach((baseField) => {\n let matchedIndex: null | number = null\n\n if (fieldAffectsData(baseField)) {\n const match = mergedFields.find((field, i) => {\n if (fieldAffectsData(field) && field.name === baseField.name) {\n matchedIndex = i\n return true\n }\n\n return false\n })\n\n if (match) {\n const matchCopy: Field = { ...match }\n mergedFields.splice(matchedIndex!, 1)\n\n const mergedField = deepMergeWithReactComponents<Field>(baseField, matchCopy)\n\n if (fieldHasSubFields(baseField) && fieldHasSubFields(matchCopy)) {\n ;(mergedField as FieldWithSubFields).fields = mergeBaseFields(\n matchCopy.fields,\n baseField.fields,\n )\n }\n\n mergedFields.push(mergedField)\n } else {\n mergedFields.push(baseField)\n }\n }\n })\n\n return mergedFields\n}\n"],"names":["deepMergeWithReactComponents","fieldAffectsData","fieldHasSubFields","mergeBaseFields","fields","baseFields","mergedFields","forEach","baseField","matchedIndex","match","find","field","i","name","matchCopy","splice","mergedField","push"],"mappings":"AAEA,SAASA,4BAA4B,QAAQ,4BAA2B;AACxE,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,oBAAmB;AAEvE,OAAO,MAAMC,kBAAkB,CAACC,QAAiBC;IAC/C,MAAMC,eAAe;WAAKF,UAAU,EAAE;KAAE;IAExCC,WAAWE,OAAO,CAAC,CAACC;QAClB,IAAIC,eAA8B;QAElC,IAAIR,iBAAiBO,YAAY;YAC/B,MAAME,QAAQJ,aAAaK,IAAI,CAAC,CAACC,OAAOC;gBACtC,IAAIZ,iBAAiBW,UAAUA,MAAME,IAAI,KAAKN,UAAUM,IAAI,EAAE;oBAC5DL,eAAeI;oBACf,OAAO;gBACT;gBAEA,OAAO;YACT;YAEA,IAAIH,OAAO;gBACT,MAAMK,YAAmB;oBAAE,GAAGL,KAAK;gBAAC;gBACpCJ,aAAaU,MAAM,CAACP,cAAe;gBAEnC,MAAMQ,cAAcjB,6BAAoCQ,WAAWO;gBAEnE,
|
|
1
|
+
{"version":3,"sources":["../../src/fields/mergeBaseFields.ts"],"sourcesContent":["import type { Field, FieldWithSubFields, Option, RadioField, SelectField } from './config/types.js'\n\nimport { deepMergeWithReactComponents } from '../utilities/deepMerge.js'\nimport { fieldAffectsData, fieldHasSubFields } from './config/types.js'\n\nexport const mergeBaseFields = (fields: Field[], baseFields: Field[]): Field[] => {\n const mergedFields = [...(fields || [])]\n\n baseFields.forEach((baseField) => {\n let matchedIndex: null | number = null\n\n if (fieldAffectsData(baseField)) {\n const match = mergedFields.find((field, i) => {\n if (fieldAffectsData(field) && field.name === baseField.name) {\n matchedIndex = i\n return true\n }\n\n return false\n })\n\n if (match) {\n const matchCopy: Field = { ...match }\n mergedFields.splice(matchedIndex!, 1)\n\n const mergedField = deepMergeWithReactComponents<Field>(baseField, matchCopy)\n\n if (fieldHasOptions(baseField) && fieldHasOptions(matchCopy)) {\n ;(mergedField as RadioField | SelectField).options = mergeOptionsByValue({\n baseOptions: baseField.options,\n overrideOptions: matchCopy.options,\n })\n }\n\n if (fieldHasSubFields(baseField) && fieldHasSubFields(matchCopy)) {\n ;(mergedField as FieldWithSubFields).fields = mergeBaseFields(\n matchCopy.fields,\n baseField.fields,\n )\n }\n\n mergedFields.push(mergedField)\n } else {\n mergedFields.push(baseField)\n }\n }\n })\n\n return mergedFields\n}\n\nconst fieldHasOptions = (field: Field): field is RadioField | SelectField =>\n (field.type === 'radio' || field.type === 'select') && Array.isArray(field.options)\n\nconst getOptionValue = (option: Option): string =>\n typeof option === 'string' ? option : option.value\n\n/**\n * Keeps every base option, lets an override replace a base option with the same value\n * (e.g. to change its label), and appends override options the base does not have.\n * Concatenating instead would duplicate values, which produces invalid database enums.\n */\nconst mergeOptionsByValue = ({\n baseOptions,\n overrideOptions,\n}: {\n baseOptions: Option[]\n overrideOptions: Option[]\n}): Option[] => {\n const overridesByValue = new Map(\n overrideOptions.map((option) => [getOptionValue(option), option]),\n )\n const baseValues = new Set(baseOptions.map(getOptionValue))\n\n return [\n ...baseOptions.map((option) => overridesByValue.get(getOptionValue(option)) ?? option),\n ...overrideOptions.filter((option) => !baseValues.has(getOptionValue(option))),\n ]\n}\n"],"names":["deepMergeWithReactComponents","fieldAffectsData","fieldHasSubFields","mergeBaseFields","fields","baseFields","mergedFields","forEach","baseField","matchedIndex","match","find","field","i","name","matchCopy","splice","mergedField","fieldHasOptions","options","mergeOptionsByValue","baseOptions","overrideOptions","push","type","Array","isArray","getOptionValue","option","value","overridesByValue","Map","map","baseValues","Set","get","filter","has"],"mappings":"AAEA,SAASA,4BAA4B,QAAQ,4BAA2B;AACxE,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,oBAAmB;AAEvE,OAAO,MAAMC,kBAAkB,CAACC,QAAiBC;IAC/C,MAAMC,eAAe;WAAKF,UAAU,EAAE;KAAE;IAExCC,WAAWE,OAAO,CAAC,CAACC;QAClB,IAAIC,eAA8B;QAElC,IAAIR,iBAAiBO,YAAY;YAC/B,MAAME,QAAQJ,aAAaK,IAAI,CAAC,CAACC,OAAOC;gBACtC,IAAIZ,iBAAiBW,UAAUA,MAAME,IAAI,KAAKN,UAAUM,IAAI,EAAE;oBAC5DL,eAAeI;oBACf,OAAO;gBACT;gBAEA,OAAO;YACT;YAEA,IAAIH,OAAO;gBACT,MAAMK,YAAmB;oBAAE,GAAGL,KAAK;gBAAC;gBACpCJ,aAAaU,MAAM,CAACP,cAAe;gBAEnC,MAAMQ,cAAcjB,6BAAoCQ,WAAWO;gBAEnE,IAAIG,gBAAgBV,cAAcU,gBAAgBH,YAAY;;oBAC1DE,YAAyCE,OAAO,GAAGC,oBAAoB;wBACvEC,aAAab,UAAUW,OAAO;wBAC9BG,iBAAiBP,UAAUI,OAAO;oBACpC;gBACF;gBAEA,IAAIjB,kBAAkBM,cAAcN,kBAAkBa,YAAY;;oBAC9DE,YAAmCb,MAAM,GAAGD,gBAC5CY,UAAUX,MAAM,EAChBI,UAAUJ,MAAM;gBAEpB;gBAEAE,aAAaiB,IAAI,CAACN;YACpB,OAAO;gBACLX,aAAaiB,IAAI,CAACf;YACpB;QACF;IACF;IAEA,OAAOF;AACT,EAAC;AAED,MAAMY,kBAAkB,CAACN,QACvB,AAACA,CAAAA,MAAMY,IAAI,KAAK,WAAWZ,MAAMY,IAAI,KAAK,QAAO,KAAMC,MAAMC,OAAO,CAACd,MAAMO,OAAO;AAEpF,MAAMQ,iBAAiB,CAACC,SACtB,OAAOA,WAAW,WAAWA,SAASA,OAAOC,KAAK;AAEpD;;;;CAIC,GACD,MAAMT,sBAAsB,CAAC,EAC3BC,WAAW,EACXC,eAAe,EAIhB;IACC,MAAMQ,mBAAmB,IAAIC,IAC3BT,gBAAgBU,GAAG,CAAC,CAACJ,SAAW;YAACD,eAAeC;YAASA;SAAO;IAElE,MAAMK,aAAa,IAAIC,IAAIb,YAAYW,GAAG,CAACL;IAE3C,OAAO;WACFN,YAAYW,GAAG,CAAC,CAACJ,SAAWE,iBAAiBK,GAAG,CAACR,eAAeC,YAAYA;WAC5EN,gBAAgBc,MAAM,CAAC,CAACR,SAAW,CAACK,WAAWI,GAAG,CAACV,eAAeC;KACtE;AACH"}
|
|
@@ -32,18 +32,8 @@ function iterateFields({ fields, titleFieldName }) {
|
|
|
32
32
|
}
|
|
33
33
|
for (const field of fields){
|
|
34
34
|
switch(field.type){
|
|
35
|
-
case 'text':
|
|
36
|
-
case 'number':
|
|
37
|
-
case 'textarea':
|
|
38
|
-
if (field.name === titleFieldName) {
|
|
39
|
-
return {
|
|
40
|
-
localized: Boolean(field.localized),
|
|
41
|
-
titleFieldName: field.name
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
break;
|
|
45
|
-
case 'row':
|
|
46
35
|
case 'collapsible':
|
|
36
|
+
case 'row':
|
|
47
37
|
{
|
|
48
38
|
const result = iterateFields({
|
|
49
39
|
fields: field.fields,
|
|
@@ -65,6 +55,16 @@ function iterateFields({ fields, titleFieldName }) {
|
|
|
65
55
|
}
|
|
66
56
|
}
|
|
67
57
|
break;
|
|
58
|
+
case 'number':
|
|
59
|
+
case 'text':
|
|
60
|
+
case 'textarea':
|
|
61
|
+
if (field.name === titleFieldName) {
|
|
62
|
+
return {
|
|
63
|
+
localized: Boolean(field.localized),
|
|
64
|
+
titleFieldName: field.name
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
68
|
case 'tabs':
|
|
69
69
|
for (const tab of field.tabs){
|
|
70
70
|
if (!('name' in tab)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hierarchy/utils/findUseAsTitle.ts"],"sourcesContent":["import type { CollectionConfig } from '../../collections/config/types.js'\nimport type { Field } from '../../fields/config/types.js'\n\nexport function findUseAsTitleField(collectionConfig: CollectionConfig): {\n localized: boolean\n titleFieldName: string\n} {\n const titleFieldName = collectionConfig.admin?.useAsTitle || 'id'\n return iterateFields({ fields: collectionConfig.fields, titleFieldName })\n}\n\n/**\n * Find a field by name and return its localization status.\n * Returns undefined if field is not found.\n */\nexport function findFieldByName(\n collectionConfig: CollectionConfig,\n fieldName: string,\n): { fieldName: string; localized: boolean } | undefined {\n try {\n const result = iterateFields({ fields: collectionConfig.fields, titleFieldName: fieldName })\n return { fieldName: result.titleFieldName, localized: result.localized }\n } catch {\n return undefined\n }\n}\n\nfunction iterateFields({ fields, titleFieldName }: { fields: Field[]; titleFieldName: string }): {\n localized: boolean\n titleFieldName: string\n} {\n let titleField: { localized: boolean; titleFieldName: string } | undefined\n\n if (titleFieldName === 'id') {\n return {\n localized: false,\n titleFieldName,\n }\n }\n\n for (const field of fields) {\n switch (field.type) {\n case '
|
|
1
|
+
{"version":3,"sources":["../../../src/hierarchy/utils/findUseAsTitle.ts"],"sourcesContent":["import type { CollectionConfig } from '../../collections/config/types.js'\nimport type { Field } from '../../fields/config/types.js'\n\nexport function findUseAsTitleField(collectionConfig: CollectionConfig): {\n localized: boolean\n titleFieldName: string\n} {\n const titleFieldName = collectionConfig.admin?.useAsTitle || 'id'\n return iterateFields({ fields: collectionConfig.fields, titleFieldName })\n}\n\n/**\n * Find a field by name and return its localization status.\n * Returns undefined if field is not found.\n */\nexport function findFieldByName(\n collectionConfig: CollectionConfig,\n fieldName: string,\n): { fieldName: string; localized: boolean } | undefined {\n try {\n const result = iterateFields({ fields: collectionConfig.fields, titleFieldName: fieldName })\n return { fieldName: result.titleFieldName, localized: result.localized }\n } catch {\n return undefined\n }\n}\n\nfunction iterateFields({ fields, titleFieldName }: { fields: Field[]; titleFieldName: string }): {\n localized: boolean\n titleFieldName: string\n} {\n let titleField: { localized: boolean; titleFieldName: string } | undefined\n\n if (titleFieldName === 'id') {\n return {\n localized: false,\n titleFieldName,\n }\n }\n\n for (const field of fields) {\n switch (field.type) {\n case 'collapsible':\n case 'row':\n {\n const result = iterateFields({ fields: field.fields, titleFieldName })\n if (result) {\n titleField = result\n }\n }\n break\n case 'group':\n if (!('name' in field)) {\n const result = iterateFields({ fields: field.fields, titleFieldName })\n if (result) {\n titleField = result\n }\n }\n break\n case 'number':\n case 'text':\n case 'textarea':\n if (field.name === titleFieldName) {\n return {\n localized: Boolean(field.localized),\n titleFieldName: field.name,\n }\n }\n break\n case 'tabs':\n for (const tab of field.tabs) {\n if (!('name' in tab)) {\n const result = iterateFields({ fields: tab.fields, titleFieldName })\n if (result) {\n titleField = result\n }\n }\n }\n }\n\n // If we found the field in recursion, return it\n if (titleField) {\n return titleField\n }\n }\n\n throw new Error(\n `The hierarchy title field \"${titleFieldName}\" was not found. It cannot be nested within named fields i.e. named groups, named tabs, etc.`,\n )\n}\n"],"names":["findUseAsTitleField","collectionConfig","titleFieldName","admin","useAsTitle","iterateFields","fields","findFieldByName","fieldName","result","localized","undefined","titleField","field","type","name","Boolean","tab","tabs","Error"],"mappings":"AAGA,OAAO,SAASA,oBAAoBC,gBAAkC;IAIpE,MAAMC,iBAAiBD,iBAAiBE,KAAK,EAAEC,cAAc;IAC7D,OAAOC,cAAc;QAAEC,QAAQL,iBAAiBK,MAAM;QAAEJ;IAAe;AACzE;AAEA;;;CAGC,GACD,OAAO,SAASK,gBACdN,gBAAk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AM,IAAIO,MACR,CAAC,2BAA2B,EAAEjB,eAAe,4FAA4F,CAAC;AAE9I"}
|
package/dist/index.bundled.d.ts
CHANGED
|
@@ -17,8 +17,6 @@ export { z } from 'zod/mini';
|
|
|
17
17
|
import * as zod_v4_core from 'zod/v4/core';
|
|
18
18
|
import { lookup } from 'dns';
|
|
19
19
|
import { core } from 'zod';
|
|
20
|
-
import deepMerge from 'deepmerge';
|
|
21
|
-
export { default as deepMerge } from 'deepmerge';
|
|
22
20
|
import { PinoPretty } from 'pino-pretty';
|
|
23
21
|
import { DatePickerProps } from 'react-datepicker';
|
|
24
22
|
|
|
@@ -16266,12 +16264,65 @@ declare function deepCopyObjectSimple<T extends JsonValue>(value: T, filterUndef
|
|
|
16266
16264
|
*/
|
|
16267
16265
|
declare function deepCopyObjectComplex<T>(object: T, cache?: WeakMap<any, any>): T;
|
|
16268
16266
|
|
|
16267
|
+
type DeepMergeArrayMergeOptions = {
|
|
16268
|
+
cloneUnlessOtherwiseSpecified(value: object, options?: DeepMergeOptions): any;
|
|
16269
|
+
isMergeableObject(value: object): boolean;
|
|
16270
|
+
};
|
|
16271
|
+
type DeepMergeOptions = {
|
|
16272
|
+
/**
|
|
16273
|
+
* Merges two arrays. Defaults to concatenating `target` and `source`.
|
|
16274
|
+
*/
|
|
16275
|
+
arrayMerge?: (target: any[], source: any[], options: ResolvedDeepMergeOptions) => any[];
|
|
16276
|
+
/**
|
|
16277
|
+
* When `false`, mergeable values are copied by reference instead of being deeply cloned.
|
|
16278
|
+
* @default true
|
|
16279
|
+
*/
|
|
16280
|
+
clone?: boolean;
|
|
16281
|
+
/**
|
|
16282
|
+
* Returns a custom merge function for a given key, or `undefined` to use the default merge.
|
|
16283
|
+
*/
|
|
16284
|
+
customMerge?: (key: string, options?: DeepMergeOptions) => ((x: any, y: any) => any) | undefined;
|
|
16285
|
+
/**
|
|
16286
|
+
* Determines whether a value should be merged recursively or copied as-is.
|
|
16287
|
+
*/
|
|
16288
|
+
isMergeableObject?(value: object): boolean;
|
|
16289
|
+
};
|
|
16290
|
+
type ResolvedDeepMergeOptions = {
|
|
16291
|
+
arrayMerge: NonNullable<DeepMergeOptions['arrayMerge']>;
|
|
16292
|
+
isMergeableObject: (value: unknown) => boolean;
|
|
16293
|
+
} & DeepMergeArrayMergeOptions & DeepMergeOptions;
|
|
16294
|
+
/**
|
|
16295
|
+
* Fully-featured deepMerge. Returns a new object and does not mutate its arguments.
|
|
16296
|
+
*
|
|
16297
|
+
* Array handling: arrays are concatenated unless `arrayMerge` is provided.
|
|
16298
|
+
*
|
|
16299
|
+
* `__proto__` keys are never copied to the result, preventing prototype poisoning of the returned
|
|
16300
|
+
* object when merging untrusted input (e.g. parsed JSON).
|
|
16301
|
+
*/
|
|
16302
|
+
declare function deepMerge<T>(x: Partial<T>, y: Partial<T>, options?: DeepMergeOptions): T;
|
|
16303
|
+
declare function deepMerge<T1, T2>(x: Partial<T1>, y: Partial<T2>, options?: DeepMergeOptions): T1 & T2;
|
|
16304
|
+
declare namespace deepMerge {
|
|
16305
|
+
var all: typeof deepMergeAll;
|
|
16306
|
+
}
|
|
16307
|
+
/**
|
|
16308
|
+
* Keeps the `deepMerge.Options` / `deepMerge.ArrayMergeOptions` type references from the former
|
|
16309
|
+
* `deepmerge` dependency working.
|
|
16310
|
+
*/
|
|
16311
|
+
declare namespace deepMerge {
|
|
16312
|
+
type ArrayMergeOptions = DeepMergeArrayMergeOptions;
|
|
16313
|
+
type Options = DeepMergeOptions;
|
|
16314
|
+
}
|
|
16315
|
+
/**
|
|
16316
|
+
* Deep-merges all objects in the array, from left to right.
|
|
16317
|
+
*/
|
|
16318
|
+
declare function deepMergeAll<T = object>(objects: Partial<T>[], options?: DeepMergeOptions): T;
|
|
16319
|
+
declare function deepMergeAll(objects: object[], options?: DeepMergeOptions): object;
|
|
16269
16320
|
/**
|
|
16270
16321
|
* Fully-featured deepMerge.
|
|
16271
16322
|
*
|
|
16272
16323
|
* Array handling: Arrays in the target object are combined with the source object's arrays.
|
|
16273
16324
|
*/
|
|
16274
|
-
declare function deepMergeWithCombinedArrays<T extends object>(obj1: object, obj2: object, options?:
|
|
16325
|
+
declare function deepMergeWithCombinedArrays<T extends object>(obj1: object, obj2: object, options?: DeepMergeOptions): T;
|
|
16275
16326
|
/**
|
|
16276
16327
|
* Fully-featured deepMerge.
|
|
16277
16328
|
*
|
|
@@ -17543,5 +17594,5 @@ interface GlobalAdminCustom extends Record<string, any> {
|
|
|
17543
17594
|
interface GlobalAdminCustom extends Record<string, any> {
|
|
17544
17595
|
}
|
|
17545
17596
|
|
|
17546
|
-
export { APIError, APIErrorName, Action, AuthenticationError, BasePayload, DEFAULT_ALLOW_HAS_MANY, DEFAULT_HIERARCHY_TREE_LIMIT, DatabaseKVAdapter, DuplicateCollection, DuplicateFieldName, DuplicateGlobal, EntityType, ErrorDeletingFile, FileRetrievalError, FileUploadError, Forbidden, HIERARCHY_DEFAULT_LOCALE, HIERARCHY_SLUG_PATH_FIELD, HIERARCHY_TITLE_PATH_FIELD, InMemoryKVAdapter, InvalidConfiguration, InvalidFieldName, InvalidFieldRelationship, JWTAuthentication, JWT_AUTH_VERSION, JobCancelledError, Locked, LockedAuth, MissingCollectionLabel, MissingEditorProp, MissingFieldInputOptions, MissingFieldType, MissingFile, NotFound, QueryError, TransformerContractError, UnauthorizedError, UnverifiedEmail, ValidationError, ValidationErrorName, _internal_jobSystemGlobals, _internal_resetJobSystemGlobals, _internal_safeFetchGlobal, accessOperation, addDataAndFileToRequest, addDefaultsToConfig, addLocalesToRequestFromData, traverseFields$4 as afterChangeTraverseFields, promise as afterReadPromise, traverseFields$3 as afterReadTraverseFields, appendVersionToQueryKey, accountLockFields as baseAccountLockFields, baseAuthFields, baseBlockFields, emailFieldConfig as baseEmailField, baseIDField, sessionsFieldConfig as baseSessionsField, usernameFieldConfig as baseUsernameField, verificationFields as baseVerificationFields, batchProcessing, traverseFields$2 as beforeChangeTraverseFields, traverseFields$1 as beforeValidateTraverseFields, buildConfig, buildVersionCollectionFields, buildVersionCompoundIndexes, buildVersionGlobalFields, canAccessAdmin, checkDependencies, checkLoginPermission, combineQueries, commitTransaction, configToJSONSchema, countDocumentsInputSchema, countDocumentsLocalInputSchema, countGlobalVersionsInputSchema, countGlobalVersionsLocalInputSchema, countOperation, countRunnableOrActiveJobsForQueue, countVersionsInputSchema, countVersionsLocalInputSchema, createAPIKeyFields, createArrayFromCommaDelineated, createAuthToken, createClientBlocks, createClientCollectionConfig, createClientCollectionConfigs, createClientConfig, createClientField, createClientFields, createClientGlobalConfig, createClientGlobalConfigs, createCreatedByField, createDatabaseAdapter, createDataloaderCacheKey, createDocumentsInputSchema, createDocumentsLocalInputSchema, createFolderField, createMigration, createOperation, createPayloadRequest, createPayloadRequestFromWebRequest, createTagField, createUnauthenticatedClientConfig, createUpdatedByField, databaseKVAdapter, deepCopyObject, deepCopyObjectComplex, deepCopyObjectSimple, deepMergeSimple, deepMergeWithCombinedArrays, deepMergeWithReactComponents, deepMergeWithSourceArrays, initialized as default, defaultBeginTransaction, defaultLoggerOptions, defaultUserCollection, definePlugin, deleteByIDOperation, deleteCollectionVersions, deleteDocumentsInputSchema, deleteDocumentsLocalInputSchema, deleteOperation, docAccessOperation$1 as docAccessOperation, docAccessOperation as docAccessOperationGlobal, docHasTimestamps, duplicateDocumentInputSchema, duplicateDocumentLocalInputSchema, duplicateOperation, dynamicImport, enforceMaxVersions, entityToJSONSchema, entityToStandaloneJSONSchema, escapeRegExp, executeAccess, executeAuthStrategies, extractAccessFromPermission, extractJWT, fieldsToJSONSchema, findByIDOperation, findDistinctInputSchema, findDistinctLocalInputSchema, findDocumentsInputSchema, findDocumentsLocalInputSchema, findGlobalInputSchema, findGlobalLocalInputSchema, findGlobalVersionByIDInputSchema, findGlobalVersionByIDLocalInputSchema, findGlobalVersionsInputSchema, findGlobalVersionsLocalInputSchema, findMigrationDir, findOneOperation, findOperation, findUp, findUpSync, findVersionByIDInputSchema, findVersionByIDLocalInputSchema, findVersionByIDOperation$1 as findVersionByIDOperation, findVersionByIDOperation as findVersionByIDOperationGlobal, findVersionsInputSchema, findVersionsLocalInputSchema, findVersionsOperation$1 as findVersionsOperation, findVersionsOperation as findVersionsOperationGlobal, flattenAllFields, flattenTopLevelFields, flattenWhereToOperators, forgotPasswordOperation, formatErrors, formatLabels, formatNames, genImportMapIterateFields, generateCookie, generateExpiredPayloadCookie, generateImportMap, generatePayloadCookie, generatePayloadFileURL, getAccessResults, getAncestors, getBlockSelect, getCollectionIDFieldTypes, getCollectionInputSchema, getCollectionSchemaInputSchema, getCollectionVirtualFieldNames, getConfigInfoInputSchema, getCookieExpiration, getCurrentDate, getDataLoader, getDefaultValue, getDependencies, getFieldByPath, getFieldsToSign, getFileByPath, getGlobalInputSchema, getGlobalSchemaInputSchema, getGlobalVirtualFieldNames, getHierarchyFieldName, getInitialTreeData, getLocalI18n, getLocalizedPaths, getLoginOptions, getMigrations, getObjectDotNotation, getPayload, getPredefinedMigration, getQueryDraftsSort, getRegisteredDevReloadStrategy, getRequestLanguage, getSlugFallbackValue, getUniqueFieldValue, handleEndpoints, hasDraftValidationEnabled, hasDraftsEnabled, hasWhereAccessResult, headersWithCors, importHandlerPath, inMemoryKVAdapter, incrementLoginAttempts, initOperation, initTransaction, injectHierarchyButton, isEntityHidden, isPlainObject, isUserMenuSettingsGroup, isValidID, isolateObjectProperty, jobAfterRead, jwtSign, killTransaction, logError, loginOperation, logoutOperation, mapAsync, meOperation, mergeHeaders, migrate, migrateDown, migrateRefresh, migrateReset, migrateStatus, migrationTemplate, migrationsCollection, parseCookies, parseDocumentID, parseErrorResponse, parseParams, pathExistsAndIsAccessible, pathExistsAndIsAccessibleSync, readMigrationFiles, redeemRefreshToken, refreshOperation, registerBlockInterface, registerCLIExitCodeHandler, registerDevReloadStrategy, registerFirstUserOperation, registerUploadVariants, reload, renameFileOperation, resetLoginAttempts, resetPasswordOperation, resolveHierarchyCollections, restoreGlobalVersionInputSchema, restoreGlobalVersionLocalInputSchema, restoreVersionInputSchema, restoreVersionLocalInputSchema, restoreVersionOperation$1 as restoreVersionOperation, restoreVersionOperation as restoreVersionOperationGlobal, rotateSecret, sanitizeConfig, sanitizeFallbackLocale, sanitizeField, sanitizeFields, sanitizeJoinParams, sanitizeLocales, sanitizePopulateParam, sanitizeSelectParam, sanitizeSortParams, saveVersion, serverOnlyAdminConfigProperties, serverOnlyConfigProperties, serverProps, sortableFieldTypes, strictObject, stripUnselectedFields, stripVirtualFields, toWords, transformPointDataToPayload, traverseFields, unlockOperation, updateByIDOperation, updateDocumentInputSchema, updateDocumentLocalInputSchema, updateGlobalInputSchema, updateGlobalLocalInputSchema, updateOperation$1 as updateOperation, updateOperation as updateOperationGlobal, validateBlocksFilterOptions, validateCollectionData, validateGlobalData, validateQueryPaths, validateSearchParam, validations, verifyEmailOperation, versionDefaults, withNullableJSONSchemaType, writeMigrationIndex };
|
|
17597
|
+
export { APIError, APIErrorName, Action, AuthenticationError, BasePayload, DEFAULT_ALLOW_HAS_MANY, DEFAULT_HIERARCHY_TREE_LIMIT, DatabaseKVAdapter, DuplicateCollection, DuplicateFieldName, DuplicateGlobal, EntityType, ErrorDeletingFile, FileRetrievalError, FileUploadError, Forbidden, HIERARCHY_DEFAULT_LOCALE, HIERARCHY_SLUG_PATH_FIELD, HIERARCHY_TITLE_PATH_FIELD, InMemoryKVAdapter, InvalidConfiguration, InvalidFieldName, InvalidFieldRelationship, JWTAuthentication, JWT_AUTH_VERSION, JobCancelledError, Locked, LockedAuth, MissingCollectionLabel, MissingEditorProp, MissingFieldInputOptions, MissingFieldType, MissingFile, NotFound, QueryError, TransformerContractError, UnauthorizedError, UnverifiedEmail, ValidationError, ValidationErrorName, _internal_jobSystemGlobals, _internal_resetJobSystemGlobals, _internal_safeFetchGlobal, accessOperation, addDataAndFileToRequest, addDefaultsToConfig, addLocalesToRequestFromData, traverseFields$4 as afterChangeTraverseFields, promise as afterReadPromise, traverseFields$3 as afterReadTraverseFields, appendVersionToQueryKey, accountLockFields as baseAccountLockFields, baseAuthFields, baseBlockFields, emailFieldConfig as baseEmailField, baseIDField, sessionsFieldConfig as baseSessionsField, usernameFieldConfig as baseUsernameField, verificationFields as baseVerificationFields, batchProcessing, traverseFields$2 as beforeChangeTraverseFields, traverseFields$1 as beforeValidateTraverseFields, buildConfig, buildVersionCollectionFields, buildVersionCompoundIndexes, buildVersionGlobalFields, canAccessAdmin, checkDependencies, checkLoginPermission, combineQueries, commitTransaction, configToJSONSchema, countDocumentsInputSchema, countDocumentsLocalInputSchema, countGlobalVersionsInputSchema, countGlobalVersionsLocalInputSchema, countOperation, countRunnableOrActiveJobsForQueue, countVersionsInputSchema, countVersionsLocalInputSchema, createAPIKeyFields, createArrayFromCommaDelineated, createAuthToken, createClientBlocks, createClientCollectionConfig, createClientCollectionConfigs, createClientConfig, createClientField, createClientFields, createClientGlobalConfig, createClientGlobalConfigs, createCreatedByField, createDatabaseAdapter, createDataloaderCacheKey, createDocumentsInputSchema, createDocumentsLocalInputSchema, createFolderField, createMigration, createOperation, createPayloadRequest, createPayloadRequestFromWebRequest, createTagField, createUnauthenticatedClientConfig, createUpdatedByField, databaseKVAdapter, deepCopyObject, deepCopyObjectComplex, deepCopyObjectSimple, deepMerge, deepMergeSimple, deepMergeWithCombinedArrays, deepMergeWithReactComponents, deepMergeWithSourceArrays, initialized as default, defaultBeginTransaction, defaultLoggerOptions, defaultUserCollection, definePlugin, deleteByIDOperation, deleteCollectionVersions, deleteDocumentsInputSchema, deleteDocumentsLocalInputSchema, deleteOperation, docAccessOperation$1 as docAccessOperation, docAccessOperation as docAccessOperationGlobal, docHasTimestamps, duplicateDocumentInputSchema, duplicateDocumentLocalInputSchema, duplicateOperation, dynamicImport, enforceMaxVersions, entityToJSONSchema, entityToStandaloneJSONSchema, escapeRegExp, executeAccess, executeAuthStrategies, extractAccessFromPermission, extractJWT, fieldsToJSONSchema, findByIDOperation, findDistinctInputSchema, findDistinctLocalInputSchema, findDocumentsInputSchema, findDocumentsLocalInputSchema, findGlobalInputSchema, findGlobalLocalInputSchema, findGlobalVersionByIDInputSchema, findGlobalVersionByIDLocalInputSchema, findGlobalVersionsInputSchema, findGlobalVersionsLocalInputSchema, findMigrationDir, findOneOperation, findOperation, findUp, findUpSync, findVersionByIDInputSchema, findVersionByIDLocalInputSchema, findVersionByIDOperation$1 as findVersionByIDOperation, findVersionByIDOperation as findVersionByIDOperationGlobal, findVersionsInputSchema, findVersionsLocalInputSchema, findVersionsOperation$1 as findVersionsOperation, findVersionsOperation as findVersionsOperationGlobal, flattenAllFields, flattenTopLevelFields, flattenWhereToOperators, forgotPasswordOperation, formatErrors, formatLabels, formatNames, genImportMapIterateFields, generateCookie, generateExpiredPayloadCookie, generateImportMap, generatePayloadCookie, generatePayloadFileURL, getAccessResults, getAncestors, getBlockSelect, getCollectionIDFieldTypes, getCollectionInputSchema, getCollectionSchemaInputSchema, getCollectionVirtualFieldNames, getConfigInfoInputSchema, getCookieExpiration, getCurrentDate, getDataLoader, getDefaultValue, getDependencies, getFieldByPath, getFieldsToSign, getFileByPath, getGlobalInputSchema, getGlobalSchemaInputSchema, getGlobalVirtualFieldNames, getHierarchyFieldName, getInitialTreeData, getLocalI18n, getLocalizedPaths, getLoginOptions, getMigrations, getObjectDotNotation, getPayload, getPredefinedMigration, getQueryDraftsSort, getRegisteredDevReloadStrategy, getRequestLanguage, getSlugFallbackValue, getUniqueFieldValue, handleEndpoints, hasDraftValidationEnabled, hasDraftsEnabled, hasWhereAccessResult, headersWithCors, importHandlerPath, inMemoryKVAdapter, incrementLoginAttempts, initOperation, initTransaction, injectHierarchyButton, isEntityHidden, isPlainObject, isUserMenuSettingsGroup, isValidID, isolateObjectProperty, jobAfterRead, jwtSign, killTransaction, logError, loginOperation, logoutOperation, mapAsync, meOperation, mergeHeaders, migrate, migrateDown, migrateRefresh, migrateReset, migrateStatus, migrationTemplate, migrationsCollection, parseCookies, parseDocumentID, parseErrorResponse, parseParams, pathExistsAndIsAccessible, pathExistsAndIsAccessibleSync, readMigrationFiles, redeemRefreshToken, refreshOperation, registerBlockInterface, registerCLIExitCodeHandler, registerDevReloadStrategy, registerFirstUserOperation, registerUploadVariants, reload, renameFileOperation, resetLoginAttempts, resetPasswordOperation, resolveHierarchyCollections, restoreGlobalVersionInputSchema, restoreGlobalVersionLocalInputSchema, restoreVersionInputSchema, restoreVersionLocalInputSchema, restoreVersionOperation$1 as restoreVersionOperation, restoreVersionOperation as restoreVersionOperationGlobal, rotateSecret, sanitizeConfig, sanitizeFallbackLocale, sanitizeField, sanitizeFields, sanitizeJoinParams, sanitizeLocales, sanitizePopulateParam, sanitizeSelectParam, sanitizeSortParams, saveVersion, serverOnlyAdminConfigProperties, serverOnlyConfigProperties, serverProps, sortableFieldTypes, strictObject, stripUnselectedFields, stripVirtualFields, toWords, transformPointDataToPayload, traverseFields, unlockOperation, updateByIDOperation, updateDocumentInputSchema, updateDocumentLocalInputSchema, updateGlobalInputSchema, updateGlobalLocalInputSchema, updateOperation$1 as updateOperation, updateOperation as updateOperationGlobal, validateBlocksFilterOptions, validateCollectionData, validateGlobalData, validateQueryPaths, validateSearchParam, validations, verifyEmailOperation, versionDefaults, withNullableJSONSchemaType, writeMigrationIndex };
|
|
17547
17598
|
export type { Access, AccessArgs, AccessResult, AdminClient, AdminComponent, AdminContext, AdminDependencies, AdminFunction, AdminView, AdminViewAdapter, AdminViewClientProps, AdminViewComponent, AdminViewConfig, AdminViewKey, AdminViewServerProps as AdminViewProps, AdminViewServerProps, AdminViewServerPropsOnly, AfterErrorHook$1 as AfterErrorHook, AfterErrorHookArgs, AfterErrorResult, AfterListClientProps, AfterListServerProps, AfterListServerPropsOnly, AfterListTableClientProps, AfterListTableServerProps, AfterListTableServerPropsOnly, AllOperations, AllowList, Ancestor, ApplyDisableErrors, ArrayField, ArrayFieldClient, ArrayFieldClientProps, ArrayFieldDescriptionClientProps, ArrayFieldDescriptionServerProps, ArrayFieldDiffClientProps, ArrayFieldDiffServerProps, ArrayFieldErrorClientProps, ArrayFieldErrorServerProps, ArrayFieldLabelClientProps, ArrayFieldLabelServerProps, ArrayFieldServerProps, ArrayFieldValidation, Auth, AuthCollection, AuthCollectionSlug, AuthOperations, AuthOperationsFromCollectionSlug, AuthRuntimeFields, AuthStrategy, AuthStrategyFunction, AuthStrategyFunctionArgs, AuthStrategyResult, AuthenticatedUser, Authorship, BaseAccess, BaseDatabaseAdapter, BaseFilter, BaseListFilter, BaseLocalizationConfig, BaseValidateOptions, BaseVersionField, BatchProcessing, BatchProcessingArgs, BatchProcessingOperation, BatchProcessingOptions, BatchProcessingResult, BatchProcessorResult, BeforeDocumentControlsClientProps, BeforeDocumentControlsServerProps, BeforeDocumentControlsServerPropsOnly, BeforeListClientProps, BeforeListServerProps, BeforeListServerPropsOnly, BeforeListTableClientProps, BeforeListTableServerProps, BeforeListTableServerPropsOnly, BeforeValidateOperation, BeginTransaction, Block, BlockJSX, BlockPermissions, BlockRowLabelClientProps, BlockRowLabelServerProps, BlockSlug, BlocksField, BlocksFieldClient, BlocksFieldClientProps, BlocksFieldDescriptionClientProps, BlocksFieldDescriptionServerProps, BlocksFieldDiffClientProps, BlocksFieldDiffServerProps, BlocksFieldErrorClientProps, BlocksFieldErrorServerProps, BlocksFieldLabelClientProps, BlocksFieldLabelServerProps, BlocksFieldServerProps, BlocksFieldValidation, BlocksPermissions, BrowserAutoComplete, BuildFormStateArgs, BuildTableStateArgs, BulkOperationResult, CLICommand, CLICommandDescription, CLICommandEntry, CLICommandResult, CLICommands, CLIExitCodeHandler, CLIFieldOverride, CLIGlobalOptionDescription, CLIHelp, CLIInputSchema, CLIRuntime, CORSConfig, CanTransformArgs, CanTransformResult, CheckboxField, CheckboxFieldClient, CheckboxFieldClientProps, CheckboxFieldDescriptionClientProps, CheckboxFieldDescriptionServerProps, CheckboxFieldDiffClientProps, CheckboxFieldDiffServerProps, CheckboxFieldErrorClientProps, CheckboxFieldErrorServerProps, CheckboxFieldLabelClientProps, CheckboxFieldLabelServerProps, CheckboxFieldServerProps, CheckboxFieldValidation, ClientBlock, ClientCollectionConfig, ClientComponentProps, ClientConfig, ClientField, ClientFieldBase, ClientFieldProps, ClientFieldSchemaMap, ClientFieldWithOptionalType, ClientGlobalConfig, DocumentViewClientProps as ClientSideEditViewProps, ClientTab, ClientUploadSession, ClientWidget, CodeField, CodeFieldClient, CodeFieldClientProps, CodeFieldDescriptionClientProps, CodeFieldDescriptionServerProps, CodeFieldDiffClientProps, CodeFieldDiffServerProps, CodeFieldErrorClientProps, CodeFieldErrorServerProps, CodeFieldLabelClientProps, CodeFieldLabelServerProps, CodeFieldServerProps, CodeFieldValidation, CollapsedPreferences, CollapsibleField, CollapsibleFieldClient, CollapsibleFieldClientProps, CollapsibleFieldDescriptionClientProps, CollapsibleFieldDescriptionServerProps, CollapsibleFieldDiffClientProps, CollapsibleFieldDiffServerProps, CollapsibleFieldErrorClientProps, CollapsibleFieldErrorServerProps, CollapsibleFieldLabelClientProps, CollapsibleFieldLabelServerProps, CollapsibleFieldServerProps, Collection, CollectionAccess, CollectionAdminCustom, CollectionAdminOptions, AfterChangeHook as CollectionAfterChangeHook, AfterDeleteHook as CollectionAfterDeleteHook, AfterErrorHook as CollectionAfterErrorHook, AfterForgotPasswordHook as CollectionAfterForgotPasswordHook, AfterLoginHook as CollectionAfterLoginHook, AfterLogoutHook as CollectionAfterLogoutHook, AfterMeHook as CollectionAfterMeHook, AfterOperationHook as CollectionAfterOperationHook, AfterReadHook as CollectionAfterReadHook, AfterRefreshHook as CollectionAfterRefreshHook, BeforeChangeHook as CollectionBeforeChangeHook, BeforeDeleteHook as CollectionBeforeDeleteHook, BeforeLoginHook as CollectionBeforeLoginHook, BeforeOperationHook as CollectionBeforeOperationHook, BeforeReadHook as CollectionBeforeReadHook, BeforeValidateHook as CollectionBeforeValidateHook, CollectionConfig, CollectionCustom, MeHook as CollectionMeHook, CollectionPermission, CollectionPreferences, RefreshHook as CollectionRefreshHook, CollectionSlug, Column, ColumnPreference, CommitTransaction, ComponentRenderer, CompoundIndex, ConcurrencyConfig, Condition, ConditionalDateProps, Config, ConfirmPasswordFieldValidation, Connect, CookieOptions$1 as CookieOptions, CookieStore, Copy, CopyArgs, Count, CountArgs, CountGlobalVersionArgs, CountGlobalVersions, CountVersions, Create, CreateArgs, CreateClientConfigArgs, CreateFolderFieldOptions, CreateGlobal, CreateGlobalArgs, CreateGlobalVersion, CreateGlobalVersionArgs, CreateMigration, CreateMigrationResult, CreatePayloadRequestArgs, CreateTagFieldOptions, CreateVersion, CreateVersionArgs, Crop, CurrentHierarchyItem, CustomComponent, CustomDocumentViewConfig, CustomPayloadRequestProperties, CustomComponent as CustomPreviewButton, CustomComponent as CustomPublishButton, CustomComponent as CustomSaveButton, CustomComponent as CustomSaveDraftButton, CustomStatus, CustomUpload, CustomVersionParser, DBIdentifierName, DashboardConfig, Data, DataFromCollectionSlug, DataFromGlobalSlug, DataFromWidgetSlug, DatabaseAdapter, DatabaseAdapterResult as DatabaseAdapterObj, DatabaseKVAdapterOptions, DateField, DateFieldClient, DateFieldClientProps, DateFieldDescriptionClientProps, DateFieldDescriptionServerProps, DateFieldDiffClientProps, DateFieldDiffServerProps, DateFieldErrorClientProps, DateFieldErrorServerProps, DateFieldLabelClientProps, DateFieldLabelServerProps, DateFieldServerProps, DateFieldValidation, DayPickerProps, DefaultCellComponentProps, DefaultDocumentIDType, DefaultDocumentViewConfig, DefaultServerCellComponentProps, DefaultServerFunctionArgs, DefaultValue, DeleteMany, DeleteManyArgs, DeleteOne, DeleteOneArgs, DeleteVersions, DeleteVersionsArgs, Description, DescriptionFunction, Destroy, DevReloadCleanup, DevReloadStrategy, Document, DocumentEvent, DocumentPermissions, DocumentPreferences, DocumentSlots, DocumentSubViewTypes, DocumentTabClientProps, DocumentTabComponent, DocumentTabCondition, DocumentTabConfig, DocumentTabServerProps as DocumentTabProps, DocumentTabServerProps, DocumentTabServerPropsOnly, DocumentViewClientProps, DocumentViewComponent, DocumentViewConfig, DocumentViewServerProps, DocumentViewServerPropsOnly, DraftTransformCollectionWithSelect, DynamicMigrationTemplate, EditConfig, EditConfigWithRoot, EditConfigWithoutRoot, EditMenuItemsClientProps, EditMenuItemsServerProps, EditMenuItemsServerPropsOnly, EditViewComponent, EditViewConfig, EditViewProps, EmailAdapter, EmailField, EmailFieldClient, EmailFieldClientProps, EmailFieldDescriptionClientProps, EmailFieldDescriptionServerProps, EmailFieldDiffClientProps, EmailFieldDiffServerProps, EmailFieldErrorClientProps, EmailFieldErrorServerProps, EmailFieldLabelClientProps, EmailFieldLabelServerProps, EmailFieldServerProps, EmailFieldValidation, Endpoint, EntityDescription, EntityDescriptionComponent, EntityDescriptionFunction, EntityInputSchema, EntityPolicies, ErrorResult, ExternalFileHeaderFilterContext, FetchAPIFileUploadOptions, Field, FieldAccess, FieldAccessArgs, FieldAffectingData, FieldAffectingDataClient, FieldBase, FieldBaseClient, FieldClientProps, FieldCustom, FieldDescriptionClientProps, FieldDescriptionServerProps, FieldDiffClientProps, FieldDiffServerProps, FieldErrorClientProps, FieldErrorServerProps, FieldHook, FieldHookArgs, FieldLabelClientProps, FieldLabelServerProps, FieldOperation, FieldPaths, FieldPermissions, FieldPosition, FieldPresentationalOnly, FieldPresentationalOnlyClient, FieldRow, FieldSchemaMap, FieldServerProps, FieldState, FieldTypes, FieldWithMany, FieldWithManyClient, FieldWithMaxDepth, FieldWithMaxDepthClient, FieldWithPath, FieldWithPathClient, FieldWithSubFields, FieldWithSubFieldsClient, FieldsPermissions, FieldsPreferences, FieldsToJSONSchemaArgs, File$1 as File, FileAllowList, FileData, FileHandlerOperation, FileSize, FileSizes, FileSource, FileToSave, FilterOptions, FilterOptionsProps, FilterOptionsResult, Find, FindArgs, FindDistinct, FindGlobal, FindGlobalArgs, FindGlobalVersions, FindGlobalVersionsArgs, FindOne, FindOneArgs, FindOptions, FindVersions, FindVersionsArgs, FlattenedArrayField, FlattenedBlock, FlattenedBlocksField, FlattenedField$1 as FlattenedField, FlattenedGroupField, FlattenedJoinField, FlattenedTabAsField, FocalPoint, FoldersConfig, FieldState as FormField, FieldStateWithoutComponents as FormFieldWithoutComponents, FormState, FormStateWithoutComponents, GenerateImageName, GeneratePreviewURL, GenerateSchema, GenerateUploadInstructions, GenerateViewMetadata, GeneratedTypes, GenericDescriptionProps, GenericErrorProps, GenericLabelProps, GetAdminThumbnail, GetInitialTreeDataArgs, GlobalAccess, GlobalAdminCustom, GlobalAdminOptions, AfterChangeHook$1 as GlobalAfterChangeHook, AfterReadHook$1 as GlobalAfterReadHook, BeforeChangeHook$1 as GlobalBeforeChangeHook, BeforeOperationHook$1 as GlobalBeforeOperationHook, BeforeReadHook$1 as GlobalBeforeReadHook, BeforeValidateHook$1 as GlobalBeforeValidateHook, GlobalConfig, GlobalCustom, GlobalPermission, GlobalSlug, GlobalUploadConfig, GraphQLExtension, GraphQLInfo, GroupField, GroupFieldClient, GroupFieldClientProps, GroupFieldDescriptionClientProps, GroupFieldDescriptionServerProps, GroupFieldDiffClientProps, GroupFieldDiffServerProps, GroupFieldErrorClientProps, GroupFieldErrorServerProps, GroupFieldLabelClientProps, GroupFieldLabelServerProps, GroupFieldServerProps, HandleTransformRequestArgs, HandleTransformRequestResult, HasManyRelationshipOperator, HiddenFieldProps, HierarchyConfig, HierarchyViewData, HookName, HookOperationType, IDTypeForCollectionSlug, IfAny, ImageSize, ImportMap, ImportMapGenerators, IncomingAuthType, Init, InitOptions, InitPageResult, InitialTreeData, InsideFieldsPreferences, IsAny, JSONField, JSONFieldClient, JSONFieldClientProps, JSONFieldDescriptionClientProps, JSONFieldDescriptionServerProps, JSONFieldDiffClientProps, JSONFieldDiffServerProps, JSONFieldErrorClientProps, JSONFieldErrorServerProps, JSONFieldLabelClientProps, JSONFieldLabelServerProps, JSONFieldServerProps, JSONFieldValidation, JWTAuthVersion, Job, JobLog, JobTaskStatus, JobsConfig, JoinField, JoinFieldClient, JoinFieldClientProps, JoinFieldDescriptionClientProps, JoinFieldDescriptionServerProps, JoinFieldDiffClientProps, JoinFieldDiffServerProps, JoinFieldErrorClientProps, JoinFieldErrorServerProps, JoinFieldLabelClientProps, JoinFieldLabelServerProps, JoinFieldServerProps, JoinParams, JoinQuery, JsonArray, JsonObject, JsonValue, KVAdapter, KVAdapterResult, KVStoreValue, LabelFunction, Labels, LabelsClient, LanguageOptions, LinkAdapterProps, CollectionPreferences as ListPreferences, ListQuery, ListViewClientProps, ListViewGroup, ListViewServerProps, ListViewServerPropsOnly, ListViewSlotSharedClientProps, ListViewSlots, LivePreviewConfig, LivePreviewURLType, Locale, LocalizationConfig, LocalizationConfigWithLabels, LocalizationConfigWithNoLabels, LoginResult, LoginWithUsernameOptions, MappedClientComponent, MappedEmptyComponent, MappedServerComponent, MarkdownRichTextAdapter, MarkdownRichTextAdapterProvider, MaybePromise, MeOperationResult, MetaConfig, Migration, MigrationData, MigrationResult, MigrationStatus, MigrationTemplateArgs, NamedGroupField, NamedGroupFieldClient, NamedTab, NavGroupPreferences, NavPreferences, NoResultsClientProps, NoResultsServerProps, NoResultsServerPropsOnly, NonPresentationalField, NonPresentationalFieldClient, NumberField, NumberFieldClient, NumberFieldClientProps, NumberFieldDescriptionClientProps, NumberFieldDescriptionServerProps, NumberFieldDiffClientProps, NumberFieldDiffServerProps, NumberFieldErrorClientProps, NumberFieldErrorServerProps, NumberFieldLabelClientProps, NumberFieldLabelServerProps, NumberFieldManyValidation, NumberFieldServerProps, NumberFieldSingleValidation, NumberFieldValidation, OGImageConfig, Operation, Operator, Option, OptionLabel, OptionObject, OrderableEndpointBody, OriginalFileData, PaginatedDistinctDocs, PaginatedDocs, Params, ParsedErrorResponse, ParsedNonFieldError, ParsedParams, PasswordFieldValidation, PathToQuery, Payload, PayloadClientComponentProps, PayloadClientReactComponent, PayloadComponent, PayloadComponentProps, EmailAdapter as PayloadEmailAdapter, PayloadHandler, PayloadLogger, PayloadReactComponent, PayloadRequest, PayloadRequestAPI, PayloadServerAction, PayloadServerComponentProps, PayloadServerReactComponent, PayloadTypes, PayloadTypesShape, Permission, Permissions, PickPreserveOptional, PinnedDocument, PinnedDocumentsPreferences, Plugin, PluginsMap, PointField, PointFieldClient, PointFieldClientProps, PointFieldDescriptionClientProps, PointFieldDescriptionServerProps, PointFieldDiffClientProps, PointFieldDiffServerProps, PointFieldErrorClientProps, PointFieldErrorServerProps, PointFieldLabelClientProps, PointFieldLabelServerProps, PointFieldServerProps, PointFieldValidation, PolymorphicRelationshipField, PolymorphicRelationshipFieldClient, PopulateType, PreferenceRequest, PreferenceUpdateRequest, PreviewButtonClientProps, PreviewButtonServerProps, PreviewButtonServerPropsOnly, ProbedImageSize, ProviderState, PublishButtonClientProps, PublishButtonServerProps, PublishButtonServerPropsOnly, QueryDrafts, QueryDraftsArgs, QueryPreset, RadioField, RadioFieldClient, RadioFieldClientProps, RadioFieldDescriptionClientProps, RadioFieldDescriptionServerProps, RadioFieldDiffClientProps, RadioFieldDiffServerProps, RadioFieldErrorClientProps, RadioFieldErrorServerProps, RadioFieldLabelClientProps, RadioFieldLabelServerProps, RadioFieldServerProps, RadioFieldValidation, RawParams, RawPayloadComponent, RecentlyViewedItem, RecentlyViewedPreferences, ReconciledSegments, RegisteredImageSizeOptions, RegisteredPlugins, RelatedDocumentsGrouped, RelationshipField, RelationshipFieldClient, RelationshipFieldClientProps, RelationshipFieldDescriptionClientProps, RelationshipFieldDescriptionServerProps, RelationshipFieldDiffClientProps, RelationshipFieldDiffServerProps, RelationshipFieldErrorClientProps, RelationshipFieldErrorServerProps, RelationshipFieldLabelClientProps, RelationshipFieldLabelServerProps, RelationshipFieldManyValidation, RelationshipFieldServerProps, RelationshipFieldSingleValidation, RelationshipFieldValidation, RelationshipValue, RenderConfigArgs, RenderDocumentVersionsProperties, RenderEntityConfigArgs, RenderFieldConfigArgs, RenderRootConfigArgs, RenderedField, ReplaceAny, RequestContext, RequiredDataFromCollection, RequiredDataFromCollectionSlug, ReservedObject, ResolvedComponent, ResolvedFilterOptions, RichTextAdapter, RichTextAdapterProvider, RichTextField, RichTextFieldClient, RichTextFieldClientProps, RichTextFieldDescriptionClientProps, RichTextFieldDescriptionServerProps, RichTextFieldDiffClientProps, RichTextFieldDiffServerProps, RichTextFieldErrorClientProps, RichTextFieldErrorServerProps, RichTextFieldLabelClientProps, RichTextFieldLabelServerProps, RichTextFieldServerProps, RichTextFieldValidation, RichTextHooks, RollbackTransaction, RootLivePreviewConfig, RotateSecretArgs, RotateSecretResult, RouterAdapterComponent, RouterAdapterRouter, Row, RowField, RowFieldClient, RowFieldClientProps, RowFieldDescriptionClientProps, RowFieldDescriptionServerProps, RowFieldDiffClientProps, RowFieldDiffServerProps, RowFieldErrorClientProps, RowFieldErrorServerProps, RowFieldLabelClientProps, RowFieldLabelServerProps, RowFieldServerProps, RowLabel, RowLabelComponent, RunInlineTaskFunction, RunJobAccess, RunJobAccessArgs, RunTaskFunction, RunTaskFunctions, SanitizeFieldArgs, SanitizedAuthorship, SanitizedBlockPermissions, SanitizedBlocksPermissions, SanitizedCollectionConfig, SanitizedCollectionPermission, SanitizedCompoundIndex, SanitizedConfig, SanitizedDashboardConfig, SanitizedDocumentPermissions, SanitizedFieldPermissions, SanitizedFieldsPermissions, SanitizedGlobalConfig, SanitizedGlobalPermission, SanitizedHierarchyConfig, SanitizedHierarchyRelatedCollection, SanitizedJoins, SanitizedLabelProps, SanitizedLocalizationConfig, SanitizedPermissions, SanitizedUploadConfig, SaveButtonClientProps, SaveButtonServerProps, SaveButtonServerPropsOnly, SaveDraftButtonClientProps, SaveDraftButtonServerProps, SaveDraftButtonServerPropsOnly, SchedulePublish, SchedulePublishTaskInput, SchemaVariant, SegmentedUploadCapability, SegmentedUploadLimits, SelectExcludeType, SelectField, SelectFieldClient, SelectFieldClientProps, SelectFieldDescriptionClientProps, SelectFieldDescriptionServerProps, SelectFieldDiffClientProps, SelectFieldDiffServerProps, SelectFieldErrorClientProps, SelectFieldErrorServerProps, SelectFieldLabelClientProps, SelectFieldLabelServerProps, SelectFieldManyValidation, SelectFieldServerProps, SelectFieldSingleValidation, SelectFieldValidation, SelectFn, SelectFnArgs, SelectFnOperation, SelectIncludeType, SelectMode, SelectType, SendEmailOptions, ServerAdapter, ServerComponentProps, ServerFieldBase, ServerFunction, ServerFunctionArgs, ServerFunctionClient, ServerFunctionClientArgs, ServerFunctionConfig, ServerFunctionHandler, ServerOnlyCollectionAdminProperties, ServerOnlyCollectionProperties, ServerOnlyFieldAdminProperties, ServerOnlyFieldProperties, ServerOnlyGlobalAdminProperties, ServerOnlyGlobalProperties, ServerOnlyLivePreviewProperties, ServerOnlyUploadProperties, ServerProps, ServerPropsFromView, DocumentViewServerProps as ServerSideEditViewProps, SharedAdminComponents, SharedEditViewComponents, SharedEntityViews, SharedLocalAPIOptions, SharedProps, SidebarTab, SidebarTabClientProps, SidebarTabServerProps, SidebarTabServerPropsOnly, SingleRelationshipField, SingleRelationshipFieldClient, SingleTaskStatus, SlugField, SlugFieldClient, SlugFieldClientProps, SlugifyServerFunctionArgs, Sort, StaticDescription, StaticLabel, StorageAdapter, StringKeyOf, Tab, TabAsField, TabAsFieldClient, TabsField, TabsFieldClient, TabsFieldClientProps, TabsFieldDescriptionClientProps, TabsFieldDescriptionServerProps, TabsFieldDiffClientProps, TabsFieldDiffServerProps, TabsFieldErrorClientProps, TabsFieldErrorServerProps, TabsFieldLabelClientProps, TabsFieldLabelServerProps, TabsFieldServerProps, TabsPreferences, TagsConfig, TaskConfig, TaskHandler, TaskHandlerArgs, TaskHandlerResult, TaskHandlerResults, TaskInput, TaskOutput, TaskSlug, TextField, TextFieldClient, TextFieldClientProps, TextFieldDescriptionClientProps, TextFieldDescriptionServerProps, TextFieldDiffClientProps, TextFieldDiffServerProps, TextFieldErrorClientProps, TextFieldErrorServerProps, TextFieldLabelClientProps, TextFieldLabelServerProps, TextFieldManyValidation, TextFieldServerProps, TextFieldSingleValidation, TextFieldValidation, TextareaField, TextareaFieldClient, TextareaFieldClientProps, TextareaFieldDescriptionClientProps, TextareaFieldDescriptionServerProps, TextareaFieldDiffClientProps, TextareaFieldDiffServerProps, TextareaFieldErrorClientProps, TextareaFieldErrorServerProps, TextareaFieldLabelClientProps, TextareaFieldLabelServerProps, TextareaFieldServerProps, TextareaFieldValidation, TimePickerProps, Timezone, TimezonesConfig, Transaction, TransformCollectionWithSelect, TransformDataWithSelect, TransformDefinition, TransformFileArgs, TransformFileResult, TransformGlobalWithSelect, TransformValidate, TransformValueSchema, TraverseFieldsCallback, TypeWithID, TypeWithTimestamps, TypeWithVersion, TypedAuthOperations, TypedBlock, TypedCollection, TypedCollectionJoins, TypedCollectionSelect, TypedFallbackLocale, TypedGlobal, TypedGlobalSelect, TypedJobs, TypedLocale, TypedUploadCollection, TypedWidget, UIField, UIFieldClient, UIFieldClientProps, UIFieldDiffClientProps, UIFieldDiffServerProps, UIFieldServerProps, UnauthenticatedClientConfig, UnnamedGroupField, UnnamedGroupFieldClient, UnnamedTab, UnpublishButtonClientProps, UnpublishButtonServerProps, UnpublishButtonServerPropsOnly, UntypedPayloadTypes, UpdateGlobal, UpdateGlobalArgs, UpdateGlobalVersion, UpdateGlobalVersionArgs, UpdateJobs, UpdateJobsArgs, UpdateMany, UpdateManyArgs, UpdateOne, UpdateOneArgs, UpdateVersion, UpdateVersionArgs, UploadCollectionSlug, UploadConfig, UploadEdits, UploadField, UploadFieldClient, UploadFieldClientProps, UploadFieldDescriptionClientProps, UploadFieldDescriptionServerProps, UploadFieldDiffClientProps, UploadFieldDiffServerProps, UploadFieldErrorClientProps, UploadFieldErrorServerProps, UploadFieldLabelClientProps, UploadFieldLabelServerProps, UploadFieldManyValidation, UploadFieldServerProps, UploadFieldSingleValidation, UploadFieldValidation, UploadFilePreviewClientProps, UploadInstructions, UploadInstructionsAccess, UploadInstructionsCapability, UploadInstructionsRequest, UploadSegment, UploadSegmentRequest, UploadSessionCancelReason, UploadSessionDoc, UploadSessionError, UploadSessionIntent, UploadSessionOperation, UploadSessionSaveOptions, UploadSessionStatus, UploadSessionTransferConfig, UploadSessionsConfig, UploadTransformer, Upsert, UpsertArgs, User, UserMenuSettingsGroup, UserMenuSettingsItem, UserSession, UsernameFieldValidation, Validate, ValidateCollectionOptions, ValidateGlobalOptions, ValidateOptions, ValidationFieldError, ValidationResult, ValueWithRelation, VerifyConfig, VersionField, VersionOperations, VersionTab, ViewDescriptionClientProps, ViewDescriptionServerProps, ViewDescriptionServerPropsOnly, ViewTypes, VisibleEntities, Where, WhereField, Widget, WidgetInstance, WidgetServerProps, WidgetSlug, WidgetWidth, WithSelectFn, WithServerSidePropsComponent, WithServerSidePropsComponentProps, WorkflowConfig, WorkflowHandler, WorkflowSlug, checkFileRestrictionsParams };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planUploadStages.d.ts","sourceRoot":"","sources":["../../../../src/uploads/generateFileData/plan/planUploadStages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAUpE,MAAM,MAAM,YAAY,GAAG;IACzB,yEAAyE;IACzE,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,qBAAqB,EAAE,GAAG,CAAC,iBAAiB,EAAE,MAAM,EAAE,CAAC,CAAA;IACvD,mFAAmF;IACnF,kBAAkB,EAAE,OAAO,CAAA;IAC3B,kFAAkF;IAClF,QAAQ,EAAE,iBAAiB,EAAE,CAAA;IAC7B,IAAI,EAAE,UAAU,CAAA;IAChB,aAAa,EAAE,iBAAiB,EAAE,CAAA;CACnC,CAAA;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,WAAW,EACX,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,GAAG,GACJ,EAAE;IACD,oFAAoF;IACpF,iBAAiB,EAAE,OAAO,CAAA;IAC1B,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B,wFAAwF;IACxF,WAAW,CAAC,EAAE;QAAE,kBAAkB,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,UAAU,CAAA;KAAE,CAAA;IAC/D,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,QAAQ,CAAA;IACrB,mBAAmB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACvC,GAAG,EAAE,cAAc,CAAA;CACpB,GAAG,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"planUploadStages.d.ts","sourceRoot":"","sources":["../../../../src/uploads/generateFileData/plan/planUploadStages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAUpE,MAAM,MAAM,YAAY,GAAG;IACzB,yEAAyE;IACzE,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,qBAAqB,EAAE,GAAG,CAAC,iBAAiB,EAAE,MAAM,EAAE,CAAC,CAAA;IACvD,mFAAmF;IACnF,kBAAkB,EAAE,OAAO,CAAA;IAC3B,kFAAkF;IAClF,QAAQ,EAAE,iBAAiB,EAAE,CAAA;IAC7B,IAAI,EAAE,UAAU,CAAA;IAChB,aAAa,EAAE,iBAAiB,EAAE,CAAA;CACnC,CAAA;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,WAAW,EACX,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,GAAG,GACJ,EAAE;IACD,oFAAoF;IACpF,iBAAiB,EAAE,OAAO,CAAA;IAC1B,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B,wFAAwF;IACxF,WAAW,CAAC,EAAE;QAAE,kBAAkB,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,UAAU,CAAA;KAAE,CAAA;IAC/D,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,QAAQ,CAAA;IACrB,mBAAmB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACvC,GAAG,EAAE,cAAc,CAAA;CACpB,GAAG,OAAO,CAAC,YAAY,CAAC,CA4CxB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,UAAU,GACX,EAAE;IACD,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAA;IACnD,UAAU,EAAE,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAA;CACjD,GAAG,QAAQ,CAAC,aAAa,CAAC,CAS1B"}
|
|
@@ -9,7 +9,9 @@ import { toFileUploadError } from '../utils/toFileUploadError.js';
|
|
|
9
9
|
let plan;
|
|
10
10
|
try {
|
|
11
11
|
plan = earlierPlan?.plan.mimeType === mimeType ? earlierPlan.plan : await planUploadPipeline({
|
|
12
|
+
canApplyAtRequest,
|
|
12
13
|
collectionSlug,
|
|
14
|
+
documentID,
|
|
13
15
|
mimeType,
|
|
14
16
|
pipelineDoc,
|
|
15
17
|
pipelineOriginalDoc,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/uploads/generateFileData/plan/planUploadStages.ts"],"sourcesContent":["import type { Document, PayloadRequest } from '../../../types/index.js'\nimport type { UploadTransformer } from '../../transformers/types.js'\nimport type { UploadPlan } from '../../transformState/planUpload.js'\n\nimport {\n getStagesThatRun,\n planUploadPipeline,\n resolveTransformKeyCoverage,\n} from '../../transformState/planUpload.js'\nimport { isFocalPointKey } from '../../transformState/transformKeyClaims.js'\nimport { toFileUploadError } from '../utils/toFileUploadError.js'\n\nexport type UploadStages = {\n /** The one upload bridge that drives the upload, if the plan has any. */\n bridgeTransformer?: UploadTransformer\n claimsOfStagesThatRun: Map<UploadTransformer, string[]>\n /** Request-time stages apply the saved keys, so the default file is not stored. */\n isAppliedAtRequest: boolean\n /** The upload stages that build stored files. Empty when `isAppliedAtRequest`. */\n pipeline: UploadTransformer[]\n plan: UploadPlan\n stagesThatRun: UploadTransformer[]\n}\n\n/**\n * Plans the upload stages for a file of this MIME type, and decides whether the saved keys are\n * applied by upload stages or at request time. A plan made before the file was read is reused\n * when the MIME type is the same.\n */\nexport async function planUploadStages({\n canApplyAtRequest,\n collectionSlug,\n documentID,\n earlierPlan,\n mimeType,\n pipelineDoc,\n pipelineOriginalDoc,\n req,\n}: {\n /** False when no original would be stored for request-time stages to start from. */\n canApplyAtRequest: boolean\n collectionSlug: string\n documentID?: number | string\n /** The rebuild plan, made with the stored MIME type before the stored file was read. */\n earlierPlan?: { isAppliedAtRequest: boolean; plan: UploadPlan }\n mimeType: string\n pipelineDoc: Document\n pipelineOriginalDoc: Readonly<Document>\n req: PayloadRequest\n}): Promise<UploadStages> {\n let plan: UploadPlan\n\n try {\n plan =\n earlierPlan?.plan.mimeType === mimeType\n ? earlierPlan.plan\n : await planUploadPipeline({\n collectionSlug,\n mimeType,\n pipelineDoc,\n pipelineOriginalDoc,\n req,\n })\n } catch (err) {\n throw toFileUploadError({ err, req })\n }\n\n const { isAppliedAtRequest } =\n plan === earlierPlan?.plan\n ? earlierPlan\n : await resolveTransformKeyCoverage({\n // Request-time stages start from the stored original, so one must be stored.\n canApplyAtRequest,\n collectionSlug,\n documentID,\n mimeType,\n pipelineDoc,\n pipelineOriginalDoc,\n plan,\n req,\n }).catch((err: unknown) => {\n throw toFileUploadError({ err, req })\n })\n\n return {\n isAppliedAtRequest,\n // Upload stages build stored files. A default file built at request time has none to build.\n pipeline: isAppliedAtRequest ? [] : plan.pipeline,\n plan,\n ...getStagesThatRun({ collectionSlug, plan }),\n }\n}\n\n/**\n * The saved keys without the ones that the stages that run claim. A duplicate of a stored upload\n * is made from the source's main file, which already has those keys applied, so the copy drops\n * them and they are not applied twice. A focal point only guides sizes, so it is kept.\n */\nexport function withoutAppliedKeys({\n stages,\n transforms,\n}: {\n stages: Pick<UploadStages, 'claimsOfStagesThatRun'>\n transforms: NonNullable<Document['_transforms']>\n}): Document['_transforms'] {\n const appliedKeys = [...stages.claimsOfStagesThatRun.values()]\n .flat()\n .filter((key) => !isFocalPointKey(key))\n const keptTransforms = Object.fromEntries(\n Object.entries(transforms).filter(([key]) => !appliedKeys.includes(key)),\n )\n\n return Object.keys(keptTransforms).length ? keptTransforms : null\n}\n"],"names":["getStagesThatRun","planUploadPipeline","resolveTransformKeyCoverage","isFocalPointKey","toFileUploadError","planUploadStages","canApplyAtRequest","collectionSlug","documentID","earlierPlan","mimeType","pipelineDoc","pipelineOriginalDoc","req","plan","err","isAppliedAtRequest","catch","pipeline","withoutAppliedKeys","stages","transforms","appliedKeys","claimsOfStagesThatRun","values","flat","filter","key","keptTransforms","Object","fromEntries","entries","includes","keys","length"],"mappings":"AAIA,SACEA,gBAAgB,EAChBC,kBAAkB,EAClBC,2BAA2B,QACtB,qCAAoC;AAC3C,SAASC,eAAe,QAAQ,6CAA4C;AAC5E,SAASC,iBAAiB,QAAQ,gCAA+B;AAcjE;;;;CAIC,GACD,OAAO,eAAeC,iBAAiB,EACrCC,iBAAiB,EACjBC,cAAc,EACdC,UAAU,EACVC,WAAW,EACXC,QAAQ,EACRC,WAAW,EACXC,mBAAmB,EACnBC,GAAG,EAYJ;IACC,IAAIC;IAEJ,IAAI;QACFA,OACEL,aAAaK,KAAKJ,aAAaA,WAC3BD,YAAYK,IAAI,GAChB,MAAMb,mBAAmB;
|
|
1
|
+
{"version":3,"sources":["../../../../src/uploads/generateFileData/plan/planUploadStages.ts"],"sourcesContent":["import type { Document, PayloadRequest } from '../../../types/index.js'\nimport type { UploadTransformer } from '../../transformers/types.js'\nimport type { UploadPlan } from '../../transformState/planUpload.js'\n\nimport {\n getStagesThatRun,\n planUploadPipeline,\n resolveTransformKeyCoverage,\n} from '../../transformState/planUpload.js'\nimport { isFocalPointKey } from '../../transformState/transformKeyClaims.js'\nimport { toFileUploadError } from '../utils/toFileUploadError.js'\n\nexport type UploadStages = {\n /** The one upload bridge that drives the upload, if the plan has any. */\n bridgeTransformer?: UploadTransformer\n claimsOfStagesThatRun: Map<UploadTransformer, string[]>\n /** Request-time stages apply the saved keys, so the default file is not stored. */\n isAppliedAtRequest: boolean\n /** The upload stages that build stored files. Empty when `isAppliedAtRequest`. */\n pipeline: UploadTransformer[]\n plan: UploadPlan\n stagesThatRun: UploadTransformer[]\n}\n\n/**\n * Plans the upload stages for a file of this MIME type, and decides whether the saved keys are\n * applied by upload stages or at request time. A plan made before the file was read is reused\n * when the MIME type is the same.\n */\nexport async function planUploadStages({\n canApplyAtRequest,\n collectionSlug,\n documentID,\n earlierPlan,\n mimeType,\n pipelineDoc,\n pipelineOriginalDoc,\n req,\n}: {\n /** False when no original would be stored for request-time stages to start from. */\n canApplyAtRequest: boolean\n collectionSlug: string\n documentID?: number | string\n /** The rebuild plan, made with the stored MIME type before the stored file was read. */\n earlierPlan?: { isAppliedAtRequest: boolean; plan: UploadPlan }\n mimeType: string\n pipelineDoc: Document\n pipelineOriginalDoc: Readonly<Document>\n req: PayloadRequest\n}): Promise<UploadStages> {\n let plan: UploadPlan\n\n try {\n plan =\n earlierPlan?.plan.mimeType === mimeType\n ? earlierPlan.plan\n : await planUploadPipeline({\n canApplyAtRequest,\n collectionSlug,\n documentID,\n mimeType,\n pipelineDoc,\n pipelineOriginalDoc,\n req,\n })\n } catch (err) {\n throw toFileUploadError({ err, req })\n }\n\n const { isAppliedAtRequest } =\n plan === earlierPlan?.plan\n ? earlierPlan\n : await resolveTransformKeyCoverage({\n // Request-time stages start from the stored original, so one must be stored.\n canApplyAtRequest,\n collectionSlug,\n documentID,\n mimeType,\n pipelineDoc,\n pipelineOriginalDoc,\n plan,\n req,\n }).catch((err: unknown) => {\n throw toFileUploadError({ err, req })\n })\n\n return {\n isAppliedAtRequest,\n // Upload stages build stored files. A default file built at request time has none to build.\n pipeline: isAppliedAtRequest ? [] : plan.pipeline,\n plan,\n ...getStagesThatRun({ collectionSlug, plan }),\n }\n}\n\n/**\n * The saved keys without the ones that the stages that run claim. A duplicate of a stored upload\n * is made from the source's main file, which already has those keys applied, so the copy drops\n * them and they are not applied twice. A focal point only guides sizes, so it is kept.\n */\nexport function withoutAppliedKeys({\n stages,\n transforms,\n}: {\n stages: Pick<UploadStages, 'claimsOfStagesThatRun'>\n transforms: NonNullable<Document['_transforms']>\n}): Document['_transforms'] {\n const appliedKeys = [...stages.claimsOfStagesThatRun.values()]\n .flat()\n .filter((key) => !isFocalPointKey(key))\n const keptTransforms = Object.fromEntries(\n Object.entries(transforms).filter(([key]) => !appliedKeys.includes(key)),\n )\n\n return Object.keys(keptTransforms).length ? keptTransforms : null\n}\n"],"names":["getStagesThatRun","planUploadPipeline","resolveTransformKeyCoverage","isFocalPointKey","toFileUploadError","planUploadStages","canApplyAtRequest","collectionSlug","documentID","earlierPlan","mimeType","pipelineDoc","pipelineOriginalDoc","req","plan","err","isAppliedAtRequest","catch","pipeline","withoutAppliedKeys","stages","transforms","appliedKeys","claimsOfStagesThatRun","values","flat","filter","key","keptTransforms","Object","fromEntries","entries","includes","keys","length"],"mappings":"AAIA,SACEA,gBAAgB,EAChBC,kBAAkB,EAClBC,2BAA2B,QACtB,qCAAoC;AAC3C,SAASC,eAAe,QAAQ,6CAA4C;AAC5E,SAASC,iBAAiB,QAAQ,gCAA+B;AAcjE;;;;CAIC,GACD,OAAO,eAAeC,iBAAiB,EACrCC,iBAAiB,EACjBC,cAAc,EACdC,UAAU,EACVC,WAAW,EACXC,QAAQ,EACRC,WAAW,EACXC,mBAAmB,EACnBC,GAAG,EAYJ;IACC,IAAIC;IAEJ,IAAI;QACFA,OACEL,aAAaK,KAAKJ,aAAaA,WAC3BD,YAAYK,IAAI,GAChB,MAAMb,mBAAmB;YACvBK;YACAC;YACAC;YACAE;YACAC;YACAC;YACAC;QACF;IACR,EAAE,OAAOE,KAAK;QACZ,MAAMX,kBAAkB;YAAEW;YAAKF;QAAI;IACrC;IAEA,MAAM,EAAEG,kBAAkB,EAAE,GAC1BF,SAASL,aAAaK,OAClBL,cACA,MAAMP,4BAA4B;QAChC,6EAA6E;QAC7EI;QACAC;QACAC;QACAE;QACAC;QACAC;QACAE;QACAD;IACF,GAAGI,KAAK,CAAC,CAACF;QACR,MAAMX,kBAAkB;YAAEW;YAAKF;QAAI;IACrC;IAEN,OAAO;QACLG;QACA,4FAA4F;QAC5FE,UAAUF,qBAAqB,EAAE,GAAGF,KAAKI,QAAQ;QACjDJ;QACA,GAAGd,iBAAiB;YAAEO;YAAgBO;QAAK,EAAE;IAC/C;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASK,mBAAmB,EACjCC,MAAM,EACNC,UAAU,EAIX;IACC,MAAMC,cAAc;WAAIF,OAAOG,qBAAqB,CAACC,MAAM;KAAG,CAC3DC,IAAI,GACJC,MAAM,CAAC,CAACC,MAAQ,CAACxB,gBAAgBwB;IACpC,MAAMC,iBAAiBC,OAAOC,WAAW,CACvCD,OAAOE,OAAO,CAACV,YAAYK,MAAM,CAAC,CAAC,CAACC,IAAI,GAAK,CAACL,YAAYU,QAAQ,CAACL;IAGrE,OAAOE,OAAOI,IAAI,CAACL,gBAAgBM,MAAM,GAAGN,iBAAiB;AAC/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBaseFields.d.ts","sourceRoot":"","sources":["../../src/uploads/getBaseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AAsBtD,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,gBAAgB,CAAA;IAC5B,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,mBAAmB,2BAA4B,OAAO,KAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"getBaseFields.d.ts","sourceRoot":"","sources":["../../src/uploads/getBaseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AAsBtD,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,gBAAgB,CAAA;IAC5B,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,mBAAmB,2BAA4B,OAAO,KAAG,KAAK,EAuX1E,CAAA"}
|
|
@@ -340,7 +340,10 @@ export const getBaseUploadFields = ({ collection, config })=>{
|
|
|
340
340
|
admin: {
|
|
341
341
|
...mimeType.admin,
|
|
342
342
|
...disabledFromImageSize(size.admin)
|
|
343
|
-
}
|
|
343
|
+
},
|
|
344
|
+
// `upload.mimeTypes` limits the files a user can upload. A variant is a transformer's
|
|
345
|
+
// output: it may use another format, and a variant built on request has no MIME type yet.
|
|
346
|
+
validate: undefined
|
|
344
347
|
},
|
|
345
348
|
{
|
|
346
349
|
...filesize,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/uploads/getBaseFields.ts"],"sourcesContent":["import type { CollectionConfig } from '../collections/config/types.js'\nimport type { Config } from '../config/types.js'\nimport type { Field } from '../fields/config/types.js'\nimport type { SanitizedUploadConfig } from './types.js'\n\nimport { generateFilePathOrURL } from './generateFilePathOrURL.js'\nimport { shouldRequestOriginal } from './isOriginalFileRequest.js'\nimport { mimeTypeValidator } from './mimeTypeValidator.js'\nimport { getTransformStateSchema } from './transformState/transformStateSchema.js'\nimport { validateTransformState } from './transformState/validateTransformState.js'\nimport { validateUploadFilename } from './validateUploadFilename.js'\n\nconst disabledFromImageSize = (\n sizeAdmin: { disabled?: { column?: boolean; filter?: boolean; groupBy?: boolean } } | undefined,\n): { disabled: { column: boolean; filter: boolean; groupBy: boolean } } => {\n return {\n disabled: {\n column: sizeAdmin?.disabled?.column ?? false,\n filter: sizeAdmin?.disabled?.filter ?? false,\n groupBy: sizeAdmin?.disabled?.groupBy ?? false,\n },\n }\n}\n\ntype Options = {\n collection: CollectionConfig\n config: Config\n}\n\nexport const getBaseUploadFields = ({ collection, config }: Options): Field[] => {\n // `variants` only exists once a transformer (e.g. Sharp) has written it back during init.\n const uploadOptions: Partial<SanitizedUploadConfig> =\n typeof collection.upload === 'object' ? collection.upload : {}\n\n const mimeType: Field = {\n name: 'mimeType',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: 'MIME Type',\n }\n\n const thumbnailURL: Field = {\n name: 'thumbnailURL',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n hooks: {\n afterRead: [\n ({ originalDoc, req }) => {\n const adminThumbnail =\n typeof collection.upload !== 'boolean' ? collection.upload?.adminThumbnail : undefined\n\n if (typeof adminThumbnail === 'function') {\n return adminThumbnail({ doc: originalDoc })\n }\n\n return generateFilePathOrURL({\n collectionSlug: collection.slug,\n config,\n filename:\n typeof adminThumbnail === 'string'\n ? (originalDoc.variants?.[adminThumbnail]?.filename as string)\n : undefined,\n relative: false,\n serverURL: req.payload.config.serverURL,\n urlOrPath:\n typeof adminThumbnail === 'string'\n ? (originalDoc.variants?.[adminThumbnail]?.url as string)\n : undefined,\n })\n },\n ],\n },\n label: 'Thumbnail URL',\n }\n\n const width: Field = {\n name: 'width',\n type: 'number',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: ({ t }) => t('upload:width'),\n }\n\n const height: Field = {\n name: 'height',\n type: 'number',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: ({ t }) => t('upload:height'),\n }\n\n const filesize: Field = {\n name: 'filesize',\n type: 'number',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: ({ t }) => t('upload:fileSize'),\n }\n\n // Set only by core, and only to `false`, for a file entry with no stored object. A missing value\n // means stored. `sanitizeUploadData` drops client input. Like `_objectKey`, it is not\n // field-level `hidden`, because that would remove it before the URL hooks can read it.\n const storedField: Field = {\n name: '_stored',\n type: 'checkbox',\n admin: { disabled: true, hidden: true, readOnly: true },\n }\n\n const filename: Field = {\n name: 'filename',\n type: 'text',\n admin: {\n disabled: { bulkEdit: true },\n hidden: true,\n readOnly: true,\n },\n index: true,\n label: ({ t }) => t('upload:fileName'),\n validate: validateUploadFilename,\n }\n\n // Only set unique: true if the collection does not have a compound index\n if (\n collection.upload === true ||\n (typeof collection.upload === 'object' && !collection.upload.filenameCompoundIndex)\n ) {\n filename.unique = true\n }\n\n const url: Field = {\n name: 'url',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: 'URL',\n }\n\n let uploadFields: Field[] = [\n {\n ...url,\n hooks: {\n afterRead: [\n ({ data, originalDoc, req, value }) =>\n generateFilePathOrURL({\n collectionSlug: collection.slug,\n config,\n filename: data?.filename || originalDoc?.filename,\n relative: false,\n serverURL: req.payload.config.serverURL,\n urlOrPath: value,\n }),\n ],\n beforeChange: [\n ({ collection, data, originalDoc, req, value }) =>\n generateFilePathOrURL({\n collectionSlug: collection?.slug as string,\n config,\n filename: data?.filename || originalDoc?.filename,\n relative: true,\n serverURL: req.payload.config.serverURL,\n urlOrPath: value,\n }),\n ],\n },\n },\n thumbnailURL,\n filename,\n mimeType,\n filesize,\n width,\n height,\n storedField,\n {\n name: '_transforms',\n type: 'json',\n admin: { disabled: true },\n hooks: {\n beforeChange: [\n ({ operation, value }) => {\n const isEmptyObject =\n value &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n !Object.keys(value).length\n\n return isEmptyObject || (operation === 'create' && value === undefined) ? null : value\n },\n ],\n },\n interfaceName: 'UploadTransforms',\n jsonSchema: {\n fileMatch: ['payload://upload-transforms'],\n schema: getTransformStateSchema({ transformers: config.upload?.transformers ?? [] }),\n uri: 'payload://upload-transforms',\n },\n label: 'Transforms',\n validate: validateTransformState,\n },\n {\n name: 'original',\n type: 'group',\n admin: {\n hidden: true,\n readOnly: true,\n },\n fields: [\n { ...filename, unique: false },\n {\n ...url,\n hooks: {\n afterRead: [\n ({ data, originalDoc, req, value }) => {\n return generateFilePathOrURL({\n collectionSlug: collection.slug,\n config,\n filename: data?.original?.filename || originalDoc?.original?.filename,\n isOriginal: shouldRequestOriginal({ doc: data ?? originalDoc }),\n relative: false,\n serverURL: req.payload.config.serverURL,\n urlOrPath: value,\n })\n },\n ],\n beforeChange: [\n ({ data, originalDoc, req, value }) => {\n return generateFilePathOrURL({\n collectionSlug: collection.slug,\n config,\n filename: data?.original?.filename || originalDoc?.original?.filename,\n isOriginal: shouldRequestOriginal({ doc: data ?? originalDoc }),\n relative: true,\n serverURL: req.payload.config.serverURL,\n urlOrPath: value,\n })\n },\n ],\n },\n },\n mimeType,\n filesize,\n width,\n height,\n {\n name: 'prefix',\n type: 'text',\n admin: { disabled: true, hidden: true, readOnly: true },\n },\n {\n name: '_objectKey',\n type: 'text',\n admin: { disabled: true, hidden: true, readOnly: true },\n },\n storedField,\n ],\n },\n ]\n\n // Add focal point fields if not disabled\n if (\n uploadOptions.focalPoint !== false ||\n uploadOptions.variants ||\n uploadOptions.hasImageAdjustments\n ) {\n uploadFields = uploadFields.concat(\n ['focalX', 'focalY'].map((name) => {\n return {\n name,\n type: 'number',\n admin: {\n disabled: { column: true, filter: true, groupBy: true },\n hidden: true,\n },\n }\n }),\n )\n }\n\n if (uploadOptions.mimeTypes) {\n mimeType.validate = mimeTypeValidator(uploadOptions.mimeTypes)\n }\n\n if (uploadOptions.variants) {\n uploadFields = uploadFields.concat([\n {\n name: 'variants',\n type: 'group',\n admin: {\n hidden: true,\n },\n fields: uploadOptions.variants.map((size) => ({\n name: size.name,\n type: 'group',\n admin: {\n hidden: true,\n ...disabledFromImageSize(size.admin),\n },\n fields: [\n {\n ...url,\n admin: {\n ...url.admin,\n ...disabledFromImageSize(size.admin),\n },\n hooks: {\n afterRead: [\n ({ collection, data, originalDoc, req, value }) =>\n generateFilePathOrURL({\n collectionSlug: collection?.slug as string,\n config,\n filename:\n data?.variants?.[size.name]?.filename ||\n originalDoc?.variants?.[size.name]?.filename,\n relative: false,\n serverURL: req.payload.config.serverURL,\n urlOrPath: value,\n }),\n ],\n beforeChange: [\n ({ collection, data, originalDoc, req, value }) =>\n generateFilePathOrURL({\n collectionSlug: collection?.slug as string,\n config,\n filename:\n data?.variants?.[size.name]?.filename ||\n originalDoc?.variants?.[size.name]?.filename,\n relative: true,\n serverURL: req.payload.config.serverURL,\n urlOrPath: value,\n }),\n ],\n },\n },\n {\n ...width,\n admin: {\n ...width.admin,\n ...disabledFromImageSize(size.admin),\n },\n },\n {\n ...height,\n admin: {\n ...height.admin,\n ...disabledFromImageSize(size.admin),\n },\n },\n {\n ...mimeType,\n admin: {\n ...mimeType.admin,\n ...disabledFromImageSize(size.admin),\n },\n },\n {\n ...filesize,\n admin: {\n ...filesize.admin,\n ...disabledFromImageSize(size.admin),\n },\n },\n {\n ...filename,\n admin: {\n ...filename.admin,\n ...disabledFromImageSize(size.admin),\n },\n unique: false,\n },\n {\n name: 'prefix',\n type: 'text',\n admin: { disabled: true, hidden: true, readOnly: true },\n },\n {\n name: '_objectKey',\n type: 'text',\n admin: { disabled: true, hidden: true, readOnly: true },\n },\n storedField,\n ],\n label: size.name,\n })),\n label: ({ t }) => t('upload:sizes'),\n },\n ])\n }\n return uploadFields\n}\n"],"names":["generateFilePathOrURL","shouldRequestOriginal","mimeTypeValidator","getTransformStateSchema","validateTransformState","validateUploadFilename","disabledFromImageSize","sizeAdmin","disabled","column","filter","groupBy","getBaseUploadFields","collection","config","uploadOptions","upload","mimeType","name","type","admin","hidden","readOnly","label","thumbnailURL","hooks","afterRead","originalDoc","req","adminThumbnail","undefined","doc","collectionSlug","slug","filename","variants","relative","serverURL","payload","urlOrPath","url","width","t","height","filesize","storedField","bulkEdit","index","validate","filenameCompoundIndex","unique","uploadFields","data","value","beforeChange","operation","isEmptyObject","Array","isArray","Object","keys","length","interfaceName","jsonSchema","fileMatch","schema","transformers","uri","fields","original","isOriginal","focalPoint","hasImageAdjustments","concat","map","mimeTypes","size"],"mappings":"AAKA,SAASA,qBAAqB,QAAQ,6BAA4B;AAClE,SAASC,qBAAqB,QAAQ,6BAA4B;AAClE,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,uBAAuB,QAAQ,2CAA0C;AAClF,SAASC,sBAAsB,QAAQ,6CAA4C;AACnF,SAASC,sBAAsB,QAAQ,8BAA6B;AAEpE,MAAMC,wBAAwB,CAC5BC;IAEA,OAAO;QACLC,UAAU;YACRC,QAAQF,WAAWC,UAAUC,UAAU;YACvCC,QAAQH,WAAWC,UAAUE,UAAU;YACvCC,SAASJ,WAAWC,UAAUG,WAAW;QAC3C;IACF;AACF;AAOA,OAAO,MAAMC,sBAAsB,CAAC,EAAEC,UAAU,EAAEC,MAAM,EAAW;IACjE,0FAA0F;IAC1F,MAAMC,gBACJ,OAAOF,WAAWG,MAAM,KAAK,WAAWH,WAAWG,MAAM,GAAG,CAAC;IAE/D,MAAMC,WAAkB;QACtBC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,QAAQ;YACRC,UAAU;QACZ;QACAC,OAAO;IACT;IAEA,MAAMC,eAAsB;QAC1BN,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,QAAQ;YACRC,UAAU;QACZ;QACAG,OAAO;YACLC,WAAW;gBACT,CAAC,EAAEC,WAAW,EAAEC,GAAG,EAAE;oBACnB,MAAMC,iBACJ,OAAOhB,WAAWG,MAAM,KAAK,YAAYH,WAAWG,MAAM,EAAEa,iBAAiBC;oBAE/E,IAAI,OAAOD,mBAAmB,YAAY;wBACxC,OAAOA,eAAe;4BAAEE,KAAKJ;wBAA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GAAGd,sBAAsBsE,KAAKxD,KAAK,CAAC;gCACtC;gCACA8B,QAAQ;4BACV;4BACA;gCACEhC,MAAM;gCACNC,MAAM;gCACNC,OAAO;oCAAEZ,UAAU;oCAAMa,QAAQ;oCAAMC,UAAU;gCAAK;4BACxD;4BACA;gCACEJ,MAAM;gCACNC,MAAM;gCACNC,OAAO;oCAAEZ,UAAU;oCAAMa,QAAQ;oCAAMC,UAAU;gCAAK;4BACxD;4BACAuB;yBACD;wBACDtB,OAAOqD,KAAK1D,IAAI;oBAClB,CAAA;gBACAK,OAAO,CAAC,EAAEmB,CAAC,EAAE,GAAKA,EAAE;YACtB;SACD;IACH;IACA,OAAOS;AACT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/uploads/getBaseFields.ts"],"sourcesContent":["import type { CollectionConfig } from '../collections/config/types.js'\nimport type { Config } from '../config/types.js'\nimport type { Field } from '../fields/config/types.js'\nimport type { SanitizedUploadConfig } from './types.js'\n\nimport { generateFilePathOrURL } from './generateFilePathOrURL.js'\nimport { shouldRequestOriginal } from './isOriginalFileRequest.js'\nimport { mimeTypeValidator } from './mimeTypeValidator.js'\nimport { getTransformStateSchema } from './transformState/transformStateSchema.js'\nimport { validateTransformState } from './transformState/validateTransformState.js'\nimport { validateUploadFilename } from './validateUploadFilename.js'\n\nconst disabledFromImageSize = (\n sizeAdmin: { disabled?: { column?: boolean; filter?: boolean; groupBy?: boolean } } | undefined,\n): { disabled: { column: boolean; filter: boolean; groupBy: boolean } } => {\n return {\n disabled: {\n column: sizeAdmin?.disabled?.column ?? false,\n filter: sizeAdmin?.disabled?.filter ?? false,\n groupBy: sizeAdmin?.disabled?.groupBy ?? false,\n },\n }\n}\n\ntype Options = {\n collection: CollectionConfig\n config: Config\n}\n\nexport const getBaseUploadFields = ({ collection, config }: Options): Field[] => {\n // `variants` only exists once a transformer (e.g. Sharp) has written it back during init.\n const uploadOptions: Partial<SanitizedUploadConfig> =\n typeof collection.upload === 'object' ? collection.upload : {}\n\n const mimeType: Field = {\n name: 'mimeType',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: 'MIME Type',\n }\n\n const thumbnailURL: Field = {\n name: 'thumbnailURL',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n hooks: {\n afterRead: [\n ({ originalDoc, req }) => {\n const adminThumbnail =\n typeof collection.upload !== 'boolean' ? collection.upload?.adminThumbnail : undefined\n\n if (typeof adminThumbnail === 'function') {\n return adminThumbnail({ doc: originalDoc })\n }\n\n return generateFilePathOrURL({\n collectionSlug: collection.slug,\n config,\n filename:\n typeof adminThumbnail === 'string'\n ? (originalDoc.variants?.[adminThumbnail]?.filename as string)\n : undefined,\n relative: false,\n serverURL: req.payload.config.serverURL,\n urlOrPath:\n typeof adminThumbnail === 'string'\n ? (originalDoc.variants?.[adminThumbnail]?.url as string)\n : undefined,\n })\n },\n ],\n },\n label: 'Thumbnail URL',\n }\n\n const width: Field = {\n name: 'width',\n type: 'number',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: ({ t }) => t('upload:width'),\n }\n\n const height: Field = {\n name: 'height',\n type: 'number',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: ({ t }) => t('upload:height'),\n }\n\n const filesize: Field = {\n name: 'filesize',\n type: 'number',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: ({ t }) => t('upload:fileSize'),\n }\n\n // Set only by core, and only to `false`, for a file entry with no stored object. A missing value\n // means stored. `sanitizeUploadData` drops client input. Like `_objectKey`, it is not\n // field-level `hidden`, because that would remove it before the URL hooks can read it.\n const storedField: Field = {\n name: '_stored',\n type: 'checkbox',\n admin: { disabled: true, hidden: true, readOnly: true },\n }\n\n const filename: Field = {\n name: 'filename',\n type: 'text',\n admin: {\n disabled: { bulkEdit: true },\n hidden: true,\n readOnly: true,\n },\n index: true,\n label: ({ t }) => t('upload:fileName'),\n validate: validateUploadFilename,\n }\n\n // Only set unique: true if the collection does not have a compound index\n if (\n collection.upload === true ||\n (typeof collection.upload === 'object' && !collection.upload.filenameCompoundIndex)\n ) {\n filename.unique = true\n }\n\n const url: Field = {\n name: 'url',\n type: 'text',\n admin: {\n hidden: true,\n readOnly: true,\n },\n label: 'URL',\n }\n\n let uploadFields: Field[] = [\n {\n ...url,\n hooks: {\n afterRead: [\n ({ data, originalDoc, req, value }) =>\n generateFilePathOrURL({\n collectionSlug: collection.slug,\n config,\n filename: data?.filename || originalDoc?.filename,\n relative: false,\n serverURL: req.payload.config.serverURL,\n urlOrPath: value,\n }),\n ],\n beforeChange: [\n ({ collection, data, originalDoc, req, value }) =>\n generateFilePathOrURL({\n collectionSlug: collection?.slug as string,\n config,\n filename: data?.filename || originalDoc?.filename,\n relative: true,\n serverURL: req.payload.config.serverURL,\n urlOrPath: value,\n }),\n ],\n },\n },\n thumbnailURL,\n filename,\n mimeType,\n filesize,\n width,\n height,\n storedField,\n {\n name: '_transforms',\n type: 'json',\n admin: { disabled: true },\n hooks: {\n beforeChange: [\n ({ operation, value }) => {\n const isEmptyObject =\n value &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n !Object.keys(value).length\n\n return isEmptyObject || (operation === 'create' && value === undefined) ? null : value\n },\n ],\n },\n interfaceName: 'UploadTransforms',\n jsonSchema: {\n fileMatch: ['payload://upload-transforms'],\n schema: getTransformStateSchema({ transformers: config.upload?.transformers ?? [] }),\n uri: 'payload://upload-transforms',\n },\n label: 'Transforms',\n validate: validateTransformState,\n },\n {\n name: 'original',\n type: 'group',\n admin: {\n hidden: true,\n readOnly: true,\n },\n fields: [\n { ...filename, unique: false },\n {\n ...url,\n hooks: {\n afterRead: [\n ({ data, originalDoc, req, value }) => {\n return generateFilePathOrURL({\n collectionSlug: collection.slug,\n config,\n filename: data?.original?.filename || originalDoc?.original?.filename,\n isOriginal: shouldRequestOriginal({ doc: data ?? originalDoc }),\n relative: false,\n serverURL: req.payload.config.serverURL,\n urlOrPath: value,\n })\n },\n ],\n beforeChange: [\n ({ data, originalDoc, req, value }) => {\n return generateFilePathOrURL({\n collectionSlug: collection.slug,\n config,\n filename: data?.original?.filename || originalDoc?.original?.filename,\n isOriginal: shouldRequestOriginal({ doc: data ?? originalDoc }),\n relative: true,\n serverURL: req.payload.config.serverURL,\n urlOrPath: value,\n })\n },\n ],\n },\n },\n mimeType,\n filesize,\n width,\n height,\n {\n name: 'prefix',\n type: 'text',\n admin: { disabled: true, hidden: true, readOnly: true },\n },\n {\n name: '_objectKey',\n type: 'text',\n admin: { disabled: true, hidden: true, readOnly: true },\n },\n storedField,\n ],\n },\n ]\n\n // Add focal point fields if not disabled\n if (\n uploadOptions.focalPoint !== false ||\n uploadOptions.variants ||\n uploadOptions.hasImageAdjustments\n ) {\n uploadFields = uploadFields.concat(\n ['focalX', 'focalY'].map((name) => {\n return {\n name,\n type: 'number',\n admin: {\n disabled: { column: true, filter: true, groupBy: true },\n hidden: true,\n },\n }\n }),\n )\n }\n\n if (uploadOptions.mimeTypes) {\n mimeType.validate = mimeTypeValidator(uploadOptions.mimeTypes)\n }\n\n if (uploadOptions.variants) {\n uploadFields = uploadFields.concat([\n {\n name: 'variants',\n type: 'group',\n admin: {\n hidden: true,\n },\n fields: uploadOptions.variants.map((size) => ({\n name: size.name,\n type: 'group',\n admin: {\n hidden: true,\n ...disabledFromImageSize(size.admin),\n },\n fields: [\n {\n ...url,\n admin: {\n ...url.admin,\n ...disabledFromImageSize(size.admin),\n },\n hooks: {\n afterRead: [\n ({ collection, data, originalDoc, req, value }) =>\n generateFilePathOrURL({\n collectionSlug: collection?.slug as string,\n config,\n filename:\n data?.variants?.[size.name]?.filename ||\n originalDoc?.variants?.[size.name]?.filename,\n relative: false,\n serverURL: req.payload.config.serverURL,\n urlOrPath: value,\n }),\n ],\n beforeChange: [\n ({ collection, data, originalDoc, req, value }) =>\n generateFilePathOrURL({\n collectionSlug: collection?.slug as string,\n config,\n filename:\n data?.variants?.[size.name]?.filename ||\n originalDoc?.variants?.[size.name]?.filename,\n relative: true,\n serverURL: req.payload.config.serverURL,\n urlOrPath: value,\n }),\n ],\n },\n },\n {\n ...width,\n admin: {\n ...width.admin,\n ...disabledFromImageSize(size.admin),\n },\n },\n {\n ...height,\n admin: {\n ...height.admin,\n ...disabledFromImageSize(size.admin),\n },\n },\n {\n ...mimeType,\n admin: {\n ...mimeType.admin,\n ...disabledFromImageSize(size.admin),\n },\n // `upload.mimeTypes` limits the files a user can upload. A variant is a transformer's\n // output: it may use another format, and a variant built on request has no MIME type yet.\n validate: undefined,\n },\n {\n ...filesize,\n admin: {\n ...filesize.admin,\n ...disabledFromImageSize(size.admin),\n },\n },\n {\n ...filename,\n admin: {\n ...filename.admin,\n ...disabledFromImageSize(size.admin),\n },\n unique: false,\n },\n {\n name: 'prefix',\n type: 'text',\n admin: { disabled: true, hidden: true, readOnly: true },\n },\n {\n name: '_objectKey',\n type: 'text',\n admin: { disabled: true, hidden: true, readOnly: true },\n },\n storedField,\n ],\n label: size.name,\n })),\n label: ({ t }) => t('upload:sizes'),\n },\n ])\n }\n return uploadFields\n}\n"],"names":["generateFilePathOrURL","shouldRequestOriginal","mimeTypeValidator","getTransformStateSchema","validateTransformState","validateUploadFilename","disabledFromImageSize","sizeAdmin","disabled","column","filter","groupBy","getBaseUploadFields","collection","config","uploadOptions","upload","mimeType","name","type","admin","hidden","readOnly","label","thumbnailURL","hooks","afterRead","originalDoc","req","adminThumbnail","undefined","doc","collectionSlug","slug","filename","variants","relative","serverURL","payload","urlOrPath","url","width","t","height","filesize","storedField","bulkEdit","index","validate","filenameCompoundIndex","unique","uploadFields","data","value","beforeChange","operation","isEmptyObject","Array","isArray","Object","keys","length","interfaceName","jsonSchema","fileMatch","schema","transformers","uri","fields","original","isOriginal","focalPoint","hasImageAdjustments","concat","map","mimeTypes","size"],"mappings":"AAKA,SAASA,qBAAqB,QAAQ,6BAA4B;AAClE,SAASC,qBAAqB,QAAQ,6BAA4B;AAClE,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,uBAAuB,QAAQ,2CAA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;gBACAK,OAAO,CAAC,EAAEmB,CAAC,EAAE,GAAKA,EAAE;YACtB;SACD;IACH;IACA,OAAOS;AACT,EAAC"}
|
|
@@ -47,7 +47,10 @@ export declare function planUploadRebuild({ canApplyAtRequest, documentID, hasCr
|
|
|
47
47
|
rebuildPlan?: UploadPlan;
|
|
48
48
|
}>;
|
|
49
49
|
/** Plans the upload pipeline for one MIME type, without checking claims. */
|
|
50
|
-
export declare function planUploadPipeline({
|
|
50
|
+
export declare function planUploadPipeline({ canApplyAtRequest, documentID, mimeType, ...planArgs }: {
|
|
51
|
+
/** False when no original would be stored for request-time stages to start from. */
|
|
52
|
+
canApplyAtRequest: boolean;
|
|
53
|
+
documentID?: number | string;
|
|
51
54
|
mimeType: string;
|
|
52
55
|
} & PlanArgs): Promise<UploadPlan>;
|
|
53
56
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planUpload.d.ts","sourceRoot":"","sources":["../../../src/uploads/transformState/planUpload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAA;AAC5F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAOjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAG5E,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,0BAA0B,CAAA;AAE1E;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,MAAM,GAAG,SAAS,CAAA;AAE3F,KAAK,QAAQ,GAAG;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,QAAQ,CAAA;IACrB,mBAAmB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACvC,GAAG,EAAE,cAAc,CA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AAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAA;AAEzF;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,cAAc,EACd,UAAU,EACV,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,GAAG,GACJ,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAStD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,gBAAgB,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,EAC1C,uBAAuB,GACxB,EAAE;IACD,gBAAgB,EAAE,oBAAoB,CAAA;IACtC,uBAAuB,CAAC,EAAE,MAAM,CAAA;CACjC,GAAG,OAAO,CAOV;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,EAC5C,gBAAgB,EAChB,uBAAuB,GACxB,EAAE;IACD,gBAAgB,EAAE,oBAAoB,CAAA;IACtC,uBAAuB,CAAC,EAAE,MAAM,CAAA;CACjC,GAAG,OAAO,CAKV"}
|
|
@@ -33,6 +33,8 @@ import { isClaimRequired, isFocalPointKey } from './transformKeyClaims.js';
|
|
|
33
33
|
}
|
|
34
34
|
const rebuildPlan = await planUploadPipeline({
|
|
35
35
|
...planArgs,
|
|
36
|
+
canApplyAtRequest,
|
|
37
|
+
documentID,
|
|
36
38
|
mimeType: storedMimeType
|
|
37
39
|
});
|
|
38
40
|
const hasRequiredChange = isDuplicating || hasCropOrResizeEdit || changedKeys.some(isClaimRequired);
|
|
@@ -80,7 +82,8 @@ import { isClaimRequired, isFocalPointKey } from './transformKeyClaims.js';
|
|
|
80
82
|
plan
|
|
81
83
|
}).stagesThatRun.some((transformer)=>plan.claims.get(transformer)?.some((key)=>optionalChangedKeys.includes(key)));
|
|
82
84
|
}
|
|
83
|
-
/** Plans the upload pipeline for one MIME type, without checking claims. */ export async function planUploadPipeline({
|
|
85
|
+
/** Plans the upload pipeline for one MIME type, without checking claims. */ export async function planUploadPipeline({ canApplyAtRequest, documentID, mimeType, ...planArgs }) {
|
|
86
|
+
const { collectionSlug, pipelineOriginalDoc, req } = planArgs;
|
|
84
87
|
const plan = await planTransformerPipeline({
|
|
85
88
|
args: {
|
|
86
89
|
collectionSlug,
|
|
@@ -93,11 +96,58 @@ import { isClaimRequired, isFocalPointKey } from './transformKeyClaims.js';
|
|
|
93
96
|
capability: 'transformFile',
|
|
94
97
|
transformers: req.payload.config.upload?.transformers ?? []
|
|
95
98
|
});
|
|
99
|
+
const variantsOwnerSlug = canApplyAtRequest ? await getVariantsOwnerThatBuildsAtRequest({
|
|
100
|
+
...planArgs,
|
|
101
|
+
documentID,
|
|
102
|
+
mimeType
|
|
103
|
+
}) : undefined;
|
|
96
104
|
return {
|
|
97
|
-
...
|
|
105
|
+
...variantsOwnerSlug ? withoutBridgesThatDoNotOwnCollection({
|
|
106
|
+
collectionSlug,
|
|
107
|
+
plan,
|
|
108
|
+
variantsOwnerSlug
|
|
109
|
+
}) : plan,
|
|
98
110
|
mimeType
|
|
99
111
|
};
|
|
100
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* The slug of the transformer that registered the collection's sizes, when it can build the
|
|
115
|
+
* default file and the sizes from the original at request time. Otherwise `undefined`.
|
|
116
|
+
*/ async function getVariantsOwnerThatBuildsAtRequest({ documentID, mimeType, ...planArgs }) {
|
|
117
|
+
const upload = planArgs.req.payload.collections?.[planArgs.collectionSlug]?.config.upload;
|
|
118
|
+
const variantsTransformerSlug = upload?.variantsTransformerSlug;
|
|
119
|
+
if (!upload?.variants?.length || !variantsTransformerSlug) {
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
const canOwnerBuild = await canBuildAtRequest({
|
|
123
|
+
...planArgs,
|
|
124
|
+
documentID,
|
|
125
|
+
mimeType,
|
|
126
|
+
requiredTransformerSlug: variantsTransformerSlug
|
|
127
|
+
});
|
|
128
|
+
return canOwnerBuild ? variantsTransformerSlug : undefined;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The plan without the upload bridges that do not own the collection. The transformer that
|
|
132
|
+
* registered the sizes owns the collection's files, so a bridge must not build a main file that
|
|
133
|
+
* differs from those sizes. A bridge that the collection is configured on still runs.
|
|
134
|
+
*/ function withoutBridgesThatDoNotOwnCollection({ collectionSlug, plan, variantsOwnerSlug }) {
|
|
135
|
+
const isKept = (transformer)=>{
|
|
136
|
+
const bridge = getUploadTransformerInternal(transformer);
|
|
137
|
+
return !bridge?.transformUpload || transformer.slug === variantsOwnerSlug || Boolean(bridge.handlesCollection?.({
|
|
138
|
+
collectionSlug
|
|
139
|
+
}));
|
|
140
|
+
};
|
|
141
|
+
return {
|
|
142
|
+
claims: new Map([
|
|
143
|
+
...plan.claims
|
|
144
|
+
].filter(([transformer])=>isKept(transformer))),
|
|
145
|
+
options: new Map([
|
|
146
|
+
...plan.options
|
|
147
|
+
].filter(([transformer])=>isKept(transformer))),
|
|
148
|
+
pipeline: plan.pipeline.filter(isKept)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
101
151
|
/**
|
|
102
152
|
* The planned stages that run. Only one Sharp bridge drives an upload: the one that owns the
|
|
103
153
|
* collection, or the first. The other bridges do not run, so they do not count as claimers, and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/uploads/transformState/planUpload.ts"],"sourcesContent":["import type { Document, PayloadRequest } from '../../types/index.js'\nimport type { PlannedTransformerPipeline } from '../transformers/planTransformerPipeline.js'\nimport type { UploadTransformer } from '../transformers/types.js'\n\nimport { ValidationError } from '../../errors/ValidationError.js'\nimport { planTransformerPipeline } from '../transformers/planTransformerPipeline.js'\nimport { getUploadTransformerInternal } from '../transformers/uploadTransformerBridge.js'\nimport { getChangedTransformKeys } from './getChangedTransformKeys.js'\nimport { getTransformKeyCoverageErrors } from './getTransformKeyCoverageErrors.js'\nimport { planPersistedDefaultStages } from './planPersistedDefaultStages.js'\nimport { isClaimRequired, isFocalPointKey } from './transformKeyClaims.js'\n\nexport type UploadPlan = { mimeType: string } & PlannedTransformerPipeline\n\n/**\n * What an upload with no new file does with its stored file.\n * - `keep`: nothing changes the file, so the stored files stay.\n * - `rebuild`: upload stages build new files from the stored file.\n * - `applyAtRequest`: request-time stages apply the saved keys, so no file is read or written.\n * - `copyForRequest`: a copy reads the source's original to store its own, and request-time stages\n * apply the saved keys. No upload stage runs.\n */\nexport type UploadRebuildOutcome = 'applyAtRequest' | 'copyForRequest' | 'keep' | 'rebuild'\n\ntype PlanArgs = {\n collectionSlug: string\n pipelineDoc: Document\n pipelineOriginalDoc: Readonly<Document>\n req: PayloadRequest\n}\n\n/**\n * Decides whether an upload without a new file rebuilds from the stored file. A rebuild is planned\n * with the stored MIME type, so a key that cannot be applied fails before the stored file is read.\n * When request-time stages apply the saved keys, an update writes no file, and only a copy reads\n * the stored original.\n */\nexport async function planUploadRebuild({\n canApplyAtRequest,\n documentID,\n hasCropOrFocalPointEdit,\n hasCropOrResizeEdit,\n isDuplicating,\n isExternalSource,\n previousTransforms,\n storedMimeType,\n ...planArgs\n}: {\n /** False when no original would be stored for request-time stages to start from. */\n canApplyAtRequest: boolean\n documentID?: number | string\n /**\n * A crop or resize in `uploadEdits`, or a focal point that differs from the stored one\n * (`shouldReupload`). These triggers rebuilt the file before claims existed.\n */\n hasCropOrFocalPointEdit: boolean\n /** A crop or resize sent in the `uploadEdits` query. */\n hasCropOrResizeEdit: boolean\n isDuplicating: boolean\n isExternalSource: boolean\n /** The stored `_transforms` on an update; `undefined` when there is nothing to compare. */\n previousTransforms: Document['_transforms'] | undefined\n storedMimeType: string | undefined\n} & PlanArgs): Promise<{ outcome: UploadRebuildOutcome; rebuildPlan?: UploadPlan }> {\n if (isExternalSource) {\n return { outcome: 'rebuild' }\n }\n\n const changedKeys =\n previousTransforms === undefined\n ? []\n : getChangedTransformKeys({\n next: planArgs.pipelineDoc._transforms,\n previous: previousTransforms,\n })\n const hasNonFocalPointChange = changedKeys.some((key) => !isFocalPointKey(key))\n\n if (!isDuplicating && !hasNonFocalPointChange && !hasCropOrFocalPointEdit) {\n return { outcome: 'keep' }\n }\n\n if (!storedMimeType) {\n return { outcome: 'rebuild' }\n }\n\n const rebuildPlan = await planUploadPipeline({ ...planArgs, mimeType: storedMimeType })\n const hasRequiredChange =\n isDuplicating || hasCropOrResizeEdit || changedKeys.some(isClaimRequired)\n const shouldRebuild =\n hasRequiredChange ||\n hasClaimedOptionalChange({\n changedKeys,\n collectionSlug: planArgs.collectionSlug,\n hasCropOrFocalPointEdit,\n plan: rebuildPlan,\n })\n\n if (!shouldRebuild) {\n return { outcome: 'keep', rebuildPlan }\n }\n\n const { isAppliedAtRequest } = await resolveTransformKeyCoverage({\n ...planArgs,\n canApplyAtRequest,\n documentID,\n mimeType: storedMimeType,\n plan: rebuildPlan,\n })\n\n if (!isAppliedAtRequest) {\n return { outcome: 'rebuild', rebuildPlan }\n }\n\n return { outcome: isDuplicating ? 'copyForRequest' : 'applyAtRequest', rebuildPlan }\n}\n\n/**\n * Whether a stage that runs claims a changed key that rebuilds the file only when claimed: a\n * focal point or a custom key. An edit sent through `uploadEdits`, `focalX` or `focalY` is not in\n * `changedKeys`, because those inputs predate `_transforms`; it counts as a focal point change.\n */\nfunction hasClaimedOptionalChange({\n changedKeys,\n collectionSlug,\n hasCropOrFocalPointEdit,\n plan,\n}: {\n changedKeys: string[]\n collectionSlug: string\n hasCropOrFocalPointEdit: boolean\n plan: UploadPlan\n}): boolean {\n const optionalChangedKeys = changedKeys.filter((key) => !isClaimRequired(key))\n\n if (hasCropOrFocalPointEdit) {\n optionalChangedKeys.push('focalPoint')\n }\n\n return getStagesThatRun({ collectionSlug, plan }).stagesThatRun.some((transformer) =>\n plan.claims.get(transformer)?.some((key) => optionalChangedKeys.includes(key)),\n )\n}\n\n/** Plans the upload pipeline for one MIME type, without checking claims. */\nexport async function planUploadPipeline({\n collectionSlug,\n mimeType,\n pipelineOriginalDoc,\n req,\n}: { mimeType: string } & PlanArgs): Promise<UploadPlan> {\n const plan = await planTransformerPipeline({\n args: {\n collectionSlug,\n doc: pipelineOriginalDoc,\n mimeType,\n operation: 'upload',\n originalDoc: pipelineOriginalDoc,\n req,\n },\n capability: 'transformFile',\n transformers: req.payload.config.upload?.transformers ?? [],\n })\n\n return { ...plan, mimeType }\n}\n\n/**\n * The planned stages that run. Only one Sharp bridge drives an upload: the one that owns the\n * collection, or the first. The other bridges do not run, so they do not count as claimers, and\n * they must not see the chosen bridge's task options, which are private to it.\n */\nexport function getStagesThatRun({\n collectionSlug,\n plan,\n}: {\n collectionSlug: string\n plan: PlannedTransformerPipeline\n}): {\n bridgeTransformer?: UploadTransformer\n /** The claims of the stages that run. */\n claimsOfStagesThatRun: Map<UploadTransformer, string[]>\n stagesThatRun: UploadTransformer[]\n} {\n const bridgeTransformers = plan.pipeline.filter((transformer) =>\n Boolean(getUploadTransformerInternal(transformer)?.transformUpload),\n )\n const bridgeTransformer =\n bridgeTransformers.find((transformer) =>\n getUploadTransformerInternal(transformer)!.handlesCollection?.({ collectionSlug }),\n ) ?? bridgeTransformers[0]\n\n const stagesThatRun = plan.pipeline.filter(\n (transformer) => transformer === bridgeTransformer || !bridgeTransformers.includes(transformer),\n )\n\n return {\n bridgeTransformer,\n claimsOfStagesThatRun: new Map(\n [...plan.claims].filter(([transformer]) => stagesThatRun.includes(transformer)),\n ),\n stagesThatRun,\n }\n}\n\n/**\n * Decides where the saved keys are applied. Upload stages that run apply them into a stored file.\n * When those leave a key with no claim, request-time stages can apply every saved key instead: the\n * default file is then built when it is requested, and only the original is stored. When both kinds\n * claim a key, the upload stage wins. Fails before any file work when neither covers the keys.\n */\nexport async function resolveTransformKeyCoverage({\n canApplyAtRequest,\n collectionSlug,\n documentID,\n mimeType,\n pipelineDoc,\n pipelineOriginalDoc,\n plan,\n req,\n}: {\n /** False when no original would be stored for request-time stages to start from. */\n canApplyAtRequest: boolean\n documentID?: number | string\n mimeType: string\n plan: PlannedTransformerPipeline\n} & PlanArgs): Promise<{ isAppliedAtRequest: boolean }> {\n const { claimsOfStagesThatRun } = getStagesThatRun({ collectionSlug, plan })\n const errors = getTransformKeyCoverageErrors({\n claims: claimsOfStagesThatRun,\n transforms: pipelineDoc._transforms,\n })\n\n if (errors.length === 0) {\n return { isAppliedAtRequest: false }\n }\n\n const uploadClaimedKeys = new Set([...claimsOfStagesThatRun.values()].flat())\n const hasOnlyUnclaimedKeys = errors.every(\n ({ path }) => !uploadClaimedKeys.has(path.slice('_transforms.'.length)),\n )\n // Every output must apply the saved keys. Sizes are stored at upload unless their owner builds\n // them at request time, so with sizes the owner must be a request-time stage too.\n const upload = req.payload.collections?.[collectionSlug]?.config.upload\n const hasVariants = Boolean(upload?.variants?.length)\n const canBuildVariantsAtRequest = !hasVariants || Boolean(upload?.variantsTransformerSlug)\n\n if (\n canApplyAtRequest &&\n hasOnlyUnclaimedKeys &&\n canBuildVariantsAtRequest &&\n (await canBuildAtRequest({\n collectionSlug,\n documentID,\n mimeType,\n pipelineDoc,\n pipelineOriginalDoc,\n req,\n requiredTransformerSlug: hasVariants ? upload?.variantsTransformerSlug : undefined,\n }))\n ) {\n return { isAppliedAtRequest: true }\n }\n\n throw new ValidationError({ collection: collectionSlug, errors, req }, req.t)\n}\n\n/** Fails before any file work when a saved key has no claiming stage, or more than one. */\nexport function assertTransformKeysCovered({\n collectionSlug,\n pipelineDoc,\n plan,\n req,\n}: {\n plan: PlannedTransformerPipeline\n} & Pick<PlanArgs, 'collectionSlug' | 'pipelineDoc' | 'req'>): void {\n const { claimsOfStagesThatRun } = getStagesThatRun({ collectionSlug, plan })\n const errors = getTransformKeyCoverageErrors({\n claims: claimsOfStagesThatRun,\n transforms: pipelineDoc._transforms,\n })\n\n if (errors.length > 0) {\n throw new ValidationError({ collection: collectionSlug, errors, req }, req.t)\n }\n}\n\n/**\n * Whether request-time stages can build a file of this MIME type from the original, applying every\n * saved key. With `requiredTransformerSlug`, that transformer must also be one of the stages.\n */\nexport async function canBuildAtRequest({\n requiredTransformerSlug,\n ...buildArgs\n}: {\n requiredTransformerSlug?: string\n} & RequestTimeBuildArgs): Promise<boolean> {\n return isBuildableAtRequest({\n requestTimeBuild: await planRequestTimeBuild(buildArgs),\n requiredTransformerSlug,\n })\n}\n\ntype RequestTimeBuildArgs = {\n documentID?: number | string\n mimeType: string\n} & PlanArgs\n\nexport type RequestTimeBuildPlan = Awaited<ReturnType<typeof planPersistedDefaultStages>>\n\n/**\n * Plans the request-time stages that would build a file of this MIME type from the original. Check\n * the result with `isBuildableAtRequest`. Use both to check more than one condition on one plan.\n */\nexport function planRequestTimeBuild({\n collectionSlug,\n documentID,\n mimeType,\n pipelineDoc,\n pipelineOriginalDoc,\n req,\n}: RequestTimeBuildArgs): Promise<RequestTimeBuildPlan> {\n return planPersistedDefaultStages({\n collectionSlug,\n doc: pipelineOriginalDoc,\n documentID,\n mimeType,\n req,\n transforms: pipelineDoc._transforms,\n })\n}\n\n/**\n * Whether a planned request-time build has stages that apply every saved key. With\n * `requiredTransformerSlug`, that transformer must also be one of the stages.\n */\nexport function isBuildableAtRequest({\n requestTimeBuild: { coverageErrors, plan },\n requiredTransformerSlug,\n}: {\n requestTimeBuild: RequestTimeBuildPlan\n requiredTransformerSlug?: string\n}): boolean {\n return (\n plan.pipeline.length > 0 &&\n (requiredTransformerSlug === undefined ||\n plan.pipeline.some((transformer) => transformer.slug === requiredTransformerSlug)) &&\n coverageErrors.length === 0\n )\n}\n\n/**\n * Whether a planned request-time build can build the collection's sizes. The transformer that\n * registered the sizes (`variantsTransformerSlug`) must be one of the stages.\n */\nexport function areVariantsBuildableAtRequest({\n requestTimeBuild,\n variantsTransformerSlug,\n}: {\n requestTimeBuild: RequestTimeBuildPlan\n variantsTransformerSlug?: string\n}): boolean {\n return (\n Boolean(variantsTransformerSlug) &&\n isBuildableAtRequest({ requestTimeBuild, requiredTransformerSlug: variantsTransformerSlug })\n )\n}\n"],"names":["ValidationError","planTransformerPipeline","getUploadTransformerInternal","getChangedTransformKeys","getTransformKeyCoverageErrors","planPersistedDefaultStages","isClaimRequired","isFocalPointKey","planUploadRebuild","canApplyAtRequest","documentID","hasCropOrFocalPointEdit","hasCropOrResizeEdit","isDuplicating","isExternalSource","previousTransforms","storedMimeType","planArgs","outcome","changedKeys","undefined","next","pipelineDoc","_transforms","previous","hasNonFocalPointChange","some","key","rebuildPlan","planUploadPipeline","mimeType","hasRequiredChange","shouldRebuild","hasClaimedOptionalChange","collectionSlug","plan","isAppliedAtRequest","resolveTransformKeyCoverage","optionalChangedKeys","filter","push","getStagesThatRun","stagesThatRun","transformer","claims","get","includes","pipelineOriginalDoc","req","args","doc","operation","originalDoc","capability","transformers","payload","config","upload","bridgeTransformers","pipeline","Boolean","transformUpload","bridgeTransformer","find","handlesCollection","claimsOfStagesThatRun","Map","errors","transforms","length","uploadClaimedKeys","Set","values","flat","hasOnlyUnclaimedKeys","every","path","has","slice","collections","hasVariants","variants","canBuildVariantsAtRequest","variantsTransformerSlug","canBuildAtRequest","requiredTransformerSlug","collection","t","assertTransformKeysCovered","buildArgs","isBuildableAtRequest","requestTimeBuild","planRequestTimeBuild","coverageErrors","slug","areVariantsBuildableAtRequest"],"mappings":"AAIA,SAASA,eAAe,QAAQ,kCAAiC;AACjE,SAASC,uBAAuB,QAAQ,6CAA4C;AACpF,SAASC,4BAA4B,QAAQ,6CAA4C;AACzF,SAASC,uBAAuB,QAAQ,+BAA8B;AACtE,SAASC,6BAA6B,QAAQ,qCAAoC;AAClF,SAASC,0BAA0B,QAAQ,kCAAiC;AAC5E,SAASC,eAAe,EAAEC,eAAe,QAAQ,0BAAyB;AAqB1E;;;;;CAKC,GACD,OAAO,eAAeC,kBAAkB,EACtCC,iBAAiB,EACjBC,UAAU,EACVC,uBAAuB,EACvBC,mBAAmB,EACnBC,aAAa,EACbC,gBAAgB,EAChBC,kBAAkB,EAClBC,cAAc,EACd,GAAGC,UAiBO;IACV,IAAIH,kBAAkB;QACpB,OAAO;YAAEI,SAAS;QAAU;IAC9B;IAEA,MAAMC,cACJJ,uBAAuBK,YACnB,EAAE,GACFjB,wBAAwB;Q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D;YAAgBiC;YAAQnB;QAAI,GAAGA,IAAIuC,CAAC;IAC9E;AACF;AAEA;;;CAGC,GACD,OAAO,eAAeH,kBAAkB,EACtCC,uBAAuB,EACvB,GAAGI,WAGmB;IACtB,OAAOC,qBAAqB;QAC1BC,kBAAkB,MAAMC,qBAAqBH;QAC7CJ;IACF;AACF;AASA;;;CAGC,GACD,OAAO,SAASO,qBAAqB,EACnC1D,cAAc,EACdxB,UAAU,EACVoB,QAAQ,EACRR,WAAW,EACXyB,mBAAmB,EACnBC,GAAG,EACkB;IACrB,OAAO3C,2BAA2B;QAChC6B;QACAgB,KAAKH;QACLrC;QACAoB;QACAkB;QACAoB,YAAY9C,YAAYC,WAAW;IACrC;AACF;AAEA;;;CAGC,GACD,OAAO,SAASmE,qBAAqB,EACnCC,kBAAkB,EAAEE,cAAc,EAAE1D,IAAI,EAAE,EAC1CkD,uBAAuB,EAIxB;IACC,OACElD,KAAKwB,QAAQ,CAACU,MAAM,GAAG,KACtBgB,CAAAA,4BAA4BjE,aAC3Be,KAAKwB,QAAQ,CAACjC,IAAI,CAAC,CAACiB,cAAgBA,YAAYmD,IAAI,KAAKT,wBAAuB,KAClFQ,eAAexB,MAAM,KAAK;AAE9B;AAEA;;;CAGC,GACD,OAAO,SAAS0B,8BAA8B,EAC5CJ,gBAAgB,EAChBR,uBAAuB,EAIxB;IACC,OACEvB,QAAQuB,4BACRO,qBAAqB;QAAEC;QAAkBN,yBAAyBF;IAAwB;AAE9F"}
|
|
1
|
+
{"version":3,"sources":["../../../src/uploads/transformState/planUpload.ts"],"sourcesContent":["import type { Document, PayloadRequest } from '../../types/index.js'\nimport type { PlannedTransformerPipeline } from '../transformers/planTransformerPipeline.js'\nimport type { UploadTransformer } from '../transformers/types.js'\n\nimport { ValidationError } from '../../errors/ValidationError.js'\nimport { planTransformerPipeline } from '../transformers/planTransformerPipeline.js'\nimport { getUploadTransformerInternal } from '../transformers/uploadTransformerBridge.js'\nimport { getChangedTransformKeys } from './getChangedTransformKeys.js'\nimport { getTransformKeyCoverageErrors } from './getTransformKeyCoverageErrors.js'\nimport { planPersistedDefaultStages } from './planPersistedDefaultStages.js'\nimport { isClaimRequired, isFocalPointKey } from './transformKeyClaims.js'\n\nexport type UploadPlan = { mimeType: string } & PlannedTransformerPipeline\n\n/**\n * What an upload with no new file does with its stored file.\n * - `keep`: nothing changes the file, so the stored files stay.\n * - `rebuild`: upload stages build new files from the stored file.\n * - `applyAtRequest`: request-time stages apply the saved keys, so no file is read or written.\n * - `copyForRequest`: a copy reads the source's original to store its own, and request-time stages\n * apply the saved keys. No upload stage runs.\n */\nexport type UploadRebuildOutcome = 'applyAtRequest' | 'copyForRequest' | 'keep' | 'rebuild'\n\ntype PlanArgs = {\n collectionSlug: string\n pipelineDoc: Document\n pipelineOriginalDoc: Readonly<Document>\n req: PayloadRequest\n}\n\n/**\n * Decides whether an upload without a new file rebuilds from the stored file. A rebuild is planned\n * with the stored MIME type, so a key that cannot be applied fails before the stored file is read.\n * When request-time stages apply the saved keys, an update writes no file, and only a copy reads\n * the stored original.\n */\nexport async function planUploadRebuild({\n canApplyAtRequest,\n documentID,\n hasCropOrFocalPointEdit,\n hasCropOrResizeEdit,\n isDuplicating,\n isExternalSource,\n previousTransforms,\n storedMimeType,\n ...planArgs\n}: {\n /** False when no original would be stored for request-time stages to start from. */\n canApplyAtRequest: boolean\n documentID?: number | string\n /**\n * A crop or resize in `uploadEdits`, or a focal point that differs from the stored one\n * (`shouldReupload`). These triggers rebuilt the file before claims existed.\n */\n hasCropOrFocalPointEdit: boolean\n /** A crop or resize sent in the `uploadEdits` query. */\n hasCropOrResizeEdit: boolean\n isDuplicating: boolean\n isExternalSource: boolean\n /** The stored `_transforms` on an update; `undefined` when there is nothing to compare. */\n previousTransforms: Document['_transforms'] | undefined\n storedMimeType: string | undefined\n} & PlanArgs): Promise<{ outcome: UploadRebuildOutcome; rebuildPlan?: UploadPlan }> {\n if (isExternalSource) {\n return { outcome: 'rebuild' }\n }\n\n const changedKeys =\n previousTransforms === undefined\n ? []\n : getChangedTransformKeys({\n next: planArgs.pipelineDoc._transforms,\n previous: previousTransforms,\n })\n const hasNonFocalPointChange = changedKeys.some((key) => !isFocalPointKey(key))\n\n if (!isDuplicating && !hasNonFocalPointChange && !hasCropOrFocalPointEdit) {\n return { outcome: 'keep' }\n }\n\n if (!storedMimeType) {\n return { outcome: 'rebuild' }\n }\n\n const rebuildPlan = await planUploadPipeline({\n ...planArgs,\n canApplyAtRequest,\n documentID,\n mimeType: storedMimeType,\n })\n const hasRequiredChange =\n isDuplicating || hasCropOrResizeEdit || changedKeys.some(isClaimRequired)\n const shouldRebuild =\n hasRequiredChange ||\n hasClaimedOptionalChange({\n changedKeys,\n collectionSlug: planArgs.collectionSlug,\n hasCropOrFocalPointEdit,\n plan: rebuildPlan,\n })\n\n if (!shouldRebuild) {\n return { outcome: 'keep', rebuildPlan }\n }\n\n const { isAppliedAtRequest } = await resolveTransformKeyCoverage({\n ...planArgs,\n canApplyAtRequest,\n documentID,\n mimeType: storedMimeType,\n plan: rebuildPlan,\n })\n\n if (!isAppliedAtRequest) {\n return { outcome: 'rebuild', rebuildPlan }\n }\n\n return { outcome: isDuplicating ? 'copyForRequest' : 'applyAtRequest', rebuildPlan }\n}\n\n/**\n * Whether a stage that runs claims a changed key that rebuilds the file only when claimed: a\n * focal point or a custom key. An edit sent through `uploadEdits`, `focalX` or `focalY` is not in\n * `changedKeys`, because those inputs predate `_transforms`; it counts as a focal point change.\n */\nfunction hasClaimedOptionalChange({\n changedKeys,\n collectionSlug,\n hasCropOrFocalPointEdit,\n plan,\n}: {\n changedKeys: string[]\n collectionSlug: string\n hasCropOrFocalPointEdit: boolean\n plan: UploadPlan\n}): boolean {\n const optionalChangedKeys = changedKeys.filter((key) => !isClaimRequired(key))\n\n if (hasCropOrFocalPointEdit) {\n optionalChangedKeys.push('focalPoint')\n }\n\n return getStagesThatRun({ collectionSlug, plan }).stagesThatRun.some((transformer) =>\n plan.claims.get(transformer)?.some((key) => optionalChangedKeys.includes(key)),\n )\n}\n\n/** Plans the upload pipeline for one MIME type, without checking claims. */\nexport async function planUploadPipeline({\n canApplyAtRequest,\n documentID,\n mimeType,\n ...planArgs\n}: {\n /** False when no original would be stored for request-time stages to start from. */\n canApplyAtRequest: boolean\n documentID?: number | string\n mimeType: string\n} & PlanArgs): Promise<UploadPlan> {\n const { collectionSlug, pipelineOriginalDoc, req } = planArgs\n const plan = await planTransformerPipeline({\n args: {\n collectionSlug,\n doc: pipelineOriginalDoc,\n mimeType,\n operation: 'upload',\n originalDoc: pipelineOriginalDoc,\n req,\n },\n capability: 'transformFile',\n transformers: req.payload.config.upload?.transformers ?? [],\n })\n\n const variantsOwnerSlug = canApplyAtRequest\n ? await getVariantsOwnerThatBuildsAtRequest({ ...planArgs, documentID, mimeType })\n : undefined\n\n return {\n ...(variantsOwnerSlug\n ? withoutBridgesThatDoNotOwnCollection({ collectionSlug, plan, variantsOwnerSlug })\n : plan),\n mimeType,\n }\n}\n\n/**\n * The slug of the transformer that registered the collection's sizes, when it can build the\n * default file and the sizes from the original at request time. Otherwise `undefined`.\n */\nasync function getVariantsOwnerThatBuildsAtRequest({\n documentID,\n mimeType,\n ...planArgs\n}: { documentID?: number | string; mimeType: string } & PlanArgs): Promise<string | undefined> {\n const upload = planArgs.req.payload.collections?.[planArgs.collectionSlug]?.config.upload\n const variantsTransformerSlug = upload?.variantsTransformerSlug\n\n if (!upload?.variants?.length || !variantsTransformerSlug) {\n return undefined\n }\n\n const canOwnerBuild = await canBuildAtRequest({\n ...planArgs,\n documentID,\n mimeType,\n requiredTransformerSlug: variantsTransformerSlug,\n })\n\n return canOwnerBuild ? variantsTransformerSlug : undefined\n}\n\n/**\n * The plan without the upload bridges that do not own the collection. The transformer that\n * registered the sizes owns the collection's files, so a bridge must not build a main file that\n * differs from those sizes. A bridge that the collection is configured on still runs.\n */\nfunction withoutBridgesThatDoNotOwnCollection({\n collectionSlug,\n plan,\n variantsOwnerSlug,\n}: {\n collectionSlug: string\n plan: PlannedTransformerPipeline\n variantsOwnerSlug: string\n}): PlannedTransformerPipeline {\n const isKept = (transformer: UploadTransformer): boolean => {\n const bridge = getUploadTransformerInternal(transformer)\n\n return (\n !bridge?.transformUpload ||\n transformer.slug === variantsOwnerSlug ||\n Boolean(bridge.handlesCollection?.({ collectionSlug }))\n )\n }\n\n return {\n claims: new Map([...plan.claims].filter(([transformer]) => isKept(transformer))),\n options: new Map([...plan.options].filter(([transformer]) => isKept(transformer))),\n pipeline: plan.pipeline.filter(isKept),\n }\n}\n\n/**\n * The planned stages that run. Only one Sharp bridge drives an upload: the one that owns the\n * collection, or the first. The other bridges do not run, so they do not count as claimers, and\n * they must not see the chosen bridge's task options, which are private to it.\n */\nexport function getStagesThatRun({\n collectionSlug,\n plan,\n}: {\n collectionSlug: string\n plan: PlannedTransformerPipeline\n}): {\n bridgeTransformer?: UploadTransformer\n /** The claims of the stages that run. */\n claimsOfStagesThatRun: Map<UploadTransformer, string[]>\n stagesThatRun: UploadTransformer[]\n} {\n const bridgeTransformers = plan.pipeline.filter((transformer) =>\n Boolean(getUploadTransformerInternal(transformer)?.transformUpload),\n )\n const bridgeTransformer =\n bridgeTransformers.find((transformer) =>\n getUploadTransformerInternal(transformer)!.handlesCollection?.({ collectionSlug }),\n ) ?? bridgeTransformers[0]\n\n const stagesThatRun = plan.pipeline.filter(\n (transformer) => transformer === bridgeTransformer || !bridgeTransformers.includes(transformer),\n )\n\n return {\n bridgeTransformer,\n claimsOfStagesThatRun: new Map(\n [...plan.claims].filter(([transformer]) => stagesThatRun.includes(transformer)),\n ),\n stagesThatRun,\n }\n}\n\n/**\n * Decides where the saved keys are applied. Upload stages that run apply them into a stored file.\n * When those leave a key with no claim, request-time stages can apply every saved key instead: the\n * default file is then built when it is requested, and only the original is stored. When both kinds\n * claim a key, the upload stage wins. Fails before any file work when neither covers the keys.\n */\nexport async function resolveTransformKeyCoverage({\n canApplyAtRequest,\n collectionSlug,\n documentID,\n mimeType,\n pipelineDoc,\n pipelineOriginalDoc,\n plan,\n req,\n}: {\n /** False when no original would be stored for request-time stages to start from. */\n canApplyAtRequest: boolean\n documentID?: number | string\n mimeType: string\n plan: PlannedTransformerPipeline\n} & PlanArgs): Promise<{ isAppliedAtRequest: boolean }> {\n const { claimsOfStagesThatRun } = getStagesThatRun({ collectionSlug, plan })\n const errors = getTransformKeyCoverageErrors({\n claims: claimsOfStagesThatRun,\n transforms: pipelineDoc._transforms,\n })\n\n if (errors.length === 0) {\n return { isAppliedAtRequest: false }\n }\n\n const uploadClaimedKeys = new Set([...claimsOfStagesThatRun.values()].flat())\n const hasOnlyUnclaimedKeys = errors.every(\n ({ path }) => !uploadClaimedKeys.has(path.slice('_transforms.'.length)),\n )\n // Every output must apply the saved keys. Sizes are stored at upload unless their owner builds\n // them at request time, so with sizes the owner must be a request-time stage too.\n const upload = req.payload.collections?.[collectionSlug]?.config.upload\n const hasVariants = Boolean(upload?.variants?.length)\n const canBuildVariantsAtRequest = !hasVariants || Boolean(upload?.variantsTransformerSlug)\n\n if (\n canApplyAtRequest &&\n hasOnlyUnclaimedKeys &&\n canBuildVariantsAtRequest &&\n (await canBuildAtRequest({\n collectionSlug,\n documentID,\n mimeType,\n pipelineDoc,\n pipelineOriginalDoc,\n req,\n requiredTransformerSlug: hasVariants ? upload?.variantsTransformerSlug : undefined,\n }))\n ) {\n return { isAppliedAtRequest: true }\n }\n\n throw new ValidationError({ collection: collectionSlug, errors, req }, req.t)\n}\n\n/** Fails before any file work when a saved key has no claiming stage, or more than one. */\nexport function assertTransformKeysCovered({\n collectionSlug,\n pipelineDoc,\n plan,\n req,\n}: {\n plan: PlannedTransformerPipeline\n} & Pick<PlanArgs, 'collectionSlug' | 'pipelineDoc' | 'req'>): void {\n const { claimsOfStagesThatRun } = getStagesThatRun({ collectionSlug, plan })\n const errors = getTransformKeyCoverageErrors({\n claims: claimsOfStagesThatRun,\n transforms: pipelineDoc._transforms,\n })\n\n if (errors.length > 0) {\n throw new ValidationError({ collection: collectionSlug, errors, req }, req.t)\n }\n}\n\n/**\n * Whether request-time stages can build a file of this MIME type from the original, applying every\n * saved key. With `requiredTransformerSlug`, that transformer must also be one of the stages.\n */\nexport async function canBuildAtRequest({\n requiredTransformerSlug,\n ...buildArgs\n}: {\n requiredTransformerSlug?: string\n} & RequestTimeBuildArgs): Promise<boolean> {\n return isBuildableAtRequest({\n requestTimeBuild: await planRequestTimeBuild(buildArgs),\n requiredTransformerSlug,\n })\n}\n\ntype RequestTimeBuildArgs = {\n documentID?: number | string\n mimeType: string\n} & PlanArgs\n\nexport type RequestTimeBuildPlan = Awaited<ReturnType<typeof planPersistedDefaultStages>>\n\n/**\n * Plans the request-time stages that would build a file of this MIME type from the original. Check\n * the result with `isBuildableAtRequest`. Use both to check more than one condition on one plan.\n */\nexport function planRequestTimeBuild({\n collectionSlug,\n documentID,\n mimeType,\n pipelineDoc,\n pipelineOriginalDoc,\n req,\n}: RequestTimeBuildArgs): Promise<RequestTimeBuildPlan> {\n return planPersistedDefaultStages({\n collectionSlug,\n doc: pipelineOriginalDoc,\n documentID,\n mimeType,\n req,\n transforms: pipelineDoc._transforms,\n })\n}\n\n/**\n * Whether a planned request-time build has stages that apply every saved key. With\n * `requiredTransformerSlug`, that transformer must also be one of the stages.\n */\nexport function isBuildableAtRequest({\n requestTimeBuild: { coverageErrors, plan },\n requiredTransformerSlug,\n}: {\n requestTimeBuild: RequestTimeBuildPlan\n requiredTransformerSlug?: string\n}): boolean {\n return (\n plan.pipeline.length > 0 &&\n (requiredTransformerSlug === undefined ||\n plan.pipeline.some((transformer) => transformer.slug === requiredTransformerSlug)) &&\n coverageErrors.length === 0\n )\n}\n\n/**\n * Whether a planned request-time build can build the collection's sizes. The transformer that\n * registered the sizes (`variantsTransformerSlug`) must be one of the stages.\n */\nexport function areVariantsBuildableAtRequest({\n requestTimeBuild,\n variantsTransformerSlug,\n}: {\n requestTimeBuild: RequestTimeBuildPlan\n variantsTransformerSlug?: string\n}): boolean {\n return (\n Boolean(variantsTransformerSlug) &&\n isBuildableAtRequest({ requestTimeBuild, requiredTransformerSlug: variantsTransformerSlug })\n )\n}\n"],"names":["ValidationError","planTransformerPipeline","getUploadTransformerInternal","getChangedTransformKeys","getTransformKeyCoverageErrors","planPersistedDefaultStages","isClaimRequired","isFocalPointKey","planUploadRebuild","canApplyAtRequest","documentID","hasCropOrFocalPointEdit","hasCropOrResizeEdit","isDuplicating","isExternalSource","previousTransforms","storedMimeType","planArgs","outcome","changedKeys","undefined","next","pipelineDoc","_transforms","previous","hasNonFocalPointChange","some","key","rebuildPlan","planUploadPipeline","mimeType","hasRequiredChange","shouldRebuild","hasClaimedOptionalChange","collectionSlug","plan","isAppliedAtRequest","resolveTransformKeyCoverage","optionalChangedKeys","filter","push","getStagesThatRun","stagesThatRun","transformer","claims","get","includes","pipelineOriginalDoc","req","args","doc","operation","originalDoc","capability","transformers","payload","config","upload","variantsOwnerSlug","getVariantsOwnerThatBuildsAtRequest","withoutBridgesThatDoNotOwnCollection","collections","variantsTransformerSlug","variants","length","canOwnerBuild","canBuildAtRequest","requiredTransformerSlug","isKept","bridge","transformUpload","slug","Boolean","handlesCollection","Map","options","pipeline","bridgeTransformers","bridgeTransformer","find","claimsOfStagesThatRun","errors","transforms","uploadClaimedKeys","Set","values","flat","hasOnlyUnclaimedKeys","every","path","has","slice","hasVariants","canBuildVariantsAtRequest","collection","t","assertTransformKeysCovered","buildArgs","isBuildableAtRequest","requestTimeBuild","planRequestTimeBuild","coverageErrors","areVariantsBuildableAtRequest"],"mappings":"AAIA,SAASA,eAAe,QAAQ,kCAAiC;AACjE,SAASC,uBAAuB,QAAQ,6CAA4C;AACpF,SAASC,4BAA4B,QAAQ,6CAA4C;AACzF,SAASC,uBAAuB,QAAQ,+BAA8B;AACtE,SAASC,6BAA6B,QAAQ,qCAAoC;AAClF,SAASC,0BAA0B,QAAQ,kCAAiC;AAC5E,SAASC,eAAe,EAAEC,eAAe,QAAQ,0BAAyB;AAqB1E;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|
-
|
|
2
|
-
|
|
1
|
+
export type DeepMergeArrayMergeOptions = {
|
|
2
|
+
cloneUnlessOtherwiseSpecified(value: object, options?: DeepMergeOptions): any;
|
|
3
|
+
isMergeableObject(value: object): boolean;
|
|
4
|
+
};
|
|
5
|
+
export type DeepMergeOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* Merges two arrays. Defaults to concatenating `target` and `source`.
|
|
8
|
+
*/
|
|
9
|
+
arrayMerge?: (target: any[], source: any[], options: ResolvedDeepMergeOptions) => any[];
|
|
10
|
+
/**
|
|
11
|
+
* When `false`, mergeable values are copied by reference instead of being deeply cloned.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
clone?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Returns a custom merge function for a given key, or `undefined` to use the default merge.
|
|
17
|
+
*/
|
|
18
|
+
customMerge?: (key: string, options?: DeepMergeOptions) => ((x: any, y: any) => any) | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Determines whether a value should be merged recursively or copied as-is.
|
|
21
|
+
*/
|
|
22
|
+
isMergeableObject?(value: object): boolean;
|
|
23
|
+
};
|
|
24
|
+
type ResolvedDeepMergeOptions = {
|
|
25
|
+
arrayMerge: NonNullable<DeepMergeOptions['arrayMerge']>;
|
|
26
|
+
isMergeableObject: (value: unknown) => boolean;
|
|
27
|
+
} & DeepMergeArrayMergeOptions & DeepMergeOptions;
|
|
28
|
+
/**
|
|
29
|
+
* Fully-featured deepMerge. Returns a new object and does not mutate its arguments.
|
|
30
|
+
*
|
|
31
|
+
* Array handling: arrays are concatenated unless `arrayMerge` is provided.
|
|
32
|
+
*
|
|
33
|
+
* `__proto__` keys are never copied to the result, preventing prototype poisoning of the returned
|
|
34
|
+
* object when merging untrusted input (e.g. parsed JSON).
|
|
35
|
+
*/
|
|
36
|
+
export declare function deepMerge<T>(x: Partial<T>, y: Partial<T>, options?: DeepMergeOptions): T;
|
|
37
|
+
export declare namespace deepMerge {
|
|
38
|
+
export { deepMergeAll as all };
|
|
39
|
+
}
|
|
40
|
+
export declare function deepMerge<T1, T2>(x: Partial<T1>, y: Partial<T2>, options?: DeepMergeOptions): T1 & T2;
|
|
41
|
+
/**
|
|
42
|
+
* Keeps the `deepMerge.Options` / `deepMerge.ArrayMergeOptions` type references from the former
|
|
43
|
+
* `deepmerge` dependency working.
|
|
44
|
+
*/
|
|
45
|
+
export declare namespace deepMerge {
|
|
46
|
+
type ArrayMergeOptions = DeepMergeArrayMergeOptions;
|
|
47
|
+
type Options = DeepMergeOptions;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Deep-merges all objects in the array, from left to right.
|
|
51
|
+
*/
|
|
52
|
+
declare function deepMergeAll<T = object>(objects: Partial<T>[], options?: DeepMergeOptions): T;
|
|
53
|
+
declare function deepMergeAll(objects: object[], options?: DeepMergeOptions): object;
|
|
3
54
|
/**
|
|
4
55
|
* Fully-featured deepMerge.
|
|
5
56
|
*
|
|
6
57
|
* Array handling: Arrays in the target object are combined with the source object's arrays.
|
|
7
58
|
*/
|
|
8
|
-
export declare function deepMergeWithCombinedArrays<T extends object>(obj1: object, obj2: object, options?:
|
|
59
|
+
export declare function deepMergeWithCombinedArrays<T extends object>(obj1: object, obj2: object, options?: DeepMergeOptions): T;
|
|
9
60
|
/**
|
|
10
61
|
* Fully-featured deepMerge.
|
|
11
62
|
*
|
|
@@ -22,4 +73,5 @@ export declare function deepMergeWithSourceArraysIgnoringUndefined<T extends obj
|
|
|
22
73
|
* Fully-featured deepMerge. Does not clone React components by default.
|
|
23
74
|
*/
|
|
24
75
|
export declare function deepMergeWithReactComponents<T extends object>(obj1: object, obj2: object): T;
|
|
76
|
+
export {};
|
|
25
77
|
//# sourceMappingURL=deepMerge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepMerge.d.ts","sourceRoot":"","sources":["../../src/utilities/deepMerge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deepMerge.d.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
|
|
4
|
+
Symbol.for('react.transitional.element')
|
|
5
|
+
]);
|
|
6
|
+
export function deepMerge(target, source, options) {
|
|
7
|
+
// Copied rather than mutated, so that a reused options object is left untouched.
|
|
8
|
+
const resolvedOptions = {
|
|
9
|
+
...options,
|
|
10
|
+
arrayMerge: options?.arrayMerge || defaultArrayMerge,
|
|
11
|
+
// Exposed on `options` so that custom `arrayMerge` implementations can use it.
|
|
12
|
+
cloneUnlessOtherwiseSpecified: cloneUnlessOtherwiseSpecified,
|
|
13
|
+
isMergeableObject: options?.isMergeableObject || isMergeableObject
|
|
14
|
+
};
|
|
15
|
+
const isSourceArray = Array.isArray(source);
|
|
16
|
+
const isTargetArray = Array.isArray(target);
|
|
17
|
+
if (isSourceArray !== isTargetArray) {
|
|
18
|
+
return cloneUnlessOtherwiseSpecified(source, resolvedOptions);
|
|
19
|
+
}
|
|
20
|
+
if (isSourceArray) {
|
|
21
|
+
return resolvedOptions.arrayMerge(target, source, resolvedOptions);
|
|
22
|
+
}
|
|
23
|
+
return mergeObject(target, source, resolvedOptions);
|
|
24
|
+
}
|
|
25
|
+
function deepMergeAll(objects, options) {
|
|
26
|
+
if (!Array.isArray(objects)) {
|
|
27
|
+
throw new Error('first argument should be an array');
|
|
28
|
+
}
|
|
29
|
+
return objects.reduce((previous, next)=>deepMerge(previous, next, options), {});
|
|
30
|
+
}
|
|
31
|
+
deepMerge.all = deepMergeAll;
|
|
4
32
|
/**
|
|
5
33
|
* Fully-featured deepMerge.
|
|
6
34
|
*
|
|
@@ -39,6 +67,80 @@ export { deepMerge };
|
|
|
39
67
|
*/ export function deepMergeWithSourceArraysIgnoringUndefined(obj1, obj2) {
|
|
40
68
|
return deepMergeWithSourceArrays(obj1, removeUndefinedProperties(obj2));
|
|
41
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Fully-featured deepMerge. Does not clone React components by default.
|
|
72
|
+
*/ export function deepMergeWithReactComponents(obj1, obj2) {
|
|
73
|
+
return deepMerge(obj1, obj2, {
|
|
74
|
+
isMergeableObject: isPlainObject
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function isMergeableObject(value) {
|
|
78
|
+
if (!value || typeof value !== 'object') {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
const stringTag = Object.prototype.toString.call(value);
|
|
82
|
+
if (stringTag === '[object RegExp]' || stringTag === '[object Date]') {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
return !REACT_ELEMENT_TYPES.has(value.$$typeof);
|
|
86
|
+
}
|
|
87
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
88
|
+
return options.clone !== false && options.isMergeableObject(value) ? deepMerge(Array.isArray(value) ? [] : {}, value, options) : value;
|
|
89
|
+
}
|
|
90
|
+
function defaultArrayMerge(target, source, options) {
|
|
91
|
+
return target.concat(source).map((element)=>cloneUnlessOtherwiseSpecified(element, options));
|
|
92
|
+
}
|
|
93
|
+
function getMergeFunction(key, options) {
|
|
94
|
+
if (!options.customMerge) {
|
|
95
|
+
return deepMerge;
|
|
96
|
+
}
|
|
97
|
+
const customMerge = options.customMerge(key, options);
|
|
98
|
+
return typeof customMerge === 'function' ? customMerge : deepMerge;
|
|
99
|
+
}
|
|
100
|
+
function getEnumerableOwnKeys(value) {
|
|
101
|
+
return [
|
|
102
|
+
...Object.keys(value),
|
|
103
|
+
...Object.getOwnPropertySymbols(value).filter((symbol)=>Object.prototype.propertyIsEnumerable.call(value, symbol))
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
function isPropertyOnObject(object, property) {
|
|
107
|
+
try {
|
|
108
|
+
return property in object;
|
|
109
|
+
} catch {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* A key is unsafe to merge when it exists on the target but is inherited or non-enumerable, or when
|
|
115
|
+
* it is `__proto__`, which would replace the prototype of the returned object on assignment.
|
|
116
|
+
*/ function isUnsafeKey(target, key) {
|
|
117
|
+
if (key === '__proto__') {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
return isPropertyOnObject(target, key) && !(Object.prototype.hasOwnProperty.call(target, key) && Object.prototype.propertyIsEnumerable.call(target, key));
|
|
121
|
+
}
|
|
122
|
+
function mergeObject(target, source, options) {
|
|
123
|
+
const destination = {};
|
|
124
|
+
if (options.isMergeableObject(target)) {
|
|
125
|
+
for (const key of getEnumerableOwnKeys(target)){
|
|
126
|
+
if (key === '__proto__') {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
for (const key of getEnumerableOwnKeys(source)){
|
|
133
|
+
if (isUnsafeKey(target, key)) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (isPropertyOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
137
|
+
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
138
|
+
} else {
|
|
139
|
+
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return destination;
|
|
143
|
+
}
|
|
42
144
|
function removeUndefinedProperties(value) {
|
|
43
145
|
if (Array.isArray(value)) {
|
|
44
146
|
return value.map(removeUndefinedProperties);
|
|
@@ -51,12 +153,5 @@ function removeUndefinedProperties(value) {
|
|
|
51
153
|
removeUndefinedProperties(nestedValue)
|
|
52
154
|
]));
|
|
53
155
|
}
|
|
54
|
-
/**
|
|
55
|
-
* Fully-featured deepMerge. Does not clone React components by default.
|
|
56
|
-
*/ export function deepMergeWithReactComponents(obj1, obj2) {
|
|
57
|
-
return deepMerge(obj1, obj2, {
|
|
58
|
-
isMergeableObject: isPlainObject
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
156
|
|
|
62
157
|
//# sourceMappingURL=deepMerge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/deepMerge.ts"],"sourcesContent":["import deepMerge from 'deepmerge'\n\nimport { isPlainObject } from './isPlainObject.js'\n\nexport { deepMerge }\n/**\n * Fully-featured deepMerge.\n *\n * Array handling: Arrays in the target object are combined with the source object's arrays.\n */\nexport function deepMergeWithCombinedArrays<T extends object>(\n obj1: object,\n obj2: object,\n options: deepMerge.Options = {},\n): T {\n return deepMerge<T>(obj1, obj2, {\n arrayMerge: (target, source, options) => {\n const destination = target.slice()\n\n source.forEach((item, index) => {\n if (typeof destination[index] === 'undefined') {\n destination[index] = options?.cloneUnlessOtherwiseSpecified(item, options)\n } else if (options?.isMergeableObject(item)) {\n destination[index] = deepMerge(target[index], item, options)\n } else if (target.indexOf(item) === -1) {\n destination.push(item)\n }\n })\n return destination\n },\n ...options,\n })\n}\n\n/**\n * Fully-featured deepMerge.\n *\n * Array handling: Arrays in the target object are replaced by the source object's arrays.\n */\nexport function deepMergeWithSourceArrays<T extends object>(obj1: object, obj2: object): T {\n return deepMerge<T>(obj1, obj2, { arrayMerge: (_, source) => source })\n}\n\n/**\n * Deep-merges objects while replacing arrays and retaining target values when the source contains\n * `undefined`. This matches partial update semantics, where `undefined` means that a stored value\n * was omitted rather than cleared.\n */\nexport function deepMergeWithSourceArraysIgnoringUndefined<T extends object>(\n obj1: object,\n obj2: object,\n): T {\n return deepMergeWithSourceArrays<T>(obj1, removeUndefinedProperties(obj2))\n}\n\nfunction removeUndefinedProperties<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map(removeUndefinedProperties) as T\n }\n\n if (\n value === null ||\n typeof value !== 'object' ||\n (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)\n ) {\n return value\n }\n\n return Object.fromEntries(\n Object.entries(value)\n .filter(([, nestedValue]) => nestedValue !== undefined)\n .map(([key, nestedValue]) => [key, removeUndefinedProperties(nestedValue)]),\n ) as T\n}\n\n/**\n * Fully-featured deepMerge. Does not clone React components by default.\n */\nexport function deepMergeWithReactComponents<T extends object>(obj1: object, obj2: object): T {\n return deepMerge<T>(obj1, obj2, {\n isMergeableObject: isPlainObject,\n })\n}\n"],"names":["deepMerge","isPlainObject","deepMergeWithCombinedArrays","obj1","obj2","options","arrayMerge","target","source","destination","slice","forEach","item","index","cloneUnlessOtherwiseSpecified","isMergeableObject","indexOf","push","deepMergeWithSourceArrays","_","deepMergeWithSourceArraysIgnoringUndefined","removeUndefinedProperties","value","Array","isArray","map","Object","getPrototypeOf","prototype","fromEntries","entries","filter","nestedValue","undefined","key","deepMergeWithReactComponents"],"mappings":"AAAA,OAAOA,eAAe,YAAW;AAEjC,SAASC,aAAa,QAAQ,qBAAoB;AAElD,SAASD,SAAS,GAAE;AACpB;;;;CAIC,GACD,OAAO,SAASE,4BACdC,IAAY,EACZC,IAAY,EACZC,UAA6B,CAAC,CAAC;IAE/B,OAAOL,UAAaG,MAAMC,MAAM;QAC9BE,YAAY,CAACC,QAAQC,QAAQH;YAC3B,MAAMI,cAAcF,OAAOG,KAAK;YAEhCF,OAAOG,OAAO,CAAC,CAACC,MAAMC;gBACpB,IAAI,OAAOJ,WAAW,CAACI,MAAM,KAAK,aAAa;oBAC7CJ,WAAW,CAACI,MAAM,GAAGR,SAASS,8BAA8BF,MAAMP;gBACpE,OAAO,IAAIA,SAASU,kBAAkBH,OAAO;oBAC3CH,WAAW,CAACI,MAAM,GAAGb,UAAUO,MAAM,CAACM,MAAM,EAAED,MAAMP;gBACtD,OAAO,IAAIE,OAAOS,OAAO,CAACJ,UAAU,CAAC,GAAG;oBACtCH,YAAYQ,IAAI,CAACL;gBACnB;YACF;YACA,OAAOH;QACT;QACA,GAAGJ,OAAO;IACZ;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASa,0BAA4Cf,IAAY,EAAEC,IAAY;IACpF,OAAOJ,UAAaG,MAAMC,MAAM;QAAEE,YAAY,CAACa,GAAGX,SAAWA;IAAO;AACtE;AAEA;;;;CAIC,GACD,OAAO,SAASY,2CACdjB,IAAY,EACZC,IAAY;IAEZ,OAAOc,0BAA6Bf,MAAMkB,0BAA0BjB;AACtE;AAEA,SAASiB,0BAA6BC,KAAQ;IAC5C,IAAIC,MAAMC,OAAO,CAACF,QAAQ;QACxB,OAAOA,MAAMG,GAAG,CAACJ;IACnB;IAEA,IACEC,UAAU,QACV,OAAOA,UAAU,YAChBI,OAAOC,cAAc,CAACL,WAAWI,OAAOE,SAAS,IAAIF,OAAOC,cAAc,CAACL,WAAW,MACvF;QACA,OAAOA;IACT;IAEA,OAAOI,OAAOG,WAAW,CACvBH,OAAOI,OAAO,CAACR,OACZS,MAAM,CAAC,CAAC,GAAGC,YAAY,GAAKA,gBAAgBC,WAC5CR,GAAG,CAAC,CAAC,CAACS,KAAKF,YAAY,GAAK;YAACE;YAAKb,0BAA0BW;SAAa;AAEhF;AAEA;;CAEC,GACD,OAAO,SAASG,6BAA+ChC,IAAY,EAAEC,IAAY;IACvF,OAAOJ,UAAaG,MAAMC,MAAM;QAC9BW,mBAAmBd;IACrB;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/deepMerge.ts"],"sourcesContent":["import { isPlainObject } from './isPlainObject.js'\n\nexport type DeepMergeArrayMergeOptions = {\n cloneUnlessOtherwiseSpecified(value: object, options?: DeepMergeOptions): any\n isMergeableObject(value: object): boolean\n}\n\nexport type DeepMergeOptions = {\n /**\n * Merges two arrays. Defaults to concatenating `target` and `source`.\n */\n arrayMerge?: (target: any[], source: any[], options: ResolvedDeepMergeOptions) => any[]\n /**\n * When `false`, mergeable values are copied by reference instead of being deeply cloned.\n * @default true\n */\n clone?: boolean\n /**\n * Returns a custom merge function for a given key, or `undefined` to use the default merge.\n */\n customMerge?: (key: string, options?: DeepMergeOptions) => ((x: any, y: any) => any) | undefined\n /**\n * Determines whether a value should be merged recursively or copied as-is.\n */\n isMergeableObject?(value: object): boolean\n}\n\ntype ResolvedDeepMergeOptions = {\n arrayMerge: NonNullable<DeepMergeOptions['arrayMerge']>\n isMergeableObject: (value: unknown) => boolean\n} & DeepMergeArrayMergeOptions &\n DeepMergeOptions\n\nconst REACT_ELEMENT_TYPES = new Set<unknown>([\n Symbol.for('react.element'),\n Symbol.for('react.transitional.element'),\n])\n\n/**\n * Fully-featured deepMerge. Returns a new object and does not mutate its arguments.\n *\n * Array handling: arrays are concatenated unless `arrayMerge` is provided.\n *\n * `__proto__` keys are never copied to the result, preventing prototype poisoning of the returned\n * object when merging untrusted input (e.g. parsed JSON).\n */\nexport function deepMerge<T>(x: Partial<T>, y: Partial<T>, options?: DeepMergeOptions): T\nexport function deepMerge<T1, T2>(\n x: Partial<T1>,\n y: Partial<T2>,\n options?: DeepMergeOptions,\n): T1 & T2\nexport function deepMerge(target: any, source: any, options?: DeepMergeOptions): any {\n // Copied rather than mutated, so that a reused options object is left untouched.\n const resolvedOptions = {\n ...options,\n arrayMerge: options?.arrayMerge || defaultArrayMerge,\n // Exposed on `options` so that custom `arrayMerge` implementations can use it.\n cloneUnlessOtherwiseSpecified: cloneUnlessOtherwiseSpecified as any,\n isMergeableObject: options?.isMergeableObject || isMergeableObject,\n } as ResolvedDeepMergeOptions\n\n const isSourceArray = Array.isArray(source)\n const isTargetArray = Array.isArray(target)\n\n if (isSourceArray !== isTargetArray) {\n return cloneUnlessOtherwiseSpecified(source, resolvedOptions)\n }\n\n if (isSourceArray) {\n return resolvedOptions.arrayMerge(target, source, resolvedOptions)\n }\n\n return mergeObject(target, source, resolvedOptions)\n}\n\n/**\n * Keeps the `deepMerge.Options` / `deepMerge.ArrayMergeOptions` type references from the former\n * `deepmerge` dependency working.\n */\n// oxlint-disable-next-line typescript/no-namespace\nexport declare namespace deepMerge {\n type ArrayMergeOptions = DeepMergeArrayMergeOptions\n type Options = DeepMergeOptions\n}\n\n/**\n * Deep-merges all objects in the array, from left to right.\n */\nfunction deepMergeAll<T = object>(objects: Partial<T>[], options?: DeepMergeOptions): T\nfunction deepMergeAll(objects: object[], options?: DeepMergeOptions): object\nfunction deepMergeAll(objects: object[], options?: DeepMergeOptions): object {\n if (!Array.isArray(objects)) {\n throw new Error('first argument should be an array')\n }\n\n return objects.reduce<object>((previous, next) => deepMerge(previous, next, options), {})\n}\n\ndeepMerge.all = deepMergeAll\n\n/**\n * Fully-featured deepMerge.\n *\n * Array handling: Arrays in the target object are combined with the source object's arrays.\n */\nexport function deepMergeWithCombinedArrays<T extends object>(\n obj1: object,\n obj2: object,\n options: DeepMergeOptions = {},\n): T {\n return deepMerge<T>(obj1, obj2, {\n arrayMerge: (target, source, options) => {\n const destination = target.slice()\n\n source.forEach((item, index) => {\n if (typeof destination[index] === 'undefined') {\n destination[index] = options?.cloneUnlessOtherwiseSpecified(item, options)\n } else if (options?.isMergeableObject(item)) {\n destination[index] = deepMerge(target[index], item, options)\n } else if (target.indexOf(item) === -1) {\n destination.push(item)\n }\n })\n return destination\n },\n ...options,\n })\n}\n\n/**\n * Fully-featured deepMerge.\n *\n * Array handling: Arrays in the target object are replaced by the source object's arrays.\n */\nexport function deepMergeWithSourceArrays<T extends object>(obj1: object, obj2: object): T {\n return deepMerge<T>(obj1, obj2, { arrayMerge: (_, source) => source })\n}\n\n/**\n * Deep-merges objects while replacing arrays and retaining target values when the source contains\n * `undefined`. This matches partial update semantics, where `undefined` means that a stored value\n * was omitted rather than cleared.\n */\nexport function deepMergeWithSourceArraysIgnoringUndefined<T extends object>(\n obj1: object,\n obj2: object,\n): T {\n return deepMergeWithSourceArrays<T>(obj1, removeUndefinedProperties(obj2))\n}\n\n/**\n * Fully-featured deepMerge. Does not clone React components by default.\n */\nexport function deepMergeWithReactComponents<T extends object>(obj1: object, obj2: object): T {\n return deepMerge<T>(obj1, obj2, {\n isMergeableObject: isPlainObject,\n })\n}\n\nfunction isMergeableObject(value: unknown): boolean {\n if (!value || typeof value !== 'object') {\n return false\n }\n\n const stringTag = Object.prototype.toString.call(value)\n\n if (stringTag === '[object RegExp]' || stringTag === '[object Date]') {\n return false\n }\n\n return !REACT_ELEMENT_TYPES.has((value as { $$typeof?: unknown }).$$typeof)\n}\n\nfunction cloneUnlessOtherwiseSpecified(value: unknown, options: ResolvedDeepMergeOptions): any {\n return options.clone !== false && options.isMergeableObject(value)\n ? deepMerge<object>(Array.isArray(value) ? [] : {}, value as object, options)\n : value\n}\n\nfunction defaultArrayMerge(target: any[], source: any[], options: ResolvedDeepMergeOptions) {\n return target.concat(source).map((element) => cloneUnlessOtherwiseSpecified(element, options))\n}\n\nfunction getMergeFunction(key: PropertyKey, options: ResolvedDeepMergeOptions) {\n if (!options.customMerge) {\n return deepMerge\n }\n\n const customMerge = options.customMerge(key as string, options)\n\n return typeof customMerge === 'function' ? customMerge : deepMerge\n}\n\nfunction getEnumerableOwnKeys(value: object): PropertyKey[] {\n return [\n ...Object.keys(value),\n ...Object.getOwnPropertySymbols(value).filter((symbol) =>\n Object.prototype.propertyIsEnumerable.call(value, symbol),\n ),\n ]\n}\n\nfunction isPropertyOnObject(object: object, property: PropertyKey): boolean {\n try {\n return property in object\n } catch {\n return false\n }\n}\n\n/**\n * A key is unsafe to merge when it exists on the target but is inherited or non-enumerable, or when\n * it is `__proto__`, which would replace the prototype of the returned object on assignment.\n */\nfunction isUnsafeKey(target: object, key: PropertyKey): boolean {\n if (key === '__proto__') {\n return true\n }\n\n return (\n isPropertyOnObject(target, key) &&\n !(\n Object.prototype.hasOwnProperty.call(target, key) &&\n Object.prototype.propertyIsEnumerable.call(target, key)\n )\n )\n}\n\nfunction mergeObject(target: any, source: any, options: ResolvedDeepMergeOptions) {\n const destination: Record<PropertyKey, unknown> = {}\n\n if (options.isMergeableObject(target)) {\n for (const key of getEnumerableOwnKeys(target)) {\n if (key === '__proto__') {\n continue\n }\n\n destination[key] = cloneUnlessOtherwiseSpecified(target[key], options)\n }\n }\n\n for (const key of getEnumerableOwnKeys(source)) {\n if (isUnsafeKey(target, key)) {\n continue\n }\n\n if (isPropertyOnObject(target, key) && options.isMergeableObject(source[key])) {\n destination[key] = getMergeFunction(key, options)(target[key], source[key], options)\n } else {\n destination[key] = cloneUnlessOtherwiseSpecified(source[key], options)\n }\n }\n\n return destination\n}\n\nfunction removeUndefinedProperties<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map(removeUndefinedProperties) as T\n }\n\n if (\n value === null ||\n typeof value !== 'object' ||\n (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)\n ) {\n return value\n }\n\n return Object.fromEntries(\n Object.entries(value)\n .filter(([, nestedValue]) => nestedValue !== undefined)\n .map(([key, nestedValue]) => [key, removeUndefinedProperties(nestedValue)]),\n ) as T\n}\n"],"names":["isPlainObject","REACT_ELEMENT_TYPES","Set","Symbol","for","deepMerge","target","source","options","resolvedOptions","arrayMerge","defaultArrayMerge","cloneUnlessOtherwiseSpecified","isMergeableObject","isSourceArray","Array","isArray","isTargetArray","mergeObject","deepMergeAll","objects","Error","reduce","previous","next","all","deepMergeWithCombinedArrays","obj1","obj2","destination","slice","forEach","item","index","indexOf","push","deepMergeWithSourceArrays","_","deepMergeWithSourceArraysIgnoringUndefined","removeUndefinedProperties","deepMergeWithReactComponents","value","stringTag","Object","prototype","toString","call","has","$$typeof","clone","concat","map","element","getMergeFunction","key","customMerge","getEnumerableOwnKeys","keys","getOwnPropertySymbols","filter","symbol","propertyIsEnumerable","isPropertyOnObject","object","property","isUnsafeKey","hasOwnProperty","getPrototypeOf","fromEntries","entries","nestedValue","undefined"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAoB;AAiClD,MAAMC,sBAAsB,IAAIC,IAAa;IAC3CC,OAAOC,GAAG,CAAC;IACXD,OAAOC,GAAG,CAAC;CACZ;AAgBD,OAAO,SAASC,UAAUC,MAAW,EAAEC,MAAW,EAAEC,OAA0B;IAC5E,iFAAiF;IACjF,MAAMC,kBAAkB;QACtB,GAAGD,OAAO;QACVE,YAAYF,SAASE,cAAcC;QACnC,+EAA+E;QAC/EC,+BAA+BA;QAC/BC,mBAAmBL,SAASK,qBAAqBA;IACnD;IAEA,MAAMC,gBAAgBC,MAAMC,OAAO,CAAC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,OAAO,CAACyB,QAAQ;QACxB,OAAOA,MAAMU,GAAG,CAACZ;IACnB;IAEA,IACEE,UAAU,QACV,OAAOA,UAAU,YAChBE,OAAOwB,cAAc,CAAC1B,WAAWE,OAAOC,SAAS,IAAID,OAAOwB,cAAc,CAAC1B,WAAW,MACvF;QACA,OAAOA;IACT;IAEA,OAAOE,OAAOyB,WAAW,CACvBzB,OAAO0B,OAAO,CAAC5B,OACZkB,MAAM,CAAC,CAAC,GAAGW,YAAY,GAAKA,gBAAgBC,WAC5CpB,GAAG,CAAC,CAAC,CAACG,KAAKgB,YAAY,GAAK;YAAChB;YAAKf,0BAA0B+B;SAAa;AAEhF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.11",
|
|
4
4
|
"description": "Node, React, Headless CMS and Application Framework built on Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"admin panel",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
},
|
|
119
119
|
"dependencies": {
|
|
120
120
|
"@next/env": "16.4.6",
|
|
121
|
-
"@payloadcms/translations": "4.0.0-beta.
|
|
121
|
+
"@payloadcms/translations": "4.0.0-beta.11",
|
|
122
122
|
"@standard-schema/spec": "1.1.0",
|
|
123
123
|
"@types/busboy": "1.5.4",
|
|
124
124
|
"bson-objectid": "2.0.4",
|
|
@@ -128,7 +128,6 @@
|
|
|
128
128
|
"console-table-printer": "2.15.0",
|
|
129
129
|
"croner": "10.0.1",
|
|
130
130
|
"dataloader": "2.2.3",
|
|
131
|
-
"deepmerge": "4.3.1",
|
|
132
131
|
"dotenv": "16.4.5",
|
|
133
132
|
"dotenv-expand": "11.0.6",
|
|
134
133
|
"file-type": "22.0.1",
|