@ones-open/cli 0.50.0 → 1.0.1-16596.1816

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 (175) hide show
  1. package/LICENSE +201 -674
  2. package/bin/ones.js +4 -0
  3. package/dist/callback.html +65 -0
  4. package/dist/index.cjs +836 -0
  5. package/dist/index.js +835 -0
  6. package/dist/types/actions/build/index.d.ts +4 -0
  7. package/dist/types/actions/build/index.d.ts.map +1 -0
  8. package/dist/types/actions/build/normalize.d.ts +6 -0
  9. package/dist/types/actions/build/normalize.d.ts.map +1 -0
  10. package/dist/types/actions/build/regexp.d.ts +2 -0
  11. package/dist/types/actions/build/regexp.d.ts.map +1 -0
  12. package/dist/types/actions/dev/enums.d.ts +6 -0
  13. package/dist/types/actions/dev/enums.d.ts.map +1 -0
  14. package/dist/types/actions/dev/index.d.ts +4 -0
  15. package/dist/types/actions/dev/index.d.ts.map +1 -0
  16. package/dist/types/actions/dev/normalize.d.ts +6 -0
  17. package/dist/types/actions/dev/normalize.d.ts.map +1 -0
  18. package/dist/types/actions/disable/index.d.ts +4 -0
  19. package/dist/types/actions/disable/index.d.ts.map +1 -0
  20. package/dist/types/actions/disable/normalize.d.ts +6 -0
  21. package/dist/types/actions/disable/normalize.d.ts.map +1 -0
  22. package/dist/types/actions/enable/index.d.ts +4 -0
  23. package/dist/types/actions/enable/index.d.ts.map +1 -0
  24. package/dist/types/actions/enable/normalize.d.ts +6 -0
  25. package/dist/types/actions/enable/normalize.d.ts.map +1 -0
  26. package/dist/types/actions/index.d.ts +15 -0
  27. package/dist/types/actions/index.d.ts.map +1 -0
  28. package/dist/types/actions/install/index.d.ts +4 -0
  29. package/dist/types/actions/install/index.d.ts.map +1 -0
  30. package/dist/types/actions/install/normalize.d.ts +6 -0
  31. package/dist/types/actions/install/normalize.d.ts.map +1 -0
  32. package/dist/types/actions/legacy/index.d.ts +4 -0
  33. package/dist/types/actions/legacy/index.d.ts.map +1 -0
  34. package/dist/types/actions/legacy/normalize.d.ts +6 -0
  35. package/dist/types/actions/legacy/normalize.d.ts.map +1 -0
  36. package/dist/types/actions/login/consts.d.ts +2 -0
  37. package/dist/types/actions/login/consts.d.ts.map +1 -0
  38. package/dist/types/actions/login/index.d.ts +4 -0
  39. package/dist/types/actions/login/index.d.ts.map +1 -0
  40. package/dist/types/actions/login/normalize.d.ts +6 -0
  41. package/dist/types/actions/login/normalize.d.ts.map +1 -0
  42. package/dist/types/actions/login/regexp.d.ts +2 -0
  43. package/dist/types/actions/login/regexp.d.ts.map +1 -0
  44. package/dist/types/actions/logout/index.d.ts +4 -0
  45. package/dist/types/actions/logout/index.d.ts.map +1 -0
  46. package/dist/types/actions/logout/normalize.d.ts +6 -0
  47. package/dist/types/actions/logout/normalize.d.ts.map +1 -0
  48. package/dist/types/actions/tunnel/consts.d.ts +3 -0
  49. package/dist/types/actions/tunnel/consts.d.ts.map +1 -0
  50. package/dist/types/actions/tunnel/index.d.ts +4 -0
  51. package/dist/types/actions/tunnel/index.d.ts.map +1 -0
  52. package/dist/types/actions/tunnel/normalize.d.ts +6 -0
  53. package/dist/types/actions/tunnel/normalize.d.ts.map +1 -0
  54. package/dist/types/actions/tunnel/regexp.d.ts +2 -0
  55. package/dist/types/actions/tunnel/regexp.d.ts.map +1 -0
  56. package/dist/types/actions/tunnel/tunnel.d.ts +2 -0
  57. package/dist/types/actions/tunnel/tunnel.d.ts.map +1 -0
  58. package/dist/types/actions/uninstall/index.d.ts +4 -0
  59. package/dist/types/actions/uninstall/index.d.ts.map +1 -0
  60. package/dist/types/actions/uninstall/normalize.d.ts +6 -0
  61. package/dist/types/actions/uninstall/normalize.d.ts.map +1 -0
  62. package/dist/types/actions/whoami/index.d.ts +4 -0
  63. package/dist/types/actions/whoami/index.d.ts.map +1 -0
  64. package/dist/types/actions/whoami/normalize.d.ts +6 -0
  65. package/dist/types/actions/whoami/normalize.d.ts.map +1 -0
  66. package/dist/types/cli/index.d.ts +2 -0
  67. package/dist/types/cli/index.d.ts.map +1 -0
  68. package/dist/types/command/app/index.d.ts +4 -0
  69. package/dist/types/command/app/index.d.ts.map +1 -0
  70. package/dist/types/command/build/index.d.ts +9 -0
  71. package/dist/types/command/build/index.d.ts.map +1 -0
  72. package/dist/types/command/dev/index.d.ts +9 -0
  73. package/dist/types/command/dev/index.d.ts.map +1 -0
  74. package/dist/types/command/disable/index.d.ts +8 -0
  75. package/dist/types/command/disable/index.d.ts.map +1 -0
  76. package/dist/types/command/enable/index.d.ts +8 -0
  77. package/dist/types/command/enable/index.d.ts.map +1 -0
  78. package/dist/types/command/index.d.ts +16 -0
  79. package/dist/types/command/index.d.ts.map +1 -0
  80. package/dist/types/command/install/index.d.ts +8 -0
  81. package/dist/types/command/install/index.d.ts.map +1 -0
  82. package/dist/types/command/legacy/index.d.ts +8 -0
  83. package/dist/types/command/legacy/index.d.ts.map +1 -0
  84. package/dist/types/command/login/index.d.ts +8 -0
  85. package/dist/types/command/login/index.d.ts.map +1 -0
  86. package/dist/types/command/logout/index.d.ts +8 -0
  87. package/dist/types/command/logout/index.d.ts.map +1 -0
  88. package/dist/types/command/tunnel/index.d.ts +8 -0
  89. package/dist/types/command/tunnel/index.d.ts.map +1 -0
  90. package/dist/types/command/uninstall/index.d.ts +8 -0
  91. package/dist/types/command/uninstall/index.d.ts.map +1 -0
  92. package/dist/types/command/whoami/index.d.ts +8 -0
  93. package/dist/types/command/whoami/index.d.ts.map +1 -0
  94. package/dist/types/common/base/index.d.ts +5 -0
  95. package/dist/types/common/base/index.d.ts.map +1 -0
  96. package/dist/types/common/base/utils.d.ts +7 -0
  97. package/dist/types/common/base/utils.d.ts.map +1 -0
  98. package/dist/types/common/command/index.d.ts +6 -0
  99. package/dist/types/common/command/index.d.ts.map +1 -0
  100. package/dist/types/common/command/types.d.ts +2 -0
  101. package/dist/types/common/command/types.d.ts.map +1 -0
  102. package/dist/types/common/command/utils.d.ts +2 -0
  103. package/dist/types/common/command/utils.d.ts.map +1 -0
  104. package/dist/types/common/config/index.d.ts +6 -0
  105. package/dist/types/common/config/index.d.ts.map +1 -0
  106. package/dist/types/common/config/types.d.ts +6 -0
  107. package/dist/types/common/config/types.d.ts.map +1 -0
  108. package/dist/types/common/config/utils.d.ts +3 -0
  109. package/dist/types/common/config/utils.d.ts.map +1 -0
  110. package/dist/types/common/context/index.d.ts +6 -0
  111. package/dist/types/common/context/index.d.ts.map +1 -0
  112. package/dist/types/common/context/types.d.ts +2 -0
  113. package/dist/types/common/context/types.d.ts.map +1 -0
  114. package/dist/types/common/context/utils.d.ts +2 -0
  115. package/dist/types/common/context/utils.d.ts.map +1 -0
  116. package/dist/types/common/error/enums.d.ts +15 -0
  117. package/dist/types/common/error/enums.d.ts.map +1 -0
  118. package/dist/types/common/error/index.d.ts +7 -0
  119. package/dist/types/common/error/index.d.ts.map +1 -0
  120. package/dist/types/common/error/types.d.ts +2 -0
  121. package/dist/types/common/error/types.d.ts.map +1 -0
  122. package/dist/types/common/error/utils.d.ts +2 -0
  123. package/dist/types/common/error/utils.d.ts.map +1 -0
  124. package/dist/types/common/locales/en/index.d.ts +30 -0
  125. package/dist/types/common/locales/en/index.d.ts.map +1 -0
  126. package/dist/types/common/locales/index.d.ts +6 -0
  127. package/dist/types/common/locales/index.d.ts.map +1 -0
  128. package/dist/types/common/locales/types.d.ts +4 -0
  129. package/dist/types/common/locales/types.d.ts.map +1 -0
  130. package/dist/types/common/locales/utils.d.ts +6 -0
  131. package/dist/types/common/locales/utils.d.ts.map +1 -0
  132. package/dist/types/common/package/index.d.ts +7 -0
  133. package/dist/types/common/package/index.d.ts.map +1 -0
  134. package/dist/types/common/package/schema.d.ts +235 -0
  135. package/dist/types/common/package/schema.d.ts.map +1 -0
  136. package/dist/types/common/package/types.d.ts +2 -0
  137. package/dist/types/common/package/types.d.ts.map +1 -0
  138. package/dist/types/common/package/utils.d.ts +9 -0
  139. package/dist/types/common/package/utils.d.ts.map +1 -0
  140. package/dist/types/common/public/index.d.ts +5 -0
  141. package/dist/types/common/public/index.d.ts.map +1 -0
  142. package/dist/types/common/public/utils.d.ts +2 -0
  143. package/dist/types/common/public/utils.d.ts.map +1 -0
  144. package/dist/types/common/request/consts.d.ts +9 -0
  145. package/dist/types/common/request/consts.d.ts.map +1 -0
  146. package/dist/types/common/request/fetch.d.ts +9 -0
  147. package/dist/types/common/request/fetch.d.ts.map +1 -0
  148. package/dist/types/common/request/index.d.ts +8 -0
  149. package/dist/types/common/request/index.d.ts.map +1 -0
  150. package/dist/types/common/request/types.d.ts +50 -0
  151. package/dist/types/common/request/types.d.ts.map +1 -0
  152. package/dist/types/common/request/utils.d.ts +7 -0
  153. package/dist/types/common/request/utils.d.ts.map +1 -0
  154. package/dist/types/common/store/index.d.ts +6 -0
  155. package/dist/types/common/store/index.d.ts.map +1 -0
  156. package/dist/types/common/store/schema.d.ts +22 -0
  157. package/dist/types/common/store/schema.d.ts.map +1 -0
  158. package/dist/types/common/store/utils.d.ts +11 -0
  159. package/dist/types/common/store/utils.d.ts.map +1 -0
  160. package/dist/types/index.d.ts +2 -0
  161. package/dist/types/index.d.ts.map +1 -0
  162. package/index.d.ts +2 -0
  163. package/index.js +2 -0
  164. package/package.json +54 -38
  165. package/bin/index.es.js +0 -261
  166. package/bin/types/index.d.ts +0 -2
  167. package/bin/types/index.d.ts.map +0 -1
  168. package/bin/types/lib/create.d.ts +0 -4
  169. package/bin/types/lib/create.d.ts.map +0 -1
  170. package/bin/types/lib/env.d.ts +0 -6
  171. package/bin/types/lib/env.d.ts.map +0 -1
  172. package/template/_prettierignore +0 -13
  173. package/template/_prettierrc +0 -6
  174. package/template/browserslist +0 -4
  175. package/template/package.json +0 -5
package/dist/index.cjs ADDED
@@ -0,0 +1,836 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const _includesInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/includes");
4
+ const commander = require("commander");
5
+ const createOnesApp = require("create-ones-app");
6
+ const lodashEs = require("lodash-es");
7
+ const process = require("node:process");
8
+ const node_path = require("node:path");
9
+ const node_url = require("node:url");
10
+ const node_fs = require("node:fs");
11
+ const zod = require("zod");
12
+ const fse = require("fs-extra");
13
+ const envPaths = require("env-paths");
14
+ const http = require("node:http");
15
+ const ora = require("ora");
16
+ const open = require("open");
17
+ const getPort = require("get-port");
18
+ const uuid = require("uuid");
19
+ const axios = require("axios");
20
+ const _reduceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/reduce");
21
+ var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
22
+ const en = {
23
+ "desc.ones": "cli for ones",
24
+ "desc.build": "build the application",
25
+ "desc.build.output": "specify the output file path",
26
+ "desc.dev": "develop the application",
27
+ "desc.dev.install": "whether to install the application",
28
+ "desc.tunnel": "start a tunnel to the application",
29
+ "desc.tunnel.port": "specify the port number for serve",
30
+ "desc.login": "login to the environment",
31
+ "desc.login.baseUrl": "specify the environment url for login",
32
+ "desc.logout": "logout from the environment",
33
+ "desc.whoami": "show the current user",
34
+ "desc.app": "app command",
35
+ "desc.install": "install the application",
36
+ "desc.enable": "enable the application",
37
+ "desc.disable": "disable the application",
38
+ "desc.uninstall": "uninstall the application",
39
+ "desc.legacy": "legacy command",
40
+ "error.login.missingBaseURL": "missing base url",
41
+ "error.login.incorrectBaseURL": "incorrect base url",
42
+ "error.tunnel.missingPort": "missing port",
43
+ "error.tunnel.incorrectPort": "incorrect port",
44
+ "error.schema.app.package.parseError": "app package json parse error",
45
+ "error.schema.app.manifest.parseError": "app manifest json parse error",
46
+ "error.build.scriptNotFound": "build script not found",
47
+ "error.dev.scriptNotFound": "dev script not found",
48
+ "error.store.permission": 'permission denied, please check the file permission with "{filePath}"'
49
+ };
50
+ const map = {
51
+ en
52
+ };
53
+ const getCurrentLanguageList = () => {
54
+ return ["en"];
55
+ };
56
+ const translate = (key, params) => {
57
+ const list = getCurrentLanguageList();
58
+ for (let index = 0; index < list.length; index++) {
59
+ const language = list[index];
60
+ let value = lodashEs.get(map[language], key);
61
+ if (value) {
62
+ if (params && typeof value === "string") {
63
+ value = value.replace(/\{(\w+)\}/g, (match, paramKey) => {
64
+ var _params$paramKey;
65
+ const result = (_params$paramKey = params === null || params === void 0 ? void 0 : params[paramKey]) !== null && _params$paramKey !== void 0 ? _params$paramKey : match;
66
+ return String(result);
67
+ });
68
+ }
69
+ return value;
70
+ }
71
+ }
72
+ return key;
73
+ };
74
+ const i18n = {
75
+ t: translate
76
+ };
77
+ var ErrorCode = ((ErrorCode2) => {
78
+ ErrorCode2[ErrorCode2["UNKNOWN_ERROR"] = createOnesApp.ErrorCode.UNKNOWN_ERROR] = "UNKNOWN_ERROR";
79
+ ErrorCode2[ErrorCode2["COMMAND_ERROR"] = createOnesApp.ErrorCode.COMMAND_ERROR] = "COMMAND_ERROR";
80
+ ErrorCode2[ErrorCode2["TEMPLATE_NOT_FOUND"] = createOnesApp.ErrorCode.TEMPLATE_NOT_FOUND] = "TEMPLATE_NOT_FOUND";
81
+ ErrorCode2["MISSING_BASE_URL"] = "E03";
82
+ ErrorCode2["MISSING_PORT"] = "E04";
83
+ ErrorCode2["INCORRECT_BASE_URL"] = "E05";
84
+ ErrorCode2["INCORRECT_PORT"] = "E06";
85
+ ErrorCode2["APP_PACKAGE_JSON_PARSE_ERROR"] = "E07";
86
+ ErrorCode2["APP_MANIFEST_JSON_PARSE_ERROR"] = "E08";
87
+ ErrorCode2["BUILD_SCRIPT_NOT_FOUND"] = "E09";
88
+ ErrorCode2["DEV_SCRIPT_NOT_FOUND"] = "E10";
89
+ ErrorCode2["STORE_PERMISSION"] = "E11";
90
+ return ErrorCode2;
91
+ })(ErrorCode || {});
92
+ const AppPackageJSONSchema = zod.z.object({
93
+ scripts: zod.z.object({
94
+ dev: zod.z.string().optional(),
95
+ build: zod.z.string().optional()
96
+ }).optional()
97
+ });
98
+ const AppManifestJSONSchema = zod.z.object({
99
+ app: zod.z.object({
100
+ id: zod.z.string(),
101
+ name: zod.z.string(),
102
+ version: zod.z.string(),
103
+ logo: zod.z.string().optional(),
104
+ desc: zod.z.string().optional(),
105
+ base_url: zod.z.string().optional(),
106
+ auth: zod.z.object({
107
+ type: zod.z.literal("jwt")
108
+ }),
109
+ ones_version: zod.z.object({
110
+ min: zod.z.string(),
111
+ max: zod.z.string()
112
+ }).optional(),
113
+ lifecycle_callback: zod.z.object({
114
+ install: zod.z.string(),
115
+ enabled: zod.z.string().optional(),
116
+ disabled: zod.z.string().optional(),
117
+ uninstalled: zod.z.string().optional()
118
+ }),
119
+ oauth: zod.z.object({
120
+ type: zod.z.array(zod.z.enum(["app", "user"])).optional(),
121
+ scope: zod.z.array(zod.z.string()),
122
+ redirect_url: zod.z.string().optional()
123
+ }).optional(),
124
+ events: zod.z.object({
125
+ url: zod.z.string(),
126
+ types: zod.z.array(zod.z.object({
127
+ eventType: zod.z.string()
128
+ }))
129
+ }).optional(),
130
+ extensions: zod.z.record(zod.z.unknown()).optional()
131
+ })
132
+ });
133
+ const getPackageJSONPath = () => {
134
+ const __dirname = node_path.dirname(node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href));
135
+ return node_path.join(__dirname, "../package.json");
136
+ };
137
+ const getPackageJSON = () => {
138
+ const path = getPackageJSONPath();
139
+ try {
140
+ const string = node_fs.readFileSync(path, {
141
+ encoding: "utf8"
142
+ });
143
+ return JSON.parse(string);
144
+ } catch (error) {
145
+ return {};
146
+ }
147
+ };
148
+ const getAppPackageJSONPath = () => {
149
+ return node_path.join(process.cwd(), "./package.json");
150
+ };
151
+ const getAppPackageJSON = () => {
152
+ const path = getAppPackageJSONPath();
153
+ try {
154
+ const string = node_fs.readFileSync(path, {
155
+ encoding: "utf8"
156
+ });
157
+ const json = JSON.parse(string);
158
+ return AppPackageJSONSchema.parse(json);
159
+ } catch (error) {
160
+ console.error(error);
161
+ return createOnesApp.throwError(ErrorCode.APP_PACKAGE_JSON_PARSE_ERROR, i18n.t("error.schema.app.package.parseError"));
162
+ }
163
+ };
164
+ const getAppManifestJSONPath = () => {
165
+ return node_path.join(process.cwd(), "./opkx.json");
166
+ };
167
+ const getAppManifestJSON = () => {
168
+ const path = getAppManifestJSONPath();
169
+ try {
170
+ const string = node_fs.readFileSync(path, {
171
+ encoding: "utf8"
172
+ });
173
+ const json = JSON.parse(string);
174
+ return AppManifestJSONSchema.parse(json);
175
+ } catch (error) {
176
+ console.error(error);
177
+ return createOnesApp.throwError(ErrorCode.APP_MANIFEST_JSON_PARSE_ERROR, i18n.t("error.schema.app.manifest.parseError"));
178
+ }
179
+ };
180
+ const isOPKXFilename = /\.opkx$/;
181
+ const defaultOutputPath = "";
182
+ const normalize$a = async (options) => {
183
+ var _options$output;
184
+ let output = node_path.resolve(process.cwd(), (_options$output = options.output) !== null && _options$output !== void 0 ? _options$output : defaultOutputPath);
185
+ if (isOPKXFilename.test(output))
186
+ ;
187
+ else {
188
+ const appManifestJSON = getAppManifestJSON();
189
+ const defaultOutputFilename = `${appManifestJSON.app.name}.opkx`;
190
+ output = node_path.resolve(output, defaultOutputFilename);
191
+ }
192
+ return {
193
+ output
194
+ };
195
+ };
196
+ const build = async function() {
197
+ var _appPackageJSON$scrip;
198
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
199
+ args[_key] = arguments[_key];
200
+ }
201
+ const {
202
+ options
203
+ } = createOnesApp.getCommandOptions(args, buildCommandArguments);
204
+ const normalizedOptions = await normalize$a(options);
205
+ console.log("build", normalizedOptions);
206
+ const appPackageJSON = getAppPackageJSON();
207
+ console.log("appPackageJSON", appPackageJSON);
208
+ const appManifestJSON = getAppManifestJSON();
209
+ console.log("appManifestJSON", appManifestJSON);
210
+ if ((_appPackageJSON$scrip = appPackageJSON.scripts) !== null && _appPackageJSON$scrip !== void 0 && _appPackageJSON$scrip.build)
211
+ ;
212
+ else {
213
+ return createOnesApp.throwError(ErrorCode.BUILD_SCRIPT_NOT_FOUND, i18n.t("error.build.scriptNotFound"));
214
+ }
215
+ };
216
+ var InstallOptions = /* @__PURE__ */ ((InstallOptions2) => {
217
+ InstallOptions2["AUTO"] = "auto";
218
+ InstallOptions2["TRUE"] = "true";
219
+ InstallOptions2["FALSE"] = "false";
220
+ return InstallOptions2;
221
+ })(InstallOptions || {});
222
+ const defaultInstall = InstallOptions.AUTO;
223
+ const normalize$9 = async (options) => {
224
+ var _options$install;
225
+ let install2 = (_options$install = options.install) !== null && _options$install !== void 0 ? _options$install : defaultInstall;
226
+ switch (true) {
227
+ case install2 === InstallOptions.AUTO:
228
+ break;
229
+ case Boolean(install2):
230
+ install2 = InstallOptions.TRUE;
231
+ break;
232
+ default:
233
+ install2 = InstallOptions.FALSE;
234
+ break;
235
+ }
236
+ return {
237
+ install: install2
238
+ };
239
+ };
240
+ const dev = async function() {
241
+ var _appPackageJSON$scrip;
242
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
243
+ args[_key] = arguments[_key];
244
+ }
245
+ const {
246
+ options
247
+ } = createOnesApp.getCommandOptions(args, devCommandArguments);
248
+ const normalizedOptions = await normalize$9(options);
249
+ console.log("dev", normalizedOptions);
250
+ const appPackageJSON = getAppPackageJSON();
251
+ console.log("appPackageJSON", appPackageJSON);
252
+ const appManifestJSON = getAppManifestJSON();
253
+ console.log("appManifestJSON", appManifestJSON);
254
+ if ((_appPackageJSON$scrip = appPackageJSON.scripts) !== null && _appPackageJSON$scrip !== void 0 && _appPackageJSON$scrip.dev) {
255
+ if (normalizedOptions.install)
256
+ ;
257
+ } else {
258
+ return createOnesApp.throwError(ErrorCode.DEV_SCRIPT_NOT_FOUND, i18n.t("error.dev.scriptNotFound"));
259
+ }
260
+ };
261
+ const isPortNumber = /^[1-9]\d{0,4}$/;
262
+ const minPortNumber = 1;
263
+ const maxPortNumber = 65535;
264
+ const normalize$8 = async (options) => {
265
+ const portInput = options.port;
266
+ if (portInput)
267
+ ;
268
+ else {
269
+ return createOnesApp.throwError(ErrorCode.MISSING_PORT, i18n.t("error.tunnel.missingPort"));
270
+ }
271
+ const portString = String(portInput);
272
+ const portNumber = Number(portString);
273
+ if (isPortNumber.test(portString))
274
+ ;
275
+ else {
276
+ return createOnesApp.throwError(ErrorCode.INCORRECT_PORT, i18n.t("error.tunnel.incorrectPort"));
277
+ }
278
+ if (portNumber < minPortNumber || portNumber > maxPortNumber) {
279
+ return createOnesApp.throwError(ErrorCode.INCORRECT_PORT, i18n.t("error.tunnel.incorrectPort"));
280
+ }
281
+ const port = portString;
282
+ return {
283
+ port
284
+ };
285
+ };
286
+ const StoreJSONSchema = zod.z.object({
287
+ version: zod.z.string().optional(),
288
+ timestamp: zod.z.number().optional(),
289
+ base_url: zod.z.string().optional(),
290
+ region_url: zod.z.string().optional(),
291
+ ones_token: zod.z.string().optional()
292
+ });
293
+ const {
294
+ ensureFile,
295
+ readJSON,
296
+ writeJSON
297
+ } = fse;
298
+ const name = "@ones-open/cli";
299
+ const paths = envPaths(name);
300
+ const storeDir = paths.config;
301
+ const storePath = node_path.join(storeDir, "config.json");
302
+ const getStore = async () => {
303
+ let json = {};
304
+ try {
305
+ await ensureFile(storePath);
306
+ json = await readJSON(storePath, {
307
+ encoding: "utf8"
308
+ });
309
+ } catch (error) {
310
+ const $error = error;
311
+ if ($error.code === "EPERM" || $error.code === "EACCES") {
312
+ return createOnesApp.throwError(ErrorCode.STORE_PERMISSION, i18n.t("error.store.permission", {
313
+ filePath: storePath
314
+ }));
315
+ }
316
+ if ($error instanceof SyntaxError) {
317
+ return {};
318
+ }
319
+ throw error;
320
+ }
321
+ try {
322
+ return StoreJSONSchema.parse(json);
323
+ } catch (error) {
324
+ return {};
325
+ }
326
+ };
327
+ const setStore = async (store) => {
328
+ try {
329
+ await ensureFile(storePath);
330
+ const version = `${getPackageJSON().version}`;
331
+ const timestamp = Date.now();
332
+ return await writeJSON(storePath, {
333
+ ...store,
334
+ version,
335
+ timestamp
336
+ }, {
337
+ encoding: "utf8"
338
+ });
339
+ } catch (error) {
340
+ const $error = error;
341
+ if ($error.code === "EPERM" || $error.code === "EACCES") {
342
+ return createOnesApp.throwError(ErrorCode.STORE_PERMISSION, i18n.t("error.store.permission", {
343
+ filePath: storePath
344
+ }));
345
+ }
346
+ throw error;
347
+ }
348
+ };
349
+ const mergeStore = async (store) => {
350
+ const currentStore = await getStore();
351
+ return setStore({
352
+ ...currentStore,
353
+ ...store
354
+ });
355
+ };
356
+ const setBaseURL = async (baseURL) => {
357
+ return mergeStore({
358
+ base_url: baseURL
359
+ });
360
+ };
361
+ const getRegionURL = async () => {
362
+ var _store$region_url;
363
+ const store = await getStore();
364
+ return (_store$region_url = store.region_url) !== null && _store$region_url !== void 0 ? _store$region_url : "";
365
+ };
366
+ const setRegionURL = async (regionURL) => {
367
+ return mergeStore({
368
+ region_url: regionURL
369
+ });
370
+ };
371
+ const getONESToken = async () => {
372
+ var _store$ones_token;
373
+ const store = await getStore();
374
+ return (_store$ones_token = store.ones_token) !== null && _store$ones_token !== void 0 ? _store$ones_token : "";
375
+ };
376
+ const setONESToken = async (token) => {
377
+ return mergeStore({
378
+ ones_token: token
379
+ });
380
+ };
381
+ const invokeTunnel = async (port) => {
382
+ console.log("invokeTunnel", port);
383
+ const appManifestJSON = getAppManifestJSON();
384
+ console.log("appManifestJSON", appManifestJSON);
385
+ const regionURL = await getRegionURL();
386
+ const onesToken = await getONESToken();
387
+ console.log("regionURL", regionURL);
388
+ console.log("onesToken", onesToken);
389
+ };
390
+ const tunnel = async function() {
391
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
392
+ args[_key] = arguments[_key];
393
+ }
394
+ const {
395
+ options
396
+ } = createOnesApp.getCommandOptions(args, tunnelCommandArguments);
397
+ const normalizedOptions = await normalize$8(options);
398
+ await invokeTunnel(normalizedOptions.port);
399
+ };
400
+ const config = {
401
+ defaultPort: {
402
+ login: 8200
403
+ }
404
+ };
405
+ const getConfig = () => config;
406
+ const getPublicPath = () => {
407
+ const __dirname = node_path.dirname(node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href));
408
+ return node_path.join(__dirname, "../public");
409
+ };
410
+ function createPromise() {
411
+ let resolve;
412
+ let reject;
413
+ const promise = new Promise((res, rej) => {
414
+ resolve = res;
415
+ reject = rej;
416
+ });
417
+ return {
418
+ promise,
419
+ resolve,
420
+ reject
421
+ };
422
+ }
423
+ const sleep = (number) => {
424
+ return new Promise((resolve) => {
425
+ setTimeout(resolve, number);
426
+ });
427
+ };
428
+ const isURL = /^https?:\/\//;
429
+ const HostBlackList = ["ones.cn", "www.ones.cn", "ones.com", "www.ones.com"];
430
+ const normalize$7 = async (options) => {
431
+ const baseURLInput = options.baseURL;
432
+ if (baseURLInput)
433
+ ;
434
+ else {
435
+ return createOnesApp.throwError(ErrorCode.MISSING_BASE_URL, i18n.t("error.login.missingBaseURL"));
436
+ }
437
+ if (isURL.test(baseURLInput))
438
+ ;
439
+ else {
440
+ return createOnesApp.throwError(ErrorCode.INCORRECT_BASE_URL, i18n.t("error.login.incorrectBaseURL"));
441
+ }
442
+ let baseURL = "";
443
+ try {
444
+ const url = new URL(baseURLInput);
445
+ const host = url.hostname;
446
+ if (_includesInstanceProperty(HostBlackList).call(HostBlackList, host)) {
447
+ return createOnesApp.throwError(ErrorCode.INCORRECT_BASE_URL, i18n.t("error.login.incorrectBaseURL"));
448
+ }
449
+ url.pathname = "";
450
+ url.search = "";
451
+ url.hash = "";
452
+ baseURL = url.toString();
453
+ } catch (error) {
454
+ return createOnesApp.throwError(ErrorCode.INCORRECT_BASE_URL, i18n.t("error.login.incorrectBaseURL"));
455
+ }
456
+ return {
457
+ baseURL
458
+ };
459
+ };
460
+ const login = async function() {
461
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
462
+ args[_key] = arguments[_key];
463
+ }
464
+ const {
465
+ options
466
+ } = createOnesApp.getCommandOptions(args, loginCommandArguments);
467
+ const normalizedOptions = await normalize$7(options);
468
+ const base = normalizedOptions.baseURL;
469
+ const path = "project/oauth2.html";
470
+ const config2 = getConfig();
471
+ const port = await getPort({
472
+ port: config2.defaultPort.login
473
+ });
474
+ const uuid$1 = uuid.v7();
475
+ const search = new URLSearchParams();
476
+ search.set("redirect_path", "/developer/cli");
477
+ search.set("redirect_url", `http://localhost:${port}`);
478
+ search.set("state", uuid$1);
479
+ const url = `${base}${path}?${search}`;
480
+ const publicPath = getPublicPath();
481
+ const htmlPath = node_path.join(publicPath, "callback.html");
482
+ const html = node_fs.readFileSync(htmlPath, {
483
+ encoding: "utf-8"
484
+ });
485
+ const {
486
+ promise,
487
+ resolve
488
+ } = createPromise();
489
+ const server = http.createServer((req, res) => {
490
+ var _req$url$split$, _req$url, _search2$get, _search2$get2;
491
+ const search2 = new URLSearchParams((_req$url$split$ = (_req$url = req.url) === null || _req$url === void 0 ? void 0 : _req$url.split("?")[1]) !== null && _req$url$split$ !== void 0 ? _req$url$split$ : "");
492
+ const state = search2.get("state");
493
+ const token = (_search2$get = search2.get("access_token")) !== null && _search2$get !== void 0 ? _search2$get : "";
494
+ const region = (_search2$get2 = search2.get("region_url")) !== null && _search2$get2 !== void 0 ? _search2$get2 : "";
495
+ if (state === uuid$1 && token && region) {
496
+ resolve({
497
+ base_url: base,
498
+ ones_token: token,
499
+ region_url: region
500
+ });
501
+ }
502
+ res.writeHead(200, {
503
+ "Content-Type": "text/html"
504
+ });
505
+ res.end(html);
506
+ });
507
+ server.listen(port);
508
+ promise.then(async (store) => {
509
+ var _store$base_url, _store$ones_token, _store$region_url;
510
+ await sleep(100);
511
+ server.closeAllConnections();
512
+ await setBaseURL((_store$base_url = store.base_url) !== null && _store$base_url !== void 0 ? _store$base_url : "");
513
+ await setONESToken((_store$ones_token = store.ones_token) !== null && _store$ones_token !== void 0 ? _store$ones_token : "");
514
+ await setRegionURL((_store$region_url = store.region_url) !== null && _store$region_url !== void 0 ? _store$region_url : "");
515
+ console.log("Logged in successfully!");
516
+ process.exit(0);
517
+ });
518
+ console.log("Logging into your ONES account...");
519
+ console.log(`Opening ${url}`);
520
+ ora("Waiting for authorization...").start();
521
+ await open(url);
522
+ };
523
+ const normalize$6 = async (options) => {
524
+ lodashEs.noop(options);
525
+ return {};
526
+ };
527
+ const logout = async function() {
528
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
529
+ args[_key] = arguments[_key];
530
+ }
531
+ const {
532
+ options
533
+ } = createOnesApp.getCommandOptions(args, logoutCommandArguments);
534
+ const normalizedOptions = await normalize$6(options);
535
+ lodashEs.noop(normalizedOptions);
536
+ await setStore({});
537
+ console.log("Logged out successfully!");
538
+ };
539
+ const API = {
540
+ TOKEN_INFO: "/project/api/project/auth/token_info",
541
+ APP_LIST: "/platform/api/app/list",
542
+ APP_INSTALL: "/app/install",
543
+ APP_UNINSTALL: "/app/uninstall",
544
+ APP_ENABLE: "/platform/api/app/:installation_id/enable",
545
+ APP_DISABLE: "/platform/api/app/:installation_id/disable"
546
+ };
547
+ const getPath = (path, map2) => {
548
+ var _context;
549
+ return _reduceInstanceProperty(_context = path.split("/")).call(_context, (base, part) => {
550
+ if (/^:/.test(part)) {
551
+ return `${base}/${map2[part.slice(1)]}`;
552
+ }
553
+ return `${base}/${part}`;
554
+ }, "").slice(1);
555
+ };
556
+ const consoleUnauthorizedMessage = () => {
557
+ console.log("Not logged in");
558
+ console.log('Login with "ones login" command');
559
+ };
560
+ const getURL = async (path, pathMap, queryMap) => {
561
+ const base = await getRegionURL();
562
+ if (base) {
563
+ const query = new URLSearchParams(queryMap !== null && queryMap !== void 0 ? queryMap : {}).toString();
564
+ return `${base}${getPath(path, pathMap !== null && pathMap !== void 0 ? pathMap : {})}${query ? `?${query}` : ""}`;
565
+ }
566
+ consoleUnauthorizedMessage();
567
+ process.exit(1);
568
+ };
569
+ const getHeaders = async (value) => {
570
+ const token = await getONESToken();
571
+ if (token) {
572
+ return lodashEs.merge({
573
+ Authorization: `Bearer ${token}`
574
+ }, value);
575
+ }
576
+ consoleUnauthorizedMessage();
577
+ process.exit(1);
578
+ };
579
+ const handleError = (error) => {
580
+ var _error$response;
581
+ if (((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 401) {
582
+ console.log(error.response.statusText);
583
+ consoleUnauthorizedMessage();
584
+ } else {
585
+ console.error(error);
586
+ }
587
+ return {};
588
+ };
589
+ const fetchAppBase = async (params) => {
590
+ var _params$url;
591
+ const url = await getURL((_params$url = params.url) !== null && _params$url !== void 0 ? _params$url : "", params.pathMap, params.queryMap);
592
+ const headers = await getHeaders(params.headers);
593
+ const response = await axios({
594
+ ...params,
595
+ url,
596
+ headers
597
+ });
598
+ return response.data;
599
+ };
600
+ const fetchAppList = async (appID) => {
601
+ return await fetchAppBase({
602
+ url: API.APP_LIST,
603
+ method: "GET",
604
+ queryMap: {
605
+ app_id: appID
606
+ }
607
+ }).catch(handleError);
608
+ };
609
+ const fetchTokenInfo = async () => {
610
+ return await fetchAppBase({
611
+ url: API.TOKEN_INFO,
612
+ method: "GET"
613
+ }).catch(handleError);
614
+ };
615
+ const fetchAppInstall = async () => {
616
+ return await fetchAppBase({
617
+ url: API.APP_INSTALL,
618
+ method: "POST"
619
+ }).catch(handleError);
620
+ };
621
+ const fetchAppUninstall = async () => {
622
+ return await fetchAppBase({
623
+ url: API.APP_UNINSTALL,
624
+ method: "POST"
625
+ }).catch(handleError);
626
+ };
627
+ const fetchAppEnable = async () => {
628
+ var _appList$data$0$insta, _appList$data;
629
+ const appID = getAppManifestJSON().app.id;
630
+ const appList = await fetchAppList(appID);
631
+ const installationID = (_appList$data$0$insta = (_appList$data = appList.data) === null || _appList$data === void 0 || (_appList$data = _appList$data[0]) === null || _appList$data === void 0 ? void 0 : _appList$data.installation_id) !== null && _appList$data$0$insta !== void 0 ? _appList$data$0$insta : "";
632
+ return await fetchAppBase({
633
+ url: API.APP_ENABLE,
634
+ method: "POST",
635
+ pathMap: {
636
+ installation_id: installationID
637
+ }
638
+ }).catch(handleError);
639
+ };
640
+ const fetchAppDisable = async () => {
641
+ var _appList$data$0$insta2, _appList$data2;
642
+ const appID = getAppManifestJSON().app.id;
643
+ const appList = await fetchAppList(appID);
644
+ const installationID = (_appList$data$0$insta2 = (_appList$data2 = appList.data) === null || _appList$data2 === void 0 || (_appList$data2 = _appList$data2[0]) === null || _appList$data2 === void 0 ? void 0 : _appList$data2.installation_id) !== null && _appList$data$0$insta2 !== void 0 ? _appList$data$0$insta2 : "";
645
+ return await fetchAppBase({
646
+ url: API.APP_DISABLE,
647
+ method: "POST",
648
+ pathMap: {
649
+ installation_id: installationID
650
+ }
651
+ }).catch(handleError);
652
+ };
653
+ const normalize$5 = async (options) => {
654
+ lodashEs.noop(options);
655
+ return {};
656
+ };
657
+ const whoami = async function() {
658
+ var _tokenInfo$user, _tokenInfo$user2;
659
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
660
+ args[_key] = arguments[_key];
661
+ }
662
+ const {
663
+ options
664
+ } = createOnesApp.getCommandOptions(args, whoamiCommandArguments);
665
+ const normalizedOptions = await normalize$5(options);
666
+ lodashEs.noop(normalizedOptions);
667
+ const tokenInfo = await fetchTokenInfo();
668
+ const name2 = (_tokenInfo$user = tokenInfo.user) === null || _tokenInfo$user === void 0 ? void 0 : _tokenInfo$user.name;
669
+ const email = (_tokenInfo$user2 = tokenInfo.user) === null || _tokenInfo$user2 === void 0 ? void 0 : _tokenInfo$user2.email;
670
+ if (name2 && email) {
671
+ console.log(`${name2} <${email}>`);
672
+ } else {
673
+ consoleUnauthorizedMessage();
674
+ }
675
+ };
676
+ const normalize$4 = async (options) => {
677
+ lodashEs.noop(options);
678
+ return {};
679
+ };
680
+ const install = async function() {
681
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
682
+ args[_key] = arguments[_key];
683
+ }
684
+ const {
685
+ options
686
+ } = createOnesApp.getCommandOptions(args, installCommandArguments);
687
+ const normalizedOptions = await normalize$4(options);
688
+ lodashEs.noop(normalizedOptions);
689
+ const result = await fetchAppInstall();
690
+ if (result.code === "OK") {
691
+ console.log("App installed successfully!");
692
+ } else {
693
+ console.error(result);
694
+ }
695
+ };
696
+ const normalize$3 = async (options) => {
697
+ lodashEs.noop(options);
698
+ return {};
699
+ };
700
+ const enable = async function() {
701
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
702
+ args[_key] = arguments[_key];
703
+ }
704
+ const {
705
+ options
706
+ } = createOnesApp.getCommandOptions(args, enableCommandArguments);
707
+ const normalizedOptions = await normalize$3(options);
708
+ lodashEs.noop(normalizedOptions);
709
+ const result = await fetchAppEnable();
710
+ if (result.code === "OK") {
711
+ console.log("App enabled successfully!");
712
+ } else {
713
+ console.error(result);
714
+ }
715
+ };
716
+ const normalize$2 = async (options) => {
717
+ lodashEs.noop(options);
718
+ return {};
719
+ };
720
+ const disable = async function() {
721
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
722
+ args[_key] = arguments[_key];
723
+ }
724
+ const {
725
+ options
726
+ } = createOnesApp.getCommandOptions(args, disableCommandArguments);
727
+ const normalizedOptions = await normalize$2(options);
728
+ lodashEs.noop(normalizedOptions);
729
+ const result = await fetchAppDisable();
730
+ if (result.code === "OK") {
731
+ console.log("App disabled successfully!");
732
+ } else {
733
+ console.error(result);
734
+ }
735
+ };
736
+ const normalize$1 = async (options) => {
737
+ lodashEs.noop(options);
738
+ return {};
739
+ };
740
+ const uninstall = async function() {
741
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
742
+ args[_key] = arguments[_key];
743
+ }
744
+ const {
745
+ options
746
+ } = createOnesApp.getCommandOptions(args, uninstallCommandArguments);
747
+ const normalizedOptions = await normalize$1(options);
748
+ lodashEs.noop(normalizedOptions);
749
+ const result = await fetchAppUninstall();
750
+ if (result.code === "OK") {
751
+ console.log("App uninstalled successfully!");
752
+ } else {
753
+ console.error(result);
754
+ }
755
+ };
756
+ const normalize = async (options) => {
757
+ lodashEs.noop(options);
758
+ return {};
759
+ };
760
+ const legacy = async function() {
761
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
762
+ args[_key] = arguments[_key];
763
+ }
764
+ const {
765
+ options
766
+ } = createOnesApp.getCommandOptions(args, legacyCommandArguments);
767
+ const normalizedOptions = await normalize(options);
768
+ console.log("legacy", normalizedOptions);
769
+ };
770
+ const buildCommandArguments = [];
771
+ const $build = new commander.Command("build").description(i18n.t("desc.build")).option("-o, --output [file-path]", i18n.t("desc.build.output")).action(build);
772
+ createOnesApp.addCommandUsage($build);
773
+ createOnesApp.addCommandOutput($build);
774
+ const devCommandArguments = [];
775
+ const $dev = new commander.Command("dev").description(i18n.t("desc.dev")).option("-i, --install [boolean]", i18n.t("desc.dev.install")).action(dev);
776
+ createOnesApp.addCommandUsage($dev);
777
+ createOnesApp.addCommandOutput($dev);
778
+ const tunnelCommandArguments = ["port"];
779
+ const $tunnel = new commander.Command("tunnel").description(i18n.t("desc.tunnel")).argument("<port>", i18n.t("desc.tunnel.port")).action(tunnel);
780
+ createOnesApp.addCommandUsage($tunnel);
781
+ createOnesApp.addCommandOutput($tunnel);
782
+ const loginCommandArguments = ["baseURL"];
783
+ const $login = new commander.Command("login").description(i18n.t("desc.login")).argument("<base-url>", i18n.t("desc.login.baseUrl")).action(login);
784
+ createOnesApp.addCommandUsage($login);
785
+ createOnesApp.addCommandOutput($login);
786
+ const logoutCommandArguments = [];
787
+ const $logout = new commander.Command("logout").description(i18n.t("desc.logout")).action(logout);
788
+ createOnesApp.addCommandUsage($logout);
789
+ createOnesApp.addCommandOutput($logout);
790
+ const whoamiCommandArguments = [];
791
+ const $whoami = new commander.Command("whoami").description(i18n.t("desc.whoami")).action(whoami);
792
+ createOnesApp.addCommandUsage($whoami);
793
+ createOnesApp.addCommandOutput($whoami);
794
+ const installCommandArguments = [];
795
+ const $install = new commander.Command("install").description(i18n.t("desc.install")).action(install);
796
+ createOnesApp.addCommandUsage($install);
797
+ createOnesApp.addCommandOutput($install);
798
+ const enableCommandArguments = [];
799
+ const $enable = new commander.Command("enable").description(i18n.t("desc.enable")).action(enable);
800
+ createOnesApp.addCommandUsage($enable);
801
+ createOnesApp.addCommandOutput($enable);
802
+ const disableCommandArguments = [];
803
+ const $disable = new commander.Command("disable").description(i18n.t("desc.disable")).action(disable);
804
+ createOnesApp.addCommandUsage($disable);
805
+ createOnesApp.addCommandOutput($disable);
806
+ const uninstallCommandArguments = [];
807
+ const $uninstall = new commander.Command("uninstall").description(i18n.t("desc.uninstall")).action(uninstall);
808
+ createOnesApp.addCommandUsage($uninstall);
809
+ createOnesApp.addCommandOutput($uninstall);
810
+ const $app = new commander.Command("app").description(i18n.t("desc.app"));
811
+ $app.addCommand($install).addCommand($enable).addCommand($disable).addCommand($uninstall);
812
+ createOnesApp.addCommandUsage($app);
813
+ createOnesApp.addCommandOutput($app);
814
+ const legacyCommandArguments = [];
815
+ const $legacy = new commander.Command("legacy").description(i18n.t("desc.legacy")).action(legacy);
816
+ createOnesApp.addCommandUsage($legacy);
817
+ createOnesApp.addCommandOutput($legacy);
818
+ const ones = new commander.Command("ones");
819
+ ones.description(i18n.t("desc.ones")).addCommand(createOnesApp.$create).addCommand($build).addCommand($dev).addCommand($tunnel).addCommand($app).addCommand($login).addCommand($logout).addCommand($whoami).addCommand($legacy).configureHelp({
820
+ visibleCommands: (cmd) => {
821
+ const blackList = ["legacy"];
822
+ return cmd.commands.filter((command) => !_includesInstanceProperty(blackList).call(blackList, command.name()));
823
+ },
824
+ subcommandTerm: (subcommand) => {
825
+ return `${subcommand.name()} ${subcommand.usage()}`.trim();
826
+ }
827
+ });
828
+ createOnesApp.addCommandOutput(ones);
829
+ const runCommandONES = async () => {
830
+ const command = ones;
831
+ createOnesApp.setContext("command", command);
832
+ const version = `${getPackageJSON().version}`;
833
+ command.version(version);
834
+ await command.parse();
835
+ };
836
+ exports.runCommandONES = runCommandONES;