From 2751844997123c0a561bd4396a205da89e6e5cf1 Mon Sep 17 00:00:00 2001 From: Hasan Eroglu Date: Sun, 21 Jul 2024 19:45:23 +0200 Subject: [PATCH] refactor: replace deprecated detectProtocolSchemes Signed-off-by: Hasan Eroglu --- packages/web/package-lock.json | 6 ++++++ packages/web/package.json | 1 + packages/web/src/scripts/console.js | 7 ++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/web/package-lock.json b/packages/web/package-lock.json index 4c0eddf2..241a529b 100644 --- a/packages/web/package-lock.json +++ b/packages/web/package-lock.json @@ -13,6 +13,7 @@ "@thingweb/async-api-converter": "^1.0.0", "@thingweb/json-spell-checker": "^1.0.0", "@thingweb/open-api-converter": "^1.0.0", + "@thingweb/td-utils": "^1.0.0", "d3": "^3.5.17", "d3-tip": "^0.6.7", "express": "^4.19.2", @@ -2056,6 +2057,11 @@ "swagger-parser": "^10.0.3" } }, + "node_modules/@thingweb/td-utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@thingweb/td-utils/-/td-utils-1.0.0.tgz", + "integrity": "sha512-6TJ+2NUDicP1sXvWqorchj+F1Cc/zvCFJHtgIR8p5wI78jNSb0ZQHmpC2/bfZK2AkuE+6dgrzEcJcWNbVcB3sQ==" + }, "node_modules/@trysound/sax": { "version": "0.2.0", "dev": true, diff --git a/packages/web/package.json b/packages/web/package.json index 52f5b26d..54beb73e 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -48,6 +48,7 @@ "@thingweb/async-api-converter": "^1.0.0", "@thingweb/json-spell-checker": "^1.0.0", "@thingweb/open-api-converter": "^1.0.0", + "@thingweb/td-utils": "^1.0.0", "d3": "^3.5.17", "d3-tip": "^0.6.7", "express": "^4.19.2", diff --git a/packages/web/src/scripts/console.js b/packages/web/src/scripts/console.js index ead7175c..2025399a 100644 --- a/packages/web/src/scripts/console.js +++ b/packages/web/src/scripts/console.js @@ -25,7 +25,8 @@ import { AASView } from './aas' import { defaultsView, defaultsJsonBtn, defaultsYamlBtn, defaultsAddBtn } from './defaults' import { visualize } from './visualize' import { validationView, validationTab } from './validation' -import { convertTDYamlToJson, detectProtocolSchemes } from '../../../core/dist/web-bundle.min.js' +import { convertTDYamlToJson } from '../../../core/dist/web-bundle.min.js' +import { detectProtocolSchemes } from '@thingweb/td-utils/dist/web-bundle.min.js' import { generateOAP, generateAAP, addDefaultsUtil, validate, generateAAS, resetValidationStatus } from './util' import { editorList, getEditorData } from './editor' import { textIcon } from './main.js' @@ -239,7 +240,7 @@ function enableAPIConversionWithProtocol(editorInstance) { if (protocolSchemes) { if (openApiTab.checked === true) { - if (["http", "https"].some(p => protocolSchemes.includes(p))) { + if (["http", "https"].some(p => Object.keys(protocolSchemes).includes(p))) { generateOAP(editorInstance["_domElement"].dataset.modeId, editorInstance) openApiView.classList.remove("hidden") } else { @@ -248,7 +249,7 @@ function enableAPIConversionWithProtocol(editorInstance) { } if (asyncApiTab.checked === true) { - if (["mqtt", "mqtts"].some(p => protocolSchemes.includes(p))) { + if (["mqtt", "mqtts"].some(p => Object.keys(protocolSchemes).includes(p))) { generateAAP(editorInstance["_domElement"].dataset.modeId, editorInstance) asyncApiView.classList.remove("hidden") } else {