@signageos/cli 1.4.0 → 1.4.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
CHANGED
|
@@ -4,6 +4,10 @@ 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.4.1] - 2023-10-02
|
|
8
|
+
### Fixed
|
|
9
|
+
- Auth0 compatibility (auto select)
|
|
10
|
+
|
|
7
11
|
## [1.4.0] - 2023-09-25
|
|
8
12
|
### Added
|
|
9
13
|
- Update readme
|
|
@@ -14,8 +14,8 @@ declare const OPTION_LIST: readonly [{
|
|
|
14
14
|
* Only one from auth0 and legacy authentication can be active at the moment
|
|
15
15
|
*/
|
|
16
16
|
export declare const getIsAuth0OrLegacyEnabled: (options: any) => {
|
|
17
|
-
isAuth0Enabled
|
|
18
|
-
isLegacyEnabled
|
|
17
|
+
isAuth0Enabled?: boolean | undefined;
|
|
18
|
+
isLegacyEnabled?: boolean | undefined;
|
|
19
19
|
};
|
|
20
20
|
export declare const login: {
|
|
21
21
|
name: "login";
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
14
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
15
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -61,20 +72,19 @@ var OPTION_LIST = [{ name: 'username', type: String, description: "Username or e
|
|
|
61
72
|
*/
|
|
62
73
|
var getIsAuth0OrLegacyEnabled = function (options) {
|
|
63
74
|
var _a, _b;
|
|
64
|
-
var
|
|
65
|
-
var isLegacyEnabled = false;
|
|
75
|
+
var queryParams = {};
|
|
66
76
|
// tslint:disable-next-line no-string-literal
|
|
67
77
|
if ((_a = options['_unknown']) === null || _a === void 0 ? void 0 : _a.includes('--auth0-enabled')) {
|
|
68
|
-
isAuth0Enabled = true;
|
|
78
|
+
queryParams.isAuth0Enabled = true;
|
|
69
79
|
}
|
|
70
80
|
// tslint:disable-next-line no-string-literal
|
|
71
81
|
if ((_b = options['_unknown']) === null || _b === void 0 ? void 0 : _b.includes('--legacy-enabled')) {
|
|
72
|
-
isLegacyEnabled = true;
|
|
82
|
+
queryParams.isLegacyEnabled = true;
|
|
73
83
|
}
|
|
74
|
-
if (isAuth0Enabled && isLegacyEnabled) {
|
|
84
|
+
if (queryParams.isAuth0Enabled !== undefined && queryParams.isLegacyEnabled !== undefined) {
|
|
75
85
|
throw new Error('Only one override from auth0 and legacy authentication options can be active at the moment.');
|
|
76
86
|
}
|
|
77
|
-
return
|
|
87
|
+
return queryParams;
|
|
78
88
|
};
|
|
79
89
|
exports.getIsAuth0OrLegacyEnabled = getIsAuth0OrLegacyEnabled;
|
|
80
90
|
exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
@@ -84,9 +94,9 @@ exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
84
94
|
commands: [],
|
|
85
95
|
run: function (options) {
|
|
86
96
|
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
-
var identification, response, password, config, apiUrl,
|
|
88
|
-
return __generator(this, function (
|
|
89
|
-
switch (
|
|
97
|
+
var identification, response, password, config, apiUrl, authQueryParams, _a, tokenId, apiSecurityToken, name;
|
|
98
|
+
return __generator(this, function (_b) {
|
|
99
|
+
switch (_b.label) {
|
|
90
100
|
case 0:
|
|
91
101
|
identification = options.username;
|
|
92
102
|
if (!!identification) return [3 /*break*/, 2];
|
|
@@ -96,9 +106,9 @@ exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
96
106
|
message: "Type your username or e-mail used for ".concat(parameters_1.parameters.boxHost),
|
|
97
107
|
})];
|
|
98
108
|
case 1:
|
|
99
|
-
response =
|
|
109
|
+
response = _b.sent();
|
|
100
110
|
identification = response.username;
|
|
101
|
-
|
|
111
|
+
_b.label = 2;
|
|
102
112
|
case 2:
|
|
103
113
|
if (!identification) {
|
|
104
114
|
throw new Error('Missing argument --username <string>');
|
|
@@ -109,28 +119,22 @@ exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
109
119
|
message: "Type your password used for ".concat(parameters_1.parameters.boxHost),
|
|
110
120
|
})];
|
|
111
121
|
case 3:
|
|
112
|
-
password = (
|
|
122
|
+
password = (_b.sent()).password;
|
|
113
123
|
return [4 /*yield*/, (0, runControlHelper_1.loadConfig)()];
|
|
114
124
|
case 4:
|
|
115
|
-
config =
|
|
125
|
+
config = _b.sent();
|
|
116
126
|
apiUrl = (0, helper_1.getApiUrl)(config);
|
|
117
|
-
|
|
118
|
-
return [4 /*yield*/, getOrCreateApiSecurityToken({
|
|
119
|
-
identification: identification,
|
|
120
|
-
password: password,
|
|
121
|
-
apiUrl: apiUrl,
|
|
122
|
-
isAuth0Enabled: isAuth0Enabled,
|
|
123
|
-
isLegacyEnabled: isLegacyEnabled,
|
|
124
|
-
})];
|
|
127
|
+
authQueryParams = (0, exports.getIsAuth0OrLegacyEnabled)(options);
|
|
128
|
+
return [4 /*yield*/, getOrCreateApiSecurityToken(__assign({ identification: identification, password: password, apiUrl: apiUrl }, authQueryParams))];
|
|
125
129
|
case 5:
|
|
126
|
-
|
|
130
|
+
_a = _b.sent(), tokenId = _a.id, apiSecurityToken = _a.securityToken, name = _a.name;
|
|
127
131
|
return [4 /*yield*/, (0, runControlHelper_1.saveConfig)({
|
|
128
132
|
apiUrl: apiUrl !== parameters_1.parameters.apiUrl ? apiUrl : undefined,
|
|
129
133
|
identification: tokenId,
|
|
130
134
|
apiSecurityToken: apiSecurityToken,
|
|
131
135
|
})];
|
|
132
136
|
case 6:
|
|
133
|
-
|
|
137
|
+
_b.sent();
|
|
134
138
|
(0, log_1.log)('info', "User ".concat(chalk_1.default.green(identification), " has been logged in with token \"").concat(name, "\". Credentials are stored in ").concat(chalk_1.default.blue((0, sosControlHelper_1.getConfigFilePath)())));
|
|
135
139
|
return [2 /*return*/];
|
|
136
140
|
}
|
|
@@ -152,13 +156,7 @@ function getOrCreateApiSecurityToken(_a) {
|
|
|
152
156
|
version: apiVersions_1.ApiVersions.V1,
|
|
153
157
|
};
|
|
154
158
|
tokenName = generateTokenName();
|
|
155
|
-
query = {
|
|
156
|
-
identification: identification,
|
|
157
|
-
password: password,
|
|
158
|
-
name: tokenName,
|
|
159
|
-
isAuth0AuthenticationEnabled: isAuth0Enabled,
|
|
160
|
-
isLegacyAuthenticationEnabled: isLegacyEnabled,
|
|
161
|
-
};
|
|
159
|
+
query = __assign(__assign({ identification: identification, password: password, name: tokenName }, isAuth0Enabled !== undefined ? { isAuth0AuthenticationEnabled: isAuth0Enabled } : {}), isLegacyEnabled !== undefined ? { isLegacyAuthenticationEnabled: isLegacyEnabled } : {});
|
|
162
160
|
return [4 /*yield*/, (0, helper_1.postResource)(options, ACCOUNT_SECURITY_TOKEN_RESOURCE, query)];
|
|
163
161
|
case 1:
|
|
164
162
|
responseOfPost = _d.sent();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loginCommand.js","sourceRoot":"","sources":["../../src/Auth/loginCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loginCommand.js","sourceRoot":"","sources":["../../src/Auth/loginCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC;qBAClD;yBAAM;wBACN,MAAM,IAAI,KAAK,CAAC,iBAAiB,GAAG,CAAC,UAAU,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;qBACrH;;;;;CACD;AAED,SAAS,iBAAiB;IACzB,IAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAC/B,IAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,IAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAE/B,OAAO,UAAG,QAAQ,CAAC,QAAQ,cAAI,aAAa,CAAE,CAAC;AAChD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signageos/cli",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
".env",
|
|
@@ -35,10 +35,6 @@
|
|
|
35
35
|
"bin": {
|
|
36
36
|
"sos": "./dist/index.js"
|
|
37
37
|
},
|
|
38
|
-
"publishConfig": {
|
|
39
|
-
"registry": "https://registry.npmjs.org/",
|
|
40
|
-
"access": "public"
|
|
41
|
-
},
|
|
42
38
|
"devDependencies": {
|
|
43
39
|
"@istanbuljs/nyc-config-typescript": "1.0.2",
|
|
44
40
|
"@signageos/codestyle": "0.0.23",
|
|
@@ -92,5 +88,9 @@
|
|
|
92
88
|
"prompts": "2.1.0",
|
|
93
89
|
"semver": "7.1.3",
|
|
94
90
|
"serve-static": "1.14.1"
|
|
91
|
+
},
|
|
92
|
+
"publishConfig": {
|
|
93
|
+
"registry": "https://registry.npmjs.org/",
|
|
94
|
+
"access": "public"
|
|
95
95
|
}
|
|
96
96
|
}
|