grexx-api 1.0.2 → 12.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/core/OpenAPI.js +2 -2
- package/dist/generated/core/request.d.ts +1 -1
- package/dist/generated/models/AdditionalAggregateColumn.js +1 -1
- package/dist/generated/models/AdditionalDataHistoryColumn.js +1 -1
- package/dist/generated/models/AdditionalDerivedColumn.js +1 -1
- package/dist/generated/models/AdditionalExternalColumn.js +1 -1
- package/dist/generated/models/AdditionalGroupbyColumn.js +1 -1
- package/dist/generated/models/AdditionalMetaColumn.js +1 -1
- package/dist/generated/models/AdditionalTemplateColumn.js +1 -1
- package/dist/generated/models/BaseMessage.js +1 -1
- package/dist/generated/models/CatchPattern.js +1 -1
- package/dist/generated/models/ColumnIdentifier.js +1 -1
- package/dist/generated/models/ConditionOperatorType.js +1 -1
- package/dist/generated/models/FieldType.js +1 -1
- package/dist/generated/models/FormFieldConditionList.js +1 -1
- package/dist/generated/models/FormFieldSimpleCondition.js +1 -1
- package/dist/generated/models/InterfaceConditionListType.js +1 -1
- package/dist/generated/models/PrimitiveType.js +1 -1
- package/dist/generated/models/ReturnTypeFlags.js +1 -1
- package/dist/generated/models/SortConfigSearchCondition.js +1 -1
- package/dist/generated/models/SortConfigSearchList.js +1 -1
- package/dist/generated/models/SortConfigSort.js +1 -1
- package/dist/generated/services/CaseService.d.ts +6 -6
- package/dist/generated/services/CaseService.js +12 -12
- package/generate-spec.ts +17 -0
- package/{openapi.yaml → openapi-spec.yaml} +9 -9
- package/package.json +12 -8
- package/tsconfig.json +2 -1
- package/typedoc.json +19 -0
- package/.idea/grexx-api.iml +0 -12
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/openapitools.json +0 -7
- package/src/generated/core/ApiError.ts +0 -25
- package/src/generated/core/ApiRequestOptions.ts +0 -17
- package/src/generated/core/ApiResult.ts +0 -11
- package/src/generated/core/CancelablePromise.ts +0 -131
- package/src/generated/core/OpenAPI.ts +0 -32
- package/src/generated/core/request.ts +0 -322
- package/src/generated/index.ts +0 -73
- package/src/generated/models/AbstractCondition.ts +0 -11
- package/src/generated/models/AbstractReference.ts +0 -8
- package/src/generated/models/AbstractRule.ts +0 -19
- package/src/generated/models/Activity.ts +0 -7
- package/src/generated/models/AdditionalAggregateColumn.ts +0 -20
- package/src/generated/models/AdditionalDataHistoryColumn.ts +0 -17
- package/src/generated/models/AdditionalDerivedColumn.ts +0 -24
- package/src/generated/models/AdditionalExternalColumn.ts +0 -16
- package/src/generated/models/AdditionalGroupbyColumn.ts +0 -18
- package/src/generated/models/AdditionalMetaColumn.ts +0 -34
- package/src/generated/models/AdditionalTemplateColumn.ts +0 -22
- package/src/generated/models/AnalyseDependency.ts +0 -39
- package/src/generated/models/BaseMessage.ts +0 -26
- package/src/generated/models/CaseReference.ts +0 -8
- package/src/generated/models/CasetypeAttribute.ts +0 -7
- package/src/generated/models/CasetypeCss.ts +0 -10
- package/src/generated/models/CatchBlock.ts +0 -7
- package/src/generated/models/CatchPattern.ts +0 -7
- package/src/generated/models/ColumnId.ts +0 -5
- package/src/generated/models/ColumnIdentifier.ts +0 -10
- package/src/generated/models/ConditionList.ts +0 -7
- package/src/generated/models/ConditionOperatorType.ts +0 -26
- package/src/generated/models/CustomThrow.ts +0 -7
- package/src/generated/models/Dataset.ts +0 -7
- package/src/generated/models/DatasetColumn.ts +0 -7
- package/src/generated/models/DatasetCondition.ts +0 -7
- package/src/generated/models/DatasetResult.ts +0 -20
- package/src/generated/models/FieldType.ts +0 -16
- package/src/generated/models/FileUploadProfile.ts +0 -7
- package/src/generated/models/ForEach.ts +0 -7
- package/src/generated/models/FormAction.ts +0 -7
- package/src/generated/models/FormActionInlineJavascript.ts +0 -7
- package/src/generated/models/FormField.ts +0 -7
- package/src/generated/models/FormFieldConditionList.ts +0 -19
- package/src/generated/models/FormFieldNotCondition.ts +0 -12
- package/src/generated/models/FormFieldSimpleCondition.ts +0 -27
- package/src/generated/models/FormGroup.ts +0 -7
- package/src/generated/models/GrexxComplexDatatype.ts +0 -11
- package/src/generated/models/HasRoleCondition.ts +0 -7
- package/src/generated/models/IfThenElse.ts +0 -7
- package/src/generated/models/Instant.ts +0 -5
- package/src/generated/models/InterfaceConditionListType.ts +0 -8
- package/src/generated/models/MapStringObject.ts +0 -5
- package/src/generated/models/Mapping.ts +0 -7
- package/src/generated/models/NotCondition.ts +0 -7
- package/src/generated/models/ParallelBlock.ts +0 -7
- package/src/generated/models/Picklist.ts +0 -7
- package/src/generated/models/PrimitiveType.ts +0 -35
- package/src/generated/models/RequestContext.ts +0 -7
- package/src/generated/models/ReturnTypeFlags.ts +0 -19
- package/src/generated/models/RuleList.ts +0 -7
- package/src/generated/models/SimpleCondition.ts +0 -7
- package/src/generated/models/SortConfigSearchCondition.ts +0 -24
- package/src/generated/models/SortConfigSearchList.ts +0 -17
- package/src/generated/models/SortConfigSort.ts +0 -16
- package/src/generated/models/Trigger.ts +0 -7
- package/src/generated/models/TryBlock.ts +0 -7
- package/src/generated/models/UUID.ts +0 -5
- package/src/generated/models/UnversionedReference.ts +0 -8
- package/src/generated/models/VersionedReference.ts +0 -8
- package/src/generated/models/While.ts +0 -7
- package/src/generated/services/CaseService.ts +0 -800
- package/src/generated/services/PlatformService.ts +0 -26
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
export class CancelError extends Error {
|
|
6
|
-
|
|
7
|
-
constructor(message: string) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = 'CancelError';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
public get isCancelled(): boolean {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface OnCancel {
|
|
18
|
-
readonly isResolved: boolean;
|
|
19
|
-
readonly isRejected: boolean;
|
|
20
|
-
readonly isCancelled: boolean;
|
|
21
|
-
|
|
22
|
-
(cancelHandler: () => void): void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export class CancelablePromise<T> implements Promise<T> {
|
|
26
|
-
#isResolved: boolean;
|
|
27
|
-
#isRejected: boolean;
|
|
28
|
-
#isCancelled: boolean;
|
|
29
|
-
readonly #cancelHandlers: (() => void)[];
|
|
30
|
-
readonly #promise: Promise<T>;
|
|
31
|
-
#resolve?: (value: T | PromiseLike<T>) => void;
|
|
32
|
-
#reject?: (reason?: any) => void;
|
|
33
|
-
|
|
34
|
-
constructor(
|
|
35
|
-
executor: (
|
|
36
|
-
resolve: (value: T | PromiseLike<T>) => void,
|
|
37
|
-
reject: (reason?: any) => void,
|
|
38
|
-
onCancel: OnCancel
|
|
39
|
-
) => void
|
|
40
|
-
) {
|
|
41
|
-
this.#isResolved = false;
|
|
42
|
-
this.#isRejected = false;
|
|
43
|
-
this.#isCancelled = false;
|
|
44
|
-
this.#cancelHandlers = [];
|
|
45
|
-
this.#promise = new Promise<T>((resolve, reject) => {
|
|
46
|
-
this.#resolve = resolve;
|
|
47
|
-
this.#reject = reject;
|
|
48
|
-
|
|
49
|
-
const onResolve = (value: T | PromiseLike<T>): void => {
|
|
50
|
-
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
this.#isResolved = true;
|
|
54
|
-
if (this.#resolve) this.#resolve(value);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const onReject = (reason?: any): void => {
|
|
58
|
-
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
this.#isRejected = true;
|
|
62
|
-
if (this.#reject) this.#reject(reason);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const onCancel = (cancelHandler: () => void): void => {
|
|
66
|
-
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
this.#cancelHandlers.push(cancelHandler);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
Object.defineProperty(onCancel, 'isResolved', {
|
|
73
|
-
get: (): boolean => this.#isResolved,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
Object.defineProperty(onCancel, 'isRejected', {
|
|
77
|
-
get: (): boolean => this.#isRejected,
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
Object.defineProperty(onCancel, 'isCancelled', {
|
|
81
|
-
get: (): boolean => this.#isCancelled,
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
return executor(onResolve, onReject, onCancel as OnCancel);
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
get [Symbol.toStringTag]() {
|
|
89
|
-
return "Cancellable Promise";
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
public then<TResult1 = T, TResult2 = never>(
|
|
93
|
-
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
|
|
94
|
-
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null
|
|
95
|
-
): Promise<TResult1 | TResult2> {
|
|
96
|
-
return this.#promise.then(onFulfilled, onRejected);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
public catch<TResult = never>(
|
|
100
|
-
onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null
|
|
101
|
-
): Promise<T | TResult> {
|
|
102
|
-
return this.#promise.catch(onRejected);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
public finally(onFinally?: (() => void) | null): Promise<T> {
|
|
106
|
-
return this.#promise.finally(onFinally);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
public cancel(): void {
|
|
110
|
-
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
this.#isCancelled = true;
|
|
114
|
-
if (this.#cancelHandlers.length) {
|
|
115
|
-
try {
|
|
116
|
-
for (const cancelHandler of this.#cancelHandlers) {
|
|
117
|
-
cancelHandler();
|
|
118
|
-
}
|
|
119
|
-
} catch (error) {
|
|
120
|
-
console.warn('Cancellation threw an error', error);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
this.#cancelHandlers.length = 0;
|
|
125
|
-
if (this.#reject) this.#reject(new CancelError('Request aborted'));
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
public get isCancelled(): boolean {
|
|
129
|
-
return this.#isCancelled;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
6
|
-
|
|
7
|
-
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
8
|
-
type Headers = Record<string, string>;
|
|
9
|
-
|
|
10
|
-
export type OpenAPIConfig = {
|
|
11
|
-
BASE: string;
|
|
12
|
-
VERSION: string;
|
|
13
|
-
WITH_CREDENTIALS: boolean;
|
|
14
|
-
CREDENTIALS: 'include' | 'omit' | 'same-origin';
|
|
15
|
-
TOKEN?: string | Resolver<string> | undefined;
|
|
16
|
-
USERNAME?: string | Resolver<string> | undefined;
|
|
17
|
-
PASSWORD?: string | Resolver<string> | undefined;
|
|
18
|
-
HEADERS?: Headers | Resolver<Headers> | undefined;
|
|
19
|
-
ENCODE_PATH?: ((path: string) => string) | undefined;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const OpenAPI: OpenAPIConfig = {
|
|
23
|
-
BASE: 'https://daanpaardekooper-studio.local.grexx.io/api/v1',
|
|
24
|
-
VERSION: '12.6.1',
|
|
25
|
-
WITH_CREDENTIALS: false,
|
|
26
|
-
CREDENTIALS: 'include',
|
|
27
|
-
TOKEN: undefined,
|
|
28
|
-
USERNAME: undefined,
|
|
29
|
-
PASSWORD: undefined,
|
|
30
|
-
HEADERS: undefined,
|
|
31
|
-
ENCODE_PATH: undefined,
|
|
32
|
-
};
|
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
import { ApiError } from './ApiError';
|
|
6
|
-
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
7
|
-
import type { ApiResult } from './ApiResult';
|
|
8
|
-
import { CancelablePromise } from './CancelablePromise';
|
|
9
|
-
import type { OnCancel } from './CancelablePromise';
|
|
10
|
-
import type { OpenAPIConfig } from './OpenAPI';
|
|
11
|
-
|
|
12
|
-
export const isDefined = <T>(value: T | null | undefined): value is Exclude<T, null | undefined> => {
|
|
13
|
-
return value !== undefined && value !== null;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const isString = (value: any): value is string => {
|
|
17
|
-
return typeof value === 'string';
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const isStringWithValue = (value: any): value is string => {
|
|
21
|
-
return isString(value) && value !== '';
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const isBlob = (value: any): value is Blob => {
|
|
25
|
-
return (
|
|
26
|
-
typeof value === 'object' &&
|
|
27
|
-
typeof value.type === 'string' &&
|
|
28
|
-
typeof value.stream === 'function' &&
|
|
29
|
-
typeof value.arrayBuffer === 'function' &&
|
|
30
|
-
typeof value.constructor === 'function' &&
|
|
31
|
-
typeof value.constructor.name === 'string' &&
|
|
32
|
-
/^(Blob|File)$/.test(value.constructor.name) &&
|
|
33
|
-
/^(Blob|File)$/.test(value[Symbol.toStringTag])
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const isFormData = (value: any): value is FormData => {
|
|
38
|
-
return value instanceof FormData;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const base64 = (str: string): string => {
|
|
42
|
-
try {
|
|
43
|
-
return btoa(str);
|
|
44
|
-
} catch (err) {
|
|
45
|
-
// @ts-ignore
|
|
46
|
-
return Buffer.from(str).toString('base64');
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const getQueryString = (params: Record<string, any>): string => {
|
|
51
|
-
const qs: string[] = [];
|
|
52
|
-
|
|
53
|
-
const append = (key: string, value: any) => {
|
|
54
|
-
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const process = (key: string, value: any) => {
|
|
58
|
-
if (isDefined(value)) {
|
|
59
|
-
if (Array.isArray(value)) {
|
|
60
|
-
value.forEach(v => {
|
|
61
|
-
process(key, v);
|
|
62
|
-
});
|
|
63
|
-
} else if (typeof value === 'object') {
|
|
64
|
-
Object.entries(value).forEach(([k, v]) => {
|
|
65
|
-
process(`${key}[${k}]`, v);
|
|
66
|
-
});
|
|
67
|
-
} else {
|
|
68
|
-
append(key, value);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
74
|
-
process(key, value);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
if (qs.length > 0) {
|
|
78
|
-
return `?${qs.join('&')}`;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return '';
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {
|
|
85
|
-
const encoder = config.ENCODE_PATH || encodeURI;
|
|
86
|
-
|
|
87
|
-
const path = options.url
|
|
88
|
-
.replace('{api-version}', config.VERSION)
|
|
89
|
-
.replace(/{(.*?)}/g, (substring: string, group: string) => {
|
|
90
|
-
if (options.path?.hasOwnProperty(group)) {
|
|
91
|
-
return encoder(String(options.path[group]));
|
|
92
|
-
}
|
|
93
|
-
return substring;
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
const url = `${config.BASE}${path}`;
|
|
97
|
-
if (options.query) {
|
|
98
|
-
return `${url}${getQueryString(options.query)}`;
|
|
99
|
-
}
|
|
100
|
-
return url;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export const getFormData = (options: ApiRequestOptions): FormData | undefined => {
|
|
104
|
-
if (options.formData) {
|
|
105
|
-
const formData = new FormData();
|
|
106
|
-
|
|
107
|
-
const process = (key: string, value: any) => {
|
|
108
|
-
if (isString(value) || isBlob(value)) {
|
|
109
|
-
formData.append(key, value);
|
|
110
|
-
} else {
|
|
111
|
-
formData.append(key, JSON.stringify(value));
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
Object.entries(options.formData)
|
|
116
|
-
.filter(([_, value]) => isDefined(value))
|
|
117
|
-
.forEach(([key, value]) => {
|
|
118
|
-
if (Array.isArray(value)) {
|
|
119
|
-
value.forEach(v => process(key, v));
|
|
120
|
-
} else {
|
|
121
|
-
process(key, value);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
return formData;
|
|
126
|
-
}
|
|
127
|
-
return undefined;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
131
|
-
|
|
132
|
-
export const resolve = async <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>): Promise<T | undefined> => {
|
|
133
|
-
if (typeof resolver === 'function') {
|
|
134
|
-
return (resolver as Resolver<T>)(options);
|
|
135
|
-
}
|
|
136
|
-
return resolver;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise<Headers> => {
|
|
140
|
-
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
141
|
-
resolve(options, config.TOKEN),
|
|
142
|
-
resolve(options, config.USERNAME),
|
|
143
|
-
resolve(options, config.PASSWORD),
|
|
144
|
-
resolve(options, config.HEADERS),
|
|
145
|
-
]);
|
|
146
|
-
|
|
147
|
-
const headers = Object.entries({
|
|
148
|
-
Accept: 'application/json',
|
|
149
|
-
...additionalHeaders,
|
|
150
|
-
...options.headers,
|
|
151
|
-
})
|
|
152
|
-
.filter(([_, value]) => isDefined(value))
|
|
153
|
-
.reduce((headers, [key, value]) => ({
|
|
154
|
-
...headers,
|
|
155
|
-
[key]: String(value),
|
|
156
|
-
}), {} as Record<string, string>);
|
|
157
|
-
|
|
158
|
-
if (isStringWithValue(token)) {
|
|
159
|
-
headers['Authorization'] = `Bearer ${token}`;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (isStringWithValue(username) && isStringWithValue(password)) {
|
|
163
|
-
const credentials = base64(`${username}:${password}`);
|
|
164
|
-
headers['Authorization'] = `Basic ${credentials}`;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (options.body !== undefined) {
|
|
168
|
-
if (options.mediaType) {
|
|
169
|
-
headers['Content-Type'] = options.mediaType;
|
|
170
|
-
} else if (isBlob(options.body)) {
|
|
171
|
-
headers['Content-Type'] = options.body.type || 'application/octet-stream';
|
|
172
|
-
} else if (isString(options.body)) {
|
|
173
|
-
headers['Content-Type'] = 'text/plain';
|
|
174
|
-
} else if (!isFormData(options.body)) {
|
|
175
|
-
headers['Content-Type'] = 'application/json';
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return new Headers(headers);
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
export const getRequestBody = (options: ApiRequestOptions): any => {
|
|
183
|
-
if (options.body !== undefined) {
|
|
184
|
-
if (options.mediaType?.includes('/json')) {
|
|
185
|
-
return JSON.stringify(options.body)
|
|
186
|
-
} else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
|
|
187
|
-
return options.body;
|
|
188
|
-
} else {
|
|
189
|
-
return JSON.stringify(options.body);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return undefined;
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
export const sendRequest = async (
|
|
196
|
-
config: OpenAPIConfig,
|
|
197
|
-
options: ApiRequestOptions,
|
|
198
|
-
url: string,
|
|
199
|
-
body: any,
|
|
200
|
-
formData: FormData | undefined,
|
|
201
|
-
headers: Headers,
|
|
202
|
-
onCancel: OnCancel
|
|
203
|
-
): Promise<Response> => {
|
|
204
|
-
const controller = new AbortController();
|
|
205
|
-
|
|
206
|
-
const request: RequestInit = {
|
|
207
|
-
headers,
|
|
208
|
-
body: body ?? formData,
|
|
209
|
-
method: options.method,
|
|
210
|
-
signal: controller.signal,
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
if (config.WITH_CREDENTIALS) {
|
|
214
|
-
request.credentials = config.CREDENTIALS;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
onCancel(() => controller.abort());
|
|
218
|
-
|
|
219
|
-
return await fetch(url, request);
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
export const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => {
|
|
223
|
-
if (responseHeader) {
|
|
224
|
-
const content = response.headers.get(responseHeader);
|
|
225
|
-
if (isString(content)) {
|
|
226
|
-
return content;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
return undefined;
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
export const getResponseBody = async (response: Response): Promise<any> => {
|
|
233
|
-
if (response.status !== 204) {
|
|
234
|
-
try {
|
|
235
|
-
const contentType = response.headers.get('Content-Type');
|
|
236
|
-
if (contentType) {
|
|
237
|
-
const jsonTypes = ['application/json', 'application/problem+json']
|
|
238
|
-
const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type));
|
|
239
|
-
if (isJSON) {
|
|
240
|
-
return await response.json();
|
|
241
|
-
} else {
|
|
242
|
-
return await response.text();
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
} catch (error) {
|
|
246
|
-
console.error(error);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
return undefined;
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => {
|
|
253
|
-
const errors: Record<number, string> = {
|
|
254
|
-
400: 'Bad Request',
|
|
255
|
-
401: 'Unauthorized',
|
|
256
|
-
403: 'Forbidden',
|
|
257
|
-
404: 'Not Found',
|
|
258
|
-
500: 'Internal Server Error',
|
|
259
|
-
502: 'Bad Gateway',
|
|
260
|
-
503: 'Service Unavailable',
|
|
261
|
-
...options.errors,
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
const error = errors[result.status];
|
|
265
|
-
if (error) {
|
|
266
|
-
throw new ApiError(options, result, error);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
if (!result.ok) {
|
|
270
|
-
const errorStatus = result.status ?? 'unknown';
|
|
271
|
-
const errorStatusText = result.statusText ?? 'unknown';
|
|
272
|
-
const errorBody = (() => {
|
|
273
|
-
try {
|
|
274
|
-
return JSON.stringify(result.body, null, 2);
|
|
275
|
-
} catch (e) {
|
|
276
|
-
return undefined;
|
|
277
|
-
}
|
|
278
|
-
})();
|
|
279
|
-
|
|
280
|
-
throw new ApiError(options, result,
|
|
281
|
-
`Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Request method
|
|
288
|
-
* @param config The OpenAPI configuration object
|
|
289
|
-
* @param options The request options from the service
|
|
290
|
-
* @returns CancelablePromise<T>
|
|
291
|
-
* @throws ApiError
|
|
292
|
-
*/
|
|
293
|
-
export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise<T> => {
|
|
294
|
-
return new CancelablePromise(async (resolve, reject, onCancel) => {
|
|
295
|
-
try {
|
|
296
|
-
const url = getUrl(config, options);
|
|
297
|
-
const formData = getFormData(options);
|
|
298
|
-
const body = getRequestBody(options);
|
|
299
|
-
const headers = await getHeaders(config, options);
|
|
300
|
-
|
|
301
|
-
if (!onCancel.isCancelled) {
|
|
302
|
-
const response = await sendRequest(config, options, url, body, formData, headers, onCancel);
|
|
303
|
-
const responseBody = await getResponseBody(response);
|
|
304
|
-
const responseHeader = getResponseHeader(response, options.responseHeader);
|
|
305
|
-
|
|
306
|
-
const result: ApiResult = {
|
|
307
|
-
url,
|
|
308
|
-
ok: response.ok,
|
|
309
|
-
status: response.status,
|
|
310
|
-
statusText: response.statusText,
|
|
311
|
-
body: responseHeader ?? responseBody,
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
catchErrorCodes(options, result);
|
|
315
|
-
|
|
316
|
-
resolve(result.body);
|
|
317
|
-
}
|
|
318
|
-
} catch (error) {
|
|
319
|
-
reject(error);
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
};
|
package/src/generated/index.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
export { ApiError } from './core/ApiError';
|
|
6
|
-
export { CancelablePromise, CancelError } from './core/CancelablePromise';
|
|
7
|
-
export { OpenAPI } from './core/OpenAPI';
|
|
8
|
-
export type { OpenAPIConfig } from './core/OpenAPI';
|
|
9
|
-
|
|
10
|
-
export type { AbstractCondition } from './models/AbstractCondition';
|
|
11
|
-
export type { AbstractReference } from './models/AbstractReference';
|
|
12
|
-
export type { AbstractRule } from './models/AbstractRule';
|
|
13
|
-
export type { Activity } from './models/Activity';
|
|
14
|
-
export { AdditionalAggregateColumn } from './models/AdditionalAggregateColumn';
|
|
15
|
-
export { AdditionalDataHistoryColumn } from './models/AdditionalDataHistoryColumn';
|
|
16
|
-
export { AdditionalDerivedColumn } from './models/AdditionalDerivedColumn';
|
|
17
|
-
export { AdditionalExternalColumn } from './models/AdditionalExternalColumn';
|
|
18
|
-
export { AdditionalGroupbyColumn } from './models/AdditionalGroupbyColumn';
|
|
19
|
-
export { AdditionalMetaColumn } from './models/AdditionalMetaColumn';
|
|
20
|
-
export { AdditionalTemplateColumn } from './models/AdditionalTemplateColumn';
|
|
21
|
-
export type { AnalyseDependency } from './models/AnalyseDependency';
|
|
22
|
-
export { BaseMessage } from './models/BaseMessage';
|
|
23
|
-
export type { CaseReference } from './models/CaseReference';
|
|
24
|
-
export type { CasetypeAttribute } from './models/CasetypeAttribute';
|
|
25
|
-
export type { CasetypeCss } from './models/CasetypeCss';
|
|
26
|
-
export type { CatchBlock } from './models/CatchBlock';
|
|
27
|
-
export { CatchPattern } from './models/CatchPattern';
|
|
28
|
-
export type { ColumnId } from './models/ColumnId';
|
|
29
|
-
export { ColumnIdentifier } from './models/ColumnIdentifier';
|
|
30
|
-
export type { ConditionList } from './models/ConditionList';
|
|
31
|
-
export { ConditionOperatorType } from './models/ConditionOperatorType';
|
|
32
|
-
export type { CustomThrow } from './models/CustomThrow';
|
|
33
|
-
export type { Dataset } from './models/Dataset';
|
|
34
|
-
export type { DatasetColumn } from './models/DatasetColumn';
|
|
35
|
-
export type { DatasetCondition } from './models/DatasetCondition';
|
|
36
|
-
export type { DatasetResult } from './models/DatasetResult';
|
|
37
|
-
export { FieldType } from './models/FieldType';
|
|
38
|
-
export type { FileUploadProfile } from './models/FileUploadProfile';
|
|
39
|
-
export type { ForEach } from './models/ForEach';
|
|
40
|
-
export type { FormAction } from './models/FormAction';
|
|
41
|
-
export type { FormActionInlineJavascript } from './models/FormActionInlineJavascript';
|
|
42
|
-
export type { FormField } from './models/FormField';
|
|
43
|
-
export { FormFieldConditionList } from './models/FormFieldConditionList';
|
|
44
|
-
export type { FormFieldNotCondition } from './models/FormFieldNotCondition';
|
|
45
|
-
export { FormFieldSimpleCondition } from './models/FormFieldSimpleCondition';
|
|
46
|
-
export type { FormGroup } from './models/FormGroup';
|
|
47
|
-
export type { GrexxComplexDatatype } from './models/GrexxComplexDatatype';
|
|
48
|
-
export type { HasRoleCondition } from './models/HasRoleCondition';
|
|
49
|
-
export type { IfThenElse } from './models/IfThenElse';
|
|
50
|
-
export type { Instant } from './models/Instant';
|
|
51
|
-
export { InterfaceConditionListType } from './models/InterfaceConditionListType';
|
|
52
|
-
export type { Mapping } from './models/Mapping';
|
|
53
|
-
export type { MapStringObject } from './models/MapStringObject';
|
|
54
|
-
export type { NotCondition } from './models/NotCondition';
|
|
55
|
-
export type { ParallelBlock } from './models/ParallelBlock';
|
|
56
|
-
export type { Picklist } from './models/Picklist';
|
|
57
|
-
export { PrimitiveType } from './models/PrimitiveType';
|
|
58
|
-
export type { RequestContext } from './models/RequestContext';
|
|
59
|
-
export { ReturnTypeFlags } from './models/ReturnTypeFlags';
|
|
60
|
-
export type { RuleList } from './models/RuleList';
|
|
61
|
-
export type { SimpleCondition } from './models/SimpleCondition';
|
|
62
|
-
export { SortConfigSearchCondition } from './models/SortConfigSearchCondition';
|
|
63
|
-
export { SortConfigSearchList } from './models/SortConfigSearchList';
|
|
64
|
-
export { SortConfigSort } from './models/SortConfigSort';
|
|
65
|
-
export type { Trigger } from './models/Trigger';
|
|
66
|
-
export type { TryBlock } from './models/TryBlock';
|
|
67
|
-
export type { UnversionedReference } from './models/UnversionedReference';
|
|
68
|
-
export type { UUID } from './models/UUID';
|
|
69
|
-
export type { VersionedReference } from './models/VersionedReference';
|
|
70
|
-
export type { While } from './models/While';
|
|
71
|
-
|
|
72
|
-
export { CaseService } from './services/CaseService';
|
|
73
|
-
export { PlatformService } from './services/PlatformService';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
import type { ConditionList } from './ConditionList';
|
|
6
|
-
import type { DatasetCondition } from './DatasetCondition';
|
|
7
|
-
import type { HasRoleCondition } from './HasRoleCondition';
|
|
8
|
-
import type { NotCondition } from './NotCondition';
|
|
9
|
-
import type { SimpleCondition } from './SimpleCondition';
|
|
10
|
-
export type AbstractCondition = (ConditionList | DatasetCondition | HasRoleCondition | NotCondition | SimpleCondition);
|
|
11
|
-
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
import type { CatchBlock } from './CatchBlock';
|
|
6
|
-
import type { CustomThrow } from './CustomThrow';
|
|
7
|
-
import type { ForEach } from './ForEach';
|
|
8
|
-
import type { FormAction } from './FormAction';
|
|
9
|
-
import type { FormActionInlineJavascript } from './FormActionInlineJavascript';
|
|
10
|
-
import type { IfThenElse } from './IfThenElse';
|
|
11
|
-
import type { Mapping } from './Mapping';
|
|
12
|
-
import type { ParallelBlock } from './ParallelBlock';
|
|
13
|
-
import type { RequestContext } from './RequestContext';
|
|
14
|
-
import type { RuleList } from './RuleList';
|
|
15
|
-
import type { Trigger } from './Trigger';
|
|
16
|
-
import type { TryBlock } from './TryBlock';
|
|
17
|
-
import type { While } from './While';
|
|
18
|
-
export type AbstractRule = (CatchBlock | CustomThrow | ForEach | FormAction | FormActionInlineJavascript | IfThenElse | Mapping | ParallelBlock | RequestContext | RuleList | Trigger | TryBlock | While);
|
|
19
|
-
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
import type { ColumnId } from './ColumnId';
|
|
6
|
-
export type AdditionalAggregateColumn = {
|
|
7
|
-
alias?: string;
|
|
8
|
-
allowHtmlAlways?: boolean;
|
|
9
|
-
datatype?: string;
|
|
10
|
-
externalReference?: string;
|
|
11
|
-
operator?: string;
|
|
12
|
-
parentColumn?: ColumnId;
|
|
13
|
-
type?: AdditionalAggregateColumn.type;
|
|
14
|
-
};
|
|
15
|
-
export namespace AdditionalAggregateColumn {
|
|
16
|
-
export enum type {
|
|
17
|
-
AGGREGATED = 'aggregated',
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
export type AdditionalDataHistoryColumn = {
|
|
6
|
-
alias?: string;
|
|
7
|
-
allowHtmlAlways?: boolean;
|
|
8
|
-
externalReference?: string;
|
|
9
|
-
metaname: string;
|
|
10
|
-
type?: AdditionalDataHistoryColumn.type;
|
|
11
|
-
};
|
|
12
|
-
export namespace AdditionalDataHistoryColumn {
|
|
13
|
-
export enum type {
|
|
14
|
-
DATA_HISTORY = 'dataHistory',
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
-
/* istanbul ignore file */
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
import type { AbstractReference } from './AbstractReference';
|
|
6
|
-
export type AdditionalDerivedColumn = {
|
|
7
|
-
alias?: string;
|
|
8
|
-
allowHtmlAlways?: boolean;
|
|
9
|
-
columnID: AbstractReference;
|
|
10
|
-
derivation: AdditionalDerivedColumn.derivation;
|
|
11
|
-
externalReference?: string;
|
|
12
|
-
type?: AdditionalDerivedColumn.type;
|
|
13
|
-
};
|
|
14
|
-
export namespace AdditionalDerivedColumn {
|
|
15
|
-
export enum derivation {
|
|
16
|
-
PICKLISTLABEL = 'PICKLISTLABEL',
|
|
17
|
-
FASTPICKLISTLABEL = 'FASTPICKLISTLABEL',
|
|
18
|
-
REFERENCE = 'REFERENCE',
|
|
19
|
-
}
|
|
20
|
-
export enum type {
|
|
21
|
-
DERIVED = 'derived',
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|