@ones-open/cli 1.0.1-5596.1908 → 1.0.1-9456.1922
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/dist/index.cjs
CHANGED
|
@@ -222,7 +222,11 @@ const build = async function() {
|
|
|
222
222
|
if ((_appPackageJSON$scrip = appPackageJSON.scripts) !== null && _appPackageJSON$scrip !== void 0 && _appPackageJSON$scrip.build) {
|
|
223
223
|
node_child_process.spawnSync("npm", ["run", "build"], {
|
|
224
224
|
cwd: getAppWorkspacePath(),
|
|
225
|
-
stdio: "inherit"
|
|
225
|
+
stdio: "inherit",
|
|
226
|
+
env: {
|
|
227
|
+
...process.env,
|
|
228
|
+
NODE_ENV: "production"
|
|
229
|
+
}
|
|
226
230
|
});
|
|
227
231
|
} else {
|
|
228
232
|
return createOnesApp.throwError(ErrorCode.BUILD_SCRIPT_NOT_FOUND, i18n.t("error.build.scriptNotFound"));
|
|
@@ -317,6 +321,7 @@ const dev = async function() {
|
|
|
317
321
|
const cwd = getAppWorkspacePath();
|
|
318
322
|
const env = {
|
|
319
323
|
...process.env,
|
|
324
|
+
NODE_ENV: "development",
|
|
320
325
|
ONES_HOSTED_PORT: `${port}`
|
|
321
326
|
};
|
|
322
327
|
const tunnelChild = node_child_process.spawn("ones", ["tunnel", String(port)], {
|
|
@@ -476,6 +481,7 @@ const setONESToken = async (token) => {
|
|
|
476
481
|
ones_token: token
|
|
477
482
|
});
|
|
478
483
|
};
|
|
484
|
+
const MAX_RELAY_BODY_BYTES = 64 * 1024 * 1024;
|
|
479
485
|
class TunnelClient {
|
|
480
486
|
constructor(localPort, baseUrl, appID, hostedToken) {
|
|
481
487
|
_defineProperty(this, "ws", null);
|
|
@@ -489,7 +495,8 @@ class TunnelClient {
|
|
|
489
495
|
this.ws = new WebSocket(proxyUrl, {
|
|
490
496
|
headers: {
|
|
491
497
|
Authorization: `Bearer ${this.hostedToken}`
|
|
492
|
-
}
|
|
498
|
+
},
|
|
499
|
+
maxPayload: MAX_RELAY_BODY_BYTES
|
|
493
500
|
});
|
|
494
501
|
this.ws.on("message", async (data) => {
|
|
495
502
|
const message = this.parseMessage(data);
|
|
@@ -591,7 +598,13 @@ class TunnelClient {
|
|
|
591
598
|
if (payload.query) {
|
|
592
599
|
Object.entries(payload.query).forEach((_ref) => {
|
|
593
600
|
let [key, value] = _ref;
|
|
594
|
-
|
|
601
|
+
if (Array.isArray(value)) {
|
|
602
|
+
value.forEach((item) => {
|
|
603
|
+
url.searchParams.append(key, item);
|
|
604
|
+
});
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
url.searchParams.append(key, value);
|
|
595
608
|
});
|
|
596
609
|
}
|
|
597
610
|
const response = await axios.request({
|
|
@@ -600,7 +613,9 @@ class TunnelClient {
|
|
|
600
613
|
headers: payload.headers,
|
|
601
614
|
data: payload.body,
|
|
602
615
|
responseType: "arraybuffer",
|
|
603
|
-
validateStatus: () => true
|
|
616
|
+
validateStatus: () => true,
|
|
617
|
+
maxBodyLength: MAX_RELAY_BODY_BYTES,
|
|
618
|
+
maxContentLength: MAX_RELAY_BODY_BYTES
|
|
604
619
|
});
|
|
605
620
|
const responseBytes = Buffer.from(response.data);
|
|
606
621
|
return {
|
|
@@ -632,6 +647,9 @@ class TunnelClient {
|
|
|
632
647
|
var _envelope$payload;
|
|
633
648
|
const payload = (_envelope$payload = envelope.payload) !== null && _envelope$payload !== void 0 ? _envelope$payload : {};
|
|
634
649
|
const body = this.toBodyBuffer(payload.body);
|
|
650
|
+
if (body.length > MAX_RELAY_BODY_BYTES) {
|
|
651
|
+
throw new Error("relay body too large");
|
|
652
|
+
}
|
|
635
653
|
const metaPayload = {
|
|
636
654
|
...payload
|
|
637
655
|
};
|
|
@@ -674,7 +692,12 @@ class TunnelClient {
|
|
|
674
692
|
return envelope;
|
|
675
693
|
}
|
|
676
694
|
const body = buffer.subarray(4 + metaLength);
|
|
677
|
-
|
|
695
|
+
if (body.length > MAX_RELAY_BODY_BYTES) {
|
|
696
|
+
console.error("Binary tunnel body exceeds size limit");
|
|
697
|
+
return null;
|
|
698
|
+
}
|
|
699
|
+
const payload = envelope.payload;
|
|
700
|
+
payload.body = body;
|
|
678
701
|
return envelope;
|
|
679
702
|
} catch (error) {
|
|
680
703
|
console.error("Invalid binary tunnel message:", error);
|
|
@@ -1308,7 +1331,7 @@ const runCommandONES = async () => {
|
|
|
1308
1331
|
const command = ones;
|
|
1309
1332
|
createOnesApp.setContext("command", command);
|
|
1310
1333
|
const version = `${getPackageJSON().version}`;
|
|
1311
|
-
command.version(version);
|
|
1334
|
+
command.version(version, "-v, --version");
|
|
1312
1335
|
await command.parse();
|
|
1313
1336
|
};
|
|
1314
1337
|
exports.runCommandONES = runCommandONES;
|
package/dist/index.js
CHANGED
|
@@ -219,7 +219,11 @@ const build = async function() {
|
|
|
219
219
|
if ((_appPackageJSON$scrip = appPackageJSON.scripts) !== null && _appPackageJSON$scrip !== void 0 && _appPackageJSON$scrip.build) {
|
|
220
220
|
spawnSync("npm", ["run", "build"], {
|
|
221
221
|
cwd: getAppWorkspacePath(),
|
|
222
|
-
stdio: "inherit"
|
|
222
|
+
stdio: "inherit",
|
|
223
|
+
env: {
|
|
224
|
+
...process.env,
|
|
225
|
+
NODE_ENV: "production"
|
|
226
|
+
}
|
|
223
227
|
});
|
|
224
228
|
} else {
|
|
225
229
|
return throwError(ErrorCode.BUILD_SCRIPT_NOT_FOUND, i18n.t("error.build.scriptNotFound"));
|
|
@@ -314,6 +318,7 @@ const dev = async function() {
|
|
|
314
318
|
const cwd2 = getAppWorkspacePath();
|
|
315
319
|
const env = {
|
|
316
320
|
...process.env,
|
|
321
|
+
NODE_ENV: "development",
|
|
317
322
|
ONES_HOSTED_PORT: `${port}`
|
|
318
323
|
};
|
|
319
324
|
const tunnelChild = spawn("ones", ["tunnel", String(port)], {
|
|
@@ -473,6 +478,7 @@ const setONESToken = async (token) => {
|
|
|
473
478
|
ones_token: token
|
|
474
479
|
});
|
|
475
480
|
};
|
|
481
|
+
const MAX_RELAY_BODY_BYTES = 64 * 1024 * 1024;
|
|
476
482
|
class TunnelClient {
|
|
477
483
|
constructor(localPort, baseUrl, appID, hostedToken) {
|
|
478
484
|
_defineProperty(this, "ws", null);
|
|
@@ -486,7 +492,8 @@ class TunnelClient {
|
|
|
486
492
|
this.ws = new WebSocket(proxyUrl, {
|
|
487
493
|
headers: {
|
|
488
494
|
Authorization: `Bearer ${this.hostedToken}`
|
|
489
|
-
}
|
|
495
|
+
},
|
|
496
|
+
maxPayload: MAX_RELAY_BODY_BYTES
|
|
490
497
|
});
|
|
491
498
|
this.ws.on("message", async (data) => {
|
|
492
499
|
const message = this.parseMessage(data);
|
|
@@ -588,7 +595,13 @@ class TunnelClient {
|
|
|
588
595
|
if (payload.query) {
|
|
589
596
|
Object.entries(payload.query).forEach((_ref) => {
|
|
590
597
|
let [key, value] = _ref;
|
|
591
|
-
|
|
598
|
+
if (Array.isArray(value)) {
|
|
599
|
+
value.forEach((item) => {
|
|
600
|
+
url.searchParams.append(key, item);
|
|
601
|
+
});
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
url.searchParams.append(key, value);
|
|
592
605
|
});
|
|
593
606
|
}
|
|
594
607
|
const response = await axios.request({
|
|
@@ -597,7 +610,9 @@ class TunnelClient {
|
|
|
597
610
|
headers: payload.headers,
|
|
598
611
|
data: payload.body,
|
|
599
612
|
responseType: "arraybuffer",
|
|
600
|
-
validateStatus: () => true
|
|
613
|
+
validateStatus: () => true,
|
|
614
|
+
maxBodyLength: MAX_RELAY_BODY_BYTES,
|
|
615
|
+
maxContentLength: MAX_RELAY_BODY_BYTES
|
|
601
616
|
});
|
|
602
617
|
const responseBytes = Buffer.from(response.data);
|
|
603
618
|
return {
|
|
@@ -629,6 +644,9 @@ class TunnelClient {
|
|
|
629
644
|
var _envelope$payload;
|
|
630
645
|
const payload = (_envelope$payload = envelope.payload) !== null && _envelope$payload !== void 0 ? _envelope$payload : {};
|
|
631
646
|
const body = this.toBodyBuffer(payload.body);
|
|
647
|
+
if (body.length > MAX_RELAY_BODY_BYTES) {
|
|
648
|
+
throw new Error("relay body too large");
|
|
649
|
+
}
|
|
632
650
|
const metaPayload = {
|
|
633
651
|
...payload
|
|
634
652
|
};
|
|
@@ -671,7 +689,12 @@ class TunnelClient {
|
|
|
671
689
|
return envelope;
|
|
672
690
|
}
|
|
673
691
|
const body = buffer.subarray(4 + metaLength);
|
|
674
|
-
|
|
692
|
+
if (body.length > MAX_RELAY_BODY_BYTES) {
|
|
693
|
+
console.error("Binary tunnel body exceeds size limit");
|
|
694
|
+
return null;
|
|
695
|
+
}
|
|
696
|
+
const payload = envelope.payload;
|
|
697
|
+
payload.body = body;
|
|
675
698
|
return envelope;
|
|
676
699
|
} catch (error) {
|
|
677
700
|
console.error("Invalid binary tunnel message:", error);
|
|
@@ -1305,7 +1328,7 @@ const runCommandONES = async () => {
|
|
|
1305
1328
|
const command = ones;
|
|
1306
1329
|
setContext("command", command);
|
|
1307
1330
|
const version = `${getPackageJSON().version}`;
|
|
1308
|
-
command.version(version);
|
|
1331
|
+
command.version(version, "-v, --version");
|
|
1309
1332
|
await command.parse();
|
|
1310
1333
|
};
|
|
1311
1334
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/actions/build/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,KAAK,EAAyB,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAE3E,eAAO,MAAM,KAAK,GAAU,GAAG,MAAM,gBAAgB,CAAC,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/actions/build/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,KAAK,EAAyB,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAE3E,eAAO,MAAM,KAAK,GAAU,GAAG,MAAM,gBAAgB,CAAC,mBAAmB,CAAC,uBAiEzE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/actions/dev/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,KAAK,EAAuB,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAEvE,eAAO,MAAM,GAAG,GAAU,GAAG,MAAM,gBAAgB,CAAC,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/actions/dev/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,KAAK,EAAuB,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAEvE,eAAO,MAAM,GAAG,GAAU,GAAG,MAAM,gBAAgB,CAAC,iBAAiB,CAAC,uBAiErE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tunnel-client.d.ts","sourceRoot":"","sources":["../../../../src/actions/tunnel/tunnel-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tunnel-client.d.ts","sourceRoot":"","sources":["../../../../src/actions/tunnel/tunnel-client.ts"],"names":[],"mappings":"AA8BA,qBAAa,YAAY;IACvB,OAAO,CAAC,EAAE,CAAyB;IACnC,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,WAAW,CAAQ;gBAEf,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAO5E,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA+B9B,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,YAAY;YAcN,aAAa;IA4C3B,OAAO,CAAC,iBAAiB;YAQX,cAAc;IAiC5B,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,oBAAoB;IAc5B,OAAO,CAAC,YAAY;IAmBpB,OAAO,CAAC,mBAAmB;IAyB3B,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,QAAQ;CAYjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ones-open/cli",
|
|
3
|
-
"version": "1.0.1-
|
|
3
|
+
"version": "1.0.1-9456.1922+cb99c856",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"chalk": "^5.0.1",
|
|
63
63
|
"commander": "~9.4.0",
|
|
64
64
|
"cosmiconfig": "^8.3.6",
|
|
65
|
-
"create-ones-app": "1.0.1-
|
|
65
|
+
"create-ones-app": "1.0.1-9456.1922+cb99c856",
|
|
66
66
|
"env-paths": "3.0.0",
|
|
67
67
|
"execa": "^6.1.0",
|
|
68
68
|
"fs-extra": "^11.3.0",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"ws": "^8.18.3",
|
|
76
76
|
"zod": "^3.22.2"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "cb99c8562240b5643fab4a19db12da88ce6d0bcf"
|
|
79
79
|
}
|