Skip to content

Interface: BaseFormulaDef<ParamDefsT, ResultT>

core.BaseFormulaDef

Base type for formula definitions accepted by makeFormula.

Type parameters

Name Type
ParamDefsT extends ParamDefs
ResultT extends string | number | boolean | object

Hierarchy

BaseFormulaDef

Properties

cacheTtlSecs

Optional Readonly cacheTtlSecs: number

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

Inherited from

PackFormulaDef.cacheTtlSecs

Defined in

api_types.ts:472


connectionRequirement

Optional Readonly connectionRequirement: ConnectionRequirement

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

Inherited from

PackFormulaDef.connectionRequirement

Defined in

api_types.ts:464


description

Readonly description: string

A brief description of what the formula does.

Inherited from

PackFormulaDef.description

Defined in

api_types.ts:438


examples

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

Sample inputs and outputs demonstrating usage of this formula.

Inherited from

PackFormulaDef.examples

Defined in

api_types.ts:453


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

PackFormulaDef.extraOAuthScopes

Defined in

api_types.ts:494


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

PackFormulaDef.isAction

Defined in

api_types.ts:459


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

PackFormulaDef.isExperimental

Defined in

api_types.ts:478


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

PackFormulaDef.isSystem

Defined in

api_types.ts:484


name

Readonly name: string

The name of the formula, used to invoke it.

Inherited from

PackFormulaDef.name

Defined in

api_types.ts:433


network

Optional Readonly network: Network

Deprecated

use isAction and connectionRequirement instead

Inherited from

PackFormulaDef.network

Defined in

api_types.ts:467


parameters

Readonly parameters: ParamDefsT

The parameter inputs to the formula, if any.

Inherited from

PackFormulaDef.parameters

Defined in

api_types.ts:443


varargParameters

Optional Readonly varargParameters: ParamDefs

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

Inherited from

PackFormulaDef.varargParameters

Defined in

api_types.ts:448

Methods

execute

execute(params, context): ResultT | Promise<ResultT>

The JavaScript function that implements this formula

Parameters

Name Type
params ParamValues<ParamDefsT>
context ExecutionContext

Returns

ResultT | Promise<ResultT>

Inherited from

PackFormulaDef.execute

Defined in

api.ts:872


onError

Optional onError(error): any

If specified, will catch errors in the execute function and call this function with the error, instead of letting them throw and the formula failing.

This is helpful for writing common error handling into a singular helper function that can then be applied to many different formulas in a pack.

Parameters

Name Type
error Error

Returns

any

Defined in

api.ts:1515