InteractiveQuery / FilterDSL
FieldResolver
Default field resolver implementation for js object graphs.
FilterDSL
The automaton filter DSL creates object graphs representations of filter expressions that can be evaluated as SQL, on Java objects and on JavaScript objects.
.not(operand)
Logical not condition.
Parameters
Name | Type | Description |
---|---|---|
operand | ConditionNode |
Return Value
Type: ConditionNodenegated condition
.or(operands)
Logical or condition. Will remove null conditions
Parameters
Name | Type | Description |
---|---|---|
operands | ... ConditionNode |
Return Value
Type: ConditionNodeORed condition
.and(operands)
Logical or condition. Will ignore falsy operands.
Parameters
Name | Type | Description |
---|---|---|
operands | ... ConditionNode |
Return Value
Type: ConditionNodeORed condition
.condition(name, operands)
General Condition node. Useful for programmatically instantiating conditions. Not needed for fluent style conditions.
Parameters
Name | Type | Description |
---|---|---|
name | String | condition name |
operands | Array<ConditionNode> | operands |
Return Value
Type: ConditionNodeNo description
.field(name)
Field / column reference.
Parameters
Name | Type | Description |
---|---|---|
name | String | field name (e.g. "name", "owner.name") |
Return Value
Type: FieldNo description
.component(id, condition)
Component condition node. These nodes are just marker for which part of the condition originated from which component Logically they are evaluated as the condition they wrap.
Parameters
Name | Type | Description |
---|---|---|
id | String | component id |
condition | ConditionNode | actual condition for component |
Return Value
Type: ConditionNodeNo description
.value(value)
Creates a new value node
Parameters
Name | Type | Description |
---|---|---|
value | Object | scalar value of appropriate type |
.values(type, values)
Creates a new values node that encapsulates a collection of scalar values (for e.g. the IN operator)
Parameters
Name | Type | Description |
---|---|---|
type | String | scalar type name |
values | Object | var args of scalar value of appropriate type |
Return Value
Type: Valuesvalues node
.getConditionArgCount(name)
Returns the number of expected arguments for the condition with the given name.
Parameters
Name | Type | Description |
---|---|---|
name | String | condition name |
Return Value
Type: numbernumber of value arguments expected
.isLogicalCondition(node)
Returns true if the given condition node is either a logical and or a logical or condition.
Parameters
Name | Type | Description |
---|---|---|
node | Object | node |
Return Value
Type: booleantrue if the node is either an "and" or an "or"
.findComponentNode(conditionNode, id)
Finds a component node with the given id.
Parameters
Name | Type | Description |
---|---|---|
conditionNode | Object | condition structure root |
id | String | component id |
Return Value
Type: Object | nullcomponent node or `null`
FilterDSL.Type
Enum object containting the node types
Type | Description |
---|---|
FIELD | field / column reference |
CONDITION | Condition node |
VALUE | Value node |
VALUES | Values node (for .in()) |
OPERATION | field operation |
COMPONENT | component marker |
InteractiveQuery
Client-side implementation of the InteractiveQuery mechanism. Meant to be registered for all concrete types created for de.quinscape.automaton.model.data.InteractiveQuery
.rows()
Current result rows of the base type
.queryConfig()
Query config object used to create this query
.columnStates()
Array of column states for this query
.rowCount()
Total number of rows available for pagination
.setQueryConfig(config)
Set the new queryConfig without mobx printing warnings. This is supposed to be only called from the inside.
Parameters
Name | Type | Description |
---|---|---|
config | Object | the new query configuration |
.update(queryConfig)
Updates the current iQuery base on a new query config. The given query config is merged with the current config so you only need to define the changes. Examples: ```js // page to second page iQuery.update({offset: 10}) // sorty by name descending iQuery.update({ sortFields: [ "!name" ] }) ```
Parameters
Name | Type | Description |
---|---|---|
queryConfig | Object | query config structure (see de.quinscape.automaton.model.data.QueryConfig) |
Return Value
Type: Promise<* | never>No description
.updateCondition(componentCondition)
Updates a component condition in the current query config state. If no component node is found, the current condition if present will be ANDed with the component condition
Parameters
Name | Type | Description |
---|---|---|
componentCondition | Object | condition node |
.separate(result, varName)
Extracts a new independent iQuery object with a new Query containing only the selections for that iQuery.
Parameters
Name | Type | Description |
---|---|---|
result | Object | multi iQuery result object |
varName | String | variable name of this query in the original query |
compareConditions(a, b, compareValueNodes)
Does a deep-comparison between two conditions
Parameters
Name | Type | Description |
---|---|---|
a | ConditionNode | condition node A |
b | ConditionNode | condition node B |
compareValueNodes | boolean | compare the value of value nodes (default = false) |
Return Value
Type: booleantrue if the conditions are equal (ignoring values)
createMockedQuery(format, type, payload)
Creates a mocked query that returns a single constant result. If you need filtering or pagination on your mock, use createFilteredMockQuery
Parameters
Name | Type | Description |
---|---|---|
format | ------ | wire format |
type | String | iQuery container type |
payload | Object | function | constant iQuery result to return from the mocked query or function producing a result from given variables |
Return Value
Type: GraphQLQuerymocked query object.
evaluateMemoryQuery(format, cachedDocument, queryConfig)
Filters a given cached iQuery document according to the give query config object.
Parameters
Name | Type | Description |
---|---|---|
format | ------ | WireFormat instance |
cachedDocument | ------ | cached iQuery document containing all data |
queryConfig | ------ | QueryConfig instance |
filterTransformer(condition, resolverFactory)
Filter transformer function that transforms a condition as JSON object to an executable JS function.
Parameters
Name | Type | Description |
---|---|---|
condition | Object | JSON condition map |
resolverFactory | Function | function that creates a field resolver function for a given field name ( name => { return () => f(name) } ) |
getFirstValue(m)
Returns the first value from an object.
Parameters
Name | Type | Description |
---|---|---|
m | object | js object |
updateComponentCondition(compositeCondition, componentCondition)
Updates a logical condition composed of component conditions with a new condition for one of the components.
Parameters
Name | Type | Description |
---|---|---|
compositeCondition | Object | logical condition composed of component conditions. |
componentCondition | Object | new component condition |