@signageos/cli 2.3.1 → 2.4.0
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 +54 -19
- package/dist/Applet/Build/appletBuildCommand.js +28 -72
- package/dist/Applet/Generate/Templates/CHANGELOG.md.template +7 -0
- package/dist/Applet/Generate/Templates/README.md.template +3 -0
- 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 +432 -365
- package/dist/Applet/Start/appletStartCommand.js +70 -132
- package/dist/Applet/Test/Upload/appletTestRunCommand.js +90 -178
- package/dist/Applet/Test/Upload/appletTestRunFacade.js +5 -29
- package/dist/Applet/Test/Upload/appletTestUploadCommand.js +99 -224
- package/dist/Applet/Test/Upload/appletTestUploadFacade.js +51 -105
- package/dist/Applet/Test/appletTestCommand.js +6 -36
- package/dist/Applet/Upload/appletUploadCommand.js +199 -305
- package/dist/Applet/Upload/appletUploadCommandHelper.js +129 -144
- package/dist/Applet/Upload/appletUploadFacade.d.ts +2 -2
- package/dist/Applet/Upload/appletUploadFacade.js +184 -265
- package/dist/Applet/Upload/appletUploadFacadeHelper.js +51 -55
- package/dist/Applet/appletCommand.d.ts +25 -157
- package/dist/Applet/appletCommand.js +9 -39
- package/dist/Applet/appletErrors.js +5 -24
- package/dist/Applet/appletFacade.js +122 -147
- package/dist/Applet/appletServerHelper.js +18 -55
- package/dist/Auth/loginCommand.d.ts +2 -2
- package/dist/Auth/loginCommand.js +105 -136
- package/dist/Cache/tmpCache.js +47 -16
- package/dist/Cli/helper.js +3 -5
- package/dist/Cli/packageVersion.js +99 -131
- package/dist/Command/Autocomplete/Install/installAutocompleteCommand.d.ts +10 -0
- package/dist/Command/Autocomplete/Install/installAutocompleteCommand.js +39 -0
- package/dist/Command/Autocomplete/Install/installAutocompleteCommand.ts +30 -0
- package/dist/Command/Autocomplete/Install/sos-completion.sh +63 -0
- package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.d.ts +8 -0
- package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.js +120 -0
- package/dist/Command/Autocomplete/autocompleteCommand.d.ts +22 -0
- package/dist/Command/Autocomplete/autocompleteCommand.js +32 -0
- package/dist/Command/autoComplete.d.ts +4 -0
- package/dist/Command/autoComplete.js +184 -0
- package/dist/Command/commandDefinition.d.ts +9 -9
- package/dist/Command/commandDefinition.js +1 -3
- package/dist/Command/commandProcessor.js +41 -131
- package/dist/Command/globalArgs.js +9 -8
- package/dist/CommandLine/IProgressBar.js +0 -1
- package/dist/CommandLine/progressBarFactory.d.ts +1 -1
- package/dist/CommandLine/progressBarFactory.js +42 -13
- package/dist/CustomScript/Generate/customScriptGenerateCommand.js +17 -56
- package/dist/CustomScript/Generate/customScriptGenerateFacade.js +94 -109
- package/dist/CustomScript/Upload/customScriptUploadCommand.js +44 -120
- package/dist/CustomScript/customScriptCommand.d.ts +1 -9
- package/dist/CustomScript/customScriptCommand.js +6 -36
- package/dist/CustomScript/customScriptFacade.d.ts +2 -2
- package/dist/CustomScript/customScriptFacade.js +187 -297
- package/dist/Device/Connect/connectCommand.js +73 -137
- 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 +71 -127
- package/dist/Emulator/IEmulator.js +0 -1
- package/dist/Emulator/createDomain.d.ts +0 -1
- package/dist/Emulator/createDomain.js +44 -14
- package/dist/Emulator/emulatorFacade.js +75 -133
- package/dist/Emulator/emulatorFactory.js +123 -126
- package/dist/Firmware/Upload/firmwareUploadCommand.js +133 -221
- package/dist/Firmware/Upload/firmwareUploadFacade.js +75 -112
- package/dist/Firmware/Upload/firmwareUploadHelper.js +38 -6
- package/dist/Firmware/firmwareCommand.js +5 -35
- package/dist/Lib/archive.js +56 -62
- package/dist/Lib/childProcess.js +37 -5
- package/dist/Lib/fileSystem.js +76 -87
- package/dist/Lib/git.d.ts +1 -1
- package/dist/Lib/git.js +58 -87
- 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 +102 -177
- package/dist/RunControl/runControlHelper.js +14 -64
- package/dist/Timer/wait.js +2 -3
- package/dist/Timing/List/timingListCommand.js +20 -62
- package/dist/Timing/timingCommand.js +5 -35
- package/dist/generalCommand.js +1 -2
- package/dist/helper.d.ts +4 -4
- package/dist/helper.js +61 -122
- package/dist/index.js +19 -46
- package/dist/parameters.js +17 -40
- package/package.json +52 -57
- 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
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,127 +41,79 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
41
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
42
|
});
|
|
10
43
|
};
|
|
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
|
-
}
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
46
|
};
|
|
38
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
exports.askForParameters = askForParameters;
|
|
49
|
+
exports.downloadBoilerplateCode = downloadBoilerplateCode;
|
|
50
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
51
|
+
const prompts_1 = __importDefault(require("prompts"));
|
|
52
|
+
const path = __importStar(require("path"));
|
|
53
|
+
const fs = __importStar(require("fs-extra"));
|
|
54
|
+
const log_1 = require("@signageos/sdk/dist/Console/log");
|
|
55
|
+
const git_1 = require("../../Lib/git");
|
|
46
56
|
/**
|
|
47
57
|
* Prompts the user for the parameters needed to generate a custom script.
|
|
48
58
|
*/
|
|
49
59
|
function askForParameters() {
|
|
50
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
" - Description: ".concat(chalk_1.default.green(description), "\n") +
|
|
88
|
-
" - Danger Level: ".concat(chalk_1.default.green(dangerLevel), "\n"));
|
|
89
|
-
return [4 /*yield*/, prompts({
|
|
90
|
-
type: 'confirm',
|
|
91
|
-
name: 'confirm',
|
|
92
|
-
message: 'Confirm',
|
|
93
|
-
})];
|
|
94
|
-
case 2:
|
|
95
|
-
confirm = (_b.sent()).confirm;
|
|
96
|
-
if (!confirm) {
|
|
97
|
-
throwCanceledError();
|
|
98
|
-
}
|
|
99
|
-
return [2 /*return*/, {
|
|
100
|
-
targetDir: targetDir,
|
|
101
|
-
name: name,
|
|
102
|
-
description: description,
|
|
103
|
-
dangerLevel: dangerLevel,
|
|
104
|
-
}];
|
|
105
|
-
}
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const throwCanceledError = () => {
|
|
62
|
+
throw new Error('Custom Script generation was canceled.');
|
|
63
|
+
};
|
|
64
|
+
const { name, description, dangerLevel } = yield (0, prompts_1.default)([
|
|
65
|
+
{
|
|
66
|
+
type: 'text',
|
|
67
|
+
name: 'name',
|
|
68
|
+
message: 'Type name',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: 'text',
|
|
72
|
+
name: 'description',
|
|
73
|
+
message: 'Type description',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: 'select',
|
|
77
|
+
name: 'dangerLevel',
|
|
78
|
+
message: 'Select danger level',
|
|
79
|
+
choices: [
|
|
80
|
+
{ title: 'Low', value: 'low' },
|
|
81
|
+
{ title: 'Medium', value: 'medium' },
|
|
82
|
+
{ title: 'High', value: 'high' },
|
|
83
|
+
{ title: 'Critical', value: 'critical' },
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
], { onCancel: throwCanceledError });
|
|
87
|
+
const targetDir = name;
|
|
88
|
+
(0, log_1.log)('info', `Generating Custom Script with these parameters:\n` +
|
|
89
|
+
` - Directory: ${chalk_1.default.green(targetDir)}\n` +
|
|
90
|
+
` - Name: ${chalk_1.default.green(name)}\n` +
|
|
91
|
+
` - Description: ${chalk_1.default.green(description)}\n` +
|
|
92
|
+
` - Danger Level: ${chalk_1.default.green(dangerLevel)}\n`);
|
|
93
|
+
const { confirm } = yield (0, prompts_1.default)({
|
|
94
|
+
type: 'confirm',
|
|
95
|
+
name: 'confirm',
|
|
96
|
+
message: 'Confirm',
|
|
106
97
|
});
|
|
98
|
+
if (!confirm) {
|
|
99
|
+
throwCanceledError();
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
targetDir,
|
|
103
|
+
name,
|
|
104
|
+
description,
|
|
105
|
+
dangerLevel,
|
|
106
|
+
};
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
-
exports.askForParameters = askForParameters;
|
|
110
109
|
/**
|
|
111
110
|
* Downloads the latest version of the boilerplate code from the GitHub repository.
|
|
112
111
|
*/
|
|
113
112
|
function downloadBoilerplateCode(targetDir) {
|
|
114
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
URL = 'https://github.com/signageos/custom-scripts-boilerplate.git';
|
|
120
|
-
return [4 /*yield*/, (0, git_1.cloneGitRepository)(URL, targetDir)];
|
|
121
|
-
case 1:
|
|
122
|
-
_a.sent();
|
|
123
|
-
// we just want the code, not the git history
|
|
124
|
-
return [4 /*yield*/, fs.remove(path.join(targetDir, '.git'))];
|
|
125
|
-
case 2:
|
|
126
|
-
// we just want the code, not the git history
|
|
127
|
-
_a.sent();
|
|
128
|
-
return [2 /*return*/];
|
|
129
|
-
}
|
|
130
|
-
});
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
const URL = 'https://github.com/signageos/custom-scripts-boilerplate.git';
|
|
115
|
+
yield (0, git_1.cloneGitRepository)(URL, targetDir);
|
|
116
|
+
// we just want the code, not the git history
|
|
117
|
+
yield fs.remove(path.join(targetDir, '.git'));
|
|
131
118
|
});
|
|
132
119
|
}
|
|
133
|
-
exports.downloadBoilerplateCode = downloadBoilerplateCode;
|
|
134
|
-
//# sourceMappingURL=customScriptGenerateFacade.js.map
|
|
@@ -8,136 +8,60 @@ 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
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __values = (this && this.__values) || function(o) {
|
|
39
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
-
if (m) return m.call(o);
|
|
41
|
-
if (o && typeof o.length === "number") return {
|
|
42
|
-
next: function () {
|
|
43
|
-
if (o && i >= o.length) o = void 0;
|
|
44
|
-
return { value: o && o[i++], done: !o };
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
13
|
};
|
|
49
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
15
|
exports.customScriptUpload = exports.OPTION_LIST = void 0;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
const util_1 = require("util");
|
|
18
|
+
const debug_1 = __importDefault(require("debug"));
|
|
19
|
+
const log_1 = require("@signageos/sdk/dist/Console/log");
|
|
20
|
+
const commandDefinition_1 = require("../../Command/commandDefinition");
|
|
21
|
+
const helper_1 = require("../../helper");
|
|
22
|
+
const organizationFacade_1 = require("../../Organization/organizationFacade");
|
|
23
|
+
const customScriptFacade_1 = require("../customScriptFacade");
|
|
24
|
+
const Debug = (0, debug_1.default)('@signageos/cli:CustomScript:Upload:Command');
|
|
60
25
|
exports.OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, organizationFacade_1.ORGANIZATION_UID_OPTION];
|
|
61
26
|
exports.customScriptUpload = (0, commandDefinition_1.createCommandDefinition)({
|
|
62
27
|
name: 'upload',
|
|
63
28
|
description: 'Uploads current custom script version',
|
|
64
29
|
optionList: exports.OPTION_LIST,
|
|
65
30
|
commands: [],
|
|
66
|
-
run
|
|
67
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
organization = _d.sent();
|
|
80
|
-
return [4 /*yield*/, (0, helper_1.createOrganizationRestApi)(organization)];
|
|
81
|
-
case 3:
|
|
82
|
-
restApi = _d.sent();
|
|
83
|
-
return [4 /*yield*/, (0, customScriptFacade_1.getConfig)(currentDirectory)];
|
|
84
|
-
case 4:
|
|
85
|
-
config = _d.sent();
|
|
86
|
-
return [4 /*yield*/, (0, customScriptFacade_1.ensureCustomScriptVersion)(restApi, config)];
|
|
87
|
-
case 5:
|
|
88
|
-
customScriptVersion = _d.sent();
|
|
89
|
-
_d.label = 6;
|
|
90
|
-
case 6:
|
|
91
|
-
_d.trys.push([6, 11, 12, 13]);
|
|
92
|
-
_a = __values(Object.keys(config.platforms)), _b = _a.next();
|
|
93
|
-
_d.label = 7;
|
|
94
|
-
case 7:
|
|
95
|
-
if (!!_b.done) return [3 /*break*/, 10];
|
|
96
|
-
platform = _b.value;
|
|
97
|
-
return [4 /*yield*/, (0, customScriptFacade_1.uploadCode)({
|
|
98
|
-
restApi: restApi,
|
|
99
|
-
workDir: currentDirectory,
|
|
100
|
-
platform: platform,
|
|
101
|
-
config: config.platforms[platform],
|
|
102
|
-
customScriptVersion: customScriptVersion,
|
|
103
|
-
})];
|
|
104
|
-
case 8:
|
|
105
|
-
_d.sent();
|
|
106
|
-
_d.label = 9;
|
|
107
|
-
case 9:
|
|
108
|
-
_b = _a.next();
|
|
109
|
-
return [3 /*break*/, 7];
|
|
110
|
-
case 10: return [3 /*break*/, 13];
|
|
111
|
-
case 11:
|
|
112
|
-
e_1_1 = _d.sent();
|
|
113
|
-
e_1 = { error: e_1_1 };
|
|
114
|
-
return [3 /*break*/, 13];
|
|
115
|
-
case 12:
|
|
116
|
-
try {
|
|
117
|
-
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
118
|
-
}
|
|
119
|
-
finally { if (e_1) throw e_1.error; }
|
|
120
|
-
return [7 /*endfinally*/];
|
|
121
|
-
case 13:
|
|
122
|
-
if (!!(0, util_1.isDeepStrictEqual)(customScriptVersion.configDefinition, config.configDefinition)) return [3 /*break*/, 15];
|
|
123
|
-
debug('Config definition is different, updating custom script version.');
|
|
124
|
-
return [4 /*yield*/, restApi.customScript.version.update({
|
|
125
|
-
customScriptUid: customScriptVersion.customScriptUid,
|
|
126
|
-
version: customScriptVersion.version,
|
|
127
|
-
configDefinition: config.configDefinition,
|
|
128
|
-
})];
|
|
129
|
-
case 14:
|
|
130
|
-
_d.sent();
|
|
131
|
-
return [3 /*break*/, 16];
|
|
132
|
-
case 15:
|
|
133
|
-
debug('Config definition is the same, skipping update.');
|
|
134
|
-
_d.label = 16;
|
|
135
|
-
case 16:
|
|
136
|
-
(0, log_1.log)('info', "Custom Script ".concat(chalk_1.default.green(config.name), " version ").concat(chalk_1.default.green(config.version), " has been uploaded."));
|
|
137
|
-
return [2 /*return*/];
|
|
31
|
+
run(options) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const currentDirectory = process.cwd();
|
|
34
|
+
const organizationUid = yield (0, organizationFacade_1.getOrganizationUidOrDefaultOrSelect)(options);
|
|
35
|
+
const organization = yield (0, organizationFacade_1.getOrganization)(organizationUid);
|
|
36
|
+
const restApi = yield (0, helper_1.createOrganizationRestApi)(organization);
|
|
37
|
+
const config = yield (0, customScriptFacade_1.getConfig)(currentDirectory);
|
|
38
|
+
const customScriptVersion = yield (0, customScriptFacade_1.ensureCustomScriptVersion)(restApi, config);
|
|
39
|
+
for (const platform of Object.keys(config.platforms)) {
|
|
40
|
+
const platformConfig = config.platforms[platform];
|
|
41
|
+
if (!platformConfig) {
|
|
42
|
+
console.warn(`Skipping platform ${platform} due to missing configuration`);
|
|
43
|
+
continue;
|
|
138
44
|
}
|
|
139
|
-
|
|
45
|
+
yield (0, customScriptFacade_1.uploadCode)({
|
|
46
|
+
restApi,
|
|
47
|
+
workDir: currentDirectory,
|
|
48
|
+
platform,
|
|
49
|
+
config: platformConfig,
|
|
50
|
+
customScriptVersion,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (!(0, util_1.isDeepStrictEqual)(customScriptVersion.configDefinition, config.configDefinition)) {
|
|
54
|
+
Debug('Config definition is different, updating custom script version.');
|
|
55
|
+
yield restApi.customScript.version.update({
|
|
56
|
+
customScriptUid: customScriptVersion.customScriptUid,
|
|
57
|
+
version: customScriptVersion.version,
|
|
58
|
+
configDefinition: config.configDefinition,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
Debug('Config definition is the same, skipping update.');
|
|
63
|
+
}
|
|
64
|
+
(0, log_1.log)('info', `Custom Script ${chalk_1.default.green(config.name)} version ${chalk_1.default.green(config.version)} has been uploaded.`);
|
|
140
65
|
});
|
|
141
66
|
},
|
|
142
67
|
});
|
|
143
|
-
//# sourceMappingURL=customScriptUploadCommand.js.map
|
|
@@ -15,15 +15,7 @@ export declare const customScript: {
|
|
|
15
15
|
readonly description: "Organization UID";
|
|
16
16
|
}];
|
|
17
17
|
commands: never[];
|
|
18
|
-
run(options: import("../Command/commandDefinition").CommandLineOptions<
|
|
19
|
-
readonly name: "no-default-organization";
|
|
20
|
-
readonly type: BooleanConstructor;
|
|
21
|
-
readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc which were set using command sos organization set-default";
|
|
22
|
-
}, {
|
|
23
|
-
readonly name: "organization-uid";
|
|
24
|
-
readonly type: StringConstructor;
|
|
25
|
-
readonly description: "Organization UID";
|
|
26
|
-
}]>): Promise<void>;
|
|
18
|
+
run(options: import("../Command/commandDefinition").CommandLineOptions<typeof import("./Upload/customScriptUploadCommand").OPTION_LIST>): Promise<void>;
|
|
27
19
|
} | {
|
|
28
20
|
name: "generate";
|
|
29
21
|
description: string;
|
|
@@ -8,49 +8,19 @@ 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.customScript = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
13
|
+
const commandDefinition_1 = require("../Command/commandDefinition");
|
|
14
|
+
const customScriptUploadCommand_1 = require("./Upload/customScriptUploadCommand");
|
|
15
|
+
const customScriptGenerateCommand_1 = require("./Generate/customScriptGenerateCommand");
|
|
43
16
|
exports.customScript = (0, commandDefinition_1.createCommandDefinition)({
|
|
44
17
|
name: 'custom-script',
|
|
45
18
|
description: 'Custom Script management',
|
|
46
19
|
optionList: [],
|
|
47
20
|
commands: [customScriptUploadCommand_1.customScriptUpload, customScriptGenerateCommand_1.customScriptGenerate],
|
|
48
|
-
run
|
|
49
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
-
|
|
51
|
-
throw new Error('Unknown command');
|
|
52
|
-
});
|
|
21
|
+
run() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
throw new Error('Unknown command');
|
|
53
24
|
});
|
|
54
25
|
},
|
|
55
26
|
});
|
|
56
|
-
//# sourceMappingURL=customScriptCommand.js.map
|
|
@@ -17,7 +17,7 @@ declare const PlatformSchema: z.ZodObject<{
|
|
|
17
17
|
mainFile: string;
|
|
18
18
|
runtime: string;
|
|
19
19
|
}>;
|
|
20
|
-
export
|
|
20
|
+
export type PlatformConfig = z.infer<typeof PlatformSchema>;
|
|
21
21
|
declare const ConfigSchema: z.ZodObject<{
|
|
22
22
|
uid: z.ZodOptional<z.ZodString>;
|
|
23
23
|
name: z.ZodString;
|
|
@@ -72,7 +72,7 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
72
72
|
description?: string | undefined;
|
|
73
73
|
uid?: string | undefined;
|
|
74
74
|
}>;
|
|
75
|
-
export
|
|
75
|
+
export type CustomScriptConfig = z.infer<typeof ConfigSchema>;
|
|
76
76
|
/**
|
|
77
77
|
* Represents archive with Custom Script code for a particular platform
|
|
78
78
|
*/
|