@signageos/cli 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/dist/Auth/loginCommand.d.ts +5 -0
- package/dist/Auth/loginCommand.js +31 -16
- package/dist/Auth/loginCommand.js.map +1 -1
- package/package.json +12 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.3.1] - 2023-08-29
|
|
7
8
|
## [1.3.0] - 2023-05-19
|
|
8
9
|
### Fixed
|
|
9
10
|
- New version announcement has a link to the changelog
|
|
@@ -4,6 +4,11 @@ declare const OPTION_LIST: readonly [{
|
|
|
4
4
|
readonly type: StringConstructor;
|
|
5
5
|
readonly description: `Username or e-mail used for ${string}`;
|
|
6
6
|
}];
|
|
7
|
+
/**
|
|
8
|
+
* Gets secret flag --auth0-enabled from command line options
|
|
9
|
+
* { _unknown: [ '--auth0-enabled' ], command: [ 'login' ] }
|
|
10
|
+
*/
|
|
11
|
+
export declare const getIsAuth0Enabled: (options: any) => boolean;
|
|
7
12
|
export declare const login: {
|
|
8
13
|
name: "login";
|
|
9
14
|
description: string;
|
|
@@ -36,22 +36,34 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.login = void 0;
|
|
39
|
+
exports.login = exports.getIsAuth0Enabled = void 0;
|
|
40
40
|
var chalk_1 = require("chalk");
|
|
41
41
|
var prompts = require("prompts");
|
|
42
42
|
var Debug = require("debug");
|
|
43
43
|
var os = require("os");
|
|
44
|
+
var apiVersions_1 = require("@signageos/sdk/dist/RestApi/apiVersions");
|
|
45
|
+
var log_1 = require("@signageos/sdk/dist/Console/log");
|
|
46
|
+
var sosControlHelper_1 = require("@signageos/sdk/dist/SosHelper/sosControlHelper");
|
|
44
47
|
var helper_1 = require("../helper");
|
|
45
48
|
var runControlHelper_1 = require("../RunControl/runControlHelper");
|
|
46
49
|
var parameters_1 = require("../parameters");
|
|
47
50
|
var commandDefinition_1 = require("../Command/commandDefinition");
|
|
48
|
-
var apiVersions_1 = require("@signageos/sdk/dist/RestApi/apiVersions");
|
|
49
|
-
var log_1 = require("@signageos/sdk/dist/Console/log");
|
|
50
|
-
var sosControlHelper_1 = require("@signageos/sdk/dist/SosHelper/sosControlHelper");
|
|
51
51
|
var debug = Debug('@signageos/cli:Auth:login');
|
|
52
|
-
var OPTION_LIST = [
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
var OPTION_LIST = [{ name: 'username', type: String, description: "Username or e-mail used for ".concat(parameters_1.parameters.boxHost) }];
|
|
53
|
+
/**
|
|
54
|
+
* Gets secret flag --auth0-enabled from command line options
|
|
55
|
+
* { _unknown: [ '--auth0-enabled' ], command: [ 'login' ] }
|
|
56
|
+
*/
|
|
57
|
+
var getIsAuth0Enabled = function (options) {
|
|
58
|
+
var _a;
|
|
59
|
+
var isAuth0Enabled = false;
|
|
60
|
+
// tslint:disable-next-line no-string-literal
|
|
61
|
+
if ((_a = options['_unknown']) === null || _a === void 0 ? void 0 : _a.includes('--auth0-enabled')) {
|
|
62
|
+
isAuth0Enabled = true;
|
|
63
|
+
}
|
|
64
|
+
return isAuth0Enabled;
|
|
65
|
+
};
|
|
66
|
+
exports.getIsAuth0Enabled = getIsAuth0Enabled;
|
|
55
67
|
exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
56
68
|
name: 'login',
|
|
57
69
|
description: 'Login account using username & password',
|
|
@@ -59,7 +71,7 @@ exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
59
71
|
commands: [],
|
|
60
72
|
run: function (options) {
|
|
61
73
|
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
-
var identification, response, password, config, apiUrl, _a, tokenId, apiSecurityToken, name;
|
|
74
|
+
var identification, response, password, config, apiUrl, isAuth0Enabled, _a, tokenId, apiSecurityToken, name;
|
|
63
75
|
return __generator(this, function (_b) {
|
|
64
76
|
switch (_b.label) {
|
|
65
77
|
case 0:
|
|
@@ -89,7 +101,8 @@ exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
89
101
|
case 4:
|
|
90
102
|
config = _b.sent();
|
|
91
103
|
apiUrl = (0, helper_1.getApiUrl)(config);
|
|
92
|
-
|
|
104
|
+
isAuth0Enabled = (0, exports.getIsAuth0Enabled)(options);
|
|
105
|
+
return [4 /*yield*/, getOrCreateApiSecurityToken({ identification: identification, password: password, apiUrl: apiUrl, isAuth0Enabled: isAuth0Enabled })];
|
|
93
106
|
case 5:
|
|
94
107
|
_a = _b.sent(), tokenId = _a.id, apiSecurityToken = _a.securityToken, name = _a.name;
|
|
95
108
|
return [4 /*yield*/, (0, runControlHelper_1.saveConfig)({
|
|
@@ -106,11 +119,12 @@ exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
106
119
|
});
|
|
107
120
|
},
|
|
108
121
|
});
|
|
109
|
-
function getOrCreateApiSecurityToken(
|
|
122
|
+
function getOrCreateApiSecurityToken(_a) {
|
|
123
|
+
var identification = _a.identification, password = _a.password, apiUrl = _a.apiUrl, isAuth0Enabled = _a.isAuth0Enabled;
|
|
110
124
|
return __awaiter(this, void 0, void 0, function () {
|
|
111
|
-
var ACCOUNT_SECURITY_TOKEN_RESOURCE, options, tokenName, query, responseOfPost, bodyOfPost,
|
|
112
|
-
return __generator(this, function (
|
|
113
|
-
switch (
|
|
125
|
+
var ACCOUNT_SECURITY_TOKEN_RESOURCE, options, tokenName, query, responseOfPost, bodyOfPost, _b, _c;
|
|
126
|
+
return __generator(this, function (_d) {
|
|
127
|
+
switch (_d.label) {
|
|
114
128
|
case 0:
|
|
115
129
|
ACCOUNT_SECURITY_TOKEN_RESOURCE = 'account/security-token';
|
|
116
130
|
options = {
|
|
@@ -123,14 +137,15 @@ function getOrCreateApiSecurityToken(identification, password, apiUrl) {
|
|
|
123
137
|
identification: identification,
|
|
124
138
|
password: password,
|
|
125
139
|
name: tokenName,
|
|
140
|
+
isAuth0AuthenticationEnabled: isAuth0Enabled,
|
|
126
141
|
};
|
|
127
142
|
return [4 /*yield*/, (0, helper_1.postResource)(options, ACCOUNT_SECURITY_TOKEN_RESOURCE, query)];
|
|
128
143
|
case 1:
|
|
129
|
-
responseOfPost =
|
|
130
|
-
|
|
144
|
+
responseOfPost = _d.sent();
|
|
145
|
+
_c = (_b = JSON).parse;
|
|
131
146
|
return [4 /*yield*/, responseOfPost.text()];
|
|
132
147
|
case 2:
|
|
133
|
-
bodyOfPost =
|
|
148
|
+
bodyOfPost = _c.apply(_b, [_d.sent(), helper_1.deserializeJSON]);
|
|
134
149
|
debug('POST security-token response', bodyOfPost);
|
|
135
150
|
if (responseOfPost.status === 201) {
|
|
136
151
|
return [2 /*return*/, bodyOfPost];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loginCommand.js","sourceRoot":"","sources":["../../src/Auth/loginCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA0B;AAC1B,iCAAmC;AACnC,6BAA+B;AAC/B,uBAAyB;AACzB,oCAAqE;AACrE,mEAAwE;AACxE,4CAA2C;AAC3C,kEAA2F;
|
|
1
|
+
{"version":3,"file":"loginCommand.js","sourceRoot":"","sources":["../../src/Auth/loginCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA0B;AAC1B,iCAAmC;AACnC,6BAA+B;AAC/B,uBAAyB;AACzB,uEAAsE;AACtE,uDAAsD;AACtD,mFAAmF;AACnF,oCAAqE;AACrE,mEAAwE;AACxE,4CAA2C;AAC3C,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
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
".env",
|
|
@@ -13,21 +13,24 @@
|
|
|
13
13
|
"type": "git"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"build": "tsc",
|
|
16
|
+
"build": "npx check-engine@latest && tsc",
|
|
17
17
|
"lint": "tslint --config node_modules/@signageos/codestyle/tslint.json {src,tests}/**/*.ts",
|
|
18
18
|
"prebuild": "rm -rf dist/*",
|
|
19
19
|
"prepare": "npm run prebuild && npm run build && chmod +x dist/index.js",
|
|
20
20
|
"test": "env NODE_ENV=test mocha --config .mocharc.unit.json",
|
|
21
21
|
"test-integration": "env NODE_ENV=test mocha --config .mocharc.integration.json",
|
|
22
|
+
"test:coverage": "c8 npm run test",
|
|
22
23
|
"watch": "tsc --watch",
|
|
23
24
|
"check": "npm run depcheck && npx --userconfig ./.npmrc @signageos/lib check-deps && npm run check-circular-deps",
|
|
24
25
|
"check-circular-deps": "npx madge@5 --circular --extensions ts ./src/",
|
|
25
|
-
"depcheck": "depcheck --config .depcheckrc.json"
|
|
26
|
+
"depcheck": "depcheck --config .depcheckrc.json",
|
|
27
|
+
"check-types": "tsc --noEmit",
|
|
28
|
+
"prettier:format": "prettier \"(src|tests|tools)/**/*.+(ts|js)\" --write"
|
|
26
29
|
},
|
|
27
30
|
"license": "MIT",
|
|
28
31
|
"engines": {
|
|
29
|
-
"node": "
|
|
30
|
-
"npm": "
|
|
32
|
+
"node": "12",
|
|
33
|
+
"npm": "6"
|
|
31
34
|
},
|
|
32
35
|
"bin": {
|
|
33
36
|
"sos": "./dist/index.js"
|
|
@@ -37,7 +40,8 @@
|
|
|
37
40
|
"access": "public"
|
|
38
41
|
},
|
|
39
42
|
"devDependencies": {
|
|
40
|
-
"@
|
|
43
|
+
"@istanbuljs/nyc-config-typescript": "1.0.2",
|
|
44
|
+
"@signageos/codestyle": "0.0.23",
|
|
41
45
|
"@types/chalk": "2.2.0",
|
|
42
46
|
"@types/child-process-promise": "2.2.1",
|
|
43
47
|
"@types/cli-progress": "3.7.0",
|
|
@@ -57,8 +61,10 @@
|
|
|
57
61
|
"@types/should": "13.0.0",
|
|
58
62
|
"@types/sinon": "7.5.0",
|
|
59
63
|
"@types/webpack": "4.41.7",
|
|
64
|
+
"c8": "7.13.0",
|
|
60
65
|
"depcheck": "1.4.3",
|
|
61
66
|
"mocha": "8.4.0",
|
|
67
|
+
"prettier": "2.8.8",
|
|
62
68
|
"rewiremock": "3.13.9",
|
|
63
69
|
"should": "13.2.3",
|
|
64
70
|
"sinon": "9.2.0",
|