Comparing version 1.0.2 to 1.1.0
@@ -30,1 +30,11 @@ 'use strict'; | ||
}; | ||
exports.assertAppSecret = (options) => { | ||
if (!(options.app && options.secret)) { | ||
throw new Error(`App and Secret not found. Set them with: | ||
--app & --secret parameters | ||
save to vinlirc with 'vinli-cli app set-current' | ||
export to VINLI_APP & VINLI_SECRET environment variables`); | ||
} | ||
return options; | ||
}; |
@@ -21,3 +21,3 @@ 'use strict'; | ||
throw new Error(err); | ||
console.log(colors.red(err.message || err)); | ||
}; |
'use strict'; | ||
const origins = { | ||
prod: { | ||
platform: 'https://platform.vin.li', | ||
telemetry: 'https://telemetry.vin.li', | ||
event: 'https://events.vin.li', | ||
trip: 'https://trips.vin.li', | ||
dev: 'https://dev.vin.li', | ||
auth: 'https://auth.vin.li', | ||
rule: 'https://rules.vin.li', | ||
dummy: 'https://dummies.vin.li' | ||
} | ||
}; | ||
const origins = (stack) => ({ | ||
platform: `https://platform${stack}`, | ||
telemetry: `https://telemetry${stack}`, | ||
event: `https://events${stack}`, | ||
trip: `https://trips${stack}`, | ||
dev: `https://dev${stack}`, | ||
auth: `https://auth${stack}`, | ||
rule: `https://rules${stack}`, | ||
dummy: `https://dummies${stack}`, | ||
stream: `wss://stream${stack}` | ||
}); | ||
module.exports = function(service, stack) { | ||
return origins[stack || 'prod'][service]; | ||
return origins(stack || process.env.VINLI_STACK || '.vin.li')[service]; | ||
}; |
@@ -8,3 +8,3 @@ 'use strict'; | ||
const defaultFormat = function(value) { | ||
if (typeof value === 'time') { | ||
if (_.isDate(value)) { | ||
return value.toISOString(); | ||
@@ -11,0 +11,0 @@ } |
{ | ||
"name": "vinli-cli", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Vinli Developers don't use web interfaces", | ||
@@ -46,6 +46,7 @@ "preferGlobal": true, | ||
"moment": "^2.11.1", | ||
"prompt": "^0.2.14", | ||
"prompt": "^1.0.0", | ||
"table": "^3.7.8", | ||
"ws": "^1.0.1", | ||
"yarp": "^0.4.5" | ||
} | ||
} |
@@ -22,2 +22,4 @@ Vinli CLI | ||
- [Device](#device) | ||
- [`events`](#device-events) | ||
- [`latest-vehicle`](#device-latest-vehicle) | ||
- [`list`](#device-list) | ||
@@ -27,2 +29,4 @@ - [`set-current`](#device-set-current) | ||
- [`snapshots`](#device-snapshots) | ||
- [`stream`](#device-stream) | ||
- [`messages`](#device-messages) | ||
- [`vehicles`](#device-vehicles) | ||
@@ -63,2 +67,3 @@ - [Dummy](#dummy) | ||
- **Dummy** - Dummies are virtual devices can be created on demand and sent on virtual trips on predefined routes. A dummy can be added to a My Vinli account that has authorized your app and when it starts a trip the data will come into your application in real time exactly the same as a real Vinli device. Commands that act on a dummy can have a dummy specified by name or id with the `--dummy` parameter, `VINL_DUMMY` environment variable or saved to nearest `.vinlirc` file with `dummy set-current`. Dummies are associated with an app and there is a limit of 5 per app. They can be reused multiple times and deleted. | ||
- **since** & **until** - Commands that output sets of dated sets of data can be limited with `--since` and `--until` parameters (or `VINLI_SINCE` / `VINLI_UNTIL` environment variables). Use either or both parameters to limit the output of the command. You can enter anything that will parse to a javascript date like `2016-02-14`, `2016-02-14T06:00:00.000Z`, '1455429600000' (milliseconds Epoch), or relative values like `1 hour ago` (seconds/minutes/hours/days/weeks/months/years) | ||
- **Output** - Output of almost all commands can be formatted to support easier integration with the parameter `--output [format]` or `-o [format]`. Supported formats are `table` (default), `json`, `yaml`, or `text` | ||
@@ -119,2 +124,16 @@ - **Help** - `-h` or `--help` with any command or subcommand will output help contents and accepted parameters. Ex: `vinli --help`, `vinli app -h`, `vinli dummy set-current --help`. | ||
## Device | ||
### `device events` | ||
Get device event history. | ||
Requires `--device` param or current device saved in `.vinlirc`. Supports output formatting with `--output`. Requires `app` and `secret`. | ||
Pagination parameters for `device locations`: | ||
* `--limit` | ||
* `--since` | ||
* `--until` | ||
### `device latest-vehicle` | ||
Get the vehicle information for last vehicle a device was seen in. | ||
Requires `--device` param or current device saved in `.vinlirc`. Supports output formatting with `--output`. Requires `app` and `secret`. | ||
### `device list` | ||
@@ -128,3 +147,3 @@ Get a list of devices that available to an app. These can be real devices or dummies. Supports output formatting with `--output`. Requires `app` and `secret`. | ||
### `device set-current` | ||
Most commands require the selection of a device. This is similar to the app selection and will also be stored in the nearest `.vinlirc` file. Requires `app` and `secret`. | ||
Most commands require the selection of a device. This is similar to the app selection and will also be stored in the nearest `.vinlirc` file. Requires `--device` param. Requires `app` and `secret`. | ||
@@ -140,3 +159,3 @@ * `vinli device set-current --device 74ce1599-72e3-4353-8637-0cc4e2bffe54` | ||
Fields in output can be limited with `--fields [list]` parameter. Supports output formatting with `--output`. Requires `app` and `secret`. | ||
Requires `--device` param or current device saved in `.vinlirc`. Fields in output can be limited with `--fields [list]` parameter. Supports output formatting with `--output`. Requires `app` and `secret`. | ||
@@ -151,3 +170,3 @@ Pagination parameters for `device locations`: | ||
Fields in output can be limited with `--fields [list]` parameter. Supports output formatting with `--output`. Requires `app` and `secret`. | ||
Requires `--device` param or current device saved in `.vinlirc`. Fields in output can be limited with `--fields [list]` parameter. Supports output formatting with `--output`. Requires `app` and `secret`. | ||
@@ -159,6 +178,21 @@ Pagination parameters for `device snapshots`: | ||
### `device stream` | ||
Subscribe to a stream of device messages. | ||
Requires `--device` param or current device saved in `.vinlirc`. Requires `app` and `secret`. Supports output formatting with `--output`, but only `table` and `json` are supported.s | ||
### `device messages` | ||
Get recent messages that a device has sent in to the platform. | ||
Requires `--device` param or current device saved in `.vinlirc`. Supports output formatting with `--output`. Requires `app` and `secret`. | ||
Pagination parameters for `device snapshots`: | ||
* `--limit` | ||
* `--since` | ||
* `--until` | ||
### `device vehicles` | ||
Get a list of vehicles a devices has been in. | ||
Supports output formatting with `--output`. Requires `app` and `secret`. | ||
Requires `--device` param or current device saved in `.vinlirc`. Supports output formatting with `--output`. Requires `app` and `secret`. | ||
@@ -165,0 +199,0 @@ Pagination parameters for `device snapshots`: |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125801
47
1395
465
12
+ Addedws@^1.0.1
+ Added@colors/colors@1.5.0(transitive)
+ Addedasync@2.6.43.2.3(transitive)
+ Addedcolors@1.0.3(transitive)
+ Addedoptions@0.0.6(transitive)
+ Addedprompt@1.3.0(transitive)
+ Addedultron@1.0.2(transitive)
+ Addedwinston@2.4.7(transitive)
+ Addedws@1.1.5(transitive)
- Removedarray-buffer-byte-length@1.0.2(transitive)
- Removedasync@0.2.10(transitive)
- Removedavailable-typed-arrays@1.0.7(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcolors@0.6.2(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddeep-equal@2.2.3(transitive)
- Removeddefine-properties@1.2.1(transitive)
- Removedes-get-iterator@1.1.3(transitive)
- Removedfor-each@0.3.3(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedfunctions-have-names@1.2.3(transitive)
- Removedglob@7.2.3(transitive)
- Removedhas-bigints@1.1.0(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedi@0.3.7(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinternal-slot@1.1.0(transitive)
- Removedis-arguments@1.2.0(transitive)
- Removedis-array-buffer@3.0.5(transitive)
- Removedis-bigint@1.1.0(transitive)
- Removedis-boolean-object@1.2.1(transitive)
- Removedis-callable@1.2.7(transitive)
- Removedis-date-object@1.1.0(transitive)
- Removedis-map@2.0.3(transitive)
- Removedis-number-object@1.1.1(transitive)
- Removedis-regex@1.2.1(transitive)
- Removedis-set@2.0.3(transitive)
- Removedis-shared-array-buffer@1.0.4(transitive)
- Removedis-string@1.1.1(transitive)
- Removedis-symbol@1.1.1(transitive)
- Removedis-weakmap@2.0.2(transitive)
- Removedis-weakset@2.0.4(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedncp@0.4.2(transitive)
- Removedobject-inspect@1.13.3(transitive)
- Removedobject-is@1.1.6(transitive)
- Removedobject.assign@4.1.7(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpkginfo@0.3.10.4.1(transitive)
- Removedpossible-typed-array-names@1.0.0(transitive)
- Removedprompt@0.2.14(transitive)
- Removedregexp.prototype.flags@1.5.3(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedsafe-regex-test@1.1.0(transitive)
- Removedset-function-name@2.0.2(transitive)
- Removedside-channel@1.1.0(transitive)
- Removedside-channel-list@1.0.0(transitive)
- Removedside-channel-map@1.0.1(transitive)
- Removedside-channel-weakmap@1.0.2(transitive)
- Removedstop-iteration-iterator@1.1.0(transitive)
- Removedutile@0.2.1(transitive)
- Removedwhich-boxed-primitive@1.1.1(transitive)
- Removedwhich-collection@1.0.2(transitive)
- Removedwhich-typed-array@1.1.18(transitive)
- Removedwinston@0.8.3(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedprompt@^1.0.0