@forge/api 2.18.4-next.1 → 2.18.4-next.3

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,20 @@
1
1
  # @forge/api
2
2
 
3
+ ## 2.18.4-next.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 854ff5d: Fix Authorize API on Node runtime
8
+ - Updated dependencies [854ff5d]
9
+ - @forge/auth@0.0.4-next.1
10
+
11
+ ## 2.18.4-next.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [2cba32e]
16
+ - @forge/storage@1.5.6-next.1
17
+
3
18
  ## 2.18.4-next.1
4
19
 
5
20
  ### Patch Changes
@@ -15,6 +15,7 @@ export type ForgeRuntime = {
15
15
  moduleType: string;
16
16
  moduleKey: string;
17
17
  };
18
+ aaid?: string;
18
19
  allowedEgress: string[];
19
20
  lambdaContext: {
20
21
  awsRequestId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/api/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAC;AAU5E,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,aAAa,EAAE,MAAM,EAAE,CAAC;IACx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MAAM,CAAC;IACd,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE;QACb,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE;QACJ,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC;AAEF,wBAAgB,UAAU,IAAI,YAAY,CAOzC;AAED,wBAAgB,aAAa,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,GAAG,EACvD,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,GAAG,CAAC,EACnC,EAAE,IAAI,EAAE,GAAE;IAAE,IAAI,CAAC,EAAE,IAAI,CAAA;CAAO,GAC7B,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,GAAG,CAAC,CAiBjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS;;;;;CAgBrB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS;;;;;CA0BrB,CAAC"}
@@ -2,16 +2,23 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.authorize = void 0;
4
4
  const auth_1 = require("@forge/auth");
5
- const api = global.api;
5
+ const __1 = require("..");
6
6
  const authorize = () => {
7
- if (!process.env.__CURRENT_USER_ACCOUNT_ID)
7
+ let accountId;
8
+ if (global.api) {
9
+ accountId = process.env.__CURRENT_USER_ACCOUNT_ID;
10
+ }
11
+ else {
12
+ accountId = (0, __1.getRuntime)().aaid;
13
+ }
14
+ if (!accountId) {
8
15
  throw new Error(`Couldn’t find the accountId of the invoking user. This API can only be used inside user-invoked modules.`);
9
- const accountId = process.env.__CURRENT_USER_ACCOUNT_ID;
16
+ }
10
17
  return Object.assign(Object.assign({}, (0, auth_1.authorizeConfluenceWithFetch)(async (path, opts) => {
11
- const res = await api.asUser().requestConfluence(path, opts);
18
+ const res = await (0, __1.asUser)().requestConfluence((0, __1.assumeTrustedRoute)(path), opts);
12
19
  return res.json();
13
20
  }, accountId)), (0, auth_1.authorizeJiraWithFetch)(async (path, opts) => {
14
- const res = await api.asUser().requestJira(path, opts);
21
+ const res = await (0, __1.asUser)().requestJira((0, __1.assumeTrustedRoute)(path), opts);
15
22
  return res.json();
16
23
  }, accountId));
17
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/api",
3
- "version": "2.18.4-next.1",
3
+ "version": "2.18.4-next.3",
4
4
  "description": "Forge API methods",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
@@ -12,15 +12,15 @@
12
12
  "compile": "tsc -b -v"
13
13
  },
14
14
  "devDependencies": {
15
- "@forge/runtime": "4.4.6-next.1",
15
+ "@forge/runtime": "4.4.6-next.4",
16
16
  "@types/node": "14.18.54",
17
17
  "jest-matcher-specific-error": "^1.0.0",
18
18
  "nock": "^10.0.6"
19
19
  },
20
20
  "dependencies": {
21
- "@forge/auth": "0.0.4-next.0",
21
+ "@forge/auth": "0.0.4-next.1",
22
22
  "@forge/egress": "1.2.2",
23
- "@forge/storage": "1.5.6-next.0",
23
+ "@forge/storage": "1.5.6-next.1",
24
24
  "@forge/util": "1.3.1",
25
25
  "@types/node-fetch": "^2.6.4",
26
26
  "node-fetch": "2.6.12"