@strapi/utils 5.19.0 → 5.21.0
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/content-types.d.ts +3 -1
- package/dist/content-types.d.ts.map +1 -1
- package/dist/content-types.js +4 -0
- package/dist/content-types.js.map +1 -1
- package/dist/content-types.mjs +4 -1
- package/dist/content-types.mjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -1
- package/dist/validation/index.d.ts +3 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/route-validators/base.d.ts +107 -0
- package/dist/validation/route-validators/base.d.ts.map +1 -0
- package/dist/validation/route-validators/base.js +92 -0
- package/dist/validation/route-validators/base.js.map +1 -0
- package/dist/validation/route-validators/base.mjs +90 -0
- package/dist/validation/route-validators/base.mjs.map +1 -0
- package/dist/validation/route-validators/index.d.ts +39 -0
- package/dist/validation/route-validators/index.d.ts.map +1 -0
- package/dist/validation/route-validators/query-params.d.ts +100 -0
- package/dist/validation/route-validators/query-params.d.ts.map +1 -0
- package/dist/validation/route-validators/query-params.js +117 -0
- package/dist/validation/route-validators/query-params.js.map +1 -0
- package/dist/validation/route-validators/query-params.mjs +88 -0
- package/dist/validation/route-validators/query-params.mjs.map +1 -0
- package/dist/validation/utilities.d.ts +81 -0
- package/dist/validation/utilities.d.ts.map +1 -0
- package/dist/validation/utilities.js +123 -0
- package/dist/validation/utilities.js.map +1 -0
- package/dist/validation/utilities.mjs +116 -0
- package/dist/validation/utilities.mjs.map +1 -0
- package/dist/zod.js +2 -2
- package/dist/zod.js.map +1 -1
- package/dist/zod.mjs +2 -2
- package/dist/zod.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file This file contains utility functions for working with Zod schemas.
|
|
5
|
+
* It provides functions to modify schemas (e.g., make them optional, readonly, or add default values),
|
|
6
|
+
* and to safely register and create schemas within Zod's global registry.
|
|
7
|
+
*/ /**
|
|
8
|
+
* Transforms a Strapi UID into an OpenAPI-compliant component name.
|
|
9
|
+
*
|
|
10
|
+
* @param uid - The Strapi UID to transform (e.g., "basic.seo", "api::category.category", "plugin::upload.file")
|
|
11
|
+
* @returns The OpenAPI-compliant component name (e.g., "BasicSeoEntry", "ApiCategoryCategoryDocument", "PluginUploadFileDocument")
|
|
12
|
+
*/ const transformUidToValidOpenApiName = (uid)=>{
|
|
13
|
+
const capitalize = (str)=>{
|
|
14
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
15
|
+
};
|
|
16
|
+
const toPascalCase = (str)=>{
|
|
17
|
+
return str.split(/[-_]/).map(capitalize).join('');
|
|
18
|
+
};
|
|
19
|
+
// Check if it contains double colons (other namespaced UIDs)
|
|
20
|
+
if (uid.includes('::')) {
|
|
21
|
+
const [namespace, ...rest] = uid.split('::');
|
|
22
|
+
const namespacePart = toPascalCase(namespace);
|
|
23
|
+
const restParts = rest.join('.').split('.').map(toPascalCase).map(capitalize);
|
|
24
|
+
return `${capitalize(namespacePart)}${restParts.join('')}Document`;
|
|
25
|
+
}
|
|
26
|
+
if (uid.includes('.')) {
|
|
27
|
+
// basic.seo -> BasicSeoEntry
|
|
28
|
+
const parts = uid.split('.');
|
|
29
|
+
const transformedParts = parts.map(toPascalCase).map(capitalize);
|
|
30
|
+
return `${transformedParts.join('')}Entry`;
|
|
31
|
+
}
|
|
32
|
+
return `${toPascalCase(capitalize(uid))}Schema`;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Conditionally makes a Zod schema optional based on the `required` parameter.
|
|
36
|
+
*
|
|
37
|
+
* @param required - If `false` or `undefined`, the schema will be made optional. If `true`, the schema becomes non-optional.
|
|
38
|
+
* @returns A function that takes a Zod schema and returns a modified schema (optional or required).
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const optionalString = maybeRequired(false)(z.string()); // z.ZodOptional<z.ZodString>
|
|
42
|
+
*
|
|
43
|
+
* const requiredString = maybeRequired(true)(z.string()); // z.ZodString
|
|
44
|
+
* ```
|
|
45
|
+
*/ const maybeRequired = (required)=>{
|
|
46
|
+
return (schema)=>{
|
|
47
|
+
return required !== true ? schema.optional() : schema.nonoptional();
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Conditionally makes a Zod schema readonly based on the `writable` parameter.
|
|
52
|
+
*
|
|
53
|
+
* @param writable - If `false`, the schema will be made readonly. If `true` or `undefined`, the schema remains unchanged.
|
|
54
|
+
* @returns A function that takes a Zod schema and returns a modified schema (readonly or original).
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const readonlyNumber = maybeReadonly(false)(z.number()); // z.ZodReadonly<z.ZodNumber>
|
|
58
|
+
* const writableNumber = maybeReadonly(true)(z.number()); // z.ZodNumber
|
|
59
|
+
* ```
|
|
60
|
+
*/ const maybeReadonly = (writable)=>{
|
|
61
|
+
return (schema)=>writable !== false ? schema : schema.readonly();
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Conditionally adds a default value to a Zod schema based on the `defaultValue` parameter.
|
|
65
|
+
*
|
|
66
|
+
* @param defaultValue - The default value to apply to the schema. If `undefined`, no default value is added.
|
|
67
|
+
* If `defaultValue` is a function, its return value will be used as the default.
|
|
68
|
+
* @returns A function that takes a Zod schema and returns a modified schema (with default or original).
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const stringWithDefault = maybeWithDefault("default")(z.string()); // z.ZodDefault<z.ZodString>
|
|
72
|
+
* const numberWithFunctionDefault = maybeWithDefault(() => Math.random())(z.number());
|
|
73
|
+
* ```
|
|
74
|
+
*/ const maybeWithDefault = (defaultValue)=>{
|
|
75
|
+
return (schema)=>{
|
|
76
|
+
if (defaultValue === undefined) {
|
|
77
|
+
return schema;
|
|
78
|
+
}
|
|
79
|
+
const value = typeof defaultValue === 'function' ? defaultValue() : defaultValue;
|
|
80
|
+
return schema.default(value);
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Conditionally applies `min` and `max` constraints to a Zod string, number, or array schema.
|
|
85
|
+
*
|
|
86
|
+
* @param min - The minimum value/length. If `undefined`, no minimum constraint is applied.
|
|
87
|
+
* @param max - The maximum value/length. If `undefined`, no maximum constraint is applied.
|
|
88
|
+
* @returns A function that takes a Zod string, number, or array schema and returns a modified schema (with min/max constraints or original).
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* const stringWithMinMax = maybeWithMinMax(5, 10)(z.string()); // z.ZodString with min(5) and max(10)
|
|
92
|
+
* const numberWithMinMax = maybeWithMinMax(0, 100)(z.number()); // z.ZodNumber with min(0) and max(100)
|
|
93
|
+
* ```
|
|
94
|
+
*/ const maybeWithMinMax = (min, max)=>{
|
|
95
|
+
return (schema)=>{
|
|
96
|
+
return min !== undefined && max !== undefined ? schema.min(min).max(max) : schema;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Applies a series of modifier functions to a Zod schema sequentially.
|
|
101
|
+
*
|
|
102
|
+
* @template T - The type of the Zod schema.
|
|
103
|
+
* @param schema - The initial Zod schema to which modifiers will be applied.
|
|
104
|
+
* @param modifiers - An array of functions, each taking a Zod schema and returning a modified schema.
|
|
105
|
+
* @returns The final Zod schema after all modifiers have been applied.
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const modifiedSchema = augmentSchema(z.string(), [
|
|
109
|
+
* maybeRequired(false),
|
|
110
|
+
* maybeWithDefault("test")
|
|
111
|
+
* ]);
|
|
112
|
+
* ```
|
|
113
|
+
*/ const augmentSchema = (schema, modifiers)=>{
|
|
114
|
+
return modifiers.reduce((acc, modifier)=>modifier(acc), schema);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
exports.augmentSchema = augmentSchema;
|
|
118
|
+
exports.maybeReadonly = maybeReadonly;
|
|
119
|
+
exports.maybeRequired = maybeRequired;
|
|
120
|
+
exports.maybeWithDefault = maybeWithDefault;
|
|
121
|
+
exports.maybeWithMinMax = maybeWithMinMax;
|
|
122
|
+
exports.transformUidToValidOpenApiName = transformUidToValidOpenApiName;
|
|
123
|
+
//# sourceMappingURL=utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilities.js","sources":["../../src/validation/utilities.ts"],"sourcesContent":["/**\n * @file This file contains utility functions for working with Zod schemas.\n * It provides functions to modify schemas (e.g., make them optional, readonly, or add default values),\n * and to safely register and create schemas within Zod's global registry.\n */\n\nimport * as z from 'zod/v4';\n\n/**\n * Transforms a Strapi UID into an OpenAPI-compliant component name.\n *\n * @param uid - The Strapi UID to transform (e.g., \"basic.seo\", \"api::category.category\", \"plugin::upload.file\")\n * @returns The OpenAPI-compliant component name (e.g., \"BasicSeoEntry\", \"ApiCategoryCategoryDocument\", \"PluginUploadFileDocument\")\n */\nexport const transformUidToValidOpenApiName = (uid: string): string => {\n const capitalize = (str: string): string => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n };\n\n const toPascalCase = (str: string): string => {\n return str.split(/[-_]/).map(capitalize).join('');\n };\n\n // Check if it contains double colons (other namespaced UIDs)\n if (uid.includes('::')) {\n const [namespace, ...rest] = uid.split('::');\n const namespacePart = toPascalCase(namespace);\n const restParts = rest.join('.').split('.').map(toPascalCase).map(capitalize);\n return `${capitalize(namespacePart)}${restParts.join('')}Document`;\n }\n\n if (uid.includes('.')) {\n // basic.seo -> BasicSeoEntry\n const parts = uid.split('.');\n const transformedParts = parts.map(toPascalCase).map(capitalize);\n return `${transformedParts.join('')}Entry`;\n }\n\n return `${toPascalCase(capitalize(uid))}Schema`;\n};\n\n/**\n * Conditionally makes a Zod schema optional based on the `required` parameter.\n *\n * @param required - If `false` or `undefined`, the schema will be made optional. If `true`, the schema becomes non-optional.\n * @returns A function that takes a Zod schema and returns a modified schema (optional or required).\n * @example\n * ```typescript\n * const optionalString = maybeRequired(false)(z.string()); // z.ZodOptional<z.ZodString>\n *\n * const requiredString = maybeRequired(true)(z.string()); // z.ZodString\n * ```\n */\nexport const maybeRequired = (required?: boolean) => {\n return <T extends z.Schema>(schema: T) => {\n return required !== true ? schema.optional() : schema.nonoptional();\n };\n};\n\n/**\n * Conditionally makes a Zod schema readonly based on the `writable` parameter.\n *\n * @param writable - If `false`, the schema will be made readonly. If `true` or `undefined`, the schema remains unchanged.\n * @returns A function that takes a Zod schema and returns a modified schema (readonly or original).\n * @example\n * ```typescript\n * const readonlyNumber = maybeReadonly(false)(z.number()); // z.ZodReadonly<z.ZodNumber>\n * const writableNumber = maybeReadonly(true)(z.number()); // z.ZodNumber\n * ```\n */\nexport const maybeReadonly = (writable?: boolean) => {\n return <T extends z.Schema>(schema: T) => (writable !== false ? schema : schema.readonly());\n};\n\n/**\n * Conditionally adds a default value to a Zod schema based on the `defaultValue` parameter.\n *\n * @param defaultValue - The default value to apply to the schema. If `undefined`, no default value is added.\n * If `defaultValue` is a function, its return value will be used as the default.\n * @returns A function that takes a Zod schema and returns a modified schema (with default or original).\n * @example\n * ```typescript\n * const stringWithDefault = maybeWithDefault(\"default\")(z.string()); // z.ZodDefault<z.ZodString>\n * const numberWithFunctionDefault = maybeWithDefault(() => Math.random())(z.number());\n * ```\n */\nexport const maybeWithDefault = (defaultValue?: unknown) => {\n return <T extends z.Schema>(schema: T) => {\n if (defaultValue === undefined) {\n return schema;\n }\n\n const value = typeof defaultValue === 'function' ? defaultValue() : defaultValue;\n return schema.default(value);\n };\n};\n\n/**\n * Conditionally applies `min` and `max` constraints to a Zod string, number, or array schema.\n *\n * @param min - The minimum value/length. If `undefined`, no minimum constraint is applied.\n * @param max - The maximum value/length. If `undefined`, no maximum constraint is applied.\n * @returns A function that takes a Zod string, number, or array schema and returns a modified schema (with min/max constraints or original).\n * @example\n * ```typescript\n * const stringWithMinMax = maybeWithMinMax(5, 10)(z.string()); // z.ZodString with min(5) and max(10)\n * const numberWithMinMax = maybeWithMinMax(0, 100)(z.number()); // z.ZodNumber with min(0) and max(100)\n * ```\n */\nexport const maybeWithMinMax = (min?: number, max?: number) => {\n return <R extends z.ZodString | z.ZodEmail | z.ZodNumber | z.ZodArray<z.ZodAny>>(schema: R) => {\n return min !== undefined && max !== undefined ? schema.min(min).max(max) : schema;\n };\n};\n\n/**\n * Applies a series of modifier functions to a Zod schema sequentially.\n *\n * @template T - The type of the Zod schema.\n * @param schema - The initial Zod schema to which modifiers will be applied.\n * @param modifiers - An array of functions, each taking a Zod schema and returning a modified schema.\n * @returns The final Zod schema after all modifiers have been applied.\n * @example\n * ```typescript\n * const modifiedSchema = augmentSchema(z.string(), [\n * maybeRequired(false),\n * maybeWithDefault(\"test\")\n * ]);\n * ```\n */\nexport const augmentSchema = <T extends z.Schema>(\n schema: T,\n modifiers: ((schema: T) => z.Schema)[]\n) => {\n return modifiers.reduce((acc, modifier) => modifier(acc) as T, schema);\n};\n"],"names":["transformUidToValidOpenApiName","uid","capitalize","str","charAt","toUpperCase","slice","toPascalCase","split","map","join","includes","namespace","rest","namespacePart","restParts","parts","transformedParts","maybeRequired","required","schema","optional","nonoptional","maybeReadonly","writable","readonly","maybeWithDefault","defaultValue","undefined","value","default","maybeWithMinMax","min","max","augmentSchema","modifiers","reduce","acc","modifier"],"mappings":"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"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file This file contains utility functions for working with Zod schemas.
|
|
3
|
+
* It provides functions to modify schemas (e.g., make them optional, readonly, or add default values),
|
|
4
|
+
* and to safely register and create schemas within Zod's global registry.
|
|
5
|
+
*/ /**
|
|
6
|
+
* Transforms a Strapi UID into an OpenAPI-compliant component name.
|
|
7
|
+
*
|
|
8
|
+
* @param uid - The Strapi UID to transform (e.g., "basic.seo", "api::category.category", "plugin::upload.file")
|
|
9
|
+
* @returns The OpenAPI-compliant component name (e.g., "BasicSeoEntry", "ApiCategoryCategoryDocument", "PluginUploadFileDocument")
|
|
10
|
+
*/ const transformUidToValidOpenApiName = (uid)=>{
|
|
11
|
+
const capitalize = (str)=>{
|
|
12
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
13
|
+
};
|
|
14
|
+
const toPascalCase = (str)=>{
|
|
15
|
+
return str.split(/[-_]/).map(capitalize).join('');
|
|
16
|
+
};
|
|
17
|
+
// Check if it contains double colons (other namespaced UIDs)
|
|
18
|
+
if (uid.includes('::')) {
|
|
19
|
+
const [namespace, ...rest] = uid.split('::');
|
|
20
|
+
const namespacePart = toPascalCase(namespace);
|
|
21
|
+
const restParts = rest.join('.').split('.').map(toPascalCase).map(capitalize);
|
|
22
|
+
return `${capitalize(namespacePart)}${restParts.join('')}Document`;
|
|
23
|
+
}
|
|
24
|
+
if (uid.includes('.')) {
|
|
25
|
+
// basic.seo -> BasicSeoEntry
|
|
26
|
+
const parts = uid.split('.');
|
|
27
|
+
const transformedParts = parts.map(toPascalCase).map(capitalize);
|
|
28
|
+
return `${transformedParts.join('')}Entry`;
|
|
29
|
+
}
|
|
30
|
+
return `${toPascalCase(capitalize(uid))}Schema`;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Conditionally makes a Zod schema optional based on the `required` parameter.
|
|
34
|
+
*
|
|
35
|
+
* @param required - If `false` or `undefined`, the schema will be made optional. If `true`, the schema becomes non-optional.
|
|
36
|
+
* @returns A function that takes a Zod schema and returns a modified schema (optional or required).
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const optionalString = maybeRequired(false)(z.string()); // z.ZodOptional<z.ZodString>
|
|
40
|
+
*
|
|
41
|
+
* const requiredString = maybeRequired(true)(z.string()); // z.ZodString
|
|
42
|
+
* ```
|
|
43
|
+
*/ const maybeRequired = (required)=>{
|
|
44
|
+
return (schema)=>{
|
|
45
|
+
return required !== true ? schema.optional() : schema.nonoptional();
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Conditionally makes a Zod schema readonly based on the `writable` parameter.
|
|
50
|
+
*
|
|
51
|
+
* @param writable - If `false`, the schema will be made readonly. If `true` or `undefined`, the schema remains unchanged.
|
|
52
|
+
* @returns A function that takes a Zod schema and returns a modified schema (readonly or original).
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const readonlyNumber = maybeReadonly(false)(z.number()); // z.ZodReadonly<z.ZodNumber>
|
|
56
|
+
* const writableNumber = maybeReadonly(true)(z.number()); // z.ZodNumber
|
|
57
|
+
* ```
|
|
58
|
+
*/ const maybeReadonly = (writable)=>{
|
|
59
|
+
return (schema)=>writable !== false ? schema : schema.readonly();
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Conditionally adds a default value to a Zod schema based on the `defaultValue` parameter.
|
|
63
|
+
*
|
|
64
|
+
* @param defaultValue - The default value to apply to the schema. If `undefined`, no default value is added.
|
|
65
|
+
* If `defaultValue` is a function, its return value will be used as the default.
|
|
66
|
+
* @returns A function that takes a Zod schema and returns a modified schema (with default or original).
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const stringWithDefault = maybeWithDefault("default")(z.string()); // z.ZodDefault<z.ZodString>
|
|
70
|
+
* const numberWithFunctionDefault = maybeWithDefault(() => Math.random())(z.number());
|
|
71
|
+
* ```
|
|
72
|
+
*/ const maybeWithDefault = (defaultValue)=>{
|
|
73
|
+
return (schema)=>{
|
|
74
|
+
if (defaultValue === undefined) {
|
|
75
|
+
return schema;
|
|
76
|
+
}
|
|
77
|
+
const value = typeof defaultValue === 'function' ? defaultValue() : defaultValue;
|
|
78
|
+
return schema.default(value);
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Conditionally applies `min` and `max` constraints to a Zod string, number, or array schema.
|
|
83
|
+
*
|
|
84
|
+
* @param min - The minimum value/length. If `undefined`, no minimum constraint is applied.
|
|
85
|
+
* @param max - The maximum value/length. If `undefined`, no maximum constraint is applied.
|
|
86
|
+
* @returns A function that takes a Zod string, number, or array schema and returns a modified schema (with min/max constraints or original).
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* const stringWithMinMax = maybeWithMinMax(5, 10)(z.string()); // z.ZodString with min(5) and max(10)
|
|
90
|
+
* const numberWithMinMax = maybeWithMinMax(0, 100)(z.number()); // z.ZodNumber with min(0) and max(100)
|
|
91
|
+
* ```
|
|
92
|
+
*/ const maybeWithMinMax = (min, max)=>{
|
|
93
|
+
return (schema)=>{
|
|
94
|
+
return min !== undefined && max !== undefined ? schema.min(min).max(max) : schema;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Applies a series of modifier functions to a Zod schema sequentially.
|
|
99
|
+
*
|
|
100
|
+
* @template T - The type of the Zod schema.
|
|
101
|
+
* @param schema - The initial Zod schema to which modifiers will be applied.
|
|
102
|
+
* @param modifiers - An array of functions, each taking a Zod schema and returning a modified schema.
|
|
103
|
+
* @returns The final Zod schema after all modifiers have been applied.
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const modifiedSchema = augmentSchema(z.string(), [
|
|
107
|
+
* maybeRequired(false),
|
|
108
|
+
* maybeWithDefault("test")
|
|
109
|
+
* ]);
|
|
110
|
+
* ```
|
|
111
|
+
*/ const augmentSchema = (schema, modifiers)=>{
|
|
112
|
+
return modifiers.reduce((acc, modifier)=>modifier(acc), schema);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export { augmentSchema, maybeReadonly, maybeRequired, maybeWithDefault, maybeWithMinMax, transformUidToValidOpenApiName };
|
|
116
|
+
//# sourceMappingURL=utilities.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilities.mjs","sources":["../../src/validation/utilities.ts"],"sourcesContent":["/**\n * @file This file contains utility functions for working with Zod schemas.\n * It provides functions to modify schemas (e.g., make them optional, readonly, or add default values),\n * and to safely register and create schemas within Zod's global registry.\n */\n\nimport * as z from 'zod/v4';\n\n/**\n * Transforms a Strapi UID into an OpenAPI-compliant component name.\n *\n * @param uid - The Strapi UID to transform (e.g., \"basic.seo\", \"api::category.category\", \"plugin::upload.file\")\n * @returns The OpenAPI-compliant component name (e.g., \"BasicSeoEntry\", \"ApiCategoryCategoryDocument\", \"PluginUploadFileDocument\")\n */\nexport const transformUidToValidOpenApiName = (uid: string): string => {\n const capitalize = (str: string): string => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n };\n\n const toPascalCase = (str: string): string => {\n return str.split(/[-_]/).map(capitalize).join('');\n };\n\n // Check if it contains double colons (other namespaced UIDs)\n if (uid.includes('::')) {\n const [namespace, ...rest] = uid.split('::');\n const namespacePart = toPascalCase(namespace);\n const restParts = rest.join('.').split('.').map(toPascalCase).map(capitalize);\n return `${capitalize(namespacePart)}${restParts.join('')}Document`;\n }\n\n if (uid.includes('.')) {\n // basic.seo -> BasicSeoEntry\n const parts = uid.split('.');\n const transformedParts = parts.map(toPascalCase).map(capitalize);\n return `${transformedParts.join('')}Entry`;\n }\n\n return `${toPascalCase(capitalize(uid))}Schema`;\n};\n\n/**\n * Conditionally makes a Zod schema optional based on the `required` parameter.\n *\n * @param required - If `false` or `undefined`, the schema will be made optional. If `true`, the schema becomes non-optional.\n * @returns A function that takes a Zod schema and returns a modified schema (optional or required).\n * @example\n * ```typescript\n * const optionalString = maybeRequired(false)(z.string()); // z.ZodOptional<z.ZodString>\n *\n * const requiredString = maybeRequired(true)(z.string()); // z.ZodString\n * ```\n */\nexport const maybeRequired = (required?: boolean) => {\n return <T extends z.Schema>(schema: T) => {\n return required !== true ? schema.optional() : schema.nonoptional();\n };\n};\n\n/**\n * Conditionally makes a Zod schema readonly based on the `writable` parameter.\n *\n * @param writable - If `false`, the schema will be made readonly. If `true` or `undefined`, the schema remains unchanged.\n * @returns A function that takes a Zod schema and returns a modified schema (readonly or original).\n * @example\n * ```typescript\n * const readonlyNumber = maybeReadonly(false)(z.number()); // z.ZodReadonly<z.ZodNumber>\n * const writableNumber = maybeReadonly(true)(z.number()); // z.ZodNumber\n * ```\n */\nexport const maybeReadonly = (writable?: boolean) => {\n return <T extends z.Schema>(schema: T) => (writable !== false ? schema : schema.readonly());\n};\n\n/**\n * Conditionally adds a default value to a Zod schema based on the `defaultValue` parameter.\n *\n * @param defaultValue - The default value to apply to the schema. If `undefined`, no default value is added.\n * If `defaultValue` is a function, its return value will be used as the default.\n * @returns A function that takes a Zod schema and returns a modified schema (with default or original).\n * @example\n * ```typescript\n * const stringWithDefault = maybeWithDefault(\"default\")(z.string()); // z.ZodDefault<z.ZodString>\n * const numberWithFunctionDefault = maybeWithDefault(() => Math.random())(z.number());\n * ```\n */\nexport const maybeWithDefault = (defaultValue?: unknown) => {\n return <T extends z.Schema>(schema: T) => {\n if (defaultValue === undefined) {\n return schema;\n }\n\n const value = typeof defaultValue === 'function' ? defaultValue() : defaultValue;\n return schema.default(value);\n };\n};\n\n/**\n * Conditionally applies `min` and `max` constraints to a Zod string, number, or array schema.\n *\n * @param min - The minimum value/length. If `undefined`, no minimum constraint is applied.\n * @param max - The maximum value/length. If `undefined`, no maximum constraint is applied.\n * @returns A function that takes a Zod string, number, or array schema and returns a modified schema (with min/max constraints or original).\n * @example\n * ```typescript\n * const stringWithMinMax = maybeWithMinMax(5, 10)(z.string()); // z.ZodString with min(5) and max(10)\n * const numberWithMinMax = maybeWithMinMax(0, 100)(z.number()); // z.ZodNumber with min(0) and max(100)\n * ```\n */\nexport const maybeWithMinMax = (min?: number, max?: number) => {\n return <R extends z.ZodString | z.ZodEmail | z.ZodNumber | z.ZodArray<z.ZodAny>>(schema: R) => {\n return min !== undefined && max !== undefined ? schema.min(min).max(max) : schema;\n };\n};\n\n/**\n * Applies a series of modifier functions to a Zod schema sequentially.\n *\n * @template T - The type of the Zod schema.\n * @param schema - The initial Zod schema to which modifiers will be applied.\n * @param modifiers - An array of functions, each taking a Zod schema and returning a modified schema.\n * @returns The final Zod schema after all modifiers have been applied.\n * @example\n * ```typescript\n * const modifiedSchema = augmentSchema(z.string(), [\n * maybeRequired(false),\n * maybeWithDefault(\"test\")\n * ]);\n * ```\n */\nexport const augmentSchema = <T extends z.Schema>(\n schema: T,\n modifiers: ((schema: T) => z.Schema)[]\n) => {\n return modifiers.reduce((acc, modifier) => modifier(acc) as T, schema);\n};\n"],"names":["transformUidToValidOpenApiName","uid","capitalize","str","charAt","toUpperCase","slice","toPascalCase","split","map","join","includes","namespace","rest","namespacePart","restParts","parts","transformedParts","maybeRequired","required","schema","optional","nonoptional","maybeReadonly","writable","readonly","maybeWithDefault","defaultValue","undefined","value","default","maybeWithMinMax","min","max","augmentSchema","modifiers","reduce","acc","modifier"],"mappings":"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"}
|
package/dist/zod.js
CHANGED
|
@@ -17,11 +17,11 @@ const validateZod = (schema)=>(data)=>{
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
const formatZodErrors = (zodError)=>({
|
|
20
|
-
errors: zodError.
|
|
20
|
+
errors: zodError.issues.map((issue)=>{
|
|
21
21
|
return {
|
|
22
22
|
path: issue.path,
|
|
23
23
|
message: issue.message,
|
|
24
|
-
name:
|
|
24
|
+
name: 'ValidationError'
|
|
25
25
|
};
|
|
26
26
|
}),
|
|
27
27
|
message: 'Validation error'
|
package/dist/zod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.js","sources":["../src/zod.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { ValidationError } from './errors';\n\nexport const validateZod =\n <T extends z.ZodTypeAny>(schema: T) =>\n (data: unknown): z.TypeOf<T> => {\n try {\n return schema.parse(data);\n } catch (error) {\n if (error instanceof z.ZodError) {\n const { message, errors } = formatZodErrors(error);\n throw new ValidationError(message, { errors });\n }\n\n throw error;\n }\n };\n\nconst formatZodErrors = (zodError: z.ZodError) => ({\n errors: zodError.
|
|
1
|
+
{"version":3,"file":"zod.js","sources":["../src/zod.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { ValidationError } from './errors';\n\nexport const validateZod =\n <T extends z.ZodTypeAny>(schema: T) =>\n (data: unknown): z.TypeOf<T> => {\n try {\n return schema.parse(data);\n } catch (error) {\n if (error instanceof z.ZodError) {\n const { message, errors } = formatZodErrors(error);\n throw new ValidationError(message, { errors });\n }\n\n throw error;\n }\n };\n\nconst formatZodErrors = (zodError: z.ZodError) => ({\n errors: zodError.issues.map((issue) => {\n return {\n path: issue.path,\n message: issue.message,\n name: 'ValidationError',\n };\n }),\n message: 'Validation error',\n});\n"],"names":["validateZod","schema","data","parse","error","z","ZodError","message","errors","formatZodErrors","ValidationError","zodError","issues","map","issue","path","name"],"mappings":";;;;;AAIaA,MAAAA,WAAAA,GACX,CAAyBC,MAAAA,GACzB,CAACC,IAAAA,GAAAA;QACC,IAAI;YACF,OAAOD,MAAAA,CAAOE,KAAK,CAACD,IAAAA,CAAAA;AACtB,SAAA,CAAE,OAAOE,KAAO,EAAA;YACd,IAAIA,KAAAA,YAAiBC,KAAEC,CAAAA,QAAQ,EAAE;AAC/B,gBAAA,MAAM,EAAEC,OAAO,UAAEC,QAAM,EAAE,GAAGC,eAAgBL,CAAAA,KAAAA,CAAAA;gBAC5C,MAAM,IAAIM,uBAAgBH,OAAS,EAAA;AAAEC,4BAAAA;AAAO,iBAAA,CAAA;AAC9C;YAEA,MAAMJ,KAAAA;AACR;;AAGJ,MAAMK,eAAAA,GAAkB,CAACE,QAAAA,IAA0B;AACjDH,QAAAA,MAAAA,EAAQG,QAASC,CAAAA,MAAM,CAACC,GAAG,CAAC,CAACC,KAAAA,GAAAA;YAC3B,OAAO;AACLC,gBAAAA,IAAAA,EAAMD,MAAMC,IAAI;AAChBR,gBAAAA,OAAAA,EAASO,MAAMP,OAAO;gBACtBS,IAAM,EAAA;AACR,aAAA;AACF,SAAA,CAAA;QACAT,OAAS,EAAA;KACX,CAAA;;;;"}
|
package/dist/zod.mjs
CHANGED
|
@@ -15,11 +15,11 @@ const validateZod = (schema)=>(data)=>{
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
const formatZodErrors = (zodError)=>({
|
|
18
|
-
errors: zodError.
|
|
18
|
+
errors: zodError.issues.map((issue)=>{
|
|
19
19
|
return {
|
|
20
20
|
path: issue.path,
|
|
21
21
|
message: issue.message,
|
|
22
|
-
name:
|
|
22
|
+
name: 'ValidationError'
|
|
23
23
|
};
|
|
24
24
|
}),
|
|
25
25
|
message: 'Validation error'
|
package/dist/zod.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.mjs","sources":["../src/zod.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { ValidationError } from './errors';\n\nexport const validateZod =\n <T extends z.ZodTypeAny>(schema: T) =>\n (data: unknown): z.TypeOf<T> => {\n try {\n return schema.parse(data);\n } catch (error) {\n if (error instanceof z.ZodError) {\n const { message, errors } = formatZodErrors(error);\n throw new ValidationError(message, { errors });\n }\n\n throw error;\n }\n };\n\nconst formatZodErrors = (zodError: z.ZodError) => ({\n errors: zodError.
|
|
1
|
+
{"version":3,"file":"zod.mjs","sources":["../src/zod.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { ValidationError } from './errors';\n\nexport const validateZod =\n <T extends z.ZodTypeAny>(schema: T) =>\n (data: unknown): z.TypeOf<T> => {\n try {\n return schema.parse(data);\n } catch (error) {\n if (error instanceof z.ZodError) {\n const { message, errors } = formatZodErrors(error);\n throw new ValidationError(message, { errors });\n }\n\n throw error;\n }\n };\n\nconst formatZodErrors = (zodError: z.ZodError) => ({\n errors: zodError.issues.map((issue) => {\n return {\n path: issue.path,\n message: issue.message,\n name: 'ValidationError',\n };\n }),\n message: 'Validation error',\n});\n"],"names":["validateZod","schema","data","parse","error","z","ZodError","message","errors","formatZodErrors","ValidationError","zodError","issues","map","issue","path","name"],"mappings":";;;AAIaA,MAAAA,WAAAA,GACX,CAAyBC,MAAAA,GACzB,CAACC,IAAAA,GAAAA;QACC,IAAI;YACF,OAAOD,MAAAA,CAAOE,KAAK,CAACD,IAAAA,CAAAA;AACtB,SAAA,CAAE,OAAOE,KAAO,EAAA;YACd,IAAIA,KAAAA,YAAiBC,CAAEC,CAAAA,QAAQ,EAAE;AAC/B,gBAAA,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGC,eAAgBL,CAAAA,KAAAA,CAAAA;gBAC5C,MAAM,IAAIM,gBAAgBH,OAAS,EAAA;AAAEC,oBAAAA;AAAO,iBAAA,CAAA;AAC9C;YAEA,MAAMJ,KAAAA;AACR;;AAGJ,MAAMK,eAAAA,GAAkB,CAACE,QAAAA,IAA0B;AACjDH,QAAAA,MAAAA,EAAQG,QAASC,CAAAA,MAAM,CAACC,GAAG,CAAC,CAACC,KAAAA,GAAAA;YAC3B,OAAO;AACLC,gBAAAA,IAAAA,EAAMD,MAAMC,IAAI;AAChBR,gBAAAA,OAAAA,EAASO,MAAMP,OAAO;gBACtBS,IAAM,EAAA;AACR,aAAA;AACF,SAAA,CAAA;QACAT,OAAS,EAAA;KACX,CAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/utils",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.21.0",
|
|
4
4
|
"description": "Shared utilities for the Strapi packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -55,16 +55,16 @@
|
|
|
55
55
|
"p-map": "4.0.0",
|
|
56
56
|
"preferred-pm": "3.1.2",
|
|
57
57
|
"yup": "0.32.9",
|
|
58
|
-
"zod": "3.
|
|
58
|
+
"zod": "3.25.67"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/http-errors": "2.0.4",
|
|
62
62
|
"@types/koa": "2.13.4",
|
|
63
63
|
"@types/node": "18.19.24",
|
|
64
|
-
"eslint-config-custom": "5.
|
|
64
|
+
"eslint-config-custom": "5.21.0",
|
|
65
65
|
"koa": "2.16.1",
|
|
66
66
|
"koa-body": "6.0.1",
|
|
67
|
-
"tsconfig": "5.
|
|
67
|
+
"tsconfig": "5.21.0"
|
|
68
68
|
},
|
|
69
69
|
"engines": {
|
|
70
70
|
"node": ">=18.0.0 <=22.x.x",
|