@forge/api 3.4.1-next.0 → 3.5.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,23 @@
1
1
  # @forge/api
2
2
 
3
+ ## 3.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 94956a5: Avoid logging NEEDS_AUTHENTICATION_ERR when it is thrown from requestCredentials()
8
+
9
+ ### Patch Changes
10
+
11
+ - f8a4714: Use InMemoryMetrics from the Node monorepo
12
+ - Updated dependencies [f8a4714]
13
+ - @forge/util@1.4.3
14
+
15
+ ## 3.5.0-next.1
16
+
17
+ ### Minor Changes
18
+
19
+ - 94956a5: Avoid logging NEEDS_AUTHENTICATION_ERR when it is thrown from requestCredentials()
20
+
3
21
  ## 3.4.1-next.0
4
22
 
5
23
  ### Patch Changes
package/out/api/ari.js CHANGED
@@ -10,6 +10,7 @@ class InstallationAriImpl {
10
10
  constructor(installationId) {
11
11
  this._installationId = installationId;
12
12
  }
13
+ _installationId;
13
14
  get installationId() {
14
15
  return this._installationId;
15
16
  }
@@ -5,6 +5,7 @@ export declare const NEEDS_AUTHENTICATION_ERR = "NEEDS_AUTHENTICATION_ERR";
5
5
  export declare const PROXY_ERR = "PROXY_ERR";
6
6
  export declare function isForgePlatformError(err: Error): boolean;
7
7
  export declare function isHostedCodeError(err: Error | string): boolean;
8
+ export declare function isExpectedError(err: Error): boolean;
8
9
  export declare class HttpError extends Error {
9
10
  status: number | undefined;
10
11
  constructor(message: string);
@@ -29,6 +30,7 @@ export declare class InvalidWorkspaceRequestedError extends NotAllowedError {
29
30
  }
30
31
  export interface NeedsAuthenticationErrorOptions {
31
32
  scopes?: string[];
33
+ isExpectedError?: boolean;
32
34
  }
33
35
  export declare class NeedsAuthenticationError extends HttpError {
34
36
  readonly serviceKey: string;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/api/errors.ts"],"names":[],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6CAAiC;CAO5D;AAED,qBAAa,iBAAkB,SAAQ,SAAS;IAErC,MAAM,EAAE,MAAM;IACd,SAAS,EAAE,MAAM;gBADjB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM;CAK3B"}
package/out/api/errors.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProxyRequestError = exports.NeedsAuthenticationError = exports.InvalidWorkspaceRequestedError = exports.RequestProductNotAllowedError = exports.ProductEndpointNotAllowedError = exports.ExternalEndpointNotAllowedError = exports.NotAllowedError = exports.FetchError = exports.HttpError = exports.isHostedCodeError = exports.isForgePlatformError = exports.PROXY_ERR = exports.NEEDS_AUTHENTICATION_ERR = exports.FUNCTION_FETCH_ERR = exports.REQUEST_EGRESS_ALLOWLIST_ERR = exports.FUNCTION_ERR = void 0;
3
+ exports.ProxyRequestError = exports.NeedsAuthenticationError = exports.InvalidWorkspaceRequestedError = exports.RequestProductNotAllowedError = exports.ProductEndpointNotAllowedError = exports.ExternalEndpointNotAllowedError = exports.NotAllowedError = exports.FetchError = exports.HttpError = exports.isExpectedError = exports.isHostedCodeError = exports.isForgePlatformError = exports.PROXY_ERR = exports.NEEDS_AUTHENTICATION_ERR = exports.FUNCTION_FETCH_ERR = exports.REQUEST_EGRESS_ALLOWLIST_ERR = exports.FUNCTION_ERR = void 0;
4
4
  exports.FUNCTION_ERR = 'FUNCTION_ERR';
5
5
  exports.REQUEST_EGRESS_ALLOWLIST_ERR = 'REQUEST_EGRESS_ALLOWLIST_ERR';
6
6
  exports.FUNCTION_FETCH_ERR = 'FUNCTION_FETCH_ERR';
@@ -14,7 +14,12 @@ function isHostedCodeError(err) {
14
14
  return [exports.FUNCTION_ERR, exports.REQUEST_EGRESS_ALLOWLIST_ERR, exports.FUNCTION_FETCH_ERR, exports.NEEDS_AUTHENTICATION_ERR].includes(typeof err === 'string' ? err : err.name);
15
15
  }
16
16
  exports.isHostedCodeError = isHostedCodeError;
17
+ function isExpectedError(err) {
18
+ return err.name === exports.NEEDS_AUTHENTICATION_ERR && !!err.options?.isExpectedError;
19
+ }
20
+ exports.isExpectedError = isExpectedError;
17
21
  class HttpError extends Error {
22
+ status;
18
23
  constructor(message) {
19
24
  super(message);
20
25
  }
@@ -62,6 +67,8 @@ class InvalidWorkspaceRequestedError extends NotAllowedError {
62
67
  }
63
68
  exports.InvalidWorkspaceRequestedError = InvalidWorkspaceRequestedError;
64
69
  class NeedsAuthenticationError extends HttpError {
70
+ serviceKey;
71
+ options;
65
72
  constructor(error, serviceKey, options) {
66
73
  super(error);
67
74
  this.serviceKey = serviceKey;
@@ -73,6 +80,8 @@ class NeedsAuthenticationError extends HttpError {
73
80
  }
74
81
  exports.NeedsAuthenticationError = NeedsAuthenticationError;
75
82
  class ProxyRequestError extends HttpError {
83
+ status;
84
+ errorCode;
76
85
  constructor(status, errorCode) {
77
86
  super(`Forge platform failed to process runtime HTTP request - ${status} - ${errorCode}`);
78
87
  this.status = status;
package/out/api/fetch.js CHANGED
@@ -12,7 +12,7 @@ function fetchProduct(args) {
12
12
  const url = productURL(args.remote, path);
13
13
  init = (0, exports.addMagicAgent)(init);
14
14
  if (!hasAuthorizationHeader(init.headers)) {
15
- init.headers = Object.assign(Object.assign({}, init.headers), { authorization: `Forge ${args.provider}` });
15
+ init.headers = { ...init.headers, authorization: `Forge ${args.provider}` };
16
16
  }
17
17
  const response = await (0, node_fetch_1.default)(url, init);
18
18
  handleProxyResponseErrors(response);
@@ -29,7 +29,10 @@ function fetchRemote(args) {
29
29
  }
30
30
  remoteUrl.searchParams.append('path', path);
31
31
  init = (0, exports.addMagicAgent)(init, 'EXTERNAL_AUTH_REQUEST');
32
- init.headers = Object.assign(Object.assign({}, init.headers), { authorization: `Forge user ${args.provider} ${args.account}` });
32
+ init.headers = {
33
+ ...init.headers,
34
+ authorization: `Forge user ${args.provider} ${args.account}`
35
+ };
33
36
  const response = await (0, node_fetch_1.default)(remoteUrl, init);
34
37
  handleProxyResponseErrors(response);
35
38
  return response;
@@ -45,7 +48,7 @@ function getDefaultRemote(provider) {
45
48
  }
46
49
  function findExternalAuthProviderConfigOrThrow(provider) {
47
50
  const { externalAuth } = (0, runtime_1.__getRuntime)();
48
- const externalAuthProvider = externalAuth === null || externalAuth === void 0 ? void 0 : externalAuth.find((externalAuthMetaData) => {
51
+ const externalAuthProvider = externalAuth?.find((externalAuthMetaData) => {
49
52
  return externalAuthMetaData.service === provider;
50
53
  });
51
54
  if (!externalAuthProvider) {
@@ -76,14 +79,14 @@ function productURL(remote, path) {
76
79
  }
77
80
  function lazyThrowNeedsAuthenticationError(serviceKey) {
78
81
  return async (scopes) => {
79
- throw new errors_1.NeedsAuthenticationError('Authentication Required', serviceKey, scopes && { scopes });
82
+ throw new errors_1.NeedsAuthenticationError('Authentication Required', serviceKey, { scopes, isExpectedError: true });
80
83
  };
81
84
  }
82
85
  function buildExternalAuthAccountsInfo(provider, remote) {
83
86
  const { accounts } = findExternalAuthProviderConfigOrThrow(provider);
84
87
  const buildAccountModel = (account) => {
85
- const { externalAccountId: id } = account, rest = tslib_1.__rest(account, ["externalAccountId"]);
86
- return Object.assign(Object.assign({}, rest), { id });
88
+ const { externalAccountId: id, ...rest } = account;
89
+ return { ...rest, id };
87
90
  };
88
91
  const buildExternalAuthAccountMethods = (account, outboundAuthAccountId) => ({
89
92
  hasCredentials: async (scopes) => !scopes || scopes.every((scope) => account.scopes.includes(scope)),
@@ -91,7 +94,7 @@ function buildExternalAuthAccountsInfo(provider, remote) {
91
94
  getAccount: async () => {
92
95
  return account;
93
96
  },
94
- fetch: (0, _1.wrapWithRouteUnwrapper)(fetchRemote({ provider, remote: remote !== null && remote !== void 0 ? remote : getDefaultRemote(provider), account: outboundAuthAccountId }))
97
+ fetch: (0, _1.wrapWithRouteUnwrapper)(fetchRemote({ provider, remote: remote ?? getDefaultRemote(provider), account: outboundAuthAccountId }))
95
98
  });
96
99
  return accounts.map((account) => {
97
100
  const authAccount = buildAccountModel(account);
@@ -101,7 +104,10 @@ function buildExternalAuthAccountsInfo(provider, remote) {
101
104
  };
102
105
  });
103
106
  }
104
- const addMagicAgent = (init, agentOverride) => (Object.assign(Object.assign({}, init), { agent: (agentOverride !== null && agentOverride !== void 0 ? agentOverride : 'FORGE_PRODUCT_REQUEST') }));
107
+ const addMagicAgent = (init, agentOverride) => ({
108
+ ...init,
109
+ agent: (agentOverride ?? 'FORGE_PRODUCT_REQUEST')
110
+ });
105
111
  exports.addMagicAgent = addMagicAgent;
106
112
  const throwNotImplementedError = () => {
107
113
  throw new Error('not implemented');
package/out/api/index.js CHANGED
@@ -4,8 +4,11 @@ exports.wrapFetchApiMethods = exports.wrapWithRouteUnwrapper = exports.wrapReque
4
4
  const safeUrl_1 = require("../safeUrl");
5
5
  const wrapRequestGraph = (requestGraphApi) => (query, variables, headers = {}) => requestGraphApi('/graphql', {
6
6
  method: 'POST',
7
- headers: Object.assign(Object.assign({}, headers), { 'Content-Type': 'application/json' }),
8
- body: JSON.stringify(Object.assign({ query }, (variables ? { variables } : {})))
7
+ headers: { ...headers, 'Content-Type': 'application/json' },
8
+ body: JSON.stringify({
9
+ query,
10
+ ...(variables ? { variables } : {})
11
+ })
9
12
  });
10
13
  exports.wrapRequestGraph = wrapRequestGraph;
11
14
  const wrapRequestConnectedData = (fetch) => (path, init) => {
@@ -4,6 +4,9 @@ exports.transformResponse = void 0;
4
4
  const node_fetch_1 = require("node-fetch");
5
5
  const transformResponse = (fetchApi) => async (url, init) => {
6
6
  const response = await fetchApi(url, init);
7
- return Object.assign(Object.assign({}, response), { headers: new node_fetch_1.Headers(response.headers) });
7
+ return {
8
+ ...response,
9
+ headers: new node_fetch_1.Headers(response.headers)
10
+ };
8
11
  };
9
12
  exports.transformResponse = transformResponse;
@@ -14,12 +14,15 @@ const authorize = () => {
14
14
  if (!accountId) {
15
15
  throw new Error(`Couldn’t find the accountId of the invoking user. This API can only be used inside user-invoked modules.`);
16
16
  }
17
- return Object.assign(Object.assign({}, (0, auth_1.authorizeConfluenceWithFetch)(async (path, opts) => {
18
- const res = await (0, __1.asUser)().requestConfluence((0, __1.assumeTrustedRoute)(path), opts);
19
- return res.json();
20
- }, accountId)), (0, auth_1.authorizeJiraWithFetch)(async (path, opts) => {
21
- const res = await (0, __1.asUser)().requestJira((0, __1.assumeTrustedRoute)(path), opts);
22
- return res.json();
23
- }, accountId));
17
+ return {
18
+ ...(0, auth_1.authorizeConfluenceWithFetch)(async (path, opts) => {
19
+ const res = await (0, __1.asUser)().requestConfluence((0, __1.assumeTrustedRoute)(path), opts);
20
+ return res.json();
21
+ }, accountId),
22
+ ...(0, auth_1.authorizeJiraWithFetch)(async (path, opts) => {
23
+ const res = await (0, __1.asUser)().requestJira((0, __1.assumeTrustedRoute)(path), opts);
24
+ return res.json();
25
+ }, accountId)
26
+ };
24
27
  };
25
28
  exports.authorize = authorize;
package/out/index.d.ts CHANGED
@@ -92,5 +92,5 @@ export { asUser, asApp, authorize, fetch, requestJira, requestConfluence, reques
92
92
  export { QueryBuilder, QueryApi, EntityStorageApi, Condition, ListResult, Predicate, Result, Value, WherePredicate, FilterPredicate, startsWith, WhereConditions, FilterConditions, SortOrder } from '@forge/storage';
93
93
  export { route, assumeTrustedRoute, routeFromAbsolute, Route } from './safeUrl';
94
94
  export { ForgeRuntime, AppContext, getAppContext, __getRuntime } from './api/runtime';
95
- export { NeedsAuthenticationError, NeedsAuthenticationErrorOptions, ProxyRequestError, FetchError, ExternalEndpointNotAllowedError, ProductEndpointNotAllowedError, RequestProductNotAllowedError, NotAllowedError, InvalidWorkspaceRequestedError, HttpError, FUNCTION_ERR, isForgePlatformError, isHostedCodeError } from './api/errors';
95
+ export { NeedsAuthenticationError, NeedsAuthenticationErrorOptions, ProxyRequestError, FetchError, ExternalEndpointNotAllowedError, ProductEndpointNotAllowedError, RequestProductNotAllowedError, NotAllowedError, InvalidWorkspaceRequestedError, HttpError, FUNCTION_ERR, isForgePlatformError, isHostedCodeError, isExpectedError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ACN,KAAK,EACL,cAAc,EACd,eAAe,EACf,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,SAAS,EACV,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EACL,wBAAwB,EACxB,+BAA+B,EAC/B,iBAAiB,EACjB,UAAU,EACV,+BAA+B,EAC/B,8BAA8B,EAC9B,6BAA6B,EAC7B,eAAe,EACf,8BAA8B,EAC9B,SAAS,EACT,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EAChB,MAAM,cAAc,CAAC"}
package/out/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isHostedCodeError = exports.isForgePlatformError = exports.FUNCTION_ERR = exports.HttpError = exports.InvalidWorkspaceRequestedError = exports.NotAllowedError = exports.RequestProductNotAllowedError = exports.ProductEndpointNotAllowedError = exports.ExternalEndpointNotAllowedError = exports.FetchError = exports.ProxyRequestError = exports.NeedsAuthenticationError = exports.__getRuntime = exports.getAppContext = exports.routeFromAbsolute = exports.assumeTrustedRoute = exports.route = exports.SortOrder = exports.FilterConditions = exports.WhereConditions = exports.startsWith = exports.createRequestStargateAsApp = exports.webTrigger = exports.properties = exports.storage = exports.store = exports.requestBitbucket = exports.requestConfluence = exports.requestJira = exports.fetch = exports.authorize = exports.asApp = exports.asUser = exports.privacy = void 0;
3
+ exports.isExpectedError = exports.isHostedCodeError = exports.isForgePlatformError = exports.FUNCTION_ERR = exports.HttpError = exports.InvalidWorkspaceRequestedError = exports.NotAllowedError = exports.RequestProductNotAllowedError = exports.ProductEndpointNotAllowedError = exports.ExternalEndpointNotAllowedError = exports.FetchError = exports.ProxyRequestError = exports.NeedsAuthenticationError = exports.__getRuntime = exports.getAppContext = exports.routeFromAbsolute = exports.assumeTrustedRoute = exports.route = exports.SortOrder = exports.FilterConditions = exports.WhereConditions = exports.startsWith = exports.createRequestStargateAsApp = exports.webTrigger = exports.properties = exports.storage = exports.store = exports.requestBitbucket = exports.requestConfluence = exports.requestJira = exports.fetch = exports.authorize = exports.asApp = exports.asUser = exports.privacy = void 0;
4
4
  const storage_1 = require("@forge/storage");
5
5
  const authorization_1 = require("./authorization");
6
6
  Object.defineProperty(exports, "authorize", { enumerable: true, get: function () { return authorization_1.authorize; } });
@@ -44,7 +44,10 @@ const storage = (0, storage_1.getStorageInstanceWithQuery)(new storage_1.GlobalS
44
44
  exports.storage = storage;
45
45
  const properties = properties_1.propertiesApi;
46
46
  exports.properties = properties;
47
- const API = Object.assign(Object.assign({}, fetchAPI), { store: Object.assign({}, store) });
47
+ const API = {
48
+ ...fetchAPI,
49
+ store: { ...store }
50
+ };
48
51
  exports.privacy = {
49
52
  reportPersonalData: (0, privacy_1.createReportPersonalData)((0, fetch_and_storage_1.createRequestStargateAsApp)())
50
53
  };
@@ -74,3 +77,4 @@ Object.defineProperty(exports, "HttpError", { enumerable: true, get: function ()
74
77
  Object.defineProperty(exports, "FUNCTION_ERR", { enumerable: true, get: function () { return errors_1.FUNCTION_ERR; } });
75
78
  Object.defineProperty(exports, "isForgePlatformError", { enumerable: true, get: function () { return errors_1.isForgePlatformError; } });
76
79
  Object.defineProperty(exports, "isHostedCodeError", { enumerable: true, get: function () { return errors_1.isHostedCodeError; } });
80
+ Object.defineProperty(exports, "isExpectedError", { enumerable: true, get: function () { return errors_1.isExpectedError; } });
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProductScopedStorage = void 0;
4
4
  const storage_1 = require("@forge/storage");
5
5
  class ProductScopedStorage {
6
+ storageApiPath;
7
+ apiClient;
6
8
  constructor(storageApiPath, apiClient) {
7
9
  this.storageApiPath = storageApiPath;
8
10
  this.apiClient = apiClient;
@@ -3,11 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFetchAPI = exports.getContextAri = exports.createRequestStargateAsApp = void 0;
4
4
  const fetch_1 = require("../api/fetch");
5
5
  const runtime_1 = require("../api/runtime");
6
- const createRequestStargateAsApp = () => { var _a, _b; return (_b = (_a = global.api) === null || _a === void 0 ? void 0 : _a.asApp().__requestAtlassian) !== null && _b !== void 0 ? _b : (0, fetch_1.fetchProduct)({ provider: 'app', remote: 'stargate' }); };
6
+ const createRequestStargateAsApp = () => global.api?.asApp().__requestAtlassian ?? (0, fetch_1.fetchProduct)({ provider: 'app', remote: 'stargate' });
7
7
  exports.createRequestStargateAsApp = createRequestStargateAsApp;
8
8
  const getContextAri = () => {
9
- var _a;
10
- const sandboxGetAppAri = (_a = global.api) === null || _a === void 0 ? void 0 : _a.__getAppAri;
9
+ const sandboxGetAppAri = global.api?.__getAppAri;
11
10
  if (sandboxGetAppAri) {
12
11
  return sandboxGetAppAri();
13
12
  }
package/out/safeUrl.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assumeTrustedRoute = exports.requireSafeUrl = exports.route = exports.routeFromAbsolute = exports.isRoute = void 0;
4
4
  class ReadonlyRoute {
5
+ value_;
5
6
  constructor(value_) {
6
7
  this.value_ = value_;
7
8
  }
package/out/webTrigger.js CHANGED
@@ -4,7 +4,6 @@ exports.webTrigger = void 0;
4
4
  const runtime_1 = require("./api/runtime");
5
5
  const fetch_and_storage_1 = require("./runtime/fetch-and-storage");
6
6
  const proxyGetWebTriggerURL = (0, runtime_1.wrapInMetrics)('api.getWebTriggerUrl', async (webTriggerModuleKey, forceCreate) => {
7
- var _a, _b;
8
7
  const runtime = (0, runtime_1.__getRuntime)();
9
8
  const response = await (0, fetch_and_storage_1.createRequestStargateAsApp)()('/graphql', {
10
9
  method: 'POST',
@@ -32,14 +31,13 @@ const proxyGetWebTriggerURL = (0, runtime_1.wrapInMetrics)('api.getWebTriggerUrl
32
31
  throw new Error(`Internal error occurred: Failed to get web trigger URL: ${response.statusText}.`);
33
32
  }
34
33
  const responseBody = await response.json();
35
- if (!((_b = (_a = responseBody === null || responseBody === void 0 ? void 0 : responseBody.data) === null || _a === void 0 ? void 0 : _a.createWebTriggerUrl) === null || _b === void 0 ? void 0 : _b.url)) {
34
+ if (!responseBody?.data?.createWebTriggerUrl?.url) {
36
35
  throw new Error(`Internal error occurred: Failed to get web trigger URL.`);
37
36
  }
38
37
  return responseBody.data.createWebTriggerUrl.url;
39
38
  });
40
39
  const proxyDeleteWebTriggerURL = (0, runtime_1.wrapInMetrics)('api.deleteWebTriggerUrl', async (webTriggerUrl) => {
41
40
  const callDelete = async (webTriggerUrlId) => {
42
- var _a, _b, _c, _d;
43
41
  const response = await (0, fetch_and_storage_1.createRequestStargateAsApp)()('/graphql', {
44
42
  method: 'POST',
45
43
  headers: { 'Content-Type': 'application/json' },
@@ -61,8 +59,8 @@ const proxyDeleteWebTriggerURL = (0, runtime_1.wrapInMetrics)('api.deleteWebTrig
61
59
  throw new Error(`Internal error occurred: Failed to delete web trigger URL: ${response.statusText}.`);
62
60
  }
63
61
  const responseBody = await response.json();
64
- if (!((_b = (_a = responseBody === null || responseBody === void 0 ? void 0 : responseBody.data) === null || _a === void 0 ? void 0 : _a.deleteWebTriggerUrl) === null || _b === void 0 ? void 0 : _b.success)) {
65
- const errorText = ((_d = (_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.data) === null || _c === void 0 ? void 0 : _c.deleteWebTriggerUrl) === null || _d === void 0 ? void 0 : _d.message) || 'unknown error';
62
+ if (!responseBody?.data?.deleteWebTriggerUrl?.success) {
63
+ const errorText = responseBody?.data?.deleteWebTriggerUrl?.message || 'unknown error';
66
64
  throw new Error(`Internal error occurred: Failed to delete web trigger URL: ${errorText}`);
67
65
  }
68
66
  };
@@ -72,7 +70,6 @@ const proxyDeleteWebTriggerURL = (0, runtime_1.wrapInMetrics)('api.deleteWebTrig
72
70
  }
73
71
  });
74
72
  const proxyGetWebTriggerUrlIds = (0, runtime_1.wrapInMetrics)('api.getWebTriggerUrlIds', async (webTriggerUrl) => {
75
- var _a;
76
73
  const runtime = (0, runtime_1.__getRuntime)();
77
74
  const response = await (0, fetch_and_storage_1.createRequestStargateAsApp)()('/graphql', {
78
75
  method: 'POST',
@@ -97,7 +94,7 @@ const proxyGetWebTriggerUrlIds = (0, runtime_1.wrapInMetrics)('api.getWebTrigger
97
94
  throw new Error(`Internal error occurred: Failed to get web trigger URLs: ${response.statusText}.`);
98
95
  }
99
96
  const responseBody = await response.json();
100
- if (!((_a = responseBody === null || responseBody === void 0 ? void 0 : responseBody.data) === null || _a === void 0 ? void 0 : _a.webTriggerUrlsByAppContext) || responseBody.data.webTriggerUrlsByAppContext.length == 0) {
97
+ if (!responseBody?.data?.webTriggerUrlsByAppContext || responseBody.data.webTriggerUrlsByAppContext.length == 0) {
101
98
  throw new Error('Internal error occurred: No web trigger URLs found');
102
99
  }
103
100
  const result = responseBody.data.webTriggerUrlsByAppContext
@@ -109,7 +106,7 @@ const proxyGetWebTriggerUrlIds = (0, runtime_1.wrapInMetrics)('api.getWebTrigger
109
106
  return result;
110
107
  });
111
108
  exports.webTrigger = {
112
- getUrl: async (webTriggerModuleKey, forceCreate = false) => { var _a, _b, _c; return ((_c = (_b = (_a = global.api) === null || _a === void 0 ? void 0 : _a.webTrigger) === null || _b === void 0 ? void 0 : _b.getUrl) !== null && _c !== void 0 ? _c : proxyGetWebTriggerURL)(webTriggerModuleKey, forceCreate); },
113
- deleteUrl: async (webTriggerUrl) => { var _a, _b, _c; return ((_c = (_b = (_a = global.api) === null || _a === void 0 ? void 0 : _a.webTrigger) === null || _b === void 0 ? void 0 : _b.deleteUrl) !== null && _c !== void 0 ? _c : proxyDeleteWebTriggerURL)(webTriggerUrl); },
114
- getUrlIds: async (webTriggerUrl) => { var _a, _b, _c; return ((_c = (_b = (_a = global.api) === null || _a === void 0 ? void 0 : _a.webTrigger) === null || _b === void 0 ? void 0 : _b.getUrlIds) !== null && _c !== void 0 ? _c : proxyGetWebTriggerUrlIds)(webTriggerUrl); }
109
+ getUrl: async (webTriggerModuleKey, forceCreate = false) => (global.api?.webTrigger?.getUrl ?? proxyGetWebTriggerURL)(webTriggerModuleKey, forceCreate),
110
+ deleteUrl: async (webTriggerUrl) => (global.api?.webTrigger?.deleteUrl ?? proxyDeleteWebTriggerURL)(webTriggerUrl),
111
+ getUrlIds: async (webTriggerUrl) => (global.api?.webTrigger?.getUrlIds ?? proxyGetWebTriggerUrlIds)(webTriggerUrl)
115
112
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/api",
3
- "version": "3.4.1-next.0",
3
+ "version": "3.5.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.6.1-next.0",
15
+ "@forge/runtime": "5.6.1",
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.3-next.0",
25
+ "@forge/util": "1.4.3",
26
26
  "@types/node-fetch": "^2.6.11",
27
27
  "node-fetch": "2.7.0"
28
28
  }