@forge/manifest 13.6.0-next.3 → 13.6.0-next.4

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.6.0-next.4
4
+
5
+ ### Minor Changes
6
+
7
+ - 5932866: Allow `and`/`or`/`not` in `displayConditions` on Jira and JSM modules to be a list of composite conditions, in addition to a single condition object.
8
+
3
9
  ## 13.6.0-next.3
4
10
 
5
11
  ### Minor Changes
@@ -7,7 +7,7 @@ export declare class DisplayConditionsValidator<T> implements ValidatorInterface
7
7
  private readonly moduleSchemas;
8
8
  private readonly supportedOperations;
9
9
  constructor(schema: object);
10
- flattenDisplayConditions(moduleKey: string, displayConditions: any, nesting?: number, location?: string): any;
10
+ flattenDisplayConditions(moduleType: string, moduleKey: string, displayConditions: any, nesting?: number, location?: string): any;
11
11
  toValidationError(message: string): ValidationError;
12
12
  private collectNestedDisplayConditionsTargets;
13
13
  private validateDisplayConditions;
@@ -1 +1 @@
1
- {"version":3,"file":"display-conditions-validator.d.ts","sourceRoot":"","sources":["../../src/validators/display-conditions-validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,cAAc,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGrG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAiBpD,qBAAa,0BAA0B,CAAC,CAAC,CACvC,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAM7E,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAmB;IAClD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAC/C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,C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AAC,yBAAyB;IAuD3B,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;CA4ErD"}
@@ -9,6 +9,7 @@ const isPlainObject = (obj) => Object.prototype.toString.call(obj) === '[object
9
9
  const errors = text_1.errors.modules.displayConditions;
10
10
  const pageLocation = (page, index) => typeof page?.route === 'string' ? `page "${page.route}"` : `page[${index}]`;
11
11
  const sectionLocation = (section, index) => typeof section?.header === 'string' ? `section "${section.header}"` : `section[${index}]`;
12
+ const isJiraOrJsmModuleType = (moduleType) => moduleType.startsWith('jira:') || moduleType.startsWith('jiraServiceManagement:');
12
13
  class DisplayConditionsValidator {
13
14
  schema;
14
15
  validateSchema;
@@ -22,11 +23,14 @@ class DisplayConditionsValidator {
22
23
  this.moduleSchemas = properties.modules?.properties;
23
24
  this.supportedOperations = properties.operations?.items?.enum;
24
25
  }
25
- flattenDisplayConditions(moduleKey, displayConditions, nesting = 0, location) {
26
+ flattenDisplayConditions(moduleType, moduleKey, displayConditions, nesting = 0, location) {
26
27
  if (nesting >= 10) {
27
28
  throw Error(errors.overcomplicated(moduleKey, location));
28
29
  }
29
30
  if (Array.isArray(displayConditions)) {
31
+ if (isJiraOrJsmModuleType(moduleType)) {
32
+ return displayConditions.flatMap((entry) => this.flattenDisplayConditions(moduleType, moduleKey, entry, nesting, location));
33
+ }
30
34
  return [displayConditions];
31
35
  }
32
36
  const result = [];
@@ -34,7 +38,7 @@ class DisplayConditionsValidator {
34
38
  const keys = Object.keys(displayConditions);
35
39
  for (let i = 0; i < keys.length; i += 1) {
36
40
  if (this.supportedOperations.includes(keys[i])) {
37
- result.push(...this.flattenDisplayConditions(moduleKey, displayConditions[keys[i]], nesting + 1, location));
41
+ result.push(...this.flattenDisplayConditions(moduleType, moduleKey, displayConditions[keys[i]], nesting + 1, location));
38
42
  }
39
43
  else {
40
44
  obj[keys[i]] = displayConditions[keys[i]];
@@ -90,7 +94,7 @@ class DisplayConditionsValidator {
90
94
  }
91
95
  let flattened = [];
92
96
  try {
93
- flattened = this.flattenDisplayConditions(moduleKey, displayConditions, 0, location);
97
+ flattened = this.flattenDisplayConditions(moduleType, moduleKey, displayConditions, 0, location);
94
98
  }
95
99
  catch (e) {
96
100
  reportError('n/a', e.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/manifest",
3
- "version": "13.6.0-next.3",
3
+ "version": "13.6.0-next.4",
4
4
  "description": "Definitions and validations of the Forge manifest",
5
5
  "main": "out/index.js",
6
6
  "scripts": {