@rxap/open-api 21.0.1 → 22.0.0-dev.1
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/CHANGELOG.md +30 -0
- package/compodoc/architecture.html +222 -0
- package/compodoc/changelog.html +74 -5
- package/compodoc/classes/OpenApiHttpResponseError.html +110 -39
- package/compodoc/classes/RxapOpenApiError.html +77 -10
- package/compodoc/classes/SchemaValidationMixin.html +100 -29
- package/compodoc/dependencies.html +124 -35
- package/compodoc/index.html +46 -5
- package/compodoc/injectables/OpenApiConfigService.html +112 -38
- package/compodoc/interfaces/OpenApiInitOptions.html +166 -111
- package/compodoc/interfaces/OpenApiMetaData.html +259 -175
- package/compodoc/interfaces/OperationObjectWithMetadata.html +165 -91
- package/compodoc/interfaces/SchemaValidationResponse.html +247 -182
- package/compodoc/js/architecture-graph.js +288 -0
- package/compodoc/js/libs/bootstrap-native.js +4 -2
- package/compodoc/js/libs/jszip.min.js +13 -0
- package/compodoc/js/libs/svg-pan-zoom.min.js +3 -3
- package/compodoc/js/libs/tablesort.min.js +3 -3
- package/compodoc/js/libs/tablesort.number.min.js +3 -3
- package/compodoc/js/libs/vis-network.min.js +78 -0
- package/compodoc/js/menu-wc.js +27 -14
- package/compodoc/js/menu.js +10 -11
- package/compodoc/js/routes/routes_index.js +1 -0
- package/compodoc/js/routes.js +142 -34
- package/compodoc/js/search/search-lunr.js +6 -8
- package/compodoc/js/search/search.js +118 -66
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/js/tabs.js +98 -15
- package/compodoc/js/tree.js +44 -7
- package/compodoc/license.html +48 -6
- package/compodoc/llms.txt +154 -0
- package/compodoc/miscellaneous/functions.html +86 -19
- package/compodoc/miscellaneous/typealiases.html +46 -4
- package/compodoc/miscellaneous/variables.html +123 -16
- package/compodoc/modules.html +44 -3
- package/compodoc/overview.html +54 -3
- package/compodoc/properties.html +45 -4
- package/compodoc/routes.html +227 -0
- package/compodoc/styles/compodoc.css +365 -44
- package/compodoc/styles/dark.css +16 -0
- package/compodoc/template-playground/default-templates.json +192 -0
- package/compodoc/template-playground/hbs-render.service.ts +217 -0
- package/compodoc/template-playground/main.ts +9 -0
- package/compodoc/template-playground/template-editor.service.ts +173 -0
- package/compodoc/template-playground/template-playground.component.ts +614 -0
- package/compodoc/template-playground/template-playground.module.ts +29 -0
- package/compodoc/template-playground/zip-export.service.ts +86 -0
- package/compodoc/template-playground-app/app.js +1389 -0
- package/compodoc/template-playground-app/index.html +462 -0
- package/docs/documentation.json +1247 -1038
- package/docs/html/assets/highlight.css +1 -1
- package/docs/html/assets/icons.js +1 -1
- package/docs/html/assets/icons.svg +1 -1
- package/docs/html/assets/main.js +5 -5
- package/docs/html/assets/navigation.js +1 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/assets/style.css +265 -228
- package/docs/html/classes/OpenApiConfigService.html +216 -14
- package/docs/html/classes/OpenApiHttpResponseError.html +215 -26
- package/docs/html/classes/RxapOpenApiError.html +242 -23
- package/docs/html/classes/SchemaValidationMixin.html +245 -16
- package/docs/html/functions/AssertOpenApiV3.html +42 -1
- package/docs/html/functions/IsOpenApiV3.html +42 -1
- package/docs/html/functions/IsReferenceObject.html +42 -1
- package/docs/html/functions/NotContainsReferenceObjects.html +46 -1
- package/docs/html/functions/OpenApiInit.html +43 -1
- package/docs/html/functions/getJsonContentSchema.html +42 -1
- package/docs/html/functions/getJsonSchema.html +42 -1
- package/docs/html/functions/hasJsonContentSchema.html +46 -1
- package/docs/html/functions/hasJsonSchema.html +42 -1
- package/docs/html/hierarchy.html +29 -0
- package/docs/html/index.html +40 -4
- package/docs/html/interfaces/OpenApiInitOptions.html +65 -5
- package/docs/html/interfaces/OpenApiMetaData.html +98 -9
- package/docs/html/interfaces/OperationObjectWithMetadata.html +151 -15
- package/docs/html/interfaces/SchemaValidationResponse.html +77 -5
- package/docs/html/modules.html +52 -1
- package/docs/html/types/OperationMap.html +33 -1
- package/docs/html/variables/DEFAULT_OPEN_API_DATA_SOURCE_META_DATA.html +33 -1
- package/docs/html/variables/DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA.html +33 -1
- package/docs/html/variables/DISABLE_SCHEMA_VALIDATION.html +33 -1
- package/docs/html/variables/DISABLE_VALIDATION.html +33 -1
- package/docs/html/variables/OPEN_API_OPERATION.html +33 -1
- package/docs/html/variables/OPEN_API_OPERATION_ID.html +33 -1
- package/docs/html/variables/OPEN_API_SERVER_ID.html +33 -1
- package/docs/html/variables/OPEN_API_SERVER_INDEX.html +33 -1
- package/docs/html/variables/RXAP_OPEN_API_CONFIG.html +33 -1
- package/docs/html/variables/RXAP_OPEN_API_STRICT_VALIDATOR.html +33 -1
- package/docs/html/variables/injectOpenApiBaseUrlHttpInterceptorFn.html +33 -0
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/classes/OpenApiConfigService.md +27 -27
- package/docs/markdown/classes/OpenApiHttpResponseError.md +26 -26
- package/docs/markdown/classes/RxapOpenApiError.md +25 -25
- package/docs/markdown/classes/SchemaValidationMixin.md +36 -30
- package/docs/markdown/functions/AssertOpenApiV3.md +3 -3
- package/docs/markdown/functions/IsOpenApiV3.md +3 -3
- package/docs/markdown/functions/IsReferenceObject.md +3 -3
- package/docs/markdown/functions/NotContainsReferenceObjects.md +7 -5
- package/docs/markdown/functions/OpenApiInit.md +5 -5
- package/docs/markdown/functions/getJsonContentSchema.md +5 -5
- package/docs/markdown/functions/getJsonSchema.md +5 -5
- package/docs/markdown/functions/hasJsonContentSchema.md +8 -6
- package/docs/markdown/functions/hasJsonSchema.md +3 -3
- package/docs/markdown/globals.md +3 -3
- package/docs/markdown/interfaces/OpenApiInitOptions.md +6 -6
- package/docs/markdown/interfaces/OpenApiMetaData.md +12 -12
- package/docs/markdown/interfaces/OperationObjectWithMetadata.md +15 -15
- package/docs/markdown/interfaces/SchemaValidationResponse.md +11 -9
- package/docs/markdown/type-aliases/OperationMap.md +3 -3
- package/docs/markdown/variables/DEFAULT_OPEN_API_DATA_SOURCE_META_DATA.md +2 -2
- package/docs/markdown/variables/DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA.md +2 -2
- package/docs/markdown/variables/DISABLE_SCHEMA_VALIDATION.md +2 -2
- package/docs/markdown/variables/DISABLE_VALIDATION.md +2 -2
- package/docs/markdown/variables/OPEN_API_OPERATION.md +2 -2
- package/docs/markdown/variables/OPEN_API_OPERATION_ID.md +2 -2
- package/docs/markdown/variables/OPEN_API_SERVER_ID.md +3 -3
- package/docs/markdown/variables/OPEN_API_SERVER_INDEX.md +2 -2
- package/docs/markdown/variables/RXAP_OPEN_API_CONFIG.md +2 -2
- package/docs/markdown/variables/RXAP_OPEN_API_STRICT_VALIDATOR.md +2 -2
- package/docs/markdown/variables/injectOpenApiBaseUrlHttpInterceptorFn.md +11 -0
- package/docs/wiki/Class.OpenApiConfigService.md +26 -26
- package/docs/wiki/Class.OpenApiHttpResponseError.md +25 -25
- package/docs/wiki/Class.RxapOpenApiError.md +24 -24
- package/docs/wiki/Class.SchemaValidationMixin.md +35 -29
- package/docs/wiki/Function.AssertOpenApiV3.md +2 -2
- package/docs/wiki/Function.IsOpenApiV3.md +2 -2
- package/docs/wiki/Function.IsReferenceObject.md +2 -2
- package/docs/wiki/Function.NotContainsReferenceObjects.md +6 -4
- package/docs/wiki/Function.OpenApiInit.md +4 -4
- package/docs/wiki/Function.getJsonContentSchema.md +4 -4
- package/docs/wiki/Function.getJsonSchema.md +4 -4
- package/docs/wiki/Function.hasJsonContentSchema.md +7 -5
- package/docs/wiki/Function.hasJsonSchema.md +2 -2
- package/docs/wiki/Interface.OpenApiInitOptions.md +5 -5
- package/docs/wiki/Interface.OpenApiMetaData.md +11 -11
- package/docs/wiki/Interface.OperationObjectWithMetadata.md +14 -14
- package/docs/wiki/Interface.SchemaValidationResponse.md +10 -8
- package/docs/wiki/TypeAlias.OperationMap.md +2 -2
- package/docs/wiki/Variable.DEFAULT_OPEN_API_DATA_SOURCE_META_DATA.md +1 -1
- package/docs/wiki/Variable.DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA.md +1 -1
- package/docs/wiki/Variable.DISABLE_SCHEMA_VALIDATION.md +1 -1
- package/docs/wiki/Variable.DISABLE_VALIDATION.md +1 -1
- package/docs/wiki/Variable.OPEN_API_OPERATION.md +1 -1
- package/docs/wiki/Variable.OPEN_API_OPERATION_ID.md +1 -1
- package/docs/wiki/Variable.OPEN_API_SERVER_ID.md +2 -2
- package/docs/wiki/Variable.OPEN_API_SERVER_INDEX.md +1 -1
- package/docs/wiki/Variable.RXAP_OPEN_API_CONFIG.md +1 -1
- package/docs/wiki/Variable.RXAP_OPEN_API_STRICT_VALIDATOR.md +1 -1
- package/docs/wiki/Variable.injectOpenApiBaseUrlHttpInterceptorFn.md +7 -0
- package/docs/wiki/_Sidebar.md +1 -1
- package/docs/wiki/globals.md +2 -2
- package/fesm2022/rxap-open-api-data-source-table.mjs +212 -162
- package/fesm2022/rxap-open-api-data-source-table.mjs.map +1 -1
- package/fesm2022/rxap-open-api-data-source.mjs +243 -188
- package/fesm2022/rxap-open-api-data-source.mjs.map +1 -1
- package/fesm2022/rxap-open-api-http-resource.mjs +13 -38
- package/fesm2022/rxap-open-api-http-resource.mjs.map +1 -1
- package/fesm2022/rxap-open-api-remote-method.mjs +299 -263
- package/fesm2022/rxap-open-api-remote-method.mjs.map +1 -1
- package/fesm2022/rxap-open-api-testing.mjs +55 -82
- package/fesm2022/rxap-open-api-testing.mjs.map +1 -1
- package/fesm2022/rxap-open-api.mjs +439 -633
- package/fesm2022/rxap-open-api.mjs.map +1 -1
- package/package.json +30 -30
- package/types/rxap-open-api-data-source-table.d.ts +47 -40
- package/types/rxap-open-api-data-source.d.ts +58 -52
- package/types/rxap-open-api-http-resource.d.ts +13 -17
- package/types/rxap-open-api-remote-method.d.ts +89 -86
- package/types/rxap-open-api-testing.d.ts +25 -28
- package/types/rxap-open-api.d.ts +153 -162
- package/docs/html/functions/injectOpenApiBaseUrlHttpInterceptorFn.html +0 -1
- package/docs/markdown/functions/injectOpenApiBaseUrlHttpInterceptorFn.md +0 -25
- package/docs/wiki/Function.injectOpenApiBaseUrlHttpInterceptorFn.md +0 -21
|
@@ -1,274 +1,310 @@
|
|
|
1
|
-
import * as i2 from
|
|
2
|
-
import {
|
|
3
|
-
import { BaseRemoteMethod, RxapRemoteMethod } from
|
|
4
|
-
import { coerceString } from
|
|
5
|
-
import * as i0 from
|
|
6
|
-
import {
|
|
7
|
-
import * as i1 from
|
|
8
|
-
import { HttpContext, HttpErrorResponse, HttpEventType
|
|
9
|
-
import { __decorate, __metadata } from
|
|
10
|
-
import { Mixin } from
|
|
11
|
-
import { BaseHttpRemoteMethod } from
|
|
12
|
-
import { firstValueFrom } from
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
const response = await this.remoteMethod.call({ parameters });
|
|
54
|
-
if (event.setTotalLength) {
|
|
55
|
-
event.setTotalLength(response.total);
|
|
56
|
-
}
|
|
57
|
-
if (this.paginator) {
|
|
58
|
-
this.paginator.length = response.total;
|
|
59
|
-
}
|
|
60
|
-
return response.rows;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
1
|
+
import * as i2 from "@rxap/open-api";
|
|
2
|
+
import { DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA, DISABLE_SCHEMA_VALIDATION, DISABLE_VALIDATION, OPEN_API_OPERATION_ID, OPEN_API_SERVER_ID, OPEN_API_SERVER_INDEX, OpenApiConfigService, OpenApiHttpResponseError, RXAP_OPEN_API_STRICT_VALIDATOR, RxapOpenApiError, SchemaValidationMixin } from "@rxap/open-api";
|
|
3
|
+
import { BaseRemoteMethod, RxapRemoteMethod } from "@rxap/remote-method";
|
|
4
|
+
import { coerceString } from "@rxap/utilities";
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
import { Inject, Injectable, Injector, Optional, inject, isDevMode } from "@angular/core";
|
|
7
|
+
import * as i1 from "@angular/common/http";
|
|
8
|
+
import { HttpClient, HttpContext, HttpErrorResponse, HttpEventType } from "@angular/common/http";
|
|
9
|
+
import { __decorate, __metadata } from "tslib";
|
|
10
|
+
import { Mixin } from "@rxap/mixin";
|
|
11
|
+
import { BaseHttpRemoteMethod } from "@rxap/remote-method/http";
|
|
12
|
+
import { firstValueFrom } from "rxjs";
|
|
13
|
+
import { filter, retry, take, tap, timeout } from "rxjs/operators";
|
|
14
|
+
var RxapOpenApiRemoteMethodError = class extends RxapOpenApiError {
|
|
15
|
+
constructor(message, code, scope) {
|
|
16
|
+
super(message, code, scope);
|
|
17
|
+
this.addSubPackageName("remote-method");
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var GetPageAdapterRemoteMethod = class GetPageAdapterRemoteMethod extends BaseRemoteMethod {
|
|
21
|
+
constructor(remoteMethod, paginator, options) {
|
|
22
|
+
super(null, remoteMethod.metadata);
|
|
23
|
+
this.remoteMethod = remoteMethod;
|
|
24
|
+
this.paginator = paginator;
|
|
25
|
+
this.options = options;
|
|
26
|
+
}
|
|
27
|
+
static BuildFilter(filterEvent) {
|
|
28
|
+
const filter = [];
|
|
29
|
+
if (filterEvent && typeof filterEvent !== "string") {
|
|
30
|
+
for (const [key, value] of Object.entries(filterEvent)) if (value !== null && value !== void 0 && `${value}` !== "") {
|
|
31
|
+
const valueString = coerceString(value);
|
|
32
|
+
if (valueString) filter.push([key, valueString].join("|"));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return filter;
|
|
36
|
+
}
|
|
37
|
+
async _call(event) {
|
|
38
|
+
const parameters = {
|
|
39
|
+
pageIndex: event.page?.pageIndex ?? 0,
|
|
40
|
+
pageSize: event.page?.pageSize ?? 10,
|
|
41
|
+
sortBy: event.sort?.active ?? this.options?.sortBy ?? void 0,
|
|
42
|
+
sortDirection: event.sort?.direction ?? this.options?.sortDirection ?? void 0,
|
|
43
|
+
filter: GetPageAdapterRemoteMethod.BuildFilter(event.filter),
|
|
44
|
+
...event.parameters ?? {}
|
|
45
|
+
};
|
|
46
|
+
const response = await this.remoteMethod.call({ parameters });
|
|
47
|
+
if (event.setTotalLength) event.setTotalLength(response.total);
|
|
48
|
+
if (this.paginator) this.paginator.length = response.total;
|
|
49
|
+
return response.rows;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
63
52
|
function GetPageAdapterFactory(remoteMethod, paginator) {
|
|
64
|
-
|
|
53
|
+
return new GetPageAdapterRemoteMethod(remoteMethod, paginator);
|
|
65
54
|
}
|
|
66
55
|
function GetPageAdapterFactoryWithOptions(options = {}) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
return (remoteMethod, paginator) => {
|
|
57
|
+
return new GetPageAdapterRemoteMethod(remoteMethod, paginator, options);
|
|
58
|
+
};
|
|
70
59
|
}
|
|
71
|
-
|
|
72
60
|
function IsOperationFromMetadataInline(metadata) {
|
|
73
|
-
|
|
61
|
+
return typeof metadata.operation === "string";
|
|
74
62
|
}
|
|
75
63
|
function RxapOpenApiRemoteMethod(operationOrId, serverIndex = 0) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (typeof operationOrId !== 'string') {
|
|
90
|
-
metadata.operation = operationOrId.operation;
|
|
91
|
-
metadata.serverId = operationOrId.serverId;
|
|
92
|
-
}
|
|
93
|
-
RxapRemoteMethod(metadata)(target);
|
|
94
|
-
};
|
|
64
|
+
return function(target) {
|
|
65
|
+
const id = typeof operationOrId === "string" ? operationOrId : IsOperationFromMetadataInline(operationOrId) ? operationOrId.operationId : operationOrId.operation.operationId ?? operationOrId.fallbackId;
|
|
66
|
+
if (!id) throw new Error("The operationId for the open api remote method is not defined");
|
|
67
|
+
const metadata = {
|
|
68
|
+
id,
|
|
69
|
+
serverIndex
|
|
70
|
+
};
|
|
71
|
+
if (typeof operationOrId !== "string") {
|
|
72
|
+
metadata.operation = operationOrId.operation;
|
|
73
|
+
metadata.serverId = operationOrId.serverId;
|
|
74
|
+
}
|
|
75
|
+
RxapRemoteMethod(metadata)(target);
|
|
76
|
+
};
|
|
95
77
|
}
|
|
96
78
|
let OpenApiRemoteMethod = class OpenApiRemoteMethod extends BaseHttpRemoteMethod {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
79
|
+
constructor(http, injector, openApiConfigService, metadata = null, strict = null, disableSchemaValidation = null, disableValidation = null) {
|
|
80
|
+
super(http, injector, metadata);
|
|
81
|
+
this.disableSchemaValidation = false;
|
|
82
|
+
this.disableValidation = false;
|
|
83
|
+
this.strict = false;
|
|
84
|
+
this.metadata["operation"] ??= openApiConfigService.getOperation(this.metadata.id);
|
|
85
|
+
if (typeof this.metadata["operation"] === "string") try {
|
|
86
|
+
this.metadata["operation"] = JSON.parse(this.metadata["operation"]);
|
|
87
|
+
} catch (e) {
|
|
88
|
+
throw new Error(`could not parse the remote method operation string into an object: ${this.constructor.name}`);
|
|
89
|
+
}
|
|
90
|
+
const operation = this.metadata["operation"];
|
|
91
|
+
this.applyMetadata({
|
|
92
|
+
id: operation.operationId,
|
|
93
|
+
url: () => openApiConfigService.getBaseUrl(this.metadata["serverIndex"], this.metadata["serverId"]) + operation.path,
|
|
94
|
+
method: operation.method,
|
|
95
|
+
withCredentials: this.metadata.withCredentials ?? true,
|
|
96
|
+
ignoreUndefined: this.metadata["ignoreUndefined"] ?? true,
|
|
97
|
+
context: new HttpContext().set(OPEN_API_OPERATION_ID, operation.operationId).set(OPEN_API_SERVER_ID, this.metadata["serverId"]).set(OPEN_API_SERVER_INDEX, this.metadata["serverIndex"])
|
|
98
|
+
});
|
|
99
|
+
this.strict = strict || this.metadata["strict"] || false;
|
|
100
|
+
this.disableSchemaValidation = disableSchemaValidation || this.metadata["disableSchemaValidation"] || false;
|
|
101
|
+
this.disableValidation = disableValidation || this.metadata["disableValidation"] || false;
|
|
102
|
+
}
|
|
103
|
+
get operation() {
|
|
104
|
+
return this.metadata["operation"];
|
|
105
|
+
}
|
|
106
|
+
async callWithResponse(args = {}) {
|
|
107
|
+
this.init();
|
|
108
|
+
this.executionsInProgress$.increase();
|
|
109
|
+
let result;
|
|
110
|
+
try {
|
|
111
|
+
result = await this._callWithResponse(args);
|
|
112
|
+
} finally {
|
|
113
|
+
this.executionsInProgress$.decrease();
|
|
114
|
+
}
|
|
115
|
+
if (result.body) {
|
|
116
|
+
this.executed$.next(result.body);
|
|
117
|
+
this.executed(result.body);
|
|
118
|
+
}
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
_callWithResponse(args = {}) {
|
|
122
|
+
if (!this.disableValidation) {
|
|
123
|
+
this.validateParameters(this.operation, args.parameters, this.strict);
|
|
124
|
+
this.validateRequestBody(this.operation, args.requestBody, this.strict);
|
|
125
|
+
}
|
|
126
|
+
return firstValueFrom(this.http.request(this.updateRequest(this.buildHttpOptions(this.operation, args.parameters, args.requestBody, this.metadata["ignoreUndefined"]))).pipe(retry(this.metadata.retry ?? 0), tap({ error: (error) => {
|
|
127
|
+
if (error instanceof HttpErrorResponse) this.interceptors?.forEach((interceptor) => interceptor.next({
|
|
128
|
+
response: error,
|
|
129
|
+
parameters: args.parameters,
|
|
130
|
+
requestBody: args.requestBody
|
|
131
|
+
}));
|
|
132
|
+
} }), filter((event) => event.type === HttpEventType.Response), tap((response) => {
|
|
133
|
+
if (!this.disableValidation) this.validateResponse(this.operation, response, this.strict);
|
|
134
|
+
}), tap((response) => {
|
|
135
|
+
this.interceptors?.forEach((interceptor) => interceptor.next({
|
|
136
|
+
response,
|
|
137
|
+
parameters: args.parameters,
|
|
138
|
+
requestBody: args.requestBody
|
|
139
|
+
}));
|
|
140
|
+
}), take(1), timeout(this.timeout)));
|
|
141
|
+
}
|
|
142
|
+
async _call(args = {}) {
|
|
143
|
+
if (!this.disableValidation) {
|
|
144
|
+
this.validateParameters(this.operation, args.parameters, this.strict);
|
|
145
|
+
this.validateRequestBody(this.operation, args.requestBody, this.strict);
|
|
146
|
+
}
|
|
147
|
+
let response;
|
|
148
|
+
try {
|
|
149
|
+
response = await this._callWithResponse(args);
|
|
150
|
+
} catch (error) {
|
|
151
|
+
if (error instanceof HttpErrorResponse) throw new OpenApiHttpResponseError(error, this.metadata);
|
|
152
|
+
else throw error;
|
|
153
|
+
}
|
|
154
|
+
if (response.body) return response.body;
|
|
155
|
+
if (isDevMode()) console.warn("The response body is empty!");
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
static {
|
|
159
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
160
|
+
minVersion: "12.0.0",
|
|
161
|
+
version: "22.3.0",
|
|
162
|
+
ngImport: i0,
|
|
163
|
+
type: OpenApiRemoteMethod,
|
|
164
|
+
deps: [
|
|
165
|
+
{ token: HttpClient },
|
|
166
|
+
{ token: Injector },
|
|
167
|
+
{ token: OpenApiConfigService },
|
|
168
|
+
{
|
|
169
|
+
token: DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA,
|
|
170
|
+
optional: true
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
token: RXAP_OPEN_API_STRICT_VALIDATOR,
|
|
174
|
+
optional: true
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
token: DISABLE_SCHEMA_VALIDATION,
|
|
178
|
+
optional: true
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
token: DISABLE_VALIDATION,
|
|
182
|
+
optional: true
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
static {
|
|
189
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
190
|
+
minVersion: "12.0.0",
|
|
191
|
+
version: "22.3.0",
|
|
192
|
+
ngImport: i0,
|
|
193
|
+
type: OpenApiRemoteMethod
|
|
194
|
+
});
|
|
195
|
+
}
|
|
202
196
|
};
|
|
203
|
-
OpenApiRemoteMethod = __decorate([
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
197
|
+
OpenApiRemoteMethod = __decorate([Mixin(SchemaValidationMixin), __metadata("design:paramtypes", [
|
|
198
|
+
HttpClient,
|
|
199
|
+
Injector,
|
|
200
|
+
OpenApiConfigService,
|
|
201
|
+
Object,
|
|
202
|
+
Object,
|
|
203
|
+
Object,
|
|
204
|
+
Object
|
|
205
|
+
])], OpenApiRemoteMethod);
|
|
206
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
207
|
+
minVersion: "12.0.0",
|
|
208
|
+
version: "22.3.0",
|
|
209
|
+
ngImport: i0,
|
|
210
|
+
type: OpenApiRemoteMethod,
|
|
211
|
+
decorators: [{ type: Injectable }],
|
|
212
|
+
ctorParameters: () => [
|
|
213
|
+
{
|
|
214
|
+
type: i1.HttpClient,
|
|
215
|
+
decorators: [{
|
|
216
|
+
type: Inject,
|
|
217
|
+
args: [HttpClient]
|
|
218
|
+
}]
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
type: i0.Injector,
|
|
222
|
+
decorators: [{
|
|
223
|
+
type: Inject,
|
|
224
|
+
args: [Injector]
|
|
225
|
+
}]
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
type: i2.OpenApiConfigService,
|
|
229
|
+
decorators: [{
|
|
230
|
+
type: Inject,
|
|
231
|
+
args: [OpenApiConfigService]
|
|
232
|
+
}]
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
type: void 0,
|
|
236
|
+
decorators: [{ type: Optional }, {
|
|
237
|
+
type: Inject,
|
|
238
|
+
args: [DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA]
|
|
239
|
+
}]
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
type: void 0,
|
|
243
|
+
decorators: [{ type: Optional }, {
|
|
244
|
+
type: Inject,
|
|
245
|
+
args: [RXAP_OPEN_API_STRICT_VALIDATOR]
|
|
246
|
+
}]
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
type: void 0,
|
|
250
|
+
decorators: [{ type: Optional }, {
|
|
251
|
+
type: Inject,
|
|
252
|
+
args: [DISABLE_SCHEMA_VALIDATION]
|
|
253
|
+
}]
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
type: void 0,
|
|
257
|
+
decorators: [{ type: Optional }, {
|
|
258
|
+
type: Inject,
|
|
259
|
+
args: [DISABLE_VALIDATION]
|
|
260
|
+
}]
|
|
261
|
+
}
|
|
262
|
+
]
|
|
263
|
+
});
|
|
264
|
+
var OpenApiRemoteMethodLoader = class OpenApiRemoteMethodLoader {
|
|
265
|
+
constructor() {
|
|
266
|
+
this.openApiConfig = inject(OpenApiConfigService);
|
|
267
|
+
this.http = inject(HttpClient);
|
|
268
|
+
this.injector = inject(Injector);
|
|
269
|
+
}
|
|
270
|
+
load(definitionId) {
|
|
271
|
+
const operation = this.openApiConfig.getOperation(definitionId);
|
|
272
|
+
if (operation) return new OpenApiRemoteMethod(this.http, this.injector, this.openApiConfig, {
|
|
273
|
+
id: definitionId,
|
|
274
|
+
operation
|
|
275
|
+
});
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
static {
|
|
279
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
280
|
+
minVersion: "12.0.0",
|
|
281
|
+
version: "22.3.0",
|
|
282
|
+
ngImport: i0,
|
|
283
|
+
type: OpenApiRemoteMethodLoader,
|
|
284
|
+
deps: [],
|
|
285
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
static {
|
|
289
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
290
|
+
minVersion: "12.0.0",
|
|
291
|
+
version: "22.3.0",
|
|
292
|
+
ngImport: i0,
|
|
293
|
+
type: OpenApiRemoteMethodLoader,
|
|
294
|
+
providedIn: "root"
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
299
|
+
minVersion: "12.0.0",
|
|
300
|
+
version: "22.3.0",
|
|
301
|
+
ngImport: i0,
|
|
302
|
+
type: OpenApiRemoteMethodLoader,
|
|
303
|
+
decorators: [{
|
|
304
|
+
type: Injectable,
|
|
305
|
+
args: [{ providedIn: "root" }]
|
|
306
|
+
}]
|
|
307
|
+
});
|
|
273
308
|
export { GetPageAdapterFactory, GetPageAdapterFactoryWithOptions, GetPageAdapterRemoteMethod, IsOperationFromMetadataInline, OpenApiRemoteMethod, OpenApiRemoteMethodLoader, RxapOpenApiRemoteMethod, RxapOpenApiRemoteMethodError };
|
|
274
|
-
|
|
309
|
+
|
|
310
|
+
//# sourceMappingURL=rxap-open-api-remote-method.mjs.map
|