Skip to content

Interface: SyncFormulaDef<K, L, ParamDefsT, SchemaT>

core.SyncFormulaDef

Inputs for creating the formula that implements a sync table.

Type parameters

Name Type
K extends string
L extends string
ParamDefsT extends ParamDefs
SchemaT extends ObjectSchemaDefinition<K, L>

Hierarchy

SyncFormulaDef

Properties

cacheTtlSecs

Optional Readonly cacheTtlSecs: number

How long formulas running with the same values should cache their results for.

Inherited from

CommonPackFormulaDef.cacheTtlSecs

Defined in

api_types.ts:440


connectionRequirement

Optional Readonly connectionRequirement: ConnectionRequirement

Does this formula require a connection (aka an account)?

Inherited from

CommonPackFormulaDef.connectionRequirement

Defined in

api_types.ts:432


description

Readonly description: string

A brief description of what the formula does.

Inherited from

CommonPackFormulaDef.description

Defined in

api_types.ts:406


examples

Optional Readonly examples: { params: (undefined | PackFormulaValue)[] ; result: PackFormulaResult }[]

Sample inputs and outputs demonstrating usage of this formula.

Inherited from

CommonPackFormulaDef.examples

Defined in

api_types.ts:421


extraOAuthScopes

Optional Readonly extraOAuthScopes: string[]

OAuth scopes that the formula needs that weren't requested in the pack's overall authentication config. For example, a Slack pack can have one formula that needs admin privileges, but non-admins can use the bulk of the pack without those privileges. Coda will give users help in understanding that they need additional authentication to use a formula with extra OAuth scopes. Note that these scopes will always be requested in addition to the default scopes for the pack, so an end user must have both sets of permissions.

Inherited from

CommonPackFormulaDef.extraOAuthScopes

Defined in

api_types.ts:462


isAction

Optional Readonly isAction: boolean

Does this formula take an action (vs retrieve data or make a calculation)? Actions are presented as buttons in the Coda UI.

Inherited from

CommonPackFormulaDef.isAction

Defined in

api_types.ts:427


isExperimental

Optional Readonly isExperimental: boolean

If specified, the formula will not be suggested to users in Coda's formula autocomplete. The formula can still be invoked by manually typing its full name.

Inherited from

CommonPackFormulaDef.isExperimental

Defined in

api_types.ts:446


isSystem

Optional Readonly isSystem: boolean

Whether this is a formula that will be used by Coda internally and not exposed directly to users. Not for use by packs that are not authored by Coda.

Inherited from

CommonPackFormulaDef.isSystem

Defined in

api_types.ts:452


maxUpdateBatchSize

Optional maxUpdateBatchSize: number

If the table supports object updates, the maximum number of objects that will be sent to the pack in a single batch. Defaults to 1 if not specified.

Defined in

api.ts:1108


name

Readonly name: string

The name of the formula, used to invoke it.

Inherited from

CommonPackFormulaDef.name

Defined in

api_types.ts:401


network

Optional Readonly network: Network

Deprecated

use isAction and connectionRequirement instead

Inherited from

CommonPackFormulaDef.network

Defined in

api_types.ts:435


parameters

Readonly parameters: ParamDefsT

The parameter inputs to the formula, if any.

Inherited from

CommonPackFormulaDef.parameters

Defined in

api_types.ts:411


varargParameters

Optional Readonly varargParameters: ParamDefs

Variable argument parameters, used if this formula should accept arbitrary numbers of inputs.

Inherited from

CommonPackFormulaDef.varargParameters

Defined in

api_types.ts:416

Methods

execute

execute(params, context): Promise<SyncFormulaResult<K, L, SchemaT>>

The JavaScript function that implements this sync.

This function takes in parameters and a sync context which may have a continuation from a previous invocation, and fetches and returns one page of results, as well as another continuation if there are more result to fetch.

Parameters

Name Type
params ParamValues<ParamDefsT>
context SyncExecutionContext

Returns

Promise<SyncFormulaResult<K, L, SchemaT>>

Defined in

api.ts:1103


executeUpdate

Optional executeUpdate(params, updates, context): Promise<SyncUpdateResult<K, L, SchemaT>>

The JavaScript function that implements this sync update if the table supports updates.

This function takes in parameters, updated sync table objects, and a sync context, and is responsible for pushing those updated objects to the external system then returning the new state of each object.

Parameters

Name Type
params ParamValues<ParamDefsT>
updates SyncUpdate<K, L, SchemaT>[]
context UpdateSyncExecutionContext

Returns

Promise<SyncUpdateResult<K, L, SchemaT>>

Defined in

api.ts:1116