@forge/manifest 9.3.0-next.3 → 9.3.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
+ ## 9.3.0-next.4
4
+
5
+ ### Minor Changes
6
+
7
+ - 43832a8: Allow scopes to be declared with offline user impersonation support
8
+
3
9
  ## 9.3.0-next.3
4
10
 
5
11
  ### Patch Changes
@@ -26674,12 +26674,29 @@
26674
26674
  "title": "AppPermissionsSchema",
26675
26675
  "properties": {
26676
26676
  "scopes": {
26677
- "items": {
26678
- "type": "string"
26679
- },
26680
26677
  "title": "scopes",
26681
- "type": "array",
26682
- "minItems": 0
26678
+ "oneOf": [
26679
+ {
26680
+ "type": "array",
26681
+ "items": {
26682
+ "type": "string"
26683
+ }
26684
+ },
26685
+ {
26686
+ "description": "This method for declaring scopes is not yet supported",
26687
+ "type": "object",
26688
+ "additionalProperties": {
26689
+ "type": "object",
26690
+ "properties": {
26691
+ "allowImpersonation": {
26692
+ "type": "boolean",
26693
+ "description": "This scope property is not yet supported"
26694
+ }
26695
+ },
26696
+ "additionalProperties": false
26697
+ }
26698
+ }
26699
+ ]
26683
26700
  },
26684
26701
  "content": {
26685
26702
  "additionalProperties": false,
@@ -675,7 +675,16 @@ export type Patterns =
675
675
  * The key of the function that should be invoked on each schedule.
676
676
  */
677
677
  export type Function7 = string;
678
- export type Scopes = string[];
678
+ export type Scopes =
679
+ | string[]
680
+ | {
681
+ [k: string]: {
682
+ /**
683
+ * This scope property is not yet supported
684
+ */
685
+ allowImpersonation?: boolean;
686
+ };
687
+ };
679
688
  export type Scripts = string[];
680
689
  export type Styles = 'unsafe-inline'[];
681
690
  export type Backend = (string | EgressPermission | Remote)[];
@@ -1,8 +1,9 @@
1
+ import { Scopes } from '../schema/manifest';
1
2
  export declare type RequiredScopes = {
2
3
  current: string[];
3
4
  deprecated?: string[];
4
5
  beta?: string[];
5
6
  };
6
- export declare function getMissingScopes(existing: string[] | undefined, required: RequiredScopes): Promise<string[]>;
7
+ export declare function getMissingScopes(existing: Scopes | undefined, required: RequiredScopes): Promise<string[]>;
7
8
  export declare function getScopesWithInteractiveConsent(): Set<string>;
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scopes/index.ts"],"names":[],"mappings":"AAEA,oBAAY,cAAc,GAAG;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAoBlH;AAED,wBAAgB,+BAA+B,IAAI,GAAG,CAAC,MAAM,CAAC,CAE7D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scopes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAI5C,oBAAY,cAAc,GAAG;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAsBhH;AAED,wBAAgB,+BAA+B,IAAI,GAAG,CAAC,MAAM,CAAC,CAE7D"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getScopesWithInteractiveConsent = exports.getMissingScopes = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const scopes_1 = require("../utils/scopes");
5
6
  const shipyard_scopes_with_interactive_consent_json_1 = tslib_1.__importDefault(require("./shipyard-scopes-with-interactive-consent.json"));
6
7
  async function getMissingScopes(existing, required) {
7
8
  if (!existing?.length) {
@@ -9,13 +10,14 @@ async function getMissingScopes(existing, required) {
9
10
  }
10
11
  if (required.current.length === 0)
11
12
  return [];
12
- const missingCurrent = required.current.filter((scope) => !existing?.includes(scope));
13
+ const existingScopeKeys = existing ? (0, scopes_1.getAllScopeKeys)(existing) : undefined;
14
+ const missingCurrent = required.current.filter((scope) => !existingScopeKeys?.includes(scope));
13
15
  if (missingCurrent.length === 0)
14
16
  return [];
15
- const missingBeta = required.beta?.filter((scope) => !existing?.includes(scope));
17
+ const missingBeta = required.beta?.filter((scope) => !existingScopeKeys?.includes(scope));
16
18
  if (required.beta && missingBeta?.length === 0)
17
19
  return [];
18
- const missingDeprecated = required.deprecated?.filter((scope) => !existing?.includes(scope));
20
+ const missingDeprecated = required.deprecated?.filter((scope) => !existingScopeKeys?.includes(scope));
19
21
  if (required.deprecated && missingDeprecated?.length === 0)
20
22
  return [];
21
23
  return missingCurrent;
@@ -25,6 +25,7 @@ export declare const errors: {
25
25
  globalUrlNotRecommended: (element: string) => string;
26
26
  imageUrlNotRecommended: (element: string, value: string) => string;
27
27
  fontAndStylesNotRecommended: (element: string) => string;
28
+ malformedScope: (index: number) => string;
28
29
  };
29
30
  connectModules: {
30
31
  invalidConnectModule: (module: string) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/text/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,eAAO,MAAM,MAAM;8BACS,MAAM,KAAG,MAAM;2BACpB,MAAM;yBAEN,MAAM,GAAG,SAAS,QAAQ,MAAM,EAAE,UAAU,M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,aAAa,MAAM,SAAS,MAAM,KAAG,MAAM;yCAEvD,MAAM,SAAS,MAAM,KAAG,MAAM;4CAE3B,MAAM,SAAS,MAAM,KAAG,MAAM;gDAE1B,MAAM,aAAa,MAAM,KAAG,MAAM;4CAEtC,MAAM,SAAS,MAAM,KAAG,MAAM;;;2CAI7B,MAAM;;;gCAInB,MAAM;;;;;0DAKwB,wBAAwB,KAAG,MAAM;sDAErC,wBAAwB,KAAG,MAAM;kDAErC,wBAAwB,QAAQ,MAAM,KAAG,MAAM;mDAE9C,wBAAwB,KAAG,MAAM;mCAEjD,MAAM,KAAG,MAAM;;oDAEE,MAAM,aAAa,MAAM,KAAG,MAAM;4CAE1C,MAAM,sBAAsB,wBAAwB,YAAY,MAAM;;CAG7G,CAAC;AAEF,oBAAY,UAAU;IACpB,eAAe,2BAA2B;IAC1C,eAAe,wBAAwB;IACvC,WAAW,4BAA4B;IACvC,WAAW,+BAA+B;IAC1C,aAAa,8BAA8B;IAC3C,OAAO,0BAA0B;IACjC,cAAc,kCAAkC;IAChD,SAAS,4BAA4B;IACrC,SAAS,4BAA4B;IACrC,UAAU,wBAAwB;IAClC,GAAG,8BAA8B;IACjC,eAAe,0BAA0B;CAC1C"}
@@ -36,7 +36,8 @@ exports.errors = {
36
36
  deprecatedPermission: (element, value) => `There are deprecated scopes '${element}' in the manifest.yml file: '${value.join(', ')}'. You need to update this app to use new scopes and remove the deprecated scopes. Learn more at: https://go.atlassian.com/forge-permissions.`,
37
37
  globalUrlNotRecommended: (element) => `Global URL usage detected for '${element}' permission in the manifest.yml file. We recommend using a more specific URL.`,
38
38
  imageUrlNotRecommended: (element, value) => `Unnecessary URL detected for '${element}' permission in the manifest.yml file. Your app should not need the URL '${value}' to work properly.`,
39
- fontAndStylesNotRecommended: (element) => `Unnecessary usage of '${element}' permission in the manifest.yml file. You can avoid using this permission by packaging the fonts and styles with your app code.`
39
+ fontAndStylesNotRecommended: (element) => `Unnecessary usage of '${element}' permission in the manifest.yml file. You can avoid using this permission by packaging the fonts and styles with your app code.`,
40
+ malformedScope: (index) => `The scope definition at index '${index}' is malformed. Use either a string with the scope key, or an object with the scope key as the only key`
40
41
  },
41
42
  connectModules: {
42
43
  invalidConnectModule: (module) => `invalid value '${module}' in connectModules`,
@@ -0,0 +1,3 @@
1
+ import { Scopes } from '../schema/manifest';
2
+ export declare const getAllScopeKeys: (scopes: Scopes) => string[];
3
+ //# sourceMappingURL=scopes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../../src/utils/scopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,eAAO,MAAM,eAAe,WAAY,MAAM,KAAG,MAAM,EAA4D,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAllScopeKeys = void 0;
4
+ const getAllScopeKeys = (scopes) => (Array.isArray(scopes) ? scopes : Object.keys(scopes));
5
+ exports.getAllScopeKeys = getAllScopeKeys;
@@ -1 +1 @@
1
- {"version":3,"file":"modules-validator.d.ts","sourceRoot":"","sources":["../../src/validators/modules-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,wBAAwB,EAKzB,MAAM,UAAU,CAAC;AASlB,OAAO,EAAkB,cAAc,EAA+C,MAAM,oBAAoB,CAAC;AACjH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAqB3D,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;IA4DpD,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;IA6H3B,OAAO,CAAC,4BAA4B;IA2BpC,OAAO,CAAC,yBAAyB;CAkClC"}
1
+ {"version":3,"file":"modules-validator.d.ts","sourceRoot":"","sources":["../../src/validators/modules-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,wBAAwB,EAKzB,MAAM,UAAU,CAAC;AASlB,OAAO,EAEL,cAAc,EAMf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAsB3D,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;IA4DpD,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;IA+H3B,OAAO,CAAC,4BAA4B;IA2BpC,OAAO,CAAC,yBAAyB;CAkClC"}
@@ -20,6 +20,7 @@ const validate_full_page_1 = require("./modules-validators/jira/validate-full-pa
20
20
  const validate_custom_field_1 = require("./modules-validators/jira/validate-custom-field");
21
21
  const validate_trigger_1 = require("./modules-validators/jira/validate-trigger");
22
22
  const validate_command_1 = require("./modules-validators/jira/validate-command");
23
+ const scopes_1 = require("../utils/scopes");
23
24
  class ModulesValidator {
24
25
  functionHandlerRegex = /^([\p{Alpha}\d_-]+(?:\/[\p{Alpha}\d_-]+)*)\.([\p{Alpha}\d_-]+)$/u;
25
26
  async validate(manifest) {
@@ -132,6 +133,7 @@ class ModulesValidator {
132
133
  };
133
134
  const { endpoint: _endpoint } = modules;
134
135
  const eventModulesWithEndpoint = modules?.trigger?.filter((trigger) => trigger.endpoint != null) || [];
136
+ const scopeKeys = (0, scopes_1.getAllScopeKeys)(scopes);
135
137
  eventModulesWithEndpoint.forEach((event) => {
136
138
  const endpointModule = _endpoint?.find((remoteEndpoint) => remoteEndpoint.key === event.endpoint);
137
139
  if (endpointModule) {
@@ -169,7 +171,7 @@ class ModulesValidator {
169
171
  ...(0, utils_1.findPosition)(endpoint.remote, yamlContentByLine)
170
172
  });
171
173
  }
172
- if (endpoint.auth?.appUserToken?.enabled && !scopes.includes(types_1.USER_TOKEN_SCOPE)) {
174
+ if (endpoint.auth?.appUserToken?.enabled && !scopeKeys.includes(types_1.USER_TOKEN_SCOPE)) {
173
175
  validationErrors.push({
174
176
  message: text_1.errors.permissions.missingEndpointPermissionFromScope(types_1.USER_TOKEN_SCOPE, endpoint.key),
175
177
  reference: text_1.References.MissingScopes,
@@ -180,7 +182,7 @@ class ModulesValidator {
180
182
  ...(0, utils_1.findPosition)('scopes', yamlContentByLine)
181
183
  });
182
184
  }
183
- if (endpoint.auth?.appSystemToken?.enabled && !scopes.includes(types_1.SYSTEM_TOKEN_SCOPE)) {
185
+ if (endpoint.auth?.appSystemToken?.enabled && !scopeKeys.includes(types_1.SYSTEM_TOKEN_SCOPE)) {
184
186
  validationErrors.push({
185
187
  message: text_1.errors.permissions.missingEndpointPermissionFromScope(types_1.SYSTEM_TOKEN_SCOPE, endpoint.key),
186
188
  reference: text_1.References.MissingScopes,
@@ -204,7 +206,7 @@ class ModulesValidator {
204
206
  }
205
207
  });
206
208
  remotes?.forEach((remote) => {
207
- if (remote.auth?.appUserToken?.enabled && !scopes.includes(types_1.USER_TOKEN_SCOPE)) {
209
+ if (remote.auth?.appUserToken?.enabled && !scopeKeys.includes(types_1.USER_TOKEN_SCOPE)) {
208
210
  validationErrors.push({
209
211
  message: text_1.errors.permissions.missingRemotePermissionFromScope(types_1.USER_TOKEN_SCOPE, remote.key),
210
212
  reference: text_1.References.MissingScopes,
@@ -215,7 +217,7 @@ class ModulesValidator {
215
217
  ...(0, utils_1.findPosition)('scopes', yamlContentByLine)
216
218
  });
217
219
  }
218
- if (remote.auth?.appSystemToken?.enabled && !scopes.includes(types_1.SYSTEM_TOKEN_SCOPE)) {
220
+ if (remote.auth?.appSystemToken?.enabled && !scopeKeys.includes(types_1.SYSTEM_TOKEN_SCOPE)) {
219
221
  validationErrors.push({
220
222
  message: text_1.errors.permissions.missingRemotePermissionFromScope(types_1.SYSTEM_TOKEN_SCOPE, remote.key),
221
223
  reference: text_1.References.MissingScopes,
@@ -1 +1 @@
1
- {"version":3,"file":"validateModuleScopes.d.ts","sourceRoot":"","sources":["../../../src/validators/modules-validators/validateModuleScopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAU9C,eAAO,MAAM,oBAAoB,YACtB,OAAO,sBACI,MAAM,EAAE,gBACd,WAAW,KACxB,eAAe,EAoBjB,CAAC"}
1
+ {"version":3,"file":"validateModuleScopes.d.ts","sourceRoot":"","sources":["../../../src/validators/modules-validators/validateModuleScopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAW9C,eAAO,MAAM,oBAAoB,YACtB,OAAO,sBACI,MAAM,EAAE,gBACd,WAAW,KACxB,eAAe,EAoBjB,CAAC"}
@@ -4,9 +4,10 @@ exports.validateModuleScopes = void 0;
4
4
  const text_1 = require("../../text");
5
5
  const utils_1 = require("../../utils");
6
6
  const module_to_scope_mapping_1 = require("../../mapping/module-to-scope-mapping");
7
+ const scopes_1 = require("../../utils/scopes");
7
8
  const validateModuleScopes = (modules, yamlContentByLine, permissions) => {
8
9
  const validationErrors = [];
9
- const scopes = permissions?.scopes || [];
10
+ const scopes = (0, scopes_1.getAllScopeKeys)(permissions?.scopes ?? []);
10
11
  module_to_scope_mapping_1.MODULE_TO_SCOPES_MAPPING.forEach((requiredScopes, moduleType) => {
11
12
  const modulesToValidate = modules[moduleType];
12
13
  if (modulesToValidate) {
@@ -1 +1 @@
1
- {"version":3,"file":"permissions-validator.d.ts","sourceRoot":"","sources":["../../src/validators/permissions-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AAGrF,OAAO,EAAE,cAAc,EAAU,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAM3D,qBAAa,oBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAEzF,OAAO,CAAC,UAAU;IA+BlB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,8BAA8B;IA6ChC,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;CA8HrD"}
1
+ {"version":3,"file":"permissions-validator.d.ts","sourceRoot":"","sources":["../../src/validators/permissions-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AAGrF,OAAO,EAAE,cAAc,EAAU,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAO3D,qBAAa,oBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAEzF,OAAO,CAAC,UAAU;IA+BlB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,8BAA8B;IA6ChC,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;CAiIrD"}
@@ -8,6 +8,7 @@ const egress_types_1 = require("../types/egress-types");
8
8
  const url_1 = require("url");
9
9
  const shipyard_scopes_json_1 = tslib_1.__importDefault(require("../scopes/shipyard-scopes.json"));
10
10
  const deprecated_shipyard_scopes_json_1 = tslib_1.__importDefault(require("../scopes/deprecated-shipyard-scopes.json"));
11
+ const scopes_1 = require("../utils/scopes");
11
12
  class PermissionsValidator {
12
13
  isValidURL(inputURL) {
13
14
  const protocolRegex = /^(.*?:\/\/)/;
@@ -98,7 +99,7 @@ class PermissionsValidator {
98
99
  }
99
100
  const errors = [];
100
101
  const ALL_SCOPES = shipyard_scopes_json_1.default.concat(deprecated_shipyard_scopes_json_1.default);
101
- const invalidScopes = manifest.typedContent.permissions.scopes?.filter((key) => !ALL_SCOPES.includes(key));
102
+ const invalidScopes = (0, scopes_1.getAllScopeKeys)(manifest.typedContent.permissions.scopes ?? []).filter((scope) => !ALL_SCOPES.includes(scope));
102
103
  if (invalidScopes?.length) {
103
104
  this.addValidationErrors(errors, 'scopes', invalidScopes, manifest);
104
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"remote-auth-scopes-validator.d.ts","sourceRoot":"","sources":["../../src/validators/remote-auth-scopes-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAsB,MAAM,UAAU,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAapD,qBAAa,yBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAEnF,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;IA4CpD,OAAO,CAAC,mBAAmB,CAA+D;IAC1F,OAAO,CAAC,qBAAqB,CAAiE;CAC/F"}
1
+ {"version":3,"file":"remote-auth-scopes-validator.d.ts","sourceRoot":"","sources":["../../src/validators/remote-auth-scopes-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAsB,MAAM,UAAU,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAcpD,qBAAa,yBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAEnF,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;IA4CpD,OAAO,CAAC,mBAAmB,CAA+D;IAC1F,OAAO,CAAC,qBAAqB,CAAiE;CAC/F"}
@@ -4,6 +4,7 @@ exports.RemoteAuthScopesValidator = void 0;
4
4
  const types_1 = require("../types");
5
5
  const text_1 = require("../text");
6
6
  const utils_1 = require("../utils");
7
+ const scopes_1 = require("../utils/scopes");
7
8
  class RemoteAuthScopesValidator {
8
9
  async validate(manifest) {
9
10
  if (!manifest?.typedContent?.remotes && !manifest?.typedContent?.modules?.endpoint) {
@@ -19,7 +20,7 @@ class RemoteAuthScopesValidator {
19
20
  const hasAppSystemToken = endpoints.some((endpoint) => this.appSystemTokenEnabled(endpoint.auth)) ||
20
21
  remotes?.some((remote) => this.appSystemTokenEnabled(remote.auth));
21
22
  if (hasAppUserToken || hasAppSystemToken) {
22
- const scopes = manifest.typedContent.permissions?.scopes ?? [];
23
+ const scopes = (0, scopes_1.getAllScopeKeys)(manifest.typedContent.permissions?.scopes ?? []);
23
24
  const filteredScopes = scopes.filter((scope) => !types_1.REMOTE_AUTH_SCOPES.includes(scope));
24
25
  if (filteredScopes.length === 0) {
25
26
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/manifest",
3
- "version": "9.3.0-next.3",
3
+ "version": "9.3.0-next.4",
4
4
  "description": "Definitions and validations of the Forge manifest",
5
5
  "main": "out/index.js",
6
6
  "scripts": {