@signageos/cli 2.4.1 → 2.6.0-rc.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 +27 -1
- package/dist/Applet/Build/appletBuildCommand.d.ts +28 -2
- package/dist/Applet/Build/appletBuildCommand.js +27 -1
- package/dist/Applet/Generate/Templates/index.js.template +1 -1
- package/dist/Applet/Generate/Templates/tsconfig.js.template +1 -1
- package/dist/Applet/Generate/appletGenerateCommand.d.ts +29 -23
- package/dist/Applet/Generate/appletGenerateCommand.js +38 -32
- package/dist/Applet/Start/appletStartCommand.d.ts +44 -2
- package/dist/Applet/Start/appletStartCommand.js +44 -2
- package/dist/Applet/Test/Upload/appletTestRunCommand.d.ts +25 -2
- package/dist/Applet/Test/Upload/appletTestRunCommand.js +24 -1
- package/dist/Applet/Test/Upload/appletTestUploadCommand.d.ts +34 -4
- package/dist/Applet/Test/Upload/appletTestUploadCommand.js +32 -2
- package/dist/Applet/Test/appletTestCommand.d.ts +23 -6
- package/dist/Applet/Test/appletTestCommand.js +17 -0
- package/dist/Applet/Upload/appletUploadCommand.d.ts +46 -4
- package/dist/Applet/Upload/appletUploadCommand.js +44 -2
- package/dist/Applet/Upload/appletUploadFacade.js +3 -3
- package/dist/Applet/appletCommand.d.ts +42 -10
- package/dist/Applet/appletCommand.js +33 -1
- package/dist/Auth/loginCommand.d.ts +23 -2
- package/dist/Auth/loginCommand.js +42 -14
- package/dist/Command/Autocomplete/Install/installAutocompleteCommand.d.ts +17 -0
- package/dist/Command/Autocomplete/Install/installAutocompleteCommand.js +17 -0
- package/dist/Command/Autocomplete/Install/installAutocompleteCommand.ts +17 -0
- package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.d.ts +17 -0
- package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.js +22 -5
- package/dist/Command/Autocomplete/autocompleteCommand.d.ts +18 -0
- package/dist/Command/Autocomplete/autocompleteCommand.js +19 -1
- package/dist/Command/autoComplete.js +2 -2
- package/dist/Command/globalArgs.d.ts +33 -0
- package/dist/Command/globalArgs.js +33 -0
- package/dist/CustomScript/Generate/customScriptGenerateCommand.d.ts +19 -0
- package/dist/CustomScript/Generate/customScriptGenerateCommand.js +20 -1
- package/dist/CustomScript/Upload/customScriptUploadCommand.d.ts +32 -2
- package/dist/CustomScript/Upload/customScriptUploadCommand.js +31 -1
- package/dist/CustomScript/customScriptCommand.d.ts +21 -1
- package/dist/CustomScript/customScriptCommand.js +20 -0
- package/dist/CustomScript/customScriptFacade.d.ts +5 -5
- package/dist/CustomScript/customScriptFacade.js +5 -4
- package/dist/Device/Connect/connectCommand.d.ts +51 -2
- package/dist/Device/Connect/connectCommand.js +50 -1
- package/dist/Device/Content/setContentCommand.d.ts +28 -2
- package/dist/Device/Content/setContentCommand.js +27 -1
- package/dist/Device/PowerAction/powerActionCommand.d.ts +54 -2
- package/dist/Device/PowerAction/powerActionCommand.js +52 -0
- package/dist/Device/deviceCommand.d.ts +26 -6
- package/dist/Device/deviceCommand.js +21 -1
- package/dist/Device/deviceFacade.d.ts +1 -1
- package/dist/Firmware/Upload/firmwareUploadCommand.d.ts +42 -0
- package/dist/Firmware/Upload/firmwareUploadCommand.js +40 -6
- package/dist/Firmware/Upload/firmwareUploadFacade.js +1 -1
- package/dist/Firmware/firmwareCommand.d.ts +25 -0
- package/dist/Firmware/firmwareCommand.js +18 -1
- package/dist/Lib/childProcess.js +2 -2
- package/dist/Organization/Get/organizationGetCommand.d.ts +31 -2
- package/dist/Organization/Get/organizationGetCommand.js +31 -2
- package/dist/Organization/List/organizationListCommand.d.ts +20 -0
- package/dist/Organization/List/organizationListCommand.js +21 -1
- package/dist/Organization/SetDefault/organizationSetDefaultCommand.d.ts +24 -0
- package/dist/Organization/SetDefault/organizationSetDefaultCommand.js +25 -1
- package/dist/Organization/organizationCommand.d.ts +27 -2
- package/dist/Organization/organizationCommand.js +26 -1
- package/dist/Organization/organizationFacade.d.ts +2 -2
- package/dist/Organization/organizationFacade.js +3 -3
- package/dist/Plugin/Generate/pluginGenerateCommand.d.ts +7 -0
- package/dist/Plugin/Generate/pluginGenerateCommand.js +38 -0
- package/dist/Plugin/Generate/pluginGenerateFacade.d.ts +12 -0
- package/dist/Plugin/Generate/pluginGenerateFacade.js +106 -0
- package/dist/Plugin/Upload/pluginUploadCommand.d.ts +25 -0
- package/dist/Plugin/Upload/pluginUploadCommand.js +70 -0
- package/dist/Plugin/pluginCommand.d.ts +27 -0
- package/dist/Plugin/pluginCommand.js +26 -0
- package/dist/Plugin/pluginFacade.d.ts +62 -0
- package/dist/Plugin/pluginFacade.js +251 -0
- package/dist/Runner/Generate/runnerGenerateCommand.d.ts +7 -0
- package/dist/Runner/Generate/runnerGenerateCommand.js +38 -0
- package/dist/Runner/Generate/runnerGenerateFacade.d.ts +12 -0
- package/dist/Runner/Generate/runnerGenerateFacade.js +107 -0
- package/dist/Runner/Upload/runnerUploadCommand.d.ts +25 -0
- package/dist/Runner/Upload/runnerUploadCommand.js +72 -0
- package/dist/Runner/runnerCommand.d.ts +27 -0
- package/dist/Runner/runnerCommand.js +26 -0
- package/dist/Runner/runnerFacede.d.ts +15 -0
- package/dist/Runner/runnerFacede.js +234 -0
- package/dist/Timing/List/timingListCommand.d.ts +26 -2
- package/dist/Timing/List/timingListCommand.js +26 -2
- package/dist/Timing/timingCommand.d.ts +17 -2
- package/dist/Timing/timingCommand.js +15 -0
- package/dist/helper.d.ts +5 -5
- package/dist/helper.js +4 -6
- package/dist/index.js +26 -2
- package/docs/applet/build/index.md +74 -0
- package/docs/applet/generate/index.md +118 -0
- package/docs/applet/index.md +134 -0
- package/docs/applet/start/index.md +104 -0
- package/docs/applet/test/index.md +91 -0
- package/docs/applet/test/run/index.md +82 -0
- package/docs/applet/test/upload/index.md +80 -0
- package/docs/applet/upload/index.md +131 -0
- package/docs/autocomplete/index.md +92 -0
- package/docs/autocomplete/install/index.md +120 -0
- package/docs/autocomplete/uninstall/index.md +65 -0
- package/docs/custom-script/generate/index.md +66 -0
- package/docs/custom-script/index.md +96 -0
- package/docs/custom-script/upload/index.md +78 -0
- package/docs/device/connect/index.md +148 -0
- package/docs/device/index.md +105 -0
- package/docs/device/power-action/index.md +130 -0
- package/docs/device/set-content/index.md +72 -0
- package/docs/index.md +170 -0
- package/docs/login/index.md +122 -0
- package/docs/organization/get/index.md +79 -0
- package/docs/organization/index.md +105 -0
- package/docs/organization/list/index.md +65 -0
- package/docs/organization/set-default/index.md +74 -0
- package/docs/plugin/generate/index.md +43 -0
- package/docs/plugin/index.md +72 -0
- package/docs/plugin/upload/index.md +50 -0
- package/docs/runner/generate/index.md +43 -0
- package/docs/runner/index.md +72 -0
- package/docs/runner/upload/index.md +50 -0
- package/docs/timing/index.md +78 -0
- package/docs/timing/list/index.md +71 -0
- package/package.json +29 -19
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import RestApi from '@signageos/sdk/dist/RestApi/RestApi';
|
|
2
|
+
import { PlatformConfig } from '../CustomScript/customScriptFacade';
|
|
3
|
+
import { IRunnerVersion } from '@signageos/sdk/dist/RestApi/Runner/Version/IRunnerVersion';
|
|
4
|
+
import z from 'zod';
|
|
5
|
+
import { ConfigSchema } from '../Plugin/pluginFacade';
|
|
6
|
+
export declare function ensureRunnerVersion(restApi: RestApi, config: RunnerConfig, schema: any): Promise<IRunnerVersion>;
|
|
7
|
+
export declare function uploadCode({ restApi, workDir, platform, config, runnerVersion, }: {
|
|
8
|
+
restApi: RestApi;
|
|
9
|
+
workDir: string;
|
|
10
|
+
platform: string;
|
|
11
|
+
config: PlatformConfig;
|
|
12
|
+
runnerVersion: IRunnerVersion;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
export declare function loadSchemas(workDir: string): Promise<any>;
|
|
15
|
+
export type RunnerConfig = z.infer<typeof ConfigSchema>;
|
|
@@ -0,0 +1,234 @@
|
|
|
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
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.ensureRunnerVersion = ensureRunnerVersion;
|
|
49
|
+
exports.uploadCode = uploadCode;
|
|
50
|
+
exports.loadSchemas = loadSchemas;
|
|
51
|
+
const path = __importStar(require("path"));
|
|
52
|
+
const os = __importStar(require("os"));
|
|
53
|
+
const fs = __importStar(require("fs-extra"));
|
|
54
|
+
const prompts_1 = __importDefault(require("prompts"));
|
|
55
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
56
|
+
const log_1 = require("@signageos/sdk/dist/Console/log");
|
|
57
|
+
const archive_1 = require("../Lib/archive");
|
|
58
|
+
const fileSystem_1 = require("../Lib/fileSystem");
|
|
59
|
+
const runtimeFileSystem_1 = require("@signageos/sdk/dist/Development/runtimeFileSystem");
|
|
60
|
+
const customScriptFacade_1 = require("../CustomScript/customScriptFacade");
|
|
61
|
+
const PLUGIN_BUILDS_DIRNAME = 'plugin_builds';
|
|
62
|
+
function ensureRunnerVersion(restApi, config, schema) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const runner = yield ensureRunner(restApi, config);
|
|
65
|
+
const runnerVersion = yield restApi.runner.version.get({ runnerUid: runner.uid, version: config.version });
|
|
66
|
+
if (runnerVersion) {
|
|
67
|
+
return runnerVersion;
|
|
68
|
+
}
|
|
69
|
+
const response = yield (0, prompts_1.default)({
|
|
70
|
+
type: 'confirm',
|
|
71
|
+
name: 'newVersion',
|
|
72
|
+
message: `Do you want to create new runner version ${config.version}?`,
|
|
73
|
+
});
|
|
74
|
+
if (!response.newVersion) {
|
|
75
|
+
throw new Error('Runner version creation was canceled.');
|
|
76
|
+
}
|
|
77
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Creating Runner version ${config.version}`));
|
|
78
|
+
return yield restApi.runner.version.create({
|
|
79
|
+
runnerUid: runner.uid,
|
|
80
|
+
version: config.version,
|
|
81
|
+
description: config.description,
|
|
82
|
+
input: schema.input,
|
|
83
|
+
output: schema.output,
|
|
84
|
+
telemetry: schema.telemetry,
|
|
85
|
+
configDefinition: config.configDefinition,
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function ensureRunner(restApi, config) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
if (config.uid) {
|
|
92
|
+
const runner = yield restApi.runner.get(config.uid);
|
|
93
|
+
if (runner) {
|
|
94
|
+
yield restApi.runner.update(runner.uid, {
|
|
95
|
+
name: config.name,
|
|
96
|
+
title: config.name,
|
|
97
|
+
description: config.description,
|
|
98
|
+
});
|
|
99
|
+
return runner;
|
|
100
|
+
}
|
|
101
|
+
throw new Error(`Runner with uid "${config.uid}" not found`);
|
|
102
|
+
}
|
|
103
|
+
const response = yield (0, prompts_1.default)({
|
|
104
|
+
type: 'confirm',
|
|
105
|
+
name: 'create',
|
|
106
|
+
message: `Runner "${config.name}" does not exist. Do you want to create it?`,
|
|
107
|
+
});
|
|
108
|
+
if (!response.create) {
|
|
109
|
+
throw new Error('Runner upload was canceled.');
|
|
110
|
+
}
|
|
111
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Creating Runner "${config.name}"`));
|
|
112
|
+
const createdRunner = yield restApi.runner.create({
|
|
113
|
+
name: config.name,
|
|
114
|
+
title: config.name,
|
|
115
|
+
description: config.description,
|
|
116
|
+
});
|
|
117
|
+
// TODO ask for permission or read from CLI arg
|
|
118
|
+
(0, log_1.log)('info', chalk_1.default.yellow('Adding Runner uid to the config file'));
|
|
119
|
+
yield (0, customScriptFacade_1.addToConfigFile)(process.cwd(), { uid: createdRunner.uid });
|
|
120
|
+
return createdRunner;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function uploadCode(_a) {
|
|
124
|
+
return __awaiter(this, arguments, void 0, function* ({ restApi, workDir, platform, config, runnerVersion, }) {
|
|
125
|
+
const { mainFile, runtime } = config;
|
|
126
|
+
const codeArchive = yield generateRunnerPlatformCodeArchive(workDir, config, runnerVersion, platform);
|
|
127
|
+
const runnerVersionPlatform = yield restApi.runner.version.platform.get({
|
|
128
|
+
runnerUid: runnerVersion.runnerUid,
|
|
129
|
+
version: runnerVersion.version,
|
|
130
|
+
platform,
|
|
131
|
+
});
|
|
132
|
+
if ((runnerVersionPlatform === null || runnerVersionPlatform === void 0 ? void 0 : runnerVersionPlatform.md5Checksum) === codeArchive.md5Checksum) {
|
|
133
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Skipping upload for ${platform} - no changes detected`));
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
(0, log_1.log)('info', chalk_1.default.yellow(`Uploading files for ${platform}`));
|
|
138
|
+
yield uploadCodeArchive({
|
|
139
|
+
restApi,
|
|
140
|
+
runnerVersion,
|
|
141
|
+
platform,
|
|
142
|
+
codeArchive,
|
|
143
|
+
});
|
|
144
|
+
yield restApi.runner.version.platform.update({
|
|
145
|
+
runnerUid: runnerVersion.runnerUid,
|
|
146
|
+
version: runnerVersion.version,
|
|
147
|
+
platform,
|
|
148
|
+
mainFile,
|
|
149
|
+
runtime,
|
|
150
|
+
md5Checksum: codeArchive.md5Checksum,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
finally {
|
|
154
|
+
yield codeArchive.delete();
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function uploadCodeArchive(_a) {
|
|
159
|
+
return __awaiter(this, arguments, void 0, function* ({ restApi, runnerVersion, platform, codeArchive, }) {
|
|
160
|
+
const filePath = codeArchive.filePath;
|
|
161
|
+
const fileSize = (yield fs.stat(filePath)).size;
|
|
162
|
+
const fileStream = fs.createReadStream(filePath);
|
|
163
|
+
yield restApi.runner.version.platform.archive.upload({
|
|
164
|
+
runnerUid: runnerVersion.runnerUid,
|
|
165
|
+
version: runnerVersion.version,
|
|
166
|
+
platform,
|
|
167
|
+
md5Checksum: codeArchive.md5Checksum,
|
|
168
|
+
size: fileSize,
|
|
169
|
+
stream: fileStream,
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Generates an archive with the code for a particular platform, defined by the provided configuration.
|
|
175
|
+
*
|
|
176
|
+
* Archive is generated and stored in the runtime /tmp/signageos/runner_scripts_builds/:uid/:version/ directory.
|
|
177
|
+
* After archive isn't needed anymore, it should be deleted using the delete method.
|
|
178
|
+
*/
|
|
179
|
+
function generateRunnerPlatformCodeArchive(workDir, config, runnerVersion, platform) {
|
|
180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
const buildsDir = yield ensureBuildsDirectory(runnerVersion);
|
|
182
|
+
const archiveFileName = `${platform}.zip`;
|
|
183
|
+
const archiveFilePath = path.join(buildsDir, archiveFileName);
|
|
184
|
+
yield (0, archive_1.generateZip)(workDir, config.rootDir, archiveFilePath);
|
|
185
|
+
const md5Checksum = yield (0, fileSystem_1.getFileMD5Checksum)(archiveFilePath);
|
|
186
|
+
return {
|
|
187
|
+
filePath: archiveFilePath,
|
|
188
|
+
md5Checksum,
|
|
189
|
+
delete() {
|
|
190
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
+
yield fs.unlink(archiveFilePath);
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Ensure that the runtime directory for runner script version exists in the current working directory.
|
|
199
|
+
*
|
|
200
|
+
* This directory is used to store temporary files generated by the CLI.
|
|
201
|
+
*/
|
|
202
|
+
function ensureBuildsDirectory(runnerVersion) {
|
|
203
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
204
|
+
const runtimeDir = yield ensureRuntimeDir();
|
|
205
|
+
const buildsDir = path.join(runtimeDir, runnerVersion.runnerUid, runnerVersion.version);
|
|
206
|
+
yield fs.ensureDir(buildsDir);
|
|
207
|
+
return buildsDir;
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Ensure that the runtime directory exists in the current working directory.
|
|
212
|
+
*
|
|
213
|
+
* This directory is used to store temporary files generated by the CLI.
|
|
214
|
+
*/
|
|
215
|
+
function ensureRuntimeDir() {
|
|
216
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
217
|
+
const runtimeDir = path.join(os.tmpdir(), runtimeFileSystem_1.RUNTIME_DIRNAME, PLUGIN_BUILDS_DIRNAME);
|
|
218
|
+
yield fs.ensureDir(runtimeDir);
|
|
219
|
+
return runtimeDir;
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function loadSchemas(workDir) {
|
|
223
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
+
const filePath = getConfigFilePath(workDir);
|
|
225
|
+
if (!(yield fs.pathExists(filePath))) {
|
|
226
|
+
throw new Error(`Config file schema.json not found`);
|
|
227
|
+
}
|
|
228
|
+
const fileContent = fs.readFileSync(filePath, 'utf-8');
|
|
229
|
+
return JSON.parse(fileContent);
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
function getConfigFilePath(workDir) {
|
|
233
|
+
return path.join(workDir, 'schema.json');
|
|
234
|
+
}
|
|
@@ -2,7 +2,7 @@ import { CommandLineOptions } from '../../Command/commandDefinition';
|
|
|
2
2
|
declare const OPTION_LIST: readonly [{
|
|
3
3
|
readonly name: "no-default-organization";
|
|
4
4
|
readonly type: BooleanConstructor;
|
|
5
|
-
readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc
|
|
5
|
+
readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc";
|
|
6
6
|
}, {
|
|
7
7
|
readonly name: "organization-uid";
|
|
8
8
|
readonly type: StringConstructor;
|
|
@@ -12,13 +12,37 @@ declare const OPTION_LIST: readonly [{
|
|
|
12
12
|
readonly type: StringConstructor;
|
|
13
13
|
readonly description: "Device UID";
|
|
14
14
|
}];
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves and displays all timing configurations that are currently assigned
|
|
17
|
+
* to a specific device. Timing configurations define when and how content
|
|
18
|
+
* (applets) should be displayed on devices, including scheduling and duration settings.
|
|
19
|
+
*
|
|
20
|
+
* @group Management:1
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```bash
|
|
24
|
+
* # List timings for a specific device
|
|
25
|
+
* sos timing list --device-uid device123
|
|
26
|
+
*
|
|
27
|
+
* # List timings with organization override
|
|
28
|
+
* sos timing list --device-uid device123 --organization-uid org456
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @throws {Error} When device cannot be found or accessed
|
|
32
|
+
*
|
|
33
|
+
* @throws {Error} When organization access is denied
|
|
34
|
+
*
|
|
35
|
+
* @throws {Error} When timing list retrieval fails
|
|
36
|
+
*
|
|
37
|
+
* @since 0.3.0
|
|
38
|
+
*/
|
|
15
39
|
export declare const timingList: {
|
|
16
40
|
name: "list";
|
|
17
41
|
description: string;
|
|
18
42
|
optionList: readonly [{
|
|
19
43
|
readonly name: "no-default-organization";
|
|
20
44
|
readonly type: BooleanConstructor;
|
|
21
|
-
readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc
|
|
45
|
+
readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc";
|
|
22
46
|
}, {
|
|
23
47
|
readonly name: "organization-uid";
|
|
24
48
|
readonly type: StringConstructor;
|
|
@@ -21,9 +21,33 @@ const helper_1 = require("../../helper");
|
|
|
21
21
|
const commandDefinition_1 = require("../../Command/commandDefinition");
|
|
22
22
|
const Debug = (0, debug_1.default)('@signageos/cli:Timing:list');
|
|
23
23
|
const OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, organizationFacade_1.ORGANIZATION_UID_OPTION, deviceFacade_1.DEVICE_UID_OPTION];
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves and displays all timing configurations that are currently assigned
|
|
26
|
+
* to a specific device. Timing configurations define when and how content
|
|
27
|
+
* (applets) should be displayed on devices, including scheduling and duration settings.
|
|
28
|
+
*
|
|
29
|
+
* @group Management:1
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```bash
|
|
33
|
+
* # List timings for a specific device
|
|
34
|
+
* sos timing list --device-uid device123
|
|
35
|
+
*
|
|
36
|
+
* # List timings with organization override
|
|
37
|
+
* sos timing list --device-uid device123 --organization-uid org456
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @throws {Error} When device cannot be found or accessed
|
|
41
|
+
*
|
|
42
|
+
* @throws {Error} When organization access is denied
|
|
43
|
+
*
|
|
44
|
+
* @throws {Error} When timing list retrieval fails
|
|
45
|
+
*
|
|
46
|
+
* @since 0.3.0
|
|
47
|
+
*/
|
|
24
48
|
exports.timingList = (0, commandDefinition_1.createCommandDefinition)({
|
|
25
49
|
name: 'list',
|
|
26
|
-
description: 'List
|
|
50
|
+
description: 'List timing configurations assigned to a device',
|
|
27
51
|
optionList: OPTION_LIST,
|
|
28
52
|
commands: [],
|
|
29
53
|
run(options) {
|
|
@@ -36,7 +60,7 @@ exports.timingList = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
36
60
|
const timings = yield restApi.timing.getList({
|
|
37
61
|
deviceUid,
|
|
38
62
|
});
|
|
39
|
-
console.
|
|
63
|
+
console.info(chalk_1.default.yellow(JSON.stringify(timings, undefined, 2)));
|
|
40
64
|
});
|
|
41
65
|
},
|
|
42
66
|
});
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provides commands for managing timing configurations that control when and how
|
|
3
|
+
* applets are displayed on signageOS devices. Timing configurations define the
|
|
4
|
+
* relationship between devices, applets, and scheduling parameters.
|
|
5
|
+
*
|
|
6
|
+
* @group Management:4
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```bash
|
|
10
|
+
* # List timing configurations
|
|
11
|
+
* sos timing list
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @since 0.3.0
|
|
15
|
+
*/
|
|
1
16
|
export declare const timing: {
|
|
2
17
|
name: "timing";
|
|
3
18
|
description: string;
|
|
@@ -8,7 +23,7 @@ export declare const timing: {
|
|
|
8
23
|
optionList: readonly [{
|
|
9
24
|
readonly name: "no-default-organization";
|
|
10
25
|
readonly type: BooleanConstructor;
|
|
11
|
-
readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc
|
|
26
|
+
readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc";
|
|
12
27
|
}, {
|
|
13
28
|
readonly name: "organization-uid";
|
|
14
29
|
readonly type: StringConstructor;
|
|
@@ -22,7 +37,7 @@ export declare const timing: {
|
|
|
22
37
|
run(options: import("../Command/commandDefinition").CommandLineOptions<readonly [{
|
|
23
38
|
readonly name: "no-default-organization";
|
|
24
39
|
readonly type: BooleanConstructor;
|
|
25
|
-
readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc
|
|
40
|
+
readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc";
|
|
26
41
|
}, {
|
|
27
42
|
readonly name: "organization-uid";
|
|
28
43
|
readonly type: StringConstructor;
|
|
@@ -12,6 +12,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.timing = void 0;
|
|
13
13
|
const commandDefinition_1 = require("../Command/commandDefinition");
|
|
14
14
|
const timingListCommand_1 = require("./List/timingListCommand");
|
|
15
|
+
/**
|
|
16
|
+
* Provides commands for managing timing configurations that control when and how
|
|
17
|
+
* applets are displayed on signageOS devices. Timing configurations define the
|
|
18
|
+
* relationship between devices, applets, and scheduling parameters.
|
|
19
|
+
*
|
|
20
|
+
* @group Management:4
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```bash
|
|
24
|
+
* # List timing configurations
|
|
25
|
+
* sos timing list
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @since 0.3.0
|
|
29
|
+
*/
|
|
15
30
|
exports.timing = (0, commandDefinition_1.createCommandDefinition)({
|
|
16
31
|
name: 'timing',
|
|
17
32
|
description: 'Timing management',
|
package/dist/helper.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import fetch, { RequestInit } from 'node-fetch';
|
|
2
1
|
import RestApi from '@signageos/sdk/dist/RestApi/RestApi';
|
|
3
2
|
import { ApiVersions } from '@signageos/sdk/dist/RestApi/apiVersions';
|
|
4
3
|
import { IConfig } from '@signageos/sdk/dist/SosHelper/sosControlHelper';
|
|
4
|
+
type RequestInit = globalThis.RequestInit;
|
|
5
5
|
interface ICredentials {
|
|
6
6
|
oauthClientId: string;
|
|
7
7
|
oauthClientSecret: string;
|
|
@@ -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<
|
|
31
|
-
export declare function postResource(options: IOptions, path: string, query?: any, data?: any): Promise<
|
|
32
|
-
export declare function putResource(options: IOptions, path: string, query?: any, data?: any): Promise<
|
|
33
|
-
export declare function deleteResource(options: IOptions, path: string): Promise<
|
|
30
|
+
export declare function getResource(options: IOptions, path: string, query?: any): Promise<Response>;
|
|
31
|
+
export declare function postResource(options: IOptions, path: string, query?: any, data?: any): Promise<Response>;
|
|
32
|
+
export declare function putResource(options: IOptions, path: string, query?: any, data?: any): Promise<Response>;
|
|
33
|
+
export declare function deleteResource(options: IOptions, path: string): Promise<Response>;
|
|
34
34
|
export declare function deserializeJSON(_key: string, value: any): any;
|
|
35
35
|
export {};
|
package/dist/helper.js
CHANGED
|
@@ -25,9 +25,7 @@ exports.postResource = postResource;
|
|
|
25
25
|
exports.putResource = putResource;
|
|
26
26
|
exports.deleteResource = deleteResource;
|
|
27
27
|
exports.deserializeJSON = deserializeJSON;
|
|
28
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
29
28
|
const querystring_1 = require("querystring");
|
|
30
|
-
// import { RequestInit } from 'node-fetch';
|
|
31
29
|
const RestApi_1 = __importDefault(require("@signageos/sdk/dist/RestApi/RestApi"));
|
|
32
30
|
const runControlHelper_1 = require("./RunControl/runControlHelper");
|
|
33
31
|
const apiVersions_1 = require("@signageos/sdk/dist/RestApi/apiVersions");
|
|
@@ -97,16 +95,16 @@ function createUri(options, resource, queryParams) {
|
|
|
97
95
|
return [options.url, options.version, resource].join('/') + (typeof queryParams !== 'undefined' ? '?' + (0, querystring_1.stringify)(queryParams) : '');
|
|
98
96
|
}
|
|
99
97
|
function getResource(options, path, query) {
|
|
100
|
-
return (
|
|
98
|
+
return fetch(createUri(options, path, query), createOptions('GET', options));
|
|
101
99
|
}
|
|
102
100
|
function postResource(options, path, query, data) {
|
|
103
|
-
return (
|
|
101
|
+
return fetch(createUri(options, path, query), createOptions('POST', options, data));
|
|
104
102
|
}
|
|
105
103
|
function putResource(options, path, query, data) {
|
|
106
|
-
return (
|
|
104
|
+
return fetch(createUri(options, path, query), createOptions('PUT', options, data));
|
|
107
105
|
}
|
|
108
106
|
function deleteResource(options, path) {
|
|
109
|
-
return (
|
|
107
|
+
return fetch(createUri(options, path), createOptions('DELETE', options));
|
|
110
108
|
}
|
|
111
109
|
function deserializeJSON(_key, value) {
|
|
112
110
|
if (typeof value === 'string') {
|
package/dist/index.js
CHANGED
|
@@ -20,12 +20,36 @@ const deviceCommand_1 = require("./Device/deviceCommand");
|
|
|
20
20
|
const generalCommand_1 = require("./generalCommand");
|
|
21
21
|
const commandDefinition_1 = require("./Command/commandDefinition");
|
|
22
22
|
const customScriptCommand_1 = require("./CustomScript/customScriptCommand");
|
|
23
|
+
const pluginCommand_1 = require("./Plugin/pluginCommand");
|
|
24
|
+
const runnerCommand_1 = require("./Runner/runnerCommand");
|
|
23
25
|
const autocompleteCommand_1 = require("./Command/Autocomplete/autocompleteCommand");
|
|
26
|
+
/**
|
|
27
|
+
* The root command for the signageOS CLI tool that provides comprehensive management
|
|
28
|
+
* capabilities for applets, devices, organizations, and other signageOS resources.
|
|
29
|
+
* This command serves as the entry point for all CLI operations and coordinates
|
|
30
|
+
* access to all available command groups.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```bash
|
|
34
|
+
* # Show help and available commands
|
|
35
|
+
* sos --help
|
|
36
|
+
*
|
|
37
|
+
* # Show version information
|
|
38
|
+
* sos --version
|
|
39
|
+
*
|
|
40
|
+
* # Use custom API endpoint
|
|
41
|
+
* sos --api-url https://api.custom.signageos.io applet list
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @see {@link https://developers.signageos.io/docs/cli-setup/ CLI Setup}
|
|
45
|
+
*
|
|
46
|
+
* @since 0.1.0
|
|
47
|
+
*/
|
|
24
48
|
const index = (0, commandDefinition_1.createCommandDefinition)({
|
|
25
49
|
name: 'sos',
|
|
26
|
-
description: 'signageOS',
|
|
50
|
+
description: 'SignageOS CLI - The central command-line tool for deploying, managing, and debugging signageOS projects and devices',
|
|
27
51
|
optionList: generalCommand_1.GENERAL_OPTION_LIST,
|
|
28
|
-
commands: [appletCommand_1.applet, loginCommand_1.login, organizationCommand_1.organization, timingCommand_1.timing, firmwareCommand_1.firmware, deviceCommand_1.device, customScriptCommand_1.customScript, autocompleteCommand_1.autocomplete],
|
|
52
|
+
commands: [appletCommand_1.applet, loginCommand_1.login, organizationCommand_1.organization, timingCommand_1.timing, firmwareCommand_1.firmware, deviceCommand_1.device, customScriptCommand_1.customScript, pluginCommand_1.plugin, runnerCommand_1.runner, autocompleteCommand_1.autocomplete],
|
|
29
53
|
run() {
|
|
30
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
55
|
throw new Error('Unknown command');
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: applet-build-index
|
|
3
|
+
title: build
|
|
4
|
+
sidebar_position: 22
|
|
5
|
+
---
|
|
6
|
+
# build
|
|
7
|
+
|
|
8
|
+
Build applet locally for production deployment.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
Builds the applet into a distributable package using the signageOS SDK build system.
|
|
14
|
+
The build process compiles and bundles the applet code, assets, and dependencies
|
|
15
|
+
into a zip archive ready for upload to the signageOS platform.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
sos applet build [options]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Options
|
|
24
|
+
|
|
25
|
+
| Option | Description |
|
|
26
|
+
| --------------------------- | ---------------------------------------------------------------- |
|
|
27
|
+
| `--no-default-organization` | Prevent using the defaultOrganizationUid from ~/.sosrc (boolean) |
|
|
28
|
+
| `--organization-uid` | Organization UID (string) |
|
|
29
|
+
| `--applet-uid` | Applet UID (string) |
|
|
30
|
+
|
|
31
|
+
## Examples
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Build applet in current directory
|
|
35
|
+
sos applet build
|
|
36
|
+
|
|
37
|
+
# Build with specific organization
|
|
38
|
+
sos applet build --organization-uid abc123def456
|
|
39
|
+
|
|
40
|
+
# Build with specific applet UID
|
|
41
|
+
sos applet build --applet-uid my-applet-uid
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Since
|
|
45
|
+
|
|
46
|
+
1.2.0
|
|
47
|
+
|
|
48
|
+
## Global Options
|
|
49
|
+
|
|
50
|
+
All commands support the following global options:
|
|
51
|
+
|
|
52
|
+
| Option | Alias | Description |
|
|
53
|
+
|--------|-------|-------------|
|
|
54
|
+
| `--help` | `-h` | Display help information for any command |
|
|
55
|
+
| `--version` | `-v` | Display the installed version of the CLI |
|
|
56
|
+
| `--api-url` | `-u` | Override the API URL for REST requests |
|
|
57
|
+
| `--profile` | | Use a specific profile from ~/.sosrc config |
|
|
58
|
+
|
|
59
|
+
### Examples
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Show version
|
|
63
|
+
sos --version
|
|
64
|
+
|
|
65
|
+
# Get help for any command
|
|
66
|
+
sos applet --help
|
|
67
|
+
sos applet upload --help
|
|
68
|
+
|
|
69
|
+
# Use custom API endpoint
|
|
70
|
+
sos --api-url https://api.example.com applet upload
|
|
71
|
+
|
|
72
|
+
# Use specific profile
|
|
73
|
+
sos --profile production organization list
|
|
74
|
+
```
|