@forge/manifest 4.7.1 → 4.8.0-next.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @forge/manifest
2
2
 
3
+ ## 4.8.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 32ca02fd: Add support for Custom Entities
8
+
3
9
  ## 4.7.1
4
10
 
5
11
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"full-validation-processor.d.ts","sourceRoot":"","sources":["../../src/processor/full-validation-processor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,qBAAa,uBAAwB,SAAQ,2BAA2B,CAAC,cAAc,CAAC;;CAiBvF"}
1
+ {"version":3,"file":"full-validation-processor.d.ts","sourceRoot":"","sources":["../../src/processor/full-validation-processor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,qBAAa,uBAAwB,SAAQ,2BAA2B,CAAC,cAAc,CAAC;;CAkBvF"}
@@ -6,6 +6,7 @@ const validators_1 = require("../validators");
6
6
  const FULL_SCHEMA = tslib_1.__importStar(require("../schema/manifest-schema.json"));
7
7
  const DISPLAY_CONDITIONS_SCHEMA = tslib_1.__importStar(require("../schema/display-conditions-schema.json"));
8
8
  const abstract_validation_processor_1 = require("./abstract-validation-processor");
9
+ const storage_validator_1 = require("../validators/storage-validator");
9
10
  class FullValidationProcessor extends abstract_validation_processor_1.AbstractValidationProcessor {
10
11
  constructor() {
11
12
  super([
@@ -18,6 +19,7 @@ class FullValidationProcessor extends abstract_validation_processor_1.AbstractVa
18
19
  new validators_1.ConnectRemoteValidator(),
19
20
  new validators_1.ConnectAuthenticationValidator(),
20
21
  new validators_1.PermissionsValidator(),
22
+ new storage_validator_1.StorageValidator(),
21
23
  new validators_1.DisplayConditionsValidator(DISPLAY_CONDITIONS_SCHEMA),
22
24
  new validators_1.ProvidersValidator(),
23
25
  new validators_1.EntityPropertyValidator()
@@ -82,11 +82,8 @@
82
82
  }
83
83
  },
84
84
  "storage": {
85
- "description": "Options related to hosted storage",
86
85
  "type": "object",
87
- "required": [
88
- "classifications"
89
- ],
86
+ "description": "Options related to hosted storage",
90
87
  "additionalProperties": false,
91
88
  "properties": {
92
89
  "classifications": {
@@ -101,6 +98,95 @@
101
98
  ]
102
99
  },
103
100
  "minItems": 1
101
+ },
102
+ "entities": {
103
+ "description": "Custom schemas for app stored entities.",
104
+ "type": "array",
105
+ "items": {
106
+ "type": "object",
107
+ "required": [
108
+ "name",
109
+ "attributes"
110
+ ],
111
+ "additionalProperties": false,
112
+ "properties": {
113
+ "name": {
114
+ "description": "A name for the entity. Must be unique within the manifest and have a maximum of 60 characters.",
115
+ "type": "string",
116
+ "pattern": "^[a-z]+$",
117
+ "minLength": 3,
118
+ "maxLength": 60
119
+ },
120
+ "attributes": {
121
+ "description": "Attributes of the entity.",
122
+ "type": "object",
123
+ "patternProperties": {
124
+ "^[a-zA-Z][a-zA-Z0-9_]*$": {
125
+ "description": "An attribute of the entity. Must be unique within the entity and have a maximum of 30 characters.",
126
+ "type": "object",
127
+ "required": [
128
+ "type"
129
+ ],
130
+ "additionalProperties": false,
131
+ "properties": {
132
+ "type": {
133
+ "description": "The data type for the given attribute.",
134
+ "type": "string",
135
+ "enum": [
136
+ "string",
137
+ "boolean",
138
+ "float",
139
+ "integer",
140
+ "any"
141
+ ]
142
+ }
143
+ }
144
+ }
145
+ },
146
+ "additionalProperties": false
147
+ },
148
+ "indexes": {
149
+ "description": "Indexes on attributes of the schema.",
150
+ "type": "array",
151
+ "items": {
152
+ "oneOf": [
153
+ {
154
+ "type": "string"
155
+ },
156
+ {
157
+ "type": "object",
158
+ "required": [
159
+ "name",
160
+ "range"
161
+ ],
162
+ "additionalProperties": false,
163
+ "properties": {
164
+ "name": {
165
+ "type": "string"
166
+ },
167
+ "range": {
168
+ "type": "array",
169
+ "items": {
170
+ "type": "string"
171
+ },
172
+ "minItems": 1
173
+ },
174
+ "partition": {
175
+ "type": "array",
176
+ "items": {
177
+ "type": "string"
178
+ },
179
+ "minItems": 1
180
+ }
181
+ }
182
+ }
183
+ ]
184
+ },
185
+ "minItems": 1
186
+ }
187
+ }
188
+ },
189
+ "minItems": 1
104
190
  }
105
191
  }
106
192
  }
@@ -43,7 +43,100 @@ export interface App {
43
43
  /**
44
44
  * Labels to classify the type of data stored
45
45
  */
46
- classifications: ['ugc' | 'pii' | 'other', ...('ugc' | 'pii' | 'other')[]];
46
+ classifications?: ['ugc' | 'pii' | 'other', ...('ugc' | 'pii' | 'other')[]];
47
+ /**
48
+ * Custom schemas for app stored entities.
49
+ */
50
+ entities?: [
51
+ {
52
+ /**
53
+ * A name for the entity. Must be unique within the manifest and have a maximum of 60 characters.
54
+ */
55
+ name: string;
56
+ /**
57
+ * Attributes of the entity.
58
+ */
59
+ attributes: {
60
+ /**
61
+ * An attribute of the entity. Must be unique within the entity and have a maximum of 30 characters.
62
+ *
63
+ * This interface was referenced by `undefined`'s JSON-Schema definition
64
+ * via the `patternProperty` "^[a-zA-Z][a-zA-Z0-9_]*$".
65
+ */
66
+ [k: string]: {
67
+ /**
68
+ * The data type for the given attribute.
69
+ */
70
+ type: 'string' | 'boolean' | 'float' | 'integer' | 'any';
71
+ };
72
+ };
73
+ /**
74
+ * Indexes on attributes of the schema.
75
+ */
76
+ indexes?: [
77
+ (
78
+ | string
79
+ | {
80
+ name: string;
81
+ range: [string, ...string[]];
82
+ partition?: [string, ...string[]];
83
+ }
84
+ ),
85
+ ...(
86
+ | string
87
+ | {
88
+ name: string;
89
+ range: [string, ...string[]];
90
+ partition?: [string, ...string[]];
91
+ }
92
+ )[]
93
+ ];
94
+ },
95
+ ...{
96
+ /**
97
+ * A name for the entity. Must be unique within the manifest and have a maximum of 60 characters.
98
+ */
99
+ name: string;
100
+ /**
101
+ * Attributes of the entity.
102
+ */
103
+ attributes: {
104
+ /**
105
+ * An attribute of the entity. Must be unique within the entity and have a maximum of 30 characters.
106
+ *
107
+ * This interface was referenced by `undefined`'s JSON-Schema definition
108
+ * via the `patternProperty` "^[a-zA-Z][a-zA-Z0-9_]*$".
109
+ */
110
+ [k: string]: {
111
+ /**
112
+ * The data type for the given attribute.
113
+ */
114
+ type: 'string' | 'boolean' | 'float' | 'integer' | 'any';
115
+ };
116
+ };
117
+ /**
118
+ * Indexes on attributes of the schema.
119
+ */
120
+ indexes?: [
121
+ (
122
+ | string
123
+ | {
124
+ name: string;
125
+ range: [string, ...string[]];
126
+ partition?: [string, ...string[]];
127
+ }
128
+ ),
129
+ ...(
130
+ | string
131
+ | {
132
+ name: string;
133
+ range: [string, ...string[]];
134
+ partition?: [string, ...string[]];
135
+ }
136
+ )[]
137
+ ];
138
+ }[]
139
+ ];
47
140
  };
48
141
  }
49
142
  /**
@@ -82,11 +82,8 @@
82
82
  }
83
83
  },
84
84
  "storage": {
85
- "description": "Options related to hosted storage",
86
85
  "type": "object",
87
- "required": [
88
- "classifications"
89
- ],
86
+ "description": "Options related to hosted storage",
90
87
  "additionalProperties": false,
91
88
  "properties": {
92
89
  "classifications": {
@@ -101,6 +98,95 @@
101
98
  ]
102
99
  },
103
100
  "minItems": 1
101
+ },
102
+ "entities": {
103
+ "description": "Custom schemas for app stored entities.",
104
+ "type": "array",
105
+ "items": {
106
+ "type": "object",
107
+ "required": [
108
+ "name",
109
+ "attributes"
110
+ ],
111
+ "additionalProperties": false,
112
+ "properties": {
113
+ "name": {
114
+ "description": "A name for the entity. Must be unique within the manifest and have a maximum of 60 characters.",
115
+ "type": "string",
116
+ "pattern": "^[a-z]+$",
117
+ "minLength": 3,
118
+ "maxLength": 60
119
+ },
120
+ "attributes": {
121
+ "description": "Attributes of the entity.",
122
+ "type": "object",
123
+ "patternProperties": {
124
+ "^[a-zA-Z][a-zA-Z0-9_]*$": {
125
+ "description": "An attribute of the entity. Must be unique within the entity and have a maximum of 30 characters.",
126
+ "type": "object",
127
+ "required": [
128
+ "type"
129
+ ],
130
+ "additionalProperties": false,
131
+ "properties": {
132
+ "type": {
133
+ "description": "The data type for the given attribute.",
134
+ "type": "string",
135
+ "enum": [
136
+ "string",
137
+ "boolean",
138
+ "float",
139
+ "integer",
140
+ "any"
141
+ ]
142
+ }
143
+ }
144
+ }
145
+ },
146
+ "additionalProperties": false
147
+ },
148
+ "indexes": {
149
+ "description": "Indexes on attributes of the schema.",
150
+ "type": "array",
151
+ "items": {
152
+ "oneOf": [
153
+ {
154
+ "type": "string"
155
+ },
156
+ {
157
+ "type": "object",
158
+ "required": [
159
+ "name",
160
+ "range"
161
+ ],
162
+ "additionalProperties": false,
163
+ "properties": {
164
+ "name": {
165
+ "type": "string"
166
+ },
167
+ "range": {
168
+ "type": "array",
169
+ "items": {
170
+ "type": "string"
171
+ },
172
+ "minItems": 1
173
+ },
174
+ "partition": {
175
+ "type": "array",
176
+ "items": {
177
+ "type": "string"
178
+ },
179
+ "minItems": 1
180
+ }
181
+ }
182
+ }
183
+ ]
184
+ },
185
+ "minItems": 1
186
+ }
187
+ }
188
+ },
189
+ "minItems": 1
104
190
  }
105
191
  }
106
192
  }
@@ -223,7 +223,100 @@ export interface App {
223
223
  /**
224
224
  * Labels to classify the type of data stored
225
225
  */
226
- classifications: ['ugc' | 'pii' | 'other', ...('ugc' | 'pii' | 'other')[]];
226
+ classifications?: ['ugc' | 'pii' | 'other', ...('ugc' | 'pii' | 'other')[]];
227
+ /**
228
+ * Custom schemas for app stored entities.
229
+ */
230
+ entities?: [
231
+ {
232
+ /**
233
+ * A name for the entity. Must be unique within the manifest and have a maximum of 60 characters.
234
+ */
235
+ name: string;
236
+ /**
237
+ * Attributes of the entity.
238
+ */
239
+ attributes: {
240
+ /**
241
+ * An attribute of the entity. Must be unique within the entity and have a maximum of 30 characters.
242
+ *
243
+ * This interface was referenced by `undefined`'s JSON-Schema definition
244
+ * via the `patternProperty` "^[a-zA-Z][a-zA-Z0-9_]*$".
245
+ */
246
+ [k: string]: {
247
+ /**
248
+ * The data type for the given attribute.
249
+ */
250
+ type: 'string' | 'boolean' | 'float' | 'integer' | 'any';
251
+ };
252
+ };
253
+ /**
254
+ * Indexes on attributes of the schema.
255
+ */
256
+ indexes?: [
257
+ (
258
+ | string
259
+ | {
260
+ name: string;
261
+ range: [string, ...string[]];
262
+ partition?: [string, ...string[]];
263
+ }
264
+ ),
265
+ ...(
266
+ | string
267
+ | {
268
+ name: string;
269
+ range: [string, ...string[]];
270
+ partition?: [string, ...string[]];
271
+ }
272
+ )[]
273
+ ];
274
+ },
275
+ ...{
276
+ /**
277
+ * A name for the entity. Must be unique within the manifest and have a maximum of 60 characters.
278
+ */
279
+ name: string;
280
+ /**
281
+ * Attributes of the entity.
282
+ */
283
+ attributes: {
284
+ /**
285
+ * An attribute of the entity. Must be unique within the entity and have a maximum of 30 characters.
286
+ *
287
+ * This interface was referenced by `undefined`'s JSON-Schema definition
288
+ * via the `patternProperty` "^[a-zA-Z][a-zA-Z0-9_]*$".
289
+ */
290
+ [k: string]: {
291
+ /**
292
+ * The data type for the given attribute.
293
+ */
294
+ type: 'string' | 'boolean' | 'float' | 'integer' | 'any';
295
+ };
296
+ };
297
+ /**
298
+ * Indexes on attributes of the schema.
299
+ */
300
+ indexes?: [
301
+ (
302
+ | string
303
+ | {
304
+ name: string;
305
+ range: [string, ...string[]];
306
+ partition?: [string, ...string[]];
307
+ }
308
+ ),
309
+ ...(
310
+ | string
311
+ | {
312
+ name: string;
313
+ range: [string, ...string[]];
314
+ partition?: [string, ...string[]];
315
+ }
316
+ )[]
317
+ ];
318
+ }[]
319
+ ];
227
320
  };
228
321
  }
229
322
  /**
@@ -104,6 +104,19 @@ export declare const errors: {
104
104
  missingAppConnectRemote: () => string;
105
105
  missingRemoteForConnect: (key: string) => string;
106
106
  missingConnectModules: () => string;
107
+ storage: {
108
+ missingStorageInformation: () => string;
109
+ entities: {
110
+ entityNameTooLong: (entity: string, limit: number) => string;
111
+ missingAttributes: (entity: string) => string;
112
+ tooManyAttributes: (entity: string, limit: number) => string;
113
+ attributeNameTooLong: (entity: string, attribute: string, limit: number) => string;
114
+ tooManyIndexes: (entity: string, limit: number) => string;
115
+ invalidIndexRange: (entity: string, index: string) => string;
116
+ invalidIndexPartition: (entity: string, partition: string) => string;
117
+ reservedIndexName: (entity: string, index: string) => string;
118
+ };
119
+ };
107
120
  };
108
121
  };
109
122
  export declare enum References {
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/text/errors.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM;8BACS,MAAM,KAAG,MAAM;2BACpB,MAAM;yBAEN,MAAM,GAAG,SAAS,QAAQ,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS,KAAG,MAAM;;uBAO3E,MAAM,EAAE,EAAE,GAAG,SAAS,KAAG,MAAM;4BAI1B,MAAM,EAAE,KAAG,MAAM;mCACV,MAAM,SAAS,MAAM,mBAAmB,MAAM,KAAG,MAAM;mDAIvC,MAAM,KAAG,MAAM;4BAEtC,MAAM,EAAE,GAAG,SAAS,KAAG,MAAM;;;qCAMpB,MAAM,SAAS,MAAM,KAAG,MAAM;4CAEvB,MAAM,SAAS,MAAM,KAAG,MAAM;wCAElC,MAAM,SAAS,MAAM,EAAE,KAAG,MAAM;;;uCAMjC,MAAM,KAAG,MAAM;oCACpB,MAAM;iCAEP,MAAM,KAAG,MAAM;4CACJ,MAAM,KAAG,MAAM;;;gCAG3B,MAAM,KAAG,MAAM;6BACpB,MAAM;+BACJ,MAAM;iCACF,MAAM,KAAG,MAAM;yCACP,MAAM,eAAe,MAAM,KAAG,MAAM;yCAEpC,MAAM,eAAe,MAAM,KAAG,MAAM;6CAEhC,MAAM,KAAG,MAAM;0EAEc,MAAM,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AG,MAAM;;;;;;;;kCAQpB,MAAM,UAAU,MAAM,KAAG,MAAM;gCAEjC,MAAM,KAAG,MAAM;2CAEJ,MAAM,eAAe,MAAM,KAAG,MAAM;;;uCAI1C,MAAM;uCAEJ,MAAM,KAAG,MAAM;qCAEnB,MAAM;;6CAGA,MAAM;;4CAGP,MAAM,SAAS,MAAM,KAAG,MAAM;4CAE9B,MAAM,KAAG,MAAM;4CACf,MAAM,SAAS,MAAM,KAAG,MAAM;+CAE3B,MAAM,aAAa,MAAM,SAAS,MAAM,KAAG,MAAM;yCAEvD,MAAM,SAAS,MAAM,KAAG,MAAM;4CAE3B,MAAM,SAAS,MAAM,KAAG,MAAM;gDAE1B,MAAM,aAAa,MAAM,KAAG,MAAM;4CAEtC,MAAM,SAAS,MAAM,KAAG,MAAM;;;;CAKjE,CAAC;AAEF,oBAAY,UAAU;IACpB,eAAe,2BAA2B;IAC1C,eAAe,wBAAwB;IACvC,WAAW,4BAA4B;IACvC,WAAW,+BAA+B;IAC1C,aAAa,8BAA8B;IAC3C,OAAO,0BAA0B;IACjC,cAAc,kCAAkC;IAChD,mBAAmB,0BAA0B;IAC7C,SAAS,4BAA4B;IACrC,SAAS,4BAA4B;IACrC,UAAU,wBAAwB;IAClC,GAAG,8BAA8B;CAClC"}
@@ -117,7 +117,20 @@ exports.errors = {
117
117
  app: {
118
118
  missingAppConnectRemote: () => `missing app.connect.remote. app.connect.remote is required if connectModules are present.`,
119
119
  missingRemoteForConnect: (key) => `no remote found with key '${key}' matching app.connect.remote value.`,
120
- missingConnectModules: () => 'Missing connectModules. When app.connect.authentication is present, connectModules is required.'
120
+ missingConnectModules: () => 'Missing connectModules. When app.connect.authentication is present, connectModules is required.',
121
+ storage: {
122
+ missingStorageInformation: () => 'Missing storage configuration. When app.storage is present, either entities or classifications is required.',
123
+ entities: {
124
+ entityNameTooLong: (entity, limit) => `Entity name '${entity}' exceeds maximum allowed length of ${limit} characters.`,
125
+ missingAttributes: (entity) => `Entity '${entity}' must contain at least one attribute.`,
126
+ tooManyAttributes: (entity, limit) => `Entity '${entity}' contains more attributes than the allowed limit of ${limit}.`,
127
+ attributeNameTooLong: (entity, attribute, limit) => `Entity '${entity}' attribute name '${attribute}' exceeds maximum allowed length of ${limit}.`,
128
+ tooManyIndexes: (entity, limit) => `Entity '${entity}' contains more indexes than the allowed limit of ${limit}.`,
129
+ invalidIndexRange: (entity, index) => `Entity '${entity}' index '${index}' must refer to a valid attribute of the entity.`,
130
+ invalidIndexPartition: (entity, partition) => `Entity '${entity}' index partition '${partition}' must refer to a valid attribute of the entity.`,
131
+ reservedIndexName: (entity, index) => `Entity '${entity}' cannot use reserved index name '${index}'.`
132
+ }
133
+ }
121
134
  }
122
135
  };
123
136
  var References;
@@ -0,0 +1,11 @@
1
+ import { ValidatorInterface } from './validator-interface';
2
+ import { ManifestObject, ManifestValidationResult } from '../types';
3
+ import { ManifestSchema } from '../schema/manifest';
4
+ export declare class StorageValidator implements ValidatorInterface<ManifestObject<ManifestSchema> | undefined, ManifestSchema> {
5
+ private entityAttributeMaxLength;
6
+ private entityAttributesMaxCount;
7
+ private entityIndexesMaxCount;
8
+ private reservedIndexName;
9
+ validate(manifest: ManifestObject<ManifestSchema> | undefined): Promise<ManifestValidationResult<ManifestSchema>>;
10
+ }
11
+ //# sourceMappingURL=storage-validator.d.ts.map
@@ -0,0 +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;IACzF,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"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StorageValidator = void 0;
4
+ const text_1 = require("../text");
5
+ const utils_1 = require("../utils");
6
+ class StorageValidator {
7
+ constructor() {
8
+ this.entityAttributeMaxLength = 30;
9
+ this.entityAttributesMaxCount = 50;
10
+ this.entityIndexesMaxCount = 5;
11
+ this.reservedIndexName = 'by-key';
12
+ }
13
+ async validate(manifest) {
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)) {
16
+ return {
17
+ success: true,
18
+ manifestObject: manifest
19
+ };
20
+ }
21
+ const validationErrors = [];
22
+ if (!manifest.typedContent.app.storage.entities) {
23
+ return {
24
+ success: true,
25
+ manifestObject: manifest
26
+ };
27
+ }
28
+ const entities = manifest.typedContent.app.storage.entities;
29
+ entities.forEach((entity) => {
30
+ const { name, attributes } = entity;
31
+ if (Object.keys(attributes).length > this.entityAttributesMaxCount) {
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)));
33
+ }
34
+ Object.keys(attributes).forEach((attributeKey) => {
35
+ if (attributeKey.length > this.entityAttributeMaxLength) {
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)));
37
+ }
38
+ });
39
+ if (entity.indexes) {
40
+ const { indexes } = entity;
41
+ if (indexes.length > this.entityIndexesMaxCount) {
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)));
43
+ }
44
+ const indexName = [];
45
+ const indexRange = [];
46
+ const indexPartition = [];
47
+ indexes.forEach((index) => {
48
+ if (typeof index === 'string') {
49
+ indexRange.push(index);
50
+ }
51
+ else if (typeof index === 'object') {
52
+ indexName.push(index.name);
53
+ indexRange.push(...index.range);
54
+ if (index.partition) {
55
+ indexPartition.push(...index.partition);
56
+ }
57
+ }
58
+ });
59
+ if (indexName.find((name) => name === this.reservedIndexName)) {
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)));
61
+ }
62
+ indexRange.forEach((range) => {
63
+ if (!Object.keys(attributes).length || !attributes[range]) {
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)));
65
+ }
66
+ });
67
+ indexPartition.forEach((partition) => {
68
+ if (!Object.keys(attributes).length || !attributes[partition]) {
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)));
70
+ }
71
+ });
72
+ }
73
+ });
74
+ return {
75
+ success: validationErrors.length === 0,
76
+ manifestObject: manifest,
77
+ errors: validationErrors
78
+ };
79
+ }
80
+ }
81
+ exports.StorageValidator = StorageValidator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/manifest",
3
- "version": "4.7.1",
3
+ "version": "4.8.0-next.0",
4
4
  "description": "Definitions and validations of the Forge manifest",
5
5
  "main": "out/index.js",
6
6
  "scripts": {