@signageos/cli 2.6.1 → 2.7.1
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 -0
- package/dist/Applet/Build/appletBuildCommand.d.ts +1 -2
- package/dist/Applet/Build/appletBuildCommand.js +1 -2
- package/dist/Applet/Generate/appletGenerateCommand.d.ts +1 -1
- package/dist/Applet/Generate/appletGenerateCommand.js +6 -6
- package/dist/Applet/Start/appletStartCommand.d.ts +1 -1
- package/dist/Applet/Start/appletStartCommand.js +1 -1
- package/dist/Applet/Test/Upload/appletTestRunCommand.d.ts +1 -1
- package/dist/Applet/Test/Upload/appletTestRunCommand.js +1 -1
- package/dist/Applet/Test/Upload/appletTestUploadCommand.d.ts +1 -1
- package/dist/Applet/Test/Upload/appletTestUploadCommand.js +1 -1
- package/dist/Applet/Test/appletTestCommand.d.ts +1 -1
- package/dist/Applet/Test/appletTestCommand.js +1 -1
- package/dist/Applet/Upload/appletUploadCommand.d.ts +1 -1
- package/dist/Applet/Upload/appletUploadCommand.js +1 -1
- package/dist/Applet/appletCommand.d.ts +1 -1
- package/dist/Applet/appletCommand.js +1 -1
- package/dist/Applet/appletFacade.d.ts +2 -2
- package/dist/Applet/appletFacade.js +22 -14
- package/dist/Auth/loginCommand.d.ts +3 -10
- package/dist/Auth/loginCommand.js +10 -22
- package/dist/Command/Autocomplete/Install/installAutocompleteCommand.d.ts +1 -1
- package/dist/Command/Autocomplete/Install/installAutocompleteCommand.js +1 -1
- package/dist/Command/Autocomplete/Install/installAutocompleteCommand.ts +1 -1
- package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.d.ts +1 -1
- package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.js +1 -1
- package/dist/Command/Autocomplete/autocompleteCommand.d.ts +1 -1
- package/dist/Command/Autocomplete/autocompleteCommand.js +1 -1
- package/dist/Command/commandProcessor.d.ts +1 -0
- package/dist/Command/commandProcessor.js +78 -0
- package/dist/Command/globalArgs.d.ts +0 -2
- package/dist/Command/globalArgs.js +0 -2
- package/dist/CustomScript/Generate/customScriptGenerateCommand.d.ts +32 -8
- package/dist/CustomScript/Generate/customScriptGenerateCommand.js +17 -9
- package/dist/CustomScript/Generate/customScriptGenerateFacade.d.ts +7 -5
- package/dist/CustomScript/Generate/customScriptGenerateFacade.js +81 -32
- package/dist/CustomScript/Generate/customScriptGenerateOptions.d.ts +17 -0
- package/dist/CustomScript/Generate/customScriptGenerateOptions.js +13 -0
- package/dist/CustomScript/Upload/customScriptUploadCommand.d.ts +15 -19
- package/dist/CustomScript/Upload/customScriptUploadCommand.js +15 -19
- package/dist/CustomScript/customScriptCommand.d.ts +27 -9
- package/dist/CustomScript/customScriptCommand.js +9 -7
- package/dist/Device/Connect/connectCommand.d.ts +1 -1
- package/dist/Device/Connect/connectCommand.js +1 -1
- package/dist/Device/Content/setContentCommand.d.ts +16 -6
- package/dist/Device/Content/setContentCommand.js +23 -10
- package/dist/Device/PowerAction/powerActionCommand.d.ts +1 -1
- package/dist/Device/PowerAction/powerActionCommand.js +1 -1
- package/dist/Device/deviceCommand.d.ts +9 -1
- package/dist/Device/deviceCommand.js +1 -1
- package/dist/Device/deviceFacade.d.ts +1 -1
- package/dist/Device/deviceFacade.js +23 -18
- package/dist/Organization/Get/organizationGetCommand.d.ts +1 -1
- package/dist/Organization/Get/organizationGetCommand.js +1 -1
- package/dist/Organization/List/organizationListCommand.d.ts +1 -1
- package/dist/Organization/List/organizationListCommand.js +1 -1
- package/dist/Organization/SetDefault/organizationSetDefaultCommand.d.ts +1 -1
- package/dist/Organization/SetDefault/organizationSetDefaultCommand.js +1 -1
- package/dist/Organization/organizationCommand.d.ts +1 -1
- package/dist/Organization/organizationCommand.js +1 -1
- package/dist/Plugin/Generate/pluginGenerateCommand.d.ts +36 -2
- package/dist/Plugin/Generate/pluginGenerateCommand.js +25 -3
- package/dist/Plugin/Generate/pluginGenerateFacade.d.ts +7 -5
- package/dist/Plugin/Generate/pluginGenerateFacade.js +38 -16
- package/dist/Plugin/Generate/pluginGenerateOptions.d.ts +13 -0
- package/dist/Plugin/Generate/pluginGenerateOptions.js +20 -0
- package/dist/Plugin/Upload/pluginUploadCommand.d.ts +28 -0
- package/dist/Plugin/Upload/pluginUploadCommand.js +31 -2
- package/dist/Plugin/pluginCommand.d.ts +49 -2
- package/dist/Plugin/pluginCommand.js +31 -0
- package/dist/Plugin/pluginFacade.d.ts +1 -1
- package/dist/Plugin/pluginFacade.js +29 -19
- package/dist/Runner/Generate/runnerGenerateCommand.d.ts +36 -2
- package/dist/Runner/Generate/runnerGenerateCommand.js +25 -3
- package/dist/Runner/Generate/runnerGenerateFacade.d.ts +7 -5
- package/dist/Runner/Generate/runnerGenerateFacade.js +38 -16
- package/dist/Runner/Generate/runnerGenerateOptions.d.ts +13 -0
- package/dist/Runner/Generate/runnerGenerateOptions.js +20 -0
- package/dist/Runner/Upload/runnerUploadCommand.d.ts +28 -0
- package/dist/Runner/Upload/runnerUploadCommand.js +31 -2
- package/dist/Runner/runnerCommand.d.ts +41 -2
- package/dist/Runner/runnerCommand.js +23 -0
- package/dist/Runner/runnerFacede.d.ts +1 -1
- package/dist/Runner/runnerFacede.js +29 -19
- package/dist/Timing/List/timingListCommand.d.ts +1 -1
- package/dist/Timing/List/timingListCommand.js +1 -1
- package/dist/Timing/timingCommand.d.ts +1 -1
- package/dist/Timing/timingCommand.js +1 -1
- package/dist/index.js +2 -1
- package/docs/applet/build/index.md +1 -1
- package/docs/applet/generate/index.md +1 -1
- package/docs/applet/index.md +1 -1
- package/docs/applet/start/index.md +1 -1
- package/docs/applet/test/index.md +1 -1
- package/docs/applet/test/run/index.md +1 -1
- package/docs/applet/test/upload/index.md +1 -1
- package/docs/applet/upload/index.md +1 -1
- package/docs/autocomplete/index.md +1 -1
- package/docs/autocomplete/install/index.md +1 -1
- package/docs/autocomplete/uninstall/index.md +1 -1
- package/docs/custom-script/generate/index.md +20 -6
- package/docs/custom-script/index.md +9 -7
- package/docs/custom-script/upload/index.md +14 -13
- package/docs/device/connect/index.md +1 -1
- package/docs/device/index.md +1 -1
- package/docs/device/power-action/index.md +1 -1
- package/docs/device/set-content/index.md +12 -8
- package/docs/index.md +20 -4
- package/docs/login/index.md +2 -2
- package/docs/organization/get/index.md +1 -1
- package/docs/organization/index.md +1 -1
- package/docs/organization/list/index.md +1 -1
- package/docs/organization/set-default/index.md +1 -1
- package/docs/plugin/generate/index.md +31 -1
- package/docs/plugin/index.md +34 -1
- package/docs/plugin/upload/index.md +28 -5
- package/docs/runner/generate/index.md +31 -1
- package/docs/runner/index.md +26 -1
- package/docs/runner/upload/index.md +28 -5
- package/docs/timing/index.md +1 -1
- package/docs/timing/list/index.md +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -334,6 +334,60 @@ Upload custom script to the signageOS platform.
|
|
|
334
334
|
| --organization-uid *(required)* | Organization UID | STDIN |
|
|
335
335
|
| --script-path *(optional)* | Path to script file | ${PWD} |
|
|
336
336
|
|
|
337
|
+
### Plugin
|
|
338
|
+
```bash
|
|
339
|
+
sos plugin --help
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
#### Plugin Generate
|
|
343
|
+
```bash
|
|
344
|
+
sos plugin generate
|
|
345
|
+
```
|
|
346
|
+
Generate a new plugin project with boilerplate code.
|
|
347
|
+
|
|
348
|
+
| Argument | Description | Default value |
|
|
349
|
+
|-----------------------------|---------------------------------|----------------|
|
|
350
|
+
| --name *(required)* | Name for the plugin | STDIN |
|
|
351
|
+
| --target-dir *(optional)* | Generate plugin to directory | ${PWD}/${name} |
|
|
352
|
+
|
|
353
|
+
#### Plugin Upload
|
|
354
|
+
```bash
|
|
355
|
+
sos plugin upload
|
|
356
|
+
```
|
|
357
|
+
Upload plugin to the signageOS platform.
|
|
358
|
+
|
|
359
|
+
| Argument | Description | Default value |
|
|
360
|
+
|---------------------------------|------------------------------|----------------|
|
|
361
|
+
| --organization-uid *(required)* | Organization UID | STDIN |
|
|
362
|
+
| --script-path *(optional)* | Path to script file | ${PWD} |
|
|
363
|
+
|
|
364
|
+
### Runner
|
|
365
|
+
```bash
|
|
366
|
+
sos runner --help
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
#### Runner Generate
|
|
370
|
+
```bash
|
|
371
|
+
sos runner generate
|
|
372
|
+
```
|
|
373
|
+
Generate a new runner project with boilerplate code.
|
|
374
|
+
|
|
375
|
+
| Argument | Description | Default value |
|
|
376
|
+
|-----------------------------|---------------------------------|----------------|
|
|
377
|
+
| --name *(required)* | Name for the runner | STDIN |
|
|
378
|
+
| --target-dir *(optional)* | Generate runner to directory | ${PWD}/${name} |
|
|
379
|
+
|
|
380
|
+
#### Runner Upload
|
|
381
|
+
```bash
|
|
382
|
+
sos runner upload
|
|
383
|
+
```
|
|
384
|
+
Upload runner to the signageOS platform.
|
|
385
|
+
|
|
386
|
+
| Argument | Description | Default value |
|
|
387
|
+
|---------------------------------|------------------------------|----------------|
|
|
388
|
+
| --organization-uid *(required)* | Organization UID | STDIN |
|
|
389
|
+
| --script-path *(optional)* | Path to script file | ${PWD} |
|
|
390
|
+
|
|
337
391
|
## Debugging
|
|
338
392
|
|
|
339
393
|
To enable debugging for the `@signageos/cli:Applet:Upload:appletUploadFacade` module, use:
|
|
@@ -17,7 +17,7 @@ export declare const OPTION_LIST: readonly [{
|
|
|
17
17
|
* The build process compiles and bundles the applet code, assets, and dependencies
|
|
18
18
|
* into a zip archive ready for upload to the signageOS platform.
|
|
19
19
|
*
|
|
20
|
-
* @group Development:
|
|
20
|
+
* @group Development:12
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```bash
|
|
@@ -32,7 +32,6 @@ export declare const OPTION_LIST: readonly [{
|
|
|
32
32
|
* ```
|
|
33
33
|
*
|
|
34
34
|
* @throws {Error} When applet path is invalid or build process fails
|
|
35
|
-
*
|
|
36
35
|
* @throws {Error} When organization or applet cannot be found
|
|
37
36
|
* @throws {Error} When package.json is missing or invalid
|
|
38
37
|
*
|
|
@@ -28,7 +28,7 @@ exports.OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, orga
|
|
|
28
28
|
* The build process compiles and bundles the applet code, assets, and dependencies
|
|
29
29
|
* into a zip archive ready for upload to the signageOS platform.
|
|
30
30
|
*
|
|
31
|
-
* @group Development:
|
|
31
|
+
* @group Development:12
|
|
32
32
|
*
|
|
33
33
|
* @example
|
|
34
34
|
* ```bash
|
|
@@ -43,7 +43,6 @@ exports.OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, orga
|
|
|
43
43
|
* ```
|
|
44
44
|
*
|
|
45
45
|
* @throws {Error} When applet path is invalid or build process fails
|
|
46
|
-
*
|
|
47
46
|
* @throws {Error} When organization or applet cannot be found
|
|
48
47
|
* @throws {Error} When package.json is missing or invalid
|
|
49
48
|
*
|
|
@@ -94,7 +94,7 @@ const DEPENDENCIES = {
|
|
|
94
94
|
'@signageos/front-applet@latest',
|
|
95
95
|
'@signageos/front-display@latest',
|
|
96
96
|
'@signageos/webpack-plugin@latest',
|
|
97
|
-
'es-check@9',
|
|
97
|
+
'es-check@9.4.0',
|
|
98
98
|
/* required for transpilation to ES5 */
|
|
99
99
|
'css-loader@7',
|
|
100
100
|
'style-loader@4',
|
|
@@ -116,7 +116,7 @@ const RUNSCRIPTS = {
|
|
|
116
116
|
prepare: 'npm run clean && npm run build',
|
|
117
117
|
upload: 'sos applet upload',
|
|
118
118
|
clean: 'npx rimraf dist',
|
|
119
|
-
escheck: 'npx es-check --module es5 dist/**/*.js',
|
|
119
|
+
escheck: 'npx es-check@9.4.0 --module es5 "./dist/**/*.js"',
|
|
120
120
|
postbuild: 'npm run escheck',
|
|
121
121
|
},
|
|
122
122
|
webpack: {
|
|
@@ -145,7 +145,7 @@ const importFileAsString = (relativePath) => {
|
|
|
145
145
|
* (webpack/rspack), various package managers (npm/pnpm/yarn/bun), and includes
|
|
146
146
|
* git repository initialization.
|
|
147
147
|
*
|
|
148
|
-
* @group Development:
|
|
148
|
+
* @group Development:11
|
|
149
149
|
*
|
|
150
150
|
* @example
|
|
151
151
|
* ```bash
|
|
@@ -304,7 +304,7 @@ exports.appletGenerate = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
304
304
|
prepare: 'pnpm run clean && pnpm run build',
|
|
305
305
|
upload: 'sos applet upload',
|
|
306
306
|
clean: 'pnpx rimraf dist',
|
|
307
|
-
escheck: 'pnpx es-check --module es5 "./dist/**/*.js"',
|
|
307
|
+
escheck: 'pnpx es-check@9.4.0 --module es5 "./dist/**/*.js"',
|
|
308
308
|
postbuild: 'pnpm run escheck',
|
|
309
309
|
};
|
|
310
310
|
break;
|
|
@@ -314,7 +314,7 @@ exports.appletGenerate = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
314
314
|
prepare: 'yarn run clean && yarn run build',
|
|
315
315
|
upload: 'sos applet upload',
|
|
316
316
|
clean: 'npx rimraf dist',
|
|
317
|
-
escheck: 'npx es-check --module es5 "./dist/**/*.js"',
|
|
317
|
+
escheck: 'npx es-check@9.4.0 --module es5 "./dist/**/*.js"',
|
|
318
318
|
postbuild: 'npm run escheck',
|
|
319
319
|
};
|
|
320
320
|
break;
|
|
@@ -324,7 +324,7 @@ exports.appletGenerate = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
324
324
|
prepare: 'bun run clean && bun run build',
|
|
325
325
|
upload: 'sos applet upload',
|
|
326
326
|
clean: 'bunx rimraf dist',
|
|
327
|
-
escheck: 'bunx es-check --module es5 "./dist/**/*.js"',
|
|
327
|
+
escheck: 'bunx es-check@9.4.0 --module es5 "./dist/**/*.js"',
|
|
328
328
|
postbuild: 'bun run escheck',
|
|
329
329
|
};
|
|
330
330
|
break;
|
|
@@ -53,7 +53,7 @@ export declare const OPTION_LIST: readonly [{
|
|
|
53
53
|
* to preview their applets in a browser-based emulator. Supports both local development
|
|
54
54
|
* and device connection for testing on actual signageOS devices.
|
|
55
55
|
*
|
|
56
|
-
* @group Development:
|
|
56
|
+
* @group Development:13
|
|
57
57
|
*
|
|
58
58
|
* @example
|
|
59
59
|
* ```bash
|
|
@@ -49,7 +49,7 @@ exports.OPTION_LIST = [
|
|
|
49
49
|
* to preview their applets in a browser-based emulator. Supports both local development
|
|
50
50
|
* and device connection for testing on actual signageOS devices.
|
|
51
51
|
*
|
|
52
|
-
* @group Development:
|
|
52
|
+
* @group Development:13
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* ```bash
|
|
@@ -30,7 +30,7 @@ declare const OPTION_LIST: readonly [{
|
|
|
30
30
|
* triggers test execution and provides real-time feedback on test progress and results.
|
|
31
31
|
* Tests can be run on specific devices or across multiple devices for comprehensive testing.
|
|
32
32
|
*
|
|
33
|
-
* @group Development:
|
|
33
|
+
* @group Development:142
|
|
34
34
|
*
|
|
35
35
|
* @example
|
|
36
36
|
* ```bash
|
|
@@ -46,7 +46,7 @@ const OPTION_LIST = [
|
|
|
46
46
|
* triggers test execution and provides real-time feedback on test progress and results.
|
|
47
47
|
* Tests can be run on specific devices or across multiple devices for comprehensive testing.
|
|
48
48
|
*
|
|
49
|
-
* @group Development:
|
|
49
|
+
* @group Development:142
|
|
50
50
|
*
|
|
51
51
|
* @example
|
|
52
52
|
* ```bash
|
|
@@ -17,7 +17,7 @@ const appletTestUploadCommand_1 = require("./Upload/appletTestUploadCommand");
|
|
|
17
17
|
* Provides commands for testing applets on the signageOS platform, including
|
|
18
18
|
* uploading test configurations and running remote tests on actual devices.
|
|
19
19
|
*
|
|
20
|
-
* @group Development:
|
|
20
|
+
* @group Development:14
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```bash
|
|
@@ -40,7 +40,7 @@ export declare const OPTION_LIST: readonly [{
|
|
|
40
40
|
* The upload process validates package.json requirements, creates or updates applet versions,
|
|
41
41
|
* and handles file packaging according to .sosignore, .npmignore, and .gitignore rules.
|
|
42
42
|
*
|
|
43
|
-
* @group Development:
|
|
43
|
+
* @group Development:15
|
|
44
44
|
*
|
|
45
45
|
* @example
|
|
46
46
|
* ```bash
|
|
@@ -61,7 +61,7 @@ exports.OPTION_LIST = [
|
|
|
61
61
|
* The upload process validates package.json requirements, creates or updates applet versions,
|
|
62
62
|
* and handles file packaging according to .sosignore, .npmignore, and .gitignore rules.
|
|
63
63
|
*
|
|
64
|
-
* @group Development:
|
|
64
|
+
* @group Development:15
|
|
65
65
|
*
|
|
66
66
|
* @example
|
|
67
67
|
* ```bash
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Provides comprehensive commands for the complete applet development lifecycle including
|
|
3
3
|
* project generation, development, building, testing, uploading, and deployment to signageOS devices.
|
|
4
4
|
*
|
|
5
|
-
* @group Development:
|
|
5
|
+
* @group Development:100
|
|
6
6
|
*
|
|
7
7
|
* @subcommands
|
|
8
8
|
* - `generate` - Create a new applet project with boilerplate code
|
|
@@ -20,7 +20,7 @@ const appletBuildCommand_1 = require("./Build/appletBuildCommand");
|
|
|
20
20
|
* Provides comprehensive commands for the complete applet development lifecycle including
|
|
21
21
|
* project generation, development, building, testing, uploading, and deployment to signageOS devices.
|
|
22
22
|
*
|
|
23
|
-
* @group Development:
|
|
23
|
+
* @group Development:100
|
|
24
24
|
*
|
|
25
25
|
* @subcommands
|
|
26
26
|
* - `generate` - Create a new applet project with boilerplate code
|
|
@@ -14,5 +14,5 @@ export declare const APPLET_UID_OPTION: {
|
|
|
14
14
|
};
|
|
15
15
|
export declare function getApplet(directoryPath: string): Promise<IApplet>;
|
|
16
16
|
export declare function getAppletVersion(directoryPath: string): Promise<string>;
|
|
17
|
-
export declare function getAppletUid(restApi: RestApi, options: CommandLineOptions<[typeof APPLET_UID_OPTION]
|
|
18
|
-
export declare function getAppletVersionFromApi(restApi: RestApi, appletUid: string): Promise<string>;
|
|
17
|
+
export declare function getAppletUid(restApi: RestApi, options: CommandLineOptions<[typeof APPLET_UID_OPTION]>, skipConfirmation?: boolean): Promise<string>;
|
|
18
|
+
export declare function getAppletVersionFromApi(restApi: RestApi, appletUid: string, skipConfirmation?: boolean): Promise<string>;
|
|
@@ -89,8 +89,8 @@ function getAppletVersion(directoryPath) {
|
|
|
89
89
|
return applet.version;
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
function getAppletUid(
|
|
93
|
-
return __awaiter(this,
|
|
92
|
+
function getAppletUid(restApi_1, options_1) {
|
|
93
|
+
return __awaiter(this, arguments, void 0, function* (restApi, options, skipConfirmation = false) {
|
|
94
94
|
var _a;
|
|
95
95
|
const currentDirectory = process.cwd();
|
|
96
96
|
const currentApplet = yield getApplet(currentDirectory);
|
|
@@ -102,16 +102,21 @@ function getAppletUid(restApi, options) {
|
|
|
102
102
|
appletUid = undefined;
|
|
103
103
|
}
|
|
104
104
|
else if (candidatesOfApplets.length > 1) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
105
|
+
if (skipConfirmation) {
|
|
106
|
+
throw new appletErrors_1.AppletDoesNotExistError(`Multiple applets found with name "${currentApplet.name}". Please specify --applet-uid argument to avoid ambiguity.`);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const response = yield (0, prompts_1.default)({
|
|
110
|
+
type: 'autocomplete',
|
|
111
|
+
name: 'appletUid',
|
|
112
|
+
message: `Select applet to use`,
|
|
113
|
+
choices: candidatesOfApplets.map((applet) => ({
|
|
114
|
+
title: `${applet.name} (${applet.uid})`,
|
|
115
|
+
value: applet.uid,
|
|
116
|
+
})),
|
|
117
|
+
});
|
|
118
|
+
appletUid = response.appletUid;
|
|
119
|
+
}
|
|
115
120
|
}
|
|
116
121
|
else {
|
|
117
122
|
appletUid = (_a = candidatesOfApplets[0]) === null || _a === void 0 ? void 0 : _a.uid;
|
|
@@ -123,14 +128,17 @@ function getAppletUid(restApi, options) {
|
|
|
123
128
|
return appletUid;
|
|
124
129
|
});
|
|
125
130
|
}
|
|
126
|
-
function getAppletVersionFromApi(
|
|
127
|
-
return __awaiter(this,
|
|
131
|
+
function getAppletVersionFromApi(restApi_1, appletUid_1) {
|
|
132
|
+
return __awaiter(this, arguments, void 0, function* (restApi, appletUid, skipConfirmation = false) {
|
|
128
133
|
var _a;
|
|
129
134
|
let appletVersion;
|
|
130
135
|
const appletVersions = yield restApi.applet.version.list(appletUid);
|
|
131
136
|
if (appletVersions.length === 1 && ((_a = appletVersions[0]) === null || _a === void 0 ? void 0 : _a.version)) {
|
|
132
137
|
appletVersion = appletVersions[0].version;
|
|
133
138
|
}
|
|
139
|
+
else if (skipConfirmation) {
|
|
140
|
+
throw new Error('Multiple applet versions found. Please specify the exact version or use interactive mode to select.');
|
|
141
|
+
}
|
|
134
142
|
else {
|
|
135
143
|
const response = yield (0, prompts_1.default)({
|
|
136
144
|
type: 'autocomplete',
|
|
@@ -7,20 +7,14 @@ declare const OPTION_LIST: readonly [{
|
|
|
7
7
|
/**
|
|
8
8
|
* To explicitly enable auth0 authentication add flag --auth0-enabled to command line options
|
|
9
9
|
* { _unknown: [ '--auth0-enabled' ], command: [ 'login' ] }
|
|
10
|
-
*
|
|
11
|
-
* To explicitly enable legacy authentication add flag --legacy-enabled to command line options
|
|
12
|
-
* { _unknown: [ '--legacy-enabled' ], command: [ 'login' ] }
|
|
13
|
-
*
|
|
14
|
-
* Only one from auth0 and legacy authentication can be active at the moment
|
|
15
10
|
*/
|
|
16
|
-
export declare const
|
|
11
|
+
export declare const getIsAuth0Enabled: (options: any) => {
|
|
17
12
|
isAuth0Enabled?: boolean;
|
|
18
|
-
isLegacyEnabled?: boolean;
|
|
19
13
|
};
|
|
20
14
|
/**
|
|
21
15
|
* Handles user authentication using username/email and password credentials.
|
|
22
|
-
* Supports
|
|
23
|
-
*
|
|
16
|
+
* Supports Auth0 authentication method. Stores credentials securely in the
|
|
17
|
+
* ~/.sosrc configuration file for subsequent CLI operations.
|
|
24
18
|
*
|
|
25
19
|
* @group Authentication:1
|
|
26
20
|
*
|
|
@@ -34,7 +28,6 @@ export declare const getIsAuth0OrLegacyEnabled: (options: any) => {
|
|
|
34
28
|
* ```
|
|
35
29
|
*
|
|
36
30
|
* @throws {Error} When username is missing and not provided interactively
|
|
37
|
-
* @throws {Error} When both Auth0 and legacy authentication flags are specified
|
|
38
31
|
*
|
|
39
32
|
* @since 0.3.0
|
|
40
33
|
*/
|
|
@@ -45,7 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.login = exports.
|
|
48
|
+
exports.login = exports.getIsAuth0Enabled = void 0;
|
|
49
49
|
const chalk_1 = __importDefault(require("chalk"));
|
|
50
50
|
const prompts_1 = __importDefault(require("prompts"));
|
|
51
51
|
const debug_1 = __importDefault(require("debug"));
|
|
@@ -62,31 +62,20 @@ const OPTION_LIST = [{ name: 'username', type: String, description: `Username or
|
|
|
62
62
|
/**
|
|
63
63
|
* To explicitly enable auth0 authentication add flag --auth0-enabled to command line options
|
|
64
64
|
* { _unknown: [ '--auth0-enabled' ], command: [ 'login' ] }
|
|
65
|
-
*
|
|
66
|
-
* To explicitly enable legacy authentication add flag --legacy-enabled to command line options
|
|
67
|
-
* { _unknown: [ '--legacy-enabled' ], command: [ 'login' ] }
|
|
68
|
-
*
|
|
69
|
-
* Only one from auth0 and legacy authentication can be active at the moment
|
|
70
65
|
*/
|
|
71
|
-
const
|
|
72
|
-
var _a
|
|
66
|
+
const getIsAuth0Enabled = (options) => {
|
|
67
|
+
var _a;
|
|
73
68
|
const queryParams = {};
|
|
74
69
|
if ((_a = options._unknown) === null || _a === void 0 ? void 0 : _a.includes('--auth0-enabled')) {
|
|
75
70
|
queryParams.isAuth0Enabled = true;
|
|
76
71
|
}
|
|
77
|
-
if ((_b = options._unknown) === null || _b === void 0 ? void 0 : _b.includes('--legacy-enabled')) {
|
|
78
|
-
queryParams.isLegacyEnabled = true;
|
|
79
|
-
}
|
|
80
|
-
if (queryParams.isAuth0Enabled !== undefined && queryParams.isLegacyEnabled !== undefined) {
|
|
81
|
-
throw new Error('Only one override from auth0 and legacy authentication options can be active at the moment.');
|
|
82
|
-
}
|
|
83
72
|
return queryParams;
|
|
84
73
|
};
|
|
85
|
-
exports.
|
|
74
|
+
exports.getIsAuth0Enabled = getIsAuth0Enabled;
|
|
86
75
|
/**
|
|
87
76
|
* Handles user authentication using username/email and password credentials.
|
|
88
|
-
* Supports
|
|
89
|
-
*
|
|
77
|
+
* Supports Auth0 authentication method. Stores credentials securely in the
|
|
78
|
+
* ~/.sosrc configuration file for subsequent CLI operations.
|
|
90
79
|
*
|
|
91
80
|
* @group Authentication:1
|
|
92
81
|
*
|
|
@@ -100,7 +89,6 @@ exports.getIsAuth0OrLegacyEnabled = getIsAuth0OrLegacyEnabled;
|
|
|
100
89
|
* ```
|
|
101
90
|
*
|
|
102
91
|
* @throws {Error} When username is missing and not provided interactively
|
|
103
|
-
* @throws {Error} When both Auth0 and legacy authentication flags are specified
|
|
104
92
|
*
|
|
105
93
|
* @since 0.3.0
|
|
106
94
|
*/
|
|
@@ -133,7 +121,7 @@ exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
133
121
|
name: 'password',
|
|
134
122
|
message: `Type your password used for ${hostToDisplay}`,
|
|
135
123
|
});
|
|
136
|
-
const authQueryParams = (0, exports.
|
|
124
|
+
const authQueryParams = (0, exports.getIsAuth0Enabled)(options);
|
|
137
125
|
const { id: tokenId, securityToken: apiSecurityToken, name, } = yield getOrCreateApiSecurityToken(Object.assign({ identification,
|
|
138
126
|
password,
|
|
139
127
|
apiUrl }, authQueryParams));
|
|
@@ -147,7 +135,7 @@ exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
147
135
|
},
|
|
148
136
|
});
|
|
149
137
|
function getOrCreateApiSecurityToken(_a) {
|
|
150
|
-
return __awaiter(this, arguments, void 0, function* ({ identification, password, apiUrl, isAuth0Enabled,
|
|
138
|
+
return __awaiter(this, arguments, void 0, function* ({ identification, password, apiUrl, isAuth0Enabled, }) {
|
|
151
139
|
var _b;
|
|
152
140
|
const ACCOUNT_SECURITY_TOKEN_RESOURCE = 'account/security-token';
|
|
153
141
|
const options = {
|
|
@@ -156,8 +144,8 @@ function getOrCreateApiSecurityToken(_a) {
|
|
|
156
144
|
version: apiVersions_1.ApiVersions.V1,
|
|
157
145
|
};
|
|
158
146
|
const tokenName = generateTokenName();
|
|
159
|
-
const requestBody = Object.assign(
|
|
160
|
-
password, name: tokenName }, (isAuth0Enabled !== undefined ? { isAuth0AuthenticationEnabled: isAuth0Enabled } : {}))
|
|
147
|
+
const requestBody = Object.assign({ identification,
|
|
148
|
+
password, name: tokenName }, (isAuth0Enabled !== undefined ? { isAuth0AuthenticationEnabled: isAuth0Enabled } : {}));
|
|
161
149
|
const response = yield (0, helper_1.postResource)(options, ACCOUNT_SECURITY_TOKEN_RESOURCE, null, requestBody);
|
|
162
150
|
const responseBody = JSON.parse(yield response.text(), helper_1.deserializeJSON);
|
|
163
151
|
// Don't log sensitive response data
|
|
@@ -6,7 +6,7 @@ export declare const setRootCommand: (rootCommand: ICommand<string, OptionList>)
|
|
|
6
6
|
* This command adds auto-completion scripts and configuration to the user's shell
|
|
7
7
|
* profile, allowing tab completion for commands and sub-commands.
|
|
8
8
|
*
|
|
9
|
-
* @group Tools:
|
|
9
|
+
* @group Tools:11
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```bash
|
|
@@ -25,7 +25,7 @@ exports.setRootCommand = setRootCommand;
|
|
|
25
25
|
* This command adds auto-completion scripts and configuration to the user's shell
|
|
26
26
|
* profile, allowing tab completion for commands and sub-commands.
|
|
27
27
|
*
|
|
28
|
-
* @group Tools:
|
|
28
|
+
* @group Tools:11
|
|
29
29
|
*
|
|
30
30
|
* @example
|
|
31
31
|
* ```bash
|
|
@@ -16,7 +16,7 @@ export const setRootCommand = (rootCommand: ICommand<string, OptionList>): void
|
|
|
16
16
|
* This command adds auto-completion scripts and configuration to the user's shell
|
|
17
17
|
* profile, allowing tab completion for commands and sub-commands.
|
|
18
18
|
*
|
|
19
|
-
* @group Tools:
|
|
19
|
+
* @group Tools:11
|
|
20
20
|
*
|
|
21
21
|
* @example
|
|
22
22
|
* ```bash
|
|
@@ -4,7 +4,7 @@ export declare const OPTION_LIST: readonly [];
|
|
|
4
4
|
* This command reverses the changes made by the install command, removing auto-completion
|
|
5
5
|
* scripts and configuration entries from shell profile files.
|
|
6
6
|
*
|
|
7
|
-
* @group Tools:
|
|
7
|
+
* @group Tools:12
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* ```bash
|
|
@@ -52,7 +52,7 @@ exports.OPTION_LIST = [];
|
|
|
52
52
|
* This command reverses the changes made by the install command, removing auto-completion
|
|
53
53
|
* scripts and configuration entries from shell profile files.
|
|
54
54
|
*
|
|
55
|
-
* @group Tools:
|
|
55
|
+
* @group Tools:12
|
|
56
56
|
*
|
|
57
57
|
* @example
|
|
58
58
|
* ```bash
|
|
@@ -6,7 +6,7 @@ export declare const initializeAutocomplete: (rootCommand: ICommand<string, Opti
|
|
|
6
6
|
* Auto-completion enhances developer productivity by providing intelligent command and
|
|
7
7
|
* sub-command suggestions in supported shells (bash, zsh, fish).
|
|
8
8
|
*
|
|
9
|
-
* @group Tools:
|
|
9
|
+
* @group Tools:300
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```bash
|
|
@@ -24,7 +24,7 @@ exports.initializeAutocomplete = initializeAutocomplete;
|
|
|
24
24
|
* Auto-completion enhances developer productivity by providing intelligent command and
|
|
25
25
|
* sub-command suggestions in supported shells (bash, zsh, fish).
|
|
26
26
|
*
|
|
27
|
-
* @group Tools:
|
|
27
|
+
* @group Tools:300
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
30
|
* ```bash
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { ICommand, ICommandOption, OptionList } from './commandDefinition';
|
|
2
|
+
export declare function preprocessArgv(argv: string[]): string[];
|
|
2
3
|
export declare function processCommand(currentCommand: ICommand<string, OptionList>, parentOptionList?: ICommandOption[], commandIndex?: number): Promise<void>;
|
|
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.preprocessArgv = preprocessArgv;
|
|
15
16
|
exports.processCommand = processCommand;
|
|
16
17
|
const debug_1 = __importDefault(require("debug"));
|
|
17
18
|
const chalk_1 = __importDefault(require("chalk"));
|
|
@@ -20,10 +21,35 @@ const command_line_args_1 = __importDefault(require("command-line-args"));
|
|
|
20
21
|
const packageVersion_1 = require("../Cli/packageVersion");
|
|
21
22
|
const log_1 = require("@signageos/sdk/dist/Console/log");
|
|
22
23
|
const Debug = (0, debug_1.default)('@signageos/cli:Command:processor');
|
|
24
|
+
// Preprocess argv to detect and handle multi-character single-dash options
|
|
25
|
+
function preprocessArgv(argv) {
|
|
26
|
+
// Common multi-character options that users might accidentally use with single dash
|
|
27
|
+
const commonMultiCharOptions = ['yes', 'help', 'version', 'force', 'verbose'];
|
|
28
|
+
return argv.map((arg) => {
|
|
29
|
+
if (arg.startsWith('-') && !arg.startsWith('--') && arg.length > 2) {
|
|
30
|
+
const optionName = arg.substring(1);
|
|
31
|
+
// Throw error for common mistakes to educate users about correct syntax
|
|
32
|
+
if (commonMultiCharOptions.includes(optionName)) {
|
|
33
|
+
throw new Error(`Invalid option '${arg}'. Did you mean '--${optionName}'? Use double dashes for multi-character options.`);
|
|
34
|
+
}
|
|
35
|
+
// Convert multi-character options to double-dash to avoid cryptic errors
|
|
36
|
+
return '--' + optionName;
|
|
37
|
+
}
|
|
38
|
+
return arg;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
23
41
|
function processCommand(currentCommand_1) {
|
|
24
42
|
return __awaiter(this, arguments, void 0, function* (currentCommand, parentOptionList = [], commandIndex = 0) {
|
|
25
43
|
const nestedOptionList = [...parentOptionList, ...currentCommand.optionList];
|
|
44
|
+
// Preprocess argv to handle multi-character single-dash options that should be treated as unknown
|
|
45
|
+
// rather than being split into individual characters
|
|
46
|
+
const preprocessedArgv = preprocessArgv(process.argv);
|
|
47
|
+
const originalArgv = process.argv;
|
|
48
|
+
process.argv = preprocessedArgv;
|
|
49
|
+
// Parse command line options
|
|
26
50
|
const currentOptions = (0, command_line_args_1.default)(nestedOptionList, { partial: true });
|
|
51
|
+
// Restore original argv
|
|
52
|
+
process.argv = originalArgv;
|
|
27
53
|
Debug('process', currentOptions);
|
|
28
54
|
const subCommandName = currentOptions.command[commandIndex];
|
|
29
55
|
const subCommand = currentCommand.commands.find((command) => command.name === subCommandName);
|
|
@@ -31,6 +57,58 @@ function processCommand(currentCommand_1) {
|
|
|
31
57
|
yield processCommand(subCommand, nestedOptionList, commandIndex + 1);
|
|
32
58
|
}
|
|
33
59
|
else {
|
|
60
|
+
// Only validate unknown options when we're at a leaf command (no subcommands to process)
|
|
61
|
+
// Validate unknown options - but handle the case where single-dash multi-char options
|
|
62
|
+
// are split into individual characters by command-line-args
|
|
63
|
+
if (currentOptions._unknown && currentOptions._unknown.length > 0) {
|
|
64
|
+
const unknownOptions = currentOptions._unknown.filter((opt) => opt.startsWith('-'));
|
|
65
|
+
if (unknownOptions.length > 0) {
|
|
66
|
+
// Get the remaining args after the commands (skip the command path)
|
|
67
|
+
const originalArgs = process.argv.slice(2);
|
|
68
|
+
const commandArgs = currentOptions.command || [];
|
|
69
|
+
const optionArgs = originalArgs.slice(commandArgs.length);
|
|
70
|
+
Debug('originalArgs', originalArgs);
|
|
71
|
+
Debug('commandArgs', commandArgs);
|
|
72
|
+
Debug('optionArgs', optionArgs);
|
|
73
|
+
const realUnknownOptions = [];
|
|
74
|
+
// Find actual unknown options in the remaining arguments
|
|
75
|
+
for (const arg of optionArgs) {
|
|
76
|
+
if (arg.startsWith('-') && !arg.startsWith('--')) {
|
|
77
|
+
// This is a single-dash option, check if it's known
|
|
78
|
+
const optionName = arg.substring(1);
|
|
79
|
+
const knownOption = nestedOptionList.find((opt) => opt.alias === optionName || opt.name === optionName);
|
|
80
|
+
if (!knownOption && optionName.length > 1) {
|
|
81
|
+
// This is an unknown multi-character single-dash option
|
|
82
|
+
realUnknownOptions.push(arg);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else if (arg.startsWith('--')) {
|
|
86
|
+
// This is a double-dash option, check if it's known
|
|
87
|
+
const optionName = arg.substring(2);
|
|
88
|
+
const knownOption = nestedOptionList.find((opt) => opt.name === optionName);
|
|
89
|
+
if (!knownOption) {
|
|
90
|
+
realUnknownOptions.push(arg);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// If we found actual unknown options, use those instead
|
|
95
|
+
if (realUnknownOptions.length > 0) {
|
|
96
|
+
throw new Error(`Unknown option(s): ${realUnknownOptions.join(', ')}`);
|
|
97
|
+
}
|
|
98
|
+
else if (unknownOptions.length > 0) {
|
|
99
|
+
// Fall back to the parsed unknown options if we couldn't determine the real ones
|
|
100
|
+
throw new Error(`Unknown option(s): ${unknownOptions.join(', ')}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Check if there was an unknown subcommand provided
|
|
105
|
+
if (subCommandName && currentCommand.commands.length > 0) {
|
|
106
|
+
throw new Error(`Unknown command: '${subCommandName}'`);
|
|
107
|
+
}
|
|
108
|
+
// Check if there are extra arguments when no subcommands are expected
|
|
109
|
+
if (subCommandName && currentCommand.commands.length === 0) {
|
|
110
|
+
throw new Error(`Unknown argument: '${subCommandName}'. This command does not accept subcommands.`);
|
|
111
|
+
}
|
|
34
112
|
if (currentOptions.help) {
|
|
35
113
|
printUsage(currentCommand, nestedOptionList);
|
|
36
114
|
}
|