@forge/manifest 7.2.0-next.1 → 7.2.0-next.2
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 +6 -0
- package/out/builder/processor-builder.js +1 -2
- package/out/processor/abstract-validation-processor.js +2 -2
- package/out/scopes/index.js +7 -6
- package/out/text/errors.d.ts +0 -1
- package/out/text/errors.d.ts.map +1 -1
- package/out/text/errors.js +1 -2
- package/out/utils/index.d.ts +0 -1
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +0 -1
- package/out/utils/module-references.js +1 -1
- package/out/validators/app-features-validator.js +4 -8
- package/out/validators/connect-authentication-validator.js +4 -8
- package/out/validators/connect-modules-validator.js +3 -18
- package/out/validators/connect-remote-validator.js +7 -16
- package/out/validators/data-classification-validator.js +5 -8
- package/out/validators/display-conditions-validator.js +7 -8
- package/out/validators/entity-property-validator.js +6 -9
- package/out/validators/jql-function-validator.js +6 -9
- package/out/validators/modules-validator.js +49 -136
- package/out/validators/modules-validators/bitbucket/validateBackendModuleEndpoints.js +8 -16
- package/out/validators/modules-validators/confluence/validateCrossModulePropertyUniqueness.js +2 -6
- package/out/validators/modules-validators/confluence/validateCustomContentHierarchy.js +2 -12
- package/out/validators/modules-validators/confluence/validateKeyboardShortcuts.js +2 -7
- package/out/validators/modules-validators/confluence/validatePropertyUniqueness.js +2 -6
- package/out/validators/modules-validators/confluence/validateSingleProperty.js +1 -6
- package/out/validators/modules-validators/jira/ui-modifications.js +1 -6
- package/out/validators/modules-validators/jira/validate-full-admin-page.js +11 -21
- package/out/validators/modules-validators/jira/validate-subpages-in-module.js +2 -12
- package/out/validators/modules-validators/remote/validate-storage-operation.js +4 -8
- package/out/validators/modules-validators/validateModuleScopes.js +2 -7
- package/out/validators/package-validator.js +2 -1
- package/out/validators/permissions-validator.js +24 -32
- package/out/validators/product-trigger-scopes-validator.js +6 -11
- package/out/validators/providers-validator.js +16 -35
- package/out/validators/resources-validator.js +15 -54
- package/out/validators/schema-validator.js +84 -104
- package/out/validators/snapshot-validator.js +4 -3
- package/out/validators/storage-validator.js +14 -41
- package/out/validators/yaml-validator.d.ts +0 -2
- package/out/validators/yaml-validator.d.ts.map +1 -1
- package/out/validators/yaml-validator.js +6 -10
- package/package.json +1 -2
- package/out/utils/manifest-parser.d.ts +0 -15
- package/out/utils/manifest-parser.d.ts.map +0 -1
- package/out/utils/manifest-parser.js +0 -42
|
@@ -4,12 +4,15 @@ exports.StorageValidator = void 0;
|
|
|
4
4
|
const text_1 = require("../text");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
class StorageValidator {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
constructor() {
|
|
8
|
+
this.entityAttributeMaxLength = 30;
|
|
9
|
+
this.entityAttributesMaxCount = 50;
|
|
10
|
+
this.entityIndexesMaxCount = 7;
|
|
11
|
+
this.reservedIndexName = 'by-key';
|
|
12
|
+
}
|
|
11
13
|
async validate(manifest) {
|
|
12
|
-
|
|
14
|
+
var _a, _b;
|
|
15
|
+
if (!((_b = (_a = manifest === null || manifest === void 0 ? void 0 : manifest.typedContent) === null || _a === void 0 ? void 0 : _a.app) === null || _b === void 0 ? void 0 : _b.storage)) {
|
|
13
16
|
return {
|
|
14
17
|
success: true,
|
|
15
18
|
manifestObject: manifest
|
|
@@ -26,32 +29,17 @@ class StorageValidator {
|
|
|
26
29
|
entities.forEach((entity) => {
|
|
27
30
|
const { name, attributes } = entity;
|
|
28
31
|
if (Object.keys(attributes).length > this.entityAttributesMaxCount) {
|
|
29
|
-
validationErrors.push({
|
|
30
|
-
message: text_1.errors.app.storage.entities.tooManyAttributes(name, this.entityAttributesMaxCount),
|
|
31
|
-
reference: text_1.References.App,
|
|
32
|
-
level: 'error',
|
|
33
|
-
...(0, utils_1.findPosition)('entities', manifest.yamlContentByLine)
|
|
34
|
-
});
|
|
32
|
+
validationErrors.push(Object.assign({ message: text_1.errors.app.storage.entities.tooManyAttributes(name, this.entityAttributesMaxCount), reference: text_1.References.App, level: 'error' }, (0, utils_1.findPosition)('entities', manifest.yamlContentByLine)));
|
|
35
33
|
}
|
|
36
34
|
Object.keys(attributes).forEach((attributeKey) => {
|
|
37
35
|
if (attributeKey.length > this.entityAttributeMaxLength) {
|
|
38
|
-
validationErrors.push({
|
|
39
|
-
message: text_1.errors.app.storage.entities.attributeNameTooLong(name, attributeKey, this.entityAttributeMaxLength),
|
|
40
|
-
reference: text_1.References.App,
|
|
41
|
-
level: 'error',
|
|
42
|
-
...(0, utils_1.findPosition)('entities', manifest.yamlContentByLine)
|
|
43
|
-
});
|
|
36
|
+
validationErrors.push(Object.assign({ message: text_1.errors.app.storage.entities.attributeNameTooLong(name, attributeKey, this.entityAttributeMaxLength), reference: text_1.References.App, level: 'error' }, (0, utils_1.findPosition)('entities', manifest.yamlContentByLine)));
|
|
44
37
|
}
|
|
45
38
|
});
|
|
46
39
|
if (entity.indexes) {
|
|
47
40
|
const { indexes } = entity;
|
|
48
41
|
if (indexes.length > this.entityIndexesMaxCount) {
|
|
49
|
-
validationErrors.push({
|
|
50
|
-
message: text_1.errors.app.storage.entities.tooManyIndexes(name, this.entityIndexesMaxCount),
|
|
51
|
-
reference: text_1.References.App,
|
|
52
|
-
level: 'error',
|
|
53
|
-
...(0, utils_1.findPosition)('entities', manifest.yamlContentByLine)
|
|
54
|
-
});
|
|
42
|
+
validationErrors.push(Object.assign({ message: text_1.errors.app.storage.entities.tooManyIndexes(name, this.entityIndexesMaxCount), reference: text_1.References.App, level: 'error' }, (0, utils_1.findPosition)('entities', manifest.yamlContentByLine)));
|
|
55
43
|
}
|
|
56
44
|
const indexName = [];
|
|
57
45
|
const indexRange = [];
|
|
@@ -69,31 +57,16 @@ class StorageValidator {
|
|
|
69
57
|
}
|
|
70
58
|
});
|
|
71
59
|
if (indexName.find((name) => name === this.reservedIndexName)) {
|
|
72
|
-
validationErrors.push({
|
|
73
|
-
message: text_1.errors.app.storage.entities.reservedIndexName(name, this.reservedIndexName),
|
|
74
|
-
reference: text_1.References.App,
|
|
75
|
-
level: 'error',
|
|
76
|
-
...(0, utils_1.findPosition)('entities', manifest.yamlContentByLine)
|
|
77
|
-
});
|
|
60
|
+
validationErrors.push(Object.assign({ message: text_1.errors.app.storage.entities.reservedIndexName(name, this.reservedIndexName), reference: text_1.References.App, level: 'error' }, (0, utils_1.findPosition)('entities', manifest.yamlContentByLine)));
|
|
78
61
|
}
|
|
79
62
|
indexRange.forEach((range) => {
|
|
80
63
|
if (!Object.keys(attributes).length || !attributes[range]) {
|
|
81
|
-
validationErrors.push({
|
|
82
|
-
message: text_1.errors.app.storage.entities.invalidIndexRange(name, range),
|
|
83
|
-
reference: text_1.References.App,
|
|
84
|
-
level: 'error',
|
|
85
|
-
...(0, utils_1.findPosition)('entities', manifest.yamlContentByLine)
|
|
86
|
-
});
|
|
64
|
+
validationErrors.push(Object.assign({ message: text_1.errors.app.storage.entities.invalidIndexRange(name, range), reference: text_1.References.App, level: 'error' }, (0, utils_1.findPosition)('entities', manifest.yamlContentByLine)));
|
|
87
65
|
}
|
|
88
66
|
});
|
|
89
67
|
indexPartition.forEach((partition) => {
|
|
90
68
|
if (!Object.keys(attributes).length || !attributes[partition]) {
|
|
91
|
-
validationErrors.push({
|
|
92
|
-
message: text_1.errors.app.storage.entities.invalidIndexPartition(name, partition),
|
|
93
|
-
reference: text_1.References.App,
|
|
94
|
-
level: 'error',
|
|
95
|
-
...(0, utils_1.findPosition)('entities', manifest.yamlContentByLine)
|
|
96
|
-
});
|
|
69
|
+
validationErrors.push(Object.assign({ message: text_1.errors.app.storage.entities.invalidIndexPartition(name, partition), reference: text_1.References.App, level: 'error' }, (0, utils_1.findPosition)('entities', manifest.yamlContentByLine)));
|
|
97
70
|
}
|
|
98
71
|
});
|
|
99
72
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ManifestObject, ManifestValidationResult } from '../types';
|
|
2
2
|
import { ValidatorInterface } from './validator-interface';
|
|
3
3
|
export declare class YamlValidator<T> implements ValidatorInterface<ManifestObject<T> | undefined, T> {
|
|
4
|
-
private manifestParser;
|
|
5
|
-
constructor();
|
|
6
4
|
validate(manifest: ManifestObject<T> | undefined): Promise<ManifestValidationResult<T>>;
|
|
7
5
|
}
|
|
8
6
|
//# sourceMappingURL=yaml-validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml-validator.d.ts","sourceRoot":"","sources":["../../src/validators/yaml-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAIpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"yaml-validator.d.ts","sourceRoot":"","sources":["../../src/validators/yaml-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAIpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,qBAAa,aAAa,CAAC,CAAC,CAAE,YAAW,kBAAkB,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC;IACrF,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC;CAiD9F"}
|
|
@@ -2,16 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.YamlValidator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const yaml_1 = require("yaml");
|
|
5
|
+
const yaml_1 = tslib_1.__importStar(require("yaml"));
|
|
6
6
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
7
7
|
const text_1 = require("../text");
|
|
8
|
-
const __1 = require("..");
|
|
9
8
|
class YamlValidator {
|
|
10
|
-
manifestParser;
|
|
11
|
-
constructor() {
|
|
12
|
-
this.manifestParser = new __1.ManifestParser(process.env);
|
|
13
|
-
}
|
|
14
9
|
async validate(manifest) {
|
|
10
|
+
var _a, _b, _c;
|
|
15
11
|
if (!manifest || !manifest.filePath) {
|
|
16
12
|
return {
|
|
17
13
|
success: false,
|
|
@@ -20,7 +16,7 @@ class YamlValidator {
|
|
|
20
16
|
}
|
|
21
17
|
try {
|
|
22
18
|
const content = fs_1.default.readFileSync(manifest.filePath, 'utf8');
|
|
23
|
-
const manifestContent =
|
|
19
|
+
const manifestContent = yaml_1.default.parse(content);
|
|
24
20
|
return {
|
|
25
21
|
success: true,
|
|
26
22
|
manifestObject: {
|
|
@@ -32,7 +28,7 @@ class YamlValidator {
|
|
|
32
28
|
}
|
|
33
29
|
catch (e) {
|
|
34
30
|
if (e instanceof yaml_1.YAMLError) {
|
|
35
|
-
const pos = e.linePos
|
|
31
|
+
const pos = (_a = e.linePos) === null || _a === void 0 ? void 0 : _a[0];
|
|
36
32
|
return {
|
|
37
33
|
success: false,
|
|
38
34
|
errors: [
|
|
@@ -40,8 +36,8 @@ class YamlValidator {
|
|
|
40
36
|
message: text_1.errors.invalidManifest(e.message.replace(/(at line).+/gms, '').trim()),
|
|
41
37
|
reference: text_1.References.InvalidManifest,
|
|
42
38
|
level: 'error',
|
|
43
|
-
line: pos
|
|
44
|
-
column: pos
|
|
39
|
+
line: (_b = pos === null || pos === void 0 ? void 0 : pos.line) !== null && _b !== void 0 ? _b : 0,
|
|
40
|
+
column: (_c = pos === null || pos === void 0 ? void 0 : pos.col) !== null && _c !== void 0 ? _c : 0
|
|
45
41
|
}
|
|
46
42
|
]
|
|
47
43
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/manifest",
|
|
3
|
-
"version": "7.2.0-next.
|
|
3
|
+
"version": "7.2.0-next.2",
|
|
4
4
|
"description": "Definitions and validations of the Forge manifest",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"license": "UNLICENSED",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@forge/util": "1.4.3",
|
|
26
|
-
"@sentry/node": "7.100.1",
|
|
27
26
|
"ajv": "^8.12.0",
|
|
28
27
|
"ajv-formats": "2.1.1",
|
|
29
28
|
"cheerio": "^0.22.0",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ManifestSchema } from '../schema/manifest';
|
|
2
|
-
export declare class ManifestParserError extends Error {
|
|
3
|
-
constructor(message: string);
|
|
4
|
-
getAttributes(): {
|
|
5
|
-
isUserError: boolean;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
export declare class ManifestParser {
|
|
9
|
-
private readonly envVarsRecord;
|
|
10
|
-
constructor(envVarsRecord?: Record<string, string | undefined>);
|
|
11
|
-
parseManifest: (manifest: string) => ManifestSchema;
|
|
12
|
-
parseManifestAsString: (manifest: string) => string;
|
|
13
|
-
private environmentVariableReviver;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=manifest-parser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-parser.d.ts","sourceRoot":"","sources":["../../src/utils/manifest-parser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAKpD,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;IAMpB,aAAa;;;CAKrB;AACD,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAM;IACnF,aAAa,aAAc,MAAM,oBAAwE;IAEzG,qBAAqB,aAAc,MAAM,YAAgE;IAEzG,OAAO,CAAC,0BAA0B,CAgBhC;CACH"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ManifestParser = exports.ManifestParserError = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const yaml_1 = require("yaml");
|
|
6
|
-
const errors_1 = require("../text/errors");
|
|
7
|
-
const Sentry = tslib_1.__importStar(require("@sentry/node"));
|
|
8
|
-
const yamlConfigOptions = { indent: 2, skipInvalid: true };
|
|
9
|
-
class ManifestParserError extends Error {
|
|
10
|
-
constructor(message) {
|
|
11
|
-
super(message);
|
|
12
|
-
}
|
|
13
|
-
getAttributes() {
|
|
14
|
-
return {
|
|
15
|
-
isUserError: true
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.ManifestParserError = ManifestParserError;
|
|
20
|
-
class ManifestParser {
|
|
21
|
-
envVarsRecord;
|
|
22
|
-
constructor(envVarsRecord = {}) {
|
|
23
|
-
this.envVarsRecord = envVarsRecord;
|
|
24
|
-
}
|
|
25
|
-
parseManifest = (manifest) => (0, yaml_1.parse)(manifest, this.environmentVariableReviver);
|
|
26
|
-
parseManifestAsString = (manifest) => (0, yaml_1.stringify)(this.parseManifest(manifest), yamlConfigOptions);
|
|
27
|
-
environmentVariableReviver = (_, value) => {
|
|
28
|
-
if (!(typeof value == 'string')) {
|
|
29
|
-
return value;
|
|
30
|
-
}
|
|
31
|
-
value = value.replaceAll(/\$\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g, (_, envVarName) => {
|
|
32
|
-
const envVar = this.envVarsRecord[envVarName];
|
|
33
|
-
if (envVar === undefined) {
|
|
34
|
-
throw new ManifestParserError(errors_1.errors.schema.missingEnvironmentVariable(envVarName));
|
|
35
|
-
}
|
|
36
|
-
Sentry.captureMessage('replaced environment variable');
|
|
37
|
-
return envVar;
|
|
38
|
-
});
|
|
39
|
-
return value;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
exports.ManifestParser = ManifestParser;
|