{"version":3,"file":"rxap-open-api-remote-method.mjs","sources":["../../../../../packages/angular/open-api/remote-method/src/lib/error.ts","../../../../../packages/angular/open-api/remote-method/src/lib/get-page-adapter.factory.ts","../../../../../packages/angular/open-api/remote-method/src/lib/open-api.remote-method.ts","../../../../../packages/angular/open-api/remote-method/src/lib/open-api-remote-method.loader.ts","../../../../../packages/angular/open-api/remote-method/src/index.ts","../../../../../packages/angular/open-api/remote-method/src/rxap-open-api-remote-method.ts"],"sourcesContent":["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","import { BaseRemoteMethod } from '@rxap/remote-method';\nimport { TableEvent } from '@rxap/data-source/table';\nimport { coerceString } from '@rxap/utilities';\nimport type { OpenApiRemoteMethod } from './open-api.remote-method';\nimport { PaginatorLike } from '@rxap/data-source/pagination';\n\nexport interface GetPageRemoteMethodParameters {\n  pageIndex: number;\n  pageSize: number;\n  sortBy?: string;\n  sortDirection?: 'desc' | 'asc' | undefined | '' | string;\n  filter: string[];\n}\n\nexport interface GetPageResponse<Data extends Record<string, any>> {\n  total: number;\n  rows: Data[];\n  [key: string]: any;\n}\n\nexport interface GetPageAdapterDefaultOptions {\n  sortBy?: string;\n  sortDirection?: 'asc' | 'desc' | string;\n}\n\nexport class GetPageAdapterRemoteMethod<Data extends Record<string, any>>\n  extends BaseRemoteMethod<Data[], TableEvent> {\n\n  constructor(\n    private readonly remoteMethod: OpenApiRemoteMethod<GetPageResponse<Data>, GetPageRemoteMethodParameters>,\n    private readonly paginator?: PaginatorLike,\n    private readonly options?: GetPageAdapterDefaultOptions,\n  ) {\n    super(null, remoteMethod.metadata);\n  }\n\n  public static BuildFilter(filterEvent?: string | Record<string, any> | null): string[] {\n    const filter: string[] = [];\n    if (filterEvent && typeof filterEvent !== 'string') {\n      for (const [ key, value ] of Object.entries(filterEvent)) {\n        if (value !== null && value !== undefined && `${ value }` !== '') {\n          const valueString = coerceString(value);\n          if (valueString) {\n            filter.push([ key, valueString ].join('|'));\n          }\n        }\n      }\n    }\n    return filter;\n  }\n\n  protected async _call(event: TableEvent): Promise<Data[]> {\n    const parameters: GetPageRemoteMethodParameters = {\n      pageIndex: event.page?.pageIndex ?? 0,\n      pageSize: event.page?.pageSize ?? 10,\n      sortBy: event.sort?.active ?? this.options?.sortBy ?? undefined,\n      // use the || operator to set the default sort direction if the sort direction is undefined or an empty string\n      sortDirection: event.sort?.direction ?? this.options?.sortDirection ?? undefined,\n      filter: GetPageAdapterRemoteMethod.BuildFilter(event.filter),\n      ...(event.parameters ?? {}),\n    };\n    const response = await this.remoteMethod.call({ parameters });\n\n    if (event.setTotalLength) {\n      event.setTotalLength(response.total);\n    }\n\n    if (this.paginator) {\n      this.paginator.length = response.total;\n    }\n\n    return response.rows;\n  }\n\n}\n\nexport function GetPageAdapterFactory(remoteMethod: OpenApiRemoteMethod, paginator?: PaginatorLike) {\n  return new GetPageAdapterRemoteMethod(remoteMethod, paginator);\n}\n\nexport function GetPageAdapterFactoryWithOptions(options: GetPageAdapterDefaultOptions = {}) {\n  return (remoteMethod: OpenApiRemoteMethod, paginator?: PaginatorLike) => {\n    return new GetPageAdapterRemoteMethod(remoteMethod, paginator, options);\n  };\n}\n","import { HttpClient, HttpErrorResponse, HttpEventType, HttpResponse } from '@angular/common/http';\nimport {\n  Inject,\n  Injectable,\n  Injector,\n  isDevMode,\n  Optional,\n} from '@angular/core';\nimport { Mixin } from '@rxap/mixin';\nimport {\n  DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA,\n  DISABLE_SCHEMA_VALIDATION,\n  DISABLE_VALIDATION,\n  OpenApiConfigService,\n  OpenApiHttpResponseError,\n  OpenApiMetaData,\n  OperationObjectWithMetadata,\n  RXAP_OPEN_API_STRICT_VALIDATOR,\n  SchemaValidationMixin,\n} from '@rxap/open-api';\nimport { RxapRemoteMethod } from '@rxap/remote-method';\nimport { BaseHttpRemoteMethod } from '@rxap/remote-method/http';\nimport { firstValueFrom } from 'rxjs';\nimport {\n  filter,\n  retry,\n  take,\n  tap,\n  timeout,\n} from 'rxjs/operators';\n\nexport interface OperationForMetadata {\n  operation: OperationObjectWithMetadata;\n  /**\n   * used to specify the target server for the reset api operation\n   */\n  serverId?: string;\n  /**\n   * the fallback id used if the operation does not have a operationId\n   */\n  fallbackId?: string;\n}\n\nexport interface OperationFromMetadataInline {\n  operationId: string;\n  operation: string;\n  /**\n   * used to specify the target server for the reset api operation\n   */\n  serverId?: string;\n}\n\nexport function IsOperationFromMetadataInline(metadata: OperationForMetadata | OperationFromMetadataInline): metadata is OperationFromMetadataInline {\n  return typeof metadata.operation === 'string';\n}\n\nexport function RxapOpenApiRemoteMethod(\n  operationOrId: string | OperationForMetadata | OperationFromMetadataInline,\n  serverIndex = 0,\n) {\n  return function (target: any) {\n    const id = typeof operationOrId === 'string' ?\n      operationOrId :\n      (IsOperationFromMetadataInline(operationOrId) ?\n        operationOrId.operationId :\n        operationOrId.operation.operationId ?? operationOrId.fallbackId);\n    if (!id) {\n      throw new Error('The operationId for the open api remote method is not defined');\n    }\n    const metadata: OpenApiRemoteMethodMetadata = {\n      id,\n      serverIndex,\n    };\n    if (typeof operationOrId !== 'string') {\n      metadata.operation = operationOrId.operation;\n      metadata.serverId = operationOrId.serverId;\n    }\n    RxapRemoteMethod(metadata)(target);\n  };\n}\n\nexport type OpenApiRemoteMethodMetadata = OpenApiMetaData\n\nexport interface OpenApiRemoteMethodParameter<Parameters extends Record<string, any> | void = any, RequestBody = any> {\n  parameters?: Parameters,\n  requestBody?: RequestBody\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface OpenApiRemoteMethod<Response = any, Parameters extends Record<string, any> | void = any, RequestBody = any>\n  extends SchemaValidationMixin<Response, Parameters, RequestBody> {\n}\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  protected readonly disableSchemaValidation: boolean = false;\n  protected readonly disableValidation: boolean = false;\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    @Optional()\n    @Inject(DISABLE_SCHEMA_VALIDATION)\n      disableSchemaValidation: boolean | null = null,\n    @Optional()\n    @Inject(DISABLE_VALIDATION)\n      disableValidation: boolean | null = null,\n  ) {\n    super(http, injector, metadata);\n    this.metadata['operation'] ??= openApiConfigService.getOperation(this.metadata.id);\n    if (typeof this.metadata['operation'] === 'string') {\n      try {\n        this.metadata['operation'] = JSON.parse(this.metadata['operation']);\n      } catch (e: any) {\n        throw new Error(`could not parse the remote method operation string into an object: ${ this.constructor.name }`);\n      }\n    }\n    const operation: OperationObjectWithMetadata & { serverId?: string } = this.metadata['operation'];\n    this.applyMetadata({\n      id: operation.operationId,\n      url: () => openApiConfigService.getBaseUrl(this.metadata['serverIndex'], this.metadata['serverId']) +\n        operation.path,\n      method: operation.method as any,\n      withCredentials: this.metadata.withCredentials ?? true,\n      ignoreUndefined: this.metadata['ignoreUndefined'] ?? true,\n    });\n    this.strict = strict || this.metadata['strict'] || false;\n    this.disableSchemaValidation = disableSchemaValidation || this.metadata['disableSchemaValidation'] || false;\n    this.disableValidation = disableValidation || this.metadata['disableValidation'] || false;\n  }\n\n  public get operation(): OperationObjectWithMetadata {\n    return this.metadata['operation'];\n  }\n\n  /**\n   * Instead of returning the response body the full response object is returned\n   */\n  public async callWithResponse(args: OpenApiRemoteMethodParameter<Parameters, RequestBody> = {}): Promise<HttpResponse<Response>> {\n    this.init();\n    this.executionsInProgress$.increase();\n    const result = await this._callWithResponse(args);\n    this.executionsInProgress$.decrease();\n    if (result.body) {\n      this.executed$.next(result.body);\n      this.executed(result.body);\n    }\n    return result;\n  }\n\n  // TODO : update to the new call method concept (the remove of the _call method concept)\n  public _callWithResponse(args: OpenApiRemoteMethodParameter<Parameters, RequestBody> = {}): Promise<HttpResponse<Response>> {\n\n    if (!this.disableValidation) {\n      this.validateParameters(this.operation, args.parameters, this.strict);\n      this.validateRequestBody(this.operation, args.requestBody, this.strict);\n    }\n\n    return firstValueFrom(this.http.request<Response>(this.updateRequest(this.buildHttpOptions(\n      this.operation,\n      args.parameters,\n      args.requestBody,\n      this.metadata['ignoreUndefined'],\n    ))).pipe(\n      retry(this.metadata.retry ?? 0),\n      tap({\n        error: (error) => {\n          if (error instanceof HttpErrorResponse) {\n            this.interceptors?.forEach(interceptor => interceptor\n              .next({\n                response: error,\n                parameters: args.parameters,\n                requestBody: args.requestBody,\n              }),\n            );\n          }\n        },\n      }),\n      filter((event: any) => event.type === HttpEventType.Response),\n      tap((response: HttpResponse<Response>) => {\n        if (!this.disableValidation) {\n          this.validateResponse(this.operation, response, this.strict);\n        }\n      }),\n      tap((response: HttpResponse<Response>) => {\n        this.interceptors?.forEach(interceptor => interceptor\n          .next({\n            response,\n            parameters: args.parameters,\n            requestBody: args.requestBody,\n          }),\n        );\n      }),\n      take(1),\n      timeout(this.timeout),\n    ));\n\n  }\n\n  protected async _call(args: OpenApiRemoteMethodParameter<Parameters, RequestBody> = {}): Promise<Response> {\n\n    if (!this.disableValidation) {\n      this.validateParameters(this.operation, args.parameters, this.strict);\n      this.validateRequestBody(this.operation, args.requestBody, this.strict);\n    }\n\n    let response: HttpResponse<Response>;\n\n    try {\n      response = await this._callWithResponse(args);\n    } catch (error: any) {\n      if (error instanceof HttpErrorResponse) {\n        throw new OpenApiHttpResponseError(\n          error,\n          this.metadata,\n        );\n      } else {\n        throw error;\n      }\n    }\n\n    if (response.body) {\n      return response.body;\n    }\n\n    if (isDevMode()) {\n      console.warn('The response body is empty!');\n    }\n    return null as any;\n  }\n\n}\n","import {\n  Inject,\n  Injectable,\n  Injector,\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\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","// region \nexport * from './lib/error';\nexport * from './lib/get-page-adapter.factory';\nexport * from './lib/open-api-remote-method.loader';\nexport * from './lib/open-api.remote-method';\n// endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAEM,MAAO,4BAA6B,SAAQ,gBAAgB,CAAA;AAEhE,IAAA,WAAA,CAAY,OAAe,EAAE,IAAa,EAAE,KAAc,EAAA;AACxD,QAAA,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC;AAC3B,QAAA,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC;;AAG1C;;ACgBK,MAAO,0BACX,SAAQ,gBAAoC,CAAA;AAE5C,IAAA,WAAA,CACmB,YAAuF,EACvF,SAAyB,EACzB,OAAsC,EAAA;AAEvD,QAAA,KAAK,CAAC,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC;QAJjB,IAAY,CAAA,YAA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