@player-tools/xlr-sdk 0.13.0-next.3 → 0.13.0-next.5
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/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.legacy-esm.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/__tests__/__snapshots__/sdk.test.ts.snap +1342 -66
- package/src/__tests__/sdk.test.ts +19 -2
- package/src/sdk.ts +1 -1
- package/src/__tests__/utils.test.ts +0 -0
|
@@ -331,6 +331,7 @@ export type Navigation = {
|
|
|
331
331
|
attributes?: {
|
|
332
332
|
[key: string]: any;
|
|
333
333
|
};
|
|
334
|
+
[key: string]: unknown;
|
|
334
335
|
} | {
|
|
335
336
|
/** Add comments that will not be processing, but are useful for code explanation */
|
|
336
337
|
_comment?: string;
|
|
@@ -352,6 +353,7 @@ export type Navigation = {
|
|
|
352
353
|
* If this is a flow started from another flow, the outcome determines the flow transition
|
|
353
354
|
*/
|
|
354
355
|
outcome: string;
|
|
356
|
+
[key: string]: unknown;
|
|
355
357
|
} | {
|
|
356
358
|
/** Add comments that will not be processing, but are useful for code explanation */
|
|
357
359
|
_comment?: string;
|
|
@@ -394,6 +396,30 @@ export type Navigation = {
|
|
|
394
396
|
exp: Expression;
|
|
395
397
|
/** A mapping of transition-name to FlowState name */
|
|
396
398
|
transitions: Record<string, string>;
|
|
399
|
+
} | {
|
|
400
|
+
/** Add comments that will not be processing, but are useful for code explanation */
|
|
401
|
+
_comment?: string;
|
|
402
|
+
/** A property to determine the type of state this is */
|
|
403
|
+
state_type: 'ASYNC_ACTION';
|
|
404
|
+
/** An optional expression to run when this view renders */
|
|
405
|
+
onStart?: Expression | {
|
|
406
|
+
/** The expression to run */
|
|
407
|
+
exp?: Expression;
|
|
408
|
+
};
|
|
409
|
+
/** An optional expression to run before view transition */
|
|
410
|
+
onEnd?: Expression | {
|
|
411
|
+
/** The expression to run */
|
|
412
|
+
exp?: Expression;
|
|
413
|
+
};
|
|
414
|
+
/**
|
|
415
|
+
* An expression to execute.
|
|
416
|
+
* The return value determines the transition to take
|
|
417
|
+
*/
|
|
418
|
+
exp: Expression;
|
|
419
|
+
/** A mapping of transition-name to FlowState name */
|
|
420
|
+
transitions: Record<string, string>;
|
|
421
|
+
/** Whether the expression(s) should be awaited before transitioning */
|
|
422
|
+
await: boolean;
|
|
397
423
|
} | {
|
|
398
424
|
/** Add comments that will not be processing, but are useful for code explanation */
|
|
399
425
|
_comment?: string;
|
|
@@ -414,6 +440,7 @@ export type Navigation = {
|
|
|
414
440
|
transitions: Record<string, string>;
|
|
415
441
|
/** A reference for this external state */
|
|
416
442
|
ref: string;
|
|
443
|
+
[key: string]: unknown;
|
|
417
444
|
});
|
|
418
445
|
}>;
|
|
419
446
|
/** An object with an expression in it */
|
|
@@ -462,6 +489,7 @@ export interface NavigationFlow {
|
|
|
462
489
|
attributes?: {
|
|
463
490
|
[key: string]: any;
|
|
464
491
|
};
|
|
492
|
+
[key: string]: unknown;
|
|
465
493
|
} | {
|
|
466
494
|
/** Add comments that will not be processing, but are useful for code explanation */
|
|
467
495
|
_comment?: string;
|
|
@@ -483,6 +511,7 @@ export interface NavigationFlow {
|
|
|
483
511
|
* If this is a flow started from another flow, the outcome determines the flow transition
|
|
484
512
|
*/
|
|
485
513
|
outcome: string;
|
|
514
|
+
[key: string]: unknown;
|
|
486
515
|
} | {
|
|
487
516
|
/** Add comments that will not be processing, but are useful for code explanation */
|
|
488
517
|
_comment?: string;
|
|
@@ -525,6 +554,30 @@ export interface NavigationFlow {
|
|
|
525
554
|
exp: Expression;
|
|
526
555
|
/** A mapping of transition-name to FlowState name */
|
|
527
556
|
transitions: Record<string, string>;
|
|
557
|
+
} | {
|
|
558
|
+
/** Add comments that will not be processing, but are useful for code explanation */
|
|
559
|
+
_comment?: string;
|
|
560
|
+
/** A property to determine the type of state this is */
|
|
561
|
+
state_type: 'ASYNC_ACTION';
|
|
562
|
+
/** An optional expression to run when this view renders */
|
|
563
|
+
onStart?: Expression | {
|
|
564
|
+
/** The expression to run */
|
|
565
|
+
exp?: Expression;
|
|
566
|
+
};
|
|
567
|
+
/** An optional expression to run before view transition */
|
|
568
|
+
onEnd?: Expression | {
|
|
569
|
+
/** The expression to run */
|
|
570
|
+
exp?: Expression;
|
|
571
|
+
};
|
|
572
|
+
/**
|
|
573
|
+
* An expression to execute.
|
|
574
|
+
* The return value determines the transition to take
|
|
575
|
+
*/
|
|
576
|
+
exp: Expression;
|
|
577
|
+
/** A mapping of transition-name to FlowState name */
|
|
578
|
+
transitions: Record<string, string>;
|
|
579
|
+
/** Whether the expression(s) should be awaited before transitioning */
|
|
580
|
+
await: boolean;
|
|
528
581
|
} | {
|
|
529
582
|
/** Add comments that will not be processing, but are useful for code explanation */
|
|
530
583
|
_comment?: string;
|
|
@@ -545,6 +598,7 @@ export interface NavigationFlow {
|
|
|
545
598
|
transitions: Record<string, string>;
|
|
546
599
|
/** A reference for this external state */
|
|
547
600
|
ref: string;
|
|
601
|
+
[key: string]: unknown;
|
|
548
602
|
});
|
|
549
603
|
}
|
|
550
604
|
export type NavigationFlowTransition = Record<string, string>;
|
|
@@ -568,7 +622,7 @@ export interface NavigationBaseState<T extends string = any> {
|
|
|
568
622
|
* TS gets really confused with both the ActionState and the onStart state both declaring the \`exp\` property
|
|
569
623
|
* So this explicity says there should never be an exp prop on a state node that's not of type 'ACTION'
|
|
570
624
|
*/
|
|
571
|
-
exp?: T extends 'ACTION' ? Expression : never;
|
|
625
|
+
exp?: T extends 'ACTION' | 'ASYNC_ACTION' ? Expression : never;
|
|
572
626
|
}
|
|
573
627
|
/** A generic state that can transition to another state */
|
|
574
628
|
export interface NavigationFlowTransitionableState<T extends string = any> {
|
|
@@ -590,7 +644,7 @@ export interface NavigationFlowTransitionableState<T extends string = any> {
|
|
|
590
644
|
* TS gets really confused with both the ActionState and the onStart state both declaring the \`exp\` property
|
|
591
645
|
* So this explicity says there should never be an exp prop on a state node that's not of type 'ACTION'
|
|
592
646
|
*/
|
|
593
|
-
exp?: T extends 'ACTION' ? Expression : never;
|
|
647
|
+
exp?: T extends 'ACTION' | 'ASYNC_ACTION' ? Expression : never;
|
|
594
648
|
/** A mapping of transition-name to FlowState name */
|
|
595
649
|
transitions: Record<string, string>;
|
|
596
650
|
}
|
|
@@ -619,6 +673,7 @@ export interface NavigationFlowViewState {
|
|
|
619
673
|
attributes?: {
|
|
620
674
|
[key: string]: any;
|
|
621
675
|
};
|
|
676
|
+
[key: string]: unknown;
|
|
622
677
|
}
|
|
623
678
|
/** An END state of the flow. */
|
|
624
679
|
export interface NavigationFlowEndState {
|
|
@@ -642,6 +697,7 @@ export interface NavigationFlowEndState {
|
|
|
642
697
|
* If this is a flow started from another flow, the outcome determines the flow transition
|
|
643
698
|
*/
|
|
644
699
|
outcome: string;
|
|
700
|
+
[key: string]: unknown;
|
|
645
701
|
}
|
|
646
702
|
/** Action states execute an expression to determine the next state to transition to */
|
|
647
703
|
export interface NavigationFlowActionState {
|
|
@@ -667,6 +723,32 @@ export interface NavigationFlowActionState {
|
|
|
667
723
|
/** A mapping of transition-name to FlowState name */
|
|
668
724
|
transitions: Record<string, string>;
|
|
669
725
|
}
|
|
726
|
+
/** Action states execute an expression to determine the next state to transition to */
|
|
727
|
+
export interface NavigationFlowAsyncActionState {
|
|
728
|
+
/** Add comments that will not be processing, but are useful for code explanation */
|
|
729
|
+
_comment?: string;
|
|
730
|
+
/** A property to determine the type of state this is */
|
|
731
|
+
state_type: 'ASYNC_ACTION';
|
|
732
|
+
/** An optional expression to run when this view renders */
|
|
733
|
+
onStart?: Expression | {
|
|
734
|
+
/** The expression to run */
|
|
735
|
+
exp?: Expression;
|
|
736
|
+
};
|
|
737
|
+
/** An optional expression to run before view transition */
|
|
738
|
+
onEnd?: Expression | {
|
|
739
|
+
/** The expression to run */
|
|
740
|
+
exp?: Expression;
|
|
741
|
+
};
|
|
742
|
+
/**
|
|
743
|
+
* An expression to execute.
|
|
744
|
+
* The return value determines the transition to take
|
|
745
|
+
*/
|
|
746
|
+
exp: Expression;
|
|
747
|
+
/** A mapping of transition-name to FlowState name */
|
|
748
|
+
transitions: Record<string, string>;
|
|
749
|
+
/** Whether the expression(s) should be awaited before transitioning */
|
|
750
|
+
await: boolean;
|
|
751
|
+
}
|
|
670
752
|
/**
|
|
671
753
|
* External Flow states represent states in the FSM that can't be resolved internally in Player.
|
|
672
754
|
* The flow will wait for the embedded application to manage moving to the next state via a transition
|
|
@@ -691,6 +773,7 @@ export interface NavigationFlowExternalState {
|
|
|
691
773
|
transitions: Record<string, string>;
|
|
692
774
|
/** A reference for this external state */
|
|
693
775
|
ref: string;
|
|
776
|
+
[key: string]: unknown;
|
|
694
777
|
}
|
|
695
778
|
export interface NavigationFlowFlowState {
|
|
696
779
|
/** Add comments that will not be processing, but are useful for code explanation */
|
|
@@ -737,6 +820,7 @@ export type NavigationFlowState = {
|
|
|
737
820
|
attributes?: {
|
|
738
821
|
[key: string]: any;
|
|
739
822
|
};
|
|
823
|
+
[key: string]: unknown;
|
|
740
824
|
} | {
|
|
741
825
|
/** Add comments that will not be processing, but are useful for code explanation */
|
|
742
826
|
_comment?: string;
|
|
@@ -758,6 +842,7 @@ export type NavigationFlowState = {
|
|
|
758
842
|
* If this is a flow started from another flow, the outcome determines the flow transition
|
|
759
843
|
*/
|
|
760
844
|
outcome: string;
|
|
845
|
+
[key: string]: unknown;
|
|
761
846
|
} | {
|
|
762
847
|
/** Add comments that will not be processing, but are useful for code explanation */
|
|
763
848
|
_comment?: string;
|
|
@@ -800,6 +885,30 @@ export type NavigationFlowState = {
|
|
|
800
885
|
exp: Expression;
|
|
801
886
|
/** A mapping of transition-name to FlowState name */
|
|
802
887
|
transitions: Record<string, string>;
|
|
888
|
+
} | {
|
|
889
|
+
/** Add comments that will not be processing, but are useful for code explanation */
|
|
890
|
+
_comment?: string;
|
|
891
|
+
/** A property to determine the type of state this is */
|
|
892
|
+
state_type: 'ASYNC_ACTION';
|
|
893
|
+
/** An optional expression to run when this view renders */
|
|
894
|
+
onStart?: Expression | {
|
|
895
|
+
/** The expression to run */
|
|
896
|
+
exp?: Expression;
|
|
897
|
+
};
|
|
898
|
+
/** An optional expression to run before view transition */
|
|
899
|
+
onEnd?: Expression | {
|
|
900
|
+
/** The expression to run */
|
|
901
|
+
exp?: Expression;
|
|
902
|
+
};
|
|
903
|
+
/**
|
|
904
|
+
* An expression to execute.
|
|
905
|
+
* The return value determines the transition to take
|
|
906
|
+
*/
|
|
907
|
+
exp: Expression;
|
|
908
|
+
/** A mapping of transition-name to FlowState name */
|
|
909
|
+
transitions: Record<string, string>;
|
|
910
|
+
/** Whether the expression(s) should be awaited before transitioning */
|
|
911
|
+
await: boolean;
|
|
803
912
|
} | {
|
|
804
913
|
/** Add comments that will not be processing, but are useful for code explanation */
|
|
805
914
|
_comment?: string;
|
|
@@ -820,6 +929,7 @@ export type NavigationFlowState = {
|
|
|
820
929
|
transitions: Record<string, string>;
|
|
821
930
|
/** A reference for this external state */
|
|
822
931
|
ref: string;
|
|
932
|
+
[key: string]: unknown;
|
|
823
933
|
};
|
|
824
934
|
/** The data at the end of a flow */
|
|
825
935
|
export interface FlowResult {
|
|
@@ -845,6 +955,7 @@ export interface FlowResult {
|
|
|
845
955
|
* If this is a flow started from another flow, the outcome determines the flow transition
|
|
846
956
|
*/
|
|
847
957
|
outcome: string;
|
|
958
|
+
[key: string]: unknown;
|
|
848
959
|
};
|
|
849
960
|
/** The serialized data-model */
|
|
850
961
|
data?: any;
|
|
@@ -867,6 +978,8 @@ export interface Templatable {
|
|
|
867
978
|
* If it already exists, values are appended to the end.
|
|
868
979
|
*/
|
|
869
980
|
output: Key;
|
|
981
|
+
/** Specifies the template placement in relation to existing elements */
|
|
982
|
+
placement?: 'prepend' | 'append';
|
|
870
983
|
}>;
|
|
871
984
|
}
|
|
872
985
|
/** A template describes a mapping from a data array -> array of objects */
|
|
@@ -885,6 +998,8 @@ export interface Template<ValueType extends any = unknown, Key extends string =
|
|
|
885
998
|
* If it already exists, values are appended to the end.
|
|
886
999
|
*/
|
|
887
1000
|
output: Key;
|
|
1001
|
+
/** Specifies the template placement in relation to existing elements */
|
|
1002
|
+
placement?: 'prepend' | 'append';
|
|
888
1003
|
}
|
|
889
1004
|
export type View<T extends Asset = Asset> = unknown extends Asset ? T & {
|
|
890
1005
|
/** Each view can optionally supply a list of validations to run against a particular view */
|
|
@@ -904,6 +1019,12 @@ export type View<T extends Asset = Asset> = unknown extends Asset ? T & {
|
|
|
904
1019
|
dataTarget?: never;
|
|
905
1020
|
/** Where the error should be displayed */
|
|
906
1021
|
displayTarget?: 'page' | 'section' | 'field';
|
|
1022
|
+
/**
|
|
1023
|
+
* If the validation blocks navigation
|
|
1024
|
+
* true/false - always/never block navigation
|
|
1025
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1026
|
+
*/
|
|
1027
|
+
blocking?: boolean | 'once';
|
|
907
1028
|
/** The binding to associate this validation with */
|
|
908
1029
|
ref?: Binding;
|
|
909
1030
|
[key: string]: unknown;
|
|
@@ -932,6 +1053,12 @@ export interface Flow<T extends Asset = Asset> {
|
|
|
932
1053
|
dataTarget?: never;
|
|
933
1054
|
/** Where the error should be displayed */
|
|
934
1055
|
displayTarget?: 'page' | 'section' | 'field';
|
|
1056
|
+
/**
|
|
1057
|
+
* If the validation blocks navigation
|
|
1058
|
+
* true/false - always/never block navigation
|
|
1059
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1060
|
+
*/
|
|
1061
|
+
blocking?: boolean | 'once';
|
|
935
1062
|
/** The binding to associate this validation with */
|
|
936
1063
|
ref?: Binding;
|
|
937
1064
|
[key: string]: unknown;
|
|
@@ -947,8 +1074,6 @@ export interface Flow<T extends Asset = Asset> {
|
|
|
947
1074
|
[key: string]: {
|
|
948
1075
|
/** The reference of the base type to use */
|
|
949
1076
|
type: string;
|
|
950
|
-
/** The referenced object represents an array rather than an object */
|
|
951
|
-
isArray?: boolean;
|
|
952
1077
|
/**
|
|
953
1078
|
* Any additional validations that are associated with this property
|
|
954
1079
|
* These will add to any base validations associated with the "type"
|
|
@@ -973,6 +1098,116 @@ export interface Flow<T extends Asset = Asset> {
|
|
|
973
1098
|
dataTarget?: 'formatted' | 'deformatted';
|
|
974
1099
|
/** Where the error should be displayed */
|
|
975
1100
|
displayTarget?: 'page' | 'section' | 'field';
|
|
1101
|
+
/**
|
|
1102
|
+
* If the validation blocks navigation
|
|
1103
|
+
* true/false - always/never block navigation
|
|
1104
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1105
|
+
*/
|
|
1106
|
+
blocking?: boolean | 'once';
|
|
1107
|
+
[key: string]: unknown;
|
|
1108
|
+
}>;
|
|
1109
|
+
/**
|
|
1110
|
+
* A reference to a specific data format to use.
|
|
1111
|
+
* If none is specified, will fallback to that of the base type
|
|
1112
|
+
*/
|
|
1113
|
+
format?: {
|
|
1114
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
1115
|
+
type: string;
|
|
1116
|
+
[key: string]: unknown;
|
|
1117
|
+
};
|
|
1118
|
+
/**
|
|
1119
|
+
* A default value for this property.
|
|
1120
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
1121
|
+
*/
|
|
1122
|
+
default?: T;
|
|
1123
|
+
[key: string]: unknown;
|
|
1124
|
+
} | {
|
|
1125
|
+
/** The reference of the base type to use */
|
|
1126
|
+
type: string;
|
|
1127
|
+
/**
|
|
1128
|
+
* Any additional validations that are associated with this property
|
|
1129
|
+
* These will add to any base validations associated with the "type"
|
|
1130
|
+
*/
|
|
1131
|
+
validation?: Array<{
|
|
1132
|
+
/**
|
|
1133
|
+
* The name of the referenced validation type
|
|
1134
|
+
* This will be used to lookup the proper handler
|
|
1135
|
+
*/
|
|
1136
|
+
type: string;
|
|
1137
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
1138
|
+
message?: string;
|
|
1139
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
1140
|
+
severity?: 'error' | 'warning';
|
|
1141
|
+
/** When to run this particular validation */
|
|
1142
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
1143
|
+
/**
|
|
1144
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
1145
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
1146
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
1147
|
+
*/
|
|
1148
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
1149
|
+
/** Where the error should be displayed */
|
|
1150
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
1151
|
+
/**
|
|
1152
|
+
* If the validation blocks navigation
|
|
1153
|
+
* true/false - always/never block navigation
|
|
1154
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1155
|
+
*/
|
|
1156
|
+
blocking?: boolean | 'once';
|
|
1157
|
+
[key: string]: unknown;
|
|
1158
|
+
}>;
|
|
1159
|
+
/**
|
|
1160
|
+
* A reference to a specific data format to use.
|
|
1161
|
+
* If none is specified, will fallback to that of the base type
|
|
1162
|
+
*/
|
|
1163
|
+
format?: {
|
|
1164
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
1165
|
+
type: string;
|
|
1166
|
+
[key: string]: unknown;
|
|
1167
|
+
};
|
|
1168
|
+
/**
|
|
1169
|
+
* A default value for this property.
|
|
1170
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
1171
|
+
*/
|
|
1172
|
+
default?: T;
|
|
1173
|
+
/** boolean to define if its a record */
|
|
1174
|
+
isRecord: boolean;
|
|
1175
|
+
/** This property is mutually exclusive with RecordType and can not be used with ArrayType */
|
|
1176
|
+
isArray?: never;
|
|
1177
|
+
[key: string]: unknown;
|
|
1178
|
+
} | {
|
|
1179
|
+
/** The reference of the base type to use */
|
|
1180
|
+
type: string;
|
|
1181
|
+
/**
|
|
1182
|
+
* Any additional validations that are associated with this property
|
|
1183
|
+
* These will add to any base validations associated with the "type"
|
|
1184
|
+
*/
|
|
1185
|
+
validation?: Array<{
|
|
1186
|
+
/**
|
|
1187
|
+
* The name of the referenced validation type
|
|
1188
|
+
* This will be used to lookup the proper handler
|
|
1189
|
+
*/
|
|
1190
|
+
type: string;
|
|
1191
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
1192
|
+
message?: string;
|
|
1193
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
1194
|
+
severity?: 'error' | 'warning';
|
|
1195
|
+
/** When to run this particular validation */
|
|
1196
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
1197
|
+
/**
|
|
1198
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
1199
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
1200
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
1201
|
+
*/
|
|
1202
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
1203
|
+
/** Where the error should be displayed */
|
|
1204
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
1205
|
+
/**
|
|
1206
|
+
* If the validation blocks navigation
|
|
1207
|
+
* true/false - always/never block navigation
|
|
1208
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1209
|
+
*/
|
|
1210
|
+
blocking?: boolean | 'once';
|
|
976
1211
|
[key: string]: unknown;
|
|
977
1212
|
}>;
|
|
978
1213
|
/**
|
|
@@ -989,6 +1224,10 @@ export interface Flow<T extends Asset = Asset> {
|
|
|
989
1224
|
* Any reads for this property will result in this default value being written to the model.
|
|
990
1225
|
*/
|
|
991
1226
|
default?: T;
|
|
1227
|
+
/** boolean to define if its an array */
|
|
1228
|
+
isArray: boolean;
|
|
1229
|
+
/** This property is mutually exclusive with ArrayType and can not be used with RecordType */
|
|
1230
|
+
isRecord?: never;
|
|
992
1231
|
[key: string]: unknown;
|
|
993
1232
|
};
|
|
994
1233
|
};
|
|
@@ -996,8 +1235,6 @@ export interface Flow<T extends Asset = Asset> {
|
|
|
996
1235
|
[key: string]: {
|
|
997
1236
|
/** The reference of the base type to use */
|
|
998
1237
|
type: string;
|
|
999
|
-
/** The referenced object represents an array rather than an object */
|
|
1000
|
-
isArray?: boolean;
|
|
1001
1238
|
/**
|
|
1002
1239
|
* Any additional validations that are associated with this property
|
|
1003
1240
|
* These will add to any base validations associated with the "type"
|
|
@@ -1022,6 +1259,12 @@ export interface Flow<T extends Asset = Asset> {
|
|
|
1022
1259
|
dataTarget?: 'formatted' | 'deformatted';
|
|
1023
1260
|
/** Where the error should be displayed */
|
|
1024
1261
|
displayTarget?: 'page' | 'section' | 'field';
|
|
1262
|
+
/**
|
|
1263
|
+
* If the validation blocks navigation
|
|
1264
|
+
* true/false - always/never block navigation
|
|
1265
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1266
|
+
*/
|
|
1267
|
+
blocking?: boolean | 'once';
|
|
1025
1268
|
[key: string]: unknown;
|
|
1026
1269
|
}>;
|
|
1027
1270
|
/**
|
|
@@ -1039,66 +1282,175 @@ export interface Flow<T extends Asset = Asset> {
|
|
|
1039
1282
|
*/
|
|
1040
1283
|
default?: T;
|
|
1041
1284
|
[key: string]: unknown;
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1285
|
+
} | {
|
|
1286
|
+
/** The reference of the base type to use */
|
|
1287
|
+
type: string;
|
|
1288
|
+
/**
|
|
1289
|
+
* Any additional validations that are associated with this property
|
|
1290
|
+
* These will add to any base validations associated with the "type"
|
|
1291
|
+
*/
|
|
1292
|
+
validation?: Array<{
|
|
1293
|
+
/**
|
|
1294
|
+
* The name of the referenced validation type
|
|
1295
|
+
* This will be used to lookup the proper handler
|
|
1296
|
+
*/
|
|
1297
|
+
type: string;
|
|
1298
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
1299
|
+
message?: string;
|
|
1300
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
1301
|
+
severity?: 'error' | 'warning';
|
|
1302
|
+
/** When to run this particular validation */
|
|
1303
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
1304
|
+
/**
|
|
1305
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
1306
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
1307
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
1308
|
+
*/
|
|
1309
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
1310
|
+
/** Where the error should be displayed */
|
|
1311
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
1312
|
+
/**
|
|
1313
|
+
* If the validation blocks navigation
|
|
1314
|
+
* true/false - always/never block navigation
|
|
1315
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1316
|
+
*/
|
|
1317
|
+
blocking?: boolean | 'once';
|
|
1318
|
+
[key: string]: unknown;
|
|
1319
|
+
}>;
|
|
1320
|
+
/**
|
|
1321
|
+
* A reference to a specific data format to use.
|
|
1322
|
+
* If none is specified, will fallback to that of the base type
|
|
1323
|
+
*/
|
|
1324
|
+
format?: {
|
|
1325
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
1326
|
+
type: string;
|
|
1327
|
+
[key: string]: unknown;
|
|
1328
|
+
};
|
|
1329
|
+
/**
|
|
1330
|
+
* A default value for this property.
|
|
1331
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
1332
|
+
*/
|
|
1333
|
+
default?: T;
|
|
1334
|
+
/** boolean to define if its a record */
|
|
1335
|
+
isRecord: boolean;
|
|
1336
|
+
/** This property is mutually exclusive with RecordType and can not be used with ArrayType */
|
|
1337
|
+
isArray?: never;
|
|
1338
|
+
[key: string]: unknown;
|
|
1339
|
+
} | {
|
|
1340
|
+
/** The reference of the base type to use */
|
|
1341
|
+
type: string;
|
|
1342
|
+
/**
|
|
1343
|
+
* Any additional validations that are associated with this property
|
|
1344
|
+
* These will add to any base validations associated with the "type"
|
|
1345
|
+
*/
|
|
1346
|
+
validation?: Array<{
|
|
1347
|
+
/**
|
|
1348
|
+
* The name of the referenced validation type
|
|
1349
|
+
* This will be used to lookup the proper handler
|
|
1350
|
+
*/
|
|
1351
|
+
type: string;
|
|
1352
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
1353
|
+
message?: string;
|
|
1354
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
1355
|
+
severity?: 'error' | 'warning';
|
|
1356
|
+
/** When to run this particular validation */
|
|
1357
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
1358
|
+
/**
|
|
1359
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
1360
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
1361
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
1362
|
+
*/
|
|
1363
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
1364
|
+
/** Where the error should be displayed */
|
|
1365
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
1366
|
+
/**
|
|
1367
|
+
* If the validation blocks navigation
|
|
1368
|
+
* true/false - always/never block navigation
|
|
1369
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1370
|
+
*/
|
|
1371
|
+
blocking?: boolean | 'once';
|
|
1372
|
+
[key: string]: unknown;
|
|
1373
|
+
}>;
|
|
1374
|
+
/**
|
|
1375
|
+
* A reference to a specific data format to use.
|
|
1376
|
+
* If none is specified, will fallback to that of the base type
|
|
1377
|
+
*/
|
|
1378
|
+
format?: {
|
|
1379
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
1380
|
+
type: string;
|
|
1381
|
+
[key: string]: unknown;
|
|
1382
|
+
};
|
|
1383
|
+
/**
|
|
1384
|
+
* A default value for this property.
|
|
1385
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
1386
|
+
*/
|
|
1387
|
+
default?: T;
|
|
1388
|
+
/** boolean to define if its an array */
|
|
1389
|
+
isArray: boolean;
|
|
1390
|
+
/** This property is mutually exclusive with ArrayType and can not be used with RecordType */
|
|
1391
|
+
isRecord?: never;
|
|
1392
|
+
[key: string]: unknown;
|
|
1393
|
+
};
|
|
1394
|
+
};
|
|
1395
|
+
};
|
|
1396
|
+
/** Any initial data that the flow can use */
|
|
1397
|
+
data?: Record<any, unknown>;
|
|
1398
|
+
/** A state machine to drive a user through the experience */
|
|
1399
|
+
navigation: {
|
|
1400
|
+
/** The name of the Flow to begin on */
|
|
1401
|
+
BEGIN: string;
|
|
1402
|
+
} & Record<string, string | {
|
|
1403
|
+
/** The first state to kick off the state machine */
|
|
1404
|
+
startState: string;
|
|
1405
|
+
/** An optional expression to run when this Flow starts */
|
|
1406
|
+
onStart?: Expression | {
|
|
1407
|
+
/** The expression to run */
|
|
1408
|
+
exp?: Expression;
|
|
1409
|
+
};
|
|
1410
|
+
/** An optional expression to run when this Flow ends */
|
|
1411
|
+
onEnd?: Expression | {
|
|
1412
|
+
/** The expression to run */
|
|
1413
|
+
exp?: Expression;
|
|
1414
|
+
};
|
|
1415
|
+
[key: string]: undefined | string | Expression | {
|
|
1416
|
+
/** The expression to run */
|
|
1417
|
+
exp?: Expression;
|
|
1418
|
+
} | ({
|
|
1419
|
+
/** Add comments that will not be processing, but are useful for code explanation */
|
|
1420
|
+
_comment?: string;
|
|
1421
|
+
/** A property to determine the type of state this is */
|
|
1422
|
+
state_type: 'VIEW';
|
|
1423
|
+
/** An optional expression to run when this view renders */
|
|
1424
|
+
onStart?: Expression | {
|
|
1425
|
+
/** The expression to run */
|
|
1426
|
+
exp?: Expression;
|
|
1427
|
+
};
|
|
1428
|
+
/** An optional expression to run before view transition */
|
|
1429
|
+
onEnd?: Expression | {
|
|
1430
|
+
/** The expression to run */
|
|
1431
|
+
exp?: Expression;
|
|
1432
|
+
};
|
|
1433
|
+
exp?: never;
|
|
1434
|
+
/** A mapping of transition-name to FlowState name */
|
|
1435
|
+
transitions: Record<string, string>;
|
|
1436
|
+
/** An id corresponding to a view from the 'views' array */
|
|
1437
|
+
ref: string;
|
|
1438
|
+
/** View meta-properties */
|
|
1439
|
+
attributes?: {
|
|
1440
|
+
[key: string]: any;
|
|
1441
|
+
};
|
|
1442
|
+
[key: string]: unknown;
|
|
1443
|
+
} | {
|
|
1444
|
+
/** Add comments that will not be processing, but are useful for code explanation */
|
|
1445
|
+
_comment?: string;
|
|
1446
|
+
/** A property to determine the type of state this is */
|
|
1447
|
+
state_type: 'END';
|
|
1448
|
+
/** An optional expression to run when this view renders */
|
|
1449
|
+
onStart?: Expression | {
|
|
1450
|
+
/** The expression to run */
|
|
1451
|
+
exp?: Expression;
|
|
1452
|
+
};
|
|
1453
|
+
/** An optional expression to run before view transition */
|
|
1102
1454
|
onEnd?: Expression | {
|
|
1103
1455
|
/** The expression to run */
|
|
1104
1456
|
exp?: Expression;
|
|
@@ -1109,6 +1461,7 @@ export interface Flow<T extends Asset = Asset> {
|
|
|
1109
1461
|
* If this is a flow started from another flow, the outcome determines the flow transition
|
|
1110
1462
|
*/
|
|
1111
1463
|
outcome: string;
|
|
1464
|
+
[key: string]: unknown;
|
|
1112
1465
|
} | {
|
|
1113
1466
|
/** Add comments that will not be processing, but are useful for code explanation */
|
|
1114
1467
|
_comment?: string;
|
|
@@ -1151,6 +1504,30 @@ export interface Flow<T extends Asset = Asset> {
|
|
|
1151
1504
|
exp: Expression;
|
|
1152
1505
|
/** A mapping of transition-name to FlowState name */
|
|
1153
1506
|
transitions: Record<string, string>;
|
|
1507
|
+
} | {
|
|
1508
|
+
/** Add comments that will not be processing, but are useful for code explanation */
|
|
1509
|
+
_comment?: string;
|
|
1510
|
+
/** A property to determine the type of state this is */
|
|
1511
|
+
state_type: 'ASYNC_ACTION';
|
|
1512
|
+
/** An optional expression to run when this view renders */
|
|
1513
|
+
onStart?: Expression | {
|
|
1514
|
+
/** The expression to run */
|
|
1515
|
+
exp?: Expression;
|
|
1516
|
+
};
|
|
1517
|
+
/** An optional expression to run before view transition */
|
|
1518
|
+
onEnd?: Expression | {
|
|
1519
|
+
/** The expression to run */
|
|
1520
|
+
exp?: Expression;
|
|
1521
|
+
};
|
|
1522
|
+
/**
|
|
1523
|
+
* An expression to execute.
|
|
1524
|
+
* The return value determines the transition to take
|
|
1525
|
+
*/
|
|
1526
|
+
exp: Expression;
|
|
1527
|
+
/** A mapping of transition-name to FlowState name */
|
|
1528
|
+
transitions: Record<string, string>;
|
|
1529
|
+
/** Whether the expression(s) should be awaited before transitioning */
|
|
1530
|
+
await: boolean;
|
|
1154
1531
|
} | {
|
|
1155
1532
|
/** Add comments that will not be processing, but are useful for code explanation */
|
|
1156
1533
|
_comment?: string;
|
|
@@ -1171,10 +1548,909 @@ export interface Flow<T extends Asset = Asset> {
|
|
|
1171
1548
|
transitions: Record<string, string>;
|
|
1172
1549
|
/** A reference for this external state */
|
|
1173
1550
|
ref: string;
|
|
1551
|
+
[key: string]: unknown;
|
|
1174
1552
|
});
|
|
1175
1553
|
}>;
|
|
1176
1554
|
[key: string]: unknown;
|
|
1177
1555
|
}
|
|
1556
|
+
/** The authored schema object in the JSON payload */
|
|
1557
|
+
export interface Schema.Schema {
|
|
1558
|
+
/** The ROOT object is the top level object to use */
|
|
1559
|
+
ROOT: {
|
|
1560
|
+
[key: string]: {
|
|
1561
|
+
/** The reference of the base type to use */
|
|
1562
|
+
type: string;
|
|
1563
|
+
/**
|
|
1564
|
+
* Any additional validations that are associated with this property
|
|
1565
|
+
* These will add to any base validations associated with the "type"
|
|
1566
|
+
*/
|
|
1567
|
+
validation?: Array<{
|
|
1568
|
+
/**
|
|
1569
|
+
* The name of the referenced validation type
|
|
1570
|
+
* This will be used to lookup the proper handler
|
|
1571
|
+
*/
|
|
1572
|
+
type: string;
|
|
1573
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
1574
|
+
message?: string;
|
|
1575
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
1576
|
+
severity?: 'error' | 'warning';
|
|
1577
|
+
/** When to run this particular validation */
|
|
1578
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
1579
|
+
/**
|
|
1580
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
1581
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
1582
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
1583
|
+
*/
|
|
1584
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
1585
|
+
/** Where the error should be displayed */
|
|
1586
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
1587
|
+
/**
|
|
1588
|
+
* If the validation blocks navigation
|
|
1589
|
+
* true/false - always/never block navigation
|
|
1590
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1591
|
+
*/
|
|
1592
|
+
blocking?: boolean | 'once';
|
|
1593
|
+
[key: string]: unknown;
|
|
1594
|
+
}>;
|
|
1595
|
+
/**
|
|
1596
|
+
* A reference to a specific data format to use.
|
|
1597
|
+
* If none is specified, will fallback to that of the base type
|
|
1598
|
+
*/
|
|
1599
|
+
format?: {
|
|
1600
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
1601
|
+
type: string;
|
|
1602
|
+
[key: string]: unknown;
|
|
1603
|
+
};
|
|
1604
|
+
/**
|
|
1605
|
+
* A default value for this property.
|
|
1606
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
1607
|
+
*/
|
|
1608
|
+
default?: T;
|
|
1609
|
+
[key: string]: unknown;
|
|
1610
|
+
} | {
|
|
1611
|
+
/** The reference of the base type to use */
|
|
1612
|
+
type: string;
|
|
1613
|
+
/**
|
|
1614
|
+
* Any additional validations that are associated with this property
|
|
1615
|
+
* These will add to any base validations associated with the "type"
|
|
1616
|
+
*/
|
|
1617
|
+
validation?: Array<{
|
|
1618
|
+
/**
|
|
1619
|
+
* The name of the referenced validation type
|
|
1620
|
+
* This will be used to lookup the proper handler
|
|
1621
|
+
*/
|
|
1622
|
+
type: string;
|
|
1623
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
1624
|
+
message?: string;
|
|
1625
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
1626
|
+
severity?: 'error' | 'warning';
|
|
1627
|
+
/** When to run this particular validation */
|
|
1628
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
1629
|
+
/**
|
|
1630
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
1631
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
1632
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
1633
|
+
*/
|
|
1634
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
1635
|
+
/** Where the error should be displayed */
|
|
1636
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
1637
|
+
/**
|
|
1638
|
+
* If the validation blocks navigation
|
|
1639
|
+
* true/false - always/never block navigation
|
|
1640
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1641
|
+
*/
|
|
1642
|
+
blocking?: boolean | 'once';
|
|
1643
|
+
[key: string]: unknown;
|
|
1644
|
+
}>;
|
|
1645
|
+
/**
|
|
1646
|
+
* A reference to a specific data format to use.
|
|
1647
|
+
* If none is specified, will fallback to that of the base type
|
|
1648
|
+
*/
|
|
1649
|
+
format?: {
|
|
1650
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
1651
|
+
type: string;
|
|
1652
|
+
[key: string]: unknown;
|
|
1653
|
+
};
|
|
1654
|
+
/**
|
|
1655
|
+
* A default value for this property.
|
|
1656
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
1657
|
+
*/
|
|
1658
|
+
default?: T;
|
|
1659
|
+
/** boolean to define if its a record */
|
|
1660
|
+
isRecord: boolean;
|
|
1661
|
+
/** This property is mutually exclusive with RecordType and can not be used with ArrayType */
|
|
1662
|
+
isArray?: never;
|
|
1663
|
+
[key: string]: unknown;
|
|
1664
|
+
} | {
|
|
1665
|
+
/** The reference of the base type to use */
|
|
1666
|
+
type: string;
|
|
1667
|
+
/**
|
|
1668
|
+
* Any additional validations that are associated with this property
|
|
1669
|
+
* These will add to any base validations associated with the "type"
|
|
1670
|
+
*/
|
|
1671
|
+
validation?: Array<{
|
|
1672
|
+
/**
|
|
1673
|
+
* The name of the referenced validation type
|
|
1674
|
+
* This will be used to lookup the proper handler
|
|
1675
|
+
*/
|
|
1676
|
+
type: string;
|
|
1677
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
1678
|
+
message?: string;
|
|
1679
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
1680
|
+
severity?: 'error' | 'warning';
|
|
1681
|
+
/** When to run this particular validation */
|
|
1682
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
1683
|
+
/**
|
|
1684
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
1685
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
1686
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
1687
|
+
*/
|
|
1688
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
1689
|
+
/** Where the error should be displayed */
|
|
1690
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
1691
|
+
/**
|
|
1692
|
+
* If the validation blocks navigation
|
|
1693
|
+
* true/false - always/never block navigation
|
|
1694
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1695
|
+
*/
|
|
1696
|
+
blocking?: boolean | 'once';
|
|
1697
|
+
[key: string]: unknown;
|
|
1698
|
+
}>;
|
|
1699
|
+
/**
|
|
1700
|
+
* A reference to a specific data format to use.
|
|
1701
|
+
* If none is specified, will fallback to that of the base type
|
|
1702
|
+
*/
|
|
1703
|
+
format?: {
|
|
1704
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
1705
|
+
type: string;
|
|
1706
|
+
[key: string]: unknown;
|
|
1707
|
+
};
|
|
1708
|
+
/**
|
|
1709
|
+
* A default value for this property.
|
|
1710
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
1711
|
+
*/
|
|
1712
|
+
default?: T;
|
|
1713
|
+
/** boolean to define if its an array */
|
|
1714
|
+
isArray: boolean;
|
|
1715
|
+
/** This property is mutually exclusive with ArrayType and can not be used with RecordType */
|
|
1716
|
+
isRecord?: never;
|
|
1717
|
+
[key: string]: unknown;
|
|
1718
|
+
};
|
|
1719
|
+
};
|
|
1720
|
+
[key: string]: {
|
|
1721
|
+
[key: string]: {
|
|
1722
|
+
/** The reference of the base type to use */
|
|
1723
|
+
type: string;
|
|
1724
|
+
/**
|
|
1725
|
+
* Any additional validations that are associated with this property
|
|
1726
|
+
* These will add to any base validations associated with the "type"
|
|
1727
|
+
*/
|
|
1728
|
+
validation?: Array<{
|
|
1729
|
+
/**
|
|
1730
|
+
* The name of the referenced validation type
|
|
1731
|
+
* This will be used to lookup the proper handler
|
|
1732
|
+
*/
|
|
1733
|
+
type: string;
|
|
1734
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
1735
|
+
message?: string;
|
|
1736
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
1737
|
+
severity?: 'error' | 'warning';
|
|
1738
|
+
/** When to run this particular validation */
|
|
1739
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
1740
|
+
/**
|
|
1741
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
1742
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
1743
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
1744
|
+
*/
|
|
1745
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
1746
|
+
/** Where the error should be displayed */
|
|
1747
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
1748
|
+
/**
|
|
1749
|
+
* If the validation blocks navigation
|
|
1750
|
+
* true/false - always/never block navigation
|
|
1751
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1752
|
+
*/
|
|
1753
|
+
blocking?: boolean | 'once';
|
|
1754
|
+
[key: string]: unknown;
|
|
1755
|
+
}>;
|
|
1756
|
+
/**
|
|
1757
|
+
* A reference to a specific data format to use.
|
|
1758
|
+
* If none is specified, will fallback to that of the base type
|
|
1759
|
+
*/
|
|
1760
|
+
format?: {
|
|
1761
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
1762
|
+
type: string;
|
|
1763
|
+
[key: string]: unknown;
|
|
1764
|
+
};
|
|
1765
|
+
/**
|
|
1766
|
+
* A default value for this property.
|
|
1767
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
1768
|
+
*/
|
|
1769
|
+
default?: T;
|
|
1770
|
+
[key: string]: unknown;
|
|
1771
|
+
} | {
|
|
1772
|
+
/** The reference of the base type to use */
|
|
1773
|
+
type: string;
|
|
1774
|
+
/**
|
|
1775
|
+
* Any additional validations that are associated with this property
|
|
1776
|
+
* These will add to any base validations associated with the "type"
|
|
1777
|
+
*/
|
|
1778
|
+
validation?: Array<{
|
|
1779
|
+
/**
|
|
1780
|
+
* The name of the referenced validation type
|
|
1781
|
+
* This will be used to lookup the proper handler
|
|
1782
|
+
*/
|
|
1783
|
+
type: string;
|
|
1784
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
1785
|
+
message?: string;
|
|
1786
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
1787
|
+
severity?: 'error' | 'warning';
|
|
1788
|
+
/** When to run this particular validation */
|
|
1789
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
1790
|
+
/**
|
|
1791
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
1792
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
1793
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
1794
|
+
*/
|
|
1795
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
1796
|
+
/** Where the error should be displayed */
|
|
1797
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
1798
|
+
/**
|
|
1799
|
+
* If the validation blocks navigation
|
|
1800
|
+
* true/false - always/never block navigation
|
|
1801
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1802
|
+
*/
|
|
1803
|
+
blocking?: boolean | 'once';
|
|
1804
|
+
[key: string]: unknown;
|
|
1805
|
+
}>;
|
|
1806
|
+
/**
|
|
1807
|
+
* A reference to a specific data format to use.
|
|
1808
|
+
* If none is specified, will fallback to that of the base type
|
|
1809
|
+
*/
|
|
1810
|
+
format?: {
|
|
1811
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
1812
|
+
type: string;
|
|
1813
|
+
[key: string]: unknown;
|
|
1814
|
+
};
|
|
1815
|
+
/**
|
|
1816
|
+
* A default value for this property.
|
|
1817
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
1818
|
+
*/
|
|
1819
|
+
default?: T;
|
|
1820
|
+
/** boolean to define if its a record */
|
|
1821
|
+
isRecord: boolean;
|
|
1822
|
+
/** This property is mutually exclusive with RecordType and can not be used with ArrayType */
|
|
1823
|
+
isArray?: never;
|
|
1824
|
+
[key: string]: unknown;
|
|
1825
|
+
} | {
|
|
1826
|
+
/** The reference of the base type to use */
|
|
1827
|
+
type: string;
|
|
1828
|
+
/**
|
|
1829
|
+
* Any additional validations that are associated with this property
|
|
1830
|
+
* These will add to any base validations associated with the "type"
|
|
1831
|
+
*/
|
|
1832
|
+
validation?: Array<{
|
|
1833
|
+
/**
|
|
1834
|
+
* The name of the referenced validation type
|
|
1835
|
+
* This will be used to lookup the proper handler
|
|
1836
|
+
*/
|
|
1837
|
+
type: string;
|
|
1838
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
1839
|
+
message?: string;
|
|
1840
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
1841
|
+
severity?: 'error' | 'warning';
|
|
1842
|
+
/** When to run this particular validation */
|
|
1843
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
1844
|
+
/**
|
|
1845
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
1846
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
1847
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
1848
|
+
*/
|
|
1849
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
1850
|
+
/** Where the error should be displayed */
|
|
1851
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
1852
|
+
/**
|
|
1853
|
+
* If the validation blocks navigation
|
|
1854
|
+
* true/false - always/never block navigation
|
|
1855
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1856
|
+
*/
|
|
1857
|
+
blocking?: boolean | 'once';
|
|
1858
|
+
[key: string]: unknown;
|
|
1859
|
+
}>;
|
|
1860
|
+
/**
|
|
1861
|
+
* A reference to a specific data format to use.
|
|
1862
|
+
* If none is specified, will fallback to that of the base type
|
|
1863
|
+
*/
|
|
1864
|
+
format?: {
|
|
1865
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
1866
|
+
type: string;
|
|
1867
|
+
[key: string]: unknown;
|
|
1868
|
+
};
|
|
1869
|
+
/**
|
|
1870
|
+
* A default value for this property.
|
|
1871
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
1872
|
+
*/
|
|
1873
|
+
default?: T;
|
|
1874
|
+
/** boolean to define if its an array */
|
|
1875
|
+
isArray: boolean;
|
|
1876
|
+
/** This property is mutually exclusive with ArrayType and can not be used with RecordType */
|
|
1877
|
+
isRecord?: never;
|
|
1878
|
+
[key: string]: unknown;
|
|
1879
|
+
};
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
/** A Node describes a specific object in the tree */
|
|
1883
|
+
export interface Schema.Node {
|
|
1884
|
+
[key: string]: {
|
|
1885
|
+
/** The reference of the base type to use */
|
|
1886
|
+
type: string;
|
|
1887
|
+
/**
|
|
1888
|
+
* Any additional validations that are associated with this property
|
|
1889
|
+
* These will add to any base validations associated with the "type"
|
|
1890
|
+
*/
|
|
1891
|
+
validation?: Array<{
|
|
1892
|
+
/**
|
|
1893
|
+
* The name of the referenced validation type
|
|
1894
|
+
* This will be used to lookup the proper handler
|
|
1895
|
+
*/
|
|
1896
|
+
type: string;
|
|
1897
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
1898
|
+
message?: string;
|
|
1899
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
1900
|
+
severity?: 'error' | 'warning';
|
|
1901
|
+
/** When to run this particular validation */
|
|
1902
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
1903
|
+
/**
|
|
1904
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
1905
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
1906
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
1907
|
+
*/
|
|
1908
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
1909
|
+
/** Where the error should be displayed */
|
|
1910
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
1911
|
+
/**
|
|
1912
|
+
* If the validation blocks navigation
|
|
1913
|
+
* true/false - always/never block navigation
|
|
1914
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1915
|
+
*/
|
|
1916
|
+
blocking?: boolean | 'once';
|
|
1917
|
+
[key: string]: unknown;
|
|
1918
|
+
}>;
|
|
1919
|
+
/**
|
|
1920
|
+
* A reference to a specific data format to use.
|
|
1921
|
+
* If none is specified, will fallback to that of the base type
|
|
1922
|
+
*/
|
|
1923
|
+
format?: {
|
|
1924
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
1925
|
+
type: string;
|
|
1926
|
+
[key: string]: unknown;
|
|
1927
|
+
};
|
|
1928
|
+
/**
|
|
1929
|
+
* A default value for this property.
|
|
1930
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
1931
|
+
*/
|
|
1932
|
+
default?: T;
|
|
1933
|
+
[key: string]: unknown;
|
|
1934
|
+
} | {
|
|
1935
|
+
/** The reference of the base type to use */
|
|
1936
|
+
type: string;
|
|
1937
|
+
/**
|
|
1938
|
+
* Any additional validations that are associated with this property
|
|
1939
|
+
* These will add to any base validations associated with the "type"
|
|
1940
|
+
*/
|
|
1941
|
+
validation?: Array<{
|
|
1942
|
+
/**
|
|
1943
|
+
* The name of the referenced validation type
|
|
1944
|
+
* This will be used to lookup the proper handler
|
|
1945
|
+
*/
|
|
1946
|
+
type: string;
|
|
1947
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
1948
|
+
message?: string;
|
|
1949
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
1950
|
+
severity?: 'error' | 'warning';
|
|
1951
|
+
/** When to run this particular validation */
|
|
1952
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
1953
|
+
/**
|
|
1954
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
1955
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
1956
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
1957
|
+
*/
|
|
1958
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
1959
|
+
/** Where the error should be displayed */
|
|
1960
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
1961
|
+
/**
|
|
1962
|
+
* If the validation blocks navigation
|
|
1963
|
+
* true/false - always/never block navigation
|
|
1964
|
+
* once - only block navigation if the validation has not been triggered before
|
|
1965
|
+
*/
|
|
1966
|
+
blocking?: boolean | 'once';
|
|
1967
|
+
[key: string]: unknown;
|
|
1968
|
+
}>;
|
|
1969
|
+
/**
|
|
1970
|
+
* A reference to a specific data format to use.
|
|
1971
|
+
* If none is specified, will fallback to that of the base type
|
|
1972
|
+
*/
|
|
1973
|
+
format?: {
|
|
1974
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
1975
|
+
type: string;
|
|
1976
|
+
[key: string]: unknown;
|
|
1977
|
+
};
|
|
1978
|
+
/**
|
|
1979
|
+
* A default value for this property.
|
|
1980
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
1981
|
+
*/
|
|
1982
|
+
default?: T;
|
|
1983
|
+
/** boolean to define if its a record */
|
|
1984
|
+
isRecord: boolean;
|
|
1985
|
+
/** This property is mutually exclusive with RecordType and can not be used with ArrayType */
|
|
1986
|
+
isArray?: never;
|
|
1987
|
+
[key: string]: unknown;
|
|
1988
|
+
} | {
|
|
1989
|
+
/** The reference of the base type to use */
|
|
1990
|
+
type: string;
|
|
1991
|
+
/**
|
|
1992
|
+
* Any additional validations that are associated with this property
|
|
1993
|
+
* These will add to any base validations associated with the "type"
|
|
1994
|
+
*/
|
|
1995
|
+
validation?: Array<{
|
|
1996
|
+
/**
|
|
1997
|
+
* The name of the referenced validation type
|
|
1998
|
+
* This will be used to lookup the proper handler
|
|
1999
|
+
*/
|
|
2000
|
+
type: string;
|
|
2001
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
2002
|
+
message?: string;
|
|
2003
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
2004
|
+
severity?: 'error' | 'warning';
|
|
2005
|
+
/** When to run this particular validation */
|
|
2006
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
2007
|
+
/**
|
|
2008
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
2009
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
2010
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
2011
|
+
*/
|
|
2012
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
2013
|
+
/** Where the error should be displayed */
|
|
2014
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
2015
|
+
/**
|
|
2016
|
+
* If the validation blocks navigation
|
|
2017
|
+
* true/false - always/never block navigation
|
|
2018
|
+
* once - only block navigation if the validation has not been triggered before
|
|
2019
|
+
*/
|
|
2020
|
+
blocking?: boolean | 'once';
|
|
2021
|
+
[key: string]: unknown;
|
|
2022
|
+
}>;
|
|
2023
|
+
/**
|
|
2024
|
+
* A reference to a specific data format to use.
|
|
2025
|
+
* If none is specified, will fallback to that of the base type
|
|
2026
|
+
*/
|
|
2027
|
+
format?: {
|
|
2028
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
2029
|
+
type: string;
|
|
2030
|
+
[key: string]: unknown;
|
|
2031
|
+
};
|
|
2032
|
+
/**
|
|
2033
|
+
* A default value for this property.
|
|
2034
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
2035
|
+
*/
|
|
2036
|
+
default?: T;
|
|
2037
|
+
/** boolean to define if its an array */
|
|
2038
|
+
isArray: boolean;
|
|
2039
|
+
/** This property is mutually exclusive with ArrayType and can not be used with RecordType */
|
|
2040
|
+
isRecord?: never;
|
|
2041
|
+
[key: string]: unknown;
|
|
2042
|
+
};
|
|
2043
|
+
}
|
|
2044
|
+
export type Schema.DataTypes = {
|
|
2045
|
+
/** The reference of the base type to use */
|
|
2046
|
+
type: string;
|
|
2047
|
+
/**
|
|
2048
|
+
* Any additional validations that are associated with this property
|
|
2049
|
+
* These will add to any base validations associated with the "type"
|
|
2050
|
+
*/
|
|
2051
|
+
validation?: Array<{
|
|
2052
|
+
/**
|
|
2053
|
+
* The name of the referenced validation type
|
|
2054
|
+
* This will be used to lookup the proper handler
|
|
2055
|
+
*/
|
|
2056
|
+
type: string;
|
|
2057
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
2058
|
+
message?: string;
|
|
2059
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
2060
|
+
severity?: 'error' | 'warning';
|
|
2061
|
+
/** When to run this particular validation */
|
|
2062
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
2063
|
+
/**
|
|
2064
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
2065
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
2066
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
2067
|
+
*/
|
|
2068
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
2069
|
+
/** Where the error should be displayed */
|
|
2070
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
2071
|
+
/**
|
|
2072
|
+
* If the validation blocks navigation
|
|
2073
|
+
* true/false - always/never block navigation
|
|
2074
|
+
* once - only block navigation if the validation has not been triggered before
|
|
2075
|
+
*/
|
|
2076
|
+
blocking?: boolean | 'once';
|
|
2077
|
+
[key: string]: unknown;
|
|
2078
|
+
}>;
|
|
2079
|
+
/**
|
|
2080
|
+
* A reference to a specific data format to use.
|
|
2081
|
+
* If none is specified, will fallback to that of the base type
|
|
2082
|
+
*/
|
|
2083
|
+
format?: {
|
|
2084
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
2085
|
+
type: string;
|
|
2086
|
+
[key: string]: unknown;
|
|
2087
|
+
};
|
|
2088
|
+
/**
|
|
2089
|
+
* A default value for this property.
|
|
2090
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
2091
|
+
*/
|
|
2092
|
+
default?: T;
|
|
2093
|
+
[key: string]: unknown;
|
|
2094
|
+
} | {
|
|
2095
|
+
/** The reference of the base type to use */
|
|
2096
|
+
type: string;
|
|
2097
|
+
/**
|
|
2098
|
+
* Any additional validations that are associated with this property
|
|
2099
|
+
* These will add to any base validations associated with the "type"
|
|
2100
|
+
*/
|
|
2101
|
+
validation?: Array<{
|
|
2102
|
+
/**
|
|
2103
|
+
* The name of the referenced validation type
|
|
2104
|
+
* This will be used to lookup the proper handler
|
|
2105
|
+
*/
|
|
2106
|
+
type: string;
|
|
2107
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
2108
|
+
message?: string;
|
|
2109
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
2110
|
+
severity?: 'error' | 'warning';
|
|
2111
|
+
/** When to run this particular validation */
|
|
2112
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
2113
|
+
/**
|
|
2114
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
2115
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
2116
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
2117
|
+
*/
|
|
2118
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
2119
|
+
/** Where the error should be displayed */
|
|
2120
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
2121
|
+
/**
|
|
2122
|
+
* If the validation blocks navigation
|
|
2123
|
+
* true/false - always/never block navigation
|
|
2124
|
+
* once - only block navigation if the validation has not been triggered before
|
|
2125
|
+
*/
|
|
2126
|
+
blocking?: boolean | 'once';
|
|
2127
|
+
[key: string]: unknown;
|
|
2128
|
+
}>;
|
|
2129
|
+
/**
|
|
2130
|
+
* A reference to a specific data format to use.
|
|
2131
|
+
* If none is specified, will fallback to that of the base type
|
|
2132
|
+
*/
|
|
2133
|
+
format?: {
|
|
2134
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
2135
|
+
type: string;
|
|
2136
|
+
[key: string]: unknown;
|
|
2137
|
+
};
|
|
2138
|
+
/**
|
|
2139
|
+
* A default value for this property.
|
|
2140
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
2141
|
+
*/
|
|
2142
|
+
default?: T;
|
|
2143
|
+
/** boolean to define if its a record */
|
|
2144
|
+
isRecord: boolean;
|
|
2145
|
+
/** This property is mutually exclusive with RecordType and can not be used with ArrayType */
|
|
2146
|
+
isArray?: never;
|
|
2147
|
+
[key: string]: unknown;
|
|
2148
|
+
} | {
|
|
2149
|
+
/** The reference of the base type to use */
|
|
2150
|
+
type: string;
|
|
2151
|
+
/**
|
|
2152
|
+
* Any additional validations that are associated with this property
|
|
2153
|
+
* These will add to any base validations associated with the "type"
|
|
2154
|
+
*/
|
|
2155
|
+
validation?: Array<{
|
|
2156
|
+
/**
|
|
2157
|
+
* The name of the referenced validation type
|
|
2158
|
+
* This will be used to lookup the proper handler
|
|
2159
|
+
*/
|
|
2160
|
+
type: string;
|
|
2161
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
2162
|
+
message?: string;
|
|
2163
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
2164
|
+
severity?: 'error' | 'warning';
|
|
2165
|
+
/** When to run this particular validation */
|
|
2166
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
2167
|
+
/**
|
|
2168
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
2169
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
2170
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
2171
|
+
*/
|
|
2172
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
2173
|
+
/** Where the error should be displayed */
|
|
2174
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
2175
|
+
/**
|
|
2176
|
+
* If the validation blocks navigation
|
|
2177
|
+
* true/false - always/never block navigation
|
|
2178
|
+
* once - only block navigation if the validation has not been triggered before
|
|
2179
|
+
*/
|
|
2180
|
+
blocking?: boolean | 'once';
|
|
2181
|
+
[key: string]: unknown;
|
|
2182
|
+
}>;
|
|
2183
|
+
/**
|
|
2184
|
+
* A reference to a specific data format to use.
|
|
2185
|
+
* If none is specified, will fallback to that of the base type
|
|
2186
|
+
*/
|
|
2187
|
+
format?: {
|
|
2188
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
2189
|
+
type: string;
|
|
2190
|
+
[key: string]: unknown;
|
|
2191
|
+
};
|
|
2192
|
+
/**
|
|
2193
|
+
* A default value for this property.
|
|
2194
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
2195
|
+
*/
|
|
2196
|
+
default?: T;
|
|
2197
|
+
/** boolean to define if its an array */
|
|
2198
|
+
isArray: boolean;
|
|
2199
|
+
/** This property is mutually exclusive with ArrayType and can not be used with RecordType */
|
|
2200
|
+
isRecord?: never;
|
|
2201
|
+
[key: string]: unknown;
|
|
2202
|
+
};
|
|
2203
|
+
/** Each prop in the object can have a specific DataType */
|
|
2204
|
+
export interface Schema.DataType<T extends any = unknown> {
|
|
2205
|
+
/** The reference of the base type to use */
|
|
2206
|
+
type: string;
|
|
2207
|
+
/**
|
|
2208
|
+
* Any additional validations that are associated with this property
|
|
2209
|
+
* These will add to any base validations associated with the "type"
|
|
2210
|
+
*/
|
|
2211
|
+
validation?: Array<{
|
|
2212
|
+
/**
|
|
2213
|
+
* The name of the referenced validation type
|
|
2214
|
+
* This will be used to lookup the proper handler
|
|
2215
|
+
*/
|
|
2216
|
+
type: string;
|
|
2217
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
2218
|
+
message?: string;
|
|
2219
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
2220
|
+
severity?: 'error' | 'warning';
|
|
2221
|
+
/** When to run this particular validation */
|
|
2222
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
2223
|
+
/**
|
|
2224
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
2225
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
2226
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
2227
|
+
*/
|
|
2228
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
2229
|
+
/** Where the error should be displayed */
|
|
2230
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
2231
|
+
/**
|
|
2232
|
+
* If the validation blocks navigation
|
|
2233
|
+
* true/false - always/never block navigation
|
|
2234
|
+
* once - only block navigation if the validation has not been triggered before
|
|
2235
|
+
*/
|
|
2236
|
+
blocking?: boolean | 'once';
|
|
2237
|
+
[key: string]: unknown;
|
|
2238
|
+
}>;
|
|
2239
|
+
/**
|
|
2240
|
+
* A reference to a specific data format to use.
|
|
2241
|
+
* If none is specified, will fallback to that of the base type
|
|
2242
|
+
*/
|
|
2243
|
+
format?: {
|
|
2244
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
2245
|
+
type: string;
|
|
2246
|
+
[key: string]: unknown;
|
|
2247
|
+
};
|
|
2248
|
+
/**
|
|
2249
|
+
* A default value for this property.
|
|
2250
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
2251
|
+
*/
|
|
2252
|
+
default?: T;
|
|
2253
|
+
[key: string]: unknown;
|
|
2254
|
+
}
|
|
2255
|
+
/** Determines if the Datatype is a record object */
|
|
2256
|
+
export interface Schema.RecordType {
|
|
2257
|
+
/** The reference of the base type to use */
|
|
2258
|
+
type: string;
|
|
2259
|
+
/**
|
|
2260
|
+
* Any additional validations that are associated with this property
|
|
2261
|
+
* These will add to any base validations associated with the "type"
|
|
2262
|
+
*/
|
|
2263
|
+
validation?: Array<{
|
|
2264
|
+
/**
|
|
2265
|
+
* The name of the referenced validation type
|
|
2266
|
+
* This will be used to lookup the proper handler
|
|
2267
|
+
*/
|
|
2268
|
+
type: string;
|
|
2269
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
2270
|
+
message?: string;
|
|
2271
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
2272
|
+
severity?: 'error' | 'warning';
|
|
2273
|
+
/** When to run this particular validation */
|
|
2274
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
2275
|
+
/**
|
|
2276
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
2277
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
2278
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
2279
|
+
*/
|
|
2280
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
2281
|
+
/** Where the error should be displayed */
|
|
2282
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
2283
|
+
/**
|
|
2284
|
+
* If the validation blocks navigation
|
|
2285
|
+
* true/false - always/never block navigation
|
|
2286
|
+
* once - only block navigation if the validation has not been triggered before
|
|
2287
|
+
*/
|
|
2288
|
+
blocking?: boolean | 'once';
|
|
2289
|
+
[key: string]: unknown;
|
|
2290
|
+
}>;
|
|
2291
|
+
/**
|
|
2292
|
+
* A reference to a specific data format to use.
|
|
2293
|
+
* If none is specified, will fallback to that of the base type
|
|
2294
|
+
*/
|
|
2295
|
+
format?: {
|
|
2296
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
2297
|
+
type: string;
|
|
2298
|
+
[key: string]: unknown;
|
|
2299
|
+
};
|
|
2300
|
+
/**
|
|
2301
|
+
* A default value for this property.
|
|
2302
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
2303
|
+
*/
|
|
2304
|
+
default?: T;
|
|
2305
|
+
/** boolean to define if its a record */
|
|
2306
|
+
isRecord: boolean;
|
|
2307
|
+
/** This property is mutually exclusive with RecordType and can not be used with ArrayType */
|
|
2308
|
+
isArray?: never;
|
|
2309
|
+
[key: string]: unknown;
|
|
2310
|
+
}
|
|
2311
|
+
/** Determines if the DataType is an Array Object */
|
|
2312
|
+
export interface Schema.ArrayType {
|
|
2313
|
+
/** The reference of the base type to use */
|
|
2314
|
+
type: string;
|
|
2315
|
+
/**
|
|
2316
|
+
* Any additional validations that are associated with this property
|
|
2317
|
+
* These will add to any base validations associated with the "type"
|
|
2318
|
+
*/
|
|
2319
|
+
validation?: Array<{
|
|
2320
|
+
/**
|
|
2321
|
+
* The name of the referenced validation type
|
|
2322
|
+
* This will be used to lookup the proper handler
|
|
2323
|
+
*/
|
|
2324
|
+
type: string;
|
|
2325
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
2326
|
+
message?: string;
|
|
2327
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
2328
|
+
severity?: 'error' | 'warning';
|
|
2329
|
+
/** When to run this particular validation */
|
|
2330
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
2331
|
+
/**
|
|
2332
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
2333
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
2334
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
2335
|
+
*/
|
|
2336
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
2337
|
+
/** Where the error should be displayed */
|
|
2338
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
2339
|
+
/**
|
|
2340
|
+
* If the validation blocks navigation
|
|
2341
|
+
* true/false - always/never block navigation
|
|
2342
|
+
* once - only block navigation if the validation has not been triggered before
|
|
2343
|
+
*/
|
|
2344
|
+
blocking?: boolean | 'once';
|
|
2345
|
+
[key: string]: unknown;
|
|
2346
|
+
}>;
|
|
2347
|
+
/**
|
|
2348
|
+
* A reference to a specific data format to use.
|
|
2349
|
+
* If none is specified, will fallback to that of the base type
|
|
2350
|
+
*/
|
|
2351
|
+
format?: {
|
|
2352
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
2353
|
+
type: string;
|
|
2354
|
+
[key: string]: unknown;
|
|
2355
|
+
};
|
|
2356
|
+
/**
|
|
2357
|
+
* A default value for this property.
|
|
2358
|
+
* Any reads for this property will result in this default value being written to the model.
|
|
2359
|
+
*/
|
|
2360
|
+
default?: T;
|
|
2361
|
+
/** boolean to define if its an array */
|
|
2362
|
+
isArray: boolean;
|
|
2363
|
+
/** This property is mutually exclusive with ArrayType and can not be used with RecordType */
|
|
2364
|
+
isRecord?: never;
|
|
2365
|
+
[key: string]: unknown;
|
|
2366
|
+
}
|
|
2367
|
+
/** Helper to compliment \`Schema.DataType\` to provide a way to export a reference to a data type instead of the whole object */
|
|
2368
|
+
export interface Language.DataTypeRef {
|
|
2369
|
+
/** Name of the type in Player Core */
|
|
2370
|
+
type: string;
|
|
2371
|
+
}
|
|
2372
|
+
/** A reference to a specific formatter */
|
|
2373
|
+
export interface Formatting.Reference {
|
|
2374
|
+
/** The name of the formatter (and de-formatter) to use */
|
|
2375
|
+
type: string;
|
|
2376
|
+
[key: string]: unknown;
|
|
2377
|
+
}
|
|
2378
|
+
/**
|
|
2379
|
+
* How serious are you about this error?
|
|
2380
|
+
* Warning validations are reserved for errors that could be ignored by the user without consequence
|
|
2381
|
+
* Errors must be fixed before proceeding
|
|
2382
|
+
*/
|
|
2383
|
+
export type Validation.Severity = 'error' | 'warning';
|
|
2384
|
+
/**
|
|
2385
|
+
* When to _first_ start caring about a validation of a data-val.
|
|
2386
|
+
*
|
|
2387
|
+
* load - only check once the first time the binding appears on screen
|
|
2388
|
+
* change - check anytime the data changes
|
|
2389
|
+
* navigation - check once the user attempts to navigate away from a view
|
|
2390
|
+
*/
|
|
2391
|
+
export type Validation.Trigger = 'navigation' | 'change' | 'load';
|
|
2392
|
+
/**
|
|
2393
|
+
* Where the error/warning should be displayed.
|
|
2394
|
+
* - \`field\` is the default display target. This renders the error/warning directly underneath the field.
|
|
2395
|
+
* - \`section\` is used to display a message at a parent node that is designated as a "section"
|
|
2396
|
+
* - \`page\` a special section used to display a message at the top of the page.
|
|
2397
|
+
*/
|
|
2398
|
+
export type Validation.DisplayTarget = 'page' | 'section' | 'field';
|
|
2399
|
+
/** A reference to a validation object */
|
|
2400
|
+
export interface Validation.Reference {
|
|
2401
|
+
/**
|
|
2402
|
+
* The name of the referenced validation type
|
|
2403
|
+
* This will be used to lookup the proper handler
|
|
2404
|
+
*/
|
|
2405
|
+
type: string;
|
|
2406
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
2407
|
+
message?: string;
|
|
2408
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
2409
|
+
severity?: 'error' | 'warning';
|
|
2410
|
+
/** When to run this particular validation */
|
|
2411
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
2412
|
+
/**
|
|
2413
|
+
* Each validation is passed the value of the data to run it's validation against.
|
|
2414
|
+
* By default, this is the value stored in the data-model (deformatted).
|
|
2415
|
+
* In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option
|
|
2416
|
+
*/
|
|
2417
|
+
dataTarget?: 'formatted' | 'deformatted';
|
|
2418
|
+
/** Where the error should be displayed */
|
|
2419
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
2420
|
+
/**
|
|
2421
|
+
* If the validation blocks navigation
|
|
2422
|
+
* true/false - always/never block navigation
|
|
2423
|
+
* once - only block navigation if the validation has not been triggered before
|
|
2424
|
+
*/
|
|
2425
|
+
blocking?: boolean | 'once';
|
|
2426
|
+
[key: string]: unknown;
|
|
2427
|
+
}
|
|
2428
|
+
export interface Validation.CrossfieldReference {
|
|
2429
|
+
/**
|
|
2430
|
+
* The name of the referenced validation type
|
|
2431
|
+
* This will be used to lookup the proper handler
|
|
2432
|
+
*/
|
|
2433
|
+
type: string;
|
|
2434
|
+
/** An optional means of overriding the default message if the validation is triggered */
|
|
2435
|
+
message?: string;
|
|
2436
|
+
/** An optional means of overriding the default severity of the validation if triggered */
|
|
2437
|
+
severity?: 'error' | 'warning';
|
|
2438
|
+
/** When to run this particular validation */
|
|
2439
|
+
trigger?: 'navigation' | 'change' | 'load';
|
|
2440
|
+
/** Cross-field references and validation must run against the default (deformatted) value */
|
|
2441
|
+
dataTarget?: never;
|
|
2442
|
+
/** Where the error should be displayed */
|
|
2443
|
+
displayTarget?: 'page' | 'section' | 'field';
|
|
2444
|
+
/**
|
|
2445
|
+
* If the validation blocks navigation
|
|
2446
|
+
* true/false - always/never block navigation
|
|
2447
|
+
* once - only block navigation if the validation has not been triggered before
|
|
2448
|
+
*/
|
|
2449
|
+
blocking?: boolean | 'once';
|
|
2450
|
+
/** The binding to associate this validation with */
|
|
2451
|
+
ref?: Binding;
|
|
2452
|
+
[key: string]: unknown;
|
|
2453
|
+
}
|
|
1178
2454
|
/**
|
|
1179
2455
|
* This is the most generic way of gathering data. The input is bound to a data model using the 'binding' property.
|
|
1180
2456
|
* Players can get field type information from the 'schema' definition, thus to decide the input controls for visual rendering.
|