Appearance
Interface: AppContext<Config>
Everything a call runs with. The host functions are synchronous from here: the host does the work while the module waits, so ctx.http(...) answers at once.
Type Parameters
Config
Config = unknown
Properties
ai
ts
ai: AppAi;The models of the install's vendors (AppAi), for an action's call: a webhook's and a hand-off's calls ask none (ctx.ai throws an AiError there).
cache
ts
cache: AppCache;Values kept between the calls of the install (AppCache): fetch a vendor's token once, then read it from here until it expires or the vendor refuses it.
callbackUrl?
ts
optional callbackUrl?: string;Where the vendor must send webhooks for this app, when the deployment exposes one.
callId
ts
callId: string;config
ts
config: Config;The install's configuration, parsed with the manifest's configSchema (defaults applied).
documents
ts
documents: object;The tenant's clean documents, for a call through an install that reads them: the app needs documents and the install's switch (documentsFromConfig), when it has one, is on. A call of a run's step or a rule reads its subject's documents only; webhook and hand-off calls read none. Any other read throws an AppError.
read()
ts
read(documentId): AppDocument;Parameters
documentId
string
Returns
idempotencyKey?
ts
optional idempotencyKey?: string;Stable key for the logical call, the same across retries, when the caller gave one.
log
ts
log: AppLogger;tenantId
ts
tenantId: string;Methods
hmac()
ts
hmac(request): string;Parameters
request
Returns
string
hmacVerify()
ts
hmacVerify(request): boolean;Parameters
request
Returns
boolean
http()
ts
http(request): HttpResponse;Sends one request through the host and answers whatever status the vendor gave. Throws an HttpNetworkError when it failed in transit, and an AppError when the host refused it.
Parameters
request
Returns
secret()
ts
secret(name): `{{secret:${string}:${string}}}`;The placeholder for a secret of the install in this call's requests (SecretPlaceholder): the host fills it, and the module never sees the value. It carries the call's secret tag, so it fills in this call only; keep it out of logs and answers. Throws for a name that is no secret's (a letter, then up to 63 letters, digits or _), and when the host gave no tag.
Parameters
name
string
Returns
{{secret:${string}😒{string}}}