@forge/manifest 10.0.1-next.7-experimental-effab31 → 10.1.0-next.8

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,24 +1,10 @@
1
1
  # @forge/manifest
2
2
 
3
- ## 10.0.1-next.7-experimental-effab31
3
+ ## 10.1.0-next.8
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - effab31: Bumped cheerio from 0.22 to 1.1
8
-
9
- ### Patch Changes
10
-
11
- - 5d07fbf: Update the default value for inScopeEUD of egress entries by the linter
12
- - 4b15e26: Rename some Confluence events from 'removed' to 'deleted' events for consistency with other products. Neither of the renamed events are active yet.
13
- - 634d7b9: Bump max resource limit from 10 to 50
14
- - b9574d4: Limit number of automation actions per app
15
- - 195411c: patch dependencies
16
- - d97a252: Add new Forge events and update scopes for unreleased Forge events
17
- - 1479d2d: Update manifest definitions
18
- - ca7e661: Update manifest definitions
19
- - 5ab2c49: Update manifest definitions
20
- - Updated dependencies [195411c]
21
- - @forge/i18n@0.0.7-next.0-experimental-effab31
7
+ - 46daa27: Added support for default environment variable declaration in the manifest
22
8
 
23
9
  ## 10.0.1-next.7
24
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"environment-variable-interpolator.d.ts","sourceRoot":"","sources":["../../src/interpolator/environment-variable-interpolator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,qBAAa,oCAAqC,SAAQ,yBAAyB;gBACrE,OAAO,EAAE,MAAM;CAI5B;AAKD,qBAAa,+BAAgC,YAAW,oBAAoB;IAS9D,OAAO,CAAC,QAAQ,CAAC,aAAa;IAR1C,IAAI,EAAE,gBAAgB,CAAyC;IAI/D,6BAA6B,SAAqC;IAElE,OAAO,CAAC,gBAAgB,CAAW;gBAEN,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAM;IAInF,WAAW,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,cAAc;IAKjE,OAAO,CAAC,0BAA0B,CAkBhC;CACH"}
1
+ {"version":3,"file":"environment-variable-interpolator.d.ts","sourceRoot":"","sources":["../../src/interpolator/environment-variable-interpolator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,qBAAa,oCAAqC,SAAQ,yBAAyB;gBACrE,OAAO,EAAE,MAAM;CAI5B;AAUD,qBAAa,+BAAgC,YAAW,oBAAoB;IAS9D,OAAO,CAAC,QAAQ,CAAC,aAAa;IAR1C,IAAI,EAAE,gBAAgB,CAAyC;IAI/D,6BAA6B,SAAqC;IAElE,OAAO,CAAC,gBAAgB,CAAsB;gBAEjB,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAM;IAInF,WAAW,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,cAAc;IAmBjE,OAAO,CAAC,0BAA0B,CAoBhC;CACH"}
@@ -23,7 +23,22 @@ class EnvironmentVariableInterpolator {
23
23
  this.envVarsToReplace = [];
24
24
  }
25
25
  interpolate({ manifest }) {
26
- this.envVarsToReplace = manifest.environment?.variables ?? [];
26
+ this.envVarsToReplace = [];
27
+ if (manifest.environment && manifest.environment.variables) {
28
+ this.envVarsToReplace = manifest.environment.variables.map((manifestEnvVar) => {
29
+ if (typeof manifestEnvVar === 'string') {
30
+ return {
31
+ key: manifestEnvVar
32
+ };
33
+ }
34
+ else {
35
+ return {
36
+ key: manifestEnvVar.key,
37
+ default: manifestEnvVar.default
38
+ };
39
+ }
40
+ });
41
+ }
27
42
  return (0, yaml_1.parse)(JSON.stringify(manifest), this.environmentVariableReviver);
28
43
  }
29
44
  environmentVariableReviver = (_, value) => {
@@ -31,10 +46,11 @@ class EnvironmentVariableInterpolator {
31
46
  return value;
32
47
  }
33
48
  value = value.replace(this.POSSIBLE_ENVIRONMENT_VARIABLE, (original, envVarName) => {
34
- if (!this.envVarsToReplace.includes(envVarName)) {
49
+ const envVarToReplace = this.envVarsToReplace.find((envVar) => envVar.key === envVarName);
50
+ if (!envVarToReplace) {
35
51
  return original;
36
52
  }
37
- const envVar = this.envVarsRecord[envVarName];
53
+ const envVar = this.envVarsRecord[envVarName] ?? envVarToReplace.default;
38
54
  if (envVar === undefined) {
39
55
  throw new EnvironmentVariableInterpolatorError(text_1.errors.schema.missingEnvironmentVariable(envVarName));
40
56
  }
@@ -27676,8 +27676,16 @@
27676
27676
  "title": "variables",
27677
27677
  "description": "Manifest environment variables",
27678
27678
  "items": {
27679
- "type": "string",
27680
- "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$"
27679
+ "oneOf": [
27680
+ {
27681
+ "$ref": "#/definitions/EnvVarString",
27682
+ "title": "EnvVarString"
27683
+ },
27684
+ {
27685
+ "$ref": "#/definitions/EnvVarObject",
27686
+ "title": "EnvVarObject"
27687
+ }
27688
+ ]
27681
27689
  }
27682
27690
  }
27683
27691
  }
@@ -27835,6 +27843,28 @@
27835
27843
  }
27836
27844
  }
27837
27845
  },
27846
+ "EnvVarString": {
27847
+ "type": "string",
27848
+ "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$",
27849
+ "description": "An environment variable name, which can be used in the manifest"
27850
+ },
27851
+ "EnvVarObject": {
27852
+ "type": "object",
27853
+ "additionalProperties": false,
27854
+ "required": [
27855
+ "key", "default"
27856
+ ],
27857
+ "properties": {
27858
+ "key": {
27859
+ "$ref": "#/definitions/EnvVarString",
27860
+ "description": "The name of the environment variable"
27861
+ },
27862
+ "default": {
27863
+ "type": "string",
27864
+ "description": "The default value of the environment variable"
27865
+ }
27866
+ }
27867
+ },
27838
27868
  "AuthProviderPredefined": {
27839
27869
  "type": "object",
27840
27870
  "additionalProperties": false,
@@ -721,10 +721,14 @@ export type OAuth2ScopeName = string;
721
721
  * External authentication providers
722
722
  */
723
723
  export type Auth = (AuthProviderCustom | AuthProviderPredefined)[];
724
+ /**
725
+ * An environment variable name, which can be used in the manifest
726
+ */
727
+ export type EnvVarString = string;
724
728
  /**
725
729
  * Manifest environment variables
726
730
  */
727
- export type Variables = string[];
731
+ export type Variables = (EnvVarString | EnvVarObject)[];
728
732
  export type TranslationsResources = [
729
733
  {
730
734
  key: ForgeSupportedLocaleCode;
@@ -72678,6 +72682,16 @@ export interface AuthProviderPredefined {
72678
72682
  export interface Environment {
72679
72683
  variables?: Variables;
72680
72684
  }
72685
+ export interface EnvVarObject {
72686
+ /**
72687
+ * The name of the environment variable
72688
+ */
72689
+ key: string;
72690
+ /**
72691
+ * The default value of the environment variable
72692
+ */
72693
+ default: string;
72694
+ }
72681
72695
  export interface Translations {
72682
72696
  resources: TranslationsResources;
72683
72697
  fallback: TranslationsFallback;
@@ -4,7 +4,7 @@ exports.ResourcesValidator = exports.MAX_RESOURCE_COUNT = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const fs_1 = tslib_1.__importDefault(require("fs"));
6
6
  const path_1 = require("path");
7
- const cheerio_1 = require("cheerio");
7
+ const cheerio_1 = tslib_1.__importDefault(require("cheerio"));
8
8
  const utils_1 = require("../utils");
9
9
  const text_1 = require("../text");
10
10
  const utils_2 = require("../utils");
@@ -88,7 +88,7 @@ class ResourcesValidator {
88
88
  return;
89
89
  if (fs_1.default.existsSync((0, path_1.resolve)(manifestDir, path, 'index.html'))) {
90
90
  const content = fs_1.default.readFileSync((0, path_1.resolve)(manifestDir, path, 'index.html'));
91
- const $ = (0, cheerio_1.load)(content, { xml: { xmlMode: false } });
91
+ const $ = cheerio_1.default.load(content);
92
92
  const cspContent = $('meta[http-equiv="Content-Security-Policy"]').attr('content');
93
93
  if (cspContent) {
94
94
  const cspStyleSrc = cspContent.split(';').find((s) => s.startsWith('style-src'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/manifest",
3
- "version": "10.0.1-next.7-experimental-effab31",
3
+ "version": "10.1.0-next.8",
4
4
  "description": "Definitions and validations of the Forge manifest",
5
5
  "main": "out/index.js",
6
6
  "scripts": {
@@ -24,11 +24,11 @@
24
24
  "author": "Atlassian",
25
25
  "license": "SEE LICENSE IN LICENSE.txt",
26
26
  "dependencies": {
27
- "@forge/i18n": "0.0.7-next.0-experimental-effab31",
27
+ "@forge/i18n": "0.0.7-next.0",
28
28
  "@sentry/node": "7.106.0",
29
29
  "ajv": "^8.12.0",
30
30
  "ajv-formats": "2.1.1",
31
- "cheerio": "^1.1.0",
31
+ "cheerio": "^0.22.0",
32
32
  "glob": "^10.3.10",
33
33
  "lodash": "^4.17.21",
34
34
  "mime-types": "^2.1.35",