@forge/lint 5.14.1-next.7 → 5.15.0-experimental-1ee2de3
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 +93 -0
- package/out/lint/lint.js +2 -2
- package/out/lint/linters/endpoint-linter/invoke-endpoint-interface.d.ts +35 -0
- package/out/lint/linters/endpoint-linter/invoke-endpoint-interface.d.ts.map +1 -0
- package/out/lint/linters/endpoint-linter/invoke-endpoint-interface.js +11 -0
- package/out/lint/linters/endpoint-linter/invoke-endpoint-linter.d.ts +17 -0
- package/out/lint/linters/endpoint-linter/invoke-endpoint-linter.d.ts.map +1 -0
- package/out/lint/linters/endpoint-linter/invoke-endpoint-linter.js +39 -0
- package/out/lint/linters/endpoint-linter/verifiers/invoke-endpoint-verifier.d.ts +12 -0
- package/out/lint/linters/endpoint-linter/verifiers/invoke-endpoint-verifier.d.ts.map +1 -0
- package/out/lint/linters/{remote-linter/verifiers/invoke-remote-verifier.js → endpoint-linter/verifiers/invoke-endpoint-verifier.js} +12 -12
- package/out/lint/linters/endpoint-linter/visitors/invoke-endpoint-call-visitor.d.ts +9 -0
- package/out/lint/linters/endpoint-linter/visitors/invoke-endpoint-call-visitor.d.ts.map +1 -0
- package/out/lint/linters/{remote-linter/visitors/invoke-remote-call-visitor.js → endpoint-linter/visitors/invoke-endpoint-call-visitor.js} +28 -28
- package/out/lint/linters/permission-linter/api-call-interface.d.ts +6 -2
- package/out/lint/linters/permission-linter/api-call-interface.d.ts.map +1 -1
- package/out/lint/linters/permission-linter/api-call-interface.js +1 -0
- package/out/lint/linters/permission-linter/permission-linter.d.ts +2 -1
- package/out/lint/linters/permission-linter/permission-linter.d.ts.map +1 -1
- package/out/lint/linters/permission-linter/permission-linter.js +10 -4
- package/out/lint/linters/permission-linter/verifiers/index.d.ts +1 -0
- package/out/lint/linters/permission-linter/verifiers/index.d.ts.map +1 -1
- package/out/lint/linters/permission-linter/verifiers/index.js +1 -0
- package/out/lint/linters/permission-linter/verifiers/notification-api-verifier.d.ts +8 -0
- package/out/lint/linters/permission-linter/verifiers/notification-api-verifier.d.ts.map +1 -0
- package/out/lint/linters/permission-linter/verifiers/notification-api-verifier.js +44 -0
- package/out/lint/linters/permission-linter/visitors/index.d.ts +1 -0
- package/out/lint/linters/permission-linter/visitors/index.d.ts.map +1 -1
- package/out/lint/linters/permission-linter/visitors/index.js +1 -0
- package/out/lint/linters/permission-linter/visitors/notification-api-visitor.d.ts +7 -0
- package/out/lint/linters/permission-linter/visitors/notification-api-visitor.d.ts.map +1 -0
- package/out/lint/linters/permission-linter/visitors/notification-api-visitor.js +23 -0
- package/out/lint/text/messages.d.ts +4 -0
- package/out/lint/text/messages.d.ts.map +1 -1
- package/out/lint/text/messages.js +4 -0
- package/package.json +5 -5
- package/out/lint/linters/remote-linter/invoke-remote-interface.d.ts +0 -35
- package/out/lint/linters/remote-linter/invoke-remote-interface.d.ts.map +0 -1
- package/out/lint/linters/remote-linter/invoke-remote-interface.js +0 -11
- package/out/lint/linters/remote-linter/invoke-remote-linter.d.ts +0 -17
- package/out/lint/linters/remote-linter/invoke-remote-linter.d.ts.map +0 -1
- package/out/lint/linters/remote-linter/invoke-remote-linter.js +0 -39
- package/out/lint/linters/remote-linter/verifiers/invoke-remote-verifier.d.ts +0 -12
- package/out/lint/linters/remote-linter/verifiers/invoke-remote-verifier.d.ts.map +0 -1
- package/out/lint/linters/remote-linter/visitors/invoke-remote-call-visitor.d.ts +0 -9
- package/out/lint/linters/remote-linter/visitors/invoke-remote-call-visitor.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,98 @@
|
|
|
1
1
|
# @forge/lint
|
|
2
2
|
|
|
3
|
+
## 5.15.0-experimental-1ee2de3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [b59aee1]
|
|
8
|
+
- Updated dependencies [561036a]
|
|
9
|
+
- Updated dependencies [b248c8f]
|
|
10
|
+
- @forge/cli-shared@8.15.1-experimental-1ee2de3
|
|
11
|
+
- @forge/manifest@12.1.0-experimental-1ee2de3
|
|
12
|
+
- @forge/csp@5.6.1-experimental-1ee2de3
|
|
13
|
+
|
|
14
|
+
## 5.15.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- 62086be: Modified Forge CLI linter to detect for usage of Forge NotificationApi
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- d6c8528: Rename remote linter to endpoint in preparation for adding invokeService linter
|
|
23
|
+
- 63d29ca: Update dynamic egress and remote manifest in preparation for Preview
|
|
24
|
+
- Updated dependencies [2b94ed8]
|
|
25
|
+
- Updated dependencies [6204a94]
|
|
26
|
+
- Updated dependencies [c1526eb]
|
|
27
|
+
- Updated dependencies [e4c143c]
|
|
28
|
+
- Updated dependencies [42e069d]
|
|
29
|
+
- Updated dependencies [19807bf]
|
|
30
|
+
- Updated dependencies [a684b69]
|
|
31
|
+
- Updated dependencies [e98e35c]
|
|
32
|
+
- Updated dependencies [5de91aa]
|
|
33
|
+
- Updated dependencies [6247657]
|
|
34
|
+
- Updated dependencies [434fb15]
|
|
35
|
+
- Updated dependencies [d4bbee9]
|
|
36
|
+
- Updated dependencies [8246b16]
|
|
37
|
+
- Updated dependencies [fa9b5aa]
|
|
38
|
+
- Updated dependencies [63d29ca]
|
|
39
|
+
- Updated dependencies [2719ab7]
|
|
40
|
+
- @forge/cli-shared@8.15.1
|
|
41
|
+
- @forge/manifest@12.1.0
|
|
42
|
+
|
|
43
|
+
## 5.15.0-next.13
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [6204a94]
|
|
48
|
+
- Updated dependencies [e98e35c]
|
|
49
|
+
- Updated dependencies [d4bbee9]
|
|
50
|
+
- @forge/manifest@12.1.0-next.8
|
|
51
|
+
- @forge/cli-shared@8.15.1-next.12
|
|
52
|
+
|
|
53
|
+
## 5.15.0-next.12
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [5de91aa]
|
|
58
|
+
- @forge/manifest@12.1.0-next.7
|
|
59
|
+
- @forge/cli-shared@8.15.1-next.11
|
|
60
|
+
|
|
61
|
+
## 5.15.0-next.11
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- 63d29ca: Update dynamic egress and remote manifest in preparation for Preview
|
|
66
|
+
- Updated dependencies [434fb15]
|
|
67
|
+
- Updated dependencies [63d29ca]
|
|
68
|
+
- @forge/manifest@12.1.0-next.6
|
|
69
|
+
- @forge/cli-shared@8.15.1-next.10
|
|
70
|
+
|
|
71
|
+
## 5.15.0-next.10
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- Updated dependencies [a684b69]
|
|
76
|
+
- @forge/cli-shared@8.15.1-next.9
|
|
77
|
+
|
|
78
|
+
## 5.15.0-next.9
|
|
79
|
+
|
|
80
|
+
### Patch Changes
|
|
81
|
+
|
|
82
|
+
- Updated dependencies [8246b16]
|
|
83
|
+
- @forge/manifest@12.1.0-next.5
|
|
84
|
+
- @forge/cli-shared@8.15.1-next.8
|
|
85
|
+
|
|
86
|
+
## 5.15.0-next.8
|
|
87
|
+
|
|
88
|
+
### Minor Changes
|
|
89
|
+
|
|
90
|
+
- 62086be: Modified Forge CLI linter to detect for usage of Forge NotificationApi
|
|
91
|
+
|
|
92
|
+
### Patch Changes
|
|
93
|
+
|
|
94
|
+
- d6c8528: Rename remote linter to endpoint in preparation for adding invokeService linter
|
|
95
|
+
|
|
3
96
|
## 5.14.1-next.7
|
|
4
97
|
|
|
5
98
|
### Patch Changes
|
package/out/lint/lint.js
CHANGED
|
@@ -14,7 +14,7 @@ const permissions_manifest_linter_1 = require("./linters/manifest-linter/permiss
|
|
|
14
14
|
const permission_linter_1 = require("./linters/permission-linter/permission-linter");
|
|
15
15
|
const deprecated_csp_permissions_manifest_linter_1 = require("./linters/manifest-linter/deprecated-csp-permissions-manifest-linter");
|
|
16
16
|
const dynamic_properties_permissions_linter_1 = require("./linters/dynamic-properties-linter/dynamic-properties-permissions-linter");
|
|
17
|
-
const
|
|
17
|
+
const invoke_endpoint_linter_1 = require("./linters/endpoint-linter/invoke-endpoint-linter");
|
|
18
18
|
const storage_module_linter_1 = require("./linters/storage-module-linter/storage-module-linter");
|
|
19
19
|
const frame_component_linter_1 = require("./linters/frame-component-linter/frame-component-linter");
|
|
20
20
|
const deprecated_egress_permissions_manifest_linter_1 = require("./linters/manifest-linter/deprecated-egress-permissions-manifest-linter");
|
|
@@ -87,7 +87,7 @@ const lint = async (filesToLint, manifest, environment, logger, statsigService,
|
|
|
87
87
|
new full_manifest_linter_1.FullManifestLinter(logger, statsigService),
|
|
88
88
|
new handler_linter_1.HandlerLinter(environment, manifest, logger),
|
|
89
89
|
new dynamic_properties_permissions_linter_1.DynamicPropertiesPermissionsLinter(environment, manifest, logger),
|
|
90
|
-
new
|
|
90
|
+
new invoke_endpoint_linter_1.InvokeEndpointLinter(environment, manifest, logger),
|
|
91
91
|
new storage_module_linter_1.StorageModulesLinter(environment, manifest, logger),
|
|
92
92
|
new frame_component_linter_1.FrameComponentLinter(environment, manifest, logger),
|
|
93
93
|
new llm_module_linter_1.LlmModuleLinter(environment, manifest, logger),
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TSESTree } from '@typescript-eslint/typescript-estree';
|
|
2
|
+
import { LintCriteriaMatch } from '../../linter-interface';
|
|
3
|
+
export declare enum InvokeEndpointTypes {
|
|
4
|
+
DIRECT_CALL = 0,
|
|
5
|
+
MEMBER_CALL = 1,
|
|
6
|
+
IMPORT_LIST = 2
|
|
7
|
+
}
|
|
8
|
+
export declare const INVOKE_ENDPOINT_PACKAGE_NAME = "@forge/api";
|
|
9
|
+
export declare const INVOKE_ENDPOINT_FUNCTION_NAME = "invokeRemote";
|
|
10
|
+
export interface InvokeEndpointCallBase extends LintCriteriaMatch {
|
|
11
|
+
endpointKey: string;
|
|
12
|
+
}
|
|
13
|
+
export interface InvokeEndpointDirectCall extends InvokeEndpointCallBase {
|
|
14
|
+
type: InvokeEndpointTypes.DIRECT_CALL;
|
|
15
|
+
calleeName: string;
|
|
16
|
+
}
|
|
17
|
+
export interface InvokeEndpointMemberCall extends InvokeEndpointCallBase {
|
|
18
|
+
type: InvokeEndpointTypes.MEMBER_CALL;
|
|
19
|
+
objectName: string;
|
|
20
|
+
}
|
|
21
|
+
export interface InvokeEndpointImport extends LintCriteriaMatch {
|
|
22
|
+
type: TSESTree.ImportClause['type'];
|
|
23
|
+
alias: string;
|
|
24
|
+
}
|
|
25
|
+
export interface InvokeEndpointImportList extends LintCriteriaMatch {
|
|
26
|
+
type: InvokeEndpointTypes.IMPORT_LIST;
|
|
27
|
+
imports: InvokeEndpointImport[];
|
|
28
|
+
}
|
|
29
|
+
export declare type InvokeEndpointCall = InvokeEndpointDirectCall | InvokeEndpointMemberCall;
|
|
30
|
+
export declare type InvokeEndpointUsage = InvokeEndpointCall | InvokeEndpointImportList;
|
|
31
|
+
export interface InvokeEndpointVerifierInput {
|
|
32
|
+
invokeEndpointCalls: InvokeEndpointCall[];
|
|
33
|
+
imports: InvokeEndpointImport[];
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=invoke-endpoint-interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoke-endpoint-interface.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/endpoint-linter/invoke-endpoint-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,oBAAY,mBAAmB;IAC7B,WAAW,IAAA;IACX,WAAW,IAAA;IACX,WAAW,IAAA;CACZ;AAED,eAAO,MAAM,4BAA4B,eAAe,CAAC;AACzD,eAAO,MAAM,6BAA6B,iBAAiB,CAAC;AAE5D,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,wBAAyB,SAAQ,sBAAsB;IACtE,IAAI,EAAE,mBAAmB,CAAC,WAAW,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,wBAAyB,SAAQ,sBAAsB;IACtE,IAAI,EAAE,mBAAmB,CAAC,WAAW,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE,IAAI,EAAE,mBAAmB,CAAC,WAAW,CAAC;IACtC,OAAO,EAAE,oBAAoB,EAAE,CAAC;CACjC;AAED,oBAAY,kBAAkB,GAAG,wBAAwB,GAAG,wBAAwB,CAAC;AAErF,oBAAY,mBAAmB,GAAG,kBAAkB,GAAG,wBAAwB,CAAC;AAEhF,MAAM,WAAW,2BAA2B;IAC1C,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;IAC1C,OAAO,EAAE,oBAAoB,EAAE,CAAC;CACjC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.INVOKE_ENDPOINT_FUNCTION_NAME = exports.INVOKE_ENDPOINT_PACKAGE_NAME = exports.InvokeEndpointTypes = void 0;
|
|
4
|
+
var InvokeEndpointTypes;
|
|
5
|
+
(function (InvokeEndpointTypes) {
|
|
6
|
+
InvokeEndpointTypes[InvokeEndpointTypes["DIRECT_CALL"] = 0] = "DIRECT_CALL";
|
|
7
|
+
InvokeEndpointTypes[InvokeEndpointTypes["MEMBER_CALL"] = 1] = "MEMBER_CALL";
|
|
8
|
+
InvokeEndpointTypes[InvokeEndpointTypes["IMPORT_LIST"] = 2] = "IMPORT_LIST";
|
|
9
|
+
})(InvokeEndpointTypes = exports.InvokeEndpointTypes || (exports.InvokeEndpointTypes = {}));
|
|
10
|
+
exports.INVOKE_ENDPOINT_PACKAGE_NAME = '@forge/api';
|
|
11
|
+
exports.INVOKE_ENDPOINT_FUNCTION_NAME = 'invokeRemote';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ManifestSchema as Manifest } from '@forge/manifest';
|
|
2
|
+
import BaseLinter from '../../base-linter';
|
|
3
|
+
import { LintLogger } from '../../linter-interface';
|
|
4
|
+
import { InvokeEndpointUsage, InvokeEndpointVerifierInput } from './invoke-endpoint-interface';
|
|
5
|
+
interface InvokeEndpointMatches {
|
|
6
|
+
[key: string]: InvokeEndpointVerifierInput;
|
|
7
|
+
invokeEndpoint: InvokeEndpointVerifierInput;
|
|
8
|
+
}
|
|
9
|
+
export declare class InvokeEndpointLinter extends BaseLinter<InvokeEndpointUsage, InvokeEndpointMatches, InvokeEndpointVerifierInput> {
|
|
10
|
+
private manifest;
|
|
11
|
+
constructor(environment: string, manifest: Manifest, logger: LintLogger);
|
|
12
|
+
bootstrap(): Promise<void>;
|
|
13
|
+
protected addLintCriteriaMatch(usage: InvokeEndpointUsage, filepath: string): void;
|
|
14
|
+
protected setupMatchesMap(filePath: string): void;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=invoke-endpoint-linter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoke-endpoint-linter.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/endpoint-linter/invoke-endpoint-linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAuB,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAIpH,UAAU,qBAAqB;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,2BAA2B,CAAC;IAC3C,cAAc,EAAE,2BAA2B,CAAC;CAC7C;AAED,qBAAa,oBAAqB,SAAQ,UAAU,CAClD,mBAAmB,EACnB,qBAAqB,EACrB,2BAA2B,CAC5B;IAGG,OAAO,CAAC,QAAQ;gBADhB,WAAW,EAAE,MAAM,EACX,QAAQ,EAAE,QAAQ,EAC1B,MAAM,EAAE,UAAU;IAKd,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAOhC,SAAS,CAAC,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAUlF,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAQlD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvokeEndpointLinter = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const base_linter_1 = tslib_1.__importDefault(require("../../base-linter"));
|
|
6
|
+
const invoke_endpoint_interface_1 = require("./invoke-endpoint-interface");
|
|
7
|
+
const invoke_endpoint_verifier_1 = require("./verifiers/invoke-endpoint-verifier");
|
|
8
|
+
const invoke_endpoint_call_visitor_1 = require("./visitors/invoke-endpoint-call-visitor");
|
|
9
|
+
class InvokeEndpointLinter extends base_linter_1.default {
|
|
10
|
+
manifest;
|
|
11
|
+
constructor(environment, manifest, logger) {
|
|
12
|
+
super(environment, logger);
|
|
13
|
+
this.manifest = manifest;
|
|
14
|
+
}
|
|
15
|
+
async bootstrap() {
|
|
16
|
+
this.nodeVisitors = [new invoke_endpoint_call_visitor_1.InvokeEndpointCallVisitor()];
|
|
17
|
+
this.verifiers = {
|
|
18
|
+
invokeEndpoint: new invoke_endpoint_verifier_1.InvokeEndpointVerifier(this.environment, this.manifest)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
addLintCriteriaMatch(usage, filepath) {
|
|
22
|
+
const criteriaMatches = this.matches.get(filepath);
|
|
23
|
+
if (usage.type === invoke_endpoint_interface_1.InvokeEndpointTypes.DIRECT_CALL || usage.type === invoke_endpoint_interface_1.InvokeEndpointTypes.MEMBER_CALL) {
|
|
24
|
+
criteriaMatches.invokeEndpoint.invokeEndpointCalls.push(usage);
|
|
25
|
+
}
|
|
26
|
+
else if (usage.type === invoke_endpoint_interface_1.InvokeEndpointTypes.IMPORT_LIST) {
|
|
27
|
+
criteriaMatches.invokeEndpoint.imports.push(...usage.imports);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
setupMatchesMap(filePath) {
|
|
31
|
+
this.matches.set(filePath, {
|
|
32
|
+
invokeEndpoint: {
|
|
33
|
+
invokeEndpointCalls: [],
|
|
34
|
+
imports: []
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.InvokeEndpointLinter = InvokeEndpointLinter;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LintClass, LintResultRule } from '../../../linter-interface';
|
|
2
|
+
import { BaseLintIssueVerifier, LintIssueVerifier } from '../../verifier-interface';
|
|
3
|
+
import { InvokeEndpointVerifierInput } from '../invoke-endpoint-interface';
|
|
4
|
+
export declare class InvokeEndpointVerifier extends BaseLintIssueVerifier implements LintIssueVerifier<InvokeEndpointVerifierInput> {
|
|
5
|
+
protected getLintClass(): LintClass;
|
|
6
|
+
process(input: InvokeEndpointVerifierInput): Promise<LintResultRule[]>;
|
|
7
|
+
private isValidCall;
|
|
8
|
+
private getRemoteForCall;
|
|
9
|
+
private isRemoteKeyValid;
|
|
10
|
+
private hasComputeOperation;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=invoke-endpoint-verifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoke-endpoint-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/endpoint-linter/verifiers/invoke-endpoint-verifier.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAIL,2BAA2B,EAC5B,MAAM,8BAA8B,CAAC;AAEtC,qBAAa,sBACX,SAAQ,qBACR,YAAW,iBAAiB,CAAC,2BAA2B,CAAC;IAEzD,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAuBnF,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,mBAAmB;CAK5B"}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.InvokeEndpointVerifier = void 0;
|
|
4
4
|
const typescript_estree_1 = require("@typescript-eslint/typescript-estree");
|
|
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
|
|
9
|
-
class
|
|
8
|
+
const invoke_endpoint_interface_1 = require("../invoke-endpoint-interface");
|
|
9
|
+
class InvokeEndpointVerifier extends verifier_interface_1.BaseLintIssueVerifier {
|
|
10
10
|
getLintClass() {
|
|
11
11
|
return linter_interface_1.LintClass.Error;
|
|
12
12
|
}
|
|
13
13
|
async process(input) {
|
|
14
|
-
const validCalls = input.
|
|
15
|
-
const
|
|
14
|
+
const validCalls = input.invokeEndpointCalls.filter((call) => this.isValidCall(call, input.imports));
|
|
15
|
+
const missingEndpoints = validCalls
|
|
16
16
|
.filter((call) => !this.isRemoteKeyValid(call))
|
|
17
17
|
.map((call) => ({ call, message: text_1.messages.verifiers.invokeRemoteKey }));
|
|
18
18
|
const missingComputeOperation = validCalls
|
|
19
19
|
.filter((call) => this.isRemoteKeyValid(call) && !this.hasComputeOperation(call))
|
|
20
20
|
.map((call) => ({ call, message: text_1.messages.verifiers.invokeRemoteCompute }));
|
|
21
|
-
return [...
|
|
21
|
+
return [...missingEndpoints, ...missingComputeOperation].map(({ call, message }) => ({
|
|
22
22
|
class: this.getLintClass(),
|
|
23
23
|
column: call.column,
|
|
24
24
|
line: call.line,
|
|
25
|
-
message: message.message(call.
|
|
25
|
+
message: message.message(call.endpointKey),
|
|
26
26
|
reference: message.reference
|
|
27
27
|
}));
|
|
28
28
|
}
|
|
29
29
|
isValidCall(call, imports) {
|
|
30
|
-
if (call.type ===
|
|
30
|
+
if (call.type === invoke_endpoint_interface_1.InvokeEndpointTypes.DIRECT_CALL) {
|
|
31
31
|
return imports.some((imp) => imp.type === typescript_estree_1.AST_NODE_TYPES.ImportSpecifier && call.calleeName === imp.alias);
|
|
32
32
|
}
|
|
33
33
|
return imports.some((imp) => (imp.type === typescript_estree_1.AST_NODE_TYPES.ImportDefaultSpecifier || imp.type === typescript_estree_1.AST_NODE_TYPES.ImportNamespaceSpecifier) &&
|
|
34
34
|
call.objectName === imp.alias);
|
|
35
35
|
}
|
|
36
36
|
getRemoteForCall(call) {
|
|
37
|
-
return this.manifest.remotes?.find((remote) => remote.key === call.
|
|
37
|
+
return this.manifest.remotes?.find((remote) => remote.key === call.endpointKey);
|
|
38
38
|
}
|
|
39
39
|
isRemoteKeyValid(call) {
|
|
40
40
|
const remote = this.getRemoteForCall(call);
|
|
41
41
|
return typeof remote !== 'undefined';
|
|
42
42
|
}
|
|
43
43
|
hasComputeOperation(call) {
|
|
44
|
-
const
|
|
45
|
-
return
|
|
44
|
+
const endpoint = this.getRemoteForCall(call);
|
|
45
|
+
return endpoint?.operations?.includes('compute') ?? false;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
exports.
|
|
48
|
+
exports.InvokeEndpointVerifier = InvokeEndpointVerifier;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TSESTree } from '@typescript-eslint/typescript-estree';
|
|
2
|
+
import { NodeVisitor } from '../../node-visitor-interface';
|
|
3
|
+
import { InvokeEndpointUsage } from '../invoke-endpoint-interface';
|
|
4
|
+
export declare class InvokeEndpointCallVisitor implements NodeVisitor<InvokeEndpointUsage> {
|
|
5
|
+
visit(node: TSESTree.Node, parent: TSESTree.Node | undefined, callback: (fetchCall: InvokeEndpointUsage) => void): void;
|
|
6
|
+
private endpointKeyCanBeChecked;
|
|
7
|
+
private transformArgsToInvokeEndpointCall;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=invoke-endpoint-call-visitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoke-endpoint-call-visitor.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/endpoint-linter/visitors/invoke-endpoint-call-visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAOL,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AAEtC,qBAAa,yBAA0B,YAAW,WAAW,CAAC,mBAAmB,CAAC;IACzE,KAAK,CACV,IAAI,EAAE,QAAQ,CAAC,IAAI,EACnB,MAAM,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,EACjC,QAAQ,EAAE,CAAC,SAAS,EAAE,mBAAmB,KAAK,IAAI,GACjD,IAAI;IA0FP,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,iCAAiC,CAItC;CACJ"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.InvokeEndpointCallVisitor = void 0;
|
|
4
4
|
const typescript_estree_1 = require("@typescript-eslint/typescript-estree");
|
|
5
|
-
const
|
|
6
|
-
class
|
|
5
|
+
const invoke_endpoint_interface_1 = require("../invoke-endpoint-interface");
|
|
6
|
+
class InvokeEndpointCallVisitor {
|
|
7
7
|
visit(node, parent, callback) {
|
|
8
8
|
switch (node.type) {
|
|
9
9
|
case typescript_estree_1.AST_NODE_TYPES.ImportDeclaration:
|
|
10
|
-
if (node.source.value ===
|
|
10
|
+
if (node.source.value === invoke_endpoint_interface_1.INVOKE_ENDPOINT_PACKAGE_NAME) {
|
|
11
11
|
const imports = node.specifiers
|
|
12
12
|
.filter((spec) => spec.type === typescript_estree_1.AST_NODE_TYPES.ImportDefaultSpecifier ||
|
|
13
13
|
spec.type === typescript_estree_1.AST_NODE_TYPES.ImportNamespaceSpecifier ||
|
|
14
14
|
(spec.type === typescript_estree_1.AST_NODE_TYPES.ImportSpecifier &&
|
|
15
|
-
spec.imported.name ===
|
|
15
|
+
spec.imported.name === invoke_endpoint_interface_1.INVOKE_ENDPOINT_FUNCTION_NAME))
|
|
16
16
|
.map((spec) => ({
|
|
17
17
|
type: spec.type,
|
|
18
18
|
alias: spec.local.name,
|
|
@@ -20,7 +20,7 @@ class InvokeRemoteCallVisitor {
|
|
|
20
20
|
line: spec.local.loc.start.line
|
|
21
21
|
}));
|
|
22
22
|
callback({
|
|
23
|
-
type:
|
|
23
|
+
type: invoke_endpoint_interface_1.InvokeEndpointTypes.IMPORT_LIST,
|
|
24
24
|
imports,
|
|
25
25
|
line: 0,
|
|
26
26
|
column: 0
|
|
@@ -29,44 +29,44 @@ class InvokeRemoteCallVisitor {
|
|
|
29
29
|
break;
|
|
30
30
|
case typescript_estree_1.AST_NODE_TYPES.CallExpression:
|
|
31
31
|
if (node.callee.type === typescript_estree_1.AST_NODE_TYPES.Identifier) {
|
|
32
|
-
const [
|
|
33
|
-
if (this.
|
|
34
|
-
const
|
|
35
|
-
...this.
|
|
36
|
-
type:
|
|
32
|
+
const [endpointKeyNode] = node.arguments;
|
|
33
|
+
if (this.endpointKeyCanBeChecked(endpointKeyNode)) {
|
|
34
|
+
const invokeEndpointCall = {
|
|
35
|
+
...this.transformArgsToInvokeEndpointCall(endpointKeyNode),
|
|
36
|
+
type: invoke_endpoint_interface_1.InvokeEndpointTypes.DIRECT_CALL,
|
|
37
37
|
calleeName: node.callee.name
|
|
38
38
|
};
|
|
39
|
-
callback(
|
|
39
|
+
callback(invokeEndpointCall);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
break;
|
|
43
43
|
case typescript_estree_1.AST_NODE_TYPES.MemberExpression:
|
|
44
44
|
if (node.property.type === typescript_estree_1.AST_NODE_TYPES.Identifier &&
|
|
45
45
|
node.object.type === typescript_estree_1.AST_NODE_TYPES.Identifier &&
|
|
46
|
-
node.property.name ===
|
|
46
|
+
node.property.name === invoke_endpoint_interface_1.INVOKE_ENDPOINT_FUNCTION_NAME &&
|
|
47
47
|
parent?.type === typescript_estree_1.AST_NODE_TYPES.CallExpression) {
|
|
48
|
-
const [
|
|
49
|
-
if (this.
|
|
50
|
-
const
|
|
51
|
-
...this.
|
|
52
|
-
type:
|
|
48
|
+
const [endpointKeyNode] = parent.arguments;
|
|
49
|
+
if (this.endpointKeyCanBeChecked(endpointKeyNode)) {
|
|
50
|
+
const invokeEndpointMemberCall = {
|
|
51
|
+
...this.transformArgsToInvokeEndpointCall(endpointKeyNode),
|
|
52
|
+
type: invoke_endpoint_interface_1.InvokeEndpointTypes.MEMBER_CALL,
|
|
53
53
|
objectName: node.object.name
|
|
54
54
|
};
|
|
55
|
-
callback(
|
|
55
|
+
callback(invokeEndpointMemberCall);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
typeof
|
|
64
|
-
|
|
61
|
+
endpointKeyCanBeChecked(endpointKeyNode) {
|
|
62
|
+
return (endpointKeyNode?.type === typescript_estree_1.AST_NODE_TYPES.Literal &&
|
|
63
|
+
typeof endpointKeyNode?.value === 'string' &&
|
|
64
|
+
endpointKeyNode.value.trim() !== '');
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
line:
|
|
69
|
-
column:
|
|
66
|
+
transformArgsToInvokeEndpointCall = (endpointKeyNode) => ({
|
|
67
|
+
endpointKey: endpointKeyNode.value,
|
|
68
|
+
line: endpointKeyNode.loc.start.line,
|
|
69
|
+
column: endpointKeyNode.loc.start.column
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
exports.
|
|
72
|
+
exports.InvokeEndpointCallVisitor = InvokeEndpointCallVisitor;
|
|
@@ -5,7 +5,8 @@ export declare enum ApiCallTypes {
|
|
|
5
5
|
'STORAGE' = 2,
|
|
6
6
|
'EXTERNAL' = 3,
|
|
7
7
|
'CONTENT_PROPERTY' = 4,
|
|
8
|
-
'IMAGE' = 5
|
|
8
|
+
'IMAGE' = 5,
|
|
9
|
+
'NOTIFICATION' = 6
|
|
9
10
|
}
|
|
10
11
|
export declare type ProductName = 'jira' | 'confluence' | 'bitbucket';
|
|
11
12
|
export interface ProductApiCall extends LintCriteriaMatch {
|
|
@@ -35,5 +36,8 @@ export interface ContentPropertyApiCall extends LintCriteriaMatch {
|
|
|
35
36
|
context: string;
|
|
36
37
|
method: string;
|
|
37
38
|
}
|
|
38
|
-
export
|
|
39
|
+
export interface NotificationApiCall extends LintCriteriaMatch {
|
|
40
|
+
type: ApiCallTypes.NOTIFICATION;
|
|
41
|
+
}
|
|
42
|
+
export declare type ApiCall = ProductApiCall | UIHookApiCall | StorageApiCall | ExternalApiCall | ImageUrl | ContentPropertyApiCall | NotificationApiCall;
|
|
39
43
|
//# sourceMappingURL=api-call-interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-call-interface.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/permission-linter/api-call-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,oBAAY,YAAY;IACtB,SAAS,IAAA;IACT,MAAM,IAAA;IACN,SAAS,IAAA;IACT,UAAU,IAAA;IACV,kBAAkB,IAAA;IAClB,OAAO,IAAA;
|
|
1
|
+
{"version":3,"file":"api-call-interface.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/permission-linter/api-call-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,oBAAY,YAAY;IACtB,SAAS,IAAA;IACT,MAAM,IAAA;IACN,SAAS,IAAA;IACT,UAAU,IAAA;IACV,kBAAkB,IAAA;IAClB,OAAO,IAAA;IACP,cAAc,IAAA;CACf;AAED,oBAAY,WAAW,GAAG,MAAM,GAAG,YAAY,GAAG,WAAW,CAAC;AAE9D,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC;IAC5B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,QAAS,SAAQ,iBAAiB;IACjD,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D,IAAI,EAAE,YAAY,CAAC,gBAAgB,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,IAAI,EAAE,YAAY,CAAC,YAAY,CAAC;CACjC;AAED,oBAAY,OAAO,GACf,cAAc,GACd,aAAa,GACb,cAAc,GACd,eAAe,GACf,QAAQ,GACR,sBAAsB,GACtB,mBAAmB,CAAC"}
|
|
@@ -9,4 +9,5 @@ var ApiCallTypes;
|
|
|
9
9
|
ApiCallTypes[ApiCallTypes["EXTERNAL"] = 3] = "EXTERNAL";
|
|
10
10
|
ApiCallTypes[ApiCallTypes["CONTENT_PROPERTY"] = 4] = "CONTENT_PROPERTY";
|
|
11
11
|
ApiCallTypes[ApiCallTypes["IMAGE"] = 5] = "IMAGE";
|
|
12
|
+
ApiCallTypes[ApiCallTypes["NOTIFICATION"] = 6] = "NOTIFICATION";
|
|
12
13
|
})(ApiCallTypes = exports.ApiCallTypes || (exports.ApiCallTypes = {}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ManifestSchema as Manifest } from '@forge/manifest';
|
|
2
2
|
import BaseLinter from '../../base-linter';
|
|
3
3
|
import { LintFixState, LintLogger, LintResultRule } from '../../linter-interface';
|
|
4
|
-
import { ApiCall, ExternalApiCall, ImageUrl, ProductApiCall, StorageApiCall, UIHookApiCall } from './api-call-interface';
|
|
4
|
+
import { ApiCall, ExternalApiCall, ImageUrl, NotificationApiCall, ProductApiCall, StorageApiCall, UIHookApiCall } from './api-call-interface';
|
|
5
5
|
import { PathMethods } from './verifiers';
|
|
6
6
|
interface SwaggerFormat {
|
|
7
7
|
paths: {
|
|
@@ -20,6 +20,7 @@ interface PermissionLintCriteriaMatches {
|
|
|
20
20
|
uiHook: UIHookApiCall[];
|
|
21
21
|
external: ExternalApiCall[];
|
|
22
22
|
image: ImageUrl[];
|
|
23
|
+
notification: NotificationApiCall[];
|
|
23
24
|
}
|
|
24
25
|
export declare class PermissionLinter extends BaseLinter<ApiCall, PermissionLintCriteriaMatches, ApiCall[]> {
|
|
25
26
|
private manifest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission-linter.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/permission-linter/permission-linter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,IAAI,QAAQ,EAAe,MAAM,iBAAiB,CAAC;AAE/E,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EACL,OAAO,EAEP,eAAe,EACf,QAAQ,EACR,cAAc,EACd,cAAc,EACd,aAAa,EACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAML,WAAW,
|
|
1
|
+
{"version":3,"file":"permission-linter.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/permission-linter/permission-linter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,IAAI,QAAQ,EAAe,MAAM,iBAAiB,CAAC;AAE/E,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EACL,OAAO,EAEP,eAAe,EACf,QAAQ,EACR,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,aAAa,EACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAML,WAAW,EAIZ,MAAM,aAAa,CAAC;AAarB,UAAU,aAAa;IACrB,KAAK,EAAE;QACL,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;KAC7B,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAKhD,eAAO,MAAM,sBAAsB,WACzB,cAAc,EAAE,YACd,cAAc,EAAE,mBAEtB,mBAAmB,GACnB,gCAAgC,GAChC,+BAA+B,GAC/B,iCAAiC,UAC7B,YAAY,KACnB,IAAI,MAAM,CAkBZ,CAAC;AAEF,eAAO,MAAM,2BAA2B,aAAc,cAAc,EAAE,UAAU,YAAY,KAAG,OAI9F,CAAC;AAsCF,eAAO,MAAM,qBAAqB,WACxB,cAAc,EAAE,YACd,cAAc,EAAE,SACnB,YAAY,KAClB,QAAQ,YAAY,CAyEtB,CAAC;AAEF,UAAU,6BAA6B;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,EAAE,CAAC;IACzB,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,YAAY,EAAE,mBAAmB,EAAE,CAAC;CACrC;AAED,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,OAAO,EAAE,6BAA6B,EAAE,OAAO,EAAE,CAAC;IAe/F,OAAO,CAAC,QAAQ;IAdlB,MAAM,CAAC,cAAc,SAAgC;IACrD,MAAM,CAAC,aAAa,SAA+B;IACnD,MAAM,CAAC,aAAa,SAA+B;IACnD,MAAM,CAAC,oBAAoB,SAAsC;IACjE,MAAM,CAAC,uBAAuB,SAAyC;IACvE,MAAM,CAAC,mBAAmB,SAAqC;IAE/D,OAAO,CAAC,IAAI,CAAC,CAA0B;IACvC,OAAO,CAAC,UAAU,CAAC,CAA0B;IAC7C,OAAO,CAAC,SAAS,CAAC,CAA0B;IAC5C,OAAO,CAAC,KAAK,CAAC,CAAa;gBAGzB,WAAW,EAAE,MAAM,EACX,QAAQ,EAAE,QAAQ,EAC1B,MAAM,EAAE,UAAU;IAKP,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IA6FvC,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAejD,SAAS,CAAC,QAAQ,IACd,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC,GACtG,SAAS;IAIb,SAAS,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAyB3D,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAWtE,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAKrE,OAAO,CAAC,YAAY;CAarB"}
|
|
@@ -40,7 +40,7 @@ const deprecatedEgressPermissions = (warnings, state) => {
|
|
|
40
40
|
};
|
|
41
41
|
exports.deprecatedEgressPermissions = deprecatedEgressPermissions;
|
|
42
42
|
const applyEgressPermissionsMigration = (config) => {
|
|
43
|
-
const { fetch: originalFetch, ...restExternal } = config.external ?? {};
|
|
43
|
+
const { fetch: originalFetch, configurable: _configurable, ...restExternal } = config.external ?? {};
|
|
44
44
|
Object.entries(originalFetch || {}).forEach(([key, values]) => {
|
|
45
45
|
const valuesToOverride = [];
|
|
46
46
|
values.forEach((egressValue) => {
|
|
@@ -190,7 +190,8 @@ class PermissionLinter extends base_linter_1.default {
|
|
|
190
190
|
new visitors_1.UIHookNodeVisitor(),
|
|
191
191
|
new visitors_1.StorageAPINodeVisitor(),
|
|
192
192
|
new visitors_1.ExternalApiCallVisitor(),
|
|
193
|
-
new visitors_1.ImageUrlVisitor()
|
|
193
|
+
new visitors_1.ImageUrlVisitor(),
|
|
194
|
+
new visitors_1.NotificationAPINodeVisitor()
|
|
194
195
|
];
|
|
195
196
|
const humanReadableEnvironment = (0, cli_shared_1.environmentToOption)(this.environment);
|
|
196
197
|
this.verifiers = {
|
|
@@ -200,7 +201,8 @@ class PermissionLinter extends base_linter_1.default {
|
|
|
200
201
|
storage: new verifiers_1.StorageAPIVerifier(humanReadableEnvironment, this.manifest),
|
|
201
202
|
uiHook: new verifiers_1.UIHookVerifier(humanReadableEnvironment, this.manifest),
|
|
202
203
|
external: new verifiers_1.ExternalFetchVerifier(humanReadableEnvironment, this.manifest),
|
|
203
|
-
image: new verifiers_1.ImageUrlVerifier(humanReadableEnvironment, this.manifest)
|
|
204
|
+
image: new verifiers_1.ImageUrlVerifier(humanReadableEnvironment, this.manifest),
|
|
205
|
+
notification: new verifiers_1.NotificationVerifier(humanReadableEnvironment, this.manifest)
|
|
204
206
|
};
|
|
205
207
|
}
|
|
206
208
|
setupMatchesMap(filepath) {
|
|
@@ -213,7 +215,8 @@ class PermissionLinter extends base_linter_1.default {
|
|
|
213
215
|
uiHook: [],
|
|
214
216
|
storage: [],
|
|
215
217
|
external: [],
|
|
216
|
-
image: []
|
|
218
|
+
image: [],
|
|
219
|
+
notification: []
|
|
217
220
|
});
|
|
218
221
|
}
|
|
219
222
|
getFixer() {
|
|
@@ -237,6 +240,9 @@ class PermissionLinter extends base_linter_1.default {
|
|
|
237
240
|
case api_call_interface_1.ApiCallTypes.IMAGE:
|
|
238
241
|
criteriaMatches.image.push(apiCall);
|
|
239
242
|
break;
|
|
243
|
+
case api_call_interface_1.ApiCallTypes.NOTIFICATION:
|
|
244
|
+
criteriaMatches.notification.push(apiCall);
|
|
245
|
+
break;
|
|
240
246
|
}
|
|
241
247
|
}
|
|
242
248
|
async getProductPaths(cacheKey, url) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/verifiers/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/verifiers/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC"}
|
|
@@ -6,3 +6,4 @@ tslib_1.__exportStar(require("./image-url-verifier"), exports);
|
|
|
6
6
|
tslib_1.__exportStar(require("./product-verifier"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./storage-api-verifier"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./ui-hook-verifier"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./notification-api-verifier"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LintResultRule, LintClass } from '../../../linter-interface';
|
|
2
|
+
import { ApiCall, NotificationApiCall } from '../api-call-interface';
|
|
3
|
+
import { LintIssueVerifier, BaseLintIssueVerifier } from '../../verifier-interface';
|
|
4
|
+
export declare class NotificationVerifier extends BaseLintIssueVerifier implements LintIssueVerifier<ApiCall[]> {
|
|
5
|
+
protected getLintClass(): LintClass;
|
|
6
|
+
process(apiCalls: NotificationApiCall[]): Promise<LintResultRule[]>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=notification-api-verifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-api-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/verifiers/notification-api-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAOpF,qBAAa,oBAAqB,SAAQ,qBAAsB,YAAW,iBAAiB,CAAC,OAAO,EAAE,CAAC;IACrG,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,QAAQ,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CA4CjF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationVerifier = void 0;
|
|
4
|
+
const linter_interface_1 = require("../../../linter-interface");
|
|
5
|
+
const verifier_interface_1 = require("../../verifier-interface");
|
|
6
|
+
const text_1 = require("../../../text");
|
|
7
|
+
const utils_1 = require("../../utils");
|
|
8
|
+
const JIRA_SCOPE = 'send:app-notification:jira';
|
|
9
|
+
const CONFLUENCE_SCOPE = 'send:app-notification:confluence';
|
|
10
|
+
class NotificationVerifier extends verifier_interface_1.BaseLintIssueVerifier {
|
|
11
|
+
getLintClass() {
|
|
12
|
+
return linter_interface_1.LintClass.Error;
|
|
13
|
+
}
|
|
14
|
+
async process(apiCalls) {
|
|
15
|
+
const rules = [];
|
|
16
|
+
const declaredScopes = (0, utils_1.getAllScopeKeys)(this.manifest.permissions?.scopes ?? []);
|
|
17
|
+
apiCalls.forEach((apiCall) => {
|
|
18
|
+
const { line, column } = apiCall;
|
|
19
|
+
if (!declaredScopes.includes(JIRA_SCOPE) && !declaredScopes.includes(CONFLUENCE_SCOPE)) {
|
|
20
|
+
rules.push({
|
|
21
|
+
class: this.getLintClass(),
|
|
22
|
+
message: text_1.messages.verifiers.notification.message(JIRA_SCOPE, 'Jira'),
|
|
23
|
+
reference: text_1.messages.verifiers.notification.reference,
|
|
24
|
+
line,
|
|
25
|
+
column,
|
|
26
|
+
metadata: {
|
|
27
|
+
missingPermission: JIRA_SCOPE
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
class: this.getLintClass(),
|
|
31
|
+
message: text_1.messages.verifiers.notification.message(CONFLUENCE_SCOPE, 'Confluence'),
|
|
32
|
+
reference: text_1.messages.verifiers.notification.reference,
|
|
33
|
+
line,
|
|
34
|
+
column,
|
|
35
|
+
metadata: {
|
|
36
|
+
missingPermission: CONFLUENCE_SCOPE
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return rules;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.NotificationVerifier = NotificationVerifier;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/visitors/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/visitors/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC"}
|
|
@@ -6,3 +6,4 @@ tslib_1.__exportStar(require("./image-url-visitor"), exports);
|
|
|
6
6
|
tslib_1.__exportStar(require("./product-node-visitor"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./storage-api-node-visitor"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./ui-hook-node-visitor"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./notification-api-visitor"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TSESTree } from '@typescript-eslint/typescript-estree';
|
|
2
|
+
import { NodeVisitor } from '../../node-visitor-interface';
|
|
3
|
+
import { ApiCall } from '../api-call-interface';
|
|
4
|
+
export declare class NotificationAPINodeVisitor implements NodeVisitor<ApiCall> {
|
|
5
|
+
visit(node: TSESTree.Node, _parent: TSESTree.Node | undefined, callback: (apiCall: ApiCall) => void): void;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=notification-api-visitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-api-visitor.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/permission-linter/visitors/notification-api-visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAqC,MAAM,uBAAuB,CAAC;AAKnF,qBAAa,0BAA2B,YAAW,WAAW,CAAC,OAAO,CAAC;IAC9D,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;CAelH"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationAPINodeVisitor = void 0;
|
|
4
|
+
const typescript_estree_1 = require("@typescript-eslint/typescript-estree");
|
|
5
|
+
const api_call_interface_1 = require("../api-call-interface");
|
|
6
|
+
class NotificationAPINodeVisitor {
|
|
7
|
+
visit(node, _parent, callback) {
|
|
8
|
+
if (node.type === typescript_estree_1.AST_NODE_TYPES.ImportDeclaration) {
|
|
9
|
+
node.specifiers.forEach((specifier) => {
|
|
10
|
+
if (specifier.type === typescript_estree_1.AST_NODE_TYPES.ImportSpecifier && specifier.local.type === typescript_estree_1.AST_NODE_TYPES.Identifier) {
|
|
11
|
+
if (specifier.loc && specifier.local.name === 'NotificationApi') {
|
|
12
|
+
const notificationApiCall = {
|
|
13
|
+
type: api_call_interface_1.ApiCallTypes.NOTIFICATION,
|
|
14
|
+
...specifier.loc.start
|
|
15
|
+
};
|
|
16
|
+
callback(notificationApiCall);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.NotificationAPINodeVisitor = NotificationAPINodeVisitor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/lint/text/messages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;;2BAGA,MAAM;;;;2BAKN,MAAM;2BAER,MAAM;;;;2BAKJ,MAAM;;;;iCAKA,MAAM;;;;iCAKN,MAAM;;;;8BAKT,MAAM,OAAO,MAAM;;;;+BAKlB,MAAM,UAAU,MAAM,QAAQ,MAAM,GAAG,SAAS,SAAS,MAAM;;;;6BAKjE,MAAM;;;;+BAIJ,MAAM,QAAQ,MAAM,SAAS,MAAM;;;;8BAKpC,MAAM;;;;8BAIN,MAAM;;;;8BAIN,MAAM;;;;;;;;;oCASF,MAAM;;;;;
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/lint/text/messages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;;2BAGA,MAAM;;;;2BAKN,MAAM;2BAER,MAAM;;;;2BAKJ,MAAM;;;;iCAKA,MAAM;;;;iCAKN,MAAM;;;;8BAKT,MAAM,OAAO,MAAM;;;;+BAKlB,MAAM,UAAU,MAAM,QAAQ,MAAM,GAAG,SAAS,SAAS,MAAM;;;;6BAKjE,MAAM;;;;+BAIJ,MAAM,QAAQ,MAAM,SAAS,MAAM;;;;8BAKpC,MAAM;;;;8BAIN,MAAM;;;;8BAIN,MAAM;;;;;;;;;oCASF,MAAM;;;;;6BAOX,MAAM,WAAW,MAAM;;;;CAK7C,CAAC"}
|
|
@@ -63,6 +63,10 @@ exports.messages = {
|
|
|
63
63
|
},
|
|
64
64
|
reference: 'valid-frame-component-resource-attribute-required'
|
|
65
65
|
}
|
|
66
|
+
},
|
|
67
|
+
notification: {
|
|
68
|
+
message: (scope, product) => `Missing permission ${scope} required for NotificationApi. Only add this if you are building a ${product} app`,
|
|
69
|
+
reference: 'permission-scope-required'
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
72
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/lint",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.15.0-experimental-1ee2de3",
|
|
4
4
|
"description": "Linting for forge apps",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@atlassian/xen-test-util": "^4.2.0",
|
|
14
|
-
"@forge/api": "^7.0.1
|
|
14
|
+
"@forge/api": "^7.0.1",
|
|
15
15
|
"@types/array.prototype.flatmap": "^1.2.6",
|
|
16
16
|
"@types/cross-spawn": "^6.0.6",
|
|
17
17
|
"@types/eslint": "8.56.12",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"eslint-plugin-import": "^2.29.1"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@forge/cli-shared": "8.15.1-
|
|
23
|
-
"@forge/csp": "5.6.1",
|
|
22
|
+
"@forge/cli-shared": "8.15.1-experimental-1ee2de3",
|
|
23
|
+
"@forge/csp": "5.6.1-experimental-1ee2de3",
|
|
24
24
|
"@forge/egress": "2.3.1",
|
|
25
|
-
"@forge/manifest": "12.1.0-
|
|
25
|
+
"@forge/manifest": "12.1.0-experimental-1ee2de3",
|
|
26
26
|
"@typescript-eslint/typescript-estree": "^5.62.0",
|
|
27
27
|
"array.prototype.flatmap": "^1.3.3",
|
|
28
28
|
"@atlassian/atlassian-openapi": "^1.0.6",
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { TSESTree } from '@typescript-eslint/typescript-estree';
|
|
2
|
-
import { LintCriteriaMatch } from '../../linter-interface';
|
|
3
|
-
export declare enum InvokeRemoteTypes {
|
|
4
|
-
DIRECT_CALL = 0,
|
|
5
|
-
MEMBER_CALL = 1,
|
|
6
|
-
IMPORT_LIST = 2
|
|
7
|
-
}
|
|
8
|
-
export declare const INVOKE_REMOTE_PACKAGE_NAME = "@forge/api";
|
|
9
|
-
export declare const INVOKE_REMOTE_FUNCTION_NAME = "invokeRemote";
|
|
10
|
-
export interface InvokeRemoteCallBase extends LintCriteriaMatch {
|
|
11
|
-
remoteKey: string;
|
|
12
|
-
}
|
|
13
|
-
export interface InvokeRemoteDirectCall extends InvokeRemoteCallBase {
|
|
14
|
-
type: InvokeRemoteTypes.DIRECT_CALL;
|
|
15
|
-
calleeName: string;
|
|
16
|
-
}
|
|
17
|
-
export interface InvokeRemoteMemberCall extends InvokeRemoteCallBase {
|
|
18
|
-
type: InvokeRemoteTypes.MEMBER_CALL;
|
|
19
|
-
objectName: string;
|
|
20
|
-
}
|
|
21
|
-
export interface InvokeRemoteImport extends LintCriteriaMatch {
|
|
22
|
-
type: TSESTree.ImportClause['type'];
|
|
23
|
-
alias: string;
|
|
24
|
-
}
|
|
25
|
-
export interface InvokeRemoteImportList extends LintCriteriaMatch {
|
|
26
|
-
type: InvokeRemoteTypes.IMPORT_LIST;
|
|
27
|
-
imports: InvokeRemoteImport[];
|
|
28
|
-
}
|
|
29
|
-
export declare type InvokeRemoteCall = InvokeRemoteDirectCall | InvokeRemoteMemberCall;
|
|
30
|
-
export declare type InvokeRemoteUsage = InvokeRemoteCall | InvokeRemoteImportList;
|
|
31
|
-
export interface InvokeRemoteVerifierInput {
|
|
32
|
-
invokeRemoteCalls: InvokeRemoteCall[];
|
|
33
|
-
imports: InvokeRemoteImport[];
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=invoke-remote-interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invoke-remote-interface.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/remote-linter/invoke-remote-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,oBAAY,iBAAiB;IAC3B,WAAW,IAAA;IACX,WAAW,IAAA;IACX,WAAW,IAAA;CACZ;AAED,eAAO,MAAM,0BAA0B,eAAe,CAAC;AACvD,eAAO,MAAM,2BAA2B,iBAAiB,CAAC;AAE1D,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB;IAClE,IAAI,EAAE,iBAAiB,CAAC,WAAW,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB;IAClE,IAAI,EAAE,iBAAiB,CAAC,WAAW,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D,IAAI,EAAE,iBAAiB,CAAC,WAAW,CAAC;IACpC,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B;AAED,oBAAY,gBAAgB,GAAG,sBAAsB,GAAG,sBAAsB,CAAC;AAE/E,oBAAY,iBAAiB,GAAG,gBAAgB,GAAG,sBAAsB,CAAC;AAE1E,MAAM,WAAW,yBAAyB;IACxC,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INVOKE_REMOTE_FUNCTION_NAME = exports.INVOKE_REMOTE_PACKAGE_NAME = exports.InvokeRemoteTypes = void 0;
|
|
4
|
-
var InvokeRemoteTypes;
|
|
5
|
-
(function (InvokeRemoteTypes) {
|
|
6
|
-
InvokeRemoteTypes[InvokeRemoteTypes["DIRECT_CALL"] = 0] = "DIRECT_CALL";
|
|
7
|
-
InvokeRemoteTypes[InvokeRemoteTypes["MEMBER_CALL"] = 1] = "MEMBER_CALL";
|
|
8
|
-
InvokeRemoteTypes[InvokeRemoteTypes["IMPORT_LIST"] = 2] = "IMPORT_LIST";
|
|
9
|
-
})(InvokeRemoteTypes = exports.InvokeRemoteTypes || (exports.InvokeRemoteTypes = {}));
|
|
10
|
-
exports.INVOKE_REMOTE_PACKAGE_NAME = '@forge/api';
|
|
11
|
-
exports.INVOKE_REMOTE_FUNCTION_NAME = 'invokeRemote';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ManifestSchema as Manifest } from '@forge/manifest';
|
|
2
|
-
import BaseLinter from '../../base-linter';
|
|
3
|
-
import { LintLogger } from '../../linter-interface';
|
|
4
|
-
import { InvokeRemoteUsage, InvokeRemoteVerifierInput } from './invoke-remote-interface';
|
|
5
|
-
interface InvokeRemoteMatches {
|
|
6
|
-
[key: string]: InvokeRemoteVerifierInput;
|
|
7
|
-
invokeRemote: InvokeRemoteVerifierInput;
|
|
8
|
-
}
|
|
9
|
-
export declare class InvokeRemoteLinter extends BaseLinter<InvokeRemoteUsage, InvokeRemoteMatches, InvokeRemoteVerifierInput> {
|
|
10
|
-
private manifest;
|
|
11
|
-
constructor(environment: string, manifest: Manifest, logger: LintLogger);
|
|
12
|
-
bootstrap(): Promise<void>;
|
|
13
|
-
protected addLintCriteriaMatch(usage: InvokeRemoteUsage, filepath: string): void;
|
|
14
|
-
protected setupMatchesMap(filePath: string): void;
|
|
15
|
-
}
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=invoke-remote-linter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invoke-remote-linter.d.ts","sourceRoot":"","sources":["../../../../src/lint/linters/remote-linter/invoke-remote-linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAqB,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAI5G,UAAU,mBAAmB;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,yBAAyB,CAAC;IACzC,YAAY,EAAE,yBAAyB,CAAC;CACzC;AAED,qBAAa,kBAAmB,SAAQ,UAAU,CAAC,iBAAiB,EAAE,mBAAmB,EAAE,yBAAyB,CAAC;IAGjH,OAAO,CAAC,QAAQ;gBADhB,WAAW,EAAE,MAAM,EACX,QAAQ,EAAE,QAAQ,EAC1B,MAAM,EAAE,UAAU;IAKd,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAOhC,SAAS,CAAC,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAUhF,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAQlD"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvokeRemoteLinter = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const base_linter_1 = tslib_1.__importDefault(require("../../base-linter"));
|
|
6
|
-
const invoke_remote_interface_1 = require("./invoke-remote-interface");
|
|
7
|
-
const invoke_remote_verifier_1 = require("./verifiers/invoke-remote-verifier");
|
|
8
|
-
const invoke_remote_call_visitor_1 = require("./visitors/invoke-remote-call-visitor");
|
|
9
|
-
class InvokeRemoteLinter extends base_linter_1.default {
|
|
10
|
-
manifest;
|
|
11
|
-
constructor(environment, manifest, logger) {
|
|
12
|
-
super(environment, logger);
|
|
13
|
-
this.manifest = manifest;
|
|
14
|
-
}
|
|
15
|
-
async bootstrap() {
|
|
16
|
-
this.nodeVisitors = [new invoke_remote_call_visitor_1.InvokeRemoteCallVisitor()];
|
|
17
|
-
this.verifiers = {
|
|
18
|
-
invokeRemote: new invoke_remote_verifier_1.InvokeRemoteVerifier(this.environment, this.manifest)
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
addLintCriteriaMatch(usage, filepath) {
|
|
22
|
-
const criteriaMatches = this.matches.get(filepath);
|
|
23
|
-
if (usage.type === invoke_remote_interface_1.InvokeRemoteTypes.DIRECT_CALL || usage.type === invoke_remote_interface_1.InvokeRemoteTypes.MEMBER_CALL) {
|
|
24
|
-
criteriaMatches.invokeRemote.invokeRemoteCalls.push(usage);
|
|
25
|
-
}
|
|
26
|
-
else if (usage.type === invoke_remote_interface_1.InvokeRemoteTypes.IMPORT_LIST) {
|
|
27
|
-
criteriaMatches.invokeRemote.imports.push(...usage.imports);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
setupMatchesMap(filePath) {
|
|
31
|
-
this.matches.set(filePath, {
|
|
32
|
-
invokeRemote: {
|
|
33
|
-
invokeRemoteCalls: [],
|
|
34
|
-
imports: []
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.InvokeRemoteLinter = InvokeRemoteLinter;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LintClass, LintResultRule } from '../../../linter-interface';
|
|
2
|
-
import { BaseLintIssueVerifier, LintIssueVerifier } from '../../verifier-interface';
|
|
3
|
-
import { InvokeRemoteVerifierInput } from '../invoke-remote-interface';
|
|
4
|
-
export declare class InvokeRemoteVerifier extends BaseLintIssueVerifier implements LintIssueVerifier<InvokeRemoteVerifierInput> {
|
|
5
|
-
protected getLintClass(): LintClass;
|
|
6
|
-
process(input: InvokeRemoteVerifierInput): Promise<LintResultRule[]>;
|
|
7
|
-
private isValidCall;
|
|
8
|
-
private getRemoteForCall;
|
|
9
|
-
private isRemoteKeyValid;
|
|
10
|
-
private hasComputeOperation;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=invoke-remote-verifier.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invoke-remote-verifier.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/remote-linter/verifiers/invoke-remote-verifier.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAIL,yBAAyB,EAC1B,MAAM,4BAA4B,CAAC;AAEpC,qBAAa,oBACX,SAAQ,qBACR,YAAW,iBAAiB,CAAC,yBAAyB,CAAC;IAEvD,SAAS,CAAC,YAAY,IAAI,SAAS;IAItB,OAAO,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAuBjF,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,mBAAmB;CAK5B"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { TSESTree } from '@typescript-eslint/typescript-estree';
|
|
2
|
-
import { NodeVisitor } from '../../node-visitor-interface';
|
|
3
|
-
import { InvokeRemoteUsage } from '../invoke-remote-interface';
|
|
4
|
-
export declare class InvokeRemoteCallVisitor implements NodeVisitor<InvokeRemoteUsage> {
|
|
5
|
-
visit(node: TSESTree.Node, parent: TSESTree.Node | undefined, callback: (fetchCall: InvokeRemoteUsage) => void): void;
|
|
6
|
-
private remoteKeyCanBeChecked;
|
|
7
|
-
private transformArgsToInvokeRemoteCall;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=invoke-remote-call-visitor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invoke-remote-call-visitor.d.ts","sourceRoot":"","sources":["../../../../../src/lint/linters/remote-linter/visitors/invoke-remote-call-visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAOL,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AAEpC,qBAAa,uBAAwB,YAAW,WAAW,CAAC,iBAAiB,CAAC;IACrE,KAAK,CACV,IAAI,EAAE,QAAQ,CAAC,IAAI,EACnB,MAAM,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,EACjC,QAAQ,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,GAC/C,IAAI;IA0FP,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,+BAA+B,CAIpC;CACJ"}
|