@rxap/open-api 14.2.0 → 16.0.0-dev.0

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 (68) hide show
  1. package/esm2022/lib/open-api-config.service.mjs +161 -0
  2. package/esm2022/lib/open-api-http-response.error.mjs +18 -0
  3. package/esm2022/lib/schema-validation.mixin.mjs +257 -0
  4. package/esm2022/remote-method/lib/open-api-remote-method.loader.mjs +38 -0
  5. package/esm2022/remote-method/lib/open-api.remote-method.mjs +165 -0
  6. package/{fesm2020 → fesm2022}/rxap-open-api-remote-method.mjs +10 -11
  7. package/{fesm2020 → fesm2022}/rxap-open-api-remote-method.mjs.map +1 -1
  8. package/{fesm2020 → fesm2022}/rxap-open-api.mjs +24 -24
  9. package/{fesm2020 → fesm2022}/rxap-open-api.mjs.map +1 -1
  10. package/lib/open-api-config.service.d.ts +1 -1
  11. package/package.json +23 -47
  12. package/src/schematics/open-api/coerce-open-api-project.js +6 -4
  13. package/src/schematics/open-api/coerce-open-api-project.js.map +1 -1
  14. package/src/schematics/open-api/index.js +0 -5
  15. package/src/schematics/open-api/index.js.map +1 -1
  16. package/src/schematics/open-api/schema.json +0 -8
  17. package/data-source/index.d.ts +0 -5
  18. package/data-source/lib/error.d.ts +0 -4
  19. package/data-source/lib/open-api-data-source.loader.d.ts +0 -12
  20. package/data-source/lib/open-api.data-source.d.ts +0 -41
  21. package/data-source/public_api.d.ts +0 -5
  22. package/data-source/table/index.d.ts +0 -5
  23. package/data-source/table/lib/error.d.ts +0 -4
  24. package/data-source/table/lib/open-api-table.data-source.d.ts +0 -29
  25. package/data-source/table/lib/to-open-api-table-data-source.pipe.d.ts +0 -17
  26. package/data-source/table/lib/tokens.d.ts +0 -2
  27. package/data-source/table/public_api.d.ts +0 -4
  28. package/esm2020/data-source/lib/error.mjs +0 -8
  29. package/esm2020/data-source/lib/open-api-data-source.loader.mjs +0 -36
  30. package/esm2020/data-source/lib/open-api.data-source.mjs +0 -140
  31. package/esm2020/data-source/public_api.mjs +0 -6
  32. package/esm2020/data-source/rxap-open-api-data-source.mjs +0 -5
  33. package/esm2020/data-source/table/lib/error.mjs +0 -8
  34. package/esm2020/data-source/table/lib/open-api-table.data-source.mjs +0 -127
  35. package/esm2020/data-source/table/lib/to-open-api-table-data-source.pipe.mjs +0 -29
  36. package/esm2020/data-source/table/lib/tokens.mjs +0 -3
  37. package/esm2020/data-source/table/public_api.mjs +0 -5
  38. package/esm2020/data-source/table/rxap-open-api-data-source-table.mjs +0 -5
  39. package/esm2020/lib/open-api-config.service.mjs +0 -160
  40. package/esm2020/lib/open-api-http-response.error.mjs +0 -18
  41. package/esm2020/lib/schema-validation.mixin.mjs +0 -256
  42. package/esm2020/remote-method/lib/open-api-remote-method.loader.mjs +0 -37
  43. package/esm2020/remote-method/lib/open-api.remote-method.mjs +0 -166
  44. package/fesm2015/rxap-open-api-data-source-table.mjs +0 -172
  45. package/fesm2015/rxap-open-api-data-source-table.mjs.map +0 -1
  46. package/fesm2015/rxap-open-api-data-source.mjs +0 -188
  47. package/fesm2015/rxap-open-api-data-source.mjs.map +0 -1
  48. package/fesm2015/rxap-open-api-remote-method.mjs +0 -222
  49. package/fesm2015/rxap-open-api-remote-method.mjs.map +0 -1
  50. package/fesm2015/rxap-open-api.mjs +0 -467
  51. package/fesm2015/rxap-open-api.mjs.map +0 -1
  52. package/fesm2020/rxap-open-api-data-source-table.mjs +0 -168
  53. package/fesm2020/rxap-open-api-data-source-table.mjs.map +0 -1
  54. package/fesm2020/rxap-open-api-data-source.mjs +0 -183
  55. package/fesm2020/rxap-open-api-data-source.mjs.map +0 -1
  56. package/src/schematics/open-api/generate-data-source.d.ts +0 -2
  57. package/src/schematics/open-api/generate-data-source.js +0 -76
  58. package/src/schematics/open-api/generate-data-source.js.map +0 -1
  59. /package/{esm2020 → esm2022}/index.mjs +0 -0
  60. /package/{esm2020 → esm2022}/lib/error.mjs +0 -0
  61. /package/{esm2020 → esm2022}/lib/open-api.meta-data.mjs +0 -0
  62. /package/{esm2020 → esm2022}/lib/open-api.mjs +0 -0
  63. /package/{esm2020 → esm2022}/lib/tokens.mjs +0 -0
  64. /package/{esm2020 → esm2022}/lib/utilities.mjs +0 -0
  65. /package/{esm2020 → esm2022}/remote-method/lib/error.mjs +0 -0
  66. /package/{esm2020 → esm2022}/remote-method/public_api.mjs +0 -0
  67. /package/{esm2020 → esm2022}/remote-method/rxap-open-api-remote-method.mjs +0 -0
  68. /package/{esm2020 → esm2022}/rxap-open-api.mjs +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"rxap-open-api-remote-method.mjs","sources":["../../../../libs/open-api/remote-method/src/lib/open-api.remote-method.ts","../../../../libs/open-api/remote-method/src/lib/open-api-remote-method.loader.ts","../../../../libs/open-api/remote-method/src/lib/error.ts","../../../../libs/open-api/remote-method/src/rxap-open-api-remote-method.ts"],"sourcesContent":["import {\n Inject,\n Injector,\n Optional,\n Injectable,\n isDevMode\n} from '@angular/core';\nimport {\n HttpClient,\n HttpResponse,\n HttpEventType,\n HttpErrorResponse\n} from '@angular/common/http';\nimport {\n OperationObjectWithMetadata,\n OpenApiConfigService,\n SchemaValidationMixin,\n RXAP_OPEN_API_STRICT_VALIDATOR,\n DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA,\n DISABLE_SCHEMA_VALIDATION,\n DISABLE_VALIDATION,\n OpenApiHttpResponseError,\n OpenApiMetaData\n} from '@rxap/open-api';\nimport { BaseHttpRemoteMethod } from '@rxap/remote-method/http';\nimport { RxapRemoteMethod } from '@rxap/remote-method';\nimport {\n filter,\n timeout,\n retry,\n tap,\n take\n} from 'rxjs/operators';\nimport { Mixin } from '@rxap/mixin';\n\nexport interface OperationForMetadata {\n operation: OperationObjectWithMetadata;\n /**\n * used to specify the target server for the reset api operation\n */\n serverId?: string;\n /**\n * the fallback id used if the operation does not have a operationId\n */\n fallbackId?: string;\n}\n\nexport interface OperationFromMetadataInline {\n operationId: string;\n operation: string;\n /**\n * used to specify the target server for the reset api operation\n */\n serverId?: string;\n}\n\nexport function IsOperationFromMetadataInline(metadata: OperationForMetadata | OperationFromMetadataInline): metadata is OperationFromMetadataInline {\n return typeof metadata.operation === 'string';\n}\n\nexport function RxapOpenApiRemoteMethod(operationOrId: string | OperationForMetadata | OperationFromMetadataInline, serverIndex: number = 0) {\n return function(target: any) {\n const id = typeof operationOrId === 'string' ? operationOrId : (IsOperationFromMetadataInline(operationOrId) ? operationOrId.operationId : operationOrId.operation.operationId ?? operationOrId.fallbackId);\n if (!id) {\n throw new Error('The operationId for the open api remote method is not defined');\n }\n const metadata: OpenApiRemoteMethodMetadata = {\n id,\n serverIndex\n };\n if (typeof operationOrId !== 'string') {\n metadata.operation = operationOrId.operation;\n metadata.serverId = operationOrId.serverId;\n }\n RxapRemoteMethod(metadata)(target);\n };\n}\n\nexport interface OpenApiRemoteMethodMetadata extends OpenApiMetaData {\n\n}\n\nexport interface OpenApiRemoteMethodParameter<Parameters extends Record<string, any> | void = any, RequestBody = any> {\n parameters?: Parameters,\n requestBody?: RequestBody\n}\n\nexport interface OpenApiRemoteMethod<Response = any, Parameters extends Record<string, any> | void = any, RequestBody = any>\n extends SchemaValidationMixin<Response, Parameters, RequestBody> {}\n\n@Mixin(SchemaValidationMixin)\n@Injectable()\nexport class OpenApiRemoteMethod<Response = any, Parameters extends Record<string, any> | void = any, RequestBody = any>\n extends BaseHttpRemoteMethod<Response, any, OpenApiRemoteMethodParameter<Parameters, RequestBody>> {\n\n public get operation(): OperationObjectWithMetadata {\n return this.metadata.operation;\n }\n\n private readonly strict: boolean = false;\n protected readonly disableSchemaValidation: boolean = false;\n protected readonly disableValidation: boolean = false;\n\n constructor(\n @Inject(HttpClient) http: HttpClient,\n @Inject(Injector) injector: Injector,\n @Inject(OpenApiConfigService) openApiConfigService: OpenApiConfigService,\n @Optional()\n @Inject(DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA)\n metadata: OpenApiRemoteMethodMetadata | null = null,\n @Optional()\n @Inject(RXAP_OPEN_API_STRICT_VALIDATOR)\n strict: boolean | null = null,\n @Optional()\n @Inject(DISABLE_SCHEMA_VALIDATION)\n disableSchemaValidation: boolean | null = null,\n @Optional()\n @Inject(DISABLE_VALIDATION)\n disableValidation: boolean | null = null\n ) {\n super(http, injector, metadata);\n this.metadata.operation ??= openApiConfigService.getOperation(this.metadata.id);\n if (typeof this.metadata.operation === 'string') {\n try {\n this.metadata.operation = JSON.parse(this.metadata.operation);\n } catch (e: any) {\n throw new Error(`could not parse the remote method operation string into an object: ${this.constructor.name}`);\n }\n }\n const operation: OperationObjectWithMetadata & { serverId?: string } = this.metadata.operation;\n this.applyMetadata({\n id: operation.operationId,\n url: () => openApiConfigService.getBaseUrl(this.metadata.serverIndex, this.metadata.serverId) + operation.path,\n method: operation.method as any,\n withCredentials: this.metadata.withCredentials ?? true,\n ignoreUndefined: this.metadata.ignoreUndefined ?? true,\n });\n this.strict = strict || this.metadata.strict || false;\n this.disableSchemaValidation = disableSchemaValidation || this.metadata.disableSchemaValidation || false;\n this.disableValidation = disableValidation || this.metadata.disableValidation || false;\n }\n\n protected async _call(args: OpenApiRemoteMethodParameter<Parameters, RequestBody> = {}): Promise<Response> {\n\n if (!this.disableValidation) {\n this.validateParameters(this.operation, args.parameters, this.strict);\n this.validateRequestBody(this.operation, args.requestBody, this.strict);\n }\n\n let response: HttpResponse<Response>;\n\n try {\n response = await this._callWithResponse(args);\n } catch (error: any) {\n if (error instanceof HttpErrorResponse) {\n throw new OpenApiHttpResponseError(\n error,\n this.metadata\n );\n } else {\n throw error;\n }\n }\n\n if (response.body) {\n return response.body;\n }\n\n if (isDevMode()) {\n console.warn('The response body is empty!');\n }\n return null as any;\n }\n\n /**\n * Instead of returning the response body the full response object is returned\n */\n public async callWithResponse(args: OpenApiRemoteMethodParameter<Parameters, RequestBody> = {}): Promise<HttpResponse<Response>> {\n this.init();\n this.executionsInProgress$.increase();\n const result = await this._callWithResponse(args);\n this.executionsInProgress$.decrease();\n if (result.body) {\n this.executed$.next(result.body);\n this.executed(result.body);\n }\n return result;\n }\n\n // TODO : update to the new call method concept (the remove of the _call method concept)\n public _callWithResponse(args: OpenApiRemoteMethodParameter<Parameters, RequestBody> = {}): Promise<HttpResponse<Response>> {\n\n if (!this.disableValidation) {\n this.validateParameters(this.operation, args.parameters, this.strict);\n this.validateRequestBody(this.operation, args.requestBody, this.strict);\n }\n\n return this.http.request<Response>(this.updateRequest(this.buildHttpOptions(this.operation, args.parameters, args.requestBody, this.metadata.ignoreUndefined))).pipe(\n retry(this.metadata.retry ?? 0),\n tap({\n error: (error) => {\n if (error instanceof HttpErrorResponse) {\n this.interceptors?.forEach(interceptor => interceptor\n .next({ response: error, parameters: args.parameters, requestBody: args.requestBody })\n );\n }\n }\n }),\n filter((event: any) => event.type === HttpEventType.Response),\n tap((response: HttpResponse<Response>) => {\n if (this.disableValidation) {\n this.validateResponse(this.operation, response, this.strict);\n }\n }),\n tap((response: HttpResponse<Response>) => {\n this.interceptors?.forEach(interceptor => interceptor\n .next({ response, parameters: args.parameters, requestBody: args.requestBody })\n );\n }),\n take(1),\n timeout(this.timeout)\n ).toPromise();\n\n }\n\n}\n","import {\n Injectable,\n Injector,\n Inject\n} from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { OpenApiRemoteMethod } from './open-api.remote-method';\nimport { OpenApiConfigService } from '@rxap/open-api';\n\n@Injectable({ providedIn: 'root' })\nexport class OpenApiRemoteMethodLoader {\n\n constructor(\n @Inject(OpenApiConfigService) public readonly openApiConfig: OpenApiConfigService,\n @Inject(HttpClient) public readonly http: HttpClient,\n public readonly injector: Injector\n ) {}\n\n public load(definitionId: string): OpenApiRemoteMethod | null {\n const operation = this.openApiConfig.getOperation(definitionId);\n\n if (operation) {\n\n return new OpenApiRemoteMethod(\n this.http,\n this.injector,\n this.openApiConfig,\n {\n id: definitionId,\n operation\n }\n );\n\n }\n\n return null;\n\n }\n\n}\n","import { RxapOpenApiError } from '@rxap/open-api';\n\nexport class RxapOpenApiRemoteMethodError extends RxapOpenApiError {\n\n constructor(message: string, code?: string, scope?: string) {\n super(message, code, scope);\n this.addSubPackageName('remote-method');\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;AAwDM,SAAU,6BAA6B,CAAC,QAA4D,EAAA;AACxG,IAAA,OAAO,OAAO,QAAQ,CAAC,SAAS,KAAK,QAAQ,CAAC;AAChD,CAAC;SAEe,uBAAuB,CAAC,aAA0E,EAAE,cAAsB,CAAC,EAAA;AACzI,IAAA,OAAO,UAAS,MAAW,EAAA;;AACzB,QAAA,MAAM,EAAE,GAAG,OAAO,aAAa,KAAK,QAAQ,GAAG,aAAa,IAAI,6BAA6B,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC,WAAW,GAAG,CAAA,EAAA,GAAA,aAAa,CAAC,SAAS,CAAC,WAAW,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,aAAa,CAAC,UAAU,CAAC,CAAC;QAC5M,IAAI,CAAC,EAAE,EAAE;AACP,YAAA,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;AAClF,SAAA;AACD,QAAA,MAAM,QAAQ,GAAgC;YAC5C,EAAE;YACF,WAAW;SACZ,CAAC;AACF,QAAA,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE;AACrC,YAAA,QAAQ,CAAC,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC;AAC7C,YAAA,QAAQ,CAAC,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;AAC5C,SAAA;AACD,QAAA,gBAAgB,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AACrC,KAAC,CAAC;AACJ,CAAC;IAgBY,mBAAmB,GAAA,MAAnB,mBACX,SAAQ,oBAA0F,CAAA;IAUlG,WACsB,CAAA,IAAgB,EAClB,QAAkB,EACN,oBAA0C,EAGtE,QAA+C,GAAA,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AAM,EAAE,CAAA;;;8BAI7B,MAAM;+BAAC,oBAAoB,CAAA;;8BAC3B,MAAM;+BAAC,UAAU,CAAA;;;;ACZhB,MAAO,4BAA6B,SAAQ,gBAAgB,CAAA;AAEhE,IAAA,WAAA,CAAY,OAAe,EAAE,IAAa,EAAE,KAAc,EAAA;AACxD,QAAA,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAC5B,QAAA,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;KACzC;AAEF;;ACTD;;AAEG;;;;"}
@@ -1,467 +0,0 @@
1
- import { __awaiter } from 'tslib';
2
- import * as i0 from '@angular/core';
3
- import { InjectionToken, Injectable, Optional, Inject, isDevMode } from '@angular/core';
4
- import { RxapError, coerceArray, IsRecord, clone, isPromiseLike } from '@rxap/utilities';
5
- import * as Ajv from 'ajv-oai';
6
- import { HttpParams, HttpHeaders } from '@angular/common/http';
7
-
8
- const RXAP_OPEN_API_CONFIG = new InjectionToken('rxap/open-api/config');
9
- const RXAP_OPEN_API_STRICT_VALIDATOR = new InjectionToken('rxap/open-api/strict-validator');
10
- const DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA = new InjectionToken('rxap/open-api/default-remote-method-meta-data');
11
- const DEFAULT_OPEN_API_DATA_SOURCE_META_DATA = new InjectionToken('rxap/open-api/default-data-source-meta-data');
12
- const DISABLE_SCHEMA_VALIDATION = new InjectionToken('rxap/open-api/disable-schema-validation');
13
- const DISABLE_VALIDATION = new InjectionToken('rxap/open-api/disable-validation');
14
-
15
- class RxapOpenApiError extends RxapError {
16
- constructor(message, code, scope) {
17
- super('@rxap/open-api', message, code !== null && code !== void 0 ? code : '', scope);
18
- }
19
- }
20
-
21
- function IsReferenceObject(obj) {
22
- return !!obj && obj.hasOwnProperty('$ref');
23
- }
24
- function NotContainsReferenceObjects(array) {
25
- return !!array && array.every(item => !IsReferenceObject(item) && !!item);
26
- }
27
- function IsOpenApiV3(obj) {
28
- return !!obj && obj.hasOwnProperty('openapi') && obj.openapi.match(/^3\./);
29
- }
30
- function AssertOpenApiV3(obj) {
31
- if (!IsOpenApiV3(obj)) {
32
- throw new RxapOpenApiError('Only openapi version 3.x.x is supported');
33
- }
34
- }
35
-
36
- class OpenApiConfigService {
37
- constructor(config = null) {
38
- this.defaultServerIndex = OpenApiConfigService.DefaultServerIndex;
39
- this._operations = null;
40
- this.serverConfigMap = new Map();
41
- this._config = null;
42
- config = config !== null && config !== void 0 ? config : OpenApiConfigService.Config;
43
- if (config) {
44
- this._config = config;
45
- this._operations = OpenApiConfigService.LoadOperations(config);
46
- }
47
- }
48
- /**
49
- * Used to load the app open api config from a remote resource.
50
- *
51
- * Promise.all([ OpenApiDataSourceLoader.Load() ])
52
- * .then(() => platformBrowserDynamic().bootstrapModule(AppModule))
53
- * .catch(err => console.error(err))
54
- *
55
- */
56
- static Load(openApiUrl = 'openapi.json') {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- if (!openApiUrl) {
59
- throw new Error('The open api url is not defined!');
60
- }
61
- let config = null;
62
- try {
63
- const response = yield fetch(openApiUrl);
64
- config = yield response.json();
65
- }
66
- catch (error) {
67
- console.debug(`Could not load the open api config from '${openApiUrl}'!`, error);
68
- console.error(`Could not load the open api config from '${openApiUrl}'!`, error.message);
69
- }
70
- if (config) {
71
- const expandedConfig = yield this.ExpandOpenApi(config);
72
- AssertOpenApiV3(expandedConfig);
73
- this.Config = expandedConfig;
74
- }
75
- else {
76
- this.Config = null;
77
- }
78
- });
79
- }
80
- static GetOperation(operationId) {
81
- if (!this.Config) {
82
- throw new Error('Could not load open api config');
83
- }
84
- if (!this._operations) {
85
- this._operations = this.LoadOperations(this.Config);
86
- }
87
- if (!this._operations.has(operationId)) {
88
- throw new Error(`The operation '${operationId}' is not defined in the openapi-json`);
89
- }
90
- return this._operations.get(operationId);
91
- }
92
- static LoadOperations(config) {
93
- const operations = new Map();
94
- Object.entries(config.paths)
95
- .filter((item) => item[0] !== undefined)
96
- .filter(([_, methods]) => methods &&
97
- Object.keys(methods).some((method) => ['get', 'put', 'post', 'delete', 'patch'].includes(method)))
98
- .forEach(([path, methods]) => Object.entries(methods)
99
- .filter((item) => item[0] !== undefined)
100
- .forEach(([method, operation]) => {
101
- if (!operation.operationId) {
102
- throw new Error('The OpenApu OperationId is not defined');
103
- }
104
- if (operations.has(operation.operationId)) {
105
- throw new Error(`The OpenApi Operation '${operation.operationId}' is already defined.`);
106
- }
107
- operations.set(operation.operationId, Object.assign(Object.assign({}, operation), { path: path, method: method.toUpperCase() }));
108
- }));
109
- return operations;
110
- }
111
- static GetBaseUrl(config, serverIndex = this.DefaultServerIndex) {
112
- const server = config.servers ? config.servers[serverIndex] : null;
113
- if (!server) {
114
- console.debug(`Could not extract the server config with the index '${serverIndex}' from the open api config`, config);
115
- throw new Error(`Could not extract the server config with the index '${serverIndex}' from the open api config`);
116
- }
117
- return server.url;
118
- }
119
- /**
120
- * Replaces all $ref with the concrete definition
121
- *
122
- * @param config
123
- * @private
124
- */
125
- static ExpandOpenApi(config) {
126
- return Promise.resolve(config);
127
- }
128
- get config() {
129
- if (!this._config) {
130
- throw new Error('Could not load open api config');
131
- }
132
- return this._config;
133
- }
134
- getOperation(operationId) {
135
- if (!this._operations) {
136
- if (!this._config) {
137
- throw new Error('The operations map is not loaded and the config object is not loaded');
138
- }
139
- this._operations = OpenApiConfigService.LoadOperations(this._config);
140
- }
141
- if (!this._operations.has(operationId)) {
142
- console.debug(`The operation '${operationId}' is not defined in the openapi-json`, this.config);
143
- throw new Error(`The operation '${operationId}' is not defined in the openapi-json`);
144
- }
145
- return this._operations.get(operationId);
146
- }
147
- getBaseUrl(serverIndex = this.defaultServerIndex, serverId) {
148
- var _a;
149
- let serverConfig;
150
- if (!serverId && ((_a = this._config) === null || _a === void 0 ? void 0 : _a.servers)) {
151
- serverConfig = this._config.servers[serverIndex];
152
- }
153
- if (this.serverConfigMap.has(serverId)) {
154
- serverConfig = this.serverConfigMap.get(serverId)[serverIndex];
155
- }
156
- if (!serverConfig) {
157
- throw new Error(`Could not determine the base url with the index: ${serverIndex} and the serverId: ${serverId}`);
158
- }
159
- return serverConfig.url;
160
- }
161
- insertServer(serverConfig, index = this.defaultServerIndex, serverId) {
162
- if (!serverId && this._config) {
163
- if (!this.config.servers) {
164
- this.config.servers = [];
165
- }
166
- this.config.servers.splice(index, 1, serverConfig);
167
- }
168
- if (!this.serverConfigMap.has(serverId)) {
169
- this.serverConfigMap.set(serverId, []);
170
- }
171
- const list = this.serverConfigMap.get(serverId);
172
- list[index] = serverConfig;
173
- this.serverConfigMap.set(serverId, list);
174
- }
175
- }
176
- OpenApiConfigService.Config = null;
177
- OpenApiConfigService.DefaultServerIndex = 0;
178
- OpenApiConfigService._operations = null;
179
- OpenApiConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: OpenApiConfigService, deps: [{ token: RXAP_OPEN_API_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
180
- OpenApiConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: OpenApiConfigService, providedIn: 'root' });
181
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.2", ngImport: i0, type: OpenApiConfigService, decorators: [{
182
- type: Injectable,
183
- args: [{ providedIn: 'root' }]
184
- }], ctorParameters: function () {
185
- return [{ type: undefined, decorators: [{
186
- type: Optional
187
- }, {
188
- type: Inject,
189
- args: [RXAP_OPEN_API_CONFIG]
190
- }] }];
191
- } });
192
-
193
- class SchemaValidationMixin {
194
- /**
195
- * Validates the parameters against the schema specified in the operation object
196
- *
197
- * @param operation
198
- * @param parameters
199
- * @param strict
200
- * @protected
201
- */
202
- validateParameters(operation, parameters, strict = false) {
203
- const operationParameters = coerceArray(operation.parameters);
204
- if (!NotContainsReferenceObjects(operationParameters)) {
205
- throw new RxapOpenApiError('The operation parameters contains ReferenceObject!');
206
- }
207
- if (parameters === undefined) {
208
- // TODO : find concept to definition witch parameter should not be checked if required
209
- // header parameters are never required if changes the semantic release manager breaks
210
- const requiredParameters = operationParameters.filter(parameter => parameter.required && parameter.in !== 'header');
211
- if (requiredParameters.length) {
212
- if (isDevMode()) {
213
- console.debug('Some operation parameters are required!', requiredParameters.map(p => p.name));
214
- }
215
- this.validationError('Some operation parameters are required!', strict);
216
- }
217
- }
218
- else if (IsRecord(parameters)) {
219
- for (const parameter of operationParameters) {
220
- if (parameter.required) {
221
- // header parameters are never required if changes the semantic release manager breaks
222
- if (parameter.in !== 'header') {
223
- if (!parameters.hasOwnProperty(parameter.name)) {
224
- this.validationError(`The operation parameter '${parameter.name}' is required!`, strict);
225
- }
226
- }
227
- }
228
- if (parameter.schema) {
229
- if (parameters.hasOwnProperty(parameter.name)) {
230
- const value = parameters[parameter.name];
231
- if (!this.validate(parameter.schema, value)) {
232
- this.validationError(`The parameter '${parameter.name}' is not valid against the schema!`, strict, parameter.schema, value);
233
- }
234
- }
235
- }
236
- }
237
- }
238
- else {
239
- if (operationParameters.length === 0 || operationParameters.every(op => !op.required)) {
240
- if (isDevMode()) {
241
- console.warn(`The operation ${operation.operationId} does not expect any parameters. But a parameter is provided.`, parameters);
242
- }
243
- }
244
- else {
245
- throw new Error('The parameters object is not a record');
246
- }
247
- }
248
- }
249
- /**
250
- * Validates the http response against the schema specified in the operation object
251
- *
252
- * @param operation
253
- * @param response
254
- * @param strict
255
- * @protected
256
- */
257
- validateResponse(operation, response, strict = false) {
258
- var _a;
259
- // region only validate the response if the content type is undefined or application/json
260
- const contentType = response.headers.get('Content-Type');
261
- if (contentType && contentType !== 'application/json') {
262
- if (isDevMode()) {
263
- console.warn('Response validation is only supported for content type application/json');
264
- }
265
- return;
266
- }
267
- // endregion
268
- if (operation.responses) {
269
- const status = response.status;
270
- // region extract the response object based on the response status
271
- let responseObject;
272
- if (operation.responses[status]) {
273
- responseObject = operation.responses[status];
274
- }
275
- else {
276
- // use the default response object if no matching was found.
277
- responseObject = operation.responses.default;
278
- }
279
- // endregion
280
- if (responseObject) {
281
- if (IsReferenceObject(responseObject)) {
282
- throw new RxapOpenApiError('Found a reference object. The operation config is not expand!');
283
- }
284
- // region validate the response against the schema if defined
285
- // TODO : create schema that validates all parameters at once
286
- if (responseObject.content && responseObject.content['application/json'] && responseObject.content['application/json'].schema) {
287
- const schema = responseObject.content['application/json'].schema;
288
- const data = (_a = response.body) !== null && _a !== void 0 ? _a : response.data;
289
- if (!this.validate(schema, data)) {
290
- this.validationError('The response is not valid ageist the operation schema!', strict, schema, data);
291
- }
292
- }
293
- // endregion
294
- }
295
- }
296
- }
297
- validateRequestBody(operation, body, strict = false) {
298
- // only validate body if type of object
299
- if (typeof body !== 'object') {
300
- return;
301
- }
302
- if (operation.requestBody) {
303
- if (IsReferenceObject(operation.requestBody)) {
304
- throw new RxapOpenApiError('Found a reference object. The operation config is not expand!');
305
- }
306
- if (body === undefined && operation.requestBody.required) {
307
- this.validationError('The request body is required!', strict);
308
- }
309
- if (operation.requestBody.content && operation.requestBody.content['application/json']) {
310
- const schema = operation.requestBody.content['application/json'].schema;
311
- if (schema) {
312
- if (!this.validate(schema, body)) {
313
- this.validationError('The request body is not valid!', strict, schema, body);
314
- }
315
- }
316
- }
317
- }
318
- }
319
- validationError(message, strict, schema, value) {
320
- if (isDevMode() && schema !== undefined) {
321
- // tslint:disable-next-line:no-console
322
- console.debug(message, { schema, value });
323
- }
324
- if (strict || SchemaValidationMixin.STRICT) {
325
- throw new RxapOpenApiError(message, '', 'SchemaValidationMixin');
326
- }
327
- else {
328
- console.warn(message);
329
- }
330
- }
331
- buildHttpParams(operationParameters, parameters, ignoreUndefined = true) {
332
- let params = new HttpParams();
333
- if (IsRecord(parameters)) {
334
- for (const parameter of operationParameters.filter(p => p.in === 'query')) {
335
- const parameterName = parameter.name;
336
- if (parameters.hasOwnProperty(parameter.name)) {
337
- const value = parameters[parameter.name];
338
- if (value === undefined && ignoreUndefined) {
339
- continue;
340
- }
341
- if (Array.isArray(value)) {
342
- if (value.length) {
343
- const first = value.shift();
344
- params = params.set(parameterName, first);
345
- for (const item of value) {
346
- params = params.append(parameterName, item);
347
- }
348
- }
349
- }
350
- else {
351
- params = params.set(parameter.name, value);
352
- }
353
- }
354
- }
355
- }
356
- return params;
357
- }
358
- buildHttpHeaders(operationParameters, parameters) {
359
- let headers = new HttpHeaders();
360
- if (IsRecord(parameters)) {
361
- for (const parameter of operationParameters.filter(p => p.in === 'header')) {
362
- if (parameters.hasOwnProperty(parameter.name)) {
363
- const value = parameters[parameter.name];
364
- if (Array.isArray(value)) {
365
- if (value.length) {
366
- const first = value.shift();
367
- headers = headers.set(parameters.name, first);
368
- for (const item of value) {
369
- headers = headers.append(parameters.name, item);
370
- }
371
- }
372
- }
373
- else {
374
- headers = headers.set(parameter.name, value);
375
- }
376
- }
377
- }
378
- }
379
- return headers;
380
- }
381
- buildHttpPathParams(operationParameters, parameters) {
382
- const pathParams = {};
383
- if (IsRecord(parameters)) {
384
- for (const parameter of operationParameters.filter(p => p.in === 'path')) {
385
- if (parameters.hasOwnProperty(parameter.name)) {
386
- pathParams[parameter.name] = encodeURIComponent(parameters[parameter.name]);
387
- }
388
- }
389
- }
390
- return pathParams;
391
- }
392
- /**
393
- * Converts open api parameters into the corresponding http options to
394
- * create a http request. The transformation is guided by the openapi definition
395
- *
396
- * @param operation
397
- * @param parameters
398
- * @param requestBody
399
- * @param ignoreUndefined
400
- */
401
- buildHttpOptions(operation, parameters, requestBody, ignoreUndefined = true) {
402
- const options = {};
403
- const operationParameters = coerceArray(operation.parameters);
404
- if (!NotContainsReferenceObjects(operationParameters)) {
405
- throw new RxapOpenApiError('The operation parameters contains ReferenceObject!');
406
- }
407
- const params = this.buildHttpParams(operationParameters, parameters, ignoreUndefined);
408
- const headers = this.buildHttpHeaders(operationParameters, parameters);
409
- const pathParams = this.buildHttpPathParams(operationParameters, parameters);
410
- if (params.keys().length) {
411
- options.params = params;
412
- }
413
- if (headers.keys().length) {
414
- options.headers = headers;
415
- }
416
- if (Object.keys(pathParams).length) {
417
- options.pathParams = pathParams;
418
- }
419
- if (requestBody !== undefined) {
420
- options.body = requestBody;
421
- }
422
- return options;
423
- }
424
- validate(schema, value) {
425
- if (this.disableSchemaValidation) {
426
- return true;
427
- }
428
- let result;
429
- try {
430
- result = new Ajv().validate(schema, clone(value));
431
- }
432
- catch (e) {
433
- console.error(e.message);
434
- return false;
435
- }
436
- if (isPromiseLike(result)) {
437
- throw new Error('Async schema validation is not yet supported. Ensure the all refs in the openapi schema are internal!');
438
- }
439
- return result;
440
- }
441
- }
442
- SchemaValidationMixin.STRICT = false;
443
-
444
- class OpenApiHttpResponseError extends Error {
445
- constructor(httpErrorResponse, metadata) {
446
- super(httpErrorResponse.message);
447
- this.httpErrorResponse = httpErrorResponse;
448
- this.metadata = metadata;
449
- if (Error['captureStackTrace']) {
450
- Error['captureStackTrace'](this, OpenApiHttpResponseError);
451
- }
452
- this.name = 'OpenApiHttpResponseError';
453
- }
454
- get status() {
455
- return this.httpErrorResponse.status;
456
- }
457
- get operationId() {
458
- return this.metadata.id;
459
- }
460
- }
461
-
462
- /**
463
- * Generated bundle index. Do not edit.
464
- */
465
-
466
- export { AssertOpenApiV3, DEFAULT_OPEN_API_DATA_SOURCE_META_DATA, DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA, DISABLE_SCHEMA_VALIDATION, DISABLE_VALIDATION, IsOpenApiV3, IsReferenceObject, NotContainsReferenceObjects, OpenApiConfigService, OpenApiHttpResponseError, RXAP_OPEN_API_CONFIG, RXAP_OPEN_API_STRICT_VALIDATOR, RxapOpenApiError, SchemaValidationMixin };
467
- //# sourceMappingURL=rxap-open-api.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rxap-open-api.mjs","sources":["../../../../libs/open-api/src/lib/tokens.ts","../../../../libs/open-api/src/lib/error.ts","../../../../libs/open-api/src/lib/utilities.ts","../../../../libs/open-api/src/lib/open-api-config.service.ts","../../../../libs/open-api/src/lib/schema-validation.mixin.ts","../../../../libs/open-api/src/lib/open-api-http-response.error.ts","../../../../libs/open-api/src/rxap-open-api.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const RXAP_OPEN_API_CONFIG = new InjectionToken('rxap/open-api/config');\nexport const RXAP_OPEN_API_STRICT_VALIDATOR = new InjectionToken('rxap/open-api/strict-validator');\nexport const DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA = new InjectionToken('rxap/open-api/default-remote-method-meta-data');\nexport const DEFAULT_OPEN_API_DATA_SOURCE_META_DATA = new InjectionToken('rxap/open-api/default-data-source-meta-data');\nexport const DISABLE_SCHEMA_VALIDATION = new InjectionToken<boolean>('rxap/open-api/disable-schema-validation');\nexport const DISABLE_VALIDATION = new InjectionToken<boolean>('rxap/open-api/disable-validation');\n","import { RxapError } from '@rxap/utilities';\n\nexport class RxapOpenApiError extends RxapError {\n\n constructor(message: string, code?: string, scope?: string) {\n super('@rxap/open-api', message, code ?? '', scope);\n }\n\n}\n","import { OpenAPIV3 } from 'openapi-types';\nimport { RxapOpenApiError } from './error';\n\nexport function IsReferenceObject(obj?: any): obj is OpenAPIV3.ReferenceObject {\n return !!obj && obj.hasOwnProperty('$ref');\n}\n\nexport function NotContainsReferenceObjects<T>(array?: Array<OpenAPIV3.ReferenceObject | T | undefined>): array is T[] {\n return !!array && array.every(item => !IsReferenceObject(item) && !!item);\n}\n\nexport function IsOpenApiV3(obj?: any): obj is OpenAPIV3.Document {\n return !!obj && obj.hasOwnProperty('openapi') && obj.openapi.match(/^3\\./);\n}\n\nexport function AssertOpenApiV3(obj?: any): asserts obj is OpenAPIV3.Document {\n\n if (!IsOpenApiV3(obj)) {\n throw new RxapOpenApiError('Only openapi version 3.x.x is supported');\n }\n\n}\n","import {\n Injectable,\n Inject,\n Optional\n} from '@angular/core';\nimport { OperationObjectWithMetadata } from './open-api';\nimport { RXAP_OPEN_API_CONFIG } from './tokens';\nimport {\n OpenAPIV3,\n OpenAPI\n} from 'openapi-types';\nimport { AssertOpenApiV3 } from './utilities';\n\nexport type OperationMap = Map<string, OperationObjectWithMetadata>;\n\n@Injectable({ providedIn: 'root' })\nexport class OpenApiConfigService {\n public static Config: OpenAPIV3.Document | null = null;\n\n public static DefaultServerIndex: number = 0;\n\n private static _operations: OperationMap | null = null;\n\n /**\n * Used to load the app open api config from a remote resource.\n *\n * Promise.all([ OpenApiDataSourceLoader.Load() ])\n * .then(() => platformBrowserDynamic().bootstrapModule(AppModule))\n * .catch(err => console.error(err))\n *\n */\n public static async Load(openApiUrl: string = 'openapi.json'): Promise<void> {\n if (!openApiUrl) {\n throw new Error('The open api url is not defined!');\n }\n\n let config: OpenAPIV3.Document | null = null;\n try {\n const response = await fetch(openApiUrl);\n config = await response.json();\n } catch (error: any) {\n console.debug(\n `Could not load the open api config from '${openApiUrl}'!`,\n error\n );\n console.error(\n `Could not load the open api config from '${openApiUrl}'!`,\n error.message\n );\n }\n\n if (config) {\n const expandedConfig = await this.ExpandOpenApi(config);\n\n AssertOpenApiV3(expandedConfig);\n\n this.Config = expandedConfig;\n } else {\n this.Config = null;\n }\n }\n\n public static GetOperation(operationId: string): OperationObjectWithMetadata {\n if (!this.Config) {\n throw new Error('Could not load open api config');\n }\n\n if (!this._operations) {\n this._operations = this.LoadOperations(this.Config);\n }\n if (!this._operations!.has(operationId)) {\n throw new Error(\n `The operation '${operationId}' is not defined in the openapi-json`\n );\n }\n return this._operations!.get(operationId)!;\n }\n\n private static LoadOperations(config: OpenAPIV3.Document): OperationMap {\n const operations = new Map<string, OperationObjectWithMetadata>();\n\n Object.entries(config.paths)\n .filter(\n (item): item is [string, OpenAPIV3.PathItemObject] =>\n item[0] !== undefined\n )\n .filter(\n ([_, methods]: [string, OpenAPIV3.PathItemObject]) =>\n methods &&\n Object.keys(methods).some((method) =>\n ['get', 'put', 'post', 'delete', 'patch'].includes(method)\n )\n )\n .forEach(([path, methods]: [string, OpenAPIV3.PathItemObject]) =>\n Object.entries(methods)\n .filter(\n (item): item is [string, OpenAPIV3.OperationObject] =>\n item[0] !== undefined\n )\n .forEach(\n ([method, operation]: [string, OpenAPIV3.OperationObject]) => {\n if (!operation.operationId) {\n throw new Error('The OpenApu OperationId is not defined');\n }\n\n if (operations!.has(operation.operationId)) {\n throw new Error(\n `The OpenApi Operation '${operation.operationId}' is already defined.`\n );\n }\n\n operations!.set(operation.operationId, {\n ...operation,\n path: path,\n method: method.toUpperCase(),\n });\n }\n )\n );\n\n return operations;\n }\n\n private static GetBaseUrl(\n config: OpenAPIV3.Document,\n serverIndex: number = this.DefaultServerIndex\n ): string {\n const server = config.servers ? config.servers[serverIndex] : null;\n\n if (!server) {\n console.debug(\n `Could not extract the server config with the index '${serverIndex}' from the open api config`,\n config\n );\n throw new Error(\n `Could not extract the server config with the index '${serverIndex}' from the open api config`\n );\n }\n\n return server.url;\n }\n\n /**\n * Replaces all $ref with the concrete definition\n *\n * @param config\n * @private\n */\n private static ExpandOpenApi(\n config: OpenAPI.Document\n ): Promise<OpenAPI.Document> {\n return Promise.resolve(config);\n }\n\n public get config(): OpenAPIV3.Document {\n if (!this._config) {\n throw new Error('Could not load open api config');\n }\n return this._config;\n }\n\n public defaultServerIndex: number = OpenApiConfigService.DefaultServerIndex;\n\n private _operations: OperationMap | null = null;\n\n private serverConfigMap = new Map<string | undefined, OpenAPIV3.ServerObject[]>();\n\n private _config: OpenAPIV3.Document | null = null;\n\n constructor(\n @Optional()\n @Inject(RXAP_OPEN_API_CONFIG)\n config: OpenAPIV3.Document | null = null\n ) {\n config = config ?? OpenApiConfigService.Config;\n if (config) {\n this._config = config;\n this._operations = OpenApiConfigService.LoadOperations(config);\n }\n }\n\n public getOperation(operationId: string): OperationObjectWithMetadata {\n if (!this._operations) {\n if (!this._config) {\n throw new Error('The operations map is not loaded and the config object is not loaded');\n }\n this._operations = OpenApiConfigService.LoadOperations(this._config);\n }\n if (!this._operations.has(operationId)) {\n console.debug(\n `The operation '${operationId}' is not defined in the openapi-json`,\n this.config\n );\n throw new Error(\n `The operation '${operationId}' is not defined in the openapi-json`\n );\n }\n return this._operations.get(operationId)!;\n }\n\n public getBaseUrl(serverIndex: number = this.defaultServerIndex, serverId?: string): string {\n let serverConfig: OpenAPIV3.ServerObject | undefined;\n if (!serverId && this._config?.servers) {\n serverConfig = this._config.servers[serverIndex];\n }\n if (this.serverConfigMap.has(serverId)) {\n serverConfig = this.serverConfigMap.get(serverId)![serverIndex];\n }\n if (!serverConfig) {\n throw new Error(`Could not determine the base url with the index: ${serverIndex} and the serverId: ${serverId}`);\n }\n return serverConfig.url;\n }\n\n public insertServer(\n serverConfig: OpenAPIV3.ServerObject,\n index: number = this.defaultServerIndex,\n serverId?: string\n ): void {\n if (!serverId && this._config) {\n if (!this.config.servers) {\n this.config.servers = [];\n }\n this.config.servers.splice(index, 1, serverConfig);\n }\n if (!this.serverConfigMap.has(serverId)) {\n this.serverConfigMap.set(serverId, []);\n }\n const list = this.serverConfigMap.get(serverId)!;\n list[index] = serverConfig;\n this.serverConfigMap.set(serverId, list);\n }\n}\n","import {\n coerceArray,\n isPromiseLike,\n IsRecord,\n clone\n} from '@rxap/utilities';\nimport { isDevMode } from '@angular/core';\nimport * as Ajv from 'ajv-oai';\nimport {\n HttpParams,\n HttpHeaders\n} from '@angular/common/http';\nimport {\n NotContainsReferenceObjects,\n IsReferenceObject\n} from './utilities';\nimport { OperationObjectWithMetadata } from './open-api';\nimport { RxapOpenApiError } from './error';\nimport { OpenAPIV3 } from 'openapi-types';\nimport { HttpRemoteMethodParameter } from '@rxap/remote-method/http';\n\nexport interface SchemaValidationResponse<Data> {\n headers: Record<string, any>;\n status: number;\n body?: Data | null;\n data?: Data;\n}\n\nexport class SchemaValidationMixin<Response = any, Parameters extends Record<string, any> | void = any, RequestBody = any> {\n\n public static STRICT: boolean = false;\n\n protected disableSchemaValidation?: boolean\n\n /**\n * Validates the parameters against the schema specified in the operation object\n *\n * @param operation\n * @param parameters\n * @param strict\n * @protected\n */\n public validateParameters(operation: OperationObjectWithMetadata, parameters?: Parameters, strict: boolean = false): void {\n\n const operationParameters = coerceArray(operation.parameters);\n\n if (!NotContainsReferenceObjects<OpenAPIV3.ParameterObject>(operationParameters)) {\n throw new RxapOpenApiError('The operation parameters contains ReferenceObject!');\n }\n\n if (parameters === undefined) {\n // TODO : find concept to definition witch parameter should not be checked if required\n // header parameters are never required if changes the semantic release manager breaks\n const requiredParameters = operationParameters.filter(parameter => parameter.required && parameter.in !== 'header');\n if (requiredParameters.length) {\n if (isDevMode()) {\n console.debug('Some operation parameters are required!', requiredParameters.map(p => p.name));\n }\n this.validationError('Some operation parameters are required!', strict);\n }\n\n } else if (IsRecord(parameters)) {\n\n for (const parameter of operationParameters) {\n\n if (parameter.required) {\n // header parameters are never required if changes the semantic release manager breaks\n if (parameter.in !== 'header') {\n if (!parameters.hasOwnProperty(parameter.name)) {\n this.validationError(`The operation parameter '${parameter.name}' is required!`, strict);\n }\n }\n }\n\n\n if (parameter.schema) {\n if (parameters.hasOwnProperty(parameter.name)) {\n\n const value = parameters[ parameter.name ];\n\n if (!this.validate(parameter.schema, value)) {\n this.validationError(`The parameter '${parameter.name}' is not valid against the schema!`, strict, parameter.schema, value);\n }\n\n }\n }\n\n }\n\n } else {\n if (operationParameters.length === 0 || operationParameters.every(op => !op.required)) {\n if (isDevMode()) {\n console.warn(`The operation ${operation.operationId} does not expect any parameters. But a parameter is provided.`, parameters);\n }\n } else {\n throw new Error('The parameters object is not a record');\n }\n }\n\n }\n\n /**\n * Validates the http response against the schema specified in the operation object\n *\n * @param operation\n * @param response\n * @param strict\n * @protected\n */\n public validateResponse(operation: OperationObjectWithMetadata, response: SchemaValidationResponse<Response>, strict: boolean = false): void {\n\n // region only validate the response if the content type is undefined or application/json\n\n const contentType = response.headers.get('Content-Type');\n\n if (contentType && contentType !== 'application/json') {\n if (isDevMode()) {\n console.warn('Response validation is only supported for content type application/json');\n }\n return;\n }\n\n // endregion\n\n if (operation.responses) {\n\n const status = response.status;\n\n // region extract the response object based on the response status\n let responseObject: OpenAPIV3.ResponseObject | OpenAPIV3.ReferenceObject | undefined;\n\n if (operation.responses[status]) {\n responseObject = operation.responses[status];\n } else {\n // use the default response object if no matching was found.\n responseObject = operation.responses.default;\n }\n // endregion\n\n if (responseObject) {\n\n if (IsReferenceObject(responseObject)) {\n throw new RxapOpenApiError('Found a reference object. The operation config is not expand!');\n }\n\n // region validate the response against the schema if defined\n\n // TODO : create schema that validates all parameters at once\n\n if (responseObject.content && responseObject.content['application/json'] && responseObject.content['application/json'].schema) {\n\n const schema = responseObject.content['application/json'].schema;\n\n const data = response.body ?? response.data;\n\n if (!this.validate(schema, data)) {\n this.validationError('The response is not valid ageist the operation schema!', strict, schema, data);\n }\n\n }\n\n // endregion\n\n }\n\n\n }\n\n }\n\n public validateRequestBody(operation: OperationObjectWithMetadata, body?: RequestBody, strict: boolean = false): void {\n\n // only validate body if type of object\n if (typeof body !== 'object') {\n return;\n }\n\n if (operation.requestBody) {\n\n if (IsReferenceObject(operation.requestBody)) {\n throw new RxapOpenApiError('Found a reference object. The operation config is not expand!');\n }\n\n if (body === undefined && operation.requestBody.required) {\n this.validationError('The request body is required!', strict);\n }\n\n if (operation.requestBody.content && operation.requestBody.content['application/json']) {\n\n const schema = operation.requestBody.content['application/json'].schema;\n\n if (schema) {\n if (!this.validate(schema, body)) {\n this.validationError('The request body is not valid!', strict, schema, body);\n }\n }\n\n }\n\n }\n\n }\n\n public validationError(message: string, strict: boolean, schema?: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject, value?: any) {\n if (isDevMode() && schema !== undefined) {\n // tslint:disable-next-line:no-console\n console.debug(message, { schema, value });\n }\n if (strict || SchemaValidationMixin.STRICT) {\n throw new RxapOpenApiError(message, '', 'SchemaValidationMixin');\n } else {\n console.warn(message);\n }\n }\n\n public buildHttpParams(operationParameters: OpenAPIV3.ParameterObject[], parameters?: Parameters, ignoreUndefined = true): HttpParams {\n\n let params = new HttpParams();\n\n if (IsRecord(parameters)) {\n\n for (const parameter of operationParameters.filter(p => p.in === 'query')) {\n const parameterName = parameter.name;\n\n if (parameters.hasOwnProperty(parameter.name)) {\n\n const value = parameters[ parameter.name ];\n\n if (value === undefined && ignoreUndefined) {\n continue;\n }\n\n if (Array.isArray(value)) {\n\n if (value.length) {\n\n const first = value.shift();\n\n params = params.set(parameterName, first);\n\n for (const item of value) {\n params = params.append(parameterName, item);\n }\n\n }\n\n } else {\n params = params.set(parameter.name, value);\n }\n\n }\n\n }\n\n }\n\n return params;\n\n }\n\n public buildHttpHeaders(operationParameters: OpenAPIV3.ParameterObject[], parameters?: Parameters): HttpHeaders {\n\n let headers = new HttpHeaders();\n\n if (IsRecord(parameters)) {\n\n for (const parameter of operationParameters.filter(p => p.in === 'header')) {\n\n if (parameters.hasOwnProperty(parameter.name)) {\n\n const value = parameters[ parameter.name ];\n\n if (Array.isArray(value)) {\n\n if (value.length) {\n\n const first = value.shift();\n\n headers = headers.set(parameters.name, first);\n\n for (const item of value) {\n headers = headers.append(parameters.name, item);\n }\n\n }\n\n } else {\n headers = headers.set(parameter.name, value);\n }\n\n }\n\n }\n\n }\n\n return headers;\n\n }\n\n public buildHttpPathParams(operationParameters: OpenAPIV3.ParameterObject[], parameters?: Parameters): Record<string, string> {\n\n const pathParams: Record<string, any> = {};\n\n if (IsRecord(parameters)) {\n\n for (const parameter of operationParameters.filter(p => p.in === 'path')) {\n\n if (parameters.hasOwnProperty(parameter.name)) {\n pathParams[ parameter.name ] = encodeURIComponent(parameters[ parameter.name ]);\n }\n\n }\n\n }\n\n return pathParams;\n\n }\n\n /**\n * Converts open api parameters into the corresponding http options to\n * create a http request. The transformation is guided by the openapi definition\n *\n * @param operation\n * @param parameters\n * @param requestBody\n * @param ignoreUndefined\n */\n public buildHttpOptions(operation: OperationObjectWithMetadata, parameters?: Parameters, requestBody?: RequestBody, ignoreUndefined = true): HttpRemoteMethodParameter {\n\n const options: HttpRemoteMethodParameter = {};\n\n const operationParameters = coerceArray(operation.parameters);\n\n if (!NotContainsReferenceObjects<OpenAPIV3.ParameterObject>(operationParameters)) {\n throw new RxapOpenApiError('The operation parameters contains ReferenceObject!');\n }\n\n const params = this.buildHttpParams(operationParameters, parameters, ignoreUndefined);\n const headers = this.buildHttpHeaders(operationParameters, parameters);\n const pathParams: Record<string, any> = this.buildHttpPathParams(operationParameters, parameters);\n\n if (params.keys().length) {\n options.params = params;\n }\n\n if (headers.keys().length) {\n options.headers = headers;\n }\n\n if (Object.keys(pathParams).length) {\n options.pathParams = pathParams;\n }\n\n if (requestBody !== undefined) {\n options.body = requestBody;\n }\n\n return options;\n\n }\n\n private validate(schema: string | boolean | object, value: any): boolean {\n\n if (this.disableSchemaValidation) {\n return true;\n }\n\n let result: boolean | PromiseLike<any>;\n\n try {\n result = new Ajv().validate(schema, clone(value));\n } catch (e: any) {\n console.error(e.message);\n return false;\n }\n\n if (isPromiseLike(result)) {\n throw new Error('Async schema validation is not yet supported. Ensure the all refs in the openapi schema are internal!');\n }\n\n return result;\n }\n\n}\n","import { HttpErrorResponse } from '@angular/common/http';\nimport { OpenApiMetaData } from './open-api.meta-data';\n\nexport class OpenApiHttpResponseError extends Error {\n\n get status() {\n return this.httpErrorResponse.status;\n }\n\n get operationId() {\n return this.metadata.id;\n }\n\n constructor(\n public readonly httpErrorResponse: HttpErrorResponse,\n public readonly metadata: OpenApiMetaData\n ) {\n super(httpErrorResponse.message);\n if ((Error as any)[ 'captureStackTrace' ]) {\n (Error as any)[ 'captureStackTrace' ](this, OpenApiHttpResponseError);\n }\n this.name = 'OpenApiHttpResponseError';\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAEa,oBAAoB,GAAuB,IAAI,cAAc,CAAC,sBAAsB,EAAE;MACtF,8BAA8B,GAAa,IAAI,cAAc,CAAC,gCAAgC,EAAE;MAChG,wCAAwC,GAAG,IAAI,cAAc,CAAC,+CAA+C,EAAE;MAC/G,sCAAsC,GAA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