@mediusinc/mng-commons 4.0.0-rc.1 → 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 (184) hide show
  1. package/esm2022/index.mjs +12 -2
  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/index.mjs +2 -1
  8. package/esm2022/lib/components/action/localization/data-language-dropdown.component.mjs +6 -7
  9. package/esm2022/lib/components/action/models/action-component.model.mjs +1 -1
  10. package/esm2022/lib/components/action/models/action-execution.model.mjs +3 -6
  11. package/esm2022/lib/components/action/models/index.mjs +1 -2
  12. package/esm2022/lib/components/action/route/action-route.component.mjs +14 -30
  13. package/esm2022/lib/components/action/table/action-table.component.mjs +154 -0
  14. package/esm2022/lib/components/form/editor/form-editor.component.mjs +5 -11
  15. package/esm2022/lib/components/form/formly/fields/formly-field-custom/formly-field-custom.component.mjs +1 -1
  16. package/esm2022/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +5 -5
  17. package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +6 -7
  18. package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +5 -5
  19. package/esm2022/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +1 -1
  20. package/esm2022/lib/components/layout/main-layout.component.mjs +21 -25
  21. package/esm2022/lib/components/layout/topbar.component.mjs +8 -8
  22. package/esm2022/lib/components/layoutV2/main-layout.component.mjs +13 -10
  23. package/esm2022/lib/components/layoutV2/menu-item.component.mjs +48 -5
  24. package/esm2022/lib/components/layoutV2/menu.component.mjs +13 -4
  25. package/esm2022/lib/components/layoutV2/services/main-layout.component.service.mjs +11 -2
  26. package/esm2022/lib/components/layoutV2/sidebar.component.mjs +5 -5
  27. package/esm2022/lib/components/layoutV2/topbar.component.mjs +7 -12
  28. package/esm2022/lib/components/notification/notification-wrapper.component.mjs +50 -0
  29. package/esm2022/lib/components/table/column-filter-full/column-filter-full.component.mjs +466 -0
  30. package/esm2022/lib/components/table/column-value/column-value.component.mjs +87 -0
  31. package/esm2022/lib/components/table/models/table.event.mjs +16 -0
  32. package/esm2022/lib/components/table/models/table.interface.mjs +2 -0
  33. package/esm2022/lib/components/table/table-column-filter-class/table-column-filter-class.pipe.mjs +25 -0
  34. package/esm2022/lib/components/table/table.component.mjs +717 -0
  35. package/esm2022/lib/components/tableview/index.mjs +1 -4
  36. package/esm2022/lib/components/tableview/route/tableview-route.abstract.component.mjs +5 -5
  37. package/esm2022/lib/components/tableview/route/tableview-route.component.mjs +3 -9
  38. package/esm2022/lib/components/tableview/tableview.component.mjs +18 -78
  39. package/esm2022/lib/descriptors/editor/editor.descriptor.mjs +1 -1
  40. package/esm2022/lib/descriptors/editor/field-lookup.descriptor.mjs +1 -2
  41. package/esm2022/lib/descriptors/filter/filter.descriptor.mjs +20 -20
  42. package/esm2022/lib/descriptors/table/table.descriptor.mjs +16 -17
  43. package/esm2022/lib/descriptors/tableview/tableview.descriptor.mjs +1 -1
  44. package/esm2022/lib/directives/component.directive.mjs +8 -4
  45. package/esm2022/lib/helpers/coercion.mjs +8 -1
  46. package/esm2022/lib/models/action-editor.model.mjs +1 -1
  47. package/esm2022/lib/models/config.model.mjs +1 -1
  48. package/esm2022/lib/models/index.mjs +2 -2
  49. package/esm2022/lib/models/layout-config.model.mjs +2 -0
  50. package/esm2022/lib/models/view-container.model.mjs +1 -1
  51. package/esm2022/lib/provide-commons.mjs +7 -1
  52. package/esm2022/lib/registry/type.registry.mjs +2 -3
  53. package/esm2022/lib/router/route-builder.mjs +1 -1
  54. package/esm2022/lib/services/action/action-executor.service.mjs +725 -0
  55. package/esm2022/lib/services/action/component-action-executor.service.mjs +19 -0
  56. package/esm2022/lib/services/action/index.mjs +5 -0
  57. package/esm2022/lib/services/action/provide-action-executor.mjs +9 -0
  58. package/esm2022/lib/services/action/root-action-executor.service.mjs +18 -0
  59. package/esm2022/lib/services/commons.service.mjs +5 -5
  60. package/esm2022/lib/services/index.mjs +1 -3
  61. package/esm2022/lib/services/logger.service.mjs +2 -2
  62. package/esm2022/lib/services/view/index.mjs +3 -0
  63. package/esm2022/lib/services/view/provide-view-container.mjs +17 -0
  64. package/esm2022/lib/services/view/view-container.service.mjs +59 -0
  65. package/esm2022/lib/utils/date.util.mjs +33 -23
  66. package/esm2022/lib/utils/notification.util.mjs +9 -16
  67. package/esm2022/lib/utils/string.util.mjs +2 -2
  68. package/esm2022/lib/utils/tableview.util.mjs +2 -2
  69. package/fesm2022/mediusinc-mng-commons.mjs +4305 -4121
  70. package/fesm2022/mediusinc-mng-commons.mjs.map +1 -1
  71. package/index.d.ts +10 -1
  72. package/lib/components/action/action.component.d.ts +11 -17
  73. package/lib/components/action/editor/action-editor.component.d.ts +20 -80
  74. package/lib/components/action/editor/injector-context/action-editor-injector-context.component.d.ts +80 -0
  75. package/lib/components/action/index.d.ts +1 -0
  76. package/lib/components/action/localization/data-language-dropdown.component.d.ts +2 -3
  77. package/lib/components/action/models/action-component.model.d.ts +0 -2
  78. package/lib/components/action/models/action-execution.model.d.ts +6 -6
  79. package/lib/components/action/models/index.d.ts +0 -1
  80. package/lib/components/action/route/action-route.component.d.ts +6 -12
  81. package/lib/components/action/table/action-table.component.d.ts +50 -0
  82. package/lib/components/form/editor/form-editor.component.d.ts +4 -7
  83. package/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.d.ts +2 -4
  84. package/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.d.ts +0 -2
  85. package/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.d.ts +1 -3
  86. package/lib/components/layout/main-layout.component.d.ts +4 -7
  87. package/lib/components/layoutV2/main-layout.component.d.ts +4 -3
  88. package/lib/components/layoutV2/menu-item.component.d.ts +7 -3
  89. package/lib/components/layoutV2/menu.component.d.ts +2 -0
  90. package/lib/components/layoutV2/services/main-layout.component.service.d.ts +3 -0
  91. package/lib/components/layoutV2/sidebar.component.d.ts +1 -1
  92. package/lib/components/layoutV2/topbar.component.d.ts +2 -3
  93. package/lib/components/notification/notification-wrapper.component.d.ts +12 -0
  94. package/lib/components/{tableview/table → table}/column-filter-full/column-filter-full.component.d.ts +2 -2
  95. package/lib/components/{tableview/table → table}/column-value/column-value.component.d.ts +3 -3
  96. package/lib/components/{tableview/table → table}/models/table.interface.d.ts +3 -1
  97. package/lib/components/table/table-column-filter-class/table-column-filter-class.pipe.d.ts +8 -0
  98. package/lib/components/table/table.component.d.ts +122 -0
  99. package/lib/components/tableview/index.d.ts +0 -3
  100. package/lib/components/tableview/route/tableview-route.abstract.component.d.ts +2 -3
  101. package/lib/components/tableview/route/tableview-route.component.d.ts +0 -3
  102. package/lib/components/tableview/tableview.component.d.ts +4 -20
  103. package/lib/descriptors/editor/editor.descriptor.d.ts +1 -1
  104. package/lib/descriptors/filter/filter.descriptor.d.ts +7 -7
  105. package/lib/descriptors/table/table.descriptor.d.ts +15 -12
  106. package/lib/descriptors/tableview/tableview.descriptor.d.ts +1 -1
  107. package/lib/directives/component.directive.d.ts +3 -2
  108. package/lib/models/action-editor.model.d.ts +11 -0
  109. package/lib/models/config.model.d.ts +3 -13
  110. package/lib/models/index.d.ts +1 -1
  111. package/lib/models/layout-config.model.d.ts +33 -0
  112. package/lib/models/view-container.model.d.ts +0 -25
  113. package/lib/router/route-builder.d.ts +1 -1
  114. package/lib/services/{action-executor.service.d.ts → action/action-executor.service.d.ts} +32 -31
  115. package/lib/services/action/component-action-executor.service.d.ts +9 -0
  116. package/lib/services/action/index.d.ts +4 -0
  117. package/lib/services/action/provide-action-executor.d.ts +2 -0
  118. package/lib/services/action/root-action-executor.service.d.ts +9 -0
  119. package/lib/services/index.d.ts +0 -2
  120. package/lib/services/view/index.d.ts +2 -0
  121. package/lib/services/view/provide-view-container.d.ts +2 -0
  122. package/lib/services/view/view-container.service.d.ts +32 -0
  123. package/lib/utils/date.util.d.ts +12 -2
  124. package/lib/utils/notification.util.d.ts +6 -6
  125. package/openapi/angular/README.mustache +226 -0
  126. package/openapi/angular/api.module.mustache +39 -0
  127. package/openapi/angular/api.service.mustache +253 -0
  128. package/openapi/angular/apiInterface.mustache +47 -0
  129. package/openapi/angular/apis.mustache +12 -0
  130. package/openapi/angular/configuration.mustache +128 -0
  131. package/openapi/angular/custom/base-api.service.mustache +14 -0
  132. package/openapi/angular/custom/helpers.mustache +71 -0
  133. package/openapi/angular/custom/modelSchema.mustache +46 -0
  134. package/openapi/angular/custom/schema.mustache +18 -0
  135. package/openapi/angular/encoder.mustache +20 -0
  136. package/openapi/angular/git_push.sh.mustache +57 -0
  137. package/openapi/angular/index.mustache +0 -0
  138. package/openapi/angular/licenseInfo.mustache +11 -0
  139. package/openapi/angular/model.mustache +16 -0
  140. package/openapi/angular/modelAlias.mustache +1 -0
  141. package/openapi/angular/modelEnum.mustache +24 -0
  142. package/openapi/angular/modelGeneric.mustache +14 -0
  143. package/openapi/angular/modelGenericAdditionalProperties.mustache +5 -0
  144. package/openapi/angular/modelGenericEnums.mustache +30 -0
  145. package/openapi/angular/modelOneOf.mustache +14 -0
  146. package/openapi/angular/modelTaggedUnion.mustache +21 -0
  147. package/openapi/angular/models.mustache +5 -0
  148. package/openapi/angular/ng-package.mustache +6 -0
  149. package/openapi/angular/package.mustache +39 -0
  150. package/openapi/angular/param.mustache +69 -0
  151. package/openapi/angular/tsconfig.mustache +28 -0
  152. package/openapi/angular/variables.mustache +9 -0
  153. package/openapi/{templates → node}/model.mustache +3 -17
  154. package/package.json +2 -2
  155. package/scss/mng-commons-dark-v2.scss +1 -1
  156. package/scss/mng-commons-light-v2.scss +1 -1
  157. package/scss/mng-overrides/_theme_datatable.scss +24 -10
  158. package/scss/v2/layout/layout.scss +2 -2
  159. package/scss/v2/layout/mng/_mng_layout_topbar.scss +2 -0
  160. package/scss/v2/layout/preloading.scss +8 -8
  161. package/scss/v2/theme/theme-base/mng/_mng_theme_datatable.scss +24 -9
  162. package/scss/v2/theme/theme-dark/_variables.scss +24 -12
  163. package/scss/v2/theme/theme-dark/blue/theme.scss +4 -4
  164. package/scss/v2/theme/theme-light/_variables.scss +23 -11
  165. package/scss/v2/theme/theme-light/blue/theme.scss +2 -2
  166. package/esm2022/lib/components/action/models/action-confirmation-service.model.mjs +0 -2
  167. package/esm2022/lib/components/tableview/models/index.mjs +0 -2
  168. package/esm2022/lib/components/tableview/models/table.event.mjs +0 -16
  169. package/esm2022/lib/components/tableview/table/column-filter-full/column-filter-full.component.mjs +0 -467
  170. package/esm2022/lib/components/tableview/table/column-value/column-value.component.mjs +0 -87
  171. package/esm2022/lib/components/tableview/table/models/index.mjs +0 -2
  172. package/esm2022/lib/components/tableview/table/models/table.interface.mjs +0 -2
  173. package/esm2022/lib/components/tableview/table/table.component.mjs +0 -752
  174. package/esm2022/lib/models/menu-config.model.mjs +0 -2
  175. package/esm2022/lib/services/action-executor.service.mjs +0 -747
  176. package/esm2022/lib/services/view-container.component.service.mjs +0 -65
  177. package/lib/components/action/models/action-confirmation-service.model.d.ts +0 -6
  178. package/lib/components/tableview/models/index.d.ts +0 -1
  179. package/lib/components/tableview/table/models/index.d.ts +0 -1
  180. package/lib/components/tableview/table/table.component.d.ts +0 -147
  181. package/lib/models/menu-config.model.d.ts +0 -15
  182. package/lib/services/view-container.component.service.d.ts +0 -36
  183. /package/lib/components/{tableview → table}/models/table.event.d.ts +0 -0
  184. /package/openapi/{templates → node}/models.mustache +0 -0
@@ -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}}
@@ -0,0 +1,128 @@
1
+ import {Injectable} from '@angular/core';
2
+ import {HttpParameterCodec} from '@angular/common/http';
3
+ import {Param} from './param';
4
+
5
+ export interface {{configurationParametersInterfaceName}} {
6
+ basePath?: string;
7
+ withCredentials?: boolean;
8
+ /**
9
+ * Takes care of encoding query- and form-parameters.
10
+ */
11
+ encoder?: HttpParameterCodec;
12
+ /**
13
+ * Override the default method for encoding path parameters in various
14
+ * <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
15
+ * <p>
16
+ * See {@link README.md} for more details
17
+ * </p>
18
+ */
19
+ encodeParam?: (param: Param) => string;
20
+ }
21
+
22
+ {{#isProvidedInNone}}
23
+ @Injectable()
24
+ {{/isProvidedInNone}}
25
+ {{^isProvidedInNone}}
26
+ @Injectable({
27
+ providedIn: '{{providedIn}}'
28
+ })
29
+ {{/isProvidedInNone}}
30
+ export class {{configurationClassName}} {
31
+ basePath?: string;
32
+ withCredentials?: boolean;
33
+ /**
34
+ * Takes care of encoding query- and form-parameters.
35
+ */
36
+ encoder?: HttpParameterCodec;
37
+ /**
38
+ * Encoding of various path parameter
39
+ * <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
40
+ * <p>
41
+ * See {@link README.md} for more details
42
+ * </p>
43
+ */
44
+ encodeParam: (param: Param) => string = param => this.defaultEncodeParam(param);
45
+
46
+ public init(config: {{configurationParametersInterfaceName}} | string = {}) {
47
+ if (typeof config === 'string') {
48
+ this.basePath = config;
49
+ } else {
50
+ this.basePath = config.basePath;
51
+ this.withCredentials = config.withCredentials;
52
+ this.encoder = config.encoder;
53
+ if (config.encodeParam) {
54
+ this.encodeParam = config.encodeParam;
55
+ }
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Select the correct content-type to use for a request.
61
+ * Uses {@link {{configurationClassName}}#isJsonMime} to determine the correct content-type.
62
+ * If no content type is found return the first found type if the contentTypes is not empty
63
+ * @param contentTypes - the array of content types that are available for selection
64
+ * @returns the selected content-type or <code>undefined</code> if no selection could be made.
65
+ */
66
+ public selectHeaderContentType (contentTypes: string[]): string | undefined {
67
+ if (contentTypes.length === 0) {
68
+ return undefined;
69
+ }
70
+
71
+ const type = contentTypes.find((x: string) => this.isJsonMime(x));
72
+ if (type === undefined) {
73
+ return contentTypes[0];
74
+ }
75
+ return type;
76
+ }
77
+
78
+ /**
79
+ * Select the correct accept content-type to use for a request.
80
+ * Uses {@link {{configurationClassName}}#isJsonMime} to determine the correct accept content-type.
81
+ * If no content type is found return the first found type if the contentTypes is not empty
82
+ * @param accepts - the array of content types that are available for selection.
83
+ * @returns the selected content-type or <code>undefined</code> if no selection could be made.
84
+ */
85
+ public selectHeaderAccept(accepts: string[]): string | undefined {
86
+ if (accepts.length === 0) {
87
+ return undefined;
88
+ }
89
+
90
+ const type = accepts.find((x: string) => this.isJsonMime(x));
91
+ if (type === undefined) {
92
+ return accepts[0];
93
+ }
94
+ return type;
95
+ }
96
+
97
+ /**
98
+ * Check if the given MIME is a JSON MIME.
99
+ * JSON MIME examples:
100
+ * application/json
101
+ * application/json; charset=UTF8
102
+ * APPLICATION/JSON
103
+ * application/vnd.company+json
104
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
105
+ * @return True if the given MIME is JSON, false otherwise.
106
+ */
107
+ public isJsonMime(mime: string): boolean {
108
+ // eslint-disable-next-line no-control-regex
109
+ const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
110
+ return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
111
+ }
112
+
113
+ private defaultEncodeParam(param: Param): string {
114
+ // This implementation exists as fallback for missing configuration
115
+ // and for backwards compatibility to older typescript-angular generator versions.
116
+ // It only works for the 'simple' parameter style.
117
+ // Date-handling only works for the 'date-time' format.
118
+ // All other styles and Date-formats are probably handled incorrectly.
119
+ //
120
+ // But: if that's all you need (i.e.: the most common use-case): no need for customization!
121
+
122
+ const value = param.dataFormat === 'date-time' && param.value instanceof Date
123
+ ? (param.value as Date).toISOString()
124
+ : param.value;
125
+
126
+ return encodeURIComponent(String(value));
127
+ }
128
+ }
@@ -0,0 +1,14 @@
1
+ /* eslint-disable */
2
+
3
+ import {HttpClient, HttpHeaders, HttpParameterCodec} from '@angular/common/http';
4
+ import {inject} from '@angular/core';
5
+
6
+ import { {{configurationClassName}} } from '../configuration';
7
+ import {CustomHttpParameterCodec} from '../encoder';
8
+
9
+ export class BaseApiService {
10
+ protected readonly httpClient = inject(HttpClient);
11
+ protected readonly configuration = inject({{configurationClassName}});
12
+ protected readonly encoder: HttpParameterCodec = this.configuration?.encoder ?? new CustomHttpParameterCodec();
13
+ public readonly defaultHeaders = new HttpHeaders();
14
+ }
@@ -0,0 +1,71 @@
1
+ // eslint-disable
2
+
3
+ import {HttpContext, HttpParams} from '@angular/common/http';
4
+
5
+ import { {{configurationClassName}} } from './configuration';
6
+
7
+ export function addToHttpParams(httpParams: HttpParams, value: unknown, key?: string): HttpParams {
8
+ if (typeof value === 'object' && !(value instanceof Date)) {
9
+ httpParams = addToHttpParamsRecursive(httpParams, value);
10
+ } else {
11
+ httpParams = addToHttpParamsRecursive(httpParams, value, key);
12
+ }
13
+ return httpParams;
14
+ }
15
+
16
+ function addToHttpParamsRecursive(httpParams: HttpParams, value?: unknown, key?: string): HttpParams {
17
+ if (value == null) {
18
+ return httpParams;
19
+ }
20
+
21
+ if (typeof value === 'object') {
22
+ if (Array.isArray(value)) {
23
+ value.forEach(elem => (httpParams = addToHttpParamsRecursive(httpParams, elem, key)));
24
+ } else if (value instanceof Date) {
25
+ if (key != null) {
26
+ httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
27
+ } else {
28
+ throw Error('key may not be null if value is Date');
29
+ }
30
+ } else {
31
+ Object.keys(value).forEach(k => (httpParams = addToHttpParamsRecursive(httpParams, value[k as keyof object], key != null ? `${key}.${k}` : k)));
32
+ }
33
+ } else if (key != null) {
34
+ httpParams = httpParams.append(key, String(value));
35
+ } else {
36
+ throw Error('key may not be null if value is not object or array');
37
+ }
38
+ return httpParams;
39
+ }
40
+
41
+ export function selectHeaderAccept(producesAccepts: string[], options?: {httpHeaderAccept?: string; context?: HttpContext}, configuration?: {{configurationClassName}}) {
42
+ let accept: string | undefined = options?.httpHeaderAccept;
43
+ if (accept === undefined) {
44
+ // to determine the Accept header
45
+ accept = configuration?.selectHeaderAccept(producesAccepts);
46
+ }
47
+ return accept;
48
+ }
49
+
50
+ export function getResponseType(selectedAcceptHeader?: string, configuration?: {{configurationClassName}}): 'text' | 'json' | 'blob' {
51
+ if (selectedAcceptHeader) {
52
+ if (selectedAcceptHeader.startsWith('text')) {
53
+ return 'text';
54
+ } else if (configuration?.isJsonMime(selectedAcceptHeader)) {
55
+ return 'json';
56
+ } else {
57
+ return 'blob';
58
+ }
59
+ }
60
+ return 'json';
61
+ }
62
+
63
+ export function canConsumeForm(consumes: string[]): boolean {
64
+ const form = 'multipart/form-data';
65
+ for (const consume of consumes) {
66
+ if (form === consume) {
67
+ return true;
68
+ }
69
+ }
70
+ return false;
71
+ }
@@ -0,0 +1,46 @@
1
+ import {Schema} from '../schema';
2
+
3
+ {{#models}}
4
+ {{#model}}
5
+ export const ${{name}}Schema: Schema = {
6
+ name: '{{name}}',
7
+ {{#isEnum}}
8
+ // enums not yet generated
9
+ {{/isEnum}}
10
+ {{^isEnum}}
11
+ {{#isAlias}}
12
+ // aliases not yet generated
13
+ {{/isAlias}}
14
+ {{^isAlias}}
15
+ {{#taggedUnions}}
16
+ // tagged unions not yet generated
17
+ {{/taggedUnions}}
18
+ {{^taggedUnions}}
19
+ {{#oneOf}}
20
+ // one of not yet generated
21
+ {{/oneOf}}
22
+ {{^oneOf}}
23
+ properties: {
24
+ {{#vars}}
25
+ {{name}}: {
26
+ type: '{{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{#isDate}}date{{/isDate}}{{^isDate}}{{#isDateTime}}date-time{{/isDateTime}}{{^isDateTime}}{{{dataType}}}{{/isDateTime}}{{/isDate}}{{/isEnum}}',{{#isReadOnly}}
27
+ isReadOnly: true,{{/isReadOnly}}{{#required}}
28
+ required: true,{{/required}}{{#isNullable}}
29
+ isNullable: true,{{/isNullable}}{{#minLength}}
30
+ minLength: {{.}},{{/minLength}}{{#maxLength}}
31
+ maxLength: {{.}},{{/maxLength}}{{#minimum}}
32
+ minimum: {{.}},{{/minimum}}{{#maximum}}
33
+ maximum: {{.}},{{/maximum}}{{#exclusiveMinimum}}
34
+ exclusiveMinimum: true,{{/exclusiveMinimum}}{{#exclusiveMaximum}}
35
+ exclusiveMaximum: true,{{/exclusiveMaximum}}{{#pattern}}
36
+ pattern: '{{{.}}}'{{/pattern}}
37
+ },
38
+ {{/vars}}
39
+ }
40
+ {{/oneOf}}
41
+ {{/taggedUnions}}
42
+ {{/isAlias}}
43
+ {{/isEnum}}
44
+ };
45
+ {{/model}}
46
+ {{/models}}
@@ -0,0 +1,18 @@
1
+ export interface Schema {
2
+ name: string;
3
+ properties?: Record<string, SchemaProperty>;
4
+ }
5
+
6
+ export interface SchemaProperty {
7
+ type: string;
8
+ isReadOnly?: boolean;
9
+ required?: boolean;
10
+ isNullable?: boolean;
11
+ minLength?: boolean;
12
+ maxLength?: boolean;
13
+ minimum?: boolean;
14
+ maximum?: boolean;
15
+ exclusiveMinimum?: boolean;
16
+ exclusiveMaximum?: boolean;
17
+ pattern?: string;
18
+ }
@@ -0,0 +1,20 @@
1
+ import { HttpParameterCodec } from '@angular/common/http';
2
+
3
+ /**
4
+ * Custom HttpParameterCodec
5
+ * Workaround for https://github.com/angular/angular/issues/18261
6
+ */
7
+ export class CustomHttpParameterCodec implements HttpParameterCodec {
8
+ encodeKey(k: string): string {
9
+ return encodeURIComponent(k);
10
+ }
11
+ encodeValue(v: string): string {
12
+ return encodeURIComponent(v);
13
+ }
14
+ decodeKey(k: string): string {
15
+ return decodeURIComponent(k);
16
+ }
17
+ decodeValue(v: string): string {
18
+ return decodeURIComponent(v);
19
+ }
20
+ }
@@ -0,0 +1,57 @@
1
+ #!/bin/sh
2
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3
+ #
4
+ # Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
5
+
6
+ git_user_id=$1
7
+ git_repo_id=$2
8
+ release_note=$3
9
+ git_host=$4
10
+
11
+ if [ "$git_host" = "" ]; then
12
+ git_host="{{{gitHost}}}"
13
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
14
+ fi
15
+
16
+ if [ "$git_user_id" = "" ]; then
17
+ git_user_id="{{{gitUserId}}}"
18
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
19
+ fi
20
+
21
+ if [ "$git_repo_id" = "" ]; then
22
+ git_repo_id="{{{gitRepoId}}}"
23
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
24
+ fi
25
+
26
+ if [ "$release_note" = "" ]; then
27
+ release_note="{{{releaseNote}}}"
28
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
29
+ fi
30
+
31
+ # Initialize the local directory as a Git repository
32
+ git init
33
+
34
+ # Adds the files in the local repository and stages them for commit.
35
+ git add .
36
+
37
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
38
+ git commit -m "$release_note"
39
+
40
+ # Sets the new remote
41
+ git_remote=$(git remote)
42
+ if [ "$git_remote" = "" ]; then # git remote not defined
43
+
44
+ if [ "$GIT_TOKEN" = "" ]; then
45
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
46
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
47
+ else
48
+ git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
49
+ fi
50
+
51
+ fi
52
+
53
+ git pull origin master
54
+
55
+ # Pushes (Forces) the changes in the local repository up to the remote repository
56
+ echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
57
+ git push origin master 2>&1 | grep -v 'To https'
File without changes