@rxap/open-api 12.2.5 → 12.3.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 (52) hide show
  1. package/bundles/rxap-open-api-data-source-table.umd.js +15 -17
  2. package/bundles/rxap-open-api-data-source-table.umd.js.map +1 -1
  3. package/bundles/rxap-open-api-data-source.umd.js +39 -25
  4. package/bundles/rxap-open-api-data-source.umd.js.map +1 -1
  5. package/bundles/rxap-open-api-remote-method.umd.js +34 -20
  6. package/bundles/rxap-open-api-remote-method.umd.js.map +1 -1
  7. package/bundles/rxap-open-api.umd.js +12 -12
  8. package/bundles/rxap-open-api.umd.js.map +1 -1
  9. package/data-source/lib/open-api.data-source.d.ts +4 -3
  10. package/esm2015/data-source/lib/open-api-data-source.loader.js +3 -3
  11. package/esm2015/data-source/lib/open-api-data-source.loader.js.map +1 -1
  12. package/esm2015/data-source/lib/open-api.data-source.js +29 -10
  13. package/esm2015/data-source/lib/open-api.data-source.js.map +1 -1
  14. package/esm2015/data-source/table/lib/open-api-table.data-source.js +3 -3
  15. package/esm2015/data-source/table/lib/open-api-table.data-source.js.map +1 -1
  16. package/esm2015/data-source/table/lib/to-open-api-table-data-source.pipe.js +7 -7
  17. package/esm2015/data-source/table/lib/to-open-api-table-data-source.pipe.js.map +1 -1
  18. package/esm2015/lib/open-api-config.service.js +4 -4
  19. package/esm2015/lib/open-api-config.service.js.map +1 -1
  20. package/esm2015/lib/schema-validation.mixin.js +2 -2
  21. package/esm2015/lib/schema-validation.mixin.js.map +1 -1
  22. package/esm2015/lib/tokens.js +1 -0
  23. package/esm2015/lib/tokens.js.map +1 -1
  24. package/esm2015/remote-method/lib/open-api-remote-method.loader.js +3 -3
  25. package/esm2015/remote-method/lib/open-api-remote-method.loader.js.map +1 -1
  26. package/esm2015/remote-method/lib/open-api.remote-method.js +26 -11
  27. package/esm2015/remote-method/lib/open-api.remote-method.js.map +1 -1
  28. package/fesm2015/rxap-open-api-data-source-table.js +10 -10
  29. package/fesm2015/rxap-open-api-data-source-table.js.map +1 -1
  30. package/fesm2015/rxap-open-api-data-source.js +32 -13
  31. package/fesm2015/rxap-open-api-data-source.js.map +1 -1
  32. package/fesm2015/rxap-open-api-remote-method.js +29 -14
  33. package/fesm2015/rxap-open-api-remote-method.js.map +1 -1
  34. package/fesm2015/rxap-open-api.js +8 -7
  35. package/fesm2015/rxap-open-api.js.map +1 -1
  36. package/lib/tokens.d.ts +1 -0
  37. package/package.json +2 -2
  38. package/remote-method/lib/open-api.remote-method.d.ts +3 -2
  39. package/src/schematics/ng-add/index.js +1 -1
  40. package/src/schematics/ng-add/index.js.map +1 -1
  41. package/src/schematics/open-api/coerce-open-api-project.js +4 -4
  42. package/src/schematics/open-api/coerce-open-api-project.js.map +1 -1
  43. package/src/schematics/open-api/create-directive.js +5 -5
  44. package/src/schematics/open-api/create-directive.js.map +1 -1
  45. package/src/schematics/open-api/generate-data-source.js +3 -3
  46. package/src/schematics/open-api/generate-data-source.js.map +1 -1
  47. package/src/schematics/open-api/generate-openapi-provider.js +1 -1
  48. package/src/schematics/open-api/generate-openapi-provider.js.map +1 -1
  49. package/src/schematics/open-api/generate-remote-method.js +9 -9
  50. package/src/schematics/open-api/generate-remote-method.js.map +1 -1
  51. package/src/schematics/open-api/index.js +17 -17
  52. package/src/schematics/open-api/index.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"rxap-open-api-data-source-table.js","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;IAE7E,YAAY,OAAe,EAAE,IAAa,EAAE,KAAc;QACxD,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAC5B,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;KACjC;;;MCLU,sDAAsD,GAAG,IAAI,cAAc,CAAC,wDAAwD;;MCqEpI,sBAGX,SAAQ,uBAA6B;IACrC,YAEmB,UAAmD,EAGpE,YAAkC,IAAI,EAGtC,gCAA4C,IAAI,EAGhD,OAAwB,IAAI,EAG5B,SAA4B,IAAI,EAGhC,aAA4C,IAAI,EAGhD,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BACR,MAAM;2BAAC,iCAAiC;;0BAExC,QAAQ;;0BACR,MAAM;2BAAC,yBAAyB;;SAuHrB,0BAA0B,CAIxC,QAAwC,EACxC,YAAoB,wBAAwB,EAC5C,cAAsB,kCAAkC;IAExD,OAAO,UACL,MAA6D;QAE7D,2BAA2B,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;KACvE,CAAC;AACJ;;MC9Ma,4BAA4B;IAEhC,SAAS,CACd,UAAmD,EACnD,SAAwB,EACxB,6BAAiF,EACjF,IAAe,EACf,MAAmB;QAEnB,OAAO,IAAI,sBAAsB,CAAC,UAAU,EAAE,SAAS,EAAE,6BAA6B,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;KACvG;;yHAVU,4BAA4B;uHAA5B,4BAA4B;2FAA5B,4BAA4B;kBAHxC,IAAI;mBAAC;oBACJ,IAAI,EAAE,0BAA0B;iBACjC;;MAmBY,kCAAkC;;+HAAlC,kCAAkC;gIAAlC,kCAAkC,iBAlBlC,4BAA4B,aAA5B,4BAA4B;gIAkB5B,kCAAkC;2FAAlC,kCAAkC;kBAJ9C,QAAQ;mBAAC;oBACR,OAAO,EAAO,CAAE,4BAA4B,CAAE;oBAC9C,YAAY,EAAE,CAAE,4BAA4B,CAAE;iBAC/C;;;ACrCD;;;;;;"}
1
+ {"version":3,"file":"rxap-open-api-data-source-table.js","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;IAE7E,YAAY,OAAe,EAAE,IAAa,EAAE,KAAc;QACxD,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAC5B,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;KACjC;;;MCLU,sDAAsD,GAAG,IAAI,cAAc,CAAC,wDAAwD;;MCqEpI,sBAGX,SAAQ,uBAA6B;IACrC,YAEmB,UAAmD,EAGpE,YAAkC,IAAI,EAGtC,gCAA4C,IAAI,EAGhD,OAAwB,IAAI,EAG5B,SAA4B,IAAI,EAGhC,aAA4C,IAAI,EAGhD,WAAkD,UAAU,CAAC,QAAQ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C;;0BAExC,QAAQ;;0BACR,MAAM;2BAAC,yBAAyB;;SAuHrB,0BAA0B,CAIxC,QAAwC,EACxC,YAAoB,wBAAwB,EAC5C,cAAsB,kCAAkC;IAExD,OAAO,UACL,MAA6D;QAE7D,2BAA2B,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;KACvE,CAAC;AACJ;;MC9Ma,4BAA4B;IAEhC,SAAS,CACd,UAAmD,EACnD,SAAwB,EACxB,6BAAiF,EACjF,IAAe,EACf,MAAmB;QAEnB,OAAO,IAAI,sBAAsB,CAAC,UAAU,EAAE,SAAS,EAAE,6BAA6B,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;KACvG;;0HAVU,4BAA4B;wHAA5B,4BAA4B;4FAA5B,4BAA4B;kBAHxC,IAAI;mBAAC;oBACJ,IAAI,EAAE,0BAA0B;iBACjC;;MAmBY,kCAAkC;;gIAAlC,kCAAkC;iIAAlC,kCAAkC,iBAlBlC,4BAA4B,aAA5B,4BAA4B;iIAkB5B,kCAAkC;4FAAlC,kCAAkC;kBAJ9C,QAAQ;mBAAC;oBACR,OAAO,EAAO,CAAE,4BAA4B,CAAE;oBAC9C,YAAY,EAAE,CAAE,4BAA4B,CAAE;iBAC/C;;;ACrCD;;;;;;"}
@@ -4,7 +4,7 @@ import * as i1 from '@angular/common/http';
4
4
  import { HttpEventType, HttpClient } from '@angular/common/http';
5
5
  import { __decorate, __metadata } from 'tslib';
6
6
  import * as i2 from '@rxap/open-api';
7
- import { OpenApiConfigService, DEFAULT_OPEN_API_DATA_SOURCE_META_DATA, RXAP_OPEN_API_STRICT_VALIDATOR, SchemaValidationMixin, RxapOpenApiError } from '@rxap/open-api';
7
+ import { OpenApiConfigService, DEFAULT_OPEN_API_DATA_SOURCE_META_DATA, RXAP_OPEN_API_STRICT_VALIDATOR, DISABLE_SCHEMA_VALIDATION, SchemaValidationMixin, RxapOpenApiError } from '@rxap/open-api';
8
8
  export { IsReferenceObject, NotContainsReferenceObjects } from '@rxap/open-api';
9
9
  import { joinPath, deepMerge } from '@rxap/utilities';
10
10
  import { BaseHttpDataSource } from '@rxap/data-source/http';
@@ -23,10 +23,11 @@ function RxapOpenApiDataSource(operationIdOrMetadata, serverIndex = 0) {
23
23
  };
24
24
  }
25
25
  let OpenApiDataSource = OpenApiDataSource_1 = class OpenApiDataSource extends BaseHttpDataSource {
26
- constructor(http, openApiConfigService, metadata = null, refresh$ = null, strict = null) {
26
+ constructor(http, openApiConfigService, metadata = null, refresh$ = null, strict = null, disableSchemaValidation = null) {
27
27
  super(http, metadata);
28
28
  this.openApiConfigService = openApiConfigService;
29
29
  this.strict = false;
30
+ this.disableSchemaValidation = false;
30
31
  let operation;
31
32
  if (!this.metadata.operation) {
32
33
  this.metadata.operation = operation = openApiConfigService.getOperation(this.metadata.id);
@@ -43,6 +44,7 @@ let OpenApiDataSource = OpenApiDataSource_1 = class OpenApiDataSource extends Ba
43
44
  method: 'GET'
44
45
  });
45
46
  this.strict = strict || this.metadata.strict || false;
47
+ this.disableSchemaValidation = disableSchemaValidation || this.metadata.disableSchemaValidation || false;
46
48
  }
47
49
  get operation() {
48
50
  return this.metadata.operation;
@@ -53,20 +55,28 @@ let OpenApiDataSource = OpenApiDataSource_1 = class OpenApiDataSource extends Ba
53
55
  connect(viewer) {
54
56
  var _a;
55
57
  if (viewer.parameters) {
56
- this.validateParameters(this.operation, viewer.parameters, this.strict);
58
+ if (!this.disableSchemaValidation) {
59
+ this.validateParameters(this.operation, viewer.parameters, this.strict);
60
+ }
57
61
  }
58
62
  else {
59
63
  if (viewer.viewChange === EMPTY || viewer.viewChange === undefined) {
60
64
  // set the viewer parameters to an empty parameter and test if that
61
65
  // is valid.
62
66
  viewer.parameters = {};
63
- this.validateParameters(this.operation, viewer.parameters, this.strict);
67
+ if (!this.disableSchemaValidation) {
68
+ this.validateParameters(this.operation, viewer.parameters, this.strict);
69
+ }
64
70
  }
65
71
  }
66
72
  return super.connect(Object.assign(Object.assign(Object.assign({}, viewer), this.buildHttpOptions(this.operation, viewer.parameters)), {
67
73
  // if the view change is an empty observable. Then dont apply the pipe logic
68
74
  // else the http request is never triggered
69
- viewChange: viewer.viewChange === EMPTY ? viewer.viewChange : (_a = viewer.viewChange) === null || _a === void 0 ? void 0 : _a.pipe(tap(parameters => this.validateParameters(this.operation, parameters, this.strict)), map(parameters => this.buildHttpOptions(this.operation, parameters))) }));
75
+ viewChange: viewer.viewChange === EMPTY ? viewer.viewChange : (_a = viewer.viewChange) === null || _a === void 0 ? void 0 : _a.pipe(tap(parameters => {
76
+ if (!this.disableSchemaValidation) {
77
+ this.validateParameters(this.operation, parameters, this.strict);
78
+ }
79
+ }), map(parameters => this.buildHttpOptions(this.operation, parameters))) }));
70
80
  }
71
81
  buildRequest(options) {
72
82
  var _a;
@@ -75,21 +85,25 @@ let OpenApiDataSource = OpenApiDataSource_1 = class OpenApiDataSource extends Ba
75
85
  (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.forEach(interceptor => interceptor
76
86
  .next({ response, options }));
77
87
  return throwError(response);
78
- }), filter((event) => event.type === HttpEventType.Response), tap((response) => this.validateResponse(this.operation, response, this.strict)), tap((response) => {
88
+ }), filter((event) => event.type === HttpEventType.Response), tap((response) => {
89
+ if (!this.disableSchemaValidation) {
90
+ this.validateResponse(this.operation, response, this.strict);
91
+ }
92
+ }), tap((response) => {
79
93
  var _a;
80
94
  (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.forEach(interceptor => interceptor
81
95
  .next({ response, options }));
82
96
  }), map((event) => event.body), isDefined(), take(1), timeout(this.timeout));
83
97
  }
84
98
  };
85
- OpenApiDataSource.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", 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 });
86
- OpenApiDataSource.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: OpenApiDataSource });
99
+ OpenApiDataSource.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", 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 }, { token: DISABLE_SCHEMA_VALIDATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
100
+ OpenApiDataSource.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OpenApiDataSource });
87
101
  OpenApiDataSource = OpenApiDataSource_1 = __decorate([
88
102
  Mixin(SchemaValidationMixin),
89
103
  __metadata("design:paramtypes", [HttpClient,
90
- OpenApiConfigService, Object, Object, Object])
104
+ OpenApiConfigService, Object, Object, Object, Object])
91
105
  ], OpenApiDataSource);
92
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: OpenApiDataSource, decorators: [{
106
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OpenApiDataSource, decorators: [{
93
107
  type: Injectable
94
108
  }], ctorParameters: function () { return [{ type: i1.HttpClient, decorators: [{
95
109
  type: Inject,
@@ -112,6 +126,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
112
126
  }, {
113
127
  type: Inject,
114
128
  args: [RXAP_OPEN_API_STRICT_VALIDATOR]
129
+ }] }, { type: undefined, decorators: [{
130
+ type: Optional
131
+ }, {
132
+ type: Inject,
133
+ args: [DISABLE_SCHEMA_VALIDATION]
115
134
  }] }]; } });
116
135
 
117
136
  class OpenApiDataSourceLoader {
@@ -130,9 +149,9 @@ class OpenApiDataSourceLoader {
130
149
  return null;
131
150
  }
132
151
  }
133
- OpenApiDataSourceLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: OpenApiDataSourceLoader, deps: [{ token: OpenApiConfigService }, { token: HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
134
- OpenApiDataSourceLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: OpenApiDataSourceLoader, providedIn: 'root' });
135
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: OpenApiDataSourceLoader, decorators: [{
152
+ OpenApiDataSourceLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OpenApiDataSourceLoader, deps: [{ token: OpenApiConfigService }, { token: HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
153
+ OpenApiDataSourceLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OpenApiDataSourceLoader, providedIn: 'root' });
154
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OpenApiDataSourceLoader, decorators: [{
136
155
  type: Injectable,
137
156
  args: [{ providedIn: 'root' }]
138
157
  }], ctorParameters: function () { return [{ type: i2.OpenApiConfigService, decorators: [{
@@ -1 +1 @@
1
- {"version":3,"file":"rxap-open-api-data-source.js","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":[],"mappings":";;;;;;;;;;;;;;;;;;SA6EgB,qBAAqB,CAAC,qBAAyD,EAAE,cAAsB,CAAC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D,iBAAiB,CA6G7B;2FA7GY,iBAAiB;kBAD7B,UAAU;;0BAWN,MAAM;2BAAC,UAAU;;0BAEjB,MAAM;2BAAC,oBAAoB;;0BAE3B,QAAQ;;0BACR,MAAM;2BAAC,sCAAsC;;0BAE7C,QAAQ;;0BACR,MAAM;2BAAC,wBAAwB;;0BAE/B,QAAQ;;0BACR,MAAM;2BAAC,8BAA8B;;;MCpG7B,uBAAuB;IAElC,YACgD,aAAmC,EAC7C,IAAgB;QADN,kBAAa,GAAb,aAAa,CAAsB;QAC7C,SAAI,GAAJ,IAAI,CAAY;KAClD;IAEG,IAAI,CAAC,YAAoB;QAE9B,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QAEhE,IAAI,SAAS,EAAE;YACb,OAAO,IAAI,iBAAiB,CAC1B,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,aAAa,EAClB;gBACE,EAAE,EAAE,YAAY;gBAChB,SAAS;aACV,CACF,CAAC;SACH;QAED,OAAO,IAAI,CAAC;KACb;;oHAvBU,uBAAuB,kBAGxB,oBAAoB,aACpB,UAAU;wHAJT,uBAAuB,cADV,MAAM;2FACnB,uBAAuB;kBADnC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;0BAI7B,MAAM;2BAAC,oBAAoB;;0BAC3B,MAAM;2BAAC,UAAU;;;MCXT,0BAA2B,SAAQ,gBAAgB;IAE9D,YAAY,OAAe,EAAE,IAAa,EAAE,KAAc;QACxD,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAC5B,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;KACvC;;;ACPH;;;;;;"}
1
+ {"version":3,"file":"rxap-open-api-data-source.js","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 DISABLE_SCHEMA_VALIDATION\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 protected readonly strict: boolean = false;\n protected readonly disableSchemaValidation: 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 @Optional()\n @Inject(DISABLE_SCHEMA_VALIDATION)\n disableSchemaValidation: 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 this.disableSchemaValidation = disableSchemaValidation || this.metadata.disableSchemaValidation || 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 if (!this.disableSchemaValidation) {\n this.validateParameters(this.operation, viewer.parameters, this.strict);\n }\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 if (!this.disableSchemaValidation) {\n this.validateParameters(this.operation, viewer.parameters, this.strict);\n }\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 => {\n if (!this.disableSchemaValidation) {\n this.validateParameters(this.operation, parameters, this.strict);\n }\n }),\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>) => {\n if (!this.disableSchemaValidation) {\n this.validateResponse(this.operation, response, this.strict);\n }\n }),\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":[],"mappings":";;;;;;;;;;;;;;;;;;SA8EgB,qBAAqB,CAAC,qBAAyD,EAAE,cAAsB,CAAC;IACtH,MAAM,QAAQ,GAAG,OAAO,qBAAqB,KAAK,QAAQ,GAAG,EAAE,EAAE,EAAE,qBAAqB,EAAE,WAAW,EAAE,GAAG,qBAAqB,CAAC;IAChI,OAAO,UAAS,MAAW;QACzB,cAAc,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;KAClC,CAAC;AACJ,CAAC;IAMY,iBAAiB,+BAAjB,iBACX,SAAQ,kBAA4B;IASpC,YAEI,IAAgB,EAED,oBAA0C,EAGzD,WAA6C,IAAI,EAGjD,WAAkD,IAAI,EAGxD,SAAyB,IAAI,EAG7B,0BAA0C,IAAI;QAE9C,KAAK,CAAC,IAAI,EAAE,QAAe,CAAC,CAAC;QAdZ,yBAAoB,GAApB,oBAAoB,CAAsB;QAP1C,WAAM,GAAY,KAAK,CAAC;QACxB,4BAAuB,GAAY,KAAK,CAAC;QAqB1D,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;QAED,IAAI,SAAS,CAAC,MAAM,KAAK,KAAK,E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IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QAEhE,IAAI,SAAS,EAAE;YACb,OAAO,IAAI,iBAAiB,CAC1B,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,aAAa,EAClB;gBACE,EAAE,EAAE,YAAY;gBAChB,SAAS;aACV,CACF,CAAC;SACH;QAED,OAAO,IAAI,CAAC;KACb;;qHAvBU,uBAAuB,kBAGxB,oBAAoB,aACpB,UAAU;yHAJT,uBAAuB,cADV,MAAM;4FACnB,uBAAuB;kBADnC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;0BAI7B,MAAM;2BAAC,oBAAoB;;0BAC3B,MAAM;2BAAC,UAAU;;;MCXT,0BAA2B,SAAQ,gBAAgB;IAE9D,YAAY,OAAe,EAAE,IAAa,EAAE,KAAc;QACxD,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAC5B,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;KACvC;;;ACPH;;;;;;"}
@@ -4,7 +4,7 @@ import * as i1 from '@angular/common/http';
4
4
  import { HttpEventType, HttpClient } from '@angular/common/http';
5
5
  import { __awaiter, __decorate, __metadata } from 'tslib';
6
6
  import * as i2 from '@rxap/open-api';
7
- import { OpenApiConfigService, DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA, RXAP_OPEN_API_STRICT_VALIDATOR, SchemaValidationMixin, RxapOpenApiError } from '@rxap/open-api';
7
+ import { OpenApiConfigService, DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA, RXAP_OPEN_API_STRICT_VALIDATOR, DISABLE_SCHEMA_VALIDATION, SchemaValidationMixin, RxapOpenApiError } from '@rxap/open-api';
8
8
  import { BaseHttpRemoteMethod } from '@rxap/remote-method/http';
9
9
  import { RxapRemoteMethod } from '@rxap/remote-method';
10
10
  import { joinPath } from '@rxap/utilities';
@@ -18,10 +18,11 @@ function RxapOpenApiRemoteMethod(operationId, serverIndex = 0) {
18
18
  };
19
19
  }
20
20
  let OpenApiRemoteMethod = class OpenApiRemoteMethod extends BaseHttpRemoteMethod {
21
- constructor(http, injector, openApiConfigService, metadata = null, strict = null) {
21
+ constructor(http, injector, openApiConfigService, metadata = null, strict = null, disableSchemaValidation = null) {
22
22
  var _a, _b;
23
23
  super(http, injector, metadata);
24
24
  this.strict = false;
25
+ this.disableSchemaValidation = false;
25
26
  let operation;
26
27
  if (!this.metadata.operation) {
27
28
  this.metadata.operation = operation = openApiConfigService.getOperation(this.metadata.id);
@@ -37,14 +38,17 @@ let OpenApiRemoteMethod = class OpenApiRemoteMethod extends BaseHttpRemoteMethod
37
38
  ignoreUndefined: (_b = this.metadata.ignoreUndefined) !== null && _b !== void 0 ? _b : true,
38
39
  });
39
40
  this.strict = strict || this.metadata.strict || false;
41
+ this.disableSchemaValidation = disableSchemaValidation || this.metadata.disableSchemaValidation || false;
40
42
  }
41
43
  get operation() {
42
44
  return this.metadata.operation;
43
45
  }
44
46
  _call(args = {}) {
45
47
  return __awaiter(this, void 0, void 0, function* () {
46
- this.validateParameters(this.operation, args.parameters, this.strict);
47
- this.validateRequestBody(this.operation, args.requestBody, this.strict);
48
+ if (!this.disableSchemaValidation) {
49
+ this.validateParameters(this.operation, args.parameters, this.strict);
50
+ this.validateRequestBody(this.operation, args.requestBody, this.strict);
51
+ }
48
52
  const response = yield this._callWithResponse(args);
49
53
  if (response.body) {
50
54
  return response.body;
@@ -72,29 +76,35 @@ let OpenApiRemoteMethod = class OpenApiRemoteMethod extends BaseHttpRemoteMethod
72
76
  // TODO : update to the new call method concept (the remove of the _call method concept)
73
77
  _callWithResponse(args = {}) {
74
78
  var _a;
75
- this.validateParameters(this.operation, args.parameters, this.strict);
76
- this.validateRequestBody(this.operation, args.requestBody, this.strict);
79
+ if (!this.disableSchemaValidation) {
80
+ this.validateParameters(this.operation, args.parameters, this.strict);
81
+ this.validateRequestBody(this.operation, args.requestBody, this.strict);
82
+ }
77
83
  return this.http.request(this.updateRequest(this.buildHttpOptions(this.operation, args.parameters, args.requestBody, this.metadata.ignoreUndefined))).pipe(retry((_a = this.metadata.retry) !== null && _a !== void 0 ? _a : 0), catchError((response) => {
78
84
  var _a;
79
85
  (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.forEach(interceptor => interceptor
80
86
  .next({ response, parameters: args.parameters, requestBody: args.requestBody }));
81
87
  return throwError(response);
82
- }), filter((event) => event.type === HttpEventType.Response), tap((response) => this.validateResponse(this.operation, response, this.strict)), tap((response) => {
88
+ }), filter((event) => event.type === HttpEventType.Response), tap((response) => {
89
+ if (this.disableSchemaValidation) {
90
+ this.validateResponse(this.operation, response, this.strict);
91
+ }
92
+ }), tap((response) => {
83
93
  var _a;
84
94
  (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.forEach(interceptor => interceptor
85
95
  .next({ response, parameters: args.parameters, requestBody: args.requestBody }));
86
96
  }), take(1), timeout(this.timeout)).toPromise();
87
97
  }
88
98
  };
89
- OpenApiRemoteMethod.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", 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: "12.0.1", ngImport: i0, type: OpenApiRemoteMethod });
99
+ OpenApiRemoteMethod.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", 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 }, { token: DISABLE_SCHEMA_VALIDATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
100
+ OpenApiRemoteMethod.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OpenApiRemoteMethod });
91
101
  OpenApiRemoteMethod = __decorate([
92
102
  Mixin(SchemaValidationMixin),
93
103
  __metadata("design:paramtypes", [HttpClient,
94
104
  Injector,
95
- OpenApiConfigService, Object, Object])
105
+ OpenApiConfigService, Object, Object, Object])
96
106
  ], OpenApiRemoteMethod);
97
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: OpenApiRemoteMethod, decorators: [{
107
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OpenApiRemoteMethod, decorators: [{
98
108
  type: Injectable
99
109
  }], ctorParameters: function () { return [{ type: i1.HttpClient, decorators: [{
100
110
  type: Inject,
@@ -115,6 +125,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
115
125
  }, {
116
126
  type: Inject,
117
127
  args: [RXAP_OPEN_API_STRICT_VALIDATOR]
128
+ }] }, { type: undefined, decorators: [{
129
+ type: Optional
130
+ }, {
131
+ type: Inject,
132
+ args: [DISABLE_SCHEMA_VALIDATION]
118
133
  }] }]; } });
119
134
 
120
135
  class OpenApiRemoteMethodLoader {
@@ -134,9 +149,9 @@ class OpenApiRemoteMethodLoader {
134
149
  return null;
135
150
  }
136
151
  }
137
- OpenApiRemoteMethodLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: OpenApiRemoteMethodLoader, deps: [{ token: OpenApiConfigService }, { token: HttpClient }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
138
- OpenApiRemoteMethodLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: OpenApiRemoteMethodLoader, providedIn: 'root' });
139
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: OpenApiRemoteMethodLoader, decorators: [{
152
+ OpenApiRemoteMethodLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OpenApiRemoteMethodLoader, deps: [{ token: OpenApiConfigService }, { token: HttpClient }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
153
+ OpenApiRemoteMethodLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OpenApiRemoteMethodLoader, providedIn: 'root' });
154
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OpenApiRemoteMethodLoader, decorators: [{
140
155
  type: Injectable,
141
156
  args: [{ providedIn: 'root' }]
142
157
  }], ctorParameters: function () { return [{ type: i2.OpenApiConfigService, decorators: [{
@@ -1 +1 @@
1
- {"version":3,"file":"rxap-open-api-remote-method.js","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,mBACX,SAAQ,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;aA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,YAAY,CAAC,CAAC;QAEhE,IAAI,SAAS,EAAE;YAEb,OAAO,IAAI,mBAAmB,CAC5B,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,aAAa,EAClB;gBACE,EAAE,EAAE,YAAY;gBAChB,SAAS;aACV,CACF,CAAC;SAEH;QAED,OAAO,IAAI,CAAC;KAEb;;sHA3BU,yBAAyB,kBAG1B,oBAAoB,aACpB,UAAU;0HAJT,yBAAyB,cADZ,MAAM;2FACnB,yBAAyB;kBADrC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;0BAI7B,MAAM;2BAAC,oBAAoB;;0BAC3B,MAAM;2BAAC,UAAU;;;MCZT,4BAA6B,SAAQ,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;;;;;;"}
1
+ {"version":3,"file":"rxap-open-api-remote-method.js","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 DISABLE_SCHEMA_VALIDATION\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 protected readonly disableSchemaValidation: 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 ) {\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 this.disableSchemaValidation = disableSchemaValidation || this.metadata.disableSchemaValidation || false;\n }\n\n protected async _call(args: OpenApiRemoteMethodParameter<Parameters, RequestBody> = {}): Promise<Response> {\n\n if (!this.disableSchemaValidation) {\n this.validateParameters(this.operation, args.parameters, this.strict);\n this.validateRequestBody(this.operation, args.requestBody, this.strict);\n }\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 if (!this.disableSchemaValidation) {\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 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>) => {\n if (this.disableSchemaValidation) {\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":";;;;;;;;;;;;;;SAqCgB,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,mBACX,SAAQ,oBAA0F;IASlG,YACsB,IAAgB,EAClB,QAAkB,EACN,oBAA0C,EAGtE,WAA+C,IAAI,EAGnD,SAA2D,IAAI,EAGjE,0BAA0C,IAAI;;QAE9C,KAA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B,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;KACzC;;;ACPH;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { __awaiter } from 'tslib';
2
2
  import * as i0 from '@angular/core';
3
3
  import { InjectionToken, Injectable, Optional, Inject, isDevMode } from '@angular/core';
4
- import { RxapError, coerceArray, IsRecord, isPromiseLike } from '@rxap/utilities';
4
+ import { RxapError, coerceArray, IsRecord, clone, isPromiseLike } from '@rxap/utilities';
5
5
  import * as Ajv from 'ajv-oai';
6
6
  import { HttpParams, HttpHeaders } from '@angular/common/http';
7
7
 
@@ -9,6 +9,7 @@ const RXAP_OPEN_API_CONFIG = new InjectionToken('rxap/open-api/config');
9
9
  const RXAP_OPEN_API_STRICT_VALIDATOR = new InjectionToken('rxap/open-api/strict-validator');
10
10
  const DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA = new InjectionToken('rxap/open-api/default-remote-method-meta-data');
11
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-shema-validation');
12
13
 
13
14
  class RxapOpenApiError extends RxapError {
14
15
  constructor(message, code, scope) {
@@ -36,7 +37,7 @@ class OpenApiConfigService {
36
37
  this.defaultServerIndex = OpenApiConfigService.DefaultServerIndex;
37
38
  config = config !== null && config !== void 0 ? config : OpenApiConfigService.Config;
38
39
  if (!config) {
39
- throw new Error('Could not load config');
40
+ throw new Error('Could not load open api config');
40
41
  }
41
42
  this.config = config;
42
43
  this._operations = OpenApiConfigService.LoadOperations(config);
@@ -141,9 +142,9 @@ class OpenApiConfigService {
141
142
  OpenApiConfigService.Config = null;
142
143
  OpenApiConfigService.DefaultServerIndex = 0;
143
144
  OpenApiConfigService._operations = null;
144
- OpenApiConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", 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: "12.0.1", ngImport: i0, type: OpenApiConfigService, providedIn: 'root' });
146
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: OpenApiConfigService, decorators: [{
145
+ OpenApiConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OpenApiConfigService, deps: [{ token: RXAP_OPEN_API_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
146
+ OpenApiConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OpenApiConfigService, providedIn: 'root' });
147
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OpenApiConfigService, decorators: [{
147
148
  type: Injectable,
148
149
  args: [{ providedIn: 'root' }]
149
150
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
@@ -387,7 +388,7 @@ class SchemaValidationMixin {
387
388
  validate(schema, value) {
388
389
  let result;
389
390
  try {
390
- result = new Ajv().validate(schema, value);
391
+ result = new Ajv().validate(schema, clone(value));
391
392
  }
392
393
  catch (e) {
393
394
  console.error(e.message);
@@ -405,5 +406,5 @@ SchemaValidationMixin.STRICT = false;
405
406
  * Generated bundle index. Do not edit.
406
407
  */
407
408
 
408
- 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 };
409
+ export { AssertOpenApiV3, DEFAULT_OPEN_API_DATA_SOURCE_META_DATA, DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA, DISABLE_SCHEMA_VALIDATION, IsOpenApiV3, IsReferenceObject, NotContainsReferenceObjects, OpenApiConfigService, RXAP_OPEN_API_CONFIG, RXAP_OPEN_API_STRICT_VALIDATOR, RxapOpenApiError, SchemaValidationMixin };
409
410
  //# sourceMappingURL=rxap-open-api.js.map