@sanity/blueprints 0.21.0 → 0.23.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/README.md +1 -0
- package/dist/definers/functions.d.ts +29 -14
- package/dist/definers/functions.js +42 -29
- package/dist/definers/functions.js.map +1 -1
- package/dist/definers/studios.d.ts +22 -0
- package/dist/definers/studios.js +31 -0
- package/dist/definers/studios.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/types/functions/event.d.ts +9 -17
- package/dist/types/functions/index.d.ts +55 -15
- package/dist/types/functions/index.js.map +1 -1
- package/dist/types/studios.d.ts +57 -0
- package/dist/types/studios.js +2 -0
- package/dist/types/studios.js.map +1 -0
- package/dist/validation/functions.d.ts +10 -1
- package/dist/validation/functions.js +91 -19
- package/dist/validation/functions.js.map +1 -1
- package/dist/validation/studios.d.ts +9 -0
- package/dist/validation/studios.js +70 -0
- package/dist/validation/studios.js.map +1 -0
- package/package.json +19 -9
- package/src/definers/functions.ts +45 -31
- package/src/definers/studios.ts +34 -0
- package/src/index.ts +3 -0
- package/src/types/functions/event.ts +4 -23
- package/src/types/functions/index.ts +58 -15
- package/src/types/studios.ts +68 -0
- package/src/validation/functions.ts +98 -21
- package/src/validation/studios.ts +76 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type {BlueprintResource} from '../../index.js'
|
|
2
2
|
import type {
|
|
3
3
|
BlueprintDocumentFunctionResourceEvent,
|
|
4
|
+
BlueprintFunctionResourceEvent,
|
|
4
5
|
BlueprintMediaLibraryFunctionResourceEvent,
|
|
5
|
-
BlueprintQueueFunctionConfigEvent,
|
|
6
|
-
BlueprintQueueFunctionResourceEvent,
|
|
7
6
|
BlueprintScheduledFunctionConfigEvent,
|
|
8
7
|
BlueprintScheduledFunctionResourceEvent,
|
|
9
8
|
BlueprintSyncTagInvalidateFunctionResourceEvent,
|
|
@@ -109,7 +108,8 @@ export interface BlueprintSyncTagInvalidateFunctionResource extends BlueprintBas
|
|
|
109
108
|
*/
|
|
110
109
|
export interface BlueprintQueueFunctionResource extends BlueprintBaseFunctionResource {
|
|
111
110
|
type: 'sanity.function.queue'
|
|
112
|
-
event
|
|
111
|
+
/** Optional event configuration that triggers the function */
|
|
112
|
+
event?: BlueprintFunctionResourceEvent
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
/**
|
|
@@ -221,23 +221,19 @@ export type BlueprintQueueFunctionConfig = Omit<BlueprintQueueFunctionResource,
|
|
|
221
221
|
* @defaultValue `functions/${name}`
|
|
222
222
|
*/
|
|
223
223
|
src?: string
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
*
|
|
232
|
-
* @defaultValue true
|
|
233
|
-
*/
|
|
234
|
-
queue?: BlueprintQueueFunctionConfigEvent
|
|
224
|
+
|
|
225
|
+
/** Optional event configuration that triggers the queue function */
|
|
226
|
+
event?: BlueprintFunctionResourceEvent
|
|
227
|
+
|
|
228
|
+
concurrency?: number
|
|
229
|
+
fifo?: boolean
|
|
230
|
+
dlq?: boolean
|
|
235
231
|
}
|
|
236
232
|
|
|
237
233
|
/**
|
|
238
234
|
* Configuration for defining an event function.
|
|
239
235
|
* @public
|
|
240
|
-
* @alpha Deploying
|
|
236
|
+
* @alpha Deploying Event Functions via Blueprints is experimental. This feature is not available publicly yet.
|
|
241
237
|
* @hidden
|
|
242
238
|
* @category Functions Types
|
|
243
239
|
* @interface
|
|
@@ -249,3 +245,50 @@ export type BlueprintEventFunctionConfig = Omit<BlueprintEventFunctionResource,
|
|
|
249
245
|
*/
|
|
250
246
|
src?: string
|
|
251
247
|
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* A durable, step-based pipeline function.
|
|
251
|
+
* @public
|
|
252
|
+
* @alpha Deploying Pipeline Functions via Blueprints is experimental. This feature is not available publicly yet.
|
|
253
|
+
* @hidden
|
|
254
|
+
* @category Functions Types
|
|
255
|
+
* @interface
|
|
256
|
+
*/
|
|
257
|
+
export interface BlueprintPipelineResource extends BlueprintBaseFunctionResource {
|
|
258
|
+
type: 'sanity.function.pipeline'
|
|
259
|
+
event?: BlueprintFunctionResourceEvent
|
|
260
|
+
/**
|
|
261
|
+
* Concurrent executions
|
|
262
|
+
* Min 1
|
|
263
|
+
* Max 500
|
|
264
|
+
*/
|
|
265
|
+
concurrency?: number
|
|
266
|
+
/**
|
|
267
|
+
* Debounce window in seconds
|
|
268
|
+
*/
|
|
269
|
+
debounce?: number
|
|
270
|
+
/**
|
|
271
|
+
* Path used to group debounced events, e.g. 'document._id'
|
|
272
|
+
*/
|
|
273
|
+
debounceKey?: string
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Configuration for defining a pipeline function.
|
|
278
|
+
* @public
|
|
279
|
+
* @alpha Deploying Pipeline Functions via Blueprints is experimental. This feature is not available publicly yet.
|
|
280
|
+
* @hidden
|
|
281
|
+
* @category Functions Types
|
|
282
|
+
* @interface
|
|
283
|
+
*/
|
|
284
|
+
export type BlueprintPipelineConfig = Omit<BlueprintPipelineResource, 'type' | 'src' | 'event'> & {
|
|
285
|
+
/**
|
|
286
|
+
* Path to the pipeline source code
|
|
287
|
+
* @defaultValue `functions/${name}`
|
|
288
|
+
*/
|
|
289
|
+
src?: string
|
|
290
|
+
/**
|
|
291
|
+
* Trigger configuration
|
|
292
|
+
*/
|
|
293
|
+
event?: BlueprintFunctionResourceEvent
|
|
294
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type {ConfigEnv, InlineConfig} from 'vite'
|
|
2
|
+
import type {BlueprintProjectResourceLifecycle, BlueprintResource} from '../index.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Custom Vite configuration for the Studio so it can be changed and extended.
|
|
6
|
+
* This type matches the type in @sanity/cli-core and must continue to remain compatible.
|
|
7
|
+
* @beta This feature is subject to breaking changes.
|
|
8
|
+
* @category Resource Types
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export type UserViteConfig = ((config: InlineConfig, env: ConfigEnv) => InlineConfig | Promise<InlineConfig>) | InlineConfig
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents a Studio resource.
|
|
15
|
+
* @see https://www.sanity.io/docs/studio
|
|
16
|
+
* @beta This feature is subject to breaking changes.
|
|
17
|
+
* @category Resource Types
|
|
18
|
+
* @hidden
|
|
19
|
+
*/
|
|
20
|
+
export interface BlueprintStudioResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
|
|
21
|
+
type: 'sanity.studio'
|
|
22
|
+
|
|
23
|
+
/** The relative location of the studio source code. */
|
|
24
|
+
src: string
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Auto update settings for the studio.
|
|
28
|
+
*/
|
|
29
|
+
autoUpdates: {
|
|
30
|
+
/** Whether auto updates are enabled for the studio */
|
|
31
|
+
enabled: boolean
|
|
32
|
+
|
|
33
|
+
/** What "version"/"channel" to use for auto updates */
|
|
34
|
+
version?: string // 'next', 'stable', 'latest' or a semantic version (e.g., "1.2.3", "2.0.0-beta.1")
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The base path of the studio URL. Defaults to '/' */
|
|
38
|
+
basePath?: string
|
|
39
|
+
|
|
40
|
+
/** Whether or not to minify the source code. Defaults to true. */
|
|
41
|
+
minify?: boolean
|
|
42
|
+
|
|
43
|
+
/** Whether or not to configure the reactCompiler. Defaults to false. */
|
|
44
|
+
reactCompiler?: boolean
|
|
45
|
+
|
|
46
|
+
/** Whether or not to generate source maps. Defaults to false. */
|
|
47
|
+
sourceMap?: boolean
|
|
48
|
+
|
|
49
|
+
/** Custom Vite configuration for the Studio so it can be changed and extended. */
|
|
50
|
+
vite?: UserViteConfig
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The project ID of the project that contains your Studio.
|
|
54
|
+
*
|
|
55
|
+
* The `project` attribute must be defined if your blueprint is scoped to an organization.
|
|
56
|
+
*/
|
|
57
|
+
project?: string
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Configuration for a Studio resource.
|
|
62
|
+
* @see https://www.sanity.io/docs/studio
|
|
63
|
+
* @beta This feature is subject to breaking changes.
|
|
64
|
+
* @category Resource Types
|
|
65
|
+
* @interface
|
|
66
|
+
* @hidden
|
|
67
|
+
*/
|
|
68
|
+
export interface BlueprintStudioConfig extends Omit<BlueprintStudioResource, 'type'> {}
|
|
@@ -181,7 +181,9 @@ function validateDocumentFunctionEvent(event: unknown): BlueprintError[] {
|
|
|
181
181
|
function validateFunctionEventResourceDataset(event: unknown): BlueprintError[] {
|
|
182
182
|
const errors: BlueprintError[] = []
|
|
183
183
|
if (!event || typeof event !== 'object') return [{type: 'invalid_value', message: '`event` must be an object'}]
|
|
184
|
-
|
|
184
|
+
// `resource` is optional for the event types that reach here (document and sync-tag-invalidate),
|
|
185
|
+
// so there is nothing to validate when it is absent.
|
|
186
|
+
if (!('resource' in event) || typeof event.resource === 'undefined') return []
|
|
185
187
|
const resource = event.resource
|
|
186
188
|
if (!resource || typeof resource !== 'object') return [{type: 'invalid_value', message: '`event.resource` must be an object'}]
|
|
187
189
|
if (!('type' in resource) || !resource.type || resource.type !== 'dataset')
|
|
@@ -439,7 +441,6 @@ export function validateSyncTagInvalidateFunction(functionResource: unknown): Bl
|
|
|
439
441
|
* @category Functions Types
|
|
440
442
|
* @returns Array of validation errors, empty if valid
|
|
441
443
|
*/
|
|
442
|
-
|
|
443
444
|
export function validateQueueFunction(functionResource: unknown): BlueprintError[] {
|
|
444
445
|
if (!functionResource) return [{type: 'invalid_value', message: 'Function config must be provided'}]
|
|
445
446
|
if (typeof functionResource !== 'object') return [{type: 'invalid_type', message: 'Function config must be an object'}]
|
|
@@ -450,8 +451,24 @@ export function validateQueueFunction(functionResource: unknown): BlueprintError
|
|
|
450
451
|
errors.push({type: 'invalid_value', message: '`type` must be `sanity.function.queue`'})
|
|
451
452
|
}
|
|
452
453
|
|
|
453
|
-
if ('
|
|
454
|
-
|
|
454
|
+
if ('concurrency' in functionResource) {
|
|
455
|
+
if (typeof functionResource.concurrency !== 'number') {
|
|
456
|
+
errors.push({type: 'invalid_type', message: '`concurrency` must be a number'})
|
|
457
|
+
} else if (functionResource.concurrency < 1) {
|
|
458
|
+
errors.push({type: 'invalid_type', message: '`concurrency` must be at least 1'})
|
|
459
|
+
} else if (functionResource.concurrency > 500) {
|
|
460
|
+
errors.push({type: 'invalid_value', message: '`concurrency` must be less than 500'})
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
if ('fifo' in functionResource && typeof functionResource.fifo !== 'boolean') {
|
|
464
|
+
errors.push({type: 'invalid_type', message: '`fifo` must be a boolean'})
|
|
465
|
+
}
|
|
466
|
+
if ('dlq' in functionResource && typeof functionResource.dlq !== 'boolean') {
|
|
467
|
+
errors.push({type: 'invalid_type', message: '`dlq` must be a boolean'})
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
if ('event' in functionResource && typeof functionResource.event !== 'undefined') {
|
|
471
|
+
errors.push(...validateFunctionEvent(functionResource.event))
|
|
455
472
|
}
|
|
456
473
|
|
|
457
474
|
errors.push(...validateFunction(functionResource))
|
|
@@ -459,44 +476,104 @@ export function validateQueueFunction(functionResource: unknown): BlueprintError
|
|
|
459
476
|
return errors
|
|
460
477
|
}
|
|
461
478
|
|
|
462
|
-
|
|
479
|
+
/**
|
|
480
|
+
* Validates a function event configuration.
|
|
481
|
+
* The event is a discriminated union keyed by `type`; validation is delegated to the
|
|
482
|
+
* matching per-type event validator.
|
|
483
|
+
* @param event The event configuration to validate
|
|
484
|
+
* @returns Array of validation errors, empty if valid
|
|
485
|
+
*/
|
|
486
|
+
function validateFunctionEvent(event: unknown): BlueprintError[] {
|
|
463
487
|
if (!event || typeof event !== 'object') return [{type: 'invalid_type', message: '`event` must be an object'}]
|
|
488
|
+
if (!('type' in event)) return [{type: 'missing_parameter', message: '`event.type` is required'}]
|
|
489
|
+
|
|
490
|
+
switch (event.type) {
|
|
491
|
+
case 'document':
|
|
492
|
+
return validateDocumentFunctionEvent(event)
|
|
493
|
+
case 'media-library':
|
|
494
|
+
return validateMediaLibraryFunctionEvent(event)
|
|
495
|
+
case 'cron':
|
|
496
|
+
return validateScheduledFunctionEvent(event)
|
|
497
|
+
case 'sync-tag-invalidate':
|
|
498
|
+
return validateFunctionEventResourceDataset(event)
|
|
499
|
+
default:
|
|
500
|
+
return [
|
|
501
|
+
{
|
|
502
|
+
type: 'invalid_value',
|
|
503
|
+
message: '`event.type` must be either `cron`, `document`, `sync-tag-invalidate`, or `media-library`',
|
|
504
|
+
},
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Validates an event function resource configuration.
|
|
511
|
+
* @param functionResource The function resource to validate
|
|
512
|
+
* @alpha
|
|
513
|
+
* @hidden
|
|
514
|
+
* @category Functions Types
|
|
515
|
+
* @returns Array of validation errors, empty if valid
|
|
516
|
+
*/
|
|
517
|
+
|
|
518
|
+
export function validateEventFunction(functionResource: unknown): BlueprintError[] {
|
|
519
|
+
if (!functionResource) return [{type: 'invalid_value', message: 'Function config must be provided'}]
|
|
520
|
+
if (typeof functionResource !== 'object') return [{type: 'invalid_type', message: 'Function config must be an object'}]
|
|
464
521
|
|
|
465
522
|
const errors: BlueprintError[] = []
|
|
466
523
|
|
|
467
|
-
if (
|
|
468
|
-
errors.push({type: '
|
|
469
|
-
}
|
|
470
|
-
if ('concurrency' in event && typeof event.concurrency === 'number' && event.concurrency < 1) {
|
|
471
|
-
errors.push({type: 'invalid_type', message: '`event.concurrency` must be at least 1'})
|
|
472
|
-
}
|
|
473
|
-
if (!('fifo' in event) || typeof event.fifo !== 'boolean') {
|
|
474
|
-
errors.push({type: 'invalid_type', message: '`event.fifo` must be a boolean'})
|
|
475
|
-
}
|
|
476
|
-
if (!('dlq' in event) || typeof event.dlq !== 'boolean') {
|
|
477
|
-
errors.push({type: 'invalid_type', message: '`event.dlq` must be a boolean'})
|
|
524
|
+
if ('type' in functionResource && functionResource.type !== 'sanity.function.event') {
|
|
525
|
+
errors.push({type: 'invalid_value', message: '`type` must be `sanity.function.event`'})
|
|
478
526
|
}
|
|
479
527
|
|
|
528
|
+
errors.push(...validateFunction(functionResource))
|
|
529
|
+
|
|
480
530
|
return errors
|
|
481
531
|
}
|
|
482
532
|
|
|
483
533
|
/**
|
|
484
|
-
* Validates a
|
|
534
|
+
* Validates a pipeline function resource configuration.
|
|
485
535
|
* @param functionResource The function resource to validate
|
|
486
536
|
* @alpha
|
|
487
537
|
* @hidden
|
|
488
538
|
* @category Functions Types
|
|
489
539
|
* @returns Array of validation errors, empty if valid
|
|
490
540
|
*/
|
|
491
|
-
|
|
492
|
-
export function validateEventFunction(functionResource: unknown): BlueprintError[] {
|
|
541
|
+
export function validatePipelineFunction(functionResource: unknown): BlueprintError[] {
|
|
493
542
|
if (!functionResource) return [{type: 'invalid_value', message: 'Function config must be provided'}]
|
|
494
543
|
if (typeof functionResource !== 'object') return [{type: 'invalid_type', message: 'Function config must be an object'}]
|
|
495
544
|
|
|
496
545
|
const errors: BlueprintError[] = []
|
|
497
546
|
|
|
498
|
-
if ('type' in functionResource && functionResource.type !== 'sanity.function.
|
|
499
|
-
errors.push({type: 'invalid_value', message: '`type` must be `sanity.function.
|
|
547
|
+
if ('type' in functionResource && functionResource.type !== 'sanity.function.pipeline') {
|
|
548
|
+
errors.push({type: 'invalid_value', message: '`type` must be `sanity.function.pipeline`'})
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
if ('debounceKey' in functionResource && typeof functionResource.debounceKey !== 'string') {
|
|
552
|
+
errors.push({type: 'invalid_type', message: '`debounceKey` must be a string'})
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
if ('debounceKey' in functionResource && !('debounce' in functionResource)) {
|
|
556
|
+
errors.push({type: 'invalid_value', message: '`debounceKey` requires a `debounce` to be set'})
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
if ('concurrency' in functionResource && typeof functionResource.concurrency !== 'number') {
|
|
560
|
+
errors.push({type: 'invalid_type', message: '`concurrency` must be a number'})
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
if ('concurrency' in functionResource && typeof functionResource.concurrency === 'number' && functionResource.concurrency < 1) {
|
|
564
|
+
errors.push({type: 'invalid_value', message: '`concurrency` must be at least 1'})
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
if ('concurrency' in functionResource && typeof functionResource.concurrency === 'number' && functionResource.concurrency > 500) {
|
|
568
|
+
errors.push({type: 'invalid_value', message: '`concurrency` must be less than 500'})
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
if ('debounce' in functionResource && typeof functionResource.debounce !== 'number') {
|
|
572
|
+
errors.push({type: 'invalid_type', message: '`debounce` must be a number'})
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
if ('event' in functionResource) {
|
|
576
|
+
errors.push(...validateFunctionEvent(functionResource.event))
|
|
500
577
|
}
|
|
501
578
|
|
|
502
579
|
errors.push(...validateFunction(functionResource))
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type {BlueprintError} from '../types/errors.js'
|
|
2
|
+
import {validateResource} from './resources.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Validates that the given resource is a valid Studio.
|
|
6
|
+
* @param resource The Studio resource
|
|
7
|
+
* @hidden
|
|
8
|
+
* @category Validation
|
|
9
|
+
* @returns A list of validation errors
|
|
10
|
+
*/
|
|
11
|
+
export function validateStudio(resource: unknown): BlueprintError[] {
|
|
12
|
+
if (!resource) return [{type: 'invalid_value', message: 'Studio config must be provided'}]
|
|
13
|
+
if (typeof resource !== 'object') return [{type: 'invalid_type', message: 'Studio config must be an object'}]
|
|
14
|
+
|
|
15
|
+
const errors: BlueprintError[] = validateResource(resource, {projectContained: true})
|
|
16
|
+
|
|
17
|
+
if ('type' in resource && resource.type !== 'sanity.studio') {
|
|
18
|
+
errors.push({type: 'invalid_value', message: 'Studio type must be `sanity.studio`'})
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (!('src' in resource) || !resource.src) {
|
|
22
|
+
errors.push({type: 'missing_parameter', message: 'Studio src is required'})
|
|
23
|
+
} else if (typeof resource.src !== 'string') {
|
|
24
|
+
errors.push({type: 'invalid_type', message: 'Studio src must be a string'})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!('autoUpdates' in resource) || !resource.autoUpdates) {
|
|
28
|
+
errors.push({type: 'missing_parameter', message: 'Studio autoUpdates is required'})
|
|
29
|
+
} else if (typeof resource.autoUpdates !== 'object') {
|
|
30
|
+
errors.push({type: 'invalid_type', message: 'Studio autoUpdates must be an object'})
|
|
31
|
+
} else {
|
|
32
|
+
if (!('enabled' in resource.autoUpdates)) {
|
|
33
|
+
errors.push({type: 'missing_parameter', message: 'Studio autoUpdates.enabled is required'})
|
|
34
|
+
} else if (typeof resource.autoUpdates.enabled !== 'boolean') {
|
|
35
|
+
errors.push({type: 'invalid_type', message: 'Studio autoUpdates.enabled must be a boolean'})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if ('version' in resource.autoUpdates) {
|
|
39
|
+
if (typeof resource.autoUpdates.version !== 'string') {
|
|
40
|
+
errors.push({type: 'invalid_type', message: 'Studio autoUpdates.version must be a string'})
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if ('basePath' in resource) {
|
|
46
|
+
if (typeof resource.basePath !== 'string') {
|
|
47
|
+
errors.push({type: 'invalid_type', message: 'Studio basePath must be a string'})
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if ('minify' in resource) {
|
|
52
|
+
if (typeof resource.minify !== 'boolean') {
|
|
53
|
+
errors.push({type: 'invalid_type', message: 'Studio minify must be a boolean'})
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if ('reactCompiler' in resource) {
|
|
58
|
+
if (typeof resource.reactCompiler !== 'boolean') {
|
|
59
|
+
errors.push({type: 'invalid_type', message: 'Studio reactCompiler must be a boolean'})
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if ('sourceMap' in resource) {
|
|
64
|
+
if (typeof resource.sourceMap !== 'boolean') {
|
|
65
|
+
errors.push({type: 'invalid_type', message: 'Studio sourceMap must be a boolean'})
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if ('project' in resource) {
|
|
70
|
+
if (typeof resource.project !== 'string') {
|
|
71
|
+
errors.push({type: 'invalid_type', message: 'Studio project must be a string'})
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return errors
|
|
76
|
+
}
|