Skip to content

Commit

Permalink
refactor: replace deprecated detectProtocolSchemes
Browse files Browse the repository at this point in the history
Signed-off-by: Hasan Eroglu <[email protected]>
  • Loading branch information
hasanheroglu committed Jul 21, 2024
1 parent a77021b commit 2751844
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions packages/web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 4 additions & 3 deletions packages/web/src/scripts/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 2751844

Please sign in to comment.