@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.
Files changed (122) hide show
  1. package/README.md +54 -0
  2. package/dist/Applet/Build/appletBuildCommand.d.ts +1 -2
  3. package/dist/Applet/Build/appletBuildCommand.js +1 -2
  4. package/dist/Applet/Generate/appletGenerateCommand.d.ts +1 -1
  5. package/dist/Applet/Generate/appletGenerateCommand.js +6 -6
  6. package/dist/Applet/Start/appletStartCommand.d.ts +1 -1
  7. package/dist/Applet/Start/appletStartCommand.js +1 -1
  8. package/dist/Applet/Test/Upload/appletTestRunCommand.d.ts +1 -1
  9. package/dist/Applet/Test/Upload/appletTestRunCommand.js +1 -1
  10. package/dist/Applet/Test/Upload/appletTestUploadCommand.d.ts +1 -1
  11. package/dist/Applet/Test/Upload/appletTestUploadCommand.js +1 -1
  12. package/dist/Applet/Test/appletTestCommand.d.ts +1 -1
  13. package/dist/Applet/Test/appletTestCommand.js +1 -1
  14. package/dist/Applet/Upload/appletUploadCommand.d.ts +1 -1
  15. package/dist/Applet/Upload/appletUploadCommand.js +1 -1
  16. package/dist/Applet/appletCommand.d.ts +1 -1
  17. package/dist/Applet/appletCommand.js +1 -1
  18. package/dist/Applet/appletFacade.d.ts +2 -2
  19. package/dist/Applet/appletFacade.js +22 -14
  20. package/dist/Auth/loginCommand.d.ts +3 -10
  21. package/dist/Auth/loginCommand.js +10 -22
  22. package/dist/Command/Autocomplete/Install/installAutocompleteCommand.d.ts +1 -1
  23. package/dist/Command/Autocomplete/Install/installAutocompleteCommand.js +1 -1
  24. package/dist/Command/Autocomplete/Install/installAutocompleteCommand.ts +1 -1
  25. package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.d.ts +1 -1
  26. package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.js +1 -1
  27. package/dist/Command/Autocomplete/autocompleteCommand.d.ts +1 -1
  28. package/dist/Command/Autocomplete/autocompleteCommand.js +1 -1
  29. package/dist/Command/commandProcessor.d.ts +1 -0
  30. package/dist/Command/commandProcessor.js +78 -0
  31. package/dist/Command/globalArgs.d.ts +0 -2
  32. package/dist/Command/globalArgs.js +0 -2
  33. package/dist/CustomScript/Generate/customScriptGenerateCommand.d.ts +32 -8
  34. package/dist/CustomScript/Generate/customScriptGenerateCommand.js +17 -9
  35. package/dist/CustomScript/Generate/customScriptGenerateFacade.d.ts +7 -5
  36. package/dist/CustomScript/Generate/customScriptGenerateFacade.js +81 -32
  37. package/dist/CustomScript/Generate/customScriptGenerateOptions.d.ts +17 -0
  38. package/dist/CustomScript/Generate/customScriptGenerateOptions.js +13 -0
  39. package/dist/CustomScript/Upload/customScriptUploadCommand.d.ts +15 -19
  40. package/dist/CustomScript/Upload/customScriptUploadCommand.js +15 -19
  41. package/dist/CustomScript/customScriptCommand.d.ts +27 -9
  42. package/dist/CustomScript/customScriptCommand.js +9 -7
  43. package/dist/Device/Connect/connectCommand.d.ts +1 -1
  44. package/dist/Device/Connect/connectCommand.js +1 -1
  45. package/dist/Device/Content/setContentCommand.d.ts +16 -6
  46. package/dist/Device/Content/setContentCommand.js +23 -10
  47. package/dist/Device/PowerAction/powerActionCommand.d.ts +1 -1
  48. package/dist/Device/PowerAction/powerActionCommand.js +1 -1
  49. package/dist/Device/deviceCommand.d.ts +9 -1
  50. package/dist/Device/deviceCommand.js +1 -1
  51. package/dist/Device/deviceFacade.d.ts +1 -1
  52. package/dist/Device/deviceFacade.js +23 -18
  53. package/dist/Organization/Get/organizationGetCommand.d.ts +1 -1
  54. package/dist/Organization/Get/organizationGetCommand.js +1 -1
  55. package/dist/Organization/List/organizationListCommand.d.ts +1 -1
  56. package/dist/Organization/List/organizationListCommand.js +1 -1
  57. package/dist/Organization/SetDefault/organizationSetDefaultCommand.d.ts +1 -1
  58. package/dist/Organization/SetDefault/organizationSetDefaultCommand.js +1 -1
  59. package/dist/Organization/organizationCommand.d.ts +1 -1
  60. package/dist/Organization/organizationCommand.js +1 -1
  61. package/dist/Plugin/Generate/pluginGenerateCommand.d.ts +36 -2
  62. package/dist/Plugin/Generate/pluginGenerateCommand.js +25 -3
  63. package/dist/Plugin/Generate/pluginGenerateFacade.d.ts +7 -5
  64. package/dist/Plugin/Generate/pluginGenerateFacade.js +38 -16
  65. package/dist/Plugin/Generate/pluginGenerateOptions.d.ts +13 -0
  66. package/dist/Plugin/Generate/pluginGenerateOptions.js +20 -0
  67. package/dist/Plugin/Upload/pluginUploadCommand.d.ts +28 -0
  68. package/dist/Plugin/Upload/pluginUploadCommand.js +31 -2
  69. package/dist/Plugin/pluginCommand.d.ts +49 -2
  70. package/dist/Plugin/pluginCommand.js +31 -0
  71. package/dist/Plugin/pluginFacade.d.ts +1 -1
  72. package/dist/Plugin/pluginFacade.js +29 -19
  73. package/dist/Runner/Generate/runnerGenerateCommand.d.ts +36 -2
  74. package/dist/Runner/Generate/runnerGenerateCommand.js +25 -3
  75. package/dist/Runner/Generate/runnerGenerateFacade.d.ts +7 -5
  76. package/dist/Runner/Generate/runnerGenerateFacade.js +38 -16
  77. package/dist/Runner/Generate/runnerGenerateOptions.d.ts +13 -0
  78. package/dist/Runner/Generate/runnerGenerateOptions.js +20 -0
  79. package/dist/Runner/Upload/runnerUploadCommand.d.ts +28 -0
  80. package/dist/Runner/Upload/runnerUploadCommand.js +31 -2
  81. package/dist/Runner/runnerCommand.d.ts +41 -2
  82. package/dist/Runner/runnerCommand.js +23 -0
  83. package/dist/Runner/runnerFacede.d.ts +1 -1
  84. package/dist/Runner/runnerFacede.js +29 -19
  85. package/dist/Timing/List/timingListCommand.d.ts +1 -1
  86. package/dist/Timing/List/timingListCommand.js +1 -1
  87. package/dist/Timing/timingCommand.d.ts +1 -1
  88. package/dist/Timing/timingCommand.js +1 -1
  89. package/dist/index.js +2 -1
  90. package/docs/applet/build/index.md +1 -1
  91. package/docs/applet/generate/index.md +1 -1
  92. package/docs/applet/index.md +1 -1
  93. package/docs/applet/start/index.md +1 -1
  94. package/docs/applet/test/index.md +1 -1
  95. package/docs/applet/test/run/index.md +1 -1
  96. package/docs/applet/test/upload/index.md +1 -1
  97. package/docs/applet/upload/index.md +1 -1
  98. package/docs/autocomplete/index.md +1 -1
  99. package/docs/autocomplete/install/index.md +1 -1
  100. package/docs/autocomplete/uninstall/index.md +1 -1
  101. package/docs/custom-script/generate/index.md +20 -6
  102. package/docs/custom-script/index.md +9 -7
  103. package/docs/custom-script/upload/index.md +14 -13
  104. package/docs/device/connect/index.md +1 -1
  105. package/docs/device/index.md +1 -1
  106. package/docs/device/power-action/index.md +1 -1
  107. package/docs/device/set-content/index.md +12 -8
  108. package/docs/index.md +20 -4
  109. package/docs/login/index.md +2 -2
  110. package/docs/organization/get/index.md +1 -1
  111. package/docs/organization/index.md +1 -1
  112. package/docs/organization/list/index.md +1 -1
  113. package/docs/organization/set-default/index.md +1 -1
  114. package/docs/plugin/generate/index.md +31 -1
  115. package/docs/plugin/index.md +34 -1
  116. package/docs/plugin/upload/index.md +28 -5
  117. package/docs/runner/generate/index.md +31 -1
  118. package/docs/runner/index.md +26 -1
  119. package/docs/runner/upload/index.md +28 -5
  120. package/docs/timing/index.md +1 -1
  121. package/docs/timing/list/index.md +1 -1
  122. package/package.json +3 -2
@@ -29,7 +29,5 @@ export declare function getGlobalApiUrl(): string | undefined;
29
29
  * # Use staging profile
30
30
  * sos --profile staging device connect
31
31
  * ```
32
- *
33
- * @since 1.0.0
34
32
  */
35
33
  export declare function getGlobalProfile(): string;
@@ -41,8 +41,6 @@ function getGlobalApiUrl() {
41
41
  * # Use staging profile
42
42
  * sos --profile staging device connect
43
43
  * ```
44
- *
45
- * @since 1.0.0
46
44
  */
47
45
  function getGlobalProfile() {
48
46
  const options = (0, command_line_args_1.default)([generalCommand_1.PROFILE_OPTION], { partial: true });
@@ -1,26 +1,50 @@
1
+ import { CommandLineOptions } from '../../Command/commandDefinition';
2
+ import { OPTION_LIST } from './customScriptGenerateOptions';
1
3
  /**
2
4
  * Creates a new custom script project with boilerplate code and configuration files.
3
- * This command sets up a complete development environment for custom script development,
4
- * including necessary dependencies and project structure.
5
+ * Generates `.sosconfig.json`, platform directories, and sample implementations.
5
6
  *
6
- * @group Development:1
7
+ * Requires: name, description, dangerLevel (low/medium/high/critical).
8
+ *
9
+ * @group Development:21
7
10
  *
8
11
  * @example
9
12
  * ```bash
10
- * # Generate custom script project
13
+ * # Interactive generation
11
14
  * sos custom-script generate
15
+ *
16
+ * # Non-interactive (CI/CD)
17
+ * sos custom-script generate --name brightness-control --description "Device brightness" --danger-level low --yes
12
18
  * ```
13
19
  *
14
- * @see {@link https://developers.signageos.io/docs/custom-scripts/ Custom Scripts Documentation}
20
+ * @throws {Error} When git is not installed or parameters missing in non-interactive mode
15
21
  *
16
- * @see {@link ../upload/ Upload custom script command}
22
+ * @see {@link https://developers.signageos.io/docs/custom-scripts/ Documentation}
23
+ * @see {@link https://developers.signageos.io/docs/custom-scripts/#config-file Config File}
24
+ * @see {@link ../upload/ Upload command}
17
25
  *
18
26
  * @since 2.2.0
19
27
  */
20
28
  export declare const customScriptGenerate: {
21
29
  name: "generate";
22
30
  description: string;
23
- optionList: never[];
31
+ optionList: readonly [{
32
+ readonly name: "name";
33
+ readonly type: StringConstructor;
34
+ readonly description: "Custom script name";
35
+ }, {
36
+ readonly name: "description";
37
+ readonly type: StringConstructor;
38
+ readonly description: "Custom script description";
39
+ }, {
40
+ readonly name: "danger-level";
41
+ readonly type: StringConstructor;
42
+ readonly description: "Danger level - Can be one of the following: low, medium, high, critical. It represents the danger level of the Custom Script. It should be set according to the potential impact of the Custom Script on the device.";
43
+ }, {
44
+ readonly name: "yes";
45
+ readonly type: BooleanConstructor;
46
+ readonly description: "Skip confirmation prompts and use provided values";
47
+ }];
24
48
  commands: never[];
25
- run(): Promise<void>;
49
+ run(options: CommandLineOptions<typeof OPTION_LIST>): Promise<void>;
26
50
  };
@@ -19,34 +19,42 @@ const commandDefinition_1 = require("../../Command/commandDefinition");
19
19
  const customScriptFacade_1 = require("../customScriptFacade");
20
20
  const customScriptGenerateFacade_1 = require("./customScriptGenerateFacade");
21
21
  const git_1 = require("../../Lib/git");
22
+ const customScriptGenerateOptions_1 = require("./customScriptGenerateOptions");
22
23
  /**
23
24
  * Creates a new custom script project with boilerplate code and configuration files.
24
- * This command sets up a complete development environment for custom script development,
25
- * including necessary dependencies and project structure.
25
+ * Generates `.sosconfig.json`, platform directories, and sample implementations.
26
26
  *
27
- * @group Development:1
27
+ * Requires: name, description, dangerLevel (low/medium/high/critical).
28
+ *
29
+ * @group Development:21
28
30
  *
29
31
  * @example
30
32
  * ```bash
31
- * # Generate custom script project
33
+ * # Interactive generation
32
34
  * sos custom-script generate
35
+ *
36
+ * # Non-interactive (CI/CD)
37
+ * sos custom-script generate --name brightness-control --description "Device brightness" --danger-level low --yes
33
38
  * ```
34
39
  *
35
- * @see {@link https://developers.signageos.io/docs/custom-scripts/ Custom Scripts Documentation}
40
+ * @throws {Error} When git is not installed or parameters missing in non-interactive mode
36
41
  *
37
- * @see {@link ../upload/ Upload custom script command}
42
+ * @see {@link https://developers.signageos.io/docs/custom-scripts/ Documentation}
43
+ * @see {@link https://developers.signageos.io/docs/custom-scripts/#config-file Config File}
44
+ * @see {@link ../upload/ Upload command}
38
45
  *
39
46
  * @since 2.2.0
40
47
  */
41
48
  exports.customScriptGenerate = (0, commandDefinition_1.createCommandDefinition)({
42
49
  name: 'generate',
43
50
  description: 'Generate a local repository for developing a Custom Script',
44
- optionList: [],
51
+ optionList: customScriptGenerateOptions_1.OPTION_LIST,
45
52
  commands: [],
46
- run() {
53
+ run(options) {
47
54
  return __awaiter(this, void 0, void 0, function* () {
48
55
  yield (0, git_1.throwErrorIfGitNotInstalled)();
49
- const { targetDir, name, description, dangerLevel } = yield (0, customScriptGenerateFacade_1.askForParameters)();
56
+ const skipConfirmation = !!options.yes;
57
+ const { targetDir, name, description, dangerLevel } = yield (0, customScriptGenerateFacade_1.askForParameters)(options, skipConfirmation);
50
58
  yield (0, customScriptGenerateFacade_1.downloadBoilerplateCode)(targetDir);
51
59
  yield (0, customScriptFacade_1.addToConfigFile)(targetDir, { name, description, dangerLevel });
52
60
  (0, log_1.log)('info', `Custom Script ${chalk_1.default.green(name)} has been generated in ${chalk_1.default.green(targetDir)}.`);
@@ -1,11 +1,13 @@
1
+ import { CommandLineOptions } from '../../Command/commandDefinition';
2
+ import { OPTION_LIST } from './customScriptGenerateOptions';
1
3
  /**
2
4
  * Prompts the user for the parameters needed to generate a custom script.
3
5
  */
4
- export declare function askForParameters(): Promise<{
5
- targetDir: any;
6
- name: any;
7
- description: any;
8
- dangerLevel: any;
6
+ export declare function askForParameters(options?: CommandLineOptions<typeof OPTION_LIST>, skipConfirmation?: boolean): Promise<{
7
+ targetDir: string;
8
+ name: string;
9
+ description: string;
10
+ dangerLevel: string;
9
11
  }>;
10
12
  /**
11
13
  * Downloads the latest version of the boilerplate code from the GitHub repository.
@@ -56,47 +56,96 @@ const git_1 = require("../../Lib/git");
56
56
  /**
57
57
  * Prompts the user for the parameters needed to generate a custom script.
58
58
  */
59
- function askForParameters() {
60
- return __awaiter(this, void 0, void 0, function* () {
59
+ function askForParameters(options_1) {
60
+ return __awaiter(this, arguments, void 0, function* (options, skipConfirmation = false) {
61
61
  const throwCanceledError = () => {
62
62
  throw new Error('Custom Script generation was canceled.');
63
63
  };
64
- const { name, description, dangerLevel } = yield (0, prompts_1.default)([
65
- {
66
- type: 'text',
67
- name: 'name',
68
- message: 'Type name',
69
- },
70
- {
71
- type: 'text',
72
- name: 'description',
73
- message: 'Type description',
74
- },
75
- {
76
- type: 'select',
77
- name: 'dangerLevel',
78
- message: 'Select danger level',
79
- choices: [
80
- { title: 'Low', value: 'low' },
81
- { title: 'Medium', value: 'medium' },
82
- { title: 'High', value: 'high' },
83
- { title: 'Critical', value: 'critical' },
84
- ],
85
- },
86
- ], { onCancel: throwCanceledError });
64
+ // Get values from options or prompt for them
65
+ let name = options === null || options === void 0 ? void 0 : options.name;
66
+ let description = options === null || options === void 0 ? void 0 : options.description;
67
+ let dangerLevel = options === null || options === void 0 ? void 0 : options['danger-level'];
68
+ // Validate danger level if provided
69
+ const validDangerLevels = ['low', 'medium', 'high', 'critical'];
70
+ if (dangerLevel && !validDangerLevels.includes(dangerLevel)) {
71
+ throw new Error(`Invalid danger level '${dangerLevel}'. Must be one of: ${validDangerLevels.join(', ')}`);
72
+ }
73
+ // If --yes is used, validate all required fields are present without prompting
74
+ if (skipConfirmation) {
75
+ if (!name) {
76
+ throw new Error('Name is required when using --yes. Provide it via --name option.');
77
+ }
78
+ if (!description) {
79
+ throw new Error('Description is required when using --yes. Provide it via --description option.');
80
+ }
81
+ if (!dangerLevel) {
82
+ throw new Error('Danger level is required when using --yes. Provide it via --danger-level option.');
83
+ }
84
+ }
85
+ else {
86
+ // Only prompt for missing values when not using --yes
87
+ const promptQuestions = [];
88
+ if (!name) {
89
+ promptQuestions.push({
90
+ type: 'text',
91
+ name: 'name',
92
+ message: 'Type name',
93
+ });
94
+ }
95
+ if (!description) {
96
+ promptQuestions.push({
97
+ type: 'text',
98
+ name: 'description',
99
+ message: 'Type description',
100
+ });
101
+ }
102
+ if (!dangerLevel) {
103
+ promptQuestions.push({
104
+ type: 'select',
105
+ name: 'dangerLevel',
106
+ message: 'Select danger level',
107
+ choices: [
108
+ { title: 'Low', value: 'low' },
109
+ { title: 'Medium', value: 'medium' },
110
+ { title: 'High', value: 'high' },
111
+ { title: 'Critical', value: 'critical' },
112
+ ],
113
+ });
114
+ }
115
+ // Only prompt if there are questions to ask
116
+ if (promptQuestions.length > 0) {
117
+ const responses = yield (0, prompts_1.default)(promptQuestions, { onCancel: throwCanceledError });
118
+ name = name || responses.name;
119
+ description = description || responses.description;
120
+ dangerLevel = dangerLevel || responses.dangerLevel;
121
+ }
122
+ // Validate all required fields are present after prompting
123
+ if (!name) {
124
+ throw new Error('Name is required. Provide it via --name option or interactively.');
125
+ }
126
+ if (!description) {
127
+ throw new Error('Description is required. Provide it via --description option or interactively.');
128
+ }
129
+ if (!dangerLevel) {
130
+ throw new Error('Danger level is required. Provide it via --danger-level option or interactively.');
131
+ }
132
+ }
87
133
  const targetDir = name;
88
134
  (0, log_1.log)('info', `Generating Custom Script with these parameters:\n` +
89
135
  ` - Directory: ${chalk_1.default.green(targetDir)}\n` +
90
136
  ` - Name: ${chalk_1.default.green(name)}\n` +
91
137
  ` - Description: ${chalk_1.default.green(description)}\n` +
92
138
  ` - Danger Level: ${chalk_1.default.green(dangerLevel)}\n`);
93
- const { confirm } = yield (0, prompts_1.default)({
94
- type: 'confirm',
95
- name: 'confirm',
96
- message: 'Confirm',
97
- });
98
- if (!confirm) {
99
- throwCanceledError();
139
+ // Skip confirmation if --yes flag is used
140
+ if (!skipConfirmation) {
141
+ const { confirm } = yield (0, prompts_1.default)({
142
+ type: 'confirm',
143
+ name: 'confirm',
144
+ message: 'Confirm',
145
+ });
146
+ if (!confirm) {
147
+ throwCanceledError();
148
+ }
100
149
  }
101
150
  return {
102
151
  targetDir,
@@ -0,0 +1,17 @@
1
+ export declare const OPTION_LIST: readonly [{
2
+ readonly name: "name";
3
+ readonly type: StringConstructor;
4
+ readonly description: "Custom script name";
5
+ }, {
6
+ readonly name: "description";
7
+ readonly type: StringConstructor;
8
+ readonly description: "Custom script description";
9
+ }, {
10
+ readonly name: "danger-level";
11
+ readonly type: StringConstructor;
12
+ readonly description: "Danger level - Can be one of the following: low, medium, high, critical. It represents the danger level of the Custom Script. It should be set according to the potential impact of the Custom Script on the device.";
13
+ }, {
14
+ readonly name: "yes";
15
+ readonly type: BooleanConstructor;
16
+ readonly description: "Skip confirmation prompts and use provided values";
17
+ }];
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OPTION_LIST = void 0;
4
+ exports.OPTION_LIST = [
5
+ { name: 'name', type: String, description: 'Custom script name' },
6
+ { name: 'description', type: String, description: 'Custom script description' },
7
+ {
8
+ name: 'danger-level',
9
+ type: String,
10
+ description: 'Danger level - Can be one of the following: low, medium, high, critical. It represents the danger level of the Custom Script. It should be set according to the potential impact of the Custom Script on the device.',
11
+ },
12
+ { name: 'yes', type: Boolean, description: 'Skip confirmation prompts and use provided values' },
13
+ ];
@@ -13,35 +13,31 @@ export declare const OPTION_LIST: readonly [{
13
13
  readonly description: "Allow to upload new custom script or create new version without confirmation step";
14
14
  }];
15
15
  /**
16
- * Uploads custom script code and configuration to the signageOS platform based on
17
- * the .sosconfig.json configuration file. Custom Scripts enable advanced device
18
- * functionality beyond standard applets, including system-level operations and
19
- * device-specific configurations for multiple platforms.
16
+ * Uploads custom script code and configuration to signageOS platform from `.sosconfig.json`.
17
+ * Creates/updates script, uploads platform-specific files, and provides script UID for execution.
20
18
  *
21
- * @group Development:2
19
+ * May prompt for confirmation when creating new scripts or versions.
20
+ * Use `--yes` to skip prompts for automated deployments.
21
+ *
22
+ * @group Development:22
22
23
  *
23
24
  * @example
24
25
  * ```bash
25
- * # Upload custom script from current directory
26
+ * # Upload interactively
26
27
  * sos custom-script upload
27
28
  *
28
- * # Upload with specific organization
29
- * sos custom-script upload --organization-uid abc123def456
30
- *
31
- * # Skip confirmation prompts (useful for CI/CD)
29
+ * # Skip confirmations (CI/CD)
32
30
  * sos custom-script upload --yes
33
- * ```
34
31
  *
35
- * @throws {Error} When .sosconfig.json is missing or invalid
36
- * @throws {Error} When script platform configuration is missing
37
- * @throws {Error} When organization access is denied
38
- * @throws {Error} When script upload fails
39
- *
40
- * @see {@link https://developers.signageos.io/docs/custom-scripts/ Custom Scripts Documentation}
32
+ * # Specific organization
33
+ * sos custom-script upload --organization-uid abc123def456
34
+ * ```
41
35
  *
42
- * @see {@link ../generate/ Generate custom script project}
36
+ * @throws {Error} When `.sosconfig.json` missing/invalid or upload fails
43
37
  *
44
- * @see {@link ../ Custom Script management commands}
38
+ * @see {@link https://developers.signageos.io/docs/custom-scripts/ Documentation}
39
+ * @see {@link https://developers.signageos.io/api/#tag/DeviceCustom-Script REST API}
40
+ * @see {@link ../generate/ Generate command}
45
41
  *
46
42
  * @since 1.8.0
47
43
  */
@@ -32,35 +32,31 @@ exports.OPTION_LIST = [
32
32
  },
33
33
  ];
34
34
  /**
35
- * Uploads custom script code and configuration to the signageOS platform based on
36
- * the .sosconfig.json configuration file. Custom Scripts enable advanced device
37
- * functionality beyond standard applets, including system-level operations and
38
- * device-specific configurations for multiple platforms.
35
+ * Uploads custom script code and configuration to signageOS platform from `.sosconfig.json`.
36
+ * Creates/updates script, uploads platform-specific files, and provides script UID for execution.
39
37
  *
40
- * @group Development:2
38
+ * May prompt for confirmation when creating new scripts or versions.
39
+ * Use `--yes` to skip prompts for automated deployments.
40
+ *
41
+ * @group Development:22
41
42
  *
42
43
  * @example
43
44
  * ```bash
44
- * # Upload custom script from current directory
45
+ * # Upload interactively
45
46
  * sos custom-script upload
46
47
  *
47
- * # Upload with specific organization
48
- * sos custom-script upload --organization-uid abc123def456
49
- *
50
- * # Skip confirmation prompts (useful for CI/CD)
48
+ * # Skip confirmations (CI/CD)
51
49
  * sos custom-script upload --yes
52
- * ```
53
50
  *
54
- * @throws {Error} When .sosconfig.json is missing or invalid
55
- * @throws {Error} When script platform configuration is missing
56
- * @throws {Error} When organization access is denied
57
- * @throws {Error} When script upload fails
58
- *
59
- * @see {@link https://developers.signageos.io/docs/custom-scripts/ Custom Scripts Documentation}
51
+ * # Specific organization
52
+ * sos custom-script upload --organization-uid abc123def456
53
+ * ```
60
54
  *
61
- * @see {@link ../generate/ Generate custom script project}
55
+ * @throws {Error} When `.sosconfig.json` missing/invalid or upload fails
62
56
  *
63
- * @see {@link ../ Custom Script management commands}
57
+ * @see {@link https://developers.signageos.io/docs/custom-scripts/ Documentation}
58
+ * @see {@link https://developers.signageos.io/api/#tag/DeviceCustom-Script REST API}
59
+ * @see {@link ../generate/ Generate command}
64
60
  *
65
61
  * @since 1.8.0
66
62
  */
@@ -1,20 +1,22 @@
1
1
  /**
2
- * Provides commands for developing and deploying custom scripts to signageOS devices.
3
- * Custom Scripts enable advanced device functionality beyond standard applets,
4
- * including system-level operations and device-specific configurations.
2
+ * Custom Scripts management for advanced device operations.
5
3
  *
6
- * @group Development:5
4
+ * Allows sending OS-specific scripts with native API access to signageOS devices.
5
+ * Supports JavaScript (browser), PowerShell (Windows), Bash/Shell (Linux/Android).
6
+ *
7
+ * @group Development:101
7
8
  *
8
9
  * @example
9
10
  * ```bash
10
- * # Generate new custom script project
11
+ * # Generate new project
11
12
  * sos custom-script generate
12
13
  *
13
- * # Upload custom script to platform
14
+ * # Upload to platform
14
15
  * sos custom-script upload
15
16
  * ```
16
17
  *
17
- * @see {@link https://developers.signageos.io/docs/custom-scripts/ Custom Scripts Documentation}
18
+ * @see {@link https://developers.signageos.io/docs/custom-scripts/ Documentation}
19
+ * @see {@link https://developers.signageos.io/docs/custom-scripts/#config-file Config File}
18
20
  *
19
21
  * @since 1.8.0
20
22
  */
@@ -43,9 +45,25 @@ export declare const customScript: {
43
45
  } | {
44
46
  name: "generate";
45
47
  description: string;
46
- optionList: never[];
48
+ optionList: readonly [{
49
+ readonly name: "name";
50
+ readonly type: StringConstructor;
51
+ readonly description: "Custom script name";
52
+ }, {
53
+ readonly name: "description";
54
+ readonly type: StringConstructor;
55
+ readonly description: "Custom script description";
56
+ }, {
57
+ readonly name: "danger-level";
58
+ readonly type: StringConstructor;
59
+ readonly description: "Danger level - Can be one of the following: low, medium, high, critical. It represents the danger level of the Custom Script. It should be set according to the potential impact of the Custom Script on the device.";
60
+ }, {
61
+ readonly name: "yes";
62
+ readonly type: BooleanConstructor;
63
+ readonly description: "Skip confirmation prompts and use provided values";
64
+ }];
47
65
  commands: never[];
48
- run(): Promise<void>;
66
+ run(options: import("../Command/commandDefinition").CommandLineOptions<typeof import("./Generate/customScriptGenerateOptions").OPTION_LIST>): Promise<void>;
49
67
  })[];
50
68
  run(): Promise<never>;
51
69
  };
@@ -14,22 +14,24 @@ const commandDefinition_1 = require("../Command/commandDefinition");
14
14
  const customScriptUploadCommand_1 = require("./Upload/customScriptUploadCommand");
15
15
  const customScriptGenerateCommand_1 = require("./Generate/customScriptGenerateCommand");
16
16
  /**
17
- * Provides commands for developing and deploying custom scripts to signageOS devices.
18
- * Custom Scripts enable advanced device functionality beyond standard applets,
19
- * including system-level operations and device-specific configurations.
17
+ * Custom Scripts management for advanced device operations.
20
18
  *
21
- * @group Development:5
19
+ * Allows sending OS-specific scripts with native API access to signageOS devices.
20
+ * Supports JavaScript (browser), PowerShell (Windows), Bash/Shell (Linux/Android).
21
+ *
22
+ * @group Development:101
22
23
  *
23
24
  * @example
24
25
  * ```bash
25
- * # Generate new custom script project
26
+ * # Generate new project
26
27
  * sos custom-script generate
27
28
  *
28
- * # Upload custom script to platform
29
+ * # Upload to platform
29
30
  * sos custom-script upload
30
31
  * ```
31
32
  *
32
- * @see {@link https://developers.signageos.io/docs/custom-scripts/ Custom Scripts Documentation}
33
+ * @see {@link https://developers.signageos.io/docs/custom-scripts/ Documentation}
34
+ * @see {@link https://developers.signageos.io/docs/custom-scripts/#config-file Config File}
33
35
  *
34
36
  * @since 1.8.0
35
37
  */
@@ -64,7 +64,7 @@ declare const OPTION_LIST: readonly [{
64
64
  * The command sets up a development server and configures the device to load the applet
65
65
  * from the local machine, enabling hot reload and live debugging capabilities.
66
66
  *
67
- * @group Management:1
67
+ * @group Management:11
68
68
  *
69
69
  * @example
70
70
  * ```bash
@@ -53,7 +53,7 @@ const OPTION_LIST = [
53
53
  * The command sets up a development server and configures the device to load the applet
54
54
  * from the local machine, enabling hot reload and live debugging capabilities.
55
55
  *
56
- * @group Management:1
56
+ * @group Management:11
57
57
  *
58
58
  * @example
59
59
  * ```bash
@@ -15,30 +15,36 @@ declare const OPTION_LIST: readonly [{
15
15
  readonly name: "device-uid";
16
16
  readonly type: StringConstructor;
17
17
  readonly description: "Device UID";
18
+ }, {
19
+ readonly name: "yes";
20
+ readonly type: BooleanConstructor;
21
+ readonly description: "Skip selection prompts (requires explicit device-uid and applet-uid for safety)";
18
22
  }];
19
23
  /**
20
24
  * Deploys an applet to a specific device by creating a timing configuration
21
25
  * that activates the specified applet version on the target device. This command
22
26
  * establishes the applet-to-device relationship for production deployment.
23
27
  *
24
- * @group Management:3
28
+ * @group Management:13
25
29
  *
26
30
  * @example
27
31
  * ```bash
28
- * # Deploy applet to device
32
+ * # Deploy applet to device (interactive, allows selection if multiple versions exist)
29
33
  * sos device set-content --device-uid device123 --applet-uid my-applet
30
34
  *
35
+ * # Skip selection prompts (requires explicit UIDs, fails if multiple versions)
36
+ * sos device set-content --device-uid device123 --applet-uid my-applet --yes
37
+ *
31
38
  * # Deploy with organization override
32
39
  * sos device set-content --device-uid device123 --applet-uid my-applet --organization-uid org456
33
40
  * ```
34
41
  *
42
+ * @throws {Error} When device-uid or applet-uid arguments are missing
43
+ * @throws {Error} When multiple applets/versions exist and --yes is used
35
44
  * @throws {Error} When device or applet cannot be found or accessed
36
- *
37
45
  * @throws {Error} When timing configuration creation fails
38
- *
39
46
  * @throws {Error} When organization access is denied
40
- *
41
- * @throws {Error} When applet version cannot be determined
47
+ * @throws {Error} When user cancels interactive prompts (without `--yes`)
42
48
  *
43
49
  * @since 0.9.0
44
50
  */
@@ -61,6 +67,10 @@ export declare const setContent: {
61
67
  readonly name: "device-uid";
62
68
  readonly type: StringConstructor;
63
69
  readonly description: "Device UID";
70
+ }, {
71
+ readonly name: "yes";
72
+ readonly type: BooleanConstructor;
73
+ readonly description: "Skip selection prompts (requires explicit device-uid and applet-uid for safety)";
64
74
  }];
65
75
  commands: never[];
66
76
  run(options: CommandLineOptions<typeof OPTION_LIST>): Promise<void>;
@@ -20,30 +20,42 @@ const commandDefinition_1 = require("../../Command/commandDefinition");
20
20
  const helper_1 = require("../../helper");
21
21
  const organizationFacade_1 = require("../../Organization/organizationFacade");
22
22
  const deviceFacade_1 = require("../deviceFacade");
23
- const OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, organizationFacade_1.ORGANIZATION_UID_OPTION, appletFacade_1.APPLET_UID_OPTION, deviceFacade_1.DEVICE_UID_OPTION];
23
+ const OPTION_LIST = [
24
+ organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION,
25
+ organizationFacade_1.ORGANIZATION_UID_OPTION,
26
+ appletFacade_1.APPLET_UID_OPTION,
27
+ deviceFacade_1.DEVICE_UID_OPTION,
28
+ {
29
+ name: 'yes',
30
+ type: Boolean,
31
+ description: 'Skip selection prompts (requires explicit device-uid and applet-uid for safety)',
32
+ },
33
+ ];
24
34
  /**
25
35
  * Deploys an applet to a specific device by creating a timing configuration
26
36
  * that activates the specified applet version on the target device. This command
27
37
  * establishes the applet-to-device relationship for production deployment.
28
38
  *
29
- * @group Management:3
39
+ * @group Management:13
30
40
  *
31
41
  * @example
32
42
  * ```bash
33
- * # Deploy applet to device
43
+ * # Deploy applet to device (interactive, allows selection if multiple versions exist)
34
44
  * sos device set-content --device-uid device123 --applet-uid my-applet
35
45
  *
46
+ * # Skip selection prompts (requires explicit UIDs, fails if multiple versions)
47
+ * sos device set-content --device-uid device123 --applet-uid my-applet --yes
48
+ *
36
49
  * # Deploy with organization override
37
50
  * sos device set-content --device-uid device123 --applet-uid my-applet --organization-uid org456
38
51
  * ```
39
52
  *
53
+ * @throws {Error} When device-uid or applet-uid arguments are missing
54
+ * @throws {Error} When multiple applets/versions exist and --yes is used
40
55
  * @throws {Error} When device or applet cannot be found or accessed
41
- *
42
56
  * @throws {Error} When timing configuration creation fails
43
- *
44
57
  * @throws {Error} When organization access is denied
45
- *
46
- * @throws {Error} When applet version cannot be determined
58
+ * @throws {Error} When user cancels interactive prompts (without `--yes`)
47
59
  *
48
60
  * @since 0.9.0
49
61
  */
@@ -57,9 +69,10 @@ exports.setContent = (0, commandDefinition_1.createCommandDefinition)({
57
69
  const organizationUid = yield (0, organizationFacade_1.getOrganizationUidOrDefaultOrSelect)(options);
58
70
  const organization = yield (0, organizationFacade_1.getOrganization)(organizationUid);
59
71
  const restApi = yield (0, helper_1.createOrganizationRestApi)(organization);
60
- const appletUid = yield (0, appletFacade_1.getAppletUid)(restApi, options);
61
- const appletVersion = yield (0, appletFacade_1.getAppletVersionFromApi)(restApi, appletUid);
62
- const deviceUid = yield (0, deviceFacade_1.getDeviceUid)(restApi, options);
72
+ const skipConfirmation = !!options.yes;
73
+ const appletUid = yield (0, appletFacade_1.getAppletUid)(restApi, options, skipConfirmation);
74
+ const appletVersion = yield (0, appletFacade_1.getAppletVersionFromApi)(restApi, appletUid, skipConfirmation);
75
+ const deviceUid = yield (0, deviceFacade_1.getDeviceUid)(restApi, options, skipConfirmation);
63
76
  yield restApi.timing.create({
64
77
  deviceUid: deviceUid,
65
78
  appletUid: appletUid,