@player-ui/types 0.12.1-next.0 → 0.13.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/types/src/index.ts"],"sourcesContent":["/**\n * An asset is the smallest unit of user interaction in a player view\n */\nexport interface Asset<T extends string = string> {\n /** Each asset requires a unique id per view */\n id: string;\n\n /** The asset type determines the semantics of how a user interacts with a page */\n type: T;\n\n [key: string]: unknown;\n}\n/**\n * An asset that contains a Binding.\n */\nexport interface AssetBinding extends Asset {\n /** A binding that points to somewhere in the data model */\n binding: Binding;\n}\n\n/** A single case statement to use in a switch */\nexport interface SwitchCase<T extends Asset = Asset> {\n /** The Asset to use if this case is applicable */\n asset: T;\n\n /** An expression to execute to determine if this case applies */\n case: Expression | true;\n}\n\n/** A switch can replace an asset with the applicable case on first render */\nexport type Switch<T extends Asset = Asset> = SwitchCase<T>[];\n\n/** An object that contains an asset */\nexport type AssetWrapper<T extends Asset = Asset> = {\n /** An asset instance */\n asset: T;\n\n [key: string]: unknown;\n};\n\nexport type AssetWrapperOrSwitch<T extends Asset = Asset> =\n | (AssetWrapper<T> & {\n /** The dynamicSwitch property can't exist at the same time as 'asset' */\n dynamicSwitch?: never;\n\n /** The staticSwitch property can't exist at the same time as 'asset' */\n staticSwitch?: never;\n })\n | (StaticSwitch<T> & {\n /** The staticSwitch property can't exist at the same time as 'asset' */\n asset?: never;\n\n /** The staticSwitch property can't exist at the same time as 'dynamicSwitch' */\n dynamicSwitch?: never;\n })\n | (DynamicSwitch<T> & {\n /** The dynamicSwitch property can't exist at the same time as 'asset' */\n asset?: never;\n\n /** The dynamicSwitch property can't exist at the same time as 'staticSwitch' */\n staticSwitch?: never;\n });\n\nexport type AssetSwitch<T extends Asset = Asset> =\n | StaticSwitch<T>\n | DynamicSwitch<T>;\n\nexport interface StaticSwitch<T extends Asset = Asset> {\n /** A static switch only evaluates the applicable base on first render of the view */\n staticSwitch: Switch<T>;\n}\n\nexport interface DynamicSwitch<T extends Asset = Asset> {\n /** A dynamic switch re-evaluates the applicable case as data changes */\n dynamicSwitch: Switch<T>;\n}\n\n/**\n * Expressions are a specialized way of executing code.\n * If the expression is a composite, the last expression executed is the return value\n */\nexport type Expression = string | string[];\nexport type ExpressionRef = `@[${string}]@`;\n\n/**\n * Bindings describe locations in the data model.\n */\nexport type Binding = string;\nexport type BindingRef = `{{${Binding}}}`;\n\n/**\n * The data-model is the location that all user data is stored\n */\nexport type DataModel = Record<any, unknown>;\n\n/** The navigation section of the flow describes a State Machine for the user. */\nexport type Navigation = {\n /** The name of the Flow to begin on */\n BEGIN: string;\n} & Record<string, string | NavigationFlow>;\n\n/** An object with an expression in it */\nexport interface ExpressionObject {\n /** The expression to run */\n exp?: Expression;\n}\n\n/** A state machine in the navigation */\nexport interface NavigationFlow {\n /** The first state to kick off the state machine */\n startState: string;\n\n /** An optional expression to run when this Flow starts */\n onStart?: Expression | ExpressionObject;\n\n /** An optional expression to run when this Flow ends */\n onEnd?: Expression | ExpressionObject;\n\n [key: string]:\n | undefined\n | string\n | Expression\n | ExpressionObject\n | NavigationFlowState;\n}\n\nexport type NavigationFlowTransition = Record<string, string>;\n\ninterface CommentBase {\n /** Add comments that will not be processing, but are useful for code explanation */\n _comment?: string;\n}\n\n/** The base representation of a state within a Flow */\nexport interface NavigationBaseState<T extends string> extends CommentBase {\n /** A property to determine the type of state this is */\n state_type: T;\n\n /** An optional expression to run when this view renders */\n onStart?: Expression | ExpressionObject;\n\n /** An optional expression to run before view transition */\n onEnd?: Expression | ExpressionObject;\n\n /**\n * TS gets really confused with both the ActionState and the onStart state both declaring the `exp` property\n * So this explicity says there should never be an exp prop on a state node that's not of type 'ACTION'\n */\n exp?: T extends \"ACTION\" ? Expression : never;\n}\n\n/** A generic state that can transition to another state */\nexport interface NavigationFlowTransitionableState<T extends string>\n extends NavigationBaseState<T> {\n /** A mapping of transition-name to FlowState name */\n transitions: NavigationFlowTransition;\n}\n\n/** A state representing a view */\nexport interface NavigationFlowViewState\n extends NavigationFlowTransitionableState<\"VIEW\"> {\n /** An id corresponding to a view from the 'views' array */\n ref: string;\n\n /** View meta-properties */\n attributes?: {\n [key: string]: any;\n };\n\n /** Any additional properties are forwarded as options, like param */\n [key: string]: unknown;\n}\n\n/**\n * An END state of the flow.\n */\nexport interface NavigationFlowEndState extends NavigationBaseState<\"END\"> {\n /**\n * A description of _how_ the flow ended.\n * If this is a flow started from another flow, the outcome determines the flow transition\n */\n outcome: string;\n\n /** Any additional properties are forwarded as options, like param */\n [key: string]: unknown;\n}\n\n/** Action states execute an expression to determine the next state to transition to */\nexport interface NavigationFlowActionState\n extends NavigationFlowTransitionableState<\"ACTION\"> {\n /**\n * An expression to execute.\n * The return value determines the transition to take\n */\n exp: Expression;\n}\n\n/**\n * External Flow states represent states in the FSM that can't be resolved internally in Player.\n * The flow will wait for the embedded application to manage moving to the next state via a transition\n */\nexport interface NavigationFlowExternalState\n extends NavigationFlowTransitionableState<\"EXTERNAL\"> {\n /** A reference for this external state */\n ref: string;\n /** Any additional properties are forwarded as options */\n [key: string]: unknown;\n}\n\nexport interface NavigationFlowFlowState\n extends NavigationFlowTransitionableState<\"FLOW\"> {\n /** A reference to a FLOW id state to run */\n ref: string;\n}\n\nexport type NavigationFlowState =\n | NavigationFlowViewState\n | NavigationFlowEndState\n | NavigationFlowFlowState\n | NavigationFlowActionState\n | NavigationFlowExternalState;\n\n/** The data at the end of a flow */\nexport interface FlowResult {\n /** The outcome describes _how_ the flow ended (forwards, backwards, etc) */\n endState: NavigationFlowEndState;\n\n /** The serialized data-model */\n data?: any;\n}\n\n/** Any object that contains 1 or more templates */\nexport interface Templatable {\n /** A list of templates to process for this node */\n template?: Template[];\n}\n\n/** A template describes a mapping from a data array -> array of objects */\nexport interface Template<ValueType = unknown, Key extends string = string> {\n /** A pointer to the data-model containing an array of elements to map over */\n data: Binding;\n\n /**\n * The template to iterate over using each value in the supplied template data.\n * Any reference to _index_ is replaced with the current iteration index.\n */\n value: ValueType;\n\n /** should the template be recomputed when data changes */\n dynamic?: boolean;\n\n /**\n * A property on the parent object to store the new map under.\n * If it already exists, values are appended to the end.\n */\n output: Key;\n\n /** Specifies the template placement in relation to existing elements*/\n placement?: \"prepend\" | \"append\";\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\n/**\n * The Schema organizes all content related to Data and it's types\n */\nexport declare namespace Schema {\n /** The authored schema object in the JSON payload */\n export interface Schema {\n /** The ROOT object is the top level object to use */\n ROOT: Node;\n\n /** Any additional keys are properties of the ROOT object */\n [key: string]: Node;\n }\n\n /** A Node describes a specific object in the tree */\n export interface Node {\n /** Each property describes a property of the object */\n [key: string]: DataTypes;\n }\n\n export type DataTypes = DataType | RecordType | ArrayType;\n\n /** Each prop in the object can have a specific DataType */\n export interface DataType<T = unknown> {\n /** The reference of the base type to use */\n type: string;\n\n /**\n * Any additional validations that are associated with this property\n * These will add to any base validations associated with the \"type\"\n */\n validation?: Validation.Reference[];\n\n /**\n * A reference to a specific data format to use.\n * If none is specified, will fallback to that of the base type\n */\n format?: Formatting.Reference;\n\n /**\n * A default value for this property.\n * Any reads for this property will result in this default value being written to the model.\n */\n default?: T;\n\n /** Any additional options */\n [key: string]: unknown;\n }\n /** Determines if the Datatype is a record object */\n export interface RecordType extends DataType {\n /** boolean to define if its a record */\n isRecord: boolean;\n\n /** This property is mutually exclusive with RecordType and can not be used with ArrayType */\n isArray?: never;\n }\n\n /** Determines if the DataType is an Array Object */\n export interface ArrayType extends DataType {\n /** boolean to define if its an array */\n isArray: boolean;\n\n /** This property is mutually exclusive with ArrayType and can not be used with RecordType */\n isRecord?: never;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\n/** Namespace to wrap up core functionality to be used by the Language Service */\nexport declare namespace Language {\n /**\n * Helper to compliment `Schema.DataType` to provide a way to export a reference to a data type instead of the whole object\n */\n export interface DataTypeRef {\n /** Name of the type in Player Core */\n type: string;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\n/** A spot for formatting */\nexport declare namespace Formatting {\n /** A reference to a specific formatter */\n export interface Reference {\n /** The name of the formatter (and de-formatter) to use */\n type: string;\n\n /** Any additional properties will be passed as options to the formatter function */\n [key: string]: unknown;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\n/** A space for all thing validation */\nexport declare namespace Validation {\n /**\n * How serious are you about this error?\n * Warning validations are reserved for errors that could be ignored by the user without consequence\n * Errors must be fixed before proceeding\n */\n export type Severity = \"error\" | \"warning\";\n\n /**\n * When to _first_ start caring about a validation of a data-val.\n *\n * load - only check once the first time the binding appears on screen\n * change - check anytime the data changes\n * navigation - check once the user attempts to navigate away from a view\n */\n export type Trigger = \"navigation\" | \"change\" | \"load\";\n\n /**\n * Where the error/warning should be displayed.\n * - `field` is the default display target. This renders the error/warning directly underneath the field.\n * - `section` is used to display a message at a parent node that is designated as a \"section\"\n * - `page` a special section used to display a message at the top of the page.\n */\n export type DisplayTarget = \"page\" | \"section\" | \"field\";\n\n /** A reference to a validation object */\n export interface Reference {\n /**\n * The name of the referenced validation type\n * This will be used to lookup the proper handler\n */\n type: string;\n\n /** An optional means of overriding the default message if the validation is triggered */\n message?: string;\n\n /** An optional means of overriding the default severity of the validation if triggered */\n severity?: Severity;\n\n /** When to run this particular validation */\n trigger?: Trigger;\n\n /**\n * Each validation is passed the value of the data to run it's validation against.\n * By default, this is the value stored in the data-model (deformatted).\n * In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option\n */\n dataTarget?: \"formatted\" | \"deformatted\";\n\n /** Where the error should be displayed */\n displayTarget?: DisplayTarget;\n\n /**\n * If the validation blocks navigation\n * true/false - always/never block navigation\n * once - only block navigation if the validation has not been triggered before\n *\n * @default - true for errors, 'once' for warnings\n */\n blocking?: boolean | \"once\";\n\n /** Additional props to send down to a Validator */\n [key: string]: unknown;\n }\n\n export interface CrossfieldReference extends Reference {\n /** The binding to associate this validation with */\n ref?: Binding;\n\n /** Cross-field references and validation must run against the default (deformatted) value */\n dataTarget?: never;\n }\n}\n\nexport type View<T extends Asset = Asset> = unknown extends T[\"validation\"]\n ? T & {\n /** Each view can optionally supply a list of validations to run against a particular view */\n validation?: Array<Validation.CrossfieldReference>;\n }\n : T;\n\n/**\n * The JSON payload for running Player\n */\nexport interface Flow<T extends Asset = Asset> {\n /** A unique identifier for the flow */\n id: string;\n\n /** A list of views (each with an ID) that can be shown to a user */\n views?: Array<View<T>>;\n\n /**\n * The schema for the supplied (or referenced data).\n * This is used for validation, formatting, etc\n */\n schema?: Schema.Schema;\n\n /** Any initial data that the flow can use */\n data?: DataModel;\n\n /** A state machine to drive a user through the experience */\n navigation: Navigation;\n\n /** Other keys can be present. We just don't know what they are */\n [key: string]: unknown;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/types/src/index.ts"],"sourcesContent":["/**\n * An asset is the smallest unit of user interaction in a player view\n */\nexport interface Asset<T extends string = string> {\n /** Each asset requires a unique id per view */\n id: string;\n\n /** The asset type determines the semantics of how a user interacts with a page */\n type: T;\n\n [key: string]: unknown;\n}\n/**\n * An asset that contains a Binding.\n */\nexport interface AssetBinding extends Asset {\n /** A binding that points to somewhere in the data model */\n binding: Binding;\n}\n\n/** A single case statement to use in a switch */\nexport interface SwitchCase<T extends Asset = Asset> {\n /** The Asset to use if this case is applicable */\n asset: T;\n\n /** An expression to execute to determine if this case applies */\n case: Expression | true;\n}\n\n/** A switch can replace an asset with the applicable case on first render */\nexport type Switch<T extends Asset = Asset> = SwitchCase<T>[];\n\n/** An object that contains an asset */\nexport type AssetWrapper<T extends Asset = Asset> = {\n /** An asset instance */\n asset: T;\n\n [key: string]: unknown;\n};\n\nexport type AssetWrapperOrSwitch<T extends Asset = Asset> =\n | (AssetWrapper<T> & {\n /** The dynamicSwitch property can't exist at the same time as 'asset' */\n dynamicSwitch?: never;\n\n /** The staticSwitch property can't exist at the same time as 'asset' */\n staticSwitch?: never;\n })\n | (StaticSwitch<T> & {\n /** The staticSwitch property can't exist at the same time as 'asset' */\n asset?: never;\n\n /** The staticSwitch property can't exist at the same time as 'dynamicSwitch' */\n dynamicSwitch?: never;\n })\n | (DynamicSwitch<T> & {\n /** The dynamicSwitch property can't exist at the same time as 'asset' */\n asset?: never;\n\n /** The dynamicSwitch property can't exist at the same time as 'staticSwitch' */\n staticSwitch?: never;\n });\n\nexport type AssetSwitch<T extends Asset = Asset> =\n | StaticSwitch<T>\n | DynamicSwitch<T>;\n\nexport interface StaticSwitch<T extends Asset = Asset> {\n /** A static switch only evaluates the applicable base on first render of the view */\n staticSwitch: Switch<T>;\n}\n\nexport interface DynamicSwitch<T extends Asset = Asset> {\n /** A dynamic switch re-evaluates the applicable case as data changes */\n dynamicSwitch: Switch<T>;\n}\n\n/**\n * Expressions are a specialized way of executing code.\n * If the expression is a composite, the last expression executed is the return value\n */\nexport type Expression = string | string[];\nexport type ExpressionRef = `@[${string}]@`;\n\n/**\n * Bindings describe locations in the data model.\n */\nexport type Binding = string;\nexport type BindingRef = `{{${Binding}}}`;\n\n/**\n * The data-model is the location that all user data is stored\n */\nexport type DataModel = Record<any, unknown>;\n\n/** The navigation section of the flow describes a State Machine for the user. */\nexport type Navigation = {\n /** The name of the Flow to begin on */\n BEGIN: string;\n} & Record<string, string | NavigationFlow>;\n\n/** An object with an expression in it */\nexport interface ExpressionObject {\n /** The expression to run */\n exp?: Expression;\n}\n\n/** A state machine in the navigation */\nexport interface NavigationFlow {\n /** The first state to kick off the state machine */\n startState: string;\n\n /** An optional expression to run when this Flow starts */\n onStart?: Expression | ExpressionObject;\n\n /** An optional expression to run when this Flow ends */\n onEnd?: Expression | ExpressionObject;\n\n [key: string]:\n | undefined\n | string\n | Expression\n | ExpressionObject\n | NavigationFlowState;\n}\n\nexport type NavigationFlowTransition = Record<string, string>;\n\ninterface CommentBase {\n /** Add comments that will not be processing, but are useful for code explanation */\n _comment?: string;\n}\n\n/** The base representation of a state within a Flow */\nexport interface NavigationBaseState<T extends string> extends CommentBase {\n /** A property to determine the type of state this is */\n state_type: T;\n\n /** An optional expression to run when this view renders */\n onStart?: Expression | ExpressionObject;\n\n /** An optional expression to run before view transition */\n onEnd?: Expression | ExpressionObject;\n\n /**\n * TS gets really confused with both the ActionState and the onStart state both declaring the `exp` property\n * So this explicity says there should never be an exp prop on a state node that's not of type 'ACTION'\n */\n exp?: T extends \"ACTION\" | \"ASYNC_ACTION\" ? Expression : never;\n}\n\n/** A generic state that can transition to another state */\nexport interface NavigationFlowTransitionableState<T extends string>\n extends NavigationBaseState<T> {\n /** A mapping of transition-name to FlowState name */\n transitions: NavigationFlowTransition;\n}\n\n/** A state representing a view */\nexport interface NavigationFlowViewState\n extends NavigationFlowTransitionableState<\"VIEW\"> {\n /** An id corresponding to a view from the 'views' array */\n ref: string;\n\n /** View meta-properties */\n attributes?: {\n [key: string]: any;\n };\n\n /** Any additional properties are forwarded as options, like param */\n [key: string]: unknown;\n}\n\n/**\n * An END state of the flow.\n */\nexport interface NavigationFlowEndState extends NavigationBaseState<\"END\"> {\n /**\n * A description of _how_ the flow ended.\n * If this is a flow started from another flow, the outcome determines the flow transition\n */\n outcome: string;\n\n /** Any additional properties are forwarded as options, like param */\n [key: string]: unknown;\n}\n\n/** Action states execute an expression to determine the next state to transition to */\nexport interface NavigationFlowActionState\n extends NavigationFlowTransitionableState<\"ACTION\"> {\n /**\n * An expression to execute.\n * The return value determines the transition to take\n */\n exp: Expression;\n}\n\n/** Action states execute an expression to determine the next state to transition to */\nexport interface NavigationFlowAsyncActionState\n extends NavigationFlowTransitionableState<\"ASYNC_ACTION\"> {\n /**\n * An expression to execute.\n * The return value determines the transition to take\n */\n exp: Expression;\n\n /** Whether the expression(s) should be awaited before transitioning */\n await: boolean;\n}\n\n/**\n * External Flow states represent states in the FSM that can't be resolved internally in Player.\n * The flow will wait for the embedded application to manage moving to the next state via a transition\n */\nexport interface NavigationFlowExternalState\n extends NavigationFlowTransitionableState<\"EXTERNAL\"> {\n /** A reference for this external state */\n ref: string;\n /** Any additional properties are forwarded as options */\n [key: string]: unknown;\n}\n\nexport interface NavigationFlowFlowState\n extends NavigationFlowTransitionableState<\"FLOW\"> {\n /** A reference to a FLOW id state to run */\n ref: string;\n}\n\nexport type NavigationFlowState =\n | NavigationFlowViewState\n | NavigationFlowEndState\n | NavigationFlowFlowState\n | NavigationFlowActionState\n | NavigationFlowAsyncActionState\n | NavigationFlowExternalState;\n\n/** The data at the end of a flow */\nexport interface FlowResult {\n /** The outcome describes _how_ the flow ended (forwards, backwards, etc) */\n endState: NavigationFlowEndState;\n\n /** The serialized data-model */\n data?: any;\n}\n\n/** Any object that contains 1 or more templates */\nexport interface Templatable {\n /** A list of templates to process for this node */\n template?: Template[];\n}\n\n/** A template describes a mapping from a data array -> array of objects */\nexport interface Template<ValueType = unknown, Key extends string = string> {\n /** A pointer to the data-model containing an array of elements to map over */\n data: Binding;\n\n /**\n * The template to iterate over using each value in the supplied template data.\n * Any reference to _index_ is replaced with the current iteration index.\n */\n value: ValueType;\n\n /** should the template be recomputed when data changes */\n dynamic?: boolean;\n\n /**\n * A property on the parent object to store the new map under.\n * If it already exists, values are appended to the end.\n */\n output: Key;\n\n /** Specifies the template placement in relation to existing elements*/\n placement?: \"prepend\" | \"append\";\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\n/**\n * The Schema organizes all content related to Data and it's types\n */\nexport declare namespace Schema {\n /** The authored schema object in the JSON payload */\n export interface Schema {\n /** The ROOT object is the top level object to use */\n ROOT: Node;\n\n /** Any additional keys are properties of the ROOT object */\n [key: string]: Node;\n }\n\n /** A Node describes a specific object in the tree */\n export interface Node {\n /** Each property describes a property of the object */\n [key: string]: DataTypes;\n }\n\n export type DataTypes = DataType | RecordType | ArrayType;\n\n /** Each prop in the object can have a specific DataType */\n export interface DataType<T = unknown> {\n /** The reference of the base type to use */\n type: string;\n\n /**\n * Any additional validations that are associated with this property\n * These will add to any base validations associated with the \"type\"\n */\n validation?: Validation.Reference[];\n\n /**\n * A reference to a specific data format to use.\n * If none is specified, will fallback to that of the base type\n */\n format?: Formatting.Reference;\n\n /**\n * A default value for this property.\n * Any reads for this property will result in this default value being written to the model.\n */\n default?: T;\n\n /** Any additional options */\n [key: string]: unknown;\n }\n /** Determines if the Datatype is a record object */\n export interface RecordType extends DataType {\n /** boolean to define if its a record */\n isRecord: boolean;\n\n /** This property is mutually exclusive with RecordType and can not be used with ArrayType */\n isArray?: never;\n }\n\n /** Determines if the DataType is an Array Object */\n export interface ArrayType extends DataType {\n /** boolean to define if its an array */\n isArray: boolean;\n\n /** This property is mutually exclusive with ArrayType and can not be used with RecordType */\n isRecord?: never;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\n/** Namespace to wrap up core functionality to be used by the Language Service */\nexport declare namespace Language {\n /**\n * Helper to compliment `Schema.DataType` to provide a way to export a reference to a data type instead of the whole object\n */\n export interface DataTypeRef {\n /** Name of the type in Player Core */\n type: string;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\n/** A spot for formatting */\nexport declare namespace Formatting {\n /** A reference to a specific formatter */\n export interface Reference {\n /** The name of the formatter (and de-formatter) to use */\n type: string;\n\n /** Any additional properties will be passed as options to the formatter function */\n [key: string]: unknown;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\n/** A space for all thing validation */\nexport declare namespace Validation {\n /**\n * How serious are you about this error?\n * Warning validations are reserved for errors that could be ignored by the user without consequence\n * Errors must be fixed before proceeding\n */\n export type Severity = \"error\" | \"warning\";\n\n /**\n * When to _first_ start caring about a validation of a data-val.\n *\n * load - only check once the first time the binding appears on screen\n * change - check anytime the data changes\n * navigation - check once the user attempts to navigate away from a view\n */\n export type Trigger = \"navigation\" | \"change\" | \"load\";\n\n /**\n * Where the error/warning should be displayed.\n * - `field` is the default display target. This renders the error/warning directly underneath the field.\n * - `section` is used to display a message at a parent node that is designated as a \"section\"\n * - `page` a special section used to display a message at the top of the page.\n */\n export type DisplayTarget = \"page\" | \"section\" | \"field\";\n\n /** A reference to a validation object */\n export interface Reference {\n /**\n * The name of the referenced validation type\n * This will be used to lookup the proper handler\n */\n type: string;\n\n /** An optional means of overriding the default message if the validation is triggered */\n message?: string;\n\n /** An optional means of overriding the default severity of the validation if triggered */\n severity?: Severity;\n\n /** When to run this particular validation */\n trigger?: Trigger;\n\n /**\n * Each validation is passed the value of the data to run it's validation against.\n * By default, this is the value stored in the data-model (deformatted).\n * In the off chance you'd like this validator to run against the formatted value (the one the user sees), set this option\n */\n dataTarget?: \"formatted\" | \"deformatted\";\n\n /** Where the error should be displayed */\n displayTarget?: DisplayTarget;\n\n /**\n * If the validation blocks navigation\n * true/false - always/never block navigation\n * once - only block navigation if the validation has not been triggered before\n *\n * @default - true for errors, 'once' for warnings\n */\n blocking?: boolean | \"once\";\n\n /** Additional props to send down to a Validator */\n [key: string]: unknown;\n }\n\n export interface CrossfieldReference extends Reference {\n /** The binding to associate this validation with */\n ref?: Binding;\n\n /** Cross-field references and validation must run against the default (deformatted) value */\n dataTarget?: never;\n }\n}\n\nexport type View<T extends Asset = Asset> = unknown extends T[\"validation\"]\n ? T & {\n /** Each view can optionally supply a list of validations to run against a particular view */\n validation?: Array<Validation.CrossfieldReference>;\n }\n : T;\n\n/**\n * The JSON payload for running Player\n */\nexport interface Flow<T extends Asset = Asset> {\n /** A unique identifier for the flow */\n id: string;\n\n /** A list of views (each with an ID) that can be shown to a user */\n views?: Array<View<T>>;\n\n /**\n * The schema for the supplied (or referenced data).\n * This is used for validation, formatting, etc\n */\n schema?: Schema.Schema;\n\n /** Any initial data that the flow can use */\n data?: DataModel;\n\n /** A state machine to drive a user through the experience */\n navigation: Navigation;\n\n /** Other keys can be present. We just don't know what they are */\n [key: string]: unknown;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -2114,6 +2114,134 @@
2114
2114
  "title": "NavigationFlowActionState",
2115
2115
  "description": "Action states execute an expression to determine the next state to transition to"
2116
2116
  },
2117
+ {
2118
+ "source": "core/types/src/index.ts",
2119
+ "name": "NavigationFlowAsyncActionState",
2120
+ "type": "object",
2121
+ "properties": {
2122
+ "_comment": {
2123
+ "required": false,
2124
+ "node": {
2125
+ "type": "string",
2126
+ "title": "CommentBase._comment",
2127
+ "description": "Add comments that will not be processing, but are useful for code explanation"
2128
+ }
2129
+ },
2130
+ "state_type": {
2131
+ "required": true,
2132
+ "node": {
2133
+ "type": "string",
2134
+ "const": "ASYNC_ACTION",
2135
+ "title": "NavigationBaseState.state_type",
2136
+ "description": "A property to determine the type of state this is"
2137
+ }
2138
+ },
2139
+ "onStart": {
2140
+ "required": false,
2141
+ "node": {
2142
+ "type": "or",
2143
+ "or": [
2144
+ {
2145
+ "type": "ref",
2146
+ "ref": "Expression",
2147
+ "title": "NavigationBaseState.onStart"
2148
+ },
2149
+ {
2150
+ "source": "core/types/src/index.ts",
2151
+ "name": "ExpressionObject",
2152
+ "type": "object",
2153
+ "properties": {
2154
+ "exp": {
2155
+ "required": false,
2156
+ "node": {
2157
+ "type": "ref",
2158
+ "ref": "Expression",
2159
+ "title": "ExpressionObject.exp",
2160
+ "description": "The expression to run"
2161
+ }
2162
+ }
2163
+ },
2164
+ "additionalProperties": false,
2165
+ "title": "ExpressionObject",
2166
+ "description": "An object with an expression in it"
2167
+ }
2168
+ ],
2169
+ "title": "NavigationBaseState.onStart",
2170
+ "description": "An optional expression to run when this view renders"
2171
+ }
2172
+ },
2173
+ "onEnd": {
2174
+ "required": false,
2175
+ "node": {
2176
+ "type": "or",
2177
+ "or": [
2178
+ {
2179
+ "type": "ref",
2180
+ "ref": "Expression",
2181
+ "title": "NavigationBaseState.onEnd"
2182
+ },
2183
+ {
2184
+ "source": "core/types/src/index.ts",
2185
+ "name": "ExpressionObject",
2186
+ "type": "object",
2187
+ "properties": {
2188
+ "exp": {
2189
+ "required": false,
2190
+ "node": {
2191
+ "type": "ref",
2192
+ "ref": "Expression",
2193
+ "title": "ExpressionObject.exp",
2194
+ "description": "The expression to run"
2195
+ }
2196
+ }
2197
+ },
2198
+ "additionalProperties": false,
2199
+ "title": "ExpressionObject",
2200
+ "description": "An object with an expression in it"
2201
+ }
2202
+ ],
2203
+ "title": "NavigationBaseState.onEnd",
2204
+ "description": "An optional expression to run before view transition"
2205
+ }
2206
+ },
2207
+ "exp": {
2208
+ "required": true,
2209
+ "node": {
2210
+ "type": "ref",
2211
+ "ref": "Expression",
2212
+ "title": "NavigationFlowAsyncActionState.exp",
2213
+ "description": "An expression to execute.\nThe return value determines the transition to take"
2214
+ }
2215
+ },
2216
+ "transitions": {
2217
+ "required": true,
2218
+ "node": {
2219
+ "source": "core/types/src/index.ts",
2220
+ "name": "NavigationFlowTransition",
2221
+ "type": "record",
2222
+ "keyType": {
2223
+ "type": "string"
2224
+ },
2225
+ "valueType": {
2226
+ "type": "string"
2227
+ },
2228
+ "title": "NavigationFlowTransitionableState.transitions",
2229
+ "description": "A mapping of transition-name to FlowState name"
2230
+ }
2231
+ },
2232
+ "await": {
2233
+ "required": true,
2234
+ "node": {
2235
+ "type": "boolean",
2236
+ "title": "NavigationFlowAsyncActionState.await",
2237
+ "description": "Whether the expression(s) should be awaited before transitioning"
2238
+ }
2239
+ }
2240
+ },
2241
+ "additionalProperties": false,
2242
+ "title": "NavigationFlowAsyncActionState",
2243
+ "description": "Action states execute an expression to determine the next state to transition to"
2244
+ },
2117
2245
  {
2118
2246
  "source": "core/types/src/index.ts",
2119
2247
  "name": "NavigationFlowExternalState",
@@ -640,6 +640,134 @@
640
640
  "title": "NavigationFlowActionState",
641
641
  "description": "Action states execute an expression to determine the next state to transition to"
642
642
  },
643
+ {
644
+ "source": "core/types/src/index.ts",
645
+ "name": "NavigationFlowAsyncActionState",
646
+ "type": "object",
647
+ "properties": {
648
+ "_comment": {
649
+ "required": false,
650
+ "node": {
651
+ "type": "string",
652
+ "title": "CommentBase._comment",
653
+ "description": "Add comments that will not be processing, but are useful for code explanation"
654
+ }
655
+ },
656
+ "state_type": {
657
+ "required": true,
658
+ "node": {
659
+ "type": "string",
660
+ "const": "ASYNC_ACTION",
661
+ "title": "NavigationBaseState.state_type",
662
+ "description": "A property to determine the type of state this is"
663
+ }
664
+ },
665
+ "onStart": {
666
+ "required": false,
667
+ "node": {
668
+ "type": "or",
669
+ "or": [
670
+ {
671
+ "type": "ref",
672
+ "ref": "Expression",
673
+ "title": "NavigationBaseState.onStart"
674
+ },
675
+ {
676
+ "source": "core/types/src/index.ts",
677
+ "name": "ExpressionObject",
678
+ "type": "object",
679
+ "properties": {
680
+ "exp": {
681
+ "required": false,
682
+ "node": {
683
+ "type": "ref",
684
+ "ref": "Expression",
685
+ "title": "ExpressionObject.exp",
686
+ "description": "The expression to run"
687
+ }
688
+ }
689
+ },
690
+ "additionalProperties": false,
691
+ "title": "ExpressionObject",
692
+ "description": "An object with an expression in it"
693
+ }
694
+ ],
695
+ "title": "NavigationBaseState.onStart",
696
+ "description": "An optional expression to run when this view renders"
697
+ }
698
+ },
699
+ "onEnd": {
700
+ "required": false,
701
+ "node": {
702
+ "type": "or",
703
+ "or": [
704
+ {
705
+ "type": "ref",
706
+ "ref": "Expression",
707
+ "title": "NavigationBaseState.onEnd"
708
+ },
709
+ {
710
+ "source": "core/types/src/index.ts",
711
+ "name": "ExpressionObject",
712
+ "type": "object",
713
+ "properties": {
714
+ "exp": {
715
+ "required": false,
716
+ "node": {
717
+ "type": "ref",
718
+ "ref": "Expression",
719
+ "title": "ExpressionObject.exp",
720
+ "description": "The expression to run"
721
+ }
722
+ }
723
+ },
724
+ "additionalProperties": false,
725
+ "title": "ExpressionObject",
726
+ "description": "An object with an expression in it"
727
+ }
728
+ ],
729
+ "title": "NavigationBaseState.onEnd",
730
+ "description": "An optional expression to run before view transition"
731
+ }
732
+ },
733
+ "exp": {
734
+ "required": true,
735
+ "node": {
736
+ "type": "ref",
737
+ "ref": "Expression",
738
+ "title": "NavigationFlowAsyncActionState.exp",
739
+ "description": "An expression to execute.\nThe return value determines the transition to take"
740
+ }
741
+ },
742
+ "transitions": {
743
+ "required": true,
744
+ "node": {
745
+ "source": "core/types/src/index.ts",
746
+ "name": "NavigationFlowTransition",
747
+ "type": "record",
748
+ "keyType": {
749
+ "type": "string"
750
+ },
751
+ "valueType": {
752
+ "type": "string"
753
+ },
754
+ "title": "NavigationFlowTransitionableState.transitions",
755
+ "description": "A mapping of transition-name to FlowState name"
756
+ }
757
+ },
758
+ "await": {
759
+ "required": true,
760
+ "node": {
761
+ "type": "boolean",
762
+ "title": "NavigationFlowAsyncActionState.await",
763
+ "description": "Whether the expression(s) should be awaited before transitioning"
764
+ }
765
+ }
766
+ },
767
+ "additionalProperties": false,
768
+ "title": "NavigationFlowAsyncActionState",
769
+ "description": "Action states execute an expression to determine the next state to transition to"
770
+ },
643
771
  {
644
772
  "source": "core/types/src/index.ts",
645
773
  "name": "NavigationFlowExternalState",
@@ -98,8 +98,17 @@
98
98
  "ref": "T"
99
99
  },
100
100
  "right": {
101
- "type": "string",
102
- "const": "ACTION"
101
+ "type": "or",
102
+ "or": [
103
+ {
104
+ "type": "string",
105
+ "const": "ACTION"
106
+ },
107
+ {
108
+ "type": "string",
109
+ "const": "ASYNC_ACTION"
110
+ }
111
+ ]
103
112
  }
104
113
  },
105
114
  "value": {
@@ -610,6 +610,134 @@
610
610
  "title": "NavigationFlowActionState",
611
611
  "description": "Action states execute an expression to determine the next state to transition to"
612
612
  },
613
+ {
614
+ "source": "core/types/src/index.ts",
615
+ "name": "NavigationFlowAsyncActionState",
616
+ "type": "object",
617
+ "properties": {
618
+ "_comment": {
619
+ "required": false,
620
+ "node": {
621
+ "type": "string",
622
+ "title": "CommentBase._comment",
623
+ "description": "Add comments that will not be processing, but are useful for code explanation"
624
+ }
625
+ },
626
+ "state_type": {
627
+ "required": true,
628
+ "node": {
629
+ "type": "string",
630
+ "const": "ASYNC_ACTION",
631
+ "title": "NavigationBaseState.state_type",
632
+ "description": "A property to determine the type of state this is"
633
+ }
634
+ },
635
+ "onStart": {
636
+ "required": false,
637
+ "node": {
638
+ "type": "or",
639
+ "or": [
640
+ {
641
+ "type": "ref",
642
+ "ref": "Expression",
643
+ "title": "NavigationBaseState.onStart"
644
+ },
645
+ {
646
+ "source": "core/types/src/index.ts",
647
+ "name": "ExpressionObject",
648
+ "type": "object",
649
+ "properties": {
650
+ "exp": {
651
+ "required": false,
652
+ "node": {
653
+ "type": "ref",
654
+ "ref": "Expression",
655
+ "title": "ExpressionObject.exp",
656
+ "description": "The expression to run"
657
+ }
658
+ }
659
+ },
660
+ "additionalProperties": false,
661
+ "title": "ExpressionObject",
662
+ "description": "An object with an expression in it"
663
+ }
664
+ ],
665
+ "title": "NavigationBaseState.onStart",
666
+ "description": "An optional expression to run when this view renders"
667
+ }
668
+ },
669
+ "onEnd": {
670
+ "required": false,
671
+ "node": {
672
+ "type": "or",
673
+ "or": [
674
+ {
675
+ "type": "ref",
676
+ "ref": "Expression",
677
+ "title": "NavigationBaseState.onEnd"
678
+ },
679
+ {
680
+ "source": "core/types/src/index.ts",
681
+ "name": "ExpressionObject",
682
+ "type": "object",
683
+ "properties": {
684
+ "exp": {
685
+ "required": false,
686
+ "node": {
687
+ "type": "ref",
688
+ "ref": "Expression",
689
+ "title": "ExpressionObject.exp",
690
+ "description": "The expression to run"
691
+ }
692
+ }
693
+ },
694
+ "additionalProperties": false,
695
+ "title": "ExpressionObject",
696
+ "description": "An object with an expression in it"
697
+ }
698
+ ],
699
+ "title": "NavigationBaseState.onEnd",
700
+ "description": "An optional expression to run before view transition"
701
+ }
702
+ },
703
+ "exp": {
704
+ "required": true,
705
+ "node": {
706
+ "type": "ref",
707
+ "ref": "Expression",
708
+ "title": "NavigationFlowAsyncActionState.exp",
709
+ "description": "An expression to execute.\nThe return value determines the transition to take"
710
+ }
711
+ },
712
+ "transitions": {
713
+ "required": true,
714
+ "node": {
715
+ "source": "core/types/src/index.ts",
716
+ "name": "NavigationFlowTransition",
717
+ "type": "record",
718
+ "keyType": {
719
+ "type": "string"
720
+ },
721
+ "valueType": {
722
+ "type": "string"
723
+ },
724
+ "title": "NavigationFlowTransitionableState.transitions",
725
+ "description": "A mapping of transition-name to FlowState name"
726
+ }
727
+ },
728
+ "await": {
729
+ "required": true,
730
+ "node": {
731
+ "type": "boolean",
732
+ "title": "NavigationFlowAsyncActionState.await",
733
+ "description": "Whether the expression(s) should be awaited before transitioning"
734
+ }
735
+ }
736
+ },
737
+ "additionalProperties": false,
738
+ "title": "NavigationFlowAsyncActionState",
739
+ "description": "Action states execute an expression to determine the next state to transition to"
740
+ },
613
741
  {
614
742
  "source": "core/types/src/index.ts",
615
743
  "name": "NavigationFlowExternalState",
@@ -0,0 +1,128 @@
1
+ {
2
+ "source": "core/types/src/index.ts",
3
+ "name": "NavigationFlowAsyncActionState",
4
+ "type": "object",
5
+ "properties": {
6
+ "_comment": {
7
+ "required": false,
8
+ "node": {
9
+ "type": "string",
10
+ "title": "CommentBase._comment",
11
+ "description": "Add comments that will not be processing, but are useful for code explanation"
12
+ }
13
+ },
14
+ "state_type": {
15
+ "required": true,
16
+ "node": {
17
+ "type": "string",
18
+ "const": "ASYNC_ACTION",
19
+ "title": "NavigationBaseState.state_type",
20
+ "description": "A property to determine the type of state this is"
21
+ }
22
+ },
23
+ "onStart": {
24
+ "required": false,
25
+ "node": {
26
+ "type": "or",
27
+ "or": [
28
+ {
29
+ "type": "ref",
30
+ "ref": "Expression",
31
+ "title": "NavigationBaseState.onStart"
32
+ },
33
+ {
34
+ "source": "core/types/src/index.ts",
35
+ "name": "ExpressionObject",
36
+ "type": "object",
37
+ "properties": {
38
+ "exp": {
39
+ "required": false,
40
+ "node": {
41
+ "type": "ref",
42
+ "ref": "Expression",
43
+ "title": "ExpressionObject.exp",
44
+ "description": "The expression to run"
45
+ }
46
+ }
47
+ },
48
+ "additionalProperties": false,
49
+ "title": "ExpressionObject",
50
+ "description": "An object with an expression in it"
51
+ }
52
+ ],
53
+ "title": "NavigationBaseState.onStart",
54
+ "description": "An optional expression to run when this view renders"
55
+ }
56
+ },
57
+ "onEnd": {
58
+ "required": false,
59
+ "node": {
60
+ "type": "or",
61
+ "or": [
62
+ {
63
+ "type": "ref",
64
+ "ref": "Expression",
65
+ "title": "NavigationBaseState.onEnd"
66
+ },
67
+ {
68
+ "source": "core/types/src/index.ts",
69
+ "name": "ExpressionObject",
70
+ "type": "object",
71
+ "properties": {
72
+ "exp": {
73
+ "required": false,
74
+ "node": {
75
+ "type": "ref",
76
+ "ref": "Expression",
77
+ "title": "ExpressionObject.exp",
78
+ "description": "The expression to run"
79
+ }
80
+ }
81
+ },
82
+ "additionalProperties": false,
83
+ "title": "ExpressionObject",
84
+ "description": "An object with an expression in it"
85
+ }
86
+ ],
87
+ "title": "NavigationBaseState.onEnd",
88
+ "description": "An optional expression to run before view transition"
89
+ }
90
+ },
91
+ "exp": {
92
+ "required": true,
93
+ "node": {
94
+ "type": "ref",
95
+ "ref": "Expression",
96
+ "title": "NavigationFlowAsyncActionState.exp",
97
+ "description": "An expression to execute.\nThe return value determines the transition to take"
98
+ }
99
+ },
100
+ "transitions": {
101
+ "required": true,
102
+ "node": {
103
+ "source": "core/types/src/index.ts",
104
+ "name": "NavigationFlowTransition",
105
+ "type": "record",
106
+ "keyType": {
107
+ "type": "string"
108
+ },
109
+ "valueType": {
110
+ "type": "string"
111
+ },
112
+ "title": "NavigationFlowTransitionableState.transitions",
113
+ "description": "A mapping of transition-name to FlowState name"
114
+ }
115
+ },
116
+ "await": {
117
+ "required": true,
118
+ "node": {
119
+ "type": "boolean",
120
+ "title": "NavigationFlowAsyncActionState.await",
121
+ "description": "Whether the expression(s) should be awaited before transitioning"
122
+ }
123
+ }
124
+ },
125
+ "additionalProperties": false,
126
+ "title": "NavigationFlowAsyncActionState",
127
+ "description": "Action states execute an expression to determine the next state to transition to"
128
+ }
@@ -496,6 +496,134 @@
496
496
  "title": "NavigationFlowActionState",
497
497
  "description": "Action states execute an expression to determine the next state to transition to"
498
498
  },
499
+ {
500
+ "source": "core/types/src/index.ts",
501
+ "name": "NavigationFlowAsyncActionState",
502
+ "type": "object",
503
+ "properties": {
504
+ "_comment": {
505
+ "required": false,
506
+ "node": {
507
+ "type": "string",
508
+ "title": "CommentBase._comment",
509
+ "description": "Add comments that will not be processing, but are useful for code explanation"
510
+ }
511
+ },
512
+ "state_type": {
513
+ "required": true,
514
+ "node": {
515
+ "type": "string",
516
+ "const": "ASYNC_ACTION",
517
+ "title": "NavigationBaseState.state_type",
518
+ "description": "A property to determine the type of state this is"
519
+ }
520
+ },
521
+ "onStart": {
522
+ "required": false,
523
+ "node": {
524
+ "type": "or",
525
+ "or": [
526
+ {
527
+ "type": "ref",
528
+ "ref": "Expression",
529
+ "title": "NavigationBaseState.onStart"
530
+ },
531
+ {
532
+ "source": "core/types/src/index.ts",
533
+ "name": "ExpressionObject",
534
+ "type": "object",
535
+ "properties": {
536
+ "exp": {
537
+ "required": false,
538
+ "node": {
539
+ "type": "ref",
540
+ "ref": "Expression",
541
+ "title": "ExpressionObject.exp",
542
+ "description": "The expression to run"
543
+ }
544
+ }
545
+ },
546
+ "additionalProperties": false,
547
+ "title": "ExpressionObject",
548
+ "description": "An object with an expression in it"
549
+ }
550
+ ],
551
+ "title": "NavigationBaseState.onStart",
552
+ "description": "An optional expression to run when this view renders"
553
+ }
554
+ },
555
+ "onEnd": {
556
+ "required": false,
557
+ "node": {
558
+ "type": "or",
559
+ "or": [
560
+ {
561
+ "type": "ref",
562
+ "ref": "Expression",
563
+ "title": "NavigationBaseState.onEnd"
564
+ },
565
+ {
566
+ "source": "core/types/src/index.ts",
567
+ "name": "ExpressionObject",
568
+ "type": "object",
569
+ "properties": {
570
+ "exp": {
571
+ "required": false,
572
+ "node": {
573
+ "type": "ref",
574
+ "ref": "Expression",
575
+ "title": "ExpressionObject.exp",
576
+ "description": "The expression to run"
577
+ }
578
+ }
579
+ },
580
+ "additionalProperties": false,
581
+ "title": "ExpressionObject",
582
+ "description": "An object with an expression in it"
583
+ }
584
+ ],
585
+ "title": "NavigationBaseState.onEnd",
586
+ "description": "An optional expression to run before view transition"
587
+ }
588
+ },
589
+ "exp": {
590
+ "required": true,
591
+ "node": {
592
+ "type": "ref",
593
+ "ref": "Expression",
594
+ "title": "NavigationFlowAsyncActionState.exp",
595
+ "description": "An expression to execute.\nThe return value determines the transition to take"
596
+ }
597
+ },
598
+ "transitions": {
599
+ "required": true,
600
+ "node": {
601
+ "source": "core/types/src/index.ts",
602
+ "name": "NavigationFlowTransition",
603
+ "type": "record",
604
+ "keyType": {
605
+ "type": "string"
606
+ },
607
+ "valueType": {
608
+ "type": "string"
609
+ },
610
+ "title": "NavigationFlowTransitionableState.transitions",
611
+ "description": "A mapping of transition-name to FlowState name"
612
+ }
613
+ },
614
+ "await": {
615
+ "required": true,
616
+ "node": {
617
+ "type": "boolean",
618
+ "title": "NavigationFlowAsyncActionState.await",
619
+ "description": "Whether the expression(s) should be awaited before transitioning"
620
+ }
621
+ }
622
+ },
623
+ "additionalProperties": false,
624
+ "title": "NavigationFlowAsyncActionState",
625
+ "description": "Action states execute an expression to determine the next state to transition to"
626
+ },
499
627
  {
500
628
  "source": "core/types/src/index.ts",
501
629
  "name": "NavigationFlowExternalState",
@@ -98,8 +98,17 @@
98
98
  "ref": "T"
99
99
  },
100
100
  "right": {
101
- "type": "string",
102
- "const": "ACTION"
101
+ "type": "or",
102
+ "or": [
103
+ {
104
+ "type": "string",
105
+ "const": "ACTION"
106
+ },
107
+ {
108
+ "type": "string",
109
+ "const": "ASYNC_ACTION"
110
+ }
111
+ ]
103
112
  }
104
113
  },
105
114
  "value": {
@@ -21,6 +21,7 @@ const NavigationFlowTransitionableState = require("./NavigationFlowTransitionabl
21
21
  const NavigationFlowViewState = require("./NavigationFlowViewState.json")
22
22
  const NavigationFlowEndState = require("./NavigationFlowEndState.json")
23
23
  const NavigationFlowActionState = require("./NavigationFlowActionState.json")
24
+ const NavigationFlowAsyncActionState = require("./NavigationFlowAsyncActionState.json")
24
25
  const NavigationFlowExternalState = require("./NavigationFlowExternalState.json")
25
26
  const NavigationFlowFlowState = require("./NavigationFlowFlowState.json")
26
27
  const NavigationFlowState = require("./NavigationFlowState.json")
@@ -33,7 +34,7 @@ const Flow = require("./Flow.json")
33
34
  module.exports = {
34
35
  "pluginName": "Types",
35
36
  "capabilities": {
36
- "Types":[Asset,AssetBinding,SwitchCase,Switch,AssetWrapper,AssetWrapperOrSwitch,AssetSwitch,StaticSwitch,DynamicSwitch,Expression,ExpressionRef,Binding,BindingRef,DataModel,Navigation,ExpressionObject,NavigationFlow,NavigationFlowTransition,NavigationBaseState,NavigationFlowTransitionableState,NavigationFlowViewState,NavigationFlowEndState,NavigationFlowActionState,NavigationFlowExternalState,NavigationFlowFlowState,NavigationFlowState,FlowResult,Templatable,Template,View,Flow],
37
+ "Types":[Asset,AssetBinding,SwitchCase,Switch,AssetWrapper,AssetWrapperOrSwitch,AssetSwitch,StaticSwitch,DynamicSwitch,Expression,ExpressionRef,Binding,BindingRef,DataModel,Navigation,ExpressionObject,NavigationFlow,NavigationFlowTransition,NavigationBaseState,NavigationFlowTransitionableState,NavigationFlowViewState,NavigationFlowEndState,NavigationFlowActionState,NavigationFlowAsyncActionState,NavigationFlowExternalState,NavigationFlowFlowState,NavigationFlowState,FlowResult,Templatable,Template,View,Flow],
37
38
  },
38
39
  "customPrimitives": [
39
40
  "Expression","Asset","Binding","AssetWrapper","Schema.DataType","ExpressionHandler"
@@ -25,6 +25,7 @@
25
25
  "NavigationFlowViewState",
26
26
  "NavigationFlowEndState",
27
27
  "NavigationFlowActionState",
28
+ "NavigationFlowAsyncActionState",
28
29
  "NavigationFlowExternalState",
29
30
  "NavigationFlowFlowState",
30
31
  "NavigationFlowState",
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "types"
7
7
  ],
8
8
  "name": "@player-ui/types",
9
- "version": "0.12.1-next.0",
9
+ "version": "0.13.0-next.0",
10
10
  "main": "dist/cjs/index.cjs",
11
11
  "module": "dist/index.legacy-esm.js",
12
12
  "types": "types/index.d.ts",
package/src/index.ts CHANGED
@@ -146,7 +146,7 @@ export interface NavigationBaseState<T extends string> extends CommentBase {
146
146
  * TS gets really confused with both the ActionState and the onStart state both declaring the `exp` property
147
147
  * So this explicity says there should never be an exp prop on a state node that's not of type 'ACTION'
148
148
  */
149
- exp?: T extends "ACTION" ? Expression : never;
149
+ exp?: T extends "ACTION" | "ASYNC_ACTION" ? Expression : never;
150
150
  }
151
151
 
152
152
  /** A generic state that can transition to another state */
@@ -195,6 +195,19 @@ export interface NavigationFlowActionState
195
195
  exp: Expression;
196
196
  }
197
197
 
198
+ /** Action states execute an expression to determine the next state to transition to */
199
+ export interface NavigationFlowAsyncActionState
200
+ extends NavigationFlowTransitionableState<"ASYNC_ACTION"> {
201
+ /**
202
+ * An expression to execute.
203
+ * The return value determines the transition to take
204
+ */
205
+ exp: Expression;
206
+
207
+ /** Whether the expression(s) should be awaited before transitioning */
208
+ await: boolean;
209
+ }
210
+
198
211
  /**
199
212
  * External Flow states represent states in the FSM that can't be resolved internally in Player.
200
213
  * The flow will wait for the embedded application to manage moving to the next state via a transition
@@ -218,6 +231,7 @@ export type NavigationFlowState =
218
231
  | NavigationFlowEndState
219
232
  | NavigationFlowFlowState
220
233
  | NavigationFlowActionState
234
+ | NavigationFlowAsyncActionState
221
235
  | NavigationFlowExternalState;
222
236
 
223
237
  /** The data at the end of a flow */
package/types/index.d.ts CHANGED
@@ -107,7 +107,7 @@ export interface NavigationBaseState<T extends string> extends CommentBase {
107
107
  * TS gets really confused with both the ActionState and the onStart state both declaring the `exp` property
108
108
  * So this explicity says there should never be an exp prop on a state node that's not of type 'ACTION'
109
109
  */
110
- exp?: T extends "ACTION" ? Expression : never;
110
+ exp?: T extends "ACTION" | "ASYNC_ACTION" ? Expression : never;
111
111
  }
112
112
  /** A generic state that can transition to another state */
113
113
  export interface NavigationFlowTransitionableState<T extends string> extends NavigationBaseState<T> {
@@ -145,6 +145,16 @@ export interface NavigationFlowActionState extends NavigationFlowTransitionableS
145
145
  */
146
146
  exp: Expression;
147
147
  }
148
+ /** Action states execute an expression to determine the next state to transition to */
149
+ export interface NavigationFlowAsyncActionState extends NavigationFlowTransitionableState<"ASYNC_ACTION"> {
150
+ /**
151
+ * An expression to execute.
152
+ * The return value determines the transition to take
153
+ */
154
+ exp: Expression;
155
+ /** Whether the expression(s) should be awaited before transitioning */
156
+ await: boolean;
157
+ }
148
158
  /**
149
159
  * External Flow states represent states in the FSM that can't be resolved internally in Player.
150
160
  * The flow will wait for the embedded application to manage moving to the next state via a transition
@@ -159,7 +169,7 @@ export interface NavigationFlowFlowState extends NavigationFlowTransitionableSta
159
169
  /** A reference to a FLOW id state to run */
160
170
  ref: string;
161
171
  }
162
- export type NavigationFlowState = NavigationFlowViewState | NavigationFlowEndState | NavigationFlowFlowState | NavigationFlowActionState | NavigationFlowExternalState;
172
+ export type NavigationFlowState = NavigationFlowViewState | NavigationFlowEndState | NavigationFlowFlowState | NavigationFlowActionState | NavigationFlowAsyncActionState | NavigationFlowExternalState;
163
173
  /** The data at the end of a flow */
164
174
  export interface FlowResult {
165
175
  /** The outcome describes _how_ the flow ended (forwards, backwards, etc) */