Add a command xo transform to transform input values between different different forms.
Embedded v8 engines:
We should wait until we have the UI together to get an idea of what the inputs/API might look like, but an example would be:
xo start-deployment > deployment.json
xo transform \
--deployment=deployment.json \
--dest-schema=schema-params
NOTE: the deployment being returned from startDeployment will have the schemaName as a field alongside the params field.
xo transform will take end-user params and the name of the schema the user submitted and run a mapper.js file in the embedded v8 engine to convert to the proper params for --dest-schema.
An example:
Using a guided config, we might ask about write throughput rather than RAM size for redis... but our main schema (schema-params.json) takes a "memory" parameter.
params-data.json
{
"records_per_second": 100,
"average_record_size_in_kb": 1024
}
`some-neophyte-schema.json`
```json
{
"properties": {
"records_per_second": {"type": "integer"},
"average_record_size_in_kb": {"type": "integer"},
}
}
schema-params.json
{
"properties": {
"memory": {"type": "integer"}
}
}
A mapper.js file will be written by a bundle author:
mapper.js
// some boilerplate
export default function(data, src, dest) {
// razzle dazzle magic
return records_per_second * average_record_size_in_kb
}
Add a command
xo transformto transform input values between different different forms.Embedded v8 engines:
We should wait until we have the UI together to get an idea of what the inputs/API might look like, but an example would be:
xo start-deployment > deployment.json xo transform \ --deployment=deployment.json \ --dest-schema=schema-paramsNOTE: the deployment being returned from startDeployment will have the
schemaNameas a field alongside theparamsfield.xo transformwill take end-user params and the name of the schema the user submitted and run amapper.jsfile in the embedded v8 engine to convert to the proper params for--dest-schema.An example:
Using a guided config, we might ask about write throughput rather than RAM size for redis... but our main schema (schema-params.json) takes a "memory" parameter.
params-data.json{ "records_per_second": 100, "average_record_size_in_kb": 1024 } `some-neophyte-schema.json` ```json { "properties": { "records_per_second": {"type": "integer"}, "average_record_size_in_kb": {"type": "integer"}, } }schema-params.json{ "properties": { "memory": {"type": "integer"} } }A mapper.js file will be written by a bundle author:
mapper.js