@forge/manifest 0.0.0-experimental-e739c13 → 0.0.0-experimental-9fff5da
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 +243 -3
- package/out/index.d.ts +1 -1
- package/out/index.d.ts.map +1 -1
- package/out/processor/full-validation-processor.d.ts.map +1 -1
- package/out/processor/full-validation-processor.js +5 -3
- package/out/schema/basic-manifest-schema.json +24 -7
- package/out/schema/basic-manifest.d.ts +13 -3
- package/out/schema/manifest-schema.json +7383 -804
- package/out/schema/manifest.d.ts +50174 -162
- package/out/scopes/shipyard-scopes.json +191 -0
- package/out/text/errors.d.ts +24 -1
- package/out/text/errors.d.ts.map +1 -1
- package/out/text/errors.js +24 -1
- package/out/types/index.d.ts +0 -1
- package/out/types/index.d.ts.map +1 -1
- package/out/types/index.js +0 -1
- package/out/types/module-types.d.ts +58 -1
- package/out/types/module-types.d.ts.map +1 -1
- package/out/types/module-types.js +57 -0
- package/out/utils/line-finder.d.ts +1 -1
- package/out/utils/line-finder.d.ts.map +1 -1
- package/out/utils/line-finder.js +25 -7
- package/out/utils/module-key-cleaner.d.ts.map +1 -1
- package/out/validators/connect-modules-validator.d.ts +7 -0
- package/out/validators/connect-modules-validator.d.ts.map +1 -0
- package/out/validators/connect-modules-validator.js +48 -0
- package/out/validators/connect-remote-validator.d.ts +7 -0
- package/out/validators/connect-remote-validator.d.ts.map +1 -0
- package/out/validators/connect-remote-validator.js +31 -0
- package/out/validators/index.d.ts +4 -0
- package/out/validators/index.d.ts.map +1 -1
- package/out/validators/index.js +4 -0
- package/out/validators/modules-validator.d.ts.map +1 -1
- package/out/validators/modules-validator.js +16 -0
- package/out/validators/permissions-validator.d.ts.map +1 -1
- package/out/validators/permissions-validator.js +17 -11
- package/out/validators/providers-validator.d.ts +8 -0
- package/out/validators/providers-validator.d.ts.map +1 -0
- package/out/validators/providers-validator.js +71 -0
- package/out/validators/schema-validator.d.ts.map +1 -1
- package/out/validators/schema-validator.js +11 -2
- package/package.json +1 -1
- package/out/types/scopes-types.d.ts +0 -2
- package/out/types/scopes-types.d.ts.map +0 -1
- package/out/types/scopes-types.js +0 -52
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConnectRemoteValidator = void 0;
|
|
4
|
+
const text_1 = require("../text");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
class ConnectRemoteValidator {
|
|
7
|
+
validate(manifest) {
|
|
8
|
+
var _a, _b, _c, _d, _e;
|
|
9
|
+
if (!((_a = manifest === null || manifest === void 0 ? void 0 : manifest.typedContent) === null || _a === void 0 ? void 0 : _a.app)) {
|
|
10
|
+
return {
|
|
11
|
+
success: false,
|
|
12
|
+
manifestObject: manifest
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const app = manifest.typedContent.app;
|
|
16
|
+
const validationErrors = [];
|
|
17
|
+
if (manifest.typedContent.connectModules && !((_b = app.connect) === null || _b === void 0 ? void 0 : _b.remote)) {
|
|
18
|
+
validationErrors.push(Object.assign({ message: text_1.errors.app.missingAppConnectRemote(), reference: text_1.References.App, level: 'error' }, utils_1.findPosition('connect', manifest.yamlContentByLine)));
|
|
19
|
+
}
|
|
20
|
+
if (manifest.typedContent.connectModules && ((_c = app === null || app === void 0 ? void 0 : app.connect) === null || _c === void 0 ? void 0 : _c.remote) &&
|
|
21
|
+
!((_d = manifest.typedContent.remotes) === null || _d === void 0 ? void 0 : _d.find((remote) => { var _a; return remote.key === ((_a = app === null || app === void 0 ? void 0 : app.connect) === null || _a === void 0 ? void 0 : _a.remote); }))) {
|
|
22
|
+
validationErrors.push(Object.assign({ message: text_1.errors.app.missingRemoteForConnect(((_e = app === null || app === void 0 ? void 0 : app.connect) === null || _e === void 0 ? void 0 : _e.remote) || 'undefined'), reference: text_1.References.App, level: 'error' }, utils_1.findPosition('connect', manifest.yamlContentByLine)));
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
success: validationErrors.length === 0,
|
|
26
|
+
manifestObject: manifest,
|
|
27
|
+
errors: validationErrors
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.ConnectRemoteValidator = ConnectRemoteValidator;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './modules-validator';
|
|
2
|
+
export * from './connect-modules-validator';
|
|
2
3
|
export * from './schema-validator';
|
|
3
4
|
export * from './file-validator';
|
|
4
5
|
export * from './yaml-validator';
|
|
@@ -6,4 +7,7 @@ export * from './validator-interface';
|
|
|
6
7
|
export * from './resources-validator';
|
|
7
8
|
export * from './display-conditions-validator';
|
|
8
9
|
export * from './product-trigger-scopes-validator';
|
|
10
|
+
export * from './providers-validator';
|
|
11
|
+
export * from './permissions-validator';
|
|
12
|
+
export * from './connect-remote-validator';
|
|
9
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validators/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,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"}
|
|
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,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC"}
|
package/out/validators/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./modules-validator"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./connect-modules-validator"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./schema-validator"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./file-validator"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./yaml-validator"), exports);
|
|
@@ -9,3 +10,6 @@ tslib_1.__exportStar(require("./validator-interface"), exports);
|
|
|
9
10
|
tslib_1.__exportStar(require("./resources-validator"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./display-conditions-validator"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./product-trigger-scopes-validator"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./providers-validator"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./permissions-validator"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./connect-remote-validator"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules-validator.d.ts","sourceRoot":"","sources":["../../src/validators/modules-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,cAAc,EAAE,wBAAwB,EAAsC,MAAM,UAAU,CAAC;AAGxH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAK3D,qBAAa,gBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IACzF,OAAO,CAAC,oBAAoB,CAA0C;IAEtE,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GAAG,wBAAwB,CAAC,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"modules-validator.d.ts","sourceRoot":"","sources":["../../src/validators/modules-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,cAAc,EAAE,wBAAwB,EAAsC,MAAM,UAAU,CAAC;AAGxH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAK3D,qBAAa,gBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IACzF,OAAO,CAAC,oBAAoB,CAA0C;IAEtE,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GAAG,wBAAwB,CAAC,cAAc,CAAC;CAgMzG"}
|
|
@@ -92,6 +92,22 @@ class ModulesValidator {
|
|
|
92
92
|
validationErrors.push(Object.assign({ message: text_1.errors.modules.fullPage.children(moduleType), reference: text_1.References.Modules, level: 'error' }, utils_1.findPosition(module[1].key, yamlContentByLine)));
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
|
+
[types_1.AllModuleTypes.JiraCustomField, types_1.AllModuleTypes.JiraCustomFieldType].forEach((moduleType) => {
|
|
96
|
+
var _a;
|
|
97
|
+
(_a = modules[moduleType]) === null || _a === void 0 ? void 0 : _a.forEach((module) => {
|
|
98
|
+
if (!module || module.type !== 'object' || !module.schema)
|
|
99
|
+
return;
|
|
100
|
+
const getAliases = (properties = {}) => Object.values(properties)
|
|
101
|
+
.map((v) => [v.searchAlias, ...getAliases(v.properties)])
|
|
102
|
+
.reduce((acc, val) => acc.concat(val), [])
|
|
103
|
+
.filter(Boolean);
|
|
104
|
+
const aliases = getAliases(module.schema.properties);
|
|
105
|
+
const duplicates = Array.from(new Set(aliases.filter((item, index) => aliases.indexOf(item) != index)));
|
|
106
|
+
if (duplicates.length) {
|
|
107
|
+
validationErrors.push(Object.assign({ message: text_1.errors.modules.customFields.searchAlias(duplicates), reference: text_1.References.Modules, level: 'error' }, utils_1.findPosition(module.key, yamlContentByLine)));
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
95
111
|
}
|
|
96
112
|
return {
|
|
97
113
|
success: validationErrors.length === 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions-validator.d.ts","sourceRoot":"","sources":["../../src/validators/permissions-validator.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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;AAK3D,qBAAa,oBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IACzF,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GAAG,wBAAwB,CAAC,cAAc,CAAC;CAwHzG"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PermissionsValidator = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
const text_1 = require("../text");
|
|
7
7
|
const egress_types_1 = require("../types/egress-types");
|
|
8
8
|
const url_1 = require("url");
|
|
9
|
+
const shipyard_scopes_json_1 = tslib_1.__importDefault(require("../scopes/shipyard-scopes.json"));
|
|
9
10
|
class PermissionsValidator {
|
|
10
11
|
validate(manifest) {
|
|
11
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
12
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
12
13
|
if (!manifest || !manifest.typedContent || !manifest.typedContent.permissions) {
|
|
13
14
|
return {
|
|
14
15
|
success: false,
|
|
@@ -53,7 +54,7 @@ class PermissionsValidator {
|
|
|
53
54
|
return false;
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
const invalidScope = (_a = manifest.typedContent.permissions.scopes) === null || _a === void 0 ? void 0 : _a.find((key) => !
|
|
57
|
+
const invalidScope = (_a = manifest.typedContent.permissions.scopes) === null || _a === void 0 ? void 0 : _a.find((key) => !shipyard_scopes_json_1.default.includes(key));
|
|
57
58
|
if (invalidScope) {
|
|
58
59
|
addValidationError('scopes', invalidScope, manifest);
|
|
59
60
|
}
|
|
@@ -61,27 +62,32 @@ class PermissionsValidator {
|
|
|
61
62
|
if (invalidScripts) {
|
|
62
63
|
addValidationError('content.scripts', invalidScripts, manifest);
|
|
63
64
|
}
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
addValidationError('external.fetch.backend',
|
|
65
|
+
const invalidBackendString = (_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').find((key) => !isValidURL(key));
|
|
66
|
+
if (invalidBackendString) {
|
|
67
|
+
addValidationError('external.fetch.backend', invalidBackendString, manifest);
|
|
67
68
|
}
|
|
68
|
-
const
|
|
69
|
+
const remoteMap = (_g = manifest.typedContent.remotes) === null || _g === void 0 ? void 0 : _g.reduce((prev, item) => prev.set(item.key, item.baseUrl), new Map());
|
|
70
|
+
const invalidBackendRemote = (_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').find((item) => !remoteMap || !remoteMap.has(item.remote) || !isValidURL(remoteMap.get(item.remote)));
|
|
71
|
+
if (invalidBackendRemote) {
|
|
72
|
+
addValidationError('external.fetch.backend', invalidBackendRemote.remote, manifest);
|
|
73
|
+
}
|
|
74
|
+
const invalidClient = (_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.find((key) => !isValidURL(key));
|
|
69
75
|
if (invalidClient) {
|
|
70
76
|
addValidationError('external.fetch.client', invalidClient, manifest);
|
|
71
77
|
}
|
|
72
|
-
const invalidNavigation = (
|
|
78
|
+
const invalidNavigation = (_q = (_p = manifest.typedContent.permissions.external) === null || _p === void 0 ? void 0 : _p.navigation) === null || _q === void 0 ? void 0 : _q.find((key) => !isValidURL(key));
|
|
73
79
|
if (invalidNavigation) {
|
|
74
80
|
addValidationError('external.navigation', invalidNavigation, manifest);
|
|
75
81
|
}
|
|
76
|
-
const invalidImages = (
|
|
82
|
+
const invalidImages = (_s = (_r = manifest.typedContent.permissions.external) === null || _r === void 0 ? void 0 : _r.images) === null || _s === void 0 ? void 0 : _s.find((key) => !isValidURL(key));
|
|
77
83
|
if (invalidImages) {
|
|
78
84
|
addValidationError('external.images', invalidImages, manifest);
|
|
79
85
|
}
|
|
80
|
-
const invalidMedia = (
|
|
86
|
+
const invalidMedia = (_u = (_t = manifest.typedContent.permissions.external) === null || _t === void 0 ? void 0 : _t.media) === null || _u === void 0 ? void 0 : _u.find((key) => !isValidURL(key));
|
|
81
87
|
if (invalidMedia) {
|
|
82
88
|
addValidationError('external.media', invalidMedia, manifest);
|
|
83
89
|
}
|
|
84
|
-
const invalidExternalScripts = (
|
|
90
|
+
const invalidExternalScripts = (_w = (_v = manifest.typedContent.permissions.external) === null || _v === void 0 ? void 0 : _v.scripts) === null || _w === void 0 ? void 0 : _w.find((key) => !isValidURL(key));
|
|
85
91
|
if (invalidExternalScripts) {
|
|
86
92
|
addValidationError('external.scripts', invalidExternalScripts, manifest);
|
|
87
93
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ManifestObject, ManifestValidationResult } from '../types';
|
|
2
|
+
import { ManifestSchema } from '../schema/manifest';
|
|
3
|
+
import { ValidatorInterface } from './validator-interface';
|
|
4
|
+
export declare class ProvidersValidator implements ValidatorInterface<ManifestObject<ManifestSchema> | undefined, ManifestSchema> {
|
|
5
|
+
validate(manifest: ManifestObject<ManifestSchema> | undefined): ManifestValidationResult<ManifestSchema>;
|
|
6
|
+
private isValidProfileRetrieverFunction;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=providers-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers-validator.d.ts","sourceRoot":"","sources":["../../src/validators/providers-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AAGrF,OAAO,EAA8C,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,qBAAa,kBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IACzF,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GAAG,wBAAwB,CAAC,cAAc,CAAC;IA+ExG,OAAO,CAAC,+BAA+B;CAiBxC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProvidersValidator = void 0;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
const text_1 = require("../text");
|
|
6
|
+
class ProvidersValidator {
|
|
7
|
+
validate(manifest) {
|
|
8
|
+
if (!manifest || !manifest.typedContent || !manifest.typedContent.providers) {
|
|
9
|
+
return {
|
|
10
|
+
success: true,
|
|
11
|
+
manifestObject: manifest
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const validationErrors = [];
|
|
15
|
+
const auth = manifest.typedContent.providers.auth;
|
|
16
|
+
const remotes = manifest.typedContent.remotes;
|
|
17
|
+
const permissions = manifest.typedContent.permissions;
|
|
18
|
+
auth === null || auth === void 0 ? void 0 : auth.forEach((provider) => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
if ('remotes' in provider) {
|
|
21
|
+
const hasMissing = (_a = provider.remotes) === null || _a === void 0 ? void 0 : _a.find((key) => !(remotes === null || remotes === void 0 ? void 0 : remotes.find((item) => item.key === key)));
|
|
22
|
+
if (hasMissing) {
|
|
23
|
+
validationErrors.push(Object.assign({ message: text_1.errors.providers.missingRemote(provider.key, hasMissing), reference: text_1.References.Providers, level: 'error' }, utils_1.findPosition(hasMissing, manifest.yamlContentByLine)));
|
|
24
|
+
}
|
|
25
|
+
const missingEgressPermission = (_b = provider.remotes) === null || _b === void 0 ? void 0 : _b.find((key) => {
|
|
26
|
+
var _a, _b, _c;
|
|
27
|
+
const remote = remotes === null || remotes === void 0 ? void 0 : remotes.find((item) => item.key === key);
|
|
28
|
+
if (remote) {
|
|
29
|
+
const egressPermission = (_c = (_b = (_a = permissions === null || permissions === void 0 ? void 0 : permissions.external) === null || _a === void 0 ? void 0 : _a.fetch) === null || _b === void 0 ? void 0 : _b.backend) === null || _c === void 0 ? void 0 : _c.find((item) => typeof item === 'string' ? item === remote.baseUrl : item.remote === remote.key);
|
|
30
|
+
return !egressPermission;
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
});
|
|
34
|
+
if (missingEgressPermission) {
|
|
35
|
+
validationErrors.push(Object.assign({ message: text_1.errors.providers.missingEgress(missingEgressPermission), reference: text_1.References.Providers, level: 'error' }, utils_1.findPosition(missingEgressPermission, manifest.yamlContentByLine)));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
auth === null || auth === void 0 ? void 0 : auth.forEach((provider) => {
|
|
40
|
+
if ('actions' in provider) {
|
|
41
|
+
Object.values(provider.actions).forEach((action) => {
|
|
42
|
+
const remote = remotes === null || remotes === void 0 ? void 0 : remotes.find((item) => item.key === action.remote);
|
|
43
|
+
if (!remote) {
|
|
44
|
+
validationErrors.push(Object.assign({ message: text_1.errors.providers.missingRemote(provider.key, action.remote), reference: text_1.References.Providers, level: 'error' }, utils_1.findPosition(action.remote, manifest.yamlContentByLine)));
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
auth === null || auth === void 0 ? void 0 : auth.forEach((provider) => {
|
|
50
|
+
const message = this.isValidProfileRetrieverFunction(provider, manifest);
|
|
51
|
+
if (message) {
|
|
52
|
+
validationErrors.push(message);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
success: validationErrors.length === 0,
|
|
57
|
+
errors: validationErrors
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
isValidProfileRetrieverFunction(provider, manifest) {
|
|
61
|
+
var _a, _b, _c;
|
|
62
|
+
if ('actions' in provider && 'function' in provider.actions.retrieveProfile) {
|
|
63
|
+
const { function: functionKey } = provider.actions.retrieveProfile;
|
|
64
|
+
const hasFunction = (_c = (_b = (_a = manifest.typedContent) === null || _a === void 0 ? void 0 : _a.modules) === null || _b === void 0 ? void 0 : _b.function) === null || _c === void 0 ? void 0 : _c.find((func) => func.key === functionKey);
|
|
65
|
+
if (!hasFunction) {
|
|
66
|
+
return Object.assign({ message: text_1.errors.providers.missingProfileFunction(provider.key, functionKey), reference: text_1.References.Providers, level: 'error' }, utils_1.findPosition(functionKey, manifest.yamlContentByLine));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.ProvidersValidator = ProvidersValidator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-validator.d.ts","sourceRoot":"","sources":["../../src/validators/schema-validator.ts"],"names":[],"mappings":"AACA,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,CAAuB;gBAEzB,MAAM,EAAE,MAAM;IAK3C,OAAO,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"schema-validator.d.ts","sourceRoot":"","sources":["../../src/validators/schema-validator.ts"],"names":[],"mappings":"AACA,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,CAAuB;gBAEzB,MAAM,EAAE,MAAM;IAK3C,OAAO,CAAC,mBAAmB,CA4BzB;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,CAcjB;IAEF,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,wBAAwB,CAAC,CAAC,CAAC;CAkD/E"}
|
|
@@ -22,11 +22,16 @@ class SchemaValidator {
|
|
|
22
22
|
return text_1.errors.schema.oneOf(requiredProps);
|
|
23
23
|
}
|
|
24
24
|
else if ((_a = error.parentSchema) === null || _a === void 0 ? void 0 : _a.oneOf) {
|
|
25
|
-
const requiredProps = error.parentSchema.oneOf
|
|
25
|
+
const requiredProps = error.parentSchema.oneOf
|
|
26
|
+
.map((v) => v.required)
|
|
27
|
+
.filter((v) => !!v);
|
|
26
28
|
return text_1.errors.schema.oneOf(requiredProps);
|
|
27
29
|
}
|
|
28
30
|
return text_1.errors.schema.oneOf(undefined);
|
|
29
31
|
}
|
|
32
|
+
if (error.keyword === 'additionalProperties' && 'additionalProperty' in error.params) {
|
|
33
|
+
return text_1.errors.schema.additionalProperties(error.params.additionalProperty);
|
|
34
|
+
}
|
|
30
35
|
return error.message;
|
|
31
36
|
};
|
|
32
37
|
this.handleModuleError = (path, error, manifest) => {
|
|
@@ -98,7 +103,7 @@ class SchemaValidator {
|
|
|
98
103
|
manifestObject: manifest
|
|
99
104
|
};
|
|
100
105
|
}
|
|
101
|
-
|
|
106
|
+
let success = this.validateSchema(manifest.yamlContent);
|
|
102
107
|
const errors = (_a = this.validateSchema.errors) === null || _a === void 0 ? void 0 : _a.map((error) => {
|
|
103
108
|
const values = error.dataPath.replace(/\/\d+/, '').split('/').slice(1);
|
|
104
109
|
return this.handleError(values, error, manifest);
|
|
@@ -116,6 +121,10 @@ class SchemaValidator {
|
|
|
116
121
|
dedupedErrors.push(e);
|
|
117
122
|
}
|
|
118
123
|
}));
|
|
124
|
+
const warningLevel = dedupedErrors.filter((e) => e.level === 'warning');
|
|
125
|
+
if (warningLevel.length === dedupedErrors.length) {
|
|
126
|
+
success = true;
|
|
127
|
+
}
|
|
119
128
|
return {
|
|
120
129
|
success,
|
|
121
130
|
manifestObject: Object.assign(Object.assign({}, manifest), { typedContent: success ? manifest.yamlContent : undefined }),
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scopes-types.d.ts","sourceRoot":"","sources":["../../src/types/scopes-types.ts"],"names":[],"mappings":"AA+CA,eAAO,MAAM,UAAU,UAMtB,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ALL_SCOPES = void 0;
|
|
4
|
-
const FORGE_SCOPES = ['storage:app'];
|
|
5
|
-
const IDENTITY_SCOPES = ['read:me', 'report:personal-data'];
|
|
6
|
-
const CONFLUENCE_SCOPES = [
|
|
7
|
-
'manage:confluence-configuration',
|
|
8
|
-
'read:confluence-content.all',
|
|
9
|
-
'read:confluence-content.permission',
|
|
10
|
-
'read:confluence-content.summary',
|
|
11
|
-
'read:confluence-space.summary',
|
|
12
|
-
'read:confluence-props',
|
|
13
|
-
'search:confluence',
|
|
14
|
-
'write:confluence-content',
|
|
15
|
-
'write:confluence-file',
|
|
16
|
-
'write:confluence-props',
|
|
17
|
-
'write:confluence-space',
|
|
18
|
-
'read:confluence-groups',
|
|
19
|
-
'write:confluence-groups',
|
|
20
|
-
'read:confluence-user'
|
|
21
|
-
];
|
|
22
|
-
const JIRA_SCOPES = [
|
|
23
|
-
'read:jira-user',
|
|
24
|
-
'read:jira-work',
|
|
25
|
-
'manage:jira-configuration',
|
|
26
|
-
'manage:jira-data-provider',
|
|
27
|
-
'manage:jira-project',
|
|
28
|
-
'write:jira-work'
|
|
29
|
-
];
|
|
30
|
-
const CONNECT_SCOPES = [
|
|
31
|
-
'read:connect-jira',
|
|
32
|
-
'write:connect-jira',
|
|
33
|
-
'delete:connect-jira',
|
|
34
|
-
'admin:connect-jira',
|
|
35
|
-
'project-admin:connect-jira',
|
|
36
|
-
'act-as-user:connect-jira',
|
|
37
|
-
'access-email-addresses:connect-jira',
|
|
38
|
-
'read:connect-confluence',
|
|
39
|
-
'write:connect-confluence',
|
|
40
|
-
'delete:connect-confluence',
|
|
41
|
-
'admin:connect-confluence',
|
|
42
|
-
'space-admin:connect-confluence',
|
|
43
|
-
'act-as-user:connect-confluence',
|
|
44
|
-
'access-email-addresses:connect-confluence'
|
|
45
|
-
];
|
|
46
|
-
exports.ALL_SCOPES = [
|
|
47
|
-
...IDENTITY_SCOPES,
|
|
48
|
-
...FORGE_SCOPES,
|
|
49
|
-
...CONFLUENCE_SCOPES,
|
|
50
|
-
...JIRA_SCOPES,
|
|
51
|
-
...CONNECT_SCOPES
|
|
52
|
-
];
|