@signageos/cli 2.4.1 → 2.6.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +27 -1
  2. package/dist/Applet/Build/appletBuildCommand.d.ts +28 -2
  3. package/dist/Applet/Build/appletBuildCommand.js +27 -1
  4. package/dist/Applet/Generate/Templates/index.js.template +1 -1
  5. package/dist/Applet/Generate/Templates/tsconfig.js.template +1 -1
  6. package/dist/Applet/Generate/appletGenerateCommand.d.ts +29 -23
  7. package/dist/Applet/Generate/appletGenerateCommand.js +38 -32
  8. package/dist/Applet/Start/appletStartCommand.d.ts +44 -2
  9. package/dist/Applet/Start/appletStartCommand.js +44 -2
  10. package/dist/Applet/Test/Upload/appletTestRunCommand.d.ts +25 -2
  11. package/dist/Applet/Test/Upload/appletTestRunCommand.js +24 -1
  12. package/dist/Applet/Test/Upload/appletTestUploadCommand.d.ts +34 -4
  13. package/dist/Applet/Test/Upload/appletTestUploadCommand.js +32 -2
  14. package/dist/Applet/Test/appletTestCommand.d.ts +23 -6
  15. package/dist/Applet/Test/appletTestCommand.js +17 -0
  16. package/dist/Applet/Upload/appletUploadCommand.d.ts +46 -4
  17. package/dist/Applet/Upload/appletUploadCommand.js +44 -2
  18. package/dist/Applet/Upload/appletUploadFacade.js +3 -3
  19. package/dist/Applet/appletCommand.d.ts +42 -10
  20. package/dist/Applet/appletCommand.js +33 -1
  21. package/dist/Auth/loginCommand.d.ts +23 -2
  22. package/dist/Auth/loginCommand.js +42 -14
  23. package/dist/Command/Autocomplete/Install/installAutocompleteCommand.d.ts +17 -0
  24. package/dist/Command/Autocomplete/Install/installAutocompleteCommand.js +17 -0
  25. package/dist/Command/Autocomplete/Install/installAutocompleteCommand.ts +17 -0
  26. package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.d.ts +17 -0
  27. package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.js +22 -5
  28. package/dist/Command/Autocomplete/autocompleteCommand.d.ts +18 -0
  29. package/dist/Command/Autocomplete/autocompleteCommand.js +19 -1
  30. package/dist/Command/autoComplete.js +2 -2
  31. package/dist/Command/globalArgs.d.ts +33 -0
  32. package/dist/Command/globalArgs.js +33 -0
  33. package/dist/CustomScript/Generate/customScriptGenerateCommand.d.ts +19 -0
  34. package/dist/CustomScript/Generate/customScriptGenerateCommand.js +20 -1
  35. package/dist/CustomScript/Upload/customScriptUploadCommand.d.ts +32 -2
  36. package/dist/CustomScript/Upload/customScriptUploadCommand.js +31 -1
  37. package/dist/CustomScript/customScriptCommand.d.ts +21 -1
  38. package/dist/CustomScript/customScriptCommand.js +20 -0
  39. package/dist/CustomScript/customScriptFacade.d.ts +5 -5
  40. package/dist/CustomScript/customScriptFacade.js +5 -4
  41. package/dist/Device/Connect/connectCommand.d.ts +51 -2
  42. package/dist/Device/Connect/connectCommand.js +50 -1
  43. package/dist/Device/Content/setContentCommand.d.ts +28 -2
  44. package/dist/Device/Content/setContentCommand.js +27 -1
  45. package/dist/Device/PowerAction/powerActionCommand.d.ts +54 -2
  46. package/dist/Device/PowerAction/powerActionCommand.js +52 -0
  47. package/dist/Device/deviceCommand.d.ts +26 -6
  48. package/dist/Device/deviceCommand.js +21 -1
  49. package/dist/Device/deviceFacade.d.ts +1 -1
  50. package/dist/Firmware/Upload/firmwareUploadCommand.d.ts +42 -0
  51. package/dist/Firmware/Upload/firmwareUploadCommand.js +40 -6
  52. package/dist/Firmware/Upload/firmwareUploadFacade.js +1 -1
  53. package/dist/Firmware/firmwareCommand.d.ts +25 -0
  54. package/dist/Firmware/firmwareCommand.js +18 -1
  55. package/dist/Lib/childProcess.js +2 -2
  56. package/dist/Organization/Get/organizationGetCommand.d.ts +31 -2
  57. package/dist/Organization/Get/organizationGetCommand.js +31 -2
  58. package/dist/Organization/List/organizationListCommand.d.ts +20 -0
  59. package/dist/Organization/List/organizationListCommand.js +21 -1
  60. package/dist/Organization/SetDefault/organizationSetDefaultCommand.d.ts +24 -0
  61. package/dist/Organization/SetDefault/organizationSetDefaultCommand.js +25 -1
  62. package/dist/Organization/organizationCommand.d.ts +27 -2
  63. package/dist/Organization/organizationCommand.js +26 -1
  64. package/dist/Organization/organizationFacade.d.ts +2 -2
  65. package/dist/Organization/organizationFacade.js +3 -3
  66. package/dist/Plugin/Generate/pluginGenerateCommand.d.ts +7 -0
  67. package/dist/Plugin/Generate/pluginGenerateCommand.js +38 -0
  68. package/dist/Plugin/Generate/pluginGenerateFacade.d.ts +12 -0
  69. package/dist/Plugin/Generate/pluginGenerateFacade.js +106 -0
  70. package/dist/Plugin/Upload/pluginUploadCommand.d.ts +25 -0
  71. package/dist/Plugin/Upload/pluginUploadCommand.js +70 -0
  72. package/dist/Plugin/pluginCommand.d.ts +27 -0
  73. package/dist/Plugin/pluginCommand.js +26 -0
  74. package/dist/Plugin/pluginFacade.d.ts +62 -0
  75. package/dist/Plugin/pluginFacade.js +251 -0
  76. package/dist/Runner/Generate/runnerGenerateCommand.d.ts +7 -0
  77. package/dist/Runner/Generate/runnerGenerateCommand.js +38 -0
  78. package/dist/Runner/Generate/runnerGenerateFacade.d.ts +12 -0
  79. package/dist/Runner/Generate/runnerGenerateFacade.js +107 -0
  80. package/dist/Runner/Upload/runnerUploadCommand.d.ts +25 -0
  81. package/dist/Runner/Upload/runnerUploadCommand.js +72 -0
  82. package/dist/Runner/runnerCommand.d.ts +27 -0
  83. package/dist/Runner/runnerCommand.js +26 -0
  84. package/dist/Runner/runnerFacede.d.ts +15 -0
  85. package/dist/Runner/runnerFacede.js +234 -0
  86. package/dist/Timing/List/timingListCommand.d.ts +26 -2
  87. package/dist/Timing/List/timingListCommand.js +26 -2
  88. package/dist/Timing/timingCommand.d.ts +17 -2
  89. package/dist/Timing/timingCommand.js +15 -0
  90. package/dist/helper.d.ts +5 -5
  91. package/dist/helper.js +4 -6
  92. package/dist/index.js +26 -2
  93. package/docs/applet/build/index.md +74 -0
  94. package/docs/applet/generate/index.md +118 -0
  95. package/docs/applet/index.md +134 -0
  96. package/docs/applet/start/index.md +104 -0
  97. package/docs/applet/test/index.md +91 -0
  98. package/docs/applet/test/run/index.md +82 -0
  99. package/docs/applet/test/upload/index.md +80 -0
  100. package/docs/applet/upload/index.md +131 -0
  101. package/docs/autocomplete/index.md +92 -0
  102. package/docs/autocomplete/install/index.md +120 -0
  103. package/docs/autocomplete/uninstall/index.md +65 -0
  104. package/docs/custom-script/generate/index.md +66 -0
  105. package/docs/custom-script/index.md +96 -0
  106. package/docs/custom-script/upload/index.md +78 -0
  107. package/docs/device/connect/index.md +148 -0
  108. package/docs/device/index.md +105 -0
  109. package/docs/device/power-action/index.md +130 -0
  110. package/docs/device/set-content/index.md +72 -0
  111. package/docs/index.md +170 -0
  112. package/docs/login/index.md +122 -0
  113. package/docs/organization/get/index.md +79 -0
  114. package/docs/organization/index.md +105 -0
  115. package/docs/organization/list/index.md +65 -0
  116. package/docs/organization/set-default/index.md +74 -0
  117. package/docs/plugin/generate/index.md +43 -0
  118. package/docs/plugin/index.md +72 -0
  119. package/docs/plugin/upload/index.md +50 -0
  120. package/docs/runner/generate/index.md +43 -0
  121. package/docs/runner/index.md +72 -0
  122. package/docs/runner/upload/index.md +50 -0
  123. package/docs/timing/index.md +78 -0
  124. package/docs/timing/list/index.md +71 -0
  125. package/package.json +29 -19
@@ -2,19 +2,48 @@ import { CommandLineOptions } from '../../Command/commandDefinition';
2
2
  declare const OPTION_LIST: readonly [{
3
3
  readonly name: "no-default-organization";
4
4
  readonly type: BooleanConstructor;
5
- readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc which were set using command sos organization set-default";
5
+ readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc";
6
6
  }, {
7
7
  readonly name: "organization-uid";
8
8
  readonly type: StringConstructor;
9
9
  readonly description: "Organization UID";
10
10
  }];
11
+ /**
12
+ * Retrieves and displays detailed information about a specific organization
13
+ * by its UID. If no organization UID is provided, uses the default organization
14
+ * or prompts for selection from available organizations.
15
+ *
16
+ * @group Management:2
17
+ *
18
+ * @example
19
+ * ```bash
20
+ * # Get default organization details
21
+ * sos organization get
22
+ *
23
+ * # Get specific organization by UID
24
+ * sos organization get --organization-uid abc123def456
25
+ *
26
+ * # Force organization selection (skip default)
27
+ * sos organization get --no-default-organization
28
+ * ```
29
+ *
30
+ * @throws {Error} When organization UID cannot be found or accessed
31
+ * @throws {Error} When authentication is not valid or has expired
32
+ * @throws {Error} When no organizations are available for selection
33
+ *
34
+ * @see {@link ../list/ List organizations for selection}
35
+ *
36
+ * @see {@link ../ Organization management commands}
37
+ *
38
+ * @since 0.3.0
39
+ */
11
40
  export declare const organizationGet: {
12
41
  name: "get";
13
42
  description: string;
14
43
  optionList: readonly [{
15
44
  readonly name: "no-default-organization";
16
45
  readonly type: BooleanConstructor;
17
- readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc which were set using command sos organization set-default";
46
+ readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc";
18
47
  }, {
19
48
  readonly name: "organization-uid";
20
49
  readonly type: StringConstructor;
@@ -19,9 +19,38 @@ const commandDefinition_1 = require("../../Command/commandDefinition");
19
19
  const organizationFacade_1 = require("../organizationFacade");
20
20
  const Debug = (0, debug_1.default)('@signageos/cli:Organization:get');
21
21
  const OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, organizationFacade_1.ORGANIZATION_UID_OPTION];
22
+ /**
23
+ * Retrieves and displays detailed information about a specific organization
24
+ * by its UID. If no organization UID is provided, uses the default organization
25
+ * or prompts for selection from available organizations.
26
+ *
27
+ * @group Management:2
28
+ *
29
+ * @example
30
+ * ```bash
31
+ * # Get default organization details
32
+ * sos organization get
33
+ *
34
+ * # Get specific organization by UID
35
+ * sos organization get --organization-uid abc123def456
36
+ *
37
+ * # Force organization selection (skip default)
38
+ * sos organization get --no-default-organization
39
+ * ```
40
+ *
41
+ * @throws {Error} When organization UID cannot be found or accessed
42
+ * @throws {Error} When authentication is not valid or has expired
43
+ * @throws {Error} When no organizations are available for selection
44
+ *
45
+ * @see {@link ../list/ List organizations for selection}
46
+ *
47
+ * @see {@link ../ Organization management commands}
48
+ *
49
+ * @since 0.3.0
50
+ */
22
51
  exports.organizationGet = (0, commandDefinition_1.createCommandDefinition)({
23
52
  name: 'get',
24
- description: 'Get one organization by UID',
53
+ description: 'Get detailed information about a specific organization',
25
54
  optionList: OPTION_LIST,
26
55
  commands: [],
27
56
  run(options) {
@@ -29,7 +58,7 @@ exports.organizationGet = (0, commandDefinition_1.createCommandDefinition)({
29
58
  Debug('Organization get');
30
59
  const organizationUid = yield (0, organizationFacade_1.getOrganizationUidOrDefaultOrSelect)(options);
31
60
  const organization = yield (0, organizationFacade_1.getOrganization)(organizationUid);
32
- console.log(chalk_1.default.yellow(JSON.stringify(organization, undefined, 2)));
61
+ console.info(chalk_1.default.yellow(JSON.stringify(organization, undefined, 2)));
33
62
  });
34
63
  },
35
64
  });
@@ -1,3 +1,23 @@
1
+ /**
2
+ * Retrieves and displays all organizations that the currently authenticated
3
+ * account has access to. This command helps users understand which organizations
4
+ * they can work with and select appropriate targets for other CLI operations.
5
+ *
6
+ * @group Management:1
7
+ *
8
+ * @example
9
+ * ```bash
10
+ * # List all accessible organizations
11
+ * sos organization list
12
+ * ```
13
+ *
14
+ * @throws {Error} When authentication is not valid or has expired
15
+ * @throws {Error} When organization access cannot be determined
16
+ *
17
+ * @see {@link ../get/ Get detailed organization information}
18
+ *
19
+ * @since 0.3.0
20
+ */
1
21
  export declare const organizationList: {
2
22
  name: "list";
3
23
  description: string;
@@ -18,6 +18,26 @@ const debug_1 = __importDefault(require("debug"));
18
18
  const commandDefinition_1 = require("../../Command/commandDefinition");
19
19
  const organizationFacade_1 = require("../organizationFacade");
20
20
  const Debug = (0, debug_1.default)('@signageos/cli:Organization:list');
21
+ /**
22
+ * Retrieves and displays all organizations that the currently authenticated
23
+ * account has access to. This command helps users understand which organizations
24
+ * they can work with and select appropriate targets for other CLI operations.
25
+ *
26
+ * @group Management:1
27
+ *
28
+ * @example
29
+ * ```bash
30
+ * # List all accessible organizations
31
+ * sos organization list
32
+ * ```
33
+ *
34
+ * @throws {Error} When authentication is not valid or has expired
35
+ * @throws {Error} When organization access cannot be determined
36
+ *
37
+ * @see {@link ../get/ Get detailed organization information}
38
+ *
39
+ * @since 0.3.0
40
+ */
21
41
  exports.organizationList = (0, commandDefinition_1.createCommandDefinition)({
22
42
  name: 'list',
23
43
  description: 'List organizations for logged account',
@@ -27,7 +47,7 @@ exports.organizationList = (0, commandDefinition_1.createCommandDefinition)({
27
47
  return __awaiter(this, void 0, void 0, function* () {
28
48
  Debug('Organization list');
29
49
  const organizations = yield (0, organizationFacade_1.getOrganizations)();
30
- console.log(chalk_1.default.yellow(JSON.stringify(organizations, undefined, 2)));
50
+ console.info(chalk_1.default.yellow(JSON.stringify(organizations, undefined, 2)));
31
51
  });
32
52
  },
33
53
  });
@@ -4,6 +4,30 @@ declare const OPTION_LIST: readonly [{
4
4
  readonly type: StringConstructor;
5
5
  readonly description: "Organization UID";
6
6
  }];
7
+ /**
8
+ * Sets a default organization that will be used automatically in subsequent CLI commands
9
+ * that require an organization context. This eliminates the need to specify the organization
10
+ * UID for each command. The default organization is stored in the ~/.sosrc configuration file.
11
+ *
12
+ * @group Management:3
13
+ *
14
+ * @example
15
+ * ```bash
16
+ * # Interactive selection of default organization
17
+ * sos organization set-default
18
+ *
19
+ * # Set specific organization as default
20
+ * sos organization set-default --organization-uid abc123
21
+ * ```
22
+ *
23
+ * @remarks
24
+ * The default organization can be overridden using the SOS_ORGANIZATION_UID environment variable
25
+ * or by using the --organization-uid flag in individual commands.
26
+ *
27
+ * @throws {Error} When organization UID is invalid or inaccessible
28
+ *
29
+ * @since 1.0.0
30
+ */
7
31
  export declare const organizationSetDefault: {
8
32
  name: "set-default";
9
33
  description: string;
@@ -21,9 +21,33 @@ const commandDefinition_1 = require("../../Command/commandDefinition");
21
21
  const log_1 = require("@signageos/sdk/dist/Console/log");
22
22
  const Debug = (0, debug_1.default)('@signageos/cli:Organization:get');
23
23
  const OPTION_LIST = [organizationFacade_1.ORGANIZATION_UID_OPTION];
24
+ /**
25
+ * Sets a default organization that will be used automatically in subsequent CLI commands
26
+ * that require an organization context. This eliminates the need to specify the organization
27
+ * UID for each command. The default organization is stored in the ~/.sosrc configuration file.
28
+ *
29
+ * @group Management:3
30
+ *
31
+ * @example
32
+ * ```bash
33
+ * # Interactive selection of default organization
34
+ * sos organization set-default
35
+ *
36
+ * # Set specific organization as default
37
+ * sos organization set-default --organization-uid abc123
38
+ * ```
39
+ *
40
+ * @remarks
41
+ * The default organization can be overridden using the SOS_ORGANIZATION_UID environment variable
42
+ * or by using the --organization-uid flag in individual commands.
43
+ *
44
+ * @throws {Error} When organization UID is invalid or inaccessible
45
+ *
46
+ * @since 1.0.0
47
+ */
24
48
  exports.organizationSetDefault = (0, commandDefinition_1.createCommandDefinition)({
25
49
  name: 'set-default',
26
- description: 'Set default organization to use',
50
+ description: 'Set a default organization for CLI operations',
27
51
  optionList: OPTION_LIST,
28
52
  commands: [],
29
53
  run(options) {
@@ -1,3 +1,28 @@
1
+ /**
2
+ * Provides commands to manage signageOS organizations including listing available organizations,
3
+ * retrieving organization details, and setting default organization for CLI operations.
4
+ *
5
+ * @group Management:6
6
+ *
7
+ * @subcommands
8
+ * - `list` - List all organizations accessible to the current user
9
+ * - `get` - Get details of a specific organization by UID
10
+ * - `set-default` - Set a default organization for CLI operations
11
+ *
12
+ * @example
13
+ * ```bash
14
+ * # List all organizations
15
+ * sos organization list
16
+ *
17
+ * # Get specific organization details
18
+ * sos organization get --organization-uid abc123
19
+ *
20
+ * # Set default organization
21
+ * sos organization set-default
22
+ * ```
23
+ *
24
+ * @since 0.3.0
25
+ */
1
26
  export declare const organization: {
2
27
  name: "organization";
3
28
  description: string;
@@ -14,7 +39,7 @@ export declare const organization: {
14
39
  optionList: readonly [{
15
40
  readonly name: "no-default-organization";
16
41
  readonly type: BooleanConstructor;
17
- readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc which were set using command sos organization set-default";
42
+ readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc";
18
43
  }, {
19
44
  readonly name: "organization-uid";
20
45
  readonly type: StringConstructor;
@@ -24,7 +49,7 @@ export declare const organization: {
24
49
  run(options: import("../Command/commandDefinition").CommandLineOptions<readonly [{
25
50
  readonly name: "no-default-organization";
26
51
  readonly type: BooleanConstructor;
27
- readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc which were set using command sos organization set-default";
52
+ readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc";
28
53
  }, {
29
54
  readonly name: "organization-uid";
30
55
  readonly type: StringConstructor;
@@ -14,9 +14,34 @@ const organizationListCommand_1 = require("./List/organizationListCommand");
14
14
  const organizationGetCommand_1 = require("./Get/organizationGetCommand");
15
15
  const organizationSetDefaultCommand_1 = require("./SetDefault/organizationSetDefaultCommand");
16
16
  const commandDefinition_1 = require("../Command/commandDefinition");
17
+ /**
18
+ * Provides commands to manage signageOS organizations including listing available organizations,
19
+ * retrieving organization details, and setting default organization for CLI operations.
20
+ *
21
+ * @group Management:6
22
+ *
23
+ * @subcommands
24
+ * - `list` - List all organizations accessible to the current user
25
+ * - `get` - Get details of a specific organization by UID
26
+ * - `set-default` - Set a default organization for CLI operations
27
+ *
28
+ * @example
29
+ * ```bash
30
+ * # List all organizations
31
+ * sos organization list
32
+ *
33
+ * # Get specific organization details
34
+ * sos organization get --organization-uid abc123
35
+ *
36
+ * # Set default organization
37
+ * sos organization set-default
38
+ * ```
39
+ *
40
+ * @since 0.3.0
41
+ */
17
42
  exports.organization = (0, commandDefinition_1.createCommandDefinition)({
18
43
  name: 'organization',
19
- description: 'Organization management',
44
+ description: 'Organization management operations',
20
45
  optionList: [],
21
46
  commands: [organizationListCommand_1.organizationList, organizationGetCommand_1.organizationGet, organizationSetDefaultCommand_1.organizationSetDefault],
22
47
  run() {
@@ -15,7 +15,7 @@ export declare const ORGANIZATION_UID_OPTION: {
15
15
  export declare const NO_DEFAULT_ORGANIZATION_OPTION: {
16
16
  readonly name: "no-default-organization";
17
17
  readonly type: BooleanConstructor;
18
- readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc which were set using command sos organization set-default";
18
+ readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc";
19
19
  };
20
20
  export declare const ORGANIZATION_OPTIONS: ({
21
21
  readonly name: "organization-uid";
@@ -24,7 +24,7 @@ export declare const ORGANIZATION_OPTIONS: ({
24
24
  } | {
25
25
  readonly name: "no-default-organization";
26
26
  readonly type: BooleanConstructor;
27
- readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc which were set using command sos organization set-default";
27
+ readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc";
28
28
  })[];
29
29
  export declare function getOrganizationUidOrDefaultOrSelect(options: CommandLineOptions<[typeof ORGANIZATION_UID_OPTION, typeof NO_DEFAULT_ORGANIZATION_OPTION]>): Promise<string>;
30
30
  export declare function selectOrganizationUid(options: CommandLineOptions<[typeof ORGANIZATION_UID_OPTION]>): Promise<string>;
@@ -28,7 +28,7 @@ exports.ORGANIZATION_UID_OPTION = { name: 'organization-uid', type: String, desc
28
28
  exports.NO_DEFAULT_ORGANIZATION_OPTION = {
29
29
  name: 'no-default-organization',
30
30
  type: Boolean,
31
- description: 'Prevent using the defaultOrganizationUid from ~/.sosrc which were set using command sos organization set-default',
31
+ description: 'Prevent using the defaultOrganizationUid from ~/.sosrc',
32
32
  };
33
33
  exports.ORGANIZATION_OPTIONS = [exports.ORGANIZATION_UID_OPTION, exports.NO_DEFAULT_ORGANIZATION_OPTION];
34
34
  function getOrganizationUidOrDefaultOrSelect(options) {
@@ -102,7 +102,7 @@ function getOrganizations() {
102
102
  throw new Error(`Authentication error. Try to login using ${chalk_1.default.green('sos login')}`);
103
103
  }
104
104
  else {
105
- throw new Error('Unknown error: ' + (bodyOfGet && bodyOfGet.message ? bodyOfGet.message : responseOfGet.status));
105
+ throw new Error('Unknown error: ' + ((bodyOfGet === null || bodyOfGet === void 0 ? void 0 : bodyOfGet.message) ? bodyOfGet.message : responseOfGet.status));
106
106
  }
107
107
  });
108
108
  }
@@ -128,7 +128,7 @@ function getOrganization(organizationUid) {
128
128
  throw new Error(`Authentication error. Try to login using ${chalk_1.default.green('sos login')}`);
129
129
  }
130
130
  else {
131
- throw new Error('Unknown error: ' + (bodyOfGet && bodyOfGet.message ? bodyOfGet.message : responseOfGet.status));
131
+ throw new Error('Unknown error: ' + ((bodyOfGet === null || bodyOfGet === void 0 ? void 0 : bodyOfGet.message) ? bodyOfGet.message : responseOfGet.status));
132
132
  }
133
133
  });
134
134
  }
@@ -0,0 +1,7 @@
1
+ export declare const pluginGenerate: {
2
+ name: "generate";
3
+ description: string;
4
+ optionList: never[];
5
+ commands: never[];
6
+ run(): Promise<void>;
7
+ };
@@ -0,0 +1,38 @@
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.pluginGenerate = void 0;
16
+ const chalk_1 = __importDefault(require("chalk"));
17
+ const log_1 = require("@signageos/sdk/dist/Console/log");
18
+ const commandDefinition_1 = require("../../Command/commandDefinition");
19
+ const git_1 = require("../../Lib/git");
20
+ const customScriptFacade_1 = require("../../CustomScript/customScriptFacade");
21
+ const pluginGenerateFacade_1 = require("./pluginGenerateFacade");
22
+ exports.pluginGenerate = (0, commandDefinition_1.createCommandDefinition)({
23
+ name: 'generate',
24
+ description: 'Generates a local repository for developing a Plugin',
25
+ optionList: [],
26
+ commands: [],
27
+ run() {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ yield (0, git_1.throwErrorIfGitNotInstalled)();
30
+ const { targetDir, name, description } = yield (0, pluginGenerateFacade_1.askForParameters)();
31
+ yield (0, pluginGenerateFacade_1.downloadBoilerplateCode)(targetDir);
32
+ yield (0, customScriptFacade_1.addToConfigFile)(targetDir, { name, description });
33
+ (0, log_1.log)('info', `Plugin ${chalk_1.default.green(name)} has been generated in ${chalk_1.default.green(targetDir)}.`);
34
+ (0, log_1.log)('info', 'Next steps:');
35
+ (0, log_1.log)('info', ` - Open the folder ${chalk_1.default.green(targetDir)} and read the ${chalk_1.default.green('README.md')} file.`);
36
+ });
37
+ },
38
+ });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Prompts the user for the parameters needed to generate a plugin.
3
+ */
4
+ export declare function askForParameters(): Promise<{
5
+ targetDir: any;
6
+ name: any;
7
+ description: any;
8
+ }>;
9
+ /**
10
+ * Downloads the latest version of the boilerplate code from the GitHub repository.
11
+ */
12
+ export declare function downloadBoilerplateCode(targetDir: string): Promise<void>;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.askForParameters = askForParameters;
49
+ exports.downloadBoilerplateCode = downloadBoilerplateCode;
50
+ const chalk_1 = __importDefault(require("chalk"));
51
+ const prompts_1 = __importDefault(require("prompts"));
52
+ const path = __importStar(require("path"));
53
+ const fs = __importStar(require("fs-extra"));
54
+ const log_1 = require("@signageos/sdk/dist/Console/log");
55
+ const git_1 = require("../../Lib/git");
56
+ /**
57
+ * Prompts the user for the parameters needed to generate a plugin.
58
+ */
59
+ function askForParameters() {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ const throwCanceledError = () => {
62
+ throw new Error('Plugin generation was canceled.');
63
+ };
64
+ const { name, description } = 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
+ ], { onCancel: throwCanceledError });
76
+ const targetDir = name;
77
+ (0, log_1.log)('info', `Generating Plugin with these parameters:\n` +
78
+ ` - Directory: ${chalk_1.default.green(targetDir)}\n` +
79
+ ` - Name: ${chalk_1.default.green(name)}\n` +
80
+ ` - Description: ${chalk_1.default.green(description)}\n`);
81
+ const { confirm } = yield (0, prompts_1.default)({
82
+ type: 'confirm',
83
+ name: 'confirm',
84
+ message: 'Confirm',
85
+ });
86
+ if (!confirm) {
87
+ throwCanceledError();
88
+ }
89
+ return {
90
+ targetDir,
91
+ name,
92
+ description,
93
+ };
94
+ });
95
+ }
96
+ /**
97
+ * Downloads the latest version of the boilerplate code from the GitHub repository.
98
+ */
99
+ function downloadBoilerplateCode(targetDir) {
100
+ return __awaiter(this, void 0, void 0, function* () {
101
+ const URL = 'https://github.com/signageos/plugins-boilerplate';
102
+ yield (0, git_1.cloneGitRepository)(URL, targetDir);
103
+ // we just want the code, not the git history
104
+ yield fs.remove(path.join(targetDir, '.git'));
105
+ });
106
+ }
@@ -0,0 +1,25 @@
1
+ import { CommandLineOptions } from '../../Command/commandDefinition';
2
+ export declare const OPTION_LIST: readonly [{
3
+ readonly name: "no-default-organization";
4
+ readonly type: BooleanConstructor;
5
+ readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc";
6
+ }, {
7
+ readonly name: "organization-uid";
8
+ readonly type: StringConstructor;
9
+ readonly description: "Organization UID";
10
+ }];
11
+ export declare const pluginUpload: {
12
+ name: "upload";
13
+ description: string;
14
+ optionList: readonly [{
15
+ readonly name: "no-default-organization";
16
+ readonly type: BooleanConstructor;
17
+ readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc";
18
+ }, {
19
+ readonly name: "organization-uid";
20
+ readonly type: StringConstructor;
21
+ readonly description: "Organization UID";
22
+ }];
23
+ commands: never[];
24
+ run(options: CommandLineOptions<typeof OPTION_LIST>): Promise<void>;
25
+ };
@@ -0,0 +1,70 @@
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.pluginUpload = exports.OPTION_LIST = void 0;
16
+ const chalk_1 = __importDefault(require("chalk"));
17
+ const log_1 = require("@signageos/sdk/dist/Console/log");
18
+ const commandDefinition_1 = require("../../Command/commandDefinition");
19
+ const organizationFacade_1 = require("../../Organization/organizationFacade");
20
+ const customScriptFacade_1 = require("../../CustomScript/customScriptFacade");
21
+ const pluginFacade_1 = require("../pluginFacade");
22
+ const util_1 = require("util");
23
+ const helper_1 = require("../../helper");
24
+ const debug_1 = __importDefault(require("debug"));
25
+ const Debug = (0, debug_1.default)('@signageos/cli:Plugin:Upload:Command');
26
+ exports.OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, organizationFacade_1.ORGANIZATION_UID_OPTION];
27
+ exports.pluginUpload = (0, commandDefinition_1.createCommandDefinition)({
28
+ name: 'upload',
29
+ description: 'Uploads current plugin version',
30
+ optionList: exports.OPTION_LIST,
31
+ commands: [],
32
+ run(options) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const currentDirectory = process.cwd();
35
+ const organizationUid = yield (0, organizationFacade_1.getOrganizationUidOrDefaultOrSelect)(options);
36
+ const organization = yield (0, organizationFacade_1.getOrganization)(organizationUid);
37
+ const restApi = yield (0, helper_1.createOrganizationRestApi)(organization);
38
+ const config = yield (0, customScriptFacade_1.getConfig)(currentDirectory);
39
+ const schema = yield (0, pluginFacade_1.loadSchemas)(currentDirectory);
40
+ const pluginVersion = yield (0, pluginFacade_1.ensurePluginVersion)(restApi, config, schema);
41
+ for (const platform of Object.keys(config.platforms)) {
42
+ const platformConfig = config.platforms[platform];
43
+ if (!platformConfig) {
44
+ console.warn(`Skipping platform ${platform} due to missing configuration`);
45
+ continue;
46
+ }
47
+ yield (0, pluginFacade_1.uploadCode)({
48
+ restApi,
49
+ workDir: currentDirectory,
50
+ platform,
51
+ config: platformConfig,
52
+ pluginVersion,
53
+ });
54
+ }
55
+ if (!(0, util_1.isDeepStrictEqual)(pluginVersion.configDefinition, config.configDefinition)) {
56
+ Debug('Config definition is different, updating plugin version.');
57
+ yield restApi.plugin.version.update({
58
+ pluginUid: pluginVersion.pluginUid,
59
+ version: pluginVersion.version,
60
+ configDefinition: config.configDefinition,
61
+ schema: [schema],
62
+ });
63
+ }
64
+ else {
65
+ Debug('Config definition is the same, skipping update.');
66
+ }
67
+ (0, log_1.log)('info', `Plugin ${chalk_1.default.green(config.name)} version ${chalk_1.default.green(config.version)} has been uploaded.`);
68
+ });
69
+ },
70
+ });
@@ -0,0 +1,27 @@
1
+ export declare const plugin: {
2
+ name: "plugin";
3
+ description: string;
4
+ optionList: never[];
5
+ commands: ({
6
+ name: "generate";
7
+ description: string;
8
+ optionList: never[];
9
+ commands: never[];
10
+ run(): Promise<void>;
11
+ } | {
12
+ name: "upload";
13
+ description: string;
14
+ optionList: readonly [{
15
+ readonly name: "no-default-organization";
16
+ readonly type: BooleanConstructor;
17
+ readonly description: "Prevent using the defaultOrganizationUid from ~/.sosrc";
18
+ }, {
19
+ readonly name: "organization-uid";
20
+ readonly type: StringConstructor;
21
+ readonly description: "Organization UID";
22
+ }];
23
+ commands: never[];
24
+ run(options: import("../Command/commandDefinition").CommandLineOptions<typeof import("./Upload/pluginUploadCommand").OPTION_LIST>): Promise<void>;
25
+ })[];
26
+ run(): Promise<never>;
27
+ };