Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xo transform #5

Open
coryodaniel opened this issue Jan 12, 2021 · 0 comments
Open

xo transform #5

coryodaniel opened this issue Jan 12, 2021 · 0 comments
Assignees

Comments

@coryodaniel
Copy link
Member

coryodaniel commented Jan 12, 2021

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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants