@forge/manifest 4.13.0-next.3 → 4.13.0
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 +19 -0
- package/out/builder/processor-builder.d.ts.map +1 -1
- package/out/builder/processor-builder.js +3 -0
- package/out/processor/remote-compute-validation-processor.d.ts +6 -0
- package/out/processor/remote-compute-validation-processor.d.ts.map +1 -0
- package/out/processor/remote-compute-validation-processor.js +18 -0
- package/out/text/errors.d.ts +1 -0
- package/out/text/errors.d.ts.map +1 -1
- package/out/text/errors.js +1 -0
- package/out/types/validation-types.d.ts +2 -1
- package/out/types/validation-types.d.ts.map +1 -1
- package/out/types/validation-types.js +1 -0
- package/out/validators/modules-validator.d.ts +1 -0
- package/out/validators/modules-validator.d.ts.map +1 -1
- package/out/validators/modules-validator.js +29 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @forge/manifest
|
|
2
2
|
|
|
3
|
+
## 4.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7dd1550b: Add Jira Service Management Assets Import Type module
|
|
8
|
+
- aa9b9754: Add scope validations for forge remote compute scopes
|
|
9
|
+
- 83eb996c: Cli validations for forge remote compute apps
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 08c6f1a8: Update manifest definitions
|
|
14
|
+
- 05d6c05e: Update manifest definitions
|
|
15
|
+
|
|
16
|
+
## 4.13.0-next.4
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- aa9b9754: Add scope validations for forge remote compute scopes
|
|
21
|
+
|
|
3
22
|
## 4.13.0-next.3
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processor-builder.d.ts","sourceRoot":"","sources":["../../src/builder/processor-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAGL,kBAAkB,EAEnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"processor-builder.d.ts","sourceRoot":"","sources":["../../src/builder/processor-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAGL,kBAAkB,EAEnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD,qBAAa,gBAAiB,YAAW,gBAAgB,CAAC,kBAAkB,CAAC,cAAc,GAAG,mBAAmB,CAAC,CAAC;IACjH,OAAO,CAAC,cAAc,CAAkB;IAExC,OAAO;IAIP,MAAM,CAAC,QAAQ,IAAI,gBAAgB;IAInC,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,gBAAgB;IAKvD,KAAK,IAAI,kBAAkB,CAAC,cAAc,GAAG,mBAAmB,CAAC;CAgBlE"}
|
|
@@ -4,6 +4,7 @@ exports.ProcessorBuilder = void 0;
|
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const processor_1 = require("../processor");
|
|
6
6
|
const deprecated_csp_method_validation_processor_1 = require("../processor/deprecated-csp-method-validation-processor");
|
|
7
|
+
const remote_compute_validation_processor_1 = require("../processor/remote-compute-validation-processor");
|
|
7
8
|
class ProcessorBuilder {
|
|
8
9
|
constructor() {
|
|
9
10
|
this.validationType = types_1.ValidationTypes.FULL;
|
|
@@ -21,6 +22,8 @@ class ProcessorBuilder {
|
|
|
21
22
|
return new processor_1.BasicValidationProcessor();
|
|
22
23
|
case types_1.ValidationTypes.FULL:
|
|
23
24
|
return new processor_1.FullValidationProcessor();
|
|
25
|
+
case types_1.ValidationTypes.FORGE_REMOTE_COMPUTE:
|
|
26
|
+
return new remote_compute_validation_processor_1.RemoteComputeValidationProcessor();
|
|
24
27
|
case types_1.ValidationTypes.PRODUCT_TRIGGER:
|
|
25
28
|
return new processor_1.ProductTriggerValidationProcessor();
|
|
26
29
|
case types_1.ValidationTypes.DEPRECATED_CSP_METHOD:
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AbstractValidationProcessor } from './abstract-validation-processor';
|
|
2
|
+
import { ManifestSchema } from '../schema/manifest';
|
|
3
|
+
export declare class RemoteComputeValidationProcessor extends AbstractValidationProcessor<ManifestSchema> {
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=remote-compute-validation-processor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-compute-validation-processor.d.ts","sourceRoot":"","sources":["../../src/processor/remote-compute-validation-processor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,qBAAa,gCAAiC,SAAQ,2BAA2B,CAAC,cAAc,CAAC;;CAShG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RemoteComputeValidationProcessor = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const validators_1 = require("../validators");
|
|
6
|
+
const abstract_validation_processor_1 = require("./abstract-validation-processor");
|
|
7
|
+
const FULL_SCHEMA = tslib_1.__importStar(require("../schema/manifest-schema.json"));
|
|
8
|
+
class RemoteComputeValidationProcessor extends abstract_validation_processor_1.AbstractValidationProcessor {
|
|
9
|
+
constructor() {
|
|
10
|
+
super([
|
|
11
|
+
new validators_1.FileValidator(),
|
|
12
|
+
new validators_1.YamlValidator(),
|
|
13
|
+
new validators_1.SchemaValidator(FULL_SCHEMA),
|
|
14
|
+
new validators_1.ModulesValidator()
|
|
15
|
+
]);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.RemoteComputeValidationProcessor = RemoteComputeValidationProcessor;
|
package/out/text/errors.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare const errors: {
|
|
|
12
12
|
permissions: {
|
|
13
13
|
invalidPermission: (element: string, value: string) => string;
|
|
14
14
|
missingPermissionFromScope: (scope: string, event: string) => string;
|
|
15
|
+
missingEndpointPermissionFromScope: (scope: string, key: string) => string;
|
|
15
16
|
deprecatedPermission: (element: string, value: string[]) => string;
|
|
16
17
|
};
|
|
17
18
|
connectModules: {
|
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":"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,mBAAmB,MAAM,KAAG,MAAM;mDAIvC,MAAM,KAAG,MAAM;4BAEtC,MAAM,EAAE,GAAG,SAAS,KAAG,MAAM;;;qCAMpB,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":"AAGA,eAAO,MAAM,M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AAG,MAAM;4CAE3B,MAAM,SAAS,MAAM,KAAG,MAAM;gDAE1B,MAAM,aAAa,MAAM,KAAG,MAAM;4CAEtC,MAAM,SAAS,MAAM,KAAG,MAAM;;;;CAKjE,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,mBAAmB,0BAA0B;IAC7C,SAAS,4BAA4B;IACrC,SAAS,4BAA4B;IACrC,UAAU,wBAAwB;IAClC,GAAG,8BAA8B;CAClC"}
|
package/out/text/errors.js
CHANGED
|
@@ -26,6 +26,7 @@ exports.errors = {
|
|
|
26
26
|
permissions: {
|
|
27
27
|
invalidPermission: (element, value) => `Invalid '${element}' permission in the manifest.yml file - '${value}'. Learn more about permissions at: https://go.atlassian.com/forge-permissions.`,
|
|
28
28
|
missingPermissionFromScope: (scope, event) => `Trigger event: '${event}' requires '${scope}' scope`,
|
|
29
|
+
missingEndpointPermissionFromScope: (scope, key) => `Endpoint module: '${key}' requires '${scope}' scope.`,
|
|
29
30
|
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.`
|
|
30
31
|
},
|
|
31
32
|
connectModules: {
|
|
@@ -2,6 +2,7 @@ export declare enum ValidationTypes {
|
|
|
2
2
|
BASIC = "basic",
|
|
3
3
|
FULL = "full",
|
|
4
4
|
PRODUCT_TRIGGER = "product-trigger",
|
|
5
|
-
DEPRECATED_CSP_METHOD = "deprecated-csp-method"
|
|
5
|
+
DEPRECATED_CSP_METHOD = "deprecated-csp-method",
|
|
6
|
+
FORGE_REMOTE_COMPUTE = "forge-remote-compute"
|
|
6
7
|
}
|
|
7
8
|
//# sourceMappingURL=validation-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-types.d.ts","sourceRoot":"","sources":["../../src/types/validation-types.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,eAAe,oBAAoB;IACnC,qBAAqB,0BAA0B;
|
|
1
|
+
{"version":3,"file":"validation-types.d.ts","sourceRoot":"","sources":["../../src/types/validation-types.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,eAAe,oBAAoB;IACnC,qBAAqB,0BAA0B;IAC/C,oBAAoB,yBAAyB;CAC9C"}
|
|
@@ -7,4 +7,5 @@ var ValidationTypes;
|
|
|
7
7
|
ValidationTypes["FULL"] = "full";
|
|
8
8
|
ValidationTypes["PRODUCT_TRIGGER"] = "product-trigger";
|
|
9
9
|
ValidationTypes["DEPRECATED_CSP_METHOD"] = "deprecated-csp-method";
|
|
10
|
+
ValidationTypes["FORGE_REMOTE_COMPUTE"] = "forge-remote-compute";
|
|
10
11
|
})(ValidationTypes = exports.ValidationTypes || (exports.ValidationTypes = {}));
|
|
@@ -4,6 +4,7 @@ import { ValidatorInterface } from './validator-interface';
|
|
|
4
4
|
export declare class ModulesValidator implements ValidatorInterface<ManifestObject<ManifestSchema> | undefined, ManifestSchema> {
|
|
5
5
|
private functionHandlerRegex;
|
|
6
6
|
validate(manifest: ManifestObject<ManifestSchema> | undefined): Promise<ManifestValidationResult<ManifestSchema>>;
|
|
7
|
+
private connectModuleValidation;
|
|
7
8
|
private endpointValidations;
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=modules-validator.d.ts.map
|
|
@@ -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,EAIzB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,cAAc,EAAW,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAQ3D,qBAAa,gBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IACzF,OAAO,CAAC,oBAAoB,CAA0C;IAEhE,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"modules-validator.d.ts","sourceRoot":"","sources":["../../src/validators/modules-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,wBAAwB,EAIzB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,cAAc,EAAW,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAQ3D,qBAAa,gBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IACzF,OAAO,CAAC,oBAAoB,CAA0C;IAEhE,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;IAmPpD,OAAO,CAAC,uBAAuB;IAY/B,OAAO,CAAC,mBAAmB;CAkD5B"}
|
|
@@ -23,20 +23,12 @@ class ModulesValidator {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
const validationErrors = [];
|
|
26
|
-
|
|
27
|
-
validationErrors.push({
|
|
28
|
-
message: text_1.errors.schemaError(undefined, [], text_1.errors.schema.oneOf([['modules'], ['connectModules']])),
|
|
29
|
-
reference: text_1.References.SchemaError,
|
|
30
|
-
level: 'error',
|
|
31
|
-
line: 1,
|
|
32
|
-
column: 0
|
|
33
|
-
});
|
|
34
|
-
}
|
|
26
|
+
this.connectModuleValidation(manifest, validationErrors);
|
|
35
27
|
function isNotFunctionOrEndpoint(moduleKey) {
|
|
36
28
|
return moduleKey !== (0, utils_1.cleanKey)(types_1.AllModuleTypes.CoreFunction) && moduleKey !== (0, utils_1.cleanKey)(types_1.AllModuleTypes.CoreEndpoint);
|
|
37
29
|
}
|
|
38
30
|
if (manifest.typedContent.modules) {
|
|
39
|
-
const { typedContent: { modules, remotes }, yamlContentByLine, filePath } = manifest;
|
|
31
|
+
const { typedContent: { modules, remotes, permissions }, yamlContentByLine, filePath } = manifest;
|
|
40
32
|
const { function: _function, endpoint: _endpoint } = modules;
|
|
41
33
|
Object.keys(manifest.typedContent.modules)
|
|
42
34
|
.filter((key) => !types_1.SUPPORTED_MODULES.map((key) => (0, utils_1.cleanKey)(key)).includes(key))
|
|
@@ -63,7 +55,7 @@ class ModulesValidator {
|
|
|
63
55
|
});
|
|
64
56
|
});
|
|
65
57
|
});
|
|
66
|
-
this.endpointValidations(_endpoint, validationErrors, yamlContentByLine, remotes);
|
|
58
|
+
this.endpointValidations(_endpoint, validationErrors, yamlContentByLine, remotes, (permissions === null || permissions === void 0 ? void 0 : permissions.scopes) || []);
|
|
67
59
|
const moduleKeys = [];
|
|
68
60
|
Object.keys(modules).forEach((moduleKey) => {
|
|
69
61
|
var _a;
|
|
@@ -144,14 +136,39 @@ class ModulesValidator {
|
|
|
144
136
|
errors: validationErrors
|
|
145
137
|
};
|
|
146
138
|
}
|
|
147
|
-
|
|
139
|
+
connectModuleValidation(manifest, validationErrors) {
|
|
140
|
+
var _a, _b;
|
|
141
|
+
if (!((_a = manifest.typedContent) === null || _a === void 0 ? void 0 : _a.modules) && !((_b = manifest.typedContent) === null || _b === void 0 ? void 0 : _b.connectModules)) {
|
|
142
|
+
validationErrors.push({
|
|
143
|
+
message: text_1.errors.schemaError(undefined, [], text_1.errors.schema.oneOf([['modules'], ['connectModules']])),
|
|
144
|
+
reference: text_1.References.SchemaError,
|
|
145
|
+
level: 'error',
|
|
146
|
+
line: 1,
|
|
147
|
+
column: 0
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
endpointValidations(_endpoint, validationErrors, yamlContentByLine, remotes, scopes) {
|
|
152
|
+
const SYSTEM_TOKEN_SCOPE = 'read:app-system-token';
|
|
153
|
+
const USER_TOKEN_SCOPE = 'read:app-user-token';
|
|
148
154
|
const _checkRemoteExists = (remoteKey) => {
|
|
149
155
|
return (remotes === null || remotes === void 0 ? void 0 : remotes.find((remote) => remote.key === remoteKey)) !== undefined;
|
|
150
156
|
};
|
|
151
157
|
_endpoint === null || _endpoint === void 0 ? void 0 : _endpoint.forEach((endpoint) => {
|
|
158
|
+
var _a, _b, _c, _d;
|
|
152
159
|
if (!_checkRemoteExists(endpoint.remote)) {
|
|
153
160
|
validationErrors.push(Object.assign({ message: text_1.errors.modules.endpoint.remote.notExists(endpoint.remote), reference: text_1.References.Modules, level: 'error' }, (0, utils_1.findPosition)(endpoint.remote, yamlContentByLine)));
|
|
154
161
|
}
|
|
162
|
+
if (((_b = (_a = endpoint.auth) === null || _a === void 0 ? void 0 : _a.appUserToken) === null || _b === void 0 ? void 0 : _b.enabled) && !scopes.includes(USER_TOKEN_SCOPE)) {
|
|
163
|
+
validationErrors.push(Object.assign({ message: text_1.errors.permissions.missingEndpointPermissionFromScope(USER_TOKEN_SCOPE, endpoint.key), reference: text_1.References.MissingScopes, level: 'error', metadata: {
|
|
164
|
+
missingPermission: USER_TOKEN_SCOPE
|
|
165
|
+
} }, (0, utils_1.findPosition)('scopes', yamlContentByLine)));
|
|
166
|
+
}
|
|
167
|
+
if (((_d = (_c = endpoint.auth) === null || _c === void 0 ? void 0 : _c.appSystemToken) === null || _d === void 0 ? void 0 : _d.enabled) && !scopes.includes(SYSTEM_TOKEN_SCOPE)) {
|
|
168
|
+
validationErrors.push(Object.assign({ message: text_1.errors.permissions.missingEndpointPermissionFromScope(SYSTEM_TOKEN_SCOPE, endpoint.key), reference: text_1.References.MissingScopes, level: 'error', metadata: {
|
|
169
|
+
missingPermission: SYSTEM_TOKEN_SCOPE
|
|
170
|
+
} }, (0, utils_1.findPosition)('scopes', yamlContentByLine)));
|
|
171
|
+
}
|
|
155
172
|
});
|
|
156
173
|
}
|
|
157
174
|
}
|