Skip to content

Commit

Permalink
fix: minor issues with parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Souvikns committed Sep 26, 2023
1 parent 0d6f324 commit 55881a9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default async function GleeAppInitializer() {
await registerAuth(GLEE_AUTH_DIR)

const parsedAsyncAPI = await getParsedAsyncAPI()
const channelNames = parsedAsyncAPI.channels().map(e => e.address())
const channelNames = parsedAsyncAPI.channels().all().map(e => e.address())

const app = new Glee(config)

Expand Down
3 changes: 2 additions & 1 deletion src/lib/asyncapiFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export async function getParsedAsyncAPI(): Promise<AsyncAPIDocument> {
const { ASYNCAPI_FILE_PATH } = getConfigs()
const asyncapiFileContent = await readFile(ASYNCAPI_FILE_PATH, 'utf-8')

Check warning on line 7 in src/lib/asyncapiFile.ts

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Found readFile from package "fs/promises" with non literal argument at index 0

Check warning on line 7 in src/lib/asyncapiFile.ts

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - macos-latest

Found readFile from package "fs/promises" with non literal argument at index 0
const parser = new Parser()
return toAsyncAPIDocument(parser.parse(asyncapiFileContent))
const {document} = await parser.parse(asyncapiFileContent)
return toAsyncAPIDocument(document)
}
2 changes: 1 addition & 1 deletion src/lib/servers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export async function getSelectedServerNames(): Promise<string[]> {
const parsedAsyncAPI = await getParsedAsyncAPI()

if (!process.env.GLEE_SERVER_NAMES) {
return parsedAsyncAPI.servers().all().map(e => e.url())
return parsedAsyncAPI.servers().all().map(e => e.id())
}

const arrayOfNames = process.env.GLEE_SERVER_NAMES.split(',')
Expand Down
2 changes: 1 addition & 1 deletion src/registerAdapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function registerAdapterForServer(
config: GleeConfig
) {
const protocol = server.protocol()
const remoteServers = parsedAsyncAPI.extensions().get('x-remoteServers').value()
const remoteServers = parsedAsyncAPI.extensions().get('x-remoteServers')?.value()
if (['mqtt', 'mqtts', 'secure-mqtt'].includes(protocol)) {
app.addAdapter(MqttAdapter, {
serverName,
Expand Down

0 comments on commit 55881a9

Please sign in to comment.