@forge/manifest 0.0.0-experimental-e05f7a2 → 0.0.0-experimental-d18f8dd

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +218 -1
  2. package/out/processor/full-validation-processor.d.ts.map +1 -1
  3. package/out/processor/full-validation-processor.js +3 -2
  4. package/out/schema/basic-manifest-schema.json +24 -7
  5. package/out/schema/basic-manifest.d.ts +13 -3
  6. package/out/schema/manifest-schema.json +7292 -932
  7. package/out/schema/manifest.d.ts +50131 -181
  8. package/out/scopes/shipyard-scopes.json +191 -0
  9. package/out/text/errors.d.ts +18 -1
  10. package/out/text/errors.d.ts.map +1 -1
  11. package/out/text/errors.js +18 -1
  12. package/out/types/index.d.ts +0 -1
  13. package/out/types/index.d.ts.map +1 -1
  14. package/out/types/index.js +0 -1
  15. package/out/types/module-types.d.ts +58 -1
  16. package/out/types/module-types.d.ts.map +1 -1
  17. package/out/types/module-types.js +57 -0
  18. package/out/utils/line-finder.d.ts +1 -1
  19. package/out/utils/line-finder.d.ts.map +1 -1
  20. package/out/utils/line-finder.js +25 -7
  21. package/out/utils/module-key-cleaner.d.ts.map +1 -1
  22. package/out/validators/connect-modules-validator.d.ts +7 -0
  23. package/out/validators/connect-modules-validator.d.ts.map +1 -0
  24. package/out/validators/connect-modules-validator.js +48 -0
  25. package/out/validators/connect-remote-validator.d.ts +7 -0
  26. package/out/validators/connect-remote-validator.d.ts.map +1 -0
  27. package/out/validators/connect-remote-validator.js +31 -0
  28. package/out/validators/index.d.ts +3 -0
  29. package/out/validators/index.d.ts.map +1 -1
  30. package/out/validators/index.js +3 -0
  31. package/out/validators/modules-validator.d.ts.map +1 -1
  32. package/out/validators/modules-validator.js +16 -0
  33. package/out/validators/permissions-validator.d.ts.map +1 -1
  34. package/out/validators/permissions-validator.js +3 -2
  35. package/out/validators/providers-validator.d.ts +1 -0
  36. package/out/validators/providers-validator.d.ts.map +1 -1
  37. package/out/validators/providers-validator.js +16 -0
  38. package/out/validators/schema-validator.d.ts.map +1 -1
  39. package/out/validators/schema-validator.js +5 -1
  40. package/package.json +2 -2
  41. package/out/types/scopes-types.d.ts +0 -2
  42. package/out/types/scopes-types.d.ts.map +0 -1
  43. package/out/types/scopes-types.js +0 -52
@@ -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';
@@ -7,4 +8,6 @@ export * from './resources-validator';
7
8
  export * from './display-conditions-validator';
8
9
  export * from './product-trigger-scopes-validator';
9
10
  export * from './providers-validator';
11
+ export * from './permissions-validator';
12
+ export * from './connect-remote-validator';
10
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;AACnD,cAAc,uBAAuB,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"}
@@ -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);
@@ -10,3 +11,5 @@ 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);
12
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;CAuKzG"}
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,EAAc,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AAGjG,OAAO,EAAE,cAAc,EAAU,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAI3D,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;CAuHzG"}
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,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PermissionsValidator = void 0;
4
- const types_1 = require("../types");
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
12
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
@@ -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) => !types_1.ALL_SCOPES.includes(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
  }
@@ -3,5 +3,6 @@ import { ManifestSchema } from '../schema/manifest';
3
3
  import { ValidatorInterface } from './validator-interface';
4
4
  export declare class ProvidersValidator implements ValidatorInterface<ManifestObject<ManifestSchema> | undefined, ManifestSchema> {
5
5
  validate(manifest: ManifestObject<ManifestSchema> | undefined): ManifestValidationResult<ManifestSchema>;
6
+ private isValidProfileRetrieverFunction;
6
7
  }
7
8
  //# sourceMappingURL=providers-validator.d.ts.map
@@ -1 +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,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,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;CAuEzG"}
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"}
@@ -46,10 +46,26 @@ class ProvidersValidator {
46
46
  });
47
47
  }
48
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
+ });
49
55
  return {
50
56
  success: validationErrors.length === 0,
51
57
  errors: validationErrors
52
58
  };
53
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
+ }
54
70
  }
55
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,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;CA2C/E"}
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"}
@@ -103,7 +103,7 @@ class SchemaValidator {
103
103
  manifestObject: manifest
104
104
  };
105
105
  }
106
- const success = this.validateSchema(manifest.yamlContent);
106
+ let success = this.validateSchema(manifest.yamlContent);
107
107
  const errors = (_a = this.validateSchema.errors) === null || _a === void 0 ? void 0 : _a.map((error) => {
108
108
  const values = error.dataPath.replace(/\/\d+/, '').split('/').slice(1);
109
109
  return this.handleError(values, error, manifest);
@@ -121,6 +121,10 @@ class SchemaValidator {
121
121
  dedupedErrors.push(e);
122
122
  }
123
123
  }));
124
+ const warningLevel = dedupedErrors.filter((e) => e.level === 'warning');
125
+ if (warningLevel.length === dedupedErrors.length) {
126
+ success = true;
127
+ }
124
128
  return {
125
129
  success,
126
130
  manifestObject: Object.assign(Object.assign({}, manifest), { typedContent: success ? manifest.yamlContent : undefined }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/manifest",
3
- "version": "0.0.0-experimental-e05f7a2",
3
+ "version": "0.0.0-experimental-d18f8dd",
4
4
  "description": "Definitions and validations of the Forge manifest",
5
5
  "main": "out/index.js",
6
6
  "scripts": {
@@ -23,7 +23,7 @@
23
23
  "author": "Atlassian",
24
24
  "license": "UNLICENSED",
25
25
  "dependencies": {
26
- "@forge/util": "1.0.0",
26
+ "@forge/util": "0.0.0-experimental-d18f8dd",
27
27
  "ajv": "^6.12.5",
28
28
  "js-yaml": "^3.13.1",
29
29
  "json-schema-to-typescript": "^9.1.1",
@@ -1,2 +0,0 @@
1
- export declare const ALL_SCOPES: string[];
2
- //# sourceMappingURL=scopes-types.d.ts.map
@@ -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
- ];