@forge/manifest 3.8.1 → 3.9.0-next.2

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 (27) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/out/schema/manifest-schema.json +2 -22
  3. package/out/schema/manifest.d.ts +4 -8
  4. package/out/text/errors.d.ts +12 -1
  5. package/out/text/errors.d.ts.map +1 -1
  6. package/out/text/errors.js +12 -1
  7. package/out/utils/get-all-modules.d.ts +3 -0
  8. package/out/utils/get-all-modules.d.ts.map +1 -0
  9. package/out/utils/get-all-modules.js +4 -0
  10. package/out/utils/index.d.ts +1 -0
  11. package/out/utils/index.d.ts.map +1 -1
  12. package/out/utils/index.js +1 -0
  13. package/out/validators/modules-validators/confluence/index.d.ts.map +1 -1
  14. package/out/validators/modules-validators/confluence/index.js +6 -0
  15. package/out/validators/modules-validators/confluence/validateCrossModulePropertyUniqueness.d.ts +4 -0
  16. package/out/validators/modules-validators/confluence/validateCrossModulePropertyUniqueness.d.ts.map +1 -0
  17. package/out/validators/modules-validators/confluence/validateCrossModulePropertyUniqueness.js +19 -0
  18. package/out/validators/modules-validators/confluence/validateCustomContentHierarchy.d.ts +4 -0
  19. package/out/validators/modules-validators/confluence/validateCustomContentHierarchy.d.ts.map +1 -0
  20. package/out/validators/modules-validators/confluence/validateCustomContentHierarchy.js +43 -0
  21. package/out/validators/modules-validators/confluence/validateKeyboardShortcuts.d.ts +4 -0
  22. package/out/validators/modules-validators/confluence/validateKeyboardShortcuts.d.ts.map +1 -0
  23. package/out/validators/modules-validators/confluence/validateKeyboardShortcuts.js +102 -0
  24. package/out/validators/modules-validators/confluence/validatePropertyUniqueness.d.ts.map +1 -1
  25. package/out/validators/modules-validators/confluence/validatePropertyUniqueness.js +1 -1
  26. package/out/validators/modules-validators/confluence/validateSingleProperty.d.ts.map +1 -1
  27. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @forge/manifest
2
2
 
3
+ ## 3.9.0-next.2
4
+
5
+ ### Minor Changes
6
+
7
+ - 4285fc36: Added validator for cross-module uniqueness of property values and a validator for keyboard shortcut accelerators.
8
+
9
+ ## 3.9.0-next.1
10
+
11
+ ### Minor Changes
12
+
13
+ - b447be27: CONFDEV-80332 Added validation for Custom Content modules
14
+
15
+ ## 3.8.2-next.0
16
+
17
+ ### Patch Changes
18
+
19
+ - 74e00c86: Update manifest definitions
20
+
3
21
  ## 3.8.1
4
22
 
5
23
  ### Patch Changes
@@ -1402,7 +1402,7 @@
1402
1402
  "type": "string",
1403
1403
  "enum": [
1404
1404
  "read",
1405
- "write",
1405
+ "create",
1406
1406
  "delete"
1407
1407
  ]
1408
1408
  }
@@ -1413,16 +1413,6 @@
1413
1413
  "preventDuplicateTitle": {
1414
1414
  "type": "boolean"
1415
1415
  },
1416
- "breadcrumbs": {
1417
- "type": "array",
1418
- "minItems": 1,
1419
- "uniqueItems": true,
1420
- "items": {
1421
- "type": "string",
1422
- "maxLength": 100,
1423
- "minLength": 1
1424
- }
1425
- },
1426
1416
  "function": {
1427
1417
  "type": "string",
1428
1418
  "minLength": 1,
@@ -1496,7 +1486,7 @@
1496
1486
  "type": "string",
1497
1487
  "enum": [
1498
1488
  "read",
1499
- "write",
1489
+ "create",
1500
1490
  "delete"
1501
1491
  ]
1502
1492
  }
@@ -1507,16 +1497,6 @@
1507
1497
  "preventDuplicateTitle": {
1508
1498
  "type": "boolean"
1509
1499
  },
1510
- "breadcrumbs": {
1511
- "type": "array",
1512
- "minItems": 1,
1513
- "uniqueItems": true,
1514
- "items": {
1515
- "type": "string",
1516
- "maxLength": 100,
1517
- "minLength": 1
1518
- }
1519
- },
1520
1500
  "resolver": {
1521
1501
  "additionalProperties": false,
1522
1502
  "type": "object",
@@ -820,10 +820,9 @@ export interface Modules {
820
820
  bodyType?: 'raw' | 'storage';
821
821
  supportedContainerTypes: [string, ...string[]];
822
822
  supportedChildTypes?: [string, ...string[]];
823
- supportedSpacePermissions?: ['read' | 'write' | 'delete', ...('read' | 'write' | 'delete')[]];
823
+ supportedSpacePermissions?: ['read' | 'create' | 'delete', ...('read' | 'create' | 'delete')[]];
824
824
  indexing?: boolean;
825
825
  preventDuplicateTitle?: boolean;
826
- breadcrumbs?: [string, ...string[]];
827
826
  function: string;
828
827
  key: ModuleKeySchema;
829
828
  }
@@ -834,10 +833,9 @@ export interface Modules {
834
833
  bodyType?: 'raw' | 'storage';
835
834
  supportedContainerTypes: [string, ...string[]];
836
835
  supportedChildTypes?: [string, ...string[]];
837
- supportedSpacePermissions?: ['read' | 'write' | 'delete', ...('read' | 'write' | 'delete')[]];
836
+ supportedSpacePermissions?: ['read' | 'create' | 'delete', ...('read' | 'create' | 'delete')[]];
838
837
  indexing?: boolean;
839
838
  preventDuplicateTitle?: boolean;
840
- breadcrumbs?: [string, ...string[]];
841
839
  resolver?: {
842
840
  function: string;
843
841
  };
@@ -854,10 +852,9 @@ export interface Modules {
854
852
  bodyType?: 'raw' | 'storage';
855
853
  supportedContainerTypes: [string, ...string[]];
856
854
  supportedChildTypes?: [string, ...string[]];
857
- supportedSpacePermissions?: ['read' | 'write' | 'delete', ...('read' | 'write' | 'delete')[]];
855
+ supportedSpacePermissions?: ['read' | 'create' | 'delete', ...('read' | 'create' | 'delete')[]];
858
856
  indexing?: boolean;
859
857
  preventDuplicateTitle?: boolean;
860
- breadcrumbs?: [string, ...string[]];
861
858
  function: string;
862
859
  key: ModuleKeySchema;
863
860
  }
@@ -868,10 +865,9 @@ export interface Modules {
868
865
  bodyType?: 'raw' | 'storage';
869
866
  supportedContainerTypes: [string, ...string[]];
870
867
  supportedChildTypes?: [string, ...string[]];
871
- supportedSpacePermissions?: ['read' | 'write' | 'delete', ...('read' | 'write' | 'delete')[]];
868
+ supportedSpacePermissions?: ['read' | 'create' | 'delete', ...('read' | 'create' | 'delete')[]];
872
869
  indexing?: boolean;
873
870
  preventDuplicateTitle?: boolean;
874
- breadcrumbs?: [string, ...string[]];
875
871
  resolver?: {
876
872
  function: string;
877
873
  };
@@ -35,7 +35,18 @@ export declare const errors: {
35
35
  };
36
36
  confluence: {
37
37
  multipleProperty: (property: string, moduleKey: string, keys: string[]) => string;
38
- propertyUniquenessValidator: (property: string, moduleKey: string, keys: string[]) => string;
38
+ propertyUniqueness: (property: string, moduleKey: string, keys: string[]) => string;
39
+ crossModulePropertyUniqueness: (property: string, keys: string[]) => string;
40
+ validateCustomContentHierarchyUnknown: (property: string, moduleKey: string, unknownKey: string) => string;
41
+ validateCustomContentCrossReferenceMissingContainer: (moduleKey: string, referredModuleKey: string) => string;
42
+ validateCustomContentCrossReferenceMissingChild: (moduleKey: string, referredModuleKey: string) => string;
43
+ keyboardShortcuts: {
44
+ emptyAccelerator: () => string;
45
+ spaceAroundAccelerator: (accelerator: string) => string;
46
+ invalidPlusSyntax: (accelerator: string) => string;
47
+ invalidAcceleratorCombination: (accelerator: string) => string;
48
+ invalidKey: (accelerator: string, key: string) => string;
49
+ };
39
50
  };
40
51
  jiraWorkflowValidator: {
41
52
  missingProperty: (key: string) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/text/errors.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM;8BACS,MAAM,KAAG,MAAM;2BACpB,MAAM;yBAEN,MAAM,GAAG,SAAS,QAAQ,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS,KAAG,MAAM;;uBAO3E,MAAM,EAAE,EAAE,GAAG,SAAS,KAAG,MAAM;4BAI1B,MAAM,EAAE,KAAG,MAAM;mCACV,MAAM,SAAS,MAAM,0CAA4B,MAAM;mDAIvC,MAAM,KAAG,MAAM;;;qCAI7B,MAAM,SAAS,MAAM,KAAG,MAAM;4CAEvB,MAAM,SAAS,MAAM,KAAG,MAAM;wCAElC,MAAM,SAAS,MAAM,EAAE,KAAG,MAAM;;;uCAMjC,MAAM,KAAG,MAAM;oCACpB,MAAM;iCAEP,MAAM,KAAG,MAAM;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,18 @@ exports.errors = {
47
47
  },
48
48
  confluence: {
49
49
  multipleProperty: (property, moduleKey, keys) => `There can be only 1 ${moduleKey} module which designates "${property}": true. Modules containing designation: ${keys.join(', ')}`,
50
- propertyUniquenessValidator: (property, moduleKey, keys) => `${property} should be unique across all ${moduleKey} modules. Found duplicates: ${keys.join(', ')}`
50
+ propertyUniqueness: (property, moduleKey, keys) => `${property} should be unique across all ${moduleKey} modules. Found duplicates: ${keys.join(', ')}`,
51
+ crossModulePropertyUniqueness: (property, keys) => `${property} should be unique across all modules. Found duplicates: ${keys.join(', ')}`,
52
+ validateCustomContentHierarchyUnknown: (property, moduleKey, unknownKey) => `${property} of the "${moduleKey}" module refers to unknown key: ${unknownKey}`,
53
+ validateCustomContentCrossReferenceMissingContainer: (moduleKey, referredModuleKey) => `supportedContainerTypes of the "${moduleKey}" module refers to "${referredModuleKey}" module. "${referredModuleKey}" module must include "${moduleKey}" in supportedChildTypes`,
54
+ validateCustomContentCrossReferenceMissingChild: (moduleKey, referredModuleKey) => `supportedChildTypes of the "${moduleKey}" module refers to "${referredModuleKey}" module. "${referredModuleKey}" module must include "${moduleKey}" in supportedContainerTypes`,
55
+ keyboardShortcuts: {
56
+ emptyAccelerator: () => 'Keyboard shortcut accelerator must be defined and not be an empty string.',
57
+ spaceAroundAccelerator: (accelerator) => `Keyboard shortcut accelerator must not have surrounding empty spaces. Accelerator issue found: [${accelerator}]`,
58
+ invalidPlusSyntax: (accelerator) => `Keyboard shortcut accelerator must not be single "+" character or have empty spaces on left or right of "+" character. Accelerator issue found: [${accelerator}]`,
59
+ invalidAcceleratorCombination: (accelerator) => `Keyboard shortcut accelerator combinations must have unique keys when joined with "+". Accelerator issue found: [${accelerator}]`,
60
+ invalidKey: (accelerator, key) => `Keyboard shortcut accelerator key must be a valid named key, i.e. ctrl, command, or a single key. Accelerator issue found: [${accelerator}] with invalid key: [${key}]`
61
+ }
51
62
  },
52
63
  jiraWorkflowValidator: {
53
64
  missingProperty: (key) => `${types_1.AllModuleTypes.JiraWorkflowValidator} module '${key}' must have either a function or expression.`,
@@ -0,0 +1,3 @@
1
+ import { Modules } from '../schema/manifest';
2
+ export declare const getAllModules: (allModules: Modules) => any[];
3
+ //# sourceMappingURL=get-all-modules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-all-modules.d.ts","sourceRoot":"","sources":["../../src/utils/get-all-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,eAAO,MAAM,aAAa,eAAgB,OAAO,KAAG,GAAG,EACqD,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAllModules = void 0;
4
+ exports.getAllModules = (allModules) => Object.keys(allModules).reduce((acc, key) => acc.concat(...allModules[key]), []);
@@ -1,3 +1,4 @@
1
+ export * from './get-all-modules';
1
2
  export * from './line-finder';
2
3
  export * from './module-key-cleaner';
3
4
  export * from './module-references';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./get-all-modules"), exports);
4
5
  tslib_1.__exportStar(require("./line-finder"), exports);
5
6
  tslib_1.__exportStar(require("./module-key-cleaner"), exports);
6
7
  tslib_1.__exportStar(require("./module-references"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/confluence/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAkB,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAQjE,eAAO,MAAM,yBAAyB,YAAa,OAAO,+CAAiC,eAAe,EAkBzG,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/confluence/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAkB,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAYjE,eAAO,MAAM,yBAAyB,YAAa,OAAO,+CAAiC,eAAe,EA8BzG,CAAC"}
@@ -4,9 +4,13 @@ exports.validateConfluenceModules = void 0;
4
4
  const types_1 = require("../../../types");
5
5
  const validateSingleProperty_1 = require("./validateSingleProperty");
6
6
  const validatePropertyUniqueness_1 = require("./validatePropertyUniqueness");
7
+ const validateKeyboardShortcuts_1 = require("./validateKeyboardShortcuts");
8
+ const validateCrossModulePropertyUniqueness_1 = require("./validateCrossModulePropertyUniqueness");
9
+ const validateCustomContentHierarchy_1 = require("./validateCustomContentHierarchy");
7
10
  const ROUTE = 'route';
8
11
  const USE_AS_CONFIG = 'useAsConfig';
9
12
  const USE_AS_GET_STARTED = 'useAsGetStarted';
13
+ const KEYBOARD_SHORTCUT_ACCELERATOR = 'keyboardShortcut.accelerator';
10
14
  exports.validateConfluenceModules = (modules, yamlContentByLine) => {
11
15
  const validationErrors = [];
12
16
  [
@@ -18,5 +22,7 @@ exports.validateConfluenceModules = (modules, yamlContentByLine) => {
18
22
  });
19
23
  validationErrors.push(...validateSingleProperty_1.validateSingleProperty(modules, types_1.AllModuleTypes.ConfluenceGlobalSettings, USE_AS_CONFIG, yamlContentByLine));
20
24
  validationErrors.push(...validateSingleProperty_1.validateSingleProperty(modules, types_1.AllModuleTypes.ConfluenceGlobalSettings, USE_AS_GET_STARTED, yamlContentByLine));
25
+ validationErrors.push(...validateCustomContentHierarchy_1.validateCustomContentHierarchy(modules, types_1.AllModuleTypes.ConfluenceCustomContent, yamlContentByLine));
26
+ validationErrors.push(...validateCrossModulePropertyUniqueness_1.validateCrossModulePropertyUniqueness(modules, KEYBOARD_SHORTCUT_ACCELERATOR, yamlContentByLine), ...validateKeyboardShortcuts_1.validateKeyboardShortcuts(modules, yamlContentByLine));
21
27
  return validationErrors;
22
28
  };
@@ -0,0 +1,4 @@
1
+ import { ValidationError } from '../../../types';
2
+ import { Modules } from '../../../schema/manifest';
3
+ export declare const validateCrossModulePropertyUniqueness: (allModules: Modules, property: string, yamlContentByLine?: string[] | undefined) => ValidationError[];
4
+ //# sourceMappingURL=validateCrossModulePropertyUniqueness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateCrossModulePropertyUniqueness.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/confluence/validateCrossModulePropertyUniqueness.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AASnD,eAAO,MAAM,qCAAqC,eACpC,OAAO,YACT,MAAM,+CAEf,eAAe,EAuBjB,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateCrossModulePropertyUniqueness = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const get_1 = tslib_1.__importDefault(require("lodash/get"));
6
+ const text_1 = require("../../../text");
7
+ const utils_1 = require("../../../utils");
8
+ exports.validateCrossModulePropertyUniqueness = (allModules, property, yamlContentByLine) => {
9
+ var _a;
10
+ const validationErrors = [];
11
+ const modules = utils_1.getAllModules(allModules) || [];
12
+ const allPropertyValues = modules.map((module) => get_1.default(module, property)).filter((propertyValue) => propertyValue);
13
+ const duplicatePropertyValues = allPropertyValues.filter((propertyValue, index, all) => all.indexOf(propertyValue) !== index);
14
+ if (duplicatePropertyValues.length > 0) {
15
+ const allModulesWithDuplicatedPropertyValues = modules.filter((module) => get_1.default(module, property) === duplicatePropertyValues[0]);
16
+ validationErrors.push(Object.assign({ message: text_1.errors.modules.confluence.crossModulePropertyUniqueness(property, duplicatePropertyValues), reference: text_1.References.Modules, level: 'error' }, utils_1.findPosition((_a = allModulesWithDuplicatedPropertyValues === null || allModulesWithDuplicatedPropertyValues === void 0 ? void 0 : allModulesWithDuplicatedPropertyValues[0]) === null || _a === void 0 ? void 0 : _a.key, yamlContentByLine)));
17
+ }
18
+ return validationErrors;
19
+ };
@@ -0,0 +1,4 @@
1
+ import { AllModuleTypes, ValidationError } from '../../../types';
2
+ import { Modules } from '../../../schema/manifest';
3
+ export declare const validateCustomContentHierarchy: (allModules: Modules, moduleType: AllModuleTypes, yamlContentByLine?: string[] | undefined) => ValidationError[];
4
+ //# sourceMappingURL=validateCustomContentHierarchy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateCustomContentHierarchy.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/confluence/validateCustomContentHierarchy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAInD,eAAO,MAAM,8BAA8B,eAC7B,OAAO,cACP,cAAc,+CAEzB,eAAe,EAyDjB,CAAC"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateCustomContentHierarchy = void 0;
4
+ const text_1 = require("../../../text");
5
+ const utils_1 = require("../../../utils");
6
+ const INNER_TYPE_PREFIX = 'this:';
7
+ exports.validateCustomContentHierarchy = (allModules, moduleType, yamlContentByLine) => {
8
+ const validationErrors = [];
9
+ const modules = allModules[moduleType] || [];
10
+ modules.forEach((module) => {
11
+ const supportedContainerTypes = module.supportedContainerTypes || [];
12
+ const supportedChildTypes = module.supportedChildTypes || [];
13
+ [
14
+ {
15
+ propName: 'supportedContainerTypes',
16
+ propInnerValues: supportedContainerTypes.filter((supportedContainerType) => supportedContainerType.startsWith(INNER_TYPE_PREFIX)),
17
+ dependentPropName: 'supportedChildTypes',
18
+ dependentReferenceMissingMessage: text_1.errors.modules.confluence.validateCustomContentCrossReferenceMissingContainer
19
+ },
20
+ {
21
+ propName: 'supportedChildTypes',
22
+ propInnerValues: supportedChildTypes.filter((supportedChildType) => supportedChildType.startsWith(INNER_TYPE_PREFIX)),
23
+ dependentPropName: 'supportedContainerTypes',
24
+ dependentReferenceMissingMessage: text_1.errors.modules.confluence.validateCustomContentCrossReferenceMissingChild
25
+ }
26
+ ].forEach(({ propName, propInnerValues, dependentPropName, dependentReferenceMissingMessage }) => {
27
+ propInnerValues.forEach((value) => {
28
+ const referredModuleName = value.substring(INNER_TYPE_PREFIX.length);
29
+ const referredModule = modules.find((m) => m.key === referredModuleName);
30
+ if (!referredModule) {
31
+ validationErrors.push(Object.assign({ message: text_1.errors.modules.confluence.validateCustomContentHierarchyUnknown(propName, module.key, referredModuleName), reference: text_1.References.Modules, level: 'error' }, utils_1.findPosition(module.key, yamlContentByLine)));
32
+ }
33
+ else {
34
+ const referredModuleDependentPropValues = referredModule[dependentPropName] || [];
35
+ if (!referredModuleDependentPropValues.includes(`${INNER_TYPE_PREFIX}${module.key}`)) {
36
+ validationErrors.push(Object.assign({ message: dependentReferenceMissingMessage(module.key, referredModule.key), reference: text_1.References.Modules, level: 'error' }, utils_1.findPosition(module.key, yamlContentByLine)));
37
+ }
38
+ }
39
+ });
40
+ });
41
+ });
42
+ return validationErrors;
43
+ };
@@ -0,0 +1,4 @@
1
+ import { ValidationError } from '../../../types';
2
+ import { Modules } from '../../../schema/manifest';
3
+ export declare const validateKeyboardShortcuts: (allModules: Modules, yamlContentByLine?: string[] | undefined) => ValidationError[];
4
+ //# sourceMappingURL=validateKeyboardShortcuts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateKeyboardShortcuts.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/confluence/validateKeyboardShortcuts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAgHnD,eAAO,MAAM,yBAAyB,eAAgB,OAAO,+CAAiC,eAAe,EAsB5G,CAAC"}
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateKeyboardShortcuts = void 0;
4
+ const text_1 = require("../../../text");
5
+ const utils_1 = require("../../../utils");
6
+ const VALID_SINGLE_KEY = new RegExp(/^[^+ ]$/);
7
+ const INVALID_COMBINATION_SYNTAX = new RegExp(/(^\+$| \+|\+ )/);
8
+ const VALID_NAMED_KEYS = new Set([
9
+ 'f1',
10
+ 'f2',
11
+ 'f3',
12
+ 'f4',
13
+ 'f5',
14
+ 'f6',
15
+ 'f7',
16
+ 'f8',
17
+ 'f9',
18
+ 'f10',
19
+ 'f11',
20
+ 'f12',
21
+ 'shift',
22
+ 'ctrl',
23
+ 'alt',
24
+ 'option',
25
+ 'meta',
26
+ 'command',
27
+ 'mod',
28
+ 'backspace',
29
+ 'tab',
30
+ 'enter',
31
+ 'return',
32
+ 'capslock',
33
+ 'esc',
34
+ 'escape',
35
+ 'pageup',
36
+ 'pagedown',
37
+ 'end',
38
+ 'home',
39
+ 'left',
40
+ 'up',
41
+ 'right',
42
+ 'down',
43
+ 'ins',
44
+ 'del',
45
+ 'space',
46
+ 'plus'
47
+ ]);
48
+ const isValidKey = (key) => VALID_NAMED_KEYS.has(key) || !!key.match(VALID_SINGLE_KEY);
49
+ const validateShortcut = (moduleKey, accelerator) => {
50
+ const keyboardShortcutErrors = [];
51
+ if (!accelerator || accelerator.trim() === '') {
52
+ keyboardShortcutErrors.push({
53
+ moduleKey,
54
+ message: text_1.errors.modules.confluence.keyboardShortcuts.emptyAccelerator()
55
+ });
56
+ return keyboardShortcutErrors;
57
+ }
58
+ else if (accelerator.startsWith(' ') || accelerator.endsWith(' ')) {
59
+ keyboardShortcutErrors.push({
60
+ moduleKey,
61
+ message: text_1.errors.modules.confluence.keyboardShortcuts.spaceAroundAccelerator(accelerator)
62
+ });
63
+ return keyboardShortcutErrors;
64
+ }
65
+ else if (accelerator.match(INVALID_COMBINATION_SYNTAX)) {
66
+ keyboardShortcutErrors.push({
67
+ moduleKey,
68
+ message: text_1.errors.modules.confluence.keyboardShortcuts.invalidPlusSyntax(accelerator)
69
+ });
70
+ return keyboardShortcutErrors;
71
+ }
72
+ const sequence = accelerator.split(' ');
73
+ for (const combination of sequence) {
74
+ const keys = combination.split('+');
75
+ const uniqueKeys = new Set(keys);
76
+ const allDifferent = keys.length === uniqueKeys.size;
77
+ if (!allDifferent) {
78
+ keyboardShortcutErrors.push({
79
+ moduleKey,
80
+ message: text_1.errors.modules.confluence.keyboardShortcuts.invalidAcceleratorCombination(accelerator)
81
+ });
82
+ }
83
+ for (const key of keys) {
84
+ if (!isValidKey(key)) {
85
+ keyboardShortcutErrors.push({
86
+ moduleKey,
87
+ message: text_1.errors.modules.confluence.keyboardShortcuts.invalidKey(accelerator, key)
88
+ });
89
+ }
90
+ }
91
+ }
92
+ return keyboardShortcutErrors;
93
+ };
94
+ exports.validateKeyboardShortcuts = (allModules, yamlContentByLine) => {
95
+ const validationErrors = [];
96
+ const modules = utils_1.getAllModules(allModules) || [];
97
+ const modulesWithKeyboardShortcut = modules.filter((module) => { var _a; return (_a = module === null || module === void 0 ? void 0 : module.keyboardShortcut) === null || _a === void 0 ? void 0 : _a.accelerator; });
98
+ if (modulesWithKeyboardShortcut.length > 0) {
99
+ modulesWithKeyboardShortcut.forEach((m) => validationErrors.push(...validateShortcut(m.key, m.keyboardShortcut.accelerator).map((e) => (Object.assign({ message: e.message, reference: text_1.References.Modules, level: 'error' }, utils_1.findPosition(e.moduleKey, yamlContentByLine))))));
100
+ }
101
+ return validationErrors;
102
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"validatePropertyUniqueness.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/confluence/validatePropertyUniqueness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD,eAAO,MAAM,0BAA0B,eACzB,OAAO,cACP,cAAc,YAChB,MAAM,+CAEf,eAAe,EAqBjB,CAAC"}
1
+ {"version":3,"file":"validatePropertyUniqueness.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/confluence/validatePropertyUniqueness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAUnD,eAAO,MAAM,0BAA0B,eACzB,OAAO,cACP,cAAc,YAChB,MAAM,+CAEf,eAAe,EAqBjB,CAAC"}
@@ -11,7 +11,7 @@ exports.validatePropertyUniqueness = (allModules, moduleType, property, yamlCont
11
11
  const duplicatePropertyValues = allPropertyValues.filter((property, index, all) => all.indexOf(property) !== index);
12
12
  if (duplicatePropertyValues.length > 0) {
13
13
  const allModulesWithDuplicatedPropertyValues = modules.filter((module) => module[property] === duplicatePropertyValues[0]);
14
- validationErrors.push(Object.assign({ message: text_1.errors.modules.confluence.propertyUniquenessValidator(property, moduleType, duplicatePropertyValues), reference: text_1.References.Modules, level: 'error' }, utils_1.findPosition((_a = allModulesWithDuplicatedPropertyValues === null || allModulesWithDuplicatedPropertyValues === void 0 ? void 0 : allModulesWithDuplicatedPropertyValues[0]) === null || _a === void 0 ? void 0 : _a.key, yamlContentByLine)));
14
+ validationErrors.push(Object.assign({ message: text_1.errors.modules.confluence.propertyUniqueness(property, moduleType, duplicatePropertyValues), reference: text_1.References.Modules, level: 'error' }, utils_1.findPosition((_a = allModulesWithDuplicatedPropertyValues === null || allModulesWithDuplicatedPropertyValues === void 0 ? void 0 : allModulesWithDuplicatedPropertyValues[0]) === null || _a === void 0 ? void 0 : _a.key, yamlContentByLine)));
15
15
  }
16
16
  return validationErrors;
17
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"validateSingleProperty.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/confluence/validateSingleProperty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD,eAAO,MAAM,sBAAsB,eACrB,OAAO,cACP,cAAc,YAChB,MAAM,+CAEf,eAAe,EAgBjB,CAAC"}
1
+ {"version":3,"file":"validateSingleProperty.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/confluence/validateSingleProperty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AASnD,eAAO,MAAM,sBAAsB,eACrB,OAAO,cACP,cAAc,YAChB,MAAM,+CAEf,eAAe,EAgBjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/manifest",
3
- "version": "3.8.1",
3
+ "version": "3.9.0-next.2",
4
4
  "description": "Definitions and validations of the Forge manifest",
5
5
  "main": "out/index.js",
6
6
  "scripts": {
@@ -28,6 +28,7 @@
28
28
  "cheerio": "^0.22.0",
29
29
  "js-yaml": "^3.13.1",
30
30
  "json-schema-to-typescript": "^9.1.1",
31
+ "lodash": "^4.17.20",
31
32
  "node-fetch": "2.6.1",
32
33
  "typescript-json-schema": "^0.45.1"
33
34
  }