@forge/tunnel 6.0.5-next.0 → 6.1.0-experimental-3f68b81

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 CHANGED
@@ -1,5 +1,130 @@
1
1
  # @forge/tunnel
2
2
 
3
+ ## 6.1.0-experimental-3f68b81
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [fe2852a]
8
+ - @forge/bundler@6.1.4-experimental-3f68b81
9
+ - @forge/cli-shared@8.5.0-experimental-3f68b81
10
+ - @forge/csp@5.0.1-experimental-3f68b81
11
+
12
+ ## 6.1.0
13
+
14
+ ### Minor Changes
15
+
16
+ - 7e13ccd: Add support for multi-service tunnelling
17
+ - a209a3d: integrate with rovo dev cli
18
+ - 2a0dadd: Remove Node18 runtime
19
+
20
+ ### Patch Changes
21
+
22
+ - 7b15cc4: Hide TypeScript bundler behind an EAP
23
+ - Updated dependencies [b262081]
24
+ - Updated dependencies [97c4d60]
25
+ - Updated dependencies [924b093]
26
+ - Updated dependencies [278cd16]
27
+ - Updated dependencies [be30715]
28
+ - Updated dependencies [725a653]
29
+ - Updated dependencies [a0e621c]
30
+ - Updated dependencies [3620005]
31
+ - Updated dependencies [7b15cc4]
32
+ - Updated dependencies [d27aec7]
33
+ - Updated dependencies [bda7c8d]
34
+ - Updated dependencies [a209a3d]
35
+ - Updated dependencies [2a0dadd]
36
+ - @forge/cli-shared@8.5.0
37
+ - @forge/bundler@6.1.4
38
+ - @forge/csp@5.0.1
39
+
40
+ ## 6.1.0-next.9
41
+
42
+ ### Minor Changes
43
+
44
+ - a209a3d: integrate with rovo dev cli
45
+
46
+ ### Patch Changes
47
+
48
+ - Updated dependencies [b262081]
49
+ - Updated dependencies [97c4d60]
50
+ - Updated dependencies [278cd16]
51
+ - Updated dependencies [3620005]
52
+ - Updated dependencies [a209a3d]
53
+ - @forge/cli-shared@8.5.0-next.8
54
+ - @forge/bundler@6.1.4-next.9
55
+ - @forge/csp@5.0.1-next.0
56
+
57
+ ## 6.1.0-next.8
58
+
59
+ ### Patch Changes
60
+
61
+ - 7b15cc4: Hide TypeScript bundler behind an EAP
62
+ - Updated dependencies [725a653]
63
+ - Updated dependencies [a0e621c]
64
+ - Updated dependencies [7b15cc4]
65
+ - @forge/cli-shared@8.5.0-next.7
66
+ - @forge/bundler@6.1.4-next.8
67
+
68
+ ## 6.1.0-next.7
69
+
70
+ ### Patch Changes
71
+
72
+ - Updated dependencies [d27aec7]
73
+ - @forge/bundler@6.1.4-next.7
74
+
75
+ ## 6.1.0-next.6
76
+
77
+ ### Patch Changes
78
+
79
+ - Updated dependencies [924b093]
80
+ - @forge/cli-shared@8.5.0-next.6
81
+ - @forge/bundler@6.1.4-next.6
82
+
83
+ ## 6.1.0-next.5
84
+
85
+ ### Minor Changes
86
+
87
+ - 7e13ccd: Add support for multi-service tunnelling
88
+
89
+ ### Patch Changes
90
+
91
+ - @forge/bundler@6.1.4-next.5
92
+ - @forge/cli-shared@8.5.0-next.5
93
+
94
+ ## 6.1.0-next.4
95
+
96
+ ### Patch Changes
97
+
98
+ - @forge/bundler@6.1.4-next.4
99
+ - @forge/cli-shared@8.5.0-next.4
100
+
101
+ ## 6.1.0-next.3
102
+
103
+ ### Patch Changes
104
+
105
+ - @forge/bundler@6.1.4-next.3
106
+ - @forge/cli-shared@8.5.0-next.3
107
+
108
+ ## 6.1.0-next.2
109
+
110
+ ### Minor Changes
111
+
112
+ - 2a0dadd: Remove Node18 runtime
113
+
114
+ ### Patch Changes
115
+
116
+ - Updated dependencies [2a0dadd]
117
+ - @forge/cli-shared@8.5.0-next.2
118
+ - @forge/bundler@6.1.4-next.2
119
+
120
+ ## 6.0.5-next.1
121
+
122
+ ### Patch Changes
123
+
124
+ - Updated dependencies [bda7c8d]
125
+ - @forge/bundler@6.1.4-next.1
126
+ - @forge/cli-shared@8.5.0-next.1
127
+
3
128
  ## 6.0.5-next.0
4
129
 
5
130
  ### Patch Changes
@@ -10,10 +10,12 @@ export declare class LocalFunctionHost implements FunctionChangeWatcher {
10
10
  private readonly configFile;
11
11
  private readonly logger;
12
12
  private readonly createSandbox;
13
+ private currentTunnelOptions;
13
14
  constructor(configFile: ConfigFile, logger: Logger, createSandbox: (cfg: SandboxConfig) => Promise<Sandbox>);
14
15
  startWatching(bundledCode: BundlerOutput, tunnelOptions?: TunnelOptions): Promise<void>;
15
16
  stopWatching(): Promise<void>;
16
17
  private onRuntimeLog;
18
+ private runAssistantErrorAnalysis;
17
19
  private initializeSandboxes;
18
20
  static getDebuggerPort(modName: string, handler: string, tunnelOptions: TunnelOptions): number | undefined;
19
21
  }
@@ -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;WAuBnB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa;CAY7F"}
1
+ {"version":3,"file":"function-change-watcher.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/function-change-watcher.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EAEV,MAAM,EACN,aAAa,EAId,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAIL,OAAO,EACP,aAAa,EAEd,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;IAI3D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,aAAa;IALhC,OAAO,CAAC,oBAAoB,CAA8C;gBAGvD,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;IAeH,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,OAAO,CAAC,YAAY,CAOlB;IAEF,OAAO,CAAC,yBAAyB,CAa/B;YAEY,mBAAmB;WAuBnB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa;CAY7F"}
@@ -12,12 +12,14 @@ class LocalFunctionHost {
12
12
  configFile;
13
13
  logger;
14
14
  createSandbox;
15
+ currentTunnelOptions = cli_shared_1.defaultNoDebugTunnelOptions;
15
16
  constructor(configFile, logger, createSandbox) {
16
17
  this.configFile = configFile;
17
18
  this.logger = logger;
18
19
  this.createSandbox = createSandbox;
19
20
  }
20
21
  async startWatching(bundledCode, tunnelOptions = cli_shared_1.defaultNoDebugTunnelOptions) {
22
+ this.currentTunnelOptions = tunnelOptions;
21
23
  const pathTo = (relativePath) => path_1.default.resolve(bundledCode.outputDir, relativePath);
22
24
  const manifestFilePath = pathTo(cli_shared_1.manifestFileName);
23
25
  const manifestContents = JSON.stringify(await this.configFile.readConfig());
@@ -30,6 +32,19 @@ class LocalFunctionHost {
30
32
  }
31
33
  onRuntimeLog = (event) => {
32
34
  this.logger.info((0, util_1.formatRuntimeLog)(event));
35
+ if (event.logLevel === runtime_1.LogLevel.ERROR) {
36
+ this.runAssistantErrorAnalysis(event);
37
+ }
38
+ };
39
+ runAssistantErrorAnalysis = (event) => {
40
+ const assistantName = this.currentTunnelOptions.assistantName;
41
+ if (assistantName) {
42
+ const errorMessage = JSON.stringify(event);
43
+ const prompt = (0, cli_shared_1.createForgeTunnelErrorPrompt)(errorMessage);
44
+ (0, cli_shared_1.runAssistant)(prompt, assistantName, this.logger).catch((error) => {
45
+ this.logger.error(new Error(`Error analysis with ${assistantName}: ${error}`));
46
+ });
47
+ }
33
48
  };
34
49
  async initializeSandboxes(srcPath, tunnelOptions) {
35
50
  try {
@@ -40,5 +40,7 @@ export declare class LocalDevelopmentServer implements DevelopmentServer {
40
40
  compileAndWatch(watch: BundlerWatch, tunnelOptions?: TunnelOptions): Promise<BundlerOutput>;
41
41
  getApp(): express.Application;
42
42
  handleInvocation: express.Handler;
43
+ configureProxyMiddleware: express.Handler;
44
+ private getServicePort;
43
45
  }
44
46
  //# sourceMappingURL=dev-server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/servers/dev-server.ts"],"names":[],"mappings":";;AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAKL,YAAY,EACZ,aAAa,EACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,UAAU,EAEV,gBAAgB,EAChB,2BAA2B,EAC3B,MAAM,EACN,cAAc,EAEd,aAAa,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAe,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAKvD,MAAM,WAAW,gBAAiB,SAAQ,KAAK;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAClG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,aAAa,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC7F;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,iBAAiB,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,GAAG,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO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AAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,2BAA2B;IAT9C,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,UAAU,CAA0B;gBAGzB,iBAAiB,EAAE,iBAAiB,EACpC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,EAC9B,2BAA2B,EAAE,2BAA2B;IAe9D,KAAK,CAAC,IAAI,SAAI,EAAE,YAAY,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAY9F,IAAI;IAIJ,eAAe,CAC1B,KAAK,EAAE,YAAY,EACnB,aAAa,GAAE,aAA2C,GACzD,OAAO,CAAC,aAAa,CAAC;IA+BlB,MAAM,IAAI,OAAO,CAAC,WAAW;IAI7B,gBAAgB,EAAE,OAAO,CAAC,OAAO,CA4BtC;IAEK,wBAAwB,EAAE,OAAO,CAAC,OAAO,CAoC9C;YAQY,cAAc;CAU7B"}
@@ -8,6 +8,7 @@ const cli_shared_1 = require("@forge/cli-shared");
8
8
  const runtime_1 = require("@forge/runtime");
9
9
  const util_1 = require("../util");
10
10
  const http_proxy_middleware_1 = require("http-proxy-middleware");
11
+ const DEFAULT_FORGE_SERVICE_PORT = 7071;
11
12
  async function stopServer(server) {
12
13
  if (!server) {
13
14
  return;
@@ -37,29 +38,7 @@ class LocalDevelopmentServer {
37
38
  this.app.disable('x-powered-by');
38
39
  this.app.disable('etag');
39
40
  this.app.post(`/:fnKey`, express_1.default.json({ limit: '6mb' }), this.handleInvocation);
40
- const FORGE_SERVICE_PORT = 7071;
41
- this.app.use(/^\/forge\/.*\/.*/, (0, http_proxy_middleware_1.createProxyMiddleware)({
42
- target: `http://localhost:${FORGE_SERVICE_PORT}`,
43
- pathRewrite: { '^/forge/[^/]*': '' },
44
- logLevel: 'info',
45
- logProvider: () => {
46
- return {
47
- log: this.logger.trace,
48
- debug: this.logger.trace,
49
- info: this.logger.trace,
50
- warn: this.logger.warn,
51
- error: this.logger.error
52
- };
53
- },
54
- onProxyReq: (proxyReq) => {
55
- this.logger.info(cli_shared_1.Text.tunnel.container.invoke(proxyReq, FORGE_SERVICE_PORT));
56
- },
57
- onError: (err, _, res) => {
58
- const message = cli_shared_1.Text.tunnel.container.error(err.code ?? err.message);
59
- this.logger.warn(message);
60
- res.status(500).send(message);
61
- }
62
- }));
41
+ this.app.use(/^\/forge\/.*--.*\/.*/, this.configureProxyMiddleware);
63
42
  }
64
43
  async start(port = 0, _permissions, _remotes) {
65
44
  this.httpServer = await new Promise((resolve, reject) => {
@@ -81,7 +60,7 @@ class LocalDevelopmentServer {
81
60
  if (!entryPoints.length) {
82
61
  return { outputDir: (0, bundler_1.getOutputDir)({ watchMode }) };
83
62
  }
84
- const bundler = (0, bundler_1.getNodeBundler)(this.logger, (0, bundler_1.getWrapperProvider)({ fileSystemReader: this.fileSystemReader, statsigService: this.statsigService }), this.configFile);
63
+ const bundler = (0, bundler_1.getNodeBundler)(this.logger, (0, bundler_1.getWrapperProvider)({ fileSystemReader: this.fileSystemReader, statsigService: this.statsigService }), this.configFile, this.statsigService);
85
64
  const { translations, modules } = await this.configFile.readConfig();
86
65
  const i18nResourceBundle = await this.i18nResourceBundlingService.bundle(modules, translations);
87
66
  const { result } = await bundler.watch({
@@ -121,5 +100,45 @@ class LocalDevelopmentServer {
121
100
  }
122
101
  }
123
102
  };
103
+ configureProxyMiddleware = async (req, res, next) => {
104
+ const serviceKey = req.originalUrl.match(/^\/forge\/(.*)--.*\/.*/)?.[1];
105
+ const port = await this.getServicePort(serviceKey);
106
+ if (!port || port < 1024 || port > 49152) {
107
+ this.logger.error(new Error(`Invalid tunnel port value for service ${serviceKey}. The 'tunnel:port' must be an integer between 1024 and 49152. Update your manifest.yml and try again.`));
108
+ return;
109
+ }
110
+ (0, http_proxy_middleware_1.createProxyMiddleware)({
111
+ target: `http://localhost:${port}`,
112
+ pathRewrite: { '^/forge/[^/]*': '' },
113
+ logLevel: 'info',
114
+ logProvider: () => {
115
+ return {
116
+ log: this.logger.trace,
117
+ debug: this.logger.trace,
118
+ info: this.logger.trace,
119
+ warn: this.logger.warn,
120
+ error: this.logger.error
121
+ };
122
+ },
123
+ onProxyReq: (proxyReq) => {
124
+ this.logger.info(cli_shared_1.Text.tunnel.container.invoke(proxyReq, port));
125
+ },
126
+ onError: (err, _, res) => {
127
+ const message = cli_shared_1.Text.tunnel.container.error(err.code ?? err.message);
128
+ this.logger.warn(message);
129
+ res.status(500).send(message);
130
+ }
131
+ })(req, res, next);
132
+ };
133
+ async getServicePort(serviceKey) {
134
+ if (serviceKey) {
135
+ const { services } = await this.configFile.readConfig();
136
+ if (services) {
137
+ const defaultPort = services[0].tunnel?.port ?? DEFAULT_FORGE_SERVICE_PORT;
138
+ const index = services.findIndex((service) => service.key === serviceKey);
139
+ return services[index].tunnel?.port ?? defaultPort + index;
140
+ }
141
+ }
142
+ }
124
143
  }
125
144
  exports.LocalDevelopmentServer = LocalDevelopmentServer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/tunnel",
3
- "version": "6.0.5-next.0",
3
+ "version": "6.1.0-experimental-3f68b81",
4
4
  "description": "Tunnel functionality for Forge CLI",
5
5
  "author": "Atlassian",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
@@ -11,9 +11,9 @@
11
11
  "compile": "tsc -b -v"
12
12
  },
13
13
  "dependencies": {
14
- "@forge/bundler": "6.1.4-next.0",
15
- "@forge/cli-shared": "8.5.0-next.0",
16
- "@forge/csp": "5.0.0",
14
+ "@forge/bundler": "6.1.4-experimental-3f68b81",
15
+ "@forge/cli-shared": "8.5.0-experimental-3f68b81",
16
+ "@forge/csp": "5.0.1-experimental-3f68b81",
17
17
  "@forge/runtime": "6.0.3",
18
18
  "cheerio": "^1.1.0",
19
19
  "chokidar": "^3.6.0",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@atlassian/xen-test-util": "^4.2.0",
34
- "@forge/manifest": "10.3.0",
34
+ "@forge/manifest": "10.4.0-experimental-3f68b81",
35
35
  "@types/express": "^4.17.21",
36
36
  "@types/jest": "^29.5.14",
37
37
  "@types/node": "20.19.1",