@forge/manifest 4.20.0-next.8 → 4.20.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 +48 -0
- package/out/builder/processor-builder.d.ts +2 -0
- package/out/builder/processor-builder.d.ts.map +1 -1
- package/out/builder/processor-builder.js +11 -1
- package/out/validators/display-conditions-validator.d.ts.map +1 -1
- package/out/validators/display-conditions-validator.js +9 -9
- package/out/validators/permissions-validator.d.ts +0 -2
- package/out/validators/permissions-validator.d.ts.map +1 -1
- package/out/validators/permissions-validator.js +20 -22
- package/out/validators/schema-validator.d.ts.map +1 -1
- package/out/validators/schema-validator.js +5 -2
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# @forge/manifest
|
|
2
2
|
|
|
3
|
+
## 4.20.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b9a5a33a: Add Bitbucket repository page modules bitbucket:repoMainMenuPage and bitbucket:repoSettingsMenuPage
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- b5b05c5f: Only create the validator once
|
|
12
|
+
- ccc113ec: Bumping dependencies via Renovate:
|
|
13
|
+
|
|
14
|
+
- @types/node
|
|
15
|
+
|
|
16
|
+
- e3260cf8: Bumping dependencies via Renovate:
|
|
17
|
+
|
|
18
|
+
- @types/node
|
|
19
|
+
|
|
20
|
+
- 9f70463a: Bumping dependencies via Renovate:
|
|
21
|
+
|
|
22
|
+
- node-fetch
|
|
23
|
+
|
|
24
|
+
- a4cc20b6: Warning printed when trying to snapshot on new runtime
|
|
25
|
+
- 00b3e6cb: Bumping dependencies via Renovate:
|
|
26
|
+
|
|
27
|
+
- typescript-json-schema
|
|
28
|
+
|
|
29
|
+
- bf0a343b: Bumping dependencies via Renovate:
|
|
30
|
+
|
|
31
|
+
- @types/jest
|
|
32
|
+
|
|
33
|
+
- aaf35c3e: Bumping dependencies via Renovate:
|
|
34
|
+
|
|
35
|
+
- ajv
|
|
36
|
+
|
|
37
|
+
- a8ff99b1: Update manifest definitions
|
|
38
|
+
- 9b9f58d3: Bumping dependencies via Renovate:
|
|
39
|
+
|
|
40
|
+
- @types/node
|
|
41
|
+
|
|
42
|
+
## 4.20.0-next.9
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- b5b05c5f: Only create the validator once
|
|
47
|
+
- aaf35c3e: Bumping dependencies via Renovate:
|
|
48
|
+
|
|
49
|
+
- ajv
|
|
50
|
+
|
|
3
51
|
## 4.20.0-next.8
|
|
4
52
|
|
|
5
53
|
### Patch Changes
|
|
@@ -4,10 +4,12 @@ import { BasicManifestSchema } from '../schema/basic-manifest';
|
|
|
4
4
|
import { ProcessorInterface } from '../processor';
|
|
5
5
|
import { BuilderInterface } from './builder-interface';
|
|
6
6
|
export declare class ProcessorBuilder implements BuilderInterface<ProcessorInterface<ManifestSchema | BasicManifestSchema>> {
|
|
7
|
+
private static cache;
|
|
7
8
|
private validationType;
|
|
8
9
|
private constructor();
|
|
9
10
|
static instance(): ProcessorBuilder;
|
|
10
11
|
withValidation(type: ValidationTypes): ProcessorBuilder;
|
|
12
|
+
private buildInternal;
|
|
11
13
|
build(): ProcessorInterface<ManifestSchema | BasicManifestSchema>;
|
|
12
14
|
}
|
|
13
15
|
//# sourceMappingURL=processor-builder.d.ts.map
|
|
@@ -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;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;
|
|
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,MAAM,CAAC,KAAK,CAA6F;IAEjH,OAAO,CAAC,cAAc,CAAkB;IAExC,OAAO;IAIP,MAAM,CAAC,QAAQ,IAAI,gBAAgB;IAInC,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,gBAAgB;IAKvD,OAAO,CAAC,aAAa;IAiBrB,KAAK,IAAI,kBAAkB,CAAC,cAAc,GAAG,mBAAmB,CAAC;CAUlE"}
|
|
@@ -16,7 +16,7 @@ class ProcessorBuilder {
|
|
|
16
16
|
this.validationType = type;
|
|
17
17
|
return this;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
buildInternal() {
|
|
20
20
|
switch (this.validationType) {
|
|
21
21
|
case types_1.ValidationTypes.BASIC:
|
|
22
22
|
return new processor_1.BasicValidationProcessor();
|
|
@@ -32,5 +32,15 @@ class ProcessorBuilder {
|
|
|
32
32
|
throw new Error('Unsupported validation type');
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
build() {
|
|
36
|
+
const cached = ProcessorBuilder.cache.get(this.validationType);
|
|
37
|
+
if (cached) {
|
|
38
|
+
return cached;
|
|
39
|
+
}
|
|
40
|
+
const processor = this.buildInternal();
|
|
41
|
+
ProcessorBuilder.cache.set(this.validationType, processor);
|
|
42
|
+
return processor;
|
|
43
|
+
}
|
|
35
44
|
}
|
|
36
45
|
exports.ProcessorBuilder = ProcessorBuilder;
|
|
46
|
+
ProcessorBuilder.cache = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display-conditions-validator.d.ts","sourceRoot":"","sources":["../../src/validators/display-conditions-validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,cAAc,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAErG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAKpD,qBAAa,0BAA0B,CAAC,CAAC,CACvC,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAM7E,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJnC,OAAO,CAAC,QAAQ,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"display-conditions-validator.d.ts","sourceRoot":"","sources":["../../src/validators/display-conditions-validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,cAAc,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAErG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAKpD,qBAAa,0BAA0B,CAAC,CAAC,CACvC,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAM7E,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAmB;IAClD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAC/C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA2B;gBAElC,MAAM,EAAE,MAAM;IAoE3C,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,EAAE,OAAO,SAAI,GAAG,GAAG;IA2BrF,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe;IAU7C,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;CA2FrD"}
|
|
@@ -10,7 +10,7 @@ class DisplayConditionsValidator {
|
|
|
10
10
|
constructor(schema) {
|
|
11
11
|
var _a, _b, _c;
|
|
12
12
|
this.schema = schema;
|
|
13
|
-
const ajv = new ajv_1.default({ allErrors: true,
|
|
13
|
+
const ajv = new ajv_1.default({ allErrors: true, verbose: true, strict: false });
|
|
14
14
|
this.validateSchema = ajv.compile(this.schema);
|
|
15
15
|
const properties = this.schema.properties;
|
|
16
16
|
this.moduleSchemas = (_a = properties.modules) === null || _a === void 0 ? void 0 : _a.properties;
|
|
@@ -62,8 +62,8 @@ class DisplayConditionsValidator {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
const validationErrors = new Map();
|
|
65
|
-
const reportError = (moduleKey,
|
|
66
|
-
const key = `${moduleKey}__${
|
|
65
|
+
const reportError = (moduleKey, instancePath, message) => {
|
|
66
|
+
const key = `${moduleKey}__${instancePath}`;
|
|
67
67
|
if (!validationErrors.has(key)) {
|
|
68
68
|
validationErrors.set(key, this.toValidationError(message));
|
|
69
69
|
}
|
|
@@ -90,22 +90,22 @@ class DisplayConditionsValidator {
|
|
|
90
90
|
var _a;
|
|
91
91
|
void this.validateSchema({ modules: { [m]: result } });
|
|
92
92
|
(_a = this.validateSchema.errors) === null || _a === void 0 ? void 0 : _a.forEach((error) => {
|
|
93
|
-
const { keyword,
|
|
94
|
-
const split =
|
|
93
|
+
const { keyword, instancePath, params, message } = error;
|
|
94
|
+
const split = instancePath.split('/');
|
|
95
95
|
const path = String(split.pop());
|
|
96
96
|
if (keyword === 'type' && message) {
|
|
97
97
|
if (path === String(Number(path))) {
|
|
98
|
-
reportError(module.key,
|
|
98
|
+
reportError(module.key, instancePath, errors.typeMismatch(module.key, `${split.pop()}[${path}]`, message));
|
|
99
99
|
}
|
|
100
100
|
else {
|
|
101
|
-
reportError(module.key,
|
|
101
|
+
reportError(module.key, instancePath, errors.typeMismatch(module.key, path, message));
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
else if (keyword === 'additionalProperties' && params) {
|
|
105
|
-
reportError(module.key,
|
|
105
|
+
reportError(module.key, instancePath, errors.propertyNotAllowed(module.key, String(params.additionalProperty)));
|
|
106
106
|
}
|
|
107
107
|
else {
|
|
108
|
-
reportError(module.key,
|
|
108
|
+
reportError(module.key, instancePath, errors.invalid(module.key));
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
});
|
|
@@ -2,8 +2,6 @@ import { ManifestObject, ManifestValidationResult } from '../types';
|
|
|
2
2
|
import { ManifestSchema } from '../schema/manifest';
|
|
3
3
|
import { ValidatorInterface } from './validator-interface';
|
|
4
4
|
export declare class PermissionsValidator implements ValidatorInterface<ManifestObject<ManifestSchema> | undefined, ManifestSchema> {
|
|
5
|
-
private validationErrors;
|
|
6
|
-
constructor();
|
|
7
5
|
private isValidURL;
|
|
8
6
|
private isValidHash;
|
|
9
7
|
private addValidationErrors;
|
|
@@ -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,
|
|
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;IAYhC,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;CA+GrD"}
|
|
@@ -9,9 +9,6 @@ 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
11
|
class PermissionsValidator {
|
|
12
|
-
constructor() {
|
|
13
|
-
this.validationErrors = [];
|
|
14
|
-
}
|
|
15
12
|
isValidURL(inputURL) {
|
|
16
13
|
const protocolRegex = /^(.*?:\/\/)/;
|
|
17
14
|
const validURI = /^(\*\.)?[.a-zA-Z0-9_\-\/:~#%?=&]+$/;
|
|
@@ -46,15 +43,15 @@ class PermissionsValidator {
|
|
|
46
43
|
];
|
|
47
44
|
return BASE_64_HASH_PATTERNS.some((pattern) => pattern.test(cspString));
|
|
48
45
|
}
|
|
49
|
-
addValidationErrors(element, values, manifest) {
|
|
46
|
+
addValidationErrors(result, element, values, manifest) {
|
|
50
47
|
values.forEach((value) => {
|
|
51
|
-
|
|
48
|
+
result.push(Object.assign({ message: text_1.errors.permissions.invalidPermission(element, value), reference: text_1.References.Permissions, level: 'error' }, (0, utils_1.findPosition)(value, manifest.yamlContentByLine)));
|
|
52
49
|
});
|
|
53
50
|
}
|
|
54
|
-
validateExternalPermissionURLs(extPermType, perms, manifest) {
|
|
51
|
+
validateExternalPermissionURLs(result, extPermType, perms, manifest) {
|
|
55
52
|
const invalidPerms = perms === null || perms === void 0 ? void 0 : perms.filter((key) => !this.isValidURL(key));
|
|
56
53
|
if (invalidPerms === null || invalidPerms === void 0 ? void 0 : invalidPerms.length) {
|
|
57
|
-
this.addValidationErrors(extPermType, invalidPerms, manifest);
|
|
54
|
+
this.addValidationErrors(result, extPermType, invalidPerms, manifest);
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
57
|
async validate(manifest) {
|
|
@@ -65,44 +62,45 @@ class PermissionsValidator {
|
|
|
65
62
|
manifestObject: manifest
|
|
66
63
|
};
|
|
67
64
|
}
|
|
65
|
+
const errors = [];
|
|
68
66
|
const ALL_SCOPES = shipyard_scopes_json_1.default.concat(deprecated_shipyard_scopes_json_1.default);
|
|
69
67
|
const invalidScopes = (_a = manifest.typedContent.permissions.scopes) === null || _a === void 0 ? void 0 : _a.filter((key) => !ALL_SCOPES.includes(key));
|
|
70
68
|
if (invalidScopes === null || invalidScopes === void 0 ? void 0 : invalidScopes.length) {
|
|
71
|
-
this.addValidationErrors('scopes', invalidScopes, manifest);
|
|
69
|
+
this.addValidationErrors(errors, 'scopes', invalidScopes, manifest);
|
|
72
70
|
}
|
|
73
71
|
const invalidScripts = (_c = (_b = manifest.typedContent.permissions.content) === null || _b === void 0 ? void 0 : _b.scripts) === null || _c === void 0 ? void 0 : _c.filter((key) => !egress_types_1.EGRESS_TYPES.ALLOWED_CSP_TYPES.includes(key) && !this.isValidHash(key));
|
|
74
72
|
if (invalidScripts === null || invalidScripts === void 0 ? void 0 : invalidScripts.length) {
|
|
75
|
-
this.addValidationErrors('content.scripts', invalidScripts, manifest);
|
|
73
|
+
this.addValidationErrors(errors, 'content.scripts', invalidScripts, manifest);
|
|
76
74
|
}
|
|
77
75
|
const invalidBackendStrings = (_f = (_e = (_d = manifest.typedContent.permissions.external) === null || _d === void 0 ? void 0 : _d.fetch) === null || _e === void 0 ? void 0 : _e.backend) === null || _f === void 0 ? void 0 : _f.filter((item) => typeof item === 'string' && !this.isValidURL(item));
|
|
78
76
|
if (invalidBackendStrings === null || invalidBackendStrings === void 0 ? void 0 : invalidBackendStrings.length) {
|
|
79
|
-
this.addValidationErrors('external.fetch.backend', invalidBackendStrings, manifest);
|
|
77
|
+
this.addValidationErrors(errors, 'external.fetch.backend', invalidBackendStrings, manifest);
|
|
80
78
|
}
|
|
81
79
|
const remoteMap = (_g = manifest.typedContent.remotes) === null || _g === void 0 ? void 0 : _g.reduce((prev, item) => prev.set(item.key, item.baseUrl), new Map());
|
|
82
80
|
const invalidBackendRemotes = (_k = (_j = (_h = manifest.typedContent.permissions.external) === null || _h === void 0 ? void 0 : _h.fetch) === null || _j === void 0 ? void 0 : _j.backend) === null || _k === void 0 ? void 0 : _k.filter((item) => typeof item === 'object' &&
|
|
83
81
|
(!remoteMap || !remoteMap.has(item.remote) || !this.isValidURL(remoteMap.get(item.remote)))).map((item) => item.remote);
|
|
84
82
|
if (invalidBackendRemotes === null || invalidBackendRemotes === void 0 ? void 0 : invalidBackendRemotes.length) {
|
|
85
|
-
this.addValidationErrors('external.fetch.backend', invalidBackendRemotes, manifest);
|
|
83
|
+
this.addValidationErrors(errors, 'external.fetch.backend', invalidBackendRemotes, manifest);
|
|
86
84
|
}
|
|
87
85
|
const invalidClientStrings = (_o = (_m = (_l = manifest.typedContent.permissions.external) === null || _l === void 0 ? void 0 : _l.fetch) === null || _m === void 0 ? void 0 : _m.client) === null || _o === void 0 ? void 0 : _o.filter((item) => typeof item === 'string' && !this.isValidURL(item));
|
|
88
86
|
if (invalidClientStrings) {
|
|
89
|
-
this.addValidationErrors('external.fetch.client', invalidClientStrings, manifest);
|
|
87
|
+
this.addValidationErrors(errors, 'external.fetch.client', invalidClientStrings, manifest);
|
|
90
88
|
}
|
|
91
89
|
const invalidClients = (_r = (_q = (_p = manifest.typedContent.permissions.external) === null || _p === void 0 ? void 0 : _p.fetch) === null || _q === void 0 ? void 0 : _q.client) === null || _r === void 0 ? void 0 : _r.filter((item) => typeof item === 'object' &&
|
|
92
90
|
(!remoteMap || !remoteMap.has(item.remote) || !this.isValidURL(remoteMap.get(item.remote)))).map((item) => item.remote);
|
|
93
91
|
if (invalidClients) {
|
|
94
|
-
this.addValidationErrors('external.fetch.client', invalidClients, manifest);
|
|
92
|
+
this.addValidationErrors(errors, 'external.fetch.client', invalidClients, manifest);
|
|
95
93
|
}
|
|
96
|
-
this.validateExternalPermissionURLs('external.navigation', (_s = manifest.typedContent.permissions.external) === null || _s === void 0 ? void 0 : _s.navigation, manifest);
|
|
97
|
-
this.validateExternalPermissionURLs('external.images', (_t = manifest.typedContent.permissions.external) === null || _t === void 0 ? void 0 : _t.images, manifest);
|
|
98
|
-
this.validateExternalPermissionURLs('external.frames', (_u = manifest.typedContent.permissions.external) === null || _u === void 0 ? void 0 : _u.frames, manifest);
|
|
99
|
-
this.validateExternalPermissionURLs('external.scripts', (_v = manifest.typedContent.permissions.external) === null || _v === void 0 ? void 0 : _v.scripts, manifest);
|
|
100
|
-
this.validateExternalPermissionURLs('external.styles', (_w = manifest.typedContent.permissions.external) === null || _w === void 0 ? void 0 : _w.styles, manifest);
|
|
101
|
-
this.validateExternalPermissionURLs('external.media', (_x = manifest.typedContent.permissions.external) === null || _x === void 0 ? void 0 : _x.media, manifest);
|
|
102
|
-
this.validateExternalPermissionURLs('external.fonts', (_y = manifest.typedContent.permissions.external) === null || _y === void 0 ? void 0 : _y.fonts, manifest);
|
|
94
|
+
this.validateExternalPermissionURLs(errors, 'external.navigation', (_s = manifest.typedContent.permissions.external) === null || _s === void 0 ? void 0 : _s.navigation, manifest);
|
|
95
|
+
this.validateExternalPermissionURLs(errors, 'external.images', (_t = manifest.typedContent.permissions.external) === null || _t === void 0 ? void 0 : _t.images, manifest);
|
|
96
|
+
this.validateExternalPermissionURLs(errors, 'external.frames', (_u = manifest.typedContent.permissions.external) === null || _u === void 0 ? void 0 : _u.frames, manifest);
|
|
97
|
+
this.validateExternalPermissionURLs(errors, 'external.scripts', (_v = manifest.typedContent.permissions.external) === null || _v === void 0 ? void 0 : _v.scripts, manifest);
|
|
98
|
+
this.validateExternalPermissionURLs(errors, 'external.styles', (_w = manifest.typedContent.permissions.external) === null || _w === void 0 ? void 0 : _w.styles, manifest);
|
|
99
|
+
this.validateExternalPermissionURLs(errors, 'external.media', (_x = manifest.typedContent.permissions.external) === null || _x === void 0 ? void 0 : _x.media, manifest);
|
|
100
|
+
this.validateExternalPermissionURLs(errors, 'external.fonts', (_y = manifest.typedContent.permissions.external) === null || _y === void 0 ? void 0 : _y.fonts, manifest);
|
|
103
101
|
return {
|
|
104
|
-
success:
|
|
105
|
-
errors
|
|
102
|
+
success: errors.length === 0,
|
|
103
|
+
errors
|
|
106
104
|
};
|
|
107
105
|
}
|
|
108
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-validator.d.ts","sourceRoot":"","sources":["../../src/validators/schema-validator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema-validator.d.ts","sourceRoot":"","sources":["../../src/validators/schema-validator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAA0C,MAAM,UAAU,CAAC;AAG5G,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,qBAAa,eAAe,CAAC,CAAC,CAAE,YAAW,kBAAkB,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC;IAGjF,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAmB;gBAErB,MAAM,EAAE,MAAM;IAS3C,OAAO,CAAC,mBAAmB,CAgCzB;IAEF,OAAO,CAAC,iBAAiB,CAyBvB;IAEF,OAAO,CAAC,kBAAkB,CAyBxB;IAEF,OAAO,CAAC,iBAAiB,CAKvB;IAEF,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,qBAAqB,CAa3B;IAEF,OAAO,CAAC,WAAW,CAejB;IAEI,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC;CAkD9F"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SchemaValidator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ajv_1 = tslib_1.__importDefault(require("ajv"));
|
|
6
|
+
const ajv_formats_1 = tslib_1.__importDefault(require("ajv-formats"));
|
|
6
7
|
const utils_1 = require("../utils");
|
|
7
8
|
const text_1 = require("../text");
|
|
8
9
|
class SchemaValidator {
|
|
@@ -86,7 +87,9 @@ class SchemaValidator {
|
|
|
86
87
|
}
|
|
87
88
|
return this.handleGenericError(path, error, manifest);
|
|
88
89
|
};
|
|
89
|
-
const ajv = new ajv_1.default({ allErrors: true,
|
|
90
|
+
const ajv = new ajv_1.default({ allErrors: true, verbose: true, strict: false });
|
|
91
|
+
(0, ajv_formats_1.default)(ajv);
|
|
92
|
+
ajv.addVocabulary(['defaultValue', 'fieldDescription', 'fieldTitle', 'shortClassName']);
|
|
90
93
|
this.validateSchema = ajv.compile(this.schema);
|
|
91
94
|
}
|
|
92
95
|
getDeprecationInfo(section, property) {
|
|
@@ -109,7 +112,7 @@ class SchemaValidator {
|
|
|
109
112
|
}
|
|
110
113
|
let success = this.validateSchema(manifest.yamlContent);
|
|
111
114
|
const errors = (_a = this.validateSchema.errors) === null || _a === void 0 ? void 0 : _a.map((error) => {
|
|
112
|
-
const values = error.
|
|
115
|
+
const values = error.instancePath.replace(/\/\d+/, '').split('/').slice(1);
|
|
113
116
|
return this.handleError(values, error, manifest);
|
|
114
117
|
}).filter((e) => e !== undefined);
|
|
115
118
|
const _isEqual = (e1, e2) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/manifest",
|
|
3
|
-
"version": "4.20.0
|
|
3
|
+
"version": "4.20.0",
|
|
4
4
|
"description": "Definitions and validations of the Forge manifest",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,12 +24,13 @@
|
|
|
24
24
|
"license": "UNLICENSED",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@forge/util": "1.3.1",
|
|
27
|
-
"ajv": "^
|
|
27
|
+
"ajv": "^8.12.0",
|
|
28
28
|
"cheerio": "^0.22.0",
|
|
29
29
|
"js-yaml": "^3.14.1",
|
|
30
30
|
"json-schema-to-typescript": "^9.1.1",
|
|
31
31
|
"lodash": "^4.17.21",
|
|
32
32
|
"node-fetch": "2.7.0",
|
|
33
|
-
"typescript-json-schema": "^0.60.0"
|
|
33
|
+
"typescript-json-schema": "^0.60.0",
|
|
34
|
+
"ajv-formats": "2.1.1"
|
|
34
35
|
}
|
|
35
36
|
}
|