qcobjects-cli 2.4.32 → 2.4.34
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/.dockerignore +2 -0
- package/.eslintignore +7 -0
- package/.eslintrc.cjs +22 -0
- package/VERSION +1 -1
- package/package.json +45 -24
- package/{backend → src/backend}/com.qcobjects.backend.microservice.static.js +26 -26
- package/{backend → src/backend}/org.qcobjects.backend.php.js +45 -38
- package/{com.qcobjects.cli.commands.jira.js → src/com.qcobjects.cli.commands.jira.js} +1 -1
- package/{com.qcobjects.cli.commands.js → src/com.qcobjects.cli.commands.js} +1 -1
- package/{com.qcobjects.cli.commands.version.js → src/com.qcobjects.cli.commands.version.js} +1 -1
- package/src/index.cjs +2 -0
- package/src/index.d.ts +2 -0
- package/src/index.mjs +2 -0
- package/src/index.ts +2 -0
- package/{org.qcobjects.enterprise.commands.js → src/org.qcobjects.enterprise.commands.js} +1 -1
- package/{org.quickcorp.qcobjects.cli.js → src/org.quickcorp.qcobjects.cli.js} +265 -252
- package/src/org.quickcorp.qcobjects.defaultsettings.js +293 -0
- package/{qcobjects-cli.js → src/qcobjects-cli.js} +5 -3
- package/.eslintrc.json +0 -15
- package/org.quickcorp.qcobjects.defaultsettings.js +0 -242
- /package/{com.qcobjects.cli.commands.jira.client_services.js → src/com.qcobjects.cli.commands.jira.client_services.js} +0 -0
- /package/{org.qcobjects.common.pipelog.js → src/org.qcobjects.common.pipelog.js} +0 -0
- /package/{org.quickcorp.qcobjects.api.client_services.js → src/org.quickcorp.qcobjects.api.client_services.js} +0 -0
- /package/{org.quickcorp.qcobjects.collab.server.js → src/org.quickcorp.qcobjects.collab.server.js} +0 -0
- /package/{org.quickcorp.qcobjects.main.file.js → src/org.quickcorp.qcobjects.main.file.js} +0 -0
- /package/{org.quickcorp.qcobjects.main.http.gae.server.js → src/org.quickcorp.qcobjects.main.http.gae.server.js} +0 -0
- /package/{org.quickcorp.qcobjects.main.http.server.js → src/org.quickcorp.qcobjects.main.http.server.js} +0 -0
- /package/{org.quickcorp.qcobjects.main.http2.server.js → src/org.quickcorp.qcobjects.main.http2.server.js} +0 -0
- /package/{qcobjects-collab.js → src/qcobjects-collab.js} +0 -0
- /package/{qcobjects-createcert.js → src/qcobjects-createcert.js} +0 -0
- /package/{qcobjects-gae-http-server.js → src/qcobjects-gae-http-server.js} +0 -0
- /package/{qcobjects-http-server.js → src/qcobjects-http-server.js} +0 -0
- /package/{qcobjects-http2-server.js → src/qcobjects-http2-server.js} +0 -0
- /package/{qcobjects-shell.js → src/qcobjects-shell.js} +0 -0
- /package/{templates → src/templates}/apps/spa-local.html +0 -0
- /package/{templates → src/templates}/apps/spa-local.js +0 -0
- /package/{templates → src/templates}/pwa/sw.js +0 -0
package/.dockerignore
ADDED
package/.eslintignore
ADDED
package/.eslintrc.cjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
node: true,
|
|
5
|
+
es2021: true,
|
|
6
|
+
es2020: true,
|
|
7
|
+
es2017: true,
|
|
8
|
+
es6: true
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
extends: [
|
|
12
|
+
"semistandard",
|
|
13
|
+
"standard",
|
|
14
|
+
"prettier",
|
|
15
|
+
"eslint:recommended", "plugin:@typescript-eslint/recommended",
|
|
16
|
+
"qcobjects"
|
|
17
|
+
|
|
18
|
+
],
|
|
19
|
+
parser: "@typescript-eslint/parser",
|
|
20
|
+
plugins: ["@typescript-eslint"],
|
|
21
|
+
root: true
|
|
22
|
+
};
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.4.
|
|
1
|
+
2.4.34
|
package/package.json
CHANGED
|
@@ -1,31 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qcobjects-cli",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.34",
|
|
4
4
|
"description": "qcobjects cli command line tool",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "src/index.cjs",
|
|
6
|
+
"module": "src/index.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"require": "./src/index.cjs",
|
|
10
|
+
"import": "./src/index.mjs"
|
|
11
|
+
},
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"type": "commonjs",
|
|
15
|
+
"types": "./src/index.d.ts",
|
|
16
|
+
"license": "LGPL-3.0",
|
|
6
17
|
"scripts": {
|
|
7
18
|
"sync": "git add . && git commit -am ",
|
|
8
|
-
"test": "
|
|
19
|
+
"test": "(npm run lint && (npx jasmine))",
|
|
20
|
+
"lint": "(npx eslint ./**/*.ts --fix --ext ts)",
|
|
9
21
|
"preversion": "npm cache verify && npm test",
|
|
10
22
|
"postversion": "git push && git push --tags"
|
|
11
23
|
},
|
|
12
24
|
"dependencies": {
|
|
13
|
-
"commander": "^
|
|
25
|
+
"commander": "^10.0.1",
|
|
14
26
|
"mime": "^2.4.7",
|
|
15
|
-
"qcobjects": "^2.4.
|
|
16
|
-
"qcobjects-sdk": "^2.4.
|
|
27
|
+
"qcobjects": "^2.4.67",
|
|
28
|
+
"qcobjects-sdk": "^2.4.30",
|
|
17
29
|
"yaml": "^1.10.2"
|
|
18
30
|
},
|
|
19
31
|
"devDependencies": {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
32
|
+
"@types/qcobjects": "github:QCObjects/-types-qcobjects",
|
|
33
|
+
"@types/qcobjects-sdk": "github:QCObjects/-types-qcobjects-sdk",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
|
35
|
+
"@typescript-eslint/parser": "^5.58.0",
|
|
36
|
+
"eslint": "^8.38.0",
|
|
37
|
+
"eslint-config-prettier": "^8.8.0",
|
|
38
|
+
"eslint-config-qcobjects": "^0.0.26",
|
|
39
|
+
"eslint-config-semistandard": "^17.0.0",
|
|
40
|
+
"eslint-config-standard": "^17.0.0",
|
|
41
|
+
"eslint-plugin-import": "^2.27.5",
|
|
42
|
+
"eslint-plugin-n": "^15.7.0",
|
|
43
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
22
44
|
"jasmine": "^3.99.0",
|
|
23
|
-
"qcobjects": "^2.4.
|
|
24
|
-
"qcobjects-sdk": "^2.4.
|
|
45
|
+
"qcobjects": "^2.4.67",
|
|
46
|
+
"qcobjects-sdk": "^2.4.30"
|
|
25
47
|
},
|
|
26
48
|
"peerDependencies": {
|
|
27
|
-
"qcobjects": "^2.4.
|
|
28
|
-
"qcobjects-sdk": "^2.4.
|
|
49
|
+
"qcobjects": "^2.4.67",
|
|
50
|
+
"qcobjects-sdk": "^2.4.30"
|
|
29
51
|
},
|
|
30
52
|
"repository": {
|
|
31
53
|
"type": "file",
|
|
@@ -49,25 +71,24 @@
|
|
|
49
71
|
"qcobjects"
|
|
50
72
|
],
|
|
51
73
|
"author": "Jean Machuca <correojean@gmail.com>",
|
|
52
|
-
"license": "LGPL-3.0",
|
|
53
74
|
"bugs": {
|
|
54
75
|
"url": "https://gitlab.com/api/v4/projects/12435344/issues?private_token=Wys-MPRmB1sSFn3eeX84"
|
|
55
76
|
},
|
|
56
77
|
"homepage": "https://qcobjects.dev",
|
|
57
78
|
"bin": {
|
|
58
|
-
"qco": "./qcobjects-cli.js",
|
|
59
|
-
"qcobjects": "./qcobjects-cli.js",
|
|
60
|
-
"qcobjects-cli": "./qcobjects-cli.js",
|
|
61
|
-
"qcobjects-server": "./qcobjects-http2-server.js",
|
|
62
|
-
"qcobjects-http2-server": "./qcobjects-http2-server.js",
|
|
63
|
-
"qcobjects-shell": "./qcobjects-shell.js",
|
|
64
|
-
"qcobjects-createcert": "./qcobjects-createcert.js",
|
|
65
|
-
"qcobjects-gae-server": "./qcobjects-gae-http-server.js",
|
|
66
|
-
"qcobjects-http-server": "./qcobjects-http-server.js",
|
|
67
|
-
"qcobjects-collab": "./qcobjects-collab.js"
|
|
79
|
+
"qco": "./src/qcobjects-cli.js",
|
|
80
|
+
"qcobjects": "./src/qcobjects-cli.js",
|
|
81
|
+
"qcobjects-cli": "./src/qcobjects-cli.js",
|
|
82
|
+
"qcobjects-server": "./src/qcobjects-http2-server.js",
|
|
83
|
+
"qcobjects-http2-server": "./src/qcobjects-http2-server.js",
|
|
84
|
+
"qcobjects-shell": "./src/qcobjects-shell.js",
|
|
85
|
+
"qcobjects-createcert": "./src/qcobjects-createcert.js",
|
|
86
|
+
"qcobjects-gae-server": "./src/qcobjects-gae-http-server.js",
|
|
87
|
+
"qcobjects-http-server": "./src/qcobjects-http-server.js",
|
|
88
|
+
"qcobjects-collab": "./src/qcobjects-collab.js"
|
|
68
89
|
},
|
|
69
90
|
"engines": {
|
|
70
|
-
"node": ">=
|
|
91
|
+
"node": ">=18",
|
|
71
92
|
"npm": ">=9"
|
|
72
93
|
}
|
|
73
94
|
}
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
* Everyone is permitted to copy and distribute verbatim copies of this
|
|
23
23
|
* license document, but changing it is not allowed.
|
|
24
24
|
*/
|
|
25
|
-
/*eslint no-unused-vars: "off"*/
|
|
26
|
-
/*eslint no-redeclare: "off"*/
|
|
27
|
-
/*eslint no-empty: "off"*/
|
|
28
|
-
/*eslint strict: "off"*/
|
|
29
|
-
/*eslint no-mixed-operators: "off"*/
|
|
30
|
-
/*eslint no-undef: "off"*/
|
|
31
|
-
/*eslint no-useless-escape: "off"*/
|
|
25
|
+
/* eslint no-unused-vars: "off" */
|
|
26
|
+
/* eslint no-redeclare: "off" */
|
|
27
|
+
/* eslint no-empty: "off" */
|
|
28
|
+
/* eslint strict: "off" */
|
|
29
|
+
/* eslint no-mixed-operators: "off" */
|
|
30
|
+
/* eslint no-undef: "off" */
|
|
31
|
+
/* eslint no-useless-escape: "off" */
|
|
32
32
|
"use strict";
|
|
33
33
|
const fs = require("fs");
|
|
34
34
|
const path = require("path");
|
|
@@ -45,9 +45,9 @@ Package("com.qcobjects.backend.microservice.static", [
|
|
|
45
45
|
done() {
|
|
46
46
|
// read and send file content in the stream
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
const microservice = this;
|
|
49
|
+
const stream = microservice.stream;
|
|
50
|
+
const fileName = `${process.cwd()}/${microservice.fileName}`;
|
|
51
51
|
|
|
52
52
|
const sendFileHTTP2 = function(stream, fileName) {
|
|
53
53
|
// read and send file content in the stream
|
|
@@ -148,13 +148,13 @@ Package("com.qcobjects.backend.microservice.static", [
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
static(method, data) {
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
const microservice = this;
|
|
152
|
+
const redirect_to = microservice.route.redirect_to;
|
|
153
153
|
return new Promise(function(resolve, reject) {
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
const supported_methods = microservice.route.supported_methods;
|
|
155
|
+
let _method_allowed_ = false;
|
|
156
156
|
if (typeof supported_methods !== "undefined") {
|
|
157
|
-
if (supported_methods == "*" || (typeof method
|
|
157
|
+
if (supported_methods == "*" || (typeof method === "undefined") || [...supported_methods].map(m => m.toLowerCase()).indexOf(method.toLowerCase()) !== -1) {
|
|
158
158
|
_method_allowed_ = true;
|
|
159
159
|
}
|
|
160
160
|
} else {
|
|
@@ -165,8 +165,8 @@ Package("com.qcobjects.backend.microservice.static", [
|
|
|
165
165
|
if (_method_allowed_) {
|
|
166
166
|
logger.info("I'm going to deliver a static path...");
|
|
167
167
|
if (redirect_to) {
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
const request_path = microservice.request.path;
|
|
169
|
+
const re = (new RegExp(microservice.route.path.replace(/{(.*?)}/g, "\(\?\<$1\>\.\*\)"), "g"));
|
|
170
170
|
microservice.fileName = request_path.replace(re, microservice.route.redirect_to);
|
|
171
171
|
try {
|
|
172
172
|
resolve();
|
|
@@ -187,7 +187,7 @@ Package("com.qcobjects.backend.microservice.static", [
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
head(formData) {
|
|
190
|
-
|
|
190
|
+
const microservice = this;
|
|
191
191
|
microservice.static("head", formData).then(response => {
|
|
192
192
|
microservice.body = response;
|
|
193
193
|
microservice.done();
|
|
@@ -195,7 +195,7 @@ Package("com.qcobjects.backend.microservice.static", [
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
get(formData) {
|
|
198
|
-
|
|
198
|
+
const microservice = this;
|
|
199
199
|
microservice.static("get", formData).then(response => {
|
|
200
200
|
microservice.body = response;
|
|
201
201
|
microservice.done();
|
|
@@ -205,7 +205,7 @@ Package("com.qcobjects.backend.microservice.static", [
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
post(formData) {
|
|
208
|
-
|
|
208
|
+
const microservice = this;
|
|
209
209
|
microservice.static("post", formData).then(response => {
|
|
210
210
|
microservice.body = response;
|
|
211
211
|
microservice.done();
|
|
@@ -213,7 +213,7 @@ Package("com.qcobjects.backend.microservice.static", [
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
put(formData) {
|
|
216
|
-
|
|
216
|
+
const microservice = this;
|
|
217
217
|
microservice.static("put", formData).then(response => {
|
|
218
218
|
microservice.body = response;
|
|
219
219
|
microservice.done();
|
|
@@ -221,7 +221,7 @@ Package("com.qcobjects.backend.microservice.static", [
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
delete(formData) {
|
|
224
|
-
|
|
224
|
+
const microservice = this;
|
|
225
225
|
microservice.static("delete", formData).then(response => {
|
|
226
226
|
microservice.body = response;
|
|
227
227
|
microservice.done();
|
|
@@ -229,7 +229,7 @@ Package("com.qcobjects.backend.microservice.static", [
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
connect(formData) {
|
|
232
|
-
|
|
232
|
+
const microservice = this;
|
|
233
233
|
microservice.static("connect", formData).then(response => {
|
|
234
234
|
microservice.body = response;
|
|
235
235
|
microservice.done();
|
|
@@ -237,7 +237,7 @@ Package("com.qcobjects.backend.microservice.static", [
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
options(formData) {
|
|
240
|
-
|
|
240
|
+
const microservice = this;
|
|
241
241
|
microservice.static("options", formData).then(response => {
|
|
242
242
|
microservice.body = response;
|
|
243
243
|
microservice.done();
|
|
@@ -245,7 +245,7 @@ Package("com.qcobjects.backend.microservice.static", [
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
trace(formData) {
|
|
248
|
-
|
|
248
|
+
const microservice = this;
|
|
249
249
|
microservice.static("trace", formData).then(response => {
|
|
250
250
|
microservice.body = response;
|
|
251
251
|
microservice.done();
|
|
@@ -253,7 +253,7 @@ Package("com.qcobjects.backend.microservice.static", [
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
patch(formData) {
|
|
256
|
-
|
|
256
|
+
const microservice = this;
|
|
257
257
|
microservice.static("patch", formData).then(response => {
|
|
258
258
|
microservice.body = response;
|
|
259
259
|
microservice.done();
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
* Everyone is permitted to copy and distribute verbatim copies of this
|
|
23
23
|
* license document, but changing it is not allowed.
|
|
24
24
|
*/
|
|
25
|
-
/*eslint no-unused-vars: "off"*/
|
|
26
|
-
/*eslint no-redeclare: "off"*/
|
|
27
|
-
/*eslint no-empty: "off"*/
|
|
28
|
-
/*eslint strict: "off"*/
|
|
29
|
-
/*eslint no-mixed-operators: "off"*/
|
|
30
|
-
/*eslint no-undef: "off"*/
|
|
25
|
+
/* eslint no-unused-vars: "off" */
|
|
26
|
+
/* eslint no-redeclare: "off" */
|
|
27
|
+
/* eslint no-empty: "off" */
|
|
28
|
+
/* eslint strict: "off" */
|
|
29
|
+
/* eslint no-mixed-operators: "off" */
|
|
30
|
+
/* eslint no-undef: "off" */
|
|
31
31
|
"use strict";
|
|
32
32
|
const fs = require("fs");
|
|
33
33
|
const os = require("os");
|
|
@@ -37,7 +37,7 @@ const {
|
|
|
37
37
|
} = require("child_process");
|
|
38
38
|
// MY_ENV_VAR="HELLO WORLD" php -f index.php
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
const fixWinCmd = function (commandline) {
|
|
41
41
|
if (!process.platform.toLowerCase().startsWith("win")) {
|
|
42
42
|
commandline = commandline.replace(/(")/g, String.fromCharCode(92) + "\"");
|
|
43
43
|
}
|
|
@@ -49,17 +49,17 @@ Package("org.quickcorp.backend.php", [
|
|
|
49
49
|
class PHPMicroservice extends BackendMicroservice {
|
|
50
50
|
constructor() {
|
|
51
51
|
super(...arguments);
|
|
52
|
-
|
|
52
|
+
const o = this;
|
|
53
53
|
|
|
54
54
|
logger.debug("PHP Microservice executing");
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
const microservice = this;
|
|
56
|
+
const request = microservice.request;
|
|
57
|
+
const stream = o.stream;
|
|
58
58
|
microservice.stream = stream;
|
|
59
59
|
stream.on("data", (data) => {
|
|
60
60
|
// data from POST, GET
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
const requestMethod = request.method.toLowerCase();
|
|
62
|
+
const supportedMethods = {
|
|
63
63
|
"post": microservice.post,
|
|
64
64
|
};
|
|
65
65
|
if (supportedMethods.hasOwnProperty.call(supportedmethods, requestMethod)) {
|
|
@@ -68,8 +68,8 @@ Package("org.quickcorp.backend.php", [
|
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
// data from POST, GET
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
const requestMethod = request.method.toLowerCase();
|
|
72
|
+
const supportedMethods = {
|
|
73
73
|
"get": microservice.get,
|
|
74
74
|
"head": microservice.head,
|
|
75
75
|
"put": microservice.put,
|
|
@@ -86,7 +86,7 @@ Package("org.quickcorp.backend.php", [
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
get_php_headers_list() {
|
|
89
|
-
|
|
89
|
+
const phpheaders = {
|
|
90
90
|
"QUERY_STRING": `${this.request.query}`,
|
|
91
91
|
"REDIRECT_STATUS": "200",
|
|
92
92
|
"REQUEST_METHOD": `${this.request.method}`,
|
|
@@ -102,11 +102,11 @@ Package("org.quickcorp.backend.php", [
|
|
|
102
102
|
function fixedEncodeURIComponent(str) {
|
|
103
103
|
return encodeURIComponent(str).replace(/[!'()]/g, escape).replace(/\*/g, "%2A");
|
|
104
104
|
}
|
|
105
|
-
for (
|
|
105
|
+
for (const headername in this.request.headers) {
|
|
106
106
|
if (!headername.startsWith(":")) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (typeof headervalue
|
|
107
|
+
const phpheadername = headername.toUpperCase().replace(new RegExp("-", "g"), "_");
|
|
108
|
+
let headervalue = this.request.headers[headername];
|
|
109
|
+
if (typeof headervalue !== "string") {
|
|
110
110
|
headervalue = JSON.stringify(headervalue);
|
|
111
111
|
}
|
|
112
112
|
phpheaders["HTTP_" + phpheadername] = fixedEncodeURIComponent(headervalue);
|
|
@@ -117,7 +117,7 @@ Package("org.quickcorp.backend.php", [
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
saveTempData(data, done) {
|
|
120
|
-
|
|
120
|
+
const filename = os.tmpdir() + this.tempFileName;
|
|
121
121
|
fs.writeFile(filename, data, (err) => {
|
|
122
122
|
if (err) throw err;
|
|
123
123
|
logger.debug("A temp data file has been saved!");
|
|
@@ -141,7 +141,7 @@ Package("org.quickcorp.backend.php", [
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
get() {
|
|
144
|
-
|
|
144
|
+
const microservice = this;
|
|
145
145
|
microservice.generateTempFileName();
|
|
146
146
|
|
|
147
147
|
microservice.saveTempData(this.request.query, function () {
|
|
@@ -149,15 +149,15 @@ Package("org.quickcorp.backend.php", [
|
|
|
149
149
|
process.chdir(CONFIG.get("documentRoot") + microservice.request.pathname.slice(1));
|
|
150
150
|
} catch (e) {}
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
const scriptFileName = (microservice.route.hasOwnProperty.call(microservice.route, "redirect_to") &&
|
|
153
153
|
microservice.route.redirect_to !== "") ? (microservice.route.redirect_to) : (microservice.request.scriptname);
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
const pathname = this.trimSlash(microservice.request.pathname);
|
|
155
|
+
let documentRoot = CONFIG.get("documentRoot", "");
|
|
156
156
|
if (documentRoot == "./") {
|
|
157
157
|
documentRoot = "";
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
let scriptFilePath;
|
|
161
161
|
if (documentRoot !== "") {
|
|
162
162
|
scriptFilePath = `${documentRoot}/${pathname}/${scriptFileName}`;
|
|
163
163
|
} else {
|
|
@@ -170,11 +170,11 @@ Package("org.quickcorp.backend.php", [
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
logger.debug(`Loading PHP file: ${scriptFilePath}`);
|
|
173
|
-
|
|
173
|
+
const PHPIncludePath = `.:${CONFIG.get("documentRoot")}:${CONFIG.get("projectPath")}`;
|
|
174
174
|
|
|
175
175
|
microservice.scriptFilePath = scriptFilePath;
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
let commandline = `echo $(cat ${os.tmpdir()}${microservice.tempFileName}) |` + microservice.get_php_headers_list() + ` php -d include_path="${PHPIncludePath}" -q <<- 'EOF'
|
|
178
178
|
<?php
|
|
179
179
|
$_payload = file_get_contents(sys_get_temp_dir().'${microservice.tempFileName}');
|
|
180
180
|
foreach ($_SERVER as $_k => $_v) {
|
|
@@ -194,7 +194,7 @@ EOF`;
|
|
|
194
194
|
commandline = fixWinCmd(commandline);
|
|
195
195
|
logger.debug(commandline);
|
|
196
196
|
try {
|
|
197
|
-
|
|
197
|
+
const php = exec(commandline, (err, stdout, stderr) => {
|
|
198
198
|
microservice.body = stdout;
|
|
199
199
|
console.log(stderr);
|
|
200
200
|
microservice.done();
|
|
@@ -213,9 +213,10 @@ EOF`;
|
|
|
213
213
|
head(formData) {
|
|
214
214
|
this.done();
|
|
215
215
|
}
|
|
216
|
+
|
|
216
217
|
post(formData) {
|
|
217
218
|
logger.debug("POST DATA");
|
|
218
|
-
|
|
219
|
+
const microservice = this;
|
|
219
220
|
microservice.generateTempFileName();
|
|
220
221
|
|
|
221
222
|
microservice.saveTempData(formData, function () {
|
|
@@ -223,15 +224,15 @@ EOF`;
|
|
|
223
224
|
process.chdir(CONFIG.get("documentRoot") + microservice.request.pathname.slice(1));
|
|
224
225
|
} catch (e) {}
|
|
225
226
|
|
|
226
|
-
|
|
227
|
+
const scriptFileName = (microservice.route.hasOwnProperty.call(microservice.route, "redirect_to") &&
|
|
227
228
|
microservice.route.redirect_to !== "") ? (microservice.route.redirect_to) : (microservice.request.scriptname);
|
|
228
|
-
|
|
229
|
-
|
|
229
|
+
const pathname = this.trimSlash(microservice.request.pathname);
|
|
230
|
+
let documentRoot = CONFIG.get("documentRoot", "");
|
|
230
231
|
if (documentRoot == "./") {
|
|
231
232
|
documentRoot = "";
|
|
232
233
|
}
|
|
233
234
|
|
|
234
|
-
|
|
235
|
+
let scriptFilePath;
|
|
235
236
|
if (documentRoot !== "") {
|
|
236
237
|
scriptFilePath = `${documentRoot}/${pathname}/${scriptFileName}`;
|
|
237
238
|
} else {
|
|
@@ -244,11 +245,11 @@ EOF`;
|
|
|
244
245
|
}
|
|
245
246
|
|
|
246
247
|
logger.debug(`Loading PHP file: ${scriptFilePath}`);
|
|
247
|
-
|
|
248
|
+
const PHPIncludePath = `.:${CONFIG.get("documentRoot")}:${CONFIG.get("projectPath")}`;
|
|
248
249
|
|
|
249
250
|
microservice.scriptFilePath = scriptFilePath;
|
|
250
251
|
|
|
251
|
-
|
|
252
|
+
let commandline = `echo $(cat ${os.tmpdir()}${microservice.tempFileName}) |` + microservice.get_php_headers_list() + ` php -d include_path="${PHPIncludePath}" -q <<- 'EOF'
|
|
252
253
|
<?php
|
|
253
254
|
$_payload = file_get_contents(sys_get_temp_dir().'${microservice.tempFileName}');
|
|
254
255
|
foreach ($_SERVER as $_k => $_v) {
|
|
@@ -283,24 +284,30 @@ EOF`;
|
|
|
283
284
|
put(formData) {
|
|
284
285
|
this.done();
|
|
285
286
|
}
|
|
287
|
+
|
|
286
288
|
delete(formData) {
|
|
287
289
|
this.done();
|
|
288
290
|
}
|
|
291
|
+
|
|
289
292
|
connect(formData) {
|
|
290
293
|
this.done();
|
|
291
294
|
}
|
|
295
|
+
|
|
292
296
|
options(formData) {
|
|
293
297
|
this.done();
|
|
294
298
|
}
|
|
299
|
+
|
|
295
300
|
trace(formData) {
|
|
296
301
|
this.done();
|
|
297
302
|
}
|
|
303
|
+
|
|
298
304
|
patch(formData) {
|
|
299
305
|
this.done();
|
|
300
306
|
}
|
|
307
|
+
|
|
301
308
|
done() {
|
|
302
|
-
|
|
303
|
-
|
|
309
|
+
const microservice = this;
|
|
310
|
+
const stream = microservice.stream;
|
|
304
311
|
try {
|
|
305
312
|
stream.respond(microservice.headers);
|
|
306
313
|
} catch (e) {
|
|
@@ -34,7 +34,7 @@ const path = require("path");
|
|
|
34
34
|
const absolutePath = path.resolve(__dirname, "./");
|
|
35
35
|
const templatePath = path.resolve(__dirname, "./templates/apps/") + "/";
|
|
36
36
|
const templatePwaPath = path.resolve(__dirname, "./templates/pwa/") + "/";
|
|
37
|
-
const package_config = require(absolutePath + "
|
|
37
|
+
const package_config = require(absolutePath + "/../package.json");
|
|
38
38
|
const {
|
|
39
39
|
exec,
|
|
40
40
|
execSync
|
|
@@ -34,7 +34,7 @@ const path = require("path");
|
|
|
34
34
|
const absolutePath = path.resolve( __dirname, "./" );
|
|
35
35
|
const templatePath = path.resolve( __dirname, "./templates/apps/" )+"/";
|
|
36
36
|
const templatePwaPath = path.resolve( __dirname, "./templates/pwa/" )+"/";
|
|
37
|
-
const package_config = require(absolutePath+"
|
|
37
|
+
const package_config = require(absolutePath+"/../package.json");
|
|
38
38
|
const { exec,execSync } = require("child_process");
|
|
39
39
|
|
|
40
40
|
// plugin commands here
|
|
@@ -34,7 +34,7 @@ const path = require("path");
|
|
|
34
34
|
const absolutePath = path.resolve( __dirname, "./" );
|
|
35
35
|
const templatePath = path.resolve( __dirname, "./templates/apps/" )+"/";
|
|
36
36
|
const templatePwaPath = path.resolve( __dirname, "./templates/pwa/" )+"/";
|
|
37
|
-
const package_config = require(absolutePath+"
|
|
37
|
+
const package_config = require(absolutePath+"/../package.json");
|
|
38
38
|
const { exec,execSync } = require("child_process");
|
|
39
39
|
|
|
40
40
|
Package("com.qcobjects.cli.commands.version",[
|
package/src/index.cjs
ADDED
package/src/index.d.ts
ADDED
package/src/index.mjs
ADDED
package/src/index.ts
ADDED
|
@@ -34,7 +34,7 @@ const path = require("path");
|
|
|
34
34
|
const absolutePath = path.resolve( __dirname, "./" );
|
|
35
35
|
const templatePath = path.resolve( __dirname, "./templates/apps/" )+"/";
|
|
36
36
|
const templatePwaPath = path.resolve( __dirname, "./templates/pwa/" )+"/";
|
|
37
|
-
const package_config = require(absolutePath+"
|
|
37
|
+
const package_config = require(absolutePath+"/../package.json");
|
|
38
38
|
const { exec,execSync } = require("child_process");
|
|
39
39
|
|
|
40
40
|
Package ("org.qcobjects.enterprise.commands", [
|