@forge/manifest 8.0.0-next.6 → 8.0.0-next.8

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @forge/manifest
2
2
 
3
+ ## 8.0.0-next.8
4
+
5
+ ### Patch Changes
6
+
7
+ - a9c6303: Update manifest definitions
8
+
9
+ ## 8.0.0-next.7
10
+
11
+ ### Minor Changes
12
+
13
+ - 5d4af6e: Added storage modules
14
+
3
15
  ## 8.0.0-next.6
4
16
 
5
17
  ### Patch Changes
@@ -1354,6 +1354,36 @@
1354
1354
  },
1355
1355
  "minItems": 1
1356
1356
  },
1357
+ "sql": {
1358
+ "type": "array",
1359
+ "items": {
1360
+ "$schema": "http://json-schema.org/draft-07/schema#",
1361
+ "additionalProperties": false,
1362
+ "type": "object",
1363
+ "properties": {
1364
+ "engine": {
1365
+ "type": "string",
1366
+ "enum": [
1367
+ "mysql"
1368
+ ],
1369
+ "description": "The SQL engine to be used for storage"
1370
+ },
1371
+ "key": {
1372
+ "$ref": "#/definitions/ModuleKeySchema"
1373
+ }
1374
+ },
1375
+ "required": [
1376
+ "engine",
1377
+ "key"
1378
+ ],
1379
+ "not": {
1380
+ "required": [
1381
+ "unlicensedAccess"
1382
+ ]
1383
+ }
1384
+ },
1385
+ "minItems": 1
1386
+ },
1357
1387
  "macro": {
1358
1388
  "type": "array",
1359
1389
  "items": {
@@ -1351,6 +1351,22 @@ export interface Modules {
1351
1351
  }
1352
1352
  )[]
1353
1353
  ];
1354
+ sql?: [
1355
+ {
1356
+ /**
1357
+ * The SQL engine to be used for storage
1358
+ */
1359
+ engine: 'mysql';
1360
+ key: ModuleKeySchema;
1361
+ },
1362
+ ...{
1363
+ /**
1364
+ * The SQL engine to be used for storage
1365
+ */
1366
+ engine: 'mysql';
1367
+ key: ModuleKeySchema;
1368
+ }[]
1369
+ ];
1354
1370
  macro?: [
1355
1371
  (
1356
1372
  | {
@@ -7,6 +7,7 @@ export declare enum AllModuleTypes {
7
7
  CoreEndpoint = "core:endpoint",
8
8
  CoreMigration = "core:migration",
9
9
  CoreRemote = "core:remote",
10
+ CoreSql = "core:sql",
10
11
  XenMacro = "xen:macro",
11
12
  ConfluenceContentAction = "confluence:contentAction",
12
13
  ConfluenceContentBylineItem = "confluence:contentBylineItem",
@@ -1 +1 @@
1
- {"version":3,"file":"module-types.d.ts","sourceRoot":"","sources":["../../src/types/module-types.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,YAAY,kBAAkB;IAC9B,WAAW,iBAAiB;IAC5B,cAAc,oBAAoB;IAClC,YAAY,kBAAkB;IAC9B,oBAAoB,0BAA0B;IAC9C,YAAY,kBAAkB;IAC9B,aAAa,mBAAmB;IAChC,UAAU,gBAAgB;IAC1B,QAAQ,cAAc;IACtB,uBAAuB,6BAA6B;IACpD,2BAA2B,iCAAiC;IAC5D,qBAAqB,2BAA2B;IAChD,uBAAuB,6BAA6B;IACpD,wBAAwB,8BAA8B;IACtD,oBAAoB,0BAA0B;IAC9C,sBAAsB,4BAA4B;IAClD,mBAAmB,yBAAyB;IAC5C,uBAAuB,6BAA6B;IACpD,kBAAkB,wBAAwB;IAC1C,qBAAqB,2BAA2B;IAChD,qBAAqB,2BAA2B;IAChD,wBAAwB,8BAA8B;IACtD,eAAe,qBAAqB;IACpC,mBAAmB,yBAAyB;IAC5C,eAAe,qBAAqB;IACpC,iBAAiB,uBAAuB;IACxC,mBAAmB,yBAAyB;IAC5C,eAAe,qBAAqB;IACpC,gBAAgB,sBAAsB;IACtC,cAAc,oBAAoB;IAClC,wBAAwB,8BAA8B;IACtD,aAAa,mBAAmB;IAChC,eAAe,qBAAqB;IACpC,uBAAuB,6BAA6B;IACpD,cAAc,oBAAoB;IAClC,mBAAmB,yBAAyB;IAC5C,6BAA6B,mCAAmC;IAChE,6BAA6B,mCAAmC;IAChE,oBAAoB,0BAA0B;IAC9C,qBAAqB,2BAA2B;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7E,uDAAuD,8DAA8D;IACrH,oDAAoD,2DAA2D;IAC/G,6CAA6C,oDAAoD;IACjG,yCAAyC,gDAAgD;IACzF,4BAA4B,mCAAmC;IAC/D,6BAA6B,oCAAoC;IACjE,wCAAwC,+CAA+C;IACvF,kCAAkC,yCAAyC;IAC3E,iCAAiC,wCAAwC;IACzE,2CAA2C,kDAAkD;IAC7F,0CAA0C,iDAAiD;IAC3F,8CAA8C,qDAAqD;IACnG,yCAAyC,gDAAgD;IACzF,4BAA4B,mCAAmC;IAC/D,+BAA+B,sCAAsC;IACrE,sBAAsB,6BAA6B;IACnD,2BAA2B,kCAAkC;IAE7D,8BAA8B,uBAAuB;IACrD,6BAA6B,sBAAsB;IACnD,6BAA6B,sBAAsB;IACnD,gCAAgC,yBAAyB;IACzD,wCAAwC,iCAAiC;IACzE,+BAA+B,wBAAwB;IACvD,2BAA2B,oBAAoB;IAE/C,SAAS,eAAe;IACxB,UAAU,gBAAgB;CAC3B;AAED,eAAO,MAAM,iBAAiB,kBAAgC,CAAC;AAE/D,eAAO,MAAM,uBAAuB,UAAwE,CAAC"}
@@ -11,6 +11,7 @@ var AllModuleTypes;
11
11
  AllModuleTypes["CoreEndpoint"] = "core:endpoint";
12
12
  AllModuleTypes["CoreMigration"] = "core:migration";
13
13
  AllModuleTypes["CoreRemote"] = "core:remote";
14
+ AllModuleTypes["CoreSql"] = "core:sql";
14
15
  AllModuleTypes["XenMacro"] = "xen:macro";
15
16
  AllModuleTypes["ConfluenceContentAction"] = "confluence:contentAction";
16
17
  AllModuleTypes["ConfluenceContentBylineItem"] = "confluence:contentBylineItem";
@@ -7,5 +7,7 @@ export declare class StorageValidator implements ValidatorInterface<ManifestObje
7
7
  private entityIndexesMaxCount;
8
8
  private reservedIndexName;
9
9
  validate(manifest: ManifestObject<ManifestSchema> | undefined): Promise<ManifestValidationResult<ManifestSchema>>;
10
+ private validateSqlModules;
11
+ private validateCustomEntities;
10
12
  }
11
13
  //# sourceMappingURL=storage-validator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage-validator.d.ts","sourceRoot":"","sources":["../../src/validators/storage-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,qBAAa,gBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAEzF,OAAO,CAAC,wBAAwB,CAAM;IACtC,OAAO,CAAC,wBAAwB,CAAM;IACtC,OAAO,CAAC,qBAAqB,CAAK;IAClC,OAAO,CAAC,iBAAiB,CAAY;IAE/B,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;CAyHrD"}
1
+ {"version":3,"file":"storage-validator.d.ts","sourceRoot":"","sources":["../../src/validators/storage-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,qBAAa,gBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAEzF,OAAO,CAAC,wBAAwB,CAAM;IACtC,OAAO,CAAC,wBAAwB,CAAM;IACtC,OAAO,CAAC,qBAAqB,CAAK;IAClC,OAAO,CAAC,iBAAiB,CAAY;IAE/B,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;IAYpD,OAAO,CAAC,kBAAkB;IAkB1B,OAAO,CAAC,sBAAsB;CAwG/B"}
@@ -9,100 +9,111 @@ class StorageValidator {
9
9
  entityIndexesMaxCount = 7;
10
10
  reservedIndexName = 'by-key';
11
11
  async validate(manifest) {
12
- if (!manifest?.typedContent?.app?.storage) {
13
- return {
14
- success: true,
15
- manifestObject: manifest
16
- };
17
- }
18
12
  const validationErrors = [];
19
- if (!manifest.typedContent.app.storage.entities) {
20
- return {
21
- success: true,
22
- manifestObject: manifest
23
- };
24
- }
25
- const entities = manifest.typedContent.app.storage.entities;
26
- entities.forEach((entity) => {
27
- const { name, attributes } = entity;
28
- if (Object.keys(attributes).length > this.entityAttributesMaxCount) {
13
+ validationErrors.push(...this.validateSqlModules(manifest));
14
+ validationErrors.push(...this.validateCustomEntities(manifest));
15
+ return {
16
+ success: validationErrors.length === 0,
17
+ manifestObject: manifest,
18
+ ...(validationErrors.length ? { errors: validationErrors } : {})
19
+ };
20
+ }
21
+ validateSqlModules(manifest) {
22
+ const validationErrors = [];
23
+ const sqlModules = manifest?.typedContent?.modules?.sql;
24
+ if (sqlModules && sqlModules.length) {
25
+ if (sqlModules.length > 1) {
29
26
  validationErrors.push({
30
- message: text_1.errors.app.storage.entities.tooManyAttributes(name, this.entityAttributesMaxCount),
31
- reference: text_1.References.App,
27
+ message: `Found ${sqlModules.length} SQL modules; only one is allowed.`,
28
+ reference: text_1.References.Modules,
32
29
  level: 'error',
33
- ...(0, utils_1.findPosition)('entities', manifest.yamlContentByLine)
30
+ ...(0, utils_1.findPosition)('sql', manifest.yamlContentByLine)
34
31
  });
35
32
  }
36
- Object.keys(attributes).forEach((attributeKey) => {
37
- 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
- });
44
- }
45
- });
46
- if (entity.indexes) {
47
- const { indexes } = entity;
48
- if (indexes.length > this.entityIndexesMaxCount) {
33
+ }
34
+ return validationErrors;
35
+ }
36
+ validateCustomEntities(manifest) {
37
+ const validationErrors = [];
38
+ const entities = manifest?.typedContent?.app?.storage?.entities;
39
+ if (entities) {
40
+ entities.forEach((entity) => {
41
+ const { name, attributes } = entity;
42
+ if (Object.keys(attributes).length > this.entityAttributesMaxCount) {
49
43
  validationErrors.push({
50
- message: text_1.errors.app.storage.entities.tooManyIndexes(name, this.entityIndexesMaxCount),
44
+ message: text_1.errors.app.storage.entities.tooManyAttributes(name, this.entityAttributesMaxCount),
51
45
  reference: text_1.References.App,
52
46
  level: 'error',
53
47
  ...(0, utils_1.findPosition)('entities', manifest.yamlContentByLine)
54
48
  });
55
49
  }
56
- const indexName = [];
57
- const indexRange = [];
58
- const indexPartition = [];
59
- indexes.forEach((index) => {
60
- if (typeof index === 'string') {
61
- indexRange.push(index);
62
- }
63
- else if (typeof index === 'object') {
64
- indexName.push(index.name);
65
- indexRange.push(...index.range);
66
- if (index.partition) {
67
- indexPartition.push(...index.partition);
68
- }
50
+ Object.keys(attributes).forEach((attributeKey) => {
51
+ if (attributeKey.length > this.entityAttributeMaxLength) {
52
+ validationErrors.push({
53
+ message: text_1.errors.app.storage.entities.attributeNameTooLong(name, attributeKey, this.entityAttributeMaxLength),
54
+ reference: text_1.References.App,
55
+ level: 'error',
56
+ ...(0, utils_1.findPosition)('entities', manifest.yamlContentByLine)
57
+ });
69
58
  }
70
59
  });
71
- 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
- });
78
- }
79
- indexRange.forEach((range) => {
80
- if (!Object.keys(attributes).length || !attributes[range]) {
60
+ if (entity.indexes) {
61
+ const { indexes } = entity;
62
+ if (indexes.length > this.entityIndexesMaxCount) {
81
63
  validationErrors.push({
82
- message: text_1.errors.app.storage.entities.invalidIndexRange(name, range),
64
+ message: text_1.errors.app.storage.entities.tooManyIndexes(name, this.entityIndexesMaxCount),
83
65
  reference: text_1.References.App,
84
66
  level: 'error',
85
67
  ...(0, utils_1.findPosition)('entities', manifest.yamlContentByLine)
86
68
  });
87
69
  }
88
- });
89
- indexPartition.forEach((partition) => {
90
- if (!Object.keys(attributes).length || !attributes[partition]) {
70
+ const indexName = [];
71
+ const indexRange = [];
72
+ const indexPartition = [];
73
+ indexes.forEach((index) => {
74
+ if (typeof index === 'string') {
75
+ indexRange.push(index);
76
+ }
77
+ else if (typeof index === 'object') {
78
+ indexName.push(index.name);
79
+ indexRange.push(...index.range);
80
+ if (index.partition) {
81
+ indexPartition.push(...index.partition);
82
+ }
83
+ }
84
+ });
85
+ if (indexName.find((name) => name === this.reservedIndexName)) {
91
86
  validationErrors.push({
92
- message: text_1.errors.app.storage.entities.invalidIndexPartition(name, partition),
87
+ message: text_1.errors.app.storage.entities.reservedIndexName(name, this.reservedIndexName),
93
88
  reference: text_1.References.App,
94
89
  level: 'error',
95
90
  ...(0, utils_1.findPosition)('entities', manifest.yamlContentByLine)
96
91
  });
97
92
  }
98
- });
99
- }
100
- });
101
- return {
102
- success: validationErrors.length === 0,
103
- manifestObject: manifest,
104
- errors: validationErrors
105
- };
93
+ indexRange.forEach((range) => {
94
+ if (!Object.keys(attributes).length || !attributes[range]) {
95
+ validationErrors.push({
96
+ message: text_1.errors.app.storage.entities.invalidIndexRange(name, range),
97
+ reference: text_1.References.App,
98
+ level: 'error',
99
+ ...(0, utils_1.findPosition)('entities', manifest.yamlContentByLine)
100
+ });
101
+ }
102
+ });
103
+ indexPartition.forEach((partition) => {
104
+ if (!Object.keys(attributes).length || !attributes[partition]) {
105
+ validationErrors.push({
106
+ message: text_1.errors.app.storage.entities.invalidIndexPartition(name, partition),
107
+ reference: text_1.References.App,
108
+ level: 'error',
109
+ ...(0, utils_1.findPosition)('entities', manifest.yamlContentByLine)
110
+ });
111
+ }
112
+ });
113
+ }
114
+ });
115
+ }
116
+ return validationErrors;
106
117
  }
107
118
  }
108
119
  exports.StorageValidator = StorageValidator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/manifest",
3
- "version": "8.0.0-next.6",
3
+ "version": "8.0.0-next.8",
4
4
  "description": "Definitions and validations of the Forge manifest",
5
5
  "main": "out/index.js",
6
6
  "scripts": {