@forge/api 6.4.4-next.2-experimental-3c69930 → 7.0.0-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 +3 -9
- package/out/webTrigger.d.ts +5 -1
- package/out/webTrigger.d.ts.map +1 -1
- package/out/webTrigger.js +35 -33
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
# @forge/api
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 7.0.0-next.3
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Major Changes
|
|
6
6
|
|
|
7
|
-
- Updated
|
|
8
|
-
- Updated dependencies [dfa2aa6]
|
|
9
|
-
- Updated dependencies [e21f32f]
|
|
10
|
-
- Updated dependencies [545ecc1]
|
|
11
|
-
- Updated dependencies [eadb4a6]
|
|
12
|
-
- Updated dependencies [8db2311]
|
|
13
|
-
- @forge/manifest@12.0.0-next.3-experimental-3c69930
|
|
7
|
+
- 8f24ce1: Updated webtrigger APIs for query and deletion
|
|
14
8
|
|
|
15
9
|
## 6.4.4-next.2
|
|
16
10
|
|
package/out/webTrigger.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
interface WebTriggerAPI {
|
|
2
2
|
getUrl: (webTriggerModuleKey: string, forceCreate?: boolean) => Promise<string>;
|
|
3
3
|
deleteUrl: (webTriggerUrl: string) => Promise<void>;
|
|
4
|
-
|
|
4
|
+
queryUrls: (moduleKey?: string) => Promise<WebTriggerQueryResult[]>;
|
|
5
5
|
}
|
|
6
|
+
export declare type WebTriggerQueryResult = {
|
|
7
|
+
moduleKey: string;
|
|
8
|
+
url: string;
|
|
9
|
+
};
|
|
6
10
|
export declare const webTrigger: WebTriggerAPI;
|
|
7
11
|
/** @experimental */
|
|
8
12
|
export interface WebTriggerResponse {
|
package/out/webTrigger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webTrigger.d.ts","sourceRoot":"","sources":["../src/webTrigger.ts"],"names":[],"mappings":"AAGA,UAAU,aAAa;IACrB,MAAM,EAAE,CAAC,mBAAmB,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChF,SAAS,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,SAAS,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"webTrigger.d.ts","sourceRoot":"","sources":["../src/webTrigger.ts"],"names":[],"mappings":"AAGA,UAAU,aAAa;IACrB,MAAM,EAAE,CAAC,mBAAmB,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChF,SAAS,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;CACrE;AAED,oBAAY,qBAAqB,GAAG;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AA4IF,eAAO,MAAM,UAAU,EAAE,aAKxB,CAAC;AAMF,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC;CACvC;AAMD,MAAM,WAAW,iBAAiB;IAChC,cAAc,EAAE,OAAO,MAAM,EAAE,CAAC;CACjC;AAKD,oBAAY,gBAAgB,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AAM3E,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,gBAAgB,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC3C"}
|
package/out/webTrigger.js
CHANGED
|
@@ -37,12 +37,17 @@ const proxyGetWebTriggerURL = (0, runtime_1.wrapInMetrics)('api.getWebTriggerUrl
|
|
|
37
37
|
return responseBody.data.createWebTriggerUrl.url;
|
|
38
38
|
});
|
|
39
39
|
const proxyDeleteWebTriggerURL = (0, runtime_1.wrapInMetrics)('api.deleteWebTriggerUrl', async (webTriggerUrl) => {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
const webTriggerUrlIdRegexGroupMatch = /\/x1\/([^\/\?\#]+)/;
|
|
41
|
+
const matches = webTriggerUrl.match(webTriggerUrlIdRegexGroupMatch);
|
|
42
|
+
if (!matches || matches.length < 1) {
|
|
43
|
+
throw new Error('Internal error occurred: Failed to parse web trigger URL for ID');
|
|
44
|
+
}
|
|
45
|
+
const id = matches[0];
|
|
46
|
+
const response = await (0, fetch_1.__requestAtlassianAsApp)('/graphql', {
|
|
47
|
+
method: 'POST',
|
|
48
|
+
headers: { 'Content-Type': 'application/json' },
|
|
49
|
+
body: JSON.stringify({
|
|
50
|
+
query: `
|
|
46
51
|
mutation forge_app_deleteWebTriggerUrl($id: ID!) {
|
|
47
52
|
deleteWebTriggerUrl(id: $id) {
|
|
48
53
|
success
|
|
@@ -50,26 +55,21 @@ const proxyDeleteWebTriggerURL = (0, runtime_1.wrapInMetrics)('api.deleteWebTrig
|
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
57
|
`,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
const urlIds = await exports.webTrigger.getUrlIds(webTriggerUrl);
|
|
68
|
-
for (const urlId of urlIds) {
|
|
69
|
-
await callDelete(urlId);
|
|
58
|
+
variables: {
|
|
59
|
+
id
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
if (!response.ok) {
|
|
64
|
+
throw new Error(`Internal error occurred: Failed to delete web trigger URL: ${response.statusText}.`);
|
|
65
|
+
}
|
|
66
|
+
const responseBody = (await response.json());
|
|
67
|
+
if (!responseBody?.data?.deleteWebTriggerUrl?.success) {
|
|
68
|
+
const errorText = responseBody?.data?.deleteWebTriggerUrl?.message || 'unknown error';
|
|
69
|
+
throw new Error(`Internal error occurred: Failed to delete web trigger URL: ${errorText}`);
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
const
|
|
72
|
+
const proxyQueryWebTriggerURLs = (0, runtime_1.wrapInMetrics)('api.queryWebTriggerUrls', async (moduleKey) => {
|
|
73
73
|
const runtime = (0, runtime_1.__getRuntime)();
|
|
74
74
|
const response = await (0, fetch_1.__requestAtlassianAsApp)('/graphql', {
|
|
75
75
|
method: 'POST',
|
|
@@ -78,7 +78,7 @@ const proxyGetWebTriggerUrlIds = (0, runtime_1.wrapInMetrics)('api.getWebTrigger
|
|
|
78
78
|
query: `
|
|
79
79
|
query forge_app_webTriggerUrlsByAppContext($appId: ID!, $envId: ID!, $contextId: ID!) {
|
|
80
80
|
webTriggerUrlsByAppContext(appId: $appId, envId: $envId, contextId: $contextId) {
|
|
81
|
-
|
|
81
|
+
triggerKey
|
|
82
82
|
url
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -94,19 +94,21 @@ const proxyGetWebTriggerUrlIds = (0, runtime_1.wrapInMetrics)('api.getWebTrigger
|
|
|
94
94
|
throw new Error(`Internal error occurred: Failed to get web trigger URLs: ${response.statusText}.`);
|
|
95
95
|
}
|
|
96
96
|
const responseBody = (await response.json());
|
|
97
|
-
if (!responseBody?.data?.webTriggerUrlsByAppContext
|
|
98
|
-
throw new Error('Internal error occurred: No web trigger URLs
|
|
97
|
+
if (!responseBody?.data?.webTriggerUrlsByAppContext) {
|
|
98
|
+
throw new Error('Internal error occurred: No data from web trigger URLs query.');
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
.
|
|
103
|
-
if (!result || result.length == 0) {
|
|
104
|
-
throw new Error('Internal error occurred: Web trigger URL matching URL not found');
|
|
100
|
+
let result = responseBody.data.webTriggerUrlsByAppContext;
|
|
101
|
+
if (moduleKey) {
|
|
102
|
+
result = result.filter((webTriggerResult) => webTriggerResult.triggerKey === moduleKey);
|
|
105
103
|
}
|
|
104
|
+
result = result.map((webTriggerResult) => ({
|
|
105
|
+
moduleKey: webTriggerResult.triggerKey,
|
|
106
|
+
url: webTriggerResult.url
|
|
107
|
+
}));
|
|
106
108
|
return result;
|
|
107
109
|
});
|
|
108
110
|
exports.webTrigger = {
|
|
109
111
|
getUrl: async (webTriggerModuleKey, forceCreate = false) => proxyGetWebTriggerURL(webTriggerModuleKey, forceCreate),
|
|
110
112
|
deleteUrl: async (webTriggerUrl) => proxyDeleteWebTriggerURL(webTriggerUrl),
|
|
111
|
-
|
|
113
|
+
queryUrls: async (moduleKey) => proxyQueryWebTriggerURLs(moduleKey)
|
|
112
114
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-next.3",
|
|
4
4
|
"description": "Forge API methods",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@forge/auth": "0.0.9",
|
|
29
29
|
"@forge/egress": "2.3.1",
|
|
30
30
|
"@forge/i18n": "0.0.7",
|
|
31
|
-
"@forge/manifest": "^12.0.0-next.3
|
|
31
|
+
"@forge/manifest": "^12.0.0-next.3",
|
|
32
32
|
"@forge/storage": "2.0.3",
|
|
33
33
|
"headers-utils": "^3.0.2"
|
|
34
34
|
},
|