ts-openapi-codegen 2.0.0-beta.11 → 2.0.0-beta.13
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/cli/index.js +2 -3
- package/dist/cli/previewChanges/previewChanges.d.ts.map +1 -1
- package/dist/cli/previewChanges/previewChanges.js +112 -32
- package/dist/cli/previewChanges/utils/updateOutputPaths.d.ts.map +1 -1
- package/dist/cli/previewChanges/utils/updateOutputPaths.js +6 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.js +6 -6
- package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.js +13 -0
- package/dist/common/VersionedSchema/Utils/__tests__/allUtils.test.d.ts +2 -0
- package/dist/common/VersionedSchema/Utils/__tests__/allUtils.test.d.ts.map +1 -0
- package/dist/common/VersionedSchema/Utils/__tests__/allUtils.test.js +185 -0
- package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.js +20 -3
- package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.js +18 -0
- package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts +4 -0
- package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.js +68 -23
- package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.d.ts +1 -1
- package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.js +1 -1
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts +10 -0
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +31 -14
- package/dist/core/types/base/Templates.model.d.ts +1 -1
- package/dist/core/types/base/Templates.model.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarTemplates.js +42 -41
- package/dist/templatesCompiled/client/exportClient.js +1 -1
- package/dist/templatesCompiled/client/exportSchema.d.ts +5 -1
- package/dist/templatesCompiled/client/exportSchema.d.ts.map +1 -1
- package/dist/templatesCompiled/client/exportSchema.js +37 -7
- package/dist/templatesCompiled/client/joi/exportSchema.js +3 -3
- package/dist/templatesCompiled/client/joi/partials/joiSchema.js +7 -7
- package/dist/templatesCompiled/client/joi/partials/joiSchemaComposition.js +4 -4
- package/dist/templatesCompiled/client/joi/partials/joiSchemaInterface.js +3 -3
- package/dist/templatesCompiled/client/jsonschema/exportSchema.js +3 -3
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchema.js +7 -7
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaArray.js +5 -5
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaComposition.js +2 -2
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaDictionary.js +5 -5
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface.js +2 -2
- package/dist/templatesCompiled/client/yup/exportSchema.js +1 -1
- package/dist/templatesCompiled/client/yup/partials/yupSchema.js +7 -7
- package/dist/templatesCompiled/client/yup/partials/yupSchemaComposition.js +4 -4
- package/dist/templatesCompiled/client/yup/partials/yupSchemaInterface.js +3 -3
- package/dist/templatesCompiled/client/zod/exportSchema.js +1 -1
- package/dist/templatesCompiled/client/zod/partials/zodSchema.js +7 -7
- package/dist/templatesCompiled/client/zod/partials/zodSchemaArray.js +8 -8
- package/dist/templatesCompiled/client/zod/partials/zodSchemaComposition.js +9 -9
- package/dist/templatesCompiled/client/zod/partials/zodSchemaDictionary.js +4 -4
- package/dist/templatesCompiled/client/zod/partials/zodSchemaInterface.js +3 -3
- package/package.json +2 -2
|
@@ -4,38 +4,83 @@ exports.determineBestMatchingSchemaVersion = determineBestMatchingSchemaVersion;
|
|
|
4
4
|
const validateZodOptions_1 = require("../../Validation/validateZodOptions");
|
|
5
5
|
const getUniqueKeysFromSchemas_1 = require("./getUniqueKeysFromSchemas");
|
|
6
6
|
const getUniqueObjectKeys_1 = require("./getUniqueObjectKeys");
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Counts unknown keys using a strict schema variant.
|
|
9
|
+
* The strict check is used only for ranking candidates, not for final validation.
|
|
10
|
+
*/
|
|
11
|
+
function getStrictUnrecognizedKeyCount(schema, inputData) {
|
|
12
|
+
const strictResult = (0, validateZodOptions_1.validateZodOptionsRaw)(schema.strict(), inputData);
|
|
13
|
+
if (strictResult.success) {
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
return strictResult.error.issues.reduce((count, issue) => {
|
|
17
|
+
if (issue.code !== 'unrecognized_keys' || !('keys' in issue)) {
|
|
18
|
+
return count;
|
|
19
|
+
}
|
|
20
|
+
return count + issue.keys.length;
|
|
21
|
+
}, 0);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Compares two schema candidates and returns the better one.
|
|
25
|
+
* Priority:
|
|
26
|
+
* 1) fewer structural errors;
|
|
27
|
+
* 2) fewer strict-mode unknown keys;
|
|
28
|
+
* 3) more matching keys;
|
|
29
|
+
* 4) newer version inside the same schema family;
|
|
30
|
+
* 5) lower index when schema families differ.
|
|
31
|
+
*/
|
|
32
|
+
function compareCandidates(best, current) {
|
|
33
|
+
if (current.structuralErrorCount !== best.structuralErrorCount) {
|
|
34
|
+
return current.structuralErrorCount < best.structuralErrorCount ? current : best;
|
|
35
|
+
}
|
|
36
|
+
if (current.strictUnrecognizedKeyCount !== best.strictUnrecognizedKeyCount) {
|
|
37
|
+
return current.strictUnrecognizedKeyCount < best.strictUnrecognizedKeyCount ? current : best;
|
|
38
|
+
}
|
|
39
|
+
if (current.matchingKeysCount !== best.matchingKeysCount) {
|
|
40
|
+
return current.matchingKeysCount > best.matchingKeysCount ? current : best;
|
|
41
|
+
}
|
|
42
|
+
if (current.type === best.type) {
|
|
43
|
+
return current.index > best.index ? current : best;
|
|
44
|
+
}
|
|
45
|
+
return current.index < best.index ? current : best;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Determines the best matching schema version for input data.
|
|
49
|
+
* `invalid_value` issues are intentionally ignored to allow migration from older enum/value variants.
|
|
50
|
+
*/
|
|
8
51
|
function determineBestMatchingSchemaVersion(inputData, versionedSchemas) {
|
|
9
52
|
if (!versionedSchemas.length) {
|
|
10
53
|
throw new Error('The list of schemes cannot be empty');
|
|
11
54
|
}
|
|
12
55
|
const inputKeys = (0, getUniqueObjectKeys_1.getUniqueObjectKeys)(inputData);
|
|
13
|
-
const
|
|
14
|
-
|
|
56
|
+
const schemaMatches = versionedSchemas.map(({ schema, baseSchema, version, type }, idx) => {
|
|
57
|
+
const schemaKeys = (0, getUniqueKeysFromSchemas_1.getUniqueKeysFromSchemas)([schema]);
|
|
58
|
+
const matchingKeysCount = inputKeys.filter(key => schemaKeys.has(key)).length;
|
|
59
|
+
const strictUnrecognizedKeyCount = getStrictUnrecognizedKeyCount(baseSchema, inputData);
|
|
15
60
|
const validationResult = (0, validateZodOptions_1.validateZodOptionsRaw)(schema, inputData);
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
.filter((match) => match !== null);
|
|
20
|
-
if (matchingSchemas.length > 0) {
|
|
21
|
-
const latestMatch = matchingSchemas.reduce((prev, curr) => (curr.index > prev.index ? curr : prev));
|
|
61
|
+
const structuralErrorCount = !validationResult.success
|
|
62
|
+
? validationResult.error.issues.filter(issue => issue.code !== 'invalid_value').length
|
|
63
|
+
: 0;
|
|
22
64
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
65
|
+
index: idx,
|
|
66
|
+
version,
|
|
67
|
+
type,
|
|
68
|
+
structuralErrorCount,
|
|
69
|
+
strictUnrecognizedKeyCount,
|
|
70
|
+
matchingKeysCount,
|
|
26
71
|
};
|
|
27
|
-
}
|
|
28
|
-
const schemaMatches = versionedSchemas.map(({ schema, version }, idx) => {
|
|
29
|
-
const schemaKeys = (0, getUniqueKeysFromSchemas_1.getUniqueKeysFromSchemas)([schema]);
|
|
30
|
-
const validationResult = (0, validateZodOptions_1.validateZodOptionsRaw)(schema, inputData);
|
|
31
|
-
const errorFields = !validationResult.success ? validationResult.error.issues.filter(err => err.code !== 'invalid_value') : [];
|
|
32
|
-
const matchingKeys = inputKeys.filter(key => schemaKeys.has(key));
|
|
33
|
-
return { index: idx, version, errorFields, matchingKeys };
|
|
34
72
|
});
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
73
|
+
const structurallyValidMatches = schemaMatches.filter(match => match.structuralErrorCount === 0);
|
|
74
|
+
if (structurallyValidMatches.length > 0) {
|
|
75
|
+
const bestStructurallyValidMatch = structurallyValidMatches.reduce(compareCandidates);
|
|
76
|
+
const firstVersion = structurallyValidMatches.reduce((earliest, current) => (current.index < earliest.index ? current : earliest)).version;
|
|
77
|
+
return {
|
|
78
|
+
lastVersionIndex: bestStructurallyValidMatch.index,
|
|
79
|
+
latestVersion: bestStructurallyValidMatch.version,
|
|
80
|
+
firstVersion,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const bestMatch = schemaMatches.reduce(compareCandidates);
|
|
39
84
|
return {
|
|
40
85
|
lastVersionIndex: bestMatch.index,
|
|
41
86
|
latestVersion: bestMatch.version,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
3
|
* Get all the unique parameter keys of all Joi schemes in the array
|
|
4
|
-
* @param schemas array of
|
|
4
|
+
* @param schemas array of zod schemes
|
|
5
5
|
* @returns All the unique parameter keys of all Joi schemes in the array
|
|
6
6
|
*/
|
|
7
7
|
export declare function getUniqueKeysFromSchemas(schemas: z.ZodTypeAny[]): Set<string>;
|
|
@@ -18,7 +18,7 @@ function collectKeys(schema, result) {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Get all the unique parameter keys of all Joi schemes in the array
|
|
21
|
-
* @param schemas array of
|
|
21
|
+
* @param schemas array of zod schemes
|
|
22
22
|
* @returns All the unique parameter keys of all Joi schemes in the array
|
|
23
23
|
*/
|
|
24
24
|
function getUniqueKeysFromSchemas(schemas) {
|
|
@@ -2,18 +2,28 @@ import { z } from 'zod';
|
|
|
2
2
|
import { EMigrationMode } from '../../Enums';
|
|
3
3
|
import { EVersionedSchemaType } from '../Enums';
|
|
4
4
|
import { SchemaMigrationPlan, VersionedSchema, VersionMatchResult } from '../Types';
|
|
5
|
+
/**
|
|
6
|
+
* Input arguments for migrating arbitrary config data to the latest schema version.
|
|
7
|
+
*/
|
|
5
8
|
type MigrateToLatestProps = {
|
|
6
9
|
rawInput: Record<string, any>;
|
|
7
10
|
migrationPlans: SchemaMigrationPlan<Record<string, any>, Record<string, any>>[];
|
|
8
11
|
versionedSchemas: VersionedSchema<z.ZodTypeAny>[];
|
|
9
12
|
migrationMode: EMigrationMode;
|
|
10
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Result of successful migration to the latest schema.
|
|
16
|
+
*/
|
|
11
17
|
type MigrateToLatestResult = {
|
|
12
18
|
value: Record<string, any>;
|
|
13
19
|
guessedVersion: VersionMatchResult;
|
|
14
20
|
schemaVersion: string;
|
|
15
21
|
schemaType: EVersionedSchemaType;
|
|
16
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Migrates raw input through the migration graph to the latest schema version.
|
|
25
|
+
* Migration path is resolved by `fromVersion -> toVersion` links from `migrationPlans`.
|
|
26
|
+
*/
|
|
17
27
|
export declare function migrateDataToLatestSchemaVersion({ rawInput, migrationPlans, versionedSchemas, migrationMode }: MigrateToLatestProps): MigrateToLatestResult | null;
|
|
18
28
|
export {};
|
|
19
29
|
//# sourceMappingURL=migrateDataToLatestSchemaVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrateDataToLatestSchemaVersion.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AASpF,KAAK,oBAAoB,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,cAAc,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;IAChF,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;IAClD,aAAa,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,KAAK,qBAAqB,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,cAAc,EAAE,kBAAkB,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,oBAAoB,CAAC;CACpC,CAAC;AAEF,wBAAgB,gCAAgC,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,EAAE,oBAAoB,GAAG,qBAAqB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"migrateDataToLatestSchemaVersion.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AASpF;;GAEG;AACH,KAAK,oBAAoB,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,cAAc,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;IAChF,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;IAClD,aAAa,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF;;GAEG;AACH,KAAK,qBAAqB,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,cAAc,EAAE,kBAAkB,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,oBAAoB,CAAC;CACpC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,EAAE,oBAAoB,GAAG,qBAAqB,GAAG,IAAI,CAoFlK"}
|
|
@@ -10,6 +10,10 @@ const getUniqueKeysFromSchemas_1 = require("./getUniqueKeysFromSchemas");
|
|
|
10
10
|
const getUniqueObjectKeys_1 = require("./getUniqueObjectKeys");
|
|
11
11
|
const replaceInvalidKeysWithMappedNames_1 = require("./replaceInvalidKeysWithMappedNames");
|
|
12
12
|
const validateAndSuggestKeyCorrections_1 = require("./validateAndSuggestKeyCorrections");
|
|
13
|
+
/**
|
|
14
|
+
* Migrates raw input through the migration graph to the latest schema version.
|
|
15
|
+
* Migration path is resolved by `fromVersion -> toVersion` links from `migrationPlans`.
|
|
16
|
+
*/
|
|
13
17
|
function migrateDataToLatestSchemaVersion({ rawInput, migrationPlans, versionedSchemas, migrationMode }) {
|
|
14
18
|
const schemas = versionedSchemas.map(el => el.schema);
|
|
15
19
|
const allUniqueKeysFromSchemas = (0, getUniqueKeysFromSchemas_1.getUniqueKeysFromSchemas)(schemas);
|
|
@@ -20,33 +24,46 @@ function migrateDataToLatestSchemaVersion({ rawInput, migrationPlans, versionedS
|
|
|
20
24
|
const schemaPossibleKeys = (0, getUniqueKeysFromSchemas_1.getUniqueKeysFromSchemas)([guessedValidationSchema]);
|
|
21
25
|
const replacingKeysMap = (0, generateKeyMappingForInvalidKeys_1.generateKeyMappingForInvalidKeys)(allUniqueKeysFromRawInput, schemaPossibleKeys);
|
|
22
26
|
let currentData = replacingKeysMap.size ? (0, replaceInvalidKeysWithMappedNames_1.replaceInvalidKeysWithMappedNames)(rawInput, replacingKeysMap) : rawInput;
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const actualSchema = versionedSchemas[versionedSchemas.length - 1];
|
|
28
|
+
const schemasByVersion = new Map(versionedSchemas.map(schemaInfo => [schemaInfo.version, schemaInfo.schema]));
|
|
29
|
+
const migrationPlanByFromVersion = new Map(migrationPlans.map(plan => [plan.fromVersion, plan]));
|
|
30
|
+
let currentVersion = guessedVersion.latestVersion;
|
|
31
|
+
const visitedVersions = new Set([currentVersion]);
|
|
32
|
+
while (currentVersion !== actualSchema.version) {
|
|
33
|
+
const currentVersionSchema = schemasByVersion.get(currentVersion);
|
|
34
|
+
if (!currentVersionSchema) {
|
|
35
|
+
throw new Error(`No schema found for version ${currentVersion}.`);
|
|
36
|
+
}
|
|
37
|
+
const firstValidationResult = (0, validateZodOptions_1.validateZodOptionsRaw)(currentVersionSchema, currentData);
|
|
28
38
|
if (!firstValidationResult.success) {
|
|
29
39
|
(0, getCurrentErrorMessage_1.getCurrentErrorMessage)(firstValidationResult.error, replacingKeysMap);
|
|
30
40
|
}
|
|
31
|
-
const
|
|
32
|
-
const migrationPlan = migrationPlans.find(p => p.fromVersion === fromVersion);
|
|
41
|
+
const migrationPlan = migrationPlanByFromVersion.get(currentVersion);
|
|
33
42
|
if (!migrationPlan) {
|
|
34
|
-
const availableVersions =
|
|
35
|
-
throw new Error(`No migration plan from ${
|
|
43
|
+
const availableVersions = Array.from(migrationPlanByFromVersion.keys()).join(', ');
|
|
44
|
+
throw new Error(`No migration plan from ${currentVersion}. ` +
|
|
36
45
|
`Available migration plans: ${availableVersions}. ` +
|
|
37
46
|
`This usually means the migration chain is incomplete.`);
|
|
38
47
|
}
|
|
39
|
-
const
|
|
48
|
+
const nextVersion = migrationPlan.toVersion;
|
|
49
|
+
const nextSchema = schemasByVersion.get(nextVersion);
|
|
50
|
+
if (!nextSchema) {
|
|
51
|
+
throw new Error(`Migration plan from ${migrationPlan.fromVersion} points to unknown schema version ${nextVersion}.`);
|
|
52
|
+
}
|
|
40
53
|
const migratedRaw = migrationPlan.migrate(currentData);
|
|
41
|
-
const validationResult = (0, validateZodOptions_1.validateZodOptions)(
|
|
54
|
+
const validationResult = (0, validateZodOptions_1.validateZodOptions)(nextSchema, migratedRaw);
|
|
42
55
|
if (!validationResult.success) {
|
|
43
|
-
throw new Error(`Migration from ${
|
|
56
|
+
throw new Error(`Migration from ${currentVersion} to ${nextVersion} failed validation. ` +
|
|
44
57
|
`Error: ${validationResult.errors.join('\n')}. ` +
|
|
45
58
|
`Migration description: ${migrationPlan.description || 'No description provided'}.`);
|
|
46
59
|
}
|
|
47
60
|
currentData = { ...migratedRaw };
|
|
48
|
-
|
|
49
|
-
if (
|
|
61
|
+
currentVersion = nextVersion;
|
|
62
|
+
if (visitedVersions.has(currentVersion)) {
|
|
63
|
+
throw new Error(`Migration loop detected at version ${currentVersion}.`);
|
|
64
|
+
}
|
|
65
|
+
visitedVersions.add(currentVersion);
|
|
66
|
+
if (currentVersion === actualSchema.version && migrationMode === Enums_1.EMigrationMode.GENERATE_OPENAPI) {
|
|
50
67
|
console.warn('Для выполнения генерации OpenApi потребовалось мигрировать схему Ваших данных на актуальную. Для обновленмя конфигурации в файле используйте команду `npm name_cli_tool update-config`');
|
|
51
68
|
}
|
|
52
69
|
}
|
|
@@ -11,7 +11,7 @@ export interface Templates {
|
|
|
11
11
|
exports: {
|
|
12
12
|
client: Handlebars.TemplateDelegate;
|
|
13
13
|
model: Handlebars.TemplateDelegate;
|
|
14
|
-
schema: Handlebars.TemplateDelegate
|
|
14
|
+
schema: Handlebars.TemplateDelegate;
|
|
15
15
|
service: Handlebars.TemplateDelegate;
|
|
16
16
|
};
|
|
17
17
|
core: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Templates.model.d.ts","sourceRoot":"","sources":["../../../../src/core/types/base/Templates.model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,SAAS;IACtB,OAAO,EAAE;QACL,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAClC,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAClC,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACrC,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACzC,CAAC;IACF,OAAO,EAAE;QACL,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACnC,MAAM,EAAE,UAAU,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"Templates.model.d.ts","sourceRoot":"","sources":["../../../../src/core/types/base/Templates.model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,SAAS;IACtB,OAAO,EAAE;QACL,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAClC,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAClC,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACrC,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACzC,CAAC;IACF,OAAO,EAAE;QACL,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACnC,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACxC,CAAC;IACF,IAAI,EAAE;QACF,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACtC,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACtC,iBAAiB,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC/C,SAAS,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACvC,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACrC,iBAAiB,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC/C,cAAc,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC5C,eAAe,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC7C,qBAAqB,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACnD,YAAY,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC1C,mBAAmB,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACjD,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACjD,CAAC;CACL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerHandlebarTemplates.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarTemplates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registerHandlebarTemplates.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarTemplates.ts"],"names":[],"mappings":"AA8FA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AA2C1E,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,OAAO,CAAC;IAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;CAAE,GAAG,SAAS,CAqK1K"}
|
|
@@ -89,6 +89,7 @@ const getResponseHeader_4 = __importDefault(require("../../templatesCompiled/cli
|
|
|
89
89
|
const request_5 = __importDefault(require("../../templatesCompiled/client/core/xhr/request"));
|
|
90
90
|
const sendRequest_4 = __importDefault(require("../../templatesCompiled/client/core/xhr/sendRequest"));
|
|
91
91
|
const exportClient_1 = __importDefault(require("../../templatesCompiled/client/exportClient"));
|
|
92
|
+
const exportSchema_1 = __importDefault(require("../../templatesCompiled/client/exportSchema"));
|
|
92
93
|
const exportModel_1 = __importDefault(require("../../templatesCompiled/client/exportModel"));
|
|
93
94
|
const exportService_1 = __importDefault(require("../../templatesCompiled/client/exportService"));
|
|
94
95
|
const indexFull_1 = __importDefault(require("../../templatesCompiled/client/indexFull"));
|
|
@@ -130,7 +131,7 @@ const typeReference_1 = __importDefault(require("../../templatesCompiled/client/
|
|
|
130
131
|
const typeUnion_1 = __importDefault(require("../../templatesCompiled/client/partials/typeUnion"));
|
|
131
132
|
const registerHandlebarHelpers_1 = require("./registerHandlebarHelpers");
|
|
132
133
|
const ValidationLibrary_enum_1 = require("../types/enums/ValidationLibrary.enum");
|
|
133
|
-
const
|
|
134
|
+
const exportSchema_2 = __importDefault(require("../../templatesCompiled/client/zod/exportSchema"));
|
|
134
135
|
const zodSchema_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchema"));
|
|
135
136
|
const zodSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaInterface"));
|
|
136
137
|
const zodSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaEnum"));
|
|
@@ -139,7 +140,7 @@ const zodSchemaDictionary_1 = __importDefault(require("../../templatesCompiled/c
|
|
|
139
140
|
const zodSchemaGeneric_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaGeneric"));
|
|
140
141
|
const zodSchemaReference_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaReference"));
|
|
141
142
|
const zodSchemaComposition_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaComposition"));
|
|
142
|
-
const
|
|
143
|
+
const exportSchema_3 = __importDefault(require("../../templatesCompiled/client/yup/exportSchema"));
|
|
143
144
|
const yupSchema_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchema"));
|
|
144
145
|
const yupSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaInterface"));
|
|
145
146
|
const yupSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaEnum"));
|
|
@@ -148,7 +149,7 @@ const yupSchemaDictionary_1 = __importDefault(require("../../templatesCompiled/c
|
|
|
148
149
|
const yupSchemaGeneric_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaGeneric"));
|
|
149
150
|
const yupSchemaReference_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaReference"));
|
|
150
151
|
const yupSchemaComposition_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaComposition"));
|
|
151
|
-
const
|
|
152
|
+
const exportSchema_4 = __importDefault(require("../../templatesCompiled/client/joi/exportSchema"));
|
|
152
153
|
const joiSchema_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchema"));
|
|
153
154
|
const joiSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaInterface"));
|
|
154
155
|
const joiSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaEnum"));
|
|
@@ -157,7 +158,7 @@ const joiSchemaDictionary_1 = __importDefault(require("../../templatesCompiled/c
|
|
|
157
158
|
const joiSchemaGeneric_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaGeneric"));
|
|
158
159
|
const joiSchemaReference_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaReference"));
|
|
159
160
|
const joiSchemaComposition_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaComposition"));
|
|
160
|
-
const
|
|
161
|
+
const exportSchema_5 = __importDefault(require("../../templatesCompiled/client/jsonschema/exportSchema"));
|
|
161
162
|
const jsonschemaSchema_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchema"));
|
|
162
163
|
const jsonschemaSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface"));
|
|
163
164
|
const jsonschemaSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchemaEnum"));
|
|
@@ -185,7 +186,7 @@ function registerHandlebarTemplates(root) {
|
|
|
185
186
|
exports: {
|
|
186
187
|
client: Handlebars.template(exportClient_1.default),
|
|
187
188
|
model: Handlebars.template(exportModel_1.default),
|
|
188
|
-
schema:
|
|
189
|
+
schema: Handlebars.template(exportSchema_1.default),
|
|
189
190
|
service: Handlebars.template(exportService_1.default),
|
|
190
191
|
},
|
|
191
192
|
core: {
|
|
@@ -277,50 +278,50 @@ function registerHandlebarTemplates(root) {
|
|
|
277
278
|
Handlebars.registerPartial('axios/request', Handlebars.template(request_1.default));
|
|
278
279
|
// Register Zod partials if validationLibrary is ZOD
|
|
279
280
|
if (root?.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.ZOD) {
|
|
280
|
-
|
|
281
|
-
Handlebars.registerPartial('zodSchema', Handlebars.template(zodSchema_1.default));
|
|
282
|
-
Handlebars.registerPartial('zodSchemaInterface', Handlebars.template(zodSchemaInterface_1.default));
|
|
283
|
-
Handlebars.registerPartial('zodSchemaEnum', Handlebars.template(zodSchemaEnum_1.default));
|
|
284
|
-
Handlebars.registerPartial('zodSchemaArray', Handlebars.template(zodSchemaArray_1.default));
|
|
285
|
-
Handlebars.registerPartial('zodSchemaDictionary', Handlebars.template(zodSchemaDictionary_1.default));
|
|
286
|
-
Handlebars.registerPartial('zodSchemaGeneric', Handlebars.template(zodSchemaGeneric_1.default));
|
|
287
|
-
Handlebars.registerPartial('zodSchemaReference', Handlebars.template(zodSchemaReference_1.default));
|
|
288
|
-
Handlebars.registerPartial('zodSchemaComposition', Handlebars.template(zodSchemaComposition_1.default));
|
|
281
|
+
Handlebars.registerPartial('zod/exportSchema', Handlebars.template(exportSchema_2.default));
|
|
282
|
+
Handlebars.registerPartial('zod/zodSchema', Handlebars.template(zodSchema_1.default));
|
|
283
|
+
Handlebars.registerPartial('zod/zodSchemaInterface', Handlebars.template(zodSchemaInterface_1.default));
|
|
284
|
+
Handlebars.registerPartial('zod/zodSchemaEnum', Handlebars.template(zodSchemaEnum_1.default));
|
|
285
|
+
Handlebars.registerPartial('zod/zodSchemaArray', Handlebars.template(zodSchemaArray_1.default));
|
|
286
|
+
Handlebars.registerPartial('zod/zodSchemaDictionary', Handlebars.template(zodSchemaDictionary_1.default));
|
|
287
|
+
Handlebars.registerPartial('zod/zodSchemaGeneric', Handlebars.template(zodSchemaGeneric_1.default));
|
|
288
|
+
Handlebars.registerPartial('zod/zodSchemaReference', Handlebars.template(zodSchemaReference_1.default));
|
|
289
|
+
Handlebars.registerPartial('zod/zodSchemaComposition', Handlebars.template(zodSchemaComposition_1.default));
|
|
289
290
|
}
|
|
290
291
|
// Register Yup partials if validationLibrary is YUP
|
|
291
292
|
if (root?.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.YUP) {
|
|
292
|
-
|
|
293
|
-
Handlebars.registerPartial('yupSchema', Handlebars.template(yupSchema_1.default));
|
|
294
|
-
Handlebars.registerPartial('yupSchemaInterface', Handlebars.template(yupSchemaInterface_1.default));
|
|
295
|
-
Handlebars.registerPartial('yupSchemaEnum', Handlebars.template(yupSchemaEnum_1.default));
|
|
296
|
-
Handlebars.registerPartial('yupSchemaArray', Handlebars.template(yupSchemaArray_1.default));
|
|
297
|
-
Handlebars.registerPartial('yupSchemaDictionary', Handlebars.template(yupSchemaDictionary_1.default));
|
|
298
|
-
Handlebars.registerPartial('yupSchemaGeneric', Handlebars.template(yupSchemaGeneric_1.default));
|
|
299
|
-
Handlebars.registerPartial('yupSchemaReference', Handlebars.template(yupSchemaReference_1.default));
|
|
300
|
-
Handlebars.registerPartial('yupSchemaComposition', Handlebars.template(yupSchemaComposition_1.default));
|
|
293
|
+
Handlebars.registerPartial('yup/exportSchema', Handlebars.template(exportSchema_3.default));
|
|
294
|
+
Handlebars.registerPartial('yup/yupSchema', Handlebars.template(yupSchema_1.default));
|
|
295
|
+
Handlebars.registerPartial('yup/yupSchemaInterface', Handlebars.template(yupSchemaInterface_1.default));
|
|
296
|
+
Handlebars.registerPartial('yup/yupSchemaEnum', Handlebars.template(yupSchemaEnum_1.default));
|
|
297
|
+
Handlebars.registerPartial('yup/yupSchemaArray', Handlebars.template(yupSchemaArray_1.default));
|
|
298
|
+
Handlebars.registerPartial('yup/yupSchemaDictionary', Handlebars.template(yupSchemaDictionary_1.default));
|
|
299
|
+
Handlebars.registerPartial('yup/yupSchemaGeneric', Handlebars.template(yupSchemaGeneric_1.default));
|
|
300
|
+
Handlebars.registerPartial('yup/yupSchemaReference', Handlebars.template(yupSchemaReference_1.default));
|
|
301
|
+
Handlebars.registerPartial('yup/yupSchemaComposition', Handlebars.template(yupSchemaComposition_1.default));
|
|
301
302
|
}
|
|
302
303
|
// Register Joi partials if validationLibrary is JOI
|
|
303
304
|
if (root?.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.JOI) {
|
|
304
|
-
|
|
305
|
-
Handlebars.registerPartial('joiSchema', Handlebars.template(joiSchema_1.default));
|
|
306
|
-
Handlebars.registerPartial('joiSchemaInterface', Handlebars.template(joiSchemaInterface_1.default));
|
|
307
|
-
Handlebars.registerPartial('joiSchemaEnum', Handlebars.template(joiSchemaEnum_1.default));
|
|
308
|
-
Handlebars.registerPartial('joiSchemaArray', Handlebars.template(joiSchemaArray_1.default));
|
|
309
|
-
Handlebars.registerPartial('joiSchemaDictionary', Handlebars.template(joiSchemaDictionary_1.default));
|
|
310
|
-
Handlebars.registerPartial('joiSchemaGeneric', Handlebars.template(joiSchemaGeneric_1.default));
|
|
311
|
-
Handlebars.registerPartial('joiSchemaReference', Handlebars.template(joiSchemaReference_1.default));
|
|
312
|
-
Handlebars.registerPartial('joiSchemaComposition', Handlebars.template(joiSchemaComposition_1.default));
|
|
305
|
+
Handlebars.registerPartial('joi/exportSchema', Handlebars.template(exportSchema_4.default));
|
|
306
|
+
Handlebars.registerPartial('joi/joiSchema', Handlebars.template(joiSchema_1.default));
|
|
307
|
+
Handlebars.registerPartial('joi/joiSchemaInterface', Handlebars.template(joiSchemaInterface_1.default));
|
|
308
|
+
Handlebars.registerPartial('joi/joiSchemaEnum', Handlebars.template(joiSchemaEnum_1.default));
|
|
309
|
+
Handlebars.registerPartial('joi/joiSchemaArray', Handlebars.template(joiSchemaArray_1.default));
|
|
310
|
+
Handlebars.registerPartial('joi/joiSchemaDictionary', Handlebars.template(joiSchemaDictionary_1.default));
|
|
311
|
+
Handlebars.registerPartial('joi/joiSchemaGeneric', Handlebars.template(joiSchemaGeneric_1.default));
|
|
312
|
+
Handlebars.registerPartial('joi/joiSchemaReference', Handlebars.template(joiSchemaReference_1.default));
|
|
313
|
+
Handlebars.registerPartial('joi/joiSchemaComposition', Handlebars.template(joiSchemaComposition_1.default));
|
|
313
314
|
}
|
|
314
315
|
if (root.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.JSONSCHEMA) {
|
|
315
|
-
|
|
316
|
-
Handlebars.registerPartial('jsonschemaSchema', Handlebars.template(jsonschemaSchema_1.default));
|
|
317
|
-
Handlebars.registerPartial('jsonschemaSchemaInterface', Handlebars.template(jsonschemaSchemaInterface_1.default));
|
|
318
|
-
Handlebars.registerPartial('jsonschemaSchemaEnum', Handlebars.template(jsonschemaSchemaEnum_1.default));
|
|
319
|
-
Handlebars.registerPartial('jsonschemaSchemaArray', Handlebars.template(jsonschemaSchemaArray_1.default));
|
|
320
|
-
Handlebars.registerPartial('jsonschemaSchemaDictionary', Handlebars.template(jsonschemaSchemaDictionary_1.default));
|
|
321
|
-
Handlebars.registerPartial('jsonschemaSchemaGeneric', Handlebars.template(jsonschemaSchemaGeneric_1.default));
|
|
322
|
-
Handlebars.registerPartial('jsonschemaSchemaReference', Handlebars.template(jsonschemaSchemaReference_1.default));
|
|
323
|
-
Handlebars.registerPartial('jsonschemaSchemaComposition', Handlebars.template(jsonschemaSchemaComposition_1.default));
|
|
316
|
+
Handlebars.registerPartial('jsonschema/exportSchema', Handlebars.template(exportSchema_5.default));
|
|
317
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchema', Handlebars.template(jsonschemaSchema_1.default));
|
|
318
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchemaInterface', Handlebars.template(jsonschemaSchemaInterface_1.default));
|
|
319
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchemaEnum', Handlebars.template(jsonschemaSchemaEnum_1.default));
|
|
320
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchemaArray', Handlebars.template(jsonschemaSchemaArray_1.default));
|
|
321
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchemaDictionary', Handlebars.template(jsonschemaSchemaDictionary_1.default));
|
|
322
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchemaGeneric', Handlebars.template(jsonschemaSchemaGeneric_1.default));
|
|
323
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchemaReference', Handlebars.template(jsonschemaSchemaReference_1.default));
|
|
324
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchemaComposition', Handlebars.template(jsonschemaSchemaComposition_1.default));
|
|
324
325
|
}
|
|
325
326
|
return templates;
|
|
326
327
|
}
|
|
@@ -47,7 +47,7 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
|
47
47
|
+ ((stack1 = lookupProperty(helpers, "joinPath").call(alias1, lookupProperty(lookupProperty(data, "root"), "outputCore"), "./interceptors/apiErrorInterceptor", { "name": "joinPath", "hash": {}, "data": data, "loc": { "start": { "line": 8, "column": 37 }, "end": { "line": 8, "column": 105 } } })) != null ? stack1 : "")
|
|
48
48
|
+ "';\n\n"
|
|
49
49
|
+ ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(depth0, "services"), { "name": "each", "hash": {}, "fn": container.program(1, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 12, "column": 9 } } })) != null ? stack1 : "")
|
|
50
|
-
+ "\nexport interface ClientOptions
|
|
50
|
+
+ "\nexport interface ClientOptions {\n openApi?: Partial<TOpenAPIConfig>;\n interceptors?: {\n onRequest?: RequestInterceptor[];\n onResponse?: ResponseInterceptor[];\n onError?: ErrorInterceptor[];\n }\n}\n\nexport function createClient<TExecutorOptions extends Record<string, any>>(\n options: ClientOptions = {},\n) {\n const openApiConfig: TOpenAPIConfig = {\n ...OpenAPI,\n ...options.openApi,\n };\n\n let executor = createExecutorAdapter<TExecutorOptions>(openApiConfig);\n if (options?.interceptors) {\n executor = withInterceptors(executor, {\n onError: [apiErrorInterceptor, ...(options.interceptors?.onError ?? [])],\n onRequest: options.interceptors?.onRequest,\n onResponse: options.interceptors?.onResponse,\n });\n }\n\n return {\n"
|
|
51
51
|
+ ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(depth0, "services"), { "name": "each", "hash": {}, "fn": container.program(3, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 41, "column": 4 }, "end": { "line": 43, "column": 13 } } })) != null ? stack1 : "")
|
|
52
52
|
+ " };\n}\n";
|
|
53
53
|
}, "usePartial": true, "useData": true };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
+
"1": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
3
|
+
"3": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
4
|
+
"5": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
5
|
+
"7": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
2
6
|
compiler: (string | number)[];
|
|
3
|
-
main: (container: any, depth0: any, helpers: any, partials: any, data: any) =>
|
|
7
|
+
main: (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
4
8
|
usePartial: boolean;
|
|
5
9
|
useData: boolean;
|
|
6
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportSchema.d.ts","sourceRoot":"","sources":["../../../src/templatesCompiled/client/exportSchema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exportSchema.d.ts","sourceRoot":"","sources":["../../../src/templatesCompiled/client/exportSchema.ts"],"names":[],"mappings":";;;;;;;;;;AAMA,wBAgDmC"}
|
|
@@ -6,17 +6,47 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
/* tslint: disable */
|
|
7
7
|
/* eslint: disable */
|
|
8
8
|
// @ts-nocheck
|
|
9
|
-
exports.default = { "
|
|
9
|
+
exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
10
10
|
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
11
11
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
12
12
|
return parent[propertyName];
|
|
13
13
|
}
|
|
14
14
|
return undefined;
|
|
15
15
|
};
|
|
16
|
-
return ((stack1 = container.invokePartial(lookupProperty(partials, "
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "zod/exportSchema"), depth0, { "name": "zod/exportSchema", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
17
|
+
}, "3": function (container, depth0, helpers, partials, data) {
|
|
18
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
20
|
+
return parent[propertyName];
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
};
|
|
24
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "joi/exportSchema"), depth0, { "name": "joi/exportSchema", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
25
|
+
}, "5": function (container, depth0, helpers, partials, data) {
|
|
26
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
27
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
28
|
+
return parent[propertyName];
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
};
|
|
32
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "yup/exportSchema"), depth0, { "name": "yup/exportSchema", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
33
|
+
}, "7": function (container, depth0, helpers, partials, data) {
|
|
34
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
35
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
36
|
+
return parent[propertyName];
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
};
|
|
40
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "jsonschema/exportSchema"), depth0, { "name": "jsonschema/exportSchema", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
41
|
+
}, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
42
|
+
var stack1, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
43
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
44
|
+
return parent[propertyName];
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
};
|
|
48
|
+
return ((stack1 = lookupProperty(helpers, "equals").call(alias1, lookupProperty(lookupProperty(data, "root"), "validationLibrary"), "zod", { "name": "equals", "hash": {}, "fn": container.program(1, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 75 } } })) != null ? stack1 : "")
|
|
49
|
+
+ ((stack1 = lookupProperty(helpers, "equals").call(alias1, lookupProperty(lookupProperty(data, "root"), "validationLibrary"), "joi", { "name": "equals", "hash": {}, "fn": container.program(3, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 75 } } })) != null ? stack1 : "")
|
|
50
|
+
+ ((stack1 = lookupProperty(helpers, "equals").call(alias1, lookupProperty(lookupProperty(data, "root"), "validationLibrary"), "yup", { "name": "equals", "hash": {}, "fn": container.program(5, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 75 } } })) != null ? stack1 : "")
|
|
51
|
+
+ ((stack1 = lookupProperty(helpers, "equals").call(alias1, lookupProperty(lookupProperty(data, "root"), "validationLibrary"), "jsonschema", { "name": "equals", "hash": {}, "fn": container.program(7, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 89 } } })) != null ? stack1 : "");
|
|
22
52
|
}, "usePartial": true, "useData": true };
|
|
@@ -46,11 +46,11 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
|
46
46
|
+ "\nimport Joi from 'joi';\n\nexport const "
|
|
47
47
|
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 11, "column": 16 }, "end": { "line": 11, "column": 20 } }), depth0)) != null ? stack1 : "")
|
|
48
48
|
+ "Schema = "
|
|
49
|
-
+ ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchema"), depth0, { "name": "joiSchema", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
|
|
49
|
+
+ ((stack1 = container.invokePartial(lookupProperty(partials, "joi/joiSchema"), depth0, { "name": "joi/joiSchema", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
|
|
50
50
|
+ ";\n\nexport type "
|
|
51
51
|
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 13, "column": 15 }, "end": { "line": 13, "column": 19 } }), depth0)) != null ? stack1 : "")
|
|
52
|
-
+ " = Joi.
|
|
53
|
-
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 13, "column":
|
|
52
|
+
+ " = Joi.Schema<typeof "
|
|
53
|
+
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 13, "column": 46 }, "end": { "line": 13, "column": 50 } }), depth0)) != null ? stack1 : "")
|
|
54
54
|
+ "Schema>;\n\nexport function validate"
|
|
55
55
|
+ ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 15, "column": 27 }, "end": { "line": 15, "column": 31 } }), depth0)) != null ? stack1 : "")
|
|
56
56
|
+ "(data: unknown): { value: "
|
|
@@ -13,7 +13,7 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
|
13
13
|
}
|
|
14
14
|
return undefined;
|
|
15
15
|
};
|
|
16
|
-
return ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchemaInterface"), depth0, { "name": "joiSchemaInterface", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
16
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "joi/joiSchemaInterface"), depth0, { "name": "joi/joiSchemaInterface", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
17
17
|
}, "3": function (container, depth0, helpers, partials, data) {
|
|
18
18
|
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
19
19
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
@@ -29,7 +29,7 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
|
29
29
|
}
|
|
30
30
|
return undefined;
|
|
31
31
|
};
|
|
32
|
-
return ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchemaEnum"), depth0, { "name": "joiSchemaEnum", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
32
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "joi/joiSchemaEnum"), depth0, { "name": "joi/joiSchemaEnum", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
33
33
|
}, "6": function (container, depth0, helpers, partials, data) {
|
|
34
34
|
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
35
35
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
@@ -45,7 +45,7 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
|
45
45
|
}
|
|
46
46
|
return undefined;
|
|
47
47
|
};
|
|
48
|
-
return ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchemaArray"), depth0, { "name": "joiSchemaArray", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
48
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "joi/joiSchemaArray"), depth0, { "name": "joi/joiSchemaArray", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
49
49
|
}, "9": function (container, depth0, helpers, partials, data) {
|
|
50
50
|
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
51
51
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
@@ -61,7 +61,7 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
|
61
61
|
}
|
|
62
62
|
return undefined;
|
|
63
63
|
};
|
|
64
|
-
return ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchemaDictionary"), depth0, { "name": "joiSchemaDictionary", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
64
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "joi/joiSchemaDictionary"), depth0, { "name": "joi/joiSchemaDictionary", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
65
65
|
}, "12": function (container, depth0, helpers, partials, data) {
|
|
66
66
|
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
67
67
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
@@ -77,7 +77,7 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
|
77
77
|
}
|
|
78
78
|
return undefined;
|
|
79
79
|
};
|
|
80
|
-
return ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchemaComposition"), depth0, { "name": "joiSchemaComposition", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
80
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "joi/joiSchemaComposition"), depth0, { "name": "joi/joiSchemaComposition", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
81
81
|
}, "15": function (container, depth0, helpers, partials, data) {
|
|
82
82
|
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
83
83
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
@@ -109,7 +109,7 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
|
109
109
|
}
|
|
110
110
|
return undefined;
|
|
111
111
|
};
|
|
112
|
-
return ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchemaReference"), depth0, { "name": "joiSchemaReference", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
112
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "joi/joiSchemaReference"), depth0, { "name": "joi/joiSchemaReference", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
113
113
|
}, "20": function (container, depth0, helpers, partials, data) {
|
|
114
114
|
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
115
115
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
@@ -117,7 +117,7 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
|
117
117
|
}
|
|
118
118
|
return undefined;
|
|
119
119
|
};
|
|
120
|
-
return ((stack1 = container.invokePartial(lookupProperty(partials, "joiSchemaGeneric"), depth0, { "name": "joiSchemaGeneric", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
120
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "joi/joiSchemaGeneric"), depth0, { "name": "joi/joiSchemaGeneric", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "");
|
|
121
121
|
}, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
122
122
|
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
123
123
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|