From 53ffa0d41bc453ce471be81999b93d98fbf16baa Mon Sep 17 00:00:00 2001 From: Simonas Karuzas Date: Tue, 3 Dec 2019 15:33:12 +0200 Subject: [PATCH] fix: Handle raw message in cli --- packages/daf-cli/src/cli.ts | 1 + packages/daf-cli/src/msg.ts | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 packages/daf-cli/src/msg.ts diff --git a/packages/daf-cli/src/cli.ts b/packages/daf-cli/src/cli.ts index 9e8e6b1d9..11d4bde49 100644 --- a/packages/daf-cli/src/cli.ts +++ b/packages/daf-cli/src/cli.ts @@ -6,6 +6,7 @@ import './services' import './data-explorer' import './graphql' import './sdr' +import './msg' program.parse(process.argv) if (!process.argv.slice(2).length) { diff --git a/packages/daf-cli/src/msg.ts b/packages/daf-cli/src/msg.ts new file mode 100644 index 000000000..3bb636cc2 --- /dev/null +++ b/packages/daf-cli/src/msg.ts @@ -0,0 +1,21 @@ +import { core } from './setup' +import program from 'commander' + +program + .command('msg ') + .description('Handle raw message (JWT)') + .action(async raw => { + try { + const result = await core.onRawMessage({ + raw, + meta: [ + { + sourceType: 'cli', + }, + ], + }) + console.log(result) + } catch (e) { + console.error(e) + } + })