@abp/ng.schematics
Advanced tools
Comparing version 8.2.0-rc.2 to 8.2.0-rc.3
@@ -25,7 +25,9 @@ "use strict"; | ||
const serviceType = schema.serviceType || enums_1.defaultEServiceType; | ||
if (!types || !modules) | ||
if (!types || !modules) { | ||
throw new schematics_1.SchematicsException("[Invalid API Definition] The provided API definition is invalid." /* Exception.InvalidApiDefinition */); | ||
} | ||
const definition = data.modules[moduleName]; | ||
if (!definition) | ||
if (!definition) { | ||
throw new schematics_1.SchematicsException((0, utils_1.interpolate)("[Invalid Module] Backend module \"{0}\" does not exist in API definition." /* Exception.InvalidModule */, moduleName)); | ||
} | ||
const apiName = definition.remoteServiceName; | ||
@@ -58,4 +60,5 @@ data.modules[moduleName].controllers = (0, utils_1.sanitizeControllerTypeNames)(definition.controllers); | ||
}); | ||
if (!data.generated.includes(moduleName)) | ||
if (!data.generated.includes(moduleName)) { | ||
data.generated.push(moduleName); | ||
} | ||
data.generated.sort(); | ||
@@ -93,6 +96,8 @@ const json = (0, utils_1.generateProxyConfigJson)(data); | ||
models.forEach(({ imports }) => imports.forEach(({ refs, path }) => refs.forEach(ref => { | ||
if (path === '@abp/ng.core') | ||
if (path === '@abp/ng.core') { | ||
return; | ||
if (!modelImports[path]) | ||
} | ||
if (!modelImports[path]) { | ||
return (modelImports[path] = [ref]); | ||
} | ||
modelImports[path] = [...new Set([...modelImports[path], ref])]; | ||
@@ -99,0 +104,0 @@ }))); |
{ | ||
"name": "@abp/ng.schematics", | ||
"version": "8.2.0-rc.2", | ||
"version": "8.2.0-rc.3", | ||
"author": "", | ||
@@ -5,0 +5,0 @@ "schematics": "./collection.json", |
@@ -61,8 +61,11 @@ "use strict"; | ||
const propType = types[ref]; | ||
if (!propType) | ||
if (!propType) { | ||
return; | ||
if (propType.isEnum) | ||
} | ||
if (propType.isEnum) { | ||
toBeImported.push({ type: ref, isEnum: true }); | ||
else if ((0, namespace_1.parseNamespace)(solution, ref) !== model.namespace) | ||
} | ||
if ((0, namespace_1.parseNamespace)(solution, ref) !== model.namespace) { | ||
toBeImported.push({ type: ref, isEnum: false }); | ||
} | ||
}); | ||
@@ -143,3 +146,3 @@ }); | ||
function isOptionalProperty(prop) { | ||
return (prop.typeSimple.endsWith('?') || (prop.typeSimple === 'string' && !prop.isRequired)); | ||
return prop.typeSimple.endsWith('?') || (prop.typeSimple === 'string' && !prop.isRequired); | ||
} | ||
@@ -146,0 +149,0 @@ function parseBaseTypeWithGenericTypes(type) { |
@@ -61,7 +61,12 @@ "use strict"; | ||
const newImport = mapTypeToImport(type, isEnum); | ||
if (!newImport) | ||
if (!newImport) { | ||
return; | ||
} | ||
if (newImport.specifiers.some(f => f.toLocaleLowerCase() === type.toLocaleLowerCase())) { | ||
return; | ||
} | ||
const existingImport = imports.find(({ keyword, path }) => keyword === newImport.keyword && path === newImport.path); | ||
if (!existingImport) | ||
if (!existingImport) { | ||
return imports.push(newImport); | ||
} | ||
existingImport.refs = [...new Set([...existingImport.refs, ...newImport.refs])]; | ||
@@ -85,7 +90,9 @@ existingImport.specifiers = [ | ||
const specifiers = [adaptType(simplifyType(refs[0]).split('<')[0])]; | ||
const path = constants_1.VOLO_REGEX.test(type) | ||
? '@abp/ng.core' | ||
: isEnum | ||
? (0, path_1.relativePathToEnum)(namespace, modelNamespace, specifiers[0]) | ||
: (0, path_1.relativePathToModel)(namespace, modelNamespace); | ||
let path = (0, path_1.relativePathToModel)(namespace, modelNamespace); | ||
if (constants_1.VOLO_REGEX.test(type)) { | ||
path = '@abp/ng.core'; | ||
} | ||
if (isEnum) { | ||
path = (0, path_1.relativePathToEnum)(namespace, modelNamespace, specifiers[0]); | ||
} | ||
return new models_1.Import({ keyword: enums_1.eImportKeyword.Type, path, refs, specifiers }); | ||
@@ -92,0 +99,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
398794
5907