@forge/lint 5.14.1-next.6 → 5.15.0-next.8

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.
Files changed (25) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/out/lint/lint.js +2 -2
  3. package/out/lint/linters/endpoint-linter/invoke-endpoint-interface.d.ts +35 -0
  4. package/out/lint/linters/endpoint-linter/invoke-endpoint-interface.d.ts.map +1 -0
  5. package/out/lint/linters/endpoint-linter/invoke-endpoint-interface.js +11 -0
  6. package/out/lint/linters/endpoint-linter/invoke-endpoint-linter.d.ts +17 -0
  7. package/out/lint/linters/endpoint-linter/invoke-endpoint-linter.d.ts.map +1 -0
  8. package/out/lint/linters/endpoint-linter/invoke-endpoint-linter.js +39 -0
  9. package/out/lint/linters/endpoint-linter/verifiers/invoke-endpoint-verifier.d.ts +12 -0
  10. package/out/lint/linters/endpoint-linter/verifiers/invoke-endpoint-verifier.d.ts.map +1 -0
  11. package/out/lint/linters/{remote-linter/verifiers/invoke-remote-verifier.js → endpoint-linter/verifiers/invoke-endpoint-verifier.js} +12 -12
  12. package/out/lint/linters/endpoint-linter/visitors/invoke-endpoint-call-visitor.d.ts +9 -0
  13. package/out/lint/linters/endpoint-linter/visitors/invoke-endpoint-call-visitor.d.ts.map +1 -0
  14. package/out/lint/linters/{remote-linter/visitors/invoke-remote-call-visitor.js → endpoint-linter/visitors/invoke-endpoint-call-visitor.js} +28 -28
  15. package/package.json +3 -3
  16. package/out/lint/linters/remote-linter/invoke-remote-interface.d.ts +0 -35
  17. package/out/lint/linters/remote-linter/invoke-remote-interface.d.ts.map +0 -1
  18. package/out/lint/linters/remote-linter/invoke-remote-interface.js +0 -11
  19. package/out/lint/linters/remote-linter/invoke-remote-linter.d.ts +0 -17
  20. package/out/lint/linters/remote-linter/invoke-remote-linter.d.ts.map +0 -1
  21. package/out/lint/linters/remote-linter/invoke-remote-linter.js +0 -39
  22. package/out/lint/linters/remote-linter/verifiers/invoke-remote-verifier.d.ts +0 -12
  23. package/out/lint/linters/remote-linter/verifiers/invoke-remote-verifier.d.ts.map +0 -1
  24. package/out/lint/linters/remote-linter/visitors/invoke-remote-call-visitor.d.ts +0 -9
  25. package/out/lint/linters/remote-linter/visitors/invoke-remote-call-visitor.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @forge/lint
2
2
 
3
+ ## 5.15.0-next.8
4
+
5
+ ### Minor Changes
6
+
7
+ - 62086be: Modified Forge CLI linter to detect for usage of Forge NotificationApi
8
+
9
+ ### Patch Changes
10
+
11
+ - d6c8528: Rename remote linter to endpoint in preparation for adding invokeService linter
12
+
13
+ ## 5.14.1-next.7
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [6247657]
18
+ - @forge/manifest@12.1.0-next.4
19
+ - @forge/cli-shared@8.15.1-next.7
20
+
3
21
  ## 5.14.1-next.6
4
22
 
5
23
  ### 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 invoke_remote_linter_1 = require("./linters/remote-linter/invoke-remote-linter");
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 invoke_remote_linter_1.InvokeRemoteLinter(environment, manifest, logger),
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.InvokeRemoteVerifier = void 0;
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 invoke_remote_interface_1 = require("../invoke-remote-interface");
9
- class InvokeRemoteVerifier extends verifier_interface_1.BaseLintIssueVerifier {
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.invokeRemoteCalls.filter((call) => this.isValidCall(call, input.imports));
15
- const missingRemotes = validCalls
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 [...missingRemotes, ...missingComputeOperation].map(({ call, message }) => ({
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.remoteKey),
25
+ message: message.message(call.endpointKey),
26
26
  reference: message.reference
27
27
  }));
28
28
  }
29
29
  isValidCall(call, imports) {
30
- if (call.type === invoke_remote_interface_1.InvokeRemoteTypes.DIRECT_CALL) {
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.remoteKey);
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 remote = this.getRemoteForCall(call);
45
- return remote?.operations?.includes('compute') ?? false;
44
+ const endpoint = this.getRemoteForCall(call);
45
+ return endpoint?.operations?.includes('compute') ?? false;
46
46
  }
47
47
  }
48
- exports.InvokeRemoteVerifier = InvokeRemoteVerifier;
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.InvokeRemoteCallVisitor = void 0;
3
+ exports.InvokeEndpointCallVisitor = void 0;
4
4
  const typescript_estree_1 = require("@typescript-eslint/typescript-estree");
5
- const invoke_remote_interface_1 = require("../invoke-remote-interface");
6
- class InvokeRemoteCallVisitor {
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 === invoke_remote_interface_1.INVOKE_REMOTE_PACKAGE_NAME) {
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 === invoke_remote_interface_1.INVOKE_REMOTE_FUNCTION_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: invoke_remote_interface_1.InvokeRemoteTypes.IMPORT_LIST,
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 [remoteKeyNode] = node.arguments;
33
- if (this.remoteKeyCanBeChecked(remoteKeyNode)) {
34
- const invokeRemoteCall = {
35
- ...this.transformArgsToInvokeRemoteCall(remoteKeyNode),
36
- type: invoke_remote_interface_1.InvokeRemoteTypes.DIRECT_CALL,
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(invokeRemoteCall);
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 === invoke_remote_interface_1.INVOKE_REMOTE_FUNCTION_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 [remoteKeyNode] = parent.arguments;
49
- if (this.remoteKeyCanBeChecked(remoteKeyNode)) {
50
- const invokeRemoteMemberCall = {
51
- ...this.transformArgsToInvokeRemoteCall(remoteKeyNode),
52
- type: invoke_remote_interface_1.InvokeRemoteTypes.MEMBER_CALL,
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(invokeRemoteMemberCall);
55
+ callback(invokeEndpointMemberCall);
56
56
  }
57
57
  }
58
58
  break;
59
59
  }
60
60
  }
61
- remoteKeyCanBeChecked(remoteKeyNode) {
62
- return (remoteKeyNode?.type === typescript_estree_1.AST_NODE_TYPES.Literal &&
63
- typeof remoteKeyNode?.value === 'string' &&
64
- remoteKeyNode.value.trim() !== '');
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
- transformArgsToInvokeRemoteCall = (remoteKeyNode) => ({
67
- remoteKey: remoteKeyNode.value,
68
- line: remoteKeyNode.loc.start.line,
69
- column: remoteKeyNode.loc.start.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.InvokeRemoteCallVisitor = InvokeRemoteCallVisitor;
72
+ exports.InvokeEndpointCallVisitor = InvokeEndpointCallVisitor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/lint",
3
- "version": "5.14.1-next.6",
3
+ "version": "5.15.0-next.8",
4
4
  "description": "Linting for forge apps",
5
5
  "main": "out/index.js",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
@@ -19,10 +19,10 @@
19
19
  "eslint-plugin-import": "^2.29.1"
20
20
  },
21
21
  "dependencies": {
22
- "@forge/cli-shared": "8.15.1-next.6",
22
+ "@forge/cli-shared": "8.15.1-next.7",
23
23
  "@forge/csp": "5.6.1",
24
24
  "@forge/egress": "2.3.1",
25
- "@forge/manifest": "12.1.0-next.3",
25
+ "@forge/manifest": "12.1.0-next.4",
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"}