@forge/lint 2.0.1-next.1 → 2.0.1-next.2
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,14 @@
|
|
|
1
1
|
# @forge/lint
|
|
2
2
|
|
|
3
|
+
## 2.0.1-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ffa0050: Accept both deprecated scopes and granular scopes when verifying scopes required for Forge UI hooks.
|
|
8
|
+
- Updated dependencies [14102be]
|
|
9
|
+
- @forge/manifest@3.1.0-next.2
|
|
10
|
+
- @forge/cli-shared@2.2.1-next.2
|
|
11
|
+
|
|
3
12
|
## 2.0.1-next.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-hook-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/verifiers/ui-hook-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"ui-hook-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/verifiers/ui-hook-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AA2BpF,qBAAa,cAAe,SAAQ,qBAAsB,YAAW,iBAAiB,CAAC,OAAO,EAAE,CAAC;IAC/F,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAoC1E,OAAO,CAAC,WAAW;CAepB"}
|
|
@@ -5,17 +5,22 @@ const linter_interface_1 = require("../../../linter-interface");
|
|
|
5
5
|
const verifier_interface_1 = require("../../verifier-interface");
|
|
6
6
|
const text_1 = require("../../../text");
|
|
7
7
|
const FORGE_UI_HOOK_PERMISSIONS = {
|
|
8
|
-
useContentProperty:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'read:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
useContentProperty: {
|
|
9
|
+
current: [
|
|
10
|
+
'read:content-details:confluence',
|
|
11
|
+
'read:content.property:confluence',
|
|
12
|
+
'write:content.property:confluence'
|
|
13
|
+
],
|
|
14
|
+
deprecated: ['read:confluence-props', 'write:confluence-props']
|
|
15
|
+
},
|
|
16
|
+
useSpaceProperty: {
|
|
17
|
+
current: ['read:content-details:confluence', 'read:space.property:confluence', 'write:space.property:confluence'],
|
|
18
|
+
deprecated: ['read:confluence-props', 'write:confluence-props']
|
|
19
|
+
},
|
|
20
|
+
useIssueProperty: {
|
|
21
|
+
current: ['read:issue.property:jira'],
|
|
22
|
+
deprecated: ['read:jira-work', 'write:jira-work']
|
|
23
|
+
}
|
|
19
24
|
};
|
|
20
25
|
class UIHookVerifier extends verifier_interface_1.BaseLintIssueVerifier {
|
|
21
26
|
getLintClass() {
|
|
@@ -23,17 +28,30 @@ class UIHookVerifier extends verifier_interface_1.BaseLintIssueVerifier {
|
|
|
23
28
|
}
|
|
24
29
|
async process(apiCalls) {
|
|
25
30
|
const rules = [];
|
|
26
|
-
|
|
31
|
+
for (const apiCall of apiCalls) {
|
|
27
32
|
const requiredPermissions = FORGE_UI_HOOK_PERMISSIONS[apiCall.hookName];
|
|
28
33
|
if (!requiredPermissions)
|
|
29
34
|
return rules;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
const { current, deprecated } = requiredPermissions;
|
|
36
|
+
const missingCurrentPerms = current.filter((perm) => { var _a, _b; return !((_b = (_a = this.manifest.permissions) === null || _a === void 0 ? void 0 : _a.scopes) === null || _b === void 0 ? void 0 : _b.includes(perm)); });
|
|
37
|
+
if (!missingCurrentPerms.length)
|
|
38
|
+
continue;
|
|
39
|
+
let missingDeprecatedPerms = null;
|
|
40
|
+
if (deprecated) {
|
|
41
|
+
missingDeprecatedPerms = deprecated.filter((perm) => { var _a, _b; return !((_b = (_a = this.manifest.permissions) === null || _a === void 0 ? void 0 : _a.scopes) === null || _b === void 0 ? void 0 : _b.includes(perm)); });
|
|
42
|
+
if (!missingDeprecatedPerms.length)
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (missingCurrentPerms.length < current.length) {
|
|
46
|
+
missingCurrentPerms.forEach((perm) => rules.push(this.getHookRule(apiCall, perm)));
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (deprecated && missingDeprecatedPerms && (missingDeprecatedPerms === null || missingDeprecatedPerms === void 0 ? void 0 : missingDeprecatedPerms.length) < deprecated.length) {
|
|
50
|
+
missingDeprecatedPerms.forEach((perm) => rules.push(this.getHookRule(apiCall, perm)));
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
missingCurrentPerms.forEach((perm) => rules.push(this.getHookRule(apiCall, perm)));
|
|
54
|
+
}
|
|
37
55
|
return rules;
|
|
38
56
|
}
|
|
39
57
|
getHookRule(apiCall, permission) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/lint",
|
|
3
|
-
"version": "2.0.1-next.
|
|
3
|
+
"version": "2.0.1-next.2",
|
|
4
4
|
"description": "Linting for forge apps",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"@types/node-fetch": "^2.5.7"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@forge/cli-shared": "2.2.1-next.
|
|
18
|
+
"@forge/cli-shared": "2.2.1-next.2",
|
|
19
19
|
"@forge/csp": "1.9.0",
|
|
20
|
-
"@forge/manifest": "3.1.0-next.
|
|
20
|
+
"@forge/manifest": "3.1.0-next.2",
|
|
21
21
|
"@typescript-eslint/typescript-estree": "^3.5.0",
|
|
22
22
|
"cross-spawn": "^7.0.1",
|
|
23
23
|
"node-fetch": "^2.6.1",
|