From ad1225998fc712f33a5c50afdb0466337790f39d Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 30 May 2023 10:59:47 +0200 Subject: [PATCH 01/34] created migration to correct public key length --- .../0067-community_table_public_key_length.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 database/migrations/0067-community_table_public_key_length.ts diff --git a/database/migrations/0067-community_table_public_key_length.ts b/database/migrations/0067-community_table_public_key_length.ts new file mode 100644 index 000000000..b51a1e6e0 --- /dev/null +++ b/database/migrations/0067-community_table_public_key_length.ts @@ -0,0 +1,23 @@ +/* MIGRATION TO CORRECT THE PUBLIC KEY LENGTHS + * + * This migration corrects the length of the saved public keys to 32 as this is the length it is generated for. + */ + +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { + await queryFn('ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(32) NOT NULL;') + // TODO: it is unclear if this is actually nullable - the model defines "default: null, nullable: true", but the table seems to be created without nullability(?) + await queryFn( + 'ALTER TABLE `federated_communities` MODIFY COLUMN `public_key` binary(32) NULL DEFAULT NULL;', + ) +} + +export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { + await queryFn('ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(64) NOT NULL;') + // TODO: see above + await queryFn( + 'ALTER TABLE `federated_communities` MODIFY COLUMN `public_key` binary(64) NULL DEFAULT NULL;', + ) +} From fd5716f9375f6e2a3db03ec537eb84952cea024a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 30 May 2023 11:00:16 +0200 Subject: [PATCH 02/34] define new models for correct key-length --- .../Community.ts | 60 +++++++++++++++++++ .../FederatedCommunity.ts | 51 ++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 database/entity/0067-community_table_public_key_length/Community.ts create mode 100644 database/entity/0067-community_table_public_key_length/FederatedCommunity.ts diff --git a/database/entity/0067-community_table_public_key_length/Community.ts b/database/entity/0067-community_table_public_key_length/Community.ts new file mode 100644 index 000000000..382025c83 --- /dev/null +++ b/database/entity/0067-community_table_public_key_length/Community.ts @@ -0,0 +1,60 @@ +import { + BaseEntity, + Entity, + PrimaryGeneratedColumn, + Column, + CreateDateColumn, + UpdateDateColumn, +} from 'typeorm' + +@Entity('communities') +export class Community extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) + foreign: boolean + + @Column({ name: 'url', length: 255, nullable: false }) + url: string + + @Column({ name: 'public_key', type: 'binary', length: 32, nullable: false }) + publicKey: Buffer + + @Column({ + name: 'community_uuid', + type: 'char', + length: 36, + nullable: true, + collation: 'utf8mb4_unicode_ci', + }) + communityUuid: string | null + + @Column({ name: 'authenticated_at', type: 'datetime', nullable: true }) + authenticatedAt: Date | null + + @Column({ name: 'name', type: 'varchar', length: 40, nullable: true }) + name: string | null + + @Column({ name: 'description', type: 'varchar', length: 255, nullable: true }) + description: string | null + + @CreateDateColumn({ name: 'creation_date', type: 'datetime', nullable: true }) + creationDate: Date | null + + @CreateDateColumn({ + name: 'created_at', + type: 'datetime', + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) + createdAt: Date + + @UpdateDateColumn({ + name: 'updated_at', + type: 'datetime', + onUpdate: 'CURRENT_TIMESTAMP(3)', + nullable: true, + }) + updatedAt: Date | null +} diff --git a/database/entity/0067-community_table_public_key_length/FederatedCommunity.ts b/database/entity/0067-community_table_public_key_length/FederatedCommunity.ts new file mode 100644 index 000000000..7dd49a1d6 --- /dev/null +++ b/database/entity/0067-community_table_public_key_length/FederatedCommunity.ts @@ -0,0 +1,51 @@ +import { + BaseEntity, + Entity, + PrimaryGeneratedColumn, + Column, + CreateDateColumn, + UpdateDateColumn, +} from 'typeorm' + +@Entity('federated_communities') +export class FederatedCommunity extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) + foreign: boolean + + @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) + publicKey: Buffer + + @Column({ name: 'api_version', length: 10, nullable: false }) + apiVersion: string + + @Column({ name: 'end_point', length: 255, nullable: false }) + endPoint: string + + @Column({ name: 'last_announced_at', type: 'datetime', nullable: true }) + lastAnnouncedAt: Date | null + + @Column({ name: 'verified_at', type: 'datetime', nullable: true }) + verifiedAt: Date | null + + @Column({ name: 'last_error_at', type: 'datetime', nullable: true }) + lastErrorAt: Date | null + + @CreateDateColumn({ + name: 'created_at', + type: 'datetime', + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) + createdAt: Date + + @UpdateDateColumn({ + name: 'updated_at', + type: 'datetime', + onUpdate: 'CURRENT_TIMESTAMP(3)', + nullable: true, + }) + updatedAt: Date | null +} From 1d9e5e1bf19d221960eec789491d0ecf5f389e44 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 30 May 2023 11:01:04 +0200 Subject: [PATCH 03/34] corrected entity links --- database/entity/Community.ts | 2 +- database/entity/FederatedCommunity.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/database/entity/Community.ts b/database/entity/Community.ts index ee08323b6..05361cfbf 100644 --- a/database/entity/Community.ts +++ b/database/entity/Community.ts @@ -1 +1 @@ -export { Community } from './0065-refactor_communities_table/Community' +export { Community } from './0067-community_table_public_key_length/Community' diff --git a/database/entity/FederatedCommunity.ts b/database/entity/FederatedCommunity.ts index cacaaff9c..b2b6e23fa 100644 --- a/database/entity/FederatedCommunity.ts +++ b/database/entity/FederatedCommunity.ts @@ -1 +1 @@ -export { FederatedCommunity } from './0065-refactor_communities_table/FederatedCommunity' +export { FederatedCommunity } from './0067-community_table_public_key_length/FederatedCommunity' From 0431e40e488de5bee410a3d09ec039fde6cea4e7 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 30 May 2023 11:01:55 +0200 Subject: [PATCH 04/34] updated required database version --- backend/src/config/index.ts | 2 +- dht-node/src/config/index.ts | 2 +- federation/src/config/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 8d1ed8ae6..dd092a532 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -12,7 +12,7 @@ Decimal.set({ }) const constants = { - DB_VERSION: '0066-x-community-sendcoins-transactions_table', + DB_VERSION: '0067-community_table_public_key_length', DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0 LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info diff --git a/dht-node/src/config/index.ts b/dht-node/src/config/index.ts index 43949201b..6d9c1fd46 100644 --- a/dht-node/src/config/index.ts +++ b/dht-node/src/config/index.ts @@ -3,7 +3,7 @@ import dotenv from 'dotenv' dotenv.config() const constants = { - DB_VERSION: '0066-x-community-sendcoins-transactions_table', + DB_VERSION: '0067-community_table_public_key_length', LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info LOG_LEVEL: process.env.LOG_LEVEL || 'info', diff --git a/federation/src/config/index.ts b/federation/src/config/index.ts index 66d8a056c..429a6cf9b 100644 --- a/federation/src/config/index.ts +++ b/federation/src/config/index.ts @@ -11,7 +11,7 @@ Decimal.set({ */ const constants = { - DB_VERSION: '0066-x-community-sendcoins-transactions_table', + DB_VERSION: '0067-community_table_public_key_length', // DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0 LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info From 2a48c34fd8e4efdb9c2643413bd75401126d24d8 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 30 May 2023 11:08:04 +0200 Subject: [PATCH 05/34] corrected migration name since two tables are affected --- backend/src/config/index.ts | 2 +- .../Community.ts | 0 .../FederatedCommunity.ts | 0 database/entity/Community.ts | 2 +- database/entity/FederatedCommunity.ts | 2 +- ...key_length.ts => 0067-community_tables_public_key_length.ts} | 0 dht-node/src/config/index.ts | 2 +- federation/src/config/index.ts | 2 +- 8 files changed, 5 insertions(+), 5 deletions(-) rename database/entity/{0067-community_table_public_key_length => 0067-community_tables_public_key_length}/Community.ts (100%) rename database/entity/{0067-community_table_public_key_length => 0067-community_tables_public_key_length}/FederatedCommunity.ts (100%) rename database/migrations/{0067-community_table_public_key_length.ts => 0067-community_tables_public_key_length.ts} (100%) diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index dd092a532..d12e5adad 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -12,7 +12,7 @@ Decimal.set({ }) const constants = { - DB_VERSION: '0067-community_table_public_key_length', + DB_VERSION: '0067-community_tables_public_key_length', DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0 LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info diff --git a/database/entity/0067-community_table_public_key_length/Community.ts b/database/entity/0067-community_tables_public_key_length/Community.ts similarity index 100% rename from database/entity/0067-community_table_public_key_length/Community.ts rename to database/entity/0067-community_tables_public_key_length/Community.ts diff --git a/database/entity/0067-community_table_public_key_length/FederatedCommunity.ts b/database/entity/0067-community_tables_public_key_length/FederatedCommunity.ts similarity index 100% rename from database/entity/0067-community_table_public_key_length/FederatedCommunity.ts rename to database/entity/0067-community_tables_public_key_length/FederatedCommunity.ts diff --git a/database/entity/Community.ts b/database/entity/Community.ts index 05361cfbf..ab877faa8 100644 --- a/database/entity/Community.ts +++ b/database/entity/Community.ts @@ -1 +1 @@ -export { Community } from './0067-community_table_public_key_length/Community' +export { Community } from './0067-community_tables_public_key_length/Community' diff --git a/database/entity/FederatedCommunity.ts b/database/entity/FederatedCommunity.ts index b2b6e23fa..3b636af09 100644 --- a/database/entity/FederatedCommunity.ts +++ b/database/entity/FederatedCommunity.ts @@ -1 +1 @@ -export { FederatedCommunity } from './0067-community_table_public_key_length/FederatedCommunity' +export { FederatedCommunity } from './0067-community_tables_public_key_length/FederatedCommunity' diff --git a/database/migrations/0067-community_table_public_key_length.ts b/database/migrations/0067-community_tables_public_key_length.ts similarity index 100% rename from database/migrations/0067-community_table_public_key_length.ts rename to database/migrations/0067-community_tables_public_key_length.ts diff --git a/dht-node/src/config/index.ts b/dht-node/src/config/index.ts index 6d9c1fd46..ce939e96c 100644 --- a/dht-node/src/config/index.ts +++ b/dht-node/src/config/index.ts @@ -3,7 +3,7 @@ import dotenv from 'dotenv' dotenv.config() const constants = { - DB_VERSION: '0067-community_table_public_key_length', + DB_VERSION: '0067-community_tables_public_key_length', LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info LOG_LEVEL: process.env.LOG_LEVEL || 'info', diff --git a/federation/src/config/index.ts b/federation/src/config/index.ts index 429a6cf9b..0ce9945dd 100644 --- a/federation/src/config/index.ts +++ b/federation/src/config/index.ts @@ -11,7 +11,7 @@ Decimal.set({ */ const constants = { - DB_VERSION: '0067-community_table_public_key_length', + DB_VERSION: '0067-community_tables_public_key_length', // DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0 LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info From 63c407fc29c19140c6e8eea0eac6b67c78c6176f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 7 Jun 2023 10:28:53 +0200 Subject: [PATCH 06/34] fix key length in tests --- .../federation/validateCommunities.test.ts | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/backend/src/federation/validateCommunities.test.ts b/backend/src/federation/validateCommunities.test.ts index 834f37e16..ef2c30d6b 100644 --- a/backend/src/federation/validateCommunities.test.ts +++ b/backend/src/federation/validateCommunities.test.ts @@ -73,9 +73,7 @@ describe('validate Communities', () => { } as Response }) const variables1 = { - publicKey: Buffer.from( - '1111111111111111111111111111111111111111111111111111111111111111', - ), + publicKey: Buffer.from('11111111111111111111111111111111'), apiVersion: '1_0', endPoint: 'http//localhost:5001/api/', lastAnnouncedAt: new Date(), @@ -108,7 +106,7 @@ describe('validate Communities', () => { expect(logger.warn).toBeCalledWith( 'Federation: received not matching publicKey:', 'somePubKey', - expect.stringMatching('1111111111111111111111111111111111111111111111111111111111111111'), + expect.stringMatching('11111111111111111111111111111111'), ) }) }) @@ -120,15 +118,13 @@ describe('validate Communities', () => { return { data: { getPublicKey: { - publicKey: '1111111111111111111111111111111111111111111111111111111111111111', + publicKey: '11111111111111111111111111111111', }, }, } as Response }) const variables1 = { - publicKey: Buffer.from( - '1111111111111111111111111111111111111111111111111111111111111111', - ), + publicKey: Buffer.from('11111111111111111111111111111111'), apiVersion: '1_0', endPoint: 'http//localhost:5001/api/', lastAnnouncedAt: new Date(), @@ -174,15 +170,13 @@ describe('validate Communities', () => { return { data: { getPublicKey: { - publicKey: '1111111111111111111111111111111111111111111111111111111111111111', + publicKey: '11111111111111111111111111111111', }, }, } as Response }) const variables2 = { - publicKey: Buffer.from( - '1111111111111111111111111111111111111111111111111111111111111111', - ), + publicKey: Buffer.from('11111111111111111111111111111111'), apiVersion: '1_1', endPoint: 'http//localhost:5001/api/', lastAnnouncedAt: new Date(), @@ -222,9 +216,7 @@ describe('validate Communities', () => { let dbCom: DbFederatedCommunity beforeEach(async () => { const variables3 = { - publicKey: Buffer.from( - '1111111111111111111111111111111111111111111111111111111111111111', - ), + publicKey: Buffer.from('11111111111111111111111111111111'), apiVersion: '2_0', endPoint: 'http//localhost:5001/api/', lastAnnouncedAt: new Date(), From 760c0ea9d9451dec42f8d24e36db23aa0c8532d6 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 7 Jun 2023 11:37:26 +0200 Subject: [PATCH 07/34] fix dht-node to handle pubkey as 32 bit buffer --- dht-node/src/dht_node/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dht-node/src/dht_node/index.ts b/dht-node/src/dht_node/index.ts index 36291904a..7e326c33f 100644 --- a/dht-node/src/dht_node/index.ts +++ b/dht-node/src/dht_node/index.ts @@ -94,7 +94,7 @@ export const startDHT = async (topic: string): Promise => { const variables = { apiVersion: recApiVersion.api, endPoint: recApiVersion.url, - publicKey: socket.remotePublicKey.toString('hex'), + publicKey: socket.remotePublicKey, lastAnnouncedAt: new Date(), } logger.debug(`upsert with variables=${JSON.stringify(variables)}`) @@ -195,14 +195,14 @@ async function writeFederatedHomeCommunityEntries(pubKey: string): Promise { // check for existing homeCommunity entry let homeCom = await DbCommunity.findOne({ foreign: false, - publicKey: Buffer.from(pubKey), + publicKey: Buffer.from(pubKey, 'hex'), }) if (!homeCom) { // check if a homecommunity with a different publicKey still exists @@ -225,7 +225,7 @@ async function writeHomeCommunityEntry(pubKey: string): Promise { } if (homeCom) { // simply update the existing entry, but it MUST keep the ID and UUID because of possible relations - homeCom.publicKey = Buffer.from(pubKey) + homeCom.publicKey = Buffer.from(pubKey, 'hex') homeCom.url = CONFIG.FEDERATION_COMMUNITY_URL + '/api/' homeCom.name = CONFIG.COMMUNITY_NAME homeCom.description = CONFIG.COMMUNITY_DESCRIPTION @@ -235,7 +235,7 @@ async function writeHomeCommunityEntry(pubKey: string): Promise { // insert a new homecommunity entry including a new ID and a new but ensured unique UUID homeCom = new DbCommunity() homeCom.foreign = false - homeCom.publicKey = Buffer.from(pubKey) + homeCom.publicKey = Buffer.from(pubKey, 'hex') homeCom.communityUuid = await newCommunityUuid() homeCom.url = CONFIG.FEDERATION_COMMUNITY_URL + '/api/' homeCom.name = CONFIG.COMMUNITY_NAME From 5c7b91b968ec82142b5cadca88b48cf2166f33c6 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 9 Jun 2023 13:27:31 +0200 Subject: [PATCH 08/34] import recommended --- dht-node/.eslintrc.js | 2 +- dht-node/src/server/logger.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dht-node/.eslintrc.js b/dht-node/.eslintrc.js index 64f5a9051..921e443b9 100644 --- a/dht-node/.eslintrc.js +++ b/dht-node/.eslintrc.js @@ -10,7 +10,7 @@ module.exports = { 'standard', 'eslint:recommended', 'plugin:prettier/recommended', - // 'plugin:import/recommended', + 'plugin:import/recommended', // 'plugin:import/typescript', // 'plugin:security/recommended', // 'plugin:@eslint-community/eslint-comments/recommended', diff --git a/dht-node/src/server/logger.ts b/dht-node/src/server/logger.ts index 92d930b40..7e91721f0 100644 --- a/dht-node/src/server/logger.ts +++ b/dht-node/src/server/logger.ts @@ -1,4 +1,4 @@ -import log4js from 'log4js' +import { configure, getLogger } from 'log4js' import CONFIG from '@/config' import { readFileSync } from 'fs' @@ -13,8 +13,8 @@ options.appenders.dht.filename = filename.replace( ) filename = options.appenders.errorFile.filename -log4js.configure(options) +configure(options) -const logger = log4js.getLogger('dht') +const logger = getLogger('dht') export { logger } From ef06974e6f9f9d470b558fbd2d9495777bcd8c41 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 9 Jun 2023 13:28:08 +0200 Subject: [PATCH 09/34] import typescript --- dht-node/.eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dht-node/.eslintrc.js b/dht-node/.eslintrc.js index 921e443b9..c4e587f1d 100644 --- a/dht-node/.eslintrc.js +++ b/dht-node/.eslintrc.js @@ -11,7 +11,7 @@ module.exports = { 'eslint:recommended', 'plugin:prettier/recommended', 'plugin:import/recommended', - // 'plugin:import/typescript', + 'plugin:import/typescript', // 'plugin:security/recommended', // 'plugin:@eslint-community/eslint-comments/recommended', ], From 208d1240759dfd0b63a90283126c36be48cecab0 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 9 Jun 2023 13:38:25 +0200 Subject: [PATCH 10/34] enable all import rules, lint fixes --- dht-node/.eslintrc.js | 126 ++++----- dht-node/jest.config.js | 1 + dht-node/package.json | 1 + dht-node/src/config/index.ts | 5 +- dht-node/src/dht_node/index.test.ts | 13 +- dht-node/src/dht_node/index.ts | 9 +- dht-node/src/index.ts | 5 +- dht-node/src/server/logger.ts | 7 +- dht-node/src/typeorm/DBVersion.ts | 1 + dht-node/src/typeorm/connection.ts | 7 +- dht-node/test/helpers.ts | 9 +- dht-node/yarn.lock | 395 +++++++++++++++++++++++++++- 12 files changed, 479 insertions(+), 100 deletions(-) diff --git a/dht-node/.eslintrc.js b/dht-node/.eslintrc.js index c4e587f1d..65a3bc9f6 100644 --- a/dht-node/.eslintrc.js +++ b/dht-node/.eslintrc.js @@ -37,69 +37,69 @@ module.exports = { }, ], // import - // 'import/export': 'error', - // 'import/no-deprecated': 'error', - // 'import/no-empty-named-blocks': 'error', - // 'import/no-extraneous-dependencies': 'error', - // 'import/no-mutable-exports': 'error', - // 'import/no-unused-modules': 'error', - // 'import/no-named-as-default': 'error', - // 'import/no-named-as-default-member': 'error', - // 'import/no-amd': 'error', - // 'import/no-commonjs': 'error', - // 'import/no-import-module-exports': 'error', - // 'import/no-nodejs-modules': 'off', - // 'import/unambiguous': 'error', - // 'import/default': 'error', - // 'import/named': 'error', - // 'import/namespace': 'error', - // 'import/no-absolute-path': 'error', - // 'import/no-cycle': 'error', - // 'import/no-dynamic-require': 'error', - // 'import/no-internal-modules': 'off', - // 'import/no-relative-packages': 'error', - // 'import/no-relative-parent-imports': ['error', { ignore: ['@/*'] }], - // 'import/no-self-import': 'error', - // 'import/no-unresolved': 'error', - // 'import/no-useless-path-segments': 'error', - // 'import/no-webpack-loader-syntax': 'error', - // 'import/consistent-type-specifier-style': 'error', - // 'import/exports-last': 'off', - // 'import/extensions': 'error', - // 'import/first': 'error', - // 'import/group-exports': 'off', - // 'import/newline-after-import': 'error', - // 'import/no-anonymous-default-export': 'error', - // 'import/no-default-export': 'error', - // 'import/no-duplicates': 'error', - // 'import/no-named-default': 'error', - // 'import/no-namespace': 'error', - // 'import/no-unassigned-import': 'error', - // 'import/order': [ - // 'error', - // { - // groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'], - // 'newlines-between': 'always', - // pathGroups: [ - // { - // pattern: '@?*/**', - // group: 'external', - // position: 'after', - // }, - // { - // pattern: '@/**', - // group: 'external', - // position: 'after', - // }, - // ], - // alphabetize: { - // order: 'asc' /* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */, - // caseInsensitive: true /* ignore case. Options: [true, false] */, - // }, - // distinctGroup: true, - // }, - // ], - // 'import/prefer-default-export': 'off', + 'import/export': 'error', + 'import/no-deprecated': 'error', + 'import/no-empty-named-blocks': 'error', + 'import/no-extraneous-dependencies': 'error', + 'import/no-mutable-exports': 'error', + 'import/no-unused-modules': 'error', + 'import/no-named-as-default': 'error', + 'import/no-named-as-default-member': 'error', + 'import/no-amd': 'error', + 'import/no-commonjs': 'error', + 'import/no-import-module-exports': 'error', + 'import/no-nodejs-modules': 'off', + 'import/unambiguous': 'error', + 'import/default': 'error', + 'import/named': 'error', + 'import/namespace': 'error', + 'import/no-absolute-path': 'error', + 'import/no-cycle': 'error', + 'import/no-dynamic-require': 'error', + 'import/no-internal-modules': 'off', + 'import/no-relative-packages': 'error', + 'import/no-relative-parent-imports': ['error', { ignore: ['@/*'] }], + 'import/no-self-import': 'error', + 'import/no-unresolved': 'error', + 'import/no-useless-path-segments': 'error', + 'import/no-webpack-loader-syntax': 'error', + 'import/consistent-type-specifier-style': 'error', + 'import/exports-last': 'off', + 'import/extensions': 'error', + 'import/first': 'error', + 'import/group-exports': 'off', + 'import/newline-after-import': 'error', + 'import/no-anonymous-default-export': 'error', + 'import/no-default-export': 'error', + 'import/no-duplicates': 'error', + 'import/no-named-default': 'error', + 'import/no-namespace': 'error', + 'import/no-unassigned-import': 'error', + 'import/order': [ + 'error', + { + groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'], + 'newlines-between': 'always', + pathGroups: [ + { + pattern: '@?*/**', + group: 'external', + position: 'after', + }, + { + pattern: '@/**', + group: 'external', + position: 'after', + }, + ], + alphabetize: { + order: 'asc' /* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */, + caseInsensitive: true /* ignore case. Options: [true, false] */, + }, + distinctGroup: true, + }, + ], + 'import/prefer-default-export': 'off', // n // 'n/handle-callback-err': 'error', // 'n/no-callback-literal': 'error', diff --git a/dht-node/jest.config.js b/dht-node/jest.config.js index 0b83d8edd..a8f5d1f1d 100644 --- a/dht-node/jest.config.js +++ b/dht-node/jest.config.js @@ -1,4 +1,5 @@ /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ +// eslint-disable-next-line import/no-commonjs, import/unambiguous module.exports = { verbose: true, preset: 'ts-jest', diff --git a/dht-node/package.json b/dht-node/package.json index 23238b9e4..0869ba2a4 100644 --- a/dht-node/package.json +++ b/dht-node/package.json @@ -19,6 +19,7 @@ "@hyperswarm/dht": "^6.4.4", "cross-env": "^7.0.3", "dotenv": "10.0.0", + "gradido-database": "file:../database", "log4js": "^6.7.1", "nodemon": "^2.0.20", "ts-node": "^10.9.1", diff --git a/dht-node/src/config/index.ts b/dht-node/src/config/index.ts index 43949201b..d901f4910 100644 --- a/dht-node/src/config/index.ts +++ b/dht-node/src/config/index.ts @@ -1,5 +1,6 @@ // ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env) import dotenv from 'dotenv' + dotenv.config() const constants = { @@ -53,12 +54,10 @@ if ( ) } -const CONFIG = { +export const CONFIG = { ...constants, ...server, ...database, ...community, ...federation, } - -export default CONFIG diff --git a/dht-node/src/dht_node/index.test.ts b/dht-node/src/dht_node/index.test.ts index ec172c4f8..6da410798 100644 --- a/dht-node/src/dht_node/index.test.ts +++ b/dht-node/src/dht_node/index.test.ts @@ -1,15 +1,18 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -import { startDHT } from './index' -import DHT from '@hyperswarm/dht' -import CONFIG from '@/config' -import { logger } from '@test/testSetup' import { Community as DbCommunity } from '@entity/Community' import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCommunity' -import { testEnvironment, cleanDB } from '@test/helpers' +import DHT from '@hyperswarm/dht' import { validate as validateUUID, version as versionUUID } from 'uuid' +import { testEnvironment, cleanDB } from '@test/helpers' +import { logger } from '@test/testSetup' + +import { CONFIG } from '@/config' + +import { startDHT } from './index' + CONFIG.FEDERATION_DHT_SEED = '64ebcb0e3ad547848fef4197c6e2332f' jest.mock('@hyperswarm/dht') diff --git a/dht-node/src/dht_node/index.ts b/dht-node/src/dht_node/index.ts index 2a7f7dd25..6df57f2bd 100644 --- a/dht-node/src/dht_node/index.ts +++ b/dht-node/src/dht_node/index.ts @@ -1,12 +1,13 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -import DHT from '@hyperswarm/dht' -import { logger } from '@/server/logger' -import CONFIG from '@/config' -import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCommunity' import { Community as DbCommunity } from '@entity/Community' +import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCommunity' +import DHT from '@hyperswarm/dht' import { v4 as uuidv4 } from 'uuid' +import { CONFIG } from '@/config' +import { logger } from '@/server/logger' + const KEY_SECRET_SEEDBYTES = 32 const POLLTIME = 20000 diff --git a/dht-node/src/index.ts b/dht-node/src/index.ts index d5e5f700b..8b262bb71 100644 --- a/dht-node/src/index.ts +++ b/dht-node/src/index.ts @@ -1,10 +1,9 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { startDHT } from '@/dht_node/index' -// config -import CONFIG from './config' +import { CONFIG } from './config' import { logger } from './server/logger' -import connection from './typeorm/connection' +import { connection } from './typeorm/connection' import { checkDBVersion } from './typeorm/DBVersion' async function main() { diff --git a/dht-node/src/server/logger.ts b/dht-node/src/server/logger.ts index 7e91721f0..99ea8518c 100644 --- a/dht-node/src/server/logger.ts +++ b/dht-node/src/server/logger.ts @@ -1,8 +1,9 @@ -import { configure, getLogger } from 'log4js' -import CONFIG from '@/config' - import { readFileSync } from 'fs' +import { configure, getLogger } from 'log4js' + +import { CONFIG } from '@/config' + const options = JSON.parse(readFileSync(CONFIG.LOG4JS_CONFIG, 'utf-8')) options.categories.dht.level = CONFIG.LOG_LEVEL diff --git a/dht-node/src/typeorm/DBVersion.ts b/dht-node/src/typeorm/DBVersion.ts index 5bd23c1d5..76ead1fc3 100644 --- a/dht-node/src/typeorm/DBVersion.ts +++ b/dht-node/src/typeorm/DBVersion.ts @@ -1,4 +1,5 @@ import { Migration } from '@entity/Migration' + import { logger } from '@/server/logger' const getDBVersion = async (): Promise => { diff --git a/dht-node/src/typeorm/connection.ts b/dht-node/src/typeorm/connection.ts index d08d935d4..7dec820b5 100644 --- a/dht-node/src/typeorm/connection.ts +++ b/dht-node/src/typeorm/connection.ts @@ -1,10 +1,11 @@ // TODO This is super weird - since the entities are defined in another project they have their own globals. // We cannot use our connection here, but must use the external typeorm installation import { Connection, createConnection, FileLogger } from '@dbTools/typeorm' -import CONFIG from '@/config' import { entities } from '@entity/index' -const connection = async (): Promise => { +import { CONFIG } from '@/config' + +export const connection = async (): Promise => { try { return createConnection({ name: 'default', @@ -30,5 +31,3 @@ const connection = async (): Promise => { return null } } - -export default connection diff --git a/dht-node/test/helpers.ts b/dht-node/test/helpers.ts index c5d6ce82b..fad5a093c 100644 --- a/dht-node/test/helpers.ts +++ b/dht-node/test/helpers.ts @@ -1,10 +1,11 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ - -import CONFIG from '@/config' -import connection from '@/typeorm/connection' -import { checkDBVersion } from '@/typeorm/DBVersion' import { entities } from '@entity/index' + +import { CONFIG } from '@/config' +import { connection } from '@/typeorm/connection' +import { checkDBVersion } from '@/typeorm/DBVersion' + import { logger } from './testSetup' export const headerPushMock = jest.fn((t) => { diff --git a/dht-node/yarn.lock b/dht-node/yarn.lock index a1437fe79..f339fd59e 100644 --- a/dht-node/yarn.lock +++ b/dht-node/yarn.lock @@ -672,6 +672,11 @@ dependencies: "@sinonjs/commons" "^1.7.0" +"@sqltools/formatter@^1.2.2": + version "1.2.5" + resolved "https://registry.yarnpkg.com/@sqltools/formatter/-/formatter-1.2.5.tgz#3abc203c79b8c3e90fd6c156a0c62d5403520e12" + integrity sha512-Uy0+khmZqUrUGm5dmMqVlnvufZRSK0FbYzVgp0UMstm+F5+W2/jnEEQyc9vo1ZR/E5ZI/B1WjjoTqBqwJL6Krw== + "@tootallnate/once@1": version "1.1.2" resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" @@ -781,6 +786,13 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== +"@types/mysql@^2.15.8": + version "2.15.21" + resolved "https://registry.yarnpkg.com/@types/mysql/-/mysql-2.15.21.tgz#7516cba7f9d077f980100c85fd500c8210bd5e45" + integrity sha512-NPotx5CVful7yB+qZbWtXL2fA4e7aEHkihHLjklc6ID8aq7bhguHgeIoC1EmSNTAuCgI6ZXrjt2ZSaXnYX0EUg== + dependencies: + "@types/node" "*" + "@types/node@*": version "18.11.11" resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.11.tgz#1d455ac0211549a8409d3cdb371cd55cc971e8dc" @@ -823,6 +835,11 @@ dependencies: "@types/yargs-parser" "*" +"@types/zen-observable@0.8.3": + version "0.8.3" + resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.3.tgz#781d360c282436494b32fe7d9f7f8e64b3118aa3" + integrity sha512-fbF6oTd4sGGy0xjHPKAt+eS2CrxJ3+6gQ3FGcBoIJR2TLAyCkCyI8JqZNy+FeON0AhVgNJoUumVoZQjBFUqHkw== + "@typescript-eslint/eslint-plugin@^5.57.1": version "5.59.9" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.9.tgz#2604cfaf2b306e120044f901e20c8ed926debf15" @@ -998,6 +1015,11 @@ ansi-styles@^5.0.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== +any-promise@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" + integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== + anymatch@^3.0.3, anymatch@~3.1.2: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" @@ -1006,6 +1028,11 @@ anymatch@^3.0.3, anymatch@~3.1.2: normalize-path "^3.0.0" picomatch "^2.0.4" +app-root-path@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-3.1.0.tgz#5971a2fc12ba170369a7a1ef018c71e6e47c2e86" + integrity sha512-biN3PwB2gUtjaYy/isrU3aNWI5w+fAfvHkSvCKeQGxhmYpwKFUxudR3Yya+KqVRHBmEDYh+/lTozYCFbmzX4nA== + arg@^4.1.0: version "4.1.3" resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" @@ -1135,11 +1162,21 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + big-integer@^1.6.44: version "1.6.51" resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.51.tgz#0df92a5d9880560d3ff2d5fd20245c889d130686" integrity sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg== +bignumber.js@9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.0.tgz#805880f84a329b5eac6e7cb6f8274b6d82bdf075" + integrity sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A== + binary-extensions@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" @@ -1225,6 +1262,14 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== +buffer@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" + integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + builtins@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/builtins/-/builtins-5.0.1.tgz#87f6db9ab0458be728564fa81d876d8d74552fa9" @@ -1283,7 +1328,7 @@ chalk@^2.0.0: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0: +chalk@^4.0.0, chalk@^4.1.0: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -1321,6 +1366,18 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz#9f84ba3244a512f3a54e5277e8eef4c489864e40" integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== +cli-highlight@^2.1.11: + version "2.1.11" + resolved "https://registry.yarnpkg.com/cli-highlight/-/cli-highlight-2.1.11.tgz#49736fa452f0aaf4fae580e30acb26828d2dc1bf" + integrity sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg== + dependencies: + chalk "^4.0.0" + highlight.js "^10.7.1" + mz "^2.4.0" + parse5 "^5.1.1" + parse5-htmlparser2-tree-adapter "^6.0.0" + yargs "^16.0.0" + cliui@^7.0.2: version "7.0.4" resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" @@ -1330,6 +1387,15 @@ cliui@^7.0.2: strip-ansi "^6.0.0" wrap-ansi "^7.0.0" +cliui@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" + integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.1" + wrap-ansi "^7.0.0" + co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -1395,6 +1461,11 @@ convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== +core-util-is@~1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" + integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== + create-require@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" @@ -1416,6 +1487,11 @@ cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" +crypto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/crypto/-/crypto-1.0.1.tgz#2af1b7cad8175d24c8a1b0778255794a21803037" + integrity sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig== + cssom@^0.4.4: version "0.4.4" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.4.4.tgz#5a66cf93d2d0b661d80bf6a44fb65f5c2e4e0a10" @@ -1447,7 +1523,7 @@ date-format@^4.0.14: resolved "https://registry.yarnpkg.com/date-format/-/date-format-4.0.14.tgz#7a8e584434fb169a521c8b7aa481f355810d9400" integrity sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg== -debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -1468,6 +1544,11 @@ debugging-stream@^2.0.0: dependencies: streamx "^2.12.4" +decimal.js-light@^2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/decimal.js-light/-/decimal.js-light-2.5.1.tgz#134fd32508f19e208f4fb2f8dac0d2626a867934" + integrity sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg== + decimal.js@^10.2.1: version "10.4.3" resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" @@ -1524,6 +1605,11 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== +denque@^2.0.1: + version "2.1.0" + resolved "https://registry.yarnpkg.com/denque/-/denque-2.1.0.tgz#e93e1a6569fb5e66f16a3c2a2964617d349d6ab1" + integrity sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw== + detect-newline@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" @@ -1589,11 +1675,16 @@ dotenv@*: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07" integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ== -dotenv@10.0.0: +dotenv@10.0.0, dotenv@^10.0.0: version "10.0.0" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== +dotenv@^8.2.0: + version "8.6.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.6.0.tgz#061af664d19f7f4d8fc6e4ff9b584ce237adcb8b" + integrity sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g== + electron-to-chromium@^1.4.251: version "1.4.284" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz#61046d1e4cab3a25238f6bf7413795270f125592" @@ -2141,6 +2232,13 @@ functions-have-names@^1.2.2: resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== +generate-function@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.3.1.tgz#f069617690c10c868e73b8465746764f97c3479f" + integrity sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ== + dependencies: + is-property "^1.0.2" + gensync@^1.0.0-beta.2: version "1.0.0-beta.2" resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" @@ -2199,7 +2297,7 @@ glob-parent@^6.0.2: dependencies: is-glob "^4.0.3" -glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: +glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -2263,6 +2361,20 @@ graceful-fs@^4.2.4: resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== +"gradido-database@file:../database": + version "1.21.0" + dependencies: + "@types/uuid" "^8.3.4" + cross-env "^7.0.3" + crypto "^1.0.1" + decimal.js-light "^2.5.1" + dotenv "^10.0.0" + mysql2 "^2.3.0" + reflect-metadata "^0.1.13" + ts-mysql-migrate "^1.0.2" + typeorm "^0.2.38" + uuid "^8.3.2" + grapheme-splitter@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" @@ -2314,6 +2426,11 @@ has@^1.0.3: dependencies: function-bind "^1.1.1" +highlight.js@^10.7.1: + version "10.7.3" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.7.3.tgz#697272e3991356e40c3cac566a74eef681756531" + integrity sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A== + hmac-blake2b@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/hmac-blake2b/-/hmac-blake2b-2.0.0.tgz#09494e5d245d7afe45d157093080b159f7bacf15" @@ -2378,6 +2495,18 @@ iconv-lite@0.4.24: dependencies: safer-buffer ">= 2.1.2 < 3" +iconv-lite@^0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== + dependencies: + safer-buffer ">= 2.1.2 < 3.0.0" + +ieee754@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + ignore-by-default@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" @@ -2417,7 +2546,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2: +inherits@2, inherits@^2.0.1, inherits@~2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -2543,6 +2672,11 @@ is-potential-custom-element-name@^1.0.1: resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== +is-property@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" + integrity sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g== + is-regex@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" @@ -2601,6 +2735,11 @@ is-wsl@^2.2.0: dependencies: is-docker "^2.0.0" +isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== + isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -3066,7 +3205,7 @@ js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^4.1.0: +js-yaml@^4.0.0, js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== @@ -3221,6 +3360,11 @@ log4js@^6.7.1: rfdc "^1.3.0" streamroller "^3.1.3" +long@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" + integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -3235,6 +3379,11 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +lru-cache@^7.14.1: + version "7.18.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.18.3.tgz#f793896e0fd0e954a59dfdd82f0773808df6aa89" + integrity sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA== + make-dir@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" @@ -3306,6 +3455,11 @@ minimist@^1.2.0, minimist@^1.2.6: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18" integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g== +mkdirp@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== + ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -3316,6 +3470,46 @@ ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +mysql2@^2.3.0: + version "2.3.3" + resolved "https://registry.yarnpkg.com/mysql2/-/mysql2-2.3.3.tgz#944f3deca4b16629052ff8614fbf89d5552545a0" + integrity sha512-wxJUev6LgMSgACDkb/InIFxDprRa6T95+VEoR+xPvtngtccNH2dGjEB/fVZ8yg1gWv1510c9CvXuJHi5zUm0ZA== + dependencies: + denque "^2.0.1" + generate-function "^2.3.1" + iconv-lite "^0.6.3" + long "^4.0.0" + lru-cache "^6.0.0" + named-placeholders "^1.1.2" + seq-queue "^0.0.5" + sqlstring "^2.3.2" + +mysql@^2.18.1: + version "2.18.1" + resolved "https://registry.yarnpkg.com/mysql/-/mysql-2.18.1.tgz#2254143855c5a8c73825e4522baf2ea021766717" + integrity sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig== + dependencies: + bignumber.js "9.0.0" + readable-stream "2.3.7" + safe-buffer "5.1.2" + sqlstring "2.3.1" + +mz@^2.4.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" + +named-placeholders@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/named-placeholders/-/named-placeholders-1.1.3.tgz#df595799a36654da55dda6152ba7a137ad1d9351" + integrity sha512-eLoBxg6wE/rZkJPhU/xRX1WTpkFEwDJEN96oxFrTsqBdbT5ec295Q+CoHrL9IT0DipqKhmGcaZmwOt8OON5x1w== + dependencies: + lru-cache "^7.14.1" + nanoassert@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/nanoassert/-/nanoassert-1.1.0.tgz#4f3152e09540fde28c76f44b19bbcd1d5a42478d" @@ -3427,6 +3621,11 @@ nwsapi@^2.2.0: resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.2.tgz#e5418863e7905df67d51ec95938d67bf801f0bb0" integrity sha512-90yv+6538zuvUMnN+zCr8LuV6bPFdq50304114vJYJ8RDyK8D5O9Phpbd6SZWgI7PwzmmfN1upeOJlvybDSgCw== +object-assign@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== + object-inspect@^1.12.2, object-inspect@^1.9.0: version "1.12.2" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea" @@ -3561,11 +3760,23 @@ parse-json@^5.2.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" -parse5@6.0.1: +parse5-htmlparser2-tree-adapter@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz#2cdf9ad823321140370d4dbf5d3e92c7c8ddc6e6" + integrity sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA== + dependencies: + parse5 "^6.0.1" + +parse5@6.0.1, parse5@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== +parse5@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178" + integrity sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug== + path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" @@ -3649,6 +3860,11 @@ pretty-format@^27.0.0, pretty-format@^27.5.1: ansi-styles "^5.0.0" react-is "^17.0.1" +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + prompts@^2.0.1: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" @@ -3692,6 +3908,19 @@ react-is@^17.0.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== +readable-stream@2.3.7: + version "2.3.7" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + readdirp@~3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" @@ -3706,6 +3935,11 @@ record-cache@^1.1.1: dependencies: b4a "^1.3.1" +reflect-metadata@^0.1.13: + version "0.1.13" + resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08" + integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg== + regexp-tree@~0.1.1: version "0.1.27" resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.27.tgz#2198f0ef54518ffa743fe74d983b56ffd631b6cd" @@ -3802,6 +4036,16 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" +safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safe-buffer@^5.0.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + safe-regex-test@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.0.tgz#793b874d524eb3640d1873aad03596db2d4f2295" @@ -3818,7 +4062,7 @@ safe-regex@^2.1.1: dependencies: regexp-tree "~0.1.1" -"safer-buffer@>= 2.1.2 < 3": +"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -3828,6 +4072,11 @@ safety-catch@^1.0.1: resolved "https://registry.yarnpkg.com/safety-catch/-/safety-catch-1.0.2.tgz#d64cbd57fd601da91c356b6ab8902f3e449a7a4b" integrity sha512-C1UYVZ4dtbBxEtvOcpjBaaD27nP8MlvyAQEp2fOTOEe6pfUpk1cDUxij6BR1jZup6rSyUTaBBplK7LanskrULA== +sax@>=0.6.0: + version "1.2.4" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== + saxes@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d" @@ -3857,6 +4106,19 @@ semver@~7.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== +seq-queue@^0.0.5: + version "0.0.5" + resolved "https://registry.yarnpkg.com/seq-queue/-/seq-queue-0.0.5.tgz#d56812e1c017a6e4e7c3e3a37a1da6d78dd3c93e" + integrity sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q== + +sha.js@^2.4.11: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + sha256-universal@^1.1.0: version "1.2.1" resolved "https://registry.yarnpkg.com/sha256-universal/-/sha256-universal-1.2.1.tgz#051d92decce280cd6137d42d496eac88da942c0e" @@ -4033,6 +4295,16 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== +sqlstring@2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/sqlstring/-/sqlstring-2.3.1.tgz#475393ff9e91479aea62dcaf0ca3d14983a7fb40" + integrity sha512-ooAzh/7dxIG5+uDik1z/Rd1vli0+38izZhGzSa34FwR7IbelPWCCKSNIl8jlL/F7ERvy8CB2jNeM1E9i9mXMAQ== + +sqlstring@^2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/sqlstring/-/sqlstring-2.3.3.tgz#2ddc21f03bce2c387ed60680e739922c65751d0c" + integrity sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg== + stack-utils@^2.0.3: version "2.0.6" resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" @@ -4065,7 +4337,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -string-width@^4.1.0, string-width@^4.2.0: +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -4092,6 +4364,13 @@ string.prototype.trimstart@^1.0.6: define-properties "^1.1.4" es-abstract "^1.20.4" +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -4198,6 +4477,20 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.1" + resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" + integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== + dependencies: + any-promise "^1.0.0" + throat@^6.0.1: version "6.0.2" resolved "https://registry.yarnpkg.com/throat/-/throat-6.0.2.tgz#51a3fbb5e11ae72e2cf74861ed5c8020f89f29fe" @@ -4273,6 +4566,14 @@ ts-jest@^27.0.5: semver "7.x" yargs-parser "20.x" +ts-mysql-migrate@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/ts-mysql-migrate/-/ts-mysql-migrate-1.0.2.tgz#736d37c3aa3fef92f226b869098e939950d0e18c" + integrity sha512-zDW6iQsfPCJfQ3JMhfUGjhy8aK+VNTvPrXmJH66PB2EGEvyn4m7x2nBdhDNhKuwYU9LMxW1p+l39Ei+btXNpxA== + dependencies: + "@types/mysql" "^2.15.8" + mysql "^2.18.1" + ts-node@^10.9.1: version "10.9.1" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" @@ -4316,7 +4617,7 @@ tslib@^1.8.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.5.0: +tslib@^2.1.0, tslib@^2.5.0: version "2.5.3" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.3.tgz#24944ba2d990940e6e982c4bea147aba80209913" integrity sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w== @@ -4364,6 +4665,29 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" +typeorm@^0.2.38: + version "0.2.45" + resolved "https://registry.yarnpkg.com/typeorm/-/typeorm-0.2.45.tgz#e5bbb3af822dc4646bad96cfa48cd22fa4687cea" + integrity sha512-c0rCO8VMJ3ER7JQ73xfk0zDnVv0WDjpsP6Q1m6CVKul7DB9iVdWLRjPzc8v2eaeBuomsbZ2+gTaYr8k1gm3bYA== + dependencies: + "@sqltools/formatter" "^1.2.2" + app-root-path "^3.0.0" + buffer "^6.0.3" + chalk "^4.1.0" + cli-highlight "^2.1.11" + debug "^4.3.1" + dotenv "^8.2.0" + glob "^7.1.6" + js-yaml "^4.0.0" + mkdirp "^1.0.4" + reflect-metadata "^0.1.13" + sha.js "^2.4.11" + tslib "^2.1.0" + uuid "^8.3.2" + xml2js "^0.4.23" + yargs "^17.0.1" + zen-observable-ts "^1.0.0" + typescript@^4.9.4: version "4.9.4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.4.tgz#a2a3d2756c079abda241d75f149df9d561091e78" @@ -4433,6 +4757,11 @@ url-parse@^1.5.3: querystringify "^2.1.1" requires-port "^1.0.0" +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" @@ -4566,6 +4895,19 @@ xml-name-validator@^3.0.0: resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== +xml2js@^0.4.23: + version "0.4.23" + resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.23.tgz#a0c69516752421eb2ac758ee4d4ccf58843eac66" + integrity sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug== + dependencies: + sax ">=0.6.0" + xmlbuilder "~11.0.0" + +xmlbuilder@~11.0.0: + version "11.0.1" + resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3" + integrity sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA== + xmlchars@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" @@ -4596,7 +4938,12 @@ yargs-parser@20.x, yargs-parser@^20.2.2: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== -yargs@^16.2.0: +yargs-parser@^21.1.1: + version "21.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== + +yargs@^16.0.0, yargs@^16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== @@ -4609,6 +4956,19 @@ yargs@^16.2.0: y18n "^5.0.5" yargs-parser "^20.2.2" +yargs@^17.0.1: + version "17.7.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" + integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== + dependencies: + cliui "^8.0.1" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.1.1" + yn@3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" @@ -4618,3 +4978,16 @@ yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== + +zen-observable-ts@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-1.1.0.tgz#2d1aa9d79b87058e9b75698b92791c1838551f83" + integrity sha512-1h4zlLSqI2cRLPJUHJFL8bCWHhkpuXkF+dbGkRaWjgDIG26DmzyshUMrdV/rL3UnR+mhaX4fRq8LPouq0MYYIA== + dependencies: + "@types/zen-observable" "0.8.3" + zen-observable "0.8.15" + +zen-observable@0.8.15: + version "0.8.15" + resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.15.tgz#96415c512d8e3ffd920afd3889604e30b9eaac15" + integrity sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ== From 991770ea67c4768e818736e10fa3695dea093d20 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 14 Jun 2023 12:32:52 +0200 Subject: [PATCH 11/34] fix workflow, sinc elinting is now dependent on the node_modules in the database --- .github/workflows/test_dht_node.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_dht_node.yml b/.github/workflows/test_dht_node.yml index b63d1fc0d..953f66ffc 100644 --- a/.github/workflows/test_dht_node.yml +++ b/.github/workflows/test_dht_node.yml @@ -51,7 +51,7 @@ jobs: uses: actions/checkout@v3 - name: Lint - run: cd dht-node && yarn && yarn run lint + run: cd database && yarn && cd ../backend && yarn && yarn run lint unit_test: name: Unit Tests - DHT Node From a8407618bd2218e08110f0bb5f47c113f35b3971 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 20 Jun 2023 09:18:41 +0200 Subject: [PATCH 12/34] merge conflicts solved --- .../Community.ts | 3 +++ .../FederatedCommunity.ts | 0 database/entity/FederatedCommunity.ts | 2 +- ...ey_length.ts => 0068-community_tables_public_key_length.ts} | 0 4 files changed, 4 insertions(+), 1 deletion(-) rename database/entity/{0067-community_tables_public_key_length => 0068-community_tables_public_key_length}/Community.ts (93%) rename database/entity/{0067-community_tables_public_key_length => 0068-community_tables_public_key_length}/FederatedCommunity.ts (100%) rename database/migrations/{0067-community_tables_public_key_length.ts => 0068-community_tables_public_key_length.ts} (100%) diff --git a/database/entity/0067-community_tables_public_key_length/Community.ts b/database/entity/0068-community_tables_public_key_length/Community.ts similarity index 93% rename from database/entity/0067-community_tables_public_key_length/Community.ts rename to database/entity/0068-community_tables_public_key_length/Community.ts index 382025c83..e6f8d255c 100644 --- a/database/entity/0067-community_tables_public_key_length/Community.ts +++ b/database/entity/0068-community_tables_public_key_length/Community.ts @@ -21,6 +21,9 @@ export class Community extends BaseEntity { @Column({ name: 'public_key', type: 'binary', length: 32, nullable: false }) publicKey: Buffer + @Column({ name: 'private_key', type: 'binary', length: 64, nullable: true }) + privateKey: Buffer | null + @Column({ name: 'community_uuid', type: 'char', diff --git a/database/entity/0067-community_tables_public_key_length/FederatedCommunity.ts b/database/entity/0068-community_tables_public_key_length/FederatedCommunity.ts similarity index 100% rename from database/entity/0067-community_tables_public_key_length/FederatedCommunity.ts rename to database/entity/0068-community_tables_public_key_length/FederatedCommunity.ts diff --git a/database/entity/FederatedCommunity.ts b/database/entity/FederatedCommunity.ts index 3b636af09..37a33e4d9 100644 --- a/database/entity/FederatedCommunity.ts +++ b/database/entity/FederatedCommunity.ts @@ -1 +1 @@ -export { FederatedCommunity } from './0067-community_tables_public_key_length/FederatedCommunity' +export { FederatedCommunity } from './0068-community_tables_public_key_length/FederatedCommunity' diff --git a/database/migrations/0067-community_tables_public_key_length.ts b/database/migrations/0068-community_tables_public_key_length.ts similarity index 100% rename from database/migrations/0067-community_tables_public_key_length.ts rename to database/migrations/0068-community_tables_public_key_length.ts From 580c5940d27f2278a3a0bfb1d3d1b3b6225b8a5a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 20 Jun 2023 09:39:54 +0200 Subject: [PATCH 13/34] covert public_key according to new standarts unhex/hex --- database/migrations/0068-community_tables_public_key_length.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/database/migrations/0068-community_tables_public_key_length.ts b/database/migrations/0068-community_tables_public_key_length.ts index b51a1e6e0..df70b1182 100644 --- a/database/migrations/0068-community_tables_public_key_length.ts +++ b/database/migrations/0068-community_tables_public_key_length.ts @@ -7,6 +7,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { + await queryFn('UPDATE `communities` SET `public_key` = UNHEX(publicKey);') await queryFn('ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(32) NOT NULL;') // TODO: it is unclear if this is actually nullable - the model defines "default: null, nullable: true", but the table seems to be created without nullability(?) await queryFn( @@ -16,6 +17,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { await queryFn('ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(64) NOT NULL;') + await queryFn('UPDATE `communities` SET `public_key` = HEX(publicKey);') // TODO: see above await queryFn( 'ALTER TABLE `federated_communities` MODIFY COLUMN `public_key` binary(64) NULL DEFAULT NULL;', From d23e1a5aad9d409696ec42631c7a2df660134d8a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 20 Jun 2023 10:42:39 +0200 Subject: [PATCH 14/34] removed obsolete todos --- database/migrations/0068-community_tables_public_key_length.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/database/migrations/0068-community_tables_public_key_length.ts b/database/migrations/0068-community_tables_public_key_length.ts index df70b1182..413af935f 100644 --- a/database/migrations/0068-community_tables_public_key_length.ts +++ b/database/migrations/0068-community_tables_public_key_length.ts @@ -9,7 +9,6 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { await queryFn('UPDATE `communities` SET `public_key` = UNHEX(publicKey);') await queryFn('ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(32) NOT NULL;') - // TODO: it is unclear if this is actually nullable - the model defines "default: null, nullable: true", but the table seems to be created without nullability(?) await queryFn( 'ALTER TABLE `federated_communities` MODIFY COLUMN `public_key` binary(32) NULL DEFAULT NULL;', ) @@ -18,7 +17,6 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { await queryFn('ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(64) NOT NULL;') await queryFn('UPDATE `communities` SET `public_key` = HEX(publicKey);') - // TODO: see above await queryFn( 'ALTER TABLE `federated_communities` MODIFY COLUMN `public_key` binary(64) NULL DEFAULT NULL;', ) From 6c3b784d45ad7533b553ca16ddfec6f38f662743 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 20 Jun 2023 10:50:48 +0200 Subject: [PATCH 15/34] corrected database migration --- .../migrations/0068-community_tables_public_key_length.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migrations/0068-community_tables_public_key_length.ts b/database/migrations/0068-community_tables_public_key_length.ts index 413af935f..b87ed1a70 100644 --- a/database/migrations/0068-community_tables_public_key_length.ts +++ b/database/migrations/0068-community_tables_public_key_length.ts @@ -7,7 +7,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { - await queryFn('UPDATE `communities` SET `public_key` = UNHEX(publicKey);') + await queryFn('UPDATE `communities` SET `public_key` = UNHEX(public_key);') await queryFn('ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(32) NOT NULL;') await queryFn( 'ALTER TABLE `federated_communities` MODIFY COLUMN `public_key` binary(32) NULL DEFAULT NULL;', @@ -16,7 +16,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { await queryFn('ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(64) NOT NULL;') - await queryFn('UPDATE `communities` SET `public_key` = HEX(publicKey);') + await queryFn('UPDATE `communities` SET `public_key` = HEX(public_key);') await queryFn( 'ALTER TABLE `federated_communities` MODIFY COLUMN `public_key` binary(64) NULL DEFAULT NULL;', ) From c05c16a9fc3c5b01efd13251bdc0bfbcf8033551 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 27 Jun 2023 12:15:30 +0200 Subject: [PATCH 16/34] Update .github/workflows/test_dht_node.yml --- .github/workflows/test_dht_node.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_dht_node.yml b/.github/workflows/test_dht_node.yml index 953f66ffc..e81ed33af 100644 --- a/.github/workflows/test_dht_node.yml +++ b/.github/workflows/test_dht_node.yml @@ -51,7 +51,7 @@ jobs: uses: actions/checkout@v3 - name: Lint - run: cd database && yarn && cd ../backend && yarn && yarn run lint + run: cd database && yarn && cd ../dht-node && yarn && yarn run lint unit_test: name: Unit Tests - DHT Node From 52925d4ba75c80f58634fa00d57f39fe3f880712 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 30 Jun 2023 13:10:51 +0200 Subject: [PATCH 17/34] convert the right table --- .../0068-community_tables_public_key_length.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/database/migrations/0068-community_tables_public_key_length.ts b/database/migrations/0068-community_tables_public_key_length.ts index b87ed1a70..236fc4430 100644 --- a/database/migrations/0068-community_tables_public_key_length.ts +++ b/database/migrations/0068-community_tables_public_key_length.ts @@ -7,17 +7,21 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { - await queryFn('UPDATE `communities` SET `public_key` = UNHEX(public_key);') - await queryFn('ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(32) NOT NULL;') + await queryFn('UPDATE `federated_communities` SET `public_key` = UNHEX(public_key);') await queryFn( - 'ALTER TABLE `federated_communities` MODIFY COLUMN `public_key` binary(32) NULL DEFAULT NULL;', + 'ALTER TABLE `federated_communities` MODIFY COLUMN `public_key` binary(32) NOT NULL;', + ) + await queryFn( + 'ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(32) NULL DEFAULT NULL;', ) } export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { - await queryFn('ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(64) NOT NULL;') - await queryFn('UPDATE `communities` SET `public_key` = HEX(public_key);') await queryFn( - 'ALTER TABLE `federated_communities` MODIFY COLUMN `public_key` binary(64) NULL DEFAULT NULL;', + 'ALTER TABLE `federated_communities` MODIFY COLUMN `public_key` binary(64) NOT NULL;', + ) + await queryFn('UPDATE `federated_communities` SET `public_key` = HEX(public_key);') + await queryFn( + 'ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(64) NULL DEFAULT NULL;', ) } From bd384a75bfbcc5bc7c7ac2720d6eed5cc77e004b Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 30 Jun 2023 13:29:51 +0200 Subject: [PATCH 18/34] fix migration --- .../0068-community_tables_public_key_length.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/database/migrations/0068-community_tables_public_key_length.ts b/database/migrations/0068-community_tables_public_key_length.ts index 236fc4430..2d82307fa 100644 --- a/database/migrations/0068-community_tables_public_key_length.ts +++ b/database/migrations/0068-community_tables_public_key_length.ts @@ -8,12 +8,14 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { await queryFn('UPDATE `federated_communities` SET `public_key` = UNHEX(public_key);') - await queryFn( - 'ALTER TABLE `federated_communities` MODIFY COLUMN `public_key` binary(32) NOT NULL;', - ) - await queryFn( - 'ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(32) NULL DEFAULT NULL;', - ) + try { + await queryFn( + 'ALTER TABLE `federated_communities` MODIFY COLUMN `public_key` binary(32) NOT NULL;', + ) + await queryFn('ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(32) NOT NULL;') + } catch(e){ + console.log(e) + } } export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { From 8688385a6f2e158697765fee2fb6e65558c1d9a1 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 30 Jun 2023 14:25:03 +0200 Subject: [PATCH 19/34] fixed migration --- ...0068-community_tables_public_key_length.ts | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/database/migrations/0068-community_tables_public_key_length.ts b/database/migrations/0068-community_tables_public_key_length.ts index 2d82307fa..22c04e850 100644 --- a/database/migrations/0068-community_tables_public_key_length.ts +++ b/database/migrations/0068-community_tables_public_key_length.ts @@ -7,23 +7,36 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { + // federated communities + await queryFn('DROP INDEX `public_api_key` ON `federated_communities`;') await queryFn('UPDATE `federated_communities` SET `public_key` = UNHEX(public_key);') - try { - await queryFn( - 'ALTER TABLE `federated_communities` MODIFY COLUMN `public_key` binary(32) NOT NULL;', - ) - await queryFn('ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(32) NOT NULL;') - } catch(e){ - console.log(e) - } + await queryFn( + 'ALTER TABLE `federated_communities` ADD COLUMN `public_key_new` binary(32) NOT NULL AFTER `public_key`;', + ) + await queryFn('UPDATE `federated_communities` SET public_key_new = substring(public_key,1,32);') + await queryFn('ALTER TABLE `federated_communities` DROP COLUMN public_key;') + await queryFn('ALTER TABLE `federated_communities` RENAME COLUMN public_key_new TO public_key;') + await queryFn( + 'ALTER TABLE `federated_communities` ADD CONSTRAINT `public_api_key` UNIQUE (public_key, api_version);', + ) + + // communities + await queryFn( + 'ALTER TABLE `communities` ADD COLUMN `public_key_new` binary(32) NOT NULL AFTER `public_key`;', + ) + await queryFn('UPDATE `communities` SET public_key_new = substring(public_key,1,32);') + await queryFn('ALTER TABLE `communities` DROP COLUMN public_key;') + await queryFn('ALTER TABLE `communities` RENAME COLUMN public_key_new TO public_key;') } export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { await queryFn( 'ALTER TABLE `federated_communities` MODIFY COLUMN `public_key` binary(64) NOT NULL;', ) - await queryFn('UPDATE `federated_communities` SET `public_key` = HEX(public_key);') + await queryFn( + 'UPDATE `federated_communities` SET `public_key` = substring(HEX(public_key),1,64);', + ) await queryFn( 'ALTER TABLE `communities` MODIFY COLUMN `public_key` binary(64) NULL DEFAULT NULL;', ) -} +} \ No newline at end of file From 97db22263e334f17aea90def817f6f4c37417371 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 30 Jun 2023 14:37:04 +0200 Subject: [PATCH 20/34] ignore import/no-deprecated since we have trouble with typeorm data source --- dht-node/.eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dht-node/.eslintrc.js b/dht-node/.eslintrc.js index 8b0d46837..5a1c522d2 100644 --- a/dht-node/.eslintrc.js +++ b/dht-node/.eslintrc.js @@ -38,7 +38,7 @@ module.exports = { ], // import 'import/export': 'error', - 'import/no-deprecated': 'error', + // 'import/no-deprecated': 'error', 'import/no-empty-named-blocks': 'error', 'import/no-extraneous-dependencies': 'error', 'import/no-mutable-exports': 'error', From d1ba7c7f418fbc6af57cd44c9039de6bee0fd000 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 5 Jul 2023 09:05:20 +0200 Subject: [PATCH 21/34] do not change contribution status on moderator message --- .../resolver/ContributionMessageResolver.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.ts b/backend/src/graphql/resolver/ContributionMessageResolver.ts index 0cbc2446c..5910befa1 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.ts @@ -158,16 +158,18 @@ export class ContributionMessageResolver { contributionMessage.isModerator = true await queryRunner.manager.insert(DbContributionMessage, contributionMessage) - if ( - contribution.contributionStatus === ContributionStatus.DELETED || - contribution.contributionStatus === ContributionStatus.DENIED || - contribution.contributionStatus === ContributionStatus.PENDING - ) { - contribution.contributionStatus = ContributionStatus.IN_PROGRESS - await queryRunner.manager.update(DbContribution, { id: contributionId }, contribution) - } - if (messageType !== ContributionMessageType.MODERATOR) { + // change status (does not apply to moderator messages) + if ( + contribution.contributionStatus === ContributionStatus.DELETED || + contribution.contributionStatus === ContributionStatus.DENIED || + contribution.contributionStatus === ContributionStatus.PENDING + ) { + contribution.contributionStatus = ContributionStatus.IN_PROGRESS + await queryRunner.manager.update(DbContribution, { id: contributionId }, contribution) + } + + // send email (never for moderator messages) void sendAddedContributionMessageEmail({ firstName: contribution.user.firstName, lastName: contribution.user.lastName, From 69ae2e91f0089bf69a1b445d6b79e41d81000caf Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 5 Jul 2023 09:37:35 +0200 Subject: [PATCH 22/34] fix message count on moderator message contributions (filter out MODERATOR messages) --- backend/src/graphql/resolver/ContributionResolver.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index 21bc416e5..8739e3ebf 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -142,9 +142,16 @@ export class ContributionResolver { userId: user.id, statusFilter, }) + return new ContributionListResult( count, - dbContributions.map((contribution) => new Contribution(contribution, user)), + dbContributions.map((contribution) => { + // filter out moderator messages for this call8user) + contribution.messages = contribution.messages?.filter( + (m) => m.type !== ContributionMessageType.MODERATOR, + ) + return new Contribution(contribution, user) + }), ) } From ff03b05e5e0621d7002a9d7c6aa3e9e535049712 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 5 Jul 2023 10:40:36 +0200 Subject: [PATCH 23/34] test case for Moderation Contribution message does not change contribution status, normal message does --- .../ContributionMessageResolver.test.ts | 90 +++++++++++-------- 1 file changed, 55 insertions(+), 35 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts index e4929483f..a48e005d6 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts @@ -5,6 +5,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { Connection } from '@dbTools/typeorm' import { Event as DbEvent } from '@entity/Event' +import { Contribution as DbContribution } from '@entity/Contribution' import { ApolloServerTestClient } from 'apollo-server-testing' import { GraphQLError } from 'graphql' @@ -23,6 +24,7 @@ import { import { listContributionMessages, adminListContributionMessages } from '@/seeds/graphql/queries' import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg' import { peterLustig } from '@/seeds/users/peter-lustig' +import { ContributionStatus } from '../enum/ContributionStatus' jest.mock('@/emails/sendEmailVariants', () => { const originalModule = jest.requireActual('@/emails/sendEmailVariants') @@ -168,6 +170,50 @@ describe('ContributionMessageResolver', () => { }) }) + describe('contribution message type MODERATOR', () => { + beforeAll(() => { + jest.clearAllMocks() + }) + + it('creates ContributionMessage', async () => { + await expect( + mutate({ + mutation: adminCreateContributionMessage, + variables: { + contributionId: result.data.createContribution.id, + message: 'Internal moderator communication', + messageType: 'MODERATOR', + }, + }), + ).resolves.toEqual( + expect.objectContaining({ + data: { + adminCreateContributionMessage: expect.objectContaining({ + id: expect.any(Number), + message: 'Internal moderator communication', + type: 'MODERATOR', + userFirstName: 'Peter', + userLastName: 'Lustig', + }), + }, + }), + ) + }) + + it("don't call sendAddedContributionMessageEmail", () => { + expect(sendAddedContributionMessageEmail).not.toBeCalled() + }) + + it("don't change contribution status", async () => { + await expect(DbContribution.find()).resolves.toContainEqual( + expect.objectContaining({ + id: result.data.createContribution.id, + contributionStatus: ContributionStatus.PENDING, + }), + ) + }) + }) + describe('valid input', () => { it('creates ContributionMessage', async () => { await expect( @@ -205,6 +251,15 @@ describe('ContributionMessageResolver', () => { }) }) + it('change contribution status', async () => { + await expect(DbContribution.find()).resolves.toContainEqual( + expect.objectContaining({ + id: result.data.createContribution.id, + contributionStatus: ContributionStatus.IN_PROGRESS, + }), + ) + }) + it('stores the ADMIN_CONTRIBUTION_MESSAGE_CREATE event in the database', async () => { await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ @@ -217,41 +272,6 @@ describe('ContributionMessageResolver', () => { ) }) }) - - describe('contribution message type MODERATOR', () => { - beforeAll(() => { - jest.clearAllMocks() - }) - - it('creates ContributionMessage', async () => { - await expect( - mutate({ - mutation: adminCreateContributionMessage, - variables: { - contributionId: result.data.createContribution.id, - message: 'Internal moderator communication', - messageType: 'MODERATOR', - }, - }), - ).resolves.toEqual( - expect.objectContaining({ - data: { - adminCreateContributionMessage: expect.objectContaining({ - id: expect.any(Number), - message: 'Internal moderator communication', - type: 'MODERATOR', - userFirstName: 'Peter', - userLastName: 'Lustig', - }), - }, - }), - ) - }) - - it("don't call sendAddedContributionMessageEmail", () => { - expect(sendAddedContributionMessageEmail).not.toBeCalled() - }) - }) }) }) From e6f18f718bbfa8ae19bc246c39a9397bf85295d0 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 5 Jul 2023 10:41:55 +0200 Subject: [PATCH 24/34] fix linting --- .../src/graphql/resolver/ContributionMessageResolver.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts index a48e005d6..d13d959eb 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts @@ -4,11 +4,12 @@ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-explicit-any */ import { Connection } from '@dbTools/typeorm' -import { Event as DbEvent } from '@entity/Event' import { Contribution as DbContribution } from '@entity/Contribution' +import { Event as DbEvent } from '@entity/Event' import { ApolloServerTestClient } from 'apollo-server-testing' import { GraphQLError } from 'graphql' +import { ContributionStatus } from '@enum/ContributionStatus' import { cleanDB, resetToken, testEnvironment } from '@test/helpers' import { logger, i18n as localization } from '@test/testSetup' @@ -24,7 +25,6 @@ import { import { listContributionMessages, adminListContributionMessages } from '@/seeds/graphql/queries' import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg' import { peterLustig } from '@/seeds/users/peter-lustig' -import { ContributionStatus } from '../enum/ContributionStatus' jest.mock('@/emails/sendEmailVariants', () => { const originalModule = jest.requireActual('@/emails/sendEmailVariants') From f5a761c769b26d28cd126658e3157dcfcd5df75e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 5 Jul 2023 11:07:45 +0200 Subject: [PATCH 25/34] implicitly test for messagescounts to be correct when moderator message is present(not shown on listContributions) --- .../resolver/ContributionResolver.test.ts | 52 ++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.test.ts b/backend/src/graphql/resolver/ContributionResolver.test.ts index 735b6ee69..68ff97b05 100644 --- a/backend/src/graphql/resolver/ContributionResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionResolver.test.ts @@ -55,6 +55,7 @@ import { garrickOllivander } from '@/seeds/users/garrick-ollivander' import { peterLustig } from '@/seeds/users/peter-lustig' import { raeuberHotzenplotz } from '@/seeds/users/raeuber-hotzenplotz' import { stephenHawking } from '@/seeds/users/stephen-hawking' +import { ContributionMessageType } from '../enum/ContributionMessageType' jest.mock('@/emails/sendEmailVariants') @@ -153,6 +154,14 @@ describe('ContributionResolver', () => { message: 'Test message to IN_PROGRESS contribution', }, }) + await mutate({ + mutation: adminCreateContributionMessage, + variables: { + contributionId: pendingContribution.data.createContribution.id, + message: 'Test moderator message', + messageType: ContributionMessageType.MODERATOR, + }, + }) await mutate({ mutation: logout, }) @@ -1043,31 +1052,37 @@ describe('ContributionResolver', () => { amount: '100', id: contributionToConfirm.data.createContribution.id, memo: 'Test contribution to confirm', + messagesCount: 0, }), expect.objectContaining({ id: pendingContribution.data.createContribution.id, memo: 'Test PENDING contribution update', amount: '10', + messagesCount: 1, }), expect.objectContaining({ id: contributionToDeny.data.createContribution.id, memo: 'Test contribution to deny', amount: '100', + messagesCount: 0, }), expect.objectContaining({ id: contributionToDelete.data.createContribution.id, memo: 'Test contribution to delete', amount: '100', + messagesCount: 0, }), expect.objectContaining({ id: inProgressContribution.data.createContribution.id, memo: 'Test IN_PROGRESS contribution', amount: '100', + messagesCount: 1, }), expect.objectContaining({ id: bibiCreatedContribution.id, memo: 'Herzlich Willkommen bei Gradido!', amount: '1000', + messagesCount: 0, }), ]), }) @@ -1099,24 +1114,28 @@ describe('ContributionResolver', () => { status: 'PENDING', memo: 'Test PENDING contribution update', amount: '10', + messagesCount: 1, }), expect.objectContaining({ id: contributionToDeny.data.createContribution.id, status: 'DENIED', memo: 'Test contribution to deny', amount: '100', + messagesCount: 0, }), expect.objectContaining({ id: contributionToDelete.data.createContribution.id, status: 'DELETED', memo: 'Test contribution to delete', amount: '100', + messagesCount: 0, }), expect.objectContaining({ id: inProgressContribution.data.createContribution.id, status: 'IN_PROGRESS', memo: 'Test IN_PROGRESS contribution', amount: '100', + messagesCount: 1, }), ]), }) @@ -1230,42 +1249,49 @@ describe('ContributionResolver', () => { status: 'CONFIRMED', id: contributionToConfirm.data.createContribution.id, memo: 'Test contribution to confirm', + messagesCount: 0, }), expect.objectContaining({ id: pendingContribution.data.createContribution.id, status: 'PENDING', memo: 'Test PENDING contribution update', amount: '10', + messagesCount: 0, }), expect.objectContaining({ id: contributionToDeny.data.createContribution.id, status: 'DENIED', memo: 'Test contribution to deny', amount: '100', + messagesCount: 0, }), expect.objectContaining({ id: inProgressContribution.data.createContribution.id, status: 'IN_PROGRESS', memo: 'Test IN_PROGRESS contribution', amount: '100', + messagesCount: 0, }), expect.objectContaining({ id: bibiCreatedContribution.id, status: 'CONFIRMED', memo: 'Herzlich Willkommen bei Gradido!', amount: '1000', + messagesCount: 0, }), expect.objectContaining({ id: expect.any(Number), status: 'CONFIRMED', memo: 'Whatever contribution', amount: '166', + messagesCount: 0, }), expect.objectContaining({ id: expect.any(Number), status: 'DENIED', memo: 'Whatever contribution', amount: '166', + messagesCount: 0, }), ]), }) @@ -1295,42 +1321,49 @@ describe('ContributionResolver', () => { status: 'CONFIRMED', id: contributionToConfirm.data.createContribution.id, memo: 'Test contribution to confirm', + messagesCount: 0, }), expect.objectContaining({ id: pendingContribution.data.createContribution.id, status: 'PENDING', memo: 'Test PENDING contribution update', amount: '10', + messagesCount: 0, }), expect.objectContaining({ id: contributionToDeny.data.createContribution.id, status: 'DENIED', memo: 'Test contribution to deny', amount: '100', + messagesCount: 0, }), expect.objectContaining({ id: inProgressContribution.data.createContribution.id, status: 'IN_PROGRESS', memo: 'Test IN_PROGRESS contribution', amount: '100', + messagesCount: 0, }), expect.objectContaining({ id: bibiCreatedContribution.id, status: 'CONFIRMED', memo: 'Herzlich Willkommen bei Gradido!', amount: '1000', + messagesCount: 0, }), expect.objectContaining({ id: expect.any(Number), status: 'CONFIRMED', memo: 'Whatever contribution', amount: '166', + messagesCount: 0, }), expect.objectContaining({ id: expect.any(Number), status: 'DENIED', memo: 'Whatever contribution', amount: '166', + messagesCount: 0, }), ]), }) @@ -1360,42 +1393,49 @@ describe('ContributionResolver', () => { status: 'CONFIRMED', id: contributionToConfirm.data.createContribution.id, memo: 'Test contribution to confirm', + messagesCount: 0, }), expect.objectContaining({ id: pendingContribution.data.createContribution.id, status: 'PENDING', memo: 'Test PENDING contribution update', amount: '10', + messagesCount: 0, }), expect.objectContaining({ id: contributionToDeny.data.createContribution.id, status: 'DENIED', memo: 'Test contribution to deny', amount: '100', + messagesCount: 0, }), expect.objectContaining({ id: inProgressContribution.data.createContribution.id, status: 'IN_PROGRESS', memo: 'Test IN_PROGRESS contribution', amount: '100', + messagesCount: 0, }), expect.objectContaining({ id: bibiCreatedContribution.id, status: 'CONFIRMED', memo: 'Herzlich Willkommen bei Gradido!', amount: '1000', + messagesCount: 0, }), expect.objectContaining({ id: expect.any(Number), status: 'CONFIRMED', memo: 'Whatever contribution', amount: '166', + messagesCount: 0, }), expect.objectContaining({ id: expect.any(Number), status: 'DENIED', memo: 'Whatever contribution', amount: '166', + messagesCount: 0, }), ]), }) @@ -1422,18 +1462,21 @@ describe('ContributionResolver', () => { status: 'CONFIRMED', id: contributionToConfirm.data.createContribution.id, memo: 'Test contribution to confirm', + messagesCount: 0, }), expect.objectContaining({ id: bibiCreatedContribution.id, status: 'CONFIRMED', memo: 'Herzlich Willkommen bei Gradido!', amount: '1000', + messagesCount: 0, }), expect.objectContaining({ id: expect.any(Number), status: 'CONFIRMED', memo: 'Whatever contribution', amount: '166', + messagesCount: 0, }), expect.not.objectContaining({ status: 'PENDING', @@ -1484,6 +1527,7 @@ describe('ContributionResolver', () => { status: 'PENDING', memo: 'Test PENDING contribution update', amount: '10', + messagesCount: 0, }), ]), }) @@ -1522,6 +1566,7 @@ describe('ContributionResolver', () => { status: 'IN_PROGRESS', memo: 'Test IN_PROGRESS contribution', amount: '100', + messagesCount: 0, }), ]), }) @@ -1554,6 +1599,7 @@ describe('ContributionResolver', () => { status: 'DENIED', memo: 'Whatever contribution', amount: '166', + messagesCount: 0, }), expect.not.objectContaining({ status: 'CONFIRMED', @@ -1611,24 +1657,28 @@ describe('ContributionResolver', () => { status: 'CONFIRMED', id: contributionToConfirm.data.createContribution.id, memo: 'Test contribution to confirm', + messagesCount: 0, }), expect.objectContaining({ id: pendingContribution.data.createContribution.id, status: 'PENDING', memo: 'Test PENDING contribution update', amount: '10', + messagesCount: 0, }), expect.objectContaining({ id: bibiCreatedContribution.id, status: 'CONFIRMED', memo: 'Herzlich Willkommen bei Gradido!', amount: '1000', + messagesCount: 0, }), expect.objectContaining({ id: expect.any(Number), status: 'CONFIRMED', memo: 'Whatever contribution', amount: '166', + messagesCount: 0, }), expect.not.objectContaining({ status: 'DENIED', @@ -2825,7 +2875,7 @@ describe('ContributionResolver', () => { id: expect.any(Number), lastName: 'Bloxberg', memo: 'Test PENDING contribution update', - messagesCount: 1, + messagesCount: 2, status: 'PENDING', }), expect.objectContaining({ From 604d67dd63cb428d29027927b5955fd90d9ac32f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 5 Jul 2023 11:08:23 +0200 Subject: [PATCH 26/34] lint --- backend/src/graphql/resolver/ContributionResolver.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.test.ts b/backend/src/graphql/resolver/ContributionResolver.test.ts index 68ff97b05..cbb92eff8 100644 --- a/backend/src/graphql/resolver/ContributionResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionResolver.test.ts @@ -11,6 +11,7 @@ import { ApolloServerTestClient } from 'apollo-server-testing' import { Decimal } from 'decimal.js-light' import { GraphQLError } from 'graphql' +import { ContributionMessageType } from '@enum/ContributionMessageType' import { ContributionStatus } from '@enum/ContributionStatus' import { Order } from '@enum/Order' import { @@ -55,7 +56,6 @@ import { garrickOllivander } from '@/seeds/users/garrick-ollivander' import { peterLustig } from '@/seeds/users/peter-lustig' import { raeuberHotzenplotz } from '@/seeds/users/raeuber-hotzenplotz' import { stephenHawking } from '@/seeds/users/stephen-hawking' -import { ContributionMessageType } from '../enum/ContributionMessageType' jest.mock('@/emails/sendEmailVariants') From e228d8b3e7a562a0cdd32ab74dd04ccddae2943f Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 5 Jul 2023 12:56:29 +0200 Subject: [PATCH 27/34] Correct the test message. --- .../src/graphql/resolver/ContributionMessageResolver.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts index d13d959eb..efb024de3 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts @@ -200,11 +200,11 @@ describe('ContributionMessageResolver', () => { ) }) - it("don't call sendAddedContributionMessageEmail", () => { + it('does not call sendAddedContributionMessageEmail', () => { expect(sendAddedContributionMessageEmail).not.toBeCalled() }) - it("don't change contribution status", async () => { + it('does not change contribution status', async () => { await expect(DbContribution.find()).resolves.toContainEqual( expect.objectContaining({ id: result.data.createContribution.id, From 960252e9fc3b5a540cf9a9d7dc6559431bd58912 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 6 Jul 2023 02:05:48 +0200 Subject: [PATCH 28/34] fix comment, typo --- backend/src/graphql/resolver/ContributionResolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index 8739e3ebf..80ea3e783 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -146,7 +146,7 @@ export class ContributionResolver { return new ContributionListResult( count, dbContributions.map((contribution) => { - // filter out moderator messages for this call8user) + // filter out moderator messages for this call contribution.messages = contribution.messages?.filter( (m) => m.type !== ContributionMessageType.MODERATOR, ) From 89c2c1c778daa49af0f2a5b8e164112569c78e17 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 6 Jul 2023 02:08:17 +0200 Subject: [PATCH 29/34] english typo --- .../src/graphql/resolver/ContributionMessageResolver.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts index efb024de3..a6e7d8867 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts @@ -251,7 +251,7 @@ describe('ContributionMessageResolver', () => { }) }) - it('change contribution status', async () => { + it('changes contribution status', async () => { await expect(DbContribution.find()).resolves.toContainEqual( expect.objectContaining({ id: result.data.createContribution.id, From 6571d9aaf228adaa160c8e1bb6c47fd1e1e925e4 Mon Sep 17 00:00:00 2001 From: elweyn Date: Thu, 6 Jul 2023 09:18:17 +0200 Subject: [PATCH 30/34] chore(release): v1.22.2 --- CHANGELOG.md | 9 +++++++++ admin/package.json | 2 +- backend/package.json | 2 +- database/package.json | 2 +- dht-node/package.json | 2 +- federation/package.json | 2 +- frontend/package.json | 2 +- package.json | 2 +- 8 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7f40485d..e0cb60e59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,17 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [1.22.2](https://github.com/gradido/gradido/compare/1.22.1...1.22.2) + +- fix(backend): moderation message are completely hidden from the user [`#3123`](https://github.com/gradido/gradido/pull/3123) +- fix(frontend): properly save username, do not allow to edit it again [`#3124`](https://github.com/gradido/gradido/pull/3124) +- fix(frontend): fix German "Speichern" to have capital letter [`#3122`](https://github.com/gradido/gradido/pull/3122) + #### [1.22.1](https://github.com/gradido/gradido/compare/1.22.0...1.22.1) +> 4 July 2023 + +- chore(release): v1.22.1 [`#3117`](https://github.com/gradido/gradido/pull/3117) - fix(backend): use base url from config in email templates [`#3114`](https://github.com/gradido/gradido/pull/3114) - feat(frontend): test right side layout template [`#3052`](https://github.com/gradido/gradido/pull/3052) - feat(backend): remove iota from backend [`#3115`](https://github.com/gradido/gradido/pull/3115) diff --git a/admin/package.json b/admin/package.json index 967a23dca..e406a2b16 100644 --- a/admin/package.json +++ b/admin/package.json @@ -3,7 +3,7 @@ "description": "Administraion Interface for Gradido", "main": "index.js", "author": "Moriz Wahl", - "version": "1.22.1", + "version": "1.22.2", "license": "Apache-2.0", "private": false, "scripts": { diff --git a/backend/package.json b/backend/package.json index 0a60a6e98..b0c65e87c 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "gradido-backend", - "version": "1.22.1", + "version": "1.22.2", "description": "Gradido unified backend providing an API-Service for Gradido Transactions", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/backend", diff --git a/database/package.json b/database/package.json index fce70e506..31c897698 100644 --- a/database/package.json +++ b/database/package.json @@ -1,6 +1,6 @@ { "name": "gradido-database", - "version": "1.22.1", + "version": "1.22.2", "description": "Gradido Database Tool to execute database migrations", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/database", diff --git a/dht-node/package.json b/dht-node/package.json index c3b8ef19a..5e0ccaf85 100644 --- a/dht-node/package.json +++ b/dht-node/package.json @@ -1,6 +1,6 @@ { "name": "gradido-dht-node", - "version": "1.22.1", + "version": "1.22.2", "description": "Gradido dht-node module", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/", diff --git a/federation/package.json b/federation/package.json index ac28a0317..7b33de9ae 100644 --- a/federation/package.json +++ b/federation/package.json @@ -1,6 +1,6 @@ { "name": "gradido-federation", - "version": "1.22.1", + "version": "1.22.2", "description": "Gradido federation module providing Gradido-Hub-Federation and versioned API for inter community communication", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/federation", diff --git a/frontend/package.json b/frontend/package.json index 5990998f7..4613b7ee1 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "bootstrap-vue-gradido-wallet", - "version": "1.22.1", + "version": "1.22.2", "private": true, "scripts": { "start": "node run/server.js", diff --git a/package.json b/package.json index f69c341e7..693321e75 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gradido", - "version": "1.22.1", + "version": "1.22.2", "description": "Gradido", "main": "index.js", "repository": "git@github.com:gradido/gradido.git", From caf1b8e9d8461097b90be19e09f46ecb00eadf4a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 6 Jul 2023 10:51:59 +0200 Subject: [PATCH 31/34] fix email-link --- backend/src/emails/templates/addedContributionMessage/html.pug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/emails/templates/addedContributionMessage/html.pug b/backend/src/emails/templates/addedContributionMessage/html.pug index b47bd4730..7865b2099 100644 --- a/backend/src/emails/templates/addedContributionMessage/html.pug +++ b/backend/src/emails/templates/addedContributionMessage/html.pug @@ -9,6 +9,6 @@ block content h2= t('emails.addedContributionMessage.readMessage') div(class="p_content")= t('emails.addedContributionMessage.toSeeAndAnswerMessage') - a.button-3(href=`${communityURL}contribution`) #{t('emails.general.toAccount')} + a.button-3(href=`${communityURL}community/contributions`) #{t('emails.general.toAccount')} include ../includes/doNotReply.pug From 5657798016cca199fb7a450d9288c50ca2c33d55 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 6 Jul 2023 11:03:34 +0200 Subject: [PATCH 32/34] fix snapshot --- backend/src/emails/__snapshots__/sendEmailVariants.test.ts.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/emails/__snapshots__/sendEmailVariants.test.ts.snap b/backend/src/emails/__snapshots__/sendEmailVariants.test.ts.snap index 5fedeed64..fb3a590e4 100644 --- a/backend/src/emails/__snapshots__/sendEmailVariants.test.ts.snap +++ b/backend/src/emails/__snapshots__/sendEmailVariants.test.ts.snap @@ -484,7 +484,7 @@ exports[`sendEmailVariants sendAddedContributionMessageEmail result has the corr

Read and reply to message

-
To view and reply to the message, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab.
To account +
To view and reply to the message, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab.
To account
Please do not reply to this email.
From 6a440e18b50ad64be084a17b30a6a4e9ab40a3d4 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 6 Jul 2023 11:07:57 +0200 Subject: [PATCH 33/34] fix email link to have correct url text --- .../src/emails/__snapshots__/sendEmailVariants.test.ts.snap | 6 +++--- .../emails/templates/includes/contributionDetailsCTA.pug | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/emails/__snapshots__/sendEmailVariants.test.ts.snap b/backend/src/emails/__snapshots__/sendEmailVariants.test.ts.snap index fb3a590e4..f05291eab 100644 --- a/backend/src/emails/__snapshots__/sendEmailVariants.test.ts.snap +++ b/backend/src/emails/__snapshots__/sendEmailVariants.test.ts.snap @@ -652,7 +652,7 @@ exports[`sendEmailVariants sendContributionConfirmedEmail result has the correct

Contribution details

To see your common good contributions and related messages, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab.
To account -
Or copy the link into your browser window.
http://localhost/community/contribution +
Or copy the link into your browser window.
http://localhost/community/contributions
Please do not reply to this email.
@@ -820,7 +820,7 @@ exports[`sendEmailVariants sendContributionDeletedEmail result has the correct h

Contribution details

To see your common good contributions and related messages, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab.
To account -
Or copy the link into your browser window.
http://localhost/community/contribution +
Or copy the link into your browser window.
http://localhost/community/contributions
Please do not reply to this email.
@@ -988,7 +988,7 @@ exports[`sendEmailVariants sendContributionDeniedEmail result has the correct ht

Contribution details

To see your common good contributions and related messages, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab.
To account -
Or copy the link into your browser window.
http://localhost/community/contribution +
Or copy the link into your browser window.
http://localhost/community/contributions
Please do not reply to this email.
diff --git a/backend/src/emails/templates/includes/contributionDetailsCTA.pug b/backend/src/emails/templates/includes/contributionDetailsCTA.pug index fc6075314..fb2906419 100644 --- a/backend/src/emails/templates/includes/contributionDetailsCTA.pug +++ b/backend/src/emails/templates/includes/contributionDetailsCTA.pug @@ -4,4 +4,4 @@ div(class="p_content")= t('emails.contribution.toSeeContributionsAndMessages') a.button-3(href=`${communityURL}community/contributions`) #{t('emails.general.toAccount')} div(class="p_content")= t('emails.general.orCopyLink') -a.clink(href=`${communityURL}community/contributions`) #{`${communityURL}community/contribution`} \ No newline at end of file +a.clink(href=`${communityURL}community/contributions`) #{`${communityURL}community/contributions`} \ No newline at end of file From 11057c48f0ca17a88c6fcd538dec3582deb08b67 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 6 Jul 2023 11:28:06 +0200 Subject: [PATCH 34/34] v.1.22.3 --- CHANGELOG.md | 7 +++++++ admin/package.json | 2 +- backend/package.json | 2 +- database/package.json | 2 +- dht-node/package.json | 2 +- federation/package.json | 2 +- frontend/package.json | 2 +- package.json | 2 +- 8 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0cb60e59..6261f9e7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [1.22.3](https://github.com/gradido/gradido/compare/1.22.2...1.22.3) + +- fix(backend): corrected email-link [`#3129`](https://github.com/gradido/gradido/pull/3129) + #### [1.22.2](https://github.com/gradido/gradido/compare/1.22.1...1.22.2) +> 6 July 2023 + +- chore(release): v1.22.2 [`#3127`](https://github.com/gradido/gradido/pull/3127) - fix(backend): moderation message are completely hidden from the user [`#3123`](https://github.com/gradido/gradido/pull/3123) - fix(frontend): properly save username, do not allow to edit it again [`#3124`](https://github.com/gradido/gradido/pull/3124) - fix(frontend): fix German "Speichern" to have capital letter [`#3122`](https://github.com/gradido/gradido/pull/3122) diff --git a/admin/package.json b/admin/package.json index e406a2b16..8350e146a 100644 --- a/admin/package.json +++ b/admin/package.json @@ -3,7 +3,7 @@ "description": "Administraion Interface for Gradido", "main": "index.js", "author": "Moriz Wahl", - "version": "1.22.2", + "version": "1.22.3", "license": "Apache-2.0", "private": false, "scripts": { diff --git a/backend/package.json b/backend/package.json index b0c65e87c..c03acf1ed 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "gradido-backend", - "version": "1.22.2", + "version": "1.22.3", "description": "Gradido unified backend providing an API-Service for Gradido Transactions", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/backend", diff --git a/database/package.json b/database/package.json index 31c897698..7d71883fc 100644 --- a/database/package.json +++ b/database/package.json @@ -1,6 +1,6 @@ { "name": "gradido-database", - "version": "1.22.2", + "version": "1.22.3", "description": "Gradido Database Tool to execute database migrations", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/database", diff --git a/dht-node/package.json b/dht-node/package.json index 5e0ccaf85..9c0211630 100644 --- a/dht-node/package.json +++ b/dht-node/package.json @@ -1,6 +1,6 @@ { "name": "gradido-dht-node", - "version": "1.22.2", + "version": "1.22.3", "description": "Gradido dht-node module", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/", diff --git a/federation/package.json b/federation/package.json index 7b33de9ae..c1db08f69 100644 --- a/federation/package.json +++ b/federation/package.json @@ -1,6 +1,6 @@ { "name": "gradido-federation", - "version": "1.22.2", + "version": "1.22.3", "description": "Gradido federation module providing Gradido-Hub-Federation and versioned API for inter community communication", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/federation", diff --git a/frontend/package.json b/frontend/package.json index 4613b7ee1..d60cea047 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "bootstrap-vue-gradido-wallet", - "version": "1.22.2", + "version": "1.22.3", "private": true, "scripts": { "start": "node run/server.js", diff --git a/package.json b/package.json index 693321e75..78f6f4bc7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gradido", - "version": "1.22.2", + "version": "1.22.3", "description": "Gradido", "main": "index.js", "repository": "git@github.com:gradido/gradido.git",