@nestjs-mod/webhook-afat
Version:
Webhook UI components and tools for AFAT (Angular, Formly, Antd, Transloco) and rest-sdk for work with backend of this module from Angular appliaction
1,175 lines (1,154 loc) • 126 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import * as i9$1 from '@angular/common';
import { AsyncPipe, CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { InjectionToken, Optional, Inject, Injectable, SkipSelf, NgModule, EventEmitter, Output, Input, ChangeDetectionStrategy, Component, ViewContainerRef } from '@angular/core';
import * as i13 from '@angular/forms';
import { UntypedFormGroup, FormsModule, ReactiveFormsModule, FormControl } from '@angular/forms';
import * as i3 from '@jsverse/transloco';
import { TranslocoService, TranslocoPipe, TranslocoDirective } from '@jsverse/transloco';
import * as i3$1 from '@nestjs-mod/afat';
import { ValidationService, getQueryMetaByParams, NzTableSortOrderDetectorPipe } from '@nestjs-mod/afat';
import { TIMEZONE_OFFSET, safeParseJson, compare, getQueryMeta } from '@nestjs-mod/misc';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import * as i7 from '@ngx-formly/core';
import { FormlyModule } from '@ngx-formly/core';
import { addHours, format } from 'date-fns';
import * as i10 from 'ng-zorro-antd/button';
import { NzButtonModule } from 'ng-zorro-antd/button';
import * as i9 from 'ng-zorro-antd/form';
import { NzFormModule } from 'ng-zorro-antd/form';
import * as i13$1 from 'ng-zorro-antd/input';
import { NzInputModule } from 'ng-zorro-antd/input';
import * as i2 from 'ng-zorro-antd/message';
import { NzMessageService } from 'ng-zorro-antd/message';
import * as i2$1 from 'ng-zorro-antd/modal';
import { NZ_MODAL_DATA, NzModalModule, NzModalService } from 'ng-zorro-antd/modal';
import { Observable, finalize, tap, map, BehaviorSubject, mergeMap, of, distinctUntilChanged, catchError, throwError, merge, debounceTime } from 'rxjs';
import * as i1 from '@angular/common/http';
import { HttpHeaders, HttpContext, HttpParams } from '@angular/common/http';
import * as i6 from 'ng-zorro-antd/grid';
import { NzGridModule } from 'ng-zorro-antd/grid';
import * as i11 from 'ng-zorro-antd/core/transition-patch';
import * as i12 from 'ng-zorro-antd/core/wave';
import { RouterModule } from '@angular/router';
import isEqual from 'lodash/fp/isEqual';
import omit from 'lodash/fp/omit';
import * as i8 from 'ng-zorro-antd/divider';
import { NzDividerModule } from 'ng-zorro-antd/divider';
import * as i14 from 'ng-zorro-antd/icon';
import { NzIconModule } from 'ng-zorro-antd/icon';
import { NzLayoutModule } from 'ng-zorro-antd/layout';
import { NzMenuModule } from 'ng-zorro-antd/menu';
import * as i7$1 from 'ng-zorro-antd/table';
import { NzTableModule } from 'ng-zorro-antd/table';
import { marker } from '@jsverse/transloco-keys-manager/marker';
import { TranslocoDatePipe } from '@jsverse/transloco-locale';
import * as i16 from 'ng-zorro-antd/select';
import { NzSelectModule } from 'ng-zorro-antd/select';
const BASE_PATH = new InjectionToken('basePath');
const COLLECTION_FORMATS = {
'csv': ',',
'tsv': ' ',
'ssv': ' ',
'pipes': '|'
};
class WebhookRestClientConfiguration {
/**
* @deprecated Since 5.0. Use credentials instead
*/
apiKeys;
username;
password;
/**
* @deprecated Since 5.0. Use credentials instead
*/
accessToken;
basePath;
withCredentials;
/**
* Takes care of encoding query- and form-parameters.
*/
encoder;
/**
* Encoding of various path parameter
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
* <p>
* See {@link README.md} for more details
* </p>
*/
encodeParam;
/**
* The keys are the names in the securitySchemes section of the OpenAPI
* document. They should map to the value used for authentication
* minus any standard prefixes such as 'Basic' or 'Bearer'.
*/
credentials;
constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials } = {}) {
if (apiKeys) {
this.apiKeys = apiKeys;
}
if (username !== undefined) {
this.username = username;
}
if (password !== undefined) {
this.password = password;
}
if (accessToken !== undefined) {
this.accessToken = accessToken;
}
if (basePath !== undefined) {
this.basePath = basePath;
}
if (withCredentials !== undefined) {
this.withCredentials = withCredentials;
}
if (encoder) {
this.encoder = encoder;
}
this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param));
this.credentials = credentials ?? {};
// init default bearer credential
if (!this.credentials['bearer']) {
this.credentials['bearer'] = () => {
return typeof this.accessToken === 'function'
? this.accessToken()
: this.accessToken;
};
}
}
/**
* Select the correct content-type to use for a request.
* Uses {@link WebhookRestClientConfiguration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param contentTypes - the array of content types that are available for selection
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
selectHeaderContentType(contentTypes) {
if (contentTypes.length === 0) {
return undefined;
}
const type = contentTypes.find((x) => this.isJsonMime(x));
if (type === undefined) {
return contentTypes[0];
}
return type;
}
/**
* Select the correct accept content-type to use for a request.
* Uses {@link WebhookRestClientConfiguration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param accepts - the array of content types that are available for selection.
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
selectHeaderAccept(accepts) {
if (accepts.length === 0) {
return undefined;
}
const type = accepts.find((x) => this.isJsonMime(x));
if (type === undefined) {
return accepts[0];
}
return type;
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
isJsonMime(mime) {
const jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
lookupCredential(key) {
const value = this.credentials[key];
return typeof value === 'function'
? value()
: value;
}
addCredentialToHeaders(credentialKey, headerName, headers, prefix) {
const value = this.lookupCredential(credentialKey);
return value
? headers.set(headerName, (prefix ?? '') + value)
: headers;
}
addCredentialToQuery(credentialKey, paramName, query) {
const value = this.lookupCredential(credentialKey);
return value
? query.set(paramName, value)
: query;
}
defaultEncodeParam(param) {
// This implementation exists as fallback for missing configuration
// and for backwards compatibility to older typescript-angular generator versions.
// It only works for the 'simple' parameter style.
// Date-handling only works for the 'date-time' format.
// All other styles and Date-formats are probably handled incorrectly.
//
// But: if that's all you need (i.e.: the most common use-case): no need for customization!
const value = param.dataFormat === 'date-time' && param.value instanceof Date
? param.value.toISOString()
: param.value;
return encodeURIComponent(String(value));
}
}
/**
* Custom HttpParameterCodec
* Workaround for https://github.com/angular/angular/issues/18261
*/
class CustomHttpParameterCodec {
encodeKey(k) {
return encodeURIComponent(k);
}
encodeValue(v) {
return encodeURIComponent(v);
}
decodeKey(k) {
return decodeURIComponent(k);
}
decodeValue(v) {
return decodeURIComponent(v);
}
}
/**
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
class BaseService {
basePath = 'http://localhost';
defaultHeaders = new HttpHeaders();
configuration;
encoder;
constructor(basePath, configuration) {
this.configuration = configuration || new WebhookRestClientConfiguration();
if (typeof this.configuration.basePath !== 'string') {
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
if (firstBasePath != undefined) {
basePath = firstBasePath;
}
if (typeof basePath !== 'string') {
basePath = this.basePath;
}
this.configuration.basePath = basePath;
}
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
}
canConsumeForm(consumes) {
return consumes.indexOf('multipart/form-data') !== -1;
}
addToHttpParams(httpParams, value, key) {
// If the value is an object (but not a Date), recursively add its keys.
if (typeof value === 'object' && !(value instanceof Date)) {
return this.addToHttpParamsRecursive(httpParams, value);
}
return this.addToHttpParamsRecursive(httpParams, value, key);
}
addToHttpParamsRecursive(httpParams, value, key) {
if (value === null || value === undefined) {
return httpParams;
}
if (typeof value === 'object') {
// If JSON format is preferred, key must be provided.
if (key != null) {
return httpParams.append(key, JSON.stringify(value));
}
// Otherwise, if it's an array, add each element.
if (Array.isArray(value)) {
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
}
else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key, value.toISOString());
}
else {
throw Error("key may not be null if value is Date");
}
}
else {
Object.keys(value).forEach(k => {
const paramKey = key ? `${key}.${k}` : k;
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
});
}
return httpParams;
}
else if (key != null) {
return httpParams.append(key, value);
}
throw Error("key may not be null if value is not object or array");
}
}
/**
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
class WebhookRestService extends BaseService {
httpClient;
constructor(httpClient, basePath, configuration) {
super(basePath, configuration);
this.httpClient = httpClient;
}
webhookControllerCreateOne(createWebhookDtoInterface, observe = 'body', reportProgress = false, options) {
if (createWebhookDtoInterface === null || createWebhookDtoInterface === undefined) {
throw new Error('Required parameter createWebhookDtoInterface was null or undefined when calling webhookControllerCreateOne.');
}
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext = options?.context ?? new HttpContext();
const localVarTransferCache = options?.transferCache ?? true;
// to determine the Content-Type header
const consumes = [
'application/json'
];
const httpContentTypeSelected = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
}
let responseType_ = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
}
else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/webhook`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request('post', `${basePath}${localVarPath}`, {
context: localVarHttpContext,
body: createWebhookDtoInterface,
responseType: responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
webhookControllerDeleteOne(id, observe = 'body', reportProgress = false, options) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling webhookControllerDeleteOne.');
}
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext = options?.context ?? new HttpContext();
const localVarTransferCache = options?.transferCache ?? true;
let responseType_ = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
}
else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/webhook/${this.configuration.encodeParam({ name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined })}`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request('delete', `${basePath}${localVarPath}`, {
context: localVarHttpContext,
responseType: responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
webhookControllerEvents(observe = 'body', reportProgress = false, options) {
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext = options?.context ?? new HttpContext();
const localVarTransferCache = options?.transferCache ?? true;
let responseType_ = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
}
else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/webhook/events`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request('get', `${basePath}${localVarPath}`, {
context: localVarHttpContext,
responseType: responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
webhookControllerFindMany(curPage, perPage, searchText, sort, tenantId, observe = 'body', reportProgress = false, options) {
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, curPage, 'curPage');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, perPage, 'perPage');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, searchText, 'searchText');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, sort, 'sort');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, tenantId, 'tenantId');
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext = options?.context ?? new HttpContext();
const localVarTransferCache = options?.transferCache ?? true;
let responseType_ = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
}
else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/webhook`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request('get', `${basePath}${localVarPath}`, {
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
webhookControllerFindOne(id, observe = 'body', reportProgress = false, options) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling webhookControllerFindOne.');
}
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext = options?.context ?? new HttpContext();
const localVarTransferCache = options?.transferCache ?? true;
let responseType_ = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
}
else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/webhook/${this.configuration.encodeParam({ name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined })}`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request('get', `${basePath}${localVarPath}`, {
context: localVarHttpContext,
responseType: responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
webhookControllerProfile(observe = 'body', reportProgress = false, options) {
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext = options?.context ?? new HttpContext();
const localVarTransferCache = options?.transferCache ?? true;
let responseType_ = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
}
else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/webhook/profile`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request('get', `${basePath}${localVarPath}`, {
context: localVarHttpContext,
responseType: responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
webhookControllerTestRequest(createWebhookDtoInterface, observe = 'body', reportProgress = false, options) {
if (createWebhookDtoInterface === null || createWebhookDtoInterface === undefined) {
throw new Error('Required parameter createWebhookDtoInterface was null or undefined when calling webhookControllerTestRequest.');
}
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext = options?.context ?? new HttpContext();
const localVarTransferCache = options?.transferCache ?? true;
// to determine the Content-Type header
const consumes = [
'application/json'
];
const httpContentTypeSelected = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
}
let responseType_ = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
}
else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/webhook/test-request`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request('post', `${basePath}${localVarPath}`, {
context: localVarHttpContext,
body: createWebhookDtoInterface,
responseType: responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
webhookControllerUpdateOne(id, updateWebhookDtoInterface, observe = 'body', reportProgress = false, options) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling webhookControllerUpdateOne.');
}
if (updateWebhookDtoInterface === null || updateWebhookDtoInterface === undefined) {
throw new Error('Required parameter updateWebhookDtoInterface was null or undefined when calling webhookControllerUpdateOne.');
}
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext = options?.context ?? new HttpContext();
const localVarTransferCache = options?.transferCache ?? true;
// to determine the Content-Type header
const consumes = [
'application/json'
];
const httpContentTypeSelected = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
}
let responseType_ = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
}
else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/webhook/${this.configuration.encodeParam({ name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined })}`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request('put', `${basePath}${localVarPath}`, {
context: localVarHttpContext,
body: updateWebhookDtoInterface,
responseType: responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
webhookLogsControllerDeleteOne(id, observe = 'body', reportProgress = false, options) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling webhookLogsControllerDeleteOne.');
}
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext = options?.context ?? new HttpContext();
const localVarTransferCache = options?.transferCache ?? true;
let responseType_ = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
}
else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/webhook/logs/${this.configuration.encodeParam({ name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined })}`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request('delete', `${basePath}${localVarPath}`, {
context: localVarHttpContext,
responseType: responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
webhookLogsControllerFindManyLogs(webhookId, curPage, perPage, searchText, sort, observe = 'body', reportProgress = false, options) {
if (webhookId === null || webhookId === undefined) {
throw new Error('Required parameter webhookId was null or undefined when calling webhookLogsControllerFindManyLogs.');
}
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, curPage, 'curPage');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, perPage, 'perPage');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, searchText, 'searchText');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, sort, 'sort');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, webhookId, 'webhookId');
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext = options?.context ?? new HttpContext();
const localVarTransferCache = options?.transferCache ?? true;
let responseType_ = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
}
else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/webhook/logs`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request('get', `${basePath}${localVarPath}`, {
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
webhookLogsControllerFindOne(id, observe = 'body', reportProgress = false, options) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling webhookLogsControllerFindOne.');
}
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext = options?.context ?? new HttpContext();
const localVarTransferCache = options?.transferCache ?? true;
let responseType_ = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
}
else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/webhook/logs/${this.configuration.encodeParam({ name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined })}`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request('get', `${basePath}${localVarPath}`, {
context: localVarHttpContext,
responseType: responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: WebhookRestService, deps: [{ token: i1.HttpClient }, { token: BASE_PATH, optional: true }, { token: WebhookRestClientConfiguration, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: WebhookRestService, providedIn: 'root' });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: WebhookRestService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root'
}]
}], ctorParameters: () => [{ type: i1.HttpClient }, { type: undefined, decorators: [{
type: Optional
}, {
type: Inject,
args: [BASE_PATH]
}] }, { type: WebhookRestClientConfiguration, decorators: [{
type: Optional
}] }] });
const APIS = [WebhookRestService];
/**
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
const WebhookErrorEnumInterface = {
WEBHOOK_000: 'WEBHOOK-000',
WEBHOOK_001: 'WEBHOOK-001',
WEBHOOK_002: 'WEBHOOK-002',
WEBHOOK_003: 'WEBHOOK-003',
WEBHOOK_004: 'WEBHOOK-004',
WEBHOOK_005: 'WEBHOOK-005'
};
/**
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
const WebhookLogScalarFieldEnumInterface = {
id: 'id',
request: 'request',
responseStatus: 'responseStatus',
response: 'response',
webhookStatus: 'webhookStatus',
webhookId: 'webhookId',
externalTenantId: 'externalTenantId',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
};
/**
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
const WebhookRoleInterface = {
Admin: 'Admin',
User: 'User'
};
/**
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
const WebhookScalarFieldEnumInterface = {
id: 'id',
eventName: 'eventName',
endpoint: 'endpoint',
enabled: 'enabled',
headers: 'headers',
requestTimeout: 'requestTimeout',
externalTenantId: 'externalTenantId',
createdBy: 'createdBy',
updatedBy: 'updatedBy',
createdAt: 'createdAt',
updatedAt: 'updatedAt',
workUntilDate: 'workUntilDate'
};
/**
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
const WebhookStatusInterface = {
Pending: 'Pending',
Process: 'Process',
Success: 'Success',
Error: 'Error',
Timeout: 'Timeout'
};
/**
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
const WebhookUserScalarFieldEnumInterface = {
id: 'id',
externalTenantId: 'externalTenantId',
externalUserId: 'externalUserId',
userRole: 'userRole',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
};
class WebhookRestClientApiModule {
static forRoot(configurationFactory) {
return {
ngModule: WebhookRestClientApiModule,
providers: [{ provide: WebhookRestClientConfiguration, useFactory: configurationFactory }]
};
}
constructor(parentModule, http) {
if (parentModule) {
throw new Error('WebhookRestClientApiModule is already loaded. Import in your base AppModule only.');
}
if (!http) {
throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
'See also https://github.com/angular/angular/issues/20575');
}
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: WebhookRestClientApiModule, deps: [{ token: WebhookRestClientApiModule, optional: true, skipSelf: true }, { token: i1.HttpClient, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: WebhookRestClientApiModule });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: WebhookRestClientApiModule });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: WebhookRestClientApiModule, decorators: [{
type: NgModule,
args: [{
imports: [],
declarations: [],
exports: [],
providers: []
}]
}], ctorParameters: () => [{ type: WebhookRestClientApiModule, decorators: [{
type: Optional
}, {
type: SkipSelf
}] }, { type: i1.HttpClient, decorators: [{
type: Optional
}] }] });
class WebhookRestSdkAngularService {
webhookRestClientConfiguration;
webhookRestService;
constructor(webhookRestClientConfiguration, webhookRestService) {
this.webhookRestClientConfiguration = webhookRestClientConfiguration;
this.webhookRestService = webhookRestService;
webhookRestService.configuration.withCredentials = true;
}
getWebhookApi() {
if (!this.webhookRestService) {
throw new Error('webhookApi not set');
}
return this.webhookRestService;
}
updateHeaders(headers) {
this.webhookRestService.defaultHeaders = new HttpHeaders(headers);
}
webSocket({ path, eventName, options, }) {
const wss = new WebSocket((this.webhookRestClientConfiguration.basePath || '')
.replace('/api', '')
.replace('http', 'ws') + path, options);
return new Observable((observer) => {
wss.addEventListener('open', () => {
wss.addEventListener('message', ({ data }) => {
observer.next(JSON.parse(data.toString()));
});
wss.addEventListener('error', (err) => {
observer.error(err);
if (wss?.readyState == WebSocket.OPEN) {
wss.close();
}
});
wss.send(JSON.stringify({
event: eventName,
data: true,
}));
});
}).pipe(finalize(() => {
if (wss?.readyState == WebSocket.OPEN) {
wss.close();
}
}));
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: WebhookRestSdkAngularService, deps: [{ token: WebhookRestClientConfiguration }, { token: WebhookRestService }], target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: WebhookRestSdkAngularService, providedIn: 'root' });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: WebhookRestSdkAngularService, decorators: [{
type: Injectable,
args: [{ providedIn: 'root' }]
}], ctorParameters: () => [{ type: WebhookRestClientConfiguration }, { type: WebhookRestService }] });
class WebhookRestSdkAngularModule {
static forRoot(configuration) {
const webhookRestClientConfiguration = new WebhookRestClientConfiguration(configuration);
const webhookRestClientApiModule = WebhookRestClientApiModule.forRoot(() => webhookRestClientConfiguration);
return {
ngModule: WebhookRestSdkAngularModule,
providers: [
{
provide: WebhookRestClientConfiguration,
useValue: webhookRestClientConfiguration,
},
],
imports: [webhookRestClientApiModule],
exports: [webhookRestClientApiModule, WebhookRestClientConfiguration],
};
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: WebhookRestSdkAngularModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: WebhookRestSdkAngularModule });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: WebhookRestSdkAngularModule });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: WebhookRestSdkAngularModule, decorators: [{
type: NgModule,
args: [{}]
}] });
class WebhookEventsService {
ssoRestSdkAngularService;
constructor(ssoRestSdkAngularService) {
this.ssoRestSdkAngularService = ssoRestSdkAngularService;
}
findMany() {
return this.ssoRestSdkAngularService.getWebhookApi().webhookControllerEvents();
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: WebhookEventsService, deps: [{ token: WebhookRestSdkAngularService }], target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: WebhookEventsService, providedIn: 'root' });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: WebhookEventsService, decorators: [{
type: Injectable,
args: [{ providedIn: 'root' }]
}], ctorParameters: () => [{ type: WebhookRestSdkAngularService }] });
let WebhookFormService = class WebhookFormService {
webhookEventsService;
translocoService;
validationService;
events = [];
constructor(webhookEventsService, translocoService, validationService) {
this.webhookEventsService = webhookEventsService;
this.translocoService = translocoService;
this.validationService = validationService;
}
init() {
return this.webhookEventsService.findMany().pipe(tap((events) => {
this.events = events;
}));
}
getFormlyFields(options) {
return this.validationService.appendServerErrorsAsValidatorsToFields([
{
key: WebhookScalarFieldEnumInterface.endpoint,
type: 'input',
validation: {
show: true,
},
props: {
label: this.translocoService.translate(`webhook.form.fields.endpoint`),
placeholder: 'endpoint',
required: true,
},
},
{
key: WebhookScalarFieldEnumInterface.eventName,
type: 'select',
validation: {
show: true,
},
props: {
label: this.translocoService.translate(`webhook.form.fields.event-name`),
placeholder: 'eventName',
required: true,
options: (this.events || []).map((e) => ({
value: e.eventName,
label: `${e.eventName} - ${e.description}`,
})),
change: (field, eventName) => {
const event = this.events.find((e) => e.eventName === eventName);
field.form?.get('example')?.setValue(JSON.stringify(event?.example, null, 4));
},
},
},
{
key: WebhookScalarFieldEnumInterface.headers,
type: 'textarea',
validation: {
show: true,
},
props: {
label: this.translocoService.translate(`webhook.form.fields.headers`),
placeholder: 'headers',
},
},
{
fieldGroupClassName: 'flex justify-between',
fieldGroup: [
{
fieldGroupClassName: 'flex-1',
key: WebhookScalarFieldEnumInterface.enabled,
type: 'checkbox',
validation: {
show: true,
},
props: {
label: this.translocoService.translate(`webhook.form.fields.enabled`),
placeholder: 'enabled',
required: true,
},
},
{
fieldGroupClassName: 'flex-1',
key: WebhookScalarFieldEnumInterface.requestTimeout,
type: 'input',
validation: {
show: true,
},
props: {
type: 'number',
label: this.translocoService.translate(`webhook.form.fields.request-timeout`),
placeholder: 'requestTimeout',
required: false,
},
},
{
fieldGroupClassName: 'flex-1',
key: WebhookScalarFieldEnumInterface.workUntilDate,
type: 'date-input',
validation: {
show: true,
},
props: {
type: 'datetime-local',
label: this.translocoService.translate(`webhook.form.fields.work-until-date`),
placeholder: 'workUntilDate',
required: false,
},
},
],
},
{
key: 'example',
type: 'textarea',
validation: {
show: true,
},
props: {
labe