@forge/manifest
11.3.3-next.011.4.0-next.1
out/validators/modules-validator.js~
out/validators/modules-validator.jsModified−48
Index: package/out/validators/modules-validator.js
===================================================================
--- package/out/validators/modules-validator.js
+++ package/out/validators/modules-validator.js
@@ -21,9 +21,8 @@
const validate_custom_field_1 = require("./modules-validators/jira/validate-custom-field");
const validate_trigger_1 = require("./modules-validators/jira/validate-trigger");
const validate_command_1 = require("./modules-validators/jira/validate-command");
const validate_action_validator_1 = require("./modules-validators/jira/validate-action-validator");
-const scopes_1 = require("../utils/scopes");
const automation_1 = require("./modules-validators/automation");
class ModulesValidator {
functionHandlerRegex = /^([\p{Alpha}\d_-]+(?:\/[\p{Alpha}\d_-]+)*)\.([\p{Alpha}\d_-]+)$/u;
async validate(manifest) {
@@ -135,9 +134,8 @@
return remotes?.find((remote) => remote.key === remoteKey) !== undefined;
};
const { endpoint: _endpoint } = modules;
const eventModulesWithEndpoint = modules?.trigger?.filter((trigger) => trigger.endpoint != null) || [];
- const scopeKeys = (0, scopes_1.getAllScopeKeys)(scopes);
eventModulesWithEndpoint.forEach((event) => {
const endpointModule = _endpoint?.find((remoteEndpoint) => remoteEndpoint.key === event.endpoint);
if (endpointModule) {
if (endpointModule.auth?.appUserToken?.enabled) {
@@ -173,30 +171,8 @@
level: 'error',
...(0, utils_1.findPosition)(endpoint.remote, yamlContentByLine)
});
}
- if (endpoint.auth?.appUserToken?.enabled && !scopeKeys.includes(types_1.USER_TOKEN_SCOPE)) {
- validationErrors.push({
- message: text_1.errors.permissions.missingEndpointPermissionFromScope(types_1.USER_TOKEN_SCOPE, endpoint.key),
- reference: text_1.References.MissingScopes,
- level: 'error',
- metadata: {
- missingPermission: types_1.USER_TOKEN_SCOPE
- },
- ...(0, utils_1.findPosition)('scopes', yamlContentByLine)
- });
- }
- if (endpoint.auth?.appSystemToken?.enabled && !scopeKeys.includes(types_1.SYSTEM_TOKEN_SCOPE)) {
- validationErrors.push({
- message: text_1.errors.permissions.missingEndpointPermissionFromScope(types_1.SYSTEM_TOKEN_SCOPE, endpoint.key),
- reference: text_1.References.MissingScopes,
- level: 'error',
- metadata: {
- missingPermission: types_1.SYSTEM_TOKEN_SCOPE
- },
- ...(0, utils_1.findPosition)('scopes', yamlContentByLine)
- });
- }
}
else if (isServiceType(endpoint)) {
(0, utils_1.findInvalidServiceReferences)(endpoint, services).forEach((service) => {
validationErrors.push({
@@ -207,32 +183,8 @@
});
});
}
});
- remotes?.forEach((remote) => {
- if (remote.auth?.appUserToken?.enabled && !scopeKeys.includes(types_1.USER_TOKEN_SCOPE)) {
- validationErrors.push({
- message: text_1.errors.permissions.missingRemotePermissionFromScope(types_1.USER_TOKEN_SCOPE, remote.key),
- reference: text_1.References.MissingScopes,
- level: 'error',
- metadata: {
- missingPermission: types_1.USER_TOKEN_SCOPE
- },
- ...(0, utils_1.findPosition)('scopes', yamlContentByLine)
- });
- }
- if (remote.auth?.appSystemToken?.enabled && !scopeKeys.includes(types_1.SYSTEM_TOKEN_SCOPE)) {
- validationErrors.push({
- message: text_1.errors.permissions.missingRemotePermissionFromScope(types_1.SYSTEM_TOKEN_SCOPE, remote.key),
- reference: text_1.References.MissingScopes,
- level: 'error',
- metadata: {
- missingPermission: types_1.SYSTEM_TOKEN_SCOPE
- },
- ...(0, utils_1.findPosition)('scopes', yamlContentByLine)
- });
- }
- });
return validationErrors;
}
duplicateModuleKeyValidation(modules, connectModules, yamlContentByLine) {
const validationErrors = [];