@explo-tech/fido-api 2.12.10 → 3.0.0-jordan-testing

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 (179) hide show
  1. package/index.ts +2802 -178
  2. package/package.json +9 -3
  3. package/core/ApiError.ts +0 -24
  4. package/core/ApiRequestOptions.ts +0 -16
  5. package/core/ApiResult.ts +0 -10
  6. package/core/CancelablePromise.ts +0 -130
  7. package/core/OpenAPI.ts +0 -31
  8. package/core/request.ts +0 -307
  9. package/models/AggregateProperty.ts +0 -15
  10. package/models/Aggregation.ts +0 -13
  11. package/models/AggregationOption.ts +0 -8
  12. package/models/And.ts +0 -11
  13. package/models/And1.ts +0 -11
  14. package/models/BigQuery.ts +0 -13
  15. package/models/BigQueryAuthentication.ts +0 -9
  16. package/models/BooleanPropertyValue.ts +0 -9
  17. package/models/Branch.ts +0 -9
  18. package/models/BranchResponse.ts +0 -12
  19. package/models/BranchResponseMetadata.ts +0 -8
  20. package/models/CacheTelemetry.ts +0 -10
  21. package/models/CalendarInterval.ts +0 -12
  22. package/models/CalendarIntervalGrouping.ts +0 -14
  23. package/models/Clickhouse.ts +0 -18
  24. package/models/ClickhouseConnectionType.ts +0 -8
  25. package/models/ClientError.ts +0 -9
  26. package/models/ColumnFormat.ts +0 -10
  27. package/models/Commit.ts +0 -11
  28. package/models/CommitResponse.ts +0 -10
  29. package/models/Computation.ts +0 -19
  30. package/models/ComputedView.ts +0 -20
  31. package/models/CreateCommitRequest.ts +0 -13
  32. package/models/CreateCommitResponse.ts +0 -11
  33. package/models/CreateViewChange.ts +0 -12
  34. package/models/CreateViewDiff.ts +0 -11
  35. package/models/DataPage.ts +0 -10
  36. package/models/DataRecord.ts +0 -10
  37. package/models/DataRequestParameters.ts +0 -11
  38. package/models/DataResponseMetadata.ts +0 -12
  39. package/models/DataSchema.ts +0 -10
  40. package/models/DataSource.ts +0 -14
  41. package/models/DataSourceConfiguration.ts +0 -17
  42. package/models/DataSourceError.ts +0 -14
  43. package/models/DataSourceRequest.ts +0 -10
  44. package/models/DataSourceResponse.ts +0 -13
  45. package/models/DatePart.ts +0 -10
  46. package/models/DatePartGrouping.ts +0 -14
  47. package/models/DatePropertyValue.ts +0 -9
  48. package/models/DateTimeColumnFormat.ts +0 -14
  49. package/models/DateTimeFormat.ts +0 -9
  50. package/models/DateTimePropertyValue.ts +0 -9
  51. package/models/DecimalColumnFormat.ts +0 -15
  52. package/models/DecimalIntervalGrouping.ts +0 -11
  53. package/models/DecimalPropertyValue.ts +0 -9
  54. package/models/DeleteViewChange.ts +0 -9
  55. package/models/DeleteViewDiff.ts +0 -11
  56. package/models/DiffBranchResponse.ts +0 -10
  57. package/models/DoublePropertyValue.ts +0 -9
  58. package/models/DurationColumnFormat.ts +0 -9
  59. package/models/EmailConfiguration.ts +0 -10
  60. package/models/Equal.ts +0 -12
  61. package/models/Equal1.ts +0 -13
  62. package/models/EvictionPolicy.ts +0 -9
  63. package/models/ExportColumnOptions.ts +0 -12
  64. package/models/ExportFormat.ts +0 -9
  65. package/models/ExportTargetConfiguration.ts +0 -13
  66. package/models/Filter.ts +0 -25
  67. package/models/FormulaProperty.ts +0 -10
  68. package/models/GreaterThan.ts +0 -12
  69. package/models/GreaterThan1.ts +0 -13
  70. package/models/GreaterThanOrEqual.ts +0 -12
  71. package/models/GreaterThanOrEqual1.ts +0 -13
  72. package/models/Grouping.ts +0 -15
  73. package/models/Having.ts +0 -25
  74. package/models/In.ts +0 -12
  75. package/models/In1.ts +0 -13
  76. package/models/IntegerIntervalGrouping.ts +0 -11
  77. package/models/IntegerPropertyValue.ts +0 -9
  78. package/models/JdbcAuthentication.ts +0 -8
  79. package/models/LateBoundEqual.ts +0 -10
  80. package/models/LateBoundEqual1.ts +0 -12
  81. package/models/LateBoundGreaterThan.ts +0 -10
  82. package/models/LateBoundGreaterThan1.ts +0 -12
  83. package/models/LateBoundGreaterThanOrEqual.ts +0 -10
  84. package/models/LateBoundGreaterThanOrEqual1.ts +0 -12
  85. package/models/LateBoundIn.ts +0 -10
  86. package/models/LateBoundIn1.ts +0 -12
  87. package/models/LateBoundLessThan.ts +0 -10
  88. package/models/LateBoundLessThan1.ts +0 -12
  89. package/models/LateBoundLessThanOrEqual.ts +0 -10
  90. package/models/LateBoundLessThanOrEqual1.ts +0 -12
  91. package/models/LateBoundStringContains.ts +0 -11
  92. package/models/LateBoundStringContains1.ts +0 -13
  93. package/models/LessThan.ts +0 -12
  94. package/models/LessThan1.ts +0 -13
  95. package/models/LessThanOrEqual.ts +0 -12
  96. package/models/LessThanOrEqual1.ts +0 -13
  97. package/models/ListBranchResponse.ts +0 -10
  98. package/models/ListNamespacesResponse.ts +0 -10
  99. package/models/ListVersionedViewsRequest.ts +0 -8
  100. package/models/ListViewsRequest.ts +0 -8
  101. package/models/ListViewsResponse.ts +0 -10
  102. package/models/MSS.ts +0 -16
  103. package/models/MergeBranchRequest.ts +0 -9
  104. package/models/MySql.ts +0 -16
  105. package/models/Namespace.ts +0 -10
  106. package/models/NamespaceRequest.ts +0 -10
  107. package/models/NamespaceResponse.ts +0 -14
  108. package/models/NamespaceResponseMetadata.ts +0 -12
  109. package/models/Not.ts +0 -11
  110. package/models/Not1.ts +0 -11
  111. package/models/Null.ts +0 -9
  112. package/models/Null1.ts +0 -11
  113. package/models/Or.ts +0 -11
  114. package/models/Or1.ts +0 -11
  115. package/models/PagingConfiguration.ts +0 -9
  116. package/models/PasswordAuthentication.ts +0 -10
  117. package/models/Postgres.ts +0 -16
  118. package/models/Property.ts +0 -12
  119. package/models/PropertySchema.ts +0 -13
  120. package/models/PropertyType.ts +0 -15
  121. package/models/PropertyValue.ts +0 -14
  122. package/models/PublicTunnel.ts +0 -8
  123. package/models/QueryExecutionError.ts +0 -13
  124. package/models/QueryExecutionResponse.ts +0 -14
  125. package/models/QueryExportEmailResponse.ts +0 -8
  126. package/models/QueryExportLinkResponse.ts +0 -9
  127. package/models/QueryExportResponse.ts +0 -9
  128. package/models/QueryPreviewRequest.ts +0 -14
  129. package/models/QueryTimeoutError.ts +0 -13
  130. package/models/Redshift.ts +0 -16
  131. package/models/RequestExecutionParameters.ts +0 -8
  132. package/models/RequestTelemetry.ts +0 -13
  133. package/models/SSHAuthentication.ts +0 -11
  134. package/models/SSHTunnel.ts +0 -15
  135. package/models/ScheduledEviction.ts +0 -9
  136. package/models/Snowflake.ts +0 -17
  137. package/models/SnowflakeAuthentication.ts +0 -8
  138. package/models/SnowflakePasswordAuthentication.ts +0 -9
  139. package/models/Sort.ts +0 -11
  140. package/models/SortDirection.ts +0 -8
  141. package/models/SourceProperty.ts +0 -10
  142. package/models/StringContains.ts +0 -13
  143. package/models/StringContains1.ts +0 -14
  144. package/models/StringPropertyValue.ts +0 -9
  145. package/models/TablePreviewRequest.ts +0 -11
  146. package/models/TableView.ts +0 -18
  147. package/models/Tenant.ts +0 -14
  148. package/models/TenantKey.ts +0 -10
  149. package/models/TenantPrivateKeyAuthentication.ts +0 -10
  150. package/models/TenantRequest.ts +0 -11
  151. package/models/TenantResponse.ts +0 -10
  152. package/models/TenantS3Configuration.ts +0 -11
  153. package/models/TestConnectionRequest.ts +0 -10
  154. package/models/TestConnectionResponse.ts +0 -8
  155. package/models/TtlEviction.ts +0 -9
  156. package/models/Tunnel.ts +0 -9
  157. package/models/UUID.ts +0 -5
  158. package/models/UnitOfMeasurement.ts +0 -7
  159. package/models/UpdateViewChange.ts +0 -11
  160. package/models/UpdateViewDiff.ts +0 -12
  161. package/models/ValueGrouping.ts +0 -10
  162. package/models/VendorPrivateKeyAuthentication.ts +0 -9
  163. package/models/View.ts +0 -17
  164. package/models/ViewChange.ts +0 -10
  165. package/models/ViewDiff.ts +0 -10
  166. package/models/ViewExportRequest.ts +0 -18
  167. package/models/ViewRequest.ts +0 -19
  168. package/models/ViewResponse.ts +0 -10
  169. package/models/ViewRunRequest.ts +0 -15
  170. package/services/BranchResourceService.ts +0 -112
  171. package/services/CommitResourceService.ts +0 -48
  172. package/services/DataSourceResourceService.ts +0 -146
  173. package/services/HealthResourceService.ts +0 -45
  174. package/services/ListViewsResourceService.ts +0 -73
  175. package/services/NamespaceResourceService.ts +0 -120
  176. package/services/QueryResourceService.ts +0 -207
  177. package/services/TenantResourceService.ts +0 -89
  178. package/services/TestConnectionResourceService.ts +0 -56
  179. package/services/ViewResourceService.ts +0 -130
package/package.json CHANGED
@@ -2,13 +2,19 @@
2
2
  "name": "@explo-tech/fido-api",
3
3
  "description": "Fido api",
4
4
  "homepage": "https://github.com/trust-kaz/fido",
5
- "version": "2.12.10",
5
+ "version": "3.0.0-jordan-testing",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/trust-kaz/fido"
9
9
  },
10
- "devDependencies":{"openapi-typescript-codegen":"^0.24.0"},
10
+ "devDependencies": {
11
+ "openapi-typescript-codegen": "^0.24.0"
12
+ },
11
13
  "publishConfig": {
12
14
  "registry": "https://registry.npmjs.org"
15
+ },
16
+ "dependencies": {
17
+ "@zodios/core": "^10.9.6",
18
+ "zod": "^3.23.8"
13
19
  }
14
- }
20
+ }
package/core/ApiError.ts DELETED
@@ -1,24 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- import type { ApiRequestOptions } from './ApiRequestOptions';
5
- import type { ApiResult } from './ApiResult';
6
-
7
- export class ApiError extends Error {
8
- public readonly url: string;
9
- public readonly status: number;
10
- public readonly statusText: string;
11
- public readonly body: any;
12
- public readonly request: ApiRequestOptions;
13
-
14
- constructor(request: ApiRequestOptions, response: ApiResult, message: string) {
15
- super(message);
16
-
17
- this.name = 'ApiError';
18
- this.url = response.url;
19
- this.status = response.status;
20
- this.statusText = response.statusText;
21
- this.body = response.body;
22
- this.request = request;
23
- }
24
- }
@@ -1,16 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- export type ApiRequestOptions = {
5
- readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
6
- readonly url: string;
7
- readonly path?: Record<string, any>;
8
- readonly cookies?: Record<string, any>;
9
- readonly headers?: Record<string, any>;
10
- readonly query?: Record<string, any>;
11
- readonly formData?: Record<string, any>;
12
- readonly body?: any;
13
- readonly mediaType?: string;
14
- readonly responseHeader?: string;
15
- readonly errors?: Record<number, string>;
16
- };
package/core/ApiResult.ts DELETED
@@ -1,10 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- export type ApiResult = {
5
- readonly url: string;
6
- readonly ok: boolean;
7
- readonly status: number;
8
- readonly statusText: string;
9
- readonly body: any;
10
- };
@@ -1,130 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- export class CancelError extends Error {
5
-
6
- constructor(message: string) {
7
- super(message);
8
- this.name = 'CancelError';
9
- }
10
-
11
- public get isCancelled(): boolean {
12
- return true;
13
- }
14
- }
15
-
16
- export interface OnCancel {
17
- readonly isResolved: boolean;
18
- readonly isRejected: boolean;
19
- readonly isCancelled: boolean;
20
-
21
- (cancelHandler: () => void): void;
22
- }
23
-
24
- export class CancelablePromise<T> implements Promise<T> {
25
- #isResolved: boolean;
26
- #isRejected: boolean;
27
- #isCancelled: boolean;
28
- readonly #cancelHandlers: (() => void)[];
29
- readonly #promise: Promise<T>;
30
- #resolve?: (value: T | PromiseLike<T>) => void;
31
- #reject?: (reason?: any) => void;
32
-
33
- constructor(
34
- executor: (
35
- resolve: (value: T | PromiseLike<T>) => void,
36
- reject: (reason?: any) => void,
37
- onCancel: OnCancel
38
- ) => void
39
- ) {
40
- this.#isResolved = false;
41
- this.#isRejected = false;
42
- this.#isCancelled = false;
43
- this.#cancelHandlers = [];
44
- this.#promise = new Promise<T>((resolve, reject) => {
45
- this.#resolve = resolve;
46
- this.#reject = reject;
47
-
48
- const onResolve = (value: T | PromiseLike<T>): void => {
49
- if (this.#isResolved || this.#isRejected || this.#isCancelled) {
50
- return;
51
- }
52
- this.#isResolved = true;
53
- this.#resolve?.(value);
54
- };
55
-
56
- const onReject = (reason?: any): void => {
57
- if (this.#isResolved || this.#isRejected || this.#isCancelled) {
58
- return;
59
- }
60
- this.#isRejected = true;
61
- this.#reject?.(reason);
62
- };
63
-
64
- const onCancel = (cancelHandler: () => void): void => {
65
- if (this.#isResolved || this.#isRejected || this.#isCancelled) {
66
- return;
67
- }
68
- this.#cancelHandlers.push(cancelHandler);
69
- };
70
-
71
- Object.defineProperty(onCancel, 'isResolved', {
72
- get: (): boolean => this.#isResolved,
73
- });
74
-
75
- Object.defineProperty(onCancel, 'isRejected', {
76
- get: (): boolean => this.#isRejected,
77
- });
78
-
79
- Object.defineProperty(onCancel, 'isCancelled', {
80
- get: (): boolean => this.#isCancelled,
81
- });
82
-
83
- return executor(onResolve, onReject, onCancel as OnCancel);
84
- });
85
- }
86
-
87
- get [Symbol.toStringTag]() {
88
- return "Cancellable Promise";
89
- }
90
-
91
- public then<TResult1 = T, TResult2 = never>(
92
- onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
93
- onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null
94
- ): Promise<TResult1 | TResult2> {
95
- return this.#promise.then(onFulfilled, onRejected);
96
- }
97
-
98
- public catch<TResult = never>(
99
- onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null
100
- ): Promise<T | TResult> {
101
- return this.#promise.catch(onRejected);
102
- }
103
-
104
- public finally(onFinally?: (() => void) | null): Promise<T> {
105
- return this.#promise.finally(onFinally);
106
- }
107
-
108
- public cancel(): void {
109
- if (this.#isResolved || this.#isRejected || this.#isCancelled) {
110
- return;
111
- }
112
- this.#isCancelled = true;
113
- if (this.#cancelHandlers.length) {
114
- try {
115
- for (const cancelHandler of this.#cancelHandlers) {
116
- cancelHandler();
117
- }
118
- } catch (error) {
119
- console.warn('Cancellation threw an error', error);
120
- return;
121
- }
122
- }
123
- this.#cancelHandlers.length = 0;
124
- this.#reject?.(new CancelError('Request aborted'));
125
- }
126
-
127
- public get isCancelled(): boolean {
128
- return this.#isCancelled;
129
- }
130
- }
package/core/OpenAPI.ts DELETED
@@ -1,31 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- import type { ApiRequestOptions } from './ApiRequestOptions';
5
-
6
- type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
7
- type Headers = Record<string, string>;
8
-
9
- export type OpenAPIConfig = {
10
- BASE: string;
11
- VERSION: string;
12
- WITH_CREDENTIALS: boolean;
13
- CREDENTIALS: 'include' | 'omit' | 'same-origin';
14
- TOKEN?: string | Resolver<string>;
15
- USERNAME?: string | Resolver<string>;
16
- PASSWORD?: string | Resolver<string>;
17
- HEADERS?: Headers | Resolver<Headers>;
18
- ENCODE_PATH?: (path: string) => string;
19
- };
20
-
21
- export const OpenAPI: OpenAPIConfig = {
22
- BASE: '',
23
- VERSION: '0.1',
24
- WITH_CREDENTIALS: false,
25
- CREDENTIALS: 'include',
26
- TOKEN: undefined,
27
- USERNAME: undefined,
28
- PASSWORD: undefined,
29
- HEADERS: undefined,
30
- ENCODE_PATH: undefined,
31
- };
package/core/request.ts DELETED
@@ -1,307 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- import { ApiError } from './ApiError';
5
- import type { ApiRequestOptions } from './ApiRequestOptions';
6
- import type { ApiResult } from './ApiResult';
7
- import { CancelablePromise } from './CancelablePromise';
8
- import type { OnCancel } from './CancelablePromise';
9
- import type { OpenAPIConfig } from './OpenAPI';
10
-
11
- const isDefined = <T>(value: T | null | undefined): value is Exclude<T, null | undefined> => {
12
- return value !== undefined && value !== null;
13
- };
14
-
15
- const isString = (value: any): value is string => {
16
- return typeof value === 'string';
17
- };
18
-
19
- const isStringWithValue = (value: any): value is string => {
20
- return isString(value) && value !== '';
21
- };
22
-
23
- const isBlob = (value: any): value is Blob => {
24
- return (
25
- typeof value === 'object' &&
26
- typeof value.type === 'string' &&
27
- typeof value.stream === 'function' &&
28
- typeof value.arrayBuffer === 'function' &&
29
- typeof value.constructor === 'function' &&
30
- typeof value.constructor.name === 'string' &&
31
- /^(Blob|File)$/.test(value.constructor.name) &&
32
- /^(Blob|File)$/.test(value[Symbol.toStringTag])
33
- );
34
- };
35
-
36
- const isFormData = (value: any): value is FormData => {
37
- return value instanceof FormData;
38
- };
39
-
40
- const base64 = (str: string): string => {
41
- try {
42
- return btoa(str);
43
- } catch (err) {
44
- // @ts-ignore
45
- return Buffer.from(str).toString('base64');
46
- }
47
- };
48
-
49
- const getQueryString = (params: Record<string, any>): string => {
50
- const qs: string[] = [];
51
-
52
- const append = (key: string, value: any) => {
53
- qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
54
- };
55
-
56
- const process = (key: string, value: any) => {
57
- if (isDefined(value)) {
58
- if (Array.isArray(value)) {
59
- value.forEach(v => {
60
- process(key, v);
61
- });
62
- } else if (typeof value === 'object') {
63
- Object.entries(value).forEach(([k, v]) => {
64
- process(`${key}[${k}]`, v);
65
- });
66
- } else {
67
- append(key, value);
68
- }
69
- }
70
- };
71
-
72
- Object.entries(params).forEach(([key, value]) => {
73
- process(key, value);
74
- });
75
-
76
- if (qs.length > 0) {
77
- return `?${qs.join('&')}`;
78
- }
79
-
80
- return '';
81
- };
82
-
83
- const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {
84
- const encoder = config.ENCODE_PATH || encodeURI;
85
-
86
- const path = options.url
87
- .replace('{api-version}', config.VERSION)
88
- .replace(/{(.*?)}/g, (substring: string, group: string) => {
89
- if (options.path?.hasOwnProperty(group)) {
90
- return encoder(String(options.path[group]));
91
- }
92
- return substring;
93
- });
94
-
95
- const url = `${config.BASE}${path}`;
96
- if (options.query) {
97
- return `${url}${getQueryString(options.query)}`;
98
- }
99
- return url;
100
- };
101
-
102
- const getFormData = (options: ApiRequestOptions): FormData | undefined => {
103
- if (options.formData) {
104
- const formData = new FormData();
105
-
106
- const process = (key: string, value: any) => {
107
- if (isString(value) || isBlob(value)) {
108
- formData.append(key, value);
109
- } else {
110
- formData.append(key, JSON.stringify(value));
111
- }
112
- };
113
-
114
- Object.entries(options.formData)
115
- .filter(([_, value]) => isDefined(value))
116
- .forEach(([key, value]) => {
117
- if (Array.isArray(value)) {
118
- value.forEach(v => process(key, v));
119
- } else {
120
- process(key, value);
121
- }
122
- });
123
-
124
- return formData;
125
- }
126
- return undefined;
127
- };
128
-
129
- type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
130
-
131
- const resolve = async <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>): Promise<T | undefined> => {
132
- if (typeof resolver === 'function') {
133
- return (resolver as Resolver<T>)(options);
134
- }
135
- return resolver;
136
- };
137
-
138
- const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise<Headers> => {
139
- const token = await resolve(options, config.TOKEN);
140
- const username = await resolve(options, config.USERNAME);
141
- const password = await resolve(options, config.PASSWORD);
142
- const additionalHeaders = await resolve(options, config.HEADERS);
143
-
144
- const headers = Object.entries({
145
- Accept: 'application/json',
146
- ...additionalHeaders,
147
- ...options.headers,
148
- })
149
- .filter(([_, value]) => isDefined(value))
150
- .reduce((headers, [key, value]) => ({
151
- ...headers,
152
- [key]: String(value),
153
- }), {} as Record<string, string>);
154
-
155
- if (isStringWithValue(token)) {
156
- headers['Authorization'] = `Bearer ${token}`;
157
- }
158
-
159
- if (isStringWithValue(username) && isStringWithValue(password)) {
160
- const credentials = base64(`${username}:${password}`);
161
- headers['Authorization'] = `Basic ${credentials}`;
162
- }
163
-
164
- if (options.body) {
165
- if (options.mediaType) {
166
- headers['Content-Type'] = options.mediaType;
167
- } else if (isBlob(options.body)) {
168
- headers['Content-Type'] = options.body.type || 'application/octet-stream';
169
- } else if (isString(options.body)) {
170
- headers['Content-Type'] = 'text/plain';
171
- } else if (!isFormData(options.body)) {
172
- headers['Content-Type'] = 'application/json';
173
- }
174
- }
175
-
176
- return new Headers(headers);
177
- };
178
-
179
- const getRequestBody = (options: ApiRequestOptions): any => {
180
- if (options.body !== undefined) {
181
- if (options.mediaType?.includes('/json')) {
182
- return JSON.stringify(options.body)
183
- } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
184
- return options.body;
185
- } else {
186
- return JSON.stringify(options.body);
187
- }
188
- }
189
- return undefined;
190
- };
191
-
192
- export const sendRequest = async (
193
- config: OpenAPIConfig,
194
- options: ApiRequestOptions,
195
- url: string,
196
- body: any,
197
- formData: FormData | undefined,
198
- headers: Headers,
199
- onCancel: OnCancel
200
- ): Promise<Response> => {
201
- const controller = new AbortController();
202
-
203
- const request: RequestInit = {
204
- headers,
205
- body: body ?? formData,
206
- method: options.method,
207
- signal: controller.signal,
208
- };
209
-
210
- if (config.WITH_CREDENTIALS) {
211
- request.credentials = config.CREDENTIALS;
212
- }
213
-
214
- onCancel(() => controller.abort());
215
-
216
- return await fetch(url, request);
217
- };
218
-
219
- const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => {
220
- if (responseHeader) {
221
- const content = response.headers.get(responseHeader);
222
- if (isString(content)) {
223
- return content;
224
- }
225
- }
226
- return undefined;
227
- };
228
-
229
- const getResponseBody = async (response: Response): Promise<any> => {
230
- if (response.status !== 204) {
231
- try {
232
- const contentType = response.headers.get('Content-Type');
233
- if (contentType) {
234
- const jsonTypes = ['application/json', 'application/problem+json']
235
- const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type));
236
- if (isJSON) {
237
- return await response.json();
238
- } else {
239
- return await response.text();
240
- }
241
- }
242
- } catch (error) {
243
- console.error(error);
244
- }
245
- }
246
- return undefined;
247
- };
248
-
249
- const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => {
250
- const errors: Record<number, string> = {
251
- 400: 'Bad Request',
252
- 401: 'Unauthorized',
253
- 403: 'Forbidden',
254
- 404: 'Not Found',
255
- 500: 'Internal Server Error',
256
- 502: 'Bad Gateway',
257
- 503: 'Service Unavailable',
258
- ...options.errors,
259
- }
260
-
261
- const error = errors[result.status];
262
- if (error) {
263
- throw new ApiError(options, result, error);
264
- }
265
-
266
- if (!result.ok) {
267
- throw new ApiError(options, result, 'Generic Error');
268
- }
269
- };
270
-
271
- /**
272
- * Request method
273
- * @param config The OpenAPI configuration object
274
- * @param options The request options from the service
275
- * @returns CancelablePromise<T>
276
- * @throws ApiError
277
- */
278
- export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise<T> => {
279
- return new CancelablePromise(async (resolve, reject, onCancel) => {
280
- try {
281
- const url = getUrl(config, options);
282
- const formData = getFormData(options);
283
- const body = getRequestBody(options);
284
- const headers = await getHeaders(config, options);
285
-
286
- if (!onCancel.isCancelled) {
287
- const response = await sendRequest(config, options, url, body, formData, headers, onCancel);
288
- const responseBody = await getResponseBody(response);
289
- const responseHeader = getResponseHeader(response, options.responseHeader);
290
-
291
- const result: ApiResult = {
292
- url,
293
- ok: response.ok,
294
- status: response.status,
295
- statusText: response.statusText,
296
- body: responseHeader ?? responseBody,
297
- };
298
-
299
- catchErrorCodes(options, result);
300
-
301
- resolve(result.body);
302
- }
303
- } catch (error) {
304
- reject(error);
305
- }
306
- });
307
- };
@@ -1,15 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
-
5
- import type { Aggregation } from './Aggregation';
6
- import type { AggregationOption } from './AggregationOption';
7
-
8
- export type AggregateProperty = {
9
- targetPropertyId: string | null;
10
- '@type': 'aggregate';
11
- propertyId: string | null;
12
- aggregation: Aggregation;
13
- aggregationOption?: AggregationOption | null;
14
- };
15
-
@@ -1,13 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
-
5
- export enum Aggregation {
6
- AVG = 'avg',
7
- COUNT = 'count',
8
- COUNT_DISTINCT = 'count-distinct',
9
- MAX = 'max',
10
- MIN = 'min',
11
- PERCENTILE = 'percentile',
12
- SUM = 'sum',
13
- }
@@ -1,8 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
-
5
- export type AggregationOption = {
6
- decimalValue: number;
7
- };
8
-
package/models/And.ts DELETED
@@ -1,11 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
-
5
- import type { Filter } from './Filter';
6
-
7
- export type And = {
8
- '@type': 'and';
9
- values: Array<Filter>;
10
- };
11
-
package/models/And1.ts DELETED
@@ -1,11 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
-
5
- import type { Having } from './Having';
6
-
7
- export type And1 = {
8
- '@type': 'and';
9
- values: Array<Having>;
10
- };
11
-
@@ -1,13 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
-
5
- import type { BigQueryAuthentication } from './BigQueryAuthentication';
6
- import type { Tunnel } from './Tunnel';
7
-
8
- export type BigQuery = {
9
- tunnel: Tunnel;
10
- '@type': 'bigquery';
11
- authentication: BigQueryAuthentication;
12
- };
13
-
@@ -1,9 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
-
5
- export type BigQueryAuthentication = {
6
- projectId?: string | null;
7
- jsonKeyFile?: string | null;
8
- };
9
-
@@ -1,9 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
-
5
- export type BooleanPropertyValue = {
6
- '@type': 'boolean';
7
- value: boolean;
8
- };
9
-
package/models/Branch.ts DELETED
@@ -1,9 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
-
5
- export type Branch = {
6
- name: string;
7
- headId: string;
8
- };
9
-
@@ -1,12 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
-
5
- import type { Branch } from './Branch';
6
- import type { BranchResponseMetadata } from './BranchResponseMetadata';
7
-
8
- export type BranchResponse = {
9
- branch: Branch;
10
- meta: BranchResponseMetadata | null;
11
- };
12
-
@@ -1,8 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
-
5
- export type BranchResponseMetadata = {
6
- originCommitId: string;
7
- };
8
-
@@ -1,10 +0,0 @@
1
- /* istanbul ignore file */
2
- /* tslint:disable */
3
- /* eslint-disable */
4
-
5
- export type CacheTelemetry = {
6
- cacheHit: boolean;
7
- recordedAt: string | null;
8
- ttl: string | null;
9
- };
10
-