@orval/mock 7.14.0 → 8.0.0-rc.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/index.js +60 -95
- package/dist/index.js.map +1 -1
- package/package.json +11 -9
package/dist/index.js
CHANGED
|
@@ -1,29 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
let __orval_core = require("@orval/core");
|
|
25
|
-
__orval_core = __toESM(__orval_core);
|
|
26
|
-
require("openapi3-ts/oas30");
|
|
1
|
+
import { EnumGeneration, PropertySortOrder, camel, compareVersions, escape, generalJSTypesWithArray, generateDependencyImports, getKey, getRefInfo, isBoolean, isFunction, isObject, isReference, isRootKey, isSchema, mergeDeep, pascal, resolveRef, sanitize, stringify } from "@orval/core";
|
|
27
2
|
|
|
28
3
|
//#region src/delay.ts
|
|
29
4
|
const getDelay = (override, options) => {
|
|
@@ -33,7 +8,7 @@ const getDelay = (override, options) => {
|
|
|
33
8
|
case "function": return delayFunctionLazyExecute ? overrideDelay : overrideDelay();
|
|
34
9
|
case "number":
|
|
35
10
|
case "boolean": return overrideDelay;
|
|
36
|
-
default: return
|
|
11
|
+
default: return false;
|
|
37
12
|
}
|
|
38
13
|
};
|
|
39
14
|
|
|
@@ -46,7 +21,7 @@ const isFakerVersionV9 = (packageJson) => {
|
|
|
46
21
|
const version = getFakerPackageVersion(packageJson);
|
|
47
22
|
if (!version) return false;
|
|
48
23
|
const withoutRc = version.split("-")[0];
|
|
49
|
-
return
|
|
24
|
+
return compareVersions(withoutRc, "9.0.0");
|
|
50
25
|
};
|
|
51
26
|
|
|
52
27
|
//#endregion
|
|
@@ -81,7 +56,7 @@ const DEFAULT_OBJECT_KEY_MOCK = "faker.string.alphanumeric(5)";
|
|
|
81
56
|
//#region src/faker/getters/object.ts
|
|
82
57
|
const overrideVarName = "overrideResponse";
|
|
83
58
|
const getMockObject = ({ item, mockOptions, operationId, tags, combine, context, imports, existingReferencedProperties, splitMockImplementations, allowOverride = false }) => {
|
|
84
|
-
if (
|
|
59
|
+
if (isReference(item)) return resolveMockValue({
|
|
85
60
|
schema: {
|
|
86
61
|
...item,
|
|
87
62
|
name: item.name,
|
|
@@ -95,21 +70,18 @@ const getMockObject = ({ item, mockOptions, operationId, tags, combine, context,
|
|
|
95
70
|
existingReferencedProperties,
|
|
96
71
|
splitMockImplementations
|
|
97
72
|
});
|
|
98
|
-
if (item.allOf || item.oneOf || item.anyOf) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
splitMockImplementations
|
|
111
|
-
});
|
|
112
|
-
}
|
|
73
|
+
if (item.allOf || item.oneOf || item.anyOf) return combineSchemasMock({
|
|
74
|
+
item,
|
|
75
|
+
separator: item.allOf ? "allOf" : item.oneOf ? "oneOf" : "anyOf",
|
|
76
|
+
mockOptions,
|
|
77
|
+
operationId,
|
|
78
|
+
tags,
|
|
79
|
+
combine,
|
|
80
|
+
context,
|
|
81
|
+
imports,
|
|
82
|
+
existingReferencedProperties,
|
|
83
|
+
splitMockImplementations
|
|
84
|
+
});
|
|
113
85
|
if (Array.isArray(item.type)) return combineSchemasMock({
|
|
114
86
|
item: {
|
|
115
87
|
anyOf: item.type.map((type) => ({ type })),
|
|
@@ -130,13 +102,13 @@ const getMockObject = ({ item, mockOptions, operationId, tags, combine, context,
|
|
|
130
102
|
const imports$1 = [];
|
|
131
103
|
const includedProperties = [];
|
|
132
104
|
const entries = Object.entries(item.properties);
|
|
133
|
-
if (context.output.propertySortOrder ===
|
|
105
|
+
if (context.output.propertySortOrder === PropertySortOrder.ALPHABETICAL) entries.sort((a, b) => {
|
|
134
106
|
return a[0].localeCompare(b[0]);
|
|
135
107
|
});
|
|
136
108
|
const properyScalars = entries.map(([key, prop]) => {
|
|
137
109
|
if (combine?.includedProperties.includes(key)) return;
|
|
138
110
|
const isRequired = mockOptions?.required || (Array.isArray(item.required) ? item.required : []).includes(key);
|
|
139
|
-
if ("$ref" in prop && existingReferencedProperties.includes(
|
|
111
|
+
if ("$ref" in prop && existingReferencedProperties.includes(pascal(prop.$ref.split("/").pop()))) return;
|
|
140
112
|
const resolvedValue = resolveMockValue({
|
|
141
113
|
schema: {
|
|
142
114
|
...prop,
|
|
@@ -153,7 +125,7 @@ const getMockObject = ({ item, mockOptions, operationId, tags, combine, context,
|
|
|
153
125
|
});
|
|
154
126
|
imports$1.push(...resolvedValue.imports);
|
|
155
127
|
includedProperties.push(key);
|
|
156
|
-
const keyDefinition =
|
|
128
|
+
const keyDefinition = getKey(key);
|
|
157
129
|
if (!isRequired && !resolvedValue.overrided) return `${keyDefinition}: faker.helpers.arrayElement([${resolvedValue.value}, undefined])`;
|
|
158
130
|
return `${keyDefinition}: ${resolvedValue.value}`;
|
|
159
131
|
}).filter(Boolean);
|
|
@@ -168,12 +140,12 @@ const getMockObject = ({ item, mockOptions, operationId, tags, combine, context,
|
|
|
168
140
|
};
|
|
169
141
|
}
|
|
170
142
|
if (item.additionalProperties) {
|
|
171
|
-
if (
|
|
143
|
+
if (isBoolean(item.additionalProperties)) return {
|
|
172
144
|
value: `{}`,
|
|
173
145
|
imports: [],
|
|
174
146
|
name: item.name
|
|
175
147
|
};
|
|
176
|
-
if (
|
|
148
|
+
if (isReference(item.additionalProperties) && existingReferencedProperties.includes(item.additionalProperties.$ref.split("/").pop())) return {
|
|
177
149
|
value: `{}`,
|
|
178
150
|
imports: [],
|
|
179
151
|
name: item.name
|
|
@@ -212,10 +184,9 @@ const getMockScalar = ({ item, imports, mockOptions, operationId, tags, combine,
|
|
|
212
184
|
if (item.isRef) existingReferencedProperties = [...existingReferencedProperties, item.name];
|
|
213
185
|
const operationProperty = resolveMockOverride(mockOptions?.operations?.[operationId]?.properties, item);
|
|
214
186
|
if (operationProperty) return operationProperty;
|
|
215
|
-
const
|
|
187
|
+
const tagProperty = resolveMockOverride(Object.entries(mockOptions?.tags ?? {}).sort((a, b) => {
|
|
216
188
|
return a[0].localeCompare(b[0]);
|
|
217
|
-
}).reduce((acc, [tag, options]) => tags.includes(tag) ?
|
|
218
|
-
const tagProperty = resolveMockOverride(overrideTag?.properties, item);
|
|
189
|
+
}).reduce((acc, [tag, options]) => tags.includes(tag) ? mergeDeep(acc, options) : acc, {})?.properties, item);
|
|
219
190
|
if (tagProperty) return tagProperty;
|
|
220
191
|
const property = resolveMockOverride(mockOptions?.properties, item);
|
|
221
192
|
if (property) return property;
|
|
@@ -244,8 +215,7 @@ const getMockScalar = ({ item, imports, mockOptions, operationId, tags, combine,
|
|
|
244
215
|
switch (type) {
|
|
245
216
|
case "number":
|
|
246
217
|
case "integer": {
|
|
247
|
-
|
|
248
|
-
let value = getNullable(`faker.number.${intFunction}({min: ${item.minimum ?? mockOptions?.numberMin}, max: ${item.maximum ?? mockOptions?.numberMax}${isFakerV9 && item.multipleOf !== void 0 ? `, multipleOf: ${item.multipleOf}` : ""}})`, item.nullable);
|
|
218
|
+
let value = getNullable(`faker.number.${context.output.override.useBigInt && (item.format === "int64" || item.format === "uint64") ? "bigInt" : "int"}({min: ${item.minimum ?? mockOptions?.numberMin}, max: ${item.maximum ?? mockOptions?.numberMax}${isFakerV9 && item.multipleOf !== void 0 ? `, multipleOf: ${item.multipleOf}` : ""}})`, item.nullable);
|
|
249
219
|
if (type === "number") value = getNullable(`faker.number.float({min: ${item.minimum ?? mockOptions?.numberMin}, max: ${item.maximum ?? mockOptions?.numberMax}${isFakerV9 && item.multipleOf !== void 0 ? `, multipleOf: ${item.multipleOf}` : `, fractionDigits: ${mockOptions?.fractionDigits}`}})`, item.nullable);
|
|
250
220
|
const numberImports = [];
|
|
251
221
|
if (item.enum) value = getEnum(item, numberImports, context, existingReferencedProperties, "number");
|
|
@@ -272,7 +242,7 @@ const getMockScalar = ({ item, imports, mockOptions, operationId, tags, combine,
|
|
|
272
242
|
imports: [],
|
|
273
243
|
name: item.name
|
|
274
244
|
};
|
|
275
|
-
if ("$ref" in item.items && existingReferencedProperties.includes(
|
|
245
|
+
if ("$ref" in item.items && existingReferencedProperties.includes(pascal(item.items.$ref.split("/").pop()))) return {
|
|
276
246
|
value: "[]",
|
|
277
247
|
imports: [],
|
|
278
248
|
name: item.name
|
|
@@ -361,19 +331,19 @@ function getItemType(item) {
|
|
|
361
331
|
}
|
|
362
332
|
const getEnum = (item, imports, context, existingReferencedProperties, type) => {
|
|
363
333
|
if (!item.enum) return "";
|
|
364
|
-
let enumValue = `[${item.enum.filter((e) => e !== null).map((e) => type === "string" || type === void 0 && typeof e === "string" ? `'${
|
|
365
|
-
if (context.output.override.enumGenerationType ===
|
|
334
|
+
let enumValue = `[${item.enum.filter((e) => e !== null).map((e) => type === "string" || type === void 0 && typeof e === "string" ? `'${escape(e)}'` : e).join(",")}]`;
|
|
335
|
+
if (context.output.override.enumGenerationType === EnumGeneration.ENUM) if (item.isRef || existingReferencedProperties.length === 0) {
|
|
366
336
|
enumValue += ` as ${item.name}${item.name.endsWith("[]") ? "" : "[]"}`;
|
|
367
337
|
imports.push({
|
|
368
338
|
name: item.name,
|
|
369
|
-
...
|
|
339
|
+
...isRootKey(context.specKey, context.target) ? {} : { specKey: context.specKey }
|
|
370
340
|
});
|
|
371
341
|
} else {
|
|
372
342
|
enumValue += ` as ${existingReferencedProperties[existingReferencedProperties.length - 1]}['${item.name}']`;
|
|
373
343
|
if (!item.path?.endsWith("[]")) enumValue += "[]";
|
|
374
344
|
imports.push({
|
|
375
345
|
name: existingReferencedProperties[existingReferencedProperties.length - 1],
|
|
376
|
-
...
|
|
346
|
+
...isRootKey(context.specKey, context.target) ? {} : { specKey: context.specKey }
|
|
377
347
|
});
|
|
378
348
|
}
|
|
379
349
|
else enumValue += " as const";
|
|
@@ -382,7 +352,7 @@ const getEnum = (item, imports, context, existingReferencedProperties, type) =>
|
|
|
382
352
|
imports.push({
|
|
383
353
|
name: item.name,
|
|
384
354
|
values: true,
|
|
385
|
-
...
|
|
355
|
+
...isRootKey(context.specKey, context.target) ? {} : { specKey: context.specKey }
|
|
386
356
|
});
|
|
387
357
|
}
|
|
388
358
|
return item.path?.endsWith("[]") ? `faker.helpers.arrayElements(${enumValue})` : `faker.helpers.arrayElement(${enumValue})`;
|
|
@@ -411,12 +381,12 @@ const resolveMockOverride = (properties = {}, item) => {
|
|
|
411
381
|
};
|
|
412
382
|
const getNullable = (value, nullable) => nullable ? `faker.helpers.arrayElement([${value}, null])` : value;
|
|
413
383
|
const resolveMockValue = ({ schema, mockOptions, operationId, tags, combine, context, imports, existingReferencedProperties, splitMockImplementations, allowOverride }) => {
|
|
414
|
-
if (
|
|
415
|
-
const { originalName, specKey = context.specKey, refPaths } =
|
|
384
|
+
if (isReference(schema)) {
|
|
385
|
+
const { originalName, specKey = context.specKey, refPaths } = getRefInfo(schema.$ref, context);
|
|
416
386
|
const schemaRef = Array.isArray(refPaths) ? refPaths.reduce((obj, key) => obj && typeof obj === "object" ? obj[key] : void 0, context.specs[specKey]) : void 0;
|
|
417
387
|
const newSchema = {
|
|
418
388
|
...schemaRef,
|
|
419
|
-
name:
|
|
389
|
+
name: pascal(originalName),
|
|
420
390
|
path: schema.path,
|
|
421
391
|
isRef: true,
|
|
422
392
|
required: [...schemaRef?.required ?? [], ...schema?.required ?? []]
|
|
@@ -441,19 +411,18 @@ const resolveMockValue = ({ schema, mockOptions, operationId, tags, combine, con
|
|
|
441
411
|
allowOverride
|
|
442
412
|
});
|
|
443
413
|
if (scalar.value && (newSchema.type === "object" || newSchema.allOf) && combine?.separator === "oneOf") {
|
|
444
|
-
const funcName = `get${
|
|
414
|
+
const funcName = `get${pascal(operationId)}Response${pascal(newSchema.name)}Mock`;
|
|
445
415
|
if (!splitMockImplementations?.some((f) => f.includes(`export const ${funcName}`))) {
|
|
446
416
|
const discriminatedProperty = newSchema.discriminator?.propertyName;
|
|
447
417
|
let type = `Partial<${newSchema.name}>`;
|
|
448
418
|
if (discriminatedProperty) type = `Omit<${type}, '${discriminatedProperty}'>`;
|
|
449
|
-
const
|
|
450
|
-
const func = `export const ${funcName} = (${args}): ${newSchema.name} => ({${scalar.value.startsWith("...") ? "" : "..."}${scalar.value}, ...${overrideVarName}});`;
|
|
419
|
+
const func = `export const ${funcName} = (${`${overrideVarName}: ${type} = {}`}): ${newSchema.name} => ({${scalar.value.startsWith("...") ? "" : "..."}${scalar.value}, ...${overrideVarName}});`;
|
|
451
420
|
splitMockImplementations?.push(func);
|
|
452
421
|
}
|
|
453
422
|
scalar.value = newSchema.nullable ? `${funcName}()` : `{...${funcName}()}`;
|
|
454
423
|
scalar.imports.push({
|
|
455
424
|
name: newSchema.name,
|
|
456
|
-
specKey:
|
|
425
|
+
specKey: isRootKey(specKey, context.target) ? void 0 : specKey
|
|
457
426
|
});
|
|
458
427
|
}
|
|
459
428
|
return {
|
|
@@ -486,7 +455,7 @@ const getType = (schema) => {
|
|
|
486
455
|
const combineSchemasMock = ({ item, separator, mockOptions, operationId, tags, combine, context, imports, existingReferencedProperties, splitMockImplementations }) => {
|
|
487
456
|
const combineImports = [];
|
|
488
457
|
const includedProperties = [...combine?.includedProperties ?? []];
|
|
489
|
-
const itemResolvedValue =
|
|
458
|
+
const itemResolvedValue = isReference(item) && !existingReferencedProperties.includes(item.name) || item.properties ? resolveMockValue({
|
|
490
459
|
schema: Object.fromEntries(Object.entries(item).filter(([key]) => key !== separator)),
|
|
491
460
|
combine: {
|
|
492
461
|
separator: "allOf",
|
|
@@ -504,11 +473,11 @@ const combineSchemasMock = ({ item, separator, mockOptions, operationId, tags, c
|
|
|
504
473
|
combineImports.push(...itemResolvedValue?.imports ?? []);
|
|
505
474
|
let containsOnlyPrimitiveValues = true;
|
|
506
475
|
const value = (item[separator] ?? []).reduce((acc, val, _, arr) => {
|
|
507
|
-
if ("$ref" in val && existingReferencedProperties.includes(
|
|
476
|
+
if ("$ref" in val && existingReferencedProperties.includes(pascal(val.$ref.split("/").pop()))) {
|
|
508
477
|
if (arr.length === 1) return "undefined";
|
|
509
478
|
return acc;
|
|
510
479
|
}
|
|
511
|
-
if (separator === "allOf" && item.required) val =
|
|
480
|
+
if (separator === "allOf" && item.required) val = isSchema(val) && val.required ? {
|
|
512
481
|
...val,
|
|
513
482
|
required: [...item.required, ...val.required]
|
|
514
483
|
} : {
|
|
@@ -568,7 +537,7 @@ const getRoutePath = (path) => {
|
|
|
568
537
|
const matches = /([^{]*){?([\w*_-]*)}?(.*)/.exec(path);
|
|
569
538
|
if (!matches?.length) return path;
|
|
570
539
|
const prev = matches[1];
|
|
571
|
-
const param =
|
|
540
|
+
const param = sanitize(camel(matches[2]), {
|
|
572
541
|
es5keyword: true,
|
|
573
542
|
underscore: true,
|
|
574
543
|
dash: true,
|
|
@@ -588,8 +557,8 @@ const getRouteMSW = (route, baseUrl = "*") => {
|
|
|
588
557
|
|
|
589
558
|
//#endregion
|
|
590
559
|
//#region src/msw/mocks.ts
|
|
591
|
-
const getMockPropertiesWithoutFunc = (properties, spec) => Object.entries(
|
|
592
|
-
acc[key] = (
|
|
560
|
+
const getMockPropertiesWithoutFunc = (properties, spec) => Object.entries(isFunction(properties) ? properties(spec) : properties).reduce((acc, [key, value]) => {
|
|
561
|
+
acc[key] = (isFunction(value) ? `(${value})()` : stringify(value))?.replaceAll(/import_faker.defaults|import_faker.faker/g, "faker");
|
|
593
562
|
return acc;
|
|
594
563
|
}, {});
|
|
595
564
|
const getMockWithoutFunc = (spec, override) => ({
|
|
@@ -630,17 +599,16 @@ const getResponsesMockDefinition = ({ operationId, tags, returnType, responses,
|
|
|
630
599
|
return acc;
|
|
631
600
|
}
|
|
632
601
|
}
|
|
633
|
-
if (!definition ||
|
|
602
|
+
if (!definition || generalJSTypesWithArray.includes(definition)) {
|
|
634
603
|
const value = getMockScalarJsTypes(definition, mockOptionsWithoutFunc);
|
|
635
604
|
acc.definitions.push(transformer ? transformer(value, returnType) : value);
|
|
636
605
|
return acc;
|
|
637
606
|
}
|
|
638
607
|
if (!originalSchema) return acc;
|
|
639
|
-
const resolvedRef = (0, __orval_core.resolveRef)(originalSchema, context);
|
|
640
608
|
const scalar = getMockScalar({
|
|
641
609
|
item: {
|
|
642
610
|
name: definition,
|
|
643
|
-
...
|
|
611
|
+
...resolveRef(originalSchema, context).schema
|
|
644
612
|
},
|
|
645
613
|
imports,
|
|
646
614
|
mockOptions: mockOptionsWithoutFunc,
|
|
@@ -663,14 +631,13 @@ const getResponsesMockDefinition = ({ operationId, tags, returnType, responses,
|
|
|
663
631
|
});
|
|
664
632
|
};
|
|
665
633
|
const getMockDefinition = ({ operationId, tags, returnType, responses, imports: responseImports, override, transformer, context, mockOptions, splitMockImplementations }) => {
|
|
666
|
-
const mockOptionsWithoutFunc = getMockWithoutFunc(context.specs[context.specKey], override);
|
|
667
634
|
const { definitions, imports } = getResponsesMockDefinition({
|
|
668
635
|
operationId,
|
|
669
636
|
tags,
|
|
670
637
|
returnType,
|
|
671
638
|
responses,
|
|
672
639
|
imports: responseImports,
|
|
673
|
-
mockOptionsWithoutFunc,
|
|
640
|
+
mockOptionsWithoutFunc: getMockWithoutFunc(context.specs[context.specKey], override),
|
|
674
641
|
transformer,
|
|
675
642
|
context,
|
|
676
643
|
mockOptions,
|
|
@@ -684,7 +651,7 @@ const getMockDefinition = ({ operationId, tags, returnType, responses, imports:
|
|
|
684
651
|
};
|
|
685
652
|
const getMockOptionsDataOverride = (operationTags, operationId, override) => {
|
|
686
653
|
const responseOverride = override?.operations?.[operationId]?.mock?.data || operationTags.map((operationTag) => override?.tags?.[operationTag]?.mock?.data).find((e) => e !== void 0);
|
|
687
|
-
return (
|
|
654
|
+
return (isFunction(responseOverride) ? `(${responseOverride})()` : stringify(responseOverride))?.replaceAll(/import_faker.defaults|import_faker.faker/g, "faker");
|
|
688
655
|
};
|
|
689
656
|
|
|
690
657
|
//#endregion
|
|
@@ -692,7 +659,7 @@ const getMockOptionsDataOverride = (operationTags, operationId, override) => {
|
|
|
692
659
|
const getMSWDependencies = (options) => {
|
|
693
660
|
const hasDelay = options?.delay !== false;
|
|
694
661
|
const locale = options?.locale;
|
|
695
|
-
const exports
|
|
662
|
+
const exports = [
|
|
696
663
|
{
|
|
697
664
|
name: "http",
|
|
698
665
|
values: true
|
|
@@ -706,12 +673,12 @@ const getMSWDependencies = (options) => {
|
|
|
706
673
|
values: false
|
|
707
674
|
}
|
|
708
675
|
];
|
|
709
|
-
if (hasDelay) exports
|
|
676
|
+
if (hasDelay) exports.push({
|
|
710
677
|
name: "delay",
|
|
711
678
|
values: true
|
|
712
679
|
});
|
|
713
680
|
return [{
|
|
714
|
-
exports
|
|
681
|
+
exports,
|
|
715
682
|
dependency: "msw"
|
|
716
683
|
}, {
|
|
717
684
|
exports: [{
|
|
@@ -722,7 +689,7 @@ const getMSWDependencies = (options) => {
|
|
|
722
689
|
}];
|
|
723
690
|
};
|
|
724
691
|
const generateMSWImports = ({ implementation, imports, specsName, hasSchemaDir, isAllowSyntheticDefaultImports, options }) => {
|
|
725
|
-
return
|
|
692
|
+
return generateDependencyImports(implementation, [...getMSWDependencies(options), ...imports], specsName, hasSchemaDir, isAllowSyntheticDefaultImports);
|
|
726
693
|
};
|
|
727
694
|
const generateDefinition = (name, route, getResponseMockFunctionNameBase, handlerNameBase, { operationId, response, verb, tags }, { override, context, mock }, returnType, status, responseImports, responses, contentTypes, splitMockImplementations) => {
|
|
728
695
|
const oldSplitMockImplementations = [...splitMockImplementations];
|
|
@@ -734,7 +701,7 @@ const generateDefinition = (name, route, getResponseMockFunctionNameBase, handle
|
|
|
734
701
|
imports: responseImports,
|
|
735
702
|
override,
|
|
736
703
|
context,
|
|
737
|
-
mockOptions:
|
|
704
|
+
mockOptions: isFunction(mock) ? void 0 : mock,
|
|
738
705
|
splitMockImplementations
|
|
739
706
|
});
|
|
740
707
|
const mockData = getMockOptionsDataOverride(tags, operationId, override);
|
|
@@ -745,20 +712,20 @@ const generateDefinition = (name, route, getResponseMockFunctionNameBase, handle
|
|
|
745
712
|
const isResponseOverridable = value.includes(overrideVarName);
|
|
746
713
|
const isTextPlain = contentTypes.includes("text/plain");
|
|
747
714
|
const isReturnHttpResponse = value && value !== "undefined";
|
|
748
|
-
const getResponseMockFunctionName = `${getResponseMockFunctionNameBase}${
|
|
749
|
-
const handlerName = `${handlerNameBase}${
|
|
715
|
+
const getResponseMockFunctionName = `${getResponseMockFunctionNameBase}${pascal(name)}`;
|
|
716
|
+
const handlerName = `${handlerNameBase}${pascal(name)}`;
|
|
750
717
|
const addedSplitMockImplementations = splitMockImplementations.slice(oldSplitMockImplementations.length);
|
|
751
718
|
splitMockImplementations.push(...addedSplitMockImplementations);
|
|
752
719
|
const mockImplementations = addedSplitMockImplementations.length > 0 ? `${addedSplitMockImplementations.join("\n\n")}\n\n` : "";
|
|
753
720
|
const mockImplementation = isReturnHttpResponse ? `${mockImplementations}export const ${getResponseMockFunctionName} = (${isResponseOverridable ? `overrideResponse: Partial< ${returnType} > = {}` : ""})${mockData ? "" : `: ${returnType}`} => (${value})\n\n` : mockImplementations;
|
|
754
|
-
const delay = getDelay(override,
|
|
721
|
+
const delay = getDelay(override, isFunction(mock) ? void 0 : mock);
|
|
755
722
|
const infoParam = "info";
|
|
756
723
|
const overrideResponse = `overrideResponse !== undefined
|
|
757
724
|
? (typeof overrideResponse === "function" ? await overrideResponse(${infoParam}) : overrideResponse)
|
|
758
725
|
: ${getResponseMockFunctionName}()`;
|
|
759
726
|
const handlerImplementation = `
|
|
760
727
|
export const ${handlerName} = (overrideResponse?: ${returnType} | ((${infoParam}: Parameters<Parameters<typeof http.${verb}>[1]>[0]) => Promise<${returnType}> | ${returnType}), options?: RequestHandlerOptions) => {
|
|
761
|
-
return http.${verb}('${route}', async (${infoParam}) => {${delay === false ? "" : `await delay(${
|
|
728
|
+
return http.${verb}('${route}', async (${infoParam}) => {${delay === false ? "" : `await delay(${isFunction(delay) ? `(${delay})()` : delay});`}
|
|
762
729
|
${isReturnHttpResponse ? "" : `if (typeof overrideResponse === 'function') {await overrideResponse(info); }`}
|
|
763
730
|
return new HttpResponse(${isReturnHttpResponse ? isTextPlain ? overrideResponse : `JSON.stringify(${overrideResponse})` : null},
|
|
764
731
|
{ status: ${status === "default" ? 200 : status.replace(/XX$/, "00")},
|
|
@@ -782,15 +749,15 @@ export const ${handlerName} = (overrideResponse?: ${returnType} | ((${infoParam}
|
|
|
782
749
|
const generateMSW = (generatorVerbOptions, generatorOptions) => {
|
|
783
750
|
const { pathRoute, override, mock } = generatorOptions;
|
|
784
751
|
const { operationId, response } = generatorVerbOptions;
|
|
785
|
-
const route = getRouteMSW(pathRoute, override?.mock?.baseUrl ?? (
|
|
786
|
-
const handlerName = `get${
|
|
787
|
-
const getResponseMockFunctionName = `get${
|
|
752
|
+
const route = getRouteMSW(pathRoute, override?.mock?.baseUrl ?? (isFunction(mock) ? void 0 : mock?.baseUrl));
|
|
753
|
+
const handlerName = `get${pascal(operationId)}MockHandler`;
|
|
754
|
+
const getResponseMockFunctionName = `get${pascal(operationId)}ResponseMock`;
|
|
788
755
|
const splitMockImplementations = [];
|
|
789
756
|
const baseDefinition = generateDefinition("", route, getResponseMockFunctionName, handlerName, generatorVerbOptions, generatorOptions, response.definition.success, response.types.success[0]?.key ?? "200", response.imports, response.types.success, response.contentTypes, splitMockImplementations);
|
|
790
757
|
const mockImplementations = [baseDefinition.implementation.function];
|
|
791
758
|
const handlerImplementations = [baseDefinition.implementation.handler];
|
|
792
759
|
const imports = [...baseDefinition.imports];
|
|
793
|
-
if (generatorOptions.mock &&
|
|
760
|
+
if (generatorOptions.mock && isObject(generatorOptions.mock) && generatorOptions.mock.generateEachHttpStatus) for (const statusResponse of [...response.types.success, ...response.types.errors]) {
|
|
794
761
|
const definition = generateDefinition(statusResponse.key, route, getResponseMockFunctionName, handlerName, generatorVerbOptions, generatorOptions, statusResponse.value, statusResponse.key, response.imports, [statusResponse], [statusResponse.contentType], splitMockImplementations);
|
|
795
762
|
mockImplementations.push(definition.implementation.function);
|
|
796
763
|
handlerImplementations.push(definition.implementation.handler);
|
|
@@ -824,7 +791,5 @@ const generateMock = (generatorVerbOptions, generatorOptions) => {
|
|
|
824
791
|
};
|
|
825
792
|
|
|
826
793
|
//#endregion
|
|
827
|
-
|
|
828
|
-
exports.generateMock = generateMock;
|
|
829
|
-
exports.generateMockImports = generateMockImports;
|
|
794
|
+
export { DEFAULT_MOCK_OPTIONS, generateMock, generateMockImports };
|
|
830
795
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DEFAULT_FORMAT_MOCK: Record<\n Required<SchemaObject>['format'],\n string\n>","imports: GeneratorImport[]","includedProperties: string[]","PropertySortOrder","numberImports: GeneratorImport[]","stringImports: GeneratorImport[]","enumImports: GeneratorImport[]","EnumGeneration","combineImports: GeneratorImport[]","includedProperties: string[]","generalJSTypesWithArray","exports","generateMSWImports: GenerateMockImports","splitMockImplementations: string[]","DEFAULT_MOCK_OPTIONS: GlobalMockOptions","generateMockImports: GenerateMockImports"],"sources":["../src/delay.ts","../src/faker/compatibleV9.ts","../src/faker/constants.ts","../src/faker/getters/object.ts","../src/faker/getters/scalar.ts","../src/faker/resolvers/value.ts","../src/faker/getters/combine.ts","../src/faker/getters/route.ts","../src/msw/mocks.ts","../src/msw/index.ts","../src/index.ts"],"sourcesContent":["import { GlobalMockOptions, NormalizedOverrideOutput } from '@orval/core';\n\nexport const getDelay = (\n override?: NormalizedOverrideOutput,\n options?: GlobalMockOptions,\n): GlobalMockOptions['delay'] => {\n const overrideDelay =\n override?.mock?.delay === undefined\n ? options?.delay\n : override?.mock?.delay;\n const delayFunctionLazyExecute =\n override?.mock?.delayFunctionLazyExecute ??\n options?.delayFunctionLazyExecute;\n switch (typeof overrideDelay) {\n case 'function': {\n return delayFunctionLazyExecute ? overrideDelay : overrideDelay();\n }\n case 'number':\n case 'boolean': {\n return overrideDelay;\n }\n default: {\n return 1000;\n }\n }\n};\n","import { compareVersions, PackageJson } from '@orval/core';\n\nconst getFakerPackageVersion = (packageJson: PackageJson) => {\n return (\n packageJson.dependencies?.['@faker-js/faker'] ??\n packageJson.devDependencies?.['@faker-js/faker'] ??\n packageJson.peerDependencies?.['@faker-js/faker']\n );\n};\n\nexport const isFakerVersionV9 = (packageJson: PackageJson) => {\n const version = getFakerPackageVersion(packageJson);\n\n if (!version) {\n return false;\n }\n\n const withoutRc = version.split('-')[0];\n\n return compareVersions(withoutRc, '9.0.0');\n};\n","import { SchemaObject } from 'openapi3-ts/oas30';\n\nexport const DEFAULT_FORMAT_MOCK: Record<\n Required<SchemaObject>['format'],\n string\n> = {\n bic: 'faker.finance.bic()',\n binary:\n \"new Blob(faker.helpers.arrayElements(faker.word.words(10).split(' ')))\",\n city: 'faker.location.city()',\n country: 'faker.location.country()',\n date: \"faker.date.past().toISOString().split('T')[0]\",\n 'date-time': \"`${faker.date.past().toISOString().split('.')[0]}Z`\",\n email: 'faker.internet.email()',\n firstName: 'faker.person.firstName()',\n gender: 'faker.person.gender()',\n iban: 'faker.finance.iban()',\n ipv4: 'faker.internet.ipv4()',\n ipv6: 'faker.internet.ipv6()',\n jobTitle: 'faker.person.jobTitle()',\n lastName: 'faker.person.lastName()',\n password: 'faker.internet.password()',\n phoneNumber: 'faker.phone.number()',\n streetName: 'faker.location.street()',\n uri: 'faker.internet.url()',\n url: 'faker.internet.url()',\n userName: 'faker.internet.userName()',\n uuid: 'faker.string.uuid()',\n zipCode: 'faker.location.zipCode()',\n};\n\n// #980 replace CUID so tests are consistent\nexport const DEFAULT_OBJECT_KEY_MOCK = 'faker.string.alphanumeric(5)';\n","import {\n type ContextSpecs,\n type GeneratorImport,\n getKey,\n isBoolean,\n isReference,\n type MockOptions,\n pascal,\n PropertySortOrder,\n} from '@orval/core';\nimport type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30';\n\nimport type { MockDefinition, MockSchemaObject } from '../../types';\nimport { DEFAULT_OBJECT_KEY_MOCK } from '../constants';\nimport { resolveMockValue } from '../resolvers/value';\nimport { combineSchemasMock } from './combine';\n\nexport const overrideVarName = 'overrideResponse';\n\nexport const getMockObject = ({\n item,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n allowOverride = false,\n}: {\n item: MockSchemaObject;\n operationId: string;\n mockOptions?: MockOptions;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpecs;\n imports: GeneratorImport[];\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n splitMockImplementations: string[];\n // This is used to add the overrideResponse to the object\n allowOverride?: boolean;\n}): MockDefinition => {\n if (isReference(item)) {\n return resolveMockValue({\n schema: {\n ...item,\n name: item.name,\n path: item.path ? `${item.path}.${item.name}` : item.name,\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n }\n\n if (item.allOf || item.oneOf || item.anyOf) {\n const separator = item.allOf ? 'allOf' : item.oneOf ? 'oneOf' : 'anyOf';\n return combineSchemasMock({\n item,\n separator,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n }\n\n if (Array.isArray(item.type)) {\n return combineSchemasMock({\n item: {\n anyOf: item.type.map((type) => ({ type })),\n name: item.name,\n },\n separator: 'anyOf',\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n }\n\n if (item.properties) {\n let value =\n !combine ||\n combine?.separator === 'oneOf' ||\n combine?.separator === 'anyOf'\n ? '{'\n : '';\n const imports: GeneratorImport[] = [];\n const includedProperties: string[] = [];\n\n const entries = Object.entries(item.properties);\n if (context.output.propertySortOrder === PropertySortOrder.ALPHABETICAL) {\n entries.sort((a, b) => {\n return a[0].localeCompare(b[0]);\n });\n }\n const properyScalars = entries\n .map(([key, prop]: [string, ReferenceObject | SchemaObject]) => {\n if (combine?.includedProperties.includes(key)) {\n return;\n }\n\n const isRequired =\n mockOptions?.required ||\n (Array.isArray(item.required) ? item.required : []).includes(key);\n\n // Check to see if the property is a reference to an existing property\n // Fixes issue #910\n if (\n '$ref' in prop &&\n existingReferencedProperties.includes(\n pascal(prop.$ref.split('/').pop()!),\n )\n ) {\n return;\n }\n\n const resolvedValue = resolveMockValue({\n schema: {\n ...prop,\n name: key,\n path: item.path ? `${item.path}.${key}` : `#.${key}`,\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n\n imports.push(...resolvedValue.imports);\n includedProperties.push(key);\n\n const keyDefinition = getKey(key);\n if (!isRequired && !resolvedValue.overrided) {\n return `${keyDefinition}: faker.helpers.arrayElement([${resolvedValue.value}, undefined])`;\n }\n\n return `${keyDefinition}: ${resolvedValue.value}`;\n })\n .filter(Boolean);\n\n if (allowOverride) {\n properyScalars.push(`...${overrideVarName}`);\n }\n\n value += properyScalars.join(', ');\n value +=\n !combine ||\n combine?.separator === 'oneOf' ||\n combine?.separator === 'anyOf'\n ? '}'\n : '';\n\n return {\n value,\n imports,\n name: item.name,\n includedProperties,\n };\n }\n\n if (item.additionalProperties) {\n if (isBoolean(item.additionalProperties)) {\n return { value: `{}`, imports: [], name: item.name };\n }\n if (\n isReference(item.additionalProperties) &&\n existingReferencedProperties.includes(\n item.additionalProperties.$ref.split('/').pop()!,\n )\n ) {\n return { value: `{}`, imports: [], name: item.name };\n }\n\n const resolvedValue = resolveMockValue({\n schema: {\n ...item.additionalProperties,\n name: item.name,\n path: item.path ? `${item.path}.#` : '#',\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n\n return {\n ...resolvedValue,\n value: `{\n [${DEFAULT_OBJECT_KEY_MOCK}]: ${resolvedValue.value}\n }`,\n };\n }\n\n return { value: '{}', imports: [], name: item.name };\n};\n","import {\n type ContextSpecs,\n EnumGeneration,\n escape,\n type GeneratorImport,\n isReference,\n isRootKey,\n mergeDeep,\n type MockOptions,\n pascal,\n} from '@orval/core';\nimport type { SchemaObject as SchemaObject31 } from 'openapi3-ts/oas31';\n\nimport type { MockDefinition, MockSchemaObject } from '../../types';\nimport { isFakerVersionV9 } from '../compatibleV9';\nimport { DEFAULT_FORMAT_MOCK } from '../constants';\nimport {\n getNullable,\n resolveMockOverride,\n resolveMockValue,\n} from '../resolvers';\nimport { getMockObject } from './object';\n\nexport const getMockScalar = ({\n item,\n imports,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n existingReferencedProperties,\n splitMockImplementations,\n allowOverride = false,\n}: {\n item: MockSchemaObject;\n imports: GeneratorImport[];\n mockOptions?: MockOptions;\n operationId: string;\n isRef?: boolean;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpecs;\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n splitMockImplementations: string[];\n // This is used to add the overrideResponse to the object\n allowOverride?: boolean;\n}): MockDefinition => {\n // Add the property to the existing properties to validate on object recursion\n if (item.isRef) {\n existingReferencedProperties = [...existingReferencedProperties, item.name];\n }\n\n const operationProperty = resolveMockOverride(\n mockOptions?.operations?.[operationId]?.properties,\n item,\n );\n\n if (operationProperty) {\n return operationProperty;\n }\n\n const overrideTag = Object.entries(mockOptions?.tags ?? {})\n .sort((a, b) => {\n return a[0].localeCompare(b[0]);\n })\n .reduce(\n (acc, [tag, options]) =>\n tags.includes(tag) ? mergeDeep(acc, options) : acc,\n {} as { properties: Record<string, unknown> },\n );\n\n const tagProperty = resolveMockOverride(overrideTag?.properties, item);\n\n if (tagProperty) {\n return tagProperty;\n }\n\n const property = resolveMockOverride(mockOptions?.properties, item);\n\n if (property) {\n return property;\n }\n\n if (\n (context.output.override?.mock?.useExamples || mockOptions?.useExamples) &&\n item.example !== undefined\n ) {\n return {\n value: JSON.stringify(item.example),\n imports: [],\n name: item.name,\n overrided: true,\n };\n }\n\n const ALL_FORMAT = {\n ...DEFAULT_FORMAT_MOCK,\n ...mockOptions?.format,\n };\n\n if (item.format && ALL_FORMAT[item.format]) {\n let value = ALL_FORMAT[item.format] as string;\n\n const dateFormats = ['date', 'date-time'];\n if (dateFormats.includes(item.format) && context.output.override.useDates) {\n value = `new Date(${value})`;\n }\n\n return {\n value: getNullable(value, item.nullable),\n imports: [],\n name: item.name,\n overrided: false,\n };\n }\n\n const type = getItemType(item);\n const isFakerV9 =\n !!context.output.packageJson &&\n isFakerVersionV9(context.output.packageJson);\n\n switch (type) {\n case 'number':\n case 'integer': {\n const intFunction =\n context.output.override.useBigInt &&\n (item.format === 'int64' || item.format === 'uint64')\n ? 'bigInt'\n : 'int';\n let value = getNullable(\n `faker.number.${intFunction}({min: ${item.minimum ?? mockOptions?.numberMin}, max: ${item.maximum ?? mockOptions?.numberMax}${isFakerV9 && item.multipleOf !== undefined ? `, multipleOf: ${item.multipleOf}` : ''}})`,\n item.nullable,\n );\n if (type === 'number') {\n value = getNullable(\n `faker.number.float({min: ${item.minimum ?? mockOptions?.numberMin}, max: ${item.maximum ?? mockOptions?.numberMax}${isFakerV9 && item.multipleOf !== undefined ? `, multipleOf: ${item.multipleOf}` : `, fractionDigits: ${mockOptions?.fractionDigits}`}})`,\n item.nullable,\n );\n }\n const numberImports: GeneratorImport[] = [];\n\n if (item.enum) {\n value = getEnum(\n item,\n numberImports,\n context,\n existingReferencedProperties,\n 'number',\n );\n } else if ('const' in item) {\n value = '' + (item as SchemaObject31).const;\n }\n\n return {\n value,\n enums: item.enum,\n imports: numberImports,\n name: item.name,\n };\n }\n\n case 'boolean': {\n let value = 'faker.datatype.boolean()';\n if ('const' in item) {\n value = '' + (item as SchemaObject31).const;\n }\n return {\n value,\n imports: [],\n name: item.name,\n };\n }\n\n case 'array': {\n if (!item.items) {\n return { value: '[]', imports: [], name: item.name };\n }\n\n if (\n '$ref' in item.items &&\n existingReferencedProperties.includes(\n pascal(item.items.$ref.split('/').pop()!),\n )\n ) {\n return { value: '[]', imports: [], name: item.name };\n }\n\n const {\n value,\n enums,\n imports: resolvedImports,\n } = resolveMockValue({\n schema: {\n ...item.items,\n name: item.name,\n path: item.path ? `${item.path}.[]` : '#.[]',\n },\n combine,\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n\n if (enums) {\n return {\n value,\n imports: resolvedImports,\n name: item.name,\n };\n }\n\n let mapValue = value;\n\n if (\n combine &&\n !value.startsWith('faker') &&\n !value.startsWith('{') &&\n !value.startsWith('Array.from')\n ) {\n mapValue = `{${value}}`;\n }\n\n return {\n value:\n `Array.from({ length: faker.number.int({ ` +\n `min: ${item.minItems ?? mockOptions?.arrayMin}, ` +\n `max: ${item.maxItems ?? mockOptions?.arrayMax} }) ` +\n `}, (_, i) => i + 1).map(() => (${mapValue}))`,\n imports: resolvedImports,\n name: item.name,\n };\n }\n\n case 'string': {\n const length = `{length: {min: ${item.minLength ?? mockOptions?.stringMin}, max: ${item.maxLength ?? mockOptions?.stringMax}}}`;\n let value = `faker.string.alpha(${length})`;\n const stringImports: GeneratorImport[] = [];\n\n if (item.enum) {\n value = getEnum(\n item,\n stringImports,\n context,\n existingReferencedProperties,\n 'string',\n );\n } else if (item.pattern) {\n value = `faker.helpers.fromRegExp('${item.pattern}')`;\n } else if ('const' in item) {\n value = `'${(item as SchemaObject31).const}'`;\n }\n\n return {\n value: getNullable(value, item.nullable),\n enums: item.enum,\n name: item.name,\n imports: stringImports,\n };\n }\n\n case 'null': {\n return {\n value: 'null',\n imports: [],\n name: item.name,\n };\n }\n\n default: {\n if (item.enum) {\n const enumImports: GeneratorImport[] = [];\n const value = getEnum(\n item,\n enumImports,\n context,\n existingReferencedProperties,\n );\n\n return {\n value,\n enums: item.enum,\n imports: enumImports,\n name: item.name,\n };\n }\n\n return getMockObject({\n item,\n mockOptions,\n operationId,\n tags,\n combine: combine\n ? {\n separator: combine.separator,\n includedProperties: [],\n }\n : undefined,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n allowOverride,\n });\n }\n }\n};\n\nfunction getItemType(item: MockSchemaObject) {\n if (item.type) return item.type;\n if (!item.enum) return;\n\n const uniqTypes = new Set(item.enum.map((value) => typeof value));\n if (uniqTypes.size > 1) return;\n\n const type = [...uniqTypes.values()].at(0);\n if (!type) return;\n return ['string', 'number'].includes(type) ? type : undefined;\n}\n\nconst getEnum = (\n item: MockSchemaObject,\n imports: GeneratorImport[],\n context: ContextSpecs,\n existingReferencedProperties: string[],\n type?: 'string' | 'number',\n) => {\n if (!item.enum) return '';\n const joindEnumValues = item.enum\n .filter((e) => e !== null)\n .map((e) =>\n type === 'string' || (type === undefined && typeof e === 'string')\n ? `'${escape(e)}'`\n : e,\n )\n .join(',');\n\n let enumValue = `[${joindEnumValues}]`;\n if (context.output.override.enumGenerationType === EnumGeneration.ENUM) {\n if (item.isRef || existingReferencedProperties.length === 0) {\n enumValue += ` as ${item.name}${item.name.endsWith('[]') ? '' : '[]'}`;\n imports.push({\n name: item.name,\n ...(isRootKey(context.specKey, context.target)\n ? {}\n : { specKey: context.specKey }),\n });\n } else {\n enumValue += ` as ${existingReferencedProperties[existingReferencedProperties.length - 1]}['${item.name}']`;\n if (!item.path?.endsWith('[]')) enumValue += '[]';\n imports.push({\n name: existingReferencedProperties[\n existingReferencedProperties.length - 1\n ],\n ...(isRootKey(context.specKey, context.target)\n ? {}\n : { specKey: context.specKey }),\n });\n }\n } else {\n enumValue += ' as const';\n }\n\n // But if the value is a reference, we can use the object directly via the imports and using Object.values.\n if (item.isRef && type === 'string') {\n enumValue = `Object.values(${item.name})`;\n imports.push({\n name: item.name,\n values: true,\n ...(isRootKey(context.specKey, context.target)\n ? {}\n : { specKey: context.specKey }),\n });\n }\n\n return item.path?.endsWith('[]')\n ? `faker.helpers.arrayElements(${enumValue})`\n : `faker.helpers.arrayElement(${enumValue})`;\n};\n","import {\n type ContextSpecs,\n type GeneratorImport,\n getRefInfo,\n isReference,\n isRootKey,\n type MockOptions,\n pascal,\n} from '@orval/core';\nimport type { SchemaObject } from 'openapi3-ts/oas30';\n\nimport type { MockDefinition, MockSchemaObject } from '../../types';\nimport { overrideVarName } from '../getters';\nimport { getMockScalar } from '../getters/scalar';\n\nconst isRegex = (key: string) => key.startsWith('/') && key.endsWith('/');\n\nexport const resolveMockOverride = (\n properties: Record<string, unknown> | undefined = {},\n item: SchemaObject & { name: string; path?: string },\n) => {\n const path = item.path ? item.path : `#.${item.name}`;\n const property = Object.entries(properties).find(([key]) => {\n if (isRegex(key)) {\n const regex = new RegExp(key.slice(1, -1));\n if (regex.test(item.name) || regex.test(path)) {\n return true;\n }\n }\n\n if (`#.${key}` === path) {\n return true;\n }\n\n return false;\n });\n\n if (!property) {\n return;\n }\n\n return {\n value: getNullable(property[1] as string, item.nullable),\n imports: [],\n name: item.name,\n overrided: true,\n };\n};\n\nexport const getNullable = (value: string, nullable?: boolean) =>\n nullable ? `faker.helpers.arrayElement([${value}, null])` : value;\n\nexport const resolveMockValue = ({\n schema,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n allowOverride,\n}: {\n schema: MockSchemaObject;\n operationId: string;\n mockOptions?: MockOptions;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpecs;\n imports: GeneratorImport[];\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n splitMockImplementations: string[];\n allowOverride?: boolean;\n}): MockDefinition & { type?: string } => {\n if (isReference(schema)) {\n const {\n originalName,\n specKey = context.specKey,\n refPaths,\n } = getRefInfo(schema.$ref, context);\n\n const schemaRef = Array.isArray(refPaths)\n ? (refPaths.reduce(\n (obj, key) =>\n obj && typeof obj === 'object'\n ? (obj as Record<string, any>)[key]\n : undefined,\n context.specs[specKey],\n ) as Partial<SchemaObject>)\n : undefined;\n\n const newSchema = {\n ...schemaRef,\n name: pascal(originalName),\n path: schema.path,\n isRef: true,\n required: [...(schemaRef?.required ?? []), ...(schema?.required ?? [])],\n };\n\n const newSeparator = newSchema.allOf\n ? 'allOf'\n : newSchema.oneOf\n ? 'oneOf'\n : 'anyOf';\n\n const scalar = getMockScalar({\n item: newSchema,\n mockOptions,\n operationId,\n tags,\n combine: combine\n ? {\n separator:\n combine.separator === 'anyOf' ? newSeparator : combine.separator,\n includedProperties:\n newSeparator === 'allOf' ? [] : combine.includedProperties,\n }\n : undefined,\n context: {\n ...context,\n specKey,\n },\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n allowOverride,\n });\n if (\n scalar.value &&\n (newSchema.type === 'object' || newSchema.allOf) &&\n combine?.separator === 'oneOf'\n ) {\n const funcName = `get${pascal(operationId)}Response${pascal(newSchema.name)}Mock`;\n if (\n !splitMockImplementations?.some((f) =>\n f.includes(`export const ${funcName}`),\n )\n ) {\n const discriminatedProperty = newSchema.discriminator?.propertyName;\n\n let type = `Partial<${newSchema.name}>`;\n if (discriminatedProperty) {\n type = `Omit<${type}, '${discriminatedProperty}'>`;\n }\n\n const args = `${overrideVarName}: ${type} = {}`;\n const func = `export const ${funcName} = (${args}): ${newSchema.name} => ({${scalar.value.startsWith('...') ? '' : '...'}${scalar.value}, ...${overrideVarName}});`;\n splitMockImplementations?.push(func);\n }\n\n scalar.value = newSchema.nullable\n ? `${funcName}()`\n : `{...${funcName}()}`;\n\n scalar.imports.push({\n name: newSchema.name,\n specKey: isRootKey(specKey, context.target) ? undefined : specKey,\n });\n }\n\n return {\n ...scalar,\n type: getType(newSchema),\n };\n }\n\n const scalar = getMockScalar({\n item: schema,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n allowOverride,\n });\n return {\n ...scalar,\n type: getType(schema),\n };\n};\n\nconst getType = (schema: MockSchemaObject) => {\n return (\n (schema.type as string | undefined) ??\n (schema.properties ? 'object' : schema.items ? 'array' : undefined)\n );\n};\n","import {\n type ContextSpecs,\n type GeneratorImport,\n isReference,\n isSchema,\n type MockOptions,\n pascal,\n} from '@orval/core';\n\nimport type { MockDefinition, MockSchemaObject } from '../../types';\nimport { resolveMockValue } from '../resolvers';\n\nexport const combineSchemasMock = ({\n item,\n separator,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n}: {\n item: MockSchemaObject;\n separator: 'allOf' | 'oneOf' | 'anyOf';\n operationId: string;\n mockOptions?: MockOptions;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpecs;\n imports: GeneratorImport[];\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n splitMockImplementations: string[];\n}): MockDefinition => {\n const combineImports: GeneratorImport[] = [];\n const includedProperties: string[] = [...(combine?.includedProperties ?? [])];\n\n const isRefAndNotExisting =\n isReference(item) && !existingReferencedProperties.includes(item.name);\n\n const itemResolvedValue =\n isRefAndNotExisting || item.properties\n ? resolveMockValue({\n schema: Object.fromEntries(\n Object.entries(item).filter(([key]) => key !== separator),\n ) as MockSchemaObject,\n combine: {\n separator: 'allOf',\n includedProperties: [],\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n })\n : undefined;\n\n includedProperties.push(...(itemResolvedValue?.includedProperties ?? []));\n combineImports.push(...(itemResolvedValue?.imports ?? []));\n let containsOnlyPrimitiveValues = true;\n\n const value = (item[separator] ?? []).reduce(\n (acc, val, _, arr) => {\n if (\n '$ref' in val &&\n existingReferencedProperties.includes(\n pascal(val.$ref.split('/').pop()!),\n )\n ) {\n if (arr.length === 1) {\n return 'undefined';\n }\n\n return acc;\n }\n\n // the required fields in this schema need to be considered\n // in the sub schema under the allOf key\n if (separator === 'allOf' && item.required) {\n val =\n isSchema(val) && val.required\n ? { ...val, required: [...item.required, ...val.required] }\n : { ...val, required: item.required };\n }\n\n const resolvedValue = resolveMockValue({\n schema: {\n ...val,\n name: item.name,\n path: item.path ? item.path : '#',\n },\n combine: {\n separator,\n includedProperties:\n separator === 'oneOf'\n ? (itemResolvedValue?.includedProperties ?? [])\n : includedProperties,\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n\n combineImports.push(...resolvedValue.imports);\n includedProperties.push(...(resolvedValue.includedProperties ?? []));\n\n if (resolvedValue.value === '{}') {\n containsOnlyPrimitiveValues = false;\n return acc;\n }\n if (separator === 'allOf') {\n if (resolvedValue.value.startsWith('{') || !resolvedValue.type) {\n containsOnlyPrimitiveValues = false;\n return `${acc}...${resolvedValue.value},`;\n } else if (resolvedValue.type === 'object') {\n containsOnlyPrimitiveValues = false;\n return resolvedValue.value.startsWith('faker')\n ? `${acc}...${resolvedValue.value},`\n : `${acc}...{${resolvedValue.value}},`;\n }\n }\n return `${acc}${resolvedValue.value},`;\n },\n separator === 'allOf' ? '' : 'faker.helpers.arrayElement([',\n );\n let finalValue =\n value === 'undefined'\n ? value\n : `${separator === 'allOf' && !containsOnlyPrimitiveValues ? '{' : ''}${value}${separator === 'allOf' ? (containsOnlyPrimitiveValues ? '' : '}') : '])'}`;\n if (itemResolvedValue) {\n finalValue = finalValue.startsWith('...')\n ? `...{${finalValue}, ${itemResolvedValue.value}}`\n : `{...${finalValue}, ${itemResolvedValue.value}}`;\n }\n if (finalValue.endsWith(',')) {\n finalValue = finalValue.slice(0, Math.max(0, finalValue.length - 1));\n }\n\n return {\n value: finalValue,\n imports: combineImports,\n name: item.name,\n includedProperties,\n };\n};\n","import { camel, sanitize } from '@orval/core';\n\nconst hasParam = (path: string): boolean => /[^{]*{[\\w*_-]*}.*/.test(path);\n\nconst getRoutePath = (path: string): string => {\n const matches = /([^{]*){?([\\w*_-]*)}?(.*)/.exec(path);\n if (!matches?.length) return path; // impossible due to regexp grouping here, but for TS\n\n const prev = matches[1];\n const param = sanitize(camel(matches[2]), {\n es5keyword: true,\n underscore: true,\n dash: true,\n dot: true,\n });\n const next = hasParam(matches[3]) ? getRoutePath(matches[3]) : matches[3];\n\n return hasParam(path) ? `${prev}:${param}${next}` : `${prev}${param}${next}`;\n};\n\nexport const getRouteMSW = (route: string, baseUrl = '*') => {\n route = route.replaceAll(':', '\\\\\\:');\n const splittedRoute = route.split('/');\n\n return splittedRoute.reduce((acc, path, i) => {\n if (!path && !i) {\n return acc;\n }\n\n if (!path.includes('{')) {\n return `${acc}/${path}`;\n }\n\n return `${acc}/${getRoutePath(path)}`;\n }, baseUrl);\n};\n","import {\n ContextSpecs,\n generalJSTypesWithArray,\n GeneratorImport,\n GlobalMockOptions,\n isFunction,\n MockOptions,\n NormalizedOverrideOutput,\n resolveRef,\n ResReqTypesValue,\n stringify,\n} from '@orval/core';\nimport { OpenAPIObject, SchemaObject } from 'openapi3-ts/oas30';\n\nimport { getMockScalar } from '../faker/getters';\n\nconst getMockPropertiesWithoutFunc = (properties: any, spec: OpenAPIObject) =>\n Object.entries(isFunction(properties) ? properties(spec) : properties).reduce<\n Record<string, string>\n >((acc, [key, value]) => {\n const implementation = isFunction(value)\n ? `(${value})()`\n : stringify(value as string)!;\n\n acc[key] = implementation?.replaceAll(\n /import_faker.defaults|import_faker.faker/g,\n 'faker',\n );\n return acc;\n }, {});\n\nconst getMockWithoutFunc = (\n spec: OpenAPIObject,\n override?: NormalizedOverrideOutput,\n): MockOptions => ({\n arrayMin: override?.mock?.arrayMin,\n arrayMax: override?.mock?.arrayMax,\n stringMin: override?.mock?.stringMin,\n stringMax: override?.mock?.stringMax,\n numberMin: override?.mock?.numberMin,\n numberMax: override?.mock?.numberMax,\n required: override?.mock?.required,\n fractionDigits: override?.mock?.fractionDigits,\n ...(override?.mock?.properties\n ? {\n properties: getMockPropertiesWithoutFunc(\n override.mock.properties,\n spec,\n ),\n }\n : {}),\n ...(override?.mock?.format\n ? {\n format: getMockPropertiesWithoutFunc(override.mock.format, spec),\n }\n : {}),\n ...(override?.operations\n ? {\n operations: Object.entries(override.operations).reduce<\n Exclude<MockOptions['operations'], undefined>\n >((acc, [key, value]) => {\n if (value.mock?.properties) {\n acc[key] = {\n properties: getMockPropertiesWithoutFunc(\n value.mock.properties,\n spec,\n ),\n };\n }\n\n return acc;\n }, {}),\n }\n : {}),\n ...(override?.tags\n ? {\n tags: Object.entries(override.tags).reduce<\n Exclude<MockOptions['tags'], undefined>\n >((acc, [key, value]) => {\n if (value.mock?.properties) {\n acc[key] = {\n properties: getMockPropertiesWithoutFunc(\n value.mock.properties,\n spec,\n ),\n };\n }\n\n return acc;\n }, {}),\n }\n : {}),\n});\n\nconst getMockScalarJsTypes = (\n definition: string,\n mockOptionsWithoutFunc: Record<string, unknown>,\n) => {\n const isArray = definition.endsWith('[]');\n const type = isArray ? definition.slice(0, -2) : definition;\n\n switch (type) {\n case 'number': {\n return isArray\n ? `Array.from({length: faker.number.int({` +\n `min: ${mockOptionsWithoutFunc.arrayMin}, ` +\n `max: ${mockOptionsWithoutFunc.arrayMax}}` +\n `)}, () => faker.number.int())`\n : 'faker.number.int()';\n }\n case 'string': {\n return isArray\n ? `Array.from({length: faker.number.int({` +\n `min: ${mockOptionsWithoutFunc?.arrayMin},` +\n `max: ${mockOptionsWithoutFunc?.arrayMax}}` +\n `)}, () => faker.word.sample())`\n : 'faker.word.sample()';\n }\n default: {\n return 'undefined';\n }\n }\n};\n\nexport const getResponsesMockDefinition = ({\n operationId,\n tags,\n returnType,\n responses,\n imports: responseImports,\n mockOptionsWithoutFunc,\n transformer,\n context,\n mockOptions,\n splitMockImplementations,\n}: {\n operationId: string;\n tags: string[];\n returnType: string;\n responses: ResReqTypesValue[];\n imports: GeneratorImport[];\n mockOptionsWithoutFunc: Record<string, unknown>;\n transformer?: (value: unknown, definition: string) => string;\n context: ContextSpecs;\n mockOptions?: GlobalMockOptions;\n splitMockImplementations: string[];\n}) => {\n return responses.reduce(\n (\n acc,\n { value: definition, originalSchema, example, examples, imports, isRef },\n ) => {\n if (\n context.output.override?.mock?.useExamples ||\n mockOptions?.useExamples\n ) {\n let exampleValue =\n example ||\n originalSchema?.example ||\n Object.values(examples || {})[0] ||\n originalSchema?.examples?.[0];\n exampleValue = exampleValue?.value ?? exampleValue;\n if (exampleValue) {\n acc.definitions.push(\n transformer\n ? transformer(exampleValue, returnType)\n : JSON.stringify(exampleValue),\n );\n return acc;\n }\n }\n if (!definition || generalJSTypesWithArray.includes(definition)) {\n const value = getMockScalarJsTypes(definition, mockOptionsWithoutFunc);\n\n acc.definitions.push(\n transformer ? transformer(value, returnType) : value,\n );\n\n return acc;\n }\n\n if (!originalSchema) {\n return acc;\n }\n\n const resolvedRef = resolveRef<SchemaObject>(originalSchema, context);\n\n const scalar = getMockScalar({\n item: {\n name: definition,\n ...resolvedRef.schema,\n },\n imports,\n mockOptions: mockOptionsWithoutFunc,\n operationId,\n tags,\n context: isRef\n ? {\n ...context,\n specKey: responseImports[0]?.specKey ?? context.specKey,\n }\n : context,\n existingReferencedProperties: [],\n splitMockImplementations,\n allowOverride: true,\n });\n\n acc.imports.push(...scalar.imports);\n acc.definitions.push(\n transformer\n ? transformer(scalar.value, returnType)\n : scalar.value.toString(),\n );\n\n return acc;\n },\n {\n definitions: [] as string[],\n imports: [] as GeneratorImport[],\n },\n );\n};\n\nexport const getMockDefinition = ({\n operationId,\n tags,\n returnType,\n responses,\n imports: responseImports,\n override,\n transformer,\n context,\n mockOptions,\n splitMockImplementations,\n}: {\n operationId: string;\n tags: string[];\n returnType: string;\n responses: ResReqTypesValue[];\n imports: GeneratorImport[];\n override: NormalizedOverrideOutput;\n transformer?: (value: unknown, definition: string) => string;\n context: ContextSpecs;\n mockOptions?: GlobalMockOptions;\n splitMockImplementations: string[];\n}) => {\n const mockOptionsWithoutFunc = getMockWithoutFunc(\n context.specs[context.specKey],\n override,\n );\n\n const { definitions, imports } = getResponsesMockDefinition({\n operationId,\n tags,\n returnType,\n responses,\n imports: responseImports,\n mockOptionsWithoutFunc,\n transformer,\n context,\n mockOptions,\n splitMockImplementations,\n });\n\n return {\n definition: '[' + definitions.join(', ') + ']',\n definitions,\n imports,\n };\n};\n\nexport const getMockOptionsDataOverride = (\n operationTags: string[],\n operationId: string,\n override: NormalizedOverrideOutput,\n) => {\n const responseOverride =\n override?.operations?.[operationId]?.mock?.data ||\n operationTags\n .map((operationTag) => override?.tags?.[operationTag]?.mock?.data)\n .find((e) => e !== undefined);\n const implementation = isFunction(responseOverride)\n ? `(${responseOverride})()`\n : stringify(responseOverride);\n\n return implementation?.replaceAll(\n /import_faker.defaults|import_faker.faker/g,\n 'faker',\n );\n};\n","import {\n ClientMockGeneratorBuilder,\n generateDependencyImports,\n GenerateMockImports,\n GeneratorDependency,\n GeneratorImport,\n GeneratorOptions,\n GeneratorVerbOptions,\n GlobalMockOptions,\n isFunction,\n isObject,\n pascal,\n ResReqTypesValue,\n} from '@orval/core';\n\nimport { getDelay } from '../delay';\nimport { getRouteMSW, overrideVarName } from '../faker/getters';\nimport { getMockDefinition, getMockOptionsDataOverride } from './mocks';\n\nconst getMSWDependencies = (\n options?: GlobalMockOptions,\n): GeneratorDependency[] => {\n const hasDelay = options?.delay !== false;\n const locale = options?.locale;\n\n const exports = [\n { name: 'http', values: true },\n { name: 'HttpResponse', values: true },\n { name: 'RequestHandlerOptions', values: false },\n ];\n\n if (hasDelay) {\n exports.push({ name: 'delay', values: true });\n }\n\n return [\n { exports, dependency: 'msw' },\n {\n exports: [{ name: 'faker', values: true }],\n dependency: locale\n ? `@faker-js/faker/locale/${locale}`\n : '@faker-js/faker',\n },\n ];\n};\n\nexport const generateMSWImports: GenerateMockImports = ({\n implementation,\n imports,\n specsName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n options,\n}) => {\n return generateDependencyImports(\n implementation,\n [...getMSWDependencies(options), ...imports],\n specsName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n );\n};\n\nconst generateDefinition = (\n name: string,\n route: string,\n getResponseMockFunctionNameBase: string,\n handlerNameBase: string,\n { operationId, response, verb, tags }: GeneratorVerbOptions,\n { override, context, mock }: GeneratorOptions,\n returnType: string,\n status: string,\n responseImports: GeneratorImport[],\n responses: ResReqTypesValue[],\n contentTypes: string[],\n splitMockImplementations: string[],\n) => {\n const oldSplitMockImplementations = [...splitMockImplementations];\n const { definitions, definition, imports } = getMockDefinition({\n operationId,\n tags,\n returnType,\n responses,\n imports: responseImports,\n override,\n context,\n mockOptions: isFunction(mock) ? undefined : mock,\n splitMockImplementations,\n });\n\n const mockData = getMockOptionsDataOverride(tags, operationId, override);\n\n let value = '';\n\n if (mockData) {\n value = mockData;\n } else if (definitions.length > 1) {\n value = `faker.helpers.arrayElement(${definition})`;\n } else if (definitions[0]) {\n value = definitions[0];\n }\n\n const isResponseOverridable = value.includes(overrideVarName);\n const isTextPlain = contentTypes.includes('text/plain');\n const isReturnHttpResponse = value && value !== 'undefined';\n\n const getResponseMockFunctionName = `${getResponseMockFunctionNameBase}${pascal(\n name,\n )}`;\n const handlerName = `${handlerNameBase}${pascal(name)}`;\n\n const addedSplitMockImplementations = splitMockImplementations.slice(\n oldSplitMockImplementations.length,\n );\n splitMockImplementations.push(...addedSplitMockImplementations);\n const mockImplementations =\n addedSplitMockImplementations.length > 0\n ? `${addedSplitMockImplementations.join('\\n\\n')}\\n\\n`\n : '';\n\n const mockImplementation = isReturnHttpResponse\n ? `${mockImplementations}export const ${getResponseMockFunctionName} = (${\n isResponseOverridable\n ? `overrideResponse: Partial< ${returnType} > = {}`\n : ''\n })${mockData ? '' : `: ${returnType}`} => (${value})\\n\\n`\n : mockImplementations;\n\n const delay = getDelay(override, isFunction(mock) ? undefined : mock);\n const infoParam = 'info';\n const overrideResponse = `overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(${infoParam}) : overrideResponse)\n : ${getResponseMockFunctionName}()`;\n const handlerImplementation = `\nexport const ${handlerName} = (overrideResponse?: ${returnType} | ((${infoParam}: Parameters<Parameters<typeof http.${verb}>[1]>[0]) => Promise<${returnType}> | ${returnType}), options?: RequestHandlerOptions) => {\n return http.${verb}('${route}', async (${infoParam}) => {${\n delay === false\n ? ''\n : `await delay(${isFunction(delay) ? `(${delay})()` : delay});`\n }\n ${isReturnHttpResponse ? '' : `if (typeof overrideResponse === 'function') {await overrideResponse(info); }`}\n return new HttpResponse(${\n isReturnHttpResponse\n ? isTextPlain\n ? overrideResponse\n : `JSON.stringify(${overrideResponse})`\n : null\n },\n { status: ${status === 'default' ? 200 : status.replace(/XX$/, '00')},\n ${\n isReturnHttpResponse\n ? `headers: { 'Content-Type': ${isTextPlain ? \"'text/plain'\" : \"'application/json'\"} }`\n : ''\n }\n })\n }, options)\n}\\n`;\n\n const includeResponseImports = isTextPlain\n ? imports\n : [\n ...imports,\n ...response.imports.filter((r) => {\n // Only include imports which are actually used in mock.\n const reg = new RegExp(`\\\\b${r.name}\\\\b`);\n return (\n reg.test(handlerImplementation) || reg.test(mockImplementation)\n );\n }),\n ];\n\n return {\n implementation: {\n function: mockImplementation,\n handlerName: handlerName,\n handler: handlerImplementation,\n },\n imports: includeResponseImports,\n };\n};\n\nexport const generateMSW = (\n generatorVerbOptions: GeneratorVerbOptions,\n generatorOptions: GeneratorOptions,\n): ClientMockGeneratorBuilder => {\n const { pathRoute, override, mock } = generatorOptions;\n const { operationId, response } = generatorVerbOptions;\n\n const route = getRouteMSW(\n pathRoute,\n override?.mock?.baseUrl ?? (isFunction(mock) ? undefined : mock?.baseUrl),\n );\n\n const handlerName = `get${pascal(operationId)}MockHandler`;\n const getResponseMockFunctionName = `get${pascal(operationId)}ResponseMock`;\n\n const splitMockImplementations: string[] = [];\n\n const baseDefinition = generateDefinition(\n '',\n route,\n getResponseMockFunctionName,\n handlerName,\n generatorVerbOptions,\n generatorOptions,\n response.definition.success,\n response.types.success[0]?.key ?? '200',\n response.imports,\n response.types.success,\n response.contentTypes,\n splitMockImplementations,\n );\n\n const mockImplementations = [baseDefinition.implementation.function];\n const handlerImplementations = [baseDefinition.implementation.handler];\n const imports = [...baseDefinition.imports];\n\n if (\n generatorOptions.mock &&\n isObject(generatorOptions.mock) &&\n generatorOptions.mock.generateEachHttpStatus\n ) {\n for (const statusResponse of [\n ...response.types.success,\n ...response.types.errors,\n ]) {\n const definition = generateDefinition(\n statusResponse.key,\n route,\n getResponseMockFunctionName,\n handlerName,\n generatorVerbOptions,\n generatorOptions,\n statusResponse.value,\n statusResponse.key,\n response.imports,\n [statusResponse],\n [statusResponse.contentType],\n splitMockImplementations,\n );\n mockImplementations.push(definition.implementation.function);\n handlerImplementations.push(definition.implementation.handler);\n imports.push(...definition.imports);\n }\n }\n\n return {\n implementation: {\n function: mockImplementations.join('\\n'),\n handlerName: handlerName,\n handler: handlerImplementations.join('\\n'),\n },\n imports: imports,\n };\n};\n","import {\n GenerateMockImports,\n GeneratorOptions,\n GeneratorVerbOptions,\n GlobalMockOptions,\n} from '@orval/core';\n\nimport { generateMSW, generateMSWImports } from './msw';\n\nexport const DEFAULT_MOCK_OPTIONS: GlobalMockOptions = {\n type: 'msw',\n useExamples: false,\n};\n\nexport const generateMockImports: GenerateMockImports = (importOptions) => {\n switch (importOptions.options?.type) {\n default: {\n // case 'msw':\n return generateMSWImports(importOptions);\n }\n }\n};\n\nexport const generateMock = (\n generatorVerbOptions: GeneratorVerbOptions,\n generatorOptions: Omit<GeneratorOptions, 'mock'> & {\n mock: GlobalMockOptions;\n },\n) => {\n switch (generatorOptions.mock.type) {\n default: {\n // case 'msw':\n return generateMSW(generatorVerbOptions, generatorOptions);\n }\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAa,YACX,UACA,YAC+B;CAC/B,MAAM,gBACJ,UAAU,MAAM,UAAU,SACtB,SAAS,QACT,UAAU,MAAM;CACtB,MAAM,2BACJ,UAAU,MAAM,4BAChB,SAAS;AACX,SAAQ,OAAO,eAAf;EACE,KAAK,WACH,QAAO,2BAA2B,gBAAgB,eAAe;EAEnE,KAAK;EACL,KAAK,UACH,QAAO;EAET,QACE,QAAO;;;;;;ACpBb,MAAM,0BAA0B,gBAA6B;AAC3D,QACE,YAAY,eAAe,sBAC3B,YAAY,kBAAkB,sBAC9B,YAAY,mBAAmB;;AAInC,MAAa,oBAAoB,gBAA6B;CAC5D,MAAM,UAAU,uBAAuB,YAAY;AAEnD,KAAI,CAAC,QACH,QAAO;CAGT,MAAM,YAAY,QAAQ,MAAM,IAAI,CAAC;AAErC,0CAAuB,WAAW,QAAQ;;;;;ACjB5C,MAAaA,sBAGT;CACF,KAAK;CACL,QACE;CACF,MAAM;CACN,SAAS;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EE,QAAO,mBAAmB,cAAc;;;AAK9C,MAAa,gBACX,sBACA,qBAGG;AACH,SAAQ,iBAAiB,KAAK,MAA9B;EACE,QAEE,QAAO,YAAY,sBAAsB,iBAAiB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["DEFAULT_FORMAT_MOCK: Record<\n Required<SchemaObject>['format'],\n string\n>","imports: GeneratorImport[]","includedProperties: string[]","numberImports: GeneratorImport[]","stringImports: GeneratorImport[]","enumImports: GeneratorImport[]","combineImports: GeneratorImport[]","includedProperties: string[]","generateMSWImports: GenerateMockImports","splitMockImplementations: string[]","DEFAULT_MOCK_OPTIONS: GlobalMockOptions","generateMockImports: GenerateMockImports"],"sources":["../src/delay.ts","../src/faker/compatibleV9.ts","../src/faker/constants.ts","../src/faker/getters/object.ts","../src/faker/getters/scalar.ts","../src/faker/resolvers/value.ts","../src/faker/getters/combine.ts","../src/faker/getters/route.ts","../src/msw/mocks.ts","../src/msw/index.ts","../src/index.ts"],"sourcesContent":["import type { GlobalMockOptions, NormalizedOverrideOutput } from '@orval/core';\n\nexport const getDelay = (\n override?: NormalizedOverrideOutput,\n options?: GlobalMockOptions,\n): GlobalMockOptions['delay'] => {\n const overrideDelay =\n override?.mock?.delay === undefined\n ? options?.delay\n : override?.mock?.delay;\n const delayFunctionLazyExecute =\n override?.mock?.delayFunctionLazyExecute ??\n options?.delayFunctionLazyExecute;\n switch (typeof overrideDelay) {\n case 'function': {\n return delayFunctionLazyExecute ? overrideDelay : overrideDelay();\n }\n case 'number':\n case 'boolean': {\n return overrideDelay;\n }\n default: {\n return false;\n }\n }\n};\n","import { compareVersions, type PackageJson } from '@orval/core';\n\nconst getFakerPackageVersion = (packageJson: PackageJson) => {\n return (\n packageJson.dependencies?.['@faker-js/faker'] ??\n packageJson.devDependencies?.['@faker-js/faker'] ??\n packageJson.peerDependencies?.['@faker-js/faker']\n );\n};\n\nexport const isFakerVersionV9 = (packageJson: PackageJson) => {\n const version = getFakerPackageVersion(packageJson);\n\n if (!version) {\n return false;\n }\n\n const withoutRc = version.split('-')[0];\n\n return compareVersions(withoutRc, '9.0.0');\n};\n","import type { SchemaObject } from 'openapi3-ts/oas30';\n\nexport const DEFAULT_FORMAT_MOCK: Record<\n Required<SchemaObject>['format'],\n string\n> = {\n bic: 'faker.finance.bic()',\n binary:\n \"new Blob(faker.helpers.arrayElements(faker.word.words(10).split(' ')))\",\n city: 'faker.location.city()',\n country: 'faker.location.country()',\n date: \"faker.date.past().toISOString().split('T')[0]\",\n 'date-time': \"`${faker.date.past().toISOString().split('.')[0]}Z`\",\n email: 'faker.internet.email()',\n firstName: 'faker.person.firstName()',\n gender: 'faker.person.gender()',\n iban: 'faker.finance.iban()',\n ipv4: 'faker.internet.ipv4()',\n ipv6: 'faker.internet.ipv6()',\n jobTitle: 'faker.person.jobTitle()',\n lastName: 'faker.person.lastName()',\n password: 'faker.internet.password()',\n phoneNumber: 'faker.phone.number()',\n streetName: 'faker.location.street()',\n uri: 'faker.internet.url()',\n url: 'faker.internet.url()',\n userName: 'faker.internet.userName()',\n uuid: 'faker.string.uuid()',\n zipCode: 'faker.location.zipCode()',\n};\n\n// #980 replace CUID so tests are consistent\nexport const DEFAULT_OBJECT_KEY_MOCK = 'faker.string.alphanumeric(5)';\n","import {\n type ContextSpecs,\n type GeneratorImport,\n getKey,\n isBoolean,\n isReference,\n type MockOptions,\n pascal,\n PropertySortOrder,\n} from '@orval/core';\nimport type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30';\n\nimport type { MockDefinition, MockSchemaObject } from '../../types';\nimport { DEFAULT_OBJECT_KEY_MOCK } from '../constants';\nimport { resolveMockValue } from '../resolvers/value';\nimport { combineSchemasMock } from './combine';\n\nexport const overrideVarName = 'overrideResponse';\n\nexport const getMockObject = ({\n item,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n allowOverride = false,\n}: {\n item: MockSchemaObject;\n operationId: string;\n mockOptions?: MockOptions;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpecs;\n imports: GeneratorImport[];\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n splitMockImplementations: string[];\n // This is used to add the overrideResponse to the object\n allowOverride?: boolean;\n}): MockDefinition => {\n if (isReference(item)) {\n return resolveMockValue({\n schema: {\n ...item,\n name: item.name,\n path: item.path ? `${item.path}.${item.name}` : item.name,\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n }\n\n if (item.allOf || item.oneOf || item.anyOf) {\n const separator = item.allOf ? 'allOf' : item.oneOf ? 'oneOf' : 'anyOf';\n return combineSchemasMock({\n item,\n separator,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n }\n\n if (Array.isArray(item.type)) {\n return combineSchemasMock({\n item: {\n anyOf: item.type.map((type) => ({ type })),\n name: item.name,\n },\n separator: 'anyOf',\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n }\n\n if (item.properties) {\n let value =\n !combine ||\n combine?.separator === 'oneOf' ||\n combine?.separator === 'anyOf'\n ? '{'\n : '';\n const imports: GeneratorImport[] = [];\n const includedProperties: string[] = [];\n\n const entries = Object.entries(item.properties);\n if (context.output.propertySortOrder === PropertySortOrder.ALPHABETICAL) {\n entries.sort((a, b) => {\n return a[0].localeCompare(b[0]);\n });\n }\n const properyScalars = entries\n .map(([key, prop]: [string, ReferenceObject | SchemaObject]) => {\n if (combine?.includedProperties.includes(key)) {\n return;\n }\n\n const isRequired =\n mockOptions?.required ||\n (Array.isArray(item.required) ? item.required : []).includes(key);\n\n // Check to see if the property is a reference to an existing property\n // Fixes issue #910\n if (\n '$ref' in prop &&\n existingReferencedProperties.includes(\n pascal(prop.$ref.split('/').pop()!),\n )\n ) {\n return;\n }\n\n const resolvedValue = resolveMockValue({\n schema: {\n ...prop,\n name: key,\n path: item.path ? `${item.path}.${key}` : `#.${key}`,\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n\n imports.push(...resolvedValue.imports);\n includedProperties.push(key);\n\n const keyDefinition = getKey(key);\n if (!isRequired && !resolvedValue.overrided) {\n return `${keyDefinition}: faker.helpers.arrayElement([${resolvedValue.value}, undefined])`;\n }\n\n return `${keyDefinition}: ${resolvedValue.value}`;\n })\n .filter(Boolean);\n\n if (allowOverride) {\n properyScalars.push(`...${overrideVarName}`);\n }\n\n value += properyScalars.join(', ');\n value +=\n !combine ||\n combine?.separator === 'oneOf' ||\n combine?.separator === 'anyOf'\n ? '}'\n : '';\n\n return {\n value,\n imports,\n name: item.name,\n includedProperties,\n };\n }\n\n if (item.additionalProperties) {\n if (isBoolean(item.additionalProperties)) {\n return { value: `{}`, imports: [], name: item.name };\n }\n if (\n isReference(item.additionalProperties) &&\n existingReferencedProperties.includes(\n item.additionalProperties.$ref.split('/').pop()!,\n )\n ) {\n return { value: `{}`, imports: [], name: item.name };\n }\n\n const resolvedValue = resolveMockValue({\n schema: {\n ...item.additionalProperties,\n name: item.name,\n path: item.path ? `${item.path}.#` : '#',\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n\n return {\n ...resolvedValue,\n value: `{\n [${DEFAULT_OBJECT_KEY_MOCK}]: ${resolvedValue.value}\n }`,\n };\n }\n\n return { value: '{}', imports: [], name: item.name };\n};\n","import {\n type ContextSpecs,\n EnumGeneration,\n escape,\n type GeneratorImport,\n isRootKey,\n mergeDeep,\n type MockOptions,\n pascal,\n} from '@orval/core';\nimport type { SchemaObject as SchemaObject31 } from 'openapi3-ts/oas31';\n\nimport type { MockDefinition, MockSchemaObject } from '../../types';\nimport { isFakerVersionV9 } from '../compatibleV9';\nimport { DEFAULT_FORMAT_MOCK } from '../constants';\nimport {\n getNullable,\n resolveMockOverride,\n resolveMockValue,\n} from '../resolvers';\nimport { getMockObject } from './object';\n\nexport const getMockScalar = ({\n item,\n imports,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n existingReferencedProperties,\n splitMockImplementations,\n allowOverride = false,\n}: {\n item: MockSchemaObject;\n imports: GeneratorImport[];\n mockOptions?: MockOptions;\n operationId: string;\n isRef?: boolean;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpecs;\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n splitMockImplementations: string[];\n // This is used to add the overrideResponse to the object\n allowOverride?: boolean;\n}): MockDefinition => {\n // Add the property to the existing properties to validate on object recursion\n if (item.isRef) {\n existingReferencedProperties = [...existingReferencedProperties, item.name];\n }\n\n const operationProperty = resolveMockOverride(\n mockOptions?.operations?.[operationId]?.properties,\n item,\n );\n\n if (operationProperty) {\n return operationProperty;\n }\n\n const overrideTag = Object.entries(mockOptions?.tags ?? {})\n .sort((a, b) => {\n return a[0].localeCompare(b[0]);\n })\n .reduce(\n (acc, [tag, options]) =>\n tags.includes(tag) ? mergeDeep(acc, options) : acc,\n {} as { properties: Record<string, unknown> },\n );\n\n const tagProperty = resolveMockOverride(overrideTag?.properties, item);\n\n if (tagProperty) {\n return tagProperty;\n }\n\n const property = resolveMockOverride(mockOptions?.properties, item);\n\n if (property) {\n return property;\n }\n\n if (\n (context.output.override?.mock?.useExamples || mockOptions?.useExamples) &&\n item.example !== undefined\n ) {\n return {\n value: JSON.stringify(item.example),\n imports: [],\n name: item.name,\n overrided: true,\n };\n }\n\n const ALL_FORMAT = {\n ...DEFAULT_FORMAT_MOCK,\n ...mockOptions?.format,\n };\n\n if (item.format && ALL_FORMAT[item.format]) {\n let value = ALL_FORMAT[item.format] as string;\n\n const dateFormats = ['date', 'date-time'];\n if (dateFormats.includes(item.format) && context.output.override.useDates) {\n value = `new Date(${value})`;\n }\n\n return {\n value: getNullable(value, item.nullable),\n imports: [],\n name: item.name,\n overrided: false,\n };\n }\n\n const type = getItemType(item);\n const isFakerV9 =\n !!context.output.packageJson &&\n isFakerVersionV9(context.output.packageJson);\n\n switch (type) {\n case 'number':\n case 'integer': {\n const intFunction =\n context.output.override.useBigInt &&\n (item.format === 'int64' || item.format === 'uint64')\n ? 'bigInt'\n : 'int';\n let value = getNullable(\n `faker.number.${intFunction}({min: ${item.minimum ?? mockOptions?.numberMin}, max: ${item.maximum ?? mockOptions?.numberMax}${isFakerV9 && item.multipleOf !== undefined ? `, multipleOf: ${item.multipleOf}` : ''}})`,\n item.nullable,\n );\n if (type === 'number') {\n value = getNullable(\n `faker.number.float({min: ${item.minimum ?? mockOptions?.numberMin}, max: ${item.maximum ?? mockOptions?.numberMax}${isFakerV9 && item.multipleOf !== undefined ? `, multipleOf: ${item.multipleOf}` : `, fractionDigits: ${mockOptions?.fractionDigits}`}})`,\n item.nullable,\n );\n }\n const numberImports: GeneratorImport[] = [];\n\n if (item.enum) {\n value = getEnum(\n item,\n numberImports,\n context,\n existingReferencedProperties,\n 'number',\n );\n } else if ('const' in item) {\n value = '' + (item as SchemaObject31).const;\n }\n\n return {\n value,\n enums: item.enum,\n imports: numberImports,\n name: item.name,\n };\n }\n\n case 'boolean': {\n let value = 'faker.datatype.boolean()';\n if ('const' in item) {\n value = '' + (item as SchemaObject31).const;\n }\n return {\n value,\n imports: [],\n name: item.name,\n };\n }\n\n case 'array': {\n if (!item.items) {\n return { value: '[]', imports: [], name: item.name };\n }\n\n if (\n '$ref' in item.items &&\n existingReferencedProperties.includes(\n pascal(item.items.$ref.split('/').pop()!),\n )\n ) {\n return { value: '[]', imports: [], name: item.name };\n }\n\n const {\n value,\n enums,\n imports: resolvedImports,\n } = resolveMockValue({\n schema: {\n ...item.items,\n name: item.name,\n path: item.path ? `${item.path}.[]` : '#.[]',\n },\n combine,\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n\n if (enums) {\n return {\n value,\n imports: resolvedImports,\n name: item.name,\n };\n }\n\n let mapValue = value;\n\n if (\n combine &&\n !value.startsWith('faker') &&\n !value.startsWith('{') &&\n !value.startsWith('Array.from')\n ) {\n mapValue = `{${value}}`;\n }\n\n return {\n value:\n `Array.from({ length: faker.number.int({ ` +\n `min: ${item.minItems ?? mockOptions?.arrayMin}, ` +\n `max: ${item.maxItems ?? mockOptions?.arrayMax} }) ` +\n `}, (_, i) => i + 1).map(() => (${mapValue}))`,\n imports: resolvedImports,\n name: item.name,\n };\n }\n\n case 'string': {\n const length = `{length: {min: ${item.minLength ?? mockOptions?.stringMin}, max: ${item.maxLength ?? mockOptions?.stringMax}}}`;\n let value = `faker.string.alpha(${length})`;\n const stringImports: GeneratorImport[] = [];\n\n if (item.enum) {\n value = getEnum(\n item,\n stringImports,\n context,\n existingReferencedProperties,\n 'string',\n );\n } else if (item.pattern) {\n value = `faker.helpers.fromRegExp('${item.pattern}')`;\n } else if ('const' in item) {\n value = `'${(item as SchemaObject31).const}'`;\n }\n\n return {\n value: getNullable(value, item.nullable),\n enums: item.enum,\n name: item.name,\n imports: stringImports,\n };\n }\n\n case 'null': {\n return {\n value: 'null',\n imports: [],\n name: item.name,\n };\n }\n\n default: {\n if (item.enum) {\n const enumImports: GeneratorImport[] = [];\n const value = getEnum(\n item,\n enumImports,\n context,\n existingReferencedProperties,\n );\n\n return {\n value,\n enums: item.enum,\n imports: enumImports,\n name: item.name,\n };\n }\n\n return getMockObject({\n item,\n mockOptions,\n operationId,\n tags,\n combine: combine\n ? {\n separator: combine.separator,\n includedProperties: [],\n }\n : undefined,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n allowOverride,\n });\n }\n }\n};\n\nfunction getItemType(item: MockSchemaObject) {\n if (item.type) return item.type;\n if (!item.enum) return;\n\n const uniqTypes = new Set(item.enum.map((value) => typeof value));\n if (uniqTypes.size > 1) return;\n\n const type = [...uniqTypes.values()].at(0);\n if (!type) return;\n return ['string', 'number'].includes(type) ? type : undefined;\n}\n\nconst getEnum = (\n item: MockSchemaObject,\n imports: GeneratorImport[],\n context: ContextSpecs,\n existingReferencedProperties: string[],\n type?: 'string' | 'number',\n) => {\n if (!item.enum) return '';\n const joindEnumValues = item.enum\n .filter((e) => e !== null)\n .map((e) =>\n type === 'string' || (type === undefined && typeof e === 'string')\n ? `'${escape(e)}'`\n : e,\n )\n .join(',');\n\n let enumValue = `[${joindEnumValues}]`;\n if (context.output.override.enumGenerationType === EnumGeneration.ENUM) {\n if (item.isRef || existingReferencedProperties.length === 0) {\n enumValue += ` as ${item.name}${item.name.endsWith('[]') ? '' : '[]'}`;\n imports.push({\n name: item.name,\n ...(isRootKey(context.specKey, context.target)\n ? {}\n : { specKey: context.specKey }),\n });\n } else {\n enumValue += ` as ${existingReferencedProperties[existingReferencedProperties.length - 1]}['${item.name}']`;\n if (!item.path?.endsWith('[]')) enumValue += '[]';\n imports.push({\n name: existingReferencedProperties[\n existingReferencedProperties.length - 1\n ],\n ...(isRootKey(context.specKey, context.target)\n ? {}\n : { specKey: context.specKey }),\n });\n }\n } else {\n enumValue += ' as const';\n }\n\n // But if the value is a reference, we can use the object directly via the imports and using Object.values.\n if (item.isRef && type === 'string') {\n enumValue = `Object.values(${item.name})`;\n imports.push({\n name: item.name,\n values: true,\n ...(isRootKey(context.specKey, context.target)\n ? {}\n : { specKey: context.specKey }),\n });\n }\n\n return item.path?.endsWith('[]')\n ? `faker.helpers.arrayElements(${enumValue})`\n : `faker.helpers.arrayElement(${enumValue})`;\n};\n","import {\n type ContextSpecs,\n type GeneratorImport,\n getRefInfo,\n isReference,\n isRootKey,\n type MockOptions,\n pascal,\n} from '@orval/core';\nimport type { SchemaObject } from 'openapi3-ts/oas30';\n\nimport type { MockDefinition, MockSchemaObject } from '../../types';\nimport { overrideVarName } from '../getters';\nimport { getMockScalar } from '../getters/scalar';\n\nconst isRegex = (key: string) => key.startsWith('/') && key.endsWith('/');\n\nexport const resolveMockOverride = (\n properties: Record<string, unknown> | undefined = {},\n item: SchemaObject & { name: string; path?: string },\n) => {\n const path = item.path ? item.path : `#.${item.name}`;\n const property = Object.entries(properties).find(([key]) => {\n if (isRegex(key)) {\n const regex = new RegExp(key.slice(1, -1));\n if (regex.test(item.name) || regex.test(path)) {\n return true;\n }\n }\n\n if (`#.${key}` === path) {\n return true;\n }\n\n return false;\n });\n\n if (!property) {\n return;\n }\n\n return {\n value: getNullable(property[1] as string, item.nullable),\n imports: [],\n name: item.name,\n overrided: true,\n };\n};\n\nexport const getNullable = (value: string, nullable?: boolean) =>\n nullable ? `faker.helpers.arrayElement([${value}, null])` : value;\n\nexport const resolveMockValue = ({\n schema,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n allowOverride,\n}: {\n schema: MockSchemaObject;\n operationId: string;\n mockOptions?: MockOptions;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpecs;\n imports: GeneratorImport[];\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n splitMockImplementations: string[];\n allowOverride?: boolean;\n}): MockDefinition & { type?: string } => {\n if (isReference(schema)) {\n const {\n originalName,\n specKey = context.specKey,\n refPaths,\n } = getRefInfo(schema.$ref, context);\n\n const schemaRef = Array.isArray(refPaths)\n ? (refPaths.reduce(\n (obj, key) =>\n obj && typeof obj === 'object'\n ? (obj as Record<string, any>)[key]\n : undefined,\n context.specs[specKey],\n ) as Partial<SchemaObject>)\n : undefined;\n\n const newSchema = {\n ...schemaRef,\n name: pascal(originalName),\n path: schema.path,\n isRef: true,\n required: [...(schemaRef?.required ?? []), ...(schema?.required ?? [])],\n };\n\n const newSeparator = newSchema.allOf\n ? 'allOf'\n : newSchema.oneOf\n ? 'oneOf'\n : 'anyOf';\n\n const scalar = getMockScalar({\n item: newSchema,\n mockOptions,\n operationId,\n tags,\n combine: combine\n ? {\n separator:\n combine.separator === 'anyOf' ? newSeparator : combine.separator,\n includedProperties:\n newSeparator === 'allOf' ? [] : combine.includedProperties,\n }\n : undefined,\n context: {\n ...context,\n specKey,\n },\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n allowOverride,\n });\n if (\n scalar.value &&\n (newSchema.type === 'object' || newSchema.allOf) &&\n combine?.separator === 'oneOf'\n ) {\n const funcName = `get${pascal(operationId)}Response${pascal(newSchema.name)}Mock`;\n if (\n !splitMockImplementations?.some((f) =>\n f.includes(`export const ${funcName}`),\n )\n ) {\n const discriminatedProperty = newSchema.discriminator?.propertyName;\n\n let type = `Partial<${newSchema.name}>`;\n if (discriminatedProperty) {\n type = `Omit<${type}, '${discriminatedProperty}'>`;\n }\n\n const args = `${overrideVarName}: ${type} = {}`;\n const func = `export const ${funcName} = (${args}): ${newSchema.name} => ({${scalar.value.startsWith('...') ? '' : '...'}${scalar.value}, ...${overrideVarName}});`;\n splitMockImplementations?.push(func);\n }\n\n scalar.value = newSchema.nullable\n ? `${funcName}()`\n : `{...${funcName}()}`;\n\n scalar.imports.push({\n name: newSchema.name,\n specKey: isRootKey(specKey, context.target) ? undefined : specKey,\n });\n }\n\n return {\n ...scalar,\n type: getType(newSchema),\n };\n }\n\n const scalar = getMockScalar({\n item: schema,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n allowOverride,\n });\n return {\n ...scalar,\n type: getType(schema),\n };\n};\n\nconst getType = (schema: MockSchemaObject) => {\n return (\n (schema.type as string | undefined) ??\n (schema.properties ? 'object' : schema.items ? 'array' : undefined)\n );\n};\n","import {\n type ContextSpecs,\n type GeneratorImport,\n isReference,\n isSchema,\n type MockOptions,\n pascal,\n} from '@orval/core';\n\nimport type { MockDefinition, MockSchemaObject } from '../../types';\nimport { resolveMockValue } from '../resolvers';\n\nexport const combineSchemasMock = ({\n item,\n separator,\n mockOptions,\n operationId,\n tags,\n combine,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n}: {\n item: MockSchemaObject;\n separator: 'allOf' | 'oneOf' | 'anyOf';\n operationId: string;\n mockOptions?: MockOptions;\n tags: string[];\n combine?: {\n separator: 'allOf' | 'oneOf' | 'anyOf';\n includedProperties: string[];\n };\n context: ContextSpecs;\n imports: GeneratorImport[];\n // This is used to prevent recursion when combining schemas\n // When an element is added to the array, it means on this iteration, we've already seen this property\n existingReferencedProperties: string[];\n splitMockImplementations: string[];\n}): MockDefinition => {\n const combineImports: GeneratorImport[] = [];\n const includedProperties: string[] = [...(combine?.includedProperties ?? [])];\n\n const isRefAndNotExisting =\n isReference(item) && !existingReferencedProperties.includes(item.name);\n\n const itemResolvedValue =\n isRefAndNotExisting || item.properties\n ? resolveMockValue({\n schema: Object.fromEntries(\n Object.entries(item).filter(([key]) => key !== separator),\n ) as MockSchemaObject,\n combine: {\n separator: 'allOf',\n includedProperties: [],\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n })\n : undefined;\n\n includedProperties.push(...(itemResolvedValue?.includedProperties ?? []));\n combineImports.push(...(itemResolvedValue?.imports ?? []));\n let containsOnlyPrimitiveValues = true;\n\n const value = (item[separator] ?? []).reduce(\n (acc, val, _, arr) => {\n if (\n '$ref' in val &&\n existingReferencedProperties.includes(\n pascal(val.$ref.split('/').pop()!),\n )\n ) {\n if (arr.length === 1) {\n return 'undefined';\n }\n\n return acc;\n }\n\n // the required fields in this schema need to be considered\n // in the sub schema under the allOf key\n if (separator === 'allOf' && item.required) {\n val =\n isSchema(val) && val.required\n ? { ...val, required: [...item.required, ...val.required] }\n : { ...val, required: item.required };\n }\n\n const resolvedValue = resolveMockValue({\n schema: {\n ...val,\n name: item.name,\n path: item.path ? item.path : '#',\n },\n combine: {\n separator,\n includedProperties:\n separator === 'oneOf'\n ? (itemResolvedValue?.includedProperties ?? [])\n : includedProperties,\n },\n mockOptions,\n operationId,\n tags,\n context,\n imports,\n existingReferencedProperties,\n splitMockImplementations,\n });\n\n combineImports.push(...resolvedValue.imports);\n includedProperties.push(...(resolvedValue.includedProperties ?? []));\n\n if (resolvedValue.value === '{}') {\n containsOnlyPrimitiveValues = false;\n return acc;\n }\n if (separator === 'allOf') {\n if (resolvedValue.value.startsWith('{') || !resolvedValue.type) {\n containsOnlyPrimitiveValues = false;\n return `${acc}...${resolvedValue.value},`;\n } else if (resolvedValue.type === 'object') {\n containsOnlyPrimitiveValues = false;\n return resolvedValue.value.startsWith('faker')\n ? `${acc}...${resolvedValue.value},`\n : `${acc}...{${resolvedValue.value}},`;\n }\n }\n return `${acc}${resolvedValue.value},`;\n },\n separator === 'allOf' ? '' : 'faker.helpers.arrayElement([',\n );\n let finalValue =\n value === 'undefined'\n ? value\n : `${separator === 'allOf' && !containsOnlyPrimitiveValues ? '{' : ''}${value}${separator === 'allOf' ? (containsOnlyPrimitiveValues ? '' : '}') : '])'}`;\n if (itemResolvedValue) {\n finalValue = finalValue.startsWith('...')\n ? `...{${finalValue}, ${itemResolvedValue.value}}`\n : `{...${finalValue}, ${itemResolvedValue.value}}`;\n }\n if (finalValue.endsWith(',')) {\n finalValue = finalValue.slice(0, Math.max(0, finalValue.length - 1));\n }\n\n return {\n value: finalValue,\n imports: combineImports,\n name: item.name,\n includedProperties,\n };\n};\n","import { camel, sanitize } from '@orval/core';\n\nconst hasParam = (path: string): boolean => /[^{]*{[\\w*_-]*}.*/.test(path);\n\nconst getRoutePath = (path: string): string => {\n const matches = /([^{]*){?([\\w*_-]*)}?(.*)/.exec(path);\n if (!matches?.length) return path; // impossible due to regexp grouping here, but for TS\n\n const prev = matches[1];\n const param = sanitize(camel(matches[2]), {\n es5keyword: true,\n underscore: true,\n dash: true,\n dot: true,\n });\n const next = hasParam(matches[3]) ? getRoutePath(matches[3]) : matches[3];\n\n return hasParam(path) ? `${prev}:${param}${next}` : `${prev}${param}${next}`;\n};\n\nexport const getRouteMSW = (route: string, baseUrl = '*') => {\n route = route.replaceAll(':', '\\\\\\:');\n const splittedRoute = route.split('/');\n\n return splittedRoute.reduce((acc, path, i) => {\n if (!path && !i) {\n return acc;\n }\n\n if (!path.includes('{')) {\n return `${acc}/${path}`;\n }\n\n return `${acc}/${getRoutePath(path)}`;\n }, baseUrl);\n};\n","import {\n type ContextSpecs,\n generalJSTypesWithArray,\n type GeneratorImport,\n type GlobalMockOptions,\n isFunction,\n type MockOptions,\n type NormalizedOverrideOutput,\n resolveRef,\n type ResReqTypesValue,\n stringify,\n} from '@orval/core';\nimport type { OpenAPIObject, SchemaObject } from 'openapi3-ts/oas30';\n\nimport { getMockScalar } from '../faker/getters';\n\nconst getMockPropertiesWithoutFunc = (properties: any, spec: OpenAPIObject) =>\n Object.entries(isFunction(properties) ? properties(spec) : properties).reduce<\n Record<string, string>\n >((acc, [key, value]) => {\n const implementation = isFunction(value)\n ? `(${value})()`\n : stringify(value as string)!;\n\n acc[key] = implementation?.replaceAll(\n /import_faker.defaults|import_faker.faker/g,\n 'faker',\n );\n return acc;\n }, {});\n\nconst getMockWithoutFunc = (\n spec: OpenAPIObject,\n override?: NormalizedOverrideOutput,\n): MockOptions => ({\n arrayMin: override?.mock?.arrayMin,\n arrayMax: override?.mock?.arrayMax,\n stringMin: override?.mock?.stringMin,\n stringMax: override?.mock?.stringMax,\n numberMin: override?.mock?.numberMin,\n numberMax: override?.mock?.numberMax,\n required: override?.mock?.required,\n fractionDigits: override?.mock?.fractionDigits,\n ...(override?.mock?.properties\n ? {\n properties: getMockPropertiesWithoutFunc(\n override.mock.properties,\n spec,\n ),\n }\n : {}),\n ...(override?.mock?.format\n ? {\n format: getMockPropertiesWithoutFunc(override.mock.format, spec),\n }\n : {}),\n ...(override?.operations\n ? {\n operations: Object.entries(override.operations).reduce<\n Exclude<MockOptions['operations'], undefined>\n >((acc, [key, value]) => {\n if (value.mock?.properties) {\n acc[key] = {\n properties: getMockPropertiesWithoutFunc(\n value.mock.properties,\n spec,\n ),\n };\n }\n\n return acc;\n }, {}),\n }\n : {}),\n ...(override?.tags\n ? {\n tags: Object.entries(override.tags).reduce<\n Exclude<MockOptions['tags'], undefined>\n >((acc, [key, value]) => {\n if (value.mock?.properties) {\n acc[key] = {\n properties: getMockPropertiesWithoutFunc(\n value.mock.properties,\n spec,\n ),\n };\n }\n\n return acc;\n }, {}),\n }\n : {}),\n});\n\nconst getMockScalarJsTypes = (\n definition: string,\n mockOptionsWithoutFunc: Record<string, unknown>,\n) => {\n const isArray = definition.endsWith('[]');\n const type = isArray ? definition.slice(0, -2) : definition;\n\n switch (type) {\n case 'number': {\n return isArray\n ? `Array.from({length: faker.number.int({` +\n `min: ${mockOptionsWithoutFunc.arrayMin}, ` +\n `max: ${mockOptionsWithoutFunc.arrayMax}}` +\n `)}, () => faker.number.int())`\n : 'faker.number.int()';\n }\n case 'string': {\n return isArray\n ? `Array.from({length: faker.number.int({` +\n `min: ${mockOptionsWithoutFunc?.arrayMin},` +\n `max: ${mockOptionsWithoutFunc?.arrayMax}}` +\n `)}, () => faker.word.sample())`\n : 'faker.word.sample()';\n }\n default: {\n return 'undefined';\n }\n }\n};\n\nexport const getResponsesMockDefinition = ({\n operationId,\n tags,\n returnType,\n responses,\n imports: responseImports,\n mockOptionsWithoutFunc,\n transformer,\n context,\n mockOptions,\n splitMockImplementations,\n}: {\n operationId: string;\n tags: string[];\n returnType: string;\n responses: ResReqTypesValue[];\n imports: GeneratorImport[];\n mockOptionsWithoutFunc: Record<string, unknown>;\n transformer?: (value: unknown, definition: string) => string;\n context: ContextSpecs;\n mockOptions?: GlobalMockOptions;\n splitMockImplementations: string[];\n}) => {\n return responses.reduce(\n (\n acc,\n { value: definition, originalSchema, example, examples, imports, isRef },\n ) => {\n if (\n context.output.override?.mock?.useExamples ||\n mockOptions?.useExamples\n ) {\n let exampleValue =\n example ||\n originalSchema?.example ||\n Object.values(examples || {})[0] ||\n originalSchema?.examples?.[0];\n exampleValue = exampleValue?.value ?? exampleValue;\n if (exampleValue) {\n acc.definitions.push(\n transformer\n ? transformer(exampleValue, returnType)\n : JSON.stringify(exampleValue),\n );\n return acc;\n }\n }\n if (!definition || generalJSTypesWithArray.includes(definition)) {\n const value = getMockScalarJsTypes(definition, mockOptionsWithoutFunc);\n\n acc.definitions.push(\n transformer ? transformer(value, returnType) : value,\n );\n\n return acc;\n }\n\n if (!originalSchema) {\n return acc;\n }\n\n const resolvedRef = resolveRef<SchemaObject>(originalSchema, context);\n\n const scalar = getMockScalar({\n item: {\n name: definition,\n ...resolvedRef.schema,\n },\n imports,\n mockOptions: mockOptionsWithoutFunc,\n operationId,\n tags,\n context: isRef\n ? {\n ...context,\n specKey: responseImports[0]?.specKey ?? context.specKey,\n }\n : context,\n existingReferencedProperties: [],\n splitMockImplementations,\n allowOverride: true,\n });\n\n acc.imports.push(...scalar.imports);\n acc.definitions.push(\n transformer\n ? transformer(scalar.value, returnType)\n : scalar.value.toString(),\n );\n\n return acc;\n },\n {\n definitions: [] as string[],\n imports: [] as GeneratorImport[],\n },\n );\n};\n\nexport const getMockDefinition = ({\n operationId,\n tags,\n returnType,\n responses,\n imports: responseImports,\n override,\n transformer,\n context,\n mockOptions,\n splitMockImplementations,\n}: {\n operationId: string;\n tags: string[];\n returnType: string;\n responses: ResReqTypesValue[];\n imports: GeneratorImport[];\n override: NormalizedOverrideOutput;\n transformer?: (value: unknown, definition: string) => string;\n context: ContextSpecs;\n mockOptions?: GlobalMockOptions;\n splitMockImplementations: string[];\n}) => {\n const mockOptionsWithoutFunc = getMockWithoutFunc(\n context.specs[context.specKey],\n override,\n );\n\n const { definitions, imports } = getResponsesMockDefinition({\n operationId,\n tags,\n returnType,\n responses,\n imports: responseImports,\n mockOptionsWithoutFunc,\n transformer,\n context,\n mockOptions,\n splitMockImplementations,\n });\n\n return {\n definition: '[' + definitions.join(', ') + ']',\n definitions,\n imports,\n };\n};\n\nexport const getMockOptionsDataOverride = (\n operationTags: string[],\n operationId: string,\n override: NormalizedOverrideOutput,\n) => {\n const responseOverride =\n override?.operations?.[operationId]?.mock?.data ||\n operationTags\n .map((operationTag) => override?.tags?.[operationTag]?.mock?.data)\n .find((e) => e !== undefined);\n const implementation = isFunction(responseOverride)\n ? `(${responseOverride})()`\n : stringify(responseOverride);\n\n return implementation?.replaceAll(\n /import_faker.defaults|import_faker.faker/g,\n 'faker',\n );\n};\n","import {\n type ClientMockGeneratorBuilder,\n generateDependencyImports,\n type GenerateMockImports,\n type GeneratorDependency,\n type GeneratorImport,\n type GeneratorOptions,\n type GeneratorVerbOptions,\n type GlobalMockOptions,\n isFunction,\n isObject,\n pascal,\n type ResReqTypesValue,\n} from '@orval/core';\n\nimport { getDelay } from '../delay';\nimport { getRouteMSW, overrideVarName } from '../faker/getters';\nimport { getMockDefinition, getMockOptionsDataOverride } from './mocks';\n\nconst getMSWDependencies = (\n options?: GlobalMockOptions,\n): GeneratorDependency[] => {\n const hasDelay = options?.delay !== false;\n const locale = options?.locale;\n\n const exports = [\n { name: 'http', values: true },\n { name: 'HttpResponse', values: true },\n { name: 'RequestHandlerOptions', values: false },\n ];\n\n if (hasDelay) {\n exports.push({ name: 'delay', values: true });\n }\n\n return [\n { exports, dependency: 'msw' },\n {\n exports: [{ name: 'faker', values: true }],\n dependency: locale\n ? `@faker-js/faker/locale/${locale}`\n : '@faker-js/faker',\n },\n ];\n};\n\nexport const generateMSWImports: GenerateMockImports = ({\n implementation,\n imports,\n specsName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n options,\n}) => {\n return generateDependencyImports(\n implementation,\n [...getMSWDependencies(options), ...imports],\n specsName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n );\n};\n\nconst generateDefinition = (\n name: string,\n route: string,\n getResponseMockFunctionNameBase: string,\n handlerNameBase: string,\n { operationId, response, verb, tags }: GeneratorVerbOptions,\n { override, context, mock }: GeneratorOptions,\n returnType: string,\n status: string,\n responseImports: GeneratorImport[],\n responses: ResReqTypesValue[],\n contentTypes: string[],\n splitMockImplementations: string[],\n) => {\n const oldSplitMockImplementations = [...splitMockImplementations];\n const { definitions, definition, imports } = getMockDefinition({\n operationId,\n tags,\n returnType,\n responses,\n imports: responseImports,\n override,\n context,\n mockOptions: isFunction(mock) ? undefined : mock,\n splitMockImplementations,\n });\n\n const mockData = getMockOptionsDataOverride(tags, operationId, override);\n\n let value = '';\n\n if (mockData) {\n value = mockData;\n } else if (definitions.length > 1) {\n value = `faker.helpers.arrayElement(${definition})`;\n } else if (definitions[0]) {\n value = definitions[0];\n }\n\n const isResponseOverridable = value.includes(overrideVarName);\n const isTextPlain = contentTypes.includes('text/plain');\n const isReturnHttpResponse = value && value !== 'undefined';\n\n const getResponseMockFunctionName = `${getResponseMockFunctionNameBase}${pascal(\n name,\n )}`;\n const handlerName = `${handlerNameBase}${pascal(name)}`;\n\n const addedSplitMockImplementations = splitMockImplementations.slice(\n oldSplitMockImplementations.length,\n );\n splitMockImplementations.push(...addedSplitMockImplementations);\n const mockImplementations =\n addedSplitMockImplementations.length > 0\n ? `${addedSplitMockImplementations.join('\\n\\n')}\\n\\n`\n : '';\n\n const mockImplementation = isReturnHttpResponse\n ? `${mockImplementations}export const ${getResponseMockFunctionName} = (${\n isResponseOverridable\n ? `overrideResponse: Partial< ${returnType} > = {}`\n : ''\n })${mockData ? '' : `: ${returnType}`} => (${value})\\n\\n`\n : mockImplementations;\n\n const delay = getDelay(override, isFunction(mock) ? undefined : mock);\n const infoParam = 'info';\n const overrideResponse = `overrideResponse !== undefined\n ? (typeof overrideResponse === \"function\" ? await overrideResponse(${infoParam}) : overrideResponse)\n : ${getResponseMockFunctionName}()`;\n const handlerImplementation = `\nexport const ${handlerName} = (overrideResponse?: ${returnType} | ((${infoParam}: Parameters<Parameters<typeof http.${verb}>[1]>[0]) => Promise<${returnType}> | ${returnType}), options?: RequestHandlerOptions) => {\n return http.${verb}('${route}', async (${infoParam}) => {${\n delay === false\n ? ''\n : `await delay(${isFunction(delay) ? `(${delay})()` : delay});`\n }\n ${isReturnHttpResponse ? '' : `if (typeof overrideResponse === 'function') {await overrideResponse(info); }`}\n return new HttpResponse(${\n isReturnHttpResponse\n ? isTextPlain\n ? overrideResponse\n : `JSON.stringify(${overrideResponse})`\n : null\n },\n { status: ${status === 'default' ? 200 : status.replace(/XX$/, '00')},\n ${\n isReturnHttpResponse\n ? `headers: { 'Content-Type': ${isTextPlain ? \"'text/plain'\" : \"'application/json'\"} }`\n : ''\n }\n })\n }, options)\n}\\n`;\n\n const includeResponseImports = isTextPlain\n ? imports\n : [\n ...imports,\n ...response.imports.filter((r) => {\n // Only include imports which are actually used in mock.\n const reg = new RegExp(`\\\\b${r.name}\\\\b`);\n return (\n reg.test(handlerImplementation) || reg.test(mockImplementation)\n );\n }),\n ];\n\n return {\n implementation: {\n function: mockImplementation,\n handlerName: handlerName,\n handler: handlerImplementation,\n },\n imports: includeResponseImports,\n };\n};\n\nexport const generateMSW = (\n generatorVerbOptions: GeneratorVerbOptions,\n generatorOptions: GeneratorOptions,\n): ClientMockGeneratorBuilder => {\n const { pathRoute, override, mock } = generatorOptions;\n const { operationId, response } = generatorVerbOptions;\n\n const route = getRouteMSW(\n pathRoute,\n override?.mock?.baseUrl ?? (isFunction(mock) ? undefined : mock?.baseUrl),\n );\n\n const handlerName = `get${pascal(operationId)}MockHandler`;\n const getResponseMockFunctionName = `get${pascal(operationId)}ResponseMock`;\n\n const splitMockImplementations: string[] = [];\n\n const baseDefinition = generateDefinition(\n '',\n route,\n getResponseMockFunctionName,\n handlerName,\n generatorVerbOptions,\n generatorOptions,\n response.definition.success,\n response.types.success[0]?.key ?? '200',\n response.imports,\n response.types.success,\n response.contentTypes,\n splitMockImplementations,\n );\n\n const mockImplementations = [baseDefinition.implementation.function];\n const handlerImplementations = [baseDefinition.implementation.handler];\n const imports = [...baseDefinition.imports];\n\n if (\n generatorOptions.mock &&\n isObject(generatorOptions.mock) &&\n generatorOptions.mock.generateEachHttpStatus\n ) {\n for (const statusResponse of [\n ...response.types.success,\n ...response.types.errors,\n ]) {\n const definition = generateDefinition(\n statusResponse.key,\n route,\n getResponseMockFunctionName,\n handlerName,\n generatorVerbOptions,\n generatorOptions,\n statusResponse.value,\n statusResponse.key,\n response.imports,\n [statusResponse],\n [statusResponse.contentType],\n splitMockImplementations,\n );\n mockImplementations.push(definition.implementation.function);\n handlerImplementations.push(definition.implementation.handler);\n imports.push(...definition.imports);\n }\n }\n\n return {\n implementation: {\n function: mockImplementations.join('\\n'),\n handlerName: handlerName,\n handler: handlerImplementations.join('\\n'),\n },\n imports: imports,\n };\n};\n","import type {\n GenerateMockImports,\n GeneratorOptions,\n GeneratorVerbOptions,\n GlobalMockOptions,\n} from '@orval/core';\n\nimport { generateMSW, generateMSWImports } from './msw';\n\nexport const DEFAULT_MOCK_OPTIONS: GlobalMockOptions = {\n type: 'msw',\n useExamples: false,\n};\n\nexport const generateMockImports: GenerateMockImports = (importOptions) => {\n switch (importOptions.options?.type) {\n default: {\n // case 'msw':\n return generateMSWImports(importOptions);\n }\n }\n};\n\nexport const generateMock = (\n generatorVerbOptions: GeneratorVerbOptions,\n generatorOptions: Omit<GeneratorOptions, 'mock'> & {\n mock: GlobalMockOptions;\n },\n) => {\n switch (generatorOptions.mock.type) {\n default: {\n // case 'msw':\n return generateMSW(generatorVerbOptions, generatorOptions);\n }\n }\n};\n"],"mappings":";;;AAEA,MAAa,YACX,UACA,YAC+B;CAC/B,MAAM,gBACJ,UAAU,MAAM,UAAU,SACtB,SAAS,QACT,UAAU,MAAM;CACtB,MAAM,2BACJ,UAAU,MAAM,4BAChB,SAAS;AACX,SAAQ,OAAO,eAAf;EACE,KAAK,WACH,QAAO,2BAA2B,gBAAgB,eAAe;EAEnE,KAAK;EACL,KAAK,UACH,QAAO;EAET,QACE,QAAO;;;;;;ACpBb,MAAM,0BAA0B,gBAA6B;AAC3D,QACE,YAAY,eAAe,sBAC3B,YAAY,kBAAkB,sBAC9B,YAAY,mBAAmB;;AAInC,MAA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,yBAAuB,KAAK,WAAW,eAAe,QAAQ;AAC9D,UAAQ,KAAK,GAAG,WAAW,QAAQ;;AAIvC,QAAO;EACL,gBAAgB;GACd,UAAU,oBAAoB,KAAK,KAAK;GAC3B;GACb,SAAS,uBAAuB,KAAK,KAAK;GAC3C;EACQ;EACV;;;;;ACpPH,MAAaC,uBAA0C;CACrD,MAAM;CACN,aAAa;CACd;AAED,MAAaC,uBAA4C,kBAAkB;AACzE,SAAQ,cAAc,SAAS,MAA/B;EACE,QAEE,QAAO,mBAAmB,cAAc;;;AAK9C,MAAa,gBACX,sBACA,qBAGG;AACH,SAAQ,iBAAiB,KAAK,MAA9B;EACE,QAEE,QAAO,YAAY,sBAAsB,iBAAiB"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orval/mock",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-rc.0",
|
|
4
4
|
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"exports": {
|
|
6
|
-
"
|
|
7
|
+
"import": {
|
|
7
8
|
"types": "./dist/index.d.ts",
|
|
8
|
-
"
|
|
9
|
+
"import": "./dist/index.js"
|
|
9
10
|
}
|
|
10
11
|
},
|
|
11
12
|
"files": [
|
|
@@ -21,14 +22,15 @@
|
|
|
21
22
|
"nuke": "rimraf .turbo dist node_modules"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
|
-
"@orval/core": "
|
|
25
|
+
"@orval/core": "8.0.0-rc.0",
|
|
25
26
|
"openapi3-ts": "4.5.0"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
|
-
"eslint": "^9.
|
|
29
|
+
"eslint": "^9.38.0",
|
|
29
30
|
"rimraf": "^6.0.1",
|
|
30
|
-
"tsdown": "^0.15.
|
|
31
|
-
"typescript": "^5.9.
|
|
32
|
-
"vitest": "^
|
|
33
|
-
}
|
|
31
|
+
"tsdown": "^0.15.9",
|
|
32
|
+
"typescript": "^5.9.3",
|
|
33
|
+
"vitest": "^4.0.3"
|
|
34
|
+
},
|
|
35
|
+
"stableVersion": "7.15.0"
|
|
34
36
|
}
|