@forge/tunnel 3.8.0-next.19 → 3.8.0-next.20

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,14 @@
1
1
  # @forge/tunnel
2
2
 
3
+ ## 3.8.0-next.20
4
+
5
+ ### Patch Changes
6
+
7
+ - 3a516891: Allow function timeout to be determined by payload in tunnel
8
+ - Updated dependencies [3a516891]
9
+ - @forge/runtime@5.1.0-next.7
10
+ - @forge/bundler@4.12.1-next.19
11
+
3
12
  ## 3.8.0-next.19
4
13
 
5
14
  ### Patch Changes
@@ -11,7 +11,6 @@ export interface Bundle {
11
11
  bundleFileSourceMapPath: string;
12
12
  bundleFileSourceMap?: string;
13
13
  }
14
- export declare const INVOCATION_TIMEOUT = 25;
15
14
  export declare const MEMORY_LIMIT = 256;
16
15
  export declare class LocalFunctionHost implements FunctionChangeWatcher {
17
16
  private readonly configFile;
@@ -1 +1 @@
1
- {"version":3,"file":"function-change-watcher.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/function-change-watcher.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAA8B,MAAM,EAAqB,MAAM,mBAAmB,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAIL,OAAO,EACP,aAAa,EACb,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,WAAW,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,MAAM;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uBAAuB,EAAE,MAAM,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,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,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,aAAa;IANhC,OAAO,CAAC,YAAY,CAA8C;gBAG/C,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,eAAe,GAAG,IAAI,EAChC,aAAa,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC;YAG5D,mBAAmB;IA2BpB,aAAa,CAAC,WAAW,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IA+CxD,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,OAAO,CAAC,YAAY,CAElB;YAEY,mBAAmB;CAsBlC"}
1
+ {"version":3,"file":"function-change-watcher.d.ts","sourceRoot":"","sources":["../../../src/command/interactors/function-change-watcher.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAA8B,MAAM,EAAqB,MAAM,mBAAmB,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAIL,OAAO,EACP,aAAa,EACb,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,WAAW,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,MAAM;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uBAAuB,EAAE,MAAM,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;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,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,aAAa;IANhC,OAAO,CAAC,YAAY,CAA8C;gBAG/C,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,eAAe,GAAG,IAAI,EAChC,aAAa,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC;YAG5D,mBAAmB;IA2BpB,aAAa,CAAC,WAAW,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IA+CxD,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,OAAO,CAAC,YAAY,CAElB;YAEY,mBAAmB;CAqBlC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LocalFunctionHost = exports.MEMORY_LIMIT = exports.INVOCATION_TIMEOUT = void 0;
3
+ exports.LocalFunctionHost = exports.MEMORY_LIMIT = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const path_1 = require("path");
6
6
  const fs_1 = require("fs");
@@ -8,7 +8,6 @@ const tmp_1 = tslib_1.__importDefault(require("tmp"));
8
8
  const cli_shared_1 = require("@forge/cli-shared");
9
9
  const runtime_1 = require("@forge/runtime");
10
10
  const util_1 = require("../../util");
11
- exports.INVOCATION_TIMEOUT = 25;
12
11
  exports.MEMORY_LIMIT = 256;
13
12
  class LocalFunctionHost {
14
13
  constructor(configFile, logger, snapshot, createSandbox) {
@@ -93,7 +92,6 @@ class LocalFunctionHost {
93
92
  modName: module,
94
93
  appPath: srcPath,
95
94
  handler: func,
96
- timeout: exports.INVOCATION_TIMEOUT,
97
95
  isolateMemory: exports.MEMORY_LIMIT
98
96
  });
99
97
  }));
@@ -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;AAI/C,OAAO,EACL,mBAAmB,EACnB,SAAS,EAKV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,EAAyB,MAAM,mBAAmB,CAAC;AAG9E,qBAAa,sBAAuB,YAAW,iBAAiB;IAE5D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAFT,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS;IAG1B,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC;IA2DhF,MAAM,CAAC,gBAAgB,WAA6D;IAEpF,MAAM,CAAC,YAAY,wBACI,OAAO;;6BAEpB,MAAM,KACb,IAAI,CAUL;CACH"}
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;AAI/C,OAAO,EACL,mBAAmB,EACnB,SAAS,EAKV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,EAAyB,MAAM,mBAAmB,CAAC;AAI9E,qBAAa,sBAAuB,YAAW,iBAAiB;IAE5D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAFT,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS;IAG1B,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC;IA4DhF,MAAM,CAAC,gBAAgB,WAA6D;IAEpF,MAAM,CAAC,YAAY,wBACI,OAAO;;6BAEpB,MAAM,KACb,IAAI,CAUL;CACH"}
@@ -7,7 +7,7 @@ const index_1 = require("../index");
7
7
  const v4_1 = tslib_1.__importDefault(require("uuid/v4"));
8
8
  const runtime_1 = require("@forge/runtime");
9
9
  const cli_shared_1 = require("@forge/cli-shared");
10
- const interactors_1 = require("../command/interactors");
10
+ const DEFAULT_INVOCATION_TIMEOUT = 25;
11
11
  class LocalInvocationService {
12
12
  constructor(configFile, logger, inspector) {
13
13
  this.configFile = configFile;
@@ -15,6 +15,7 @@ class LocalInvocationService {
15
15
  this.inspector = inspector;
16
16
  }
17
17
  async invoke(handler, request) {
18
+ var _a;
18
19
  this.logger.info('');
19
20
  this.logger.info((0, util_1.formatInvocation)(handler, request));
20
21
  const sandbox = util_1.SandboxesContainer.get()[handler];
@@ -38,21 +39,22 @@ class LocalInvocationService {
38
39
  variables.push({ key: 'FUNCTION_IS_SNAPSHOTTED', value: isSnapshotEnabled.toString(), secure: false });
39
40
  }
40
41
  const requestId = (0, util_1.getRequestId)(request, (0, v4_1.default)());
42
+ const timeout = (_a = request._meta.timeout) !== null && _a !== void 0 ? _a : DEFAULT_INVOCATION_TIMEOUT;
41
43
  const xenInvocationRequest = (0, runtime_1.xenInvocationRequestFactory)({
42
44
  request: Object.assign(Object.assign({}, request), { variables }),
43
- ctx: { requestId, traceId: requestId, timeout: interactors_1.INVOCATION_TIMEOUT }
45
+ ctx: { requestId, traceId: requestId, timeout }
44
46
  });
45
47
  const invocationLimits = (0, runtime_1.perInvocationLimitsTrackerFactory)(xenInvocationRequest);
46
- const timeout = setTimeout(() => {
47
- this.logger.warn(cli_shared_1.Text.tunnel.invocationTimeout(interactors_1.INVOCATION_TIMEOUT));
48
- }, interactors_1.INVOCATION_TIMEOUT * 1000);
48
+ const tunnelWarningTimeout = setTimeout(() => {
49
+ this.logger.warn(cli_shared_1.Text.tunnel.invocationTimeout(timeout));
50
+ }, timeout * 1000);
49
51
  const { body, metrics, success, error } = await (0, runtime_1.invoke)({
50
52
  sandbox,
51
53
  xenInvocationRequest,
52
54
  invocationLimits,
53
55
  inspector: inspect ? this.inspector : undefined
54
56
  });
55
- clearTimeout(timeout);
57
+ clearTimeout(tunnelWarningTimeout);
56
58
  const reportMetrics = xenInvocationRequest.isFeatureFlagEnabled(runtime_1.XEN_RUNTIME_SHOULD_REPORT_METRICS);
57
59
  LocalInvocationService.printMetrics(reportMetrics, metrics, this.logger);
58
60
  return reportMetrics ? { body, metrics, success, error } : body;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/tunnel",
3
- "version": "3.8.0-next.19",
3
+ "version": "3.8.0-next.20",
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.12.1-next.18",
14
+ "@forge/bundler": "4.12.1-next.19",
15
15
  "@forge/cli-shared": "3.19.0-next.14",
16
16
  "@forge/csp": "2.2.2-next.3",
17
- "@forge/runtime": "5.1.0-next.6",
17
+ "@forge/runtime": "5.1.0-next.7",
18
18
  "express": "^4.18.2",
19
19
  "express-intercept": "^1.1.0",
20
20
  "http-proxy-middleware": "^1.3.1",