Customize the payload sent to a function by a DataSource


I’ve a type on which I defined a function, something like in MyType.c3typ:

type MyType {
  . . .
  doWork: function(id: !string) double js server

In MyType.js I’ve:

function doWork(id) {
  . . .
  return ..;

Then I expose this function in a data source MyType.c3ui:

ui module MyTypeModule {
  dataSource MyTypeDataSource {
    "collection": false,
    "record": true,
    "cache": false,
    "c3type": "MyType",
    "c3function": "doWork",
    "responseSelector": "data",
    "responseTransform": {
        "firstItem": true
    "c3arguments": {
      'id': {{ }}

When the data source is called from ui, on the console I see the following exception:

C3.js:300 Uncaught TypeError: Cannot set property 'id' of undefined
    at Object.setDescendantProp (C3.js:300)
    at UpdateEnergyManagementDashboard.addValue (UpdateDataSourceFromSelect.js:310)
    at UpdateEnergyManagementDashboard.<anonymous> (UpdateEnergyManagementDashboard.js:86)
    at lodash.custom.js:506
    at Function.forEach (lodash.custom.js:2328)
    at UpdateEnergyManagementDashboard.dispatch (UpdateEnergyManagementDashboard.js:57)
    at UpdateEnergyManagementDashboard.execute (Action.js:186)
    at Dashboard.<anonymous> (Component.js:2473)
    at triggerEvents (backbone.js:207)
    at SelectField.trigger (backbone.js:148)

It seems it is trying to add the selected id to a spec object, and the workaround would be to change my function signature to accept a json that wraps the field id.

Question: Is there a way to customize the payload passed to my function? (I don’t want ‘spec’ and a field ‘id’ set automatically by the UpdateDataSourceFromSelect action)



Right now, both UpdateDataSourceFromSelect action and UpdateEnergyManagementDashboard action require a middle level between the c3arguments and the field to update.