Interface: DynamicSyncTableOptions<K, L, ParamDefsT, SchemaT>¶
core.DynamicSyncTableOptions
Options provided when defining a dynamic sync table.
Type parameters¶
Name | Type |
---|---|
K |
extends string |
L |
extends string |
ParamDefsT |
extends ParamDefs |
SchemaT |
extends ObjectSchemaDefinition <K , L > |
Properties¶
connectionRequirement¶
• Optional
connectionRequirement: ConnectionRequirement
A ConnectionRequirement that will be used for all formulas contained within this sync table (including autocomplete formulas).
Defined in¶
defaultAddDynamicColumns¶
• Optional
defaultAddDynamicColumns: boolean
Default is true.
If false, when subsequent syncs discover new schema properties, these properties will not automatically be added as new columns on the table. The user can still manually add columns for these new properties. This only applies to tables that use dynamic schemas.
When tables with dynamic schemas are synced, the getSchema formula is run each time, which may return a schema that is different than that from the last sync. The default behavior is that any schema properties that are new in this sync are automatically added as new columns, so they are apparent to the user. However, in rare cases when schemas change frequently, this can cause the number of columns to grow quickly and become overwhelming. Setting this value to false leaves the columns unchanged and puts the choice of what columns to display into the hands of the user.
Defined in¶
description¶
• Optional
description: string
The description of the dynamic sync table. This is shown to users in the Coda UI when listing what build blocks are contained within this pack. This should describe what the dynamic sync table does in a more detailed language.
Defined in¶
entityName¶
• Optional
entityName: string
A label for the kind of entities that you are syncing. This label is used in a doc to identify
the column in this table that contains the synced data. If you don't provide an entityName
, the value
of identity.name
from your schema will be used instead, so in most cases you don't need to provide this.
Defined in¶
formula¶
• formula: SyncFormulaDef
<K
, L
, ParamDefsT
, SchemaT
>
The definition of the formula that implements this sync. This is a Coda packs formula
that returns an array of objects fitting the given schema and optionally a Continuation.
(The name is redundant and should be the same as the name
parameter here.
These will eventually be consolidated.)
Defined in¶
getDisplayUrl¶
• getDisplayUrl: MetadataFormulaDef
A formula that that returns a browser-friendly url representing the
resource being synced. The Coda UI links to this url as the source
of the table data. This is typically a browser-friendly form of the
dynamicUrl
, which is typically an API url.
Defined in¶
getName¶
• getName: MetadataFormulaDef
A formula that returns the name of this table.
Defined in¶
getSchema¶
• getSchema: MetadataFormulaDef
A formula that returns the schema for this table.
Defined in¶
identityName¶
• identityName: string
See identityName for an introduction.
Every dynamic schema generated from this dynamic sync table definition should all use the same name for their identity. Code that refers to objects in these tables will use the dynamicUrl to differentiate which exact table to use.
Defined in¶
listDynamicUrls¶
• Optional
listDynamicUrls: MetadataFormulaDef
A formula that returns a list of available dynamic urls that can be used to create an instance of this dynamic sync table.
Defined in¶
name¶
• name: string
The name of the dynamic sync table. This is shown to users in the Coda UI
when listing what build blocks are contained within this pack.
This should describe the category of entities being synced. The actual
table name once added to the doc will be dynamic, it will be whatever value
is returned by the getName
formula.
Defined in¶
placeholderSchema¶
• Optional
placeholderSchema: SchemaT
Optional placeholder schema before the dynamic schema is retrieved.
If defaultAddDynamicColumns
is false, only featured columns
in placeholderSchema will be rendered by default after the sync.
Defined in¶
propertyOptions¶
• Optional
propertyOptions: PropertyOptionsMetadataFunction
<any
>
An options function to use for any dynamic schema properties. The name of the property that's being modified by the doc editor is available in the option function's context parameter.
Example
coda.makeDynamicSyncTable({
name: "MySyncTable",
getSchema: async function (context) => {
return coda.makeObjectSchema({
properties: {
dynamicPropertyName: {
type: coda.ValueType.String,
codaType: coda.ValueHintType.SelectList,
mutable: true,
options: coda.OptionsType.Dynamic,
},
},
});
},
propertyOptions: async function (context) => {
if (context.propertyName === "dynamicPropertyName") {
return ["Dynamic Value 1", "Dynamic value 2"];
}
throw new coda.UserVisibleError(
`Cannot generate options for property ${context.propertyName}`
);
},
...
Defined in¶
searchDynamicUrls¶
• Optional
searchDynamicUrls: MetadataFormulaDef
A formula that returns a list of available dynamic urls that match a given search query that can be used to create an instance of this dynamic sync table.