Our latest release of the Packs SDK allows you to create better sync tables and test more of your code locally. Keep reading to learn how you can leverage these features in your own Packs.
Column display names
The column names in a sync table arise from a somewhat roundabout process:
- You define property keys in your schema
- Coda transforms them into property names appropriate for the formula editor
- Coda then transforms those into a human-readable column names
While all of these automatic transformations are convenient, they can occasionally lead to some odd columns names. For example: iPhone_version
→ IPhoneVersion
→ I phone version
.
To give Pack makers more control over their column names we’ve introduced a new field, displayName
, that let’s you explicitly define what the column name should be for that property:
iPhone_version: {
type: coda.ValueType.String,
displayName: "iPhone version",
},
This feature is especially useful for sync tables that use dynamic schemas to sync custom fields, as those fields often have names that contain punctuation and other special characters that can get lost in the normal transformation process.
You can learn more about the displayName
field and how to use it in the Schemas guide.
Executing metadata functions locally
While the majority of the code in a Pack is contained within the execute
function of the building blocks, there can be a fair amount of other code scattered about that generates important metadata. For example, an autocomplete
function of a parameter, or the listDynamicUrls
function of a dynamic sync table.
Previously there was no easy way to run and test this code when developing locally using the Packs CLI, but in this release of the SDK we’ve extended the coda execute
command to support these metadata functions as well.
For example to execute the autocomplete
function of the greeting parameter in the Hello formula you could run:
npx coda execute src/pack.ts Hello:autocomplete:greeting
To fully test the code you can pass a search string and the value of other parameters as additional command line arguments.
To learn more about this feature and how to use it to test other types of metadata functions refer to the Using the CLI guide.
If you have any questions or comments about these features, or have feature requests you’d like us to know about, drop us a comment below.