Changeset View
Changeset View
Standalone View
Standalone View
lib/app/base-chips/field-types/settable-by.js
module.exports = app => ({ | module.exports = app => ({ | ||||
name: "settable-by", | name: "settable-by", | ||||
encode: function(context, params, new_value, old_value) { | encode(context, params, new_value, old_value) { | ||||
return params.target_field_type.encode( | return params.target_field_type.encode( | ||||
context, | context, | ||||
params, | params, | ||||
new_value, | new_value, | ||||
old_value | old_value | ||||
); | ); | ||||
}, | }, | ||||
is_proper_value: async function( | async is_proper_value( | ||||
context, | context, | ||||
{ target_field_type, target_params = {}, access_strategy_description }, | { target_field_type, target_params = {}, access_strategy_description }, | ||||
new_value, | new_value, | ||||
old_value | old_value | ||||
) { | ) { | ||||
const access_strategy = new app.Sealious.AccessStrategy( | const access_strategy = new app.Sealious.AccessStrategy( | ||||
app, | app, | ||||
access_strategy_description | access_strategy_description | ||||
); | ); | ||||
await access_strategy.check(context); | await access_strategy.check(context); | ||||
return target_field_type.is_proper_value( | return target_field_type.is_proper_value( | ||||
context, | context, | ||||
target_params, | target_params, | ||||
new_value, | new_value, | ||||
old_value | old_value | ||||
); | ); | ||||
}, | }, | ||||
format: function( | format( | ||||
context, | context, | ||||
{ target_field_type, target_params }, | { target_field_type, target_params }, | ||||
decode_value, | decode_value, | ||||
format | format | ||||
) { | ) { | ||||
return target_field_type.format( | return target_field_type.format( | ||||
context, | context, | ||||
target_params, | target_params, | ||||
decode_value, | decode_value, | ||||
format | format | ||||
); | ); | ||||
}, | }, | ||||
filter_to_query: function( | filter_to_query(context, { target_field_type, target_params }, filter) { | ||||
context, | |||||
{ target_field_type, target_params }, | |||||
filter | |||||
) { | |||||
return target_field_type.filter_to_query( | return target_field_type.filter_to_query( | ||||
context, | context, | ||||
target_params, | target_params, | ||||
filter | filter | ||||
); | ); | ||||
}, | }, | ||||
get_aggregation_stages: function( | get_aggregation_stages( | ||||
context, | context, | ||||
{ target_field_type, target_params }, | { target_field_type, target_params }, | ||||
field_name, | field_name, | ||||
field_value_path, | field_value_path, | ||||
query_params | query_params | ||||
) { | ) { | ||||
return target_field_type.get_aggregation_stages( | return target_field_type.get_aggregation_stages( | ||||
context, | context, | ||||
target_params, | target_params, | ||||
field_name, | field_name, | ||||
field_value_path, | field_value_path, | ||||
query_params | query_params | ||||
); | ); | ||||
}, | }, | ||||
has_index: function({ target_field_type, target_params }) { | has_index({ target_field_type, target_params }) { | ||||
return target_field_type.has_index(target_params); | return target_field_type.has_index(target_params); | ||||
}, | }, | ||||
}); | }); |