@forge/lint 0.0.0-experimental-e1cefc4 → 0.0.0-experimental-29a2cc1

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,11 +1,257 @@
1
1
  # @forge/lint
2
2
 
3
- ## 0.0.0-experimental-e1cefc4
3
+ ## 0.0.0-experimental-29a2cc1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - 7fe19b4: More resilient linting against handler exports
8
+ - Updated dependencies [69f42bd]
9
+ - Updated dependencies [b447be2]
10
+ - Updated dependencies [4d1c111]
11
+ - Updated dependencies [4285fc3]
12
+ - Updated dependencies [74e00c8]
13
+ - @forge/cli-shared@0.0.0-experimental-29a2cc1
14
+ - @forge/manifest@0.0.0-experimental-29a2cc1
15
+
16
+ ## 3.1.3-next.4
17
+
18
+ ### Patch Changes
19
+
20
+ - 7fe19b40: More resilient linting against handler exports
21
+
22
+ ## 3.1.3-next.3
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [4285fc36]
27
+ - @forge/manifest@3.9.0-next.2
28
+ - @forge/cli-shared@2.6.0-next.3
29
+
30
+ ## 3.1.3-next.2
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [b447be27]
35
+ - @forge/manifest@3.9.0-next.1
36
+ - @forge/cli-shared@2.6.0-next.2
37
+
38
+ ## 3.1.3-next.1
39
+
40
+ ### Patch Changes
41
+
42
+ - Updated dependencies [74e00c86]
43
+ - @forge/manifest@3.8.2-next.0
44
+ - @forge/cli-shared@2.6.0-next.1
45
+
46
+ ## 3.1.3-next.0
47
+
48
+ ### Patch Changes
49
+
50
+ - Updated dependencies [69f42bdc]
51
+ - @forge/cli-shared@2.6.0-next.0
52
+
53
+ ## 3.1.2
54
+
55
+ ### Patch Changes
56
+
57
+ - Updated dependencies [a85953d8]
58
+ - Updated dependencies [2c42df96]
59
+ - Updated dependencies [671a6a63]
60
+ - Updated dependencies [c52209fd]
61
+ - @forge/manifest@3.8.1
62
+ - @forge/csp@1.11.0
63
+ - @forge/cli-shared@2.5.1
64
+
65
+ ## 3.1.2-next.2
66
+
67
+ ### Patch Changes
68
+
69
+ - Updated dependencies [a85953d8]
70
+ - @forge/manifest@3.8.1-next.1
71
+ - @forge/cli-shared@2.5.1-next.1
72
+
73
+ ## 3.1.2-next.1
74
+
75
+ ### Patch Changes
76
+
77
+ - Updated dependencies [2c42df9]
78
+ - Updated dependencies [c52209f]
79
+ - @forge/manifest@3.8.1-next.0
80
+ - @forge/cli-shared@2.5.1-next.0
81
+
82
+ ## 3.1.2-next.0
83
+
84
+ ### Patch Changes
85
+
86
+ - Updated dependencies [671a6a6]
87
+ - @forge/csp@1.11.0-next.0
88
+
89
+ ## 3.1.1
90
+
91
+ ### Patch Changes
92
+
93
+ - Updated dependencies [74b6c3c]
94
+ - Updated dependencies [4f86661]
95
+ - Updated dependencies [6d7a574e]
96
+ - Updated dependencies [e892d27]
97
+ - @forge/manifest@3.8.0
98
+ - @forge/cli-shared@2.5.0
99
+
100
+ ## 3.1.1-next.3
101
+
102
+ ### Patch Changes
103
+
104
+ - Updated dependencies [4f86661c]
105
+ - @forge/cli-shared@2.5.0-next.3
106
+
107
+ ## 3.1.1-next.2
108
+
109
+ ### Patch Changes
110
+
111
+ - Updated dependencies [e892d27d]
112
+ - @forge/manifest@3.8.0-next.1
113
+ - @forge/cli-shared@2.5.0-next.2
114
+
115
+ ## 3.1.1-next.1
116
+
117
+ ### Patch Changes
118
+
119
+ - Updated dependencies [74b6c3c]
120
+ - @forge/manifest@3.8.0-next.0
121
+ - @forge/cli-shared@2.5.0-next.1
122
+
123
+ ## 3.1.1-next.0
124
+
125
+ ### Patch Changes
126
+
127
+ - Updated dependencies [6d7a574]
128
+ - @forge/cli-shared@2.5.0-next.0
129
+
130
+ ## 3.1.0
131
+
132
+ ### Minor Changes
133
+
134
+ - ce4a65f: Hide Granular scopes
135
+
136
+ ### Patch Changes
137
+
138
+ - Updated dependencies [34d085a]
139
+ - Updated dependencies [9e700ef]
140
+ - Updated dependencies [c87cdea]
141
+ - Updated dependencies [ce4a65f]
142
+ - @forge/manifest@3.7.0
143
+ - @forge/cli-shared@2.4.2
144
+
145
+ ## 3.1.0-next.1
146
+
147
+ ### Minor Changes
148
+
149
+ - ce4a65f: Hide Granular scopes
150
+
151
+ ### Patch Changes
152
+
153
+ - Updated dependencies [34d085a]
154
+ - Updated dependencies [c87cdea]
155
+ - Updated dependencies [ce4a65f]
156
+ - @forge/manifest@3.7.0-next.1
157
+ - @forge/cli-shared@2.4.2-next.1
158
+
159
+ ## 3.0.6-next.0
160
+
161
+ ### Patch Changes
162
+
163
+ - Updated dependencies [9e700ef8]
164
+ - @forge/manifest@3.6.1-next.0
165
+ - @forge/cli-shared@2.4.2-next.0
166
+
167
+ ## 3.0.5
168
+
169
+ ### Patch Changes
170
+
171
+ - Updated dependencies [1a8d47c]
172
+ - Updated dependencies [e314dd0]
173
+ - Updated dependencies [0137135]
174
+ - Updated dependencies [2bd062d]
175
+ - Updated dependencies [9047581]
176
+ - Updated dependencies [5c9419f]
177
+ - Updated dependencies [e8a6926]
178
+ - Updated dependencies [cb28bc0]
179
+ - Updated dependencies [0920759]
180
+ - @forge/manifest@3.6.0
181
+ - @forge/cli-shared@2.4.1
182
+
183
+ ## 3.0.5-next.7
184
+
185
+ ### Patch Changes
186
+
187
+ - Updated dependencies [0920759f]
188
+ - @forge/manifest@3.6.0-next.7
189
+ - @forge/cli-shared@2.4.1-next.7
190
+
191
+ ## 3.0.5-next.6
192
+
193
+ ### Patch Changes
194
+
195
+ - Updated dependencies [2bd062d0]
196
+ - @forge/manifest@3.6.0-next.6
197
+ - @forge/cli-shared@2.4.1-next.6
198
+
199
+ ## 3.0.5-next.5
200
+
201
+ ### Patch Changes
202
+
203
+ - Updated dependencies [cb28bc0]
204
+ - @forge/manifest@3.6.0-next.5
205
+ - @forge/cli-shared@2.4.1-next.5
206
+
207
+ ## 3.0.5-next.4
208
+
209
+ ### Patch Changes
210
+
211
+ - Updated dependencies [e314dd0]
212
+ - @forge/manifest@3.6.0-next.4
213
+ - @forge/cli-shared@2.4.1-next.4
214
+
215
+ ## 3.0.5-next.3
216
+
217
+ ### Patch Changes
218
+
219
+ - Updated dependencies [90475812]
220
+ - @forge/manifest@3.6.0-next.3
221
+ - @forge/cli-shared@2.4.1-next.3
222
+
223
+ ## 3.0.5-next.2
224
+
225
+ ### Patch Changes
226
+
227
+ - Updated dependencies [5c9419f4]
228
+ - Updated dependencies [e8a69267]
229
+ - @forge/manifest@3.6.0-next.2
230
+ - @forge/cli-shared@2.4.1-next.2
231
+
232
+ ## 3.0.5-next.1
233
+
234
+ ### Patch Changes
235
+
236
+ - Updated dependencies [1a8d47c0]
237
+ - @forge/manifest@3.6.0-next.1
238
+ - @forge/cli-shared@2.4.1-next.1
239
+
240
+ ## 3.0.5-next.0
241
+
242
+ ### Patch Changes
243
+
244
+ - Updated dependencies [01371351]
245
+ - @forge/manifest@3.5.1-next.0
246
+ - @forge/cli-shared@2.4.1-next.0
247
+
248
+ ## 3.0.4
249
+
250
+ ### Patch Changes
251
+
252
+ - Updated dependencies [3d82376]
7
253
  - Updated dependencies [d094c69]
8
- - Updated dependencies [ba67459]
254
+ - Updated dependencies [ba674590]
9
255
  - Updated dependencies [f33aada]
10
256
  - Updated dependencies [f3ac287]
11
257
  - Updated dependencies [d196b41]
@@ -15,8 +261,16 @@
15
261
  - Updated dependencies [02839be]
16
262
  - Updated dependencies [ffb508a]
17
263
  - Updated dependencies [726ef79]
18
- - @forge/manifest@0.0.0-experimental-e1cefc4
19
- - @forge/cli-shared@0.0.0-experimental-e1cefc4
264
+ - @forge/manifest@3.5.0
265
+ - @forge/cli-shared@2.4.0
266
+
267
+ ## 3.0.4-next.8
268
+
269
+ ### Patch Changes
270
+
271
+ - Updated dependencies [3d82376]
272
+ - @forge/manifest@3.5.0-next.7
273
+ - @forge/cli-shared@2.4.0-next.8
20
274
 
21
275
  ## 3.0.4-next.7
22
276
 
@@ -3,5 +3,12 @@ import { NodeVisitor } from '../../node-visitor-interface';
3
3
  import { ExportedMethod } from '../exported-method-interface';
4
4
  export declare class ExportedFunctionNodeVisitor implements NodeVisitor<ExportedMethod> {
5
5
  visit(node: TSESTree.Node, _parent: TSESTree.Node | undefined, callback: (exportedMethod: ExportedMethod) => void): void;
6
+ private visitSpecifiedNamedExports;
7
+ private visitInlineNamedExport;
8
+ private visitObjectAssignmentExpression;
9
+ private visitMemberExpression;
10
+ private tryAddObjectExpressionPropertiesExportedMethods;
11
+ private createExportedMethod;
12
+ private isExports;
6
13
  }
7
14
  //# sourceMappingURL=exported-function-node-visitor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exported-function-node-visitor.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/handler-linter/visitors/exported-function-node-visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,qBAAa,2BAA4B,YAAW,WAAW,CAAC,cAAc,CAAC;IACtE,KAAK,CACV,IAAI,EAAE,QAAQ,CAAC,IAAI,EACnB,OAAO,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,EAClC,QAAQ,EAAE,CAAC,cAAc,EAAE,cAAc,KAAK,IAAI,GACjD,IAAI;CA4IR"}
1
+ {"version":3,"file":"exported-function-node-visitor.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/handler-linter/visitors/exported-function-node-visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,qBAAa,2BAA4B,YAAW,WAAW,CAAC,cAAc,CAAC;IACtE,KAAK,CACV,IAAI,EAAE,QAAQ,CAAC,IAAI,EACnB,OAAO,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,EAClC,QAAQ,EAAE,CAAC,cAAc,EAAE,cAAc,KAAK,IAAI,GACjD,IAAI;IAuCP,OAAO,CAAC,0BAA0B;IAelC,OAAO,CAAC,sBAAsB;IAkC9B,OAAO,CAAC,+BAA+B;IAkBvC,OAAO,CAAC,qBAAqB;IAS7B,OAAO,CAAC,+CAA+C;IAavD,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,SAAS;CAUlB"}
@@ -4,78 +4,73 @@ exports.ExportedFunctionNodeVisitor = void 0;
4
4
  const typescript_estree_1 = require("@typescript-eslint/typescript-estree");
5
5
  class ExportedFunctionNodeVisitor {
6
6
  visit(node, _parent, callback) {
7
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
8
7
  if (node.type === typescript_estree_1.AST_NODE_TYPES.MemberExpression &&
9
8
  node.object &&
10
- (node === null || node === void 0 ? void 0 : node.property.type) === typescript_estree_1.AST_NODE_TYPES.Identifier) {
11
- if (node.object.type === typescript_estree_1.AST_NODE_TYPES.MemberExpression) {
12
- if (((_a = node.object) === null || _a === void 0 ? void 0 : _a.object.type) === typescript_estree_1.AST_NODE_TYPES.Identifier && ((_b = node.object) === null || _b === void 0 ? void 0 : _b.object.name) === 'module') {
13
- if (((_c = node.object) === null || _c === void 0 ? void 0 : _c.property.type) === typescript_estree_1.AST_NODE_TYPES.Identifier && ((_d = node.object) === null || _d === void 0 ? void 0 : _d.property.name) === 'exports') {
14
- const exportedMethod = Object.assign({ method: node.property.name }, node.property.loc.start);
15
- return callback(exportedMethod);
16
- }
17
- }
18
- }
19
- if (node.object.type === typescript_estree_1.AST_NODE_TYPES.Identifier && node.object.name === 'exports') {
20
- if (node.property.type === typescript_estree_1.AST_NODE_TYPES.Identifier) {
21
- const exportedMethod = Object.assign({ method: node.property.name }, node.property.loc.start);
22
- return callback(exportedMethod);
23
- }
24
- }
9
+ node.property.type === typescript_estree_1.AST_NODE_TYPES.Identifier) {
10
+ this.visitMemberExpression(node, callback);
25
11
  }
26
12
  if (node.type === typescript_estree_1.AST_NODE_TYPES.AssignmentExpression && node.operator === '=') {
27
- if (((_e = node.left) === null || _e === void 0 ? void 0 : _e.type) === typescript_estree_1.AST_NODE_TYPES.MemberExpression && ((_f = node.left) === null || _f === void 0 ? void 0 : _f.object) && ((_g = node.left) === null || _g === void 0 ? void 0 : _g.property)) {
28
- if (((_h = node.left) === null || _h === void 0 ? void 0 : _h.object.type) === typescript_estree_1.AST_NODE_TYPES.Identifier && ((_j = node.left) === null || _j === void 0 ? void 0 : _j.object.name) === 'module') {
29
- if (((_k = node.left) === null || _k === void 0 ? void 0 : _k.property.type) === typescript_estree_1.AST_NODE_TYPES.Identifier && ((_l = node.left) === null || _l === void 0 ? void 0 : _l.property.name) === 'exports') {
30
- ((_m = node.right) === null || _m === void 0 ? void 0 : _m.properties).forEach((property) => {
31
- if (property.key.type === typescript_estree_1.AST_NODE_TYPES.Identifier) {
32
- const exportedMethod = Object.assign({ method: property.key.name }, property.key.loc.start);
33
- return callback(exportedMethod);
34
- }
35
- });
36
- }
37
- }
38
- }
39
- if (((_o = node.left) === null || _o === void 0 ? void 0 : _o.type) === typescript_estree_1.AST_NODE_TYPES.Identifier && ((_p = node.left) === null || _p === void 0 ? void 0 : _p.name) === 'exports') {
40
- ((_q = node.right) === null || _q === void 0 ? void 0 : _q.properties).forEach((property) => {
41
- if (property.key.type === typescript_estree_1.AST_NODE_TYPES.Identifier) {
42
- const exportedMethod = Object.assign({ method: property.key.name }, property.key.loc.start);
43
- return callback(exportedMethod);
44
- }
45
- });
46
- }
13
+ this.visitObjectAssignmentExpression(node, callback);
47
14
  }
48
15
  if (node.type === typescript_estree_1.AST_NODE_TYPES.ExportNamedDeclaration) {
49
16
  if (node.declaration) {
50
- if (((_r = node.declaration) === null || _r === void 0 ? void 0 : _r.type) === typescript_estree_1.AST_NODE_TYPES.VariableDeclaration) {
51
- node.declaration.declarations.forEach((declarator) => {
52
- if (declarator.id && declarator.id.type === typescript_estree_1.AST_NODE_TYPES.Identifier) {
53
- const exportedMethod = Object.assign({ method: declarator.id.name }, declarator.id.loc.start);
54
- return callback(exportedMethod);
55
- }
56
- });
57
- }
58
- else if (((_s = node.declaration) === null || _s === void 0 ? void 0 : _s.type) === typescript_estree_1.AST_NODE_TYPES.FunctionDeclaration) {
59
- if (((_t = node.declaration) === null || _t === void 0 ? void 0 : _t.id) && ((_u = node.declaration) === null || _u === void 0 ? void 0 : _u.id.type) === typescript_estree_1.AST_NODE_TYPES.Identifier) {
60
- const exportedMethod = Object.assign({ method: node.declaration.id.name }, node.declaration.id.loc.start);
61
- return callback(exportedMethod);
62
- }
63
- }
17
+ this.visitInlineNamedExport(node, callback);
64
18
  }
65
19
  else {
66
- node.specifiers.forEach((specifier) => {
67
- if (specifier.type === typescript_estree_1.AST_NODE_TYPES.ExportSpecifier &&
68
- specifier.exported.type === typescript_estree_1.AST_NODE_TYPES.Identifier) {
69
- const exportedMethod = Object.assign({ method: specifier.exported.name }, node.loc.start);
70
- return callback(exportedMethod);
71
- }
72
- if (specifier.type === typescript_estree_1.AST_NODE_TYPES.ExportSpecifier && specifier.local.type === typescript_estree_1.AST_NODE_TYPES.Identifier) {
73
- const exportedMethod = Object.assign({ method: specifier.local.name }, node.loc.start);
74
- return callback(exportedMethod);
75
- }
76
- });
20
+ node.specifiers.forEach((specifier) => this.visitSpecifiedNamedExports(node, specifier, callback));
77
21
  }
78
22
  }
79
23
  }
24
+ visitSpecifiedNamedExports(node, specifier, callback) {
25
+ if (specifier.type === typescript_estree_1.AST_NODE_TYPES.ExportSpecifier && specifier.local.type === typescript_estree_1.AST_NODE_TYPES.Identifier) {
26
+ callback(this.createExportedMethod(specifier.exported.name, Object.assign({}, node.loc.start)));
27
+ }
28
+ }
29
+ visitInlineNamedExport(node, callback) {
30
+ var _a, _b, _c, _d;
31
+ if (((_a = node.declaration) === null || _a === void 0 ? void 0 : _a.type) === typescript_estree_1.AST_NODE_TYPES.VariableDeclaration) {
32
+ node.declaration.declarations.forEach((declarator) => {
33
+ if (declarator.id && declarator.id.type === typescript_estree_1.AST_NODE_TYPES.Identifier) {
34
+ callback(this.createExportedMethod(declarator.id.name, Object.assign({}, declarator.id.loc.start)));
35
+ }
36
+ });
37
+ }
38
+ else if (((_b = node.declaration) === null || _b === void 0 ? void 0 : _b.type) === typescript_estree_1.AST_NODE_TYPES.FunctionDeclaration) {
39
+ if (((_c = node.declaration) === null || _c === void 0 ? void 0 : _c.id) && ((_d = node.declaration) === null || _d === void 0 ? void 0 : _d.id.type) === typescript_estree_1.AST_NODE_TYPES.Identifier) {
40
+ callback(this.createExportedMethod(node.declaration.id.name, Object.assign({}, node.declaration.id.loc.start)));
41
+ }
42
+ }
43
+ }
44
+ visitObjectAssignmentExpression(node, callback) {
45
+ if (this.isExports(node.left)) {
46
+ this.tryAddObjectExpressionPropertiesExportedMethods(node, callback);
47
+ }
48
+ }
49
+ visitMemberExpression(node, callback) {
50
+ if (node.property.type === typescript_estree_1.AST_NODE_TYPES.Identifier && this.isExports(node.object)) {
51
+ callback(this.createExportedMethod(node.property.name, Object.assign({}, node.property.loc.start)));
52
+ }
53
+ }
54
+ tryAddObjectExpressionPropertiesExportedMethods(node, callback) {
55
+ var _a, _b;
56
+ if (((_a = node.right) === null || _a === void 0 ? void 0 : _a.type) === typescript_estree_1.AST_NODE_TYPES.ObjectExpression) {
57
+ (_b = node.right.properties) === null || _b === void 0 ? void 0 : _b.forEach((property) => {
58
+ if (property.key.type === typescript_estree_1.AST_NODE_TYPES.Identifier) {
59
+ callback(this.createExportedMethod(property.key.name, Object.assign({}, property.key.loc.start)));
60
+ }
61
+ });
62
+ }
63
+ }
64
+ createExportedMethod(method, location) {
65
+ return Object.assign({ method }, location);
66
+ }
67
+ isExports(node) {
68
+ return ((node.type === typescript_estree_1.AST_NODE_TYPES.MemberExpression &&
69
+ node.object.type === typescript_estree_1.AST_NODE_TYPES.Identifier &&
70
+ node.object.name === 'module' &&
71
+ node.property.type === typescript_estree_1.AST_NODE_TYPES.Identifier &&
72
+ node.property.name === 'exports') ||
73
+ ((node === null || node === void 0 ? void 0 : node.type) === typescript_estree_1.AST_NODE_TYPES.Identifier && (node === null || node === void 0 ? void 0 : node.name) === 'exports'));
74
+ }
80
75
  }
81
76
  exports.ExportedFunctionNodeVisitor = ExportedFunctionNodeVisitor;
@@ -1,15 +1,11 @@
1
1
  import { LintClass, LintResultRule } from '../../../linter-interface';
2
2
  import { BaseLintIssueVerifier, LintIssueVerifier } from '../../verifier-interface';
3
3
  import { ContentPropertyApiCall } from '../api-call-interface';
4
- declare type ContentPropertyPermissions = {
5
- current: string[];
6
- deprecated: string[];
7
- };
8
- export declare const CONTENT_PROPERTY_PERMISSIONS_MAP: Record<string, Record<string, ContentPropertyPermissions>>;
4
+ import { RequiredScopes } from '@forge/manifest';
5
+ export declare const CONTENT_PROPERTY_PERMISSIONS_MAP: Record<string, Record<string, RequiredScopes>>;
9
6
  export declare class ContentPropertyVerifier extends BaseLintIssueVerifier implements LintIssueVerifier<ContentPropertyApiCall[]> {
10
7
  protected getLintClass(): LintClass;
11
8
  process(apiCalls: ContentPropertyApiCall[]): Promise<LintResultRule[]>;
12
9
  private getMissingScopes;
13
10
  }
14
- export {};
15
11
  //# sourceMappingURL=content-property-verifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"content-property-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/verifiers/content-property-verifier.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,aAAK,0BAA0B,GAAG;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAyDvG,CAAC;AAEF,qBAAa,uBACX,SAAQ,qBACR,YAAW,iBAAiB,CAAC,sBAAsB,EAAE,CAAC;IACtD,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,QAAQ,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAuBnF,OAAO,CAAC,gBAAgB;CAyBzB"}
1
+ {"version":3,"file":"content-property-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/verifiers/content-property-verifier.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAoB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEnE,eAAO,MAAM,gCAAgC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAyD3F,CAAC;AAEF,qBAAa,uBACX,SAAQ,qBACR,YAAW,iBAAiB,CAAC,sBAAsB,EAAE,CAAC;IACtD,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,QAAQ,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAuBnF,OAAO,CAAC,gBAAgB;CAKzB"}
@@ -5,61 +5,62 @@ const cli_shared_1 = require("@forge/cli-shared");
5
5
  const linter_interface_1 = require("../../../linter-interface");
6
6
  const text_1 = require("../../../text");
7
7
  const verifier_interface_1 = require("../../verifier-interface");
8
+ const manifest_1 = require("@forge/manifest");
8
9
  exports.CONTENT_PROPERTY_PERMISSIONS_MAP = {
9
10
  onJiraIssue: {
10
11
  get: {
11
- current: ['read:issue.property:jira'],
12
- deprecated: ['read:jira-work']
12
+ beta: ['read:issue.property:jira'],
13
+ current: ['read:jira-work']
13
14
  },
14
15
  set: {
15
- current: ['write:issue.property:jira'],
16
- deprecated: ['write:jira-work']
16
+ beta: ['write:issue.property:jira'],
17
+ current: ['write:jira-work']
17
18
  },
18
19
  delete: {
19
- current: ['delete:issue.property:jira'],
20
- deprecated: ['write:jira-work']
20
+ beta: ['delete:issue.property:jira'],
21
+ current: ['write:jira-work']
21
22
  }
22
23
  },
23
24
  onJiraProject: {
24
25
  get: {
25
- current: ['read:project.property:jira'],
26
- deprecated: ['read:jira-work']
26
+ beta: ['read:project.property:jira'],
27
+ current: ['read:jira-work']
27
28
  },
28
29
  set: {
29
- current: ['write:project.property:jira'],
30
- deprecated: ['manage:jira-project']
30
+ beta: ['write:project.property:jira'],
31
+ current: ['manage:jira-project']
31
32
  },
32
33
  delete: {
33
- current: ['delete:project.property:jira'],
34
- deprecated: ['manage:jira-project']
34
+ beta: ['delete:project.property:jira'],
35
+ current: ['manage:jira-project']
35
36
  }
36
37
  },
37
38
  onConfluencePage: {
38
39
  get: {
39
- current: ['read:content-details:confluence'],
40
- deprecated: ['read:confluence-props']
40
+ beta: ['read:content-details:confluence'],
41
+ current: ['read:confluence-props']
41
42
  },
42
43
  set: {
43
- current: ['read:content.property:confluence', 'write:content.property:confluence'],
44
- deprecated: ['read:confluence-props', 'write:confluence-props']
44
+ beta: ['read:content.property:confluence', 'write:content.property:confluence'],
45
+ current: ['read:confluence-props', 'write:confluence-props']
45
46
  },
46
47
  delete: {
47
- current: ['write:content.property:confluence'],
48
- deprecated: ['write:confluence-props']
48
+ beta: ['write:content.property:confluence'],
49
+ current: ['write:confluence-props']
49
50
  }
50
51
  },
51
52
  onConfluenceSpace: {
52
53
  get: {
53
- current: ['read:content-details:confluence'],
54
- deprecated: ['read:confluence-props']
54
+ beta: ['read:content-details:confluence'],
55
+ current: ['read:confluence-props']
55
56
  },
56
57
  set: {
57
- current: ['read:space.property:confluence', 'write:space.property:confluence'],
58
- deprecated: ['read:confluence-props', 'write:confluence-props']
58
+ beta: ['read:space.property:confluence', 'write:space.property:confluence'],
59
+ current: ['read:confluence-props', 'write:confluence-props']
59
60
  },
60
61
  delete: {
61
- current: ['write:space.property:confluence'],
62
- deprecated: ['write:confluence-props']
62
+ beta: ['write:space.property:confluence'],
63
+ current: ['write:confluence-props']
63
64
  }
64
65
  }
65
66
  };
@@ -86,24 +87,7 @@ class ContentPropertyVerifier extends verifier_interface_1.BaseLintIssueVerifier
86
87
  getMissingScopes({ context, method }) {
87
88
  var _a, _b;
88
89
  const existingScopes = (_b = (_a = this.manifest) === null || _a === void 0 ? void 0 : _a.permissions) === null || _b === void 0 ? void 0 : _b.scopes;
89
- const requiredScopesCurrent = exports.CONTENT_PROPERTY_PERMISSIONS_MAP[context][method]['current'];
90
- const requiredScopesDeprecated = exports.CONTENT_PROPERTY_PERMISSIONS_MAP[context][method]['deprecated'];
91
- const missingCurrentPerms = requiredScopesCurrent.filter((perm) => !(existingScopes === null || existingScopes === void 0 ? void 0 : existingScopes.includes(perm)));
92
- if (missingCurrentPerms.length == 0)
93
- return [];
94
- let missingDeprecatedPerms = null;
95
- if (requiredScopesDeprecated) {
96
- missingDeprecatedPerms = requiredScopesDeprecated.filter((perm) => !(existingScopes === null || existingScopes === void 0 ? void 0 : existingScopes.includes(perm)));
97
- if (missingDeprecatedPerms.length == 0)
98
- return [];
99
- }
100
- if (missingCurrentPerms.length < requiredScopesCurrent.length) {
101
- return missingCurrentPerms;
102
- }
103
- if (missingDeprecatedPerms && missingDeprecatedPerms.length < requiredScopesDeprecated.length) {
104
- return missingDeprecatedPerms;
105
- }
106
- return requiredScopesCurrent;
90
+ return manifest_1.getMissingScopes(existingScopes, exports.CONTENT_PROPERTY_PERMISSIONS_MAP[context][method]);
107
91
  }
108
92
  }
109
93
  exports.ContentPropertyVerifier = ContentPropertyVerifier;
@@ -27,7 +27,7 @@ export declare class ProductVerifier extends BaseLintIssueVerifier implements Li
27
27
  private lookupApiCall;
28
28
  private getMissingPermissionScopes;
29
29
  private getRequiredScopes;
30
- private getRequiredDeprecatedScopes;
30
+ private getBetaScopes;
31
31
  }
32
32
  export {};
33
33
  //# sourceMappingURL=product-verifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/verifiers/product-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGpF,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,QAAQ,EAAE,aAAa,EAAE,CAAC;QAC1B,2BAA2B,CAAC,EAAE,qBAAqB,EAAE,CAAC;KACvD,CAAC;CACH;AAED,UAAU,aAAa;IACrB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC9B;AAED,oBAAY,uBAAuB,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAEjE,qBAAa,eAAgB,SAAQ,qBAAsB,YAAW,iBAAiB,CAAC,OAAO,EAAE,CAAC;IAI9F,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAHxB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,EACD,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,MAAM;IAKlC,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAoC3E,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,0BAA0B;IA8BlC,OAAO,CAAC,iBAAiB;IAqBzB,OAAO,CAAC,2BAA2B;CAWpC"}
1
+ {"version":3,"file":"product-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/verifiers/product-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGpF,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAoB,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,QAAQ,EAAE,aAAa,EAAE,CAAC;QAC1B,2BAA2B,CAAC,EAAE,qBAAqB,EAAE,CAAC;KACvD,CAAC;CACH;AAED,UAAU,aAAa;IACrB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC9B;AAED,oBAAY,uBAAuB,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAEjE,qBAAa,eAAgB,SAAQ,qBAAsB,YAAW,iBAAiB,CAAC,OAAO,EAAE,CAAC;IAI9F,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAHxB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,EACD,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,MAAM;IAKlC,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAoC3E,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,0BAA0B;IAOlC,OAAO,CAAC,iBAAiB;IAqBzB,OAAO,CAAC,aAAa;CAWtB"}
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const linter_interface_1 = require("../../../linter-interface");
6
6
  const verifier_interface_1 = require("../../verifier-interface");
7
7
  const cli_shared_1 = require("@forge/cli-shared");
8
+ const manifest_1 = require("@forge/manifest");
8
9
  const text_1 = require("../../../text");
9
10
  const array_prototype_flatmap_1 = tslib_1.__importDefault(require("array.prototype.flatmap"));
10
11
  class ProductVerifier extends verifier_interface_1.BaseLintIssueVerifier {
@@ -52,25 +53,10 @@ class ProductVerifier extends verifier_interface_1.BaseLintIssueVerifier {
52
53
  }
53
54
  }
54
55
  getMissingPermissionScopes(apiCall) {
55
- var _a, _b, _c;
56
- const currentScopes = this.getRequiredScopes(apiCall);
57
- const deprecatedScopes = this.getRequiredDeprecatedScopes(apiCall);
58
- if (!((_c = (_b = (_a = this.manifest) === null || _a === void 0 ? void 0 : _a.permissions) === null || _b === void 0 ? void 0 : _b.scopes) === null || _c === void 0 ? void 0 : _c.length)) {
59
- return currentScopes;
60
- }
61
- const missingCurrentScopes = currentScopes.filter((scope) => { 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(scope)); });
62
- if (!missingCurrentScopes.length)
63
- return [];
64
- const missingDeprecatedScopes = deprecatedScopes.filter((scope) => { 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(scope)); });
65
- if (deprecatedScopes.length && !missingDeprecatedScopes.length)
66
- return [];
67
- if (missingCurrentScopes.length < currentScopes.length) {
68
- return missingCurrentScopes;
69
- }
70
- if (missingDeprecatedScopes.length < deprecatedScopes.length) {
71
- return missingDeprecatedScopes;
72
- }
73
- return missingCurrentScopes;
56
+ var _a, _b;
57
+ const current = this.getRequiredScopes(apiCall);
58
+ const beta = this.getBetaScopes(apiCall);
59
+ return manifest_1.getMissingScopes((_b = (_a = this.manifest) === null || _a === void 0 ? void 0 : _a.permissions) === null || _b === void 0 ? void 0 : _b.scopes, { current, beta });
74
60
  }
75
61
  getRequiredScopes({ regex, method }) {
76
62
  var _a, _b, _c, _d;
@@ -85,14 +71,14 @@ class ProductVerifier extends verifier_interface_1.BaseLintIssueVerifier {
85
71
  return [];
86
72
  return swaggerEntries === null || swaggerEntries === void 0 ? void 0 : swaggerEntries.reduce((prev, curr) => [...prev, ...(curr['OAuth2'] || []), ...(curr['oAuthDefinitions'] || [])], []);
87
73
  }
88
- getRequiredDeprecatedScopes({ regex, method }) {
74
+ getBetaScopes({ regex, method }) {
89
75
  var _a, _b;
90
76
  if (!regex)
91
77
  return [];
92
78
  const oAuth2Scopes = (_b = (_a = this.pathMap.get(regex)) === null || _a === void 0 ? void 0 : _a.methods[method]) === null || _b === void 0 ? void 0 : _b['x-atlassian-oauth2-scopes'];
93
79
  if (!oAuth2Scopes)
94
80
  return [];
95
- return array_prototype_flatmap_1.default(oAuth2Scopes.filter((scope) => scope.state === 'Deprecated').map((scope) => scope.scopes), (x) => x);
81
+ return array_prototype_flatmap_1.default(oAuth2Scopes.filter((scope) => scope.state === 'Beta').map((scope) => scope.scopes), (x) => x);
96
82
  }
97
83
  }
98
84
  exports.ProductVerifier = ProductVerifier;
@@ -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;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"}
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;AAmBpF,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;IAe1E,OAAO,CAAC,WAAW;CAepB"}
@@ -4,22 +4,19 @@ exports.UIHookVerifier = void 0;
4
4
  const linter_interface_1 = require("../../../linter-interface");
5
5
  const verifier_interface_1 = require("../../verifier-interface");
6
6
  const text_1 = require("../../../text");
7
+ const manifest_1 = require("@forge/manifest");
7
8
  const FORGE_UI_HOOK_PERMISSIONS = {
8
9
  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']
10
+ beta: ['read:content-details:confluence', 'read:content.property:confluence', 'write:content.property:confluence'],
11
+ current: ['read:confluence-props', 'write:confluence-props']
15
12
  },
16
13
  useSpaceProperty: {
17
- current: ['read:content-details:confluence', 'read:space.property:confluence', 'write:space.property:confluence'],
18
- deprecated: ['read:confluence-props', 'write:confluence-props']
14
+ beta: ['read:content-details:confluence', 'read:space.property:confluence', 'write:space.property:confluence'],
15
+ current: ['read:confluence-props', 'write:confluence-props']
19
16
  },
20
17
  useIssueProperty: {
21
- current: ['read:issue.property:jira'],
22
- deprecated: ['read:jira-work', 'write:jira-work']
18
+ beta: ['read:issue.property:jira'],
19
+ current: ['read:jira-work', 'write:jira-work']
23
20
  }
24
21
  };
25
22
  class UIHookVerifier extends verifier_interface_1.BaseLintIssueVerifier {
@@ -27,30 +24,14 @@ class UIHookVerifier extends verifier_interface_1.BaseLintIssueVerifier {
27
24
  return linter_interface_1.LintClass.Error;
28
25
  }
29
26
  async process(apiCalls) {
27
+ var _a;
30
28
  const rules = [];
31
29
  for (const apiCall of apiCalls) {
32
30
  const requiredPermissions = FORGE_UI_HOOK_PERMISSIONS[apiCall.hookName];
33
31
  if (!requiredPermissions)
34
32
  return rules;
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)));
33
+ const missingPermissions = manifest_1.getMissingScopes((_a = this.manifest.permissions) === null || _a === void 0 ? void 0 : _a.scopes, requiredPermissions);
34
+ missingPermissions.forEach((perm) => rules.push(this.getHookRule(apiCall, perm)));
54
35
  }
55
36
  return rules;
56
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/lint",
3
- "version": "0.0.0-experimental-e1cefc4",
3
+ "version": "0.0.0-experimental-29a2cc1",
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": "0.0.0-experimental-e1cefc4",
19
- "@forge/csp": "1.10.0",
20
- "@forge/manifest": "0.0.0-experimental-e1cefc4",
18
+ "@forge/cli-shared": "0.0.0-experimental-29a2cc1",
19
+ "@forge/csp": "1.11.0",
20
+ "@forge/manifest": "0.0.0-experimental-29a2cc1",
21
21
  "@typescript-eslint/typescript-estree": "^3.5.0",
22
22
  "cross-spawn": "^7.0.1",
23
23
  "node-fetch": "2.6.1",