diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs index 0376828fc2..d17545f4cc 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs @@ -76,11 +76,9 @@ public class AngularServiceProxyGenerator : ServiceProxyGeneratorBase = {}; const generateServices = createServiceGenerator({ targetPath, @@ -170,3 +171,14 @@ function createServiceGenerator(params: ServiceGeneratorParams) { }), ); } + +function filterControllersByServiceType( + serviceType: eServiceType, + controllers: Record, +): Controller[] { + const itShouldBeIntegratedService = serviceType === eServiceType.Integration; + const skipFilter = serviceType === eServiceType.All; + return Object.values(controllers || {}).filter( + x => x.isIntegrationService === itShouldBeIntegratedService || skipFilter, + ); +} diff --git a/npm/ng-packs/packages/schematics/src/commands/api/schema.json b/npm/ng-packs/packages/schematics/src/commands/api/schema.json index ddaf06f001..b5fde3ad79 100644 --- a/npm/ng-packs/packages/schematics/src/commands/api/schema.json +++ b/npm/ng-packs/packages/schematics/src/commands/api/schema.json @@ -45,10 +45,42 @@ "type": "string", "$default": { "$source": "argv", - "index": 5 + "index": 4 }, "x-prompt": "Please enter target Angular project to place the generated code. (default: workspace \"defaultProject\")" + }, + "serviceType": { + "description": "Service type to the generated code", + "type": "string", + "$default": { + "$source": "argv", + "index": 5 + }, + "enum": [ + "application", + "integration", + "all" + ], + "x-prompt": { + "message": "Specifies the service type to generate. `application`, `integration` and `all`, Default value: `application`", + "type": "list", + "items": [ + { + "value": "all", + "label": "All" + }, + { + "value": "application", + "label": "Application" + }, + { + "value": "integration", + "label": "Integration" + } + ] + } } + }, "required": [] } diff --git a/npm/ng-packs/packages/schematics/src/commands/proxy-add/schema.json b/npm/ng-packs/packages/schematics/src/commands/proxy-add/schema.json index 2cf27f9c33..ef0c125262 100644 --- a/npm/ng-packs/packages/schematics/src/commands/proxy-add/schema.json +++ b/npm/ng-packs/packages/schematics/src/commands/proxy-add/schema.json @@ -48,6 +48,37 @@ "index": 4 }, "x-prompt": "Please enter URL for API definition (default: API Name's url in environment file)" + }, + "serviceType": { + "description": "Service type to the generated code", + "type": "string", + "$default": { + "$source": "argv", + "index": 5 + }, + "enum": [ + "application", + "integration", + "all" + ], + "x-prompt": { + "message": "Specifies the service type to generate. `application`, `integration` and `all`, Default value: `application`", + "type": "list", + "items": [ + { + "value": "all", + "label": "All" + }, + { + "value": "application", + "label": "Application" + }, + { + "value": "integration", + "label": "Integration" + } + ] + } } }, "entryPoint": { diff --git a/npm/ng-packs/packages/schematics/src/enums/index.ts b/npm/ng-packs/packages/schematics/src/enums/index.ts index aee862a5f5..9b2d376cc3 100644 --- a/npm/ng-packs/packages/schematics/src/enums/index.ts +++ b/npm/ng-packs/packages/schematics/src/enums/index.ts @@ -2,3 +2,4 @@ export * from './binding-source-id'; export * from './exception'; export * from './import-keyword'; export * from './method-modifier'; +export * from './service-types'; diff --git a/npm/ng-packs/packages/schematics/src/enums/service-types.ts b/npm/ng-packs/packages/schematics/src/enums/service-types.ts new file mode 100644 index 0000000000..1616aaca31 --- /dev/null +++ b/npm/ng-packs/packages/schematics/src/enums/service-types.ts @@ -0,0 +1,7 @@ +export enum eServiceType { + All = 'all', + Application = 'application', + Integration = 'integration', +} + +export const defaultEServiceType = eServiceType.Application; diff --git a/npm/ng-packs/packages/schematics/src/models/api-definition.ts b/npm/ng-packs/packages/schematics/src/models/api-definition.ts index 15f6ef1d0b..01af33ac3e 100644 --- a/npm/ng-packs/packages/schematics/src/models/api-definition.ts +++ b/npm/ng-packs/packages/schematics/src/models/api-definition.ts @@ -31,6 +31,8 @@ export interface Module { export interface Controller { controllerName: string; type: string; + isRemoteService: boolean; + isIntegrationService: boolean; interfaces: InterfaceDef[]; actions: Record; } diff --git a/npm/ng-packs/packages/schematics/src/models/generate-proxy-schema.ts b/npm/ng-packs/packages/schematics/src/models/generate-proxy-schema.ts index 682cdda9fe..6d4c67bcd8 100644 --- a/npm/ng-packs/packages/schematics/src/models/generate-proxy-schema.ts +++ b/npm/ng-packs/packages/schematics/src/models/generate-proxy-schema.ts @@ -1,3 +1,5 @@ +import { eServiceType } from '../enums'; + export interface GenerateProxySchema { /** * Backend module name @@ -28,4 +30,5 @@ export interface GenerateProxySchema { * Secondary entrypoint for proxy generation */ entryPoint?: string; + serviceType?: eServiceType; } diff --git a/npm/ng-packs/scripts/copy-packages-to-templates.ts b/npm/ng-packs/scripts/copy-packages-to-templates.ts index 42aa7e5eff..e71dacbcc0 100644 --- a/npm/ng-packs/scripts/copy-packages-to-templates.ts +++ b/npm/ng-packs/scripts/copy-packages-to-templates.ts @@ -17,6 +17,7 @@ const packageMap = { 'tenant-management': 'ng.tenant-management', 'theme-basic': 'ng.theme.basic', 'theme-shared': 'ng.theme.shared', + 'schematics':'ng.schematics' }; program.option('-t, --templates ', 'template dirs', false); program.option('-p, --template-path ', 'root template path', false);