@forge/manifest 12.5.0 → 12.6.0-experimental-a6c6519
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 +55 -0
- package/out/builder/processor-builder.d.ts.map +1 -1
- package/out/builder/processor-builder.js +2 -0
- package/out/mapping/agent-product-context-to-scope-mapping.json +14 -0
- package/out/processor/agent-product-context-validation-processor.d.ts +6 -0
- package/out/processor/agent-product-context-validation-processor.d.ts.map +1 -0
- package/out/processor/agent-product-context-validation-processor.js +19 -0
- package/out/processor/index.d.ts +1 -0
- package/out/processor/index.d.ts.map +1 -1
- package/out/processor/index.js +1 -0
- package/out/schema/basic-manifest-schema.json +2 -1
- package/out/schema/basic-manifest.d.ts +1 -1
- package/out/schema/manifest-schema.json +924 -190
- package/out/schema/manifest.d.ts +294 -87
- package/out/scopes/shipyard-scopes.json +0 -1
- package/out/text/errors.d.ts +4 -3
- package/out/text/errors.d.ts.map +1 -1
- package/out/text/errors.js +6 -5
- package/out/types/validation-types.d.ts +1 -0
- package/out/types/validation-types.d.ts.map +1 -1
- package/out/types/validation-types.js +1 -0
- package/out/validators/agent-product-context-scopes-validator.d.ts +21 -0
- package/out/validators/agent-product-context-scopes-validator.d.ts.map +1 -0
- package/out/validators/agent-product-context-scopes-validator.js +62 -0
- package/out/validators/connect-remote-validator.d.ts.map +1 -1
- package/out/validators/connect-remote-validator.js +13 -1
- package/out/validators/index.d.ts +1 -0
- package/out/validators/index.d.ts.map +1 -1
- package/out/validators/index.js +1 -0
- package/out/validators/modules-validator.js +1 -1
- package/out/validators/modules-validators/global/validate-global-ui.d.ts +2 -2
- package/out/validators/modules-validators/global/validate-global-ui.d.ts.map +1 -1
- package/out/validators/modules-validators/global/validate-global-ui.js +24 -10
- package/out/validators/modules-validators/jira/validate-action-validator.d.ts.map +1 -1
- package/out/validators/modules-validators/jira/validate-action-validator.js +1 -43
- package/package.json +1 -1
package/out/text/errors.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare const errors: {
|
|
|
20
20
|
permissions: {
|
|
21
21
|
invalidPermission: (element: string, value: string) => string;
|
|
22
22
|
missingPermissionFromScope: (scope: string, event: string) => string;
|
|
23
|
+
missingPermissionFromAgentProductContext: (scope: string, agentKey: string, productContexts: string[]) => string;
|
|
23
24
|
missingEndpointPermissionFromScope: (scope: string, key: string) => string;
|
|
24
25
|
missingRemotePermissionFromScope: (scope: string, key: string) => string;
|
|
25
26
|
deprecatedPermission: (element: string, value: string[]) => string;
|
|
@@ -98,8 +99,6 @@ export declare const errors: {
|
|
|
98
99
|
};
|
|
99
100
|
jiraActionValidator: {
|
|
100
101
|
limitPerActionType: (actionType: string, limit: number) => string;
|
|
101
|
-
incompatibleModules: (otherModules: string[]) => string;
|
|
102
|
-
tooManyModules: (totalModules: number, limit: number) => string;
|
|
103
102
|
};
|
|
104
103
|
jiraFullPageModule: {
|
|
105
104
|
invalidRouteRegex: (pattern: string, keyName: string, index: number) => string;
|
|
@@ -170,8 +169,9 @@ export declare const errors: {
|
|
|
170
169
|
missingRemote: () => string;
|
|
171
170
|
};
|
|
172
171
|
globalUi: {
|
|
173
|
-
invalidRouteRegex: (pattern: string, keyName: string, index: number) => string;
|
|
174
172
|
invalidIcon: (icon: string, keyName: string, index: number) => string;
|
|
173
|
+
renderMustBeNative: (keyName: string, index: number) => string;
|
|
174
|
+
installationTargetRequired: () => string;
|
|
175
175
|
};
|
|
176
176
|
};
|
|
177
177
|
resources: {
|
|
@@ -200,6 +200,7 @@ export declare const errors: {
|
|
|
200
200
|
missingRemoteForConnect: (key: string) => string;
|
|
201
201
|
missingConnectModules: () => string;
|
|
202
202
|
noConfigurableConnectRemote: () => string;
|
|
203
|
+
missingConnectRemoteWithRemotesWarning: () => string;
|
|
203
204
|
features: {
|
|
204
205
|
deprecatedAutoUserConsent: () => string;
|
|
205
206
|
};
|
package/out/text/errors.d.ts.map
CHANGED
|
@@ -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;+BACd,MAAM,EAAE,KAAG,MAAM;2BAIvB,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,mBAAmB,MAAM,KAAG,MAAM;mDAIvC,MAAM,KAAG,MAAM;4BAEtC,MAAM,EAAE,GAAG,SAAS,KAAG,MAAM;+CAIV,MAAM;6CACR,MAAM,gBAAgB,MAAM;qCAEpC,MAAM;2CACA,MAAM;6CACJ,MAAM;;;qCAGd,MAAM,SAAS,MAAM,KAAG,MAAM;4CAEvB,MAAM,SAAS,MAAM,KAAG,MAAM;
|
|
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;+BACd,MAAM,EAAE,KAAG,MAAM;2BAIvB,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,mBAAmB,MAAM,KAAG,MAAM;mDAIvC,MAAM,KAAG,MAAM;4BAEtC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AAG,MAAM;qCAEnB,MAAM;2CAEA,MAAM;sDACK,MAAM;;6CAGjB,MAAM;;;mDAIE,MAAM,KAAG,MAAM;iDAEnB,MAAM;;;;4CAKX,MAAM,SAAS,MAAM,KAAG,MAAM;4CAE9B,MAAM,KAAG,MAAM;4CACf,MAAM,SAAS,MAAM,KAAG,MAAM;+CAE3B,MAAM,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;;;;;gCAM1C,MAAM;;;;;;;;;;0DAawB,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;;;;mCAKjF,MAAM;;;CAQlC,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;CAClC"}
|
package/out/text/errors.js
CHANGED
|
@@ -34,6 +34,7 @@ exports.errors = {
|
|
|
34
34
|
permissions: {
|
|
35
35
|
invalidPermission: (element, value) => `Invalid '${element}' permission in the manifest.yml file - '${value}'. Learn more about permissions at: https://go.atlassian.com/forge-permissions.`,
|
|
36
36
|
missingPermissionFromScope: (scope, event) => `Trigger event: '${event}' requires '${scope}' scope`,
|
|
37
|
+
missingPermissionFromAgentProductContext: (scope, agentKey, productContexts) => `rovo:agentConnector '${agentKey}' declares productContexts: [${productContexts.join(', ')}] but is missing required scope '${scope}'`,
|
|
37
38
|
missingEndpointPermissionFromScope: (scope, key) => `Endpoint module: '${key}' requires '${scope}' scope.`,
|
|
38
39
|
missingRemotePermissionFromScope: (scope, key) => `Remote: '${key}' requires '${scope}' scope.`,
|
|
39
40
|
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.`,
|
|
@@ -111,9 +112,7 @@ exports.errors = {
|
|
|
111
112
|
duplicateFunctionNames: (names) => `JQL function names must be unique. Found duplicates: ${names.join(', ')}.`
|
|
112
113
|
},
|
|
113
114
|
jiraActionValidator: {
|
|
114
|
-
limitPerActionType: (actionType, limit) => `Only ${limit} ${types_1.AllModuleTypes.JiraActionValidator} module is allowed per action type. Found multiple modules for action type: ${actionType}
|
|
115
|
-
incompatibleModules: (otherModules) => `${types_1.AllModuleTypes.JiraActionValidator} modules can only be declared with page modules and core functions. Found incompatible modules: ${otherModules.join(', ')}.`,
|
|
116
|
-
tooManyModules: (totalModules, limit) => `Apps with ${types_1.AllModuleTypes.JiraActionValidator} modules can declare up to ${limit} additional modules. Found ${totalModules} total modules.`
|
|
115
|
+
limitPerActionType: (actionType, limit) => `Only ${limit} ${types_1.AllModuleTypes.JiraActionValidator} module is allowed per action type. Found multiple modules for action type: ${actionType}.`
|
|
117
116
|
},
|
|
118
117
|
jiraFullPageModule: {
|
|
119
118
|
invalidRouteRegex: (pattern, keyName, index) => `The routePrefix '${pattern}' at index '${index}' for key '${keyName}' needs to be in a valid URL route between 1-255 characters and contain only URL safe characters such as: a-z, 0-9 and '\' and '-'.`,
|
|
@@ -184,8 +183,9 @@ exports.errors = {
|
|
|
184
183
|
missingRemote: () => `Missing remote in migration:dataResidency.`
|
|
185
184
|
},
|
|
186
185
|
globalUi: {
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
invalidIcon: (icon, keyName, index) => `The icon '${icon}' at index '${index}' for key '${keyName}' needs to be a defined resource of file type svg.`,
|
|
187
|
+
renderMustBeNative: (keyName, index) => `The render property at index '${index}' for key '${keyName}' must be set to 'native' for global:ui modules.`,
|
|
188
|
+
installationTargetRequired: () => `Apps using the global:ui module must set app.installationTarget to 'unit'.`
|
|
189
189
|
}
|
|
190
190
|
},
|
|
191
191
|
resources: {
|
|
@@ -214,6 +214,7 @@ exports.errors = {
|
|
|
214
214
|
missingRemoteForConnect: (key) => `no remote found with key '${key}' matching app.connect.remote value.`,
|
|
215
215
|
missingConnectModules: () => 'Missing connectModules. When app.connect.authentication is present, connectModules is required.',
|
|
216
216
|
noConfigurableConnectRemote: () => 'Connect remotes cannot be configurable',
|
|
217
|
+
missingConnectRemoteWithRemotesWarning: () => `Warning: Previous connect region will not be persisted on connect to forge upgrades if connect.remote is not defined.`,
|
|
217
218
|
features: {
|
|
218
219
|
deprecatedAutoUserConsent: () => 'The autoUserConsent feature flag is no longer required to use automatic user consent and should be removed from the manifest.'
|
|
219
220
|
},
|
|
@@ -3,6 +3,7 @@ export declare enum ValidationTypes {
|
|
|
3
3
|
BASIC = "basic",
|
|
4
4
|
FULL = "full",
|
|
5
5
|
PRODUCT_TRIGGER = "product-trigger",
|
|
6
|
+
AGENT_PRODUCT_CONTEXT = "agent-product-context",
|
|
6
7
|
DEPRECATED_CSP_METHOD = "deprecated-csp-method",
|
|
7
8
|
FORGE_REMOTE_COMPUTE = "forge-remote-compute",
|
|
8
9
|
DEPRECATED_EGRESS_PERMISSIONS = "deprecated-egress-permissions"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-types.d.ts","sourceRoot":"","sources":["../../src/types/validation-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,eAAe,oBAAoB;IACnC,qBAAqB,0BAA0B;IAC/C,oBAAoB,yBAAyB;IAC7C,6BAA6B,kCAAkC;CAChE;AAKD,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;CACvC"}
|
|
1
|
+
{"version":3,"file":"validation-types.d.ts","sourceRoot":"","sources":["../../src/types/validation-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,eAAe,oBAAoB;IACnC,qBAAqB,0BAA0B;IAC/C,qBAAqB,0BAA0B;IAC/C,oBAAoB,yBAAyB;IAC7C,6BAA6B,kCAAkC;CAChE;AAKD,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;CACvC"}
|
|
@@ -6,6 +6,7 @@ var ValidationTypes;
|
|
|
6
6
|
ValidationTypes["BASIC"] = "basic";
|
|
7
7
|
ValidationTypes["FULL"] = "full";
|
|
8
8
|
ValidationTypes["PRODUCT_TRIGGER"] = "product-trigger";
|
|
9
|
+
ValidationTypes["AGENT_PRODUCT_CONTEXT"] = "agent-product-context";
|
|
9
10
|
ValidationTypes["DEPRECATED_CSP_METHOD"] = "deprecated-csp-method";
|
|
10
11
|
ValidationTypes["FORGE_REMOTE_COMPUTE"] = "forge-remote-compute";
|
|
11
12
|
ValidationTypes["DEPRECATED_EGRESS_PERMISSIONS"] = "deprecated-egress-permissions";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ManifestObject, ManifestValidationResult } from '../types';
|
|
2
|
+
import { ValidatorInterface } from './validator-interface';
|
|
3
|
+
import { ManifestSchema, Scopes } from '../schema/manifest';
|
|
4
|
+
import { RequiredScopes } from '../scopes';
|
|
5
|
+
export interface AgentProductContextMappingEntry {
|
|
6
|
+
productContext: string;
|
|
7
|
+
oAuthScopes: RequiredScopes;
|
|
8
|
+
}
|
|
9
|
+
export interface AgentProductContextMappingConfig {
|
|
10
|
+
mapping: AgentProductContextMappingEntry[];
|
|
11
|
+
}
|
|
12
|
+
export declare function validateAgentProductContextScopes(productContext: string, scopes: Scopes | undefined, config: AgentProductContextMappingConfig): Promise<{
|
|
13
|
+
requiredScopes: RequiredScopes;
|
|
14
|
+
missingScopes: string[];
|
|
15
|
+
}>;
|
|
16
|
+
export declare class AgentProductContextScopesValidator<T> implements ValidatorInterface<ManifestObject<ManifestSchema> | undefined, ManifestSchema> {
|
|
17
|
+
private readonly config;
|
|
18
|
+
constructor(config: AgentProductContextMappingConfig);
|
|
19
|
+
validate(manifest: ManifestObject<ManifestSchema> | undefined): Promise<ManifestValidationResult<ManifestSchema>>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=agent-product-context-scopes-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-product-context-scopes-validator.d.ts","sourceRoot":"","sources":["../../src/validators/agent-product-context-scopes-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AACrG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5D,OAAO,EAAoB,cAAc,EAAE,MAAM,WAAW,CAAC;AAE7D,MAAM,WAAW,+BAA+B;IAC9C,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,cAAc,CAAC;CAC7B;AAED,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,+BAA+B,EAAE,CAAC;CAC5C;AAUD,wBAAsB,iCAAiC,CACrD,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,gCAAgC,GACvC,OAAO,CAAC;IAAE,cAAc,EAAE,cAAc,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAQtE;AAED,qBAAa,kCAAkC,CAAC,CAAC,CAC/C,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAE7E,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,gCAAgC;IAE/D,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;CAgDrD"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentProductContextScopesValidator = exports.validateAgentProductContextScopes = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const text_1 = require("../text");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
const scopes_1 = require("../scopes");
|
|
8
|
+
async function validateAgentProductContextScopes(productContext, scopes, config) {
|
|
9
|
+
const emptyRequiredScopes = { current: [] };
|
|
10
|
+
const requiredScopes = config.mapping.find((entry) => entry.productContext === productContext)?.oAuthScopes || emptyRequiredScopes;
|
|
11
|
+
const missingScopes = await (0, scopes_1.getMissingScopes)(scopes, requiredScopes);
|
|
12
|
+
return { requiredScopes, missingScopes };
|
|
13
|
+
}
|
|
14
|
+
exports.validateAgentProductContextScopes = validateAgentProductContextScopes;
|
|
15
|
+
class AgentProductContextScopesValidator {
|
|
16
|
+
config;
|
|
17
|
+
constructor(config) {
|
|
18
|
+
this.config = config;
|
|
19
|
+
}
|
|
20
|
+
async validate(manifest) {
|
|
21
|
+
if (!manifest || !manifest.typedContent) {
|
|
22
|
+
return {
|
|
23
|
+
success: false,
|
|
24
|
+
manifestObject: manifest
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const validationErrors = [];
|
|
28
|
+
const addValidationError = (scope, agentKey, productContexts) => {
|
|
29
|
+
validationErrors.push({
|
|
30
|
+
message: text_1.errors.permissions.missingPermissionFromAgentProductContext(scope, agentKey, productContexts),
|
|
31
|
+
reference: text_1.References.MissingScopes,
|
|
32
|
+
level: 'error',
|
|
33
|
+
metadata: {
|
|
34
|
+
missingPermission: scope
|
|
35
|
+
},
|
|
36
|
+
...(0, utils_1.findPosition)('scopes', manifest.yamlContentByLine)
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const rovoAgents = manifest.typedContent.modules?.[types_1.AllModuleTypes.RovoAgentConnector];
|
|
40
|
+
if (!rovoAgents || !rovoAgents.length) {
|
|
41
|
+
return {
|
|
42
|
+
success: true,
|
|
43
|
+
manifestObject: manifest
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const manifestScopes = manifest.typedContent.permissions?.scopes || [];
|
|
47
|
+
for (const agent of rovoAgents) {
|
|
48
|
+
if (!agent.productContexts || !agent.productContexts.length)
|
|
49
|
+
continue;
|
|
50
|
+
for (const productContext of agent.productContexts) {
|
|
51
|
+
const { missingScopes } = await validateAgentProductContextScopes(productContext, manifestScopes, this.config);
|
|
52
|
+
missingScopes.forEach((scope) => addValidationError(scope, agent.key, agent.productContexts));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
success: validationErrors.length === 0,
|
|
57
|
+
manifestObject: manifest,
|
|
58
|
+
errors: validationErrors
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.AgentProductContextScopesValidator = AgentProductContextScopesValidator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-remote-validator.d.ts","sourceRoot":"","sources":["../../src/validators/connect-remote-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,qBAAa,sBACX,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;
|
|
1
|
+
{"version":3,"file":"connect-remote-validator.d.ts","sourceRoot":"","sources":["../../src/validators/connect-remote-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,qBAAa,sBACX,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;CAuErD"}
|
|
@@ -41,8 +41,20 @@ class ConnectRemoteValidator {
|
|
|
41
41
|
...(0, utils_1.findPosition)('connect', manifest.yamlContentByLine)
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
+
if (app?.connect?.key &&
|
|
45
|
+
manifest.typedContent.remotes &&
|
|
46
|
+
manifest.typedContent.remotes.length > 0 &&
|
|
47
|
+
!app.connect.remote) {
|
|
48
|
+
validationErrors.push({
|
|
49
|
+
message: text_1.errors.app.missingConnectRemoteWithRemotesWarning(),
|
|
50
|
+
reference: text_1.References.App,
|
|
51
|
+
level: 'warning',
|
|
52
|
+
...(0, utils_1.findPosition)('connect', manifest.yamlContentByLine)
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const errorLevelEntries = validationErrors.filter((e) => e.level === 'error');
|
|
44
56
|
return {
|
|
45
|
-
success:
|
|
57
|
+
success: errorLevelEntries.length === 0,
|
|
46
58
|
manifestObject: manifest,
|
|
47
59
|
errors: validationErrors
|
|
48
60
|
};
|
|
@@ -8,6 +8,7 @@ export * from './resources-validator';
|
|
|
8
8
|
export * from './display-conditions-validator';
|
|
9
9
|
export * from './product-trigger-scopes-validator';
|
|
10
10
|
export * from './simple-trigger-scope-validator';
|
|
11
|
+
export * from './agent-product-context-scopes-validator';
|
|
11
12
|
export * from './providers-validator';
|
|
12
13
|
export * from './permissions-validator';
|
|
13
14
|
export * from './connect-remote-validator';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validators/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validators/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,0CAA0C,CAAC;AACzD,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC"}
|
package/out/validators/index.js
CHANGED
|
@@ -11,6 +11,7 @@ tslib_1.__exportStar(require("./resources-validator"), exports);
|
|
|
11
11
|
tslib_1.__exportStar(require("./display-conditions-validator"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("./product-trigger-scopes-validator"), exports);
|
|
13
13
|
tslib_1.__exportStar(require("./simple-trigger-scope-validator"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./agent-product-context-scopes-validator"), exports);
|
|
14
15
|
tslib_1.__exportStar(require("./providers-validator"), exports);
|
|
15
16
|
tslib_1.__exportStar(require("./permissions-validator"), exports);
|
|
16
17
|
tslib_1.__exportStar(require("./connect-remote-validator"), exports);
|
|
@@ -38,7 +38,7 @@ class ModulesValidator {
|
|
|
38
38
|
let validationErrors = [...this.connectModuleValidation(manifest)];
|
|
39
39
|
if (manifest.typedContent.modules) {
|
|
40
40
|
const { typedContent: { modules, connectModules, remotes, permissions, services, providers }, yamlContentByLine, filePath } = manifest;
|
|
41
|
-
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, 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, 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));
|
|
41
|
+
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, 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, 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, manifest.typedContent.app, yamlContentByLine));
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
44
|
const { typedContent: { connectModules }, yamlContentByLine } = manifest;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Modules } from '../../../schema/manifest';
|
|
1
|
+
import { App, Modules } from '../../../schema/manifest';
|
|
2
2
|
import { ValidationError } from '../../../types';
|
|
3
|
-
export declare const validateGlobalUi: (modules: Modules, yamlContentByLine?: string[]) => ValidationError[];
|
|
3
|
+
export declare const validateGlobalUi: (modules: Modules, app: App, yamlContentByLine?: string[]) => ValidationError[];
|
|
4
4
|
//# sourceMappingURL=validate-global-ui.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-global-ui.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/global/validate-global-ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"validate-global-ui.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/global/validate-global-ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAkB,eAAe,EAAE,MAAM,gBAAgB,CAAC;AA6BjE,eAAO,MAAM,gBAAgB,YAAa,OAAO,OAAO,GAAG,sBAAsB,MAAM,EAAE,KAAG,eAAe,EA4D1G,CAAC"}
|
|
@@ -6,10 +6,21 @@ const types_1 = require("../../../types");
|
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
7
|
const validateGlobalModules_1 = require("../../../utils/global/validateGlobalModules");
|
|
8
8
|
const errorMessages = text_1.errors.modules.globalUi;
|
|
9
|
-
const validateGlobalUi = (modules, yamlContentByLine) => {
|
|
9
|
+
const validateGlobalUi = (modules, app, yamlContentByLine) => {
|
|
10
10
|
const validationErrors = [];
|
|
11
11
|
const moduleType = types_1.AllModuleTypes.GlobalUi;
|
|
12
12
|
const globalUiModules = modules[moduleType] || [];
|
|
13
|
+
if (globalUiModules.length === 0) {
|
|
14
|
+
return validationErrors;
|
|
15
|
+
}
|
|
16
|
+
if (!['unit', 'user'].includes(app.installationTarget)) {
|
|
17
|
+
validationErrors.push({
|
|
18
|
+
message: errorMessages.installationTargetRequired(),
|
|
19
|
+
reference: text_1.References.Modules,
|
|
20
|
+
level: 'error',
|
|
21
|
+
...(0, utils_1.findPosition)(app.installationTarget ? 'installationTarget' : 'app', yamlContentByLine)
|
|
22
|
+
});
|
|
23
|
+
}
|
|
13
24
|
if (globalUiModules.length > 1) {
|
|
14
25
|
validationErrors.push({
|
|
15
26
|
message: text_1.errors.modules.singleEntryOfTheModule(moduleType),
|
|
@@ -20,19 +31,22 @@ const validateGlobalUi = (modules, yamlContentByLine) => {
|
|
|
20
31
|
return validationErrors;
|
|
21
32
|
}
|
|
22
33
|
globalUiModules.forEach((module, index) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
if (module.render !== 'native') {
|
|
35
|
+
validationErrors.push({
|
|
36
|
+
message: errorMessages.renderMustBeNative(module.key, index),
|
|
37
|
+
reference: text_1.References.Modules,
|
|
38
|
+
level: 'error',
|
|
39
|
+
...(0, utils_1.findPosition)(module.key, yamlContentByLine)
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (module.icon) {
|
|
43
|
+
validationErrors.push(...(0, validateGlobalModules_1.validateIcon)(module.key, module.icon, index, errorMessages).map((error) => ({
|
|
30
44
|
message: error.message,
|
|
31
45
|
reference: text_1.References.Modules,
|
|
32
46
|
level: 'error',
|
|
33
47
|
...(0, utils_1.findPosition)(error.moduleKey, yamlContentByLine)
|
|
34
|
-
}))
|
|
35
|
-
|
|
48
|
+
})));
|
|
49
|
+
}
|
|
36
50
|
});
|
|
37
51
|
return validationErrors;
|
|
38
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-action-validator.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/jira/validate-action-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"validate-action-validator.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/jira/validate-action-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAkBnD,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,OAAO,EAChB,iBAAiB,EAAE,MAAM,EAAE,GAAG,SAAS,GACtC,eAAe,EAAE,CAQnB"}
|
|
@@ -4,25 +4,13 @@ exports.validateJiraActionValidator = void 0;
|
|
|
4
4
|
const text_1 = require("../../../text");
|
|
5
5
|
const utils_1 = require("../../../utils");
|
|
6
6
|
const module_types_1 = require("../../../types/module-types");
|
|
7
|
-
const PAGE_MODULE_TYPES = [
|
|
8
|
-
module_types_1.AllModuleTypes.JiraAdminPage,
|
|
9
|
-
module_types_1.AllModuleTypes.JiraProjectPage,
|
|
10
|
-
module_types_1.AllModuleTypes.JiraProjectSettingsPage,
|
|
11
|
-
module_types_1.AllModuleTypes.JiraGlobalPage,
|
|
12
|
-
module_types_1.AllModuleTypes.JiraPersonalSettingsPage
|
|
13
|
-
];
|
|
14
7
|
const MAX_JIRA_ACTION_VALIDATORS = 1;
|
|
15
|
-
const MAX_ALLOWED_MODULES = MAX_JIRA_ACTION_VALIDATORS + 1;
|
|
16
8
|
function validateJiraActionValidator(modules, yamlContentByLine) {
|
|
17
9
|
const actionValidatorModules = getActionValidatorModules(modules);
|
|
18
10
|
if (actionValidatorModules.length === 0) {
|
|
19
11
|
return [];
|
|
20
12
|
}
|
|
21
|
-
return [
|
|
22
|
-
...validateUniqueActionTypes(actionValidatorModules, yamlContentByLine),
|
|
23
|
-
...validateCompatibleModules(modules, actionValidatorModules, yamlContentByLine),
|
|
24
|
-
...validateModuleLimit(modules, actionValidatorModules, yamlContentByLine)
|
|
25
|
-
];
|
|
13
|
+
return [...validateUniqueActionTypes(actionValidatorModules, yamlContentByLine)];
|
|
26
14
|
}
|
|
27
15
|
exports.validateJiraActionValidator = validateJiraActionValidator;
|
|
28
16
|
function getActionValidatorModules(modules) {
|
|
@@ -52,33 +40,3 @@ function validateUniqueActionTypes(actionValidatorModules, yamlContentByLine) {
|
|
|
52
40
|
.filter(([, modules]) => modules.length > MAX_JIRA_ACTION_VALIDATORS)
|
|
53
41
|
.flatMap(([actionType, modules]) => modules.map((module) => createValidationError(text_1.errors.modules.jiraActionValidator.limitPerActionType(actionType, MAX_JIRA_ACTION_VALIDATORS), module.key, yamlContentByLine)));
|
|
54
42
|
}
|
|
55
|
-
function validateCompatibleModules(modules, actionValidatorModules, yamlContentByLine) {
|
|
56
|
-
const incompatibleModules = getIncompatibleModules(modules);
|
|
57
|
-
if (incompatibleModules.length === 0) {
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
|
-
return actionValidatorModules.map((module) => createValidationError(text_1.errors.modules.jiraActionValidator.incompatibleModules(incompatibleModules), module.key, yamlContentByLine));
|
|
61
|
-
}
|
|
62
|
-
function getIncompatibleModules(modules) {
|
|
63
|
-
const moduleTypes = Object.keys(modules);
|
|
64
|
-
const otherModules = moduleTypes.filter((type) => type !== module_types_1.AllModuleTypes.JiraActionValidator);
|
|
65
|
-
return otherModules.filter((moduleType) => {
|
|
66
|
-
const isPageModule = PAGE_MODULE_TYPES.includes(moduleType);
|
|
67
|
-
const isCoreFunction = moduleType === module_types_1.AllModuleTypes.CoreFunction;
|
|
68
|
-
return !isPageModule && !isCoreFunction;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
function validateModuleLimit(modules, actionValidatorModules, yamlContentByLine) {
|
|
72
|
-
const nonCoreModuleCount = getNonCoreModuleCount(modules);
|
|
73
|
-
if (nonCoreModuleCount <= MAX_ALLOWED_MODULES) {
|
|
74
|
-
return [];
|
|
75
|
-
}
|
|
76
|
-
return actionValidatorModules.map((module) => createValidationError(text_1.errors.modules.jiraActionValidator.tooManyModules(nonCoreModuleCount, MAX_JIRA_ACTION_VALIDATORS), module.key, yamlContentByLine));
|
|
77
|
-
}
|
|
78
|
-
function getNonCoreModuleCount(modules) {
|
|
79
|
-
return Object.entries(modules)
|
|
80
|
-
.filter(([moduleType]) => !moduleType.startsWith('core:'))
|
|
81
|
-
.reduce((total, [, moduleArray]) => {
|
|
82
|
-
return total + (Array.isArray(moduleArray) ? moduleArray.length : 0);
|
|
83
|
-
}, 0);
|
|
84
|
-
}
|