libs/ngx-pfe/pfe-service-activator/mapper/mapper.model.ts
Properties |
|
| conditions |
conditions:
|
Type : ExpressionCondition[]
|
| Optional |
ExpressionCondition SyntaxThe conditions use jsonPath (https://github.com/dchester/jsonpath) expressions to select data from the state. There is tooling support available to create and test jsonpath expression. The PFE dev tools also contain a possibility to test and debug expressions against a JSON. The conditions to be evaluated can either be an array of ExpressionCondition or an ConditionAdvanced object. They are an optional attribute. If they are omitted, the result of true is assumed. The selected data can then be compared with certain operators to a second value or a literal. Possible operators are Checks if the two values are equal. Checks that the two values are not equal. Compares the numerical value, to check if one of them is larger or smaller than the other one. The jsonpath syntax has the following basic format: For example: Keys, that contain special characters can be accessed in the following way: Example configuration. |
| responseDataExpression |
responseDataExpression:
|
Type : JsonPathExpression
|
|
Jsonpath expression to extract data from the retrieved service activator response. |
| stateKeyExpression |
stateKeyExpression:
|
Type : JsonPathExpression
|
|
The jsonpath expression, where the retrieved data should be stored in the state. It is possible, to access deeply nested structures in this expression. Parts to the structure, that do not yet exist, are automatically created. If $ is used as expression, a spread of the responseData on the state is done |
| useHTTPResponseAsData |
useHTTPResponseAsData:
|
Type : boolean
|
| Optional |
|
Use the http response instead of the body as source for the responseDataExpression. Allows access to the HttpResponse @link{https://angular.io/api/common/http/HttpResponse} which also contains the http headers and status code. Example Expressions: Get the HTTP Status: Access the response body of a successful call: Access the response body in an error case: |
import { JsonPathExpression } from '../../models/jsonpath-expression-type.model';
import { Conditions, ExpressionCondition } from '../../pfe-conditions/public-api';
/**
* @internal
* Internal use only - this interface is not part of the public API and may change without notice
*/
export interface PfeResponseToStateMapperOptions {
mapUndefinedResponses?: boolean;
}
export interface ServiceActivatorDataMappingForRequesting {
/**
* The local state object to get mapped into the request.
* this is the "FROM" part of the Mapping
* (From the State > To the Request)
*/
stateKeyExpression: JsonPathExpression;
/**
* How to be addressed into the request.
* This is the "TO" part of the Mapping
* (From the State > To the Request)
*/
requestDataExpression: JsonPathExpression;
/**
* # ExpressionCondition Syntax
*
* The conditions use jsonPath (https://github.com/dchester/jsonpath) expressions to select data from the state.
* There is tooling support available to create and test jsonpath expression.
* The PFE dev tools also contain a possibility to test and debug expressions against a JSON.
*
* The conditions to be evaluated can either be an array of {@link ExpressionCondition} or an {@link ConditionAdvanced} object.
*
* They are an optional attribute. If they are omitted, the result of true is assumed.
*
* The selected data can then be compared with certain operators to a second value or a literal.
*
* Possible operators are
*
* ```
* ==
* ```
* Checks if the two values are equal.
*
* ```
* !=
* ```
* Checks that the two values are not equal.
*
* ```
* < and >
* ```
* Compares the numerical value, to check if one of them is larger or
* smaller than the other one.
*
* The jsonpath syntax has the following basic format:
*
* ```
* $.<attribute or expression>
* ```
*
* For example:
*
* ```
* $.myCustomTextAreaID
* ```
*
* Keys, that contain special characters can be accessed in the following way:
*
* ```
* $['some-attribute-name']
* ```
*
* Example configuration.
*
*
* ```json
* "requestDataMapping": [
{
"requestDataExpression": "$.licenseplate",
"stateKeyExpression": "$.userdata.insuredProperty.licensePlate",
"conditions": [{
"expression": "{$.booleanValueInTheState}"
}]
}
]
* ```
*/
conditions?: Conditions;
}
export interface ServiceActivatorDataMapping {
/**
* The jsonpath expression, where the retrieved data should
* be stored in the state.
*
* It is possible, to access deeply nested structures in this expression.
* Parts to the structure, that do not yet exist, are automatically created.
*
* If $ is used as expression, a spread of the responseData on the state is done
*/
stateKeyExpression: JsonPathExpression;
/**
* Jsonpath expression to extract data from the retrieved service
* activator response.
*/
responseDataExpression: JsonPathExpression;
/**
* Use the http response instead of the body as source for
* the responseDataExpression.
* Allows access to the HttpResponse @link{https://angular.io/api/common/http/HttpResponse}
* which also contains the http headers and status code.
*
* Example Expressions:
* Get the HTTP Status:
* ```
* $.status
* ```
*
* Access the response body of a successful call:
* ```
* $.body
* ```
*
* Access the response body in an error case:
* ```
* $.error
* ```
*/
useHTTPResponseAsData?: boolean;
/**
* # ExpressionCondition Syntax
*
* The conditions use jsonPath (https://github.com/dchester/jsonpath) expressions to select data from the state.
* There is tooling support available to create and test jsonpath expression.
* The PFE dev tools also contain a possibility to test and debug expressions against a JSON.
*
* The conditions to be evaluated can either be an array of {@link ExpressionCondition} or an {@link ConditionAdvanced} object.
*
* They are an optional attribute. If they are omitted, the result of true is assumed.
*
* The selected data can then be compared with certain operators to a second value or a literal.
*
* Possible operators are
*
* ```
* ==
* ```
* Checks if the two values are equal.
*
* ```
* !=
* ```
* Checks that the two values are not equal.
*
* ```
* < and >
* ```
* Compares the numerical value, to check if one of them is larger or
* smaller than the other one.
*
* The jsonpath syntax has the following basic format:
*
* ```
* $.<attribute or expression>
* ```
*
* For example:
*
* ```
* $.myCustomTextAreaID
* ```
*
* Keys, that contain special characters can be accessed in the following way:
*
* ```
* $['some-attribute-name']
* ```
*
* Example configuration.
*
*
* ```json
* "responseDataMapping": [
{
"responseDataExpression": "$.response",
"stateKeyExpression": "$.response.localObject",
"conditions": [{
"expression": "{$.booleanValueInTheState}"
}]
},
* ```
*/
conditions?: ExpressionCondition[];
}