@signageos/cli 2.6.0 → 2.6.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.
@@ -7,6 +7,10 @@ export declare const OPTION_LIST: readonly [{
7
7
  readonly name: "organization-uid";
8
8
  readonly type: StringConstructor;
9
9
  readonly description: "Organization UID";
10
+ }, {
11
+ readonly name: "yes";
12
+ readonly type: BooleanConstructor;
13
+ readonly description: "Allow to upload new custom script or create new version without confirmation step";
10
14
  }];
11
15
  /**
12
16
  * Uploads custom script code and configuration to the signageOS platform based on
@@ -23,6 +27,9 @@ export declare const OPTION_LIST: readonly [{
23
27
  *
24
28
  * # Upload with specific organization
25
29
  * sos custom-script upload --organization-uid abc123def456
30
+ *
31
+ * # Skip confirmation prompts (useful for CI/CD)
32
+ * sos custom-script upload --yes
26
33
  * ```
27
34
  *
28
35
  * @throws {Error} When .sosconfig.json is missing or invalid
@@ -49,6 +56,10 @@ export declare const customScriptUpload: {
49
56
  readonly name: "organization-uid";
50
57
  readonly type: StringConstructor;
51
58
  readonly description: "Organization UID";
59
+ }, {
60
+ readonly name: "yes";
61
+ readonly type: BooleanConstructor;
62
+ readonly description: "Allow to upload new custom script or create new version without confirmation step";
52
63
  }];
53
64
  commands: never[];
54
65
  run(options: CommandLineOptions<typeof OPTION_LIST>): Promise<void>;
@@ -22,7 +22,15 @@ const helper_1 = require("../../helper");
22
22
  const organizationFacade_1 = require("../../Organization/organizationFacade");
23
23
  const customScriptFacade_1 = require("../customScriptFacade");
24
24
  const Debug = (0, debug_1.default)('@signageos/cli:CustomScript:Upload:Command');
25
- exports.OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, organizationFacade_1.ORGANIZATION_UID_OPTION];
25
+ exports.OPTION_LIST = [
26
+ organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION,
27
+ organizationFacade_1.ORGANIZATION_UID_OPTION,
28
+ {
29
+ name: 'yes',
30
+ type: Boolean,
31
+ description: `Allow to upload new custom script or create new version without confirmation step`,
32
+ },
33
+ ];
26
34
  /**
27
35
  * Uploads custom script code and configuration to the signageOS platform based on
28
36
  * the .sosconfig.json configuration file. Custom Scripts enable advanced device
@@ -38,6 +46,9 @@ exports.OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, orga
38
46
  *
39
47
  * # Upload with specific organization
40
48
  * sos custom-script upload --organization-uid abc123def456
49
+ *
50
+ * # Skip confirmation prompts (useful for CI/CD)
51
+ * sos custom-script upload --yes
41
52
  * ```
42
53
  *
43
54
  * @throws {Error} When .sosconfig.json is missing or invalid
@@ -65,7 +76,8 @@ exports.customScriptUpload = (0, commandDefinition_1.createCommandDefinition)({
65
76
  const organization = yield (0, organizationFacade_1.getOrganization)(organizationUid);
66
77
  const restApi = yield (0, helper_1.createOrganizationRestApi)(organization);
67
78
  const config = yield (0, customScriptFacade_1.getConfig)(currentDirectory);
68
- const customScriptVersion = yield (0, customScriptFacade_1.ensureCustomScriptVersion)(restApi, config);
79
+ const skipConfirmation = options.yes;
80
+ const customScriptVersion = yield (0, customScriptFacade_1.ensureCustomScriptVersion)(restApi, config, skipConfirmation);
69
81
  for (const platform of Object.keys(config.platforms)) {
70
82
  const platformConfig = config.platforms[platform];
71
83
  if (!platformConfig) {
@@ -33,6 +33,10 @@ export declare const customScript: {
33
33
  readonly name: "organization-uid";
34
34
  readonly type: StringConstructor;
35
35
  readonly description: "Organization UID";
36
+ }, {
37
+ readonly name: "yes";
38
+ readonly type: BooleanConstructor;
39
+ readonly description: "Allow to upload new custom script or create new version without confirmation step";
36
40
  }];
37
41
  commands: never[];
38
42
  run(options: import("../Command/commandDefinition").CommandLineOptions<typeof import("./Upload/customScriptUploadCommand").OPTION_LIST>): Promise<void>;
@@ -101,7 +101,7 @@ export declare function getConfig(workDir: string): Promise<{
101
101
  * Add data to the config file .sosconfig.json
102
102
  */
103
103
  export declare function addToConfigFile(workDir: string, data: Partial<CustomScriptConfig>): Promise<void>;
104
- export declare function ensureCustomScriptVersion(restApi: RestApi, config: CustomScriptConfig): Promise<import("@signageos/sdk/dist/RestApi/CustomScript/Version/CustomScriptVersion").CustomScriptVersion>;
104
+ export declare function ensureCustomScriptVersion(restApi: RestApi, config: CustomScriptConfig, skipConfirmation?: boolean): Promise<import("@signageos/sdk/dist/RestApi/CustomScript/Version/CustomScriptVersion").CustomScriptVersion>;
105
105
  export declare function uploadCode({ restApi, workDir, platform, config, customScriptVersion, }: {
106
106
  restApi: RestApi;
107
107
  workDir: string;
@@ -118,9 +118,9 @@ function loadConfigFromFile(workDir) {
118
118
  function getConfigFilePath(workDir) {
119
119
  return path.join(workDir, CONFIG_FILE_NAME);
120
120
  }
121
- function ensureCustomScriptVersion(restApi, config) {
121
+ function ensureCustomScriptVersion(restApi, config, skipConfirmation) {
122
122
  return __awaiter(this, void 0, void 0, function* () {
123
- const customScript = yield ensureCustomScript(restApi, config);
123
+ const customScript = yield ensureCustomScript(restApi, config, skipConfirmation);
124
124
  const customScriptVersion = yield restApi.customScript.version.get({
125
125
  customScriptUid: customScript.uid,
126
126
  version: config.version,
@@ -128,15 +128,20 @@ function ensureCustomScriptVersion(restApi, config) {
128
128
  if (customScriptVersion) {
129
129
  return customScriptVersion;
130
130
  }
131
- const response = yield (0, prompts_1.default)({
132
- type: 'confirm',
133
- name: 'newVersion',
134
- message: `Do you want to create new custom script version ${config.version}?`,
135
- });
136
- if (!response.newVersion) {
137
- throw new Error('Custom Script version creation was canceled.');
131
+ if (skipConfirmation) {
132
+ (0, log_1.log)('info', chalk_1.default.yellow(`Creating Custom Script version ${config.version}`));
133
+ }
134
+ else {
135
+ const response = yield (0, prompts_1.default)({
136
+ type: 'confirm',
137
+ name: 'newVersion',
138
+ message: `Do you want to create new custom script version ${config.version}?`,
139
+ });
140
+ if (!response.newVersion) {
141
+ throw new Error('Custom Script version creation was canceled.');
142
+ }
143
+ (0, log_1.log)('info', chalk_1.default.yellow(`Creating Custom Script version ${config.version}`));
138
144
  }
139
- (0, log_1.log)('info', chalk_1.default.yellow(`Creating Custom Script version ${config.version}`));
140
145
  return yield restApi.customScript.version.create({
141
146
  customScriptUid: customScript.uid,
142
147
  version: config.version,
@@ -144,7 +149,7 @@ function ensureCustomScriptVersion(restApi, config) {
144
149
  });
145
150
  });
146
151
  }
147
- function ensureCustomScript(restApi, config) {
152
+ function ensureCustomScript(restApi, config, skipConfirmation) {
148
153
  return __awaiter(this, void 0, void 0, function* () {
149
154
  if (config.uid) {
150
155
  const customScript = yield restApi.customScript.get(config.uid);
@@ -159,15 +164,20 @@ function ensureCustomScript(restApi, config) {
159
164
  }
160
165
  throw new Error(`Custom Script with uid "${config.uid}" not found`);
161
166
  }
162
- const response = yield (0, prompts_1.default)({
163
- type: 'confirm',
164
- name: 'create',
165
- message: `Custom Script "${config.name}" does not exist. Do you want to create it?`,
166
- });
167
- if (!response.create) {
168
- throw new Error('Custom Script upload was canceled.');
167
+ if (skipConfirmation) {
168
+ (0, log_1.log)('info', chalk_1.default.yellow(`Creating Custom Script "${config.name}"`));
169
+ }
170
+ else {
171
+ const response = yield (0, prompts_1.default)({
172
+ type: 'confirm',
173
+ name: 'create',
174
+ message: `Custom Script "${config.name}" does not exist. Do you want to create it?`,
175
+ });
176
+ if (!response.create) {
177
+ throw new Error('Custom Script upload was canceled.');
178
+ }
179
+ (0, log_1.log)('info', chalk_1.default.yellow(`Creating Custom Script "${config.name}"`));
169
180
  }
170
- (0, log_1.log)('info', chalk_1.default.yellow(`Creating Custom Script "${config.name}"`));
171
181
  const createdCustomScript = yield restApi.customScript.create({
172
182
  name: config.name,
173
183
  title: config.name, // TODO change
@@ -23,10 +23,11 @@ sos custom-script upload [options]
23
23
 
24
24
  ## Options
25
25
 
26
- | Option | Description |
27
- | --------------------------- | ---------------------------------------------------------------- |
28
- | `--no-default-organization` | Prevent using the defaultOrganizationUid from ~/.sosrc (boolean) |
29
- | `--organization-uid` | Organization UID (string) |
26
+ | Option | Description |
27
+ | --------------------------- | ------------------------------------------------------------------------------------------- |
28
+ | `--no-default-organization` | Prevent using the defaultOrganizationUid from ~/.sosrc (boolean) |
29
+ | `--organization-uid` | Organization UID (string) |
30
+ | `--yes` | Allow to upload new custom script or create new version without confirmation step (boolean) |
30
31
 
31
32
  ## Examples
32
33
 
@@ -36,6 +37,9 @@ sos custom-script upload
36
37
 
37
38
  # Upload with specific organization
38
39
  sos custom-script upload --organization-uid abc123def456
40
+
41
+ # Skip confirmation prompts (useful for CI/CD)
42
+ sos custom-script upload --yes
39
43
  ```
40
44
 
41
45
  ## Since
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signageos/cli",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "main": "./dist/index.js",
5
5
  "author": "signageOS.io <dev@signageos.io>",
6
6
  "files": [