workerd

Development These docs follow the development version and change with every merge.

Last updated View as Markdown

Classes

InvokeError

Internal

Transport-level /invoke failure (never an author failure): unknown interface/method, malformed message, bad capability table, or a missing binding.

Extends

Constructors

Constructor
new InvokeError(
   status, 
   code, 
   message
): InvokeError;
Parameters
Parameter Type
status number
code string
message string
Returns

InvokeError

Overrides

PluginError.constructor

Properties

code
readonly code: string;

Known PluginErrorCode wire string, or unknown.

Inherited from

PluginError.code

details
readonly details: Readonly<Record<string, unknown>> | undefined;

Structured detail object from the wire (details JSON), when the error carries one.

Inherited from

PluginError.details

status
readonly status: number;

HTTP status the bridge answers with.

wireCode
readonly wireCode: string;

Raw wire code, including codes this SDK does not know.

Inherited from

PluginError.wireCode

Accessors

detailsText
Get Signature
get detailsText(): string;

details as the JSON text the wire carries.

Returns

string

JSON object text, or an empty string when the error has none.

Inherited from

PluginError.detailsText

limit
Get Signature
get limit(): LimitExceeded | undefined;

The exceeded cap when this is a limit_exceeded error.

Returns

LimitExceeded | undefined

The cap from details first, then from the canonical message; undefined for every other code.

Inherited from

PluginError.limit

Methods

fromWire()
static fromWire(
   code, 
   message, 
   details?
): PluginError;

Construct a PluginError from a Cap'n Proto / JSON wire code.

Unknown codes become unknown on PluginError.code while PluginError.wireCode keeps the raw value.

Parameters
Parameter Type Default value Description
code string undefined Wire error code (known or unknown).
message string undefined Operator-facing error text.
details? string "" details JSON text from the wire (empty when none).
Returns

PluginError

Typed plugin error.

Inherited from

PluginError.fromWire

limitExceeded()
static limitExceeded(limit): PluginError;

Builds a limit_exceeded error whose message and details both carry the exceeded cap.

Parameters
Parameter Type Description
limit LimitExceeded Exceeded cap.
Returns

PluginError

Typed plugin error.

Inherited from

PluginError.limitExceeded

Interfaces

CapDescriptor

Internal

One X-Bookclerk-Caps entry: capability index i of the message is described by entry i.

Properties

binding?
binding?: string;

Binding name for guestDatabase.

id?
id?: string;

Isolate object id for adapterSession.

kind
kind: string;

source / destination / progress / cancellation / … / adapterSession.

token?
token?: string;

Grant token for host-served kinds.


InvokeFailure

Internal

Transport-level /invoke failure as a plain value (Workers RPC drops own properties of thrown errors, so the adapter returns this instead of throwing across the service binding).

Properties

error
error: object;

JSON error body.

code
code: string;
message
message: string;
status
status: number;

HTTP status the bridge answers with (400 / 404 / 500).


InvokeHost

Internal

Adapter hooks the dispatcher calls back into.

Methods

author()
author(): AuthorStub | undefined;

Default author entrypoint (PLUGIN), or undefined when unbound.

Returns

AuthorStub | undefined

bindContext()
bindContext(ctx): GrantedContext;

Bridge context → author-facing granted context.

Parameters
Parameter Type
ctx BridgeContext | undefined
Returns

GrantedContext

importCap()
importCap(descriptor, stop): unknown;

Resolve one request capability descriptor; undefined for an unknown kind. stop aborts when the call returns.

Parameters
Parameter Type
descriptor CapDescriptor
stop AbortSignal
Returns

unknown

named()
named(name): NamedStub | undefined;

Named author entrypoint, or undefined when the isolate does not export it.

Parameters
Parameter Type
name EntrypointName
Returns

NamedStub | undefined


InvokeReply

Internal

Successful /invoke reply: $Results bytes plus the descriptors of capabilities the reply exported.

Properties

body
body: Uint8Array;

Unpacked single-segment Cap'n message (<Interface>.<method>$Results).

caps
caps: CapDescriptor[];

Reply capability table (X-Bookclerk-Caps on the response).

Type Aliases

InvokeOutcome

type InvokeOutcome = InvokeReply | InvokeFailure;

Internal

What the adapter's invoke resolves to.

Functions

dispatchInvoke()

function dispatchInvoke(
   iface, 
   method, 
   context, 
   caps, 
   target, 
   body, 
   host
): Promise<InvokeReply>;

Internal

Dispatch one /invoke call.

Parameters

Parameter Type Description
iface string Cap'n interface name (X-Bookclerk-Interface).
method string Method name (X-Bookclerk-Method).
context BridgeContext | undefined Decoded bridge context, or undefined for PluginWorker.*.
caps CapDescriptor[] Request capability descriptors (X-Bookclerk-Caps).
target string | null Isolate object id (X-Bookclerk-Target), or null.
body Uint8Array $Params message bytes.
host InvokeHost Adapter hooks.

Returns

Promise<InvokeReply>

$Results bytes plus reply capability descriptors.

Throws

On transport-level failures (400 / 404 / 500).

References

Abridgement

Re-exports Abridgement


AdapterBatchOptions

Re-exports AdapterBatchOptions


AdapterBatchRequest

Re-exports AdapterBatchRequest


AdapterBatchStatement

Re-exports AdapterBatchStatement


AdapterBatchStreamedOptions

Re-exports AdapterBatchStreamedOptions


AdapterDatabaseSession

Re-exports AdapterDatabaseSession


AdapterEnv

Re-exports AdapterEnv


AdapterTransaction

Re-exports AdapterTransaction


AiBinding

Re-exports AiBinding


AiEmbedText

Re-exports AiEmbedText


AiEntrypoint

Re-exports AiEntrypoint


AiInput

Re-exports AiInput


AiModel

Re-exports AiModel


AiModelList

Re-exports AiModelList


AiOutput

Re-exports AiOutput


AiRunOk

Re-exports AiRunOk


AiRunParams

Re-exports AiRunParams


AiTask

Re-exports AiTask


AiTextEmbeddingsInput

Re-exports AiTextEmbeddingsInput


AiTextEmbeddingsOutput

Re-exports AiTextEmbeddingsOutput


AiTextEmbeddingsRequest

Re-exports AiTextEmbeddingsRequest


AiTextEmbeddingsResponse

Re-exports AiTextEmbeddingsResponse


AiTextRole

Re-exports AiTextRole


allowedEntrypointFamilies

Re-exports allowedEntrypointFamilies


AtomicTransport

Re-exports AtomicTransport


AuthenticateUserParams

Re-exports AuthenticateUserParams


BookclerkEntrypoint

Re-exports BookclerkEntrypoint


BookclerkEnv

Re-exports BookclerkEnv


canonicalExecuteRequestHash

Re-exports canonicalExecuteRequestHash


ChangesPage

Re-exports ChangesPage


ChangesRequest

Re-exports ChangesRequest


Checkpoint

Re-exports Checkpoint


chunkIndexes

Re-exports chunkIndexes


cliArgs

Re-exports cliArgs


CliEntrypoint

Re-exports CliEntrypoint


CliInvokeParams

Re-exports CliInvokeParams


CliInvokeResult

Re-exports CliInvokeResult


CliSchema

Re-exports CliSchema


collectExecuteStream

Re-exports collectExecuteStream


CopyResult

Re-exports CopyResult


CoverEntrypoint

Re-exports CoverEntrypoint


CoverFetchParams

Re-exports CoverFetchParams


CoverImage

Re-exports CoverImage


CoverImages

Re-exports CoverImages


createDatabaseBinding

Re-exports createDatabaseBinding


Credit

Re-exports Credit


CreditLevel

Re-exports CreditLevel


CreditRole

Re-exports CreditRole


D1ExecResult

Re-exports D1ExecResult


D1Meta

Re-exports D1Meta


D1Result

Re-exports D1Result


DatabaseAdapterEntrypoint

Re-exports DatabaseAdapterEntrypoint


DatabaseBinding

Re-exports DatabaseBinding


DatabaseBindingOptions

Re-exports DatabaseBindingOptions


dataMigrationOp

Re-exports dataMigrationOp


DbColumn

Re-exports DbColumn


DbResultSelection

Re-exports DbResultSelection


DbRow

Re-exports DbRow


DbStatementKind

Re-exports DbStatementKind


DbTiming

Re-exports DbTiming


DbType

Re-exports DbType


DbValue

Re-exports DbValue


decodeDbValue

Re-exports decodeDbValue


decodeExecuteRequest

Re-exports decodeExecuteRequest


decodeExecuteResultReply

Re-exports decodeExecuteResultReply


decodeExecuteStream

Re-exports decodeExecuteStream


decodeExtensibleConfig

Re-exports decodeExtensibleConfig


DeliveredCheckpoint

Re-exports DeliveredCheckpoint


Destination

Re-exports Destination


DomainEvent

Re-exports DomainEvent


encodeDbValue

Re-exports encodeDbValue


encodeExecuteRequest

Re-exports encodeExecuteRequest


encodeExecuteResultReply

Re-exports encodeExecuteResultReply


encodeExecuteStream

Re-exports encodeExecuteStream


ENTRYPOINT_BINDINGS

Re-exports ENTRYPOINT_BINDINGS


ENTRYPOINT_CLASSES

Re-exports ENTRYPOINT_CLASSES


EntrypointName

Re-exports EntrypointName


EventBatch

Re-exports EventBatch


eventBatchResults

Re-exports eventBatchResults


EventMessage

Re-exports EventMessage


EventOutcome

Re-exports EventOutcome


EventPublisherBinding

Re-exports EventPublisherBinding


EventReadOptions

Re-exports EventReadOptions


EventSuspendOptions

Re-exports EventSuspendOptions


executeAdapterBatch

Re-exports executeAdapterBatch


executeAdapterBatchStreamed

Re-exports executeAdapterBatchStreamed


ExecuteReply

Re-exports ExecuteReply


executeReplyToD1Results

Re-exports executeReplyToD1Results


ExecuteRequest

Re-exports ExecuteRequest


ExecuteStreamDecoder

Re-exports ExecuteStreamDecoder


executeStreamLimits

Re-exports executeStreamLimits


ExecuteStreamLimits

Re-exports ExecuteStreamLimits


ExpressionKind

Re-exports ExpressionKind


ExtensibleConfig

Re-exports ExtensibleConfig


ExternalUser

Re-exports ExternalUser


FEATURE_SCALAR_LIMITS

Re-exports FEATURE_SCALAR_LIMITS


FEATURE_STORAGE_CHANGES

Re-exports FEATURE_STORAGE_CHANGES


FEATURE_STORAGE_CONDITIONAL_WRITE

Re-exports FEATURE_STORAGE_CONDITIONAL_WRITE


FEATURE_STORAGE_COPY

Re-exports FEATURE_STORAGE_COPY


FEATURE_STORAGE_DELETE_MANY

Re-exports FEATURE_STORAGE_DELETE_MANY


FEATURE_STORAGE_HEAD_MANY

Re-exports FEATURE_STORAGE_HEAD_MANY


FEATURE_STORAGE_MOVE

Re-exports FEATURE_STORAGE_MOVE


FEATURE_STORAGE_MOVE_MANY

Re-exports FEATURE_STORAGE_MOVE_MANY


FEATURE_STREAMS

Re-exports FEATURE_STREAMS


FetchStorePage

Re-exports FetchStorePage


fromBridgeJson

Re-exports fromBridgeJson


GrantedContext

Re-exports GrantedContext


GrantedDatabaseTransport

Re-exports GrantedDatabaseTransport


GUEST_READ_ONLY_REPLAY_PAYLOAD

Re-exports GUEST_READ_ONLY_REPLAY_PAYLOAD


GUEST_RECEIPT_CLAIM_LOST

Re-exports GUEST_RECEIPT_CLAIM_LOST


GUEST_RECEIPT_RESULT_LOST

Re-exports GUEST_RECEIPT_RESULT_LOST


GUEST_RECEIPT_STUB_SUFFIX

Re-exports GUEST_RECEIPT_STUB_SUFFIX


GUEST_RECEIPT_WRAP_PREFIX

Re-exports GUEST_RECEIPT_WRAP_PREFIX


GUEST_REPLAY_PAYLOAD_MAX_BYTES

Re-exports GUEST_REPLAY_PAYLOAD_MAX_BYTES


guestBatchIsReadOnly

Re-exports guestBatchIsReadOnly


guestReceiptFinalizeStatements

Re-exports guestReceiptFinalizeStatements


guestReplayPayload

Re-exports guestReplayPayload


HealthOk

Re-exports HealthOk


HostWebSocket

Re-exports HostWebSocket


Identifier

Re-exports Identifier


IdentifierScheme

Re-exports IdentifierScheme


IngressEntrypoint

Re-exports IngressEntrypoint


Instant

Re-exports Instant


Invocation

Re-exports Invocation


invocationOf

Re-exports invocationOf


JobCheckpoint

Re-exports JobCheckpoint


JobCompletion

Re-exports JobCompletion


JobController

Re-exports JobController


JobInvocation

Re-exports JobInvocation


jobOutcomeFor

Re-exports jobOutcomeFor


JobOutcomeRecord

Re-exports JobOutcomeRecord


JobRetryOptions

Re-exports JobRetryOptions


JobRunnerContext

Re-exports JobRunnerContext


JobSuspendOptions

Re-exports JobSuspendOptions


JsonObject

Re-exports JsonObject


jsonPayload

Re-exports jsonPayload


KeyOutcome

Re-exports KeyOutcome


KvListKeyBinding

Re-exports KvListKeyBinding


KvListOptionsBinding

Re-exports KvListOptionsBinding


KvListResultBinding

Re-exports KvListResultBinding


KvNamespaceBinding

Re-exports KvNamespaceBinding


KvPutOptionsBinding

Re-exports KvPutOptionsBinding


KvValueType

Re-exports KvValueType


KvValueWithMetadata

Re-exports KvValueWithMetadata


ListeningProgress

Re-exports ListeningProgress


ListOptions

Re-exports ListOptions


ListPage

Re-exports ListPage


MAX_BATCH_KEYS

Re-exports MAX_BATCH_KEYS


MAX_CHANGES_CURSOR_BYTES

Re-exports MAX_CHANGES_CURSOR_BYTES


MAX_CHANGES_PAGE

Re-exports MAX_CHANGES_PAGE


MAX_CHECKPOINT_BYTES

Re-exports MAX_CHECKPOINT_BYTES


MAX_EVENT_PAYLOAD_BYTES

Re-exports MAX_EVENT_PAYLOAD_BYTES


MAX_LIST_PAGE

Re-exports MAX_LIST_PAGE


MAX_PLUGIN_MIGRATION_OPS

Re-exports MAX_PLUGIN_MIGRATION_OPS


MAX_PLUGIN_MIGRATION_REGISTRATION_BYTES

Re-exports MAX_PLUGIN_MIGRATION_REGISTRATION_BYTES


MAX_PLUGIN_MIGRATION_TOTAL_OPS

Re-exports MAX_PLUGIN_MIGRATION_TOTAL_OPS


MAX_SCALAR_BYTES

Re-exports MAX_SCALAR_BYTES


MAX_STREAM_WINDOW_BYTES

Re-exports MAX_STREAM_WINDOW_BYTES


MAX_WRITE_KEY_BYTES

Re-exports MAX_WRITE_KEY_BYTES


MediaKind

Re-exports MediaKind


MetadataAudioFile

Re-exports MetadataAudioFile


MetadataChapter

Re-exports MetadataChapter


MetadataChapters

Re-exports MetadataChapters


MetadataChaptersParams

Re-exports MetadataChaptersParams


MetadataEntrypoint

Re-exports MetadataEntrypoint


MetadataField

Re-exports MetadataField


MetadataFileParseParams

Re-exports MetadataFileParseParams


MetadataFileRecord

Re-exports MetadataFileRecord


MetadataFileRenderParams

Re-exports MetadataFileRenderParams


MetadataFilesEntrypoint

Re-exports MetadataFilesEntrypoint


MetadataLookupParams

Re-exports MetadataLookupParams


MetadataRecord

Re-exports MetadataRecord


MetadataSearchParams

Re-exports MetadataSearchParams


MoveManyPage

Re-exports MoveManyPage


MoveManyRequest

Re-exports MoveManyRequest


MoveOptions

Re-exports MoveOptions


MoveResult

Re-exports MoveResult


NamedDatabase

Re-exports NamedDatabase


NamedEntrypoint

Re-exports NamedEntrypoint


NamedKv

Re-exports NamedKv


NamedQueue

Re-exports NamedQueue


NamedSockets

Re-exports NamedSockets


NotificationAlertAction

Re-exports NotificationAlertAction


NotificationAudience

Re-exports NotificationAudience


NotificationField

Re-exports NotificationField


NotificationMessage

Re-exports NotificationMessage


NotificationSeverity

Re-exports NotificationSeverity


NotifierEntrypoint

Re-exports NotifierEntrypoint


NotifyBinding

Re-exports NotifyBinding


NotifyDestination

Re-exports NotifyDestination


NotifyDestinationKind

Re-exports NotifyDestinationKind


NotifyRaise

Re-exports NotifyRaise


NotifyRaised

Re-exports NotifyRaised


NotifySendParams

Re-exports NotifySendParams


NotifySent

Re-exports NotifySent


NotifyValidated

Re-exports NotifyValidated


NotifyValidateParams

Re-exports NotifyValidateParams


ObjectChange

Re-exports ObjectChange


ObjectInfo

Re-exports ObjectInfo


ObjectMetadata

Re-exports ObjectMetadata


OidcClientTemplate

Re-exports OidcClientTemplate


OidcEntrypoint

Re-exports OidcEntrypoint


OriginBinding

Re-exports OriginBinding


OriginFetchOptions

Re-exports OriginFetchOptions


OriginTransport

Re-exports OriginTransport


OriginTransportReply

Re-exports OriginTransportReply


OriginTransportResponse

Re-exports OriginTransportResponse


packEmbeddingVectors

Re-exports packEmbeddingVectors


parseDbValue

Re-exports parseDbValue


PluginCapabilities

Re-exports PluginCapabilities


PluginDescribe

Re-exports PluginDescribe


PluginError

Re-exports PluginError


PluginMigration

Re-exports PluginMigration


PluginMigrationOp

Re-exports PluginMigrationOp


PreparedStatement

Re-exports PreparedStatement


PRODUCT_API_VERSION

Re-exports PRODUCT_API_VERSION


ProgressSink

Re-exports ProgressSink


PublishEvent

Re-exports PublishEvent


PutResult

Re-exports PutResult


QueueBatch

Re-exports QueueBatch


queueBatchResults

Re-exports queueBatchResults


QueueBinding

Re-exports QueueBinding


QueueMessage

Re-exports QueueMessage


QueueOutcome

Re-exports QueueOutcome


QueueRetryOptions

Re-exports QueueRetryOptions


QueueSendBatchEntry

Re-exports QueueSendBatchEntry


QueueSendOptions

Re-exports QueueSendOptions


rawStreamCeiling

Re-exports rawStreamCeiling


ReadOptions

Re-exports ReadOptions


ReadResult

Re-exports ReadResult


RemoteLibraryEntrypoint

Re-exports RemoteLibraryEntrypoint


requirePluginMigrationRegistration

Re-exports requirePluginMigrationRegistration


RetryOptions

Re-exports RetryOptions


RetryToken

Re-exports RetryToken


runAdapterBatch

Re-exports runAdapterBatch


ScanLibraryParams

Re-exports ScanLibraryParams


scanPage

Re-exports scanPage


schemaMigrationOp

Re-exports schemaMigrationOp


SeriesEntry

Re-exports SeriesEntry


shouldSkipRemainingGuestWork

Re-exports shouldSkipRemainingGuestWork


SocketAutoResponsePair

Re-exports SocketAutoResponsePair


SocketConnectOptions

Re-exports SocketConnectOptions


SocketMessageData

Re-exports SocketMessageData


SocketMessageOk

Re-exports SocketMessageOk


SocketsBinding

Re-exports SocketsBinding


SocketSendData

Re-exports SocketSendData


Source

Re-exports Source


StatementResult

Re-exports StatementResult


statementResultToD1Result

Re-exports statementResultToD1Result


StorageBinding

Re-exports StorageBinding


StorageEntrypoint

Re-exports StorageEntrypoint


StorefrontEntrypoint

Re-exports StorefrontEntrypoint


StorePage

Re-exports StorePage


STREAM_FRAME_TARGET_BYTES

Re-exports STREAM_FRAME_TARGET_BYTES


streamsResults

Re-exports streamsResults


toBridgeJson

Re-exports toBridgeJson


TRIGGER_FAMILIES

Re-exports TRIGGER_FAMILIES


TypedDbStatement

Re-exports TypedDbStatement


unpackEmbeddingVectors

Re-exports unpackEmbeddingVectors


WebhookDeliveredEvent

Re-exports WebhookDeliveredEvent


WebhookMessage

Re-exports WebhookMessage


WebhookPullOptions

Re-exports WebhookPullOptions


WebhookPullResult

Re-exports WebhookPullResult


WebhooksBinding

Re-exports WebhooksBinding


WireQueueBatch

Re-exports WireQueueBatch


WorkKind

Re-exports WorkKind


wrapPluginFromBinding

Re-exports wrapPluginFromBinding


wrapPluginFromNative

Re-exports wrapPluginFromNative


WriteChunksError

Re-exports WriteChunksError


writeChunksOperationId

Re-exports writeChunksOperationId


WriteChunksOptions

Re-exports WriteChunksOptions


WriteOptions

Re-exports WriteOptions


WriteProgress

Re-exports WriteProgress

Generated from packages/plugin-sdk at main · View as Markdown