@signageos/cli 2.3.1 → 2.3.2
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/README.md +1 -0
- package/dist/Applet/Build/appletBuildCommand.js +28 -72
- package/dist/Applet/Generate/Templates/rspack.config.mjs.template +12 -12
- package/dist/Applet/Generate/appletGenerateCommand.d.ts +23 -62
- package/dist/Applet/Generate/appletGenerateCommand.js +398 -365
- package/dist/Applet/Start/appletStartCommand.js +69 -131
- package/dist/Applet/Test/Upload/appletTestRunCommand.js +89 -177
- package/dist/Applet/Test/Upload/appletTestRunFacade.js +4 -27
- package/dist/Applet/Test/Upload/appletTestUploadCommand.js +98 -223
- package/dist/Applet/Test/Upload/appletTestUploadFacade.js +39 -102
- package/dist/Applet/Test/appletTestCommand.js +6 -36
- package/dist/Applet/Upload/appletUploadCommand.js +199 -305
- package/dist/Applet/Upload/appletUploadCommandHelper.js +103 -138
- package/dist/Applet/Upload/appletUploadFacade.d.ts +2 -2
- package/dist/Applet/Upload/appletUploadFacade.js +172 -263
- package/dist/Applet/Upload/appletUploadFacadeHelper.js +39 -52
- package/dist/Applet/appletCommand.d.ts +22 -62
- package/dist/Applet/appletCommand.js +9 -39
- package/dist/Applet/appletErrors.js +5 -24
- package/dist/Applet/appletFacade.js +106 -141
- package/dist/Applet/appletServerHelper.js +16 -53
- package/dist/Auth/loginCommand.js +96 -137
- package/dist/Cache/tmpCache.js +35 -13
- package/dist/Cli/helper.js +1 -2
- package/dist/Cli/packageVersion.js +82 -123
- package/dist/Command/commandDefinition.js +0 -1
- package/dist/Command/commandProcessor.js +40 -129
- package/dist/Command/globalArgs.js +7 -5
- package/dist/CommandLine/IProgressBar.js +0 -1
- package/dist/CommandLine/progressBarFactory.js +31 -11
- package/dist/CustomScript/Generate/customScriptGenerateCommand.js +17 -56
- package/dist/CustomScript/Generate/customScriptGenerateFacade.js +82 -106
- package/dist/CustomScript/Upload/customScriptUploadCommand.js +44 -120
- package/dist/CustomScript/customScriptCommand.js +6 -36
- package/dist/CustomScript/customScriptFacade.js +175 -294
- package/dist/Device/Connect/connectCommand.js +72 -136
- package/dist/Device/Content/setContentCommand.js +33 -78
- package/dist/Device/PowerAction/powerActionCommand.js +22 -65
- package/dist/Device/deviceCommand.js +7 -37
- package/dist/Device/deviceFacade.js +67 -123
- package/dist/Emulator/IEmulator.js +0 -1
- package/dist/Emulator/createDomain.js +33 -12
- package/dist/Emulator/emulatorFacade.js +74 -131
- package/dist/Emulator/emulatorFactory.js +112 -124
- package/dist/Firmware/Upload/firmwareUploadCommand.js +133 -221
- package/dist/Firmware/Upload/firmwareUploadFacade.js +64 -110
- package/dist/Firmware/Upload/firmwareUploadHelper.js +27 -5
- package/dist/Firmware/firmwareCommand.js +5 -35
- package/dist/Lib/archive.js +45 -60
- package/dist/Lib/childProcess.js +27 -5
- package/dist/Lib/fileSystem.js +62 -82
- package/dist/Lib/git.d.ts +1 -1
- package/dist/Lib/git.js +44 -82
- package/dist/Organization/Get/organizationGetCommand.js +14 -50
- package/dist/Organization/List/organizationListCommand.js +12 -46
- package/dist/Organization/SetDefault/organizationSetDefaultCommand.js +18 -56
- package/dist/Organization/organizationCommand.js +7 -37
- package/dist/Organization/organizationFacade.js +97 -172
- package/dist/RunControl/runControlHelper.js +11 -60
- package/dist/Timer/wait.js +1 -2
- package/dist/Timing/List/timingListCommand.js +20 -62
- package/dist/Timing/timingCommand.js +5 -35
- package/dist/generalCommand.js +1 -2
- package/dist/helper.js +48 -109
- package/dist/index.js +15 -45
- package/dist/parameters.js +17 -40
- package/package.json +16 -18
- package/dist/Applet/Build/appletBuildCommand.js.map +0 -1
- package/dist/Applet/Generate/appletGenerateCommand.js.map +0 -1
- package/dist/Applet/Start/appletStartCommand.js.map +0 -1
- package/dist/Applet/Test/Upload/appletTestRunCommand.js.map +0 -1
- package/dist/Applet/Test/Upload/appletTestRunFacade.js.map +0 -1
- package/dist/Applet/Test/Upload/appletTestUploadCommand.js.map +0 -1
- package/dist/Applet/Test/Upload/appletTestUploadFacade.js.map +0 -1
- package/dist/Applet/Test/appletTestCommand.js.map +0 -1
- package/dist/Applet/Upload/appletUploadCommand.js.map +0 -1
- package/dist/Applet/Upload/appletUploadCommandHelper.js.map +0 -1
- package/dist/Applet/Upload/appletUploadFacade.js.map +0 -1
- package/dist/Applet/Upload/appletUploadFacadeHelper.js.map +0 -1
- package/dist/Applet/appletCommand.js.map +0 -1
- package/dist/Applet/appletErrors.js.map +0 -1
- package/dist/Applet/appletFacade.js.map +0 -1
- package/dist/Applet/appletServerHelper.js.map +0 -1
- package/dist/Auth/loginCommand.js.map +0 -1
- package/dist/Cache/tmpCache.js.map +0 -1
- package/dist/Cli/helper.js.map +0 -1
- package/dist/Cli/packageVersion.js.map +0 -1
- package/dist/Command/commandDefinition.js.map +0 -1
- package/dist/Command/commandProcessor.js.map +0 -1
- package/dist/Command/globalArgs.js.map +0 -1
- package/dist/CommandLine/IProgressBar.js.map +0 -1
- package/dist/CommandLine/progressBarFactory.js.map +0 -1
- package/dist/CustomScript/Generate/customScriptGenerateCommand.js.map +0 -1
- package/dist/CustomScript/Generate/customScriptGenerateFacade.js.map +0 -1
- package/dist/CustomScript/Upload/customScriptUploadCommand.js.map +0 -1
- package/dist/CustomScript/customScriptCommand.js.map +0 -1
- package/dist/CustomScript/customScriptFacade.js.map +0 -1
- package/dist/Device/Connect/connectCommand.js.map +0 -1
- package/dist/Device/Content/setContentCommand.js.map +0 -1
- package/dist/Device/PowerAction/powerActionCommand.js.map +0 -1
- package/dist/Device/deviceCommand.js.map +0 -1
- package/dist/Device/deviceFacade.js.map +0 -1
- package/dist/Emulator/IEmulator.js.map +0 -1
- package/dist/Emulator/createDomain.js.map +0 -1
- package/dist/Emulator/emulatorFacade.js.map +0 -1
- package/dist/Emulator/emulatorFactory.js.map +0 -1
- package/dist/Firmware/Upload/firmwareUploadCommand.js.map +0 -1
- package/dist/Firmware/Upload/firmwareUploadFacade.js.map +0 -1
- package/dist/Firmware/Upload/firmwareUploadHelper.js.map +0 -1
- package/dist/Firmware/firmwareCommand.js.map +0 -1
- package/dist/Lib/archive.js.map +0 -1
- package/dist/Lib/childProcess.js.map +0 -1
- package/dist/Lib/fileSystem.js.map +0 -1
- package/dist/Lib/git.js.map +0 -1
- package/dist/Organization/Get/organizationGetCommand.js.map +0 -1
- package/dist/Organization/List/organizationListCommand.js.map +0 -1
- package/dist/Organization/SetDefault/organizationSetDefaultCommand.js.map +0 -1
- package/dist/Organization/organizationCommand.js.map +0 -1
- package/dist/Organization/organizationFacade.js.map +0 -1
- package/dist/RunControl/runControlHelper.js.map +0 -1
- package/dist/Timer/wait.js.map +0 -1
- package/dist/Timing/List/timingListCommand.js.map +0 -1
- package/dist/Timing/timingCommand.js.map +0 -1
- package/dist/generalCommand.js.map +0 -1
- package/dist/helper.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/parameters.js.map +0 -1
|
@@ -8,60 +8,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
13
|
};
|
|
38
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
15
|
exports.organizationList = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
const debug_1 = __importDefault(require("debug"));
|
|
18
|
+
const commandDefinition_1 = require("../../Command/commandDefinition");
|
|
19
|
+
const organizationFacade_1 = require("../organizationFacade");
|
|
20
|
+
const Debug = (0, debug_1.default)('@signageos/cli:Organization:list');
|
|
45
21
|
exports.organizationList = (0, commandDefinition_1.createCommandDefinition)({
|
|
46
22
|
name: 'list',
|
|
47
23
|
description: 'List organizations for logged account',
|
|
48
24
|
optionList: [],
|
|
49
25
|
commands: [],
|
|
50
|
-
run
|
|
51
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
case 0:
|
|
56
|
-
debug('Organization list');
|
|
57
|
-
return [4 /*yield*/, (0, organizationFacade_1.getOrganizations)()];
|
|
58
|
-
case 1:
|
|
59
|
-
organizations = _a.sent();
|
|
60
|
-
console.log(chalk_1.default.yellow(JSON.stringify(organizations, undefined, 2)));
|
|
61
|
-
return [2 /*return*/];
|
|
62
|
-
}
|
|
63
|
-
});
|
|
26
|
+
run() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
Debug('Organization list');
|
|
29
|
+
const organizations = yield (0, organizationFacade_1.getOrganizations)();
|
|
30
|
+
console.log(chalk_1.default.yellow(JSON.stringify(organizations, undefined, 2)));
|
|
64
31
|
});
|
|
65
32
|
},
|
|
66
33
|
});
|
|
67
|
-
//# sourceMappingURL=organizationListCommand.js.map
|
|
@@ -8,71 +8,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
13
|
};
|
|
38
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
15
|
exports.organizationSetDefault = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
const debug_1 = __importDefault(require("debug"));
|
|
18
|
+
const organizationFacade_1 = require("../organizationFacade");
|
|
19
|
+
const runControlHelper_1 = require("../../RunControl/runControlHelper");
|
|
20
|
+
const commandDefinition_1 = require("../../Command/commandDefinition");
|
|
21
|
+
const log_1 = require("@signageos/sdk/dist/Console/log");
|
|
22
|
+
const Debug = (0, debug_1.default)('@signageos/cli:Organization:get');
|
|
23
|
+
const OPTION_LIST = [organizationFacade_1.ORGANIZATION_UID_OPTION];
|
|
48
24
|
exports.organizationSetDefault = (0, commandDefinition_1.createCommandDefinition)({
|
|
49
25
|
name: 'set-default',
|
|
50
26
|
description: 'Set default organization to use',
|
|
51
27
|
optionList: OPTION_LIST,
|
|
52
28
|
commands: [],
|
|
53
|
-
run
|
|
54
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return [4 /*yield*/, (0, organizationFacade_1.selectOrganizationUid)(options)];
|
|
61
|
-
case 1:
|
|
62
|
-
defaultOrganizationUid = _a.sent();
|
|
63
|
-
return [4 /*yield*/, (0, organizationFacade_1.getOrganization)(defaultOrganizationUid)];
|
|
64
|
-
case 2:
|
|
65
|
-
organization = _a.sent();
|
|
66
|
-
return [4 /*yield*/, (0, runControlHelper_1.updateConfig)({
|
|
67
|
-
defaultOrganizationUid: defaultOrganizationUid,
|
|
68
|
-
})];
|
|
69
|
-
case 3:
|
|
70
|
-
_a.sent();
|
|
71
|
-
(0, log_1.log)('info', "Organization ".concat(chalk_1.default.green("".concat(organization.title, " (").concat(organization.name, ", ").concat(organization.uid, ")")), " has been set as default"));
|
|
72
|
-
return [2 /*return*/];
|
|
73
|
-
}
|
|
29
|
+
run(options) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
Debug('Organization set default');
|
|
32
|
+
const defaultOrganizationUid = yield (0, organizationFacade_1.selectOrganizationUid)(options);
|
|
33
|
+
const organization = yield (0, organizationFacade_1.getOrganization)(defaultOrganizationUid);
|
|
34
|
+
yield (0, runControlHelper_1.updateConfig)({
|
|
35
|
+
defaultOrganizationUid,
|
|
74
36
|
});
|
|
37
|
+
(0, log_1.log)('info', `Organization ${chalk_1.default.green(`${organization.title} (${organization.name}, ${organization.uid})`)} has been set as default`);
|
|
75
38
|
});
|
|
76
39
|
},
|
|
77
40
|
});
|
|
78
|
-
//# sourceMappingURL=organizationSetDefaultCommand.js.map
|
|
@@ -8,50 +8,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
12
|
exports.organization = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
13
|
+
const organizationListCommand_1 = require("./List/organizationListCommand");
|
|
14
|
+
const organizationGetCommand_1 = require("./Get/organizationGetCommand");
|
|
15
|
+
const organizationSetDefaultCommand_1 = require("./SetDefault/organizationSetDefaultCommand");
|
|
16
|
+
const commandDefinition_1 = require("../Command/commandDefinition");
|
|
44
17
|
exports.organization = (0, commandDefinition_1.createCommandDefinition)({
|
|
45
18
|
name: 'organization',
|
|
46
19
|
description: 'Organization management',
|
|
47
20
|
optionList: [],
|
|
48
21
|
commands: [organizationListCommand_1.organizationList, organizationGetCommand_1.organizationGet, organizationSetDefaultCommand_1.organizationSetDefault],
|
|
49
|
-
run
|
|
50
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
-
|
|
52
|
-
throw new Error('Unknown command');
|
|
53
|
-
});
|
|
22
|
+
run() {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
throw new Error('Unknown command');
|
|
54
25
|
});
|
|
55
26
|
},
|
|
56
27
|
});
|
|
57
|
-
//# sourceMappingURL=organizationCommand.js.map
|
|
@@ -8,42 +8,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
13
|
};
|
|
38
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
15
|
exports.getOrganization = exports.getOrganizations = exports.selectOrganizationUid = exports.getOrganizationUidOrDefaultOrSelect = exports.ORGANIZATION_OPTIONS = exports.NO_DEFAULT_ORGANIZATION_OPTION = exports.ORGANIZATION_UID_OPTION = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
const debug_1 = __importDefault(require("debug"));
|
|
18
|
+
const prompts_1 = __importDefault(require("prompts"));
|
|
19
|
+
const helper_1 = require("../helper");
|
|
20
|
+
const runControlHelper_1 = require("../RunControl/runControlHelper");
|
|
21
|
+
const apiVersions_1 = require("@signageos/sdk/dist/RestApi/apiVersions");
|
|
22
|
+
const Debug = (0, debug_1.default)('@signageos/cli:Organization:facade');
|
|
47
23
|
exports.ORGANIZATION_UID_OPTION = { name: 'organization-uid', type: String, description: 'Organization UID' };
|
|
48
24
|
exports.NO_DEFAULT_ORGANIZATION_OPTION = {
|
|
49
25
|
name: 'no-default-organization',
|
|
@@ -52,158 +28,107 @@ exports.NO_DEFAULT_ORGANIZATION_OPTION = {
|
|
|
52
28
|
};
|
|
53
29
|
exports.ORGANIZATION_OPTIONS = [exports.ORGANIZATION_UID_OPTION, exports.NO_DEFAULT_ORGANIZATION_OPTION];
|
|
54
30
|
function getOrganizationUidOrDefaultOrSelect(options) {
|
|
55
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
initial: false,
|
|
76
|
-
})];
|
|
77
|
-
case 3:
|
|
78
|
-
response = _a.sent();
|
|
79
|
-
if (!response.setDefault) return [3 /*break*/, 5];
|
|
80
|
-
return [4 /*yield*/, (0, runControlHelper_1.updateConfig)({
|
|
81
|
-
defaultOrganizationUid: organizationUid,
|
|
82
|
-
})];
|
|
83
|
-
case 4:
|
|
84
|
-
_a.sent();
|
|
85
|
-
_a.label = 5;
|
|
86
|
-
case 5: return [2 /*return*/, organizationUid];
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const config = yield (0, runControlHelper_1.loadConfig)();
|
|
33
|
+
let organizationUid = options['organization-uid'];
|
|
34
|
+
if (!organizationUid && !options['no-default-organization']) {
|
|
35
|
+
organizationUid = config.defaultOrganizationUid;
|
|
36
|
+
}
|
|
37
|
+
if (!organizationUid) {
|
|
38
|
+
organizationUid = yield selectOrganizationUid(options);
|
|
39
|
+
if (organizationUid) {
|
|
40
|
+
const response = yield (0, prompts_1.default)({
|
|
41
|
+
type: 'confirm',
|
|
42
|
+
name: 'setDefault',
|
|
43
|
+
message: `Do you want to set the organization as a default for current profile?`,
|
|
44
|
+
initial: false,
|
|
45
|
+
});
|
|
46
|
+
if (response.setDefault) {
|
|
47
|
+
yield (0, runControlHelper_1.updateConfig)({
|
|
48
|
+
defaultOrganizationUid: organizationUid,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
87
51
|
}
|
|
88
|
-
}
|
|
52
|
+
}
|
|
53
|
+
return organizationUid;
|
|
89
54
|
});
|
|
90
55
|
}
|
|
91
56
|
exports.getOrganizationUidOrDefaultOrSelect = getOrganizationUidOrDefaultOrSelect;
|
|
92
57
|
function selectOrganizationUid(options) {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
response = _a.sent();
|
|
114
|
-
debug('Organization selected', response.organizationUid);
|
|
115
|
-
organizationUid = response.organizationUid;
|
|
116
|
-
_a.label = 3;
|
|
117
|
-
case 3:
|
|
118
|
-
if (!organizationUid) {
|
|
119
|
-
throw new Error('Missing argument --organization-uid <string>');
|
|
120
|
-
}
|
|
121
|
-
return [2 /*return*/, organizationUid];
|
|
122
|
-
}
|
|
123
|
-
});
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
let organizationUid = options['organization-uid'];
|
|
60
|
+
if (!organizationUid) {
|
|
61
|
+
const organizations = yield getOrganizations();
|
|
62
|
+
const response = yield (0, prompts_1.default)({
|
|
63
|
+
type: 'autocomplete',
|
|
64
|
+
name: 'organizationUid',
|
|
65
|
+
message: `Select organization to use`,
|
|
66
|
+
choices: organizations.map((org) => ({
|
|
67
|
+
title: `${org.title} (${org.name}, ${org.uid})`,
|
|
68
|
+
value: org.uid,
|
|
69
|
+
})),
|
|
70
|
+
});
|
|
71
|
+
Debug('Organization selected', response.organizationUid);
|
|
72
|
+
organizationUid = response.organizationUid;
|
|
73
|
+
}
|
|
74
|
+
if (!organizationUid) {
|
|
75
|
+
throw new Error('Missing argument --organization-uid <string>');
|
|
76
|
+
}
|
|
77
|
+
return organizationUid;
|
|
124
78
|
});
|
|
125
79
|
}
|
|
126
80
|
exports.selectOrganizationUid = selectOrganizationUid;
|
|
127
81
|
function getOrganizations() {
|
|
128
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
bodyOfGet = _b.apply(_a, [_c.sent(), helper_1.deserializeJSON]);
|
|
152
|
-
debug('GET organizations response', bodyOfGet);
|
|
153
|
-
if (responseOfGet.status === 200) {
|
|
154
|
-
return [2 /*return*/, bodyOfGet];
|
|
155
|
-
}
|
|
156
|
-
else if (responseOfGet.status === 403) {
|
|
157
|
-
throw new Error("Authentication error. Try to login using ".concat(chalk_1.default.green('sos login')));
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
throw new Error('Unknown error: ' + (bodyOfGet && bodyOfGet.message ? bodyOfGet.message : responseOfGet.status));
|
|
161
|
-
}
|
|
162
|
-
return [2 /*return*/];
|
|
163
|
-
}
|
|
164
|
-
});
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
const ORGANIZATION_RESOURCE = 'organization';
|
|
84
|
+
const config = yield (0, runControlHelper_1.loadConfig)();
|
|
85
|
+
const options = {
|
|
86
|
+
url: (0, helper_1.getApiUrl)(config),
|
|
87
|
+
auth: {
|
|
88
|
+
clientId: config.identification,
|
|
89
|
+
secret: config.apiSecurityToken,
|
|
90
|
+
},
|
|
91
|
+
version: apiVersions_1.ApiVersions.V1,
|
|
92
|
+
};
|
|
93
|
+
const responseOfGet = yield (0, helper_1.getResource)(options, ORGANIZATION_RESOURCE);
|
|
94
|
+
const bodyOfGet = JSON.parse(yield responseOfGet.text(), helper_1.deserializeJSON);
|
|
95
|
+
Debug('GET organizations response', bodyOfGet);
|
|
96
|
+
if (responseOfGet.status === 200) {
|
|
97
|
+
return bodyOfGet;
|
|
98
|
+
}
|
|
99
|
+
else if (responseOfGet.status === 403) {
|
|
100
|
+
throw new Error(`Authentication error. Try to login using ${chalk_1.default.green('sos login')}`);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
throw new Error('Unknown error: ' + (bodyOfGet && bodyOfGet.message ? bodyOfGet.message : responseOfGet.status));
|
|
104
|
+
}
|
|
165
105
|
});
|
|
166
106
|
}
|
|
167
107
|
exports.getOrganizations = getOrganizations;
|
|
168
108
|
function getOrganization(organizationUid) {
|
|
169
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
bodyOfGet = _b.apply(_a, [_c.sent(), helper_1.deserializeJSON]);
|
|
193
|
-
debug('GET organization response', bodyOfGet);
|
|
194
|
-
if (responseOfGet.status === 200) {
|
|
195
|
-
return [2 /*return*/, bodyOfGet];
|
|
196
|
-
}
|
|
197
|
-
else if (responseOfGet.status === 403) {
|
|
198
|
-
throw new Error("Authentication error. Try to login using ".concat(chalk_1.default.green('sos login')));
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
throw new Error('Unknown error: ' + (bodyOfGet && bodyOfGet.message ? bodyOfGet.message : responseOfGet.status));
|
|
202
|
-
}
|
|
203
|
-
return [2 /*return*/];
|
|
204
|
-
}
|
|
205
|
-
});
|
|
109
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
const ORGANIZATION_RESOURCE = 'organization';
|
|
111
|
+
const config = yield (0, runControlHelper_1.loadConfig)();
|
|
112
|
+
const options = {
|
|
113
|
+
url: (0, helper_1.getApiUrl)(config),
|
|
114
|
+
auth: {
|
|
115
|
+
clientId: config.identification,
|
|
116
|
+
secret: config.apiSecurityToken,
|
|
117
|
+
},
|
|
118
|
+
version: apiVersions_1.ApiVersions.V1,
|
|
119
|
+
};
|
|
120
|
+
const responseOfGet = yield (0, helper_1.getResource)(options, ORGANIZATION_RESOURCE + '/' + organizationUid);
|
|
121
|
+
const bodyOfGet = JSON.parse(yield responseOfGet.text(), helper_1.deserializeJSON);
|
|
122
|
+
Debug('GET organization response', bodyOfGet);
|
|
123
|
+
if (responseOfGet.status === 200) {
|
|
124
|
+
return bodyOfGet;
|
|
125
|
+
}
|
|
126
|
+
else if (responseOfGet.status === 403) {
|
|
127
|
+
throw new Error(`Authentication error. Try to login using ${chalk_1.default.green('sos login')}`);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
throw new Error('Unknown error: ' + (bodyOfGet && bodyOfGet.message ? bodyOfGet.message : responseOfGet.status));
|
|
131
|
+
}
|
|
206
132
|
});
|
|
207
133
|
}
|
|
208
134
|
exports.getOrganization = getOrganization;
|
|
209
|
-
//# sourceMappingURL=organizationFacade.js.map
|
|
@@ -8,80 +8,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
12
|
exports.updateConfig = exports.saveConfig = exports.loadConfig = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
13
|
+
const sosControlHelper_1 = require("@signageos/sdk/dist/SosHelper/sosControlHelper");
|
|
14
|
+
const globalArgs_1 = require("../Command/globalArgs");
|
|
42
15
|
/** The same as loadConfig in SDK, but respect CLI --profile argument */
|
|
43
16
|
function loadConfig() {
|
|
44
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
switch (_a.label) {
|
|
48
|
-
case 0:
|
|
49
|
-
profile = (0, globalArgs_1.getGlobalProfile)();
|
|
50
|
-
return [4 /*yield*/, (0, sosControlHelper_1.loadConfig)({ profile: profile })];
|
|
51
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
52
|
-
}
|
|
53
|
-
});
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const profile = (0, globalArgs_1.getGlobalProfile)();
|
|
19
|
+
return yield (0, sosControlHelper_1.loadConfig)({ profile });
|
|
54
20
|
});
|
|
55
21
|
}
|
|
56
22
|
exports.loadConfig = loadConfig;
|
|
57
23
|
/** The same as saveConfig in SDK, but respect CLI --profile argument */
|
|
58
24
|
function saveConfig(newConfig) {
|
|
59
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
60
|
-
|
|
61
|
-
return
|
|
62
|
-
switch (_a.label) {
|
|
63
|
-
case 0:
|
|
64
|
-
profile = (0, globalArgs_1.getGlobalProfile)();
|
|
65
|
-
return [4 /*yield*/, (0, sosControlHelper_1.saveConfig)(newConfig, { profile: profile })];
|
|
66
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const profile = (0, globalArgs_1.getGlobalProfile)();
|
|
27
|
+
return yield (0, sosControlHelper_1.saveConfig)(newConfig, { profile });
|
|
69
28
|
});
|
|
70
29
|
}
|
|
71
30
|
exports.saveConfig = saveConfig;
|
|
72
31
|
/** The same as updateConfig in SDK, but respect CLI --profile argument */
|
|
73
32
|
function updateConfig(partialConfig) {
|
|
74
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
75
|
-
|
|
76
|
-
return
|
|
77
|
-
switch (_a.label) {
|
|
78
|
-
case 0:
|
|
79
|
-
profile = (0, globalArgs_1.getGlobalProfile)();
|
|
80
|
-
return [4 /*yield*/, (0, sosControlHelper_1.updateConfig)(partialConfig, { profile: profile })];
|
|
81
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
82
|
-
}
|
|
83
|
-
});
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const profile = (0, globalArgs_1.getGlobalProfile)();
|
|
35
|
+
return yield (0, sosControlHelper_1.updateConfig)(partialConfig, { profile });
|
|
84
36
|
});
|
|
85
37
|
}
|
|
86
38
|
exports.updateConfig = updateConfig;
|
|
87
|
-
//# sourceMappingURL=runControlHelper.js.map
|
package/dist/Timer/wait.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
function wait(timeout) {
|
|
4
|
-
return new Promise(
|
|
4
|
+
return new Promise((resolve) => setTimeout(() => resolve(), timeout));
|
|
5
5
|
}
|
|
6
6
|
exports.default = wait;
|
|
7
|
-
//# sourceMappingURL=wait.js.map
|