doublemarked / loopback-console Goto Github PK
View Code? Open in Web Editor NEWA command-line tool for Loopback app debugging and administration
License: MIT License
A command-line tool for Loopback app debugging and administration
License: MIT License
my app uses es7 async await all over the place with try/catch exception handling in the async/await code. When an exception is thrown in the console the output is mangled. The exception message is output as an array instead of a string or something. example below.
2018-05-18T00:37:18.074Z [45470] ============================================
Loopback Console
Primary handles available:
- app: The Loopback app handle
- cb: A simplistic results callback that stores and prints
- result: The handle on which cb() stores results
Other handles available:
- Models: AccessToken, Affiliate, Announcement, APIKey, Application, Broker, Chat, ChatChannel, ConnectedUsers, Email, Error, Execution, Funding, IndexComposite, Instrument, InstrumentInterval, Insurance, Leaderboard, Liquidation, LiquidationOrder, LoginRecord, Margin, Notification, Order, OrderBook, OrderBookL2, Position, Quote, RoleMapping, Role, Scope, Schema, Secret, Settlement, Stats, StatsHistory, StatsUSD, Trade, TradeBin, Transaction, User, UserCommission, UserPreferences, Wallet, Webhook, accessToken, roleMapping, user
============================================
Loopback-console >User.new(
... '[email protected]',
... 'hadof78909ads8f',
... 'testuserfromconsole',
... 'user1',
... 'testuser',
... true,
... null,
... 'US'
... );
2018-05-18T00:37:32.425Z [45470] Error during creation of user testuserfromconsole[[email protected]](75633): undefined
2018-05-18T00:37:33.990Z [45470] [Promise Rejection]
OperationalError {
'0': 'c',
'1': 'o',
'2': 'n',
'3': 'n',
'4': 'e',
'5': 'c',
'6': 't',
'7': ' ',
'8': 'E',
'9': 'C',
'10': 'O',
'11': 'N',
'12': 'N',
'13': 'R',
'14': 'E',
'15': 'F',
'16': 'U',
'17': 'S',
'18': 'E',
'19': 'D',
'20': ' ',
'21': '1',
'22': '2',
'23': '7',
'24': '.',
'25': '0',
'26': '.',
'27': '0',
'28': '.',
'29': '1',
'30': ':',
'31': '4',
'32': '6',
'33': '5',
cause: { '0': 'c',
'1': 'o',
'2': 'n',
'3': 'n',
'4': 'e',
'5': 'c',
'6': 't',
'7': ' ',
'8': 'E',
'9': 'C',
'10': 'O',
'11': 'N',
'12': 'N',
'13': 'R',
'14': 'E',
'15': 'F',
'16': 'U',
'17': 'S',
'18': 'E',
'19': 'D',
'20': ' ',
'21': '1',
'22': '2',
'23': '7',
'24': '.',
'25': '0',
'26': '.',
'27': '0',
'28': '.',
'29': '1',
'30': ':',
'31': '4',
'32': '6',
'33': '5',
error: undefined,
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 465 },
__cachedRelations: {},
__data:
{ '0': 'c',
'1': 'o',
'2': 'n',
'3': 'n',
'4': 'e',
'5': 'c',
'6': 't',
'7': ' ',
'8': 'E',
'9': 'C',
'10': 'O',
'11': 'N',
'12': 'N',
'13': 'R',
'14': 'E',
'15': 'F',
'16': 'U',
'17': 'S',
'18': 'E',
'19': 'D',
'20': ' ',
'21': '1',
'22': '2',
'23': '7',
'24': '.',
'25': '0',
'26': '.',
'27': '0',
'28': '.',
'29': '1',
'30': ':',
'31': '4',
'32': '6',
'33': '5',
error: undefined,
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 465 },
__dataSource: undefined,
__strict: false,
__persisted: false,
errno: 'ECONNREFUSED',
code: 'ECONNECTION',
syscall: 'connect',
address: '127.0.0.1',
port: 465,
command: 'CONN' }
Loopback-console >2018-05-18T00:37:49.010Z [45470] 127.0.0.1 (Chrome 65.0.3325.181, Mac OS) - "GET /api/v1/geo " 404 9b - 177.891 ms
Hi,
I would like to use loopback-console
to trigger manually scripts that may take a long time. Is there a way to show progress (console.log
/ process.stdout.write
) in the REPL ?
Or if you eventually had another suggestion as on how to do the following I'd be more than happy. What I need is :
app
from these scriptsDoesn't sound much complicated but I guess I am missing some ExpressJS basics...
Help would be much appreciated, thanks
Hi!
I tried to use it on my Windows 8.1 x64 and got an error.
package.json:
"scripts": {
"console": "$(npm bin)/loopback-console ."
}
Output:
> $(npm bin)/loopback-console .
"$" Is not an internal or external
command, operable program or batch file.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\nodejs\\\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "console"
npm ERR! node v0.12.7
npm ERR! npm v3.2.0
npm ERR! code ELIFECYCLE
npm ERR! [email protected] console: `$(npm bin)/loopback-console .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] console script '$(npm bin)/loopback-console .'.
npm ERR! This is most likely a problem with the loopback-zero-to-hero package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! $(npm bin)/loopback-console .
npm ERR! You can get their info via:
npm ERR! npm owner ls loopback-zero-to-hero
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! c:\projects\loopback-zero-to-hero\npm-debug.log
$ loopback-console .
...
loopback > help
ReferenceError: help is not defined
loopback > models
ReferenceError: models is not defined
There should be a way to see the help
again which right now only pops-up in the beginning and then gets lost as the screen scrolls up ... and probably something called models
also, it helps when someone only wants all the existing models listed.
Would be great to be able to keep all the variables that have been set but reload the code in place.
What strategy can I take to integrate this into a ES6 app that uses import
statements?
$ ./node_modules/.bin/loopback-console
/Users/kevzettler//api/app.js:3
import {generateConfig} from 'etc/environment';
^^^^^^
SyntaxError: Unexpected token import
at new Script (vm.js:51:7)
at createScript (vm.js:136:10)
at Object.runInThisContext (vm.js:197:10)
In Node Repl, I can run the following short script but in loopback console it ends with SyntaxError.
if (1) {
console.log('Hello');
}
Any config change which I am missing here?
example
directory inside loopback-console
which was ignored for publishing with .npmignore
but used by those who clone this project to quickly experiment a slew of HOW-TOs on usage for loopback-consoleloopback >
/Users/pulkitsinghal/.nvm/v0.10.37/lib/node_modules/loopback-console/index.js:123
throw(err);
^
TypeError: Cannot call method 'bind' of undefined
at /Users/pulkitsinghal/.nvm/v0.10.37/lib/node_modules/loopback-console/repl.js:21:44
at REPLServer.self.eval (repl.js:122:7)
at Object.module.exports.start (/Users/pulkitsinghal/.nvm/v0.10.37/lib/node_modules/loopback-console/repl.js:19:16)
at Object.module.exports.start (/Users/pulkitsinghal/.nvm/v0.10.37/lib/node_modules/loopback-console/index.js:96:21)
at Object.module.exports.cli (/Users/pulkitsinghal/.nvm/v0.10.37/lib/node_modules/loopback-console/index.js:118:22)
at Object.<anonymous> (/Users/pulkitsinghal/.nvm/v0.10.37/lib/node_modules/loopback-console/bin/loopback-console:3:15)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:935:3
Is it possible to wrap the console prompt in an async IIFE, so that we can use await inside?
You can find the content that I think might make the README more appealing here:
https://github.com/GovRight/loopback-console/wiki/README-edits-by-Pulkit
Also theres is some additional content here, use as you see fit:
https://github.com/GovRight/loopback-console/wiki/FAQs-by-Pulkit
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.