@forge/tunnel 5.0.1-next.4 → 5.0.1-next.6
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/CHANGELOG.md +15 -0
- package/out/index.d.ts +1 -0
- package/out/index.d.ts.map +1 -1
- package/out/index.js +1 -0
- package/out/sandbox/index.d.ts +2 -0
- package/out/sandbox/index.d.ts.map +1 -0
- package/out/sandbox/index.js +4 -0
- package/out/sandbox/node-sandbox.d.ts +11 -0
- package/out/sandbox/node-sandbox.d.ts.map +1 -0
- package/out/sandbox/node-sandbox.js +62 -0
- package/out/sandbox/sandbox-runner.d.ts +3 -0
- package/out/sandbox/sandbox-runner.d.ts.map +1 -0
- package/out/sandbox/sandbox-runner.js +9 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @forge/tunnel
|
|
2
2
|
|
|
3
|
+
## 5.0.1-next.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @forge/bundler@4.15.10-next.5
|
|
8
|
+
|
|
9
|
+
## 5.0.1-next.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- eb06eca: Break more dependencies between SDK and runtime
|
|
14
|
+
- Updated dependencies [eb06eca]
|
|
15
|
+
- @forge/bundler@4.15.10-next.4
|
|
16
|
+
- @forge/runtime@5.6.1-next.1
|
|
17
|
+
|
|
3
18
|
## 5.0.1-next.4
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/out/index.d.ts
CHANGED
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,QAEnB,CAAC;AAET,wBAAgB,kBAAkB,YAEjC;AAED,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,QAEnB,CAAC;AAET,wBAAgB,kBAAkB,YAEjC;AAED,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
|
package/out/index.js
CHANGED
|
@@ -14,3 +14,4 @@ tslib_1.__exportStar(require("./servers"), exports);
|
|
|
14
14
|
tslib_1.__exportStar(require("./command"), exports);
|
|
15
15
|
tslib_1.__exportStar(require("./graphql"), exports);
|
|
16
16
|
tslib_1.__exportStar(require("./util"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./sandbox"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sandbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { XenInvocationRequest, LimitsTracker, InvocationResult, Sandbox, SandboxConfig, Inspector } from '@forge/runtime';
|
|
2
|
+
export declare class NodeSandbox implements Sandbox {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
private readonly process;
|
|
5
|
+
private readonly callbacks;
|
|
6
|
+
constructor({ appPath, modName, handler, debugPort }: SandboxConfig);
|
|
7
|
+
private handleOutput;
|
|
8
|
+
execute(xenInvocationRequest: XenInvocationRequest, invocationLimits: LimitsTracker, inspector?: Inspector | undefined): Promise<InvocationResult>;
|
|
9
|
+
stop(): void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=node-sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-sandbox.d.ts","sourceRoot":"","sources":["../../src/sandbox/node-sandbox.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,SAAS,EAIV,MAAM,gBAAgB,CAAC;AAIxB,qBAAa,WAAY,YAAW,OAAO;IACzC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkD;gBAEhE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,aAAa;IA2BnE,OAAO,CAAC,YAAY;IAOd,OAAO,CACX,oBAAoB,EAAE,oBAAoB,EAC1C,gBAAgB,EAAE,aAAa,EAC/B,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,GAChC,OAAO,CAAC,gBAAgB,CAAC;IAmB5B,IAAI,IAAI,IAAI;CAGb"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NodeSandbox = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const readline_1 = tslib_1.__importDefault(require("readline"));
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
9
|
+
const runtime_1 = require("@forge/runtime");
|
|
10
|
+
const RUNNER = (0, path_1.join)(__dirname, '..', '..', 'out', 'sandbox', 'sandbox-runner.js');
|
|
11
|
+
class NodeSandbox {
|
|
12
|
+
name;
|
|
13
|
+
process;
|
|
14
|
+
callbacks;
|
|
15
|
+
constructor({ appPath, modName, handler, debugPort }) {
|
|
16
|
+
this.name = `${modName}.${handler}`;
|
|
17
|
+
const fileName = `${appPath}/${modName}.cjs`;
|
|
18
|
+
this.callbacks = new Map();
|
|
19
|
+
this.process = (0, child_process_1.fork)(RUNNER, [fileName, handler], {
|
|
20
|
+
stdio: ['ignore', 'pipe', 2, 'ipc'],
|
|
21
|
+
env: {
|
|
22
|
+
_HANDLER: this.name
|
|
23
|
+
},
|
|
24
|
+
execArgv: debugPort ? [`--inspect=0.0.0.0:${debugPort}`] : undefined
|
|
25
|
+
});
|
|
26
|
+
readline_1.default.createInterface(this.process.stdout).on('line', (line) => {
|
|
27
|
+
const message = JSON.parse(line);
|
|
28
|
+
this.handleOutput(message);
|
|
29
|
+
});
|
|
30
|
+
this.process.on('message', (message) => {
|
|
31
|
+
const requestId = message.requestId;
|
|
32
|
+
const result = message.result;
|
|
33
|
+
this.callbacks.get(requestId)?.(result);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
handleOutput(output) {
|
|
37
|
+
if (output.invocationId) {
|
|
38
|
+
const p3LogEvent = output;
|
|
39
|
+
runtime_1.StaticInvocationEventEmitter.emit(runtime_1.EVENT_P3_LOG, p3LogEvent);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async execute(xenInvocationRequest, invocationLimits, inspector) {
|
|
43
|
+
const lambdaEvent = {
|
|
44
|
+
_meta: xenInvocationRequest.__deprecatedGetMeta(),
|
|
45
|
+
body: xenInvocationRequest.getBody(),
|
|
46
|
+
variables: xenInvocationRequest.getUserVariables()
|
|
47
|
+
};
|
|
48
|
+
const requestId = (0, uuid_1.v4)();
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
this.callbacks.set(requestId, (result) => {
|
|
51
|
+
this.callbacks.delete(requestId);
|
|
52
|
+
resolve(result);
|
|
53
|
+
});
|
|
54
|
+
const lambdaContext = { awsRequestId: requestId };
|
|
55
|
+
this.process.send({ lambdaEvent, lambdaContext });
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
stop() {
|
|
59
|
+
this.process.kill();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.NodeSandbox = NodeSandbox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-runner.d.ts","sourceRoot":"","sources":["../../src/sandbox/sandbox-runner.ts"],"names":[],"mappings":"AAAA,QAAA,MAAO,WAAW,UAAE,WAAW,UAAE,QAAQ,UAAE,WAAW,QAAgB,CAAC;AAMvE,QAAA,MAAM,OAAO,KAAiC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const [_nodeBinary, _thisScript, fileName, handlerName] = process.argv;
|
|
3
|
+
global.__forge_tunnel__ = true;
|
|
4
|
+
const handler = require(fileName)[handlerName];
|
|
5
|
+
process.on('message', async ({ lambdaEvent, lambdaContext }) => {
|
|
6
|
+
const requestId = lambdaContext.awsRequestId;
|
|
7
|
+
const result = await handler(lambdaEvent, lambdaContext);
|
|
8
|
+
process.send?.({ requestId, result });
|
|
9
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/tunnel",
|
|
3
|
-
"version": "5.0.1-next.
|
|
3
|
+
"version": "5.0.1-next.6",
|
|
4
4
|
"description": "Tunnel functionality for Forge CLI",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"compile": "tsc -b -v"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@forge/bundler": "4.15.10-next.
|
|
14
|
+
"@forge/bundler": "4.15.10-next.5",
|
|
15
15
|
"@forge/cli-shared": "4.0.0-next.3",
|
|
16
16
|
"@forge/csp": "3.2.1",
|
|
17
|
-
"@forge/runtime": "5.6.1-next.
|
|
17
|
+
"@forge/runtime": "5.6.1-next.1",
|
|
18
18
|
"express": "^4.18.3",
|
|
19
19
|
"express-intercept": "^1.1.0",
|
|
20
20
|
"http-proxy-middleware": "^2.0.6",
|