@rxap/open-api 12.2.3 → 13.0.0-next.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.
- package/data-source/package.json +5 -5
- package/data-source/table/package.json +5 -5
- package/esm2020/data-source/lib/error.mjs +8 -0
- package/esm2020/data-source/lib/open-api-data-source.loader.mjs +36 -0
- package/esm2020/data-source/lib/open-api.data-source.mjs +114 -0
- package/esm2020/data-source/public_api.mjs +6 -0
- package/esm2020/data-source/rxap-open-api-data-source.mjs +5 -0
- package/esm2020/data-source/table/lib/error.mjs +8 -0
- package/esm2020/data-source/table/lib/open-api-table.data-source.mjs +127 -0
- package/esm2020/data-source/table/lib/to-open-api-table-data-source.pipe.mjs +29 -0
- package/esm2020/data-source/table/lib/tokens.mjs +3 -0
- package/esm2020/data-source/table/public_api.mjs +5 -0
- package/esm2020/data-source/table/rxap-open-api-data-source-table.mjs +5 -0
- package/esm2020/index.mjs +7 -0
- package/esm2020/lib/error.mjs +7 -0
- package/esm2020/lib/open-api-config.service.mjs +128 -0
- package/esm2020/lib/open-api.mjs +2 -0
- package/esm2020/lib/schema-validation.mixin.mjs +253 -0
- package/esm2020/lib/tokens.mjs +6 -0
- package/esm2020/lib/utilities.mjs +16 -0
- package/esm2020/remote-method/lib/error.mjs +8 -0
- package/esm2020/remote-method/lib/open-api-remote-method.loader.mjs +37 -0
- package/esm2020/remote-method/lib/open-api.remote-method.mjs +111 -0
- package/esm2020/remote-method/public_api.mjs +4 -0
- package/esm2020/remote-method/rxap-open-api-remote-method.mjs +5 -0
- package/esm2020/rxap-open-api.mjs +5 -0
- package/{esm2015/data-source/table/lib/open-api-table.data-source.js → fesm2015/rxap-open-api-data-source-table.mjs} +91 -48
- package/fesm2015/rxap-open-api-data-source-table.mjs.map +1 -0
- package/{esm2015/data-source/lib/open-api.data-source.js → fesm2015/rxap-open-api-data-source.mjs} +86 -39
- package/fesm2015/rxap-open-api-data-source.mjs.map +1 -0
- package/fesm2015/{rxap-open-api-remote-method.js → rxap-open-api-remote-method.mjs} +38 -34
- package/fesm2015/rxap-open-api-remote-method.mjs.map +1 -0
- package/fesm2015/{rxap-open-api.js → rxap-open-api.mjs} +22 -13
- package/fesm2015/rxap-open-api.mjs.map +1 -0
- package/{fesm2015/rxap-open-api-data-source-table.js → fesm2020/rxap-open-api-data-source-table.mjs} +18 -20
- package/fesm2020/rxap-open-api-data-source-table.mjs.map +1 -0
- package/{fesm2015/rxap-open-api-data-source.js → fesm2020/rxap-open-api-data-source.mjs} +16 -17
- package/fesm2020/rxap-open-api-data-source.mjs.map +1 -0
- package/fesm2020/rxap-open-api-remote-method.mjs +154 -0
- package/fesm2020/rxap-open-api-remote-method.mjs.map +1 -0
- package/{esm2015/lib/schema-validation.mixin.js → fesm2020/rxap-open-api.mjs} +171 -9
- package/fesm2020/rxap-open-api.mjs.map +1 -0
- package/package.json +60 -22
- package/remote-method/package.json +5 -5
- package/src/schematics/ng-add/index.js +1 -1
- package/src/schematics/ng-add/index.js.map +1 -1
- package/src/schematics/open-api/coerce-open-api-project.js +4 -4
- package/src/schematics/open-api/coerce-open-api-project.js.map +1 -1
- package/src/schematics/open-api/create-directive.js +5 -5
- package/src/schematics/open-api/create-directive.js.map +1 -1
- package/src/schematics/open-api/generate-data-source.js +4 -4
- package/src/schematics/open-api/generate-data-source.js.map +1 -1
- package/src/schematics/open-api/generate-openapi-provider.js +1 -1
- package/src/schematics/open-api/generate-openapi-provider.js.map +1 -1
- package/src/schematics/open-api/generate-remote-method.js +10 -10
- package/src/schematics/open-api/generate-remote-method.js.map +1 -1
- package/src/schematics/open-api/index.js +18 -18
- package/src/schematics/open-api/index.js.map +1 -1
- package/bundles/rxap-open-api-data-source-table.umd.js +0 -536
- package/bundles/rxap-open-api-data-source-table.umd.js.map +0 -1
- package/bundles/rxap-open-api-data-source.umd.js +0 -526
- package/bundles/rxap-open-api-data-source.umd.js.map +0 -1
- package/bundles/rxap-open-api-remote-method.umd.js +0 -535
- package/bundles/rxap-open-api-remote-method.umd.js.map +0 -1
- package/bundles/rxap-open-api.umd.js +0 -856
- package/bundles/rxap-open-api.umd.js.map +0 -1
- package/esm2015/data-source/lib/error.js +0 -8
- package/esm2015/data-source/lib/error.js.map +0 -1
- package/esm2015/data-source/lib/open-api-data-source.loader.js +0 -36
- package/esm2015/data-source/lib/open-api-data-source.loader.js.map +0 -1
- package/esm2015/data-source/lib/open-api.data-source.js.map +0 -1
- package/esm2015/data-source/public_api.js +0 -6
- package/esm2015/data-source/public_api.js.map +0 -1
- package/esm2015/data-source/rxap-open-api-data-source.js +0 -5
- package/esm2015/data-source/rxap-open-api-data-source.js.map +0 -1
- package/esm2015/data-source/table/lib/error.js +0 -8
- package/esm2015/data-source/table/lib/error.js.map +0 -1
- package/esm2015/data-source/table/lib/open-api-table.data-source.js.map +0 -1
- package/esm2015/data-source/table/lib/to-open-api-table-data-source.pipe.js +0 -29
- package/esm2015/data-source/table/lib/to-open-api-table-data-source.pipe.js.map +0 -1
- package/esm2015/data-source/table/lib/tokens.js +0 -3
- package/esm2015/data-source/table/lib/tokens.js.map +0 -1
- package/esm2015/data-source/table/public_api.js +0 -5
- package/esm2015/data-source/table/public_api.js.map +0 -1
- package/esm2015/data-source/table/rxap-open-api-data-source-table.js +0 -5
- package/esm2015/data-source/table/rxap-open-api-data-source-table.js.map +0 -1
- package/esm2015/index.js +0 -7
- package/esm2015/index.js.map +0 -1
- package/esm2015/lib/error.js +0 -7
- package/esm2015/lib/error.js.map +0 -1
- package/esm2015/lib/open-api-config.service.js +0 -127
- package/esm2015/lib/open-api-config.service.js.map +0 -1
- package/esm2015/lib/open-api.js +0 -2
- package/esm2015/lib/open-api.js.map +0 -1
- package/esm2015/lib/schema-validation.mixin.js.map +0 -1
- package/esm2015/lib/tokens.js +0 -6
- package/esm2015/lib/tokens.js.map +0 -1
- package/esm2015/lib/utilities.js +0 -16
- package/esm2015/lib/utilities.js.map +0 -1
- package/esm2015/remote-method/lib/error.js +0 -8
- package/esm2015/remote-method/lib/error.js.map +0 -1
- package/esm2015/remote-method/lib/open-api-remote-method.loader.js +0 -37
- package/esm2015/remote-method/lib/open-api-remote-method.loader.js.map +0 -1
- package/esm2015/remote-method/lib/open-api.remote-method.js +0 -119
- package/esm2015/remote-method/lib/open-api.remote-method.js.map +0 -1
- package/esm2015/remote-method/public_api.js +0 -4
- package/esm2015/remote-method/public_api.js.map +0 -1
- package/esm2015/remote-method/rxap-open-api-remote-method.js +0 -5
- package/esm2015/remote-method/rxap-open-api-remote-method.js.map +0 -1
- package/esm2015/rxap-open-api.js +0 -5
- package/esm2015/rxap-open-api.js.map +0 -1
- package/fesm2015/rxap-open-api-data-source-table.js.map +0 -1
- package/fesm2015/rxap-open-api-data-source.js.map +0 -1
- package/fesm2015/rxap-open-api-remote-method.js.map +0 -1
- package/fesm2015/rxap-open-api.js.map +0 -1
|
@@ -86,36 +86,38 @@ let OpenApiRemoteMethod = class OpenApiRemoteMethod extends BaseHttpRemoteMethod
|
|
|
86
86
|
}), take(1), timeout(this.timeout)).toPromise();
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
|
-
OpenApiRemoteMethod.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
90
|
-
OpenApiRemoteMethod.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
89
|
+
OpenApiRemoteMethod.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiRemoteMethod, deps: [{ token: HttpClient }, { token: Injector }, { token: OpenApiConfigService }, { token: DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA, optional: true }, { token: RXAP_OPEN_API_STRICT_VALIDATOR, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
90
|
+
OpenApiRemoteMethod.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiRemoteMethod });
|
|
91
91
|
OpenApiRemoteMethod = __decorate([
|
|
92
92
|
Mixin(SchemaValidationMixin),
|
|
93
93
|
__metadata("design:paramtypes", [HttpClient,
|
|
94
94
|
Injector,
|
|
95
95
|
OpenApiConfigService, Object, Object])
|
|
96
96
|
], OpenApiRemoteMethod);
|
|
97
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
97
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiRemoteMethod, decorators: [{
|
|
98
98
|
type: Injectable
|
|
99
|
-
}], ctorParameters: function () {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
type:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
type:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
type:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
type:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
99
|
+
}], ctorParameters: function () {
|
|
100
|
+
return [{ type: i1.HttpClient, decorators: [{
|
|
101
|
+
type: Inject,
|
|
102
|
+
args: [HttpClient]
|
|
103
|
+
}] }, { type: i0.Injector, decorators: [{
|
|
104
|
+
type: Inject,
|
|
105
|
+
args: [Injector]
|
|
106
|
+
}] }, { type: i2.OpenApiConfigService, decorators: [{
|
|
107
|
+
type: Inject,
|
|
108
|
+
args: [OpenApiConfigService]
|
|
109
|
+
}] }, { type: undefined, decorators: [{
|
|
110
|
+
type: Optional
|
|
111
|
+
}, {
|
|
112
|
+
type: Inject,
|
|
113
|
+
args: [DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA]
|
|
114
|
+
}] }, { type: undefined, decorators: [{
|
|
115
|
+
type: Optional
|
|
116
|
+
}, {
|
|
117
|
+
type: Inject,
|
|
118
|
+
args: [RXAP_OPEN_API_STRICT_VALIDATOR]
|
|
119
|
+
}] }];
|
|
120
|
+
} });
|
|
119
121
|
|
|
120
122
|
class OpenApiRemoteMethodLoader {
|
|
121
123
|
constructor(openApiConfig, http, injector) {
|
|
@@ -134,18 +136,20 @@ class OpenApiRemoteMethodLoader {
|
|
|
134
136
|
return null;
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
|
-
OpenApiRemoteMethodLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
138
|
-
OpenApiRemoteMethodLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
139
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
139
|
+
OpenApiRemoteMethodLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiRemoteMethodLoader, deps: [{ token: OpenApiConfigService }, { token: HttpClient }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
140
|
+
OpenApiRemoteMethodLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiRemoteMethodLoader, providedIn: 'root' });
|
|
141
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiRemoteMethodLoader, decorators: [{
|
|
140
142
|
type: Injectable,
|
|
141
143
|
args: [{ providedIn: 'root' }]
|
|
142
|
-
}], ctorParameters: function () {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
type:
|
|
147
|
-
|
|
148
|
-
|
|
144
|
+
}], ctorParameters: function () {
|
|
145
|
+
return [{ type: i2.OpenApiConfigService, decorators: [{
|
|
146
|
+
type: Inject,
|
|
147
|
+
args: [OpenApiConfigService]
|
|
148
|
+
}] }, { type: i1.HttpClient, decorators: [{
|
|
149
|
+
type: Inject,
|
|
150
|
+
args: [HttpClient]
|
|
151
|
+
}] }, { type: i0.Injector }];
|
|
152
|
+
} });
|
|
149
153
|
|
|
150
154
|
class RxapOpenApiRemoteMethodError extends RxapOpenApiError {
|
|
151
155
|
constructor(message, code, scope) {
|
|
@@ -159,4 +163,4 @@ class RxapOpenApiRemoteMethodError extends RxapOpenApiError {
|
|
|
159
163
|
*/
|
|
160
164
|
|
|
161
165
|
export { OpenApiRemoteMethod, OpenApiRemoteMethodLoader, RxapOpenApiRemoteMethod, RxapOpenApiRemoteMethodError };
|
|
162
|
-
//# sourceMappingURL=rxap-open-api-remote-method.
|
|
166
|
+
//# sourceMappingURL=rxap-open-api-remote-method.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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} 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} from '@rxap/open-api';\nimport { BaseHttpRemoteMethod } from '@rxap/remote-method/http';\nimport {\n BaseRemoteMethodMetadata,\n RxapRemoteMethod\n} from '@rxap/remote-method';\nimport { joinPath } from '@rxap/utilities';\nimport {\n filter,\n timeout,\n retry,\n catchError,\n tap,\n take\n} from 'rxjs/operators';\nimport { throwError } from 'rxjs';\nimport { Mixin } from '@rxap/mixin';\n\nexport function RxapOpenApiRemoteMethod(operationId: string, serverIndex: number = 0) {\n return function(target: any) {\n RxapRemoteMethod({ id: operationId, serverIndex })(target);\n };\n}\n\nexport interface OpenApiRemoteMethodMetadata extends BaseRemoteMethodMetadata {\n /**\n * The operation object with path and method\n */\n operation?: OperationObjectWithMetadata;\n /**\n * The index of the server object in the servers array in the open api config\n */\n serverIndex?: number;\n id: string;\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\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 ) {\n super(http, injector, metadata);\n let operation: OperationObjectWithMetadata;\n if (!this.metadata.operation) {\n this.metadata.operation = operation = openApiConfigService.getOperation(this.metadata.id);\n } else {\n operation = this.metadata.operation;\n }\n this.applyMetadata({\n id: operation.operationId,\n url: () => joinPath(openApiConfigService.getBaseUrl(this.metadata.serverIndex), 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 }\n\n protected async _call(args: OpenApiRemoteMethodParameter<Parameters, RequestBody> = {}): Promise<Response> {\n\n this.validateParameters(this.operation, args.parameters, this.strict);\n this.validateRequestBody(this.operation, args.requestBody, this.strict);\n\n const response = await this._callWithResponse(args);\n\n if (response.body) {\n return response.body;\n }\n\n console.warn('The response body is empty!');\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 this.validateParameters(this.operation, args.parameters, this.strict);\n this.validateRequestBody(this.operation, args.requestBody, this.strict);\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 catchError((response: HttpErrorResponse) => {\n this.interceptors?.forEach(interceptor => interceptor\n .next({ response, parameters: args.parameters, requestBody: args.requestBody })\n );\n return throwError(response);\n }),\n filter((event: any) => event.type === HttpEventType.Response),\n tap((response: HttpResponse<Response>) => this.validateResponse(this.operation, response, this.strict)),\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":";;;;;;;;;;;;;;SAoCgB,uBAAuB,CAAC,WAAmB,EAAE,cAAsB,CAAC;IAClF,OAAO,UAAS,MAAW;QACzB,gBAAgB,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;KAC5D,CAAC;AACJ,CAAC;IAwBY,mBAAmB,SAAnB,4BACH,oBAA0F;IAQlG,YACsB,IAAgB,EAClB,QAAkB,EACN,oBAA0C,EAGtE,WAA+C,IAAI,EAGnD,SAA+C,IAAI;;QAErD,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAbjB,WAAM,GAAY,KAAK,CAAC;QAcvC,IAAI,SAAsC,CAAC;QAC3C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE;YAC5B,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,SAAS,GAAG,oBAAoB,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;SAC3F;aAAM;YACL,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;SACrC;QACD,IAAI,CAAC,aAAa,CAAC;YACjB,EAAE,EAAM,SAAS,CAAC,WAAW;YAC7B,GAAG,EAAK,MAAM,QAAQ,CAAC,oBAAoB,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,IAAI,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B,kBAG1B,oBAAoB,aACpB,UAAU;0HAJT,yBAAyB,cADZ,MAAM;2FACnB,yBAAyB;kBADrC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;8BAI7B,MAAM;+BAAC,oBAAoB;;8BAC3B,MAAM;+BAAC,UAAU;;;;MCZT,qCAAqC,gBAAgB;IAEhE,YAAY,OAAe,EAAE,IAAa,EAAE,KAAc;QACxD,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAC5B,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;KACzC;;;ACPH;;;;;;"}
|
|
@@ -36,7 +36,7 @@ class OpenApiConfigService {
|
|
|
36
36
|
this.defaultServerIndex = OpenApiConfigService.DefaultServerIndex;
|
|
37
37
|
config = config !== null && config !== void 0 ? config : OpenApiConfigService.Config;
|
|
38
38
|
if (!config) {
|
|
39
|
-
throw new Error('Could not load config');
|
|
39
|
+
throw new Error('Could not load open api config');
|
|
40
40
|
}
|
|
41
41
|
this.config = config;
|
|
42
42
|
this._operations = OpenApiConfigService.LoadOperations(config);
|
|
@@ -141,17 +141,19 @@ class OpenApiConfigService {
|
|
|
141
141
|
OpenApiConfigService.Config = null;
|
|
142
142
|
OpenApiConfigService.DefaultServerIndex = 0;
|
|
143
143
|
OpenApiConfigService._operations = null;
|
|
144
|
-
OpenApiConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
145
|
-
OpenApiConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
146
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
144
|
+
OpenApiConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiConfigService, deps: [{ token: RXAP_OPEN_API_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
145
|
+
OpenApiConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiConfigService, providedIn: 'root' });
|
|
146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiConfigService, decorators: [{
|
|
147
147
|
type: Injectable,
|
|
148
148
|
args: [{ providedIn: 'root' }]
|
|
149
|
-
}], ctorParameters: function () {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
}], ctorParameters: function () {
|
|
150
|
+
return [{ type: undefined, decorators: [{
|
|
151
|
+
type: Optional
|
|
152
|
+
}, {
|
|
153
|
+
type: Inject,
|
|
154
|
+
args: [RXAP_OPEN_API_CONFIG]
|
|
155
|
+
}] }];
|
|
156
|
+
} });
|
|
155
157
|
|
|
156
158
|
class SchemaValidationMixin {
|
|
157
159
|
/**
|
|
@@ -199,7 +201,14 @@ class SchemaValidationMixin {
|
|
|
199
201
|
}
|
|
200
202
|
}
|
|
201
203
|
else {
|
|
202
|
-
|
|
204
|
+
if (operationParameters.length === 0 || operationParameters.every(op => !op.required)) {
|
|
205
|
+
if (isDevMode()) {
|
|
206
|
+
console.warn(`The operation ${operation.operationId} does not expect any parameters. But a parameter is provided.`, parameters);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
throw new Error('The parameters object is not a record');
|
|
211
|
+
}
|
|
203
212
|
}
|
|
204
213
|
}
|
|
205
214
|
/**
|
|
@@ -211,8 +220,8 @@ class SchemaValidationMixin {
|
|
|
211
220
|
* @protected
|
|
212
221
|
*/
|
|
213
222
|
validateResponse(operation, response, strict = false) {
|
|
214
|
-
// region only validate the response if the content type is undefined or application/json
|
|
215
223
|
var _a;
|
|
224
|
+
// region only validate the response if the content type is undefined or application/json
|
|
216
225
|
const contentType = response.headers.get('Content-Type');
|
|
217
226
|
if (contentType && contentType !== 'application/json') {
|
|
218
227
|
if (isDevMode()) {
|
|
@@ -399,4 +408,4 @@ SchemaValidationMixin.STRICT = false;
|
|
|
399
408
|
*/
|
|
400
409
|
|
|
401
410
|
export { AssertOpenApiV3, DEFAULT_OPEN_API_DATA_SOURCE_META_DATA, DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA, IsOpenApiV3, IsReferenceObject, NotContainsReferenceObjects, OpenApiConfigService, RXAP_OPEN_API_CONFIG, RXAP_OPEN_API_STRICT_VALIDATOR, RxapOpenApiError, SchemaValidationMixin };
|
|
402
|
-
//# sourceMappingURL=rxap-open-api.
|
|
411
|
+
//# sourceMappingURL=rxap-open-api.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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/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');\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 readonly config: OpenAPIV3.Document;\n\n public defaultServerIndex: number = OpenApiConfigService.DefaultServerIndex;\n\n private readonly _operations: OperationMap;\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 throw new Error('Could not load open api config');\n }\n this.config = config;\n this._operations = OpenApiConfigService.LoadOperations(config);\n }\n\n public getOperation(operationId: string): OperationObjectWithMetadata {\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): string {\n return OpenApiConfigService.GetBaseUrl(this.config, serverIndex);\n }\n\n public insertServer(\n serverConfig: OpenAPIV3.ServerObject,\n index: number = this.defaultServerIndex\n ): void {\n if (!this.config.servers) {\n this.config.servers = [];\n }\n this.config.servers.splice(index, 1, serverConfig);\n }\n}\n","import {\n coerceArray,\n isPromiseLike,\n IsRecord\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 /**\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 let result: boolean | PromiseLike<any>;\n\n try {\n result = new Ajv().validate(schema, 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","/**\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,GAAK,IAAI,cAAc,CAAC,6CAA6C;;MCH3G,yBAAyB,SAAS;IAE7C,YAAY,OAAe,EAAE,IAAa,EAAE,KAAc;QACxD,KAAK,CAAC,gBAAgB,EAAE,OAAO,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,EAAE,KAAK,CAAC,CAAC;KACrD;;;SCHa,iBAAiB,CAAC,GAAS;IACzC,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC;SAEe,2BAA2B,CAAI,KAAwD;IACrG,OAAO,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AAC5E,CAAC;SAEe,WAAW,CAAC,GAAS;IACnC,OAAO,CA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AE,KAAU;QAE5D,IAAI,MAAkC,CAAC;QAEvC,IAAI;YACF,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SAC5C;QAAC,OAAO,CAAM,EAAE;YACf,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YACzB,OAAO,KAAK,CAAC;SACd;QAED,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;YACzB,MAAM,IAAI,KAAK,CAAC,uGAAuG,CAAC,CAAC;SAC1H;QAED,OAAO,MAAM,CAAC;KACf;;AA3Va,4BAAM,GAAY,KAAK;;AC7BvC;;;;;;"}
|
package/{fesm2015/rxap-open-api-data-source-table.js → fesm2020/rxap-open-api-data-source-table.mjs}
RENAMED
|
@@ -26,17 +26,15 @@ class OpenApiTableDataSource extends AbstractTableDataSource {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
tableEventToOpenApiParameters(event) {
|
|
29
|
-
var _a, _b;
|
|
30
29
|
return {
|
|
31
30
|
page: event.page.pageIndex,
|
|
32
31
|
size: event.page.pageSize,
|
|
33
|
-
sortBy:
|
|
34
|
-
direction:
|
|
32
|
+
sortBy: event.sort?.active,
|
|
33
|
+
direction: event.sort?.direction,
|
|
35
34
|
filter: event.filter,
|
|
36
35
|
};
|
|
37
36
|
}
|
|
38
37
|
_connect(viewer) {
|
|
39
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
40
38
|
this.assertPaginator();
|
|
41
39
|
if (viewer.viewChange && viewer.viewChange !== EMPTY) {
|
|
42
40
|
console.warn('The viewChange property is readonly');
|
|
@@ -54,11 +52,11 @@ class OpenApiTableDataSource extends AbstractTableDataSource {
|
|
|
54
52
|
console.warn('The page size is not defined!');
|
|
55
53
|
}
|
|
56
54
|
}), filter((page) => typeof page.pageSize === 'number')),
|
|
57
|
-
|
|
58
|
-
active:
|
|
59
|
-
direction:
|
|
60
|
-
}))
|
|
61
|
-
|
|
55
|
+
this.sort?.sortChange?.pipe(startWith({
|
|
56
|
+
active: this.sort?.active,
|
|
57
|
+
direction: this.sort?.direction,
|
|
58
|
+
})) ?? of(null),
|
|
59
|
+
this.filter?.change ?? of(null),
|
|
62
60
|
]).pipe(map(([page, sort, filter]) => ({ page, sort, filter })), switchMap((event) => {
|
|
63
61
|
const options = this.tableEventToOpenApiParameters(event);
|
|
64
62
|
if (isPromise(options) || isObservable(options)) {
|
|
@@ -92,9 +90,9 @@ class OpenApiTableDataSource extends AbstractTableDataSource {
|
|
|
92
90
|
];
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
|
-
OpenApiTableDataSource.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
96
|
-
OpenApiTableDataSource.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
97
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
93
|
+
OpenApiTableDataSource.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiTableDataSource, deps: [{ token: RXAP_TABLE_DATA_SOURCE }, { token: RXAP_TABLE_DATA_SOURCE_PAGINATOR, optional: true }, { token: RXAP_OPEN_API_TABLE_DATA_SOURCE_TO_PARAMETERS_FUNCTION, optional: true }, { token: RXAP_TABLE_DATA_SOURCE_SORT, optional: true }, { token: RXAP_TABLE_DATA_SOURCE_FILTER, optional: true }, { token: RXAP_TABLE_DATA_SOURCE_PARAMETERS, optional: true }, { token: RXAP_DATA_SOURCE_METADATA, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
94
|
+
OpenApiTableDataSource.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiTableDataSource });
|
|
95
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiTableDataSource, decorators: [{
|
|
98
96
|
type: Injectable
|
|
99
97
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
100
98
|
type: Inject,
|
|
@@ -141,9 +139,9 @@ class ToOpenApiTableDataSourcePipe {
|
|
|
141
139
|
return new OpenApiTableDataSource(dataSource, paginator, tableEventToOpenApiParameters, sort, filter);
|
|
142
140
|
}
|
|
143
141
|
}
|
|
144
|
-
ToOpenApiTableDataSourcePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
145
|
-
ToOpenApiTableDataSourcePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "
|
|
146
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
142
|
+
ToOpenApiTableDataSourcePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ToOpenApiTableDataSourcePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
143
|
+
ToOpenApiTableDataSourcePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ToOpenApiTableDataSourcePipe, name: "toOpenApiTableDataSource" });
|
|
144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ToOpenApiTableDataSourcePipe, decorators: [{
|
|
147
145
|
type: Pipe,
|
|
148
146
|
args: [{
|
|
149
147
|
name: 'toOpenApiTableDataSource'
|
|
@@ -151,10 +149,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
|
|
|
151
149
|
}] });
|
|
152
150
|
class ToOpenApiTableDataSourcePipeModule {
|
|
153
151
|
}
|
|
154
|
-
ToOpenApiTableDataSourcePipeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
155
|
-
ToOpenApiTableDataSourcePipeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
156
|
-
ToOpenApiTableDataSourcePipeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
157
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
152
|
+
ToOpenApiTableDataSourcePipeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ToOpenApiTableDataSourcePipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
153
|
+
ToOpenApiTableDataSourcePipeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ToOpenApiTableDataSourcePipeModule, declarations: [ToOpenApiTableDataSourcePipe], exports: [ToOpenApiTableDataSourcePipe] });
|
|
154
|
+
ToOpenApiTableDataSourcePipeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ToOpenApiTableDataSourcePipeModule });
|
|
155
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ToOpenApiTableDataSourcePipeModule, decorators: [{
|
|
158
156
|
type: NgModule,
|
|
159
157
|
args: [{
|
|
160
158
|
exports: [ToOpenApiTableDataSourcePipe],
|
|
@@ -167,4 +165,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
|
|
|
167
165
|
*/
|
|
168
166
|
|
|
169
167
|
export { OpenApiTableDataSource, RXAP_OPEN_API_TABLE_DATA_SOURCE_TO_PARAMETERS_FUNCTION, RxapOpenApiDataSourceTableError, RxapOpenApiTableDataSource, ToOpenApiTableDataSourcePipe, ToOpenApiTableDataSourcePipeModule };
|
|
170
|
-
//# sourceMappingURL=rxap-open-api-data-source-table.
|
|
168
|
+
//# sourceMappingURL=rxap-open-api-data-source-table.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rxap-open-api-data-source-table.mjs","sources":["../../../../libs/open-api/data-source/table/src/lib/error.ts","../../../../libs/open-api/data-source/table/src/lib/tokens.ts","../../../../libs/open-api/data-source/table/src/lib/open-api-table.data-source.ts","../../../../libs/open-api/data-source/table/src/lib/to-open-api-table-data-source.pipe.ts","../../../../libs/open-api/data-source/table/src/rxap-open-api-data-source-table.ts"],"sourcesContent":["import { RxapOpenApiDataSourceError } from '@rxap/open-api/data-source';\n\nexport class RxapOpenApiDataSourceTableError extends RxapOpenApiDataSourceError {\n\n constructor(message: string, code?: string, scope?: string) {\n super(message, code, scope);\n this.addSubPackageName('table');\n }\n\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const RXAP_OPEN_API_TABLE_DATA_SOURCE_TO_PARAMETERS_FUNCTION = new InjectionToken('rxap/open-api/data-source/table/to-parameters-function')\n","import {\n AbstractTableDataSource,\n RXAP_TABLE_DATA_SOURCE,\n RXAP_TABLE_DATA_SOURCE_PAGINATOR,\n RXAP_TABLE_DATA_SOURCE_SORT,\n SortLike,\n RXAP_TABLE_DATA_SOURCE_FILTER,\n FilterLike,\n Sort,\n AbstractTableDataSourceMetadata,\n RxapAbstractTableDataSource,\n RXAP_TABLE_DATA_SOURCE_PARAMETERS\n} from '@rxap/data-source/table';\nimport {\n Injectable,\n Inject,\n Optional\n} from '@angular/core';\nimport {\n RXAP_DATA_SOURCE_METADATA,\n BaseDataSourceViewer\n} from '@rxap/data-source';\nimport {\n PaginatorLike,\n PageEvent\n} from '@rxap/data-source/pagination';\nimport { PaginationData } from '@rxap/data-source/http/pagination';\nimport {\n Observable,\n TeardownLogic,\n EMPTY,\n combineLatest,\n of,\n isObservable\n} from 'rxjs';\nimport { RxapOpenApiDataSourceTableError } from './error';\nimport {\n startWith,\n tap,\n filter as rxjsFilter,\n map,\n switchMap\n} from 'rxjs/operators';\nimport { RXAP_OPEN_API_TABLE_DATA_SOURCE_TO_PARAMETERS_FUNCTION } from './tokens';\nimport {\n Constructor,\n isPromise\n} from '@rxap/utilities';\nimport type { OpenApiDataSource } from '@rxap/open-api/data-source';\nimport { OpenApiDataSourceViewer } from '@rxap/open-api/data-source';\n\nexport interface TableEvent {\n page: PageEvent;\n sort: Sort | null;\n filter: Record<string, any> | string | null;\n}\n\nexport interface OpenApiTableDataSourceViewer extends BaseDataSourceViewer {\n readonly viewChange: Observable<TableEvent>;\n}\n\nexport interface OpenApiTableDataSourceMetadata\n extends AbstractTableDataSourceMetadata {}\n\nexport type TableEventToOpenApiParametersFunction<\n Parameters extends Record<string, any>\n> = (\n event: TableEvent\n) => Parameters | Observable<Parameters> | Promise<Parameters>;\n\n@Injectable()\nexport class OpenApiTableDataSource<\n Data extends object = any,\n Parameters extends Record<string, any> = any\n> extends AbstractTableDataSource<Data> {\n constructor(\n @Inject(RXAP_TABLE_DATA_SOURCE)\n private readonly dataSource: OpenApiDataSource<PaginationData<Data>>,\n @Optional()\n @Inject(RXAP_TABLE_DATA_SOURCE_PAGINATOR)\n paginator: PaginatorLike | null = null,\n @Optional()\n @Inject(RXAP_OPEN_API_TABLE_DATA_SOURCE_TO_PARAMETERS_FUNCTION)\n tableEventToOpenApiParameters: any | null = null,\n @Optional()\n @Inject(RXAP_TABLE_DATA_SOURCE_SORT)\n sort: SortLike | null = null,\n @Optional()\n @Inject(RXAP_TABLE_DATA_SOURCE_FILTER)\n filter: FilterLike | null = null,\n @Optional()\n @Inject(RXAP_TABLE_DATA_SOURCE_PARAMETERS)\n parameters: Observable<Parameters> | null = null,\n @Optional()\n @Inject(RXAP_DATA_SOURCE_METADATA)\n metadata: OpenApiTableDataSourceMetadata | null = dataSource.metadata\n ) {\n super(paginator, sort, filter, parameters, metadata);\n if (tableEventToOpenApiParameters) {\n this.tableEventToOpenApiParameters = tableEventToOpenApiParameters;\n }\n }\n\n public tableEventToOpenApiParameters(\n event: TableEvent\n ): Parameters | Observable<Parameters> | Promise<Parameters> {\n return {\n page: event.page.pageIndex,\n size: event.page.pageSize,\n sortBy: event.sort?.active,\n direction: event.sort?.direction,\n filter: event.filter,\n } as any;\n }\n\n protected _connect(\n viewer: OpenApiDataSourceViewer\n ): [Observable<Data[]>, TeardownLogic] {\n this.assertPaginator();\n\n if (viewer.viewChange && viewer.viewChange !== EMPTY) {\n console.warn('The viewChange property is readonly');\n }\n\n if (this.paginator === undefined || this.paginator.page === undefined) {\n throw new RxapOpenApiDataSourceTableError(\n 'The paginator instance has not a page property',\n ''\n );\n }\n\n viewer.viewChange = combineLatest([\n this.paginator.page.pipe(\n startWith({\n pageIndex: this.paginator.pageIndex,\n pageSize: this.paginator.pageSize,\n length: this.paginator.length,\n }),\n tap((page) => {\n if (typeof page.pageSize !== 'number') {\n console.warn('The page size is not defined!');\n }\n }),\n rxjsFilter((page) => typeof page.pageSize === 'number')\n ),\n this.sort?.sortChange?.pipe(\n startWith({\n active: this.sort?.active,\n direction: this.sort?.direction,\n })\n ) ?? of(null),\n this.filter?.change ?? of(null),\n ]).pipe(\n map(([page, sort, filter]) => ({ page, sort, filter })),\n switchMap((event) => {\n const options = this.tableEventToOpenApiParameters(event);\n if (isPromise(options) || isObservable(options)) {\n return options;\n }\n return of(options);\n })\n );\n\n return [\n this.dataSource.connect(viewer).pipe(\n tap((paginationData) => {\n if (typeof paginationData !== 'object') {\n throw new RxapOpenApiDataSourceTableError(\n 'The open api data source does not return a PaginationData object. Value is not an object',\n ''\n );\n }\n if (!paginationData.hasOwnProperty('total')) {\n throw new RxapOpenApiDataSourceTableError(\n 'The open api data source does not return a PaginationData object. Object has not the property total',\n ''\n );\n }\n if (\n !paginationData.hasOwnProperty('data') &&\n !Array.isArray(paginationData.data)\n ) {\n throw new RxapOpenApiDataSourceTableError(\n 'The open api data source does not return a PaginationData object. Object has not the property data' +\n ' property of the value not an array',\n ''\n );\n }\n if (\n paginationData.size !== undefined &&\n paginationData.size !== this.paginator!.pageSize\n ) {\n console.warn(\n 'The selected page size from the paginator is not equal to the page size from the PaginationData object'\n );\n }\n if (\n paginationData.page !== undefined &&\n paginationData.page !== this.paginator!.pageIndex\n ) {\n console.warn(\n 'The selected page index from the paginator is not equal to the page index from the PaginationData object'\n );\n }\n }),\n tap((paginationData) => this.updateTotalLength(paginationData.total)),\n map((paginationData) => paginationData.data)\n ),\n () => this.dataSource.disconnect(viewer),\n ];\n }\n}\n\nexport function RxapOpenApiTableDataSource<\n Data extends object,\n Parameters extends Record<string, any>\n>(\n metadata: OpenApiTableDataSourceMetadata,\n className: string = 'OpenApiTableDataSource',\n packageName: string = '@rxap/open-api/data-source/table'\n) {\n return function (\n target: Constructor<OpenApiTableDataSource<Data, Parameters>>\n ) {\n RxapAbstractTableDataSource(metadata, className, packageName)(target);\n };\n}\n","import {\n Pipe,\n PipeTransform,\n NgModule\n} from '@angular/core';\nimport { PaginationData } from '@rxap/data-source/http/pagination';\nimport { PaginatorLike } from '@rxap/data-source/pagination';\nimport {\n SortLike,\n FilterLike\n} from '@rxap/data-source/table';\nimport { OpenApiDataSource } from '@rxap/open-api/data-source';\nimport {\n OpenApiTableDataSource,\n TableEventToOpenApiParametersFunction\n} from './open-api-table.data-source';\n\n@Pipe({\n name: 'toOpenApiTableDataSource'\n})\nexport class ToOpenApiTableDataSourcePipe implements PipeTransform {\n\n public transform<Data extends object, Parameters extends Record<string, any>>(\n dataSource: OpenApiDataSource<PaginationData<Data>>,\n paginator: PaginatorLike,\n tableEventToOpenApiParameters?: TableEventToOpenApiParametersFunction<Parameters>,\n sort?: SortLike,\n filter?: FilterLike\n ): OpenApiTableDataSource<Data> {\n return new OpenApiTableDataSource(dataSource, paginator, tableEventToOpenApiParameters, sort, filter);\n }\n\n}\n\n@NgModule({\n exports: [ ToOpenApiTableDataSourcePipe ],\n declarations: [ ToOpenApiTableDataSourcePipe ]\n})\nexport class ToOpenApiTableDataSourcePipeModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["rxjsFilter"],"mappings":";;;;;;;;;;MAEa,+BAAgC,SAAQ,0BAA0B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.metadata.operation;
|
|
49
49
|
}
|
|
50
50
|
derive(id, metadata = this.metadata, isolated = false) {
|
|
51
|
-
return new OpenApiDataSource_1(this.http, this.openApiConfigService,
|
|
51
|
+
return new OpenApiDataSource_1(this.http, this.openApiConfigService, { ...deepMerge(this.metadata, metadata), id }, isolated ? null : this.refresh$);
|
|
52
52
|
}
|
|
53
53
|
connect(viewer) {
|
|
54
|
-
var _a;
|
|
55
54
|
if (viewer.parameters) {
|
|
56
55
|
this.validateParameters(this.operation, viewer.parameters, this.strict);
|
|
57
56
|
}
|
|
@@ -63,33 +62,33 @@ let OpenApiDataSource = OpenApiDataSource_1 = class OpenApiDataSource extends Ba
|
|
|
63
62
|
this.validateParameters(this.operation, viewer.parameters, this.strict);
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
|
-
return super.connect(
|
|
65
|
+
return super.connect({
|
|
66
|
+
...viewer,
|
|
67
|
+
...this.buildHttpOptions(this.operation, viewer.parameters),
|
|
67
68
|
// if the view change is an empty observable. Then dont apply the pipe logic
|
|
68
69
|
// else the http request is never triggered
|
|
69
|
-
viewChange: viewer.viewChange === EMPTY ? viewer.viewChange :
|
|
70
|
+
viewChange: viewer.viewChange === EMPTY ? viewer.viewChange : viewer.viewChange?.pipe(tap(parameters => this.validateParameters(this.operation, parameters, this.strict)), map(parameters => this.buildHttpOptions(this.operation, parameters)))
|
|
71
|
+
});
|
|
70
72
|
}
|
|
71
73
|
buildRequest(options) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
var _a;
|
|
75
|
-
(_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.forEach(interceptor => interceptor
|
|
74
|
+
return this.http.request(this.buildHttpRequest(options)).pipe(retry(this.metadata.retry ?? 0), catchError((response) => {
|
|
75
|
+
this.interceptors?.forEach(interceptor => interceptor
|
|
76
76
|
.next({ response, options }));
|
|
77
77
|
return throwError(response);
|
|
78
78
|
}), filter((event) => event.type === HttpEventType.Response), tap((response) => this.validateResponse(this.operation, response, this.strict)), tap((response) => {
|
|
79
|
-
|
|
80
|
-
(_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.forEach(interceptor => interceptor
|
|
79
|
+
this.interceptors?.forEach(interceptor => interceptor
|
|
81
80
|
.next({ response, options }));
|
|
82
81
|
}), map((event) => event.body), isDefined(), take(1), timeout(this.timeout));
|
|
83
82
|
}
|
|
84
83
|
};
|
|
85
|
-
OpenApiDataSource.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
86
|
-
OpenApiDataSource.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
84
|
+
OpenApiDataSource.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiDataSource, deps: [{ token: HttpClient }, { token: OpenApiConfigService }, { token: DEFAULT_OPEN_API_DATA_SOURCE_META_DATA, optional: true }, { token: RXAP_DATA_SOURCE_REFRESH, optional: true }, { token: RXAP_OPEN_API_STRICT_VALIDATOR, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
85
|
+
OpenApiDataSource.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiDataSource });
|
|
87
86
|
OpenApiDataSource = OpenApiDataSource_1 = __decorate([
|
|
88
87
|
Mixin(SchemaValidationMixin),
|
|
89
88
|
__metadata("design:paramtypes", [HttpClient,
|
|
90
89
|
OpenApiConfigService, Object, Object, Object])
|
|
91
90
|
], OpenApiDataSource);
|
|
92
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
91
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiDataSource, decorators: [{
|
|
93
92
|
type: Injectable
|
|
94
93
|
}], ctorParameters: function () { return [{ type: i1.HttpClient, decorators: [{
|
|
95
94
|
type: Inject,
|
|
@@ -130,9 +129,9 @@ class OpenApiDataSourceLoader {
|
|
|
130
129
|
return null;
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
|
-
OpenApiDataSourceLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
134
|
-
OpenApiDataSourceLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
135
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
132
|
+
OpenApiDataSourceLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiDataSourceLoader, deps: [{ token: OpenApiConfigService }, { token: HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
133
|
+
OpenApiDataSourceLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiDataSourceLoader, providedIn: 'root' });
|
|
134
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: OpenApiDataSourceLoader, decorators: [{
|
|
136
135
|
type: Injectable,
|
|
137
136
|
args: [{ providedIn: 'root' }]
|
|
138
137
|
}], ctorParameters: function () { return [{ type: i2.OpenApiConfigService, decorators: [{
|
|
@@ -155,4 +154,4 @@ class RxapOpenApiDataSourceError extends RxapOpenApiError {
|
|
|
155
154
|
*/
|
|
156
155
|
|
|
157
156
|
export { OpenApiDataSource, OpenApiDataSourceLoader, RxapOpenApiDataSource, RxapOpenApiDataSourceError };
|
|
158
|
-
//# sourceMappingURL=rxap-open-api-data-source.
|
|
157
|
+
//# sourceMappingURL=rxap-open-api-data-source.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rxap-open-api-data-source.mjs","sources":["../../../../libs/open-api/data-source/src/lib/open-api.data-source.ts","../../../../libs/open-api/data-source/src/lib/open-api-data-source.loader.ts","../../../../libs/open-api/data-source/src/lib/error.ts","../../../../libs/open-api/data-source/src/rxap-open-api-data-source.ts"],"sourcesContent":["import {\n Injectable,\n Optional,\n Inject\n} from '@angular/core';\nimport {\n OperationObjectWithMetadata,\n OpenApiConfigService,\n SchemaValidationMixin,\n RXAP_OPEN_API_STRICT_VALIDATOR,\n DEFAULT_OPEN_API_DATA_SOURCE_META_DATA\n} from '@rxap/open-api';\nimport {\n HttpClient,\n HttpResponse,\n HttpErrorResponse,\n HttpEventType\n} from '@angular/common/http';\nimport {\n KeyValue,\n joinPath,\n deepMerge\n} from '@rxap/utilities';\nimport {\n HttpDataSourceMetadata,\n HttpDataSourceOptions,\n BaseHttpDataSource\n} from '@rxap/data-source/http';\nimport {\n RxapDataSource,\n BaseDataSourceViewer,\n RXAP_DATA_SOURCE_REFRESH\n} from '@rxap/data-source';\nimport {\n Observable,\n throwError,\n Subject,\n EMPTY\n} from 'rxjs';\nimport {\n map,\n tap,\n retry,\n filter,\n catchError,\n timeout,\n take\n} from 'rxjs/operators';\nimport { Mixin } from '@rxap/mixin';\nimport { isDefined } from '@rxap/utilities/rxjs';\n\nexport interface OpenApiDataSourceMetadata<PathParams = KeyValue, Body = any | null> extends Partial<HttpDataSourceMetadata<PathParams, Body>> {\n\n /**\n * The operation object with path and method\n */\n operation?: OperationObjectWithMetadata;\n\n /**\n * The index of the server object in the servers array in the open api config\n */\n serverIndex?: number;\n\n /**\n * The operation id\n */\n id: string;\n\n strict?: boolean;\n\n}\n\nexport interface OpenApiDataSourceViewer<Parameters = any>\n extends BaseDataSourceViewer<Parameters> {\n parameters?: Parameters;\n}\n\nexport function RxapOpenApiDataSource(operationIdOrMetadata: string | OpenApiDataSourceMetadata, serverIndex: number = 0) {\n const metadata = typeof operationIdOrMetadata === 'string' ? { id: operationIdOrMetadata, serverIndex } : operationIdOrMetadata;\n return function(target: any) {\n RxapDataSource(metadata)(target);\n };\n}\n\nexport interface OpenApiDataSource<Response = any, Parameters = any> extends SchemaValidationMixin<Response, Parameters> {}\n\n@Mixin(SchemaValidationMixin)\n@Injectable()\nexport class OpenApiDataSource<Response = any, Parameters = any>\n extends BaseHttpDataSource<Response> {\n\n public get operation(): OperationObjectWithMetadata {\n return this.metadata.operation;\n }\n\n private readonly strict: boolean = false;\n\n constructor(\n @Inject(HttpClient)\n http: HttpClient,\n @Inject(OpenApiConfigService)\n private readonly openApiConfigService: OpenApiConfigService,\n @Optional()\n @Inject(DEFAULT_OPEN_API_DATA_SOURCE_META_DATA)\n metadata: OpenApiDataSourceMetadata | null = null,\n @Optional()\n @Inject(RXAP_DATA_SOURCE_REFRESH)\n refresh$: Subject<HttpDataSourceOptions> | null = null,\n @Optional()\n @Inject(RXAP_OPEN_API_STRICT_VALIDATOR)\n strict: boolean | null = null,\n ) {\n super(http, metadata as any);\n let operation: OperationObjectWithMetadata;\n if (!this.metadata.operation) {\n this.metadata.operation = operation = openApiConfigService.getOperation(this.metadata.id);\n } else {\n operation = this.metadata.operation;\n }\n\n if (operation.method !== 'GET') {\n throw new Error('OpenApi DataSource only supports GET Operations!');\n }\n\n this.applyMetadata({\n id: operation.operationId,\n url: () => joinPath(openApiConfigService.getBaseUrl(this.metadata.serverIndex), operation.path),\n method: 'GET'\n });\n\n this.strict = strict || this.metadata.strict || false;\n\n }\n\n public derive<D = Response>(\n id: string,\n metadata: Partial<OpenApiDataSourceMetadata> = this.metadata,\n isolated: boolean = false\n ): OpenApiDataSource<D, Parameters> {\n return new OpenApiDataSource<D, Parameters>(\n this.http,\n this.openApiConfigService,\n { ...deepMerge(this.metadata, metadata), id },\n isolated ? null : this.refresh$\n );\n }\n\n public connect(viewer: OpenApiDataSourceViewer<Parameters>): Observable<Response> {\n\n\n if (viewer.parameters) {\n this.validateParameters(this.operation, viewer.parameters, this.strict);\n } else {\n if (viewer.viewChange === EMPTY || viewer.viewChange === undefined) {\n // set the viewer parameters to an empty parameter and test if that\n // is valid.\n viewer.parameters = {} as any;\n this.validateParameters(this.operation, viewer.parameters, this.strict);\n }\n }\n\n return super.connect({\n ...viewer,\n ...this.buildHttpOptions(this.operation, viewer.parameters),\n // if the view change is an empty observable. Then dont apply the pipe logic\n // else the http request is never triggered\n viewChange: viewer.viewChange === EMPTY ? viewer.viewChange : viewer.viewChange?.pipe(\n tap(parameters => this.validateParameters(this.operation, parameters, this.strict)),\n map(parameters => this.buildHttpOptions(this.operation, parameters))\n )\n });\n\n }\n\n protected buildRequest(options: HttpDataSourceOptions): Observable<Response> {\n return this.http.request<Response>(this.buildHttpRequest(options)).pipe(\n retry(this.metadata.retry ?? 0),\n catchError((response: HttpErrorResponse) => {\n this.interceptors?.forEach(interceptor => interceptor\n .next({ response, options })\n );\n return throwError(response);\n }),\n filter((event: any) => event.type === HttpEventType.Response),\n tap((response: HttpResponse<Response>) => this.validateResponse(this.operation, response, this.strict)),\n tap((response: HttpResponse<Response>) => {\n this.interceptors?.forEach(interceptor => interceptor\n .next({ response, options })\n );\n }),\n map((event: HttpResponse<Response>) => event.body),\n isDefined(),\n take(1),\n timeout(this.timeout)\n );\n }\n\n}\n","import {\n Injectable,\n Inject\n} from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { OpenApiDataSource } from './open-api.data-source';\nimport { OpenApiConfigService } from '@rxap/open-api';\n\n@Injectable({ providedIn: 'root' })\nexport class OpenApiDataSourceLoader {\n\n constructor(\n @Inject(OpenApiConfigService) public readonly openApiConfig: OpenApiConfigService,\n @Inject(HttpClient) public readonly http: HttpClient\n ) {}\n\n public load(definitionId: string): OpenApiDataSource | null {\n\n const operation = this.openApiConfig.getOperation(definitionId);\n\n if (operation) {\n return new OpenApiDataSource(\n this.http,\n this.openApiConfig,\n {\n id: definitionId,\n operation\n }\n );\n }\n\n return null;\n }\n\n}\n","import { RxapOpenApiError } from '@rxap/open-api';\n\nexport class RxapOpenApiDataSourceError extends RxapOpenApiError {\n\n constructor(message: string, code?: string, scope?: string) {\n super(message, code, scope);\n this.addSubPackageName('data-source');\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],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