From c8499ec3ad70a4f986414b758b370e5142d8fa68 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 4 May 2022 19:25:49 +0200 Subject: [PATCH 01/34] add dht hyperswarm package --- backend/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/package.json b/backend/package.json index f195ab44f..52fde977a 100644 --- a/backend/package.json +++ b/backend/package.json @@ -17,6 +17,7 @@ "seed": "cross-env TZ=UTC NODE_ENV=development ts-node -r tsconfig-paths/register src/seeds/index.ts" }, "dependencies": { + "@hyperswarm/dht": "^5.0.25", "@types/jest": "^27.0.2", "@types/lodash.clonedeep": "^4.5.6", "apollo-log": "^1.1.0", From 5f24c316c81680e9ba3eaf7bba82f2df538813ac Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 4 May 2022 19:27:05 +0200 Subject: [PATCH 02/34] add module type definition for hyperswarm --- backend/src/federation/@types/@hyperswarm__dht/index.d.ts | 1 + backend/tsconfig.json | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 backend/src/federation/@types/@hyperswarm__dht/index.d.ts diff --git a/backend/src/federation/@types/@hyperswarm__dht/index.d.ts b/backend/src/federation/@types/@hyperswarm__dht/index.d.ts new file mode 100644 index 000000000..efb9ad438 --- /dev/null +++ b/backend/src/federation/@types/@hyperswarm__dht/index.d.ts @@ -0,0 +1 @@ +declare module '@hyperswarm/dht' diff --git a/backend/tsconfig.json b/backend/tsconfig.json index f81bf22d5..d0039646f 100644 --- a/backend/tsconfig.json +++ b/backend/tsconfig.json @@ -58,7 +58,10 @@ "@entity/*": ["../database/entity/*", "../../database/build/entity/*"] }, // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ + "typeRoots": [ /* List of folders to include type definitions from. */ + "src/federation/@types", + "node_modules/@types" + ], // "types": [], /* Type declaration files to be included in compilation. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ From e2efd0da9d24e13301046eccdbaf9bf62aa9da44 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 4 May 2022 19:28:18 +0200 Subject: [PATCH 03/34] add env and config for dht topic as switch --- backend/.env.dist | 7 +- backend/.env.template | 5 +- backend/src/config/index.ts | 7 +- backend/yarn.lock | 364 +++++++++++++++++++++++++++++++- deployment/bare_metal/.env.dist | 8 +- 5 files changed, 383 insertions(+), 8 deletions(-) diff --git a/backend/.env.dist b/backend/.env.dist index de33a7272..83274419d 100644 --- a/backend/.env.dist +++ b/backend/.env.dist @@ -49,4 +49,9 @@ EMAIL_CODE_VALID_TIME=1440 EMAIL_CODE_REQUEST_TIME=10 # Webhook -WEBHOOK_ELOPAGE_SECRET=secret \ No newline at end of file +WEBHOOK_ELOPAGE_SECRET=secret + +# DHT +# if you set this value, the DHT hyperswarm will start to announce and listen +# on an hash created from this tpoic +# DHT_TOPIC=GRADIDO_HUB \ No newline at end of file diff --git a/backend/.env.template b/backend/.env.template index 8ce8fca4e..4e53e5a3c 100644 --- a/backend/.env.template +++ b/backend/.env.template @@ -47,4 +47,7 @@ EMAIL_CODE_VALID_TIME=$EMAIL_CODE_VALID_TIME EMAIL_CODE_REQUEST_TIME=$EMAIL_CODE_REQUEST_TIME # Webhook -WEBHOOK_ELOPAGE_SECRET=$WEBHOOK_ELOPAGE_SECRET \ No newline at end of file +WEBHOOK_ELOPAGE_SECRET=$WEBHOOK_ELOPAGE_SECRET + +# DHT +DHT_TOPIC=$DHT_TOPIC \ No newline at end of file diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 1eee1b9a4..f870faf99 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -14,7 +14,7 @@ const constants = { DECAY_START_TIME: new Date('2021-05-13 17:46:31'), // GMT+0 CONFIG_VERSION: { DEFAULT: 'DEFAULT', - EXPECTED: 'v6.2022-04-21', + EXPECTED: 'v7.2022-05-04', CURRENT: '', }, } @@ -104,6 +104,10 @@ if ( ) } +const federation = { + DHT_TOPIC: process.env.DHT_TOPIC || null, +} + const CONFIG = { ...constants, ...server, @@ -113,6 +117,7 @@ const CONFIG = { ...email, ...loginServer, ...webhook, + ...federation, } export default CONFIG diff --git a/backend/yarn.lock b/backend/yarn.lock index f37b64d11..6f16cbbba 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -394,6 +394,40 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz#87de7af9c231826fdd68ac7258f77c429e0e5fcf" integrity sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w== +"@hyperswarm/dht@^5.0.25": + version "5.0.25" + resolved "https://registry.yarnpkg.com/@hyperswarm/dht/-/dht-5.0.25.tgz#eb9f4c314715723ed7e7dcec2b3dbe2722fddda2" + integrity sha512-x8Fpvp96NSb3M/0Fap2rm70obpNd0fe8oJnwZxJfIvxQtItYFVCrD8URsI+0Fxt4tNINMxnE9h3MaKoaxePP2A== + dependencies: + "@hyperswarm/secret-stream" "^5.1.0" + b4a "^1.3.1" + bind-easy "^1.0.1" + bogon "^1.0.0" + compact-encoding "^2.4.1" + compact-encoding-net "^1.0.1" + debugging-stream "^2.0.0" + dht-rpc "^5.0.1" + noise-curve-ed "^1.0.2" + noise-handshake "^2.1.0" + record-cache "^1.1.1" + safety-catch "^1.0.1" + sodium-universal "^3.0.4" + utp-native "^2.5.3" + xache "^1.0.0" + +"@hyperswarm/secret-stream@^5.1.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@hyperswarm/secret-stream/-/secret-stream-5.2.0.tgz#26621646d3f696e81a33a92f61db31b20be9bfd3" + integrity sha512-GwgLlbJV0DgvdTm0hPfyM4IWcWqJXIPCgkZ/DAh5CJ0HX8WW/4pDw70h7fRK5zBU1XUT6IYO2QAOeqZS+e9Dvg== + dependencies: + b4a "^1.1.0" + noise-curve-ed "^1.0.2" + noise-handshake "^2.1.0" + sodium-secretstream "^1.0.0" + sodium-universal "^3.0.4" + streamx "^2.10.2" + timeout-refresh "^2.0.0" + "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -1494,6 +1528,11 @@ axios@^0.21.1: dependencies: follow-redirects "^1.14.0" +b4a@^1.0.1, b4a@^1.1.0, b4a@^1.1.1, b4a@^1.3.0, b4a@^1.3.1: + version "1.5.0" + resolved "https://registry.yarnpkg.com/b4a/-/b4a-1.5.0.tgz#cb071ca8f4e6f1eaf7d269c9ccc8eea21a914d00" + integrity sha512-J20PbRmSy38jW9TmqGEwd8xINUCuOm2I2bPQ1sK8LWLxKTbhPh0H48DJ27ff2qmSXvI30WYV0tKzSmGb+oCsXg== + babel-jest@^27.2.5: version "27.2.5" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-27.2.5.tgz#6bbbc1bb4200fe0bfd1b1fbcbe02fc62ebed16aa" @@ -1570,6 +1609,27 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== +bind-easy@^1.0.0, bind-easy@^1.0.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/bind-easy/-/bind-easy-1.1.2.tgz#d10f9be896e53fb84f49465be5b1ab9b089dbcff" + integrity sha512-2+VjZ87WFdOFnsH4tHnmtf0HF6D2T3ZNdU1t1FYIz2jt4N3tyqbg2J0bYbflXdBkVi3xfVc8Pm8NB062SPvVVA== + +blake2b-wasm@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/blake2b-wasm/-/blake2b-wasm-2.4.0.tgz#9115649111edbbd87eb24ce7c04b427e4e2be5be" + integrity sha512-S1kwmW2ZhZFFFOghcx73+ZajEfKBqhP82JMssxtLVMxlaPea1p9uoLiUZ5WYyHn0KddwbLc+0vh4wR0KBNoT5w== + dependencies: + b4a "^1.0.1" + nanoassert "^2.0.0" + +blake2b@^2.1.1: + version "2.1.4" + resolved "https://registry.yarnpkg.com/blake2b/-/blake2b-2.1.4.tgz#817d278526ddb4cd673bfb1af16d1ad61e393ba3" + integrity sha512-AyBuuJNI64gIvwx13qiICz6H6hpmjvYS5DGkG6jbXMOT8Z3WUJ3V1X0FlhIoT1b/5JtHE3ki+xjtMvu1nn+t9A== + dependencies: + blake2b-wasm "^2.4.0" + nanoassert "^2.0.0" + body-parser@1.19.0, body-parser@^1.18.3: version "1.19.0" resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a" @@ -1586,6 +1646,11 @@ body-parser@1.19.0, body-parser@^1.18.3: raw-body "2.4.0" type-is "~1.6.17" +bogon@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/bogon/-/bogon-1.0.0.tgz#66b8cdd269f790e3aa988e157bb34d4ba75ee586" + integrity sha512-mXxtlBtnW8koqFWPUBtKJm97vBSKZRpOvxvMRVun33qQXwMNfQzq9eTcQzKzqEoNUhNqF9t8rDc/wakKCcHMTg== + boxen@^5.0.0: version "5.1.2" resolved "https://registry.yarnpkg.com/boxen/-/boxen-5.1.2.tgz#788cb686fc83c1f486dfa8a40c68fc2b831d2b50" @@ -1708,6 +1773,13 @@ caniuse-lite@^1.0.30001264: resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001325.tgz" integrity sha512-sB1bZHjseSjDtijV1Hb7PB2Zd58Kyx+n/9EotvZ4Qcz2K3d0lWB8dB4nb8wN/TsOGFq3UuAm0zQZNQ4SoR7TrQ== +chacha20-universal@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/chacha20-universal/-/chacha20-universal-1.0.4.tgz#e8a33a386500b1ce5361b811ec5e81f1797883f5" + integrity sha512-/IOxdWWNa7nRabfe7+oF+jVkGjlr2xUL4J8l/OvzZhj+c9RpMqoo3Dq+5nU1j/BflRV4BKnaQ4+4oH1yBpQG1Q== + dependencies: + nanoassert "^2.0.0" + chalk@^2.0.0: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -1836,6 +1908,20 @@ commander@^2.20.3: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== +compact-encoding-net@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/compact-encoding-net/-/compact-encoding-net-1.0.1.tgz#4da743d52721f5d0cc73a6d00556a96bc9b9fa1b" + integrity sha512-N9k1Qwg9b1ENk+TZsZhthzkuMtn3rn4ZinN75gf3/LplE+uaTCKjyaau5sK0m2NEUa/MmR77VxiGfD/Qz1ar0g== + dependencies: + compact-encoding "^2.4.1" + +compact-encoding@^2.1.0, compact-encoding@^2.4.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/compact-encoding/-/compact-encoding-2.6.1.tgz#a1b854f543dea9e4c1fc89f1f77ed0a3adfe19b2" + integrity sha512-4BqkIbqQG8PbTXo2UQdAKsbp+IswdjPKrEsFg377M/LxVJ/NEmpNuNjVAxcVWbNsUGHcRSQo/L0tWM6KlAvZRg== + dependencies: + b4a "^1.3.0" + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -1973,6 +2059,13 @@ debug@^3.2.6, debug@^3.2.7: dependencies: ms "^2.1.1" +debugging-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/debugging-stream/-/debugging-stream-2.0.0.tgz#515cad5a35299cf4b4bc0afcbd69d52c809c84ce" + integrity sha512-xwfl6wB/3xc553uwtGnSa94jFxnGOc02C0WU2Nmzwr80gzeqn1FX4VcbvoKIhe8L/lPq4BTQttAbrTN94uN8rA== + 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" @@ -2052,6 +2145,22 @@ detect-newline@^3.0.0: resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== +dht-rpc@^5.0.1: + version "5.0.5" + resolved "https://registry.yarnpkg.com/dht-rpc/-/dht-rpc-5.0.5.tgz#c7b167674cbe9b8c95de185a700d6ebcd8c12d55" + integrity sha512-qcqwacG0m6zxrwTOCrL6LcOcXJRscAH1ykfDsUvGznWuKY1MxOV33IKLgy9pnmoJddyMTMRxFZxRD85/vnt+2g== + dependencies: + b4a "^1.3.1" + bind-easy "^1.0.0" + compact-encoding "^2.1.0" + compact-encoding-net "^1.0.1" + fast-fifo "^1.0.0" + kademlia-routing-table "^1.0.0" + nat-sampler "^1.0.1" + sodium-universal "^3.0.4" + streamx "^2.10.3" + time-ordered-set "^1.0.2" + dicer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/dicer/-/dicer-0.3.0.tgz#eacd98b3bfbf92e8ab5c2fdb71aaac44bb06b872" @@ -2537,6 +2646,11 @@ fast-diff@^1.1.2: resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== +fast-fifo@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.1.0.tgz#17d1a3646880b9891dfa0c54e69c5fef33cad779" + integrity sha512-Kl29QoNbNvn4nhDsLYjyIAaIqaJB6rBx5p3sL9VjaefJ+eMFBWVZiaoguaoZfzEKr5RhAti0UgM8703akGPJ6g== + fast-glob@^3.1.1: version "3.2.7" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" @@ -2903,6 +3017,15 @@ has@^1.0.3: dependencies: function-bind "^1.1.1" +hmac-blake2b@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/hmac-blake2b/-/hmac-blake2b-2.0.0.tgz#09494e5d245d7afe45d157093080b159f7bacf15" + integrity sha512-JbGNtM1YRd8EQH/2vNTAP1oy5lJVPlBFYZfCJTu3k8sqOUm0rRIf/3+MCd5noVykETwTbun6jEOc+4Tu78ubHA== + dependencies: + nanoassert "^1.1.0" + sodium-native "^3.1.1" + sodium-universal "^3.0.0" + hosted-git-info@^2.1.4: version "2.8.9" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" @@ -3043,7 +3166,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4, inherits@^2.0.1: +inherits@2, inherits@2.0.4, 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== @@ -3130,6 +3253,13 @@ is-core-module@^2.2.0, is-core-module@^2.6.0: dependencies: has "^1.0.3" +is-core-module@^2.8.1: + version "2.9.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" + integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== + dependencies: + has "^1.0.3" + is-date-object@^1.0.1: version "1.0.5" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.5.tgz#0841d5536e724c25597bf6ea62e1bd38298df31f" @@ -3843,6 +3973,11 @@ jws@^3.2.2: jwa "^1.4.1" safe-buffer "^5.0.1" +kademlia-routing-table@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/kademlia-routing-table/-/kademlia-routing-table-1.0.1.tgz#6f18416f612e885a8d4df128f04c490a90d772f6" + integrity sha512-dKk19sC3/+kWhBIvOKCthxVV+JH0NrswSBq4sA4eOkkPMqQM1rRuOWte1WSKXeP8r9Nx4NuiH2gny3lMddJTpw== + keyv@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.1.0.tgz#ecc228486f69991e49e9476485a5be1e8fc5c4d9" @@ -4150,11 +4285,31 @@ named-placeholders@^1.1.2: dependencies: lru-cache "^4.1.3" +nanoassert@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/nanoassert/-/nanoassert-1.1.0.tgz#4f3152e09540fde28c76f44b19bbcd1d5a42478d" + integrity sha1-TzFS4JVA/eKMdvRLGbvNHVpCR40= + +nanoassert@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/nanoassert/-/nanoassert-2.0.0.tgz#a05f86de6c7a51618038a620f88878ed1e490c09" + integrity sha512-7vO7n28+aYO4J+8w96AzhmU8G+Y/xpPDJz/se19ICsqj/momRbb9mh9ZUtkoJ5X3nTnPdhEJyc0qnM6yAsHBaA== + nanoid@^3.1.20: version "3.1.32" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.32.tgz#8f96069e6239cc0a9ae8c0d3b41a3b4933a88c0a" integrity sha512-F8mf7R3iT9bvThBoW4tGXhXFHCctyCiUUPrWF8WaTqa3h96d9QybkSeba43XVOOE3oiLfkVDe4bT8MeGmkrTxw== +napi-macros@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.0.0.tgz#2b6bae421e7b96eb687aa6c77a7858640670001b" + integrity sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg== + +nat-sampler@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/nat-sampler/-/nat-sampler-1.0.1.tgz#2b68338ea6d4c139450cd971fd00a4ac1b33d923" + integrity sha512-yQvyNN7xbqR8crTKk3U8gRgpcV1Az+vfCEijiHu9oHHsnIl8n3x+yXNHl42M6L3czGynAVoOT9TqBfS87gDdcw== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -4172,6 +4327,11 @@ node-fetch@^2.6.1: dependencies: whatwg-url "^5.0.0" +node-gyp-build@^4.2.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.4.0.tgz#42e99687ce87ddeaf3a10b99dc06abc11021f3f4" + integrity sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ== + node-gyp-build@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.3.0.tgz#9f256b03e5826150be39c764bf51e993946d71a3" @@ -4213,6 +4373,25 @@ nodemon@^2.0.7: undefsafe "^2.0.3" update-notifier "^5.1.0" +noise-curve-ed@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/noise-curve-ed/-/noise-curve-ed-1.0.4.tgz#8ae83f5d2d2e31d0c9c069271ca6e462d31cd884" + integrity sha512-plUUSEOU66FZ9TaBKpk4+fgQeeS+OLlThS2o8a1TxVpMWV2v1izvEnjSpFV9gEPZl4/1yN+S5KqLubFjogqQOw== + dependencies: + b4a "^1.1.0" + nanoassert "^2.0.0" + sodium-universal "^3.0.4" + +noise-handshake@^2.1.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/noise-handshake/-/noise-handshake-2.2.0.tgz#24c98f502d49118770e1ec2af2894b8789f0ac7c" + integrity sha512-+0mFUc5YSnOPI+4K/7nr6XDGduITaUasPVurzrH03sk6yW+udKxP/qjEwEekRwIpnvcCKYnjiZ9HJenJv9ljZg== + dependencies: + b4a "^1.1.0" + hmac-blake2b "^2.0.0" + nanoassert "^2.0.0" + sodium-universal "^3.0.4" + nopt@~1.0.10: version "1.0.10" resolved "https://registry.yarnpkg.com/nopt/-/nopt-1.0.10.tgz#6ddd21bd2a31417b92727dd585f8a6f37608ebee" @@ -4443,7 +4622,7 @@ path-key@^3.0.0, path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.6: +path-parse@^1.0.6, path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -4611,6 +4790,11 @@ queue-microtask@^1.2.2: resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== +queue-tick@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/queue-tick/-/queue-tick-1.0.0.tgz#011104793a3309ae86bfeddd54e251dc94a36725" + integrity sha512-ULWhjjE8BmiICGn3G8+1L9wFpERNxkf8ysxkAer4+TFdRefDaXOCV5m92aMB9FtBVmn/8sETXLXY6BfW7hyaWQ== + random-bigint@^0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/random-bigint/-/random-bigint-0.0.1.tgz#684de0a93784ab7448a441393916f0e632c95df9" @@ -4663,6 +4847,15 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" +readable-stream@^3.0.2: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + 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" @@ -4670,6 +4863,13 @@ readdirp@~3.6.0: dependencies: picomatch "^2.2.1" +record-cache@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/record-cache/-/record-cache-1.2.0.tgz#e601bc4f164d58330cc00055e27aa4682291c882" + integrity sha512-kyy3HWCez2WrotaL3O4fTn0rsIdfRKOdQQcEJ9KpvmKmbffKVvwsloX063EgRUlpJIXHiDQFhJcTbZequ2uTZw== + 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" @@ -4729,6 +4929,15 @@ resolve@^1.10.0, resolve@^1.10.1, resolve@^1.20.0: is-core-module "^2.2.0" path-parse "^1.0.6" +resolve@^1.17.0: + version "1.22.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" + integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== + dependencies: + is-core-module "^2.8.1" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + responselike@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7" @@ -4765,7 +4974,7 @@ safe-buffer@5.1.2, safe-buffer@~5.1.1: 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: +safe-buffer@^5.0.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -4775,6 +4984,11 @@ safe-buffer@^5.0.1: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== +safety-catch@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/safety-catch/-/safety-catch-1.0.2.tgz#d64cbd57fd601da91c356b6ab8902f3e449a7a4b" + integrity sha512-C1UYVZ4dtbBxEtvOcpjBaaD27nP8MlvyAQEp2fOTOEe6pfUpk1cDUxij6BR1jZup6rSyUTaBBplK7LanskrULA== + saxes@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d" @@ -4858,6 +5072,38 @@ sha.js@^2.4.11: 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" + integrity sha512-ghn3muhdn1ailCQqqceNxRgkOeZSVfSE13RQWEg6njB+itsFzGVSJv+O//2hvNXZuxVIRyNzrgsZ37SPDdGJJw== + dependencies: + b4a "^1.0.1" + sha256-wasm "^2.2.1" + +sha256-wasm@^2.2.1: + version "2.2.2" + resolved "https://registry.yarnpkg.com/sha256-wasm/-/sha256-wasm-2.2.2.tgz#4940b6c9ba28f3f08b700efce587ef36d4d516d4" + integrity sha512-qKSGARvao+JQlFiA+sjJZhJ/61gmW/3aNLblB2rsgIxDlDxsJPHo8a1seXj12oKtuHVgJSJJ7QEGBUYQN741lQ== + dependencies: + b4a "^1.0.1" + nanoassert "^2.0.0" + +sha512-universal@^1.1.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/sha512-universal/-/sha512-universal-1.2.1.tgz#829505a7586530515cc1a10b78815c99722c4df0" + integrity sha512-kehYuigMoRkIngCv7rhgruLJNNHDnitGTBdkcYbCbooL8Cidj/bS78MDxByIjcc69M915WxcQTgZetZ1JbeQTQ== + dependencies: + b4a "^1.0.1" + sha512-wasm "^2.3.1" + +sha512-wasm@^2.3.1: + version "2.3.4" + resolved "https://registry.yarnpkg.com/sha512-wasm/-/sha512-wasm-2.3.4.tgz#b86b37112ff6d1fc3740f2484a6855f17a6e1300" + integrity sha512-akWoxJPGCB3aZCrZ+fm6VIFhJ/p8idBv7AWGFng/CZIrQo51oQNsvDbTSRXWAzIiZJvpy16oIDiCCPqTe21sKg== + dependencies: + b4a "^1.0.1" + nanoassert "^2.0.0" + shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -4884,6 +5130,13 @@ signal-exit@^3.0.2, signal-exit@^3.0.3: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.5.tgz#9e3e8cc0c75a99472b44321033a7702e7738252f" integrity sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ== +siphash24@^1.0.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/siphash24/-/siphash24-1.3.1.tgz#7f87fd2c5db88d8d46335a68f780f281641c8b22" + integrity sha512-moemC3ZKiTzH29nbFo3Iw8fbemWWod4vNs/WgKbQ54oEs6mE6XVlguxvinYjB+UmaE0PThgyED9fUkWvirT8hA== + dependencies: + nanoassert "^2.0.0" + sisteransi@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" @@ -4903,13 +5156,50 @@ slice-ansi@^4.0.0: astral-regex "^2.0.0" is-fullwidth-code-point "^3.0.0" -sodium-native@^3.3.0: +sodium-javascript@~0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/sodium-javascript/-/sodium-javascript-0.8.0.tgz#0a94d7bb58ab17be82255f3949259af59778fdbc" + integrity sha512-rEBzR5mPxPES+UjyMDvKPIXy9ImF17KOJ32nJNi9uIquWpS/nfj+h6m05J5yLJaGXjgM72LmQoUbWZVxh/rmGg== + dependencies: + blake2b "^2.1.1" + chacha20-universal "^1.0.4" + nanoassert "^2.0.0" + sha256-universal "^1.1.0" + sha512-universal "^1.1.0" + siphash24 "^1.0.1" + xsalsa20 "^1.0.0" + +sodium-native@^3.1.1, sodium-native@^3.2.0, sodium-native@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/sodium-native/-/sodium-native-3.3.0.tgz#50ee52ac843315866cce3d0c08ab03eb78f22361" integrity sha512-rg6lCDM/qa3p07YGqaVD+ciAbUqm6SoO4xmlcfkbU5r1zIGrguXztLiEtaLYTV5U6k8KSIUFmnU3yQUSKmf6DA== dependencies: node-gyp-build "^4.3.0" +sodium-secretstream@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/sodium-secretstream/-/sodium-secretstream-1.0.2.tgz#ae6fec16555f1a1d9fd2460b41256736d5044e13" + integrity sha512-AsWztbBHhHid+w5g28ftXA0mTrS52Dup7FYI0GR7ri1TQTlVsw0z//FNlhIqWsgtBctO/DxQosacbElCpmdcZw== + dependencies: + b4a "^1.1.1" + sodium-universal "^3.0.4" + +sodium-universal@^3.0.0, sodium-universal@^3.0.4: + version "3.1.0" + resolved "https://registry.yarnpkg.com/sodium-universal/-/sodium-universal-3.1.0.tgz#f2fa0384d16b7cb99b1c8551a39cc05391a3ed41" + integrity sha512-N2gxk68Kg2qZLSJ4h0NffEhp4BjgWHCHXVlDi1aG1hA3y+ZeWEmHqnpml8Hy47QzfL1xLy5nwr9LcsWAg2Ep0A== + dependencies: + blake2b "^2.1.1" + chacha20-universal "^1.0.4" + nanoassert "^2.0.0" + resolve "^1.17.0" + sha256-universal "^1.1.0" + sha512-universal "^1.1.0" + siphash24 "^1.0.1" + sodium-javascript "~0.8.0" + sodium-native "^3.2.0" + xsalsa20 "^1.0.0" + source-map-support@^0.5.6: version "0.5.20" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.20.tgz#12166089f8f5e5e8c56926b377633392dd2cb6c9" @@ -4986,6 +5276,14 @@ streamsearch@0.1.2: resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-0.1.2.tgz#808b9d0e56fc273d809ba57338e929919a1a9f1a" integrity sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo= +streamx@^2.10.2, streamx@^2.10.3, streamx@^2.12.4: + version "2.12.4" + resolved "https://registry.yarnpkg.com/streamx/-/streamx-2.12.4.tgz#0369848b20b8f79c65320735372df17cafcd9aff" + integrity sha512-K3xdIp8YSkvbdI0PrCcP0JkniN8cPCyeKlcZgRFSl1o1xKINCYM93FryvTSOY57x73pz5/AjO5B8b9BYf21wWw== + dependencies: + fast-fifo "^1.0.0" + queue-tick "^1.0.0" + string-length@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" @@ -5019,6 +5317,13 @@ string.prototype.trimstart@^1.0.4: call-bind "^1.0.2" define-properties "^1.1.3" +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.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" @@ -5091,6 +5396,11 @@ supports-hyperlinks@^2.0.0: has-flag "^4.0.0" supports-color "^7.0.0" +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + symbol-observable@^1.0.4: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" @@ -5140,6 +5450,21 @@ throat@^6.0.1: resolved "https://registry.yarnpkg.com/throat/-/throat-6.0.1.tgz#d514fedad95740c12c2d7fc70ea863eb51ade375" integrity sha512-8hmiGIJMDlwjg7dlJ4yKGLK8EsYqKgPWbG3b4wjJddKNwc7N7Dpn08Df4szr/sZdMVeOstrdYSsqzX6BYbcB+w== +time-ordered-set@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/time-ordered-set/-/time-ordered-set-1.0.2.tgz#3bd931fc048234147f8c2b8b1ebbebb0a3ecb96f" + integrity sha512-vGO99JkxvgX+u+LtOKQEpYf31Kj3i/GNwVstfnh4dyINakMgeZCpew1e3Aj+06hEslhtHEd52g7m5IV+o1K8Mw== + +timeout-refresh@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/timeout-refresh/-/timeout-refresh-1.0.3.tgz#7024a8ce0a09a57acc2ea86002048e6c0bff7375" + integrity sha512-Mz0CX4vBGM5lj8ttbIFt7o4ZMxk/9rgudJRh76EvB7xXZMur7T/cjRiH2w4Fmkq0zxf2QpM8IFvOSRn8FEu3gA== + +timeout-refresh@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/timeout-refresh/-/timeout-refresh-2.0.1.tgz#f8ec7cf1f9d93b2635b7d4388cb820c5f6c16f98" + integrity sha512-SVqEcMZBsZF9mA78rjzCrYrUs37LMJk3ShZ851ygZYW1cMeIjs9mL57KO6Iv5mmjSQnOe/29/VAfGXo+oRCiVw== + tmpl@1.0.x: version "1.0.5" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" @@ -5363,6 +5688,11 @@ universalify@^0.1.2: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== +unordered-set@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/unordered-set/-/unordered-set-2.0.1.tgz#4cd0fe27b8814bcf5d6073e5f0966ec7a50841e6" + integrity sha512-eUmNTPzdx+q/WvOHW0bgGYLWvWHNT3PTKEQLg0MAQhc0AHASHVHoP/9YytYd4RBVariqno/mEUhVZN98CmD7bg== + unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" @@ -5402,6 +5732,11 @@ url-parse-lax@^3.0.0: dependencies: prepend-http "^2.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 sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + util.promisify@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.1.1.tgz#77832f57ced2c9478174149cae9b96e9918cd54b" @@ -5418,6 +5753,17 @@ utils-merge@1.0.1: resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= +utp-native@^2.5.3: + version "2.5.3" + resolved "https://registry.yarnpkg.com/utp-native/-/utp-native-2.5.3.tgz#7c04c2a8c2858716555a77d10adb9819e3119b25" + integrity sha512-sWTrWYXPhhWJh+cS2baPzhaZc89zwlWCfwSthUjGhLkZztyPhcQllo+XVVCbNGi7dhyRlxkWxN4NKU6FbA9Y8w== + dependencies: + napi-macros "^2.0.0" + node-gyp-build "^4.2.0" + readable-stream "^3.0.2" + timeout-refresh "^1.0.0" + unordered-set "^2.0.1" + uuid@^3.1.0: version "3.4.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" @@ -5584,6 +5930,11 @@ write-file-atomic@^3.0.0: resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.5.tgz#8b4bc4af518cfabd0473ae4f99144287b33eb881" integrity sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w== +xache@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/xache/-/xache-1.0.0.tgz#a252f8cbbe80e654ea4266bf172ca86e287be145" + integrity sha512-f4fYGFVY734UT4OOyTaKMdWdJ5asbMWKZvmQcoMFBeFNw0UOt0dEJTOlJeKmsduKqPj0UWsIx4SB76oCZagllQ== + xdg-basedir@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-4.0.0.tgz#4bc8d9984403696225ef83a1573cbbcb4e79db13" @@ -5599,6 +5950,11 @@ xmlchars@^2.2.0: resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== +xsalsa20@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/xsalsa20/-/xsalsa20-1.2.0.tgz#e5a05cb26f8cef723f94a559102ed50c1b44c25c" + integrity sha512-FIr/DEeoHfj7ftfylnoFt3rAIRoWXpx2AoDfrT2qD2wtp7Dp+COajvs/Icb7uHqRW9m60f5iXZwdsJJO3kvb7w== + xss@^1.0.8: version "1.0.10" resolved "https://registry.yarnpkg.com/xss/-/xss-1.0.10.tgz#5cd63a9b147a755a14cb0455c7db8866120eb4d2" diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index a1751a859..81772c169 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -52,6 +52,12 @@ EMAIL_CODE_REQUEST_TIME=10 WEBHOOK_ELOPAGE_SECRET=secret +## DHT +## if you set this value, the DHT hyperswarm will start to announce and listen +## on an hash created from this tpoic +# DHT_TOPIC=GRADIDO_HUB + + # database DATABASE_CONFIG_VERSION=v1.2022-03-18 @@ -76,4 +82,4 @@ META_AUTHOR="Bernd Hückstädt - Gradido-Akademie" ADMIN_CONFIG_VERSION=v1.2022-03-18 WALLET_AUTH_URL=https://stage1.gradido.net/authenticate?token={token} -WALLET_URL=https://stage1.gradido.net/login \ No newline at end of file +WALLET_URL=https://stage1.gradido.net/login From d514886728db9d5124d167ad5151d579bd9ed03a Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 4 May 2022 19:29:14 +0200 Subject: [PATCH 04/34] try using dht if DHT_TOPIC is set in .env --- backend/src/federation/index.ts | 12 ++++++++++++ backend/src/server/createServer.ts | 9 +++++++++ 2 files changed, 21 insertions(+) create mode 100644 backend/src/federation/index.ts diff --git a/backend/src/federation/index.ts b/backend/src/federation/index.ts new file mode 100644 index 000000000..cd9747732 --- /dev/null +++ b/backend/src/federation/index.ts @@ -0,0 +1,12 @@ +import DHT from '@hyperswarm/dht' +import { Connection } from '@dbTools/typeorm' + +const POLLTIME = 20000 +const SUCCESSTIME = 120000 +const ERRORTIME = 240000 +const ANNOUNCETIME = 30000 + +export const startDHT = async (connection: Connection, topic: string): Promise => { + console.log('topic', topic, typeof topic) + // const TOPIC = DHT.hash(Buffer.from(topic)) +} diff --git a/backend/src/server/createServer.ts b/backend/src/server/createServer.ts index 8315fda58..e2ea8ea08 100644 --- a/backend/src/server/createServer.ts +++ b/backend/src/server/createServer.ts @@ -22,6 +22,9 @@ import schema from '@/graphql/schema' import { elopageWebhook } from '@/webhook/elopage' import { Connection } from '@dbTools/typeorm' +// DHT +import { startDHT } from '@/federation/index' + // TODO implement // import queryComplexity, { simpleEstimator, fieldConfigEstimator } from "graphql-query-complexity"; @@ -41,6 +44,12 @@ const createServer = async (context: any = serverContext): Promise => throw new Error('Fatal: Database Version incorrect') } + // start DHT hyperswarm when DHT_TOPIC is set in .env + if (CONFIG.DHT_TOPIC) { + console.log('Starting hyperswarm DHT') + await startDHT(con, CONFIG.DHT_TOPIC) + } + // Express Server const app = express() From ab9e5c57120bc138443ac52a782f5ac9eac10e7b Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 4 May 2022 20:10:39 +0200 Subject: [PATCH 05/34] do I get this fucking shit running once? --- backend/src/federation/index.ts | 4 +++- backend/src/server/createServer.ts | 1 - backend/tsconfig.json | 7 ++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/backend/src/federation/index.ts b/backend/src/federation/index.ts index cd9747732..e20a7ee91 100644 --- a/backend/src/federation/index.ts +++ b/backend/src/federation/index.ts @@ -8,5 +8,7 @@ const ANNOUNCETIME = 30000 export const startDHT = async (connection: Connection, topic: string): Promise => { console.log('topic', topic, typeof topic) - // const TOPIC = DHT.hash(Buffer.from(topic)) + const buffer = Buffer.from(topic) + + const TOPIC = DHT.hash(buffer) } diff --git a/backend/src/server/createServer.ts b/backend/src/server/createServer.ts index e2ea8ea08..22bee0878 100644 --- a/backend/src/server/createServer.ts +++ b/backend/src/server/createServer.ts @@ -46,7 +46,6 @@ const createServer = async (context: any = serverContext): Promise => // start DHT hyperswarm when DHT_TOPIC is set in .env if (CONFIG.DHT_TOPIC) { - console.log('Starting hyperswarm DHT') await startDHT(con, CONFIG.DHT_TOPIC) } diff --git a/backend/tsconfig.json b/backend/tsconfig.json index d0039646f..a10b9f513 100644 --- a/backend/tsconfig.json +++ b/backend/tsconfig.json @@ -4,7 +4,7 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ + "target": "es2016", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ @@ -58,10 +58,7 @@ "@entity/*": ["../database/entity/*", "../../database/build/entity/*"] }, // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - "typeRoots": [ /* List of folders to include type definitions from. */ - "src/federation/@types", - "node_modules/@types" - ], + "typeRoots": ["src/federation/@types"], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ From 1515a97e2eec571c851a1d542a3da7991d59d17b Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 4 May 2022 21:14:20 +0200 Subject: [PATCH 06/34] include node modules --- backend/src/federation/index.ts | 10 +++++++--- backend/tsconfig.json | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/backend/src/federation/index.ts b/backend/src/federation/index.ts index e20a7ee91..5dabd3e24 100644 --- a/backend/src/federation/index.ts +++ b/backend/src/federation/index.ts @@ -7,8 +7,12 @@ const ERRORTIME = 240000 const ANNOUNCETIME = 30000 export const startDHT = async (connection: Connection, topic: string): Promise => { - console.log('topic', topic, typeof topic) - const buffer = Buffer.from(topic) + try { + console.log('topic', topic, typeof topic) + const buffer = Buffer.from(topic) - const TOPIC = DHT.hash(buffer) + const TOPIC = DHT.hash(buffer) + } catch (err) { + console.log(err) + } } diff --git a/backend/tsconfig.json b/backend/tsconfig.json index a10b9f513..6a59eb2c0 100644 --- a/backend/tsconfig.json +++ b/backend/tsconfig.json @@ -4,7 +4,7 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es2016", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ + "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ @@ -58,7 +58,7 @@ "@entity/*": ["../database/entity/*", "../../database/build/entity/*"] }, // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - "typeRoots": ["src/federation/@types"], /* List of folders to include type definitions from. */ + "typeRoots": ["src/federation/@types", "node_modules/@types"], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ From fc01c2d3981960c921158e8c5c2e74af46019b75 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 19 Jul 2022 14:46:58 +0200 Subject: [PATCH 07/34] update hyperswarm to 6.2.0 --- backend/package.json | 2 +- backend/yarn.lock | 184 ++++++++++++++++++------------------------- 2 files changed, 78 insertions(+), 108 deletions(-) diff --git a/backend/package.json b/backend/package.json index 392c16697..f89addab0 100644 --- a/backend/package.json +++ b/backend/package.json @@ -17,7 +17,7 @@ "seed": "cross-env TZ=UTC NODE_ENV=development ts-node -r tsconfig-paths/register src/seeds/index.ts" }, "dependencies": { - "@hyperswarm/dht": "^5.0.25", + "@hyperswarm/dht": "^6.2.0", "@types/jest": "^27.0.2", "@types/lodash.clonedeep": "^4.5.6", "apollo-server-express": "^2.25.2", diff --git a/backend/yarn.lock b/backend/yarn.lock index 69863d6fd..2ba541077 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -394,33 +394,35 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz#87de7af9c231826fdd68ac7258f77c429e0e5fcf" integrity sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w== -"@hyperswarm/dht@^5.0.25": - version "5.0.25" - resolved "https://registry.yarnpkg.com/@hyperswarm/dht/-/dht-5.0.25.tgz#eb9f4c314715723ed7e7dcec2b3dbe2722fddda2" - integrity sha512-x8Fpvp96NSb3M/0Fap2rm70obpNd0fe8oJnwZxJfIvxQtItYFVCrD8URsI+0Fxt4tNINMxnE9h3MaKoaxePP2A== +"@hyperswarm/dht@^6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@hyperswarm/dht/-/dht-6.2.0.tgz#b2cb1218752b52fabb66f304e73448a108d1effd" + integrity sha512-AeyfRdAkfCz/J3vTC4rdpzEpT7xQ+tls87Zpzw9Py3VGUZD8hMT7pr43OOdkCBNvcln6K/5/Lxhnq5lBkzH3yw== dependencies: - "@hyperswarm/secret-stream" "^5.1.0" + "@hyperswarm/secret-stream" "^6.0.0" b4a "^1.3.1" - bind-easy "^1.0.1" bogon "^1.0.0" compact-encoding "^2.4.1" compact-encoding-net "^1.0.1" debugging-stream "^2.0.0" - dht-rpc "^5.0.1" + dht-rpc "^6.0.0" + events "^3.3.0" + hypercore-crypto "^3.3.0" noise-curve-ed "^1.0.2" noise-handshake "^2.1.0" record-cache "^1.1.1" safety-catch "^1.0.1" sodium-universal "^3.0.4" - utp-native "^2.5.3" - xache "^1.0.0" + udx-native "^1.1.0" + xache "^1.1.0" -"@hyperswarm/secret-stream@^5.1.0": - version "5.2.0" - resolved "https://registry.yarnpkg.com/@hyperswarm/secret-stream/-/secret-stream-5.2.0.tgz#26621646d3f696e81a33a92f61db31b20be9bfd3" - integrity sha512-GwgLlbJV0DgvdTm0hPfyM4IWcWqJXIPCgkZ/DAh5CJ0HX8WW/4pDw70h7fRK5zBU1XUT6IYO2QAOeqZS+e9Dvg== +"@hyperswarm/secret-stream@^6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@hyperswarm/secret-stream/-/secret-stream-6.0.0.tgz#67db820308cc9fed899cb8f5e9f47ae819d5a4e3" + integrity sha512-0xuyJIJDe8JYk4uWUx25qJvWqybdjKU2ZIfP1GTqd7dQxwdR0bpYrQKdLkrn5txWSK4a28ySC2AjH0G3I0gXTA== dependencies: b4a "^1.1.0" + hypercore-crypto "^3.3.0" noise-curve-ed "^1.0.2" noise-handshake "^2.1.0" sodium-secretstream "^1.0.0" @@ -1487,10 +1489,10 @@ axios@^0.21.1: dependencies: follow-redirects "^1.14.0" -b4a@^1.0.1, b4a@^1.1.0, b4a@^1.1.1, b4a@^1.3.0, b4a@^1.3.1: - version "1.5.0" - resolved "https://registry.yarnpkg.com/b4a/-/b4a-1.5.0.tgz#cb071ca8f4e6f1eaf7d269c9ccc8eea21a914d00" - integrity sha512-J20PbRmSy38jW9TmqGEwd8xINUCuOm2I2bPQ1sK8LWLxKTbhPh0H48DJ27ff2qmSXvI30WYV0tKzSmGb+oCsXg== +b4a@^1.0.1, b4a@^1.1.0, b4a@^1.1.1, b4a@^1.3.0, b4a@^1.3.1, b4a@^1.5.0: + version "1.5.3" + resolved "https://registry.yarnpkg.com/b4a/-/b4a-1.5.3.tgz#56293b5607aeda3fd81c481e516e9f103fc88341" + integrity sha512-1aCQIzQJK7G0z1Una75tWMlwVAR8o+QHoAlnWc5XAxRVBESY9WsitfBgM5nPyDBP5HrhPU1Np4Pq2Y7CJQ+tVw== babel-jest@^27.2.5: version "27.2.5" @@ -1568,11 +1570,6 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== -bind-easy@^1.0.0, bind-easy@^1.0.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/bind-easy/-/bind-easy-1.1.2.tgz#d10f9be896e53fb84f49465be5b1ab9b089dbcff" - integrity sha512-2+VjZ87WFdOFnsH4tHnmtf0HF6D2T3ZNdU1t1FYIz2jt4N3tyqbg2J0bYbflXdBkVi3xfVc8Pm8NB062SPvVVA== - blake2b-wasm@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/blake2b-wasm/-/blake2b-wasm-2.4.0.tgz#9115649111edbbd87eb24ce7c04b427e4e2be5be" @@ -1874,10 +1871,10 @@ compact-encoding-net@^1.0.1: dependencies: compact-encoding "^2.4.1" -compact-encoding@^2.1.0, compact-encoding@^2.4.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/compact-encoding/-/compact-encoding-2.6.1.tgz#a1b854f543dea9e4c1fc89f1f77ed0a3adfe19b2" - integrity sha512-4BqkIbqQG8PbTXo2UQdAKsbp+IswdjPKrEsFg377M/LxVJ/NEmpNuNjVAxcVWbNsUGHcRSQo/L0tWM6KlAvZRg== +compact-encoding@^2.1.0, compact-encoding@^2.4.1, compact-encoding@^2.5.1: + version "2.7.0" + resolved "https://registry.yarnpkg.com/compact-encoding/-/compact-encoding-2.7.0.tgz#e6a0df408c25cbcdf7d619c97527074478cafd06" + integrity sha512-2I0A+pYKXYwxewbLxj26tU4pJyKlFNjadzjZ+36xJ5HwTrnhD9KcMQk3McEQRl1at6jrwA8E7UjmBdsGhEAPMw== dependencies: b4a "^1.3.0" @@ -2023,13 +2020,6 @@ debug@^3.2.6, debug@^3.2.7: dependencies: ms "^2.1.1" -debugging-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/debugging-stream/-/debugging-stream-2.0.0.tgz#515cad5a35299cf4b4bc0afcbd69d52c809c84ce" - integrity sha512-xwfl6wB/3xc553uwtGnSa94jFxnGOc02C0WU2Nmzwr80gzeqn1FX4VcbvoKIhe8L/lPq4BTQttAbrTN94uN8rA== - dependencies: - streamx "^2.12.4" - debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" @@ -2037,6 +2027,13 @@ debug@^4.3.4: dependencies: ms "2.1.2" +debugging-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/debugging-stream/-/debugging-stream-2.0.0.tgz#515cad5a35299cf4b4bc0afcbd69d52c809c84ce" + integrity sha512-xwfl6wB/3xc553uwtGnSa94jFxnGOc02C0WU2Nmzwr80gzeqn1FX4VcbvoKIhe8L/lPq4BTQttAbrTN94uN8rA== + 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" @@ -2116,21 +2113,22 @@ detect-newline@^3.0.0: resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== -dht-rpc@^5.0.1: - version "5.0.5" - resolved "https://registry.yarnpkg.com/dht-rpc/-/dht-rpc-5.0.5.tgz#c7b167674cbe9b8c95de185a700d6ebcd8c12d55" - integrity sha512-qcqwacG0m6zxrwTOCrL6LcOcXJRscAH1ykfDsUvGznWuKY1MxOV33IKLgy9pnmoJddyMTMRxFZxRD85/vnt+2g== +dht-rpc@^6.0.0: + version "6.1.1" + resolved "https://registry.yarnpkg.com/dht-rpc/-/dht-rpc-6.1.1.tgz#a292a22aa19b05136978d33528cb571d6e32502f" + integrity sha512-wo0nMXwn/rhxVz62V0d+l/0HuikxLQh6lkwlUIdoaUzGl9DobFj4epSScD3/lTMwKts+Ih0DFNqP+j0tYwdajQ== dependencies: b4a "^1.3.1" - bind-easy "^1.0.0" compact-encoding "^2.1.0" compact-encoding-net "^1.0.1" + events "^3.3.0" fast-fifo "^1.0.0" kademlia-routing-table "^1.0.0" nat-sampler "^1.0.1" sodium-universal "^3.0.4" streamx "^2.10.3" time-ordered-set "^1.0.2" + udx-native "^1.1.0" dicer@0.3.0: version "0.3.0" @@ -2534,6 +2532,11 @@ eventemitter3@^3.1.0: resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== +events@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" + integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== + execa@^5.0.0: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" @@ -3088,6 +3091,15 @@ human-signals@^2.1.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== +hypercore-crypto@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/hypercore-crypto/-/hypercore-crypto-3.3.0.tgz#03ab5b44608a563e131f629f671c6f90a83c52e6" + integrity sha512-zAWbDqG7kWwS6rCxxTUeB/OeFAz3PoOmouKaoMubtDJYJsLHqXtA3wE2mLsw+E2+iYyom5zrFyBTFVYxmgwW6g== + dependencies: + b4a "^1.1.0" + compact-encoding "^2.5.1" + sodium-universal "^3.0.0" + iconv-lite@0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -3151,7 +3163,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3: +inherits@2, inherits@2.0.4, inherits@^2.0.1: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -3238,7 +3250,7 @@ is-core-module@^2.2.0, is-core-module@^2.6.0: dependencies: has "^1.0.3" -is-core-module@^2.8.1: +is-core-module@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== @@ -4288,18 +4300,13 @@ named-placeholders@^1.1.2: nanoassert@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/nanoassert/-/nanoassert-1.1.0.tgz#4f3152e09540fde28c76f44b19bbcd1d5a42478d" - integrity sha1-TzFS4JVA/eKMdvRLGbvNHVpCR40= + integrity sha512-C40jQ3NzfkP53NsO8kEOFd79p4b9kDXQMwgiY1z8ZwrDZgUyom0AHwGegF4Dm99L+YoYhuaB0ceerUcXmqr1rQ== nanoassert@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/nanoassert/-/nanoassert-2.0.0.tgz#a05f86de6c7a51618038a620f88878ed1e490c09" integrity sha512-7vO7n28+aYO4J+8w96AzhmU8G+Y/xpPDJz/se19ICsqj/momRbb9mh9ZUtkoJ5X3nTnPdhEJyc0qnM6yAsHBaA== -nanoid@^3.1.20: - version "3.1.32" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.32.tgz#8f96069e6239cc0a9ae8c0d3b41a3b4933a88c0a" - integrity sha512-F8mf7R3iT9bvThBoW4tGXhXFHCctyCiUUPrWF8WaTqa3h96d9QybkSeba43XVOOE3oiLfkVDe4bT8MeGmkrTxw== - napi-macros@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.0.0.tgz#2b6bae421e7b96eb687aa6c77a7858640670001b" @@ -4327,15 +4334,10 @@ node-fetch@^2.6.1: dependencies: whatwg-url "^5.0.0" -node-gyp-build@^4.2.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.4.0.tgz#42e99687ce87ddeaf3a10b99dc06abc11021f3f4" - integrity sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ== - -node-gyp-build@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.3.0.tgz#9f256b03e5826150be39c764bf51e993946d71a3" - integrity sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q== +node-gyp-build@^4.3.0, node-gyp-build@^4.4.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.5.0.tgz#7a64eefa0b21112f89f58379da128ac177f20e40" + integrity sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg== node-int64@^0.4.0: version "0.4.0" @@ -4847,15 +4849,6 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" -readable-stream@^3.0.2: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== - dependencies: - inherits "^2.0.3" - 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" @@ -4930,11 +4923,11 @@ resolve@^1.10.0, resolve@^1.10.1, resolve@^1.20.0: path-parse "^1.0.6" resolve@^1.17.0: - version "1.22.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" - integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== + version "1.22.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" + integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== dependencies: - is-core-module "^2.8.1" + is-core-module "^2.9.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" @@ -4979,7 +4972,7 @@ safe-buffer@5.1.2, safe-buffer@~5.1.1: 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, safe-buffer@~5.2.0: +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== @@ -5290,7 +5283,7 @@ streamsearch@0.1.2: resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-0.1.2.tgz#808b9d0e56fc273d809ba57338e929919a1a9f1a" integrity sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo= -streamx@^2.10.2, streamx@^2.10.3, streamx@^2.12.4: +streamx@^2.10.2, streamx@^2.10.3, streamx@^2.12.0, streamx@^2.12.4: version "2.12.4" resolved "https://registry.yarnpkg.com/streamx/-/streamx-2.12.4.tgz#0369848b20b8f79c65320735372df17cafcd9aff" integrity sha512-K3xdIp8YSkvbdI0PrCcP0JkniN8cPCyeKlcZgRFSl1o1xKINCYM93FryvTSOY57x73pz5/AjO5B8b9BYf21wWw== @@ -5331,13 +5324,6 @@ string.prototype.trimstart@^1.0.4: call-bind "^1.0.2" define-properties "^1.1.3" -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.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" @@ -5469,11 +5455,6 @@ time-ordered-set@^1.0.2: resolved "https://registry.yarnpkg.com/time-ordered-set/-/time-ordered-set-1.0.2.tgz#3bd931fc048234147f8c2b8b1ebbebb0a3ecb96f" integrity sha512-vGO99JkxvgX+u+LtOKQEpYf31Kj3i/GNwVstfnh4dyINakMgeZCpew1e3Aj+06hEslhtHEd52g7m5IV+o1K8Mw== -timeout-refresh@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/timeout-refresh/-/timeout-refresh-1.0.3.tgz#7024a8ce0a09a57acc2ea86002048e6c0bff7375" - integrity sha512-Mz0CX4vBGM5lj8ttbIFt7o4ZMxk/9rgudJRh76EvB7xXZMur7T/cjRiH2w4Fmkq0zxf2QpM8IFvOSRn8FEu3gA== - timeout-refresh@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/timeout-refresh/-/timeout-refresh-2.0.1.tgz#f8ec7cf1f9d93b2635b7d4388cb820c5f6c16f98" @@ -5673,6 +5654,16 @@ typescript@^4.3.4: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.3.tgz#bdc5407caa2b109efd4f82fe130656f977a29324" integrity sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA== +udx-native@^1.1.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/udx-native/-/udx-native-1.2.1.tgz#a229b8bfab8c9c9eea05c7e0d68e671ab70d562d" + integrity sha512-hLoJ3rE1PuqO/A1YENG8oYNuAGltdwXofzavYwXbg2yk/qQgGBDpUQd/qtdENxkawad5cEEdJEdwvchslDl7OA== + dependencies: + b4a "^1.5.0" + napi-macros "^2.0.0" + node-gyp-build "^4.4.0" + streamx "^2.12.0" + unbox-primitive@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471" @@ -5702,11 +5693,6 @@ universalify@^0.1.2: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== -unordered-set@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/unordered-set/-/unordered-set-2.0.1.tgz#4cd0fe27b8814bcf5d6073e5f0966ec7a50841e6" - integrity sha512-eUmNTPzdx+q/WvOHW0bgGYLWvWHNT3PTKEQLg0MAQhc0AHASHVHoP/9YytYd4RBVariqno/mEUhVZN98CmD7bg== - universalify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" @@ -5751,11 +5737,6 @@ url-parse-lax@^3.0.0: dependencies: prepend-http "^2.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 sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= - util.promisify@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.1.1.tgz#77832f57ced2c9478174149cae9b96e9918cd54b" @@ -5772,17 +5753,6 @@ utils-merge@1.0.1: resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= -utp-native@^2.5.3: - version "2.5.3" - resolved "https://registry.yarnpkg.com/utp-native/-/utp-native-2.5.3.tgz#7c04c2a8c2858716555a77d10adb9819e3119b25" - integrity sha512-sWTrWYXPhhWJh+cS2baPzhaZc89zwlWCfwSthUjGhLkZztyPhcQllo+XVVCbNGi7dhyRlxkWxN4NKU6FbA9Y8w== - dependencies: - napi-macros "^2.0.0" - node-gyp-build "^4.2.0" - readable-stream "^3.0.2" - timeout-refresh "^1.0.0" - unordered-set "^2.0.1" - uuid@^3.1.0: version "3.4.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" @@ -5949,10 +5919,10 @@ write-file-atomic@^3.0.0: resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.5.tgz#8b4bc4af518cfabd0473ae4f99144287b33eb881" integrity sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w== -xache@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/xache/-/xache-1.0.0.tgz#a252f8cbbe80e654ea4266bf172ca86e287be145" - integrity sha512-f4fYGFVY734UT4OOyTaKMdWdJ5asbMWKZvmQcoMFBeFNw0UOt0dEJTOlJeKmsduKqPj0UWsIx4SB76oCZagllQ== +xache@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/xache/-/xache-1.1.0.tgz#afc20dec9ff8b2260eea03f5ad9422dc0200c6e9" + integrity sha512-RQGZDHLy/uCvnIrAvaorZH/e6Dfrtxj16iVlGjkj4KD2/G/dNXNqhk5IdSucv5nSSnDK00y8Y/2csyRdHveJ+Q== xdg-basedir@^4.0.0: version "4.0.0" From f0c83321fab57ae0d48d6feba34eb40223edc6ff Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 19 Jul 2022 14:55:02 +0200 Subject: [PATCH 08/34] fix broeken .envs and config --- backend/.env.dist | 3 ++- backend/src/config/index.ts | 4 ++++ deployment/bare_metal/.env.dist | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/.env.dist b/backend/.env.dist index 8a0319c67..60fc61615 100644 --- a/backend/.env.dist +++ b/backend/.env.dist @@ -27,7 +27,8 @@ KLICKTIPP_APIKEY_EN=SomeFakeKeyEN COMMUNITY_NAME=Gradido Entwicklung COMMUNITY_URL=http://localhost/ COMMUNITY_REGISTER_URL=http://localhost/register -COMMUNITY_REDEEM_URL=http://localhost/redeem/{code} +COMMUNITY_REDEEM_URL=http://localhost/redeem/{code}a +COMMUNITY_REDEEM_CONTRIBUTION_URL=http://localhost/redeem/CL-{code} COMMUNITY_DESCRIPTION=Die lokale Entwicklungsumgebung von Gradido. # Login Server diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 80c844974..8a718c6b3 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -12,6 +12,8 @@ Decimal.set({ const constants = { DB_VERSION: '0043-add_event_protocol_table', DECAY_START_TIME: new Date('2021-05-13 17:46:31'), // GMT+0 + LOG4JS_CONFIG: 'log4js-config.json', + // default log level on production should be info LOG_LEVEL: process.env.LOG_LEVEL || 'info', CONFIG_VERSION: { DEFAULT: 'DEFAULT', @@ -52,6 +54,8 @@ const community = { COMMUNITY_URL: process.env.COMMUNITY_URL || 'http://localhost/', COMMUNITY_REGISTER_URL: process.env.COMMUNITY_REGISTER_URL || 'http://localhost/register', COMMUNITY_REDEEM_URL: process.env.COMMUNITY_REDEEM_URL || 'http://localhost/redeem/{code}', + COMMUNITY_REDEEM_CONTRIBUTION_URL: + process.env.COMMUNITY_REDEEM_CONTRIBUTION_URL || 'http://localhost/redeem/CL-{code}', COMMUNITY_DESCRIPTION: process.env.COMMUNITY_DESCRIPTION || 'Die lokale Entwicklungsumgebung von Gradido.', } diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index c0e41d269..96b6b2294 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -22,6 +22,7 @@ COMMUNITY_NAME="Gradido Development Stage1" COMMUNITY_URL=https://stage1.gradido.net/ COMMUNITY_REGISTER_URL=https://stage1.gradido.net/register COMMUNITY_REDEEM_URL=https://stage1.gradido.net/redeem/{code} +COMMUNITY_REDEEM_CONTRIBUTION_URL=http://localhost/redeem/CL-{code} COMMUNITY_DESCRIPTION="Gradido Development Stage1 Test Community" # backend From c3fc068834cb50ae22e5046a15bf594e674c81ac Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 19 Jul 2022 14:59:45 +0200 Subject: [PATCH 09/34] fix URL of community redeem contribution link --- deployment/bare_metal/.env.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 96b6b2294..4b8534890 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -22,7 +22,7 @@ COMMUNITY_NAME="Gradido Development Stage1" COMMUNITY_URL=https://stage1.gradido.net/ COMMUNITY_REGISTER_URL=https://stage1.gradido.net/register COMMUNITY_REDEEM_URL=https://stage1.gradido.net/redeem/{code} -COMMUNITY_REDEEM_CONTRIBUTION_URL=http://localhost/redeem/CL-{code} +COMMUNITY_REDEEM_CONTRIBUTION_URL=https://stage1.gradido.net/redeem/CL-{code} COMMUNITY_DESCRIPTION="Gradido Development Stage1 Test Community" # backend From 7ddafdd70d57b0ab7eac485300c5fef26f1e9f16 Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 26 Sep 2022 15:24:18 +0200 Subject: [PATCH 10/34] Add updated_at to contributions table. --- .../Contribution.ts | 92 +++++++++++++++++++ database/entity/Contribution.ts | 2 +- .../0051-add_updated_at_to_contributions.ts | 10 ++ 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 database/entity/0051-add_updated_at_to_contributions/Contribution.ts create mode 100644 database/migrations/0051-add_updated_at_to_contributions.ts diff --git a/database/entity/0051-add_updated_at_to_contributions/Contribution.ts b/database/entity/0051-add_updated_at_to_contributions/Contribution.ts new file mode 100644 index 000000000..388216047 --- /dev/null +++ b/database/entity/0051-add_updated_at_to_contributions/Contribution.ts @@ -0,0 +1,92 @@ +import Decimal from 'decimal.js-light' +import { + BaseEntity, + Column, + Entity, + PrimaryGeneratedColumn, + DeleteDateColumn, + JoinColumn, + ManyToOne, + OneToMany, +} from 'typeorm' +import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' +import { User } from '../User' +import { ContributionMessage } from '../ContributionMessage' + +@Entity('contributions') +export class Contribution extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ unsigned: true, nullable: false, name: 'user_id' }) + userId: number + + @ManyToOne(() => User, (user) => user.contributions) + @JoinColumn({ name: 'user_id' }) + user: User + + @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) + createdAt: Date + + @Column({ type: 'datetime', nullable: false, name: 'contribution_date' }) + contributionDate: Date + + @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) + memo: string + + @Column({ + type: 'decimal', + precision: 40, + scale: 20, + nullable: false, + transformer: DecimalTransformer, + }) + amount: Decimal + + @Column({ unsigned: true, nullable: true, name: 'moderator_id' }) + moderatorId: number + + @Column({ unsigned: true, nullable: true, name: 'contribution_link_id' }) + contributionLinkId: number + + @Column({ unsigned: true, nullable: true, name: 'confirmed_by' }) + confirmedBy: number + + @Column({ nullable: true, name: 'confirmed_at' }) + confirmedAt: Date + + @Column({ unsigned: true, nullable: true, name: 'denied_by' }) + deniedBy: number + + @Column({ nullable: true, name: 'denied_at' }) + deniedAt: Date + + @Column({ + name: 'contribution_type', + length: 12, + nullable: false, + collation: 'utf8mb4_unicode_ci', + }) + contributionType: string + + @Column({ + name: 'contribution_status', + length: 12, + nullable: false, + collation: 'utf8mb4_unicode_ci', + }) + contributionStatus: string + + @Column({ unsigned: true, nullable: true, name: 'transaction_id' }) + transactionId: number + + @DeleteDateColumn({ name: 'deleted_at' }) + deletedAt: Date | null + + @OneToMany(() => ContributionMessage, (message) => message.contribution) + @JoinColumn({ name: 'contribution_id' }) + messages?: ContributionMessage[] + + @Column({ nullable: true, name: 'updated_at' }) + updatedAt: Date +} diff --git a/database/entity/Contribution.ts b/database/entity/Contribution.ts index f6530f00b..451398c01 100644 --- a/database/entity/Contribution.ts +++ b/database/entity/Contribution.ts @@ -1 +1 @@ -export { Contribution } from './0047-messages_tables/Contribution' +export { Contribution } from './0051-add_updated_at_to_contributions/Contribution' diff --git a/database/migrations/0051-add_updated_at_to_contributions.ts b/database/migrations/0051-add_updated_at_to_contributions.ts new file mode 100644 index 000000000..5e991eac9 --- /dev/null +++ b/database/migrations/0051-add_updated_at_to_contributions.ts @@ -0,0 +1,10 @@ +/* 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 \`contributions\` ADD COLUMN \`updated_at\` datetime DEFAULT NULL;`) +} + +export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { + await queryFn(`ALTER TABLE \`contributions\` DROP COLUMN \`updated_at\`;`) +} From 3ae79ad935bc348b3142fce429ab0d0286b59af2 Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 26 Sep 2022 15:24:36 +0200 Subject: [PATCH 11/34] Change expected database version. --- backend/src/config/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 3e6bafd9f..02ec82e01 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -10,7 +10,7 @@ Decimal.set({ }) const constants = { - DB_VERSION: '0049-add_user_contacts_table', + DB_VERSION: '0051-add_updated_at_to_contributions', 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 ea234add116a36956a1e9040fc977c84db8c68f6 Mon Sep 17 00:00:00 2001 From: elweyn Date: Tue, 27 Sep 2022 13:37:45 +0200 Subject: [PATCH 12/34] Add message after updateContribution. --- .../graphql/resolver/ContributionResolver.ts | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index fc93880f1..2caa5a6aa 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -13,6 +13,8 @@ import { Contribution, ContributionListResult } from '@model/Contribution' import { UnconfirmedContribution } from '@model/UnconfirmedContribution' import { validateContribution, getUserCreation, updateCreations } from './util/creations' import { MEMO_MAX_CHARS, MEMO_MIN_CHARS } from './const/const' +import { ContributionMessage } from '@entity/ContributionMessage' +import { ContributionMessageType } from '../enum/MessageType' @Resolver() export class ContributionResolver { @@ -159,7 +161,14 @@ export class ContributionResolver { if (contributionToUpdate.userId !== user.id) { throw new Error('user of the pending contribution and send user does not correspond') } - + if ( + contributionToUpdate.contributionStatus !== ContributionStatus.IN_PROGRESS && + contributionToUpdate.contributionStatus !== ContributionStatus.PENDING + ) { + throw new Error( + `Contribution can not be updated since the state is ${contributionToUpdate.contributionStatus}`, + ) + } const creationDateObj = new Date(creationDate) let creations = await getUserCreation(user.id) if (contributionToUpdate.contributionDate.getMonth() === creationDateObj.getMonth()) { @@ -168,10 +177,20 @@ export class ContributionResolver { // all possible cases not to be true are thrown in this function validateContribution(creations, amount, creationDateObj) + + const contributionMessage = ContributionMessage.create() + contributionMessage.contributionId = contributionId + contributionMessage.createdAt = contributionToUpdate.updatedAt + ? contributionToUpdate.updatedAt + : contributionToUpdate.createdAt + contributionMessage.message = `` + contributionMessage.type = ContributionMessageType.HISTORY + contributionToUpdate.amount = amount contributionToUpdate.memo = memo contributionToUpdate.contributionDate = new Date(creationDate) contributionToUpdate.contributionStatus = ContributionStatus.PENDING + contributionToUpdate.updatedAt = new Date() dbContribution.save(contributionToUpdate) return new UnconfirmedContribution(contributionToUpdate, user, creations) From e29c9a111d36f97f59681a83baac38635f3df4da Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 24 Oct 2022 12:15:54 +0200 Subject: [PATCH 13/34] Add a contribution message when things are changed. --- .../src/graphql/resolver/ContributionResolver.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index b756b33cc..15734d906 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -219,18 +219,20 @@ export class ContributionResolver { contributionMessage.createdAt = contributionToUpdate.updatedAt ? contributionToUpdate.updatedAt : contributionToUpdate.createdAt - const newMessage = '' + let changeMessage = '' if (contributionToUpdate.memo !== memo) { - // - + // TODO: Add message to changeMessage + changeMessage += 'Neuer Memo: ' + memo + '\n' } if (contributionToUpdate.amount !== amount) { - // + // TODO: Add amount to changeMessage + changeMessage += 'Neuer Betrag: ' + amount + '\n' } if (contributionToUpdate.contributionDate !== new Date(creationDate)) { - // + // TODO: Add contributionDate to changeMessage + changeMessage += 'Neuer Beitragsdatum: ' + creationDate + '\n' } - contributionMessage.message = `` + contributionMessage.message = changeMessage contributionMessage.type = ContributionMessageType.HISTORY contributionToUpdate.amount = amount From c17291f74d593bcdb23adb435bb15f8732856651 Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 24 Oct 2022 13:19:10 +0200 Subject: [PATCH 14/34] Remove the posibility of null of the contribution entity. --- .../entity/0052-add_updated_at_to_contributions/Contribution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/entity/0052-add_updated_at_to_contributions/Contribution.ts b/database/entity/0052-add_updated_at_to_contributions/Contribution.ts index 61d0b6cf3..fa61e9274 100644 --- a/database/entity/0052-add_updated_at_to_contributions/Contribution.ts +++ b/database/entity/0052-add_updated_at_to_contributions/Contribution.ts @@ -91,5 +91,5 @@ export class Contribution extends BaseEntity { messages?: ContributionMessage[] @Column({ nullable: true, name: 'updated_at' }) - updatedAt: Date | null + updatedAt: Date } From 94e9039c86b28b9379387db5afc8de723dc80ce0 Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 24 Oct 2022 13:23:42 +0200 Subject: [PATCH 15/34] Add changed values to the new contribution message. --- backend/src/graphql/resolver/ContributionResolver.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index 15734d906..172c61e65 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -224,16 +224,22 @@ export class ContributionResolver { // TODO: Add message to changeMessage changeMessage += 'Neuer Memo: ' + memo + '\n' } - if (contributionToUpdate.amount !== amount) { + if (contributionToUpdate.amount.toFixed(6) !== amount.toFixed(6)) { // TODO: Add amount to changeMessage changeMessage += 'Neuer Betrag: ' + amount + '\n' } - if (contributionToUpdate.contributionDate !== new Date(creationDate)) { + const isDateDifferent = + contributionToUpdate.contributionDate.getTime() !== new Date(creationDate).getTime() + if (isDateDifferent) { // TODO: Add contributionDate to changeMessage - changeMessage += 'Neuer Beitragsdatum: ' + creationDate + '\n' + changeMessage += 'Neuer Beitragsdatum: ' + creationDate } contributionMessage.message = changeMessage + contributionMessage.createdAt = new Date() + contributionMessage.isModerator = false + contributionMessage.userId = user.id contributionMessage.type = ContributionMessageType.HISTORY + ContributionMessage.save(contributionMessage) contributionToUpdate.amount = amount contributionToUpdate.memo = memo From ce73e2c4474b1ec053007ca1b56f893bf832d916 Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 24 Oct 2022 13:40:28 +0200 Subject: [PATCH 16/34] Change value from new to old value. --- backend/src/graphql/resolver/ContributionResolver.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index 172c61e65..44c279bf6 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -222,17 +222,17 @@ export class ContributionResolver { let changeMessage = '' if (contributionToUpdate.memo !== memo) { // TODO: Add message to changeMessage - changeMessage += 'Neuer Memo: ' + memo + '\n' + changeMessage += 'Alter Memo: ' + contributionToUpdate.memo + '\n' } if (contributionToUpdate.amount.toFixed(6) !== amount.toFixed(6)) { // TODO: Add amount to changeMessage - changeMessage += 'Neuer Betrag: ' + amount + '\n' + changeMessage += 'Alter Betrag: ' + contributionToUpdate.amount + '\n' } const isDateDifferent = contributionToUpdate.contributionDate.getTime() !== new Date(creationDate).getTime() if (isDateDifferent) { // TODO: Add contributionDate to changeMessage - changeMessage += 'Neuer Beitragsdatum: ' + creationDate + changeMessage += 'Altes Beitragsdatum: ' + contributionToUpdate.contributionDate } contributionMessage.message = changeMessage contributionMessage.createdAt = new Date() From 68aa0a5d072d8c6a0105195205df96350471512c Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 24 Oct 2022 16:00:08 +0200 Subject: [PATCH 17/34] Withdrew createdAt = new Date() and use updatedAt or createdAt from the contribution. --- backend/src/graphql/resolver/ContributionResolver.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index 44c279bf6..959dac3f1 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -235,7 +235,6 @@ export class ContributionResolver { changeMessage += 'Altes Beitragsdatum: ' + contributionToUpdate.contributionDate } contributionMessage.message = changeMessage - contributionMessage.createdAt = new Date() contributionMessage.isModerator = false contributionMessage.userId = user.id contributionMessage.type = ContributionMessageType.HISTORY From 53d315749dfcb784051ed1c417269842a662f765 Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 24 Oct 2022 16:01:48 +0200 Subject: [PATCH 18/34] Change import from ../enum to @enum --- 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 959dac3f1..a652f99a3 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -14,7 +14,7 @@ import { UnconfirmedContribution } from '@model/UnconfirmedContribution' import { validateContribution, getUserCreation, updateCreations } from './util/creations' import { MEMO_MAX_CHARS, MEMO_MIN_CHARS } from './const/const' import { ContributionMessage } from '@entity/ContributionMessage' -import { ContributionMessageType } from '../enum/MessageType' +import { ContributionMessageType } from '@enum/MessageType' import { Event, EventContributionCreate, From 2c3db9da01467267ec2a63267d6eb755de44343a Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 26 Oct 2022 12:04:07 +0200 Subject: [PATCH 19/34] Move updatedAt before deleted variables. --- .../0052-add_updated_at_to_contributions/Contribution.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/database/entity/0052-add_updated_at_to_contributions/Contribution.ts b/database/entity/0052-add_updated_at_to_contributions/Contribution.ts index fa61e9274..2242a753f 100644 --- a/database/entity/0052-add_updated_at_to_contributions/Contribution.ts +++ b/database/entity/0052-add_updated_at_to_contributions/Contribution.ts @@ -80,6 +80,9 @@ export class Contribution extends BaseEntity { @Column({ unsigned: true, nullable: true, name: 'transaction_id' }) transactionId: number + @Column({ nullable: true, name: 'updated_at' }) + updatedAt: Date + @DeleteDateColumn({ name: 'deleted_at' }) deletedAt: Date | null @@ -89,7 +92,4 @@ export class Contribution extends BaseEntity { @OneToMany(() => ContributionMessage, (message) => message.contribution) @JoinColumn({ name: 'contribution_id' }) messages?: ContributionMessage[] - - @Column({ nullable: true, name: 'updated_at' }) - updatedAt: Date } From 0d304f9d71c541a3034c8d33cf61da3204401981 Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 26 Oct 2022 12:05:27 +0200 Subject: [PATCH 20/34] Remove TODO comments and change the written message to only the old values no prefix. --- backend/src/graphql/resolver/ContributionResolver.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index a652f99a3..1ca7be253 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -221,18 +221,15 @@ export class ContributionResolver { : contributionToUpdate.createdAt let changeMessage = '' if (contributionToUpdate.memo !== memo) { - // TODO: Add message to changeMessage - changeMessage += 'Alter Memo: ' + contributionToUpdate.memo + '\n' + changeMessage += contributionToUpdate.memo + '\n' } if (contributionToUpdate.amount.toFixed(6) !== amount.toFixed(6)) { - // TODO: Add amount to changeMessage - changeMessage += 'Alter Betrag: ' + contributionToUpdate.amount + '\n' + changeMessage += contributionToUpdate.amount + '\n' } const isDateDifferent = contributionToUpdate.contributionDate.getTime() !== new Date(creationDate).getTime() if (isDateDifferent) { - // TODO: Add contributionDate to changeMessage - changeMessage += 'Altes Beitragsdatum: ' + contributionToUpdate.contributionDate + changeMessage += contributionToUpdate.contributionDate } contributionMessage.message = changeMessage contributionMessage.isModerator = false From d0d84af7ee692236ba05d7b74aef93bc39fbe805 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 27 Oct 2022 06:50:25 +0200 Subject: [PATCH 21/34] fix merging errors --- backend/.env.dist | 1 + backend/src/config/index.ts | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/backend/.env.dist b/backend/.env.dist index 65410f240..3b6fe2ce4 100644 --- a/backend/.env.dist +++ b/backend/.env.dist @@ -4,6 +4,7 @@ CONFIG_VERSION=v11.2022-10-27 PORT=4000 JWT_SECRET=secret123 JWT_EXPIRES_IN=10m +GRAPHIQL=false GDT_API_URL=https://gdt.gradido.net # Database diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 73a934dce..3d796af2c 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -11,7 +11,6 @@ Decimal.set({ const constants = { DB_VERSION: '0051-add_delete_by_to_contributions', - DECAY_START_TIME: new Date('2021-05-13 17:46:31'), // GMT+0 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 @@ -117,11 +116,6 @@ if ( ) } -const eventProtocol = { - // global switch to enable writing of EventProtocol-Entries - EVENT_PROTOCOL_DISABLED: process.env.EVENT_PROTOCOL_DISABLED === 'true' || false, -} - const federation = { DHT_TOPIC: process.env.DHT_TOPIC || null, } From c55be14d5a898938d6f9b59a246bcc3f48bb18c7 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 27 Oct 2022 07:26:52 +0200 Subject: [PATCH 22/34] add more code from poc --- backend/src/federation/index.ts | 108 +++++++++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 2 deletions(-) diff --git a/backend/src/federation/index.ts b/backend/src/federation/index.ts index 5dabd3e24..2ff43385f 100644 --- a/backend/src/federation/index.ts +++ b/backend/src/federation/index.ts @@ -1,17 +1,121 @@ +/* eslint-disable no-console */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ + import DHT from '@hyperswarm/dht' import { Connection } from '@dbTools/typeorm' +function between(min: number, max: number) { + return Math.floor(Math.random() * (max - min + 1) + min) +} + const POLLTIME = 20000 const SUCCESSTIME = 120000 const ERRORTIME = 240000 const ANNOUNCETIME = 30000 +const nodeRand = between(1, 99) +const nodeURL = `https://test${nodeRand}.org` +const nodeAPI = { + API_1_00: `${nodeURL}/api/1_00/`, + API_1_01: `${nodeURL}/api/1_01/`, + API_2_00: `${nodeURL}/graphql/2_00/`, +} export const startDHT = async (connection: Connection, topic: string): Promise => { try { console.log('topic', topic, typeof topic) - const buffer = Buffer.from(topic) - const TOPIC = DHT.hash(buffer) + const TOPIC = DHT.hash(Buffer.from(topic)) + + const keyPair = DHT.keyPair() + + const node = new DHT({ keyPair }) + + const server = node.createServer() + + server.on('connection', function (socket: any) { + // noiseSocket is E2E between you and the other peer + // pipe it somewhere like any duplex stream + console.log('Remote public key', socket.remotePublicKey.toString('hex')) + // console.log("Local public key", noiseSocket.publicKey.toString("hex")); // same as keyPair.publicKey + + socket.on('data', (data: Buffer) => console.log('data:', data.toString('ascii'))) + + // process.stdin.pipe(noiseSocket).pipe(process.stdout); + }) + + await server.listen() + + setInterval(async () => { + console.log('Announcing on topic:', TOPIC.toString('hex')) + await node.announce(TOPIC, keyPair).finished() + }, ANNOUNCETIME) + + let successfulRequests: string[] = [] + let errorfulRequests: string[] = [] + + setInterval(async () => { + console.log('Refreshing successful nodes') + successfulRequests = [] + }, SUCCESSTIME) + + setInterval(async () => { + console.log('Refreshing errorful nodes') + errorfulRequests = [] + }, ERRORTIME) + + setInterval(async () => { + const result = await node.lookup(TOPIC) + + const collectedPubKeys: string[] = [] + + for await (const data of result) { + /* console.log( + `${data.from.host}:${data.from.port}: peers: ${data.peers.length}` + ); */ + data.peers.forEach((peer: any) => { + const pubKey = peer.publicKey.toString('hex') + if ( + pubKey !== keyPair.publicKey.toString('hex') && + !successfulRequests.includes(pubKey) && + !errorfulRequests.includes(pubKey) && + !collectedPubKeys.includes(pubKey) + ) { + collectedPubKeys.push(peer.publicKey.toString('hex')) + } + }) + } + + console.log('Found new peers: ', collectedPubKeys) + + collectedPubKeys.forEach((remotePubKey) => { + // publicKey here is keyPair.publicKey from above + const socket = node.connect(Buffer.from(remotePubKey, 'hex')) + + /* socket.once("connect", function () { + console.log("client side emitted connect"); + }); */ + + /* socket.once("end", function () { + console.log("client side ended"); + }); */ + + socket.once('error', (err: any) => { + errorfulRequests.push(remotePubKey) + console.log(`error on peer ${remotePubKey}: ${err.message}`) + }) + + socket.on('open', function () { + // noiseSocket fully open with the other peer + // console.log("writing to socket"); + socket.write(Buffer.from(`${nodeRand}`)) + socket.write(Buffer.from(JSON.stringify(nodeAPI))) + successfulRequests.push(remotePubKey) + }) + // pipe it somewhere like any duplex stream + // process.stdin.pipe(noiseSocket).pipe(process.stdout) + }) + }, POLLTIME) } catch (err) { console.log(err) } From 12f64a3cbd8938f74feccd1d1e5ca10e049391f1 Mon Sep 17 00:00:00 2001 From: elweyn Date: Fri, 28 Oct 2022 11:28:19 +0200 Subject: [PATCH 23/34] Add after statement to alter table. --- database/migrations/0052-add_updated_at_to_contributions.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/database/migrations/0052-add_updated_at_to_contributions.ts b/database/migrations/0052-add_updated_at_to_contributions.ts index 5e991eac9..e7cc5b7b4 100644 --- a/database/migrations/0052-add_updated_at_to_contributions.ts +++ b/database/migrations/0052-add_updated_at_to_contributions.ts @@ -2,7 +2,9 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { - await queryFn(`ALTER TABLE \`contributions\` ADD COLUMN \`updated_at\` datetime DEFAULT NULL;`) + await queryFn( + `ALTER TABLE \`contributions\` ADD COLUMN \`updated_at\` datetime DEFAULT NULL AFTER \`transaction_id\`;`, + ) } export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { From b3fd53ab7a4ecff2207d19be4e07b3d283ad05e8 Mon Sep 17 00:00:00 2001 From: elweyn Date: Thu, 3 Nov 2022 08:35:26 +0100 Subject: [PATCH 24/34] Change the display of the history message. --- backend/src/graphql/resolver/ContributionResolver.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index 1ca7be253..246be6254 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -220,16 +220,14 @@ export class ContributionResolver { ? contributionToUpdate.updatedAt : contributionToUpdate.createdAt let changeMessage = '' + if (contributionToUpdate.contributionDate.getTime() !== new Date(creationDate).getTime()) { + changeMessage += contributionToUpdate.contributionDate + '\n' + } if (contributionToUpdate.memo !== memo) { - changeMessage += contributionToUpdate.memo + '\n' + changeMessage += '---\n' + contributionToUpdate.memo + '\n' } if (contributionToUpdate.amount.toFixed(6) !== amount.toFixed(6)) { - changeMessage += contributionToUpdate.amount + '\n' - } - const isDateDifferent = - contributionToUpdate.contributionDate.getTime() !== new Date(creationDate).getTime() - if (isDateDifferent) { - changeMessage += contributionToUpdate.contributionDate + changeMessage += '---\n' + contributionToUpdate.amount } contributionMessage.message = changeMessage contributionMessage.isModerator = false From 882e8b5304d25d1139a241dfb83a6bf3427a1f25 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 4 Nov 2022 12:53:29 +0100 Subject: [PATCH 25/34] lint_pr workflow --- .github/workflows/lint_pr.yml | 72 +++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/lint_pr.yml diff --git a/.github/workflows/lint_pr.yml b/.github/workflows/lint_pr.yml new file mode 100644 index 000000000..8ec8ed64b --- /dev/null +++ b/.github/workflows/lint_pr.yml @@ -0,0 +1,72 @@ +name: "gradido lint pull request CI" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - with: + # Configure which types are allowed (newline delimited). + # Default: https://github.com/commitizen/conventional-commit-types + #types: | + # fix + # feat + # Configure which scopes are allowed (newline delimited). + scopes: | + backend + wallet + admin + database + github + release + other + # Configure that a scope must always be provided. + requireScope: true + # Configure which scopes (newline delimited) are disallowed in PR + # titles. For instance by setting # the value below, `chore(release): + # ...` and `ci(e2e,release): ...` will be rejected. + #disallowScopes: | + # release + # Configure additional validation for the subject based on a regex. + # This example ensures the subject doesn't start with an uppercase character. + subjectPattern: ^(?![A-Z]).+$ + # If `subjectPattern` is configured, you can use this property to override + # the default error message that is shown when the pattern doesn't match. + # The variables `subject` and `title` can be used within the message. + subjectPatternError: | + The subject "{subject}" found in the pull request title "{title}" + didn't match the configured pattern. Please ensure that the subject + doesn't start with an uppercase character. + # If you use GitHub Enterprise, you can set this to the URL of your server + #githubBaseUrl: https://github.myorg.com/api/v3 + # If the PR contains one of these labels (newline delimited), the + # validation is skipped. + # If you want to rerun the validation when labels change, you might want + # to use the `labeled` and `unlabeled` event triggers in your workflow. + #ignoreLabels: | + # bot + # ignore-semantic-pull-request + # If you're using a format for the PR title that differs from the traditional Conventional + # Commits spec, you can use these options to customize the parsing of the type, scope and + # subject. The `headerPattern` should contain a regex where the capturing groups in parentheses + # correspond to the parts listed in `headerPatternCorrespondence`. + # See: https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser#headerpattern + headerPattern: '^(\w*)(?:\(([\w$.\-*/ ]*)\))?: (.*)$' + headerPatternCorrespondence: type, scope, subject + # For work-in-progress PRs you can typically use draft pull requests + # from GitHub. However, private repositories on the free plan don't have + # this option and therefore this action allows you to opt-in to using the + # special "[WIP]" prefix to indicate this state. This will avoid the + # validation of the PR title and the pull request checks remain pending. + # Note that a second check will be reported if this is enabled. + wip: true From 5027f2030e0ac7258dad7a96504f43c3ce49d61c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 4 Nov 2022 12:54:55 +0100 Subject: [PATCH 26/34] fix --- .github/workflows/lint_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint_pr.yml b/.github/workflows/lint_pr.yml index 8ec8ed64b..0155bc55d 100644 --- a/.github/workflows/lint_pr.yml +++ b/.github/workflows/lint_pr.yml @@ -15,7 +15,7 @@ jobs: - uses: amannn/action-semantic-pull-request@v5 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - with: + with: # Configure which types are allowed (newline delimited). # Default: https://github.com/commitizen/conventional-commit-types #types: | From ece96e19335647c16962a3a2f966a00964a5b0ed Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 4 Nov 2022 12:57:15 +0100 Subject: [PATCH 27/34] include all prs --- .github/workflows/lint_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint_pr.yml b/.github/workflows/lint_pr.yml index 0155bc55d..83a274f1d 100644 --- a/.github/workflows/lint_pr.yml +++ b/.github/workflows/lint_pr.yml @@ -1,6 +1,7 @@ name: "gradido lint pull request CI" on: + pull_request: pull_request_target: types: - opened From 070c58987ce364055fc469ae800638478869dd4b Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 4 Nov 2022 13:01:28 +0100 Subject: [PATCH 28/34] remove github from scope list --- .github/workflows/lint_pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/lint_pr.yml b/.github/workflows/lint_pr.yml index 83a274f1d..7c49768a7 100644 --- a/.github/workflows/lint_pr.yml +++ b/.github/workflows/lint_pr.yml @@ -28,7 +28,6 @@ jobs: wallet admin database - github release other # Configure that a scope must always be provided. From c79d186a45d8c4c269b83cac282c4dee2f249f88 Mon Sep 17 00:00:00 2001 From: elweyn Date: Mon, 7 Nov 2022 10:32:26 +0100 Subject: [PATCH 29/34] Log error when contribution is in the wrong state. Write full content in changeMessage. --- .../graphql/resolver/ContributionResolver.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index 246be6254..ede61b413 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -198,6 +198,9 @@ export class ContributionResolver { contributionToUpdate.contributionStatus !== ContributionStatus.IN_PROGRESS && contributionToUpdate.contributionStatus !== ContributionStatus.PENDING ) { + logger.error( + `Contribution can not be updated since the state is ${contributionToUpdate.contributionStatus}`, + ) throw new Error( `Contribution can not be updated since the state is ${contributionToUpdate.contributionStatus}`, ) @@ -219,16 +222,11 @@ export class ContributionResolver { contributionMessage.createdAt = contributionToUpdate.updatedAt ? contributionToUpdate.updatedAt : contributionToUpdate.createdAt - let changeMessage = '' - if (contributionToUpdate.contributionDate.getTime() !== new Date(creationDate).getTime()) { - changeMessage += contributionToUpdate.contributionDate + '\n' - } - if (contributionToUpdate.memo !== memo) { - changeMessage += '---\n' + contributionToUpdate.memo + '\n' - } - if (contributionToUpdate.amount.toFixed(6) !== amount.toFixed(6)) { - changeMessage += '---\n' + contributionToUpdate.amount - } + const changeMessage = `${contributionToUpdate.contributionDate} + --- + ${contributionToUpdate.memo} + --- + ${contributionToUpdate.amount}` contributionMessage.message = changeMessage contributionMessage.isModerator = false contributionMessage.userId = user.id From 48285429d49833ec1470fae313f97fc7041b7c61 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 7 Nov 2022 12:02:50 +0100 Subject: [PATCH 30/34] Update .github/workflows/lint_pr.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Wolfgang Huß --- .github/workflows/lint_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint_pr.yml b/.github/workflows/lint_pr.yml index 7c49768a7..2f9229737 100644 --- a/.github/workflows/lint_pr.yml +++ b/.github/workflows/lint_pr.yml @@ -25,7 +25,7 @@ jobs: # Configure which scopes are allowed (newline delimited). scopes: | backend - wallet + frontend admin database release From 9ec586c8853676df15390ffeb7141c6fb4b1ecf3 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 7 Nov 2022 12:27:23 +0100 Subject: [PATCH 31/34] correct variable name --- deployment/bare_metal/.env.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 0ae96b71b..1d0e96455 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -26,7 +26,7 @@ COMMUNITY_REDEEM_CONTRIBUTION_URL=https://stage1.gradido.net/redeem/CL-{code} COMMUNITY_DESCRIPTION="Gradido Development Stage1 Test Community" # backend -CONFIG_VERSION=v11.2022-10-27 +BACKEND_CONFIG_VERSION=v11.2022-10-27 JWT_EXPIRES_IN=10m GDT_API_URL=https://gdt.gradido.net From 51cc3164b27746e896242a98a32d5f8700a38dd4 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 7 Nov 2022 12:27:43 +0100 Subject: [PATCH 32/34] use logger instead of console --- backend/src/federation/index.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/backend/src/federation/index.ts b/backend/src/federation/index.ts index 2ff43385f..d91e1f2ee 100644 --- a/backend/src/federation/index.ts +++ b/backend/src/federation/index.ts @@ -1,9 +1,9 @@ -/* eslint-disable no-console */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import DHT from '@hyperswarm/dht' import { Connection } from '@dbTools/typeorm' +import { backendLogger as logger } from '@/server/logger' function between(min: number, max: number) { return Math.floor(Math.random() * (max - min + 1) + min) @@ -23,8 +23,6 @@ const nodeAPI = { export const startDHT = async (connection: Connection, topic: string): Promise => { try { - console.log('topic', topic, typeof topic) - const TOPIC = DHT.hash(Buffer.from(topic)) const keyPair = DHT.keyPair() @@ -36,10 +34,10 @@ export const startDHT = async (connection: Connection, topic: string): Promise console.log('data:', data.toString('ascii'))) + socket.on('data', (data: Buffer) => logger.info(`data: ${data.toString('ascii')}`)) // process.stdin.pipe(noiseSocket).pipe(process.stdout); }) @@ -47,7 +45,7 @@ export const startDHT = async (connection: Connection, topic: string): Promise { - console.log('Announcing on topic:', TOPIC.toString('hex')) + logger.info(`Announcing on topic: ${TOPIC.toString('hex')}`) await node.announce(TOPIC, keyPair).finished() }, ANNOUNCETIME) @@ -55,12 +53,12 @@ export const startDHT = async (connection: Connection, topic: string): Promise { - console.log('Refreshing successful nodes') + logger.info('Refreshing successful nodes') successfulRequests = [] }, SUCCESSTIME) setInterval(async () => { - console.log('Refreshing errorful nodes') + logger.info('Refreshing errorful nodes') errorfulRequests = [] }, ERRORTIME) @@ -86,7 +84,7 @@ export const startDHT = async (connection: Connection, topic: string): Promise { // publicKey here is keyPair.publicKey from above @@ -102,7 +100,7 @@ export const startDHT = async (connection: Connection, topic: string): Promise { errorfulRequests.push(remotePubKey) - console.log(`error on peer ${remotePubKey}: ${err.message}`) + logger.error(`error on peer ${remotePubKey}: ${err.message}`) }) socket.on('open', function () { @@ -117,6 +115,6 @@ export const startDHT = async (connection: Connection, topic: string): Promise Date: Mon, 7 Nov 2022 12:45:44 +0100 Subject: [PATCH 33/34] move DHT connection into main --- backend/src/federation/index.ts | 5 ++++- backend/src/index.ts | 8 +++++++- backend/src/server/createServer.ts | 8 -------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/backend/src/federation/index.ts b/backend/src/federation/index.ts index d91e1f2ee..8974c4e45 100644 --- a/backend/src/federation/index.ts +++ b/backend/src/federation/index.ts @@ -21,7 +21,10 @@ const nodeAPI = { API_2_00: `${nodeURL}/graphql/2_00/`, } -export const startDHT = async (connection: Connection, topic: string): Promise => { +export const startDHT = async ( + connection: Connection, + topic: string, +): Promise => { try { const TOPIC = DHT.hash(Buffer.from(topic)) diff --git a/backend/src/index.ts b/backend/src/index.ts index 4c08b422d..5c0f0c293 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -1,12 +1,13 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import createServer from './server/createServer' +import { startDHT } from '@/federation/index' // config import CONFIG from './config' async function main() { - const { app } = await createServer() + const { app, con } = await createServer() app.listen(CONFIG.PORT, () => { // eslint-disable-next-line no-console @@ -16,6 +17,11 @@ async function main() { console.log(`GraphIQL available at http://localhost:${CONFIG.PORT}`) } }) + + // start DHT hyperswarm when DHT_TOPIC is set in .env + if (CONFIG.DHT_TOPIC) { + await startDHT(con, CONFIG.DHT_TOPIC) + } } main().catch((e) => { diff --git a/backend/src/server/createServer.ts b/backend/src/server/createServer.ts index 88a30c93d..8ae4675db 100644 --- a/backend/src/server/createServer.ts +++ b/backend/src/server/createServer.ts @@ -22,9 +22,6 @@ import schema from '@/graphql/schema' import { elopageWebhook } from '@/webhook/elopage' import { Connection } from '@dbTools/typeorm' -// DHT -import { startDHT } from '@/federation/index' - import { apolloLogger } from './logger' import { Logger } from 'log4js' @@ -55,11 +52,6 @@ const createServer = async ( throw new Error('Fatal: Database Version incorrect') } - // start DHT hyperswarm when DHT_TOPIC is set in .env - if (CONFIG.DHT_TOPIC) { - await startDHT(con, CONFIG.DHT_TOPIC) - } - // Express Server const app = express() From 7efd2ffca3e6290bb0f5a52f59f3aad2646f958b Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 7 Nov 2022 13:16:22 +0100 Subject: [PATCH 34/34] linting, etc. --- backend/src/federation/index.ts | 19 ++++++++----------- backend/src/index.ts | 4 ++-- backend/tsconfig.json | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/backend/src/federation/index.ts b/backend/src/federation/index.ts index 8974c4e45..2ca58b432 100644 --- a/backend/src/federation/index.ts +++ b/backend/src/federation/index.ts @@ -2,7 +2,7 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import DHT from '@hyperswarm/dht' -import { Connection } from '@dbTools/typeorm' +// import { Connection } from '@dbTools/typeorm' import { backendLogger as logger } from '@/server/logger' function between(min: number, max: number) { @@ -22,7 +22,7 @@ const nodeAPI = { } export const startDHT = async ( - connection: Connection, + // connection: Connection, topic: string, ): Promise => { try { @@ -71,9 +71,6 @@ export const startDHT = async ( const collectedPubKeys: string[] = [] for await (const data of result) { - /* console.log( - `${data.from.host}:${data.from.port}: peers: ${data.peers.length}` - ); */ data.peers.forEach((peer: any) => { const pubKey = peer.publicKey.toString('hex') if ( @@ -93,13 +90,13 @@ export const startDHT = async ( // publicKey here is keyPair.publicKey from above const socket = node.connect(Buffer.from(remotePubKey, 'hex')) - /* socket.once("connect", function () { - console.log("client side emitted connect"); - }); */ + // socket.once("connect", function () { + // console.log("client side emitted connect"); + // }); - /* socket.once("end", function () { - console.log("client side ended"); - }); */ + // socket.once("end", function () { + // console.log("client side ended"); + // }); socket.once('error', (err: any) => { errorfulRequests.push(remotePubKey) diff --git a/backend/src/index.ts b/backend/src/index.ts index 5c0f0c293..dc1bbb115 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -7,7 +7,7 @@ import { startDHT } from '@/federation/index' import CONFIG from './config' async function main() { - const { app, con } = await createServer() + const { app } = await createServer() app.listen(CONFIG.PORT, () => { // eslint-disable-next-line no-console @@ -20,7 +20,7 @@ async function main() { // start DHT hyperswarm when DHT_TOPIC is set in .env if (CONFIG.DHT_TOPIC) { - await startDHT(con, CONFIG.DHT_TOPIC) + await startDHT(CONFIG.DHT_TOPIC) // con, } } diff --git a/backend/tsconfig.json b/backend/tsconfig.json index 6a59eb2c0..2e5a8b5b2 100644 --- a/backend/tsconfig.json +++ b/backend/tsconfig.json @@ -4,7 +4,7 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ + "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */