@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
|
@@ -8,42 +8,22 @@ 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
|
-
exports.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
15
|
+
exports.ORGANIZATION_OPTIONS = exports.NO_DEFAULT_ORGANIZATION_OPTION = exports.ORGANIZATION_UID_OPTION = void 0;
|
|
16
|
+
exports.getOrganizationUidOrDefaultOrSelect = getOrganizationUidOrDefaultOrSelect;
|
|
17
|
+
exports.selectOrganizationUid = selectOrganizationUid;
|
|
18
|
+
exports.getOrganizations = getOrganizations;
|
|
19
|
+
exports.getOrganization = getOrganization;
|
|
20
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
21
|
+
const debug_1 = __importDefault(require("debug"));
|
|
22
|
+
const prompts_1 = __importDefault(require("prompts"));
|
|
23
|
+
const helper_1 = require("../helper");
|
|
24
|
+
const runControlHelper_1 = require("../RunControl/runControlHelper");
|
|
25
|
+
const apiVersions_1 = require("@signageos/sdk/dist/RestApi/apiVersions");
|
|
26
|
+
const Debug = (0, debug_1.default)('@signageos/cli:Organization:facade');
|
|
47
27
|
exports.ORGANIZATION_UID_OPTION = { name: 'organization-uid', type: String, description: 'Organization UID' };
|
|
48
28
|
exports.NO_DEFAULT_ORGANIZATION_OPTION = {
|
|
49
29
|
name: 'no-default-organization',
|
|
@@ -52,158 +32,103 @@ exports.NO_DEFAULT_ORGANIZATION_OPTION = {
|
|
|
52
32
|
};
|
|
53
33
|
exports.ORGANIZATION_OPTIONS = [exports.ORGANIZATION_UID_OPTION, exports.NO_DEFAULT_ORGANIZATION_OPTION];
|
|
54
34
|
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];
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const config = yield (0, runControlHelper_1.loadConfig)();
|
|
37
|
+
let organizationUid = options['organization-uid'];
|
|
38
|
+
if (!organizationUid && !options['no-default-organization']) {
|
|
39
|
+
organizationUid = config.defaultOrganizationUid;
|
|
40
|
+
}
|
|
41
|
+
if (!organizationUid) {
|
|
42
|
+
organizationUid = yield selectOrganizationUid(options);
|
|
43
|
+
if (organizationUid && !options['no-default-organization']) {
|
|
44
|
+
const response = yield (0, prompts_1.default)({
|
|
45
|
+
type: 'confirm',
|
|
46
|
+
name: 'setDefault',
|
|
47
|
+
message: `Do you want to set the organization as a default for current profile?`,
|
|
48
|
+
initial: false,
|
|
49
|
+
});
|
|
50
|
+
if (response.setDefault) {
|
|
51
|
+
yield (0, runControlHelper_1.updateConfig)({
|
|
52
|
+
defaultOrganizationUid: organizationUid,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
87
55
|
}
|
|
88
|
-
}
|
|
56
|
+
}
|
|
57
|
+
return organizationUid;
|
|
89
58
|
});
|
|
90
59
|
}
|
|
91
|
-
exports.getOrganizationUidOrDefaultOrSelect = getOrganizationUidOrDefaultOrSelect;
|
|
92
60
|
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
|
-
});
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
let organizationUid = options['organization-uid'];
|
|
63
|
+
if (!organizationUid) {
|
|
64
|
+
const organizations = yield getOrganizations();
|
|
65
|
+
const response = yield (0, prompts_1.default)({
|
|
66
|
+
type: 'autocomplete',
|
|
67
|
+
name: 'organizationUid',
|
|
68
|
+
message: `Select organization to use`,
|
|
69
|
+
choices: organizations.map((org) => ({
|
|
70
|
+
title: `${org.title} (${org.name}, ${org.uid})`,
|
|
71
|
+
value: org.uid,
|
|
72
|
+
})),
|
|
73
|
+
});
|
|
74
|
+
Debug('Organization selected', response.organizationUid);
|
|
75
|
+
organizationUid = response.organizationUid;
|
|
76
|
+
}
|
|
77
|
+
if (!organizationUid) {
|
|
78
|
+
throw new Error('Missing argument --organization-uid <string>');
|
|
79
|
+
}
|
|
80
|
+
return organizationUid;
|
|
124
81
|
});
|
|
125
82
|
}
|
|
126
|
-
exports.selectOrganizationUid = selectOrganizationUid;
|
|
127
83
|
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
|
-
});
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
const ORGANIZATION_RESOURCE = 'organization';
|
|
86
|
+
const config = yield (0, runControlHelper_1.loadConfig)();
|
|
87
|
+
const options = {
|
|
88
|
+
url: (0, helper_1.getApiUrl)(config),
|
|
89
|
+
auth: {
|
|
90
|
+
clientId: config.identification,
|
|
91
|
+
secret: config.apiSecurityToken,
|
|
92
|
+
},
|
|
93
|
+
version: apiVersions_1.ApiVersions.V1,
|
|
94
|
+
};
|
|
95
|
+
const responseOfGet = yield (0, helper_1.getResource)(options, ORGANIZATION_RESOURCE);
|
|
96
|
+
const bodyOfGet = JSON.parse(yield responseOfGet.text(), helper_1.deserializeJSON);
|
|
97
|
+
Debug('GET organizations response', bodyOfGet);
|
|
98
|
+
if (responseOfGet.status === 200) {
|
|
99
|
+
return bodyOfGet;
|
|
100
|
+
}
|
|
101
|
+
else if (responseOfGet.status === 403) {
|
|
102
|
+
throw new Error(`Authentication error. Try to login using ${chalk_1.default.green('sos login')}`);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
throw new Error('Unknown error: ' + (bodyOfGet && bodyOfGet.message ? bodyOfGet.message : responseOfGet.status));
|
|
106
|
+
}
|
|
165
107
|
});
|
|
166
108
|
}
|
|
167
|
-
exports.getOrganizations = getOrganizations;
|
|
168
109
|
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
|
-
});
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
const ORGANIZATION_RESOURCE = 'organization';
|
|
112
|
+
const config = yield (0, runControlHelper_1.loadConfig)();
|
|
113
|
+
const options = {
|
|
114
|
+
url: (0, helper_1.getApiUrl)(config),
|
|
115
|
+
auth: {
|
|
116
|
+
clientId: config.identification,
|
|
117
|
+
secret: config.apiSecurityToken,
|
|
118
|
+
},
|
|
119
|
+
version: apiVersions_1.ApiVersions.V1,
|
|
120
|
+
};
|
|
121
|
+
const responseOfGet = yield (0, helper_1.getResource)(options, ORGANIZATION_RESOURCE + '/' + organizationUid);
|
|
122
|
+
const bodyOfGet = JSON.parse(yield responseOfGet.text(), helper_1.deserializeJSON);
|
|
123
|
+
Debug('GET organization response', bodyOfGet);
|
|
124
|
+
if (responseOfGet.status === 200) {
|
|
125
|
+
return bodyOfGet;
|
|
126
|
+
}
|
|
127
|
+
else if (responseOfGet.status === 403) {
|
|
128
|
+
throw new Error(`Authentication error. Try to login using ${chalk_1.default.green('sos login')}`);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
throw new Error('Unknown error: ' + (bodyOfGet && bodyOfGet.message ? bodyOfGet.message : responseOfGet.status));
|
|
132
|
+
}
|
|
206
133
|
});
|
|
207
134
|
}
|
|
208
|
-
exports.getOrganization = getOrganization;
|
|
209
|
-
//# sourceMappingURL=organizationFacade.js.map
|
|
@@ -8,80 +8,30 @@ 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
|
-
exports.
|
|
40
|
-
|
|
41
|
-
|
|
12
|
+
exports.loadConfig = loadConfig;
|
|
13
|
+
exports.saveConfig = saveConfig;
|
|
14
|
+
exports.updateConfig = updateConfig;
|
|
15
|
+
const sosControlHelper_1 = require("@signageos/sdk/dist/SosHelper/sosControlHelper");
|
|
16
|
+
const globalArgs_1 = require("../Command/globalArgs");
|
|
42
17
|
/** The same as loadConfig in SDK, but respect CLI --profile argument */
|
|
43
18
|
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
|
-
});
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const profile = (0, globalArgs_1.getGlobalProfile)();
|
|
21
|
+
return yield (0, sosControlHelper_1.loadConfig)({ profile });
|
|
54
22
|
});
|
|
55
23
|
}
|
|
56
|
-
exports.loadConfig = loadConfig;
|
|
57
24
|
/** The same as saveConfig in SDK, but respect CLI --profile argument */
|
|
58
25
|
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
|
-
});
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const profile = (0, globalArgs_1.getGlobalProfile)();
|
|
28
|
+
return yield (0, sosControlHelper_1.saveConfig)(newConfig, { profile });
|
|
69
29
|
});
|
|
70
30
|
}
|
|
71
|
-
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
|
-
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
|
+
exports.default = wait;
|
|
3
4
|
function wait(timeout) {
|
|
4
|
-
return new Promise(
|
|
5
|
+
return new Promise((resolve) => setTimeout(() => resolve(), timeout));
|
|
5
6
|
}
|
|
6
|
-
exports.default = wait;
|
|
7
|
-
//# sourceMappingURL=wait.js.map
|
|
@@ -8,77 +8,35 @@ 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.timingList = 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("../../Organization/organizationFacade");
|
|
19
|
+
const deviceFacade_1 = require("../../Device/deviceFacade");
|
|
20
|
+
const helper_1 = require("../../helper");
|
|
21
|
+
const commandDefinition_1 = require("../../Command/commandDefinition");
|
|
22
|
+
const Debug = (0, debug_1.default)('@signageos/cli:Timing:list');
|
|
23
|
+
const OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, organizationFacade_1.ORGANIZATION_UID_OPTION, deviceFacade_1.DEVICE_UID_OPTION];
|
|
48
24
|
exports.timingList = (0, commandDefinition_1.createCommandDefinition)({
|
|
49
25
|
name: 'list',
|
|
50
26
|
description: 'List timings assigned to device',
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
organizationUid = _a.sent();
|
|
63
|
-
return [4 /*yield*/, (0, organizationFacade_1.getOrganization)(organizationUid)];
|
|
64
|
-
case 2:
|
|
65
|
-
organization = _a.sent();
|
|
66
|
-
return [4 /*yield*/, (0, helper_1.createOrganizationRestApi)(organization)];
|
|
67
|
-
case 3:
|
|
68
|
-
restApi = _a.sent();
|
|
69
|
-
return [4 /*yield*/, (0, deviceFacade_1.getDeviceUid)(restApi, options)];
|
|
70
|
-
case 4:
|
|
71
|
-
deviceUid = _a.sent();
|
|
72
|
-
return [4 /*yield*/, restApi.timing.getList({
|
|
73
|
-
deviceUid: deviceUid,
|
|
74
|
-
})];
|
|
75
|
-
case 5:
|
|
76
|
-
timings = _a.sent();
|
|
77
|
-
console.log(chalk_1.default.yellow(JSON.stringify(timings, undefined, 2)));
|
|
78
|
-
return [2 /*return*/];
|
|
79
|
-
}
|
|
29
|
+
run(options) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
Debug('Timing list');
|
|
32
|
+
const organizationUid = yield (0, organizationFacade_1.getOrganizationUidOrDefaultOrSelect)(options);
|
|
33
|
+
const organization = yield (0, organizationFacade_1.getOrganization)(organizationUid);
|
|
34
|
+
const restApi = yield (0, helper_1.createOrganizationRestApi)(organization);
|
|
35
|
+
const deviceUid = yield (0, deviceFacade_1.getDeviceUid)(restApi, options);
|
|
36
|
+
const timings = yield restApi.timing.getList({
|
|
37
|
+
deviceUid,
|
|
80
38
|
});
|
|
39
|
+
console.log(chalk_1.default.yellow(JSON.stringify(timings, undefined, 2)));
|
|
81
40
|
});
|
|
82
41
|
},
|
|
83
42
|
});
|
|
84
|
-
//# sourceMappingURL=timingListCommand.js.map
|
|
@@ -8,48 +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 __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.timing = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
13
|
+
const commandDefinition_1 = require("../Command/commandDefinition");
|
|
14
|
+
const timingListCommand_1 = require("./List/timingListCommand");
|
|
42
15
|
exports.timing = (0, commandDefinition_1.createCommandDefinition)({
|
|
43
16
|
name: 'timing',
|
|
44
17
|
description: 'Timing management',
|
|
45
18
|
optionList: [],
|
|
46
19
|
commands: [timingListCommand_1.timingList],
|
|
47
|
-
run
|
|
48
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
49
|
-
|
|
50
|
-
throw new Error('Unknown command');
|
|
51
|
-
});
|
|
20
|
+
run() {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
throw new Error('Unknown command');
|
|
52
23
|
});
|
|
53
24
|
},
|
|
54
25
|
});
|
|
55
|
-
//# sourceMappingURL=timingCommand.js.map
|
package/dist/generalCommand.js
CHANGED
|
@@ -20,7 +20,7 @@ exports.COMMAND_OPTION = {
|
|
|
20
20
|
multiple: true,
|
|
21
21
|
defaultOption: true,
|
|
22
22
|
defaultValue: [],
|
|
23
|
-
description:
|
|
23
|
+
description: `(default) Command name`,
|
|
24
24
|
};
|
|
25
25
|
exports.HELP_OPTION = {
|
|
26
26
|
name: 'help',
|
|
@@ -34,4 +34,3 @@ exports.PROFILE_OPTION = {
|
|
|
34
34
|
description: 'signageOS Profile to be used for authentication and other values from ~/.sosrc config file.',
|
|
35
35
|
};
|
|
36
36
|
exports.GENERAL_OPTION_LIST = [exports.COMMAND_OPTION, exports.HELP_OPTION, exports.API_URL_OPTION, exports.VERSION_OPTION, exports.PROFILE_OPTION];
|
|
37
|
-
//# sourceMappingURL=generalCommand.js.map
|
package/dist/helper.d.ts
CHANGED
|
@@ -27,9 +27,9 @@ export interface IOptions {
|
|
|
27
27
|
}
|
|
28
28
|
export declare function createOptions(method: 'POST' | 'GET' | 'PUT' | 'DELETE', options: IOptions, data?: any): RequestInit;
|
|
29
29
|
export declare function createUri(options: IOptions, resource: string, queryParams?: any): string;
|
|
30
|
-
export declare function getResource(options: IOptions, path: string, query?: any): Promise<import("node-fetch").Response>;
|
|
31
|
-
export declare function postResource(options: IOptions, path: string, query?: any, data?: any): Promise<import("node-fetch").Response>;
|
|
32
|
-
export declare function putResource(options: IOptions, path: string, query?: any, data?: any): Promise<import("node-fetch").Response>;
|
|
33
|
-
export declare function deleteResource(options: IOptions, path: string): Promise<import("node-fetch").Response>;
|
|
30
|
+
export declare function getResource(options: IOptions, path: string, query?: any): Promise<import("node-fetch", { with: { "resolution-mode": "import" } }).Response>;
|
|
31
|
+
export declare function postResource(options: IOptions, path: string, query?: any, data?: any): Promise<import("node-fetch", { with: { "resolution-mode": "import" } }).Response>;
|
|
32
|
+
export declare function putResource(options: IOptions, path: string, query?: any, data?: any): Promise<import("node-fetch", { with: { "resolution-mode": "import" } }).Response>;
|
|
33
|
+
export declare function deleteResource(options: IOptions, path: string): Promise<import("node-fetch", { with: { "resolution-mode": "import" } }).Response>;
|
|
34
34
|
export declare function deserializeJSON(_key: string, value: any): any;
|
|
35
35
|
export {};
|