@forge/tunnel 6.0.0-next.9 → 6.0.0
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 +80 -0
- package/out/command/interactors/function-change-watcher.d.ts.map +1 -1
- package/out/command/interactors/function-change-watcher.js +0 -1
- package/out/command/interactors/tunnel-interactor.d.ts.map +1 -1
- package/out/command/interactors/tunnel-interactor.js +1 -4
- package/out/command/start-tunnel-command.d.ts +1 -4
- package/out/command/start-tunnel-command.d.ts.map +1 -1
- package/out/command/start-tunnel-command.js +2 -20
- package/out/index.d.ts +0 -2
- package/out/index.d.ts.map +1 -1
- package/out/index.js +0 -8
- package/out/sandbox/node-sandbox.d.ts +2 -2
- package/out/sandbox/node-sandbox.d.ts.map +1 -1
- package/out/sandbox/node-sandbox.js +3 -9
- package/out/servers/native-ui-tunnel-server.js +1 -1
- package/out/services/local-invocation-service.d.ts +3 -4
- package/out/services/local-invocation-service.d.ts.map +1 -1
- package/out/services/local-invocation-service.js +6 -29
- package/out/util/invocation-utils.d.ts +0 -2
- package/out/util/invocation-utils.d.ts.map +1 -1
- package/out/util/invocation-utils.js +1 -15
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,85 @@
|
|
|
1
1
|
# @forge/tunnel
|
|
2
2
|
|
|
3
|
+
## 6.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 8f2a3c9: Update the package to build on Node 20
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- ba634d9: Remove further sandbox runtime related components
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 9791bd6: Patch vuln by bumping dependency
|
|
16
|
+
- 75b7732: Remove feature flag for single wrapper packaging
|
|
17
|
+
- 9f050ff: Removed support for Sandbox Runtime and Sanpshots
|
|
18
|
+
- 64befbb: Refactor runtime version manifest check into a linter
|
|
19
|
+
- fd9e085: Fix for the request body for some requests being stripped
|
|
20
|
+
- Updated dependencies [e4ab25f]
|
|
21
|
+
- Updated dependencies [8f2a3c9]
|
|
22
|
+
- Updated dependencies [75b7732]
|
|
23
|
+
- Updated dependencies [c3df542]
|
|
24
|
+
- Updated dependencies [9f050ff]
|
|
25
|
+
- Updated dependencies [ba634d9]
|
|
26
|
+
- Updated dependencies [64befbb]
|
|
27
|
+
- Updated dependencies [d33186c]
|
|
28
|
+
- @forge/cli-shared@8.0.0
|
|
29
|
+
- @forge/bundler@6.0.0
|
|
30
|
+
- @forge/runtime@6.0.0
|
|
31
|
+
- @forge/csp@4.0.0
|
|
32
|
+
|
|
33
|
+
## 6.0.0-next.15
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- 9791bd6: Patch vuln by bumping dependency
|
|
38
|
+
- @forge/bundler@6.0.0-next.15
|
|
39
|
+
- @forge/cli-shared@8.0.0-next.15
|
|
40
|
+
|
|
41
|
+
## 6.0.0-next.14
|
|
42
|
+
|
|
43
|
+
### Minor Changes
|
|
44
|
+
|
|
45
|
+
- ba634d9: Remove further sandbox runtime related components
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [ba634d9]
|
|
50
|
+
- @forge/cli-shared@8.0.0-next.14
|
|
51
|
+
- @forge/bundler@6.0.0-next.14
|
|
52
|
+
- @forge/runtime@6.0.0-next.1
|
|
53
|
+
|
|
54
|
+
## 6.0.0-next.13
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- @forge/bundler@6.0.0-next.13
|
|
59
|
+
- @forge/cli-shared@8.0.0-next.13
|
|
60
|
+
|
|
61
|
+
## 6.0.0-next.12
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- Updated dependencies [d33186c]
|
|
66
|
+
- @forge/cli-shared@8.0.0-next.12
|
|
67
|
+
- @forge/bundler@6.0.0-next.12
|
|
68
|
+
|
|
69
|
+
## 6.0.0-next.11
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- @forge/bundler@6.0.0-next.11
|
|
74
|
+
- @forge/cli-shared@8.0.0-next.11
|
|
75
|
+
|
|
76
|
+
## 6.0.0-next.10
|
|
77
|
+
|
|
78
|
+
### Patch Changes
|
|
79
|
+
|
|
80
|
+
- @forge/bundler@6.0.0-next.10
|
|
81
|
+
- @forge/cli-shared@8.0.0-next.10
|
|
82
|
+
|
|
3
83
|
## 6.0.0-next.9
|
|
4
84
|
|
|
5
85
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function-change-watcher.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/function-change-watcher.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAoB,MAAM,EAAE,aAAa,EAA+B,MAAM,mBAAmB,CAAC;AACrH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAIL,OAAO,EACP,aAAa,EACd,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvF,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAED,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC,qBAAa,iBAAkB,YAAW,qBAAqB;IAE3D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAFb,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC;IAG7D,aAAa,CACxB,WAAW,EAAE,aAAa,EAC1B,aAAa,GAAE,aAA2C,GACzD,OAAO,CAAC,IAAI,CAAC;IAYH,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,OAAO,CAAC,YAAY,CAElB;YAEY,mBAAmB;
|
|
1
|
+
{"version":3,"file":"function-change-watcher.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/function-change-watcher.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAoB,MAAM,EAAE,aAAa,EAA+B,MAAM,mBAAmB,CAAC;AACrH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAIL,OAAO,EACP,aAAa,EACd,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvF,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAED,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC,qBAAa,iBAAkB,YAAW,qBAAqB;IAE3D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAFb,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC;IAG7D,aAAa,CACxB,WAAW,EAAE,aAAa,EAC1B,aAAa,GAAE,aAA2C,GACzD,OAAO,CAAC,IAAI,CAAC;IAYH,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,OAAO,CAAC,YAAY,CAElB;YAEY,mBAAmB;WAuBnB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa;CAY7F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tunnel-interactor.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/tunnel-interactor.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAyC,MAAM,EAAQ,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE/C,qBAAa,gBAAgB;IAGzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFzB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;gBAE7B,MAAM,EAAE,MAAM,EAC/B,cAAc,EAAE,cAAc;IAKzB,mBAAmB,CACxB,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EACjC,aAAa,EAAE,cAAc,GAAG,SAAS,EACzC,mBAAmB,EAAE,SAAS,GAC7B,OAAO,CAAC,IAAI,CAAC;IAsCT,6BAA6B,CAAC,gBAAgB,EAAE,MAAM;IAUtD,QAAQ,sBACM,iBAAiB,kBACrB,aAAa,KAC3B,QAAQ,cAAc,GAAG,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"tunnel-interactor.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/tunnel-interactor.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAyC,MAAM,EAAQ,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE/C,qBAAa,gBAAgB;IAGzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFzB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;gBAE7B,MAAM,EAAE,MAAM,EAC/B,cAAc,EAAE,cAAc;IAKzB,mBAAmB,CACxB,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EACjC,aAAa,EAAE,cAAc,GAAG,SAAS,EACzC,mBAAmB,EAAE,SAAS,GAC7B,OAAO,CAAC,IAAI,CAAC;IAsCT,6BAA6B,CAAC,gBAAgB,EAAE,MAAM;IAUtD,QAAQ,sBACM,iBAAiB,kBACrB,aAAa,KAC3B,QAAQ,cAAc,GAAG,SAAS,CAAC,CAwDpC;CACH"}
|
|
@@ -57,10 +57,7 @@ class TunnelInteractor {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
watchApp = async (startTunnelResult, tunnelOptions = cli_shared_1.defaultNoDebugTunnelOptions) => {
|
|
60
|
-
const { localPort,
|
|
61
|
-
if (inspectorAddress) {
|
|
62
|
-
this.logger.info(cli_shared_1.Text.tunnel.startedInspector(inspectorAddress));
|
|
63
|
-
}
|
|
60
|
+
const { localPort, reloadSandboxes, faasServer, uiServers } = startTunnelResult;
|
|
64
61
|
const onBuildWillStart = async () => {
|
|
65
62
|
this.logger.info('');
|
|
66
63
|
this.logger.info(cli_shared_1.Text.bundle.detectedChanges);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BundlerOutput } from '@forge/bundler';
|
|
2
2
|
import { AppConfigProvider, ConfigFile, Logger, TunnelOptions } from '@forge/cli-shared';
|
|
3
|
-
import { Inspector } from '@forge/runtime';
|
|
4
3
|
import { DevelopmentServer } from '../servers';
|
|
5
4
|
import { FunctionChangeWatcher } from './interactors';
|
|
6
5
|
import { TunnelDefinitions } from '../index';
|
|
@@ -14,7 +13,6 @@ export interface StartTunnelOptions {
|
|
|
14
13
|
export interface StartTunnelResult {
|
|
15
14
|
localPort: number;
|
|
16
15
|
tunnelDefinitions: TunnelDefinitions;
|
|
17
|
-
inspectorAddress?: string;
|
|
18
16
|
faasServer: DevelopmentServer;
|
|
19
17
|
uiServers: DevelopmentServer[];
|
|
20
18
|
stopFunction(): Promise<void>;
|
|
@@ -26,12 +24,11 @@ export declare class StartTunnelCommand {
|
|
|
26
24
|
private readonly tunnelFactory;
|
|
27
25
|
private readonly tunnelClient;
|
|
28
26
|
private readonly functionHost;
|
|
29
|
-
private readonly inspector;
|
|
30
27
|
private readonly logger;
|
|
31
28
|
private readonly configFile;
|
|
32
29
|
private tunnelServers;
|
|
33
30
|
private cspReporterServer;
|
|
34
|
-
constructor(getAppConfig: AppConfigProvider, devServer: DevelopmentServer, tunnelFactory: CreateTunnelService, tunnelClient: RegisterTunnelService, functionHost: FunctionChangeWatcher,
|
|
31
|
+
constructor(getAppConfig: AppConfigProvider, devServer: DevelopmentServer, tunnelFactory: CreateTunnelService, tunnelClient: RegisterTunnelService, functionHost: FunctionChangeWatcher, logger: Logger, configFile: ConfigFile);
|
|
35
32
|
private stopServices;
|
|
36
33
|
private startFaaSTunnelServer;
|
|
37
34
|
private startResourceBasedTunnelsServers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-tunnel-command.d.ts","sourceRoot":"","sources":["../../src/command/start-tunnel-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"start-tunnel-command.d.ts","sourceRoot":"","sources":["../../src/command/start-tunnel-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,EAAmB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAI1G,OAAO,EACL,iBAAiB,EAKlB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACzE,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,eAAe,CAAC,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1F;AAED,qBAAa,kBAAkB;IAK3B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAV7B,OAAO,CAAC,aAAa,CAAmE;IACxF,OAAO,CAAC,iBAAiB,CAAgC;gBAGtC,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,iBAAiB,EAC5B,aAAa,EAAE,mBAAmB,EAClC,YAAY,EAAE,qBAAqB,EACnC,YAAY,EAAE,qBAAqB,EACnC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU;IAGzC,OAAO,CAAC,YAAY,CASlB;IAEF,OAAO,CAAC,qBAAqB,CAuB3B;IAEF,OAAO,CAAC,gCAAgC,CAoCtC;IAEW,OAAO,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CA8C9E"}
|
|
@@ -2,30 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StartTunnelCommand = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const cli_shared_1 = require("@forge/cli-shared");
|
|
6
|
-
const runtime_1 = require("@forge/runtime");
|
|
7
5
|
const node_cache_1 = tslib_1.__importDefault(require("node-cache"));
|
|
8
6
|
const portfinder_1 = require("portfinder");
|
|
9
7
|
const servers_1 = require("../servers");
|
|
10
|
-
const index_1 = require("../index");
|
|
11
8
|
class StartTunnelCommand {
|
|
12
9
|
getAppConfig;
|
|
13
10
|
devServer;
|
|
14
11
|
tunnelFactory;
|
|
15
12
|
tunnelClient;
|
|
16
13
|
functionHost;
|
|
17
|
-
inspector;
|
|
18
14
|
logger;
|
|
19
15
|
configFile;
|
|
20
16
|
tunnelServers = {};
|
|
21
17
|
cspReporterServer;
|
|
22
|
-
constructor(getAppConfig, devServer, tunnelFactory, tunnelClient, functionHost,
|
|
18
|
+
constructor(getAppConfig, devServer, tunnelFactory, tunnelClient, functionHost, logger, configFile) {
|
|
23
19
|
this.getAppConfig = getAppConfig;
|
|
24
20
|
this.devServer = devServer;
|
|
25
21
|
this.tunnelFactory = tunnelFactory;
|
|
26
22
|
this.tunnelClient = tunnelClient;
|
|
27
23
|
this.functionHost = functionHost;
|
|
28
|
-
this.inspector = inspector;
|
|
29
24
|
this.logger = logger;
|
|
30
25
|
this.configFile = configFile;
|
|
31
26
|
}
|
|
@@ -35,7 +30,6 @@ class StartTunnelCommand {
|
|
|
35
30
|
this.tunnelClient.unregisterTunnels(appId, environmentKey),
|
|
36
31
|
this.tunnelFactory.closeTunnel(),
|
|
37
32
|
this.devServer.stop(),
|
|
38
|
-
this.inspector.stopServer(),
|
|
39
33
|
...Object.values(this.tunnelServers).map((server) => server.stop()),
|
|
40
34
|
this.cspReporterServer?.stop()
|
|
41
35
|
]);
|
|
@@ -100,26 +94,14 @@ class StartTunnelCommand {
|
|
|
100
94
|
}))
|
|
101
95
|
};
|
|
102
96
|
await this.tunnelClient.registerTunnels(appId, environmentKey, tunnelDefinitions);
|
|
103
|
-
const inspectorAddress = (0, index_1.isInspectorEnabled)() ? this.inspector.startServer(index_1.INSPECTOR_PORT) : undefined;
|
|
104
97
|
const stopFunction = async () => this.stopServices(appId, environmentKey);
|
|
105
98
|
const reloadSandboxes = async (bundledCode, tunnelOptions) => {
|
|
106
99
|
await this.functionHost.stopWatching();
|
|
107
|
-
|
|
108
|
-
await this.functionHost.startWatching(bundledCode, tunnelOptions);
|
|
109
|
-
}
|
|
110
|
-
catch (e) {
|
|
111
|
-
if (e instanceof runtime_1.SnapshotCodeError) {
|
|
112
|
-
this.logger.error(new Error(cli_shared_1.Text.snapshot.error('App code snapshot error', e.message)));
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
throw e;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
100
|
+
await this.functionHost.startWatching(bundledCode, tunnelOptions);
|
|
118
101
|
};
|
|
119
102
|
return {
|
|
120
103
|
localPort: faasTunnelServer.port,
|
|
121
104
|
tunnelDefinitions,
|
|
122
|
-
inspectorAddress,
|
|
123
105
|
stopFunction,
|
|
124
106
|
reloadSandboxes,
|
|
125
107
|
faasServer: faasTunnelServer.devServer,
|
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":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,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
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isInspectorEnabled = exports.INSPECTOR_PORT = void 0;
|
|
4
3
|
const tslib_1 = require("tslib");
|
|
5
|
-
exports.INSPECTOR_PORT = process.env.TUNNEL_INSPECTOR_PORT
|
|
6
|
-
? parseInt(process.env.TUNNEL_INSPECTOR_PORT, 10)
|
|
7
|
-
: 3000;
|
|
8
|
-
function isInspectorEnabled() {
|
|
9
|
-
return process.env.TUNNEL_INSPECTOR_ENABLED === 'true';
|
|
10
|
-
}
|
|
11
|
-
exports.isInspectorEnabled = isInspectorEnabled;
|
|
12
4
|
tslib_1.__exportStar(require("./services"), exports);
|
|
13
5
|
tslib_1.__exportStar(require("./servers"), exports);
|
|
14
6
|
tslib_1.__exportStar(require("./command"), exports);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExternalRequestBody, InvocationResult, Sandbox, SandboxConfig } from '@forge/runtime';
|
|
2
2
|
export declare class NodeSandbox implements Sandbox {
|
|
3
3
|
readonly name: string;
|
|
4
4
|
private process;
|
|
5
5
|
private readonly callbacks;
|
|
6
6
|
constructor({ appPath, modName, handler, debugPort }: SandboxConfig);
|
|
7
7
|
private handleOutput;
|
|
8
|
-
execute(
|
|
8
|
+
execute(request: ExternalRequestBody): Promise<InvocationResult>;
|
|
9
9
|
stop(): void;
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=node-sandbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-sandbox.d.ts","sourceRoot":"","sources":["../../src/sandbox/node-sandbox.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"node-sandbox.d.ts","sourceRoot":"","sources":["../../src/sandbox/node-sandbox.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,OAAO,EACP,aAAa,EAId,MAAM,gBAAgB,CAAC;AAMxB,qBAAa,WAAY,YAAW,OAAO;IACzC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkD;gBAEhE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,aAAa;IAgCnE,OAAO,CAAC,YAAY;IAOd,OAAO,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAyBtE,IAAI,IAAI,IAAI;CAGb"}
|
|
@@ -45,26 +45,20 @@ class NodeSandbox {
|
|
|
45
45
|
runtime_1.StaticInvocationEventEmitter.emit(runtime_1.EVENT_P3_LOG, p3LogEvent);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
async execute(
|
|
49
|
-
const lambdaEvent = {
|
|
50
|
-
_meta: xenInvocationRequest.__deprecatedGetMeta(),
|
|
51
|
-
body: xenInvocationRequest.getBody(),
|
|
52
|
-
handler: xenInvocationRequest.getHandler(),
|
|
53
|
-
variables: xenInvocationRequest.getUserVariables()
|
|
54
|
-
};
|
|
48
|
+
async execute(request) {
|
|
55
49
|
const requestId = (0, uuid_1.v4)();
|
|
56
50
|
return new Promise((resolve, reject) => {
|
|
57
51
|
this.callbacks.set(requestId, (result) => {
|
|
58
52
|
this.callbacks.delete(requestId);
|
|
59
53
|
resolve(result);
|
|
60
54
|
});
|
|
61
|
-
const timeout =
|
|
55
|
+
const timeout = request._meta.timeout ?? 25;
|
|
62
56
|
const deadline = Date.now() + timeout * 1000;
|
|
63
57
|
const tunnelContext = {
|
|
64
58
|
requestId,
|
|
65
59
|
deadline
|
|
66
60
|
};
|
|
67
|
-
const message = { lambdaEvent, tunnelContext };
|
|
61
|
+
const message = { lambdaEvent: request, tunnelContext };
|
|
68
62
|
this.process.send(message);
|
|
69
63
|
});
|
|
70
64
|
}
|
|
@@ -32,7 +32,7 @@ class NativeUITunnelServer extends resource_tunnel_server_1.ResourceTunnelServer
|
|
|
32
32
|
});
|
|
33
33
|
this.server = new webpack_dev_server_1.default({
|
|
34
34
|
port,
|
|
35
|
-
host:
|
|
35
|
+
host: '0.0.0.0',
|
|
36
36
|
setupMiddlewares: (middlewares) => {
|
|
37
37
|
const index = middlewares.findIndex((middleware) => middleware.name === 'webpack-dev-middleware');
|
|
38
38
|
middlewares.splice(index, 0, {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { InvocationService } from '../servers';
|
|
2
|
-
import { ExternalRequestBody
|
|
2
|
+
import { ExternalRequestBody } from '@forge/runtime';
|
|
3
3
|
import { Logger } from '@forge/cli-shared';
|
|
4
4
|
export declare class LocalInvocationService implements InvocationService {
|
|
5
5
|
private readonly logger;
|
|
6
|
-
|
|
7
|
-
constructor(logger: Logger, inspector: Inspector);
|
|
6
|
+
constructor(logger: Logger);
|
|
8
7
|
invoke(handler: string, request: ExternalRequestBody): Promise<any>;
|
|
9
8
|
static INTERNAL_METRICS: string[];
|
|
10
|
-
static printMetrics: (
|
|
9
|
+
static printMetrics: (metrics: {
|
|
11
10
|
[key: string]: any;
|
|
12
11
|
}[] | undefined, metricsCompressed: string | undefined, logger: Logger) => void;
|
|
13
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-invocation-service.d.ts","sourceRoot":"","sources":["../../src/services/local-invocation-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"local-invocation-service.d.ts","sourceRoot":"","sources":["../../src/services/local-invocation-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAyB,MAAM,mBAAmB,CAAC;AAKlE,qBAAa,sBAAuB,YAAW,iBAAiB;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE9B,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC;IAyBhF,MAAM,CAAC,gBAAgB,WAA6D;IAEpF,MAAM,CAAC,YAAY;;wCAEE,MAAM,GAAG,SAAS,UAC7B,MAAM,KACb,IAAI,CAcL;CACH"}
|
|
@@ -3,18 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LocalInvocationService = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const util_1 = require("../util");
|
|
6
|
-
const index_1 = require("../index");
|
|
7
|
-
const uuid_1 = require("uuid");
|
|
8
|
-
const runtime_1 = require("@forge/runtime");
|
|
9
6
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
10
7
|
const zlib = tslib_1.__importStar(require("node:zlib"));
|
|
11
8
|
const DEFAULT_INVOCATION_TIMEOUT = 25;
|
|
12
9
|
class LocalInvocationService {
|
|
13
10
|
logger;
|
|
14
|
-
|
|
15
|
-
constructor(logger, inspector) {
|
|
11
|
+
constructor(logger) {
|
|
16
12
|
this.logger = logger;
|
|
17
|
-
this.inspector = inspector;
|
|
18
13
|
}
|
|
19
14
|
async invoke(handler, request) {
|
|
20
15
|
this.logger.info('');
|
|
@@ -23,36 +18,18 @@ class LocalInvocationService {
|
|
|
23
18
|
if (!sandbox) {
|
|
24
19
|
throw new cli_shared_1.ValidationError(cli_shared_1.Text.tunnel.error.handler.notFound(handler));
|
|
25
20
|
}
|
|
26
|
-
const inspect = (0, index_1.isInspectorEnabled)();
|
|
27
|
-
if (inspect && this.inspector.isServerStopped()) {
|
|
28
|
-
const inspectorUrl = this.inspector.startServer(index_1.INSPECTOR_PORT);
|
|
29
|
-
this.logger.info(cli_shared_1.Text.tunnel.startedInspector(inspectorUrl));
|
|
30
|
-
}
|
|
31
|
-
const variables = request.variables || [];
|
|
32
|
-
const requestId = (0, util_1.getRequestId)(request, (0, uuid_1.v4)());
|
|
33
21
|
const timeout = request._meta.timeout ?? DEFAULT_INVOCATION_TIMEOUT;
|
|
34
|
-
const xenInvocationRequest = (0, runtime_1.xenInvocationRequestFactory)({
|
|
35
|
-
request: { ...request, variables },
|
|
36
|
-
ctx: { requestId, traceId: requestId, timeout }
|
|
37
|
-
});
|
|
38
|
-
const invocationLimits = (0, runtime_1.perInvocationLimitsTrackerFactory)(xenInvocationRequest);
|
|
39
22
|
const tunnelWarningTimeout = setTimeout(() => {
|
|
40
23
|
this.logger.warn(cli_shared_1.Text.tunnel.invocationTimeout(timeout));
|
|
41
24
|
}, timeout * 1000);
|
|
42
|
-
const { body, metrics, success, error, metricsCompressed } = await (
|
|
43
|
-
sandbox,
|
|
44
|
-
xenInvocationRequest,
|
|
45
|
-
invocationLimits,
|
|
46
|
-
inspector: inspect ? this.inspector : undefined
|
|
47
|
-
});
|
|
25
|
+
const { body, metrics, success, error, metricsCompressed } = await sandbox.execute(request);
|
|
48
26
|
clearTimeout(tunnelWarningTimeout);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return reportMetrics ? { body, metrics, success, error, metricsCompressed } : body;
|
|
27
|
+
LocalInvocationService.printMetrics(metrics, metricsCompressed, this.logger);
|
|
28
|
+
return { body, metrics, success, error, metricsCompressed };
|
|
52
29
|
}
|
|
53
30
|
static INTERNAL_METRICS = ['execute.setup-request-context', 'invoke.setup-isolate'];
|
|
54
|
-
static printMetrics = (
|
|
55
|
-
if (
|
|
31
|
+
static printMetrics = (metrics, metricsCompressed, logger) => {
|
|
32
|
+
if (metrics?.length) {
|
|
56
33
|
if (metricsCompressed) {
|
|
57
34
|
metrics = JSON.parse(zlib.unzipSync(Buffer.from(metricsCompressed, 'base64')).toString());
|
|
58
35
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AppDeploymentEventLogLevel } from '@forge/cli-shared';
|
|
2
1
|
import { P3LogEvent } from '@forge/runtime';
|
|
3
2
|
interface LambdaError {
|
|
4
3
|
errorType: string;
|
|
@@ -22,6 +21,5 @@ export declare const getRequestId: (request: any, value?: string) => string;
|
|
|
22
21
|
export declare const formatInvocation: (handler: string, request: any) => string;
|
|
23
22
|
export declare const formatTimestamp: () => string;
|
|
24
23
|
export declare const formatRuntimeLog: (event: P3LogEvent) => string;
|
|
25
|
-
export declare const mapLogLevel: (level: string) => AppDeploymentEventLogLevel;
|
|
26
24
|
export {};
|
|
27
25
|
//# sourceMappingURL=invocation-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invocation-utils.d.ts","sourceRoot":"","sources":["../../src/util/invocation-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invocation-utils.d.ts","sourceRoot":"","sources":["../../src/util/invocation-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,UAAU,WAAW;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,EAAE,CAAC;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,oBAAqB,SAAQ,KAAK;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,EAAE,CAAC;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,aAAa,UAAW,oBAAoB,KAAG,WAS3D,CAAC;AAEF,eAAO,MAAM,YAAY,YAAa,GAAG,qBAAsB,MAU9D,CAAC;AAEF,eAAO,MAAM,gBAAgB,YAAa,MAAM,WAAW,GAAG,KAAG,MAGhE,CAAC;AAMF,eAAO,MAAM,eAAe,QAAO,MAOlC,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAAW,UAAU,KAAG,MAUpD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.formatRuntimeLog = exports.formatTimestamp = exports.formatInvocation = exports.getRequestId = exports.toLambdaError = void 0;
|
|
4
4
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
5
|
const toLambdaError = (error) => {
|
|
6
6
|
return {
|
|
@@ -50,17 +50,3 @@ const formatRuntimeLog = (event) => {
|
|
|
50
50
|
(0, cli_shared_1.formatRuntimeLogArgs)(event.logArguments));
|
|
51
51
|
};
|
|
52
52
|
exports.formatRuntimeLog = formatRuntimeLog;
|
|
53
|
-
const mapLogLevel = (level) => {
|
|
54
|
-
switch (level) {
|
|
55
|
-
case 'warning':
|
|
56
|
-
return cli_shared_1.AppDeploymentEventLogLevel.Warning;
|
|
57
|
-
case 'error':
|
|
58
|
-
return cli_shared_1.AppDeploymentEventLogLevel.Error;
|
|
59
|
-
case 'info':
|
|
60
|
-
case 'debug':
|
|
61
|
-
return cli_shared_1.AppDeploymentEventLogLevel.Info;
|
|
62
|
-
default:
|
|
63
|
-
throw new Error('Unexpected snapshot log level: ' + level);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
exports.mapLogLevel = mapLogLevel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/tunnel",
|
|
3
|
-
"version": "6.0.0
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Tunnel functionality for Forge CLI",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"compile": "tsc -b -v"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@forge/bundler": "6.0.0
|
|
15
|
-
"@forge/cli-shared": "8.0.0
|
|
16
|
-
"@forge/csp": "4.0.0
|
|
17
|
-
"@forge/runtime": "6.0.0
|
|
14
|
+
"@forge/bundler": "6.0.0",
|
|
15
|
+
"@forge/cli-shared": "8.0.0",
|
|
16
|
+
"@forge/csp": "4.0.0",
|
|
17
|
+
"@forge/runtime": "6.0.0",
|
|
18
18
|
"cloudflared": "^0.7.0",
|
|
19
19
|
"chokidar": "^3.6.0",
|
|
20
20
|
"express": "^4.18.3",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"tmp": "^0.2.3",
|
|
26
26
|
"tslib": "^2.6.2",
|
|
27
27
|
"uuid": "^9.0.1",
|
|
28
|
-
"webpack-dev-server": "^
|
|
28
|
+
"webpack-dev-server": "^5.2.2",
|
|
29
29
|
"which": "^3.0.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@atlassian/xen-test-util": "^4.2.0",
|
|
33
|
-
"@forge/manifest": "10.0.0
|
|
33
|
+
"@forge/manifest": "10.0.0",
|
|
34
34
|
"@types/express": "^4.17.21",
|
|
35
35
|
"@types/jest": "^29.5.12",
|
|
36
36
|
"@types/node": "20.19.0",
|