From 181c1d28fc4d99312108e5265f591225f4fa744b Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 25 Oct 2025 15:28:21 +0200 Subject: [PATCH] fix for windows --- dlt-connector/bun.lock | 3 +++ dlt-connector/package.json | 1 + dlt-connector/src/bootstrap/initGradidoNode.ts | 6 +++--- dlt-connector/src/client/GradidoNode/GradidoNodeProcess.ts | 1 + dlt-connector/src/client/backend/graphql.ts | 7 +++++-- dlt-connector/src/utils/filesystem.ts | 2 +- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/dlt-connector/bun.lock b/dlt-connector/bun.lock index a60a02798..b1929bed8 100644 --- a/dlt-connector/bun.lock +++ b/dlt-connector/bun.lock @@ -13,6 +13,7 @@ "@sinclair/typemap": "^0.10.1", "@types/bun": "^1.2.17", "@types/uuid": "^8.3.4", + "adm-zip": "^0.5.16", "async-mutex": "^0.5.0", "dotenv": "^10.0.0", "elysia": "1.3.8", @@ -285,6 +286,8 @@ "acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="], + "adm-zip": ["adm-zip@0.5.16", "", {}, "sha512-TGw5yVi4saajsSEgz25grObGHEUaDrniwvA2qwSC060KfqGPdglhvPMA2lPIoxs3PQIItj2iag35fONcQqgUaQ=="], + "agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="], "anser": ["anser@1.4.10", "", {}, "sha512-hCv9AqTQ8ycjpSd3upOJd7vFwW1JaoYQ7tpham03GJ1ca8/65rqn0RpaWpItOAd6ylW9wAw6luXYPJIyPFVOww=="], diff --git a/dlt-connector/package.json b/dlt-connector/package.json index da30cf58d..1271726ec 100644 --- a/dlt-connector/package.json +++ b/dlt-connector/package.json @@ -26,6 +26,7 @@ "@sinclair/typemap": "^0.10.1", "@types/bun": "^1.2.17", "@types/uuid": "^8.3.4", + "adm-zip": "^0.5.16", "async-mutex": "^0.5.0", "dotenv": "^10.0.0", "elysia": "1.3.8", diff --git a/dlt-connector/src/bootstrap/initGradidoNode.ts b/dlt-connector/src/bootstrap/initGradidoNode.ts index 3be2e130c..263bed249 100644 --- a/dlt-connector/src/bootstrap/initGradidoNode.ts +++ b/dlt-connector/src/bootstrap/initGradidoNode.ts @@ -1,7 +1,6 @@ import { execSync } from 'node:child_process' import fs from 'node:fs' import path from 'node:path' -import { gunzipSync } from 'node:zlib' import { getLogger } from 'log4js' import { exportCommunities } from '../client/GradidoNode/communities' import { GradidoNodeProcess } from '../client/GradidoNode/GradidoNodeProcess' @@ -15,6 +14,7 @@ import { import { checkFileExist, checkPathExist } from '../utils/filesystem' import { isPortOpen } from '../utils/network' import { AppContextClients } from './appContext' +import AdmZip from 'adm-zip' const logger = getLogger(`${LOG4JS_BASE_CATEGORY}.bootstrap.initGradidoNode`) @@ -58,7 +58,6 @@ async function exportHederaAddressbooks( async function ensureGradidoNodeRuntimeAvailable(runtimeFileName: string): Promise { const runtimeFolder = path.dirname(runtimeFileName) checkPathExist(runtimeFolder, true) - logger.debug(`GradidoNode Runtime: ${runtimeFileName}`) if (!checkFileExist(runtimeFileName)) { const runtimeArchiveFilename = createGradidoNodeRuntimeArchiveFilename() const downloadUrl = new URL( @@ -71,7 +70,8 @@ async function ensureGradidoNodeRuntimeAvailable(runtimeFileName: string): Promi } const compressedBuffer = await archive.arrayBuffer() if (process.platform === 'win32') { - fs.writeFileSync(runtimeFileName, gunzipSync(Buffer.from(compressedBuffer))) + const zip = new AdmZip(Buffer.from(compressedBuffer)) + zip.extractAllTo(runtimeFolder, true) } else { const archivePath = path.join(runtimeFolder, runtimeArchiveFilename) logger.debug(`GradidoNode Runtime Archive: ${archivePath}`) diff --git a/dlt-connector/src/client/GradidoNode/GradidoNodeProcess.ts b/dlt-connector/src/client/GradidoNode/GradidoNodeProcess.ts index d6f5237bf..eb2bf6b66 100644 --- a/dlt-connector/src/client/GradidoNode/GradidoNodeProcess.ts +++ b/dlt-connector/src/client/GradidoNode/GradidoNodeProcess.ts @@ -52,6 +52,7 @@ export class GradidoNodeProcess { env: { CLIENTS_HIERO_NETWORKTYPE: CONFIG.HIERO_HEDERA_NETWORK, SERVER_JSON_RPC_PORT: CONFIG.DLT_NODE_SERVER_PORT.toString(), + USERPROFILE: CONFIG.DLT_GRADIDO_NODE_SERVER_HOME_FOLDER, HOME: CONFIG.DLT_GRADIDO_NODE_SERVER_HOME_FOLDER, }, onExit(proc, exitCode, signalCode, error) { diff --git a/dlt-connector/src/client/backend/graphql.ts b/dlt-connector/src/client/backend/graphql.ts index 03a4a3544..fafd77fcd 100644 --- a/dlt-connector/src/client/backend/graphql.ts +++ b/dlt-connector/src/client/backend/graphql.ts @@ -27,10 +27,13 @@ export const homeCommunityGraphqlQuery = gql` export const setHomeCommunityTopicId = gql` mutation ($uuid: String!, $hieroTopicId: String){ updateHomeCommunity(uuid: $uuid, hieroTopicId: $hieroTopicId) { - ...Community_common + uuid + name + hieroTopicId + foreign + creationDate } } - ${communityFragment} ` export const getReachableCommunities = gql` diff --git a/dlt-connector/src/utils/filesystem.ts b/dlt-connector/src/utils/filesystem.ts index 639c1b8a4..29a3a7519 100644 --- a/dlt-connector/src/utils/filesystem.ts +++ b/dlt-connector/src/utils/filesystem.ts @@ -9,7 +9,7 @@ export function checkFileExist(filePath: string): boolean { fs.accessSync(filePath, fs.constants.R_OK | fs.constants.W_OK) return true } catch (err) { - logger.debug(`file ${filePath} does not exist: ${err}`) + // logger.debug(`file ${filePath} does not exist: ${err}`) return false } }