@signageos/cli 2.8.0 → 3.0.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.
Files changed (52) hide show
  1. package/README.md +0 -6
  2. package/dist/Applet/Build/appletBuildCommand.js +2 -0
  3. package/dist/Applet/Generate/appletGenerateCommand.js +51 -59
  4. package/dist/Applet/Start/appletStartCommand.js +3 -1
  5. package/dist/Applet/Test/Upload/appletTestRunCommand.js +11 -6
  6. package/dist/Applet/Test/Upload/appletTestUploadCommand.js +7 -4
  7. package/dist/Applet/Upload/appletUploadCommand.d.ts +15 -1
  8. package/dist/Applet/Upload/appletUploadCommand.js +82 -13
  9. package/dist/Applet/Upload/appletUploadCommandHelper.js +3 -3
  10. package/dist/Applet/Upload/appletUploadFacade.js +124 -52
  11. package/dist/Applet/Upload/appletUploadFacadeHelper.d.ts +1 -1
  12. package/dist/Applet/Upload/appletUploadFacadeHelper.js +4 -3
  13. package/dist/Applet/appletErrors.d.ts +3 -0
  14. package/dist/Applet/appletErrors.js +8 -1
  15. package/dist/Applet/appletFacade.js +13 -2
  16. package/dist/Applet/appletValidation.d.ts +17 -0
  17. package/dist/Applet/appletValidation.js +62 -0
  18. package/dist/Auth/loginCommand.js +30 -4
  19. package/dist/Command/commandProcessor.js +5 -0
  20. package/dist/Command/globalArgs.d.ts +21 -0
  21. package/dist/Command/globalArgs.js +30 -0
  22. package/dist/CommandLine/progressBarFactory.js +51 -10
  23. package/dist/CustomScript/Upload/customScriptUploadCommand.js +2 -2
  24. package/dist/Device/Content/setContentCommand.js +2 -2
  25. package/dist/Device/deviceFacade.js +10 -1
  26. package/dist/Emulator/emulatorFacade.js +9 -2
  27. package/dist/Organization/organizationFacade.d.ts +1 -1
  28. package/dist/Organization/organizationFacade.js +50 -13
  29. package/dist/Plugin/Upload/pluginUploadCommand.js +2 -1
  30. package/dist/RunControl/runControlHelper.d.ts +7 -1
  31. package/dist/RunControl/runControlHelper.js +19 -1
  32. package/dist/Runner/Upload/runnerUploadCommand.js +2 -1
  33. package/dist/Timing/List/timingListCommand.js +1 -3
  34. package/dist/helper/paginationHelper.d.ts +7 -0
  35. package/dist/helper/paginationHelper.js +32 -0
  36. package/dist/helper.d.ts +18 -1
  37. package/dist/helper.js +31 -23
  38. package/dist/index.js +1 -2
  39. package/dist/parameters.d.ts +0 -1
  40. package/dist/parameters.js +3 -6
  41. package/docs/applet/generate/index.md +1 -1
  42. package/docs/applet/upload/index.md +15 -1
  43. package/package.json +12 -11
  44. package/.env +0 -3
  45. package/dist/Firmware/Upload/firmwareUploadCommand.d.ts +0 -90
  46. package/dist/Firmware/Upload/firmwareUploadCommand.js +0 -210
  47. package/dist/Firmware/Upload/firmwareUploadFacade.d.ts +0 -10
  48. package/dist/Firmware/Upload/firmwareUploadFacade.js +0 -90
  49. package/dist/Firmware/Upload/firmwareUploadHelper.d.ts +0 -1
  50. package/dist/Firmware/Upload/firmwareUploadHelper.js +0 -48
  51. package/dist/Firmware/firmwareCommand.d.ts +0 -76
  52. package/dist/Firmware/firmwareCommand.js +0 -42
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signageos/cli",
3
- "version": "2.8.0",
3
+ "version": "3.0.0-rc.0",
4
4
  "main": "./dist/index.js",
5
5
  "author": "signageOS.io <dev@signageos.io>",
6
6
  "files": [
@@ -21,13 +21,18 @@
21
21
  "clean-build": "npm run clean && npm run build",
22
22
  "watch": "tsc --watch",
23
23
  "check-types": "tsc --noEmit",
24
- "test": "env NODE_ENV=test mocha",
25
- "test:coverage": "c8 npm run test",
26
- "test:windows": "cross-env NODE_ENV=test mocha",
27
24
  "lint": "eslint",
28
25
  "lint:fix": "eslint --fix",
29
26
  "lint:prettier": "prettier \"(src|tests|tools)/**/*.+(ts|tsx|json|js)\" --check",
30
27
  "lint:prettier:fix": "prettier \"(src|tests|tools)/**/*.+(ts|tsx|json|js)\" --write",
28
+ "test": "npm run test:unit && npm run test:integration",
29
+ "test:all": "npm run test:unit",
30
+ "test:coverage": "c8 npm run test:all",
31
+ "test:unit": "env NODE_ENV=test mocha",
32
+ "test:unit:windows": "cross-env NODE_ENV=test mocha",
33
+ "test:integration": "npm run clean-build && env NODE_ENV=test mocha --config .mocharc.integration.json",
34
+ "test:integration:windows": "npm run build && cross-env NODE_ENV=test mocha --config .mocharc.integration.json",
35
+ "test:integration:generate": "env NODE_ENV=test mocha --config .mocharc.integration.json --grep appletGenerateCommand",
31
36
  "test:node-versions": "./tests/integration/test-node-versions.sh",
32
37
  "test:integration:node-versions": "env NODE_ENV=test mocha --config .mocharc.node-versions.json",
33
38
  "generate:dummy-applet": "node ./tools/generate-dummy-applet.mjs",
@@ -49,7 +54,7 @@
49
54
  },
50
55
  "devDependencies": {
51
56
  "@istanbuljs/nyc-config-typescript": "1.0.2",
52
- "@signageos/codestyle": "2.0.3",
57
+ "@signageos/codestyle": "2.1.0",
53
58
  "@types/archiver": "6.0.3",
54
59
  "@types/child-process-promise": "2.2.6",
55
60
  "@types/cli-progress": "3.11.6",
@@ -81,7 +86,7 @@
81
86
  },
82
87
  "dependencies": {
83
88
  "@signageos/file": "2.0.1",
84
- "@signageos/sdk": "2.0.2",
89
+ "@signageos/sdk": "2.4.0",
85
90
  "archiver": "7.0.1",
86
91
  "chalk": "2.4.2",
87
92
  "child-process-promise": "2.1.3",
@@ -92,7 +97,7 @@
92
97
  "debug": "4.4.0",
93
98
  "dotenv": "16.5.0",
94
99
  "express": "5.1.0",
95
- "fs-extra": "11.3.0",
100
+ "fs-extra": "11.3.2",
96
101
  "internal-ip": "8.0.0",
97
102
  "markdown-table": "3.0.4",
98
103
  "mime": "2.4.4",
@@ -101,9 +106,5 @@
101
106
  "serve-static": "2.2.0",
102
107
  "which": "5.0.0",
103
108
  "zod": "3.24.4"
104
- },
105
- "publishConfig": {
106
- "registry": "https://registry.npmjs.org/",
107
- "access": "public"
108
109
  }
109
110
  }
package/.env DELETED
@@ -1,3 +0,0 @@
1
- SOS_API_URL=https://api.signageos.io
2
- SOS_BOX_HOST=box.signageos.io
3
- SOS_FORWARD_SERVER_URL=https://forward.signageos.io
@@ -1,90 +0,0 @@
1
- import { CommandLineOptions } from '../../Command/commandDefinition';
2
- declare const OPTION_LIST: readonly [{
3
- readonly name: "application-type";
4
- readonly alias: "a";
5
- readonly type: StringConstructor;
6
- readonly description: "Application type for the firmware (e.g., linux, android, webos)";
7
- }, {
8
- readonly name: "firmware-version";
9
- readonly alias: "f";
10
- readonly type: StringConstructor;
11
- readonly description: "Version identifier for the firmware package";
12
- }, {
13
- readonly name: "firmware-type";
14
- readonly type: StringConstructor;
15
- readonly description: "Device model prefixed with brand (e.g., \"benq_sl550\", \"rpi4\", \"rpi\")";
16
- }, {
17
- readonly name: "src";
18
- readonly type: StringConstructor;
19
- readonly multiple: true;
20
- readonly description: "Path(s) to firmware file(s) to upload";
21
- }, {
22
- readonly name: "force";
23
- readonly type: BooleanConstructor;
24
- readonly description: "When firmware cannot be uploaded due to invalid firmware \"type\", do it anyways.";
25
- }];
26
- /**
27
- * Uploads firmware files for specific device types and application platforms.
28
- * Supports various device architectures including Linux, Android, WebOS, and others.
29
- * The command validates firmware files and creates versioned firmware packages
30
- * that can be deployed to compatible devices.
31
- *
32
- * @group Private
33
- *
34
- * @example
35
- * ```bash
36
- * # Upload firmware interactively
37
- * sos firmware upload
38
- *
39
- * # Upload firmware with command line options
40
- * sos firmware upload --application-type linux --firmware-version 1.2.3 --src /path/to/firmware.tar.gz
41
- *
42
- * # Upload Android firmware with type specification
43
- * sos firmware upload --application-type android --firmware-type rpi4 --firmware-version 1.0.0 --src /path/to/firmware.apk
44
- *
45
- * # Force upload when type validation fails
46
- * sos firmware upload --application-type linux --firmware-type custom_device --firmware-version 1.0.0 --src /path/to/firmware.tar.gz --force
47
- * ```
48
- *
49
- * @throws {Error} When required parameters are missing
50
- * @throws {Error} When firmware files cannot be found or validated
51
- * @throws {RequestError} When firmware type is invalid for the platform
52
- * @throws {Error} When upload confirmation is denied
53
- *
54
- * @see {@link ../ Firmware upload command}
55
- *
56
- * @see {@link ../../ Firmware management commands}
57
- *
58
- * @since 0.6.0
59
- */
60
- export declare const firmwareUpload: {
61
- name: "upload";
62
- description: string;
63
- optionList: readonly [{
64
- readonly name: "application-type";
65
- readonly alias: "a";
66
- readonly type: StringConstructor;
67
- readonly description: "Application type for the firmware (e.g., linux, android, webos)";
68
- }, {
69
- readonly name: "firmware-version";
70
- readonly alias: "f";
71
- readonly type: StringConstructor;
72
- readonly description: "Version identifier for the firmware package";
73
- }, {
74
- readonly name: "firmware-type";
75
- readonly type: StringConstructor;
76
- readonly description: "Device model prefixed with brand (e.g., \"benq_sl550\", \"rpi4\", \"rpi\")";
77
- }, {
78
- readonly name: "src";
79
- readonly type: StringConstructor;
80
- readonly multiple: true;
81
- readonly description: "Path(s) to firmware file(s) to upload";
82
- }, {
83
- readonly name: "force";
84
- readonly type: BooleanConstructor;
85
- readonly description: "When firmware cannot be uploaded due to invalid firmware \"type\", do it anyways.";
86
- }];
87
- commands: never[];
88
- run(options: CommandLineOptions<typeof OPTION_LIST>): Promise<void>;
89
- };
90
- export {};
@@ -1,210 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.firmwareUpload = void 0;
16
- const helper_1 = require("../../helper");
17
- const prompts_1 = __importDefault(require("prompts"));
18
- const chalk_1 = __importDefault(require("chalk"));
19
- const firmwareUploadFacade_1 = require("./firmwareUploadFacade");
20
- const progressBarFactory_1 = require("../../CommandLine/progressBarFactory");
21
- const firmwareUploadHelper_1 = __importDefault(require("./firmwareUploadHelper"));
22
- const RequestError_1 = __importDefault(require("@signageos/sdk/dist/RestApi/Error/RequestError"));
23
- const commandDefinition_1 = require("../../Command/commandDefinition");
24
- const log_1 = require("@signageos/sdk/dist/Console/log");
25
- const questions = [
26
- {
27
- type: 'text',
28
- name: 'applicationType',
29
- message: `Application type`,
30
- },
31
- {
32
- type: 'text',
33
- name: 'version',
34
- message: `Firmware version`,
35
- },
36
- ];
37
- const fwTypeQuestion = [
38
- {
39
- type: 'text',
40
- name: 'firmwareType',
41
- message: `Model prefixed with brand. E.g.: "benq_sl550", "rpi4", "rpi"`,
42
- },
43
- ];
44
- const applicationTypesRequiringType = ['linux', 'android'];
45
- const OPTION_LIST = [
46
- { name: 'application-type', alias: 'a', type: String, description: 'Application type for the firmware (e.g., linux, android, webos)' },
47
- { name: 'firmware-version', alias: 'f', type: String, description: 'Version identifier for the firmware package' },
48
- { name: 'firmware-type', type: String, description: 'Device model prefixed with brand (e.g., "benq_sl550", "rpi4", "rpi")' },
49
- { name: 'src', type: String, multiple: true, description: 'Path(s) to firmware file(s) to upload' },
50
- { name: 'force', type: Boolean, description: 'When firmware cannot be uploaded due to invalid firmware "type", do it anyways.' },
51
- ];
52
- /**
53
- * Uploads firmware files for specific device types and application platforms.
54
- * Supports various device architectures including Linux, Android, WebOS, and others.
55
- * The command validates firmware files and creates versioned firmware packages
56
- * that can be deployed to compatible devices.
57
- *
58
- * @group Private
59
- *
60
- * @example
61
- * ```bash
62
- * # Upload firmware interactively
63
- * sos firmware upload
64
- *
65
- * # Upload firmware with command line options
66
- * sos firmware upload --application-type linux --firmware-version 1.2.3 --src /path/to/firmware.tar.gz
67
- *
68
- * # Upload Android firmware with type specification
69
- * sos firmware upload --application-type android --firmware-type rpi4 --firmware-version 1.0.0 --src /path/to/firmware.apk
70
- *
71
- * # Force upload when type validation fails
72
- * sos firmware upload --application-type linux --firmware-type custom_device --firmware-version 1.0.0 --src /path/to/firmware.tar.gz --force
73
- * ```
74
- *
75
- * @throws {Error} When required parameters are missing
76
- * @throws {Error} When firmware files cannot be found or validated
77
- * @throws {RequestError} When firmware type is invalid for the platform
78
- * @throws {Error} When upload confirmation is denied
79
- *
80
- * @see {@link ../ Firmware upload command}
81
- *
82
- * @see {@link ../../ Firmware management commands}
83
- *
84
- * @since 0.6.0
85
- */
86
- exports.firmwareUpload = (0, commandDefinition_1.createCommandDefinition)({
87
- name: 'upload',
88
- description: 'Upload firmware version to the signageOS platform',
89
- optionList: OPTION_LIST,
90
- commands: [],
91
- run(options) {
92
- return __awaiter(this, void 0, void 0, function* () {
93
- const optionsProvided = !!(options['application-type'] && options['firmware-version'] && options.src && options.src.length > 0);
94
- const restApi = yield (0, helper_1.createFirmwareVersionRestApi)();
95
- const data = {
96
- applicationType: '',
97
- version: '',
98
- files: [],
99
- };
100
- const pathSet = new Set();
101
- if (!optionsProvided) {
102
- const answers = yield (0, prompts_1.default)(questions);
103
- data.applicationType = answers.applicationType;
104
- data.version = answers.version;
105
- if (applicationTypesRequiringType.includes(data.applicationType)) {
106
- const typeAnswers = yield (0, prompts_1.default)(fwTypeQuestion);
107
- data.type = typeAnswers.firmwareType;
108
- if (!data.type) {
109
- (0, log_1.log)('error', `You must input firmware type`);
110
- return;
111
- }
112
- }
113
- if (!data.applicationType || !data.version) {
114
- (0, log_1.log)('error', `You must input application type and version`);
115
- return;
116
- }
117
- while (true) {
118
- // ask for files
119
- const answer = yield (0, prompts_1.default)({
120
- type: 'text',
121
- name: 'fileFsPath',
122
- message: 'Absolute path to the file, type `stop` to stop.',
123
- });
124
- if (answer.fileFsPath === undefined || answer.fileFsPath === 'stop') {
125
- // EOF or stop
126
- break;
127
- }
128
- const path = answer.fileFsPath;
129
- try {
130
- (0, firmwareUploadHelper_1.default)(path);
131
- pathSet.add(path);
132
- (0, log_1.log)('info', `${chalk_1.default.green('File added to upload list')}`);
133
- }
134
- catch (e) {
135
- (0, log_1.log)('error', e.message);
136
- }
137
- }
138
- if (pathSet.size > 0) {
139
- (0, log_1.log)('info', 'Application type: ', chalk_1.default.green(data.applicationType));
140
- (0, log_1.log)('info', 'Version: ', chalk_1.default.green(data.version));
141
- if (data.type) {
142
- (0, log_1.log)('info', 'Firmware type: ', chalk_1.default.green(data.type));
143
- }
144
- (0, log_1.log)('info', 'List of files: ', ...Array.from(pathSet));
145
- const confirmation = yield (0, prompts_1.default)({
146
- type: 'confirm',
147
- name: 'confirmed',
148
- message: 'Is this ok?',
149
- });
150
- if (!confirmation.confirmed) {
151
- throw new Error(`You must confirm your action.`);
152
- }
153
- }
154
- }
155
- else {
156
- // data is given cli args
157
- if (!options['application-type']) {
158
- throw new Error('Argument --application-type is required');
159
- }
160
- if (!options['firmware-version']) {
161
- throw new Error('Argument --firmware-version is required');
162
- }
163
- data.applicationType = options['application-type'];
164
- data.version = options['firmware-version'];
165
- if (applicationTypesRequiringType.includes(data.applicationType) && !options['firmware-type']) {
166
- (0, log_1.log)('error', 'You must input firmware type');
167
- return;
168
- }
169
- data.type = options['firmware-type'];
170
- const pathArr = options.src;
171
- pathArr === null || pathArr === void 0 ? void 0 : pathArr.forEach((path) => {
172
- (0, firmwareUploadHelper_1.default)(path);
173
- pathSet.add(path);
174
- });
175
- }
176
- try {
177
- yield (0, firmwareUploadFacade_1.uploadFirmwareVersion)({
178
- restApi,
179
- firmware: data,
180
- pathArr: Array.from(pathSet),
181
- progressBar: (0, progressBarFactory_1.createProgressBar)(),
182
- });
183
- }
184
- catch (error) {
185
- if (error instanceof RequestError_1.default && error.errorName === 'INVALID_TYPE_TO_FIRMWARE_VERSION_UPLOAD') {
186
- const promptOverride = () => (0, prompts_1.default)({
187
- type: 'confirm',
188
- name: 'confirmed',
189
- message: `A firmware "type=${data.type}" field is not valid because doesn't exist any device with this type ` +
190
- `thus firmware version not to be uploaded. ` +
191
- `If you are sure that "type=${data.type}" you've specified is valid, ` +
192
- `you can override it confirming this question or using --force flag.`,
193
- });
194
- if (options.force || (!optionsProvided && (yield promptOverride()).confirmed)) {
195
- yield (0, firmwareUploadFacade_1.uploadFirmwareVersion)({
196
- restApi,
197
- firmware: data,
198
- pathArr: Array.from(pathSet),
199
- progressBar: (0, progressBarFactory_1.createProgressBar)(),
200
- force: true,
201
- });
202
- }
203
- }
204
- else {
205
- throw error;
206
- }
207
- }
208
- });
209
- },
210
- });
@@ -1,10 +0,0 @@
1
- import RestApi from '@signageos/sdk/dist/RestApi/RestApi';
2
- import { ProgressBar } from '../../CommandLine/IProgressBar';
3
- import { IFirmwareVersionCreatable } from '@signageos/sdk/dist/RestApi/Firmware/Version/IFirmwareVersion';
4
- export declare function uploadFirmwareVersion(parameters: {
5
- restApi: RestApi;
6
- firmware: IFirmwareVersionCreatable;
7
- pathArr: Array<string>;
8
- progressBar?: ProgressBar;
9
- force?: boolean;
10
- }): Promise<void>;
@@ -1,90 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.uploadFirmwareVersion = uploadFirmwareVersion;
46
- const path = __importStar(require("path"));
47
- const fs = __importStar(require("fs-extra"));
48
- const fileSystem_1 = require("../../Lib/fileSystem");
49
- function uploadFirmwareVersion(parameters) {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- const { restApi, firmware, pathArr, progressBar } = parameters;
52
- const sizes = yield Promise.all(pathArr.map((filePath) => __awaiter(this, void 0, void 0, function* () {
53
- const stat = yield fs.stat(filePath);
54
- return stat.size;
55
- })));
56
- const totalSize = sizes.reduce((sum, size) => sum + size, 0);
57
- if (progressBar) {
58
- progressBar.init({ size: totalSize, name: pathArr.join(',') });
59
- }
60
- for (const index in pathArr) {
61
- const filePath = pathArr[index];
62
- if (!filePath) {
63
- continue;
64
- }
65
- const fileSize = sizes[parseInt(index)];
66
- const fileName = path.basename(filePath);
67
- const md5Hash = yield (0, fileSystem_1.getFileMD5Checksum)(filePath);
68
- const stream = fs.createReadStream(filePath);
69
- stream.pause();
70
- stream.on('data', (chunk) => {
71
- if (progressBar) {
72
- progressBar.update({ add: chunk.length, name: fileName });
73
- }
74
- });
75
- firmware.files.push({
76
- hash: md5Hash,
77
- content: stream,
78
- size: fileSize !== null && fileSize !== void 0 ? fileSize : 0,
79
- });
80
- }
81
- try {
82
- yield restApi.firmwareVersion.create(firmware, parameters.force);
83
- }
84
- finally {
85
- if (progressBar) {
86
- progressBar.end();
87
- }
88
- }
89
- });
90
- }
@@ -1 +0,0 @@
1
- export default function validateFileExistenceSync(path: string): void;
@@ -1,48 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.default = validateFileExistenceSync;
37
- const fs = __importStar(require("fs-extra"));
38
- function validateFileExistenceSync(path) {
39
- if (fs.existsSync(path)) {
40
- const stats = fs.statSync(path);
41
- if (!stats.isFile()) {
42
- throw new Error(`${path} is not file.`);
43
- }
44
- }
45
- else {
46
- throw new Error(`${path} does not exist.`);
47
- }
48
- }
@@ -1,76 +0,0 @@
1
- /**
2
- * Provides commands for managing device firmware on the signageOS platform.
3
- * Firmware management includes uploading new firmware versions for different
4
- * device types and application platforms.
5
- *
6
- * @group Private
7
- *
8
- * @example
9
- * ```bash
10
- * # Upload firmware version
11
- * sos firmware upload
12
- * ```
13
- *
14
- * @see {@link ./upload/ Upload firmware version command}
15
- *
16
- * @since 0.6.0
17
- */
18
- export declare const firmware: {
19
- name: "firmware";
20
- description: string;
21
- optionList: never[];
22
- commands: {
23
- name: "upload";
24
- description: string;
25
- optionList: readonly [{
26
- readonly name: "application-type";
27
- readonly alias: "a";
28
- readonly type: StringConstructor;
29
- readonly description: "Application type for the firmware (e.g., linux, android, webos)";
30
- }, {
31
- readonly name: "firmware-version";
32
- readonly alias: "f";
33
- readonly type: StringConstructor;
34
- readonly description: "Version identifier for the firmware package";
35
- }, {
36
- readonly name: "firmware-type";
37
- readonly type: StringConstructor;
38
- readonly description: "Device model prefixed with brand (e.g., \"benq_sl550\", \"rpi4\", \"rpi\")";
39
- }, {
40
- readonly name: "src";
41
- readonly type: StringConstructor;
42
- readonly multiple: true;
43
- readonly description: "Path(s) to firmware file(s) to upload";
44
- }, {
45
- readonly name: "force";
46
- readonly type: BooleanConstructor;
47
- readonly description: "When firmware cannot be uploaded due to invalid firmware \"type\", do it anyways.";
48
- }];
49
- commands: never[];
50
- run(options: import("../Command/commandDefinition").CommandLineOptions<readonly [{
51
- readonly name: "application-type";
52
- readonly alias: "a";
53
- readonly type: StringConstructor;
54
- readonly description: "Application type for the firmware (e.g., linux, android, webos)";
55
- }, {
56
- readonly name: "firmware-version";
57
- readonly alias: "f";
58
- readonly type: StringConstructor;
59
- readonly description: "Version identifier for the firmware package";
60
- }, {
61
- readonly name: "firmware-type";
62
- readonly type: StringConstructor;
63
- readonly description: "Device model prefixed with brand (e.g., \"benq_sl550\", \"rpi4\", \"rpi\")";
64
- }, {
65
- readonly name: "src";
66
- readonly type: StringConstructor;
67
- readonly multiple: true;
68
- readonly description: "Path(s) to firmware file(s) to upload";
69
- }, {
70
- readonly name: "force";
71
- readonly type: BooleanConstructor;
72
- readonly description: "When firmware cannot be uploaded due to invalid firmware \"type\", do it anyways.";
73
- }]>): Promise<void>;
74
- }[];
75
- run(): Promise<never>;
76
- };
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.firmware = void 0;
13
- const commandDefinition_1 = require("../Command/commandDefinition");
14
- const firmwareUploadCommand_1 = require("./Upload/firmwareUploadCommand");
15
- /**
16
- * Provides commands for managing device firmware on the signageOS platform.
17
- * Firmware management includes uploading new firmware versions for different
18
- * device types and application platforms.
19
- *
20
- * @group Private
21
- *
22
- * @example
23
- * ```bash
24
- * # Upload firmware version
25
- * sos firmware upload
26
- * ```
27
- *
28
- * @see {@link ./upload/ Upload firmware version command}
29
- *
30
- * @since 0.6.0
31
- */
32
- exports.firmware = (0, commandDefinition_1.createCommandDefinition)({
33
- name: 'firmware',
34
- description: 'Firmware management',
35
- optionList: [],
36
- commands: [firmwareUploadCommand_1.firmwareUpload],
37
- run() {
38
- return __awaiter(this, void 0, void 0, function* () {
39
- throw new Error('Unknown command');
40
- });
41
- },
42
- });