@mediusinc/mng-commons 4.0.0-rc.2 → 4.0.0-rc.3

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.
Files changed (148) hide show
  1. package/esm2022/index.mjs +5 -1
  2. package/esm2022/lib/api/utils/medius-rest.util.mjs +15 -7
  3. package/esm2022/lib/api/utils/object-serializer.util.mjs +8 -4
  4. package/esm2022/lib/components/action/action.component.mjs +16 -45
  5. package/esm2022/lib/components/action/editor/action-editor.component.mjs +60 -434
  6. package/esm2022/lib/components/action/editor/injector-context/action-editor-injector-context.component.mjs +394 -0
  7. package/esm2022/lib/components/action/localization/data-language-dropdown.component.mjs +6 -7
  8. package/esm2022/lib/components/action/models/action-component.model.mjs +1 -1
  9. package/esm2022/lib/components/action/models/action-execution.model.mjs +3 -6
  10. package/esm2022/lib/components/action/models/index.mjs +1 -2
  11. package/esm2022/lib/components/action/route/action-route.component.mjs +14 -30
  12. package/esm2022/lib/components/action/table/action-table.component.mjs +9 -19
  13. package/esm2022/lib/components/form/editor/form-editor.component.mjs +5 -11
  14. package/esm2022/lib/components/form/formly/fields/formly-field-custom/formly-field-custom.component.mjs +1 -1
  15. package/esm2022/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +4 -4
  16. package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +5 -5
  17. package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +4 -4
  18. package/esm2022/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +1 -1
  19. package/esm2022/lib/components/layout/main-layout.component.mjs +21 -25
  20. package/esm2022/lib/components/layout/topbar.component.mjs +8 -8
  21. package/esm2022/lib/components/layoutV2/main-layout.component.mjs +13 -10
  22. package/esm2022/lib/components/layoutV2/menu-item.component.mjs +48 -5
  23. package/esm2022/lib/components/layoutV2/menu.component.mjs +13 -4
  24. package/esm2022/lib/components/layoutV2/services/main-layout.component.service.mjs +11 -2
  25. package/esm2022/lib/components/layoutV2/sidebar.component.mjs +5 -5
  26. package/esm2022/lib/components/layoutV2/topbar.component.mjs +7 -7
  27. package/esm2022/lib/components/notification/notification-wrapper.component.mjs +50 -0
  28. package/esm2022/lib/components/table/column-value/column-value.component.mjs +2 -2
  29. package/esm2022/lib/components/table/table.component.mjs +17 -23
  30. package/esm2022/lib/components/tableview/route/tableview-route.abstract.component.mjs +5 -5
  31. package/esm2022/lib/components/tableview/route/tableview-route.component.mjs +3 -9
  32. package/esm2022/lib/components/tableview/tableview.component.mjs +17 -76
  33. package/esm2022/lib/descriptors/editor/field-lookup.descriptor.mjs +1 -2
  34. package/esm2022/lib/descriptors/filter/filter.descriptor.mjs +20 -20
  35. package/esm2022/lib/directives/component.directive.mjs +8 -4
  36. package/esm2022/lib/helpers/coercion.mjs +8 -1
  37. package/esm2022/lib/models/action-editor.model.mjs +1 -1
  38. package/esm2022/lib/models/config.model.mjs +1 -1
  39. package/esm2022/lib/models/index.mjs +2 -2
  40. package/esm2022/lib/models/layout-config.model.mjs +2 -0
  41. package/esm2022/lib/models/view-container.model.mjs +1 -1
  42. package/esm2022/lib/provide-commons.mjs +7 -1
  43. package/esm2022/lib/registry/type.registry.mjs +2 -3
  44. package/esm2022/lib/router/route-builder.mjs +1 -1
  45. package/esm2022/lib/services/action/action-executor.service.mjs +725 -0
  46. package/esm2022/lib/services/action/component-action-executor.service.mjs +19 -0
  47. package/esm2022/lib/services/action/index.mjs +5 -0
  48. package/esm2022/lib/services/action/provide-action-executor.mjs +9 -0
  49. package/esm2022/lib/services/action/root-action-executor.service.mjs +18 -0
  50. package/esm2022/lib/services/commons.service.mjs +5 -5
  51. package/esm2022/lib/services/index.mjs +1 -3
  52. package/esm2022/lib/services/logger.service.mjs +2 -2
  53. package/esm2022/lib/services/view/index.mjs +3 -0
  54. package/esm2022/lib/services/view/provide-view-container.mjs +17 -0
  55. package/esm2022/lib/services/view/view-container.service.mjs +59 -0
  56. package/esm2022/lib/utils/date.util.mjs +33 -23
  57. package/esm2022/lib/utils/notification.util.mjs +9 -16
  58. package/esm2022/lib/utils/string.util.mjs +2 -2
  59. package/fesm2022/mediusinc-mng-commons.mjs +3199 -3156
  60. package/fesm2022/mediusinc-mng-commons.mjs.map +1 -1
  61. package/index.d.ts +4 -0
  62. package/lib/components/action/action.component.d.ts +11 -17
  63. package/lib/components/action/editor/action-editor.component.d.ts +20 -80
  64. package/lib/components/action/editor/injector-context/action-editor-injector-context.component.d.ts +80 -0
  65. package/lib/components/action/localization/data-language-dropdown.component.d.ts +2 -3
  66. package/lib/components/action/models/action-component.model.d.ts +0 -2
  67. package/lib/components/action/models/action-execution.model.d.ts +6 -6
  68. package/lib/components/action/models/index.d.ts +0 -1
  69. package/lib/components/action/route/action-route.component.d.ts +6 -12
  70. package/lib/components/action/table/action-table.component.d.ts +3 -8
  71. package/lib/components/form/editor/form-editor.component.d.ts +4 -7
  72. package/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.d.ts +1 -3
  73. package/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.d.ts +0 -2
  74. package/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.d.ts +0 -2
  75. package/lib/components/layout/main-layout.component.d.ts +4 -7
  76. package/lib/components/layoutV2/main-layout.component.d.ts +4 -3
  77. package/lib/components/layoutV2/menu-item.component.d.ts +7 -3
  78. package/lib/components/layoutV2/menu.component.d.ts +2 -0
  79. package/lib/components/layoutV2/services/main-layout.component.service.d.ts +3 -0
  80. package/lib/components/layoutV2/sidebar.component.d.ts +1 -1
  81. package/lib/components/layoutV2/topbar.component.d.ts +2 -2
  82. package/lib/components/notification/notification-wrapper.component.d.ts +12 -0
  83. package/lib/components/table/table.component.d.ts +4 -7
  84. package/lib/components/tableview/route/tableview-route.abstract.component.d.ts +2 -3
  85. package/lib/components/tableview/route/tableview-route.component.d.ts +0 -3
  86. package/lib/components/tableview/tableview.component.d.ts +3 -19
  87. package/lib/descriptors/filter/filter.descriptor.d.ts +7 -7
  88. package/lib/directives/component.directive.d.ts +3 -2
  89. package/lib/models/action-editor.model.d.ts +11 -0
  90. package/lib/models/config.model.d.ts +3 -13
  91. package/lib/models/index.d.ts +1 -1
  92. package/lib/models/layout-config.model.d.ts +33 -0
  93. package/lib/models/view-container.model.d.ts +0 -25
  94. package/lib/router/route-builder.d.ts +1 -1
  95. package/lib/services/{action-executor.service.d.ts → action/action-executor.service.d.ts} +32 -31
  96. package/lib/services/action/component-action-executor.service.d.ts +9 -0
  97. package/lib/services/action/index.d.ts +4 -0
  98. package/lib/services/action/provide-action-executor.d.ts +2 -0
  99. package/lib/services/action/root-action-executor.service.d.ts +9 -0
  100. package/lib/services/index.d.ts +0 -2
  101. package/lib/services/view/index.d.ts +2 -0
  102. package/lib/services/view/provide-view-container.d.ts +2 -0
  103. package/lib/services/view/view-container.service.d.ts +32 -0
  104. package/lib/utils/date.util.d.ts +12 -2
  105. package/lib/utils/notification.util.d.ts +6 -6
  106. package/openapi/angular/README.mustache +226 -0
  107. package/openapi/angular/api.module.mustache +39 -0
  108. package/openapi/angular/api.service.mustache +253 -0
  109. package/openapi/angular/apiInterface.mustache +47 -0
  110. package/openapi/angular/apis.mustache +12 -0
  111. package/openapi/angular/configuration.mustache +128 -0
  112. package/openapi/angular/custom/base-api.service.mustache +14 -0
  113. package/openapi/angular/custom/helpers.mustache +71 -0
  114. package/openapi/angular/custom/modelSchema.mustache +46 -0
  115. package/openapi/angular/custom/schema.mustache +18 -0
  116. package/openapi/angular/encoder.mustache +20 -0
  117. package/openapi/angular/git_push.sh.mustache +57 -0
  118. package/openapi/angular/index.mustache +0 -0
  119. package/openapi/angular/licenseInfo.mustache +11 -0
  120. package/openapi/angular/model.mustache +16 -0
  121. package/openapi/angular/modelAlias.mustache +1 -0
  122. package/openapi/angular/modelEnum.mustache +24 -0
  123. package/openapi/angular/modelGeneric.mustache +14 -0
  124. package/openapi/angular/modelGenericAdditionalProperties.mustache +5 -0
  125. package/openapi/angular/modelGenericEnums.mustache +30 -0
  126. package/openapi/angular/modelOneOf.mustache +14 -0
  127. package/openapi/angular/modelTaggedUnion.mustache +21 -0
  128. package/openapi/angular/models.mustache +5 -0
  129. package/openapi/angular/ng-package.mustache +6 -0
  130. package/openapi/angular/package.mustache +39 -0
  131. package/openapi/angular/param.mustache +69 -0
  132. package/openapi/angular/tsconfig.mustache +28 -0
  133. package/openapi/angular/variables.mustache +9 -0
  134. package/openapi/{templates → node}/model.mustache +3 -17
  135. package/package.json +2 -2
  136. package/scss/mng-commons-dark-v2.scss +1 -1
  137. package/scss/mng-commons-light-v2.scss +1 -1
  138. package/scss/v2/layout/layout.scss +2 -2
  139. package/scss/v2/layout/mng/_mng_layout_topbar.scss +2 -0
  140. package/scss/v2/layout/preloading.scss +8 -8
  141. package/esm2022/lib/components/action/models/action-confirmation-service.model.mjs +0 -2
  142. package/esm2022/lib/models/menu-config.model.mjs +0 -2
  143. package/esm2022/lib/services/action-executor.service.mjs +0 -747
  144. package/esm2022/lib/services/view-container.component.service.mjs +0 -65
  145. package/lib/components/action/models/action-confirmation-service.model.d.ts +0 -6
  146. package/lib/models/menu-config.model.d.ts +0 -15
  147. package/lib/services/view-container.component.service.d.ts +0 -36
  148. /package/openapi/{templates → node}/models.mustache +0 -0
@@ -1,8 +1,18 @@
1
+ export type toIsoStringTypeOptType = 'date' | 'date-time' | 'dateTime';
2
+ export type toIsoStringDateTimeOptsType = {
3
+ utc?: boolean;
4
+ noTimezone?: boolean;
5
+ noMillis?: boolean;
6
+ };
1
7
  export declare class DateUtil {
2
8
  private static readonly NG_PRIME_FORMAT_SUPPORTED;
3
9
  private static readonly NG_PRIME_FORMAT_OTHER;
4
10
  private static readonly NG_PRIME_FORMAT_MAP;
5
- private static pad;
6
- static toIsoString(date: unknown, inUtc?: boolean, withTimezone?: boolean, withMillis?: boolean, dateOnly?: boolean): string | null;
11
+ private static padNumber;
12
+ static toIsoString(value: string | number | Date, type?: 'date'): string;
13
+ static toIsoString(value: string | number | Date, type: 'date-time' | 'dateTime', dateTimeOpts?: toIsoStringDateTimeOptsType): string;
14
+ static toIsoString(value: undefined | null | unknown, type?: 'date'): null;
15
+ static toIsoString(value: undefined | null | unknown, type: 'date-time' | 'dateTime', dateTimeOpts?: toIsoStringDateTimeOptsType): null;
16
+ static toIsoString(value: unknown, type?: toIsoStringTypeOptType, dateTimeOpts?: toIsoStringDateTimeOptsType): string | null;
7
17
  static fromPrimeToAngularDateFormat(ngDateFormat: string): string;
8
18
  }
@@ -1,13 +1,13 @@
1
1
  import { TranslateService } from '@ngx-translate/core';
2
- import { Message } from 'primeng/api';
2
+ import { Message, MessageService } from 'primeng/api';
3
3
  import { ActionDescriptor } from '../descriptors/action';
4
4
  import { TableDescriptorInst } from '../descriptors/table';
5
- import { IMngError, IViewContainer } from '../models';
5
+ import { IMngError } from '../models';
6
6
  export declare class NotificationUtil {
7
- static notification(viewContainer?: IViewContainer<any, any>, title?: string, message?: string, severity?: 'success' | 'warn' | 'error', icon?: string): Message;
8
- static tableNotificationError(translate: TranslateService, table: TableDescriptorInst<any>, error: any, viewContainer?: IViewContainer<any, any>): Message;
9
- static actionNotificationSuccess(translate: TranslateService, action: ActionDescriptor, functionName: string, customTitleKey?: string, customMessageKey?: string, viewContainer?: IViewContainer<any, any>, item?: any): Message;
10
- static actionNotificationError(translate: TranslateService, action: ActionDescriptor, error: IMngError, functionName: string, viewContainer?: IViewContainer<any, any>, item?: any, severity?: 'warn' | 'error'): Message;
7
+ static notification(messageService: MessageService, title?: string, message?: string, severity?: 'success' | 'warn' | 'error', icon?: string): Message;
8
+ static tableNotificationError(translate: TranslateService, table: TableDescriptorInst<any>, error: any, messageService: MessageService): Message;
9
+ static actionNotificationSuccess(translate: TranslateService, action: ActionDescriptor, functionName: string, messageService: MessageService, customTitleKey?: string, customMessageKey?: string, item?: any): Message;
10
+ static actionNotificationError(translate: TranslateService, action: ActionDescriptor, error: IMngError, functionName: string, messageService: MessageService, item?: any, severity?: 'warn' | 'error'): Message;
11
11
  static getFormEditorInfoMessage(translate: TranslateService, title: string, message: string, params?: any): Message;
12
12
  static getFormEditorWarningMessage(translate: TranslateService, title: string, message: string): Message;
13
13
  }
@@ -0,0 +1,226 @@
1
+ ## {{npmName}}@{{npmVersion}}
2
+
3
+ ### Building
4
+
5
+ To install the required dependencies and to build the typescript sources run:
6
+ ```
7
+ npm install
8
+ npm run build
9
+ ```
10
+
11
+ ### publishing
12
+
13
+ First build the package then run ```npm publish dist``` (don't forget to specify the `dist` folder!)
14
+
15
+ ### consuming
16
+
17
+ Navigate to the folder of your consuming project and run one of next commands.
18
+
19
+ _published:_
20
+
21
+ ```
22
+ npm install {{npmName}}@{{npmVersion}} --save
23
+ ```
24
+
25
+ _without publishing (not recommended):_
26
+
27
+ ```
28
+ npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
29
+ ```
30
+
31
+ _It's important to take the tgz file, otherwise you'll get trouble with links on windows_
32
+
33
+ _using `npm link`:_
34
+
35
+ In PATH_TO_GENERATED_PACKAGE/dist:
36
+ ```
37
+ npm link
38
+ ```
39
+
40
+ In your project:
41
+ ```
42
+ npm link {{npmName}}
43
+ ```
44
+
45
+ __Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
46
+ Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
47
+ Published packages are not effected by this issue.
48
+
49
+
50
+ #### General usage
51
+
52
+ In your Angular project:
53
+
54
+
55
+ ```
56
+ // without configuring providers
57
+ import { {{apiModuleClassName}} } from '{{npmName}}';
58
+ import { HttpClientModule } from '@angular/common/http';
59
+
60
+ @NgModule({
61
+ imports: [
62
+ {{apiModuleClassName}},
63
+ // make sure to import the HttpClientModule in the AppModule only,
64
+ // see https://github.com/angular/angular/issues/20575
65
+ HttpClientModule
66
+ ],
67
+ declarations: [ AppComponent ],
68
+ providers: [],
69
+ bootstrap: [ AppComponent ]
70
+ })
71
+ export class AppModule {}
72
+ ```
73
+
74
+ ```
75
+ // configuring providers
76
+ import { {{apiModuleClassName}}, {{configurationClassName}}, {{configurationParametersInterfaceName}} } from '{{npmName}}';
77
+
78
+ export function apiConfigFactory (): {{configurationClassName}} {
79
+ const params: {{configurationParametersInterfaceName}} = {
80
+ // set configuration parameters here.
81
+ }
82
+ return new {{configurationClassName}}(params);
83
+ }
84
+
85
+ @NgModule({
86
+ imports: [ {{apiModuleClassName}}.forRoot(apiConfigFactory) ],
87
+ declarations: [ AppComponent ],
88
+ providers: [],
89
+ bootstrap: [ AppComponent ]
90
+ })
91
+ export class AppModule {}
92
+ ```
93
+
94
+ ```
95
+ // configuring providers with an authentication service that manages your access tokens
96
+ import { {{apiModuleClassName}}, {{configurationClassName}} } from '{{npmName}}';
97
+
98
+ @NgModule({
99
+ imports: [ {{apiModuleClassName}} ],
100
+ declarations: [ AppComponent ],
101
+ providers: [
102
+ {
103
+ provide: {{configurationClassName}},
104
+ useFactory: (authService: AuthService) => new {{configurationClassName}}(
105
+ {
106
+ basePath: environment.apiUrl,
107
+ accessToken: authService.getAccessToken.bind(authService)
108
+ }
109
+ ),
110
+ deps: [AuthService],
111
+ multi: false
112
+ }
113
+ ],
114
+ bootstrap: [ AppComponent ]
115
+ })
116
+ export class AppModule {}
117
+ ```
118
+
119
+ ```
120
+ import { DefaultApi } from '{{npmName}}';
121
+
122
+ export class AppComponent {
123
+ constructor(private apiGateway: DefaultApi) { }
124
+ }
125
+ ```
126
+
127
+ Note: The {{apiModuleClassName}} is restricted to being instantiated once app wide.
128
+ This is to ensure that all services are treated as singletons.
129
+
130
+ #### Using multiple OpenAPI files / APIs / {{apiModuleClassName}}s
131
+ In order to use multiple `{{apiModuleClassName}}s` generated from different OpenAPI files,
132
+ you can create an alias name when importing the modules
133
+ in order to avoid naming conflicts:
134
+ ```
135
+ import { {{apiModuleClassName}} } from 'my-api-path';
136
+ import { {{apiModuleClassName}} as OtherApiModule } from 'my-other-api-path';
137
+ import { HttpClientModule } from '@angular/common/http';
138
+
139
+ @NgModule({
140
+ imports: [
141
+ {{apiModuleClassName}},
142
+ OtherApiModule,
143
+ // make sure to import the HttpClientModule in the AppModule only,
144
+ // see https://github.com/angular/angular/issues/20575
145
+ HttpClientModule
146
+ ]
147
+ })
148
+ export class AppModule {
149
+
150
+ }
151
+ ```
152
+
153
+
154
+ ### Set service base path
155
+ If different than the generated base path, during app bootstrap, you can provide the base path to your service.
156
+
157
+ ```
158
+ import { BASE_PATH } from '{{npmName}}';
159
+
160
+ bootstrap(AppComponent, [
161
+ { provide: BASE_PATH, useValue: 'https://your-web-service.com' },
162
+ ]);
163
+ ```
164
+ or
165
+
166
+ ```
167
+ import { BASE_PATH } from '{{npmName}}';
168
+
169
+ @NgModule({
170
+ imports: [],
171
+ declarations: [ AppComponent ],
172
+ providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
173
+ bootstrap: [ AppComponent ]
174
+ })
175
+ export class AppModule {}
176
+ ```
177
+
178
+
179
+ #### Using @angular/cli
180
+ First extend your `src/environments/*.ts` files by adding the corresponding base path:
181
+
182
+ ```
183
+ export const environment = {
184
+ production: false,
185
+ API_BASE_PATH: 'http://127.0.0.1:8080'
186
+ };
187
+ ```
188
+
189
+ In the src/app/app.module.ts:
190
+ ```
191
+ import { BASE_PATH } from '{{npmName}}';
192
+ import { environment } from '../environments/environment';
193
+
194
+ @NgModule({
195
+ declarations: [
196
+ AppComponent
197
+ ],
198
+ imports: [ ],
199
+ providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
200
+ bootstrap: [ AppComponent ]
201
+ })
202
+ export class AppModule { }
203
+ ```
204
+
205
+ ### Customizing path parameter encoding
206
+
207
+ Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple'
208
+ and Dates for format 'date-time' are encoded correctly.
209
+
210
+ Other styles (e.g. "matrix") are not that easy to encode
211
+ and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]).
212
+
213
+ To implement your own parameter encoding (or call another library),
214
+ pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object
215
+ (see [General Usage](#general-usage) above).
216
+
217
+ Example value for use in your Configuration-Provider:
218
+ ```typescript
219
+ new Configuration({
220
+ encodeParam: (param: Param) => myFancyParamEncoder(param),
221
+ })
222
+ ```
223
+
224
+ [parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations
225
+ [style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values
226
+ [@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander
@@ -0,0 +1,39 @@
1
+ import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
2
+ import { {{configurationClassName}} } from './configuration';
3
+ import { HttpClient } from '@angular/common/http';
4
+
5
+ {{#isProvidedInNone}}
6
+ {{#apiInfo}}
7
+ {{#apis}}
8
+ import { {{classname}} } from './{{importPath}}';
9
+ {{/apis}}
10
+ {{/apiInfo}}
11
+ {{/isProvidedInNone}}
12
+
13
+ @NgModule({
14
+ imports: [],
15
+ declarations: [],
16
+ exports: [],
17
+ providers: [{{#isProvidedInNone}}
18
+ {{#apiInfo}}{{#apis}}{{classname}}{{^-last}},
19
+ {{/-last}}{{/apis}}{{/apiInfo}} {{/isProvidedInNone}}]
20
+ })
21
+ export class {{apiModuleClassName}} {
22
+ public static forRoot(configurationFactory: () => {{configurationClassName}}): ModuleWithProviders{{#enforceGenericModuleWithProviders}}<{{apiModuleClassName}}>{{/enforceGenericModuleWithProviders}} {
23
+ return {
24
+ ngModule: {{apiModuleClassName}},
25
+ providers: [ { provide: {{configurationClassName}}, useFactory: configurationFactory } ]
26
+ };
27
+ }
28
+
29
+ constructor( @Optional() @SkipSelf() parentModule: {{apiModuleClassName}},
30
+ @Optional() http: HttpClient) {
31
+ if (parentModule) {
32
+ throw new Error('{{apiModuleClassName}} is already loaded. Import in your base AppModule only.');
33
+ }
34
+ if (!http) {
35
+ throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
36
+ 'See also https://github.com/angular/angular/issues/20575');
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,253 @@
1
+ {{>licenseInfo}}
2
+
3
+ /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types */
4
+
5
+ import {Injectable} from '@angular/core';
6
+ import {HttpParams, HttpResponse} from '@angular/common/http';
7
+ import {Observable} from 'rxjs';
8
+
9
+ {{#imports}}
10
+ import { {{classname}} } from '{{filename}}';
11
+ {{/imports}}
12
+
13
+ import {BaseApiService} from './base-api.service';
14
+ import {COLLECTION_FORMATS} from '../variables';
15
+ import {addToHttpParams, getResponseType, selectHeaderAccept {{#hasSomeFormParams}}, canConsumeForm{{/hasSomeFormParams}}} from '../helpers';
16
+
17
+ {{#withInterfaces}}
18
+ import {
19
+ {{classname}}Interface{{#useSingleRequestParameter}}{{#operations}}{{#operation}}{{#allParams.0}},
20
+ {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams{{/allParams.0}}{{/operation}}{{/operations}}{{/useSingleRequestParameter}}
21
+ } from './{{classFilename}}Interface';
22
+ {{/withInterfaces}}
23
+
24
+ {{#operations}}
25
+
26
+ {{^withInterfaces}}
27
+ {{#useSingleRequestParameter}}
28
+ {{#operation}}
29
+ {{#allParams.0}}
30
+ export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams {
31
+ {{#allParams}}
32
+ {{#description}}/** {{.}} */
33
+ {{/description}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#isNullable}} | null{{/isNullable}};
34
+ {{/allParams}}
35
+ }
36
+
37
+ {{/allParams.0}}
38
+ {{/operation}}
39
+ {{/useSingleRequestParameter}}
40
+ {{/withInterfaces}}
41
+
42
+ {{#description}}
43
+ /**
44
+ * {{&description}}
45
+ */
46
+ {{/description}}
47
+ {{#isProvidedInNone}}
48
+ @Injectable()
49
+ {{/isProvidedInNone}}
50
+ {{^isProvidedInNone}}
51
+ @Injectable({
52
+ providedIn: '{{providedIn}}'
53
+ })
54
+ {{/isProvidedInNone}}
55
+ {{#withInterfaces}}
56
+ export class {{classname}} extends BaseApiService implements {{classname}}Interface {
57
+ {{/withInterfaces}}
58
+ {{^withInterfaces}}
59
+ export class {{classname}} extends BaseApiService {
60
+ {{/withInterfaces}}
61
+
62
+ {{#operation}}
63
+ /**
64
+ {{#summary}}
65
+ * {{.}}
66
+ {{/summary}}
67
+ {{#notes}}
68
+ * {{.}}
69
+ {{/notes}}
70
+ {{^useSingleRequestParameter}}
71
+ {{#allParams}}
72
+ * @param {{paramName}} {{description}}
73
+ {{/allParams}}
74
+ {{/useSingleRequestParameter}}
75
+ {{#useSingleRequestParameter}}
76
+ {{#allParams.0}}
77
+ * @param requestParameters
78
+ {{/allParams.0}}
79
+ {{/useSingleRequestParameter}}
80
+ * @param observe set whether or not to return the data Observable as the body or response. defaults to returning the body.
81
+ {{#isDeprecated}}
82
+ * @deprecated
83
+ {{/isDeprecated}}
84
+ */
85
+ public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe?: 'body'): Observable<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>;
86
+ public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe?: 'response'): Observable<HttpResponse<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
87
+ public {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}observe: 'body' | 'response' = 'body'): Observable<any> {
88
+ {{#allParams}}
89
+ {{#useSingleRequestParameter}}
90
+ const {{paramName}} = requestParameters.{{paramName}};
91
+ {{/useSingleRequestParameter}}
92
+ {{#required}}
93
+ if ({{paramName}} === null || {{paramName}} === undefined) {
94
+ throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.');
95
+ }
96
+ {{/required}}
97
+ {{/allParams}}
98
+
99
+ {{#hasQueryParamsOrAuth}}
100
+ let localVarQueryParameters = new HttpParams({encoder: this.encoder});
101
+ {{#queryParams}}
102
+ {{#isArray}}
103
+ if ({{paramName}}) {
104
+ {{#isQueryParamObjectFormatJson}}
105
+ localVarQueryParameters = addToHttpParams(localVarQueryParameters,
106
+ {{paramName}}, '{{baseName}}');
107
+ {{/isQueryParamObjectFormatJson}}
108
+ {{^isQueryParamObjectFormatJson}}
109
+ {{#isCollectionFormatMulti}}
110
+ {{paramName}}.forEach((element) => {
111
+ localVarQueryParameters = addToHttpParams(localVarQueryParameters,
112
+ element, '{{baseName}}');
113
+ })
114
+ {{/isCollectionFormatMulti}}
115
+ {{^isCollectionFormatMulti}}
116
+ localVarQueryParameters = addToHttpParams(localVarQueryParameters,
117
+ [...{{paramName}}].join(COLLECTION_FORMATS['{{collectionFormat}}']), '{{baseName}}');
118
+ {{/isCollectionFormatMulti}}
119
+ {{/isQueryParamObjectFormatJson}}
120
+ }
121
+ {{/isArray}}
122
+ {{^isArray}}
123
+ if ({{paramName}} !== undefined && {{paramName}} !== null) {
124
+ localVarQueryParameters = addToHttpParams(localVarQueryParameters,
125
+ {{paramName}}, '{{baseName}}');
126
+ }
127
+ {{/isArray}}
128
+ {{/queryParams}}
129
+
130
+ {{/hasQueryParamsOrAuth}}
131
+ let localVarHeaders = this.defaultHeaders;
132
+ {{#headerParams}}
133
+ {{#isArray}}
134
+ if ({{paramName}}) {
135
+ localVarHeaders = localVarHeaders.set('{{baseName}}', [...{{paramName}}].join(COLLECTION_FORMATS['{{collectionFormat}}']));
136
+ }
137
+ {{/isArray}}
138
+ {{^isArray}}
139
+ if ({{paramName}} !== undefined && {{paramName}} !== null) {
140
+ localVarHeaders = localVarHeaders.set('{{baseName}}', String({{paramName}}));
141
+ }
142
+ {{/isArray}}
143
+ {{/headerParams}}
144
+ const localVarHttpHeaderAcceptSelected = selectHeaderAccept([
145
+ {{#produces}}
146
+ '{{{mediaType}}}'{{^-last}},{{/-last}}
147
+ {{/produces}}
148
+ ], {}, this.configuration);
149
+ if (localVarHttpHeaderAcceptSelected !== undefined) {
150
+ localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
151
+ }
152
+
153
+ {{#bodyParam}}
154
+ {{- duplicated below, don't forget to change}}
155
+ // to determine the Content-Type header
156
+ const consumes: string[] = [
157
+ {{#consumes}}
158
+ '{{{mediaType}}}'{{^-last}},{{/-last}}
159
+ {{/consumes}}
160
+ ];
161
+ {{/bodyParam}}
162
+ {{#hasFormParams}}
163
+ {{^bodyParam}}
164
+ // to determine the Content-Type header
165
+ const consumes: string[] = [
166
+ {{#consumes}}
167
+ '{{{mediaType}}}'{{^-last}},{{/-last}}
168
+ {{/consumes}}
169
+ ];
170
+ {{/bodyParam}}
171
+ {{/hasFormParams}}
172
+ {{#bodyParam}}
173
+ const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
174
+ if (httpContentTypeSelected !== undefined) {
175
+ localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
176
+ }
177
+ {{/bodyParam}}
178
+
179
+ {{#hasFormParams}}
180
+ const canConsumeForm = this.canConsumeForm(consumes);
181
+
182
+ let localVarFormParams: { append(param: string, value: any): any; };
183
+ let localVarUseForm = false;
184
+ let localVarConvertFormParamsToString = false;
185
+ {{#formParams}}
186
+ {{#isFile}}
187
+ // use FormData to transmit files using content-type "multipart/form-data"
188
+ // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data
189
+ localVarUseForm = canConsumeForm;
190
+ {{/isFile}}
191
+ {{/formParams}}
192
+ if (localVarUseForm) {
193
+ localVarFormParams = new FormData();
194
+ } else {
195
+ localVarFormParams = new HttpParams({encoder: this.encoder});
196
+ }
197
+
198
+ {{#formParams}}
199
+ {{#isArray}}
200
+ if ({{paramName}}) {
201
+ {{#isCollectionFormatMulti}}
202
+ {{paramName}}.forEach((element) => {
203
+ localVarFormParams = localVarFormParams.append('{{baseName}}', <any>element) as any || localVarFormParams;
204
+ })
205
+ {{/isCollectionFormatMulti}}
206
+ {{^isCollectionFormatMulti}}
207
+ if (localVarUseForm) {
208
+ {{paramName}}.forEach((element) => {
209
+ localVarFormParams = localVarFormParams.append('{{baseName}}', <any>element) as any || localVarFormParams;
210
+ })
211
+ } else {
212
+ localVarFormParams = localVarFormParams.append('{{baseName}}', [...{{paramName}}].join(COLLECTION_FORMATS['{{collectionFormat}}'])) as any || localVarFormParams;
213
+ }
214
+ {{/isCollectionFormatMulti}}
215
+ }
216
+ {{/isArray}}
217
+ {{^isArray}}
218
+ if ({{paramName}} !== undefined) {
219
+ localVarFormParams = localVarFormParams.append('{{baseName}}', {{^isModel}}<any>{{paramName}}{{/isModel}}{{#isModel}}localVarUseForm ? new Blob([JSON.stringify({{paramName}})], {type: 'application/json'}) : <any>{{paramName}}{{/isModel}}) as any || localVarFormParams;
220
+ }
221
+ {{/isArray}}
222
+ {{/formParams}}
223
+
224
+ {{/hasFormParams}}
225
+ let localVarPath = `{{{path}}}`;
226
+ return this.httpClient.request{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}('{{httpMethod}}', `${this.configuration.basePath}${localVarPath}`,
227
+ {
228
+ {{#bodyParam}}
229
+ body: {{paramName}},
230
+ {{/bodyParam}}
231
+ {{^bodyParam}}
232
+ {{#hasFormParams}}
233
+ body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams,
234
+ {{/hasFormParams}}
235
+ {{/bodyParam}}
236
+ {{#hasQueryParamsOrAuth}}
237
+ params: localVarQueryParameters,
238
+ {{/hasQueryParamsOrAuth}}
239
+ {{#isResponseFile}}
240
+ responseType: "blob",
241
+ {{/isResponseFile}}
242
+ {{^isResponseFile}}
243
+ responseType: <any>getResponseType(localVarHttpHeaderAcceptSelected, this.configuration),
244
+ {{/isResponseFile}}
245
+ withCredentials: this.configuration.withCredentials,
246
+ headers: localVarHeaders,
247
+ observe: <any>observe
248
+ }
249
+ );
250
+ }
251
+
252
+ {{/operation}}}
253
+ {{/operations}}
@@ -0,0 +1,47 @@
1
+ {{>licenseInfo}}
2
+
3
+ /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types */
4
+
5
+ import { Observable } from 'rxjs';
6
+
7
+ {{#imports}}
8
+ import { {{classname}} } from '../model/models';
9
+ {{/imports}}
10
+
11
+ {{#operations}}
12
+
13
+ {{#useSingleRequestParameter}}
14
+ {{#operation}}
15
+ {{#allParams.0}}
16
+ export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams {
17
+ {{#allParams}}
18
+ {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#isNullable}} | null{{/isNullable}};
19
+ {{/allParams}}
20
+ }
21
+
22
+ {{/allParams.0}}
23
+ {{/operation}}
24
+ {{/useSingleRequestParameter}}
25
+
26
+ {{#description}}
27
+ /**
28
+ * {{&description}}
29
+ */
30
+ {{/description}}
31
+ export interface {{classname}}Interface {
32
+ {{#operation}}
33
+ /**{{#summary}}
34
+ * {{.}}{{/summary}}{{#notes}}
35
+ * {{.}}{{/notes}}
36
+ {{^useSingleRequestParameter}}
37
+ {{#allParams}}* @param {{paramName}} {{description}}
38
+ {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}* @param requestParameters
39
+ {{/allParams.0}}
40
+ * @param extraParams Extra HTTP Request Parameters to be sent with the request.{{/useSingleRequestParameter}}{{#isDeprecated}}
41
+ * @deprecated{{/isDeprecated}}
42
+ */
43
+ {{nickname}}({{^useSingleRequestParameter}}{{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}{{/useSingleRequestParameter}}{{#useSingleRequestParameter}}{{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}RequestParams, {{/allParams.0}}{{/useSingleRequestParameter}}extraParams?: any): Observable<{{{returnType}}}{{^returnType}}{}{{/returnType}}>;
44
+
45
+ {{/operation}}
46
+ }
47
+ {{/operations}}
@@ -0,0 +1,12 @@
1
+ {{#apiInfo}}
2
+ {{#apis}}
3
+ {{#operations}}
4
+ export * from './{{ classFilename }}';
5
+ import { {{ classname }} } from './{{ classFilename }}';
6
+ {{/operations}}
7
+ {{#withInterfaces}}
8
+ export * from './{{ classFilename }}Interface';
9
+ {{/withInterfaces}}
10
+ {{/apis}}
11
+ export const APIS = [{{#apis}}{{#operations}}{{ classname }}{{/operations}}{{^-last}}, {{/-last}}{{/apis}}];
12
+ {{/apiInfo}}