@forge/api 3.3.0-next.2 → 3.3.1-next.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 CHANGED
@@ -1,5 +1,26 @@
1
1
  # @forge/api
2
2
 
3
+ ## 3.3.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - da345ba: Fix custom authentication header for first party api request
8
+
9
+ ## 3.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 119eb24: Implement external auth API enhancements for Node runtime
14
+
15
+ ### Patch Changes
16
+
17
+ - fc5ea37: Bumping dependencies via Renovate:
18
+
19
+ - nock
20
+
21
+ - Updated dependencies [d76d95c]
22
+ - @forge/util@1.4.2
23
+
3
24
  ## 3.3.0-next.2
4
25
 
5
26
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/api/fetch.ts"],"names":[],"mappings":"AAEA,OAAc,EAAE,WAAW,EAAY,MAAM,YAAY,CAAC;AAS1D,OAAO,EAIL,QAAQ,EACR,WAAW,EAEZ,MAAM,IAAI,CAAC;AAKZ,aAAK,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAC5C,aAAK,SAAS,GAAG,MAAM,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,CAAC;AAElE,aAAK,oBAAoB,GAAG,MAAM,CAAC;AACnC,aAAK,kBAAkB,GAAG,MAAM,CAAC;AAEjC,aAAK,SAAS,GAAG;IAAE,QAAQ,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC;AAC/D,aAAK,qBAAqB,GAAG;IAAE,QAAQ,EAAE,oBAAoB,CAAC;IAAC,MAAM,EAAE,kBAAkB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAS7G,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,WAAW,CAkBzD;AAED,wBAAgB,WA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GAAG,GAAG,QAAQ,CAEvD"}
package/out/api/fetch.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSandboxRuntimeAPI = exports.getNodeRuntimeAPI = exports.addMagicAgent = exports.fetchRemote = exports.fetchProduct = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
5
+ const node_fetch_1 = tslib_1.__importStar(require("node-fetch"));
6
6
  const _1 = require(".");
7
7
  const runtime_1 = require("./runtime");
8
8
  const polyfill_response_1 = require("./polyfill-response");
@@ -11,7 +11,9 @@ function fetchProduct(args) {
11
11
  return async (path, init) => {
12
12
  const url = productURL(args.remote, path);
13
13
  init = (0, exports.addMagicAgent)(init);
14
- init.headers = Object.assign(Object.assign({}, init.headers), { authorization: `Forge ${args.provider}` });
14
+ if (!hasAuthorizationHeader(init.headers)) {
15
+ init.headers = Object.assign(Object.assign({}, init.headers), { authorization: `Forge ${args.provider}` });
16
+ }
15
17
  const response = await (0, node_fetch_1.default)(url, init);
16
18
  handleProxyResponseErrors(response);
17
19
  return response;
@@ -56,6 +58,11 @@ const handleProxyResponseErrors = (response) => {
56
58
  throw new errors_1.ProxyRequestError(response.status, response.headers.get('forge-proxy-error'));
57
59
  }
58
60
  };
61
+ const hasAuthorizationHeader = (headersInit) => {
62
+ if (!headersInit)
63
+ return false;
64
+ return new node_fetch_1.Headers(headersInit).has('authorization');
65
+ };
59
66
  function productURL(remote, path) {
60
67
  if (!path.startsWith('/')) {
61
68
  path = '/' + path;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/api",
3
- "version": "3.3.0-next.2",
3
+ "version": "3.3.1-next.0",
4
4
  "description": "Forge API methods",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
@@ -12,7 +12,7 @@
12
12
  "compile": "tsc -b -v"
13
13
  },
14
14
  "devDependencies": {
15
- "@forge/runtime": "5.5.0-next.2",
15
+ "@forge/runtime": "5.5.0",
16
16
  "@types/node": "14.18.63",
17
17
  "expect-type": "^0.17.3",
18
18
  "jest-matcher-specific-error": "^1.0.0",
@@ -22,7 +22,7 @@
22
22
  "@forge/auth": "0.0.5",
23
23
  "@forge/egress": "1.2.13",
24
24
  "@forge/storage": "1.5.15",
25
- "@forge/util": "1.4.2-next.0",
25
+ "@forge/util": "1.4.2",
26
26
  "@types/node-fetch": "^2.6.11",
27
27
  "node-fetch": "2.7.0"
28
28
  }