@forge/api 3.3.1-next.1 → 3.4.0-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,18 @@
1
1
  # @forge/api
2
2
 
3
+ ## 3.4.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4d149f1: Support absolute paths for withProvider fetch for the Node runtime
8
+
9
+ ## 3.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - da345ba: Fix custom authentication header for first party api request
14
+ - 67590d1: Update type used by Node runtime
15
+
3
16
  ## 3.3.1-next.1
4
17
 
5
18
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/api/fetch.ts"],"names":[],"mappings":"AAEA,OAAc,EAAE,WAAW,EAAkC,MAAM,YAAY,CAAC;AAShF,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,CAqBzD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,qBAAqB,GAAG,WAAW,CAcpE;AAyGD,eAAO,MAAM,aAAa,EAAE,CAAC,I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
  exports.fetchProduct = fetchProduct;
23
23
  function fetchRemote(args) {
24
24
  return async (path, init) => {
25
- const url = `https://${args.remote}${path}`;
25
+ const remoteUrl = new URL(`https://${args.remote}`);
26
+ const url = new URL(path, remoteUrl);
27
+ if (url.hostname !== remoteUrl.hostname) {
28
+ throw new Error(`Invalid path provided ${path}`);
29
+ }
30
+ remoteUrl.searchParams.append('path', path);
26
31
  init = (0, exports.addMagicAgent)(init, 'EXTERNAL_AUTH_REQUEST');
27
32
  init.headers = Object.assign(Object.assign({}, init.headers), { authorization: `Forge user ${args.provider} ${args.account}` });
28
- const response = await (0, node_fetch_1.default)(url, init);
33
+ const response = await (0, node_fetch_1.default)(remoteUrl, init);
29
34
  handleProxyResponseErrors(response);
30
35
  return response;
31
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/api",
3
- "version": "3.3.1-next.1",
3
+ "version": "3.4.0-next.0",
4
4
  "description": "Forge API methods",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",