@forge/manifest 13.7.0-next.0 → 13.7.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @forge/manifest
2
2
 
3
+ ## 13.7.0-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - e17be5e: Add validation linting for dashboard modules
8
+
3
9
  ## 13.7.0-next.0
4
10
 
5
11
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"modules-validator.d.ts","sourceRoot":"","sources":["../../src/validators/modules-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,cAAc,EAAE,wBAAwB,EAAsC,MAAM,UAAU,CAAC;AAWxH,OAAO,EAEL,cAAc,EAMf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AA4B3D,qBAAa,gBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAGzF,OAAO,CAAC,oBAAoB,CAAsE;IAE5F,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;IAwEpD,OAAO,CAAC,uBAAuB;IAO/B,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,4BAA4B;IAapC,OAAO,CAAC,uBAAuB;IAe/B,OAAO,CAAC,uBAAuB;IAiB/B,OAAO,CAAC,4BAA4B;IA0BpC,OAAO,CAAC,mBAAmB;IA2E3B,OAAO,CAAC,4BAA4B;IA2BpC,OAAO,CAAC,yBAAyB;CAoClC"}
1
+ {"version":3,"file":"modules-validator.d.ts","sourceRoot":"","sources":["../../src/validators/modules-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,cAAc,EAAE,wBAAwB,EAAsC,MAAM,UAAU,CAAC;AAWxH,OAAO,EAEL,cAAc,EAMf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AA6B3D,qBAAa,gBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAGzF,OAAO,CAAC,oBAAoB,CAAsE;IAE5F,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;IAyEpD,OAAO,CAAC,uBAAuB;IAO/B,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,4BAA4B;IAapC,OAAO,CAAC,uBAAuB;IAe/B,OAAO,CAAC,uBAAuB;IAiB/B,OAAO,CAAC,4BAA4B;IA0BpC,OAAO,CAAC,mBAAmB;IA2E3B,OAAO,CAAC,4BAA4B;IA2BpC,OAAO,CAAC,yBAAyB;CAoClC"}
@@ -27,6 +27,7 @@ const automation_1 = require("./modules-validators/automation");
27
27
  const graph_1 = require("./modules-validators/graph");
28
28
  const validate_global_ui_1 = require("./modules-validators/global/validate-global-ui");
29
29
  const validate_global_full_page_1 = require("./modules-validators/global/validate-global-full-page");
30
+ const dashboards_1 = require("./modules-validators/dashboards");
30
31
  class ModulesValidator {
31
32
  functionHandlerRegex = /^([\p{Alpha}\d_-]+(?:\/[\p{Alpha}\d_-]+)*)\.([\p{Alpha}\d_-]+)$/u;
32
33
  async validate(manifest) {
@@ -39,7 +40,7 @@ class ModulesValidator {
39
40
  let validationErrors = [...this.connectModuleValidation(manifest)];
40
41
  if (manifest.typedContent.modules) {
41
42
  const { typedContent: { modules, connectModules, remotes, permissions, services, providers }, yamlContentByLine, filePath } = manifest;
42
- validationErrors = validationErrors.concat(this.checkUnsupportedModules(manifest.typedContent.modules, yamlContentByLine), this.functionKeyLength(modules, yamlContentByLine), this.minimumModuleCountValidation(modules, yamlContentByLine), this.functionKeyDefinedValidation(modules, yamlContentByLine), this.endpointValidations(modules, yamlContentByLine, remotes, permissions?.scopes || [], services), this.duplicateModuleKeyValidation(modules, connectModules || {}, yamlContentByLine), this.functionHandlerValidation(modules, yamlContentByLine, filePath, (0, utils_1.getHandlersDirectory)(manifest.typedContent)), (0, validate_workflow_1.validateJiraWorkflowValidator)(modules, yamlContentByLine), (0, validate_workflow_1.validateJiraWorkflowCondition)(modules, yamlContentByLine), (0, ui_modifications_1.validateUiModificationsModule)(modules, yamlContentByLine), (0, validate_full_admin_page_1.validateJiraFullAdminPage)(modules, yamlContentByLine), (0, validate_full_page_1.validateJiraFullPage)(modules, yamlContentByLine), (0, validate_full_page_module_1.validateJiraFullPageModule)(modules, yamlContentByLine), (0, validate_custom_field_1.validateJiraCustomField)(modules, yamlContentByLine), (0, confluence_1.validateConfluenceModules)(modules, yamlContentByLine), (0, bitbucket_1.validateBitbucketModules)(modules, yamlContentByLine), (0, validate_trigger_1.validateJiraTriggers)(modules, yamlContentByLine), (0, remote_1.validateRemoteModules)(modules, yamlContentByLine), (0, dataResidency_1.validateMigrationDataResidencyModule)(modules, remotes, yamlContentByLine), (0, validateModuleScopes_1.validateModuleScopes)(modules, yamlContentByLine, permissions), (0, rovo_1.validateRovoModules)(modules, (0, path_1.dirname)(filePath), yamlContentByLine), (0, automation_1.validateAutomationModules)(modules, yamlContentByLine), (0, validate_timetrackingprovider_module_1.validateJiraTimeTrackingModule)(modules, yamlContentByLine), (0, validate_command_1.validateJiraCommandModule)(modules, yamlContentByLine), (0, validate_action_validator_1.validateJiraActionValidator)(modules, yamlContentByLine), (0, validate_global_background_script_1.validateJiraGlobalBackgroundScript)(modules, yamlContentByLine), (0, graph_1.validateGraphModules)(modules, providers, yamlContentByLine), (0, validate_global_ui_1.validateGlobalUi)(modules, yamlContentByLine), (0, validate_global_full_page_1.validateGlobalFullPage)(modules, yamlContentByLine));
43
+ validationErrors = validationErrors.concat(this.checkUnsupportedModules(manifest.typedContent.modules, yamlContentByLine), this.functionKeyLength(modules, yamlContentByLine), this.minimumModuleCountValidation(modules, yamlContentByLine), this.functionKeyDefinedValidation(modules, yamlContentByLine), this.endpointValidations(modules, yamlContentByLine, remotes, permissions?.scopes || [], services), this.duplicateModuleKeyValidation(modules, connectModules || {}, yamlContentByLine), this.functionHandlerValidation(modules, yamlContentByLine, filePath, (0, utils_1.getHandlersDirectory)(manifest.typedContent)), (0, validate_workflow_1.validateJiraWorkflowValidator)(modules, yamlContentByLine), (0, validate_workflow_1.validateJiraWorkflowCondition)(modules, yamlContentByLine), (0, ui_modifications_1.validateUiModificationsModule)(modules, yamlContentByLine), (0, validate_full_admin_page_1.validateJiraFullAdminPage)(modules, yamlContentByLine), (0, validate_full_page_1.validateJiraFullPage)(modules, yamlContentByLine), (0, validate_full_page_module_1.validateJiraFullPageModule)(modules, yamlContentByLine), (0, validate_custom_field_1.validateJiraCustomField)(modules, yamlContentByLine), (0, confluence_1.validateConfluenceModules)(modules, yamlContentByLine), (0, bitbucket_1.validateBitbucketModules)(modules, yamlContentByLine), (0, validate_trigger_1.validateJiraTriggers)(modules, yamlContentByLine), (0, remote_1.validateRemoteModules)(modules, yamlContentByLine), (0, dataResidency_1.validateMigrationDataResidencyModule)(modules, remotes, yamlContentByLine), (0, validateModuleScopes_1.validateModuleScopes)(modules, yamlContentByLine, permissions), (0, rovo_1.validateRovoModules)(modules, (0, path_1.dirname)(filePath), yamlContentByLine), (0, automation_1.validateAutomationModules)(modules, yamlContentByLine), (0, validate_timetrackingprovider_module_1.validateJiraTimeTrackingModule)(modules, yamlContentByLine), (0, validate_command_1.validateJiraCommandModule)(modules, yamlContentByLine), (0, validate_action_validator_1.validateJiraActionValidator)(modules, yamlContentByLine), (0, validate_global_background_script_1.validateJiraGlobalBackgroundScript)(modules, yamlContentByLine), (0, graph_1.validateGraphModules)(modules, providers, yamlContentByLine), (0, dashboards_1.validateDashboardModules)(modules, yamlContentByLine), (0, validate_global_ui_1.validateGlobalUi)(modules, yamlContentByLine), (0, validate_global_full_page_1.validateGlobalFullPage)(modules, yamlContentByLine));
43
44
  }
44
45
  else {
45
46
  const { typedContent: { connectModules }, yamlContentByLine } = manifest;
@@ -0,0 +1,2 @@
1
+ export { validateDashboardModules } from './validate-dashboard-modules';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/dashboards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateDashboardModules = void 0;
4
+ var validate_dashboard_modules_1 = require("./validate-dashboard-modules");
5
+ Object.defineProperty(exports, "validateDashboardModules", { enumerable: true, get: function () { return validate_dashboard_modules_1.validateDashboardModules; } });
@@ -0,0 +1,4 @@
1
+ import { Modules } from '../../../schema/manifest';
2
+ import { ValidationError } from '../../../types';
3
+ export declare const validateDashboardModules: (modules: Modules, yamlContentByLine?: string[]) => ValidationError[];
4
+ //# sourceMappingURL=validate-dashboard-modules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-dashboard-modules.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/dashboards/validate-dashboard-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAkB,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAyDjE,eAAO,MAAM,wBAAwB,GAAI,SAAS,OAAO,EAAE,oBAAoB,MAAM,EAAE,KAAG,eAAe,EAoBxG,CAAC"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateDashboardModules = void 0;
4
+ const text_1 = require("../../../text");
5
+ const types_1 = require("../../../types");
6
+ const utils_1 = require("../../../utils");
7
+ const DASHBOARD_MODULE_ALLOWED_PROPERTIES = [
8
+ {
9
+ moduleType: types_1.AllModuleTypes.DashboardsWidget,
10
+ allowedProperties: new Set([
11
+ 'key',
12
+ 'title',
13
+ 'description',
14
+ 'thumbnail',
15
+ 'resource',
16
+ 'render',
17
+ 'edit',
18
+ 'resolver',
19
+ 'aiContext'
20
+ ])
21
+ },
22
+ {
23
+ moduleType: types_1.AllModuleTypes.DashboardsFilter,
24
+ allowedProperties: new Set(['key', 'title', 'icon', 'function', 'resource', 'render', 'edit', 'resolver'])
25
+ },
26
+ {
27
+ moduleType: types_1.AllModuleTypes.DashboardsBackgroundScript,
28
+ allowedProperties: new Set(['key', 'resource', 'render', 'resolver'])
29
+ }
30
+ ];
31
+ const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
32
+ const buildAdditionalPropertyError = (moduleType, additionalProperty, moduleKey, yamlContentByLine) => ({
33
+ message: text_1.errors.schemaError(undefined, [moduleType], text_1.errors.schema.additionalProperties(additionalProperty)),
34
+ reference: text_1.References.Modules,
35
+ level: 'error',
36
+ ...(0, utils_1.findPosition)(additionalProperty, yamlContentByLine ?? [], moduleKey)
37
+ });
38
+ const validateAllowedProperties = (moduleType, module, allowedProperties, moduleKey, yamlContentByLine) => Object.keys(module)
39
+ .filter((property) => !allowedProperties.has(property))
40
+ .map((property) => buildAdditionalPropertyError(moduleType, property, moduleKey, yamlContentByLine));
41
+ const validateDashboardModules = (modules, yamlContentByLine) => {
42
+ const validationErrors = [];
43
+ DASHBOARD_MODULE_ALLOWED_PROPERTIES.forEach(({ moduleType, allowedProperties }) => {
44
+ const dashboardModules = modules[moduleType];
45
+ if (!Array.isArray(dashboardModules)) {
46
+ return;
47
+ }
48
+ dashboardModules.filter(isRecord).forEach((module) => {
49
+ const moduleKey = typeof module.key === 'string' ? module.key : undefined;
50
+ validationErrors.push(...validateAllowedProperties(moduleType, module, allowedProperties, moduleKey, yamlContentByLine));
51
+ });
52
+ });
53
+ return validationErrors;
54
+ };
55
+ exports.validateDashboardModules = validateDashboardModules;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/manifest",
3
- "version": "13.7.0-next.0",
3
+ "version": "13.7.0-next.1",
4
4
  "description": "Definitions and validations of the Forge manifest",
5
5
  "main": "out/index.js",
6
6
  "scripts": {