npm package diff
Package: @forge/manifest
Versions: 9.3.0-next.3 - 9.3.0-next.4
File: package/out/validators/modules-validator.js
Index: package/out/validators/modules-validator.js
===================================================================
--- package/out/validators/modules-validator.js
+++ package/out/validators/modules-validator.js
@@ -19,8 +19,9 @@
const validate_full_page_1 = require("./modules-validators/jira/validate-full-page");
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 scopes_1 = require("../utils/scopes");
class ModulesValidator {
functionHandlerRegex = /^([\p{Alpha}\d_-]+(?:\/[\p{Alpha}\d_-]+)*)\.([\p{Alpha}\d_-]+)$/u;
async validate(manifest) {
if (!manifest?.typedContent || !manifest.filePath) {
@@ -131,8 +132,9 @@
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) {
@@ -168,9 +170,9 @@
level: 'error',
...(0, utils_1.findPosition)(endpoint.remote, yamlContentByLine)
});
}
- if (endpoint.auth?.appUserToken?.enabled && !scopes.includes(types_1.USER_TOKEN_SCOPE)) {
+ 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',
@@ -179,9 +181,9 @@
},
...(0, utils_1.findPosition)('scopes', yamlContentByLine)
});
}
- if (endpoint.auth?.appSystemToken?.enabled && !scopes.includes(types_1.SYSTEM_TOKEN_SCOPE)) {
+ 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',
@@ -203,9 +205,9 @@
});
}
});
remotes?.forEach((remote) => {
- if (remote.auth?.appUserToken?.enabled && !scopes.includes(types_1.USER_TOKEN_SCOPE)) {
+ 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',
@@ -214,9 +216,9 @@
},
...(0, utils_1.findPosition)('scopes', yamlContentByLine)
});
}
- if (remote.auth?.appSystemToken?.enabled && !scopes.includes(types_1.SYSTEM_TOKEN_SCOPE)) {
+ 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',