Skip to content
Snippets Groups Projects
Verified Commit c74b5e8f authored by Daniel Göbel's avatar Daniel Göbel
Browse files

Update dependencies and service clients

#61
parent 81e52077
No related branches found
No related tags found
1 merge request!55Resolve "Support private Git Repositories"
Showing
with 1280 additions and 487 deletions
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-bs-theme="light">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
......
This diff is collapsed.
......@@ -8,53 +8,54 @@
"build-only": "vite build",
"type-check": "vue-tsc --noEmit",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"generate-s3-client": "openapi --input https://clowm-staging.bi.denbi.de/api/s3proxy-service/openapi.json --output src/client/s3proxy --client axios",
"generate-auth-client": "openapi --input https://clowm-staging.bi.denbi.de/api/auth-service/openapi.json --output src/client/auth --client axios",
"generate-workflow-client": "openapi --input https://clowm-staging.bi.denbi.de/api/workflow-service/openapi.json --output src/client/workflow --client axios"
"generate-s3-client": "openapi --input http://localhost:9999/api/s3proxy-service/openapi.json --output src/client/s3proxy --client axios",
"generate-auth-client": "openapi --input http://localhost:9999/api/auth-service/openapi.json --output src/client/auth --client axios",
"generate-workflow-client": "openapi --input http://localhost:9999/api/workflow-service/openapi.json --output src/client/workflow --client axios"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.379.1",
"@aws-sdk/lib-storage": "^3.379.1",
"@aws-sdk/s3-request-presigner": "^3.379.1",
"@fortawesome/fontawesome-free": "^6.4.0",
"@popperjs/core": "^2.11.8",
"ajv": "^8.12.0",
"bootstrap": "^5.2.3",
"chart.js": "^4.3.2",
"chartjs-plugin-zoom": "^2.0.1",
"dayjs": "^1.11.9",
"dompurify": "^3.0.5",
"filesize": "^10.0.8",
"pinia": "^2.1.6",
"semver": "^7.5.4",
"showdown": "^2.1.0",
"vue": "^3.3.4",
"vue-router": "^4.2.4",
"vue3-cookies": "^1.0.6"
"@fortawesome/fontawesome-free": "~6.4.0",
"@popperjs/core": "~2.11.8",
"ajv": "~8.12.0",
"bootstrap": "~5.3.1",
"chart.js": "~4.3.3",
"chartjs-plugin-zoom": "~2.0.1",
"dayjs": "~1.11.9",
"dompurify": "~3.0.5",
"filesize": "~10.0.12",
"pinia": "~2.1.6",
"semver": "~7.5.4",
"showdown": "~2.1.0",
"vue": "~3.3.4",
"vue-router": "~4.2.4",
"vue3-cookies": "~1.0.6"
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@rushstack/eslint-patch": "^1.2.0",
"@types/bootstrap": "^5.2.6",
"@types/dompurify": "^3.0.2",
"@types/node": "^16.11.45",
"@types/semver": "^7.5.0",
"@types/showdown": "^2.0.1",
"@vitejs/plugin-vue": "^4.2.3",
"@vue/eslint-config-prettier": "^7.1.0",
"@vue/eslint-config-typescript": "^11.0.2",
"@vue/tsconfig": "^0.1.3",
"axios": "^1.4.0",
"eslint": "^8.46.0",
"eslint-plugin-vue": "^9.16.1",
"npm-run-all": "^4.1.5",
"@esbuild-plugins/node-globals-polyfill": "~0.2.3",
"@esbuild-plugins/node-modules-polyfill": "~0.2.2",
"@rushstack/eslint-patch": "~1.2.0",
"@tsconfig/node16": "^16.1.1",
"@types/bootstrap": "~5.2.6",
"@types/dompurify": "~3.0.2",
"@types/node": "^16.18.48",
"@types/semver": "~7.5.1",
"@types/showdown": "~2.0.1",
"@vitejs/plugin-vue": "~4.3.4",
"@vue/eslint-config-prettier": "~8.0.0",
"@vue/eslint-config-typescript": "~11.0.3",
"@vue/tsconfig": "~0.4.0",
"axios": "~1.5.0",
"eslint": "~8.48.0",
"eslint-plugin-vue": "~9.17.0",
"npm-run-all": "~4.1.5",
"openapi-typescript-codegen": "^0.25.0",
"prettier": "^2.8.4",
"rollup-plugin-node-polyfills": "^0.2.1",
"sass": "^1.59.3",
"typescript": "~4.9.5",
"vite": "^4.2.3",
"vue-tsc": "^1.8.8"
"prettier": "~3.0.3",
"rollup-plugin-node-polyfills": "~0.2.1",
"sass": "~1.66.1",
"typescript": "~5.1.6",
"vite": "~4.4.9",
"vue-tsc": "~1.8.10"
}
}
......@@ -47,8 +47,6 @@
body {
min-height: 100vh;
color: var(--color-text);
background: var(--color-background);
transition: color 0.5s, background-color 0.5s;
line-height: 1.6;
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
......
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
......
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
......
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
......
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
......@@ -22,15 +23,13 @@ export interface OnCancel {
}
export class CancelablePromise<T> implements Promise<T> {
readonly [Symbol.toStringTag]!: string;
private _isResolved: boolean;
private _isRejected: boolean;
private _isCancelled: boolean;
private readonly _cancelHandlers: (() => void)[];
private readonly _promise: Promise<T>;
private _resolve?: (value: T | PromiseLike<T>) => void;
private _reject?: (reason?: any) => void;
#isResolved: boolean;
#isRejected: boolean;
#isCancelled: boolean;
readonly #cancelHandlers: (() => void)[];
readonly #promise: Promise<T>;
#resolve?: (value: T | PromiseLike<T>) => void;
#reject?: (reason?: any) => void;
constructor(
executor: (
......@@ -39,78 +38,82 @@ export class CancelablePromise<T> implements Promise<T> {
onCancel: OnCancel
) => void
) {
this._isResolved = false;
this._isRejected = false;
this._isCancelled = false;
this._cancelHandlers = [];
this._promise = new Promise<T>((resolve, reject) => {
this._resolve = resolve;
this._reject = reject;
this.#isResolved = false;
this.#isRejected = false;
this.#isCancelled = false;
this.#cancelHandlers = [];
this.#promise = new Promise<T>((resolve, reject) => {
this.#resolve = resolve;
this.#reject = reject;
const onResolve = (value: T | PromiseLike<T>): void => {
if (this._isResolved || this._isRejected || this._isCancelled) {
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
return;
}
this._isResolved = true;
this._resolve?.(value);
this.#isResolved = true;
this.#resolve?.(value);
};
const onReject = (reason?: any): void => {
if (this._isResolved || this._isRejected || this._isCancelled) {
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
return;
}
this._isRejected = true;
this._reject?.(reason);
this.#isRejected = true;
this.#reject?.(reason);
};
const onCancel = (cancelHandler: () => void): void => {
if (this._isResolved || this._isRejected || this._isCancelled) {
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
return;
}
this._cancelHandlers.push(cancelHandler);
this.#cancelHandlers.push(cancelHandler);
};
Object.defineProperty(onCancel, 'isResolved', {
get: (): boolean => this._isResolved,
get: (): boolean => this.#isResolved,
});
Object.defineProperty(onCancel, 'isRejected', {
get: (): boolean => this._isRejected,
get: (): boolean => this.#isRejected,
});
Object.defineProperty(onCancel, 'isCancelled', {
get: (): boolean => this._isCancelled,
get: (): boolean => this.#isCancelled,
});
return executor(onResolve, onReject, onCancel as OnCancel);
});
}
get [Symbol.toStringTag]() {
return "Cancellable Promise";
}
public then<TResult1 = T, TResult2 = never>(
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null
): Promise<TResult1 | TResult2> {
return this._promise.then(onFulfilled, onRejected);
return this.#promise.then(onFulfilled, onRejected);
}
public catch<TResult = never>(
onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null
): Promise<T | TResult> {
return this._promise.catch(onRejected);
return this.#promise.catch(onRejected);
}
public finally(onFinally?: (() => void) | null): Promise<T> {
return this._promise.finally(onFinally);
return this.#promise.finally(onFinally);
}
public cancel(): void {
if (this._isResolved || this._isRejected || this._isCancelled) {
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
return;
}
this._isCancelled = true;
if (this._cancelHandlers.length) {
this.#isCancelled = true;
if (this.#cancelHandlers.length) {
try {
for (const cancelHandler of this._cancelHandlers) {
for (const cancelHandler of this.#cancelHandlers) {
cancelHandler();
}
} catch (error) {
......@@ -118,11 +121,11 @@ export class CancelablePromise<T> implements Promise<T> {
return;
}
}
this._cancelHandlers.length = 0;
this._reject?.(new CancelError('Request aborted'));
this.#cancelHandlers.length = 0;
this.#reject?.(new CancelError('Request aborted'));
}
public get isCancelled(): boolean {
return this._isCancelled;
return this.#isCancelled;
}
}
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
......@@ -11,11 +12,11 @@ export type OpenAPIConfig = {
VERSION: string;
WITH_CREDENTIALS: boolean;
CREDENTIALS: 'include' | 'omit' | 'same-origin';
TOKEN?: string | Resolver<string>;
USERNAME?: string | Resolver<string>;
PASSWORD?: string | Resolver<string>;
HEADERS?: Headers | Resolver<Headers>;
ENCODE_PATH?: (path: string) => string;
TOKEN?: string | Resolver<string> | undefined;
USERNAME?: string | Resolver<string> | undefined;
PASSWORD?: string | Resolver<string> | undefined;
HEADERS?: Headers | Resolver<Headers> | undefined;
ENCODE_PATH?: ((path: string) => string) | undefined;
};
export const OpenAPI: OpenAPIConfig = {
......
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import axios from 'axios';
import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';
import type { AxiosError, AxiosRequestConfig, AxiosResponse, AxiosInstance } from 'axios';
import FormData from 'form-data';
import { ApiError } from './ApiError';
......@@ -12,19 +13,19 @@ import { CancelablePromise } from './CancelablePromise';
import type { OnCancel } from './CancelablePromise';
import type { OpenAPIConfig } from './OpenAPI';
const isDefined = <T>(value: T | null | undefined): value is Exclude<T, null | undefined> => {
export const isDefined = <T>(value: T | null | undefined): value is Exclude<T, null | undefined> => {
return value !== undefined && value !== null;
};
const isString = (value: any): value is string => {
export const isString = (value: any): value is string => {
return typeof value === 'string';
};
const isStringWithValue = (value: any): value is string => {
export const isStringWithValue = (value: any): value is string => {
return isString(value) && value !== '';
};
const isBlob = (value: any): value is Blob => {
export const isBlob = (value: any): value is Blob => {
return (
typeof value === 'object' &&
typeof value.type === 'string' &&
......@@ -37,15 +38,15 @@ const isBlob = (value: any): value is Blob => {
);
};
const isFormData = (value: any): value is FormData => {
export const isFormData = (value: any): value is FormData => {
return value instanceof FormData;
};
const isSuccess = (status: number): boolean => {
export const isSuccess = (status: number): boolean => {
return status >= 200 && status < 300;
};
const base64 = (str: string): string => {
export const base64 = (str: string): string => {
try {
return btoa(str);
} catch (err) {
......@@ -54,7 +55,7 @@ const base64 = (str: string): string => {
}
};
const getQueryString = (params: Record<string, any>): string => {
export const getQueryString = (params: Record<string, any>): string => {
const qs: string[] = [];
const append = (key: string, value: any) => {
......@@ -107,7 +108,7 @@ const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {
return url;
};
const getFormData = (options: ApiRequestOptions): FormData | undefined => {
export const getFormData = (options: ApiRequestOptions): FormData | undefined => {
if (options.formData) {
const formData = new FormData();
......@@ -136,14 +137,14 @@ const getFormData = (options: ApiRequestOptions): FormData | undefined => {
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
const resolve = async <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>): Promise<T | undefined> => {
export const resolve = async <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>): Promise<T | undefined> => {
if (typeof resolver === 'function') {
return (resolver as Resolver<T>)(options);
}
return resolver;
};
const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions, formData?: FormData): Promise<Record<string, string>> => {
export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions, formData?: FormData): Promise<Record<string, string>> => {
const token = await resolve(options, config.TOKEN);
const username = await resolve(options, config.USERNAME);
const password = await resolve(options, config.PASSWORD);
......@@ -186,21 +187,22 @@ const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions, for
return headers;
};
const getRequestBody = (options: ApiRequestOptions): any => {
export const getRequestBody = (options: ApiRequestOptions): any => {
if (options.body) {
return options.body;
}
return undefined;
};
const sendRequest = async <T>(
export const sendRequest = async <T>(
config: OpenAPIConfig,
options: ApiRequestOptions,
url: string,
body: any,
formData: FormData | undefined,
headers: Record<string, string>,
onCancel: OnCancel
onCancel: OnCancel,
axiosClient: AxiosInstance
): Promise<AxiosResponse<T>> => {
const source = axios.CancelToken.source();
......@@ -216,7 +218,7 @@ const sendRequest = async <T>(
onCancel(() => source.cancel('The user aborted a request.'));
try {
return await axios.request(requestConfig);
return await axiosClient.request(requestConfig);
} catch (error) {
const axiosError = error as AxiosError<T>;
if (axiosError.response) {
......@@ -226,7 +228,7 @@ const sendRequest = async <T>(
}
};
const getResponseHeader = (response: AxiosResponse<any>, responseHeader?: string): string | undefined => {
export const getResponseHeader = (response: AxiosResponse<any>, responseHeader?: string): string | undefined => {
if (responseHeader) {
const content = response.headers[responseHeader];
if (isString(content)) {
......@@ -236,14 +238,14 @@ const getResponseHeader = (response: AxiosResponse<any>, responseHeader?: string
return undefined;
};
const getResponseBody = (response: AxiosResponse<any>): any => {
export const getResponseBody = (response: AxiosResponse<any>): any => {
if (response.status !== 204) {
return response.data;
}
return undefined;
};
const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => {
export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => {
const errors: Record<number, string> = {
400: 'Bad Request',
401: 'Unauthorized',
......@@ -261,7 +263,19 @@ const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void =>
}
if (!result.ok) {
throw new ApiError(options, result, 'Generic Error');
const errorStatus = result.status ?? 'unknown';
const errorStatusText = result.statusText ?? 'unknown';
const errorBody = (() => {
try {
return JSON.stringify(result.body, null, 2);
} catch (e) {
return undefined;
}
})();
throw new ApiError(options, result,
`Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`
);
}
};
......@@ -269,10 +283,11 @@ const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void =>
* Request method
* @param config The OpenAPI configuration object
* @param options The request options from the service
* @param axiosClient The axios client instance to use
* @returns CancelablePromise<T>
* @throws ApiError
*/
export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise<T> => {
export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions, axiosClient: AxiosInstance = axios): CancelablePromise<T> => {
return new CancelablePromise(async (resolve, reject, onCancel) => {
try {
const url = getUrl(config, options);
......@@ -281,7 +296,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions): C
const headers = await getHeaders(config, options, formData);
if (!onCancel.isCancelled) {
const response = await sendRequest<T>(config, options, url, body, formData, headers, onCancel);
const response = await sendRequest<T>(config, options, url, body, formData, headers, onCancel, axiosClient);
const responseBody = getResponseBody(response);
const responseHeader = getResponseHeader(response, options.responseHeader);
......
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
......
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
/**
*
* Schema for a error due to a rejected request.
*
*/
export type ErrorDetail = {
/**
......
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
......
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
......
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
......@@ -5,7 +6,9 @@
import type { RoleEnum } from './RoleEnum';
/**
*
* Schema for a user.
*
*/
export type User = {
/**
......@@ -19,6 +22,6 @@ export type User = {
/**
* Roles of the user
*/
roles?: Array<RoleEnum>;
roles: (Array<RoleEnum> | null);
};
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
......
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
......
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
......@@ -34,15 +35,15 @@ export class UserService {
* Return the users that have a specific substring in their name.
* Permission 'user:read_any' required, except when 'name_substring' as only query parameter is set.
* Then permission 'user:search' required.
* @param nameSubstring Filter users by a substring in their name. Permission 'search_user' required
* @param nameSubstring Filter users by a substring in their name. Permission 'search' required
* @param filterRoles Filter users by their role. If multiple are selected, they are concatenating by an OR Expresssion. Permission 'read_any' required
* @param includeRoles Flag whether to include the roles of the users in the response. If True, permission 'read_any' required.
* @returns User Successful Response
* @throws ApiError
*/
public static userListUsers(
nameSubstring?: string,
filterRoles?: Array<RoleEnum>,
nameSubstring?: (string | null),
filterRoles?: (Array<RoleEnum> | null),
includeRoles: boolean = false,
): CancelablePromise<Array<User>> {
return __request(OpenAPI, {
......@@ -65,6 +66,7 @@ export class UserService {
/**
* Get a user by its uid
* Return the user with the specific uid. A user can only view himself.
* Permission 'user:read' required
* @param uid UID of a user
* @param includeRoles Flag whether to include the roles of the users in the response. If True, permission 'read_any' required.
* @returns User Successful Response
......
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
......
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment