@movable/rollup-plugin-manifest-validator 3.2.0-app-validation

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 (55) hide show
  1. package/.mocharc.yml +3 -0
  2. package/babel.config.json +11 -0
  3. package/dist/apps/index.js +15 -0
  4. package/dist/apps/plugins/app-manifest-validator.js +44 -0
  5. package/dist/apps/utils/app-manifest-validator.js +44 -0
  6. package/dist/apps/validators/ajvCompiler.js +43 -0
  7. package/dist/apps/validators/erroringValidator.js +16 -0
  8. package/dist/apps/validators/index.js +23 -0
  9. package/dist/apps/validators/warningValidator.js +16 -0
  10. package/dist/index.js +21 -0
  11. package/dist/packages/index.js +15 -0
  12. package/dist/packages/plugins/package-manifest-validator.js +44 -0
  13. package/dist/packages/utils/package-manifest-validator.js +44 -0
  14. package/dist/packages/validators/ajvCompiler.js +43 -0
  15. package/dist/packages/validators/erroringValidator.js +16 -0
  16. package/dist/packages/validators/index.js +23 -0
  17. package/dist/packages/validators/warningValidator.js +16 -0
  18. package/dist/schemas/enums.js +14 -0
  19. package/dist/schemas/erroringSchemaApps.js +809 -0
  20. package/dist/schemas/erroringSchemaPackages.js +17 -0
  21. package/dist/schemas/index.js +39 -0
  22. package/dist/schemas/warningSchemaApps.js +8 -0
  23. package/dist/schemas/warningSchemaPackages.js +504 -0
  24. package/package.json +42 -0
  25. package/src/apps/index.js +3 -0
  26. package/src/apps/plugins/app-manifest-validator.js +22 -0
  27. package/src/apps/utils/app-manifest-validator.js +31 -0
  28. package/src/apps/validators/ajvCompiler.js +28 -0
  29. package/src/apps/validators/erroringValidator.js +4 -0
  30. package/src/apps/validators/index.js +4 -0
  31. package/src/apps/validators/warningValidator.js +4 -0
  32. package/src/index.js +4 -0
  33. package/src/packages/index.js +3 -0
  34. package/src/packages/plugins/package-manifest-validator.js +19 -0
  35. package/src/packages/utils/package-manifest-validator.js +31 -0
  36. package/src/packages/validators/ajvCompiler.js +28 -0
  37. package/src/packages/validators/erroringValidator.js +4 -0
  38. package/src/packages/validators/index.js +4 -0
  39. package/src/packages/validators/warningValidator.js +4 -0
  40. package/src/schemas/enums.js +130 -0
  41. package/src/schemas/erroringSchemaApps.js +468 -0
  42. package/src/schemas/erroringSchemaPackages.js +8 -0
  43. package/src/schemas/index.js +6 -0
  44. package/src/schemas/warningSchemaApps.js +1 -0
  45. package/src/schemas/warningSchemaPackages.js +304 -0
  46. package/test/fixtures/blankFile.js +0 -0
  47. package/test/fixtures/invalidField.yml +3 -0
  48. package/test/fixtures/master-app-manifest.yml +72 -0
  49. package/test/fixtures/master-package-manifest.yml +100 -0
  50. package/test/fixtures/noName.yml +1 -0
  51. package/test/helpers/lib.js +10 -0
  52. package/test/plugins/app-manifest-validation.js +34 -0
  53. package/test/plugins/package-manifest-validation.js +62 -0
  54. package/test/utils/app-manifest-validation.js +785 -0
  55. package/test/utils/package-manifest-validation.js +1515 -0
@@ -0,0 +1,468 @@
1
+ import { studioIcons, fieldTypes, propertyTypes, contextOptionTypes } from './enums';
2
+
3
+ const strNumBool = ['string', 'number', 'boolean'];
4
+
5
+ export default {
6
+ type: 'object',
7
+ additionalProperties: false,
8
+ required: ['name', 'authors'],
9
+ properties: {
10
+ name: { type: 'string' },
11
+ authors: { type: 'array', minItems: 1, items: { type: 'string' } },
12
+ stats: {
13
+ type: 'object',
14
+ required: ['page_name', 'groups'],
15
+ additionalProperties: false,
16
+ properties: {
17
+ page_name: { type: 'string' },
18
+ groups: {
19
+ type: 'array',
20
+ items: {
21
+ type: 'object',
22
+ required: ['name', 'events'],
23
+ additionalProperties: false,
24
+ properties: {
25
+ name: { type: 'string' },
26
+ calculation: { enum: ['exclusive'] },
27
+ format: { enum: ['percentage'] },
28
+ events: {
29
+ type: 'array',
30
+ items: {
31
+ type: 'object',
32
+ required: ['name', 'label'],
33
+ additionalProperties: false,
34
+ properties: {
35
+ name: { type: 'string' },
36
+ label: { type: 'string' },
37
+ hide_empty: { type: 'boolean' }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ },
46
+ width: { type: 'integer', minimum: 0, maximum: 2000 },
47
+ height: { type: 'integer', minimum: 0, maximum: 10000 },
48
+ format: { enum: ['auto', 'png', 'jpeg'] },
49
+ quality: { type: 'number', minimum: -1, maximum: 100 },
50
+ documentation: {
51
+ type: 'string',
52
+ anyOf: [{ pattern: '^https?://' }, { const: '' }]
53
+ },
54
+ expose_advanced_options: { type: 'boolean' },
55
+ description: { type: 'string' },
56
+ html_file: { type: 'string' },
57
+ css_file: { type: 'string' },
58
+ javascript_file: { type: 'string' },
59
+ data_loader_file: { type: 'string' },
60
+ label: { type: 'string' },
61
+ app_gallery_priority: { type: 'number' },
62
+ signals: { type: 'boolean' },
63
+ category: {
64
+ enum: [
65
+ 'content: social',
66
+ 'content: media',
67
+ 'context: location',
68
+ 'context: time',
69
+ 'custom',
70
+ 'data: rendering',
71
+ 'augmented reality'
72
+ ]
73
+ },
74
+ icon: { type: 'string' },
75
+ icon_v2: { type: 'string' },
76
+ query_params: { type: 'object', additionalProperties: { type: 'string' } },
77
+ hidden_query_params: { type: 'object', additionalProperties: { type: 'string' } },
78
+ render_types: { type: 'array', items: { enum: ['capturama', 'landing_page'] } },
79
+ fields: {
80
+ type: 'array',
81
+ items: {
82
+ oneOf: [
83
+ {
84
+ type: 'object',
85
+ additionalProperties: false,
86
+ required: ['name', 'type', 'label'],
87
+ properties: {
88
+ name: {
89
+ type: 'string',
90
+ not: { enum: ['id', 'name', 'html', 'width', 'height', 'dataSource'] }
91
+ },
92
+ type: { type: 'string', enum: fieldTypes },
93
+ label: { type: 'string' },
94
+ placeholder: { type: ['string', 'number'] },
95
+ provider: { type: 'string', enum: ['twitter', 'instagram'] },
96
+ authorization_url: { type: 'string', pattern: '^https?://' },
97
+ min: { type: 'number' },
98
+ max: { type: 'number' },
99
+ description: { type: 'string' },
100
+ template: { type: 'string' },
101
+ heading: { type: 'string' },
102
+ value: { type: ['number', 'string', 'boolean'] },
103
+ options: {
104
+ type: 'array',
105
+ items: {
106
+ required: ['value', 'label'],
107
+ properties: {
108
+ value: { type: ['string', 'number', 'boolean', 'null'] },
109
+ label: { type: ['string', 'number'] }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ },
115
+ {
116
+ type: 'object',
117
+ additionalProperties: false,
118
+ required: ['name', 'type'],
119
+ properties: {
120
+ name: {
121
+ type: 'string',
122
+ not: { enum: ['id', 'name', 'html', 'width', 'height', 'dataSource'] }
123
+ },
124
+ type: { type: 'string', enum: ['hidden'] },
125
+ label: { type: 'string' },
126
+ value: { type: strNumBool }
127
+ }
128
+ }
129
+ ]
130
+ }
131
+ },
132
+ field_headings: {
133
+ type: 'array',
134
+ items: {
135
+ type: 'object',
136
+ required: ['name', 'label'],
137
+ properties: {
138
+ name: { type: 'string' },
139
+ label: { type: 'string' },
140
+ toggleable: { type: 'boolean' },
141
+ default_toggle_collapsed: { type: 'boolean' }
142
+ }
143
+ }
144
+ },
145
+ package_manifests: {
146
+ type: 'array',
147
+ items: { type: 'object', additionalProperties: true }
148
+ },
149
+ capture_options: {
150
+ type: 'object',
151
+ additionalProperties: false,
152
+ properties: {
153
+ cache_ttl: { type: 'string', pattern: '^\\d+(s|ms)$' },
154
+ timeout: { type: 'string', pattern: '^\\d+(s|ms)$' },
155
+ beta: { type: 'boolean' },
156
+ capturama_version: { type: 'number' },
157
+ legacy: { type: 'boolean' },
158
+ transparent: { type: 'boolean' },
159
+ animation: {
160
+ type: 'object',
161
+ properties: {
162
+ looping: { type: 'boolean' },
163
+ step_function: { type: 'string' },
164
+ streaming: { type: 'boolean' },
165
+ color_palette: { type: 'string', enum: ['global', 'local'] },
166
+ length: { type: 'string', pattern: '^\\d+(s|ms)$' },
167
+ interval: { type: 'string', pattern: '^\\d+(s|ms)$' }
168
+ }
169
+ },
170
+ format: {
171
+ type: 'string',
172
+ enum: ['jpeg', 'png']
173
+ }
174
+ }
175
+ },
176
+ data_loader: {
177
+ type: 'object',
178
+ additionalProperties: false,
179
+ properties: {
180
+ cache_ttl: { type: 'string', pattern: '^\\d+(s|ms)$' },
181
+ timeout: { type: 'string', pattern: '^\\d+(s|ms)$' },
182
+ query_params: { type: 'object', additionalProperties: { type: 'string' } }
183
+ }
184
+ },
185
+ integration_ids: {
186
+ type: 'array',
187
+ items: {
188
+ type: 'string',
189
+ pattern: '^[a-zA-Z0-9]+$',
190
+ minLength: 15,
191
+ maxLength: 18
192
+ }
193
+ },
194
+ studio_options: {
195
+ type: 'object',
196
+ additionalProperties: false,
197
+ properties: {
198
+ prohibit_custom_params: { type: 'boolean' },
199
+ can_add_packages: { type: 'boolean' },
200
+ package_dependencies: {
201
+ type: 'array',
202
+ items: {
203
+ type: 'object',
204
+ required: ['name', 'version'],
205
+ properties: { name: { type: 'string' }, version: { type: 'string' } }
206
+ }
207
+ },
208
+ cold_state: {
209
+ type: 'object',
210
+ items: {
211
+ type: 'object',
212
+ required: ['packageName', 'name'],
213
+ properties: { packageName: { type: 'string' }, name: { type: 'string' } }
214
+ }
215
+ },
216
+ framework_version: { type: ['string', 'number'] },
217
+ tools: {
218
+ type: 'array',
219
+ items: {
220
+ type: 'object',
221
+ additionalProperties: false,
222
+ required: ['name', 'type', 'icon'],
223
+ properties: {
224
+ name: { type: 'string' },
225
+ type: { type: 'string' },
226
+ icon: { type: 'string', enum: studioIcons },
227
+ label: { type: ['string', 'number'] },
228
+ class_names: { type: 'string' },
229
+ locked: { type: 'boolean' },
230
+ has_source_index: { type: 'boolean' },
231
+ advanced: { type: 'object', properties: { autoresize: { type: 'boolean' } } },
232
+ defaults: {
233
+ properties: {
234
+ richText: {
235
+ type: 'array',
236
+ items: {
237
+ type: 'object',
238
+ required: ['insert'],
239
+ properties: {
240
+ insert: { type: 'string' },
241
+ attributes: { type: 'object' }
242
+ }
243
+ }
244
+ },
245
+ previewTokenMap: {
246
+ type: 'object',
247
+ additionalProperties: {
248
+ type: strNumBool
249
+ }
250
+ },
251
+ dynamicProperty: {
252
+ type: 'object',
253
+ required: ['propertyPath'],
254
+ properties: {
255
+ propertyPath: { type: 'string' },
256
+ propertyPreview: { type: 'string' },
257
+ propertyFallback: { type: 'string' },
258
+ propertyGroupKey: { type: 'string' },
259
+ propertyValue: { type: 'string' },
260
+ contextOptions: {
261
+ type: 'object',
262
+ required: ['name', 'type'],
263
+ properties: {
264
+ name: { type: 'string' },
265
+ description: { type: 'string' },
266
+ type: { type: 'string', enum: contextOptionTypes },
267
+ defaultValue: { type: strNumBool },
268
+ options: {
269
+ type: 'array',
270
+ items: {
271
+ type: 'object',
272
+ required: ['value', 'label'],
273
+ properties: { value: { type: strNumBool }, label: { type: 'string' } }
274
+ }
275
+ }
276
+ }
277
+ }
278
+ }
279
+ }
280
+ },
281
+ additionalProperties: {
282
+ type: strNumBool
283
+ }
284
+ },
285
+ fields: {
286
+ type: 'array',
287
+ items: {
288
+ type: 'object',
289
+ required: ['name', 'type'],
290
+ properties: {
291
+ name: { type: 'string' },
292
+ type: {
293
+ type: 'string',
294
+ enum: [
295
+ 'select',
296
+ 'textarea',
297
+ 'text',
298
+ 'checkbox',
299
+ 'color',
300
+ 'image',
301
+ 'date',
302
+ 'datetime',
303
+ 'number',
304
+ 'radio',
305
+ 'dynamicProperty'
306
+ ]
307
+ },
308
+ label: { type: ['string', 'number'] },
309
+ hidden: { type: 'boolean' },
310
+ disabled: { type: 'boolean' },
311
+ placeholder: { type: ['number', 'string'] }
312
+ }
313
+ }
314
+ },
315
+ dynamic_fields: {
316
+ type: 'array',
317
+ items: {
318
+ type: 'object',
319
+ required: ['name', 'type'],
320
+ properties: {
321
+ name: { type: 'string' },
322
+ type: { type: 'string' },
323
+ allow_static_option: { type: 'boolean' },
324
+ label: { type: 'string' }
325
+ }
326
+ }
327
+ }
328
+ }
329
+ }
330
+ },
331
+ data_options: {
332
+ required: ['label'],
333
+ properties: {
334
+ label: { type: ['string', 'number'] },
335
+ min: { type: 'integer' },
336
+ max: { type: 'integer' }
337
+ }
338
+ },
339
+ preview_fields: {
340
+ type: 'array',
341
+ items: { enum: ['location', 'date-time'] }
342
+ },
343
+ element_modifiers: {
344
+ type: 'array',
345
+ items: {
346
+ type: 'object',
347
+ additionalProperties: false,
348
+ required: ['name', 'label'],
349
+ properties: {
350
+ name: { type: 'string' },
351
+ label: { type: 'string' },
352
+ description: { type: 'string' }
353
+ }
354
+ }
355
+ },
356
+ property_groups: {
357
+ type: 'array',
358
+ items: {
359
+ type: 'object',
360
+ required: ['name', 'label', 'properties'],
361
+ properties: {
362
+ name: { type: 'string' },
363
+ label: { type: 'string' },
364
+ description: { type: 'string' },
365
+ properties: {
366
+ type: 'array',
367
+ items: {
368
+ type: 'object',
369
+ required: ['name', 'label'],
370
+ properties: {
371
+ name: { type: 'string' },
372
+ label: { type: 'string' },
373
+ options_description: { type: 'string' },
374
+ type: { type: 'string', enum: propertyTypes },
375
+ context_options: {
376
+ type: 'array',
377
+ items: {
378
+ type: 'object',
379
+ required: ['name', 'type'],
380
+ properties: {
381
+ name: { type: 'string' },
382
+ description: { type: 'string' },
383
+ type: { type: 'string', enum: contextOptionTypes },
384
+ defaultValue: { type: strNumBool },
385
+ options: {
386
+ type: 'array',
387
+ items: {
388
+ type: 'object',
389
+ required: ['value', 'label'],
390
+ properties: { value: { type: strNumBool }, label: { type: 'string' } }
391
+ }
392
+ }
393
+ }
394
+ }
395
+ },
396
+ preview_values: { type: 'array', items: { type: strNumBool } }
397
+ }
398
+ }
399
+ }
400
+ }
401
+ }
402
+ }
403
+ }
404
+ },
405
+ auto_pass_params: { type: 'boolean' },
406
+ ignored_query_params: { type: 'array', items: { type: 'string' } },
407
+ data_source_definitions: {
408
+ type: 'object',
409
+ additionalProperties: {
410
+ type: 'object',
411
+ additionalProperties: false,
412
+ required: ['name', 'type'],
413
+ properties: {
414
+ name: { type: 'string' },
415
+ type: { type: 'string', enum: ['ApiDataSource'] },
416
+ url: { type: 'string', pattern: '^https?://' },
417
+ content_type: { type: 'string' },
418
+ auth_type: { type: 'string', enum: ['none', 'basic_http', 'bearer'] },
419
+ http_method: { type: 'string', enum: ['GET', 'POST', 'PUT', 'DELETE'] },
420
+ username: { type: 'string' },
421
+ password: { type: 'string' },
422
+ bearer: { type: 'string' },
423
+ origin: { type: 'string' },
424
+ accept_type: { type: 'string' },
425
+ data_type: { type: 'string' },
426
+ body: { type: 'string' },
427
+ request_headers: {
428
+ type: 'array',
429
+ items: {
430
+ type: 'object',
431
+ additionalProperties: false,
432
+ required: ['name', 'value'],
433
+ properties: {
434
+ name: { type: ['string'] },
435
+ value: { type: ['string'] }
436
+ }
437
+ }
438
+ },
439
+ sample_responses: {
440
+ type: 'array',
441
+ items: {
442
+ type: 'object',
443
+ additionalProperties: false,
444
+ required: ['name', 'path'],
445
+ properties: {
446
+ name: { type: ['string'] },
447
+ path: { type: ['string'] }
448
+ }
449
+ }
450
+ }
451
+ }
452
+ }
453
+ },
454
+ clickthrough_dynamic_property: {
455
+ type: 'object',
456
+ additionalProperties: false,
457
+ required: ['property_path', 'property_group_key'],
458
+ properties: {
459
+ property_path: { type: 'string' },
460
+ property_group_key: { type: 'string' },
461
+ context: {
462
+ type: 'object',
463
+ additionalProperties: true
464
+ }
465
+ }
466
+ }
467
+ }
468
+ };
@@ -0,0 +1,8 @@
1
+ export default {
2
+ type: 'object',
3
+ properties: {
4
+ name: { type: 'string' }
5
+ },
6
+ required: ['name'],
7
+ prohibited: ['clickthrough_dynamic_property']
8
+ };
@@ -0,0 +1,6 @@
1
+ import warningSchemaApps from './warningSchemaApps';
2
+ import erroringSchemaApps from './erroringSchemaApps';
3
+ import warningSchemaPackages from './warningSchemaPackages';
4
+ import erroringSchemaPackages from './erroringSchemaPackages';
5
+
6
+ export { warningSchemaApps, erroringSchemaApps, warningSchemaPackages, erroringSchemaPackages };
@@ -0,0 +1 @@
1
+ export default {};