@constela/core 0.4.0 → 0.6.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/dist/index.d.ts +341 -4
- package/dist/index.js +356 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,14 @@ declare const UPDATE_OPERATIONS: readonly ["increment", "decrement", "push", "po
|
|
|
10
10
|
type UpdateOperation = (typeof UPDATE_OPERATIONS)[number];
|
|
11
11
|
declare const HTTP_METHODS: readonly ["GET", "POST", "PUT", "DELETE"];
|
|
12
12
|
type HttpMethod = (typeof HTTP_METHODS)[number];
|
|
13
|
+
declare const STORAGE_OPERATIONS: readonly ["get", "set", "remove"];
|
|
14
|
+
type StorageOperation = (typeof STORAGE_OPERATIONS)[number];
|
|
15
|
+
declare const STORAGE_TYPES: readonly ["local", "session"];
|
|
16
|
+
type StorageType = (typeof STORAGE_TYPES)[number];
|
|
17
|
+
declare const CLIPBOARD_OPERATIONS: readonly ["write", "read"];
|
|
18
|
+
type ClipboardOperation = (typeof CLIPBOARD_OPERATIONS)[number];
|
|
19
|
+
declare const NAVIGATE_TARGETS: readonly ["_self", "_blank"];
|
|
20
|
+
type NavigateTarget = (typeof NAVIGATE_TARGETS)[number];
|
|
13
21
|
declare const PARAM_TYPES: readonly ["string", "number", "boolean", "json"];
|
|
14
22
|
type ParamType = (typeof PARAM_TYPES)[number];
|
|
15
23
|
interface ParamDef {
|
|
@@ -79,7 +87,38 @@ interface GetExpr {
|
|
|
79
87
|
base: Expression;
|
|
80
88
|
path: string;
|
|
81
89
|
}
|
|
82
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Route expression - references route parameters
|
|
92
|
+
*/
|
|
93
|
+
interface RouteExpr {
|
|
94
|
+
expr: 'route';
|
|
95
|
+
name: string;
|
|
96
|
+
source?: 'param' | 'query' | 'path';
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Import expression - references imported external data
|
|
100
|
+
*/
|
|
101
|
+
interface ImportExpr {
|
|
102
|
+
expr: 'import';
|
|
103
|
+
name: string;
|
|
104
|
+
path?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Data expression - references loaded data from data sources
|
|
108
|
+
*/
|
|
109
|
+
interface DataExpr {
|
|
110
|
+
expr: 'data';
|
|
111
|
+
name: string;
|
|
112
|
+
path?: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Ref expression - references a DOM element by ref name
|
|
116
|
+
*/
|
|
117
|
+
interface RefExpr {
|
|
118
|
+
expr: 'ref';
|
|
119
|
+
name: string;
|
|
120
|
+
}
|
|
121
|
+
type Expression = LitExpr | StateExpr | VarExpr | BinExpr | NotExpr | ParamExpr | CondExpr | GetExpr | RouteExpr | ImportExpr | DataExpr | RefExpr;
|
|
83
122
|
/**
|
|
84
123
|
* Number state field
|
|
85
124
|
*/
|
|
@@ -164,7 +203,79 @@ interface FetchStep {
|
|
|
164
203
|
onSuccess?: ActionStep[];
|
|
165
204
|
onError?: ActionStep[];
|
|
166
205
|
}
|
|
167
|
-
|
|
206
|
+
/**
|
|
207
|
+
* Storage step - localStorage/sessionStorage operations
|
|
208
|
+
*/
|
|
209
|
+
interface StorageStep {
|
|
210
|
+
do: 'storage';
|
|
211
|
+
operation: StorageOperation;
|
|
212
|
+
key: Expression;
|
|
213
|
+
value?: Expression;
|
|
214
|
+
storage: StorageType;
|
|
215
|
+
result?: string;
|
|
216
|
+
onSuccess?: ActionStep[];
|
|
217
|
+
onError?: ActionStep[];
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Clipboard step - clipboard API operations
|
|
221
|
+
*/
|
|
222
|
+
interface ClipboardStep {
|
|
223
|
+
do: 'clipboard';
|
|
224
|
+
operation: ClipboardOperation;
|
|
225
|
+
value?: Expression;
|
|
226
|
+
result?: string;
|
|
227
|
+
onSuccess?: ActionStep[];
|
|
228
|
+
onError?: ActionStep[];
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Navigate step - page navigation
|
|
232
|
+
*/
|
|
233
|
+
interface NavigateStep {
|
|
234
|
+
do: 'navigate';
|
|
235
|
+
url: Expression;
|
|
236
|
+
target?: NavigateTarget;
|
|
237
|
+
replace?: boolean;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Import step - dynamically imports an external module
|
|
241
|
+
* Module name must be a static string for bundler optimization
|
|
242
|
+
*/
|
|
243
|
+
interface ImportStep {
|
|
244
|
+
do: 'import';
|
|
245
|
+
module: string;
|
|
246
|
+
result: string;
|
|
247
|
+
onSuccess?: ActionStep[];
|
|
248
|
+
onError?: ActionStep[];
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Call step - calls a function on an external library
|
|
252
|
+
*/
|
|
253
|
+
interface CallStep {
|
|
254
|
+
do: 'call';
|
|
255
|
+
target: Expression;
|
|
256
|
+
args?: Expression[];
|
|
257
|
+
result?: string;
|
|
258
|
+
onSuccess?: ActionStep[];
|
|
259
|
+
onError?: ActionStep[];
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Subscribe step - subscribes to an event on an object
|
|
263
|
+
* Subscription is auto-collected and disposed on lifecycle.onUnmount
|
|
264
|
+
*/
|
|
265
|
+
interface SubscribeStep {
|
|
266
|
+
do: 'subscribe';
|
|
267
|
+
target: Expression;
|
|
268
|
+
event: string;
|
|
269
|
+
action: string;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Dispose step - manually disposes a resource
|
|
273
|
+
*/
|
|
274
|
+
interface DisposeStep {
|
|
275
|
+
do: 'dispose';
|
|
276
|
+
target: Expression;
|
|
277
|
+
}
|
|
278
|
+
type ActionStep = SetStep | UpdateStep | FetchStep | StorageStep | ClipboardStep | NavigateStep | ImportStep | CallStep | SubscribeStep | DisposeStep;
|
|
168
279
|
/**
|
|
169
280
|
* Event handler - binds an event to an action
|
|
170
281
|
*/
|
|
@@ -186,6 +297,7 @@ interface ActionDefinition {
|
|
|
186
297
|
interface ElementNode {
|
|
187
298
|
kind: 'element';
|
|
188
299
|
tag: string;
|
|
300
|
+
ref?: string;
|
|
189
301
|
props?: Record<string, Expression | EventHandler>;
|
|
190
302
|
children?: ViewNode[];
|
|
191
303
|
}
|
|
@@ -227,9 +339,11 @@ interface ComponentNode {
|
|
|
227
339
|
}
|
|
228
340
|
/**
|
|
229
341
|
* Slot node - placeholder for children in component definition
|
|
342
|
+
* For layouts, can have an optional name for named slots
|
|
230
343
|
*/
|
|
231
344
|
interface SlotNode {
|
|
232
345
|
kind: 'slot';
|
|
346
|
+
name?: string;
|
|
233
347
|
}
|
|
234
348
|
/**
|
|
235
349
|
* Markdown node - renders markdown content
|
|
@@ -251,17 +365,83 @@ interface ComponentDef {
|
|
|
251
365
|
params?: Record<string, ParamDef>;
|
|
252
366
|
view: ViewNode;
|
|
253
367
|
}
|
|
368
|
+
/**
|
|
369
|
+
* Data transform types for build-time content loading
|
|
370
|
+
*/
|
|
371
|
+
declare const DATA_TRANSFORMS: readonly ["mdx", "yaml", "csv"];
|
|
372
|
+
type DataTransform = (typeof DATA_TRANSFORMS)[number];
|
|
373
|
+
/**
|
|
374
|
+
* Data source types
|
|
375
|
+
*/
|
|
376
|
+
declare const DATA_SOURCE_TYPES: readonly ["glob", "file", "api"];
|
|
377
|
+
type DataSourceType = (typeof DATA_SOURCE_TYPES)[number];
|
|
378
|
+
/**
|
|
379
|
+
* Data source for build-time content loading
|
|
380
|
+
*/
|
|
381
|
+
interface DataSource {
|
|
382
|
+
type: DataSourceType;
|
|
383
|
+
pattern?: string;
|
|
384
|
+
path?: string;
|
|
385
|
+
url?: string;
|
|
386
|
+
transform?: DataTransform;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Static paths definition for SSG
|
|
390
|
+
*/
|
|
391
|
+
interface StaticPathsDefinition {
|
|
392
|
+
source: string;
|
|
393
|
+
params: Record<string, Expression>;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Route definition for a page
|
|
397
|
+
*/
|
|
398
|
+
interface RouteDefinition {
|
|
399
|
+
path: string;
|
|
400
|
+
title?: Expression;
|
|
401
|
+
layout?: string;
|
|
402
|
+
meta?: Record<string, Expression>;
|
|
403
|
+
getStaticPaths?: StaticPathsDefinition;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Lifecycle hooks for component/page lifecycle events
|
|
407
|
+
*/
|
|
408
|
+
interface LifecycleHooks {
|
|
409
|
+
onMount?: string;
|
|
410
|
+
onUnmount?: string;
|
|
411
|
+
onRouteEnter?: string;
|
|
412
|
+
onRouteLeave?: string;
|
|
413
|
+
}
|
|
254
414
|
/**
|
|
255
415
|
* Program - the root of a Constela AST
|
|
256
416
|
*/
|
|
257
417
|
interface Program {
|
|
258
418
|
version: '1.0';
|
|
419
|
+
route?: RouteDefinition;
|
|
420
|
+
imports?: Record<string, string>;
|
|
421
|
+
data?: Record<string, DataSource>;
|
|
422
|
+
lifecycle?: LifecycleHooks;
|
|
259
423
|
state: Record<string, StateField>;
|
|
260
424
|
actions: ActionDefinition[];
|
|
261
425
|
view: ViewNode;
|
|
262
426
|
components?: Record<string, ComponentDef>;
|
|
263
427
|
}
|
|
264
428
|
type ConstelaAst = Program;
|
|
429
|
+
/**
|
|
430
|
+
* Layout program - a special type of program that wraps page content
|
|
431
|
+
* Must contain at least one SlotNode in the view tree
|
|
432
|
+
*/
|
|
433
|
+
interface LayoutProgram {
|
|
434
|
+
version: '1.0';
|
|
435
|
+
type: 'layout';
|
|
436
|
+
state?: Record<string, StateField>;
|
|
437
|
+
actions?: ActionDefinition[];
|
|
438
|
+
view: ViewNode;
|
|
439
|
+
components?: Record<string, ComponentDef>;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Union type for both regular Program and LayoutProgram
|
|
443
|
+
*/
|
|
444
|
+
type ConstelaProgram = Program | LayoutProgram;
|
|
265
445
|
|
|
266
446
|
/**
|
|
267
447
|
* Type Guards for Constela AST Types
|
|
@@ -325,6 +505,34 @@ declare function isCondExpr(value: unknown): value is CondExpr;
|
|
|
325
505
|
* Use the AST validator for full recursive validation instead.
|
|
326
506
|
*/
|
|
327
507
|
declare function isGetExpr(value: unknown): value is GetExpr;
|
|
508
|
+
/**
|
|
509
|
+
* Checks if value is a route expression
|
|
510
|
+
*/
|
|
511
|
+
declare function isRouteExpr(value: unknown): value is RouteExpr;
|
|
512
|
+
/**
|
|
513
|
+
* Checks if value is an import expression
|
|
514
|
+
*/
|
|
515
|
+
declare function isImportExpr(value: unknown): value is ImportExpr;
|
|
516
|
+
/**
|
|
517
|
+
* Checks if value is a data expression
|
|
518
|
+
*/
|
|
519
|
+
declare function isDataExpr(value: unknown): value is DataExpr;
|
|
520
|
+
/**
|
|
521
|
+
* Checks if value is a ref expression
|
|
522
|
+
*/
|
|
523
|
+
declare function isRefExpr(value: unknown): value is RefExpr;
|
|
524
|
+
/**
|
|
525
|
+
* Checks if value is a data source
|
|
526
|
+
*/
|
|
527
|
+
declare function isDataSource(value: unknown): value is DataSource;
|
|
528
|
+
/**
|
|
529
|
+
* Checks if value is a static paths definition
|
|
530
|
+
*/
|
|
531
|
+
declare function isStaticPathsDefinition(value: unknown): value is StaticPathsDefinition;
|
|
532
|
+
/**
|
|
533
|
+
* Checks if value is a route definition
|
|
534
|
+
*/
|
|
535
|
+
declare function isRouteDefinition(value: unknown): value is RouteDefinition;
|
|
328
536
|
/**
|
|
329
537
|
* Checks if value is any valid expression
|
|
330
538
|
*/
|
|
@@ -377,6 +585,34 @@ declare function isUpdateStep(value: unknown): value is UpdateStep;
|
|
|
377
585
|
* Checks if value is a fetch step
|
|
378
586
|
*/
|
|
379
587
|
declare function isFetchStep(value: unknown): value is FetchStep;
|
|
588
|
+
/**
|
|
589
|
+
* Checks if value is a storage step
|
|
590
|
+
*/
|
|
591
|
+
declare function isStorageStep(value: unknown): value is StorageStep;
|
|
592
|
+
/**
|
|
593
|
+
* Checks if value is a clipboard step
|
|
594
|
+
*/
|
|
595
|
+
declare function isClipboardStep(value: unknown): value is ClipboardStep;
|
|
596
|
+
/**
|
|
597
|
+
* Checks if value is a navigate step
|
|
598
|
+
*/
|
|
599
|
+
declare function isNavigateStep(value: unknown): value is NavigateStep;
|
|
600
|
+
/**
|
|
601
|
+
* Checks if value is an import step
|
|
602
|
+
*/
|
|
603
|
+
declare function isImportStep(value: unknown): value is ImportStep;
|
|
604
|
+
/**
|
|
605
|
+
* Checks if value is a call step
|
|
606
|
+
*/
|
|
607
|
+
declare function isCallStep(value: unknown): value is CallStep;
|
|
608
|
+
/**
|
|
609
|
+
* Checks if value is a subscribe step
|
|
610
|
+
*/
|
|
611
|
+
declare function isSubscribeStep(value: unknown): value is SubscribeStep;
|
|
612
|
+
/**
|
|
613
|
+
* Checks if value is a dispose step
|
|
614
|
+
*/
|
|
615
|
+
declare function isDisposeStep(value: unknown): value is DisposeStep;
|
|
380
616
|
/**
|
|
381
617
|
* Checks if value is any valid action step
|
|
382
618
|
*/
|
|
@@ -409,6 +645,23 @@ declare function isStateField(value: unknown): value is StateField;
|
|
|
409
645
|
* Checks if value is an event handler
|
|
410
646
|
*/
|
|
411
647
|
declare function isEventHandler(value: unknown): value is EventHandler;
|
|
648
|
+
/**
|
|
649
|
+
* Checks if value is a layout program
|
|
650
|
+
*/
|
|
651
|
+
declare function isLayoutProgram(value: unknown): value is LayoutProgram;
|
|
652
|
+
/**
|
|
653
|
+
* Checks if value is a named slot node (slot with a name property)
|
|
654
|
+
*/
|
|
655
|
+
declare function isNamedSlotNode(value: unknown): value is SlotNode & {
|
|
656
|
+
name: string;
|
|
657
|
+
};
|
|
658
|
+
/**
|
|
659
|
+
* Checks if value is a lifecycle hooks object
|
|
660
|
+
*
|
|
661
|
+
* Lifecycle hooks are permissive - they allow unknown properties for extensibility.
|
|
662
|
+
* Only known properties are validated to be strings.
|
|
663
|
+
*/
|
|
664
|
+
declare function isLifecycleHooks(value: unknown): value is LifecycleHooks;
|
|
412
665
|
|
|
413
666
|
/**
|
|
414
667
|
* Error Types for Constela
|
|
@@ -416,7 +669,7 @@ declare function isEventHandler(value: unknown): value is EventHandler;
|
|
|
416
669
|
* This module defines error types, the ConstelaError class,
|
|
417
670
|
* and factory functions for creating specific errors.
|
|
418
671
|
*/
|
|
419
|
-
type ErrorCode = 'SCHEMA_INVALID' | 'UNDEFINED_STATE' | 'UNDEFINED_ACTION' | 'VAR_UNDEFINED' | 'DUPLICATE_ACTION' | 'UNSUPPORTED_VERSION' | 'COMPONENT_NOT_FOUND' | 'COMPONENT_PROP_MISSING' | 'COMPONENT_CYCLE' | 'COMPONENT_PROP_TYPE' | 'PARAM_UNDEFINED' | 'OPERATION_INVALID_FOR_TYPE' | 'OPERATION_MISSING_FIELD' | 'OPERATION_UNKNOWN' | 'EXPR_INVALID_BASE' | 'EXPR_INVALID_CONDITION' | 'EXPR_COND_ELSE_REQUIRED';
|
|
672
|
+
type ErrorCode = 'SCHEMA_INVALID' | 'UNDEFINED_STATE' | 'UNDEFINED_ACTION' | 'VAR_UNDEFINED' | 'DUPLICATE_ACTION' | 'UNSUPPORTED_VERSION' | 'COMPONENT_NOT_FOUND' | 'COMPONENT_PROP_MISSING' | 'COMPONENT_CYCLE' | 'COMPONENT_PROP_TYPE' | 'PARAM_UNDEFINED' | 'OPERATION_INVALID_FOR_TYPE' | 'OPERATION_MISSING_FIELD' | 'OPERATION_UNKNOWN' | 'EXPR_INVALID_BASE' | 'EXPR_INVALID_CONDITION' | 'EXPR_COND_ELSE_REQUIRED' | 'UNDEFINED_ROUTE_PARAM' | 'ROUTE_NOT_DEFINED' | 'UNDEFINED_IMPORT' | 'IMPORTS_NOT_DEFINED' | 'LAYOUT_MISSING_SLOT' | 'LAYOUT_NOT_FOUND' | 'INVALID_SLOT_NAME' | 'DUPLICATE_SLOT_NAME' | 'DUPLICATE_DEFAULT_SLOT' | 'SLOT_IN_LOOP' | 'INVALID_DATA_SOURCE' | 'UNDEFINED_DATA_SOURCE' | 'DATA_NOT_DEFINED' | 'UNDEFINED_DATA' | 'UNDEFINED_REF' | 'INVALID_STORAGE_OPERATION' | 'INVALID_STORAGE_TYPE' | 'STORAGE_SET_MISSING_VALUE' | 'INVALID_CLIPBOARD_OPERATION' | 'CLIPBOARD_WRITE_MISSING_VALUE' | 'INVALID_NAVIGATE_TARGET';
|
|
420
673
|
/**
|
|
421
674
|
* Custom error class for Constela validation errors
|
|
422
675
|
*/
|
|
@@ -497,6 +750,90 @@ declare function createOperationUnknownError(operation: string, path?: string):
|
|
|
497
750
|
* Creates a cond else required error
|
|
498
751
|
*/
|
|
499
752
|
declare function createCondElseRequiredError(path?: string): ConstelaError;
|
|
753
|
+
/**
|
|
754
|
+
* Creates an undefined route param error
|
|
755
|
+
*/
|
|
756
|
+
declare function createUndefinedRouteParamError(paramName: string, path?: string): ConstelaError;
|
|
757
|
+
/**
|
|
758
|
+
* Creates a route not defined error
|
|
759
|
+
*/
|
|
760
|
+
declare function createRouteNotDefinedError(path?: string): ConstelaError;
|
|
761
|
+
/**
|
|
762
|
+
* Creates an undefined import reference error
|
|
763
|
+
*/
|
|
764
|
+
declare function createUndefinedImportError(importName: string, path?: string): ConstelaError;
|
|
765
|
+
/**
|
|
766
|
+
* Creates an imports not defined error
|
|
767
|
+
*/
|
|
768
|
+
declare function createImportsNotDefinedError(path?: string): ConstelaError;
|
|
769
|
+
/**
|
|
770
|
+
* Creates a layout missing slot error
|
|
771
|
+
*/
|
|
772
|
+
declare function createLayoutMissingSlotError(path?: string): ConstelaError;
|
|
773
|
+
/**
|
|
774
|
+
* Creates a layout not found error
|
|
775
|
+
*/
|
|
776
|
+
declare function createLayoutNotFoundError(layoutName: string, path?: string): ConstelaError;
|
|
777
|
+
/**
|
|
778
|
+
* Creates an invalid slot name error
|
|
779
|
+
*/
|
|
780
|
+
declare function createInvalidSlotNameError(slotName: string, layoutName: string, path?: string): ConstelaError;
|
|
781
|
+
/**
|
|
782
|
+
* Creates a duplicate slot name error
|
|
783
|
+
*/
|
|
784
|
+
declare function createDuplicateSlotNameError(slotName: string, path?: string): ConstelaError;
|
|
785
|
+
/**
|
|
786
|
+
* Creates a duplicate default slot error
|
|
787
|
+
*/
|
|
788
|
+
declare function createDuplicateDefaultSlotError(path?: string): ConstelaError;
|
|
789
|
+
/**
|
|
790
|
+
* Creates a slot in loop error
|
|
791
|
+
*/
|
|
792
|
+
declare function createSlotInLoopError(path?: string): ConstelaError;
|
|
793
|
+
/**
|
|
794
|
+
* Creates an invalid data source error
|
|
795
|
+
*/
|
|
796
|
+
declare function createInvalidDataSourceError(dataName: string, reason: string, path?: string): ConstelaError;
|
|
797
|
+
/**
|
|
798
|
+
* Creates an undefined data source error (for getStaticPaths)
|
|
799
|
+
*/
|
|
800
|
+
declare function createUndefinedDataSourceError(sourceName: string, path?: string): ConstelaError;
|
|
801
|
+
/**
|
|
802
|
+
* Creates a data not defined error (for data or getStaticPaths used without data field)
|
|
803
|
+
*/
|
|
804
|
+
declare function createDataNotDefinedError(path?: string): ConstelaError;
|
|
805
|
+
/**
|
|
806
|
+
* Creates an undefined data error (for DataExpr references)
|
|
807
|
+
*/
|
|
808
|
+
declare function createUndefinedDataError(dataName: string, path?: string): ConstelaError;
|
|
809
|
+
/**
|
|
810
|
+
* Creates an undefined ref error
|
|
811
|
+
*/
|
|
812
|
+
declare function createUndefinedRefError(refName: string, path?: string): ConstelaError;
|
|
813
|
+
/**
|
|
814
|
+
* Creates an invalid storage operation error
|
|
815
|
+
*/
|
|
816
|
+
declare function createInvalidStorageOperationError(operation: string, path?: string): ConstelaError;
|
|
817
|
+
/**
|
|
818
|
+
* Creates an invalid storage type error
|
|
819
|
+
*/
|
|
820
|
+
declare function createInvalidStorageTypeError(storageType: string, path?: string): ConstelaError;
|
|
821
|
+
/**
|
|
822
|
+
* Creates a storage set missing value error
|
|
823
|
+
*/
|
|
824
|
+
declare function createStorageSetMissingValueError(path?: string): ConstelaError;
|
|
825
|
+
/**
|
|
826
|
+
* Creates an invalid clipboard operation error
|
|
827
|
+
*/
|
|
828
|
+
declare function createInvalidClipboardOperationError(operation: string, path?: string): ConstelaError;
|
|
829
|
+
/**
|
|
830
|
+
* Creates a clipboard write missing value error
|
|
831
|
+
*/
|
|
832
|
+
declare function createClipboardWriteMissingValueError(path?: string): ConstelaError;
|
|
833
|
+
/**
|
|
834
|
+
* Creates an invalid navigate target error
|
|
835
|
+
*/
|
|
836
|
+
declare function createInvalidNavigateTargetError(target: string, path?: string): ConstelaError;
|
|
500
837
|
|
|
501
838
|
/**
|
|
502
839
|
* AST Validator for Constela
|
|
@@ -1141,4 +1478,4 @@ declare const astSchema: {
|
|
|
1141
1478
|
};
|
|
1142
1479
|
};
|
|
1143
1480
|
|
|
1144
|
-
export { type ActionDefinition, type ActionStep, BINARY_OPERATORS, type BinExpr, type BinaryOperator, type BooleanField, type CodeNode, type ComponentDef, type ComponentNode, type CondExpr, type ConstelaAst, ConstelaError, type EachNode, type ElementNode, type ErrorCode, type EventHandler, type Expression, type FetchStep, type GetExpr, HTTP_METHODS, type HttpMethod, type IfNode, type ListField, type LitExpr, type MarkdownNode, type NotExpr, type NumberField, type ObjectField, PARAM_TYPES, type ParamDef, type ParamExpr, type ParamType, type Program, type SetStep, type SlotNode, type StateExpr, type StateField, type StringField, type TextNode, UPDATE_OPERATIONS, type UpdateOperation, type UpdateStep, type ValidationFailure, type ValidationResult, type ValidationSuccess, type VarExpr, type ViewNode, astSchema, createComponentCycleError, createComponentNotFoundError, createComponentPropMissingError, createComponentPropTypeError, createCondElseRequiredError, createDuplicateActionError, createOperationInvalidForTypeError, createOperationMissingFieldError, createOperationUnknownError, createSchemaError, createUndefinedActionError, createUndefinedParamError, createUndefinedStateError, createUndefinedVarError, createUnsupportedVersionError, isActionStep, isBinExpr, isBooleanField, isCodeNode, isComponentNode, isCondExpr, isConstelaError, isEachNode, isElementNode, isEventHandler, isExpression, isFetchStep, isGetExpr, isIfNode, isListField, isLitExpr, isMarkdownNode, isNotExpr, isNumberField, isObjectField, isParamExpr, isSetStep, isSlotNode, isStateExpr, isStateField, isStringField, isTextNode, isUpdateStep, isVarExpr, isViewNode, validateAst };
|
|
1481
|
+
export { type ActionDefinition, type ActionStep, BINARY_OPERATORS, type BinExpr, type BinaryOperator, type BooleanField, CLIPBOARD_OPERATIONS, type CallStep, type ClipboardOperation, type ClipboardStep, type CodeNode, type ComponentDef, type ComponentNode, type CondExpr, type ConstelaAst, ConstelaError, type ConstelaProgram, DATA_SOURCE_TYPES, DATA_TRANSFORMS, type DataExpr, type DataSource, type DataSourceType, type DataTransform, type DisposeStep, type EachNode, type ElementNode, type ErrorCode, type EventHandler, type Expression, type FetchStep, type GetExpr, HTTP_METHODS, type HttpMethod, type IfNode, type ImportExpr, type ImportStep, type LayoutProgram, type LifecycleHooks, type ListField, type LitExpr, type MarkdownNode, NAVIGATE_TARGETS, type NavigateStep, type NavigateTarget, type NotExpr, type NumberField, type ObjectField, PARAM_TYPES, type ParamDef, type ParamExpr, type ParamType, type Program, type RefExpr, type RouteDefinition, type RouteExpr, STORAGE_OPERATIONS, STORAGE_TYPES, type SetStep, type SlotNode, type StateExpr, type StateField, type StaticPathsDefinition, type StorageOperation, type StorageStep, type StorageType, type StringField, type SubscribeStep, type TextNode, UPDATE_OPERATIONS, type UpdateOperation, type UpdateStep, type ValidationFailure, type ValidationResult, type ValidationSuccess, type VarExpr, type ViewNode, astSchema, createClipboardWriteMissingValueError, createComponentCycleError, createComponentNotFoundError, createComponentPropMissingError, createComponentPropTypeError, createCondElseRequiredError, createDataNotDefinedError, createDuplicateActionError, createDuplicateDefaultSlotError, createDuplicateSlotNameError, createImportsNotDefinedError, createInvalidClipboardOperationError, createInvalidDataSourceError, createInvalidNavigateTargetError, createInvalidSlotNameError, createInvalidStorageOperationError, createInvalidStorageTypeError, createLayoutMissingSlotError, createLayoutNotFoundError, createOperationInvalidForTypeError, createOperationMissingFieldError, createOperationUnknownError, createRouteNotDefinedError, createSchemaError, createSlotInLoopError, createStorageSetMissingValueError, createUndefinedActionError, createUndefinedDataError, createUndefinedDataSourceError, createUndefinedImportError, createUndefinedParamError, createUndefinedRefError, createUndefinedRouteParamError, createUndefinedStateError, createUndefinedVarError, createUnsupportedVersionError, isActionStep, isBinExpr, isBooleanField, isCallStep, isClipboardStep, isCodeNode, isComponentNode, isCondExpr, isConstelaError, isDataExpr, isDataSource, isDisposeStep, isEachNode, isElementNode, isEventHandler, isExpression, isFetchStep, isGetExpr, isIfNode, isImportExpr, isImportStep, isLayoutProgram, isLifecycleHooks, isListField, isLitExpr, isMarkdownNode, isNamedSlotNode, isNavigateStep, isNotExpr, isNumberField, isObjectField, isParamExpr, isRefExpr, isRouteDefinition, isRouteExpr, isSetStep, isSlotNode, isStateExpr, isStateField, isStaticPathsDefinition, isStorageStep, isStringField, isSubscribeStep, isTextNode, isUpdateStep, isVarExpr, isViewNode, validateAst };
|
package/dist/index.js
CHANGED
|
@@ -26,7 +26,13 @@ var UPDATE_OPERATIONS = [
|
|
|
26
26
|
"splice"
|
|
27
27
|
];
|
|
28
28
|
var HTTP_METHODS = ["GET", "POST", "PUT", "DELETE"];
|
|
29
|
+
var STORAGE_OPERATIONS = ["get", "set", "remove"];
|
|
30
|
+
var STORAGE_TYPES = ["local", "session"];
|
|
31
|
+
var CLIPBOARD_OPERATIONS = ["write", "read"];
|
|
32
|
+
var NAVIGATE_TARGETS = ["_self", "_blank"];
|
|
29
33
|
var PARAM_TYPES = ["string", "number", "boolean", "json"];
|
|
34
|
+
var DATA_TRANSFORMS = ["mdx", "yaml", "csv"];
|
|
35
|
+
var DATA_SOURCE_TYPES = ["glob", "file", "api"];
|
|
30
36
|
|
|
31
37
|
// src/types/guards.ts
|
|
32
38
|
function isObject(value) {
|
|
@@ -84,8 +90,76 @@ function isGetExpr(value) {
|
|
|
84
90
|
if (typeof value["path"] !== "string") return false;
|
|
85
91
|
return true;
|
|
86
92
|
}
|
|
93
|
+
function isRouteExpr(value) {
|
|
94
|
+
if (!isObject(value)) return false;
|
|
95
|
+
if (value["expr"] !== "route") return false;
|
|
96
|
+
if (typeof value["name"] !== "string") return false;
|
|
97
|
+
if ("source" in value && value["source"] !== void 0) {
|
|
98
|
+
const validSources = ["param", "query", "path"];
|
|
99
|
+
if (!validSources.includes(value["source"])) return false;
|
|
100
|
+
}
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
function isImportExpr(value) {
|
|
104
|
+
if (!isObject(value)) return false;
|
|
105
|
+
if (value["expr"] !== "import") return false;
|
|
106
|
+
if (typeof value["name"] !== "string") return false;
|
|
107
|
+
if ("path" in value && value["path"] !== void 0) {
|
|
108
|
+
if (typeof value["path"] !== "string") return false;
|
|
109
|
+
}
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
function isDataExpr(value) {
|
|
113
|
+
if (!isObject(value)) return false;
|
|
114
|
+
if (value["expr"] !== "data") return false;
|
|
115
|
+
if (typeof value["name"] !== "string") return false;
|
|
116
|
+
if ("path" in value && value["path"] !== void 0) {
|
|
117
|
+
if (typeof value["path"] !== "string") return false;
|
|
118
|
+
}
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
function isRefExpr(value) {
|
|
122
|
+
if (!isObject(value)) return false;
|
|
123
|
+
if (value["expr"] !== "ref") return false;
|
|
124
|
+
return typeof value["name"] === "string";
|
|
125
|
+
}
|
|
126
|
+
function isDataSource(value) {
|
|
127
|
+
if (!isObject(value)) return false;
|
|
128
|
+
const type = value["type"];
|
|
129
|
+
if (!DATA_SOURCE_TYPES.includes(type)) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
if ("transform" in value && value["transform"] !== void 0) {
|
|
133
|
+
if (!DATA_TRANSFORMS.includes(value["transform"])) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
switch (type) {
|
|
138
|
+
case "glob":
|
|
139
|
+
if (typeof value["pattern"] !== "string") return false;
|
|
140
|
+
break;
|
|
141
|
+
case "file":
|
|
142
|
+
if (typeof value["path"] !== "string") return false;
|
|
143
|
+
break;
|
|
144
|
+
case "api":
|
|
145
|
+
if (typeof value["url"] !== "string") return false;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
function isStaticPathsDefinition(value) {
|
|
151
|
+
if (!isObject(value)) return false;
|
|
152
|
+
if (typeof value["source"] !== "string") return false;
|
|
153
|
+
if (!("params" in value) || !isObject(value["params"])) return false;
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
function isRouteDefinition(value) {
|
|
157
|
+
if (!isObject(value)) return false;
|
|
158
|
+
if (typeof value["path"] !== "string") return false;
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
87
161
|
function isExpression(value) {
|
|
88
|
-
return isLitExpr(value) || isStateExpr(value) || isVarExpr(value) || isBinExpr(value) || isNotExpr(value) || isParamExpr(value) || isCondExpr(value) || isGetExpr(value);
|
|
162
|
+
return isLitExpr(value) || isStateExpr(value) || isVarExpr(value) || isBinExpr(value) || isNotExpr(value) || isParamExpr(value) || isCondExpr(value) || isGetExpr(value) || isRouteExpr(value) || isImportExpr(value) || isDataExpr(value) || isRefExpr(value);
|
|
89
163
|
}
|
|
90
164
|
function isElementNode(value) {
|
|
91
165
|
if (!isObject(value)) return false;
|
|
@@ -170,8 +244,66 @@ function isFetchStep(value) {
|
|
|
170
244
|
}
|
|
171
245
|
return true;
|
|
172
246
|
}
|
|
247
|
+
function isStorageStep(value) {
|
|
248
|
+
if (!isObject(value)) return false;
|
|
249
|
+
if (value["do"] !== "storage") return false;
|
|
250
|
+
if (!STORAGE_OPERATIONS.includes(value["operation"])) {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
if (!STORAGE_TYPES.includes(value["storage"])) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
if (!("key" in value)) return false;
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
function isClipboardStep(value) {
|
|
260
|
+
if (!isObject(value)) return false;
|
|
261
|
+
if (value["do"] !== "clipboard") return false;
|
|
262
|
+
if (!CLIPBOARD_OPERATIONS.includes(value["operation"])) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
function isNavigateStep(value) {
|
|
268
|
+
if (!isObject(value)) return false;
|
|
269
|
+
if (value["do"] !== "navigate") return false;
|
|
270
|
+
if (!("url" in value)) return false;
|
|
271
|
+
if ("target" in value && value["target"] !== void 0) {
|
|
272
|
+
if (!NAVIGATE_TARGETS.includes(value["target"])) {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
function isImportStep(value) {
|
|
279
|
+
if (!isObject(value)) return false;
|
|
280
|
+
if (value["do"] !== "import") return false;
|
|
281
|
+
if (typeof value["module"] !== "string") return false;
|
|
282
|
+
if (typeof value["result"] !== "string") return false;
|
|
283
|
+
return true;
|
|
284
|
+
}
|
|
285
|
+
function isCallStep(value) {
|
|
286
|
+
if (!isObject(value)) return false;
|
|
287
|
+
if (value["do"] !== "call") return false;
|
|
288
|
+
if (!isObject(value["target"])) return false;
|
|
289
|
+
return true;
|
|
290
|
+
}
|
|
291
|
+
function isSubscribeStep(value) {
|
|
292
|
+
if (!isObject(value)) return false;
|
|
293
|
+
if (value["do"] !== "subscribe") return false;
|
|
294
|
+
if (!isObject(value["target"])) return false;
|
|
295
|
+
if (typeof value["event"] !== "string") return false;
|
|
296
|
+
if (typeof value["action"] !== "string") return false;
|
|
297
|
+
return true;
|
|
298
|
+
}
|
|
299
|
+
function isDisposeStep(value) {
|
|
300
|
+
if (!isObject(value)) return false;
|
|
301
|
+
if (value["do"] !== "dispose") return false;
|
|
302
|
+
if (!isObject(value["target"])) return false;
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
173
305
|
function isActionStep(value) {
|
|
174
|
-
return isSetStep(value) || isUpdateStep(value) || isFetchStep(value);
|
|
306
|
+
return isSetStep(value) || isUpdateStep(value) || isFetchStep(value) || isStorageStep(value) || isClipboardStep(value) || isNavigateStep(value) || isImportStep(value) || isCallStep(value) || isSubscribeStep(value) || isDisposeStep(value);
|
|
175
307
|
}
|
|
176
308
|
function isNumberField(value) {
|
|
177
309
|
if (!isObject(value)) return false;
|
|
@@ -207,6 +339,37 @@ function isEventHandler(value) {
|
|
|
207
339
|
if (!("action" in value) || typeof value["action"] !== "string") return false;
|
|
208
340
|
return true;
|
|
209
341
|
}
|
|
342
|
+
function isLayoutProgram(value) {
|
|
343
|
+
if (!isObject(value)) return false;
|
|
344
|
+
if (value["version"] !== "1.0") return false;
|
|
345
|
+
if (value["type"] !== "layout") return false;
|
|
346
|
+
if (!("view" in value)) return false;
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
function isNamedSlotNode(value) {
|
|
350
|
+
if (!isObject(value)) return false;
|
|
351
|
+
if (value["kind"] !== "slot") return false;
|
|
352
|
+
if (typeof value["name"] !== "string") return false;
|
|
353
|
+
return true;
|
|
354
|
+
}
|
|
355
|
+
function isLifecycleHooks(value) {
|
|
356
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
359
|
+
const obj = value;
|
|
360
|
+
const knownFields = ["onMount", "onUnmount", "onRouteEnter", "onRouteLeave"];
|
|
361
|
+
for (const key of knownFields) {
|
|
362
|
+
if (key in obj && obj[key] !== void 0) {
|
|
363
|
+
if (typeof obj[key] !== "string") return false;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
for (const key of Object.keys(obj)) {
|
|
367
|
+
if (!knownFields.includes(key)) {
|
|
368
|
+
if (typeof obj[key] !== "string") return false;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return true;
|
|
372
|
+
}
|
|
210
373
|
|
|
211
374
|
// src/types/error.ts
|
|
212
375
|
var ConstelaError = class _ConstelaError extends Error {
|
|
@@ -334,6 +497,153 @@ function createCondElseRequiredError(path) {
|
|
|
334
497
|
path
|
|
335
498
|
);
|
|
336
499
|
}
|
|
500
|
+
function createUndefinedRouteParamError(paramName, path) {
|
|
501
|
+
return new ConstelaError(
|
|
502
|
+
"UNDEFINED_ROUTE_PARAM",
|
|
503
|
+
`Undefined route param reference: '${paramName}' is not defined in route path`,
|
|
504
|
+
path
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
function createRouteNotDefinedError(path) {
|
|
508
|
+
return new ConstelaError(
|
|
509
|
+
"ROUTE_NOT_DEFINED",
|
|
510
|
+
`Route expression used but no route is defined in the program`,
|
|
511
|
+
path
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
function createUndefinedImportError(importName, path) {
|
|
515
|
+
return new ConstelaError(
|
|
516
|
+
"UNDEFINED_IMPORT",
|
|
517
|
+
`Undefined import reference: '${importName}' is not defined in imports`,
|
|
518
|
+
path
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
function createImportsNotDefinedError(path) {
|
|
522
|
+
return new ConstelaError(
|
|
523
|
+
"IMPORTS_NOT_DEFINED",
|
|
524
|
+
`Import expression used but no imports are defined in the program`,
|
|
525
|
+
path
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
function createLayoutMissingSlotError(path) {
|
|
529
|
+
return new ConstelaError(
|
|
530
|
+
"LAYOUT_MISSING_SLOT",
|
|
531
|
+
`Layout must contain at least one slot node for page content`,
|
|
532
|
+
path
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
function createLayoutNotFoundError(layoutName, path) {
|
|
536
|
+
return new ConstelaError(
|
|
537
|
+
"LAYOUT_NOT_FOUND",
|
|
538
|
+
`Layout '${layoutName}' is not found`,
|
|
539
|
+
path
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
function createInvalidSlotNameError(slotName, layoutName, path) {
|
|
543
|
+
return new ConstelaError(
|
|
544
|
+
"INVALID_SLOT_NAME",
|
|
545
|
+
`Named slot '${slotName}' does not exist in layout '${layoutName}'`,
|
|
546
|
+
path
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
function createDuplicateSlotNameError(slotName, path) {
|
|
550
|
+
return new ConstelaError(
|
|
551
|
+
"DUPLICATE_SLOT_NAME",
|
|
552
|
+
`Duplicate named slot '${slotName}' found in layout`,
|
|
553
|
+
path
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
function createDuplicateDefaultSlotError(path) {
|
|
557
|
+
return new ConstelaError(
|
|
558
|
+
"DUPLICATE_DEFAULT_SLOT",
|
|
559
|
+
`Layout contains multiple default (unnamed) slots`,
|
|
560
|
+
path
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
function createSlotInLoopError(path) {
|
|
564
|
+
return new ConstelaError(
|
|
565
|
+
"SLOT_IN_LOOP",
|
|
566
|
+
`Slot cannot be placed inside a loop (each node) as it would render multiple times`,
|
|
567
|
+
path
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
function createInvalidDataSourceError(dataName, reason, path) {
|
|
571
|
+
return new ConstelaError(
|
|
572
|
+
"INVALID_DATA_SOURCE",
|
|
573
|
+
`Invalid data source '${dataName}': ${reason}`,
|
|
574
|
+
path
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
function createUndefinedDataSourceError(sourceName, path) {
|
|
578
|
+
return new ConstelaError(
|
|
579
|
+
"UNDEFINED_DATA_SOURCE",
|
|
580
|
+
`Undefined data source reference: '${sourceName}' is not defined in data`,
|
|
581
|
+
path
|
|
582
|
+
);
|
|
583
|
+
}
|
|
584
|
+
function createDataNotDefinedError(path) {
|
|
585
|
+
return new ConstelaError(
|
|
586
|
+
"DATA_NOT_DEFINED",
|
|
587
|
+
`Data expression or getStaticPaths used but no data is defined in the program`,
|
|
588
|
+
path
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
function createUndefinedDataError(dataName, path) {
|
|
592
|
+
return new ConstelaError(
|
|
593
|
+
"UNDEFINED_DATA",
|
|
594
|
+
`Undefined data reference: '${dataName}' is not defined in data`,
|
|
595
|
+
path
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
function createUndefinedRefError(refName, path) {
|
|
599
|
+
return new ConstelaError(
|
|
600
|
+
"UNDEFINED_REF",
|
|
601
|
+
`Undefined ref reference: '${refName}' is not defined in view elements`,
|
|
602
|
+
path
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
function createInvalidStorageOperationError(operation, path) {
|
|
606
|
+
return new ConstelaError(
|
|
607
|
+
"INVALID_STORAGE_OPERATION",
|
|
608
|
+
`Invalid storage operation: '${operation}'. Valid operations are: get, set, remove`,
|
|
609
|
+
path
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
function createInvalidStorageTypeError(storageType, path) {
|
|
613
|
+
return new ConstelaError(
|
|
614
|
+
"INVALID_STORAGE_TYPE",
|
|
615
|
+
`Invalid storage type: '${storageType}'. Valid types are: local, session`,
|
|
616
|
+
path
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
function createStorageSetMissingValueError(path) {
|
|
620
|
+
return new ConstelaError(
|
|
621
|
+
"STORAGE_SET_MISSING_VALUE",
|
|
622
|
+
`Storage 'set' operation requires a 'value' field`,
|
|
623
|
+
path
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
function createInvalidClipboardOperationError(operation, path) {
|
|
627
|
+
return new ConstelaError(
|
|
628
|
+
"INVALID_CLIPBOARD_OPERATION",
|
|
629
|
+
`Invalid clipboard operation: '${operation}'. Valid operations are: write, read`,
|
|
630
|
+
path
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
function createClipboardWriteMissingValueError(path) {
|
|
634
|
+
return new ConstelaError(
|
|
635
|
+
"CLIPBOARD_WRITE_MISSING_VALUE",
|
|
636
|
+
`Clipboard 'write' operation requires a 'value' field`,
|
|
637
|
+
path
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
function createInvalidNavigateTargetError(target, path) {
|
|
641
|
+
return new ConstelaError(
|
|
642
|
+
"INVALID_NAVIGATE_TARGET",
|
|
643
|
+
`Invalid navigate target: '${target}'. Valid targets are: _self, _blank`,
|
|
644
|
+
path
|
|
645
|
+
);
|
|
646
|
+
}
|
|
337
647
|
|
|
338
648
|
// src/schema/validator.ts
|
|
339
649
|
function isObject2(value) {
|
|
@@ -1299,33 +1609,65 @@ var astSchema = {
|
|
|
1299
1609
|
};
|
|
1300
1610
|
export {
|
|
1301
1611
|
BINARY_OPERATORS,
|
|
1612
|
+
CLIPBOARD_OPERATIONS,
|
|
1302
1613
|
ConstelaError,
|
|
1614
|
+
DATA_SOURCE_TYPES,
|
|
1615
|
+
DATA_TRANSFORMS,
|
|
1303
1616
|
HTTP_METHODS,
|
|
1617
|
+
NAVIGATE_TARGETS,
|
|
1304
1618
|
PARAM_TYPES,
|
|
1619
|
+
STORAGE_OPERATIONS,
|
|
1620
|
+
STORAGE_TYPES,
|
|
1305
1621
|
UPDATE_OPERATIONS,
|
|
1306
1622
|
astSchema,
|
|
1623
|
+
createClipboardWriteMissingValueError,
|
|
1307
1624
|
createComponentCycleError,
|
|
1308
1625
|
createComponentNotFoundError,
|
|
1309
1626
|
createComponentPropMissingError,
|
|
1310
1627
|
createComponentPropTypeError,
|
|
1311
1628
|
createCondElseRequiredError,
|
|
1629
|
+
createDataNotDefinedError,
|
|
1312
1630
|
createDuplicateActionError,
|
|
1631
|
+
createDuplicateDefaultSlotError,
|
|
1632
|
+
createDuplicateSlotNameError,
|
|
1633
|
+
createImportsNotDefinedError,
|
|
1634
|
+
createInvalidClipboardOperationError,
|
|
1635
|
+
createInvalidDataSourceError,
|
|
1636
|
+
createInvalidNavigateTargetError,
|
|
1637
|
+
createInvalidSlotNameError,
|
|
1638
|
+
createInvalidStorageOperationError,
|
|
1639
|
+
createInvalidStorageTypeError,
|
|
1640
|
+
createLayoutMissingSlotError,
|
|
1641
|
+
createLayoutNotFoundError,
|
|
1313
1642
|
createOperationInvalidForTypeError,
|
|
1314
1643
|
createOperationMissingFieldError,
|
|
1315
1644
|
createOperationUnknownError,
|
|
1645
|
+
createRouteNotDefinedError,
|
|
1316
1646
|
createSchemaError,
|
|
1647
|
+
createSlotInLoopError,
|
|
1648
|
+
createStorageSetMissingValueError,
|
|
1317
1649
|
createUndefinedActionError,
|
|
1650
|
+
createUndefinedDataError,
|
|
1651
|
+
createUndefinedDataSourceError,
|
|
1652
|
+
createUndefinedImportError,
|
|
1318
1653
|
createUndefinedParamError,
|
|
1654
|
+
createUndefinedRefError,
|
|
1655
|
+
createUndefinedRouteParamError,
|
|
1319
1656
|
createUndefinedStateError,
|
|
1320
1657
|
createUndefinedVarError,
|
|
1321
1658
|
createUnsupportedVersionError,
|
|
1322
1659
|
isActionStep,
|
|
1323
1660
|
isBinExpr,
|
|
1324
1661
|
isBooleanField,
|
|
1662
|
+
isCallStep,
|
|
1663
|
+
isClipboardStep,
|
|
1325
1664
|
isCodeNode,
|
|
1326
1665
|
isComponentNode,
|
|
1327
1666
|
isCondExpr,
|
|
1328
1667
|
isConstelaError,
|
|
1668
|
+
isDataExpr,
|
|
1669
|
+
isDataSource,
|
|
1670
|
+
isDisposeStep,
|
|
1329
1671
|
isEachNode,
|
|
1330
1672
|
isElementNode,
|
|
1331
1673
|
isEventHandler,
|
|
@@ -1333,18 +1675,30 @@ export {
|
|
|
1333
1675
|
isFetchStep,
|
|
1334
1676
|
isGetExpr,
|
|
1335
1677
|
isIfNode,
|
|
1678
|
+
isImportExpr,
|
|
1679
|
+
isImportStep,
|
|
1680
|
+
isLayoutProgram,
|
|
1681
|
+
isLifecycleHooks,
|
|
1336
1682
|
isListField,
|
|
1337
1683
|
isLitExpr,
|
|
1338
1684
|
isMarkdownNode,
|
|
1685
|
+
isNamedSlotNode,
|
|
1686
|
+
isNavigateStep,
|
|
1339
1687
|
isNotExpr,
|
|
1340
1688
|
isNumberField,
|
|
1341
1689
|
isObjectField,
|
|
1342
1690
|
isParamExpr,
|
|
1691
|
+
isRefExpr,
|
|
1692
|
+
isRouteDefinition,
|
|
1693
|
+
isRouteExpr,
|
|
1343
1694
|
isSetStep,
|
|
1344
1695
|
isSlotNode,
|
|
1345
1696
|
isStateExpr,
|
|
1346
1697
|
isStateField,
|
|
1698
|
+
isStaticPathsDefinition,
|
|
1699
|
+
isStorageStep,
|
|
1347
1700
|
isStringField,
|
|
1701
|
+
isSubscribeStep,
|
|
1348
1702
|
isTextNode,
|
|
1349
1703
|
isUpdateStep,
|
|
1350
1704
|
isVarExpr,
|