qcobjects-cli 2.5.103-beta → 2.5.105-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/VERSION +1 -1
- package/build-esbuild.js +65 -12
- package/package.json +55 -21
- package/public/browser/com.qcobjects.cli.commands.jira.client_services.js +66 -55
- package/public/browser/com.qcobjects.cli.commands.jira.client_services.js.map +2 -2
- package/public/browser/com.qcobjects.cli.commands.jira.js +138 -93
- package/public/browser/com.qcobjects.cli.commands.jira.js.map +4 -4
- package/public/browser/com.qcobjects.cli.commands.js +371 -14
- package/public/browser/com.qcobjects.cli.commands.js.map +4 -4
- package/public/browser/com.qcobjects.cli.commands.version.js +220 -214
- package/public/browser/com.qcobjects.cli.commands.version.js.map +2 -2
- package/public/browser/index.js +4042 -13
- package/public/browser/index.js.map +4 -4
- package/public/browser/org.qcobjects.common.pipelog.js +37 -24
- package/public/browser/org.qcobjects.common.pipelog.js.map +2 -2
- package/public/browser/org.qcobjects.enterprise.commands.js +108 -117
- package/public/browser/org.qcobjects.enterprise.commands.js.map +3 -3
- package/public/browser/org.quickcorp.qcobjects.api.client_services.js +64 -55
- package/public/browser/org.quickcorp.qcobjects.api.client_services.js.map +2 -2
- package/public/browser/org.quickcorp.qcobjects.cli.js +1280 -379
- package/public/browser/org.quickcorp.qcobjects.cli.js.map +4 -4
- package/public/browser/org.quickcorp.qcobjects.defaultsettings.js +373 -359
- package/public/browser/org.quickcorp.qcobjects.defaultsettings.js.map +2 -2
- package/public/browser/qcobjects-cli.js +4042 -13
- package/public/browser/qcobjects-cli.js.map +4 -4
- package/public/browser/templates/apps/spa-local.html +28 -0
- package/public/browser/templates/apps/spa-local.js +65 -0
- package/public/browser/templates/pwa/sw.js +112 -0
- package/public/cjs/com.qcobjects.cli.commands.cjs +377 -6
- package/public/cjs/com.qcobjects.cli.commands.cjs.map +4 -4
- package/public/cjs/com.qcobjects.cli.commands.jira.cjs +82 -24
- package/public/cjs/com.qcobjects.cli.commands.jira.cjs.map +4 -4
- package/public/cjs/com.qcobjects.cli.commands.jira.client_services.cjs +25 -1
- package/public/cjs/com.qcobjects.cli.commands.jira.client_services.cjs.map +2 -2
- package/public/cjs/com.qcobjects.cli.commands.version.cjs +25 -6
- package/public/cjs/com.qcobjects.cli.commands.version.cjs.map +2 -2
- package/public/cjs/index.cjs +4042 -13
- package/public/cjs/index.cjs.map +4 -4
- package/public/cjs/org.qcobjects.common.pipelog.cjs +40 -14
- package/public/cjs/org.qcobjects.common.pipelog.cjs.map +2 -2
- package/public/cjs/org.qcobjects.enterprise.commands.cjs +38 -34
- package/public/cjs/org.qcobjects.enterprise.commands.cjs.map +3 -3
- package/public/cjs/org.quickcorp.qcobjects.api.client_services.cjs +24 -2
- package/public/cjs/org.quickcorp.qcobjects.api.client_services.cjs.map +2 -2
- package/public/cjs/org.quickcorp.qcobjects.cli.cjs +1032 -118
- package/public/cjs/org.quickcorp.qcobjects.cli.cjs.map +4 -4
- package/public/cjs/org.quickcorp.qcobjects.defaultsettings.cjs +362 -334
- package/public/cjs/org.quickcorp.qcobjects.defaultsettings.cjs.map +2 -2
- package/public/cjs/qcobjects-cli.cjs +4047 -13
- package/public/cjs/qcobjects-cli.cjs.map +4 -4
- package/public/cjs/templates/apps/spa-local.html +28 -0
- package/public/cjs/templates/apps/spa-local.js +65 -0
- package/public/cjs/templates/pwa/sw.js +112 -0
- package/public/esm/com.qcobjects.cli.commands.jira.client_services.mjs +50 -57
- package/public/esm/com.qcobjects.cli.commands.jira.client_services.mjs.map +2 -2
- package/public/esm/com.qcobjects.cli.commands.jira.mjs +119 -94
- package/public/esm/com.qcobjects.cli.commands.jira.mjs.map +4 -4
- package/public/esm/com.qcobjects.cli.commands.mjs +357 -16
- package/public/esm/com.qcobjects.cli.commands.mjs.map +4 -4
- package/public/esm/com.qcobjects.cli.commands.version.mjs +204 -216
- package/public/esm/com.qcobjects.cli.commands.version.mjs.map +2 -2
- package/public/esm/index.mjs +4043 -13
- package/public/esm/index.mjs.map +4 -4
- package/public/esm/org.qcobjects.common.pipelog.mjs +21 -26
- package/public/esm/org.qcobjects.common.pipelog.mjs.map +2 -2
- package/public/esm/org.qcobjects.enterprise.commands.mjs +92 -119
- package/public/esm/org.qcobjects.enterprise.commands.mjs.map +3 -3
- package/public/esm/org.quickcorp.qcobjects.api.client_services.mjs +48 -57
- package/public/esm/org.quickcorp.qcobjects.api.client_services.mjs.map +2 -2
- package/public/esm/org.quickcorp.qcobjects.cli.mjs +1266 -380
- package/public/esm/org.quickcorp.qcobjects.cli.mjs.map +4 -4
- package/public/esm/org.quickcorp.qcobjects.defaultsettings.mjs +357 -361
- package/public/esm/org.quickcorp.qcobjects.defaultsettings.mjs.map +2 -2
- package/public/esm/qcobjects-cli.mjs +4046 -14
- package/public/esm/qcobjects-cli.mjs.map +4 -4
- package/public/esm/templates/apps/spa-local.html +28 -0
- package/public/esm/templates/apps/spa-local.js +65 -0
- package/public/esm/templates/pwa/sw.js +112 -0
- package/public/index.d.ts +140 -10
- package/src/com.qcobjects.cli.commands.jira.client_services.ts +19 -21
- package/src/com.qcobjects.cli.commands.jira.ts +11 -34
- package/src/com.qcobjects.cli.commands.ts +3 -9
- package/src/com.qcobjects.cli.commands.version.ts +1 -9
- package/src/org.qcobjects.common.pipelog.ts +18 -15
- package/src/org.qcobjects.enterprise.commands.ts +29 -50
- package/src/org.quickcorp.qcobjects.api.client_services.ts +1 -4
- package/src/org.quickcorp.qcobjects.cli.ts +28 -57
- package/src/org.quickcorp.qcobjects.defaultsettings.ts +359 -355
- package/src/qcobjects-cli.ts +4 -5
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
3
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
5
4
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
@@ -7,374 +6,371 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
7
6
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
8
7
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
9
8
|
});
|
|
10
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
11
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
-
};
|
|
13
9
|
|
|
14
10
|
// src/org.quickcorp.qcobjects.defaultsettings.ts
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
11
|
+
__require("qcobjects");
|
|
12
|
+
var { CONFIG, global, logger, _Crypt, findPackageNodePath, Export } = __require("qcobjects");
|
|
13
|
+
var __get_version__ = /* @__PURE__ */ __name(() => {
|
|
14
|
+
const path = __require("path");
|
|
15
|
+
const absolutePath = path.resolve(__dirname, "./");
|
|
16
|
+
const package_config = __require(path.resolve(process.cwd(), "package.json"));
|
|
17
|
+
const qcobjects_pkg_config = __require("qcobjects/package.json");
|
|
18
|
+
const qcobjects_sdk_pkg_config = __require("qcobjects-sdk/package.json");
|
|
19
|
+
return {
|
|
20
|
+
"qcobjects": qcobjects_pkg_config.version,
|
|
21
|
+
"sdk": qcobjects_sdk_pkg_config.version,
|
|
22
|
+
"cli": package_config.version
|
|
23
|
+
};
|
|
24
|
+
}, "__get_version__");
|
|
25
|
+
var __get_version_string__ = /* @__PURE__ */ __name(() => {
|
|
26
|
+
const version = __get_version__();
|
|
27
|
+
return "QCObjects: v" + version.qcobjects + ", SDK: v" + version.sdk + ", CLI: v" + version.cli;
|
|
28
|
+
}, "__get_version_string__");
|
|
29
|
+
Export(__get_version__);
|
|
30
|
+
Export(__get_version_string__);
|
|
31
|
+
var __load_default_settings__ = /* @__PURE__ */ __name(() => {
|
|
32
|
+
CONFIG.set("documentRootFileIndex", "index.html");
|
|
33
|
+
CONFIG.set("projectPath", `${process.cwd()}/`);
|
|
34
|
+
CONFIG.set("useConfigService", false);
|
|
35
|
+
CONFIG.set("documentRoot", "./");
|
|
36
|
+
CONFIG.set("serverPortHTTP", 80);
|
|
37
|
+
CONFIG.set("serverPortHTTPS", 443);
|
|
38
|
+
CONFIG.set("private-key-pem", "localhost-privkey.pem");
|
|
39
|
+
CONFIG.set("private-cert-pem", "localhost-cert.pem");
|
|
40
|
+
CONFIG.set("allowHTTP1", true);
|
|
41
|
+
CONFIG.set("useTemplate", false);
|
|
42
|
+
CONFIG.set("domain", "localhost");
|
|
43
|
+
const setDevMode = /* @__PURE__ */ __name((devmode) => {
|
|
44
|
+
if (typeof devmode !== "undefined") {
|
|
45
|
+
switch (true) {
|
|
46
|
+
case devmode == "debug":
|
|
47
|
+
logger.debugEnabled = true;
|
|
48
|
+
logger.warnEnabled = true;
|
|
49
|
+
logger.infoEnabled = true;
|
|
50
|
+
break;
|
|
51
|
+
case devmode == "warn":
|
|
52
|
+
logger.debugEnabled = false;
|
|
53
|
+
logger.warnEnabled = true;
|
|
54
|
+
logger.infoEnabled = true;
|
|
55
|
+
break;
|
|
56
|
+
case devmode == "info":
|
|
57
|
+
logger.debugEnabled = false;
|
|
58
|
+
logger.warnEnabled = false;
|
|
59
|
+
logger.infoEnabled = true;
|
|
60
|
+
break;
|
|
61
|
+
default:
|
|
62
|
+
logger.debugEnabled = false;
|
|
63
|
+
logger.warnEnabled = false;
|
|
64
|
+
logger.infoEnabled = false;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
logger.debugEnabled = false;
|
|
69
|
+
logger.warnEnabled = false;
|
|
70
|
+
logger.infoEnabled = false;
|
|
71
|
+
}
|
|
72
|
+
}, "setDevMode");
|
|
73
|
+
try {
|
|
74
|
+
var _config = __require(CONFIG.get("projectPath") + "config.json");
|
|
75
|
+
logger.debug("Loading settings from your config.json");
|
|
76
|
+
const _secretKey = Object.hasOwn(_config, "domain") ? _config["domain"] : "_secret_";
|
|
77
|
+
if (Object.hasOwn(_config, "__encoded__")) {
|
|
78
|
+
_config = JSON.parse(_Crypt.decrypt(_config.__encoded__, _secretKey));
|
|
79
|
+
}
|
|
80
|
+
for (var k in _config) {
|
|
81
|
+
CONFIG.set(k, _config[k]);
|
|
82
|
+
}
|
|
83
|
+
setDevMode(CONFIG.get("devmode", ""));
|
|
84
|
+
if (typeof CONFIG.get("backend") !== "undefined") {
|
|
85
|
+
global.set("backendAvailable", true);
|
|
86
|
+
if (typeof CONFIG.get("basePath") !== "undefined") {
|
|
87
|
+
logger.debug(`Changing the current directory: ${process.cwd()}`);
|
|
77
88
|
try {
|
|
78
|
-
|
|
79
|
-
logger.debug(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
_config = JSON.parse(_Crypt.decrypt(_config.__encoded__, _secretKey));
|
|
83
|
-
}
|
|
84
|
-
for (var k in _config) {
|
|
85
|
-
CONFIG.set(k, _config[k]);
|
|
86
|
-
}
|
|
87
|
-
setDevMode(CONFIG.get("devmode", ""));
|
|
88
|
-
if (typeof CONFIG.get("backend") !== "undefined") {
|
|
89
|
-
global.set("backendAvailable", true);
|
|
90
|
-
if (typeof CONFIG.get("basePath") !== "undefined") {
|
|
91
|
-
logger.debug(`Changing the current directory: ${process.cwd()}`);
|
|
92
|
-
try {
|
|
93
|
-
process.chdir(CONFIG.get("basePath"));
|
|
94
|
-
logger.debug(`New directory: ${process.cwd()}`);
|
|
95
|
-
} catch (err) {
|
|
96
|
-
logger.warn(`It was impossible to change the current chdir: ${err}`);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
} catch (e) {
|
|
101
|
-
logger.debug(e);
|
|
102
|
-
logger.debug("Something went wrong trying to load config.json file in your project");
|
|
89
|
+
process.chdir(CONFIG.get("basePath"));
|
|
90
|
+
logger.debug(`New directory: ${process.cwd()}`);
|
|
91
|
+
} catch (err) {
|
|
92
|
+
logger.warn(`It was impossible to change the current chdir: ${err}`);
|
|
103
93
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
"microservice": "com.qcobjects.backend.microservice.static",
|
|
135
|
-
"redirect_to": path.resolve(sdkPath, "src/QCObjects-SDK.js"),
|
|
136
|
-
"responseHeaders": {},
|
|
137
|
-
"cors": {
|
|
138
|
-
"allow_origins": "*"
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
"name": "QCObjects-SDK Components",
|
|
143
|
-
"description": "Redirection of QCObjects SDK",
|
|
144
|
-
"path": "^/qcobjects-sdk/(.*)$",
|
|
145
|
-
"microservice": "com.qcobjects.backend.microservice.static",
|
|
146
|
-
"redirect_to": path.resolve(sdkPath, "$1"),
|
|
147
|
-
"responseHeaders": {},
|
|
148
|
-
"cors": {
|
|
149
|
-
"allow_origins": "*"
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
]);
|
|
153
|
-
CONFIG.set("backend", backend);
|
|
154
|
-
resolve();
|
|
155
|
-
});
|
|
156
|
-
}, "loadDefaultRoutes");
|
|
157
|
-
await loadDefaultRoutes();
|
|
158
|
-
})().then(() => logger.info("Default routes loaded")).catch((e) => {
|
|
159
|
-
logger.warn(`An error ocurred loading default settings: ${e}`);
|
|
160
|
-
});
|
|
161
|
-
(function() {
|
|
162
|
-
const path = __require("path");
|
|
163
|
-
const fs = __require("fs");
|
|
164
|
-
const projectPath = CONFIG.get("projectPath", `${process.cwd()}/`);
|
|
165
|
-
logger.debug(`CONFIG.projectPath is set to ${projectPath}`);
|
|
166
|
-
const findPath = /* @__PURE__ */ __name((p) => {
|
|
167
|
-
const packagePath = path.resolve(findPackageNodePath(p), p);
|
|
168
|
-
return packagePath;
|
|
169
|
-
}, "findPath");
|
|
170
|
-
const getPackageJSON = /* @__PURE__ */ __name((p) => {
|
|
171
|
-
let _json;
|
|
172
|
-
try {
|
|
173
|
-
const packagePath = findPath(p);
|
|
174
|
-
if (typeof packagePath !== "undefined") {
|
|
175
|
-
_json = JSON.parse(fs.readFileSync(path.resolve(`${packagePath}`, "./package.json")).toString());
|
|
176
|
-
} else {
|
|
177
|
-
_json = {};
|
|
178
|
-
}
|
|
179
|
-
} catch (e) {
|
|
180
|
-
logger.debug(`It was impossible to get the package.json from ${p}: ${e}`);
|
|
181
|
-
_json = {};
|
|
182
|
-
}
|
|
183
|
-
return _json;
|
|
184
|
-
}, "getPackageJSON");
|
|
185
|
-
const hasKeyword = /* @__PURE__ */ (() => {
|
|
186
|
-
let keywords = {};
|
|
187
|
-
return (p, keyword) => {
|
|
188
|
-
if (typeof keywords === "undefined") {
|
|
189
|
-
keywords = {};
|
|
190
|
-
}
|
|
191
|
-
try {
|
|
192
|
-
if (typeof keywords[p] === "undefined") {
|
|
193
|
-
keywords[p] = getPackageJSON(p).keywords;
|
|
194
|
-
}
|
|
195
|
-
} catch (e) {
|
|
196
|
-
throw Error(`Something went wrong when trying to get the keywords of ${p}`);
|
|
197
|
-
}
|
|
198
|
-
return typeof keywords[p] !== "undefined" && keywords[p].includes(keyword);
|
|
199
|
-
};
|
|
200
|
-
})();
|
|
201
|
-
const setBackendValue = /* @__PURE__ */ __name((name, value) => {
|
|
202
|
-
const backend = CONFIG.get("backend", {});
|
|
203
|
-
if (typeof value !== "undefined") {
|
|
204
|
-
backend[name] = value;
|
|
205
|
-
}
|
|
206
|
-
CONFIG.set("backend", backend);
|
|
207
|
-
}, "setBackendValue");
|
|
208
|
-
const dependencies = /* @__PURE__ */ (() => {
|
|
209
|
-
let deps = [];
|
|
210
|
-
return () => {
|
|
211
|
-
if (typeof deps === "undefined") {
|
|
212
|
-
deps = Object.keys(JSON.parse(fs.readFileSync(path.resolve(`${projectPath}`, "./package.json")).toString()).dependencies);
|
|
213
|
-
setBackendValue("dependencies", deps);
|
|
214
|
-
}
|
|
215
|
-
return deps;
|
|
216
|
-
};
|
|
217
|
-
})();
|
|
218
|
-
const devDependencies = /* @__PURE__ */ (() => {
|
|
219
|
-
let deps = [];
|
|
220
|
-
return () => {
|
|
221
|
-
if (typeof deps === "undefined") {
|
|
222
|
-
deps = Object.keys(JSON.parse(fs.readFileSync(path.resolve(`${projectPath}`, "./package.json")).toString()).devDependencies);
|
|
223
|
-
setBackendValue("devDependencies", deps);
|
|
224
|
-
}
|
|
225
|
-
return deps;
|
|
226
|
-
};
|
|
227
|
-
})();
|
|
228
|
-
const loadLibs = /* @__PURE__ */ __name(() => {
|
|
229
|
-
let _ret_;
|
|
230
|
-
if (CONFIG.get("autodiscover", false) || CONFIG.get("autodiscover_libs", false)) {
|
|
231
|
-
const libs = dependencies().filter((p) => hasKeyword(p, "qcobjects-lib"));
|
|
232
|
-
setBackendValue("libs", libs);
|
|
233
|
-
if (libs.length > 0) {
|
|
234
|
-
logger.debug(`Plugin Libs found: ${libs.join(",")}`);
|
|
235
|
-
_ret_ = Promise.all(libs.map((p) => {
|
|
236
|
-
return __require(findPath(p));
|
|
237
|
-
})).then(() => logger.info("Libs loaded"));
|
|
238
|
-
} else {
|
|
239
|
-
logger.debug("No Plugin Libs found.");
|
|
240
|
-
_ret_ = Promise.resolve();
|
|
241
|
-
}
|
|
242
|
-
} else {
|
|
243
|
-
logger.debug("To load libs, set autodiscover_libs to true in your config.json");
|
|
244
|
-
_ret_ = Promise.resolve();
|
|
245
|
-
}
|
|
246
|
-
return _ret_;
|
|
247
|
-
}, "loadLibs");
|
|
248
|
-
const loadHandlers = /* @__PURE__ */ __name(() => {
|
|
249
|
-
let _ret_;
|
|
250
|
-
if (CONFIG.get("autodiscover", false) || CONFIG.get("autodiscover_handlers", false)) {
|
|
251
|
-
const handlers = dependencies().filter((p) => hasKeyword(p, "qcobjects-handler"));
|
|
252
|
-
setBackendValue("handlers", handlers);
|
|
253
|
-
if (handlers.length > 0) {
|
|
254
|
-
logger.debug(`Plugin Handlers found: ${handlers.join(",")}`);
|
|
255
|
-
_ret_ = Promise.all(handlers.map((p) => {
|
|
256
|
-
return __require(findPath(p));
|
|
257
|
-
})).then(() => logger.info("Handlers loaded"));
|
|
258
|
-
} else {
|
|
259
|
-
logger.debug("No Plugin Handlers found.");
|
|
260
|
-
_ret_ = Promise.resolve();
|
|
261
|
-
}
|
|
262
|
-
} else {
|
|
263
|
-
logger.debug("To load handlers, set autodiscover_handlers to true in your config.json");
|
|
264
|
-
_ret_ = Promise.resolve();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
} catch (e) {
|
|
97
|
+
logger.debug(e);
|
|
98
|
+
logger.debug("Something went wrong trying to load config.json file in your project");
|
|
99
|
+
}
|
|
100
|
+
(async function() {
|
|
101
|
+
const path = __require("path");
|
|
102
|
+
const projectPath = CONFIG.get("projectPath", `${process.cwd()}/`);
|
|
103
|
+
const loadDefaultRoutes = /* @__PURE__ */ __name(async () => {
|
|
104
|
+
return await new Promise((resolve, reject) => {
|
|
105
|
+
const sdkPath = path.resolve(findPackageNodePath("qcobjects-sdk"), "qcobjects-sdk");
|
|
106
|
+
const qcobjectsPath = path.resolve(findPackageNodePath("qcobjects"), "qcobjects");
|
|
107
|
+
let backend = CONFIG.get("backend");
|
|
108
|
+
if (typeof backend === "undefined") {
|
|
109
|
+
backend = {};
|
|
110
|
+
}
|
|
111
|
+
if (typeof backend.routes === "undefined") {
|
|
112
|
+
backend.routes = [];
|
|
113
|
+
}
|
|
114
|
+
backend.routes = backend.routes.concat([
|
|
115
|
+
{
|
|
116
|
+
"name": "QCObjects.js",
|
|
117
|
+
"description": "Redirection of QCObjects.js",
|
|
118
|
+
"path": "^/QCObjects.js$",
|
|
119
|
+
"microservice": "com.qcobjects.backend.microservice.static",
|
|
120
|
+
"redirect_to": path.resolve(qcobjectsPath, "src", "QCObjects.js"),
|
|
121
|
+
"responseHeaders": {},
|
|
122
|
+
"cors": {
|
|
123
|
+
"allow_origins": "*"
|
|
265
124
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
_ret_ = Promise.all(commands.map((p) => {
|
|
277
|
-
return __require(findPath(p));
|
|
278
|
-
})).then(() => logger.info("Commands loaded"));
|
|
279
|
-
} else {
|
|
280
|
-
logger.debug("No Plugin Commands found.");
|
|
281
|
-
_ret_ = Promise.resolve();
|
|
282
|
-
}
|
|
283
|
-
} else {
|
|
284
|
-
logger.debug("To load commands, set autodiscover_commands to true in your config.json");
|
|
285
|
-
_ret_ = Promise.resolve();
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "QCObjects-SDK.js",
|
|
128
|
+
"description": "Redirection of QCObjects SDK",
|
|
129
|
+
"path": "^/js/packages/QCObjects-SDK.js$",
|
|
130
|
+
"microservice": "com.qcobjects.backend.microservice.static",
|
|
131
|
+
"redirect_to": path.resolve(sdkPath, "src/QCObjects-SDK.js"),
|
|
132
|
+
"responseHeaders": {},
|
|
133
|
+
"cors": {
|
|
134
|
+
"allow_origins": "*"
|
|
286
135
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
_ret_ = Promise.all(commands.map((p) => {
|
|
298
|
-
return __require(findPath(p));
|
|
299
|
-
})).then(() => logger.info("Commands loaded"));
|
|
300
|
-
} else {
|
|
301
|
-
logger.debug("No Plugin Commands found in dev dependencies.");
|
|
302
|
-
_ret_ = Promise.resolve();
|
|
303
|
-
}
|
|
304
|
-
} else {
|
|
305
|
-
logger.debug("To load commands, set autodiscover_commands to true in your config.json");
|
|
306
|
-
_ret_ = Promise.resolve();
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"name": "QCObjects-SDK Components",
|
|
139
|
+
"description": "Redirection of QCObjects SDK",
|
|
140
|
+
"path": "^/qcobjects-sdk/(.*)$",
|
|
141
|
+
"microservice": "com.qcobjects.backend.microservice.static",
|
|
142
|
+
"redirect_to": path.resolve(sdkPath, "$1"),
|
|
143
|
+
"responseHeaders": {},
|
|
144
|
+
"cors": {
|
|
145
|
+
"allow_origins": "*"
|
|
307
146
|
}
|
|
308
|
-
return _ret_;
|
|
309
|
-
}, "loadDevCommands");
|
|
310
|
-
if (CONFIG.get("autodiscover", false) || CONFIG.get("autodiscover_libs", false) || CONFIG.get("autodiscover_handlers", false) || CONFIG.get("autodiscover_commands", false)) {
|
|
311
|
-
logger.info("Auto discover is enabled");
|
|
312
|
-
} else if (!CONFIG.get("autodiscover", false)) {
|
|
313
|
-
logger.info("Auto discover is disabled");
|
|
314
|
-
logger.debug("To load all dependencies, set autodiscover to true in your config.json");
|
|
315
|
-
} else {
|
|
316
|
-
logger.info("Auto discover is disabled");
|
|
317
|
-
}
|
|
318
|
-
try {
|
|
319
|
-
logger.debug("Loading Libs...");
|
|
320
|
-
loadLibs().catch((e) => {
|
|
321
|
-
logger.warn(`An error ocurred loading libs: ${e}`);
|
|
322
|
-
});
|
|
323
|
-
} catch (e) {
|
|
324
|
-
throw Error(`Something went wrong trying to load libs: ${e.message}`);
|
|
325
|
-
}
|
|
326
|
-
try {
|
|
327
|
-
logger.debug("Loading Handlers...");
|
|
328
|
-
loadHandlers().catch((e) => {
|
|
329
|
-
logger.warn(`An error ocurred loading handlers: ${e}`);
|
|
330
|
-
});
|
|
331
|
-
} catch (e) {
|
|
332
|
-
throw Error(`Something went wrong trying to load handler: ${e.message}`);
|
|
333
|
-
}
|
|
334
|
-
try {
|
|
335
|
-
logger.debug("Loading Commands...");
|
|
336
|
-
loadCommands().catch((e) => {
|
|
337
|
-
logger.warn(`An error ocurred loading commands: ${e}`);
|
|
338
|
-
});
|
|
339
|
-
} catch (e) {
|
|
340
|
-
throw Error(`Something went wrong trying to load commands: ${e.message}`);
|
|
341
147
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
148
|
+
]);
|
|
149
|
+
CONFIG.set("backend", backend);
|
|
150
|
+
resolve();
|
|
151
|
+
});
|
|
152
|
+
}, "loadDefaultRoutes");
|
|
153
|
+
await loadDefaultRoutes();
|
|
154
|
+
})().then(() => logger.info("Default routes loaded")).catch((e) => {
|
|
155
|
+
logger.warn(`An error ocurred loading default settings: ${e}`);
|
|
156
|
+
});
|
|
157
|
+
(function() {
|
|
158
|
+
const path = __require("path");
|
|
159
|
+
const fs = __require("fs");
|
|
160
|
+
const projectPath = CONFIG.get("projectPath", `${process.cwd()}/`);
|
|
161
|
+
logger.debug(`CONFIG.projectPath is set to ${projectPath}`);
|
|
162
|
+
const findPath = /* @__PURE__ */ __name((p) => {
|
|
163
|
+
const packagePath = path.resolve(findPackageNodePath(p), p);
|
|
164
|
+
return packagePath;
|
|
165
|
+
}, "findPath");
|
|
166
|
+
const getPackageJSON = /* @__PURE__ */ __name((p) => {
|
|
167
|
+
let _json;
|
|
168
|
+
try {
|
|
169
|
+
const packagePath = findPath(p);
|
|
170
|
+
if (typeof packagePath !== "undefined") {
|
|
171
|
+
_json = JSON.parse(fs.readFileSync(path.resolve(`${packagePath}`, "./package.json")).toString());
|
|
172
|
+
} else {
|
|
173
|
+
_json = {};
|
|
174
|
+
}
|
|
175
|
+
} catch (e) {
|
|
176
|
+
logger.debug(`It was impossible to get the package.json from ${p}: ${e}`);
|
|
177
|
+
_json = {};
|
|
178
|
+
}
|
|
179
|
+
return _json;
|
|
180
|
+
}, "getPackageJSON");
|
|
181
|
+
const hasKeyword = /* @__PURE__ */ (() => {
|
|
182
|
+
let keywords = {};
|
|
183
|
+
return (p, keyword) => {
|
|
184
|
+
if (typeof keywords === "undefined") {
|
|
185
|
+
keywords = {};
|
|
186
|
+
}
|
|
187
|
+
try {
|
|
188
|
+
if (typeof keywords[p] === "undefined") {
|
|
189
|
+
keywords[p] = getPackageJSON(p).keywords;
|
|
356
190
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
})();
|
|
363
|
-
}, "__load_default_settings__");
|
|
364
|
-
global.__load_default_settings__ = __load_default_settings__;
|
|
365
|
-
global.__load_default_settings__();
|
|
366
|
-
const cleanCache = /* @__PURE__ */ __name(() => {
|
|
367
|
-
Object.keys(__require.cache).forEach((key) => {
|
|
368
|
-
delete __require.cache[key];
|
|
369
|
-
});
|
|
370
|
-
}, "cleanCache");
|
|
371
|
-
const __reset_settings__ = /* @__PURE__ */ __name(() => {
|
|
372
|
-
cleanCache();
|
|
373
|
-
global.__load_default_settings__();
|
|
374
|
-
}, "__reset_settings__");
|
|
375
|
-
global.__reset_settings__ = __reset_settings__;
|
|
191
|
+
} catch (e) {
|
|
192
|
+
throw Error(`Something went wrong when trying to get the keywords of ${p}`);
|
|
193
|
+
}
|
|
194
|
+
return typeof keywords[p] !== "undefined" && keywords[p].includes(keyword);
|
|
195
|
+
};
|
|
376
196
|
})();
|
|
377
|
-
|
|
378
|
-
});
|
|
379
|
-
|
|
197
|
+
const setBackendValue = /* @__PURE__ */ __name((name, value) => {
|
|
198
|
+
const backend = CONFIG.get("backend", {});
|
|
199
|
+
if (typeof value !== "undefined") {
|
|
200
|
+
backend[name] = value;
|
|
201
|
+
}
|
|
202
|
+
CONFIG.set("backend", backend);
|
|
203
|
+
}, "setBackendValue");
|
|
204
|
+
const dependencies = /* @__PURE__ */ (() => {
|
|
205
|
+
let deps = [];
|
|
206
|
+
return () => {
|
|
207
|
+
if (typeof deps === "undefined") {
|
|
208
|
+
deps = Object.keys(JSON.parse(fs.readFileSync(path.resolve(`${projectPath}`, "./package.json")).toString()).dependencies);
|
|
209
|
+
setBackendValue("dependencies", deps);
|
|
210
|
+
}
|
|
211
|
+
return deps;
|
|
212
|
+
};
|
|
213
|
+
})();
|
|
214
|
+
const devDependencies = /* @__PURE__ */ (() => {
|
|
215
|
+
let deps = [];
|
|
216
|
+
return () => {
|
|
217
|
+
if (typeof deps === "undefined") {
|
|
218
|
+
deps = Object.keys(JSON.parse(fs.readFileSync(path.resolve(`${projectPath}`, "./package.json")).toString()).devDependencies);
|
|
219
|
+
setBackendValue("devDependencies", deps);
|
|
220
|
+
}
|
|
221
|
+
return deps;
|
|
222
|
+
};
|
|
223
|
+
})();
|
|
224
|
+
const loadLibs = /* @__PURE__ */ __name(() => {
|
|
225
|
+
let _ret_;
|
|
226
|
+
if (CONFIG.get("autodiscover", false) || CONFIG.get("autodiscover_libs", false)) {
|
|
227
|
+
const libs = dependencies().filter((p) => hasKeyword(p, "qcobjects-lib"));
|
|
228
|
+
setBackendValue("libs", libs);
|
|
229
|
+
if (libs.length > 0) {
|
|
230
|
+
logger.debug(`Plugin Libs found: ${libs.join(",")}`);
|
|
231
|
+
_ret_ = Promise.all(libs.map((p) => {
|
|
232
|
+
return __require(findPath(p));
|
|
233
|
+
})).then(() => logger.info("Libs loaded"));
|
|
234
|
+
} else {
|
|
235
|
+
logger.debug("No Plugin Libs found.");
|
|
236
|
+
_ret_ = Promise.resolve();
|
|
237
|
+
}
|
|
238
|
+
} else {
|
|
239
|
+
logger.debug("To load libs, set autodiscover_libs to true in your config.json");
|
|
240
|
+
_ret_ = Promise.resolve();
|
|
241
|
+
}
|
|
242
|
+
return _ret_;
|
|
243
|
+
}, "loadLibs");
|
|
244
|
+
const loadHandlers = /* @__PURE__ */ __name(() => {
|
|
245
|
+
let _ret_;
|
|
246
|
+
if (CONFIG.get("autodiscover", false) || CONFIG.get("autodiscover_handlers", false)) {
|
|
247
|
+
const handlers = dependencies().filter((p) => hasKeyword(p, "qcobjects-handler"));
|
|
248
|
+
setBackendValue("handlers", handlers);
|
|
249
|
+
if (handlers.length > 0) {
|
|
250
|
+
logger.debug(`Plugin Handlers found: ${handlers.join(",")}`);
|
|
251
|
+
_ret_ = Promise.all(handlers.map((p) => {
|
|
252
|
+
return __require(findPath(p));
|
|
253
|
+
})).then(() => logger.info("Handlers loaded"));
|
|
254
|
+
} else {
|
|
255
|
+
logger.debug("No Plugin Handlers found.");
|
|
256
|
+
_ret_ = Promise.resolve();
|
|
257
|
+
}
|
|
258
|
+
} else {
|
|
259
|
+
logger.debug("To load handlers, set autodiscover_handlers to true in your config.json");
|
|
260
|
+
_ret_ = Promise.resolve();
|
|
261
|
+
}
|
|
262
|
+
return _ret_;
|
|
263
|
+
}, "loadHandlers");
|
|
264
|
+
const loadCommands = /* @__PURE__ */ __name(() => {
|
|
265
|
+
let _ret_;
|
|
266
|
+
logger.debug(`Looking for custom commands as dependencies in: ${projectPath}/package.json`);
|
|
267
|
+
if (CONFIG.get("autodiscover", false) || CONFIG.get("autodiscover_commands", false)) {
|
|
268
|
+
const commands = dependencies().filter((p) => hasKeyword(p, "qcobjects-command"));
|
|
269
|
+
setBackendValue("commands", commands);
|
|
270
|
+
if (commands.length > 0) {
|
|
271
|
+
logger.debug(`Plugin Commands found: ${commands.join(",")}`);
|
|
272
|
+
_ret_ = Promise.all(commands.map((p) => {
|
|
273
|
+
return __require(findPath(p));
|
|
274
|
+
})).then(() => logger.info("Commands loaded"));
|
|
275
|
+
} else {
|
|
276
|
+
logger.debug("No Plugin Commands found.");
|
|
277
|
+
_ret_ = Promise.resolve();
|
|
278
|
+
}
|
|
279
|
+
} else {
|
|
280
|
+
logger.debug("To load commands, set autodiscover_commands to true in your config.json");
|
|
281
|
+
_ret_ = Promise.resolve();
|
|
282
|
+
}
|
|
283
|
+
return _ret_;
|
|
284
|
+
}, "loadCommands");
|
|
285
|
+
const loadDevCommands = /* @__PURE__ */ __name(() => {
|
|
286
|
+
let _ret_;
|
|
287
|
+
logger.debug(`Looking for custom commands as dev dependencies in: ${projectPath}/package.json`);
|
|
288
|
+
if (CONFIG.get("autodiscover", false) || CONFIG.get("autodiscover_commands", false)) {
|
|
289
|
+
const commands = devDependencies().filter((p) => hasKeyword(p, "qcobjects-command"));
|
|
290
|
+
setBackendValue("devCommands", commands);
|
|
291
|
+
if (commands.length > 0) {
|
|
292
|
+
logger.debug(`Dev Plugin Commands found: ${commands.join(",")}`);
|
|
293
|
+
_ret_ = Promise.all(commands.map((p) => {
|
|
294
|
+
return __require(findPath(p));
|
|
295
|
+
})).then(() => logger.info("Commands loaded"));
|
|
296
|
+
} else {
|
|
297
|
+
logger.debug("No Plugin Commands found in dev dependencies.");
|
|
298
|
+
_ret_ = Promise.resolve();
|
|
299
|
+
}
|
|
300
|
+
} else {
|
|
301
|
+
logger.debug("To load commands, set autodiscover_commands to true in your config.json");
|
|
302
|
+
_ret_ = Promise.resolve();
|
|
303
|
+
}
|
|
304
|
+
return _ret_;
|
|
305
|
+
}, "loadDevCommands");
|
|
306
|
+
if (CONFIG.get("autodiscover", false) || CONFIG.get("autodiscover_libs", false) || CONFIG.get("autodiscover_handlers", false) || CONFIG.get("autodiscover_commands", false)) {
|
|
307
|
+
logger.info("Auto discover is enabled");
|
|
308
|
+
} else if (!CONFIG.get("autodiscover", false)) {
|
|
309
|
+
logger.info("Auto discover is disabled");
|
|
310
|
+
logger.debug("To load all dependencies, set autodiscover to true in your config.json");
|
|
311
|
+
} else {
|
|
312
|
+
logger.info("Auto discover is disabled");
|
|
313
|
+
}
|
|
314
|
+
try {
|
|
315
|
+
logger.debug("Loading Libs...");
|
|
316
|
+
loadLibs().catch((e) => {
|
|
317
|
+
logger.warn(`An error ocurred loading libs: ${e}`);
|
|
318
|
+
});
|
|
319
|
+
} catch (e) {
|
|
320
|
+
throw Error(`Something went wrong trying to load libs: ${e.message}`);
|
|
321
|
+
}
|
|
322
|
+
try {
|
|
323
|
+
logger.debug("Loading Handlers...");
|
|
324
|
+
loadHandlers().catch((e) => {
|
|
325
|
+
logger.warn(`An error ocurred loading handlers: ${e}`);
|
|
326
|
+
});
|
|
327
|
+
} catch (e) {
|
|
328
|
+
throw Error(`Something went wrong trying to load handler: ${e.message}`);
|
|
329
|
+
}
|
|
330
|
+
try {
|
|
331
|
+
logger.debug("Loading Commands...");
|
|
332
|
+
loadCommands().catch((e) => {
|
|
333
|
+
logger.warn(`An error ocurred loading commands: ${e}`);
|
|
334
|
+
});
|
|
335
|
+
} catch (e) {
|
|
336
|
+
throw Error(`Something went wrong trying to load commands: ${e.message}`);
|
|
337
|
+
}
|
|
338
|
+
try {
|
|
339
|
+
logger.debug("Loading Dev Commands...");
|
|
340
|
+
loadDevCommands().catch((e) => {
|
|
341
|
+
logger.warn(`An error ocurred loading dev commands: ${e}`);
|
|
342
|
+
});
|
|
343
|
+
} catch (e) {
|
|
344
|
+
throw Error(`Something went wrong trying to load Dev commands: ${e.message}`);
|
|
345
|
+
}
|
|
346
|
+
try {
|
|
347
|
+
const commands = CONFIG.get("backend", { commands: [] }).commands || [];
|
|
348
|
+
const devCommands = CONFIG.get("backend", { devCommands: [] }).devCommands || [];
|
|
349
|
+
setBackendValue("plugins", commands.concat(devCommands));
|
|
350
|
+
} catch (e) {
|
|
351
|
+
throw Error(`Something went wrong trying to load plugins list: ${e.message}`);
|
|
352
|
+
}
|
|
353
|
+
logger.info("Dependencies loaded");
|
|
354
|
+
process.once("SIGTERM", () => {
|
|
355
|
+
console.log("\x1B[33m%s\x1B[0m", "Bye bye!");
|
|
356
|
+
process.exit();
|
|
357
|
+
});
|
|
358
|
+
})();
|
|
359
|
+
}, "__load_default_settings__");
|
|
360
|
+
global.__load_default_settings__ = __load_default_settings__;
|
|
361
|
+
global.__load_default_settings__();
|
|
362
|
+
var cleanCache = /* @__PURE__ */ __name(() => {
|
|
363
|
+
Object.keys(__require.cache).forEach((key) => {
|
|
364
|
+
delete __require.cache[key];
|
|
365
|
+
});
|
|
366
|
+
}, "cleanCache");
|
|
367
|
+
var __reset_settings__ = /* @__PURE__ */ __name(() => {
|
|
368
|
+
cleanCache();
|
|
369
|
+
global.__load_default_settings__();
|
|
370
|
+
}, "__reset_settings__");
|
|
371
|
+
global.__reset_settings__ = __reset_settings__;
|
|
372
|
+
export {
|
|
373
|
+
__get_version__,
|
|
374
|
+
__get_version_string__
|
|
375
|
+
};
|
|
380
376
|
//# sourceMappingURL=org.quickcorp.qcobjects.defaultsettings.mjs.map
|