From f088756236e745f3f41875aae8d700a87b5a86d9 Mon Sep 17 00:00:00 2001 From: Firas Shmit Date: Thu, 14 Nov 2024 15:37:46 +0100 Subject: [PATCH 01/26] EW-1060 added generate script for new common cartridge --- openapitools-for-common-cartridge.json | 9 +++++++++ package.json | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 openapitools-for-common-cartridge.json diff --git a/openapitools-for-common-cartridge.json b/openapitools-for-common-cartridge.json new file mode 100644 index 0000000000..3570d978fe --- /dev/null +++ b/openapitools-for-common-cartridge.json @@ -0,0 +1,9 @@ +{ + "apiPackage": "api", + "enumNameSuffix": "", + "enumPropertyNaming": "UPPERCASE", + "modelPackage": "models", + "supportsES6": true, + "withInterfaces": true, + "withSeparateModelsAndApi": true +} diff --git a/package.json b/package.json index 15abbe44ac..af526b9a97 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "lint:fix": "npx eslint 'src/**/*.{ts,js,vue}' --fix", "generate-client:server": "node generate-client.js -c openapitools-for-server.json", "generate-client:filestorage": "node generate-client.js -u 'http://localhost:4444/api/v3/docs-json/' -p 'src/fileStorageApi/v3' -c 'openapitools-for-file-storage.json'", - "generate-client:h5p-editor": "node generate-client.js -u 'http://localhost:4448/api/v3/docs-json/' -p 'src/h5pEditorApi/v3' -c 'openapitools-for-h5p-editor.json'" + "generate-client:h5p-editor": "node generate-client.js -u 'http://localhost:4448/api/v3/docs-json/' -p 'src/h5pEditorApi/v3' -c 'openapitools-for-h5p-editor.json'", + "generate-client:common-cartridge": "node generate-client.js -u 'http://localhost:3350/api/v3/docs-json/' -p 'src/commonCartridgeApi/v3' -c 'openapitools-for-common-cartridge.json'" }, "dependencies": { "@braintree/sanitize-url": "^6.0.4", From 76459a0af10dafced9a4d7b501f08702bb86c6a2 Mon Sep 17 00:00:00 2001 From: Maximilian Kreuzkam Date: Fri, 15 Nov 2024 09:14:02 +0100 Subject: [PATCH 02/26] EW-1060: Generate client. --- src/commonCartridgeApi/v3/.gitignore | 4 + src/commonCartridgeApi/v3/.npmignore | 1 + .../v3/.openapi-generator-ignore | 23 ++ .../v3/.openapi-generator/FILES | 12 + .../v3/.openapi-generator/VERSION | 1 + src/commonCartridgeApi/v3/api.ts | 18 ++ .../v3/api/common-cartridge-api.ts | 233 ++++++++++++++++++ src/commonCartridgeApi/v3/base.ts | 71 ++++++ src/commonCartridgeApi/v3/common.ts | 138 +++++++++++ src/commonCartridgeApi/v3/configuration.ts | 101 ++++++++ src/commonCartridgeApi/v3/git_push.sh | 58 +++++ src/commonCartridgeApi/v3/index.ts | 18 ++ .../v3/models/course-export-body-params.ts | 43 ++++ src/commonCartridgeApi/v3/models/index.ts | 1 + 14 files changed, 722 insertions(+) create mode 100644 src/commonCartridgeApi/v3/.gitignore create mode 100644 src/commonCartridgeApi/v3/.npmignore create mode 100644 src/commonCartridgeApi/v3/.openapi-generator-ignore create mode 100644 src/commonCartridgeApi/v3/.openapi-generator/FILES create mode 100644 src/commonCartridgeApi/v3/.openapi-generator/VERSION create mode 100644 src/commonCartridgeApi/v3/api.ts create mode 100644 src/commonCartridgeApi/v3/api/common-cartridge-api.ts create mode 100644 src/commonCartridgeApi/v3/base.ts create mode 100644 src/commonCartridgeApi/v3/common.ts create mode 100644 src/commonCartridgeApi/v3/configuration.ts create mode 100644 src/commonCartridgeApi/v3/git_push.sh create mode 100644 src/commonCartridgeApi/v3/index.ts create mode 100644 src/commonCartridgeApi/v3/models/course-export-body-params.ts create mode 100644 src/commonCartridgeApi/v3/models/index.ts diff --git a/src/commonCartridgeApi/v3/.gitignore b/src/commonCartridgeApi/v3/.gitignore new file mode 100644 index 0000000000..149b576547 --- /dev/null +++ b/src/commonCartridgeApi/v3/.gitignore @@ -0,0 +1,4 @@ +wwwroot/*.js +node_modules +typings +dist diff --git a/src/commonCartridgeApi/v3/.npmignore b/src/commonCartridgeApi/v3/.npmignore new file mode 100644 index 0000000000..999d88df69 --- /dev/null +++ b/src/commonCartridgeApi/v3/.npmignore @@ -0,0 +1 @@ +# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm \ No newline at end of file diff --git a/src/commonCartridgeApi/v3/.openapi-generator-ignore b/src/commonCartridgeApi/v3/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/src/commonCartridgeApi/v3/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/src/commonCartridgeApi/v3/.openapi-generator/FILES b/src/commonCartridgeApi/v3/.openapi-generator/FILES new file mode 100644 index 0000000000..b571336241 --- /dev/null +++ b/src/commonCartridgeApi/v3/.openapi-generator/FILES @@ -0,0 +1,12 @@ +.gitignore +.npmignore +.openapi-generator-ignore +api.ts +api/common-cartridge-api.ts +base.ts +common.ts +configuration.ts +git_push.sh +index.ts +models/course-export-body-params.ts +models/index.ts diff --git a/src/commonCartridgeApi/v3/.openapi-generator/VERSION b/src/commonCartridgeApi/v3/.openapi-generator/VERSION new file mode 100644 index 0000000000..acf69b48b8 --- /dev/null +++ b/src/commonCartridgeApi/v3/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.1.0 \ No newline at end of file diff --git a/src/commonCartridgeApi/v3/api.ts b/src/commonCartridgeApi/v3/api.ts new file mode 100644 index 0000000000..0edbcfe49a --- /dev/null +++ b/src/commonCartridgeApi/v3/api.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Schulcloud-Verbund-Software Server API + * This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1. + * + * The version of the OpenAPI document: 3.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +export * from './api/common-cartridge-api'; + diff --git a/src/commonCartridgeApi/v3/api/common-cartridge-api.ts b/src/commonCartridgeApi/v3/api/common-cartridge-api.ts new file mode 100644 index 0000000000..25b5924a22 --- /dev/null +++ b/src/commonCartridgeApi/v3/api/common-cartridge-api.ts @@ -0,0 +1,233 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Schulcloud-Verbund-Software Server API + * This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1. + * + * The version of the OpenAPI document: 3.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import { Configuration } from '../configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; +// @ts-ignore +import { CourseExportBodyParams } from '../models'; +/** + * CommonCartridgeApi - axios parameter creator + * @export + */ +export const CommonCartridgeApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @param {string} parentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + commonCartridgeControllerExportCourse: async (parentId: string, options: any = {}): Promise => { + // verify required parameter 'parentId' is not null or undefined + assertParamExists('commonCartridgeControllerExportCourse', 'parentId', parentId) + const localVarPath = `/common-cartridge/export/{parentId}` + .replace(`{${"parentId"}}`, encodeURIComponent(String(parentId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} parentId + * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export + * @param {CourseExportBodyParams} courseExportBodyParams + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + commonCartridgeControllerExportCourseToCommonCartridge: async (parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options: any = {}): Promise => { + // verify required parameter 'parentId' is not null or undefined + assertParamExists('commonCartridgeControllerExportCourseToCommonCartridge', 'parentId', parentId) + // verify required parameter 'version' is not null or undefined + assertParamExists('commonCartridgeControllerExportCourseToCommonCartridge', 'version', version) + // verify required parameter 'courseExportBodyParams' is not null or undefined + assertParamExists('commonCartridgeControllerExportCourseToCommonCartridge', 'courseExportBodyParams', courseExportBodyParams) + const localVarPath = `/common-cartridge/newexport/{parentId}` + .replace(`{${"parentId"}}`, encodeURIComponent(String(parentId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (version !== undefined) { + localVarQueryParameter['version'] = version; + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(courseExportBodyParams, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * CommonCartridgeApi - functional programming interface + * @export + */ +export const CommonCartridgeApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = CommonCartridgeApiAxiosParamCreator(configuration) + return { + /** + * + * @param {string} parentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async commonCartridgeControllerExportCourse(parentId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.commonCartridgeControllerExportCourse(parentId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} parentId + * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export + * @param {CourseExportBodyParams} courseExportBodyParams + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async commonCartridgeControllerExportCourseToCommonCartridge(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.commonCartridgeControllerExportCourseToCommonCartridge(parentId, version, courseExportBodyParams, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * CommonCartridgeApi - factory interface + * @export + */ +export const CommonCartridgeApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = CommonCartridgeApiFp(configuration) + return { + /** + * + * @param {string} parentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + commonCartridgeControllerExportCourse(parentId: string, options?: any): AxiosPromise { + return localVarFp.commonCartridgeControllerExportCourse(parentId, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} parentId + * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export + * @param {CourseExportBodyParams} courseExportBodyParams + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + commonCartridgeControllerExportCourseToCommonCartridge(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): AxiosPromise { + return localVarFp.commonCartridgeControllerExportCourseToCommonCartridge(parentId, version, courseExportBodyParams, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * CommonCartridgeApi - interface + * @export + * @interface CommonCartridgeApi + */ +export interface CommonCartridgeApiInterface { + /** + * + * @param {string} parentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CommonCartridgeApiInterface + */ + commonCartridgeControllerExportCourse(parentId: string, options?: any): AxiosPromise; + + /** + * + * @param {string} parentId + * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export + * @param {CourseExportBodyParams} courseExportBodyParams + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CommonCartridgeApiInterface + */ + commonCartridgeControllerExportCourseToCommonCartridge(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): AxiosPromise; + +} + +/** + * CommonCartridgeApi - object-oriented interface + * @export + * @class CommonCartridgeApi + * @extends {BaseAPI} + */ +export class CommonCartridgeApi extends BaseAPI implements CommonCartridgeApiInterface { + /** + * + * @param {string} parentId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CommonCartridgeApi + */ + public commonCartridgeControllerExportCourse(parentId: string, options?: any) { + return CommonCartridgeApiFp(this.configuration).commonCartridgeControllerExportCourse(parentId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} parentId + * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export + * @param {CourseExportBodyParams} courseExportBodyParams + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CommonCartridgeApi + */ + public commonCartridgeControllerExportCourseToCommonCartridge(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any) { + return CommonCartridgeApiFp(this.configuration).commonCartridgeControllerExportCourseToCommonCartridge(parentId, version, courseExportBodyParams, options).then((request) => request(this.axios, this.basePath)); + } +} diff --git a/src/commonCartridgeApi/v3/base.ts b/src/commonCartridgeApi/v3/base.ts new file mode 100644 index 0000000000..04e7c6ea9a --- /dev/null +++ b/src/commonCartridgeApi/v3/base.ts @@ -0,0 +1,71 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Schulcloud-Verbund-Software Server API + * This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1. + * + * The version of the OpenAPI document: 3.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +// Some imports not used depending on template conditions +// @ts-ignore +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; + +export const BASE_PATH = "http://localhost:3350/api/v3".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: any; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} diff --git a/src/commonCartridgeApi/v3/common.ts b/src/commonCartridgeApi/v3/common.ts new file mode 100644 index 0000000000..927bdf8400 --- /dev/null +++ b/src/commonCartridgeApi/v3/common.ts @@ -0,0 +1,138 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Schulcloud-Verbund-Software Server API + * This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1. + * + * The version of the OpenAPI document: 3.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance } from 'axios'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + for (const object of objects) { + for (const key in object) { + if (Array.isArray(object[key])) { + searchParams.delete(key); + for (const item of object[key]) { + searchParams.append(key, item); + } + } else { + searchParams.set(key, object[key]); + } + } + } + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/src/commonCartridgeApi/v3/configuration.ts b/src/commonCartridgeApi/v3/configuration.ts new file mode 100644 index 0000000000..ce202f21c6 --- /dev/null +++ b/src/commonCartridgeApi/v3/configuration.ts @@ -0,0 +1,101 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Schulcloud-Verbund-Software Server API + * This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1. + * + * The version of the OpenAPI document: 3.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + baseOptions?: any; + formDataCtor?: new () => any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; + this.formDataCtor = param.formDataCtor; + } + + /** + * 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. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/src/commonCartridgeApi/v3/git_push.sh b/src/commonCartridgeApi/v3/git_push.sh new file mode 100644 index 0000000000..ced3be2b0c --- /dev/null +++ b/src/commonCartridgeApi/v3/git_push.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/src/commonCartridgeApi/v3/index.ts b/src/commonCartridgeApi/v3/index.ts new file mode 100644 index 0000000000..8b762df664 --- /dev/null +++ b/src/commonCartridgeApi/v3/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Schulcloud-Verbund-Software Server API + * This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1. + * + * The version of the OpenAPI document: 3.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; +export * from "./models"; diff --git a/src/commonCartridgeApi/v3/models/course-export-body-params.ts b/src/commonCartridgeApi/v3/models/course-export-body-params.ts new file mode 100644 index 0000000000..7bdbce2ac9 --- /dev/null +++ b/src/commonCartridgeApi/v3/models/course-export-body-params.ts @@ -0,0 +1,43 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Schulcloud-Verbund-Software Server API + * This is v3 of Schulcloud-Verbund-Software Server. Checkout /docs for v1. + * + * The version of the OpenAPI document: 3.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface CourseExportBodyParams + */ +export interface CourseExportBodyParams { + /** + * The list of ids of topics which should be exported. If empty no topics are exported. + * @type {Array} + * @memberof CourseExportBodyParams + */ + topics: Array; + /** + * The list of ids of tasks which should be exported. If empty no tasks are exported. + * @type {Array} + * @memberof CourseExportBodyParams + */ + tasks: Array; + /** + * The list of ids of column boards which should be exported. If empty no column boards are exported. + * @type {Array} + * @memberof CourseExportBodyParams + */ + columnBoards: Array; +} + + diff --git a/src/commonCartridgeApi/v3/models/index.ts b/src/commonCartridgeApi/v3/models/index.ts new file mode 100644 index 0000000000..0ff80136e6 --- /dev/null +++ b/src/commonCartridgeApi/v3/models/index.ts @@ -0,0 +1 @@ +export * from './course-export-body-params'; From bfb8619c5d75aba6caf2d0d3fb097f1df76b0bd6 Mon Sep 17 00:00:00 2001 From: Firas Shmit Date: Fri, 15 Nov 2024 09:45:49 +0100 Subject: [PATCH 03/26] EW-1060 changed endpoint of export to microservice --- src/store/course-room-details.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/store/course-room-details.ts b/src/store/course-room-details.ts index 137111dfc4..ae29989e13 100644 --- a/src/store/course-room-details.ts +++ b/src/store/course-room-details.ts @@ -20,6 +20,7 @@ import { Action, Module, Mutation, VuexModule } from "vuex-module-decorators"; import { BusinessError } from "./types/commons"; import { HttpStatusCode } from "./types/http-status-code.enum"; import { Course } from "./types/room"; +import { CommonCartridgeApiFactory } from "@/commonCartridgeApi/v3"; @Module({ name: "courseRoomDetailsModule", @@ -199,11 +200,11 @@ export default class CourseRoomDetailsModule extends VuexModule { }): Promise { this.resetBusinessError(); try { - const response = await CoursesApiFactory( + const response = await CommonCartridgeApiFactory( undefined, "v3", $axios - ).courseControllerExportCourse( + ).commonCartridgeControllerExportCourseToCommonCartridge( this.roomData.roomId, exportSettings.version, { @@ -215,6 +216,22 @@ export default class CourseRoomDetailsModule extends VuexModule { responseType: "blob", } ); + // const response = await CoursesApiFactory( + // undefined, + // "v3", + // $axios + // ).courseControllerExportCourse( + // this.roomData.roomId, + // exportSettings.version, + // { + // topics: exportSettings.topics, + // tasks: exportSettings.tasks, + // columnBoards: exportSettings.columnBoards, + // }, + // { + // responseType: "blob", + // } + // ); const link = document.createElement("a"); link.href = URL.createObjectURL( new Blob([response.data as unknown as Blob]) From 19b137a42b50b8b12bf78459ba2ea1a07c23c93d Mon Sep 17 00:00:00 2001 From: Firas Shmit Date: Fri, 15 Nov 2024 09:57:33 +0100 Subject: [PATCH 04/26] EW-1060 fixed export in a index file --- src/commonCartridgeApi/v3/models/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commonCartridgeApi/v3/models/index.ts b/src/commonCartridgeApi/v3/models/index.ts index 0ff80136e6..5b596305a3 100644 --- a/src/commonCartridgeApi/v3/models/index.ts +++ b/src/commonCartridgeApi/v3/models/index.ts @@ -1 +1 @@ -export * from './course-export-body-params'; +export * from "./course-export-body-params"; From f1984e3c42555310117bcea63aecb0cdeaed1841 Mon Sep 17 00:00:00 2001 From: Firas Shmit Date: Fri, 15 Nov 2024 11:31:19 +0100 Subject: [PATCH 05/26] EW-1060 genereated the client of common cartridge new --- src/commonCartridgeApi/v3/.openapi-generator/FILES | 1 - src/commonCartridgeApi/v3/api/common-cartridge-api.ts | 2 +- src/commonCartridgeApi/v3/models/index.ts | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/commonCartridgeApi/v3/.openapi-generator/FILES b/src/commonCartridgeApi/v3/.openapi-generator/FILES index b571336241..584b39696c 100644 --- a/src/commonCartridgeApi/v3/.openapi-generator/FILES +++ b/src/commonCartridgeApi/v3/.openapi-generator/FILES @@ -1,6 +1,5 @@ .gitignore .npmignore -.openapi-generator-ignore api.ts api/common-cartridge-api.ts base.ts diff --git a/src/commonCartridgeApi/v3/api/common-cartridge-api.ts b/src/commonCartridgeApi/v3/api/common-cartridge-api.ts index 25b5924a22..6e967fc64d 100644 --- a/src/commonCartridgeApi/v3/api/common-cartridge-api.ts +++ b/src/commonCartridgeApi/v3/api/common-cartridge-api.ts @@ -85,7 +85,7 @@ export const CommonCartridgeApiAxiosParamCreator = function (configuration?: Con baseOptions = configuration.baseOptions; } - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; diff --git a/src/commonCartridgeApi/v3/models/index.ts b/src/commonCartridgeApi/v3/models/index.ts index 5b596305a3..0ff80136e6 100644 --- a/src/commonCartridgeApi/v3/models/index.ts +++ b/src/commonCartridgeApi/v3/models/index.ts @@ -1 +1 @@ -export * from "./course-export-body-params"; +export * from './course-export-body-params'; From 04297c472a42896a77c160f7e66e1dcd632d3bef Mon Sep 17 00:00:00 2001 From: Firas Shmit Date: Fri, 15 Nov 2024 11:43:01 +0100 Subject: [PATCH 06/26] EW-1060 changed a import in a index file --- src/commonCartridgeApi/v3/models/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commonCartridgeApi/v3/models/index.ts b/src/commonCartridgeApi/v3/models/index.ts index 0ff80136e6..5b596305a3 100644 --- a/src/commonCartridgeApi/v3/models/index.ts +++ b/src/commonCartridgeApi/v3/models/index.ts @@ -1 +1 @@ -export * from './course-export-body-params'; +export * from "./course-export-body-params"; From 9b2b73e54b192d53dfd24d8fac21b93e32079cfa Mon Sep 17 00:00:00 2001 From: Firas Shmit Date: Fri, 15 Nov 2024 14:48:22 +0100 Subject: [PATCH 07/26] EW-1060 generated api client again after deleting the old export endpoint --- .../v3/api/common-cartridge-api.ts | 96 +++---------------- src/store/course-room-details.ts | 2 +- 2 files changed, 13 insertions(+), 85 deletions(-) diff --git a/src/commonCartridgeApi/v3/api/common-cartridge-api.ts b/src/commonCartridgeApi/v3/api/common-cartridge-api.ts index 6e967fc64d..abf3176d84 100644 --- a/src/commonCartridgeApi/v3/api/common-cartridge-api.ts +++ b/src/commonCartridgeApi/v3/api/common-cartridge-api.ts @@ -28,39 +28,6 @@ import { CourseExportBodyParams } from '../models'; */ export const CommonCartridgeApiAxiosParamCreator = function (configuration?: Configuration) { return { - /** - * - * @param {string} parentId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - commonCartridgeControllerExportCourse: async (parentId: string, options: any = {}): Promise => { - // verify required parameter 'parentId' is not null or undefined - assertParamExists('commonCartridgeControllerExportCourse', 'parentId', parentId) - const localVarPath = `/common-cartridge/export/{parentId}` - .replace(`{${"parentId"}}`, encodeURIComponent(String(parentId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - - - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, /** * * @param {string} parentId @@ -69,14 +36,14 @@ export const CommonCartridgeApiAxiosParamCreator = function (configuration?: Con * @param {*} [options] Override http request option. * @throws {RequiredError} */ - commonCartridgeControllerExportCourseToCommonCartridge: async (parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options: any = {}): Promise => { + commonCartridgeControllerExportCourse: async (parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options: any = {}): Promise => { // verify required parameter 'parentId' is not null or undefined - assertParamExists('commonCartridgeControllerExportCourseToCommonCartridge', 'parentId', parentId) + assertParamExists('commonCartridgeControllerExportCourse', 'parentId', parentId) // verify required parameter 'version' is not null or undefined - assertParamExists('commonCartridgeControllerExportCourseToCommonCartridge', 'version', version) + assertParamExists('commonCartridgeControllerExportCourse', 'version', version) // verify required parameter 'courseExportBodyParams' is not null or undefined - assertParamExists('commonCartridgeControllerExportCourseToCommonCartridge', 'courseExportBodyParams', courseExportBodyParams) - const localVarPath = `/common-cartridge/newexport/{parentId}` + assertParamExists('commonCartridgeControllerExportCourse', 'courseExportBodyParams', courseExportBodyParams) + const localVarPath = `/common-cartridge/export/{parentId}` .replace(`{${"parentId"}}`, encodeURIComponent(String(parentId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -117,16 +84,6 @@ export const CommonCartridgeApiAxiosParamCreator = function (configuration?: Con export const CommonCartridgeApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = CommonCartridgeApiAxiosParamCreator(configuration) return { - /** - * - * @param {string} parentId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async commonCartridgeControllerExportCourse(parentId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.commonCartridgeControllerExportCourse(parentId, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, /** * * @param {string} parentId @@ -135,8 +92,8 @@ export const CommonCartridgeApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async commonCartridgeControllerExportCourseToCommonCartridge(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.commonCartridgeControllerExportCourseToCommonCartridge(parentId, version, courseExportBodyParams, options); + async commonCartridgeControllerExportCourse(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.commonCartridgeControllerExportCourse(parentId, version, courseExportBodyParams, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } @@ -149,15 +106,6 @@ export const CommonCartridgeApiFp = function(configuration?: Configuration) { export const CommonCartridgeApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = CommonCartridgeApiFp(configuration) return { - /** - * - * @param {string} parentId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - commonCartridgeControllerExportCourse(parentId: string, options?: any): AxiosPromise { - return localVarFp.commonCartridgeControllerExportCourse(parentId, options).then((request) => request(axios, basePath)); - }, /** * * @param {string} parentId @@ -166,8 +114,8 @@ export const CommonCartridgeApiFactory = function (configuration?: Configuration * @param {*} [options] Override http request option. * @throws {RequiredError} */ - commonCartridgeControllerExportCourseToCommonCartridge(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): AxiosPromise { - return localVarFp.commonCartridgeControllerExportCourseToCommonCartridge(parentId, version, courseExportBodyParams, options).then((request) => request(axios, basePath)); + commonCartridgeControllerExportCourse(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): AxiosPromise { + return localVarFp.commonCartridgeControllerExportCourse(parentId, version, courseExportBodyParams, options).then((request) => request(axios, basePath)); }, }; }; @@ -178,15 +126,6 @@ export const CommonCartridgeApiFactory = function (configuration?: Configuration * @interface CommonCartridgeApi */ export interface CommonCartridgeApiInterface { - /** - * - * @param {string} parentId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof CommonCartridgeApiInterface - */ - commonCartridgeControllerExportCourse(parentId: string, options?: any): AxiosPromise; - /** * * @param {string} parentId @@ -196,7 +135,7 @@ export interface CommonCartridgeApiInterface { * @throws {RequiredError} * @memberof CommonCartridgeApiInterface */ - commonCartridgeControllerExportCourseToCommonCartridge(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): AxiosPromise; + commonCartridgeControllerExportCourse(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): AxiosPromise; } @@ -207,17 +146,6 @@ export interface CommonCartridgeApiInterface { * @extends {BaseAPI} */ export class CommonCartridgeApi extends BaseAPI implements CommonCartridgeApiInterface { - /** - * - * @param {string} parentId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof CommonCartridgeApi - */ - public commonCartridgeControllerExportCourse(parentId: string, options?: any) { - return CommonCartridgeApiFp(this.configuration).commonCartridgeControllerExportCourse(parentId, options).then((request) => request(this.axios, this.basePath)); - } - /** * * @param {string} parentId @@ -227,7 +155,7 @@ export class CommonCartridgeApi extends BaseAPI implements CommonCartridgeApiInt * @throws {RequiredError} * @memberof CommonCartridgeApi */ - public commonCartridgeControllerExportCourseToCommonCartridge(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any) { - return CommonCartridgeApiFp(this.configuration).commonCartridgeControllerExportCourseToCommonCartridge(parentId, version, courseExportBodyParams, options).then((request) => request(this.axios, this.basePath)); + public commonCartridgeControllerExportCourse(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any) { + return CommonCartridgeApiFp(this.configuration).commonCartridgeControllerExportCourse(parentId, version, courseExportBodyParams, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/src/store/course-room-details.ts b/src/store/course-room-details.ts index ae29989e13..289679312b 100644 --- a/src/store/course-room-details.ts +++ b/src/store/course-room-details.ts @@ -204,7 +204,7 @@ export default class CourseRoomDetailsModule extends VuexModule { undefined, "v3", $axios - ).commonCartridgeControllerExportCourseToCommonCartridge( + ).commonCartridgeControllerExportCourse( this.roomData.roomId, exportSettings.version, { From d325a895e590a9547214cc3402df81a339f6be7e Mon Sep 17 00:00:00 2001 From: Firas Shmit Date: Thu, 21 Nov 2024 15:17:28 +0100 Subject: [PATCH 08/26] EW-1060 deleted options info point 2 --- src/components/molecules/CommonCartridgeExportModal.vue | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/molecules/CommonCartridgeExportModal.vue b/src/components/molecules/CommonCartridgeExportModal.vue index 3d9ec14906..bab53482e1 100644 --- a/src/components/molecules/CommonCartridgeExportModal.vue +++ b/src/components/molecules/CommonCartridgeExportModal.vue @@ -41,9 +41,6 @@ {{ $t(`components.molecules.export.options.info`) }}
· - {{ $t(`components.molecules.export.options.info.point1`) }} -
- · {{ $t(`components.molecules.export.options.info.point2`) }}

From eec722c462d327906d56cd5534b155a5b81754e3 Mon Sep 17 00:00:00 2001 From: Firas Shmit Date: Wed, 11 Dec 2024 15:28:13 +0100 Subject: [PATCH 09/26] EW-1060 modifed download common cartridge test --- src/store/course-room-details.unit.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/store/course-room-details.unit.ts b/src/store/course-room-details.unit.ts index 962b40ef2c..227a9e1488 100644 --- a/src/store/course-room-details.unit.ts +++ b/src/store/course-room-details.unit.ts @@ -1,4 +1,5 @@ import * as serverApi from "@/serverApi/v3/api"; +import * as commoncartridgeApi from "@/commonCartridgeApi/v3/api"; import { BoardParentType } from "@/serverApi/v3/api"; import { applicationErrorModule, authModule } from "@/store"; import ApplicationErrorModule from "@/store/application-error"; @@ -390,8 +391,10 @@ describe("course-room module", () => { lessonControllerDelete: jest.fn(() => Promise.resolve()), }; const spy = jest - .spyOn(serverApi, "CoursesApiFactory") - .mockReturnValue(mockApi as unknown as serverApi.CoursesApiInterface); + .spyOn(commoncartridgeApi, "CommonCartridgeApiFactory") + .mockReturnValue( + mockApi as unknown as commoncartridgeApi.CommonCartridgeApiInterface + ); await expect( courseRoomDetailsModule.downloadCommonCartridgeCourse({ @@ -413,8 +416,10 @@ describe("course-room module", () => { ), }; const spy = jest - .spyOn(serverApi, "CoursesApiFactory") - .mockReturnValue(mockApi as unknown as serverApi.CoursesApiInterface); + .spyOn(commoncartridgeApi, "CommonCartridgeApiFactory") + .mockReturnValue( + mockApi as unknown as commoncartridgeApi.CommonCartridgeApiInterface + ); await courseRoomDetailsModule.downloadCommonCartridgeCourse({ version: "1.1.0", From fa2d8252551a6d88659c813b304a579c0d0c3fec Mon Sep 17 00:00:00 2001 From: Patrick Sachmann <20001160+psachmann@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:11:55 +0100 Subject: [PATCH 10/26] changing client generation --- openapitools-for-common-cartridge.json | 9 - openapitools.json | 20 +- package-lock.json | 253 +++++++++++------- package.json | 4 +- .../v3/.openapi-generator/FILES | 1 + .../v3/.openapi-generator/VERSION | 2 +- .../v3/api/common-cartridge-api.ts | 71 +++-- src/commonCartridgeApi/v3/base.ts | 25 +- src/commonCartridgeApi/v3/common.ts | 48 ++-- src/commonCartridgeApi/v3/configuration.ts | 9 + src/commonCartridgeApi/v3/git_push.sh | 7 +- .../v3/models/course-export-body-params.ts | 7 +- src/commonCartridgeApi/v3/models/index.ts | 2 +- 13 files changed, 291 insertions(+), 167 deletions(-) delete mode 100644 openapitools-for-common-cartridge.json diff --git a/openapitools-for-common-cartridge.json b/openapitools-for-common-cartridge.json deleted file mode 100644 index 3570d978fe..0000000000 --- a/openapitools-for-common-cartridge.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "apiPackage": "api", - "enumNameSuffix": "", - "enumPropertyNaming": "UPPERCASE", - "modelPackage": "models", - "supportsES6": true, - "withInterfaces": true, - "withSeparateModelsAndApi": true -} diff --git a/openapitools.json b/openapitools.json index 741c3d8322..869cd66688 100644 --- a/openapitools.json +++ b/openapitools.json @@ -2,6 +2,24 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.1.0" + "version": "7.6.0", + "generators": { + "common-cartridge-api": { + "generatorName": "typescript-axios", + "inputSpec": "http://localhost:3350/api/v3/docs-json/", + "output": "./src/commonCartridgeApi/v3", + "skipValidateSpec": true, + "enablePostProcessFile": true, + "additionalProperties": { + "apiPackage": "api", + "enumNameSuffix": "", + "enumPropertyNaming": "UPPERCASE", + "modelPackage": "models", + "supportsES6": true, + "withInterfaces": true, + "withSeparateModelsAndApi": true + } + } + } } } diff --git a/package-lock.json b/package-lock.json index 475ad48429..648bc879fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "mobile-drag-drop": "^3.0.0-rc.0", "object-hash": "^3.0.0", "pinia": "^2.1.7", + "rimraf": "^6.0.1", "socket.io-client": "^4.7.5", "sortablejs": "^1.15.2", "sortablejs-vue3": "^1.2.11", @@ -2293,7 +2294,6 @@ "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, "license": "ISC", "dependencies": { "string-width": "^5.1.2", @@ -2311,7 +2311,6 @@ "version": "6.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", - "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -2324,7 +2323,6 @@ "version": "6.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -2337,14 +2335,12 @@ "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true, "license": "MIT" }, "node_modules/@isaacs/cliui/node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, "license": "MIT", "dependencies": { "eastasianwidth": "^0.2.0", @@ -2362,7 +2358,6 @@ "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" @@ -2378,7 +2373,6 @@ "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^6.1.0", @@ -3348,6 +3342,39 @@ "node": ">= 6.0.0" } }, + "node_modules/@mapbox/node-pre-gyp/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@mapbox/node-pre-gyp/node_modules/https-proxy-agent": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", @@ -3362,6 +3389,36 @@ "node": ">= 6" } }, + "node_modules/@mapbox/node-pre-gyp/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@mapbox/node-pre-gyp/node_modules/semver": { "version": "7.6.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", @@ -5234,7 +5291,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -5582,7 +5638,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, "license": "MIT" }, "node_modules/base64-js": { @@ -5722,7 +5777,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" @@ -7286,7 +7340,6 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true, "license": "MIT" }, "node_modules/easy-table": { @@ -7404,7 +7457,6 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, "license": "MIT" }, "node_modules/emojis-list": { @@ -8642,7 +8694,6 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", - "dev": true, "license": "ISC", "dependencies": { "cross-spawn": "^7.0.0", @@ -8659,7 +8710,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, "license": "ISC", "engines": { "node": ">=14" @@ -8867,6 +8917,29 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/glob": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.0.tgz", + "integrity": "sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==", + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^4.0.1", + "minimatch": "^10.0.0", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^2.0.0" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -8887,6 +8960,61 @@ "devOptional": true, "license": "BSD-2-Clause" }, + "node_modules/glob/node_modules/jackspeak": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.2.tgz", + "integrity": "sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==", + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob/node_modules/lru-cache": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.2.tgz", + "integrity": "sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==", + "license": "ISC", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", + "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob/node_modules/path-scurry": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", + "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/globals": { "version": "15.10.0", "resolved": "https://registry.npmjs.org/globals/-/globals-15.10.0.tgz", @@ -9704,7 +9832,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -12063,16 +12190,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/js-beautify/node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, "node_modules/js-beautify/node_modules/nopt": { "version": "7.2.1", "resolved": "https://registry.npmjs.org/nopt/-/nopt-7.2.1.tgz", @@ -12813,6 +12930,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/minizlib": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", @@ -13476,7 +13602,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", - "dev": true, "license": "BlueOak-1.0.0" }, "node_modules/param-case": { @@ -13616,16 +13741,6 @@ "dev": true, "license": "ISC" }, - "node_modules/path-scurry/node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, "node_modules/path-to-regexp": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-3.3.0.tgz", @@ -14472,68 +14587,24 @@ } }, "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", - "dev": true, + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.0.1.tgz", + "integrity": "sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==", "license": "ISC", "dependencies": { - "glob": "^7.1.3" + "glob": "^11.0.0", + "package-json-from-dist": "^1.0.0" }, "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/rimraf/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "rimraf": "dist/esm/bin.mjs" }, "engines": { - "node": "*" + "node": "20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/rimraf/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/run-applescript": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", @@ -15315,7 +15386,6 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", @@ -15331,7 +15401,6 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", @@ -15346,7 +15415,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -15360,7 +15428,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -17367,7 +17434,6 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", @@ -17385,7 +17451,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -17401,7 +17466,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -17414,7 +17478,6 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, "license": "MIT" }, "node_modules/wrap-ansi/node_modules/ansi-styles": { diff --git a/package.json b/package.json index a87473862f..24587910c2 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "generate-client:server": "node generate-client.js -c openapitools-for-server.json", "generate-client:filestorage": "node generate-client.js -u 'http://localhost:4444/api/v3/docs-json/' -p 'src/fileStorageApi/v3' -c 'openapitools-for-file-storage.json'", "generate-client:h5p-editor": "node generate-client.js -u 'http://localhost:4448/api/v3/docs-json/' -p 'src/h5pEditorApi/v3' -c 'openapitools-for-h5p-editor.json'", - "generate-client:common-cartridge": "node generate-client.js -u 'http://localhost:3350/api/v3/docs-json/' -p 'src/commonCartridgeApi/v3' -c 'openapitools-for-common-cartridge.json'" + "pregenerate-client:common-cartridge": "rimraf ./src/commonCartridgeApi/v3", + "generate-client:common-cartridge": "openapi-generator-cli generate -c ./openapitools.json --generator-key common-cartridge-api" }, "dependencies": { "@braintree/sanitize-url": "^6.0.4", @@ -33,6 +34,7 @@ "mobile-drag-drop": "^3.0.0-rc.0", "object-hash": "^3.0.0", "pinia": "^2.1.7", + "rimraf": "^6.0.1", "socket.io-client": "^4.7.5", "sortablejs": "^1.15.2", "sortablejs-vue3": "^1.2.11", diff --git a/src/commonCartridgeApi/v3/.openapi-generator/FILES b/src/commonCartridgeApi/v3/.openapi-generator/FILES index 584b39696c..b571336241 100644 --- a/src/commonCartridgeApi/v3/.openapi-generator/FILES +++ b/src/commonCartridgeApi/v3/.openapi-generator/FILES @@ -1,5 +1,6 @@ .gitignore .npmignore +.openapi-generator-ignore api.ts api/common-cartridge-api.ts base.ts diff --git a/src/commonCartridgeApi/v3/.openapi-generator/VERSION b/src/commonCartridgeApi/v3/.openapi-generator/VERSION index acf69b48b8..93c8ddab9f 100644 --- a/src/commonCartridgeApi/v3/.openapi-generator/VERSION +++ b/src/commonCartridgeApi/v3/.openapi-generator/VERSION @@ -1 +1 @@ -5.1.0 \ No newline at end of file +7.6.0 diff --git a/src/commonCartridgeApi/v3/api/common-cartridge-api.ts b/src/commonCartridgeApi/v3/api/common-cartridge-api.ts index abf3176d84..97bc107c92 100644 --- a/src/commonCartridgeApi/v3/api/common-cartridge-api.ts +++ b/src/commonCartridgeApi/v3/api/common-cartridge-api.ts @@ -13,15 +13,16 @@ */ -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; -import { Configuration } from '../configuration'; +import type { Configuration } from '../configuration'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; +import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; // @ts-ignore -import { CourseExportBodyParams } from '../models'; +import type { CourseExportBodyParams } from '../models'; /** * CommonCartridgeApi - axios parameter creator * @export @@ -30,21 +31,21 @@ export const CommonCartridgeApiAxiosParamCreator = function (configuration?: Con return { /** * - * @param {string} parentId - * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export + * @param {string} courseId + * @param {CommonCartridgeControllerExportCourseVersion} version The version of CC export * @param {CourseExportBodyParams} courseExportBodyParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ - commonCartridgeControllerExportCourse: async (parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options: any = {}): Promise => { - // verify required parameter 'parentId' is not null or undefined - assertParamExists('commonCartridgeControllerExportCourse', 'parentId', parentId) + commonCartridgeControllerExportCourse: async (courseId: string, version: CommonCartridgeControllerExportCourseVersion, courseExportBodyParams: CourseExportBodyParams, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'courseId' is not null or undefined + assertParamExists('commonCartridgeControllerExportCourse', 'courseId', courseId) // verify required parameter 'version' is not null or undefined assertParamExists('commonCartridgeControllerExportCourse', 'version', version) // verify required parameter 'courseExportBodyParams' is not null or undefined assertParamExists('commonCartridgeControllerExportCourse', 'courseExportBodyParams', courseExportBodyParams) - const localVarPath = `/common-cartridge/export/{parentId}` - .replace(`{${"parentId"}}`, encodeURIComponent(String(parentId))); + const localVarPath = `/common-cartridge/export/{courseId}` + .replace(`{${"courseId"}}`, encodeURIComponent(String(courseId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -64,7 +65,7 @@ export const CommonCartridgeApiAxiosParamCreator = function (configuration?: Con localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(courseExportBodyParams, localVarRequestOptions, configuration) @@ -86,15 +87,17 @@ export const CommonCartridgeApiFp = function(configuration?: Configuration) { return { /** * - * @param {string} parentId - * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export + * @param {string} courseId + * @param {CommonCartridgeControllerExportCourseVersion} version The version of CC export * @param {CourseExportBodyParams} courseExportBodyParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async commonCartridgeControllerExportCourse(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.commonCartridgeControllerExportCourse(parentId, version, courseExportBodyParams, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + async commonCartridgeControllerExportCourse(courseId: string, version: CommonCartridgeControllerExportCourseVersion, courseExportBodyParams: CourseExportBodyParams, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.commonCartridgeControllerExportCourse(courseId, version, courseExportBodyParams, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['CommonCartridgeApi.commonCartridgeControllerExportCourse']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } }; @@ -108,14 +111,14 @@ export const CommonCartridgeApiFactory = function (configuration?: Configuration return { /** * - * @param {string} parentId - * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export + * @param {string} courseId + * @param {CommonCartridgeControllerExportCourseVersion} version The version of CC export * @param {CourseExportBodyParams} courseExportBodyParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ - commonCartridgeControllerExportCourse(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): AxiosPromise { - return localVarFp.commonCartridgeControllerExportCourse(parentId, version, courseExportBodyParams, options).then((request) => request(axios, basePath)); + commonCartridgeControllerExportCourse(courseId: string, version: CommonCartridgeControllerExportCourseVersion, courseExportBodyParams: CourseExportBodyParams, options?: any): AxiosPromise { + return localVarFp.commonCartridgeControllerExportCourse(courseId, version, courseExportBodyParams, options).then((request) => request(axios, basePath)); }, }; }; @@ -128,14 +131,14 @@ export const CommonCartridgeApiFactory = function (configuration?: Configuration export interface CommonCartridgeApiInterface { /** * - * @param {string} parentId - * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export + * @param {string} courseId + * @param {CommonCartridgeControllerExportCourseVersion} version The version of CC export * @param {CourseExportBodyParams} courseExportBodyParams * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonCartridgeApiInterface */ - commonCartridgeControllerExportCourse(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): AxiosPromise; + commonCartridgeControllerExportCourse(courseId: string, version: CommonCartridgeControllerExportCourseVersion, courseExportBodyParams: CourseExportBodyParams, options?: RawAxiosRequestConfig): AxiosPromise; } @@ -148,14 +151,26 @@ export interface CommonCartridgeApiInterface { export class CommonCartridgeApi extends BaseAPI implements CommonCartridgeApiInterface { /** * - * @param {string} parentId - * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export + * @param {string} courseId + * @param {CommonCartridgeControllerExportCourseVersion} version The version of CC export * @param {CourseExportBodyParams} courseExportBodyParams * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonCartridgeApi */ - public commonCartridgeControllerExportCourse(parentId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any) { - return CommonCartridgeApiFp(this.configuration).commonCartridgeControllerExportCourse(parentId, version, courseExportBodyParams, options).then((request) => request(this.axios, this.basePath)); + public commonCartridgeControllerExportCourse(courseId: string, version: CommonCartridgeControllerExportCourseVersion, courseExportBodyParams: CourseExportBodyParams, options?: RawAxiosRequestConfig) { + return CommonCartridgeApiFp(this.configuration).commonCartridgeControllerExportCourse(courseId, version, courseExportBodyParams, options).then((request) => request(this.axios, this.basePath)); } } + +/** + * @export + */ +export const CommonCartridgeControllerExportCourseVersion = { + _0_0: '1.0.0', + _1_0: '1.1.0', + _2_0: '1.2.0', + _3_0: '1.3.0', + _4_0: '1.4.0' +} as const; +export type CommonCartridgeControllerExportCourseVersion = typeof CommonCartridgeControllerExportCourseVersion[keyof typeof CommonCartridgeControllerExportCourseVersion]; diff --git a/src/commonCartridgeApi/v3/base.ts b/src/commonCartridgeApi/v3/base.ts index 04e7c6ea9a..9adfe7a71e 100644 --- a/src/commonCartridgeApi/v3/base.ts +++ b/src/commonCartridgeApi/v3/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost:3350/api/v3".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: RawAxiosRequestConfig; } /** @@ -52,7 +53,7 @@ export class BaseAPI { constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { if (configuration) { this.configuration = configuration; - this.basePath = configuration.basePath || this.basePath; + this.basePath = configuration.basePath ?? basePath; } } }; @@ -64,8 +65,22 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } + +interface ServerMap { + [key: string]: { + url: string, + description: string, + }[]; +} + +/** + * + * @export + */ +export const operationServerMap: ServerMap = { +} diff --git a/src/commonCartridgeApi/v3/common.ts b/src/commonCartridgeApi/v3/common.ts index 927bdf8400..6c119efb60 100644 --- a/src/commonCartridgeApi/v3/common.ts +++ b/src/commonCartridgeApi/v3/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); }; } diff --git a/src/commonCartridgeApi/v3/configuration.ts b/src/commonCartridgeApi/v3/configuration.ts index ce202f21c6..8c97d307cf 100644 --- a/src/commonCartridgeApi/v3/configuration.ts +++ b/src/commonCartridgeApi/v3/configuration.ts @@ -19,6 +19,7 @@ export interface ConfigurationParameters { password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); basePath?: string; + serverIndex?: number; baseOptions?: any; formDataCtor?: new () => any; } @@ -58,6 +59,13 @@ export class Configuration { * @memberof Configuration */ basePath?: string; + /** + * override server index + * + * @type {number} + * @memberof Configuration + */ + serverIndex?: number; /** * base options for axios calls * @@ -80,6 +88,7 @@ export class Configuration { this.password = param.password; this.accessToken = param.accessToken; this.basePath = param.basePath; + this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; this.formDataCtor = param.formDataCtor; } diff --git a/src/commonCartridgeApi/v3/git_push.sh b/src/commonCartridgeApi/v3/git_push.sh index ced3be2b0c..f53a75d4fa 100644 --- a/src/commonCartridgeApi/v3/git_push.sh +++ b/src/commonCartridgeApi/v3/git_push.sh @@ -1,7 +1,7 @@ #!/bin/sh # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # -# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" git_user_id=$1 git_repo_id=$2 @@ -38,14 +38,14 @@ git add . git commit -m "$release_note" # Sets the new remote -git_remote=`git remote` +git_remote=$(git remote) if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git fi fi @@ -55,4 +55,3 @@ git pull origin master # Pushes (Forces) the changes in the local repository up to the remote repository echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" git push origin master 2>&1 | grep -v 'To https' - diff --git a/src/commonCartridgeApi/v3/models/course-export-body-params.ts b/src/commonCartridgeApi/v3/models/course-export-body-params.ts index 7bdbce2ac9..7fe921f621 100644 --- a/src/commonCartridgeApi/v3/models/course-export-body-params.ts +++ b/src/commonCartridgeApi/v3/models/course-export-body-params.ts @@ -25,19 +25,18 @@ export interface CourseExportBodyParams { * @type {Array} * @memberof CourseExportBodyParams */ - topics: Array; + 'topics': Array; /** * The list of ids of tasks which should be exported. If empty no tasks are exported. * @type {Array} * @memberof CourseExportBodyParams */ - tasks: Array; + 'tasks': Array; /** * The list of ids of column boards which should be exported. If empty no column boards are exported. * @type {Array} * @memberof CourseExportBodyParams */ - columnBoards: Array; + 'columnBoards': Array; } - diff --git a/src/commonCartridgeApi/v3/models/index.ts b/src/commonCartridgeApi/v3/models/index.ts index 5b596305a3..0ff80136e6 100644 --- a/src/commonCartridgeApi/v3/models/index.ts +++ b/src/commonCartridgeApi/v3/models/index.ts @@ -1 +1 @@ -export * from "./course-export-body-params"; +export * from './course-export-body-params'; From 479db895657fb142b48c69cf5549e92ced9d9466 Mon Sep 17 00:00:00 2001 From: Patrick Sachmann <20001160+psachmann@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:35:00 +0100 Subject: [PATCH 11/26] updating eslint config --- eslint.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint.config.js b/eslint.config.js index d48866d2e3..82fa229ba2 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -31,6 +31,7 @@ module.exports = [ "src/serverApi/**", "src/fileStorageApi/**", "src/h5pEditorApi/**", + "src/commonCartridgeApi/**", ], }, { From e11da22de01716b1df8be3698d98f7ff12044bcf Mon Sep 17 00:00:00 2001 From: Patrick Sachmann <20001160+psachmann@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:26:13 +0100 Subject: [PATCH 12/26] updating unit tests --- src/store/course-room-details.ts | 1 - src/store/course-room-details.unit.ts | 28 ++++++++++++--------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/store/course-room-details.ts b/src/store/course-room-details.ts index 68c71e4744..9f97d3d975 100644 --- a/src/store/course-room-details.ts +++ b/src/store/course-room-details.ts @@ -1,6 +1,5 @@ import { BoardApiFactory, - CoursesApiFactory, CreateBoardBodyParams, CreateBoardResponse, LessonApiFactory, diff --git a/src/store/course-room-details.unit.ts b/src/store/course-room-details.unit.ts index 227a9e1488..9ea056eef7 100644 --- a/src/store/course-room-details.unit.ts +++ b/src/store/course-room-details.unit.ts @@ -1,5 +1,5 @@ import * as serverApi from "@/serverApi/v3/api"; -import * as commoncartridgeApi from "@/commonCartridgeApi/v3/api"; +import { CommonCartridgeApiFactory } from "@/commonCartridgeApi/v3/api"; import { BoardParentType } from "@/serverApi/v3/api"; import { applicationErrorModule, authModule } from "@/store"; import ApplicationErrorModule from "@/store/application-error"; @@ -8,7 +8,7 @@ import { initializeAxios } from "@/utils/api"; import { meResponseFactory } from "@@/tests/test-utils"; import { courseFactory } from "@@/tests/test-utils/factory"; import setupStores from "@@/tests/test-utils/setupStores"; -import { AxiosError, AxiosInstance } from "axios"; +import { AxiosError, AxiosInstance, AxiosPromise } from "axios"; import CourseRoomDetailsModule from "./course-room-details"; import { HttpStatusCode } from "./types/http-status-code.enum"; import { Course } from "./types/room"; @@ -387,14 +387,12 @@ describe("course-room module", () => { describe("downloadCommonCartridgeCourse", () => { it("should call backend api", async () => { const courseRoomDetailsModule = new CourseRoomDetailsModule({}); - const mockApi = { - lessonControllerDelete: jest.fn(() => Promise.resolve()), - }; const spy = jest - .spyOn(commoncartridgeApi, "CommonCartridgeApiFactory") - .mockReturnValue( - mockApi as unknown as commoncartridgeApi.CommonCartridgeApiInterface - ); + .spyOn( + CommonCartridgeApiFactory(), + "commonCartridgeControllerExportCourse" + ) + .mockReturnValue(Promise.resolve() as unknown as AxiosPromise); await expect( courseRoomDetailsModule.downloadCommonCartridgeCourse({ @@ -410,15 +408,13 @@ describe("course-room module", () => { it("should catch error in catch block", async () => { const courseRoomDetailsModule = new CourseRoomDetailsModule({}); const error = { statusCode: 418, message: "I'm a teapot" }; - const mockApi = { - courseControllerExportCourse: jest.fn(() => - Promise.reject({ ...error }) - ), - }; const spy = jest - .spyOn(commoncartridgeApi, "CommonCartridgeApiFactory") + .spyOn( + CommonCartridgeApiFactory(), + "commonCartridgeControllerExportCourse" + ) .mockReturnValue( - mockApi as unknown as commoncartridgeApi.CommonCartridgeApiInterface + Promise.reject(error) as unknown as AxiosPromise ); await courseRoomDetailsModule.downloadCommonCartridgeCourse({ From 178bc97d69ad902ee28ca086f4d7367e06be3fdf Mon Sep 17 00:00:00 2001 From: Patrick Sachmann <20001160+psachmann@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:32:13 +0100 Subject: [PATCH 13/26] changing rimraf version --- package-lock.json | 352 +++++++--------------------------------------- package.json | 2 +- 2 files changed, 55 insertions(+), 299 deletions(-) diff --git a/package-lock.json b/package-lock.json index 648bc879fc..157f1641ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "mobile-drag-drop": "^3.0.0-rc.0", "object-hash": "^3.0.0", "pinia": "^2.1.7", - "rimraf": "^6.0.1", + "rimraf": "^3.0.2", "socket.io-client": "^4.7.5", "sortablejs": "^1.15.2", "sortablejs-vue3": "^1.2.11", @@ -2294,6 +2294,7 @@ "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, "license": "ISC", "dependencies": { "string-width": "^5.1.2", @@ -2311,6 +2312,7 @@ "version": "6.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -2323,6 +2325,7 @@ "version": "6.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -2335,12 +2338,14 @@ "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, "license": "MIT" }, "node_modules/@isaacs/cliui/node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, "license": "MIT", "dependencies": { "eastasianwidth": "^0.2.0", @@ -2358,6 +2363,7 @@ "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" @@ -2373,6 +2379,7 @@ "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^6.1.0", @@ -2768,17 +2775,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/@jest/reporters/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/@jest/reporters/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2816,28 +2812,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@jest/reporters/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/@jest/reporters/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2865,19 +2839,6 @@ "node": ">=10" } }, - "node_modules/@jest/reporters/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/@jest/reporters/node_modules/semver": { "version": "7.6.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", @@ -3342,39 +3303,6 @@ "node": ">= 6.0.0" } }, - "node_modules/@mapbox/node-pre-gyp/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/@mapbox/node-pre-gyp/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/@mapbox/node-pre-gyp/node_modules/https-proxy-agent": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", @@ -3389,36 +3317,6 @@ "node": ">= 6" } }, - "node_modules/@mapbox/node-pre-gyp/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/@mapbox/node-pre-gyp/node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/@mapbox/node-pre-gyp/node_modules/semver": { "version": "7.6.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", @@ -5291,6 +5189,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -5777,6 +5676,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" @@ -6395,7 +6295,6 @@ "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true, "license": "MIT" }, "node_modules/concurrently": { @@ -7340,6 +7239,7 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, "license": "MIT" }, "node_modules/easy-table": { @@ -7457,6 +7357,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, "license": "MIT" }, "node_modules/emojis-list": { @@ -8694,6 +8595,7 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", + "dev": true, "license": "ISC", "dependencies": { "cross-spawn": "^7.0.0", @@ -8710,6 +8612,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, "license": "ISC", "engines": { "node": ">=14" @@ -8804,7 +8707,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true, "license": "ISC" }, "node_modules/fsevents": { @@ -8918,23 +8820,21 @@ } }, "node_modules/glob": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.0.tgz", - "integrity": "sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "license": "ISC", "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^4.0.1", - "minimatch": "^10.0.0", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^2.0.0" - }, - "bin": { - "glob": "dist/esm/bin.mjs" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" }, "engines": { - "node": "20 || >=22" + "node": "*" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -8960,59 +8860,26 @@ "devOptional": true, "license": "BSD-2-Clause" }, - "node_modules/glob/node_modules/jackspeak": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.2.tgz", - "integrity": "sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==", - "license": "BlueOak-1.0.0", + "node_modules/glob/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "license": "MIT", "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob/node_modules/lru-cache": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.2.tgz", - "integrity": "sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==", - "license": "ISC", - "engines": { - "node": "20 || >=22" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, "node_modules/glob/node_modules/minimatch": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", - "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "license": "ISC", "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob/node_modules/path-scurry": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", - "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", - "license": "BlueOak-1.0.0", - "dependencies": { - "lru-cache": "^11.0.0", - "minipass": "^7.1.2" + "brace-expansion": "^1.1.7" }, "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "node": "*" } }, "node_modules/globals": { @@ -9622,7 +9489,6 @@ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", - "dev": true, "license": "ISC", "dependencies": { "once": "^1.3.0", @@ -9633,7 +9499,6 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true, "license": "ISC" }, "node_modules/ini": { @@ -9832,6 +9697,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -10662,17 +10528,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/jest-config/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/jest-config/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -10710,28 +10565,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-config/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/jest-config/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -10742,19 +10575,6 @@ "node": ">=8" } }, - "node_modules/jest-config/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/jest-config/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -11564,17 +11384,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/jest-runtime/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/jest-runtime/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -11612,28 +11421,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-runtime/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/jest-runtime/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -11644,19 +11431,6 @@ "node": ">=8" } }, - "node_modules/jest-runtime/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/jest-runtime/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -12934,6 +12708,7 @@ "version": "7.1.2", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, "license": "ISC", "engines": { "node": ">=16 || 14 >=14.17" @@ -13356,7 +13131,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -13602,6 +13376,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, "license": "BlueOak-1.0.0" }, "node_modules/param-case": { @@ -13695,7 +13470,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -14587,19 +14361,16 @@ } }, "node_modules/rimraf": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.0.1.tgz", - "integrity": "sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", "license": "ISC", "dependencies": { - "glob": "^11.0.0", - "package-json-from-dist": "^1.0.0" + "glob": "^7.1.3" }, "bin": { - "rimraf": "dist/esm/bin.mjs" - }, - "engines": { - "node": "20 || >=22" + "rimraf": "bin.js" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -15386,6 +15157,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", @@ -15401,6 +15173,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", @@ -15415,6 +15188,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -15428,6 +15202,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -15732,28 +15507,6 @@ "concat-map": "0.0.1" } }, - "node_modules/test-exclude/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/test-exclude/node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -17434,6 +17187,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", @@ -17451,6 +17205,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -17466,6 +17221,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -17478,6 +17234,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, "license": "MIT" }, "node_modules/wrap-ansi/node_modules/ansi-styles": { @@ -17520,7 +17277,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true, "license": "ISC" }, "node_modules/write-file-atomic": { diff --git a/package.json b/package.json index 24587910c2..b53eb981e1 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "mobile-drag-drop": "^3.0.0-rc.0", "object-hash": "^3.0.0", "pinia": "^2.1.7", - "rimraf": "^6.0.1", + "rimraf": "^3.0.2", "socket.io-client": "^4.7.5", "sortablejs": "^1.15.2", "sortablejs-vue3": "^1.2.11", From 8d10d622cc640ca0c6492a2af24e2e6dd5d1424b Mon Sep 17 00:00:00 2001 From: Patrick Sachmann <20001160+psachmann@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:37:14 +0100 Subject: [PATCH 14/26] adding dev dependency --- package-lock.json | 290 +++++++++++++++++++++++++++++++++++++--------- package.json | 2 +- 2 files changed, 237 insertions(+), 55 deletions(-) diff --git a/package-lock.json b/package-lock.json index 157f1641ae..71bae2b35c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,6 @@ "mobile-drag-drop": "^3.0.0-rc.0", "object-hash": "^3.0.0", "pinia": "^2.1.7", - "rimraf": "^3.0.2", "socket.io-client": "^4.7.5", "sortablejs": "^1.15.2", "sortablejs-vue3": "^1.2.11", @@ -74,6 +73,7 @@ "jest-transform-stub": "^2.0.0", "prettier": "^3.2.5", "resize-observer-polyfill": "^1.5.1", + "rimraf": "^3.0.2", "sass": "^1.77.8", "sass-loader": "^16.0.0", "ts-jest": "^29.1.2", @@ -2775,6 +2775,17 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/@jest/reporters/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/@jest/reporters/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2812,6 +2823,28 @@ "dev": true, "license": "MIT" }, + "node_modules/@jest/reporters/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@jest/reporters/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2839,6 +2872,19 @@ "node": ">=10" } }, + "node_modules/@jest/reporters/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@jest/reporters/node_modules/semver": { "version": "7.6.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", @@ -5537,6 +5583,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, "license": "MIT" }, "node_modules/base64-js": { @@ -6295,6 +6342,7 @@ "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, "license": "MIT" }, "node_modules/concurrently": { @@ -8707,6 +8755,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, "license": "ISC" }, "node_modules/fsevents": { @@ -8819,27 +8868,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -8860,28 +8888,6 @@ "devOptional": true, "license": "BSD-2-Clause" }, - "node_modules/glob/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/glob/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/globals": { "version": "15.10.0", "resolved": "https://registry.npmjs.org/globals/-/globals-15.10.0.tgz", @@ -9489,6 +9495,7 @@ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, "license": "ISC", "dependencies": { "once": "^1.3.0", @@ -9499,6 +9506,7 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, "license": "ISC" }, "node_modules/ini": { @@ -10528,6 +10536,17 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/jest-config/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/jest-config/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -10565,6 +10584,28 @@ "dev": true, "license": "MIT" }, + "node_modules/jest-config/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/jest-config/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -10575,6 +10616,19 @@ "node": ">=8" } }, + "node_modules/jest-config/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/jest-config/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -11384,6 +11438,17 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/jest-runtime/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/jest-runtime/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -11421,6 +11486,28 @@ "dev": true, "license": "MIT" }, + "node_modules/jest-runtime/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/jest-runtime/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -11431,6 +11518,19 @@ "node": ">=8" } }, + "node_modules/jest-runtime/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/jest-runtime/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -11964,6 +12064,16 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/js-beautify/node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/js-beautify/node_modules/nopt": { "version": "7.2.1", "resolved": "https://registry.npmjs.org/nopt/-/nopt-7.2.1.tgz", @@ -12704,16 +12814,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, "node_modules/minizlib": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", @@ -13131,6 +13231,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -13470,6 +13571,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -13515,6 +13617,16 @@ "dev": true, "license": "ISC" }, + "node_modules/path-scurry/node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/path-to-regexp": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-3.3.0.tgz", @@ -14365,6 +14477,7 @@ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, "license": "ISC", "dependencies": { "glob": "^7.1.3" @@ -14376,6 +14489,52 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rimraf/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/rimraf/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/run-applescript": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", @@ -15507,6 +15666,28 @@ "concat-map": "0.0.1" } }, + "node_modules/test-exclude/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/test-exclude/node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -17277,6 +17458,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, "license": "ISC" }, "node_modules/write-file-atomic": { diff --git a/package.json b/package.json index b53eb981e1..eb90be0f92 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "mobile-drag-drop": "^3.0.0-rc.0", "object-hash": "^3.0.0", "pinia": "^2.1.7", - "rimraf": "^3.0.2", "socket.io-client": "^4.7.5", "sortablejs": "^1.15.2", "sortablejs-vue3": "^1.2.11", @@ -86,6 +85,7 @@ "jest-transform-stub": "^2.0.0", "prettier": "^3.2.5", "resize-observer-polyfill": "^1.5.1", + "rimraf": "^3.0.2", "sass": "^1.77.8", "sass-loader": "^16.0.0", "ts-jest": "^29.1.2", From 81d4faadc335f55444827256d15484d563068e14 Mon Sep 17 00:00:00 2001 From: Patrick Sachmann <20001160+psachmann@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:41:20 +0100 Subject: [PATCH 15/26] updating package.json --- package-lock.json | 1 - package.json | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 71bae2b35c..475ad48429 100644 --- a/package-lock.json +++ b/package-lock.json @@ -73,7 +73,6 @@ "jest-transform-stub": "^2.0.0", "prettier": "^3.2.5", "resize-observer-polyfill": "^1.5.1", - "rimraf": "^3.0.2", "sass": "^1.77.8", "sass-loader": "^16.0.0", "ts-jest": "^29.1.2", diff --git a/package.json b/package.json index eb90be0f92..c1ffb35832 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "generate-client:server": "node generate-client.js -c openapitools-for-server.json", "generate-client:filestorage": "node generate-client.js -u 'http://localhost:4444/api/v3/docs-json/' -p 'src/fileStorageApi/v3' -c 'openapitools-for-file-storage.json'", "generate-client:h5p-editor": "node generate-client.js -u 'http://localhost:4448/api/v3/docs-json/' -p 'src/h5pEditorApi/v3' -c 'openapitools-for-h5p-editor.json'", - "pregenerate-client:common-cartridge": "rimraf ./src/commonCartridgeApi/v3", + "pregenerate-client:common-cartridge": "rm -rf ./src/commonCartridgeApi/v3", "generate-client:common-cartridge": "openapi-generator-cli generate -c ./openapitools.json --generator-key common-cartridge-api" }, "dependencies": { @@ -85,7 +85,6 @@ "jest-transform-stub": "^2.0.0", "prettier": "^3.2.5", "resize-observer-polyfill": "^1.5.1", - "rimraf": "^3.0.2", "sass": "^1.77.8", "sass-loader": "^16.0.0", "ts-jest": "^29.1.2", From 0578f51754da257ca1aee41c3c98d5704fc1a813 Mon Sep 17 00:00:00 2001 From: Patrick Sachmann <20001160+psachmann@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:26:07 +0100 Subject: [PATCH 16/26] fixing unit tests --- src/store/course-room-details.ts | 38 +++++++++++++++------------ src/store/course-room-details.unit.ts | 34 +++++++++++------------- 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/src/store/course-room-details.ts b/src/store/course-room-details.ts index 9f97d3d975..998a413f17 100644 --- a/src/store/course-room-details.ts +++ b/src/store/course-room-details.ts @@ -19,7 +19,10 @@ import { Action, Module, Mutation, VuexModule } from "vuex-module-decorators"; import { BusinessError } from "./types/commons"; import { HttpStatusCode } from "./types/http-status-code.enum"; import { Course } from "./types/room"; -import { CommonCartridgeApiFactory } from "@/commonCartridgeApi/v3"; +import { + CommonCartridgeApiFactory, + CommonCartridgeApiInterface, +} from "@/commonCartridgeApi/v3"; @Module({ name: "courseRoomDetailsModule", @@ -53,6 +56,10 @@ export default class CourseRoomDetailsModule extends VuexModule { return LessonApiFactory(undefined, "/v3", $axios); } + public getCommonCartridgeApi(): CommonCartridgeApiInterface { + return CommonCartridgeApiFactory(undefined, "/v3", $axios); + } + @Action async fetchCourse(courseId: string): Promise { this.setLoading(true); @@ -199,22 +206,19 @@ export default class CourseRoomDetailsModule extends VuexModule { }): Promise { this.resetBusinessError(); try { - const response = await CommonCartridgeApiFactory( - undefined, - "v3", - $axios - ).commonCartridgeControllerExportCourse( - this.roomData.roomId, - exportSettings.version, - { - topics: exportSettings.topics, - tasks: exportSettings.tasks, - columnBoards: exportSettings.columnBoards, - }, - { - responseType: "blob", - } - ); + const response = + await this.getCommonCartridgeApi().commonCartridgeControllerExportCourse( + this.roomData.roomId, + exportSettings.version, + { + topics: exportSettings.topics, + tasks: exportSettings.tasks, + columnBoards: exportSettings.columnBoards, + }, + { + responseType: "blob", + } + ); // const response = await CoursesApiFactory( // undefined, // "v3", diff --git a/src/store/course-room-details.unit.ts b/src/store/course-room-details.unit.ts index 9ea056eef7..b56e1b3c9c 100644 --- a/src/store/course-room-details.unit.ts +++ b/src/store/course-room-details.unit.ts @@ -387,12 +387,14 @@ describe("course-room module", () => { describe("downloadCommonCartridgeCourse", () => { it("should call backend api", async () => { const courseRoomDetailsModule = new CourseRoomDetailsModule({}); - const spy = jest - .spyOn( - CommonCartridgeApiFactory(), - "commonCartridgeControllerExportCourse" - ) - .mockReturnValue(Promise.resolve() as unknown as AxiosPromise); + + jest + .spyOn(courseRoomDetailsModule, "getCommonCartridgeApi") + .mockReturnValue({ + commonCartridgeControllerExportCourse: jest.fn( + () => Promise.resolve() as unknown as AxiosPromise + ), + }); await expect( courseRoomDetailsModule.downloadCommonCartridgeCourse({ @@ -402,20 +404,18 @@ describe("course-room module", () => { columnBoards: [], }) ).resolves.not.toBeDefined(); - - spy.mockRestore(); }); it("should catch error in catch block", async () => { const courseRoomDetailsModule = new CourseRoomDetailsModule({}); const error = { statusCode: 418, message: "I'm a teapot" }; - const spy = jest - .spyOn( - CommonCartridgeApiFactory(), - "commonCartridgeControllerExportCourse" - ) - .mockReturnValue( - Promise.reject(error) as unknown as AxiosPromise - ); + + jest + .spyOn(courseRoomDetailsModule, "getCommonCartridgeApi") + .mockReturnValue({ + commonCartridgeControllerExportCourse: jest.fn(() => + Promise.reject(error) + ), + }); await courseRoomDetailsModule.downloadCommonCartridgeCourse({ version: "1.1.0", @@ -425,8 +425,6 @@ describe("course-room module", () => { }); expect(courseRoomDetailsModule.businessError).toStrictEqual(error); - - spy.mockRestore(); }); }); From fb8f5a7df4fc795d57e21d36b53182ef4e909434 Mon Sep 17 00:00:00 2001 From: Patrick Sachmann <20001160+psachmann@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:42:28 +0100 Subject: [PATCH 17/26] updating sonarcloud properties --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index d6ac3c6e56..795558ec95 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,7 +1,7 @@ sonar.organization=schulcloud-verbund sonar.projectKey=hpi-schul-cloud_nuxt-client sonar.sources=. -sonar.exclusions=src/serverApi/**/*.*,src/fileStorageApi/**/*.*,src/h5pEditorApi/**/*.*,**/themes/**.ts +sonar.exclusions=src/serverApi/**/*.*,src/fileStorageApi/**/*.*,src/h5pEditorApi/**/*.*,src/commonCartridgeApi/**/*.***/themes/**.ts sonar.coverage.exclusions=tests/**/*.*,**/*.unit.ts,**/*.unit.js,**/themes/**.ts,eslint.config.js,src/main.ts,src/plugins/vuetify.ts sonar.cpd.exclusions=**/locales/**.ts,tests/**/*.*,**/*.unit.ts,**/*.unit.js,**/themes/**.ts sonar.javascript.lcov.reportPaths=./coverage/lcov.info \ No newline at end of file From b6e402b5c642d7521cb04dc742b803ea0eb96cf1 Mon Sep 17 00:00:00 2001 From: Patrick Sachmann <20001160+psachmann@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:01:47 +0100 Subject: [PATCH 18/26] working on test coverage --- src/store/course-room-details.unit.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/store/course-room-details.unit.ts b/src/store/course-room-details.unit.ts index b56e1b3c9c..2fb367b0bb 100644 --- a/src/store/course-room-details.unit.ts +++ b/src/store/course-room-details.unit.ts @@ -817,5 +817,15 @@ describe("course-room module", () => { ); }); }); + + describe("getCommonCartridgeApi", () => { + it("should return the CommonCartridgeApiInterface", () => { + const courseRoomDetailsModule = new CourseRoomDetailsModule({}); + + const result = courseRoomDetailsModule.getCommonCartridgeApi(); + + expect(result).toBeInstanceOf(Object); + }); + }); }); }); From 82ef11c5cf7f489958c9893489194a87aac37e73 Mon Sep 17 00:00:00 2001 From: Patrick Sachmann <20001160+psachmann@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:07:32 +0100 Subject: [PATCH 19/26] removing comments --- src/store/course-room-details.ts | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/store/course-room-details.ts b/src/store/course-room-details.ts index 998a413f17..547a608934 100644 --- a/src/store/course-room-details.ts +++ b/src/store/course-room-details.ts @@ -219,22 +219,7 @@ export default class CourseRoomDetailsModule extends VuexModule { responseType: "blob", } ); - // const response = await CoursesApiFactory( - // undefined, - // "v3", - // $axios - // ).courseControllerExportCourse( - // this.roomData.roomId, - // exportSettings.version, - // { - // topics: exportSettings.topics, - // tasks: exportSettings.tasks, - // columnBoards: exportSettings.columnBoards, - // }, - // { - // responseType: "blob", - // } - // ); + const link = document.createElement("a"); link.href = URL.createObjectURL( new Blob([response.data as unknown as Blob]) From 055c6272d08c872f7258e7c4da335399c8653c1b Mon Sep 17 00:00:00 2001 From: Patrick Sachmann <20001160+psachmann@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:20:01 +0100 Subject: [PATCH 20/26] updating sonar properties --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 795558ec95..cd26cc3f4b 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,7 +1,7 @@ sonar.organization=schulcloud-verbund sonar.projectKey=hpi-schul-cloud_nuxt-client sonar.sources=. -sonar.exclusions=src/serverApi/**/*.*,src/fileStorageApi/**/*.*,src/h5pEditorApi/**/*.*,src/commonCartridgeApi/**/*.***/themes/**.ts +sonar.exclusions=src/serverApi/**/*.*,src/fileStorageApi/**/*.*,src/h5pEditorApi/**/*.*,src/commonCartridgeApi/**/*.*,**/themes/**.ts sonar.coverage.exclusions=tests/**/*.*,**/*.unit.ts,**/*.unit.js,**/themes/**.ts,eslint.config.js,src/main.ts,src/plugins/vuetify.ts sonar.cpd.exclusions=**/locales/**.ts,tests/**/*.*,**/*.unit.ts,**/*.unit.js,**/themes/**.ts sonar.javascript.lcov.reportPaths=./coverage/lcov.info \ No newline at end of file From d9bfe2dfc4d0ce79ccad100283584bb5148211c5 Mon Sep 17 00:00:00 2001 From: Patrick Sachmann <20001160+psachmann@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:29:29 +0100 Subject: [PATCH 21/26] some logging --- src/store/course-room-details.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/store/course-room-details.ts b/src/store/course-room-details.ts index 547a608934..6370ca8200 100644 --- a/src/store/course-room-details.ts +++ b/src/store/course-room-details.ts @@ -205,7 +205,9 @@ export default class CourseRoomDetailsModule extends VuexModule { columnBoards: string[]; }): Promise { this.resetBusinessError(); + console.log("exportSettings", exportSettings); try { + console.log("making the request"); const response = await this.getCommonCartridgeApi().commonCartridgeControllerExportCourse( this.roomData.roomId, @@ -220,6 +222,8 @@ export default class CourseRoomDetailsModule extends VuexModule { } ); + console.log("response", response); + const link = document.createElement("a"); link.href = URL.createObjectURL( new Blob([response.data as unknown as Blob]) From 7e3b37f58a0955807cb4e9c16d29390baa7420dc Mon Sep 17 00:00:00 2001 From: Patrick Sachmann <20001160+psachmann@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:37:23 +0100 Subject: [PATCH 22/26] adding some logging --- src/store/course-room-details.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/store/course-room-details.ts b/src/store/course-room-details.ts index 6370ca8200..cb536565bc 100644 --- a/src/store/course-room-details.ts +++ b/src/store/course-room-details.ts @@ -234,6 +234,8 @@ export default class CourseRoomDetailsModule extends VuexModule { link.click(); URL.revokeObjectURL(link.href); } catch (error: any) { + console.log("error", error); + this.setBusinessError({ statusCode: error?.response?.status, message: error?.response?.statusText, From 4d93f64bdbfd2256e1d57615c57660c96e924e5f Mon Sep 17 00:00:00 2001 From: Firas Shmit Date: Tue, 17 Dec 2024 16:20:49 +0100 Subject: [PATCH 23/26] try getter --- src/store/course-room-details.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/store/course-room-details.ts b/src/store/course-room-details.ts index 547a608934..c530005f7c 100644 --- a/src/store/course-room-details.ts +++ b/src/store/course-room-details.ts @@ -56,7 +56,7 @@ export default class CourseRoomDetailsModule extends VuexModule { return LessonApiFactory(undefined, "/v3", $axios); } - public getCommonCartridgeApi(): CommonCartridgeApiInterface { + public get getCommonCartridgeApi(): CommonCartridgeApiInterface { return CommonCartridgeApiFactory(undefined, "/v3", $axios); } @@ -207,7 +207,7 @@ export default class CourseRoomDetailsModule extends VuexModule { this.resetBusinessError(); try { const response = - await this.getCommonCartridgeApi().commonCartridgeControllerExportCourse( + await this.getCommonCartridgeApi.commonCartridgeControllerExportCourse( this.roomData.roomId, exportSettings.version, { From 7a62ddcd42423c7fb830a0426b397bc13843d9ce Mon Sep 17 00:00:00 2001 From: Patrick Sachmann <20001160+psachmann@users.noreply.github.com> Date: Wed, 18 Dec 2024 09:16:22 +0100 Subject: [PATCH 24/26] changing openapi generator version --- openapitools.json | 2 +- package.json | 1 - .../v3/.openapi-generator/VERSION | 2 +- .../v3/api/common-cartridge-api.ts | 47 +++++++----------- src/commonCartridgeApi/v3/base.ts | 25 ++-------- src/commonCartridgeApi/v3/common.ts | 48 +++++++------------ src/commonCartridgeApi/v3/configuration.ts | 9 ---- src/commonCartridgeApi/v3/git_push.sh | 7 +-- .../v3/models/course-export-body-params.ts | 7 +-- 9 files changed, 49 insertions(+), 99 deletions(-) diff --git a/openapitools.json b/openapitools.json index 869cd66688..e0b1bc018c 100644 --- a/openapitools.json +++ b/openapitools.json @@ -2,7 +2,7 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "7.6.0", + "version": "5.1.0", "generators": { "common-cartridge-api": { "generatorName": "typescript-axios", diff --git a/package.json b/package.json index c1ffb35832..3569a7adeb 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,6 @@ "generate-client:server": "node generate-client.js -c openapitools-for-server.json", "generate-client:filestorage": "node generate-client.js -u 'http://localhost:4444/api/v3/docs-json/' -p 'src/fileStorageApi/v3' -c 'openapitools-for-file-storage.json'", "generate-client:h5p-editor": "node generate-client.js -u 'http://localhost:4448/api/v3/docs-json/' -p 'src/h5pEditorApi/v3' -c 'openapitools-for-h5p-editor.json'", - "pregenerate-client:common-cartridge": "rm -rf ./src/commonCartridgeApi/v3", "generate-client:common-cartridge": "openapi-generator-cli generate -c ./openapitools.json --generator-key common-cartridge-api" }, "dependencies": { diff --git a/src/commonCartridgeApi/v3/.openapi-generator/VERSION b/src/commonCartridgeApi/v3/.openapi-generator/VERSION index 93c8ddab9f..acf69b48b8 100644 --- a/src/commonCartridgeApi/v3/.openapi-generator/VERSION +++ b/src/commonCartridgeApi/v3/.openapi-generator/VERSION @@ -1 +1 @@ -7.6.0 +5.1.0 \ No newline at end of file diff --git a/src/commonCartridgeApi/v3/api/common-cartridge-api.ts b/src/commonCartridgeApi/v3/api/common-cartridge-api.ts index 97bc107c92..ee596fb7fe 100644 --- a/src/commonCartridgeApi/v3/api/common-cartridge-api.ts +++ b/src/commonCartridgeApi/v3/api/common-cartridge-api.ts @@ -13,16 +13,15 @@ */ -import type { Configuration } from '../configuration'; -import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; -import globalAxios from 'axios'; +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import { Configuration } from '../configuration'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; // @ts-ignore -import type { CourseExportBodyParams } from '../models'; +import { CourseExportBodyParams } from '../models'; /** * CommonCartridgeApi - axios parameter creator * @export @@ -32,12 +31,12 @@ export const CommonCartridgeApiAxiosParamCreator = function (configuration?: Con /** * * @param {string} courseId - * @param {CommonCartridgeControllerExportCourseVersion} version The version of CC export + * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export * @param {CourseExportBodyParams} courseExportBodyParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ - commonCartridgeControllerExportCourse: async (courseId: string, version: CommonCartridgeControllerExportCourseVersion, courseExportBodyParams: CourseExportBodyParams, options: RawAxiosRequestConfig = {}): Promise => { + commonCartridgeControllerExportCourse: async (courseId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options: any = {}): Promise => { // verify required parameter 'courseId' is not null or undefined assertParamExists('commonCartridgeControllerExportCourse', 'courseId', courseId) // verify required parameter 'version' is not null or undefined @@ -65,7 +64,7 @@ export const CommonCartridgeApiAxiosParamCreator = function (configuration?: Con localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter); + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(courseExportBodyParams, localVarRequestOptions, configuration) @@ -88,16 +87,14 @@ export const CommonCartridgeApiFp = function(configuration?: Configuration) { /** * * @param {string} courseId - * @param {CommonCartridgeControllerExportCourseVersion} version The version of CC export + * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export * @param {CourseExportBodyParams} courseExportBodyParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async commonCartridgeControllerExportCourse(courseId: string, version: CommonCartridgeControllerExportCourseVersion, courseExportBodyParams: CourseExportBodyParams, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async commonCartridgeControllerExportCourse(courseId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.commonCartridgeControllerExportCourse(courseId, version, courseExportBodyParams, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['CommonCartridgeApi.commonCartridgeControllerExportCourse']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; @@ -112,12 +109,12 @@ export const CommonCartridgeApiFactory = function (configuration?: Configuration /** * * @param {string} courseId - * @param {CommonCartridgeControllerExportCourseVersion} version The version of CC export + * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export * @param {CourseExportBodyParams} courseExportBodyParams * @param {*} [options] Override http request option. * @throws {RequiredError} */ - commonCartridgeControllerExportCourse(courseId: string, version: CommonCartridgeControllerExportCourseVersion, courseExportBodyParams: CourseExportBodyParams, options?: any): AxiosPromise { + commonCartridgeControllerExportCourse(courseId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): AxiosPromise { return localVarFp.commonCartridgeControllerExportCourse(courseId, version, courseExportBodyParams, options).then((request) => request(axios, basePath)); }, }; @@ -132,13 +129,13 @@ export interface CommonCartridgeApiInterface { /** * * @param {string} courseId - * @param {CommonCartridgeControllerExportCourseVersion} version The version of CC export + * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export * @param {CourseExportBodyParams} courseExportBodyParams * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonCartridgeApiInterface */ - commonCartridgeControllerExportCourse(courseId: string, version: CommonCartridgeControllerExportCourseVersion, courseExportBodyParams: CourseExportBodyParams, options?: RawAxiosRequestConfig): AxiosPromise; + commonCartridgeControllerExportCourse(courseId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any): AxiosPromise; } @@ -152,25 +149,13 @@ export class CommonCartridgeApi extends BaseAPI implements CommonCartridgeApiInt /** * * @param {string} courseId - * @param {CommonCartridgeControllerExportCourseVersion} version The version of CC export + * @param {'1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0'} version The version of CC export * @param {CourseExportBodyParams} courseExportBodyParams * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonCartridgeApi */ - public commonCartridgeControllerExportCourse(courseId: string, version: CommonCartridgeControllerExportCourseVersion, courseExportBodyParams: CourseExportBodyParams, options?: RawAxiosRequestConfig) { + public commonCartridgeControllerExportCourse(courseId: string, version: '1.0.0' | '1.1.0' | '1.2.0' | '1.3.0' | '1.4.0', courseExportBodyParams: CourseExportBodyParams, options?: any) { return CommonCartridgeApiFp(this.configuration).commonCartridgeControllerExportCourse(courseId, version, courseExportBodyParams, options).then((request) => request(this.axios, this.basePath)); } } - -/** - * @export - */ -export const CommonCartridgeControllerExportCourseVersion = { - _0_0: '1.0.0', - _1_0: '1.1.0', - _2_0: '1.2.0', - _3_0: '1.3.0', - _4_0: '1.4.0' -} as const; -export type CommonCartridgeControllerExportCourseVersion = typeof CommonCartridgeControllerExportCourseVersion[keyof typeof CommonCartridgeControllerExportCourseVersion]; diff --git a/src/commonCartridgeApi/v3/base.ts b/src/commonCartridgeApi/v3/base.ts index 9adfe7a71e..04e7c6ea9a 100644 --- a/src/commonCartridgeApi/v3/base.ts +++ b/src/commonCartridgeApi/v3/base.ts @@ -13,11 +13,10 @@ */ -import type { Configuration } from './configuration'; +import { Configuration } from "./configuration"; // Some imports not used depending on template conditions // @ts-ignore -import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; -import globalAxios from 'axios'; +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; export const BASE_PATH = "http://localhost:3350/api/v3".replace(/\/+$/, ""); @@ -39,7 +38,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: RawAxiosRequestConfig; + options: any; } /** @@ -53,7 +52,7 @@ export class BaseAPI { constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { if (configuration) { this.configuration = configuration; - this.basePath = configuration.basePath ?? basePath; + this.basePath = configuration.basePath || this.basePath; } } }; @@ -65,22 +64,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); - this.name = "RequiredError" } } - -interface ServerMap { - [key: string]: { - url: string, - description: string, - }[]; -} - -/** - * - * @export - */ -export const operationServerMap: ServerMap = { -} diff --git a/src/commonCartridgeApi/v3/common.ts b/src/commonCartridgeApi/v3/common.ts index 6c119efb60..927bdf8400 100644 --- a/src/commonCartridgeApi/v3/common.ts +++ b/src/commonCartridgeApi/v3/common.ts @@ -13,10 +13,9 @@ */ -import type { Configuration } from "./configuration"; -import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; -import { RequiredError } from "./base"; +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance } from 'axios'; /** * @@ -84,35 +83,24 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } -function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { - if (parameter == null) return; - if (typeof parameter === "object") { - if (Array.isArray(parameter)) { - (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); - } - else { - Object.keys(parameter).forEach(currentKey => - setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) - ); - } - } - else { - if (urlSearchParams.has(key)) { - urlSearchParams.append(key, parameter); - } - else { - urlSearchParams.set(key, parameter); - } - } -} - /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - setFlattenedQueryParams(searchParams, objects); + for (const object of objects) { + for (const key in object) { + if (Array.isArray(object[key])) { + searchParams.delete(key); + for (const item of object[key]) { + searchParams.append(key, item); + } + } else { + searchParams.set(key, object[key]); + } + } + } url.search = searchParams.toString(); } @@ -143,8 +131,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); }; } diff --git a/src/commonCartridgeApi/v3/configuration.ts b/src/commonCartridgeApi/v3/configuration.ts index 8c97d307cf..ce202f21c6 100644 --- a/src/commonCartridgeApi/v3/configuration.ts +++ b/src/commonCartridgeApi/v3/configuration.ts @@ -19,7 +19,6 @@ export interface ConfigurationParameters { password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); basePath?: string; - serverIndex?: number; baseOptions?: any; formDataCtor?: new () => any; } @@ -59,13 +58,6 @@ export class Configuration { * @memberof Configuration */ basePath?: string; - /** - * override server index - * - * @type {number} - * @memberof Configuration - */ - serverIndex?: number; /** * base options for axios calls * @@ -88,7 +80,6 @@ export class Configuration { this.password = param.password; this.accessToken = param.accessToken; this.basePath = param.basePath; - this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; this.formDataCtor = param.formDataCtor; } diff --git a/src/commonCartridgeApi/v3/git_push.sh b/src/commonCartridgeApi/v3/git_push.sh index f53a75d4fa..ced3be2b0c 100644 --- a/src/commonCartridgeApi/v3/git_push.sh +++ b/src/commonCartridgeApi/v3/git_push.sh @@ -1,7 +1,7 @@ #!/bin/sh # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" git_user_id=$1 git_repo_id=$2 @@ -38,14 +38,14 @@ git add . git commit -m "$release_note" # Sets the new remote -git_remote=$(git remote) +git_remote=`git remote` if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git fi fi @@ -55,3 +55,4 @@ git pull origin master # Pushes (Forces) the changes in the local repository up to the remote repository echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" git push origin master 2>&1 | grep -v 'To https' + diff --git a/src/commonCartridgeApi/v3/models/course-export-body-params.ts b/src/commonCartridgeApi/v3/models/course-export-body-params.ts index 7fe921f621..7bdbce2ac9 100644 --- a/src/commonCartridgeApi/v3/models/course-export-body-params.ts +++ b/src/commonCartridgeApi/v3/models/course-export-body-params.ts @@ -25,18 +25,19 @@ export interface CourseExportBodyParams { * @type {Array} * @memberof CourseExportBodyParams */ - 'topics': Array; + topics: Array; /** * The list of ids of tasks which should be exported. If empty no tasks are exported. * @type {Array} * @memberof CourseExportBodyParams */ - 'tasks': Array; + tasks: Array; /** * The list of ids of column boards which should be exported. If empty no column boards are exported. * @type {Array} * @memberof CourseExportBodyParams */ - 'columnBoards': Array; + columnBoards: Array; } + From 9f15e8ff44ad3ec9966f45721b2181f7e04d84de Mon Sep 17 00:00:00 2001 From: Patrick Sachmann <20001160+psachmann@users.noreply.github.com> Date: Wed, 18 Dec 2024 09:54:19 +0100 Subject: [PATCH 25/26] fixing unit tests --- src/store/course-room-details.ts | 4 +-- src/store/course-room-details.unit.ts | 45 ++++++++++++++++----------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/store/course-room-details.ts b/src/store/course-room-details.ts index 388fb32dd2..712e556087 100644 --- a/src/store/course-room-details.ts +++ b/src/store/course-room-details.ts @@ -56,7 +56,7 @@ export default class CourseRoomDetailsModule extends VuexModule { return LessonApiFactory(undefined, "/v3", $axios); } - public get getCommonCartridgeApi(): CommonCartridgeApiInterface { + public get commonCartridgeApi(): CommonCartridgeApiInterface { return CommonCartridgeApiFactory(undefined, "/v3", $axios); } @@ -209,7 +209,7 @@ export default class CourseRoomDetailsModule extends VuexModule { try { console.log("making the request"); const response = - await this.getCommonCartridgeApi.commonCartridgeControllerExportCourse( + await this.commonCartridgeApi.commonCartridgeControllerExportCourse( this.roomData.roomId, exportSettings.version, { diff --git a/src/store/course-room-details.unit.ts b/src/store/course-room-details.unit.ts index 2fb367b0bb..2b634e39fe 100644 --- a/src/store/course-room-details.unit.ts +++ b/src/store/course-room-details.unit.ts @@ -1,5 +1,6 @@ import * as serverApi from "@/serverApi/v3/api"; -import { CommonCartridgeApiFactory } from "@/commonCartridgeApi/v3/api"; +import * as commonCartridgeApi from "@/commonCartridgeApi/v3/api/common-cartridge-api"; +import { CommonCartridgeApiInterface } from "@/commonCartridgeApi/v3/api"; import { BoardParentType } from "@/serverApi/v3/api"; import { applicationErrorModule, authModule } from "@/store"; import ApplicationErrorModule from "@/store/application-error"; @@ -387,14 +388,14 @@ describe("course-room module", () => { describe("downloadCommonCartridgeCourse", () => { it("should call backend api", async () => { const courseRoomDetailsModule = new CourseRoomDetailsModule({}); - - jest - .spyOn(courseRoomDetailsModule, "getCommonCartridgeApi") - .mockReturnValue({ - commonCartridgeControllerExportCourse: jest.fn( - () => Promise.resolve() as unknown as AxiosPromise - ), - }); + const mockApi: CommonCartridgeApiInterface = { + commonCartridgeControllerExportCourse: jest.fn( + () => Promise.resolve() as unknown as AxiosPromise + ), + }; + const spy = jest + .spyOn(commonCartridgeApi, "CommonCartridgeApiFactory") + .mockReturnValue(mockApi); await expect( courseRoomDetailsModule.downloadCommonCartridgeCourse({ @@ -404,18 +405,24 @@ describe("course-room module", () => { columnBoards: [], }) ).resolves.not.toBeDefined(); + + expect( + mockApi.commonCartridgeControllerExportCourse + ).toHaveBeenCalled(); + + spy.mockRestore(); }); it("should catch error in catch block", async () => { const courseRoomDetailsModule = new CourseRoomDetailsModule({}); const error = { statusCode: 418, message: "I'm a teapot" }; - - jest - .spyOn(courseRoomDetailsModule, "getCommonCartridgeApi") - .mockReturnValue({ - commonCartridgeControllerExportCourse: jest.fn(() => - Promise.reject(error) - ), - }); + const mockApi: CommonCartridgeApiInterface = { + commonCartridgeControllerExportCourse: jest.fn(() => + Promise.reject(error) + ), + }; + const spy = jest + .spyOn(commonCartridgeApi, "CommonCartridgeApiFactory") + .mockReturnValue(mockApi); await courseRoomDetailsModule.downloadCommonCartridgeCourse({ version: "1.1.0", @@ -425,6 +432,8 @@ describe("course-room module", () => { }); expect(courseRoomDetailsModule.businessError).toStrictEqual(error); + + spy.mockRestore(); }); }); @@ -822,7 +831,7 @@ describe("course-room module", () => { it("should return the CommonCartridgeApiInterface", () => { const courseRoomDetailsModule = new CourseRoomDetailsModule({}); - const result = courseRoomDetailsModule.getCommonCartridgeApi(); + const result = courseRoomDetailsModule.commonCartridgeApi; expect(result).toBeInstanceOf(Object); }); From dd29b1706c2597d05337f14f699a26242c6e84d3 Mon Sep 17 00:00:00 2001 From: Firas Shmit Date: Wed, 18 Dec 2024 14:48:55 +0100 Subject: [PATCH 26/26] EW-1060 removed console logs --- src/store/course-room-details.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/store/course-room-details.ts b/src/store/course-room-details.ts index 712e556087..f9312bcaaa 100644 --- a/src/store/course-room-details.ts +++ b/src/store/course-room-details.ts @@ -205,9 +205,7 @@ export default class CourseRoomDetailsModule extends VuexModule { columnBoards: string[]; }): Promise { this.resetBusinessError(); - console.log("exportSettings", exportSettings); try { - console.log("making the request"); const response = await this.commonCartridgeApi.commonCartridgeControllerExportCourse( this.roomData.roomId, @@ -222,8 +220,6 @@ export default class CourseRoomDetailsModule extends VuexModule { } ); - console.log("response", response); - const link = document.createElement("a"); link.href = URL.createObjectURL( new Blob([response.data as unknown as Blob]) @@ -234,8 +230,6 @@ export default class CourseRoomDetailsModule extends VuexModule { link.click(); URL.revokeObjectURL(link.href); } catch (error: any) { - console.log("error", error); - this.setBusinessError({ statusCode: error?.response?.status, message: error?.response?.statusText,