Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • jw_sonar
  • jw_sonar_backup
  • main
  • move-to-esm-only
  • open_tool_for_self_hosting
  • v5.0
  • v4.1
  • v4.2
8 results

Target

Select target project
  • dojo_project/projects/shared/nodesharedcode
1 result
Select Git revision
Show changes
Commits on Source (1)
......@@ -41,7 +41,7 @@ class ArchiveHelper {
}
public async getBase64(folderPath: string): Promise<string> {
let data: any;
let data: string;
const tarDataStream = new stream.Writable({
write(this: Writable, chunk: Buffer, _encoding: BufferEncoding, next: (error?: Error | null) => void) {
if ( data ) {
......@@ -55,9 +55,9 @@ class ArchiveHelper {
await this.compress(folderPath, tarDataStream);
await (new Promise((resolve, reject) => {
data = await (new Promise((resolve) => {
tarDataStream.on('close', () => {
resolve(0);
resolve(data);
});
}));
......
......@@ -48,7 +48,7 @@ class SharedAssignmentHelper {
const isValid = validator(results);
return {
results: isValid ? results : results as any,
results: isValid ? results : results as AssignmentFile,
isValid: isValid,
errors : validator.errors
};
......
......@@ -5,7 +5,7 @@ import JSON5 from 'json5';
class SharedExerciseHelper {
validateResultFile(resultsFilePathOrStr: string, isFile: boolean = true): { results: ExerciseResultsFile | undefined, isValid: boolean, errors: Array<ErrorObject<string, Record<string, any>, unknown> | string> | null | undefined } {
validateResultFile(resultsFilePathOrStr: string, isFile: boolean = true): { results: ExerciseResultsFile | undefined, isValid: boolean, errors: Array<ErrorObject | string> | null | undefined } {
const ajv = new Ajv();
const schema: JTDSchemaType<ExerciseResultsFile> = {
......@@ -49,7 +49,7 @@ class SharedExerciseHelper {
}
return {
results: isValid ? results : results as any,
results: isValid ? results : results as ExerciseResultsFile,
isValid: isValid,
errors : validator.errors
};
......
......@@ -4,12 +4,15 @@ class LazyVal<T> {
constructor(private valLoader: () => Promise<T> | T) {}
get value(): Promise<T> {
return new Promise<T>(async (resolve) => {
return new Promise<T>((resolve) => {
if ( this.val === undefined ) {
this.val = await this.valLoader();
}
Promise.resolve(this.valLoader()).then((value: T) => {
this.val = value;
resolve(value);
});
} else {
resolve(this.val);
}
});
}
......
......@@ -11,7 +11,7 @@ class Toolbox {
Source of getAllFiles and getTotalSize (modified for this project): https://coderrocketfuel.com/article/get-the-total-size-of-all-files-in-a-directory-using-node-js
*/
private async getAllFiles(dirPath: string, arrayOfFiles: Array<string> = []): Promise<Array<string>> {
let files = await fs.readdir(dirPath);
const files = await fs.readdir(dirPath);
await Promise.all(files.map(async file => {
if ( (await fs.stat(dirPath + '/' + file)).isDirectory() ) {
......@@ -22,7 +22,7 @@ class Toolbox {
}));
return arrayOfFiles;
};
}
private async getTotalSize(directoryPath: string): Promise<number> {
const arrayOfFiles = await this.getAllFiles(directoryPath);
......@@ -34,7 +34,7 @@ class Toolbox {
}
return totalSize;
};
}
get fs() {
return {
......
declare global {
interface BigInt {
toJSON: () => string;
}
interface Array<T> {
removeObjectDuplicates: (getProperty: (item: T) => any) => Array<T>;
removeObjectDuplicates: (getProperty: (item: T) => unknown) => Array<T>;
}
......@@ -22,15 +27,15 @@ function registerAll() {
}
function registerBigIntJson() {
(BigInt.prototype as any).toJSON = function () {
BigInt.prototype.toJSON = function () {
return this.toString();
};
}
function registerArrayRemoveObjectDuplicates() {
Array.prototype.removeObjectDuplicates = function <T>(this: Array<T>, getProperty: (item: T) => any): Array<T> {
Array.prototype.removeObjectDuplicates = function <T>(this: Array<T>, getProperty: (item: T) => unknown): Array<T> {
return this.reduce((accumulator: Array<T>, current: T) => {
if ( !accumulator.find((item: any) => getProperty(item) === getProperty(current)) ) {
if ( !accumulator.find((item: T) => getProperty(item) === getProperty(current)) ) {
accumulator.push(current);
}
return accumulator;
......
......@@ -131,7 +131,7 @@ class RecursiveFilesStats {
}
return stat;
};
}
/**
* Get ext
......
......@@ -11,7 +11,6 @@ class GitlabManager {
}
async getTokens(codeOrRefresh: string, isRefresh: boolean = false, clientSecret: string = ''): Promise<GitlabToken> {
try {
const response = await axios.post<GitlabToken>(SharedConfig.login.gitlab.url.token, {
client_id : SharedConfig.login.gitlab.client.id,
client_secret: clientSecret,
......@@ -22,9 +21,6 @@ class GitlabManager {
});
return response.data;
} catch ( error ) {
throw error;
}
}
async getRepositoryPipelines(repoId: number, branch: string = 'main'): Promise<Array<GitlabPipeline>> {
......
......@@ -3,8 +3,8 @@ enum GitlabRoute {
PROFILE_GET = '/user',
USERS_GET = '/users',
REPOSITORY_GET = '/projects/{{id}}',
REPOSITORY_CREATE = '/projects',
REPOSITORY_DELETE = '/projects/{{id}}',
REPOSITORY_CREATE = '/projects', // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
REPOSITORY_DELETE = '/projects/{{id}}', // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
REPOSITORY_EDIT = '/projects/{{id}}',
REPOSITORY_FORK = '/projects/{{id}}/fork',
REPOSITORY_MEMBER_ADD = '/projects/{{id}}/members',
......