Skip to content
RELKIT
Esc
↑↓navigate↵open⌘Jpreview
On this page

Jobs API

Generated public TypeScript reference for @relkit/jobs.

Common APIs

For configuration and examples, read quickstart, schedules, comparison.

Frontend usage

Trigger and observe a job shows the client side of this capability.

Public imports

  • @relkit/jobs — 413 exports
  • @relkit/jobs/adapter — 34 exports
  • @relkit/jobs/server — 9 exports
  • @relkit/jobs/legacy — 33 exports

All exported APIs

Names link to their complete contracts. Re-exports share their original contract; legacy exports keep their separate identity. Examples link to the API’s inline sample, a maintained repository usage, or the shared module walkthrough.

API Kind Import from Example
assertAdapterMethods Value @relkit/jobs, @relkit/jobs/adapter API example
assertAdapterMethodsEffect Value @relkit/jobs API example
assertAuthorizedOperation Value @relkit/jobs API example
assertAuthorizedOperationEffect Value @relkit/jobs API example
assertBoundedString Value @relkit/jobs API example
assertBoundedStringEffect Value @relkit/jobs API example
assertCanonicalScalarKey Value @relkit/jobs API example
assertCanonicalScalarKeyEffect Value @relkit/jobs API example
assertFieldName Value @relkit/jobs API example
assertFieldNameEffect Value @relkit/jobs API example
assertJobDescriptor Value @relkit/jobs API example
assertJobDescriptorEffect Value @relkit/jobs API example
assertJobGrant Value @relkit/jobs API example
assertJobGrantEffect Value @relkit/jobs API example
assertJobName Value @relkit/jobs API example
assertJobNameEffect Value @relkit/jobs API example
assertJobsAdapterRuntime Value @relkit/jobs, @relkit/jobs/adapter API example
assertJobsAdapterRuntimeEffect Value @relkit/jobs, @relkit/jobs/adapter API example
assertJobsCapability Value @relkit/jobs, @relkit/jobs/adapter API example
assertJobsCapabilityEffect Value @relkit/jobs API example
assertRfc3339Instant Value @relkit/jobs API example
assertRfc3339InstantEffect Value @relkit/jobs API example
assertSupportedJobsServiceOptions Value @relkit/jobs API example
assertSupportedJobsServiceOptionsEffect Value @relkit/jobs API example
assertTaskDescriptor Value @relkit/jobs API example
assertTaskDescriptorEffect Value @relkit/jobs API example
authorize Value @relkit/jobs API example
authorizeJobAccess Value @relkit/jobs API example
authorizeJobAccessEffect Value @relkit/jobs API example
BindingSource Type @relkit/jobs Module example
cancelRun Value @relkit/jobs API example
cancelRunEffect Value @relkit/jobs API example
CanonicalTaskSubmissionOptions Type @relkit/jobs Module example
copyConcurrency Value @relkit/jobs API example
copyConcurrencyEffect Value @relkit/jobs API example
copyLogging Value @relkit/jobs API example
copyLoggingEffect Value @relkit/jobs API example
copyResources Value @relkit/jobs API example
copyResourcesEffect Value @relkit/jobs API example
copyTaskTags Value @relkit/jobs API example
copyTaskTagsEffect Value @relkit/jobs API example
copyTriggerOptions Value @relkit/jobs API example
createCursor Value @relkit/jobs API example
createJobClient Value @relkit/jobs/legacy API example
createJobClientEffect Value @relkit/jobs/legacy API example
createJobCursor Value @relkit/jobs API example
createJobCursorEffect Value @relkit/jobs API example
createJobsControls Value @relkit/jobs API example
createJobsControlsEffect Value @relkit/jobs API example
createJobsRuntime Value @relkit/jobs API example
createJobsRuntimeEffect Value @relkit/jobs API example
createRunLocator Value @relkit/jobs API example
createRunLocatorEffect Value @relkit/jobs API example
createScheduleControls Value @relkit/jobs API example
createScheduleControlsEffect Value @relkit/jobs API example
createSubmissionPipeline Value @relkit/jobs API example
createSubmissionPipelineEffect Value @relkit/jobs API example
createTaskProgressEmitter Value @relkit/jobs API example
createTaskProgressEmitterEffect Value @relkit/jobs API example
createTaskStreamEmitter Value @relkit/jobs API example
createTaskStreamEmitterEffect Value @relkit/jobs API example
currentJobsRuntime Value @relkit/jobs API example
currentJobsRuntimeEffect Value @relkit/jobs API example
decodeCursor Value @relkit/jobs API example
decodeJobWire Value @relkit/jobs API example
decodeJobWireEffect Value @relkit/jobs API example
decodeRunLocator Value @relkit/jobs API example
defineJob Value @relkit/jobs API example
defineJob Value @relkit/jobs/legacy API example
defineJobEffect Value @relkit/jobs API example
defineJobEffect Value @relkit/jobs/legacy API example
DefineJobOptions Type @relkit/jobs Module example
DefineJobOptions Type @relkit/jobs/legacy Module example
defineTask Value @relkit/jobs API example
defineTaskEffect Value @relkit/jobs API example
DefineTaskOptions Type @relkit/jobs Module example
deserializeJobsServiceOptions Value @relkit/jobs API example
deserializeJobsServiceOptionsEffect Value @relkit/jobs API example
diagnoseJobMigration Value @relkit/jobs API example
diagnoseJobMigrationEffect Value @relkit/jobs API example
diagnoseLegacyCompatibility Value @relkit/jobs API example
diagnoseLegacyCompatibilityEffect Value @relkit/jobs API example
DurationInput Type @relkit/jobs Module example
durationToMillis Value @relkit/jobs API example
durationToMillisEffect Value @relkit/jobs API example
DurationUnit Type @relkit/jobs Module example
DurationValidationError Value @relkit/jobs API example
EffectJobClient Type @relkit/jobs/legacy Module example
EffectTaskEmitter Type @relkit/jobs Module example
encodeJobWire Value @relkit/jobs API example
encodeJobWireEffect Value @relkit/jobs API example
encodeRunLocator Value @relkit/jobs API example
encodeTaskInput Value @relkit/jobs API example
encodeTaskInputEffect Value @relkit/jobs API example
encodeTaskOutput Value @relkit/jobs API example
encodeTaskOutputEffect Value @relkit/jobs API example
getRun Value @relkit/jobs API example
getRunEffect Value @relkit/jobs API example
getScheduleEffect Value @relkit/jobs API example
IdempotencyDefinition Type @relkit/jobs/legacy Module example
InputOf Type @relkit/jobs Module example
InstantValidationError Value @relkit/jobs API example
isDurationInput Value @relkit/jobs API example
isDurationInputEffect Value @relkit/jobs API example
isJobDescriptor Value @relkit/jobs API example
isJobDescriptorEffect Value @relkit/jobs API example
isJobName Value @relkit/jobs API example
isJobNameEffect Value @relkit/jobs API example
isJobsAdapterRuntime Value @relkit/jobs, @relkit/jobs/adapter API example
isJobsAdapterRuntimeEffect Value @relkit/jobs, @relkit/jobs/adapter API example
isRfc3339Instant Value @relkit/jobs API example
isRfc3339InstantEffect Value @relkit/jobs API example
isTaskDescriptor Value @relkit/jobs API example
isTaskDescriptorEffect Value @relkit/jobs API example
isValidJobName Value @relkit/jobs API example
JOB_NAME_MAX_LENGTH Value @relkit/jobs Module example
JOB_NAME_PATTERN Value @relkit/jobs API example
JOB_NAME_RESERVED Value @relkit/jobs API example
JOB_PROFILE_DEPRECATED_CODE Value @relkit/jobs API example
JobAccessGrant Type @relkit/jobs Module example
JobAccessRequest Type @relkit/jobs Module example
JobAdmission Type @relkit/jobs Module example
JobAuthorizationContext Type @relkit/jobs Module example
JobAuthorizationError Value @relkit/jobs API example
JobAuthorizationFailure Value @relkit/jobs API example
JobBindingErrorCode Type @relkit/jobs Module example
JobBindingFailure Value @relkit/jobs API example
JobBindingMigration Type @relkit/jobs Module example
JobBindingResolutionError Value @relkit/jobs API example
JobCancelOptions Type @relkit/jobs Module example
JobClient Type @relkit/jobs/legacy Module example
JobClientAccess Type @relkit/jobs Module example
JobClientFailure Value @relkit/jobs/legacy API example
JobClientField Type @relkit/jobs Module example
JobClientOperation Type @relkit/jobs Module example
JobClientOptions Type @relkit/jobs/legacy Module example
JobControlFailure Value @relkit/jobs API example
JobControlUnknownError Value @relkit/jobs API example
JobCursorBinding Type @relkit/jobs Module example
JobCursorError Value @relkit/jobs API example
JobCursorFailure Value @relkit/jobs API example
JobCursorOptions Type @relkit/jobs Module example
JobDeclaredEdge Type @relkit/jobs/legacy Module example
JobDefinitionFailure Value @relkit/jobs API example
JobDependencyError Value @relkit/jobs/legacy API example
JobDescriptor Type @relkit/jobs Module example
JobDescriptor Type @relkit/jobs/legacy Module example
JobDescriptorAny Type @relkit/jobs Source example
JobDescriptorForThisTask Type @relkit/jobs Module example
JobEnqueueOptions Type @relkit/jobs/legacy API example
JobEnqueueResult Type @relkit/jobs/legacy API example
JobErrorEnvelope Type @relkit/jobs Module example
JobIdentityError Value @relkit/jobs API example
JobInputValidationError Value @relkit/jobs/legacy API example
JobInvocationBridge Type @relkit/jobs/legacy Module example
JobInvocationBridgeOptions Type @relkit/jobs/legacy Module example
JobMigrationDiagnostic Type @relkit/jobs Module example
JobMigrationSeverity Type @relkit/jobs Module example
JobMigrationSnapshot Type @relkit/jobs Module example
JobName Type @relkit/jobs Module example
JobNameValidationError Value @relkit/jobs API example
JobObservationTimeoutError Value @relkit/jobs API example
JobObservedEdge Type @relkit/jobs/legacy Module example
JobObserveOptions Type @relkit/jobs Module example
JobOperationCancelledError Value @relkit/jobs/legacy API example
JobOperationContext Type @relkit/jobs/legacy Source example
JobOperationTimeoutError Value @relkit/jobs/legacy API example
JobProfileError Value @relkit/jobs/legacy API example
JobProvider Type @relkit/jobs/legacy Source example
JobProviderError Value @relkit/jobs/legacy API example
JobProviderResult Type @relkit/jobs/legacy Module example
JobReceiptError Value @relkit/jobs API example
JobResultUnavailableError Value @relkit/jobs API example
JobRetryOptions Type @relkit/jobs Module example
JobRunResultOptions Type @relkit/jobs Module example
JobRunStatus Type @relkit/jobs Module example
JOBS_ADAPTER_PROTOCOL_VERSION Value @relkit/jobs, @relkit/jobs/adapter API example
JobsAdapterRuntime Type @relkit/jobs, @relkit/jobs/adapter Source example
JobsAdapterValidationError Value @relkit/jobs, @relkit/jobs/adapter API example
JobsCapability Type @relkit/jobs Module example
JobsCapabilityError Value @relkit/jobs, @relkit/jobs/adapter API example
JobsCapabilityFailure Value @relkit/jobs API example
JobsCapabilityName Type @relkit/jobs Module example
JobsCapabilityReport Type @relkit/jobs, @relkit/jobs/adapter Module example
JobsCapabilitySupport Type @relkit/jobs Module example
JobScheduleClient Type @relkit/jobs Module example
JobScheduleControlFailure Value @relkit/jobs API example
JobsControls Type @relkit/jobs Module example
JobServiceSelection Type @relkit/jobs Module example
JobsManifestLike Type @relkit/jobs Module example
JobsManifestReader Value @relkit/jobs/server API example
JobsManifestReaderLive Value @relkit/jobs/server API example
JobsOperationOptions Type @relkit/jobs Module example
JobsRuntime Type @relkit/jobs Source example
JobsRuntimeBinding Type @relkit/jobs Source example
JobsRuntimeCallbackError Value @relkit/jobs API example
JobsRuntimeError Value @relkit/jobs API example
JobsRuntimeOptions Type @relkit/jobs Module example
JobsServerError Value @relkit/jobs/server API example
JobsServiceBehavior Type @relkit/jobs Module example
JobsServiceOptionName Type @relkit/jobs Module example
JobsServiceOptions Type @relkit/jobs Source example
JobsServiceOptionsError Value @relkit/jobs API example
JobState Type @relkit/jobs/legacy API example
JobStatus Type @relkit/jobs/legacy API example
JobsTelemetry Value @relkit/jobs API example
JobsTelemetryLive Value @relkit/jobs API example
JobSubmissionCancelledError Value @relkit/jobs API example
JobSubmissionError Value @relkit/jobs API example
JobSubmissionPipelineFailure Value @relkit/jobs API example
JobSubmissionUnknownError Value @relkit/jobs API example
JobTriggerClients Type @relkit/jobs Module example
JobUnknownOutcome Type @relkit/jobs Module example
JobWireEnvelope Type @relkit/jobs Module example
JsonWireEnvelope Type @relkit/jobs Module example
LegacyCompatibilitySnapshot Type @relkit/jobs Module example
LegacyJobValidationError Value @relkit/jobs/legacy API example
listRuns Value @relkit/jobs API example
listRunsEffect Value @relkit/jobs API example
listSchedulesEffect Value @relkit/jobs API example
memoryBytes Value @relkit/jobs API example
memoryBytesEffect Value @relkit/jobs API example
MemoryInput Type @relkit/jobs Module example
NamedStreamFrame Type @relkit/jobs Module example
namespaceHash Value @relkit/jobs API example
namespaceHashEffect Value @relkit/jobs API example
NativeCancelRequest Type @relkit/jobs, @relkit/jobs/adapter Module example
NativeControlReceipt Type @relkit/jobs, @relkit/jobs/adapter Module example
NativeDurableSleep Type @relkit/jobs, @relkit/jobs/adapter Module example
NativeLocator Type @relkit/jobs, @relkit/jobs/adapter Module example
NativeObservation Type @relkit/jobs, @relkit/jobs/adapter Module example
NativeOwnedScheduleRecord Type @relkit/jobs Module example
NativeProgressWriter Type @relkit/jobs, @relkit/jobs/adapter Module example
NativeReceipt Type @relkit/jobs, @relkit/jobs/adapter Module example
NativeRetryRequest Type @relkit/jobs, @relkit/jobs/adapter Module example
NativeRun Type @relkit/jobs, @relkit/jobs/adapter Module example
NativeRunPage Type @relkit/jobs, @relkit/jobs/adapter Module example
NativeRunQuery Type @relkit/jobs, @relkit/jobs/adapter Module example
nativeScheduleLayer Value @relkit/jobs API example
NativeScheduleOperations Type @relkit/jobs, @relkit/jobs/adapter Source example
NativeScheduleService Value @relkit/jobs API example
NativeStreamWriter Type @relkit/jobs, @relkit/jobs/adapter Module example
NativeStreamWriters Type @relkit/jobs, @relkit/jobs/adapter Module example
NativeSubmission Type @relkit/jobs, @relkit/jobs/adapter Source example
NativeTaskWork Type @relkit/jobs, @relkit/jobs/adapter Source example
NativeTaskWorker Type @relkit/jobs, @relkit/jobs/adapter Module example
NativeWatchRequest Type @relkit/jobs, @relkit/jobs/adapter Module example
NormalizedTaskRetryPolicy Type @relkit/jobs Source example
normalizeJobName Value @relkit/jobs API example
observeRun Value @relkit/jobs API example
observeRunEffect Value @relkit/jobs API example
OperationContext Type @relkit/jobs, @relkit/jobs/adapter Source example
OutputOf Type @relkit/jobs Module example
parseDuration Value @relkit/jobs API example
prepareCanonicalSubmission Value @relkit/jobs API example
prepareCanonicalSubmissionEffect Value @relkit/jobs API example
prepareSubmission Value @relkit/jobs API example
prepareSubmissionEffect Value @relkit/jobs API example
ProgressEmitReceipt Type @relkit/jobs Module example
projectRun Value @relkit/jobs API example
projectRunPage Value @relkit/jobs API example
projectRunPageEffect Value @relkit/jobs API example
projectRunSnapshot Value @relkit/jobs API example
projectRunSnapshotEffect Value @relkit/jobs API example
PublishedEventName Type @relkit/jobs Module example
readJobCursor Value @relkit/jobs API example
readJobCursorEffect Value @relkit/jobs API example
reconcileNativeSchedules Value @relkit/jobs API example
reconcileNativeSchedulesEffect Value @relkit/jobs API example
requireJobsRuntime Value @relkit/jobs API example
requireJobsRuntimeEffect Value @relkit/jobs API example
resolveBinding Value @relkit/jobs API example
ResolveBindingOptions Type @relkit/jobs Module example
ResolvedTaskBinding Type @relkit/jobs Module example
resolveTaskBinding Value @relkit/jobs API example
resolveTaskBindingEffect Value @relkit/jobs API example
ResultAvailability Type @relkit/jobs Module example
retryDelayMillis Value @relkit/jobs API example
retryDelayMillisEffect Value @relkit/jobs API example
RetryJitter Type @relkit/jobs Module example
RetryJitter Type @relkit/jobs/legacy Module example
retryOperationIdentity Value @relkit/jobs API example
retryOperationIdentityEffect Value @relkit/jobs API example
RetryPolicy Type @relkit/jobs Module example
RetryPolicy Type @relkit/jobs/legacy Source example
retryRun Value @relkit/jobs API example
retryRunEffect Value @relkit/jobs API example
rotateRunLocatorKeys Value @relkit/jobs API example
rotateRunLocatorKeysEffect Value @relkit/jobs API example
RUN_LOCATOR_MAX_BYTES Value @relkit/jobs API example
RUN_LOCATOR_VERSION Value @relkit/jobs API example
RunAvailability Type @relkit/jobs Module example
RunCancellationReceipt Type @relkit/jobs Module example
RunConnection Type @relkit/jobs Module example
RunHandle Type @relkit/jobs Source example
runInJobsRuntime Value @relkit/jobs API example
runInJobsRuntimeEffect Value @relkit/jobs API example
RunListQuery Type @relkit/jobs Module example
RunLocatorCreateOptions Type @relkit/jobs Module example
RunLocatorError Value @relkit/jobs API example
RunLocatorFailure Value @relkit/jobs API example
RunLocatorGeneration Type @relkit/jobs Module example
RunLocatorGenerationStorage Value @relkit/jobs API example
RunLocatorGenerationStore Type @relkit/jobs Module example
RunLocatorKeyRing Type @relkit/jobs Module example
RunLocatorKeyRingStore Type @relkit/jobs Module example
RunLocatorPayload Type @relkit/jobs Module example
RunLocatorRouter Value @relkit/jobs API example
RunLocatorStoreFailure Value @relkit/jobs API example
runLocatorStoreLayer Value @relkit/jobs API example
RunLocatorVerifyOptions Type @relkit/jobs Module example
RunPage Type @relkit/jobs Source example
RunResultOptions Type @relkit/jobs, @relkit/jobs/server Module example
RunRetryReceipt Type @relkit/jobs Module example
RunSnapshot Type @relkit/jobs Source example
RunWatchFrame Type @relkit/jobs Source example
runWithJobs Value @relkit/jobs/server API example
RunWithJobsConfig Type @relkit/jobs/server API example
runWithJobsEffect Value @relkit/jobs/server API example
runWithJobsRuntime Value @relkit/jobs API example
runWithJobsRuntimeEffect Value @relkit/jobs API example
ScheduleDefinition Type @relkit/jobs Source example
ScheduleDefinition Type @relkit/jobs/legacy Module example
ScheduleListOptions Type @relkit/jobs Module example
ScheduleMisfire Type @relkit/jobs Module example
scheduleOccurrenceIdentity Value @relkit/jobs API example
scheduleOccurrenceIdentityEffect Value @relkit/jobs API example
scheduleOperationId Value @relkit/jobs API example
scheduleOperationIdEffect Value @relkit/jobs API example
ScheduleOverlap Type @relkit/jobs Module example
ScheduleOverlap Type @relkit/jobs/legacy Module example
scheduleOwner Value @relkit/jobs API example
scheduleOwnerEffect Value @relkit/jobs API example
ScheduleReadReceipt Type @relkit/jobs Module example
ScheduleReconciliationFailure Value @relkit/jobs API example
ScheduleReconciliationOptions Type @relkit/jobs Module example
ScheduleReconciliationResult Type @relkit/jobs Module example
ScheduleRecord Type @relkit/jobs Module example
ScheduleWriteOptions Type @relkit/jobs Module example
ScheduleWriteOutcome Type @relkit/jobs Module example
ScheduleWriteReceipt Type @relkit/jobs Module example
serializeJobsServiceOptions Value @relkit/jobs API example
serializeJobsServiceOptionsEffect Value @relkit/jobs API example
ServerTriggerOptions Type @relkit/jobs, @relkit/jobs/server Module example
stableIdentityTuple Value @relkit/jobs API example
stableIdentityTupleEffect Value @relkit/jobs API example
StreamIdentity Type @relkit/jobs Module example
StreamItem Type @relkit/jobs Module example
SubmissionAdmission Type @relkit/jobs Module example
SubmissionPipeline Type @relkit/jobs Module example
submitCanonicalTask Value @relkit/jobs API example
submitCanonicalTaskEffect Value @relkit/jobs API example
submitJob Value @relkit/jobs API example
submitJobEffect Value @relkit/jobs API example
submitPreparedSubmission Value @relkit/jobs API example
submitTask Value @relkit/jobs API example
submitTaskEffect Value @relkit/jobs API example
TASK_INPUT_MAX_BYTES Value @relkit/jobs API example
TASK_ITEM_MAX_BYTES Value @relkit/jobs API example
TASK_KEY_MAX_BYTES Value @relkit/jobs API example
TASK_MAX_TAGS Value @relkit/jobs API example
TASK_OUTPUT_MAX_BYTES Value @relkit/jobs API example
TASK_REASON_MAX_BYTES Value @relkit/jobs API example
TaskAuthContext Type @relkit/jobs Module example
TaskBlockingWaitError Value @relkit/jobs API example
TaskCallerInput Type @relkit/jobs Source example
TaskCanonicalInput Type @relkit/jobs Source example
TaskClientFor Type @relkit/jobs Module example
TaskClients Type @relkit/jobs Module example
TaskConcurrency Type @relkit/jobs Module example
TaskContext Type @relkit/jobs Module example
TaskContextBase Type @relkit/jobs Module example
TaskDefinitionFailure Value @relkit/jobs API example
TaskDependencies Type @relkit/jobs Module example
TaskDescriptor Type @relkit/jobs Module example
TaskDescriptorAny Type @relkit/jobs Source example
TaskEmissionError Value @relkit/jobs API example
TaskEmissionErrorCode Type @relkit/jobs Module example
TaskEmissionFailure Value @relkit/jobs API example
TaskEmissionSink Type @relkit/jobs Module example
TaskEmitterOptions Type @relkit/jobs Module example
TaskExecution Type @relkit/jobs Module example
TaskExecutionBinding Type @relkit/jobs, @relkit/jobs/adapter Module example
TaskExecutionEnvelope Type @relkit/jobs, @relkit/jobs/adapter Module example
TaskExecutor Type @relkit/jobs, @relkit/jobs/adapter Module example
TaskFailureHook Type @relkit/jobs Module example
TaskHandler Type @relkit/jobs Source example
TaskHandlerResult Type @relkit/jobs Module example
TaskHookContext Type @relkit/jobs Module example
TaskInput Type @relkit/jobs Module example
TaskLogging Type @relkit/jobs Module example
TaskObservation Type @relkit/jobs Module example
taskOperationIdentity Value @relkit/jobs API example
taskOperationIdentityEffect Value @relkit/jobs API example
TaskOutput Type @relkit/jobs Module example
TaskPolicyRandom Value @relkit/jobs API example
taskPolicyRandomLayer Value @relkit/jobs API example
TaskProgressEmitter Type @relkit/jobs Module example
TaskProgressInput Type @relkit/jobs Source example
TaskProgressOutput Type @relkit/jobs Source example
TaskRawHandlerOutput Type @relkit/jobs Source example
TaskResources Type @relkit/jobs Module example
TaskRetryPolicy Type @relkit/jobs Module example
TaskRunContext Type @relkit/jobs Module example
TaskSleepOptions Type @relkit/jobs Module example
TaskStartHook Type @relkit/jobs Module example
TaskStreamEmitter Type @relkit/jobs Module example
TaskStreamEmitterOptions Type @relkit/jobs Module example
TaskStreamEmitters Type @relkit/jobs Module example
TaskStreamFrames Type @relkit/jobs Module example
TaskStreamInput Type @relkit/jobs Source example
TaskStreamItem Type @relkit/jobs Module example
TaskStreamOutput Type @relkit/jobs Source example
TaskStreamSchemas Type @relkit/jobs Module example
TaskStreamSink Type @relkit/jobs Module example
TaskSubmissionMetadata Type @relkit/jobs Source example
TaskSuccessHook Type @relkit/jobs Source example
TaskTriggerOptions Type @relkit/jobs Module example
TaskValidatedOutput Type @relkit/jobs Source example
TaskWireErrorCode Type @relkit/jobs Module example
TaskWireFailure Value @relkit/jobs API example
TaskWireValidationError Value @relkit/jobs API example
TriggerOptions Type @relkit/jobs, @relkit/jobs/server Source example
TrustedJobScope Type @relkit/jobs API example
utf8Bytes Value @relkit/jobs API example
utf8BytesEffect Value @relkit/jobs API example
validateCanonicalInput Value @relkit/jobs API example
validateCanonicalInputEffect Value @relkit/jobs API example
validateCanonicalOutput Value @relkit/jobs API example
validateCanonicalOutputEffect Value @relkit/jobs API example
validateDuration Value @relkit/jobs API example
validateJobName Value @relkit/jobs API example
validateJobNameEffect Value @relkit/jobs API example
validateJobsCapabilityReport Value @relkit/jobs, @relkit/jobs/adapter API example
validateJobsCapabilityReportEffect Value @relkit/jobs API example
validateJobsServiceOptions Value @relkit/jobs API example
validateJobsServiceOptionsEffect Value @relkit/jobs API example
validateResultOptions Value @relkit/jobs API example
validateRunLocatorKeyRing Value @relkit/jobs API example
validateRunLocatorKeyRingEffect Value @relkit/jobs API example
validateTaskInput Value @relkit/jobs API example
validateTaskInputEffect Value @relkit/jobs API example
validateTaskOutput Value @relkit/jobs API example
validateTaskOutputEffect Value @relkit/jobs API example
ValidJobName Type @relkit/jobs Module example
VerifiedRunLocator Type @relkit/jobs Module example
verifyRunLocator Value @relkit/jobs API example
verifyRunLocatorEffect Value @relkit/jobs API example
VoidWireEnvelope Type @relkit/jobs Module example
waitForResult Value @relkit/jobs API example
waitForResultEffect Value @relkit/jobs API example
writeScheduleEffect Value @relkit/jobs API example

adapter-methods.ts

assertAdapterMethods

Synchronous adapter method check.

Throws

JobsCapabilityError when a method is missing.

Example

assertAdapterMethods(adapter);

Signature

declare const assertAdapterMethods: (adapter: JobsAdapterRuntime) => void;

Source

assertAdapterMethodsEffect

Checks the methods promised by a jobs adapter.

Example

Effect.runSync(assertAdapterMethodsEffect(adapter));

Signature

declare const assertAdapterMethodsEffect: (
  adapter: JobsAdapterRuntime,
) => Effect.Effect<undefined, JobsCapabilityFailure, never>;

Source

adapter-requests.types.ts

NativeCancelRequest (interface)

Provider-facing cancel request contract at the adapter boundary.

Signature

export interface NativeCancelRequest {
  readonly runId: string;
  readonly operationId: string;
  readonly reason?: string;
}

Source

NativeControlReceipt (type alias)

Provider acknowledgement for a run control operation.

Signature

type NativeControlReceipt = RunCancellationReceipt | RunRetryReceipt | JobUnknownOutcome;

Source

NativeReceipt (type alias)

Provider acknowledgement for an accepted submission.

Signature

type NativeReceipt = RunHandle | JobUnknownOutcome;

Source

NativeRetryRequest (interface)

Provider-facing retry request contract at the adapter boundary.

Signature

export interface NativeRetryRequest {
  readonly runId: string;
  readonly operationId: string;
  readonly retryIdentity?: string;
  readonly canonicalInput?: JobWireEnvelope;
  readonly inputHash?: string;
  readonly inputSchemaHash?: string;
  readonly taskId?: string;
  readonly jobId?: string;
  readonly taskVersion?: string;
  readonly buildId?: string;
  readonly scope?: string;
  readonly acceptanceIdentity?: string;
  readonly canonicalAdmission?: {
    readonly validatePinnedInput: true;
    readonly allocateFreshBudget: true;
    readonly clearInitialDelay: true;
  };
}

Source

NativeSubmission (interface)

Provider request created from a validated job submission.

Signature

export interface NativeSubmission {
  readonly jobId: string;
  readonly taskId: string;
  readonly taskVersion: string;
  readonly buildId: string;
  readonly execution?: "durable" | "retryable";
  readonly scope?: string;
  readonly input: JsonValue;
  readonly operationId: string;
  readonly idempotencyKey?: string;
  readonly canonicalInput?: JobWireEnvelope;
  readonly inputHash?: string;
  readonly inputSchemaHash?: string;
  readonly policy?: JsonValue;
  readonly scheduledFor?: string;
  readonly tags?: readonly string[];
  readonly correlationId?: string;
  readonly parentRunId?: string;
  readonly propagation?: TracePropagation;
  readonly acceptanceIdentity?: string;
  readonly occurrenceIdentity?: string;
  readonly retryOfRunId?: string;
}

Source

NativeWatchRequest (interface)

Provider-facing watch request contract at the adapter boundary.

Signature

export interface NativeWatchRequest {
  readonly runId: string;
  readonly after?: string;
}

Source

OperationContext (interface)

Scope, signal, and tracing data passed to one provider operation.

Signature

export interface OperationContext {
  readonly signal: AbortSignal;
  readonly application: string;
  readonly environment: string;
  readonly scope: string;
  readonly service: string;
  readonly serviceGeneration: string;
  readonly operationId?: string;
  readonly deadlineMs?: number;
  readonly correlationId?: string;
  readonly parentRunId?: string;
  readonly propagation?: TracePropagation;
  readonly acceptanceIdentity?: string;
  readonly occurrenceIdentity?: string;
  readonly inputSchemaHash?: string;
  readonly retryOfRunId?: string;
}

Source

adapter.ts

JOBS_ADAPTER_PROTOCOL_VERSION

Protocol version required by all jobs adapters.

Example

adapter.protocolVersion === JOBS_ADAPTER_PROTOCOL_VERSION;

Signature

declare const JOBS_ADAPTER_PROTOCOL_VERSION: 1;

Source

JobsAdapterRuntime

Signature

declare const JobsAdapterRuntime: JobsAdapterRuntime;

Source

JobsAdapterValidationError (class)

Invalid jobs adapter shape or protocol.

Example

if (error instanceof JobsAdapterValidationError) console.log(error.message);

Signature

declare class JobsAdapterValidationError

Source

JobsCapabilityError

Signature

declare const JobsCapabilityError: typeof JobsCapabilityError;

Source

JobsCapabilityReport

Signature

declare const JobsCapabilityReport: JobsCapabilityReport;

Source

NativeCancelRequest

Signature

declare const NativeCancelRequest: NativeCancelRequest;

Source

NativeControlReceipt

Signature

declare const NativeControlReceipt: NativeControlReceipt;

Source

NativeDurableSleep

Signature

declare const NativeDurableSleep: NativeDurableSleep;

Source

NativeLocator

Signature

declare const NativeLocator: string;

Source

NativeObservation

Signature

declare const NativeObservation: NativeObservation;

Source

NativeProgressWriter

Signature

declare const NativeProgressWriter: NativeProgressWriter;

Source

NativeReceipt

Signature

declare const NativeReceipt: NativeReceipt;

Source

NativeRetryRequest

Signature

declare const NativeRetryRequest: NativeRetryRequest;

Source

NativeRun

Signature

declare const NativeRun: NativeRun;

Source

NativeRunPage

Signature

declare const NativeRunPage: NativeRunPage;

Source

NativeRunQuery

Signature

declare const NativeRunQuery: RunListQuery;

Source

NativeScheduleOperations

Signature

declare const NativeScheduleOperations: NativeScheduleOperations;

Source

NativeStreamWriter

Signature

declare const NativeStreamWriter: NativeStreamWriter;

Source

NativeStreamWriters

Signature

declare const NativeStreamWriters: Readonly<Record<string, NativeStreamWriter>>;

Source

NativeSubmission

Signature

declare const NativeSubmission: NativeSubmission;

Source

NativeTaskWork

Signature

declare const NativeTaskWork: NativeTaskWork;

Source

NativeTaskWorker

Signature

declare const NativeTaskWorker: NativeTaskWorker;

Source

NativeWatchRequest

Signature

declare const NativeWatchRequest: NativeWatchRequest;

Source

OperationContext

Signature

declare const OperationContext: OperationContext;

Source

TaskExecutionBinding

Signature

declare const TaskExecutionBinding: TaskExecutionBinding;

Source

TaskExecutionEnvelope

Signature

declare const TaskExecutionEnvelope: TaskExecutionEnvelope;

Source

TaskExecutor

Signature

declare const TaskExecutor: TaskExecutor;

Source

assertAdapterMethods

Signature

declare const assertAdapterMethods: (adapter: JobsAdapterRuntime) => void;

Source

assertJobsAdapterRuntime

Synchronous adapter shape assertion.

Throws

TypeError or JobsCapabilityError when invalid.

Example

assertJobsAdapterRuntime(adapter);

Signature

declare const assertJobsAdapterRuntime: (value: unknown) => asserts value is JobsAdapterRuntime;

Source

assertJobsAdapterRuntimeEffect

Validates an untrusted jobs adapter in Effect.

Example

Effect.runSync(assertJobsAdapterRuntimeEffect(adapter));

Signature

declare const assertJobsAdapterRuntimeEffect: (
  value: unknown,
) => Effect.Effect<JobsAdapterRuntime, JobsCapabilityFailure | JobsAdapterValidationError, never>;

Source

assertJobsCapability

Signature

declare const assertJobsCapability: (report: JobsCapabilityReport, capability: string) => void;

Source

isJobsAdapterRuntime

Synchronous jobs adapter brand check.

Example

isJobsAdapterRuntime(value);

Signature

declare const isJobsAdapterRuntime: (value: unknown) => value is JobsAdapterRuntime;

Source

isJobsAdapterRuntimeEffect

Checks the jobs adapter brand in Effect.

Example

Effect.runSync(isJobsAdapterRuntimeEffect(value));

Signature

declare const isJobsAdapterRuntimeEffect: (value: unknown) => Effect.Effect<boolean, never, never>;

Source

validateJobsCapabilityReport

Signature

declare const validateJobsCapabilityReport: (value: unknown) => JobsCapabilityReport;

Source

adapter.types.ts

JobsAdapterRuntime (interface)

Provider protocol for submitting, reading, controlling, and observing jobs.

Signature

export interface JobsAdapterRuntime {
  readonly kind: "jobs-adapter-runtime";
  readonly protocolVersion: typeof JOBS_PROTOCOL_VERSION;
  readonly capabilities: JobsCapabilityReport;
  readonly submit: (request: NativeSubmission, context: OperationContext) => Promise<NativeReceipt>;
  readonly get: (locator: NativeLocator, context: OperationContext) => Promise<NativeRun>;
  readonly list: (query: NativeRunQuery, context: OperationContext) => Promise<NativeRunPage>;
  readonly observe: (
    request: NativeWatchRequest,
    context: OperationContext,
  ) => AsyncIterable<NativeObservation>;
  readonly cancel: (
    request: NativeCancelRequest,
    context: OperationContext,
  ) => Promise<NativeControlReceipt>;
  readonly retry?: (
    request: NativeRetryRequest,
    context: OperationContext,
  ) => Promise<NativeControlReceipt>;
  readonly close: () => Promise<void>;
  readonly worker?: NativeTaskWorker;
  readonly schedules?: NativeScheduleOperations;
  readonly streams?: Readonly<Record<string, unknown>>;
}

Source

NativeDurableSleep (interface)

Provider-facing durable sleep contract at the adapter boundary.

Signature

export interface NativeDurableSleep {
  readonly sleep: (key: string, durationMs: number) => Promise<void>;
  readonly sleepUntil?: (key: string, instant: string) => Promise<void>;
}

Source

NativeLocator (type alias)

Provider-facing locator contract at the adapter boundary.

Signature

type NativeLocator = string;

Source

NativeObservation (type alias)

Provider-facing observation contract at the adapter boundary.

Signature

type NativeObservation = RunWatchFrame<NativeRun>;

Source

NativeProgressWriter (interface)

Provider-facing progress writer contract at the adapter boundary.

Signature

export interface NativeProgressWriter {
  readonly emit: (
    value: JsonValue,
    context?: OperationContext,
  ) => MaybePromise<ProgressEmitReceipt | void>;
}

Source

NativeRun (type alias)

Provider-facing run contract at the adapter boundary.

Signature

type NativeRun = RunSnapshot;

Source

NativeRunPage (type alias)

Provider-facing run page contract at the adapter boundary.

Signature

type NativeRunPage = RunPage<NativeRun>;

Source

NativeRunQuery (type alias)

Provider-facing run query contract at the adapter boundary.

Signature

type NativeRunQuery = RunListQuery;

Source

NativeScheduleOperations (interface)

Provider-facing schedule operations contract at the adapter boundary.

Signature

export interface NativeScheduleOperations {
  readonly list: (
    query: Readonly<Record<string, unknown>>,
    context: OperationContext,
  ) => Promise<unknown>;
  readonly get: (id: string, context: OperationContext) => Promise<unknown>;
  readonly upsert: (definition: JsonValue, context: OperationContext) => Promise<unknown>;
  readonly pause: (id: string, context: OperationContext) => Promise<unknown>;
  readonly resume: (id: string, context: OperationContext) => Promise<unknown>;
  readonly delete: (id: string, context: OperationContext) => Promise<unknown>;
}

Source

NativeStreamWriter (interface)

Provider-facing stream writer contract at the adapter boundary.

Signature

export interface NativeStreamWriter {
  readonly emit: (
    value: JsonValue,
    context?: OperationContext,
  ) => MaybePromise<ProgressEmitReceipt | void>;
}

Source

NativeStreamWriters (type alias)

Provider-facing stream writers contract at the adapter boundary.

Signature

type NativeStreamWriters = Readonly<Record<string, NativeStreamWriter>>;

Source

NativeTaskWork (interface)

Provider-facing task work contract at the adapter boundary.

Signature

export interface NativeTaskWork {
  readonly envelope: TaskExecutionEnvelope;
  readonly binding: TaskExecutionBinding;
}

Source

NativeTaskWorker (interface)

Provider worker operations for accepting and completing task work.

Signature

export interface NativeTaskWorker {
  readonly next: (context: OperationContext) => Promise<NativeTaskWork | undefined>;
  readonly complete: (runId: string, output: unknown, context: OperationContext) => Promise<void>;
  readonly fail: (runId: string, error: unknown, context: OperationContext) => Promise<void>;
  /** Returns an intentional provider park/yield to the native continuation owner. */
  readonly suspend?: (runId: string, value: unknown, context: OperationContext) => Promise<void>;
}

Source

TaskExecutionBinding (interface)

Provider-owned context and sinks supplied to one task execution.

Signature

export interface TaskExecutionBinding {
  readonly run: {
    readonly runId: string;
    readonly jobId: string;
    readonly taskId: string;
    readonly taskVersion: string;
    readonly buildId: string;
    readonly service?: string;
    readonly serviceGeneration?: string;
    readonly attempt?: number;
    readonly acceptedAt?: string;
    readonly scheduledFor?: string;
    readonly parentRunId?: string;
    readonly deadlineMs?: number;
    readonly scope?: string;
    readonly inputSchemaHash?: string;
    readonly acceptanceIdentity?: string;
    readonly occurrenceIdentity?: string;
    readonly propagation?: TracePropagation;
  };
  readonly signal: AbortSignal;
  readonly isSuspension?: (cause: unknown) => boolean;
  readonly sleep?: NativeDurableSleep;
  readonly progress?: NativeProgressWriter;
  readonly streams?: NativeStreamWriters;
}

Source

TaskExecutionEnvelope (interface)

Provider-owned envelope containing the accepted task input and run identity.

Signature

export interface TaskExecutionEnvelope {
  readonly runId: string;
  readonly jobId: string;
  readonly taskId: string;
  readonly taskVersion: string;
  readonly buildId: string;
  readonly input: JobWireEnvelope;
  readonly inputHash?: string;
  readonly inputSchemaHash?: string;
  readonly acceptedAt?: string;
  readonly scheduledFor?: string;
  readonly attempt?: number;
  readonly parentRunId?: string;
  readonly service?: string;
  readonly serviceGeneration?: string;
  readonly scope?: string;
  readonly acceptanceIdentity?: string;
  readonly occurrenceIdentity?: string;
  readonly propagation?: TracePropagation;
}

Source

TaskExecutor (interface)

Execution callback used by a native task worker.

Signature

export interface TaskExecutor {
  readonly execute: (
    envelope: TaskExecutionEnvelope,
    binding: TaskExecutionBinding,
  ) => Promise<unknown>;
}

Source

authorization-cursor-codec.ts

createCursorValue

Encodes a bounded authorization cursor, signing it when keys are supplied.

Throws

JobCursorError for invalid binding, key, or encoded size.

Example

createCursorValue(binding, { key: "secret" });

Signature

declare const createCursorValue: (binding: JobCursorBinding, options?: JobCursorOptions) => string;

Source

readCursorValue

Decodes and verifies a cursor against the caller’s trusted authorization binding.

Throws

JobCursorError for invalid encoding, signature, or binding mismatch.

Example

readCursorValue(cursor, expected, { key: "secret" });

Signature

declare const readCursorValue: (
  cursor: string,
  expected: JobCursorBinding,
  options?: JobCursorOptions,
) => JobCursorBinding;

Source

authorization-cursor.ts

JobCursorBinding

Signature

declare const JobCursorBinding: JobCursorBinding;

Source

JobCursorFailure (class)

A rejected cursor creation or verification.

Example

if (error instanceof JobCursorFailure) console.log(error.message);

Signature

declare class JobCursorFailure

Source

JobCursorOptions

Signature

declare const JobCursorOptions: JobCursorOptions;

Source

createJobCursor

Synchronous cursor creator.

Throws

JobCursorError when the binding or encoded cursor is invalid.

Example

createJobCursor(binding, { key: "secret" });

Signature

declare const createJobCursor: (binding: JobCursorBinding, options?: JobCursorOptions) => string;

Source

createJobCursorEffect

Creates a bound, optionally signed job cursor in Effect.

Example

Effect.runSync(createJobCursorEffect(binding, { key: "secret" }));

Signature

declare const createJobCursorEffect: (
  binding: JobCursorBinding,
  options?: JobCursorOptions | undefined,
) => Effect.Effect<string, JobCursorFailure, never>;

Source

readJobCursor

Synchronous bound cursor reader.

Throws

JobCursorError when the cursor is invalid or has a different binding.

Example

readJobCursor(cursor, expected, { key: "secret" });

Signature

declare const readJobCursor: (
  cursor: string,
  expected: JobCursorBinding,
  options?: JobCursorOptions,
) => JobCursorBinding;

Source

readJobCursorEffect

Reads and verifies a cursor against its expected binding in Effect.

Example

Effect.runSync(readJobCursorEffect(cursor, expected, { key: "secret" }));

Signature

declare const readJobCursorEffect: (
  cursor: string,
  expected: JobCursorBinding,
  options?: JobCursorOptions | undefined,
) => Effect.Effect<JobCursorBinding, JobCursorFailure, never>;

Source

authorization-cursor.types.ts

JobCursorBinding (interface)

Trusted job and scope identity bound into a pagination cursor.

Signature

export interface JobCursorBinding {
  readonly application?: string;
  readonly environment?: string;
  readonly scope: string;
  readonly subject?: string;
  readonly jobId: string;
  readonly operation: JobClientOperation;
  readonly filters: JsonValue;
  readonly schema: string;
  readonly position: JsonValue;
}

Source

JobCursorOptions (interface)

Options accepted for job cursor operations.

Signature

export interface JobCursorOptions {
  readonly key: string | Uint8Array;
  readonly keyId?: string;
}

Source

authorization-errors.ts

A caller attempted a job operation outside its trusted grant.

Example

new JobAuthorizationError("Run belongs to another subject");

JobAuthorizationError (class)

A caller attempted a job operation outside its trusted grant.

Example

new JobAuthorizationError("Run belongs to another subject");

Signature

declare class JobAuthorizationError {
  constructor(message = "Job operation is not authorized");
}

Source

code (property)

Signature

readonly code: "RELKIT_JOB_ACCESS_DENIED"

Source

JobCursorError (class)

A continuation cursor is malformed or bound to another request.

Example

new JobCursorError();

Signature

declare class JobCursorError {
  constructor();
}

Source

code (property)

Signature

readonly code: "RELKIT_JOB_CURSOR_INVALID"

Source

authorization-failure.ts

JobAuthorizationFailure (class)

A denied or malformed jobs authorization decision.

Example

new JobAuthorizationFailure({ reason: "scope" });

Signature

declare class JobAuthorizationFailure

Source

authorization-grant.ts

assertAuthorizedOperation

Synchronous compatibility assertion for an authorized operation.

Throws

JobAuthorizationError for an invalid grant or request.

Example

assertAuthorizedOperation(grant, request, trusted);

Signature

declare const assertAuthorizedOperation: (
  grant: JobAccessGrant,
  request: JobAccessRequest,
  trusted: TrustedJobScope,
  now?: number,
) => void;

Source

assertAuthorizedOperationEffect

Validates a grant and the requested operation in Effect.

Example

Effect.runPromise(assertAuthorizedOperationEffect(grant, request, trusted));

Signature

declare const assertAuthorizedOperationEffect: (
  grant: JobAccessGrant,
  request: JobAccessRequest,
  trusted: TrustedJobScope,
  now?: number | undefined,
) => Effect.Effect<undefined, JobAuthorizationFailure, never>;

Source

assertJobGrant

Synchronous compatibility assertion for policy grants.

Throws

JobAuthorizationError for an invalid or expired grant.

Example

assertJobGrant({ scope: "tenant:a" }, trusted);

Signature

declare const assertJobGrant: (
  value: unknown,
  trusted: TrustedJobScope,
  now?: number,
) => asserts value is JobAccessGrant;

Source

assertJobGrantEffect

Validates a grant against a trusted tenant scope and current time.

Example

Effect.runPromise(assertJobGrantEffect({ scope: "tenant:a" }, trusted));

Signature

declare const assertJobGrantEffect: (
  value: unknown,
  trusted: TrustedJobScope,
  now?: number | undefined,
) => Effect.Effect<JobAccessGrant, JobAuthorizationFailure, never>;

Source

boundedTextEffect

Checks bounded trusted and grant strings.

Example

Effect.runPromise(boundedTextEffect("tenant:a"));

Signature

declare const boundedTextEffect: (
  value: unknown,
) => Effect.Effect<undefined, JobAuthorizationFailure, never>;

Source

authorization-projection.ts

JobProjectionOptions

Signature

declare const JobProjectionOptions: JobProjectionOptions;

Source

projectRunPage

Synchronous compatibility projection of a page.

Example

projectRunPage(page, ["progress"]);

Signature

declare const projectRunPage: (
  page: RunPage<RunSnapshot>,
  fields?: readonly JobClientField[],
  options?: JobProjectionOptions,
) => RunPage<RunSnapshot>;

Source

projectRunPageEffect

Projects a page of runs without exposing fields outside the grant.

Example

Effect.runSync(projectRunPageEffect(page, ["progress"]));

Signature

declare const projectRunPageEffect: (
  page: RunPage<RunSnapshot>,
  fields?: ReadonlyArray<JobClientField> | undefined,
  options?: JobProjectionOptions | undefined,
) => Effect.Effect<RunPage<RunSnapshot>, never, never>;

Source

projectRunSnapshot

Synchronous compatibility projection of one run.

Example

projectRunSnapshot(run, ["output"]);

Signature

declare const projectRunSnapshot: (
  run: RunSnapshot,
  fields?: readonly JobClientField[],
  options?: JobProjectionOptions,
) => RunSnapshot;

Source

projectRunSnapshotEffect

Copies only authorized run fields into a safe client snapshot.

Example

Effect.runSync(projectRunSnapshotEffect(run, ["output"]));

Signature

declare const projectRunSnapshotEffect: (
  run: RunSnapshot,
  fields?: ReadonlyArray<JobClientField> | undefined,
  options?: JobProjectionOptions | undefined,
) => Effect.Effect<RunSnapshot, never, never>;

Source

authorization-projection.types.ts

Fields needed to disclose a declared job error safely.

JobProjectionOptions (interface)

Fields needed to disclose a declared job error safely.

Signature

export interface JobProjectionOptions {
  readonly declaredErrorIds?: readonly string[];
}

Source

authorization.ts

JobAuthorizationError

Signature

declare const JobAuthorizationError: typeof JobAuthorizationError;

Source

JobAuthorizationFailure

Signature

declare const JobAuthorizationFailure: typeof JobAuthorizationFailure;

Source

JobCursorBinding

Signature

declare const JobCursorBinding: any;

Source

JobCursorError

Signature

declare const JobCursorError: typeof JobCursorError;

Source

JobCursorFailure

Signature

declare const JobCursorFailure: typeof JobCursorFailure;

Source

JobCursorOptions

Signature

declare const JobCursorOptions: any;

Source

TrustedJobScope

Signature

declare const TrustedJobScope: TrustedJobScope;

Source

assertAuthorizedOperation

Signature

declare const assertAuthorizedOperation: (
  grant: JobAccessGrant,
  request: JobAccessRequest,
  trusted: TrustedJobScope,
  now?: number,
) => void;

Source

assertAuthorizedOperationEffect

Signature

declare const assertAuthorizedOperationEffect: (
  grant: JobAccessGrant,
  request: JobAccessRequest,
  trusted: TrustedJobScope,
  now?: number | undefined,
) => Effect.Effect<undefined, JobAuthorizationFailure, never>;

Source

assertJobGrant

Signature

declare const assertJobGrant: (
  value: unknown,
  trusted: TrustedJobScope,
  now?: number,
) => asserts value is JobAccessGrant;

Source

assertJobGrantEffect

Signature

declare const assertJobGrantEffect: (
  value: unknown,
  trusted: TrustedJobScope,
  now?: number | undefined,
) => Effect.Effect<JobAccessGrant, JobAuthorizationFailure, never>;

Source

authorize

Compatibility alias for authorizeJobAccess.

Example

await authorize(job, request, trusted);

Signature

declare const authorize: (
  job: JobDescriptorAny,
  request: JobAccessRequest,
  trusted: TrustedJobScope,
  context?: JobAuthorizationContext,
) => Promise<JobAccessGrant>;

Source

authorizeJobAccess

Promise compatibility adapter for job authorization. Preflight denials still throw synchronously before a Promise is returned.

Throws

JobAuthorizationError for invalid preflight or policy decisions.

Example

await authorizeJobAccess(job, request, trusted);

Signature

declare const authorizeJobAccess: (
  job: JobDescriptorAny,
  request: JobAccessRequest,
  trusted: TrustedJobScope,
  context?: JobAuthorizationContext,
) => Promise<JobAccessGrant>;

Source

authorizeJobAccessEffect

Authorizes a job operation against trusted scope in Effect. Policy callback failures are redacted to a tagged authorization failure.

Example

Effect.runPromise(authorizeJobAccessEffect(job, request, trusted));

Signature

declare const authorizeJobAccessEffect: (
  job: JobDescriptorAny,
  request: JobAccessRequest,
  trusted: TrustedJobScope,
  context?: JobAuthorizationContext | undefined,
) => Effect.Effect<Readonly<{ scope: string }>, JobAuthorizationFailure, never>;

Source

createCursor

Compatibility alias for createJobCursor.

Example

createCursor(options);

Signature

declare const createCursor: (binding: JobCursorBinding, options?: JobCursorOptions) => string;

Source

createJobCursor

Signature

declare const createJobCursor: (binding: JobCursorBinding, options?: JobCursorOptions) => string;

Source

createJobCursorEffect

Signature

declare const createJobCursorEffect: (
  binding: JobCursorBinding,
  options?: JobCursorOptions | undefined,
) => Effect.Effect<string, JobCursorFailure, never>;

Source

decodeCursor

Compatibility alias for readJobCursor.

Example

decodeCursor(cursor, options);

Signature

declare const decodeCursor: (
  cursor: string,
  expected: JobCursorBinding,
  options?: JobCursorOptions,
) => JobCursorBinding;

Source

projectRun

Compatibility alias for projectRunSnapshot.

Example

projectRun(snapshot, grant);

Signature

declare const projectRun: (
  run: RunSnapshot,
  fields?: readonly JobClientField[],
  options?: JobProjectionOptions,
) => RunSnapshot;

Source

projectRunPage

Signature

declare const projectRunPage: (
  page: RunPage<RunSnapshot>,
  fields?: readonly JobClientField[],
  options?: JobProjectionOptions,
) => RunPage<RunSnapshot>;

Source

projectRunPageEffect

Signature

declare const projectRunPageEffect: (
  page: RunPage<RunSnapshot>,
  fields?: ReadonlyArray<JobClientField> | undefined,
  options?: JobProjectionOptions | undefined,
) => Effect.Effect<RunPage<RunSnapshot>, never, never>;

Source

projectRunSnapshot

Signature

declare const projectRunSnapshot: (
  run: RunSnapshot,
  fields?: readonly JobClientField[],
  options?: JobProjectionOptions,
) => RunSnapshot;

Source

projectRunSnapshotEffect

Signature

declare const projectRunSnapshotEffect: (
  run: RunSnapshot,
  fields?: ReadonlyArray<JobClientField> | undefined,
  options?: JobProjectionOptions | undefined,
) => Effect.Effect<RunSnapshot, never, never>;

Source

readJobCursor

Signature

declare const readJobCursor: (
  cursor: string,
  expected: JobCursorBinding,
  options?: JobCursorOptions,
) => JobCursorBinding;

Source

readJobCursorEffect

Signature

declare const readJobCursorEffect: (
  cursor: string,
  expected: JobCursorBinding,
  options?: JobCursorOptions | undefined,
) => Effect.Effect<JobCursorBinding, JobCursorFailure, never>;

Source

authorization.types.ts

Trusted application and tenant context for a jobs authorization decision. The scope may be narrowed by a policy but never broadened.

Example

const trusted: TrustedJobScope = { application: "app", environment: "test", scope: "tenant:a" };

TrustedJobScope (interface)

Trusted application and tenant context for a jobs authorization decision. The scope may be narrowed by a policy but never broadened.

Example

const trusted: TrustedJobScope = { application: "app", environment: "test", scope: "tenant:a" };

Signature

export interface TrustedJobScope {
  readonly application: string;
  readonly environment: string;
  readonly scope: string;
  readonly subject?: string;
}

Source

canonical-support.ts

CanonicalProjectionError (class)

A task schema that cannot be represented as faithful canonical JSON.

Example

new CanonicalProjectionError({ name: "input", reason: "invalid schema" });

Signature

declare class CanonicalProjectionError

Source

assertCanonicalProjection

Synchronous canonical-schema assertion.

Throws

TypeError when the projection is not faithful canonical JSON.

Example

assertCanonicalProjection({ type: "string" }, "input");

Signature

declare const assertCanonicalProjection: (
  value: unknown,
  name: string,
  allowVoid?: boolean,
) => void;

Source

assertCanonicalProjectionEffect

Traverses a projected schema in Effect, preserving exact validation failures.

Example

Effect.runPromise(assertCanonicalProjectionEffect({ type: "string" }, "input"));

Signature

declare const assertCanonicalProjectionEffect: (
  value: unknown,
  name: string,
  allowVoid?: any,
) => Effect.Effect<void, CanonicalProjectionError, never>;

Source

capabilities.ts

JobsCapability

Signature

declare const JobsCapability: JobsCapability;

Source

JobsCapabilityError (class)

Compatibility error raised by synchronous capability checks.

Example

if (error instanceof JobsCapabilityError) console.log(error.message);

Signature

declare class JobsCapabilityError {
  constructor(capability: string, message = `Jobs capability "${capability}" is unavailable`);
}

Source

code (property)

Signature

readonly code: "RELKIT_JOB_CAPABILITY_UNSUPPORTED"

Source

capability (property)

Signature

readonly capability: string

Source

JobsCapabilityFailure (class)

A capability rejected by the Effect jobs boundary.

Example

if (error instanceof JobsCapabilityFailure) console.log(error.message);

Signature

declare class JobsCapabilityFailure

Source

JobsCapabilityName

Signature

declare const JobsCapabilityName: JobsCapabilityName;

Source

JobsCapabilityReport

Signature

declare const JobsCapabilityReport: JobsCapabilityReport;

Source

JobsCapabilitySupport

Signature

declare const JobsCapabilitySupport: JobsCapabilitySupport;

Source

assertAdapterMethods

Signature

declare const assertAdapterMethods: (adapter: JobsAdapterRuntime) => void;

Source

assertAdapterMethodsEffect

Signature

declare const assertAdapterMethodsEffect: (
  adapter: JobsAdapterRuntime,
) => Effect.Effect<undefined, JobsCapabilityFailure, never>;

Source

assertJobsCapability

Synchronously requires a supported jobs capability.

Throws

JobsCapabilityError when unsupported.

Example

assertJobsCapability(report, "submission");

Signature

declare const assertJobsCapability: (report: JobsCapabilityReport, capability: string) => void;

Source

assertJobsCapabilityEffect

Requires support for one jobs capability.

Example

Effect.runSync(assertJobsCapabilityEffect(report, "submission"));

Signature

declare const assertJobsCapabilityEffect: (
  report: JobsCapabilityReport,
  capability: string,
) => Effect.Effect<undefined, JobsCapabilityFailure, never>;

Source

validateJobsCapabilityReport

Synchronously validates and freezes a provider report.

Throws

JobsCapabilityError when invalid.

Example

validateJobsCapabilityReport(candidate);

Signature

declare const validateJobsCapabilityReport: (value: unknown) => JobsCapabilityReport;

Source

validateJobsCapabilityReportEffect

Validates and freezes an untrusted provider report in Effect.

Example

Effect.runSync(validateJobsCapabilityReportEffect(candidate));

Signature

declare const validateJobsCapabilityReportEffect: (
  value: unknown,
) => Effect.Effect<JobsCapabilityReport, JobsCapabilityFailure, never>;

Source

capabilities.types.ts

Level of support reported by a jobs provider.

JobsCapability (interface)

Evidence and constraints for one provider capability.

Signature

export interface JobsCapability {
  readonly support: JobsCapabilitySupport;
  readonly constraints?: Readonly<Record<string, unknown>>;
  readonly evidence?: readonly string[];
}

Source

JobsCapabilityName (type alias)

Standard jobs capability names.

Signature

type JobsCapabilityName =
  "submission" | "read" | "list" | "observation" | "cancel" | "retry" | "schedules" | "streams";

Source

JobsCapabilityReport (interface)

Provider capabilities validated at the jobs boundary.

Signature

export interface JobsCapabilityReport {
  readonly service: string;
  readonly provider?: string;
  readonly adapterId?: string;
  readonly protocolVersion?: 1;
  readonly features: Readonly<Record<string, boolean>>;
  readonly capabilities?: Readonly<Record<string, JobsCapability>>;
  readonly limits?: Readonly<Record<string, number>>;
}

Source

JobsCapabilitySupport (type alias)

Level of support reported by a jobs provider.

Signature

type JobsCapabilitySupport = "native" | "adapter" | "unsupported" | "unverified";

Source

client-abort.ts

JobClientAbortFailure (class)

Cancelled, timed out, or failed client enqueue, with the original cause.

Example

if (error instanceof JobClientAbortFailure) console.log(error.message);

Signature

declare class JobClientAbortFailure

Source

runAbortable

Promise compatibility adapter for abortable client work.

Throws

The original cancellation, timeout, or provider error.

Example

await runAbortable(signal, undefined, () => Promise.resolve("ok"));

Signature

declare const runAbortable: <A>(
  signal: AbortSignal,
  deadlineMs: number | undefined,
  work: (signal: AbortSignal) => Promise<A>,
) => Promise<A>;

Source

runAbortableEffect

Runs client work with an Effect owned abort listener and deadline.

Example

Effect.runPromise(runAbortableEffect(signal, undefined, () => Promise.resolve("ok")));

Signature

declare const runAbortableEffect: <A>(
  signal: AbortSignal,
  deadlineMs: number | undefined,
  work: (signal: AbortSignal) => Promise<A>,
) => Effect.Effect<Awaited<A>, JobClientAbortFailure, never>;

Source

client-abort.types.ts

Cancellation and deadline state owned by one client enqueue.

JobClientAbortRegistration (interface)

Cancellation and deadline state owned by one client enqueue.

Signature

export interface JobClientAbortRegistration {
  readonly stopped: Promise<Error>;
  readonly failure: () => Error | undefined;
  readonly dispose: () => void;
}

Source

client-errors.ts

JobDependencyError (class)

A job call crossed an undeclared function dependency boundary.

Example

new JobDependencyError("billing.charge");

Signature

declare class JobDependencyError { constructor(readonly jobId: string) }

Source

code (property)

Signature

readonly code: "RELKIT_JOB_DEPENDENCY_UNDECLARED"

Source

JobInputValidationError (class)

Invalid caller input with the schema issues retained for clients.

Example

new JobInputValidationError(issues);

Signature

declare class JobInputValidationError { constructor(readonly issues: readonly StandardIssue[]) }

Source

code (property)

Signature

readonly code: "RELKIT_JOB_INPUT_VALIDATION"

Source

JobOperationCancelledError (class)

Caller cancellation before the job operation completed.

Example

new JobOperationCancelledError();

Signature

declare class JobOperationCancelledError {
  constructor();
}

Source

code (property)

Signature

readonly code: "ABORT_ERR"

Source

JobOperationTimeoutError (class)

A job client operation exceeded its configured timeout.

Example

new JobOperationTimeoutError();

Signature

declare class JobOperationTimeoutError {
  constructor();
}

Source

code (property)

Signature

readonly code: "ETIMEDOUT"

Source

JobProfileError (class)

Requested job provider profile is absent from client configuration.

Example

new JobProfileError("primary");

Signature

declare class JobProfileError { constructor(readonly profile: string) }

Source

code (property)

Signature

readonly code: "RELKIT_JOB_PROFILE_UNKNOWN"

Source

JobProviderError (class)

The selected provider does not implement job enqueue.

Example

new JobProviderError();

Signature

declare class JobProviderError {
  constructor();
}

Source

code (property)

Signature

readonly code: "RELKIT_JOB_PROVIDER_UNAVAILABLE"

Source

client-utils-error.ts

ClientUtilityFailure (class)

Expected client helper failure with its original compatibility error.

Example

if (error instanceof ClientUtilityFailure) console.log(error.message);

Signature

declare class ClientUtilityFailure

Source

client-utils-output.ts

normalizeResult

Synchronous provider receipt normalizer.

Throws

Original normalization error.

Example

normalizeResult(receipt, "default", undefined);

Signature

declare const normalizeResult: (
  value: JobProviderResult | undefined,
  profile: string,
  correlationId: string | undefined,
) => JobEnqueueResult;

Source

normalizeResultEffect

Normalizes a provider receipt in Effect.

Example

Effect.runSync(normalizeResultEffect(receipt, "default", undefined));

Signature

declare const normalizeResultEffect: (
  value: JobProviderResult | undefined,
  profile: string,
  correlationId: string | undefined,
) => Effect.Effect<JobEnqueueResult, ClientUtilityFailure, never>;

Source

notify

Synchronous client edge hook notification.

Example

notify(onEdge, edge);

Signature

declare const notify: <T>(
  hook: ((value: T) => void) | undefined,
  value: T,
  enabled?: boolean,
) => void;

Source

notifyEffect

Delivers a client edge hook without changing enqueue outcome in Effect.

Example

Effect.runSync(notifyEffect(onEdge, edge));

Signature

declare const notifyEffect: <T>(
  hook: ((value: T) => void) | undefined,
  value: T,
  enabled?: boolean | undefined,
) => Effect.Effect<void, never, never>;

Source

resolveCorrelation

Synchronous correlation id resolver.

Throws

Original callback error.

Example

resolveCorrelation(() => "request");

Signature

declare const resolveCorrelation: (value: JobClientOptions["correlationId"]) => string | undefined;

Source

resolveCorrelationEffect

Resolves a configured correlation id in Effect.

Example

Effect.runSync(resolveCorrelationEffect(() => "request"));

Signature

declare const resolveCorrelationEffect: (
  value: string | (() => string | undefined) | undefined,
) => Effect.Effect<string | undefined, ClientUtilityFailure, never>;

Source

client-utils-validation.ts

assertOptionalText

Synchronous optional client text assertion.

Throws

TypeError for invalid text.

Example

assertOptionalText("request", "correlationId");

Signature

declare const assertOptionalText: (value: unknown, name: string) => void;

Source

assertOptionalTextEffect

Validates optional client text in Effect.

Example

Effect.runSync(assertOptionalTextEffect("request", "correlationId"));

Signature

declare const assertOptionalTextEffect: (
  value: unknown,
  name: string,
) => Effect.Effect<void, ClientUtilityFailure, never>;

Source

assertOptions

Synchronous enqueue options assertion.

Throws

TypeError for invalid options.

Example

assertOptions({ correlationId: "request" });

Signature

declare const assertOptions: (
  value: unknown,
) => asserts value is { readonly correlationId?: string };

Source

assertOptionsEffect

Validates enqueue options in Effect.

Example

Effect.runSync(assertOptionsEffect({ correlationId: "request" }));

Signature

declare const assertOptionsEffect: (
  value: unknown,
) => Effect.Effect<void, ClientUtilityFailure, never>;

Source

parseInput

Promise compatibility input validator.

Throws

Original input validation error.

Example

await parseInput(z.string(), "value");

Signature

declare const parseInput: (
  schema: StandardSchemaV1 | undefined,
  input: unknown,
) => Promise<unknown>;

Source

parseInputEffect

Validates client input against an optional schema in Effect.

Example

Effect.runPromise(parseInputEffect(z.string(), "value"));

Signature

declare const parseInputEffect: (
  schema: StandardSchemaV1<unknown, unknown> | undefined,
  input: unknown,
) => Effect.Effect<unknown, ClientUtilityFailure, never>;

Source

resolveProvider

Synchronous provider resolver.

Throws

Original profile or provider error.

Example

resolveProvider(source, "default", undefined);

Signature

declare const resolveProvider: (
  source: unknown,
  profile: string,
  resolveProfile: ((profile: string) => unknown) | undefined,
) => JobProvider;

Source

resolveProviderEffect

Resolves a job provider in Effect.

Example

Effect.runSync(resolveProviderEffect(source, "default"));

Signature

declare const resolveProviderEffect: (
  source: unknown,
  profile: string,
  resolveProfile: ((profile: string) => unknown) | undefined,
) => Effect.Effect<JobProvider, ClientUtilityFailure, never>;

Source

client-utils-value.ts

assertOptionalTextValue

Requires a present optional text field to be nonempty.

Throws

TypeError for nontext or blank text.

Example

assertOptionalTextValue("request-1", "correlationId");

Signature

declare const assertOptionalTextValue: (value: unknown, name: string) => void;

Source

assertOptionsValue

Validates the client enqueue options shape and correlation identifier.

Throws

TypeError for missing object shape or invalid correlation text.

Example

assertOptionsValue({ correlationId: "request-1" });

Signature

declare const assertOptionsValue: (
  value: unknown,
) => asserts value is { readonly correlationId?: string };

Source

normalizeResultValue

Normalizes a provider acceptance into the public enqueue receipt.

Example

normalizeResultValue(result, "primary", "request-1");

Signature

declare const normalizeResultValue: (
  value: JobProviderResult | undefined,
  profile: string,
  correlationId: string | undefined,
) => JobEnqueueResult;

Source

notifyValue

Calls an optional observer without letting hook errors change acceptance.

Example

notifyValue(onAccepted, receipt);

Signature

declare const notifyValue: <T>(
  hook: ((value: T) => void) | undefined,
  value: T,
  enabled?: boolean,
) => void;

Source

parseInputValue

Validates authored client input before enqueueing.

Throws

JobInputValidationError for schema issues.

Example

await parseInputValue(schema, { id: "one" });

Signature

declare const parseInputValue: (
  schema: StandardSchemaV1 | undefined,
  input: unknown,
) => Promise<unknown>;

Source

resolveCorrelationValue

Resolves a literal or lazy client correlation identifier.

Example

resolveCorrelationValue(() => "request-1");

Signature

declare const resolveCorrelationValue: (
  value: JobClientOptions["correlationId"],
) => string | undefined;

Source

resolveProviderValue

Resolves an enqueue provider from a named profile or explicit resolver.

Throws

JobProfileError or JobProviderError when unavailable.

Example

resolveProviderValue(providers, "primary", undefined);

Signature

declare const resolveProviderValue: (
  source: unknown,
  profile: string,
  resolveProfile: ((profile: string) => unknown) | undefined,
) => JobProvider;

Source

client-utils.ts

“./client-utils-output.js” (namespace export)

Re-exports all named exports from the “./client-utils-output.js” module.

Signature

export * from "./client-utils-output.js";

Source

“./client-utils-validation.js” (namespace export)

Re-exports all named exports from the “./client-utils-validation.js” module.

Signature

export * from "./client-utils-validation.js";

Source

ClientUtilityFailure

Signature

declare const ClientUtilityFailure: typeof ClientUtilityFailure;

Source

JobClientAbortFailure

Signature

declare const JobClientAbortFailure: typeof JobClientAbortFailure;

Source

runAbortable

Signature

declare const runAbortable: <A>(
  signal: AbortSignal,
  deadlineMs: number | undefined,
  work: (signal: AbortSignal) => Promise<A>,
) => Promise<A>;

Source

runAbortableEffect

Signature

declare const runAbortableEffect: <A>(
  signal: AbortSignal,
  deadlineMs: number | undefined,
  work: (signal: AbortSignal) => Promise<A>,
) => Effect<Awaited<A>, JobClientAbortFailure, never>;

Source

client.ts

EffectJobClient

Signature

declare const EffectJobClient: EffectJobClient<Input>;

Source

JobClient

Signature

declare const JobClient: JobClient<Input>;

Source

JobClientFailure (class)

Expected client setup or enqueue failure, preserving its original cause.

Example

if (error instanceof JobClientFailure) console.log(error.message);

Signature

declare class JobClientFailure

Source

JobClientOptions

Signature

declare const JobClientOptions: JobClientOptions;

Source

JobDeclaredEdge

Signature

declare const JobDeclaredEdge: JobDeclaredEdge;

Source

JobDependencyError

Signature

declare const JobDependencyError: typeof JobDependencyError;

Source

JobEnqueueOptions

Signature

declare const JobEnqueueOptions: JobEnqueueOptions;

Source

JobEnqueueResult

Signature

declare const JobEnqueueResult: JobEnqueueResult;

Source

JobInputValidationError

Signature

declare const JobInputValidationError: typeof JobInputValidationError;

Source

JobInvocationBridge

Signature

declare const JobInvocationBridge: JobInvocationBridge;

Source

JobInvocationBridgeOptions

Signature

declare const JobInvocationBridgeOptions: JobInvocationBridgeOptions;

Source

JobObservedEdge

Signature

declare const JobObservedEdge: JobObservedEdge;

Source

JobOperationCancelledError

Signature

declare const JobOperationCancelledError: typeof JobOperationCancelledError;

Source

JobOperationContext

Signature

declare const JobOperationContext: JobOperationContext;

Source

JobOperationTimeoutError

Signature

declare const JobOperationTimeoutError: typeof JobOperationTimeoutError;

Source

JobProfileError

Signature

declare const JobProfileError: typeof JobProfileError;

Source

JobProvider

Signature

declare const JobProvider: JobProvider;

Source

JobProviderError

Signature

declare const JobProviderError: typeof JobProviderError;

Source

JobProviderResult

Signature

declare const JobProviderResult: JobProviderResult;

Source

JobState

Signature

declare const JobState: JobState;

Source

JobStatus

Signature

declare const JobStatus: JobStatus;

Source

createJobClient

Synchronous compatibility client factory.

Throws

The original invalid profile or provider error.

Example

createJobClient(options);

Signature

declare const createJobClient: (options: JobClientOptions) => EffectJobClient;

Source

createJobClientEffect

Creates a jobs enqueue client in Effect.

Example

Effect.runSync(createJobClientEffect(options));

Signature

declare const createJobClientEffect: (
  options: JobClientOptions,
) => Effect.Effect<EffectJobClient<unknown>, JobClientFailure, never>;

Source

client.types.ts

EffectJobClient (interface)

A client whose enqueue operation is directly available in Effect.

Signature

export interface EffectJobClient<Input = unknown> extends JobClient<Input> {
  readonly enqueueEffect: (
    input: Input,
    options?: JobEnqueueOptions,
  ) => Effect.Effect<JobEnqueueResult, JobClientFailure>;
}

Source

JobClient (interface)

Client operations exposed for a job through its provider.

Signature

export interface JobClient<Input = unknown> {
  readonly enqueue: (input: Input, options?: JobEnqueueOptions) => Promise<JobEnqueueResult>;
}

Source

JobClientOptions (interface)

Options accepted for job client operations.

Signature

export interface JobClientOptions {
  readonly ownerId: string;
  readonly jobId: string;
  readonly source: unknown;
  readonly inputSchema?: StandardSchemaV1;
  readonly profile?: string;
  readonly resolveProfile?: (profile: string) => unknown;
  readonly bridge?: JobInvocationBridge;
  readonly signal?: () => AbortSignal;
  readonly deadline?: () => number | undefined;
  readonly correlationId?: string | (() => string | undefined);
  readonly declared?: boolean;
  readonly onDeclaredEdge?: (edge: JobDeclaredEdge) => void;
  readonly onObservedEdge?: (edge: JobObservedEdge) => void;
}

Source

JobClientState (interface)

Resolved dependencies shared by a client’s enqueue operations.

Signature

export interface JobClientState {
  readonly options: JobClientOptions;
  readonly ownerId: string;
  readonly jobId: string;
  readonly profile: string;
  readonly declared: boolean;
  readonly provider: JobProvider;
}

Source

JobDeclaredEdge (interface)

Declared dependency between a task and job.

Signature

export interface JobDeclaredEdge {
  readonly kind: "enqueues-job";
  readonly from: string;
  readonly to: string;
}

Source

JobInvocationBridge (interface)

Bridge for invoking jobs from a task execution context.

Signature

export interface JobInvocationBridge {
  readonly run: <A>(
    operation: () => MaybePromise<A>,
    options?: JobInvocationBridgeOptions,
  ) => Promise<A>;
}

Source

JobInvocationBridgeOptions (interface)

Options accepted for job invocation bridge operations.

Signature

export interface JobInvocationBridgeOptions {
  readonly name: string;
  readonly attributes: Readonly<Record<string, unknown>>;
  readonly signal: AbortSignal;
  readonly kind?: "producer";
  readonly input?: unknown;
}

Source

JobObservedEdge (interface)

Job edge recorded during a concrete invocation.

Signature

export interface JobObservedEdge {
  readonly relationship: "enqueues-job";
  readonly from: string;
  readonly to: string;
}

Source

JobOperationContext (interface)

Trusted job, scope, and signal data available during a client operation.

Signature

export interface JobOperationContext {
  readonly operation: "enqueue";
  readonly signal: AbortSignal;
  readonly profile: string;
  readonly deadlineMs?: number;
  readonly correlationId?: string;
  readonly propagation?: TracePropagation;
}

Source

JobProvider (interface)

Provider callback used to resolve the jobs runtime.

Signature

export interface JobProvider {
  readonly enqueue: (
    input: unknown,
    options: JobEnqueueOptions,
    context: JobOperationContext,
  ) => MaybePromise<JobProviderResult>;
}

Source

JobProviderResult (type alias)

Runtime or handle returned by the job provider.

Signature

type JobProviderResult = Pick<JobEnqueueResult, "instanceId" | "accepted"> &
  Partial<
    Pick<
      JobEnqueueResult,
      | "status"
      | "profile"
      | "correlationId"
      | "duplicate"
      | "idempotencyKey"
      | "idempotencyExpiresAt"
    >
  >;

Source

control-errors.ts

JobControlUnknownError (class)

A native control write may have committed; callers can recover by operation ID.

Example

new JobControlUnknownError("cancel-1", "same-key");

Signature

declare class JobControlUnknownError { constructor(
    readonly operationId: string,
    readonly idempotencyKey?: string,
    recovery: JobUnknownOutcome["recovery"] = { action: "inspect-native" },
  ) }

Source

toJSON (method)

Serializes the bounded recovery contract for callers.

Example

error.toJSON();

Signature

declare const toJSON: () => JobUnknownOutcome;

Source

code (property)

Signature

readonly code: "RELKIT_JOB_CONTROL_UNKNOWN"

Source

outcome (property)

Signature

readonly outcome: "unknown"

Source

recovery (property)

Signature

readonly recovery: { readonly action: "retry-with-same-key" | "inspect-native" | "unavailable"; readonly expiresAt?: string; }

Source

JobObservationTimeoutError (class)

A native observation read exceeded its bounded timeout.

Example

new JobObservationTimeoutError(5_000);

Signature

declare class JobObservationTimeoutError { constructor(readonly timeoutMs: number) }

Source

code (property)

Signature

readonly code: "RELKIT_JOB_OBSERVATION_TIMEOUT"

Source

JobResultUnavailableError (class)

A completed run has no result available to this caller.

Example

new JobResultUnavailableError("expired");

Signature

declare class JobResultUnavailableError { constructor(
    readonly availability: string,
    message = "The requested job result is unavailable",
  ) }

Source

code (property)

Signature

readonly code: "RELKIT_JOB_RESULT_UNAVAILABLE"

Source

TaskBlockingWaitError (class)

Task execution cannot synchronously wait for another task result.

Example

new TaskBlockingWaitError();

Signature

declare class TaskBlockingWaitError {
  constructor();
}

Source

code (property)

Signature

readonly code: "RELKIT_TASK_BLOCKING_WAIT_UNSUPPORTED"

Source

control-observe.ts

JobObserveFailure (class)

Expected run observation failure with its original cause.

Example

if (error instanceof JobObserveFailure) console.log(error.message);

Signature

declare class JobObserveFailure

Source

observeWithTimeout

Compatibility async iterable with scoped iterator cleanup.

Throws

Original read, cancellation, or timeout error while consuming.

Example

for await (const frame of observeWithTimeout(source, signal, 1000)) console.log(frame);

Signature

declare const observeWithTimeout: (
  source: AsyncIterable<RunWatchFrame<RunSnapshot>>,
  signal: AbortSignal,
  timeoutMs: number,
) => AsyncIterable<RunWatchFrame<RunSnapshot>>;

Source

observeWithTimeoutEffect

Creates a scoped run observation stream in Effect.

Example

Effect.runPromise(
  Effect.flatMap(observeWithTimeoutEffect(source, signal, 1000), Stream.runCollect),
);

Signature

declare const observeWithTimeoutEffect: (
  source: AsyncIterable<RunWatchFrame<RunSnapshot>>,
  signal: AbortSignal,
  timeoutMs: number,
) => Effect.Effect<
  Stream.Stream<RunWatchFrame<RunSnapshot>, JobObserveFailure, never>,
  never,
  never
>;

Source

control-result.ts

JobResultFailure (class)

Expected result polling failure retaining its original cause.

Example

if (error instanceof JobResultFailure) console.log(error.message);

Signature

declare class JobResultFailure

Source

ReadRun

Signature

declare const ReadRun: ReadRun;

Source

ResultRunReader (class)

Injectable run snapshot reader for result polling.

Example

const service = yield * ResultRunReader;

Signature

declare class ResultRunReader

Source

resultRunReaderLayer

Provides a snapshot reader for deterministic result polling.

Example

Effect.provide(waitForResultEffect(runtime, id, options), resultRunReaderLayer(readRun));

Signature

declare const resultRunReaderLayer: (
  readRun: ReadRun,
) => Layer.Layer<ResultRunReader, never, never>;

Source

waitForResult

Promise compatibility result polling.

Throws

Original validation, cancellation, read, or availability error.

Example

await waitForResult(runtime, id, options, readRun);

Signature

declare const waitForResult: (
  runtime: JobsRuntime,
  runId: string,
  options: RunResultOptions,
  readRun: ReadRun,
) => Promise<unknown>;

Source

waitForResultEffect

Polls for a terminal result with Effect Clock and an owned abort listener.

Example

Effect.runPromise(
  Effect.provide(waitForResultEffect(runtime, id, options), resultRunReaderLayer(readRun)),
);

Signature

declare const waitForResultEffect: (
  runtime: JobsRuntime,
  runId: string,
  options: RunResultOptions,
) => Effect.Effect<unknown, JobResultFailure, ResultRunReader>;

Source

control-result.types.ts

ReadRun (type alias)

Substitutable snapshot reader for result polling.

Signature

type ReadRun = (runtime: JobsRuntime, runId: string, signal?: AbortSignal) => Promise<RunSnapshot>;

Source

control-support-methods.ts

operationContext

Synchronous native operation context creator.

Throws

Original runtime context error.

Example

operationContext(runtime, undefined);

Signature

declare const operationContext: (
  runtime: JobsRuntime,
  signal: AbortSignal | undefined,
  operationId?: string,
) => OperationContext;

Source

operationContextEffect

Creates a native operation context in Effect.

Example

Effect.runSync(operationContextEffect(runtime, undefined));

Signature

declare const operationContextEffect: (
  runtime: JobsRuntime,
  signal: AbortSignal | undefined,
  operationId?: string | undefined,
) => Effect.Effect<OperationContext, ControlSupportFailure, never>;

Source

requireMethod

Synchronous native method and capability assertion.

Throws

JobsCapabilityError when unavailable.

Example

requireMethod(runtime, "read", "get");

Signature

declare const requireMethod: (
  runtime: JobsRuntime,
  capability: string,
  method: keyof JobsRuntime["adapter"],
) => void;

Source

requireMethodEffect

Requires a native adapter method and capability in Effect.

Example

Effect.runSync(requireMethodEffect(runtime, "read", "get"));

Signature

declare const requireMethodEffect: (
  runtime: JobsRuntime,
  capability: string,
  method: keyof JobsAdapterRuntime,
) => Effect.Effect<void, ControlSupportFailure, never>;

Source

requireOperationId

Synchronous bounded control operation ID assertion.

Throws

TypeError when missing or too long.

Example

requireOperationId("cancel-1");

Signature

declare const requireOperationId: (value: string) => void;

Source

requireOperationIdEffect

Validates a bounded control operation ID in Effect.

Example

Effect.runSync(requireOperationIdEffect("cancel-1"));

Signature

declare const requireOperationIdEffect: (
  value: string,
) => Effect.Effect<void, ControlSupportFailure, never>;

Source

control-support-observation.ts

isControlRecordEffect

Tests for a nonarray record in Effect.

Example

Effect.runSync(isControlRecordEffect({ id: "run" }));

Signature

declare const isControlRecordEffect: (
  value: unknown,
) => Effect.Effect<boolean, ControlSupportFailure, never>;

Source

isRecord

Synchronous nonarray record type guard.

Example

isRecord({ id: "run" });

Signature

declare const isRecord: (value: unknown) => value is Record<string, unknown>;

Source

isTerminal

Synchronous terminal run status test.

Example

isTerminal(run);

Signature

declare const isTerminal: (run: RunSnapshot) => boolean;

Source

isTerminalEffect

Tests whether a run is terminal in Effect.

Example

Effect.runSync(isTerminalEffect(run));

Signature

declare const isTerminalEffect: (
  run: RunSnapshot,
) => Effect.Effect<boolean, ControlSupportFailure, never>;

Source

observerTimeout

Synchronous bounded native observation timeout.

Throws

RangeError for an unsafe duration.

Example

observerTimeout(runtime);

Signature

declare const observerTimeout: (runtime: JobsRuntime, authored?: DurationInput) => number;

Source

observerTimeoutEffect

Computes a bounded native observation read timeout in Effect.

Example

Effect.runSync(observerTimeoutEffect(runtime));

Signature

declare const observerTimeoutEffect: (
  runtime: JobsRuntime,
  authored?:
    | `${number} second`
    | `${number} seconds`
    | `${number} minute`
    | `${number} minutes`
    | `${number} hour`
    | `${number} hours`
    | `${number} day`
    | `${number} days`
    | `${number} week`
    | `${number} weeks`
    | `${number} millisecond`
    | `${number} milliseconds`
    | undefined,
) => Effect.Effect<number, ControlSupportFailure, never>;

Source

control-support-receipts.ts

isUnknown

Synchronous uncertain outcome type guard.

Example

if (isUnknown(response)) console.log(response.operationId);

Signature

declare const isUnknown: (value: unknown) => value is UnknownControlOutcome;

Source

isUnknownEffect

Tests an uncertain native outcome in Effect.

Example

Effect.runSync(isUnknownEffect(response));

Signature

declare const isUnknownEffect: (
  value: unknown,
) => Effect.Effect<boolean, ControlSupportFailure, never>;

Source

normalizeCancellationReceipt

Synchronous cancellation receipt normalizer.

Throws

TypeError for a mismatched or malformed receipt.

Example

normalizeCancellationReceipt(value, "run", "cancel");

Signature

declare const normalizeCancellationReceipt: (
  value: unknown,
  runId: string,
  operationId: string,
) => RunCancellationReceipt;

Source

normalizeCancellationReceiptEffect

Normalizes a native cancellation receipt in Effect.

Example

Effect.runSync(normalizeCancellationReceiptEffect(value, "run", "cancel"));

Signature

declare const normalizeCancellationReceiptEffect: (
  value: unknown,
  runId: string,
  operationId: string,
) => Effect.Effect<RunCancellationReceipt, ControlSupportFailure, never>;

Source

normalizeRetryReceipt

Synchronous retry receipt normalizer.

Throws

TypeError for a mismatched or malformed receipt.

Example

normalizeRetryReceipt(value, "run-1");

Signature

declare const normalizeRetryReceipt: (value: unknown, originalRunId: string) => RunRetryReceipt;

Source

normalizeRetryReceiptEffect

Normalizes a native retry receipt in Effect.

Example

Effect.runSync(normalizeRetryReceiptEffect(value, "run-1"));

Signature

declare const normalizeRetryReceiptEffect: (
  value: unknown,
  originalRunId: string,
) => Effect.Effect<RunRetryReceipt, ControlSupportFailure, never>;

Source

unknownKey

Synchronous uncertain outcome key reader.

Example

unknownKey(response);

Signature

declare const unknownKey: (value: unknown) => string | undefined;

Source

unknownKeyEffect

Reads an uncertain outcome’s idempotency key in Effect.

Example

Effect.runSync(unknownKeyEffect(response));

Signature

declare const unknownKeyEffect: (
  value: unknown,
) => Effect.Effect<string | undefined, ControlSupportFailure, never>;

Source

unknownRecovery

Synchronous uncertain outcome recovery reader.

Example

unknownRecovery(response);

Signature

declare const unknownRecovery: (value: unknown) => JobUnknownOutcome["recovery"] | undefined;

Source

unknownRecoveryEffect

Reads bounded recovery guidance in Effect.

Example

Effect.runSync(unknownRecoveryEffect(response));

Signature

declare const unknownRecoveryEffect: (value: unknown) => Effect.Effect<
  | {
      readonly action: "retry-with-same-key" | "inspect-native" | "unavailable";
      readonly expiresAt?: string;
    }
  | undefined,
  ControlSupportFailure,
  never
>;

Source

control-support-run.ts

ControlSupportFailure (class)

Expected run control helper failure with its original cause.

Example

if (error instanceof ControlSupportFailure) console.log(error.message);

Signature

declare class ControlSupportFailure

Source

controlSupportEffect

Runs a control helper inside an observed Effect.

Example

controlSupportEffect("controls.read", () => receipt);

Signature

declare const controlSupportEffect: <A>(
  operation: JobsOperation,
  compute: () => A,
) => Effect.Effect<A, ControlSupportFailure, never>;

Source

runControlSupport

Synchronous control helper compatibility runner.

Throws

The original helper error on failure.

Example

runControlSupport(controlSupportEffect("controls.read", () => receipt));

Signature

declare const runControlSupport: <A>(effect: Effect.Effect<A, ControlSupportFailure>) => A;

Source

control-support-value-observation.ts

isTerminal

Tests whether a run has reached a terminal state.

Example

isTerminal(snapshot);

Signature

declare const isTerminal: (run: RunSnapshot) => boolean;

Source

observerTimeout

Resolves a bounded per-read observation timeout.

Throws

RangeError for invalid or oversized timeouts.

Example

observerTimeout(runtime, "2 seconds");

Signature

declare const observerTimeout: (runtime: JobsRuntime, authored?: DurationInput) => number;

Source

control-support-value.ts

isRecord

Tests for a nonarray native response record.

Example

isRecord({ outcome: "requested" });

Signature

declare const isRecord: (value: unknown) => value is Record<string, unknown>;

Source

isTerminal

Signature

declare const isTerminal: (run: RunSnapshot) => boolean;

Source

isUnknown

Recognizes an uncertain native control outcome.

Example

isUnknown(response);

Signature

declare const isUnknown: (value: unknown) => value is UnknownControlOutcome;

Source

normalizeCancellationReceipt

Validates and freezes a native cancellation receipt.

Throws

TypeError for mismatched identities or invalid fields.

Example

normalizeCancellationReceipt(receipt, "run-1", "cancel-1");

Signature

declare const normalizeCancellationReceipt: (
  value: unknown,
  runId: string,
  operationId: string,
) => RunCancellationReceipt;

Source

normalizeRetryReceipt

Validates that a native retry created a new run from the original.

Throws

TypeError for missing durable identity or reused run ID.

Example

normalizeRetryReceipt(receipt, "run-1");

Signature

declare const normalizeRetryReceipt: (value: unknown, originalRunId: string) => RunRetryReceipt;

Source

observerTimeout

Signature

declare const observerTimeout: (runtime: JobsRuntime, authored?: DurationInput) => number;

Source

operationContext

Builds a native context with a caller signal and optional operation ID.

Example

operationContext(runtime, undefined, "cancel-1");

Signature

declare const operationContext: (
  runtime: JobsRuntime,
  signal: AbortSignal | undefined,
  operationId?: string,
) => OperationContext;

Source

requireMethod

Requires a provider method and its reported capability.

Throws

JobsCapabilityError when unavailable.

Example

requireMethod(runtime, "read", "get");

Signature

declare const requireMethod: (
  runtime: JobsRuntime,
  capability: string,
  method: keyof JobsRuntime["adapter"],
) => void;

Source

requireOperationId

Validates a bounded idempotent control operation identity.

Throws

TypeError for blank or oversized IDs.

Example

requireOperationId("cancel-1");

Signature

declare const requireOperationId: (value: string) => void;

Source

unknownKey

Reads an optional idempotency key from an uncertain outcome.

Example

unknownKey(response);

Signature

declare const unknownKey: (value: unknown) => string | undefined;

Source

unknownRecovery

Copies a recognized native recovery action from an uncertain outcome.

Example

unknownRecovery(response);

Signature

declare const unknownRecovery: (value: unknown) => JobUnknownOutcome["recovery"] | undefined;

Source

control-support.ts

“./control-support-methods.js” (namespace export)

Re-exports all named exports from the “./control-support-methods.js” module.

Signature

export * from "./control-support-methods.js";

Source

“./control-support-observation.js” (namespace export)

Re-exports all named exports from the “./control-support-observation.js” module.

Signature

export * from "./control-support-observation.js";

Source

“./control-support-receipts.js” (namespace export)

Re-exports all named exports from the “./control-support-receipts.js” module.

Signature

export * from "./control-support-receipts.js";

Source

ControlSupportFailure

Signature

declare const ControlSupportFailure: typeof ControlSupportFailure;

Source

JobObserveFailure

Signature

declare const JobObserveFailure: typeof JobObserveFailure;

Source

JobObserveOptions

Signature

declare const JobObserveOptions: JobObserveOptions;

Source

UnknownControlOutcome

Signature

declare const UnknownControlOutcome: UnknownControlOutcome;

Source

observeWithTimeout

Signature

declare const observeWithTimeout: (
  source: AsyncIterable<RunWatchFrame<RunSnapshot>>,
  signal: AbortSignal,
  timeoutMs: number,
) => AsyncIterable<RunWatchFrame<RunSnapshot>>;

Source

observeWithTimeoutEffect

Signature

declare const observeWithTimeoutEffect: (
  source: AsyncIterable<RunWatchFrame<RunSnapshot>>,
  signal: AbortSignal,
  timeoutMs: number,
) => Effect<Stream<RunWatchFrame<RunSnapshot>, JobObserveFailure, never>, never, never>;

Source

control-support.types.ts

JobObserveOptions (interface)

Signal and per-read timeout for native run observation.

Signature

export interface JobObserveOptions {
  readonly signal?: AbortSignal;
  readonly timeout?: DurationInput;
}

Source

UnknownControlOutcome (interface)

Native control response with an uncertain outcome.

Signature

export interface UnknownControlOutcome {
  readonly operationId: string;
  readonly idempotencyKey?: string;
  readonly outcome: "unknown";
  readonly recovery?: JobUnknownOutcome["recovery"];
}

Source

control-write.ts

JobControlWriteFailure (class)

A cancelled, uncertain, or provider-failed native control write.

Example

new JobControlWriteFailure({ operationId: "op", kind: "unknown", cause: new Error() });

Signature

declare class JobControlWriteFailure

Source

controlWrite

Promise compatibility adapter for native control writes.

Throws

The original cancellation, unknown-outcome, or provider error.

Example

await controlWrite(() => Promise.resolve("ok"), undefined, "op");

Signature

declare const controlWrite: <A>(
  call: () => Promise<A>,
  signal: AbortSignal | undefined,
  operationId: string,
) => Promise<A>;

Source

controlWriteEffect

Calls a native control write with an Effect-managed abort listener. Cancellation before the provider begins prevents the call. Cancellation after start produces an unknown outcome requiring operation-id recovery.

Example

Effect.runPromise(controlWriteEffect(() => Promise.resolve("ok"), undefined, "op"));

Signature

declare const controlWriteEffect: <A>(
  call: () => Promise<A>,
  signal: AbortSignal | undefined,
  operationId: string,
) => Effect.Effect<A, JobControlWriteFailure, never>;

Source

control-write.types.ts

Lifetime of one registered abort listener for a native control write.

ControlWriteRegistration (interface)

Lifetime of one registered abort listener for a native control write.

Signature

export interface ControlWriteRegistration {
  readonly aborted: Promise<void>;
  readonly isAborted: () => boolean;
  readonly dispose: () => void;
}

Source

controls-factory.ts

createJobsControls

Synchronous factory for a run controls facade.

Example

createJobsControls(runtime);

Signature

declare const createJobsControls: (runtime?: JobsRuntime) => JobsControls;

Source

createJobsControlsEffect

Builds a run controls facade in Effect.

Example

Effect.runSync(createJobsControlsEffect(runtime));

Signature

declare const createJobsControlsEffect: (
  runtime: JobsRuntime,
) => Effect.Effect<JobsControls, never, never>;

Source

controls-observe.ts

observeRun

Synchronous compatibility adapter for run observation.

Throws

The original capability or provider error during setup.

Example

for await (const frame of observeRun(runtime, request)) console.log(frame);

Signature

declare const observeRun: (
  runtime: JobsRuntime,
  request: NativeWatchRequest,
  options?: JobObserveOptions,
) => AsyncIterable<RunWatchFrame<RunSnapshot>>;

Source

observeRunEffect

Acquires an async run observation iterator in Effect. The caller owns iterator consumption and should close it on early exit.

Example

Effect.runSync(observeRunEffect(runtime, request));

Signature

declare const observeRunEffect: (
  runtime: JobsRuntime,
  request: NativeWatchRequest,
  options?: JobObserveOptions | undefined,
) => Effect.Effect<AsyncIterable<RunWatchFrame<RunSnapshot>>, JobControlFailure, never>;

Source

controls-operations.ts

cancelRunValue

Signature

declare const cancelRunValue: (
  runtime: JobsRuntime,
  runId: string,
  options: JobCancelOptions,
) => Promise<RunCancellationReceipt>;

Source

getRunValue

Signature

declare const getRunValue: (
  runtime: JobsRuntime,
  locator: string,
  signal?: AbortSignal,
) => Promise<RunSnapshot>;

Source

listRunsValue

Signature

declare const listRunsValue: (
  runtime: JobsRuntime,
  query?: RunListQuery,
  signal?: AbortSignal,
) => Promise<RunPage<RunSnapshot>>;

Source

observeRunValue

Builds a native run observation with a scoped iterator timeout. The consumer owns the iterator and must close it on early exit.

Throws

The original capability or observer setup error.

Example

for await (const frame of observeRunValue(runtime, request)) console.log(frame);

Signature

declare const observeRunValue: (
  runtime: JobsRuntime,
  request: NativeWatchRequest,
  options?: JobObserveOptions,
) => AsyncIterable<RunWatchFrame<RunSnapshot>>;

Source

retryRunValue

Signature

declare const retryRunValue: (
  runtime: JobsRuntime,
  runId: string,
  options: JobRetryOptions,
) => Promise<RunRetryReceipt>;

Source

controls-read.ts

ControlReadFailure (class)

Expected native run read failure with its original compatibility cause.

Example

new ControlReadFailure({ cause: new Error("read unavailable") });

Signature

declare class ControlReadFailure

Source

getRunOperationEffect

Checks read capability and requests one native run in Effect.

Example

Effect.runPromise(getRunOperationEffect(runtime, "run-1"));

Signature

declare const getRunOperationEffect: (
  runtime: JobsRuntime,
  locator: string,
  signal?: AbortSignal | undefined,
) => Effect.Effect<NativeRun, ControlReadFailure, never>;

Source

getRunValue

Promise compatibility read for internal control consumers.

Throws

The original capability, context, or provider error.

Example

await getRunValue(runtime, "run-1");

Signature

declare const getRunValue: (
  runtime: JobsRuntime,
  locator: string,
  signal?: AbortSignal,
) => Promise<RunSnapshot>;

Source

listRunsOperationEffect

Checks list capability and validates the page limit before native IO.

Example

Effect.runPromise(listRunsOperationEffect(runtime, { limit: 25 }));

Signature

declare const listRunsOperationEffect: (
  runtime: JobsRuntime,
  query?: RunListQuery | undefined,
  signal?: AbortSignal | undefined,
) => Effect.Effect<NativeRunPage, ControlReadFailure, never>;

Source

listRunsValue

Promise compatibility listing for internal control consumers.

Throws

The original capability, limit, context, or provider error.

Example

await listRunsValue(runtime, { limit: 25 });

Signature

declare const listRunsValue: (
  runtime: JobsRuntime,
  query?: RunListQuery,
  signal?: AbortSignal,
) => Promise<RunPage<RunSnapshot>>;

Source

controls-write-operations.ts

ControlOperationFailure (class)

Expected native control operation failure with its compatibility cause.

Example

new ControlOperationFailure({ cause: new Error("provider rejected") });

Signature

declare class ControlOperationFailure

Source

cancelRunOperationEffect

Validates and submits an idempotent native cancellation in Effect.

Example

Effect.runPromise(cancelRunOperationEffect(runtime, "run", { operationId: "op" }));

Signature

declare const cancelRunOperationEffect: (
  runtime: JobsRuntime,
  runId: string,
  options: JobCancelOptions,
) => Effect.Effect<RunCancellationReceipt, ControlOperationFailure, never>;

Source

cancelRunValue

Promise compatibility cancellation for internal control consumers.

Throws

The original capability, cancellation, provider, or receipt error.

Example

await cancelRunValue(runtime, "run", { operationId: "op" });

Signature

declare const cancelRunValue: (
  runtime: JobsRuntime,
  runId: string,
  options: JobCancelOptions,
) => Promise<RunCancellationReceipt>;

Source

retryRunOperationEffect

Reuses pinned run identity to request a fresh native retry in Effect.

Example

Effect.runPromise(retryRunOperationEffect(runtime, "run", { operationId: "op" }));

Signature

declare const retryRunOperationEffect: (
  runtime: JobsRuntime,
  runId: string,
  options: JobRetryOptions,
) => Effect.Effect<RunRetryReceipt, ControlOperationFailure, never>;

Source

retryRunValue

Promise compatibility retry for internal control consumers.

Throws

The original capability, provider, cancellation, or receipt error.

Example

await retryRunValue(runtime, "run", { operationId: "op" });

Signature

declare const retryRunValue: (
  runtime: JobsRuntime,
  runId: string,
  options: JobRetryOptions,
) => Promise<RunRetryReceipt>;

Source

controls.ts

JobCancelOptions

Signature

declare const JobCancelOptions: JobCancelOptions;

Source

JobControlFailure (class)

Expected failure while reading or changing a job run.

Example

if (error instanceof JobControlFailure) console.log(error.message);

Signature

declare class JobControlFailure

Source

JobObserveOptions

Signature

declare const JobObserveOptions: JobObserveOptions;

Source

JobRetryOptions

Signature

declare const JobRetryOptions: JobRetryOptions;

Source

JobsControls

Signature

declare const JobsControls: JobsControls;

Source

cancelRun

Promise compatibility adapter for cancellation.

Throws

The original provider or control error.

Example

await cancelRun(runtime, "run-1", { operationId: "op" });

Signature

declare const cancelRun: (
  runtime: JobsRuntime,
  runId: string,
  options: JobCancelOptions,
) => Promise<RunCancellationReceipt>;

Source

cancelRunEffect

Cancels a run in Effect.

Example

Effect.runPromise(cancelRunEffect(runtime, "run-1", { operationId: "op" }));

Signature

declare const cancelRunEffect: (
  runtime: JobsRuntime,
  runId: string,
  options: JobCancelOptions,
) => Effect.Effect<RunCancellationReceipt, JobControlFailure, never>;

Source

createJobsControls

Signature

declare const createJobsControls: (runtime?: JobsRuntime) => JobsControls;

Source

createJobsControlsEffect

Signature

declare const createJobsControlsEffect: (
  runtime: JobsRuntime,
) => Effect.Effect<JobsControls, never, never>;

Source

getRun

Promise compatibility adapter for native run reads.

Throws

The original provider or capability error.

Example

await getRun(runtime, "run-1");

Signature

declare const getRun: (
  runtime: JobsRuntime,
  locator: string,
  signal?: AbortSignal,
) => Promise<RunSnapshot>;

Source

getRunEffect

Reads a native run in Effect.

Example

Effect.runPromise(getRunEffect(runtime, "run-1"));

Signature

declare const getRunEffect: (
  runtime: JobsRuntime,
  locator: string,
  signal?: AbortSignal | undefined,
) => Effect.Effect<NativeRun, JobControlFailure, never>;

Source

listRuns

Promise compatibility adapter for native run listings.

Throws

The original provider, capability, or limit error.

Example

await listRuns(runtime);

Signature

declare const listRuns: (
  runtime: JobsRuntime,
  query?: RunListQuery,
  signal?: AbortSignal,
) => Promise<RunPage<RunSnapshot>>;

Source

listRunsEffect

Lists native runs in Effect.

Example

Effect.runPromise(listRunsEffect(runtime));

Signature

declare const listRunsEffect: (
  runtime: JobsRuntime,
  query?: RunListQuery | undefined,
  signal?: AbortSignal | undefined,
) => Effect.Effect<NativeRunPage, JobControlFailure, never>;

Source

observeRun

Signature

declare const observeRun: (
  runtime: JobsRuntime,
  request: NativeWatchRequest,
  options?: JobObserveOptions,
) => AsyncIterable<RunWatchFrame<RunSnapshot>>;

Source

observeRunEffect

Signature

declare const observeRunEffect: (
  runtime: JobsRuntime,
  request: NativeWatchRequest,
  options?: JobObserveOptions | undefined,
) => Effect.Effect<AsyncIterable<RunWatchFrame<RunSnapshot>>, JobControlFailure, never>;

Source

retryRun

Promise compatibility adapter for retry.

Throws

The original provider or control error.

Example

await retryRun(runtime, "run-1", { operationId: "op" });

Signature

declare const retryRun: (
  runtime: JobsRuntime,
  runId: string,
  options: JobRetryOptions,
) => Promise<RunRetryReceipt>;

Source

retryRunEffect

Retries a run in Effect.

Example

Effect.runPromise(retryRunEffect(runtime, "run-1", { operationId: "op" }));

Signature

declare const retryRunEffect: (
  runtime: JobsRuntime,
  runId: string,
  options: JobRetryOptions,
) => Effect.Effect<RunRetryReceipt, JobControlFailure, never>;

Source

waitForResult

Promise compatibility adapter for result waiting.

Throws

The original observation or result error.

Example

await waitForResult(runtime, "run-1", { timeout: "1 second" });

Signature

declare const waitForResult: (
  runtime: JobsRuntime,
  runId: string,
  options: RunResultOptions,
) => Promise<unknown>;

Source

waitForResultEffect

Waits for a run result in Effect.

Example

Effect.runPromise(waitForResultEffect(runtime, "run-1", { timeout: "1 second" }));

Signature

declare const waitForResultEffect: (
  runtime: JobsRuntime,
  runId: string,
  options: RunResultOptions,
) => Effect.Effect<unknown, JobControlFailure, never>;

Source

controls.types.ts

JobCancelOptions (interface)

Options accepted for job cancel operations.

Signature

export interface JobCancelOptions {
  readonly operationId: string;
  readonly reason?: string;
  readonly signal?: AbortSignal;
}

Source

JobRetryOptions (interface)

Options accepted for job retry operations.

Signature

export interface JobRetryOptions {
  readonly operationId: string;
  readonly signal?: AbortSignal;
}

Source

JobsControls (interface)

Run read, observation, cancellation, retry, result, and schedule operations.

Signature

export interface JobsControls {
  readonly get: (
    locator: string,
    options?: { readonly signal?: AbortSignal },
  ) => Promise<RunSnapshot>;
  readonly list: (
    query?: RunListQuery,
    options?: { readonly signal?: AbortSignal },
  ) => Promise<RunPage<RunSnapshot>>;
  readonly observe: (
    request: NativeWatchRequest,
    options?: JobObserveOptions,
  ) => AsyncIterable<RunWatchFrame<RunSnapshot>>;
  readonly cancel: (runId: string, options: JobCancelOptions) => Promise<RunCancellationReceipt>;
  readonly retry: (runId: string, options: JobRetryOptions) => Promise<RunRetryReceipt>;
  readonly result: (runId: string, options: RunResultOptions) => Promise<unknown>;
  readonly schedules?: JobScheduleClient;
}

Source

define-job-value.ts

defineJobValue

Binds a task to a named job with immutable scheduling and client policy metadata.

Example

import { defineJob } from "@relkit/app/jobs";
import { defineTask } from "@relkit/app/tasks";
import { z } from "@relkit/app/schema";
const task = defineTask({
  id: "receipts.send",
  version: "1",
  input: z.object({ orderId: z.string() }),
  output: z.object({ sent: z.boolean() }),
  handler: async () => ({ sent: true }),
});
const job = defineJob({ name: "sendReceipt", task });
void job;

Signature

declare const defineJobValue: <
  const Name extends string,
  const Task extends TaskDescriptorAny,
  const Id extends string = Name,
>(
  options: DefineJobOptions<Name, Task, Id>,
) => JobDescriptor<Name, Id, Task>;

Source

Since v0.4.1

JOB_PROFILE_DEPRECATED_CODE

Diagnostic code used when the one-release profile spelling is consumed as service.

Example

JOB_PROFILE_DEPRECATED_CODE === "RELKIT_JOB_PROFILE_DEPRECATED";

Signature

declare const JOB_PROFILE_DEPRECATED_CODE: "RELKIT_JOB_PROFILE_DEPRECATED";

Source

RetryJitter

Signature

declare const RetryJitter: RetryJitter;

Source

RetryPolicy

Signature

declare const RetryPolicy: RetryPolicy;

Source

isJobDescriptorValue

Checks the runtime descriptor brand and task association.

Example

isJobDescriptorValue(candidate);

Signature

declare const isJobDescriptorValue: (value: unknown) => value is JobDescriptorAny;

Source

define-job.ts

defineJob

Binds a task to an immutable job descriptor.

Throws

Original validation error for invalid definitions.

Example

import { defineJob, defineTask } from "@relkit/jobs";
import { z } from "@relkit/schema";
const echo = defineTask({
  id: "echo",
  version: "1",
  input: z.string(),
  output: z.string(),
  execution: "retryable",
  handler: async (input) => input,
});
const echoJob = defineJob({ name: "echoJob", task: echo });

Signature

declare const defineJob: <
  const Name extends string,
  const Task extends TaskDescriptorAny,
  const Id extends string = Name,
>(
  options: DefineJobOptions<Name, Task, Id>,
) => JobDescriptor<Name, Id, Task>;

Source

Since v0.4.1

Backend and frontend example

Backend — these maintained files define the operation used by the frontend below.

/** Registers the export task as a public job exposing trigger, get, list and watch with progress/output fields. */
import { defineJob } from "@relkit/app/jobs";
import exportOrders from "../tasks/export-orders.task.js";

const exportOrdersJob = defineJob({
  name: "exportOrders",
  id: "orders.export-orders",
  task: exportOrders,
  client: {
    public: true,
    operations: ["trigger", "get", "list", "watch"],
    fields: ["status", "progress", "output"],
  },
});

export default exportOrdersJob;

Frontend

After frontend setup and pulling the commerce contract, render this component under the provider. It selects this job’s public exportOrders name:

"use client";

/** Submits one commerce export and observes the accepted run without replaying an uncertain submission. */
import { useJobRun, useJobTrigger, useRelkitClient } from "@relkit/client/react";

/** Keeps the accepted receipt separate from the task's eventual output.
 * @returns One explicit submission button and its receipt, observation, or failure state. */
export function ExportOrders() {
  const { status } = useRelkitClient();
  const submit = useJobTrigger("exportOrders");
  const run = useJobRun("exportOrders", submit.data ? { runId: submit.data.runId } : {});

  return (
    <section>
      <button
        disabled={status !== "ready" || !submit.isIdle}
        onClick={() => submit.mutate({ input: { orderIds: ["order-1"] } })}
      >
        Export orders
      </button>
      {submit.isPending && <p role="status">Submitting…</p>}
      {submit.isError && (
        <p role="alert">{String(submit.error)}. Check the outcome before submitting again.</p>
      )}
      {submit.data && <p>Run ID: {submit.data.runId}</p>}
      <p role="status">
        Connection: {run.connection}; run: {run.run?.status ?? "not accepted"}
      </p>
    </section>
  );
}

The task determines the orderIds input. The job’s client.operations permits triggering and observation, while client.fields selects public run data. The returned runId is an admission receipt; completion and output arrive through the run observer. The example keeps uncertain submissions visible instead of automatically sending them again.

Reference: useJobTrigger, useJobRun. Continue with job clients and recovery.

JOB_PROFILE_DEPRECATED_CODE

Signature

declare const JOB_PROFILE_DEPRECATED_CODE: "RELKIT_JOB_PROFILE_DEPRECATED";

Source

JobDefinitionFailure (class)

Expected job definition failure, retaining the original validation error.

Example

if (error instanceof JobDefinitionFailure) console.log(error.message);

Signature

declare class JobDefinitionFailure

Source

RetryJitter

Signature

declare const RetryJitter: RetryJitter;

Source

RetryPolicy

Signature

declare const RetryPolicy: RetryPolicy;

Source

assertJobDescriptor

Synchronous job descriptor assertion.

Throws

TypeError for an invalid descriptor.

Example

assertJobDescriptor(job);

Signature

declare const assertJobDescriptor: (value: unknown) => asserts value is JobDescriptorAny;

Source

assertJobDescriptorEffect

Asserts a valid job descriptor in Effect.

Example

Effect.runSync(assertJobDescriptorEffect(job));

Signature

declare const assertJobDescriptorEffect: (
  value: unknown,
) => Effect.Effect<undefined, JobDefinitionFailure, never>;

Source

defineJobEffect

Defines an immutable job descriptor in Effect.

Example

Effect.runSync(defineJobEffect({ name: "sendReceipt", task }));

Signature

declare const defineJobEffect: <
  const Name extends string,
  const Task extends TaskDescriptorAny,
  const Id extends string = Name,
>(
  options: DefineJobOptions<Name, Task, Id>,
) => Effect.Effect<JobDescriptor<Name, Id, Task>, JobDefinitionFailure, never>;

Source

isJobDescriptor

Synchronous job descriptor type guard.

Example

if (isJobDescriptor(value)) console.log(value.name);

Signature

declare const isJobDescriptor: (value: unknown) => value is JobDescriptorAny;

Source

isJobDescriptorEffect

Tests a value for a valid job descriptor in Effect.

Example

Effect.runSync(isJobDescriptorEffect(value));

Signature

declare const isJobDescriptorEffect: (value: unknown) => Effect.Effect<boolean, never, never>;

Source

define-task-support.ts

TaskSupportError (class)

An invalid task authoring helper input.

Example

new TaskSupportError({ reason: "Task tags must be unique" });

Signature

declare class TaskSupportError

Source

assertHook

Synchronous optional hook assertion.

Throws

TypeError when the hook is not a function.

Example

assertHook(() => {}, "onStart");

Signature

declare const assertHook: (value: unknown, name: string) => void;

Source

assertHookEffect

Validates an optional lifecycle hook in Effect.

Example

Effect.runPromise(assertHookEffect(() => {}, "onStart"));

Signature

declare const assertHookEffect: (
  value: unknown,
  name: string,
) => Effect.Effect<undefined, TaskSupportError, never>;

Source

copyStrings

Synchronous authoring string adapter.

Throws

TypeError for invalid or duplicate strings.

Example

copyStrings(["red"], "tags");

Signature

declare const copyStrings: (value: unknown, name: string) => readonly string[] | undefined;

Source

copyStringsEffect

Copies unique, bounded authoring strings in Effect.

Example

Effect.runPromise(copyStringsEffect(["red"], "tags"));

Signature

declare const copyStringsEffect: (
  value: unknown,
  name: string,
) => Effect.Effect<ReadonlyArray<string> | undefined, TaskSupportError, never>;

Source

hasOwn

Synchronous own-property predicate.

Throws

A runtime defect if the Effect cannot execute synchronously.

Example

hasOwn({ id: 1 }, "id");

Signature

declare const hasOwn: (value: object, key: PropertyKey) => boolean;

Source

hasOwnEffect

Checks property ownership in Effect.

Example

Effect.runSync(hasOwnEffect({ id: 1 }, "id"));

Signature

declare const hasOwnEffect: (
  value: object,
  key: PropertyKey,
) => Effect.Effect<boolean, never, never>;

Source

isRecord

Synchronous non-array record predicate.

Throws

A runtime defect if the Effect cannot execute synchronously.

Example

isRecord({ id: 1 });

Signature

declare const isRecord: (value: unknown) => value is Record<PropertyKey, unknown>;

Source

isRecordEffect

Tests for a non-array record in Effect.

Example

Effect.runSync(isRecordEffect({ id: 1 }));

Signature

declare const isRecordEffect: (value: unknown) => Effect.Effect<boolean, never, never>;

Source

isSchema

Synchronous Standard Schema v1 predicate.

Throws

A runtime defect if the Effect cannot execute synchronously.

Example

isSchema({ "~standard": { version: 1, validate() {} } });

Signature

declare const isSchema: (value: unknown) => boolean;

Source

isSchemaEffect

Detects a Standard Schema v1 value in Effect.

Example

Effect.runSync(isSchemaEffect({ "~standard": { version: 1, validate() {} } }));

Signature

declare const isSchemaEffect: (value: unknown) => Effect.Effect<boolean, never, never>;

Source

define-task-value.ts

defineTaskValue

Declares a typed task with an immutable execution contract and handler.

Example

import { defineTask } from "@relkit/app/tasks";
import { z } from "@relkit/app/schema";
const exportOrders = defineTask({
  id: "orders.export",
  version: "1",
  input: z.object({ orderIds: z.array(z.string()) }),
  output: z.object({ exported: z.number() }),
  handler: async ({ orderIds }) => ({ exported: orderIds.length }),
});
void exportOrders;

Signature

declare const defineTaskValue: <
  const Id extends string,
  const Version extends string,
  const InputSchema extends StandardSchemaV1,
  const OutputSchema extends StandardSchemaV1,
  const Dependencies extends TaskDependencies = {},
  const Errors extends readonly ErrorDescriptorAny[] = readonly [],
  const Publishes extends readonly PublishedEventName[] = readonly [],
  const ProgressSchema extends StandardSchemaV1 | undefined = undefined,
  const Streams extends TaskStreamSchemas = {},
  const Execution extends TaskExecution = "durable",
>(
  options: DefineTaskOptions<
    Id,
    Version,
    InputSchema,
    OutputSchema,
    Dependencies,
    Errors,
    Publishes,
    ProgressSchema,
    Streams,
    Execution
  >,
) => TaskDescriptor<
  Id,
  Version,
  InputSchema,
  OutputSchema,
  Dependencies,
  Errors,
  Publishes,
  ProgressSchema,
  Streams,
  Execution
>;

Source

Since v0.4.1

isTaskDescriptorValue

Checks a candidate for the branded task descriptor shape.

Example

isTaskDescriptorValue(candidate);

Signature

declare const isTaskDescriptorValue: (value: unknown) => value is TaskDescriptorAny;

Source

define-task.ts

defineTask

Declares a typed immutable task with an execution contract and handler.

Throws

Original validation error for invalid definitions.

Example

import { defineTask } from "@relkit/jobs";
import { z } from "@relkit/schema";
const echo = defineTask({
  id: "echo",
  version: "1",
  input: z.string(),
  output: z.string(),
  execution: "retryable",
  handler: async (input) => input,
});

Signature

declare const defineTask: <
  const Id extends string,
  const Version extends string,
  const InputSchema extends StandardSchemaV1,
  const OutputSchema extends StandardSchemaV1,
  const Dependencies extends TaskDependencies = {},
  const Errors extends readonly ErrorDescriptorAny[] = readonly [],
  const Publishes extends readonly PublishedEventName[] = readonly [],
  const ProgressSchema extends StandardSchemaV1 | undefined = undefined,
  const Streams extends TaskStreamSchemas = {},
  const Execution extends TaskExecution = "durable",
>(
  options: DefineTaskOptions<
    Id,
    Version,
    InputSchema,
    OutputSchema,
    Dependencies,
    Errors,
    Publishes,
    ProgressSchema,
    Streams,
    Execution
  >,
) => TaskDescriptor<
  Id,
  Version,
  InputSchema,
  OutputSchema,
  Dependencies,
  Errors,
  Publishes,
  ProgressSchema,
  Streams,
  Execution
>;

Source

Since v0.4.1

TaskDefinitionFailure (class)

Expected task definition failure, retaining the original validation error.

Example

if (error instanceof TaskDefinitionFailure) console.log(error.message);

Signature

declare class TaskDefinitionFailure

Source

assertTaskDescriptor

Synchronous task descriptor assertion.

Throws

TypeError for invalid descriptors.

Example

assertTaskDescriptor(task);

Signature

declare const assertTaskDescriptor: (value: unknown) => asserts value is TaskDescriptorAny;

Source

assertTaskDescriptorEffect

Asserts a task descriptor in Effect.

Example

Effect.runSync(assertTaskDescriptorEffect(task));

Signature

declare const assertTaskDescriptorEffect: (
  value: unknown,
) => Effect.Effect<undefined, TaskDefinitionFailure, never>;

Source

defineTaskEffect

Defines an immutable task descriptor in Effect.

Example

Effect.runSync(defineTaskEffect({ id: "send", version: "1", input, output, handler }));

Signature

declare const defineTaskEffect: <
  const Id extends string,
  const Version extends string,
  const InputSchema extends StandardSchemaV1,
  const OutputSchema extends StandardSchemaV1,
  const Dependencies extends TaskDependencies = {},
  const Errors extends readonly ErrorDescriptorAny[] = readonly [],
  const Publishes extends readonly PublishedEventName[] = readonly [],
  const ProgressSchema extends StandardSchemaV1 | undefined = undefined,
  const Streams extends Readonly<Record<string, StandardSchemaV1<unknown, unknown>>> = {},
  const Execution extends TaskExecution = "durable",
>(
  options: DefineTaskOptions<
    Id,
    Version,
    InputSchema,
    OutputSchema,
    Dependencies,
    Errors,
    Publishes,
    ProgressSchema,
    Streams,
    Execution
  >,
) => Effect.Effect<
  TaskDescriptor<
    Id,
    Version,
    InputSchema,
    OutputSchema,
    Dependencies,
    Errors,
    Publishes,
    ProgressSchema,
    Streams,
    Execution
  >,
  TaskDefinitionFailure,
  never
>;

Source

isTaskDescriptor

Synchronous task descriptor type guard.

Example

if (isTaskDescriptor(value)) console.log(value.id);

Signature

declare const isTaskDescriptor: (value: unknown) => value is TaskDescriptorAny;

Source

isTaskDescriptorEffect

Checks a task descriptor candidate in Effect.

Example

Effect.runSync(isTaskDescriptorEffect(value));

Signature

declare const isTaskDescriptorEffect: (value: unknown) => Effect.Effect<boolean, never, never>;

Source

duration.ts

DurationInput

Signature

declare const DurationInput:
  | `${number} second`
  | `${number} seconds`
  | `${number} minute`
  | `${number} minutes`
  | `${number} hour`
  | `${number} hours`
  | `${number} day`
  | `${number} days`
  | `${number} week`
  | `${number} weeks`
  | `${number} millisecond`
  | `${number} milliseconds`;

Source

DurationUnit

Signature

declare const DurationUnit: DurationUnit;

Source

DurationValidationError (class)

A malformed, inexact, or unsafe authored duration.

Example

new DurationValidationError({ input: "1.1 milliseconds", reason: "Invalid duration" });

Signature

declare class DurationValidationError

Source

durationToMillis

Compatibility adapter for authored duration parsing.

Throws

TypeError when the duration is invalid or cannot be represented safely.

Example

durationToMillis("1.5 seconds");

Signature

declare const durationToMillis: (value: DurationInput) => number;

Source

durationToMillisEffect

Converts an authored duration to exact, safe milliseconds.

Example

Effect.runPromise(durationToMillisEffect("1.5 seconds"));

Signature

declare const durationToMillisEffect: (
  value:
    | `${number} second`
    | `${number} seconds`
    | `${number} minute`
    | `${number} minutes`
    | `${number} hour`
    | `${number} hours`
    | `${number} day`
    | `${number} days`
    | `${number} week`
    | `${number} weeks`
    | `${number} millisecond`
    | `${number} milliseconds`,
) => Effect.Effect<number, DurationValidationError, never>;

Source

isDurationInput

Tests authored duration syntax.

Throws

A runtime defect if the Effect cannot execute synchronously.

Example

isDurationInput("1 second");

Signature

declare const isDurationInput: (value: unknown) => value is DurationInput;

Source

isDurationInputEffect

Tests authored duration syntax in the Effect path.

Example

Effect.runSync(isDurationInputEffect("1 second"));

Signature

declare const isDurationInputEffect: (value: unknown) => Effect.Effect<boolean, never, never>;

Source

parseDuration

Alias for durationToMillis.

Throws

TypeError when the duration is invalid or unsafe.

Example

parseDuration("1 second");

Signature

declare const parseDuration: (value: DurationInput) => number;

Source

validateDuration

Alias for durationToMillis.

Throws

TypeError when the duration is invalid or unsafe.

Example

validateDuration("1 second");

Signature

declare const validateDuration: (value: DurationInput) => number;

Source

duration.types.ts

Units accepted by the authored duration syntax.

DurationInput (type alias)

An authored decimal amount followed by one duration unit.

Signature

type DurationInput = `${number} ${DurationUnit}`;

Source

DurationUnit (type alias)

Units accepted by the authored duration syntax.

Signature

type DurationUnit =
  | "millisecond"
  | "milliseconds"
  | "second"
  | "seconds"
  | "minute"
  | "minutes"
  | "hour"
  | "hours"
  | "day"
  | "days"
  | "week"
  | "weeks";

Source

identity.ts

JobIdentityError (class)

An identity tuple containing a value that cannot be encoded as JSON.

Example

new JobIdentityError({ operation: "stableTuple", cause: new Error("invalid") });

Signature

declare class JobIdentityError

Source

retryOperationIdentity

Synchronous retry-operation identity adapter.

Throws

A JSON validation error for unsupported values.

Example

retryOperationIdentity("r", "op");

Signature

declare const retryOperationIdentity: (runId: string, operationId: string) => string;

Source

retryOperationIdentityEffect

Builds a retry-operation identity in Effect.

Example

Effect.runPromise(retryOperationIdentityEffect("r", "op"));

Signature

declare const retryOperationIdentityEffect: (
  runId: string,
  operationId: string,
) => Effect.Effect<string, JobIdentityError, never>;

Source

scheduleOccurrenceIdentity

Synchronous schedule-occurrence identity adapter.

Throws

A JSON validation error for unsupported values.

Example

scheduleOccurrenceIdentity("s", "2026-01-01T00:00:00Z");

Signature

declare const scheduleOccurrenceIdentity: (scheduleId: string, scheduledFor: string) => string;

Source

scheduleOccurrenceIdentityEffect

Builds a schedule-occurrence identity in Effect.

Example

Effect.runPromise(scheduleOccurrenceIdentityEffect("s", "2026-01-01T00:00:00Z"));

Signature

declare const scheduleOccurrenceIdentityEffect: (
  scheduleId: string,
  scheduledFor: string,
) => Effect.Effect<string, JobIdentityError, never>;

Source

stableIdentityTuple

Synchronous compatibility adapter for identity tuples.

Throws

The original JSON validation error for unsupported values.

Example

stableIdentityTuple([1, "1"]);

Signature

declare const stableIdentityTuple: (values: readonly unknown[]) => string;

Source

stableIdentityTupleEffect

Encodes typed tuple members in Effect so numeric and string values differ.

Example

Effect.runPromise(stableIdentityTupleEffect([1, "1"]));

Signature

declare const stableIdentityTupleEffect: (
  values: ReadonlyArray<unknown>,
) => Effect.Effect<string, JobIdentityError, never>;

Source

taskOperationIdentity

Synchronous task-operation identity adapter.

Throws

A JSON validation error for unsupported values.

Example

taskOperationIdentity("a", "send");

Signature

declare const taskOperationIdentity: (acceptanceIdentity: string, operation: string) => string;

Source

taskOperationIdentityEffect

Builds a task-operation identity in Effect.

Example

Effect.runPromise(taskOperationIdentityEffect("a", "send"));

Signature

declare const taskOperationIdentityEffect: (
  acceptanceIdentity: string,
  operation: string,
) => Effect.Effect<string, JobIdentityError, never>;

Source

identity.types.ts

IdentityValue (type alias)

JSON-safe representation of one identity tuple component.

Signature

type IdentityValue = JsonValue;

Source

index.ts

“./adapter.js” (namespace export)

Re-exports all named exports from the “./adapter.js” module.

Signature

export * from "./adapter.js";

Source

“./authorization.js” (namespace export)

Re-exports all named exports from the “./authorization.js” module.

Signature

export * from "./authorization.js";

Source

“./capabilities.js” (namespace export)

Re-exports all named exports from the “./capabilities.js” module.

Signature

export * from "./capabilities.js";

Source

“./control-errors.js” (namespace export)

Re-exports all named exports from the “./control-errors.js” module.

Signature

export * from "./control-errors.js";

Source

“./controls.js” (namespace export)

Re-exports all named exports from the “./controls.js” module.

Signature

export * from "./controls.js";

Source

“./define-job.js” (namespace export)

Re-exports all named exports from the “./define-job.js” module.

Signature

export * from "./define-job.js";

Source

“./define-task.js” (namespace export)

Re-exports all named exports from the “./define-task.js” module.

Signature

export * from "./define-task.js";

Source

“./identity.js” (namespace export)

Re-exports all named exports from the “./identity.js” module.

Signature

export * from "./identity.js";

Source

“./migration.js” (namespace export)

Re-exports all named exports from the “./migration.js” module.

Signature

export * from "./migration.js";

Source

“./resolve-binding.js” (namespace export)

Re-exports all named exports from the “./resolve-binding.js” module.

Signature

export * from "./resolve-binding.js";

Source

“./run-id-router.js” (namespace export)

Re-exports all named exports from the “./run-id-router.js” module.

Signature

export * from "./run-id-router.js";

Source

“./run-id.js” (namespace export)

Re-exports all named exports from the “./run-id.js” module.

Signature

export * from "./run-id.js";

Source

“./runtime.js” (namespace export)

Re-exports all named exports from the “./runtime.js” module.

Signature

export * from "./runtime.js";

Source

“./schedule-controls.js” (namespace export)

Re-exports all named exports from the “./schedule-controls.js” module.

Signature

export * from "./schedule-controls.js";

Source

“./schedule-reconciliation.js” (namespace export)

Re-exports all named exports from the “./schedule-reconciliation.js” module.

Signature

export * from "./schedule-reconciliation.js";

Source

“./service-options.js” (namespace export)

Re-exports all named exports from the “./service-options.js” module.

Signature

export * from "./service-options.js";

Source

“./submission.js” (namespace export)

Re-exports all named exports from the “./submission.js” module.

Signature

export * from "./submission.js";

Source

“./task-policy-validation.js” (namespace export)

Re-exports all named exports from the “./task-policy-validation.js” module.

Signature

export * from "./task-policy-validation.js";

Source

“./task-progress.js” (namespace export)

Re-exports all named exports from the “./task-progress.js” module.

Signature

export * from "./task-progress.js";

Source

“./task-types.js” (namespace export)

Re-exports all named exports from the “./task-types.js” module.

Signature

export * from "./task-types.js";

Source

“./task-wire.js” (namespace export)

Re-exports all named exports from the “./task-wire.js” module.

Signature

export * from "./task-wire.js";

Source

DefineJobOptions

Signature

declare const DefineJobOptions: DefineJobOptions<Name, Task, Id>;

Source

DurationInput

Signature

declare const DurationInput:
  | `${number} second`
  | `${number} seconds`
  | `${number} minute`
  | `${number} minutes`
  | `${number} hour`
  | `${number} hours`
  | `${number} day`
  | `${number} days`
  | `${number} week`
  | `${number} weeks`
  | `${number} millisecond`
  | `${number} milliseconds`;

Source

DurationUnit

Signature

declare const DurationUnit: DurationUnit;

Source

DurationValidationError

Signature

declare const DurationValidationError: typeof DurationValidationError;

Source

InstantValidationError

Signature

declare const InstantValidationError: typeof InstantValidationError;

Source

JOB_NAME_MAX_LENGTH

Signature

declare const JOB_NAME_MAX_LENGTH: 64;

Source

JOB_NAME_PATTERN

Signature

declare const JOB_NAME_PATTERN: RegExp;

Source

JOB_NAME_RESERVED

Signature

declare const JOB_NAME_RESERVED: readonly [
  "then",
  "constructor",
  "prototype",
  "toJSON",
  "toString",
  "valueOf",
  "hasOwnProperty",
  "isPrototypeOf",
  "propertyIsEnumerable",
  "toLocaleString",
  "__proto__",
];

Source

JobAccessGrant

Signature

declare const JobAccessGrant: JobAccessGrant;

Source

JobAccessRequest

Signature

declare const JobAccessRequest: JobAccessRequest;

Source

JobAdmission

Signature

declare const JobAdmission: JobAdmission<Input>;

Source

JobAuthorizationContext

Signature

declare const JobAuthorizationContext: JobAuthorizationContext;

Source

JobClientAccess

Signature

declare const JobClientAccess: JobClientAccess<Streams>;

Source

JobClientField

Signature

declare const JobClientField: JobClientField;

Source

JobClientOperation

Signature

declare const JobClientOperation: JobClientOperation;

Source

JobDescriptor

Signature

declare const JobDescriptor: JobDescriptor<Name, Id, Task>;

Source

JobDescriptorAny

Signature

declare const JobDescriptorAny: JobDescriptorAny;

Source

JobErrorEnvelope

Signature

declare const JobErrorEnvelope: JobErrorEnvelope;

Source

JobName

Signature

declare const JobName: JobName<Name>;

Source

JobNameValidationError

Signature

declare const JobNameValidationError: typeof JobNameValidationError;

Source

JobRunResultOptions

Signature

declare const JobRunResultOptions: RunResultOptions;

Source

JobRunStatus

Signature

declare const JobRunStatus: JobRunStatus;

Source

JobScheduleClient

Signature

declare const JobScheduleClient: JobScheduleClient<Definition>;

Source

JobServiceSelection

Signature

declare const JobServiceSelection: JobServiceSelection;

Source

JobUnknownOutcome

Signature

declare const JobUnknownOutcome: JobUnknownOutcome;

Source

JobWireEnvelope

Signature

declare const JobWireEnvelope: JobWireEnvelope;

Source

JobsTelemetry

Signature

declare const JobsTelemetry: typeof JobsTelemetry;

Source

JobsTelemetryLive

Signature

declare const JobsTelemetryLive: Layer<JobsTelemetry, never, never>;

Source

JsonWireEnvelope

Signature

declare const JsonWireEnvelope: JsonWireEnvelope;

Source

NamedStreamFrame

Signature

declare const NamedStreamFrame: NamedStreamFrame<Item>;

Source

ProgressEmitReceipt

Signature

declare const ProgressEmitReceipt: ProgressEmitReceipt;

Source

ResultAvailability

Signature

declare const ResultAvailability: ResultAvailability;

Source

RunAvailability

Signature

declare const RunAvailability: RunAvailability;

Source

RunCancellationReceipt

Signature

declare const RunCancellationReceipt: RunCancellationReceipt;

Source

RunConnection

Signature

declare const RunConnection: RunConnection;

Source

RunHandle

Signature

declare const RunHandle: RunHandle;

Source

RunListQuery

Signature

declare const RunListQuery: RunListQuery;

Source

RunPage

Signature

declare const RunPage: RunPage<Run>;

Source

RunRetryReceipt

Signature

declare const RunRetryReceipt: RunRetryReceipt;

Source

RunSnapshot

Signature

declare const RunSnapshot: RunSnapshot<Input, Output, Progress, Failure>;

Source

RunWatchFrame

Signature

declare const RunWatchFrame: RunWatchFrame<Run>;

Source

ScheduleDefinition

Signature

declare const ScheduleDefinition: ScheduleDefinition<Input>;

Source

ScheduleListOptions

Signature

declare const ScheduleListOptions: ScheduleListOptions;

Source

ScheduleMisfire

Signature

declare const ScheduleMisfire: ScheduleMisfire;

Source

ScheduleOverlap

Signature

declare const ScheduleOverlap: ScheduleOverlap;

Source

ScheduleReadReceipt

Signature

declare const ScheduleReadReceipt: ScheduleReadReceipt<Definition>;

Source

ScheduleRecord

Signature

declare const ScheduleRecord: ScheduleRecord<Definition>;

Source

ScheduleWriteOptions

Signature

declare const ScheduleWriteOptions: ScheduleWriteOptions;

Source

ScheduleWriteOutcome

Signature

declare const ScheduleWriteOutcome: ScheduleWriteOutcome;

Source

ScheduleWriteReceipt

Signature

declare const ScheduleWriteReceipt: ScheduleWriteReceipt<Definition>;

Source

StreamIdentity

Signature

declare const StreamIdentity: StreamIdentity;

Source

StreamItem

Signature

declare const StreamItem: JsonValue;

Source

TASK_INPUT_MAX_BYTES

Signature

declare const TASK_INPUT_MAX_BYTES: 1048576;

Source

TASK_ITEM_MAX_BYTES

Signature

declare const TASK_ITEM_MAX_BYTES: number;

Source

TASK_KEY_MAX_BYTES

Signature

declare const TASK_KEY_MAX_BYTES: 256;

Source

TASK_MAX_TAGS

Signature

declare const TASK_MAX_TAGS: 20;

Source

TASK_OUTPUT_MAX_BYTES

Signature

declare const TASK_OUTPUT_MAX_BYTES: 1048576;

Source

TASK_REASON_MAX_BYTES

Signature

declare const TASK_REASON_MAX_BYTES: 1024;

Source

ValidJobName

Signature

declare const ValidJobName: ValidJobName<Name>;

Source

VoidWireEnvelope

Signature

declare const VoidWireEnvelope: VoidWireEnvelope;

Source

assertJobName

Signature

declare const assertJobName: (value: unknown, source?: string) => asserts value is JobName;

Source

assertJobNameEffect

Signature

declare const assertJobNameEffect: (
  value: unknown,
  source?: any,
) => Effect<undefined, JobNameValidationError, never>;

Source

assertRfc3339Instant

Signature

declare const assertRfc3339Instant: (value: unknown, name?: string) => asserts value is string;

Source

assertRfc3339InstantEffect

Signature

declare const assertRfc3339InstantEffect: (
  value: unknown,
  name?: any,
) => Effect<undefined, InstantValidationError, never>;

Source

copyTriggerOptions

Signature

declare const copyTriggerOptions: (value: unknown) => CopiedTriggerOptions;

Source

durationToMillis

Signature

declare const durationToMillis: (value: DurationInput) => number;

Source

durationToMillisEffect

Signature

declare const durationToMillisEffect: (
  value:
    | `${number} second`
    | `${number} seconds`
    | `${number} minute`
    | `${number} minutes`
    | `${number} hour`
    | `${number} hours`
    | `${number} day`
    | `${number} days`
    | `${number} week`
    | `${number} weeks`
    | `${number} millisecond`
    | `${number} milliseconds`,
) => Effect<number, DurationValidationError, never>;

Source

isDurationInput

Signature

declare const isDurationInput: (value: unknown) => value is DurationInput;

Source

isDurationInputEffect

Signature

declare const isDurationInputEffect: (value: unknown) => Effect<boolean, never, never>;

Source

isJobName

Signature

declare const isJobName: (value: unknown) => value is JobName;

Source

isJobNameEffect

Signature

declare const isJobNameEffect: (value: unknown) => Effect<boolean, never, never>;

Source

isRfc3339Instant

Signature

declare const isRfc3339Instant: (value: unknown) => value is string;

Source

isRfc3339InstantEffect

Signature

declare const isRfc3339InstantEffect: (value: unknown) => Effect<boolean, never, never>;

Source

isValidJobName

Signature

declare const isValidJobName: (value: unknown) => value is JobName;

Source

normalizeJobName

Signature

declare const normalizeJobName: <const Name extends string>(value: Name) => ValidJobName<Name>;

Source

parseDuration

Signature

declare const parseDuration: (value: DurationInput) => number;

Source

validateDuration

Signature

declare const validateDuration: (value: DurationInput) => number;

Source

validateJobName

Signature

declare const validateJobName: <const Name extends string>(value: Name) => ValidJobName<Name>;

Source

validateJobNameEffect

Signature

declare const validateJobNameEffect: <const Name extends string>(
  value: Name,
) => Effect<ValidJobName<Name>, JobNameValidationError, never>;

Source

validateResultOptions

Signature

declare const validateResultOptions: (value: unknown) => RunResultOptions;

Source

instant-validation.ts

InstantValidationError (class)

An invalid authored RFC 3339 instant.

Example

new InstantValidationError({ name: "instant", reason: "invalid" });

Signature

declare class InstantValidationError

Source

assertRfc3339Instant

Synchronous RFC 3339 assertion.

Throws

TypeError when the instant is invalid.

Example

assertRfc3339Instant("2026-01-01T00:00:00Z");

Signature

declare const assertRfc3339Instant: (value: unknown, name?: string) => asserts value is string;

Source

assertRfc3339InstantEffect

Requires an RFC 3339 instant in Effect.

Example

Effect.runPromise(assertRfc3339InstantEffect("2026-01-01T00:00:00Z"));

Signature

declare const assertRfc3339InstantEffect: (
  value: unknown,
  name?: any,
) => Effect.Effect<undefined, InstantValidationError, never>;

Source

isRfc3339Instant

Synchronous RFC 3339 predicate.

Throws

A runtime defect if the Effect cannot execute synchronously.

Example

isRfc3339Instant("2026-01-01T00:00:00Z");

Signature

declare const isRfc3339Instant: (value: unknown) => value is string;

Source

isRfc3339InstantEffect

Checks RFC 3339 syntax and calendar bounds in Effect.

Example

Effect.runSync(isRfc3339InstantEffect("2026-01-01T00:00:00Z"));

Signature

declare const isRfc3339InstantEffect: (value: unknown) => Effect.Effect<boolean, never, never>;

Source

job-name.ts

JOB_NAME_PATTERN

ASCII job names start with a lowercase letter and continue with letters or digits.

Example

JOB_NAME_PATTERN.test("sendEmail");

Signature

declare const JOB_NAME_PATTERN: RegExp;

Source

JOB_NAME_RESERVED

JavaScript promise and object keys that cannot name callable jobs.

Example

JOB_NAME_RESERVED.includes("then");

Signature

declare const JOB_NAME_RESERVED: readonly [
  "then",
  "constructor",
  "prototype",
  "toJSON",
  "toString",
  "valueOf",
  "hasOwnProperty",
  "isPrototypeOf",
  "propertyIsEnumerable",
  "toLocaleString",
  "__proto__",
];

Source

JobName

Signature

declare const JobName: JobName<Name>;

Source

JobNameValidationError (class)

A rejected authored job name with a stable validation tag.

Example

new JobNameValidationError({ source: "job name", reason: "Invalid name" });

Signature

declare class JobNameValidationError

Source

ValidJobName

Signature

declare const ValidJobName: ValidJobName<Name>;

Source

assertJobName

Asserts the job-name grammar for synchronous callers.

Throws

TypeError when the candidate is not a valid job name.

Example

assertJobName("sendEmail");

Signature

declare const assertJobName: (value: unknown, source?: string) => asserts value is JobName;

Source

assertJobNameEffect

Validates a job name in the Effect error channel.

Example

Effect.runPromise(assertJobNameEffect("sendEmail"));

Signature

declare const assertJobNameEffect: (
  value: unknown,
  source?: any,
) => Effect.Effect<undefined, JobNameValidationError, never>;

Source

isJobName

Tests a candidate against the job-name grammar.

Throws

A runtime defect if the Effect cannot execute synchronously.

Example

isJobName("sendEmail");

Signature

declare const isJobName: (value: unknown) => value is JobName;

Source

isJobNameEffect

Tests a candidate against the job-name grammar in Effect.

Example

Effect.runSync(isJobNameEffect("sendEmail"));

Signature

declare const isJobNameEffect: (value: unknown) => Effect.Effect<boolean, never, never>;

Source

isValidJobName

Alias for isJobName.

Throws

A runtime defect if the Effect cannot execute synchronously.

Example

isValidJobName("sendEmail");

Signature

declare const isValidJobName: (value: unknown) => value is JobName;

Source

normalizeJobName

Alias for validateJobName.

Throws

TypeError when the name is invalid.

Example

normalizeJobName("sendEmail");

Signature

declare const normalizeJobName: <const Name extends string>(value: Name) => ValidJobName<Name>;

Source

validateJobName

Validates a literal job name for synchronous authors.

Throws

TypeError when the name is invalid.

Example

validateJobName("sendEmail");

Signature

declare const validateJobName: <const Name extends string>(value: Name) => ValidJobName<Name>;

Source

validateJobNameEffect

Validates a literal name in Effect while retaining its literal type.

Example

Effect.runPromise(validateJobNameEffect("sendEmail"));

Signature

declare const validateJobNameEffect: <const Name extends string>(
  value: Name,
) => Effect.Effect<ValidJobName<Name>, JobNameValidationError, never>;

Source

job-name.types.ts

JobName (type alias)

A validated job name, preserving literal types when available.

Signature

type JobName<Name extends string = string> = string extends Name ? string : ValidJobName<Name>;

Source

ValidJobName (type alias)

Compile-time predicate for a literal job name.

Signature

type ValidJobName<Name extends string = string> = string extends Name
  ? never
  : Name extends (typeof JOB_NAME_RESERVED)[number]
    ? never
    : Name extends `${LowercaseLetter}${infer Rest}`
      ? ValidCharacters<Rest> extends true
        ? AtMost64<Name> extends true
          ? Name
          : never
        : never
      : never;

Source

job-validation-value.ts

copyAdmission

Validates and freezes job admission policy against the canonical input schema.

Throws

TypeError for unsupported or unsafe admission values.

Example

copyAdmission({ idempotency: { key: "orderId" } }, inputSchema);

Signature

declare const copyAdmission: <Input>(
  value: unknown,
  canonicalSchema?: StandardSchemaV1,
) => JobAdmission<Input> | undefined;

Source

copyClient

Validates the client operations and projected fields exposed by a job.

Throws

TypeError for an undeclared operation or invalid field.

Example

copyClient({ public: true, operations: ["status"] }, declarations);

Signature

declare const copyClient: (
  value: unknown,
  declarations: ClientDeclarations,
) => JobClientAccess | undefined;

Source

job-validation.ts

ClientDeclarations

Signature

declare const ClientDeclarations: ClientDeclarations;

Source

JobValidationFailure (class)

Expected job policy validation failure with its original cause.

Example

if (error instanceof JobValidationFailure) console.log(error.message);

Signature

declare class JobValidationFailure

Source

copyAdmission

Synchronous job admission policy copier.

Throws

Original invalid policy error.

Example

copyAdmission({ pastAt: "run" });

Signature

declare const copyAdmission: <Input>(
  value: unknown,
  canonicalSchema?: StandardSchemaV1,
) => JobAdmission<Input> | undefined;

Source

copyAdmissionEffect

Copies job admission policy in Effect.

Example

Effect.runSync(copyAdmissionEffect({ pastAt: "run" }));

Signature

declare const copyAdmissionEffect: <Input>(
  value: unknown,
  canonicalSchema?: StandardSchemaV1<unknown, unknown> | undefined,
) => Effect.Effect<JobAdmission<Input> | undefined, JobValidationFailure, never>;

Source

copyClient

Synchronous job client access policy copier.

Throws

Original invalid policy error.

Example

copyClient({ public: true, operations: ["trigger"] }, {});

Signature

declare const copyClient: (
  value: unknown,
  declarations: ClientDeclarations,
) => JobClientAccess | undefined;

Source

copyClientEffect

Copies job client access policy in Effect.

Example

Effect.runSync(copyClientEffect({ public: true, operations: ["trigger"] }, {}));

Signature

declare const copyClientEffect: (
  value: unknown,
  declarations: ClientDeclarations,
) => Effect.Effect<JobClientAccess | undefined, JobValidationFailure, never>;

Source

job-validation.types.ts

Task schemas available when authoring job client access.

ClientDeclarations (interface)

Task schemas available when authoring job client access.

Signature

export interface ClientDeclarations {
  readonly progress?: unknown;
  readonly streams?: unknown;
}

Source

job.types.ts

DefineJobOptions (type alias)

Options accepted for define job operations.

Signature

type DefineJobOptions<
  Name extends string,
  Task extends TaskDescriptorAny,
  Id extends string = Name,
> = DescriptorMetadata &
  JobServiceSelection & {
    readonly name: Name & ValidJobName<Name>;
    readonly id?: Id;
    readonly task: Task;
    readonly default?: boolean;
    readonly schedules?: readonly ScheduleDefinition<InferInput<Task["input"]>>[];
    readonly admission?: JobAdmission<InferOutput<Task["input"]>>;
    readonly client?: JobClientAccess<StreamsOf<Task>>;
  };

Source

JobAdmission (interface)

Policy for late schedules and idempotent submissions.

Signature

export interface JobAdmission<Input = unknown> {
  readonly pastAt?: "run" | "reject";
  readonly idempotency?: {
    readonly key?: Extract<keyof Input, string>;
    readonly retention?: DurationInput;
  };
}

Source

JobAuthorizationContext (interface)

Trusted scope and optional subject data passed to an access policy.

Signature

export interface JobAuthorizationContext {
  readonly application: string;
  readonly environment: string;
  readonly scope: string;
  readonly subject?: string;
  readonly auth?: unknown;
  readonly run?: import("@relkit/contracts/jobs").RunSnapshot;
}

Source

JobClientAccess (type alias)

Public or policy-guarded operations and fields exposed to clients.

Signature

type JobClientAccess<Streams extends TaskStreamSchemas = TaskStreamSchemas> =
  | {
      readonly public: true;
      readonly operations: readonly JobClientOperation[];
      readonly fields?: readonly JobClientField[];
      readonly streams?: readonly (keyof Streams & string)[];
    }
  | {
      readonly authorize: (
        request: JobAccessRequest,
        context: JobAuthorizationContext,
      ) => MaybePromise<JobAccessGrant>;
      readonly public?: never;
      readonly operations: readonly JobClientOperation[];
      readonly fields?: readonly JobClientField[];
      readonly streams?: readonly (keyof Streams & string)[];
    };

Source

JobClientField (type alias)

Run fields that authorization may expose to a client.

Signature

type JobClientField = "status" | "input" | "progress" | "output" | "error";

Source

JobDescriptor (type alias)

Validated job definition and its task-specific trigger operation.

Signature

type JobDescriptor<
  Name extends string,
  Id extends string,
  Task extends TaskDescriptorAny,
> = DescriptorBase<"job", Id> &
  JobRef<Id, Task["input"], Task["output"], Task> & {
    readonly name: Name;
    readonly task: Task;
    readonly input: Task["input"];
    readonly output: Task["output"];
    readonly errors?: Task["errors"];
    readonly progress?: Task["progress"];
    readonly streams?: Task["streams"];
    readonly execution: Task["execution"];
    readonly observation?: TaskObservation<
      Task["streams"] extends TaskStreamSchemas ? Task["streams"] : {}
    >;
    readonly service?: string;
    readonly default?: boolean;
    readonly schedules?: readonly ScheduleDefinition<InferOutput<Task["input"]>>[];
    readonly admission?: JobAdmission<InferOutput<Task["input"]>>;
    readonly client?: JobClientAccess<StreamsOf<Task>>;
    readonly trigger: (
      input: InferInput<Task["input"]>,
      options?: ServerTriggerOptions,
    ) => Promise<RunHandle>;
  };

Source

JobDescriptorAny (type alias)

Erases task-specific admission keys at runtime boundaries without making concrete jobs invariant.

Signature

type JobDescriptorAny = Omit<
  JobDescriptor<string, string, TaskDescriptorAny>,
  "admission" | "trigger"
> & {
  readonly admission?: JobAdmission<any>;
  readonly trigger: (input: any, options?: ServerTriggerOptions) => Promise<RunHandle>;
};

Source

JobRunResultOptions (type alias)

Options accepted for job run result operations.

Signature

type JobRunResultOptions = RunResultOptions;

Source

JobScheduleClient

Signature

declare const JobScheduleClient: JobScheduleClient<Definition>;

Source

JobServiceSelection (type alias)

Mutually exclusive service and deprecated profile selectors.

Signature

type JobServiceSelection =
  | { readonly service?: string; readonly profile?: never }
  | { readonly service?: never; readonly profile?: string };

Source

RetryJitter (type alias)

Jitter strategy for the compatibility retry policy.

Signature

type RetryJitter = "none" | "full" | "equal";

Source

RetryPolicy (interface)

Compatibility retry attempts, delays, multiplier, and jitter.

Signature

export interface RetryPolicy {
  readonly maxAttempts: number;
  readonly initialDelayMs: number;
  readonly maxDelayMs: number;
  readonly multiplier: number;
  readonly jitter: RetryJitter;
}

Source

RunResultOptions

Signature

declare const RunResultOptions: RunResultOptions;

Source

ScheduleDefinition

Signature

declare const ScheduleDefinition: ScheduleDefinition<Input>;

Source

ScheduleListOptions

Signature

declare const ScheduleListOptions: ScheduleListOptions;

Source

ScheduleMisfire

Signature

declare const ScheduleMisfire: ScheduleMisfire;

Source

ScheduleOverlap

Signature

declare const ScheduleOverlap: ScheduleOverlap;

Source

ScheduleReadReceipt

Signature

declare const ScheduleReadReceipt: ScheduleReadReceipt<Definition>;

Source

ScheduleRecord

Signature

declare const ScheduleRecord: ScheduleRecord<Definition>;

Source

ScheduleWriteOptions

Signature

declare const ScheduleWriteOptions: ScheduleWriteOptions;

Source

ScheduleWriteOutcome

Signature

declare const ScheduleWriteOutcome: ScheduleWriteOutcome;

Source

ScheduleWriteReceipt

Signature

declare const ScheduleWriteReceipt: ScheduleWriteReceipt<Definition>;

Source

ServerTriggerOptions

Signature

declare const ServerTriggerOptions: ServerTriggerOptions;

Source

TriggerOptions

Signature

declare const TriggerOptions: TriggerOptions;

Source

jobs-observability.ts

JobsTelemetry (class)

Injectable observer for jobs Effect operations.

Example

Effect.provide(durationToMillisEffect("1 second"), JobsTelemetryLive);

Signature

declare class JobsTelemetry

Source

JobsTelemetryLive

Live spans and bounded jobs operation metrics.

Example

Effect.provide(durationToMillisEffect("1 second"), JobsTelemetryLive);

Signature

declare const JobsTelemetryLive: Layer.Layer<JobsTelemetry, never, never>;

Source

observeJobs

Observes an operation with a supplied service or the live observer.

Example

observeJobs("duration.toMillis", Effect.succeed(1000));

Signature

declare const observeJobs: <A, E, R>(
  operation: JobsOperation,
  effect: Effect.Effect<A, E, R>,
) => Effect.Effect<A, E, R>;

Source

jobs-observability.types.ts

JobsOperation (type alias)

Stable, bounded operation labels recorded in spans and metrics.

Example

const operation: JobsOperation = "submission.write";

Signature

type JobsOperation =
  | "duration.isInput"
  | "duration.toMillis"
  | "jobName.is"
  | "jobName.assert"
  | "jobName.validate"
  | "identity.stableTuple"
  | "identity.taskOperation"
  | "identity.retryOperation"
  | "identity.scheduleOccurrence"
  | "instant.is"
  | "instant.assert"
  | "retry.validate"
  | "control.write"
  | "canonical.assertProjection"
  | "taskSupport.copyStrings"
  | "taskSupport.assertHook"
  | "taskSupport.isSchema"
  | "taskSupport.hasOwn"
  | "taskSupport.isRecord"
  | "taskObservation.copy"
  | "migration.diagnose"
  | "migration.legacy"
  | "authorization.authorize"
  | "authorization.grant"
  | "authorization.operation"
  | "server.readManifest"
  | "server.run"
  | "server.runtimeOptions"
  | "capability.assert"
  | "capability.validateReport"
  | "adapter.assertMethods"
  | "authorization.projectSnapshot"
  | "authorization.projectPage"
  | "adapter.assertRuntime"
  | "adapter.isRuntime"
  | "runtime.create"
  | "runtime.current"
  | "runtime.require"
  | "runtime.validateManifest"
  | "runtime.runIn"
  | "serviceOptions.validate"
  | "serviceOptions.serialize"
  | "serviceOptions.deserialize"
  | "serviceOptions.assertSupported"
  | "submission.write"
  | "submission.prepare"
  | "submission.prepareCanonical"
  | "submission.createPipeline"
  | "submission.submitTask"
  | "submission.submitJob"
  | "submission.submitCanonical"
  | "schedule.createControls"
  | "schedule.list"
  | "schedule.get"
  | "schedule.write"
  | "control.create"
  | "control.get"
  | "control.list"
  | "control.observe"
  | "control.cancel"
  | "control.retry"
  | "control.result"
  | "legacy.defineJob"
  | "authorization.createCursor"
  | "authorization.readCursor"
  | "runLocator.create"
  | "runLocator.namespaceHash"
  | "runLocator.validateKeyRing"
  | "runLocator.verify"
  | "runLocator.rotate"
  | "runLocator.routerLoad"
  | "runLocator.routerRegister"
  | "runLocator.routerSnapshot"
  | "runLocator.routerPersist"
  | "runLocator.routerRoute"
  | "trigger.copyOptions"
  | "trigger.resultOptions"
  | "schedule.copyDefinitions"
  | "binding.resolve"
  | "runtime.resolveBinding"
  | "client.runAbortable"
  | "client.create"
  | "client.enqueue"
  | "task.createProgressEmitter"
  | "task.createStreamEmitter"
  | "task.emitProgress"
  | "task.emitStream"
  | "schedule.reconcile"
  | "schedule.owner"
  | "schedule.operationId"
  | "schedule.writeRecovery"
  | "control.pollResult"
  | "taskWire.encodeJob"
  | "taskWire.encodeInput"
  | "taskWire.encodeOutput"
  | "taskWire.decodeJob"
  | "taskWire.validateInput"
  | "taskWire.validateCanonicalInput"
  | "taskWire.validateOutput"
  | "taskWire.validateCanonicalOutput"
  | "job.define"
  | "job.isDescriptor"
  | "job.assertDescriptor"
  | "task.define"
  | "task.isDescriptor"
  | "task.assertDescriptor"
  | "client.resolveProvider"
  | "client.parseInput"
  | "client.assertOptions"
  | "client.assertOptionalText"
  | "client.normalizeResult"
  | "client.notify"
  | "client.resolveCorrelation"
  | "taskValidation.assertSchema"
  | "taskValidation.normalizeVersion"
  | "taskValidation.inputWire"
  | "taskValidation.canonicalSchema"
  | "taskValidation.canonicalStreams"
  | "taskValidation.retry"
  | "taskValidation.dependencies"
  | "taskValidation.errors"
  | "taskValidation.streams"
  | "taskValidation.duration"
  | "taskPolicy.utf8Bytes"
  | "taskPolicy.boundedString"
  | "taskPolicy.fieldName"
  | "taskPolicy.memoryBytes"
  | "taskPolicy.scalarKey"
  | "taskPolicy.tags"
  | "taskPolicy.resources"
  | "taskPolicy.concurrency"
  | "taskPolicy.logging"
  | "taskPolicy.retryDelay"
  | "jobValidation.admission"
  | "jobValidation.client"
  | "submission.admission"
  | "submission.submitPrepared"
  | "control.observeSetup"
  | "control.observeNext"
  | "controlSupport.context"
  | "controlSupport.requireMethod"
  | "controlSupport.operationId"
  | "controlSupport.cancelReceipt"
  | "controlSupport.retryReceipt"
  | "controlSupport.isUnknown"
  | "controlSupport.unknownKey"
  | "controlSupport.unknownRecovery"
  | "controlSupport.isTerminal"
  | "controlSupport.timeout"
  | "controlSupport.isRecord"
  | "submissionSupport.error"
  | "submissionSupport.receipt"
  | "submissionSupport.envelope"
  | "submissionSupport.isUnknown"
  | "submissionSupport.isRecord"
  | "submissionSupport.idempotency"
  | "submissionSupport.boundedKey"
  | "submissionSupport.scheduledTime"
  | "submissionSupport.correlation"
  | "submissionSupport.propagation"
  | "submissionSupport.parentRun"
  | "submissionSupport.hashWire"
  | "binding.selectProfile"
  | "binding.taskId";

Source

JobsTelemetryService (interface)

Substitutable observer used by jobs Effect operations.

Example

const observer: JobsTelemetryService = { observe: (_name, effect) => effect };

Signature

export interface JobsTelemetryService {
  /** Surrounds an operation while preserving its success and error channels.
   * @param operation - A stable operation name.
   * @param effect - The operation to observe.
   * @returns The observed Effect with unchanged success and error types.
   * @example observer.observe("duration.toMillis", Effect.succeed(1000));
   */
  readonly observe: <A, E, R>(
    operation: JobsOperation,
    effect: Effect.Effect<A, E, R>,
  ) => Effect.Effect<A, E, R>;
}

Source

legacy-define-job.ts

DefineJobOptions

Signature

declare const DefineJobOptions: DefineJobOptions<Id, InputSchema, Target>;

Source

IdempotencyDefinition

Signature

declare const IdempotencyDefinition: IdempotencyDefinition<Input>;

Source

JobDescriptor

Signature

declare const JobDescriptor: JobDescriptor<Id, Input, InputSchema, Target>;

Source

LegacyJobValidationError (class)

Invalid legacy job authoring options.

Example

if (error instanceof LegacyJobValidationError) console.log(error.message);

Signature

declare class LegacyJobValidationError

Source

RetryJitter

Signature

declare const RetryJitter: RetryJitter;

Source

RetryPolicy

Signature

declare const RetryPolicy: RetryPolicy;

Source

ScheduleDefinition

Signature

declare const ScheduleDefinition: ScheduleDefinition<Input>;

Source

ScheduleOverlap

Signature

declare const ScheduleOverlap: ScheduleOverlap;

Source

defineJob

Synchronous compatibility adapter for legacy job authoring.

Throws

TypeError when the authored job is invalid.

Example

defineJob(options);

Signature

declare const defineJob: <
  const Id extends string,
  const InputSchema extends StandardSchemaV1,
  const Target extends FunctionRefAny,
>(
  options: DefineJobOptions<Id, InputSchema, Target>,
) => JobDescriptor<Id, InferInput<InputSchema>, InputSchema, Target>;

Source

defineJobEffect

Defines a legacy function backed job in Effect.

Example

Effect.runSync(defineJobEffect(options));

Signature

declare const defineJobEffect: <
  const Id extends string,
  const InputSchema extends StandardSchemaV1,
  const Target extends FunctionRefAny,
>(
  options: DefineJobOptions<Id, InputSchema, Target>,
) => Effect.Effect<
  JobDescriptor<Id, InferInput<InputSchema>, InputSchema, Target>,
  LegacyJobValidationError,
  never
>;

Source

legacy-define-job.types.ts

DefineJobOptions (interface)

Options accepted for define job operations.

Signature

export interface DefineJobOptions<
  Id extends string,
  InputSchema extends StandardSchemaV1,
  Target extends FunctionRefAny,
> extends DescriptorMetadata {
  readonly id: Id;
  readonly input: InputSchema;
  readonly target: Target;
  readonly profile?: string;
  readonly retry: RetryPolicy;
  readonly timeoutMs?: number;
  readonly concurrency?: number;
  readonly schedule?: readonly ScheduleDefinition<InferInput<InputSchema>>[];
  readonly idempotency?: IdempotencyDefinition<InferInput<InputSchema>>;
}

Source

IdempotencyDefinition (interface)

Legacy deduplication key and retention policy.

Signature

export interface IdempotencyDefinition<Input = unknown> {
  readonly key: IdempotencyKey<Input>;
  readonly retentionMs: number;
}

Source

JobDescriptor (interface)

Validated job definition and its task-specific trigger operation.

Signature

export interface JobDescriptor<
  Id extends string,
  Input,
  InputSchema extends StandardSchemaV1 = StandardSchemaV1,
  Target extends FunctionRefAny = FunctionRefAny,
> extends DescriptorBase<"job", Id> {
  readonly input: InputSchema;
  readonly target: Target;
  readonly profile?: string;
  readonly retry: RetryPolicy;
  readonly timeoutMs?: number;
  readonly concurrency?: number;
  readonly schedule?: readonly ScheduleDefinition<Input>[];
  readonly idempotency?: IdempotencyDefinition<Input>;
}

Source

RetryJitter (type alias)

Jitter strategy retained for legacy job retry policy.

Signature

type RetryJitter = "none" | "full" | "equal";

Source

RetryPolicy (interface)

Legacy retry attempts, backoff, and jitter settings.

Signature

export interface RetryPolicy {
  readonly maxAttempts: number;
  readonly initialDelayMs: number;
  readonly maxDelayMs: number;
  readonly multiplier: number;
  readonly jitter: RetryJitter;
}

Source

ScheduleDefinition (interface)

Legacy schedule timing and overlap configuration.

Signature

export interface ScheduleDefinition<Input = JsonValue> {
  readonly id: string;
  readonly cron: string;
  readonly timezone: string;
  readonly input: Input;
  readonly overlap: ScheduleOverlap;
}

Source

ScheduleOverlap (type alias)

Legacy policy for simultaneous schedule occurrences.

Signature

type ScheduleOverlap = "skip" | "allow";

Source

legacy.ts

Explicit one-release compatibility surface for function-target enqueue jobs.

“./client.js” (namespace export)

Re-exports all named exports from the “./client.js” module.

Signature

export * from "./client.js";

Source

“./legacy-define-job.js” (namespace export)

Re-exports all named exports from the “./legacy-define-job.js” module.

Signature

export * from "./legacy-define-job.js";

Source

migration-support.ts

breakingEffect

Constructs one breaking diagnostic within a migration Effect.

Example

Effect.runSync(breakingEffect("TASK_ID_CHANGED", "Task changed"));

Signature

declare const breakingEffect: (
  code:
    | "TASK_ID_CHANGED"
    | "TASK_VERSION_CHANGED"
    | "TASK_INPUT_SCHEMA_CHANGED"
    | "DEDUPE_SCOPE_CHANGED"
    | "PUBLIC_CLIENT_FINGERPRINT_CHANGED"
    | "LEGACY_JOBS_DISABLED"
    | "LEGACY_ALIAS_CONFLICT",
  message: string,
) => Effect.Effect<JobMigrationDiagnostic, never, never>;

Source

sameEffect

Compares schedule identifiers in authored order.

Example

Effect.runSync(sameEffect(["daily"], ["daily"]));

Signature

declare const sameEffect: (
  left: ReadonlyArray<string> | undefined,
  right: ReadonlyArray<string> | undefined,
) => Effect.Effect<boolean, never, never>;

Source

migration.ts

JobBindingMigration

Signature

declare const JobBindingMigration: JobBindingMigration;

Source

JobMigrationDiagnostic

Signature

declare const JobMigrationDiagnostic: JobMigrationDiagnostic;

Source

JobMigrationSeverity

Signature

declare const JobMigrationSeverity: JobMigrationSeverity;

Source

JobMigrationSnapshot

Signature

declare const JobMigrationSnapshot: JobMigrationSnapshot;

Source

LegacyCompatibilitySnapshot

Signature

declare const LegacyCompatibilitySnapshot: LegacyCompatibilitySnapshot;

Source

diagnoseJobMigration

Synchronous migration diagnostic adapter.

Throws

A runtime defect if the Effect cannot execute synchronously.

Example

diagnoseJobMigration(previous, next);

Signature

declare const diagnoseJobMigration: (
  previous: JobMigrationSnapshot,
  next: JobMigrationSnapshot,
) => readonly JobMigrationDiagnostic[];

Source

diagnoseJobMigrationEffect

Diagnoses identity and contract changes between two job snapshots in Effect.

Example

Effect.runSync(diagnoseJobMigrationEffect(previous, next));

Signature

declare const diagnoseJobMigrationEffect: (
  previous: JobMigrationSnapshot,
  next: JobMigrationSnapshot,
) => Effect.Effect<ReadonlyArray<JobMigrationDiagnostic>, never, never>;

Source

diagnoseLegacyCompatibility

Synchronous legacy compatibility diagnostic adapter.

Throws

A runtime defect if the Effect cannot execute synchronously.

Example

diagnoseLegacyCompatibility(snapshot);

Signature

declare const diagnoseLegacyCompatibility: (
  snapshot: LegacyCompatibilitySnapshot,
) => readonly JobMigrationDiagnostic[];

Source

diagnoseLegacyCompatibilityEffect

Diagnoses legacy configuration aliases in Effect.

Example

Effect.runSync(diagnoseLegacyCompatibilityEffect(snapshot));

Signature

declare const diagnoseLegacyCompatibilityEffect: (
  snapshot: LegacyCompatibilitySnapshot,
) => Effect.Effect<ReadonlyArray<JobMigrationDiagnostic>, never, never>;

Source

migration.types.ts

Binding mode recorded in a job migration snapshot.

JobBindingMigration (type alias)

Binding mode recorded in a job migration snapshot.

Signature

type JobBindingMigration = "implicit" | "default" | "explicit";

Source

JobMigrationDiagnostic (interface)

Actionable compatibility finding for an authored job change.

Signature

export interface JobMigrationDiagnostic {
  readonly code:
    | "DEFAULT_DERIVED_JOB_ID_RENAME"
    | "PINNED_JOB_ID_CHANGED"
    | "IMPLICIT_TO_EXPLICIT_BINDING"
    | "TASK_ID_CHANGED"
    | "TASK_VERSION_CHANGED"
    | "TASK_INPUT_SCHEMA_CHANGED"
    | "HISTORICAL_RUNS_PINNED"
    | "SCHEDULE_TARGET_CHANGED"
    | "DEDUPE_SCOPE_CHANGED"
    | "PUBLIC_CLIENT_FINGERPRINT_CHANGED"
    | "LEGACY_JOBS_DISABLED"
    | "LEGACY_ALIAS_CONFLICT"
    | "LEGACY_ALIAS_DEPRECATED";
  readonly severity: JobMigrationSeverity;
  readonly breaking: boolean;
  readonly message: string;
}

Source

JobMigrationSeverity (type alias)

Severity assigned to one compatibility diagnostic.

Signature

type JobMigrationSeverity = "warning" | "error";

Source

JobMigrationSnapshot (interface)

Versioned job identity and public contract facts used by migration checks.

Signature

export interface JobMigrationSnapshot {
  readonly name: string;
  readonly id: string;
  readonly idSource?: "explicit" | "name";
  readonly taskId: string;
  readonly taskVersion: string;
  readonly inputSchemaHash?: string;
  readonly binding: JobBindingMigration;
  readonly publicFingerprint?: string;
  readonly clientFingerprint?: string;
  readonly service?: string;
  readonly hasHistoricalRuns?: boolean;
  readonly scheduleIds?: readonly string[];
  readonly dedupeScope?: string;
}

Source

LegacyCompatibilitySnapshot (interface)

Legacy and replacement configuration keys involved in migration.

Signature

export interface LegacyCompatibilitySnapshot {
  readonly usesFunctionTarget: boolean;
  readonly legacyJobsEnabled: boolean;
  readonly legacyKeys?: readonly ("job" | "defaults.job" | "profile")[];
  readonly newKeys?: readonly ("jobs" | "defaults.jobs" | "service")[];
}

Source

resolve-binding-error.ts

JobBindingResolutionError (class)

A deterministic task-to-job binding resolution failure.

Example

new JobBindingResolutionError("UNKNOWN_JOB_SELECTOR", "Unknown job");

Signature

declare class JobBindingResolutionError {
  constructor(code: JobBindingErrorCode, message: string);
}

Source

code (property)

Signature

readonly code: JobBindingErrorCode

Source

resolve-binding-support.ts

JobBindingSupportFailure (class)

A provider profile selection failure with a stable resolution code.

Example

new JobBindingSupportFailure({ code: "UNKNOWN_JOB_PROFILE", reason: "Unknown profile" });

Signature

declare class JobBindingSupportFailure

Source

selectProfile

Synchronous provider profile selector.

Throws

JobBindingResolutionError for missing or unknown profiles.

Example

selectProfile(undefined, ["default"], "send");

Signature

declare const selectProfile: (
  requested: string | undefined,
  profiles: ResolveBindingOptions["profiles"],
  jobId: string,
) => string;

Source

selectProfileEffect

Selects a provider profile in Effect.

Example

Effect.runSync(selectProfileEffect(undefined, ["default"], "send"));

Signature

declare const selectProfileEffect: (
  requested: string | undefined,
  profiles: ReadonlyArray<string> | Readonly<Record<string, unknown>> | undefined,
  jobId: string,
) => Effect.Effect<string, JobBindingSupportFailure, never>;

Source

taskIdOf

Synchronous task reference id reader.

Example

taskIdOf(taskRef);

Signature

declare const taskIdOf: (value: TaskRefAny | undefined) => string;

Source

taskIdOfEffect

Reads a task reference id in Effect.

Example

Effect.runSync(taskIdOfEffect(taskRef));

Signature

declare const taskIdOfEffect: (
  value: TaskRefAny | undefined,
) => Effect.Effect<string, never, never>;

Source

resolve-binding.ts

BindingSource

Signature

declare const BindingSource: BindingSource;

Source

JobBindingErrorCode

Signature

declare const JobBindingErrorCode: JobBindingErrorCode;

Source

JobBindingFailure (class)

A typed task-to-job binding resolution failure.

Example

if (error instanceof JobBindingFailure) console.log(error.message);

Signature

declare class JobBindingFailure

Source

JobBindingResolutionError

Signature

declare const JobBindingResolutionError: typeof JobBindingResolutionError;

Source

ResolveBindingOptions

Signature

declare const ResolveBindingOptions: ResolveBindingOptions;

Source

ResolvedTaskBinding

Signature

declare const ResolvedTaskBinding: ResolvedTaskBinding;

Source

resolveBinding

Compatibility alias for task-to-job binding resolution.

Throws

JobBindingResolutionError for invalid or ambiguous bindings.

Example

resolveBinding({ task, implicitName: "send" });

Signature

declare const resolveBinding: (options: ResolveBindingOptions) => ResolvedTaskBinding;

Source

resolveTaskBinding

Synchronous compatibility resolver for one task.

Throws

JobBindingResolutionError on ambiguity or invalid selector.

Example

resolveTaskBinding(options);

Signature

declare const resolveTaskBinding: (options: ResolveBindingOptions) => ResolvedTaskBinding;

Source

resolveTaskBindingEffect

Resolves an explicit, default, or private implicit job in Effect.

Example

Effect.runSync(resolveTaskBindingEffect(options));

Signature

declare const resolveTaskBindingEffect: (
  options: ResolveBindingOptions,
) => Effect.Effect<ResolvedTaskBinding, JobBindingFailure, never>;

Source

resolve-binding.types.ts

BindingSource (type alias)

How a task selected its job binding.

Signature

type BindingSource = "explicit" | "default" | "implicit";

Source

JobBindingErrorCode (type alias)

Machine-readable reason for a binding resolution failure.

Signature

type JobBindingErrorCode =
  | "MISSING_IMPLICIT_NAME"
  | "INVALID_IMPLICIT_NAME"
  | "TASK_SELECTOR_MISMATCH"
  | "UNKNOWN_JOB_SELECTOR"
  | "AMBIGUOUS_JOB"
  | "DUPLICATE_JOB_ID"
  | "MULTIPLE_DEFAULT_JOBS"
  | "MISSING_JOB_PROFILE"
  | "AMBIGUOUS_JOB_PROFILE"
  | "UNKNOWN_JOB_PROFILE";

Source

ResolveBindingOptions (interface)

Inputs for resolving one task to its executable job.

Signature

export interface ResolveBindingOptions {
  readonly task: TaskRefAny;
  readonly jobs?: readonly JobDescriptorAny[];
  readonly selector?: JobDescriptorAny | JobRefAny;
  readonly implicitName?: string;
  readonly profiles?: readonly string[] | Readonly<Record<string, unknown>>;
  readonly defaultProfile?: string;
}

Source

ResolvedTaskBinding (interface)

Canonical task-to-job selection returned by the binding resolver.

Signature

export interface ResolvedTaskBinding {
  readonly taskId: string;
  readonly taskVersion?: string;
  readonly jobId: string;
  readonly name: string;
  readonly service?: string;
  readonly profile: string;
  readonly source: BindingSource;
  readonly implicit: boolean;
  readonly default: boolean;
  readonly private: boolean;
  readonly job?: JobDescriptorAny;
}

Source

retry-policy.ts

RetryPolicyValidationError (class)

An invalid authored legacy retry policy.

Example

new RetryPolicyValidationError({ reason: "retry.maxAttempts must be positive" });

Signature

declare class RetryPolicyValidationError

Source

validateRetry

Synchronous legacy retry policy validator.

Throws

TypeError when any retry field is invalid.

Example

validateRetry({ maxAttempts: 2, initialDelayMs: 0, maxDelayMs: 0, multiplier: 1, jitter: "none" });

Signature

declare const validateRetry: (value: LegacyRetryPolicy) => LegacyRetryPolicy;

Source

validateRetryEffect

Validates legacy retry policy fields in Effect.

Example

Effect.runPromise(
  validateRetryEffect({
    maxAttempts: 2,
    initialDelayMs: 0,
    maxDelayMs: 0,
    multiplier: 1,
    jitter: "none",
  }),
);

Signature

declare const validateRetryEffect: (value: RetryPolicy) => Effect.Effect<
  Readonly<{
    maxAttempts: number;
    initialDelayMs: number;
    maxDelayMs: number;
    multiplier: number;
    jitter: RetryJitter;
  }>,
  RetryPolicyValidationError,
  never
>;

Source

retry-policy.types.ts

LegacyRetryPolicy (type alias)

Legacy authored retry policy accepted by the validation boundary.

Signature

type LegacyRetryPolicy = RetryPolicy;

Source

run-id-codec.ts

createRunLocatorValue

Serializes and signs a validated run locator payload.

Throws

RunLocatorError when keys, payload, or encoded length are invalid.

Example

createRunLocatorValue({ keyRing, payload });

Signature

declare const createRunLocatorValue: (options: RunLocatorCreateOptions) => string;

Source

rotateRunLocatorKeysValue

Adds a signing key while retaining prior keys for existing locators.

Throws

RunLocatorError when the ring or new key identifier is invalid.

Example

rotateRunLocatorKeysValue(keyRing, "v2", "new-secret");

Signature

declare const rotateRunLocatorKeysValue: (
  ring: RunLocatorKeyRing,
  keyId: string,
  secret: string | Uint8Array,
) => RunLocatorKeyRing;

Source

verifyRunLocatorValue

Verifies a locator signature, payload, and requested deployment namespace.

Throws

RunLocatorError on malformed encoding, signature, or namespace.

Example

verifyRunLocatorValue(locator, { keyRing, application: "shop" });

Signature

declare const verifyRunLocatorValue: (
  locator: string,
  options: RunLocatorVerifyOptions,
) => VerifiedRunLocator;

Source

run-id-errors.ts

Compatibility error for an invalid, unauthenticated, or unroutable locator.

Example

throw new RunLocatorError();

RunLocatorError (class)

Compatibility error for an invalid, unauthenticated, or unroutable locator.

Example

throw new RunLocatorError();

Signature

declare class RunLocatorError {
  constructor();
}

Source

code (property)

Signature

readonly code: "RELKIT_JOB_LOCATOR_INVALID"

Source

run-id-router-store.ts

RunLocatorGenerationStorage (class)

Injectable persistence service for historical run locator generations.

Example

Effect.provide(RunLocatorRouter.fromStoreEffect(), runLocatorStoreLayer(store));

Signature

declare class RunLocatorGenerationStorage

Source

RunLocatorStoreFailure (class)

Failure from generation persistence, preserving the original cause.

Example

if (error instanceof RunLocatorStoreFailure) console.log(error.message);

Signature

declare class RunLocatorStoreFailure

Source

runLocatorStoreLayer

Provides a concrete generation store to Effect operations.

Example

runLocatorStoreLayer(memoryStore);

Signature

declare const runLocatorStoreLayer: (
  store: RunLocatorGenerationStore,
) => Layer.Layer<RunLocatorGenerationStorage, never, never>;

Source

run-id-router.ts

RunLocatorGeneration

Signature

declare const RunLocatorGeneration: RunLocatorGeneration;

Source

RunLocatorGenerationStorage

Signature

declare const RunLocatorGenerationStorage: typeof RunLocatorGenerationStorage;

Source

RunLocatorGenerationStore

Signature

declare const RunLocatorGenerationStore: RunLocatorGenerationStore;

Source

RunLocatorRouter (class)

Routes signed run locators through retained service generations.

Example

new RunLocatorRouter([{ generation: "v1", keyRing }]);

Signature

declare class RunLocatorRouter {
  constructor(generations: readonly RunLocatorGeneration[] = []);
}

Source

fromStore (static method)

Promise compatibility loader.

Throws

The original storage error.

Example

await RunLocatorRouter.fromStore(store);

Signature

declare const fromStore: (store: RunLocatorGenerationStore) => Promise<RunLocatorRouter>;

Source

register (method)

Synchronous generation registration.

Throws

RunLocatorError for invalid generation or keys.

Example

router.register("v2", ring);

Signature

declare const register: (generation: string, keyRing: RunLocatorKeyRing) => void;

Source

snapshot (method)

Synchronous snapshot of retained generations.

Example

router.snapshot();

Signature

declare const snapshot: () => readonly RunLocatorGeneration[];

Source

persist (method)

Promise compatibility persistence.

Throws

The original storage error.

Example

await router.persist(store);

Signature

declare const persist: (store: RunLocatorGenerationStore) => Promise<void>;

Source

route (method)

Synchronously routes a signed locator.

Throws

RunLocatorError when no retained generation matches.

Example

router.route(locator);

Signature

declare const route: (
  locator: string,
  options?: Omit<RunLocatorVerifyOptions, "keyRing">,
) => VerifiedRunLocator;

Source

registerEffect (property)

Registers a generation in Effect.

Example

Effect.runSync(router.registerEffect("v2", ring));

Signature

readonly registerEffect: (generation: string, keyRing: RunLocatorKeyRing) => Effect.Effect<void, RunLocatorFailure, never>

Source

snapshotEffect (property)

Returns a sorted frozen snapshot in Effect.

Example

Effect.runSync(router.snapshotEffect());

Signature

readonly snapshotEffect: () => Effect.Effect<ReadonlyArray<Readonly<{ generation: string; keyRing: RunLocatorKeyRing; }>>, never, never>

Source

persistEffect (property)

Persists the current snapshot through the storage service.

Example

Effect.runPromise(Effect.provide(router.persistEffect(), runLocatorStoreLayer(store)));

Signature

readonly persistEffect: () => Effect.Effect<void, RunLocatorStoreFailure, RunLocatorGenerationStorage>

Source

routeEffect (property)

Routes a locator through retained generations in Effect.

Example

Effect.runSync(router.routeEffect(locator));

Signature

readonly routeEffect: (locator: string, options?: Omit<RunLocatorVerifyOptions, "keyRing"> | undefined) => Effect.Effect<VerifiedRunLocator, RunLocatorFailure, never>

Source

RunLocatorStoreFailure

Signature

declare const RunLocatorStoreFailure: typeof RunLocatorStoreFailure;

Source

runLocatorStoreLayer

Signature

declare const runLocatorStoreLayer: (
  store: RunLocatorGenerationStore,
) => Layer<RunLocatorGenerationStorage, never, never>;

Source

run-id-router.types.ts

RunLocatorGeneration (interface)

One retained service generation and its locator verification keys.

Signature

export interface RunLocatorGeneration {
  readonly generation: string;
  readonly keyRing: RunLocatorKeyRing;
}

Source

RunLocatorGenerationStore (interface)

Replaceable persistence boundary for locator generations.

Signature

export interface RunLocatorGenerationStore {
  readonly load: () => readonly RunLocatorGeneration[] | Promise<readonly RunLocatorGeneration[]>;
  readonly save: (generations: readonly RunLocatorGeneration[]) => void | Promise<void>;
}

Source

run-id-support.ts

assertSegment

Validates a bounded printable locator key identifier.

Throws

RunLocatorError for unsupported characters or length.

Example

assertSegment("key-v1");

Signature

declare const assertSegment: (value: string) => void;

Source

isBase64Url

Checks canonical unpadded base64url encoding for one locator segment.

Example

isBase64Url("YQ");

Signature

declare const isBase64Url: (value: string | undefined) => value is string;

Source

namespaceHash

Hashes the trusted deployment namespace used to bind durable run locators.

Throws

RunLocatorError when an identity is empty or exceeds its byte limit.

Example

namespaceHash("shop", "production", "orders");

Signature

declare const namespaceHash: (application: string, environment: string, scope: string) => string;

Source

normalizePayload

Validates and freezes the payload before it is signed or returned to callers.

Throws

RunLocatorError for malformed identities or a mismatched namespace.

Example

normalizePayload(payload);

Signature

declare const normalizePayload: (value: RunLocatorPayload) => RunLocatorPayload;

Source

validateRunLocatorKeyRing

Verifies the active key and every key identifier and secret in a key ring.

Throws

RunLocatorError for missing, oversized, or malformed keys.

Example

validateRunLocatorKeyRing({ activeKeyId: "v1", keys: { v1: "secret" } });

Signature

declare const validateRunLocatorKeyRing: (ring: RunLocatorKeyRing) => void;

Source

run-id.ts

RUN_LOCATOR_MAX_BYTES

Maximum encoded locator size accepted at the jobs boundary.

Example

locator.length <= RUN_LOCATOR_MAX_BYTES;

Signature

declare const RUN_LOCATOR_MAX_BYTES: 4096;

Source

RUN_LOCATOR_VERSION

Wire format version for signed run locators.

Example

RUN_LOCATOR_VERSION === 1;

Signature

declare const RUN_LOCATOR_VERSION: 1;

Source

RunLocatorCreateOptions

Signature

declare const RunLocatorCreateOptions: RunLocatorCreateOptions;

Source

RunLocatorError

Signature

declare const RunLocatorError: typeof RunLocatorError;

Source

RunLocatorFailure (class)

Invalid signed run locator or key rotation.

Example

if (error instanceof RunLocatorFailure) console.log(error.message);

Signature

declare class RunLocatorFailure

Source

RunLocatorKeyRing

Signature

declare const RunLocatorKeyRing: RunLocatorKeyRing;

Source

RunLocatorKeyRingStore

Signature

declare const RunLocatorKeyRingStore: RunLocatorKeyRingStore;

Source

RunLocatorPayload

Signature

declare const RunLocatorPayload: RunLocatorPayload;

Source

RunLocatorVerifyOptions

Signature

declare const RunLocatorVerifyOptions: RunLocatorVerifyOptions;

Source

VerifiedRunLocator

Signature

declare const VerifiedRunLocator: VerifiedRunLocator;

Source

createRunLocator

Synchronously signs a run locator.

Throws

RunLocatorError when the payload or key ring is invalid.

Example

createRunLocator({ payload, keyRing });

Signature

declare const createRunLocator: (options: RunLocatorCreateOptions) => string;

Source

createRunLocatorEffect

Signs a run locator in Effect.

Example

Effect.runSync(createRunLocatorEffect({ payload, keyRing }));

Signature

declare const createRunLocatorEffect: (
  options: RunLocatorCreateOptions,
) => Effect.Effect<string, RunLocatorFailure, never>;

Source

decodeRunLocator

Compatibility alias for verifyRunLocator.

Example

decodeRunLocator(locator, { keyRing });

Signature

declare const decodeRunLocator: (
  locator: string,
  options: RunLocatorVerifyOptions,
) => VerifiedRunLocator;

Source

encodeRunLocator

Compatibility alias for createRunLocator.

Example

encodeRunLocator({ payload, keyRing });

Signature

declare const encodeRunLocator: (options: RunLocatorCreateOptions) => string;

Source

namespaceHash

Synchronously hashes a trusted deployment namespace.

Throws

RunLocatorError for invalid identities.

Example

namespaceHash("shop", "production", "orders");

Signature

declare const namespaceHash: (application: string, environment: string, scope: string) => string;

Source

namespaceHashEffect

Hashes a trusted deployment namespace in Effect.

Example

Effect.runSync(namespaceHashEffect("shop", "production", "orders"));

Signature

declare const namespaceHashEffect: (
  application: string,
  environment: string,
  scope: string,
) => Effect.Effect<string, RunLocatorFailure, never>;

Source

rotateRunLocatorKeys

Synchronously rotates a locator signing key.

Throws

RunLocatorError when the ring or key identifier is invalid.

Example

rotateRunLocatorKeys(ring, "v2", secret);

Signature

declare const rotateRunLocatorKeys: (
  ring: RunLocatorKeyRing,
  keyId: string,
  secret: string | Uint8Array,
) => RunLocatorKeyRing;

Source

rotateRunLocatorKeysEffect

Rotates the active locator signing key in Effect.

Example

Effect.runSync(rotateRunLocatorKeysEffect(ring, "v2", secret));

Signature

declare const rotateRunLocatorKeysEffect: (
  ring: RunLocatorKeyRing,
  keyId: string,
  secret: string | Uint8Array<ArrayBufferLike>,
) => Effect.Effect<RunLocatorKeyRing, RunLocatorFailure, never>;

Source

validateRunLocatorKeyRing

Synchronously validates a locator key ring.

Throws

RunLocatorError for invalid keys or IDs.

Example

validateRunLocatorKeyRing(ring);

Signature

declare const validateRunLocatorKeyRing: (ring: RunLocatorKeyRing) => void;

Source

validateRunLocatorKeyRingEffect

Validates a locator key ring in Effect.

Example

Effect.runSync(validateRunLocatorKeyRingEffect(ring));

Signature

declare const validateRunLocatorKeyRingEffect: (
  ring: RunLocatorKeyRing,
) => Effect.Effect<void, RunLocatorFailure, never>;

Source

verifyRunLocator

Synchronously verifies a signed run locator.

Throws

RunLocatorError when the locator is invalid or has another namespace.

Example

verifyRunLocator(locator, { keyRing });

Signature

declare const verifyRunLocator: (
  locator: string,
  options: RunLocatorVerifyOptions,
) => VerifiedRunLocator;

Source

verifyRunLocatorEffect

Verifies a run locator in Effect.

Example

Effect.runSync(verifyRunLocatorEffect(locator, { keyRing }));

Signature

declare const verifyRunLocatorEffect: (
  locator: string,
  options: RunLocatorVerifyOptions,
) => Effect.Effect<VerifiedRunLocator, RunLocatorFailure, never>;

Source

run-id.types.ts

Signed run identity and namespace fields carried by a locator.

RunLocatorCreateOptions (interface)

Options accepted for run locator create operations.

Signature

export interface RunLocatorCreateOptions {
  readonly payload: RunLocatorPayload;
  readonly keyRing: RunLocatorKeyRing;
}

Source

RunLocatorKeyRing (interface)

Signing and verification keys for run locators.

Signature

export interface RunLocatorKeyRing {
  readonly activeKeyId: string;
  readonly keys: Readonly<Record<string, string | Uint8Array>>;
}

Source

RunLocatorKeyRingStore (interface)

Store of key rings used during locator rotation.

Signature

export interface RunLocatorKeyRingStore {
  readonly load: () => RunLocatorKeyRing | Promise<RunLocatorKeyRing>;
  readonly save: (ring: RunLocatorKeyRing) => void | Promise<void>;
}

Source

RunLocatorPayload (interface)

Signed run identity and namespace fields carried by a locator.

Signature

export interface RunLocatorPayload {
  readonly application: string;
  readonly environment: string;
  readonly serviceGeneration: string;
  readonly jobId: string;
  readonly taskId: string;
  readonly taskVersion: string;
  readonly buildId: string;
  /** Accepted only while creating a locator; the clear-text scope is never encoded. */
  readonly scope?: string;
  readonly namespaceHash?: string;
  readonly schemaHash?: string;
  readonly native: { readonly kind: string; readonly value: string };
}

Source

RunLocatorVerifyOptions (interface)

Options accepted for run locator verify operations.

Signature

export interface RunLocatorVerifyOptions {
  readonly keyRing: RunLocatorKeyRing;
  readonly application?: string;
  readonly environment?: string;
  readonly scope?: string;
}

Source

VerifiedRunLocator (interface)

Decoded signed locator with trusted namespace and run identity.

Signature

export interface VerifiedRunLocator extends RunLocatorPayload {
  readonly keyId: string;
  readonly version: 1;
}

Source

runtime-context.ts

JobsRuntimeCallbackError (class)

Failure raised by a callback executed inside an ambient runtime.

Example

if (error instanceof JobsRuntimeCallbackError) console.log(error.message);

Signature

declare class JobsRuntimeCallbackError

Source

JobsRuntimeError (class)

Invalid runtime configuration or missing ambient runtime.

Example

if (error instanceof JobsRuntimeError) console.log(error.message);

Signature

declare class JobsRuntimeError

Source

currentJobsRuntime

Reads the ambient runtime synchronously.

Example

currentJobsRuntime();

Signature

declare const currentJobsRuntime: () => JobsRuntime | undefined;

Source

currentJobsRuntimeEffect

Reads the ambient runtime in Effect.

Example

Effect.runSync(currentJobsRuntimeEffect());

Signature

declare const currentJobsRuntimeEffect: () => Effect.Effect<JobsRuntime | undefined, never, never>;

Source

requireJobsRuntime

Requires an ambient runtime synchronously.

Throws

Error when no runtime is bound.

Example

requireJobsRuntime();

Signature

declare const requireJobsRuntime: () => JobsRuntime;

Source

requireJobsRuntimeEffect

Requires an ambient runtime in Effect.

Example

Effect.runSync(requireJobsRuntimeEffect());

Signature

declare const requireJobsRuntimeEffect: () => Effect.Effect<JobsRuntime, JobsRuntimeError, never>;

Source

runInJobsRuntime

Runs a callback with a runtime bound to its async context.

Throws

The original callback error, if it throws.

Example

runInJobsRuntime(runtime, () => requireJobsRuntime());

Signature

declare const runInJobsRuntime: <A>(runtime: JobsRuntime, callback: () => A) => A;

Source

runInJobsRuntimeEffect

Runs a callback with the given ambient runtime in Effect.

Example

Effect.runSync(runInJobsRuntimeEffect(runtime, () => requireJobsRuntime()));

Signature

declare const runInJobsRuntimeEffect: <A>(
  runtime: JobsRuntime,
  callback: () => A,
) => Effect.Effect<A, JobsRuntimeCallbackError, never>;

Source

runWithJobsRuntime

Alias of runInJobsRuntime.

Throws

The original callback error.

Example

runWithJobsRuntime(runtime, () => 1);

Signature

declare const runWithJobsRuntime: <A>(runtime: JobsRuntime, callback: () => A) => A;

Source

runWithJobsRuntimeEffect

Alias of runInJobsRuntimeEffect.

Example

Effect.runSync(runWithJobsRuntimeEffect(runtime, () => 1));

Signature

declare const runWithJobsRuntimeEffect: <A>(
  runtime: JobsRuntime,
  callback: () => A,
) => Effect.Effect<A, JobsRuntimeCallbackError, never>;

Source

runtime-selection-value.ts

resolveBindingValue

Selects a task’s job from the runtime manifest and validates its build binding.

Throws

TypeError for missing, ambiguous, or mismatched bindings.

Example

resolveBindingValue(task, undefined, options);

Signature

declare const resolveBindingValue: (
  task: TaskRefAny,
  selector: JobRefAny | undefined,
  options: JobsRuntimeOptions,
) => JobsRuntimeBinding;

Source

runtime-selection.ts

RuntimeBindingFailure (class)

Invalid manifest or selector resolution for a runtime binding.

Example

if (error instanceof RuntimeBindingFailure) console.log(error.message);

Signature

declare class RuntimeBindingFailure

Source

resolveBinding

Synchronous runtime binding resolver.

Throws

TypeError for ambiguous or unknown jobs.

Example

resolveBinding(task, undefined, options);

Signature

declare const resolveBinding: (
  task: TaskRefAny,
  selector: JobRefAny | undefined,
  options: JobsRuntimeOptions,
) => JobsRuntimeBinding;

Source

resolveBindingEffect

Resolves a task’s runtime binding in Effect.

Example

Effect.runSync(resolveBindingEffect(task, undefined, options));

Signature

declare const resolveBindingEffect: (
  task: TaskRefAny,
  selector: JobRefAny | undefined,
  options: JobsRuntimeOptions,
) => Effect.Effect<JobsRuntimeBinding, RuntimeBindingFailure, never>;

Source

runtime.ts

JobsManifestLike

Signature

declare const JobsManifestLike: JobsManifestLike;

Source

JobsOperationOptions

Signature

declare const JobsOperationOptions: JobsOperationOptions;

Source

JobsRuntime

Signature

declare const JobsRuntime: JobsRuntime;

Source

JobsRuntimeBinding

Signature

declare const JobsRuntimeBinding: JobsRuntimeBinding;

Source

JobsRuntimeCallbackError

Signature

declare const JobsRuntimeCallbackError: typeof JobsRuntimeCallbackError;

Source

JobsRuntimeError

Signature

declare const JobsRuntimeError: typeof JobsRuntimeError;

Source

JobsRuntimeOptions

Signature

declare const JobsRuntimeOptions: JobsRuntimeOptions;

Source

NativeLocator

Signature

declare const NativeLocator: string;

Source

TaskDescriptorAny

Signature

declare const TaskDescriptorAny: TaskDescriptorAny;

Source

createJobsRuntime

Synchronously creates a validated jobs runtime.

Throws

TypeError or JobsCapabilityError for invalid configuration.

Example

createJobsRuntime({ adapter });

Signature

declare const createJobsRuntime: (options: JobsRuntimeOptions) => JobsRuntime;

Source

createJobsRuntimeEffect

Creates a validated jobs runtime in Effect.

Example

Effect.runSync(createJobsRuntimeEffect({ adapter }));

Signature

declare const createJobsRuntimeEffect: (
  options: JobsRuntimeOptions,
) => Effect.Effect<
  JobsRuntime,
  JobsCapabilityFailure | JobsAdapterValidationError | JobsRuntimeError,
  never
>;

Source

currentJobsRuntime

Signature

declare const currentJobsRuntime: () => JobsRuntime | undefined;

Source

currentJobsRuntimeEffect

Signature

declare const currentJobsRuntimeEffect: () => Effect.Effect<JobsRuntime | undefined, never, never>;

Source

requireJobsRuntime

Signature

declare const requireJobsRuntime: () => JobsRuntime;

Source

requireJobsRuntimeEffect

Signature

declare const requireJobsRuntimeEffect: () => Effect.Effect<JobsRuntime, JobsRuntimeError, never>;

Source

runInJobsRuntime

Signature

declare const runInJobsRuntime: <A>(runtime: JobsRuntime, callback: () => A) => A;

Source

runInJobsRuntimeEffect

Signature

declare const runInJobsRuntimeEffect: <A>(
  runtime: JobsRuntime,
  callback: () => A,
) => Effect.Effect<A, JobsRuntimeCallbackError, never>;

Source

runWithJobsRuntime

Signature

declare const runWithJobsRuntime: <A>(runtime: JobsRuntime, callback: () => A) => A;

Source

runWithJobsRuntimeEffect

Signature

declare const runWithJobsRuntimeEffect: <A>(
  runtime: JobsRuntime,
  callback: () => A,
) => Effect.Effect<A, JobsRuntimeCallbackError, never>;

Source

runtime.types.ts

JobsManifestLike (interface)

Minimal manifest fields used to resolve authored jobs and tasks.

Signature

export interface JobsManifestLike {
  readonly protocol?: string;
  readonly version?: number;
  readonly app?: string;
  readonly environment?: string;
  readonly jobsProtocolVersion?: number;
  readonly tasks?: readonly {
    readonly id: string;
    readonly version?: string;
    readonly buildId?: string;
    readonly schemaHashes?: unknown;
    readonly policy?: unknown;
  }[];
  readonly jobs?: readonly {
    readonly id: string;
    readonly name: string;
    readonly taskId: string;
    readonly taskVersion?: string;
    readonly buildId?: string;
    readonly profile?: string;
    readonly serviceGeneration?: string;
    readonly default?: boolean;
  }[];
}

Source

JobsOperationOptions (type alias)

Caller signal and trusted metadata passed to a native jobs operation.

Signature

type JobsOperationOptions = Pick<OperationContext, "signal"> &
  Partial<
    Pick<
      OperationContext,
      | "scope"
      | "operationId"
      | "deadlineMs"
      | "correlationId"
      | "parentRunId"
      | "propagation"
      | "acceptanceIdentity"
      | "occurrenceIdentity"
      | "inputSchemaHash"
      | "retryOfRunId"
    >
  >;

Source

JobsRuntime (interface)

Validated runtime bindings and provider access for job operations.

Signature

export interface JobsRuntime {
  readonly adapter: JobsAdapterRuntime;
  readonly capabilities: JobsCapabilityReport;
  readonly application: string;
  readonly environment: string;
  readonly scope: string;
  readonly service: string;
  readonly serviceGeneration: string;
  readonly manifest?: JobsManifestLike;
  readonly jobs?: readonly JobDescriptorAny[];
  readonly taskExecutor?: TaskExecutor;
  readonly tasks?: readonly TaskDescriptorAny[];
  readonly resolveBinding: (task: TaskRefAny, selector?: JobRefAny) => JobsRuntimeBinding;
  readonly operationContext: (options: JobsOperationOptions) => OperationContext;
  readonly close: () => Promise<void>;
}

Source

JobsRuntimeBinding (interface)

Resolved task, job, service, and build identity pinned for one run.

Signature

export interface JobsRuntimeBinding {
  readonly taskId: string;
  readonly taskVersion: string;
  readonly jobId: string;
  readonly name: string;
  readonly profile: string;
  readonly service: string;
  readonly serviceGeneration: string;
  readonly buildId: string;
  readonly inputSchemaHash?: string;
  readonly scope?: string;
  readonly policy?: unknown;
}

Source

JobsRuntimeOptions (interface)

Provider, manifest, and authored descriptors used to create a jobs runtime.

Signature

export interface JobsRuntimeOptions {
  readonly adapter?: unknown;
  readonly provider?: unknown;
  readonly providerHandle?: { readonly value: unknown };
  readonly capabilities?: JobsCapabilityReport;
  readonly application?: string;
  readonly environment?: string;
  readonly scope?: string;
  readonly service?: string;
  readonly serviceGeneration?: string;
  readonly manifest?: JobsManifestLike;
  readonly jobs?: readonly JobDescriptorAny[];
  readonly taskExecutor?: TaskExecutor;
  readonly tasks?: readonly TaskDescriptorAny[];
}

Source

schedule-controls-operations.ts

ScheduleOperationFailure (class)

Expected native schedule operation failure with its compatibility cause.

Example

new ScheduleOperationFailure({ cause: new Error("provider rejected") });

Signature

declare class ScheduleOperationFailure

Source

getScheduleOperationEffect

Reads one bounded native schedule in Effect.

Example

Effect.runPromise(getScheduleOperationEffect(runtime, schedule, "hourly"));

Signature

declare const getScheduleOperationEffect: (
  runtime: JobsRuntime,
  schedule: NativeScheduleOperations,
  id: string,
  signal?: AbortSignal | undefined,
) => Effect.Effect<
  ScheduleReadReceipt<ScheduleDefinition<unknown>>,
  ScheduleOperationFailure,
  never
>;

Source

listSchedulesOperationEffect

Lists bounded native schedules in Effect.

Example

Effect.runPromise(listSchedulesOperationEffect(runtime, schedule));

Signature

declare const listSchedulesOperationEffect: (
  runtime: JobsRuntime,
  schedule: NativeScheduleOperations,
  options?: ScheduleListOptions | undefined,
) => Effect.Effect<
  ScheduleReadReceipt<ScheduleDefinition<unknown>>,
  ScheduleOperationFailure,
  never
>;

Source

writeScheduleOperationEffect

Validates and performs one idempotent native schedule write in Effect.

Example

Effect.runPromise(writeScheduleOperationEffect(runtime, schedule, definition, options, "upsert"));

Signature

declare const writeScheduleOperationEffect: (
  runtime: JobsRuntime,
  schedule: NativeScheduleOperations,
  value: string | ScheduleDefinition,
  options: ScheduleWriteOptions,
  operation: "delete" | "upsert" | "pause" | "resume",
) => Effect.Effect<Readonly<ScheduleWriteReceipt>, ScheduleOperationFailure, never>;

Source

schedule-controls-value.ts

boundedCursor

Validates a native schedule pagination cursor byte limit.

Throws

RangeError when the cursor exceeds 4096 UTF-8 bytes.

Example

boundedCursor("next-page");

Signature

declare const boundedCursor: (value: string) => string;

Source

boundedId

Validates schedule and operation identifiers against the byte limit.

Throws

TypeError for missing or oversized identifiers.

Example

boundedId("hourly");

Signature

declare const boundedId: (value: string) => string;

Source

idleSignal

Creates a nonaborted signal when a caller did not supply one.

Example

idleSignal().aborted;

Signature

declare const idleSignal: () => AbortSignal;

Source

isOutcome

Checks the known native schedule write outcomes.

Example

isOutcome("paused");

Signature

declare const isOutcome: (value: unknown) => boolean;

Source

isRecord

Tests for a nonarray native response record.

Example

isRecord({ outcome: "available" });

Signature

declare const isRecord: (value: unknown) => value is Record<string, unknown>;

Source

isUnknown

Recognizes an uncertain native schedule write for recovery.

Example

isUnknown({ operationId: "op", outcome: "unknown" });

Signature

declare const isUnknown: (value: unknown) => value is UnknownControlOutcome;

Source

normalizeRead

Freezes a valid native schedule read receipt.

Throws

TypeError for an unrecognized outcome.

Example

normalizeRead({ outcome: "unavailable" });

Signature

declare const normalizeRead: (value: unknown) => ScheduleReadReceipt;

Source

schedule-controls.ts

JobScheduleControlFailure (class)

A native schedule operation failed or returned an invalid receipt.

Example

if (error instanceof JobScheduleControlFailure) console.log(error.message);

Signature

declare class JobScheduleControlFailure

Source

createScheduleControls

Synchronous schedule facade factory.

Throws

JobsCapabilityError when native schedules are unavailable.

Example

createScheduleControls(runtime);

Signature

declare const createScheduleControls: (runtime?: JobsRuntime) => JobScheduleClient;

Source

createScheduleControlsEffect

Creates a schedule facade in Effect.

Example

Effect.runSync(createScheduleControlsEffect(runtime));

Signature

declare const createScheduleControlsEffect: (
  runtime: JobsRuntime,
) => Effect.Effect<
  JobScheduleClient<ScheduleDefinition<unknown>>,
  JobScheduleControlFailure,
  never
>;

Source

getScheduleEffect

Reads a single native schedule in Effect.

Example

Effect.runPromise(getScheduleEffect(runtime, schedule, "hourly"));

Signature

declare const getScheduleEffect: (
  runtime: JobsRuntime,
  schedule: NativeScheduleOperations,
  id: string,
  signal?: AbortSignal | undefined,
) => Effect.Effect<
  ScheduleReadReceipt<ScheduleDefinition<unknown>>,
  JobScheduleControlFailure,
  never
>;

Source

listSchedulesEffect

Lists native schedules in Effect.

Example

Effect.runPromise(listSchedulesEffect(runtime, schedule));

Signature

declare const listSchedulesEffect: (
  runtime: JobsRuntime,
  schedule: NativeScheduleOperations,
  options?: ScheduleListOptions | undefined,
) => Effect.Effect<
  ScheduleReadReceipt<ScheduleDefinition<unknown>>,
  JobScheduleControlFailure,
  never
>;

Source

writeScheduleEffect

Writes or changes a native schedule in Effect.

Example

Effect.runPromise(writeScheduleEffect(runtime, schedule, definition, options, "upsert"));

Signature

declare const writeScheduleEffect: (
  runtime: JobsRuntime,
  schedule: NativeScheduleOperations,
  value: string | ScheduleDefinition,
  options: ScheduleWriteOptions,
  operation: "delete" | "upsert" | "pause" | "resume",
) => Effect.Effect<Readonly<ScheduleWriteReceipt>, JobScheduleControlFailure, never>;

Source

schedule-reconciliation-identity.ts

scheduleOperationId

Synchronous idempotent native operation identity.

Example

scheduleOperationId(options, "hourly");

Signature

declare const scheduleOperationId: (
  options: Pick<ScheduleReconciliationOptions, "context" | "jobId" | "buildId">,
  scheduleId: string,
) => string;

Source

scheduleOperationIdEffect

Builds an idempotent native operation identity in Effect.

Example

Effect.runSync(scheduleOperationIdEffect(options, "hourly"));

Signature

declare const scheduleOperationIdEffect: (
  options: Pick<ScheduleReconciliationOptions, "jobId" | "context" | "buildId">,
  scheduleId: string,
) => Effect.Effect<string, JobIdentityError, never>;

Source

scheduleOwner

Synchronous stable schedule owner identity.

Example

scheduleOwner({ context, jobId: "send" });

Signature

declare const scheduleOwner: (
  options: Pick<ScheduleReconciliationOptions, "context" | "jobId">,
) => string;

Source

scheduleOwnerEffect

Builds a stable owner identity in Effect.

Example

Effect.runSync(scheduleOwnerEffect({ context, jobId: "send" }));

Signature

declare const scheduleOwnerEffect: (
  options: Pick<ScheduleReconciliationOptions, "jobId" | "context">,
) => Effect.Effect<string, JobIdentityError, never>;

Source

schedule-reconciliation-service.ts

NativeScheduleService (class)

Injectable native provider for schedule reconciliation.

Example

const service = yield * NativeScheduleService;

Signature

declare class NativeScheduleService

Source

ScheduleReconciliationFailure (class)

Expected native schedule reconciliation failure with original cause.

Example

if (error instanceof ScheduleReconciliationFailure) console.log(error.message);

Signature

declare class ScheduleReconciliationFailure

Source

nativeScheduleLayer

Provides a native schedule implementation to the Effect reconciler.

Example

nativeScheduleLayer(adapter.nativeSchedules);

Signature

declare const nativeScheduleLayer: (
  native: NativeScheduleOperations,
) => Layer.Layer<NativeScheduleService, never, never>;

Source

schedule-reconciliation-support.ts

isRecord

Tests for a nonarray provider record.

Example

isRecord({ id: "hourly" });

Signature

declare const isRecord: (value: unknown) => value is Record<string, any>;

Source

isScheduleRecord

Recognizes a native schedule record with an identifier.

Example

isScheduleRecord({ id: "hourly" });

Signature

declare const isScheduleRecord: (value: unknown) => value is NativeOwnedScheduleRecord;

Source

nativeDefinition

Adds ownership and canonical input metadata to a desired native schedule.

Throws

TypeError for non-JSON schedule input.

Example

nativeDefinition(schedule, options, "owner-1");

Signature

declare const nativeDefinition: (
  schedule: ScheduleReconciliationOptions["desired"][number],
  options: Omit<ScheduleReconciliationOptions, "native">,
  owner: string,
) => Readonly<
  | {
      metadata: Readonly<{
        buildId: string;
        serviceGeneration: string;
        canonicalInput: string;
        taskVersion?: string;
        taskId?: string;
        owner: string;
        application: string;
        environment: string;
        service: string;
        scope: string;
        jobId: string;
      }>;
      id: string;
      input: unknown;
      overlap?: ScheduleOverlap;
      misfire?: ScheduleMisfire;
      cron: string;
      timezone: string;
      every?: never;
    }
  | {
      metadata: Readonly<{
        buildId: string;
        serviceGeneration: string;
        canonicalInput: string;
        taskVersion?: string;
        taskId?: string;
        owner: string;
        application: string;
        environment: string;
        service: string;
        scope: string;
        jobId: string;
      }>;
      id: string;
      input: unknown;
      overlap?: ScheduleOverlap;
      misfire?: ScheduleMisfire;
      every: DurationInput;
      cron?: never;
      timezone?: never;
    }
>;

Source

writeContext

Binds one stable operation identity to a native schedule write.

Example

writeContext(context, "schedule-upsert-1");

Signature

declare const writeContext: (
  context: OperationContext,
  operationIdValue: string,
) => OperationContext;

Source

writeWithRecovery

Promise compatibility native write retry.

Throws

Original terminal write error or unknown outcome error.

Example

await writeWithRecovery(() => native.upsert(value, context), context);

Signature

declare const writeWithRecovery: (
  write: () => Promise<unknown>,
  context: OperationContext,
) => Promise<unknown>;

Source

writeWithRecoveryEffect

Retries an ambiguous native write once in Effect.

Example

Effect.runPromise(writeWithRecoveryEffect(() => native.upsert(value, context), context));

Signature

declare const writeWithRecoveryEffect: (
  write: () => Promise<unknown>,
  context: OperationContext,
) => Effect.Effect<unknown, ScheduleReconciliationFailure, never>;

Source

schedule-reconciliation.ts

NativeOwnedScheduleRecord

Signature

declare const NativeOwnedScheduleRecord: NativeOwnedScheduleRecord;

Source

NativeScheduleService

Signature

declare const NativeScheduleService: typeof NativeScheduleService;

Source

ScheduleReconciliationFailure

Signature

declare const ScheduleReconciliationFailure: typeof ScheduleReconciliationFailure;

Source

ScheduleReconciliationOptions

Signature

declare const ScheduleReconciliationOptions: ScheduleReconciliationOptions;

Source

ScheduleReconciliationResult

Signature

declare const ScheduleReconciliationResult: ScheduleReconciliationResult;

Source

nativeScheduleLayer

Signature

declare const nativeScheduleLayer: (
  native: NativeScheduleOperations,
) => Layer<NativeScheduleService, never, never>;

Source

reconcileNativeSchedules

Promise compatibility reconciler.

Throws

The original native, validation, or ownership error.

Example

await reconcileNativeSchedules(options);

Signature

declare const reconcileNativeSchedules: (
  options: ScheduleReconciliationOptions,
) => Promise<ScheduleReconciliationResult>;

Source

reconcileNativeSchedulesEffect

Reconciles owned schedules with ordered native writes in Effect.

Example

Effect.runPromise(
  Effect.provide(reconcileNativeSchedulesEffect(options), nativeScheduleLayer(native)),
);

Signature

declare const reconcileNativeSchedulesEffect: (
  options: Omit<ScheduleReconciliationOptions, "native">,
) => Effect.Effect<
  Readonly<{ upserted: Array<string>; deleted: Array<string>; preserved: Array<string> }>,
  ScheduleReconciliationFailure,
  NativeScheduleService
>;

Source

scheduleOperationId

Signature

declare const scheduleOperationId: (
  options: Pick<ScheduleReconciliationOptions, "context" | "jobId" | "buildId">,
  scheduleId: string,
) => string;

Source

scheduleOperationIdEffect

Signature

declare const scheduleOperationIdEffect: (
  options: Pick<ScheduleReconciliationOptions, "jobId" | "context" | "buildId">,
  scheduleId: string,
) => Effect.Effect<string, JobIdentityError, never>;

Source

scheduleOwner

Signature

declare const scheduleOwner: (
  options: Pick<ScheduleReconciliationOptions, "context" | "jobId">,
) => string;

Source

scheduleOwnerEffect

Signature

declare const scheduleOwnerEffect: (
  options: Pick<ScheduleReconciliationOptions, "jobId" | "context">,
) => Effect.Effect<string, JobIdentityError, never>;

Source

schedule-reconciliation.types.ts

NativeOwnedScheduleRecord (interface)

Native schedule visible to reconciliation, including ownership metadata.

Signature

export interface NativeOwnedScheduleRecord {
  readonly id: string;
  readonly state?: "active" | "paused" | "missing" | "unknown";
  readonly definition?: ScheduleDefinition;
  readonly metadata?: Readonly<Record<string, unknown>>;
}

Source

ScheduleReconciliationOptions (interface)

Existing Promise API options, including the native provider.

Signature

export interface ScheduleReconciliationOptions {
  readonly native: NativeScheduleOperations;
  readonly desired: readonly ScheduleDefinition[];
  readonly existing?: readonly NativeOwnedScheduleRecord[];
  readonly context: OperationContext;
  readonly jobId: string;
  readonly taskId?: string;
  readonly taskVersion?: string;
  readonly buildId: string;
  readonly workerReady?: (() => Promise<void>) | undefined;
}

Source

ScheduleReconciliationResult (interface)

Ordered changes made by a reconciliation pass.

Signature

export interface ScheduleReconciliationResult {
  readonly upserted: readonly string[];
  readonly deleted: readonly string[];
  readonly preserved: readonly string[];
}

Source

schedule-validation.ts

ScheduleValidationError (class)

Invalid authored schedule definitions.

Example

if (error instanceof ScheduleValidationError) console.log(error.message);

Signature

declare class ScheduleValidationError

Source

ScheduleValidationOptions

Signature

declare const ScheduleValidationOptions: ScheduleValidationOptions;

Source

copySchedules

Synchronous schedule validation adapter.

Throws

TypeError when a schedule is invalid.

Example

copySchedules([{ id: "hourly", every: "1 hour", input: null }]);

Signature

declare const copySchedules: <CanonicalInput>(
  value: unknown,
  options?: ScheduleValidationOptions,
) => readonly ScheduleDefinition<CanonicalInput>[] | undefined;

Source

copySchedulesEffect

Copies and validates authored schedules in Effect.

Example

Effect.runSync(copySchedulesEffect([{ id: "hourly", every: "1 hour", input: null }]));

Signature

declare const copySchedulesEffect: <CanonicalInput>(
  value: unknown,
  options?: ScheduleValidationOptions | undefined,
) => Effect.Effect<
  ReadonlyArray<ScheduleDefinition<CanonicalInput>> | undefined,
  ScheduleValidationError,
  never
>;

Source

schedule-validation.types.ts

ScheduleValidationOptions (interface)

Schemas used to validate and canonicalize authored schedule input.

Signature

export interface ScheduleValidationOptions {
  readonly callerSchema?: StandardSchemaV1;
  readonly canonicalSchema?: StandardSchemaV1;
}

Source

schedule.types.ts

JobScheduleClient (interface)

Read and write operations available for a job’s schedules.

Signature

export interface JobScheduleClient<Definition = ScheduleDefinition> {
  readonly list: (options?: ScheduleListOptions) => Promise<ScheduleReadReceipt<Definition>>;
  readonly get: (
    id: string,
    options?: { readonly signal?: AbortSignal },
  ) => Promise<ScheduleReadReceipt<Definition>>;
  readonly upsert: (
    definition: Definition,
    options: ScheduleWriteOptions,
  ) => Promise<ScheduleWriteReceipt<Definition>>;
  readonly pause: (
    id: string,
    options: ScheduleWriteOptions,
  ) => Promise<ScheduleWriteReceipt<Definition>>;
  readonly resume: (
    id: string,
    options: ScheduleWriteOptions,
  ) => Promise<ScheduleWriteReceipt<Definition>>;
  readonly delete: (
    id: string,
    options: ScheduleWriteOptions,
  ) => Promise<ScheduleWriteReceipt<Definition>>;
}

Source

ScheduleDefinition (type alias)

Authored schedule target, timing, and admission policy.

Signature

type ScheduleDefinition<Input = unknown> = {
  readonly id: string;
  readonly input: Input;
  readonly overlap?: ScheduleOverlap;
  readonly misfire?: ScheduleMisfire;
} & (
  | { readonly cron: string; readonly timezone: string; readonly every?: never }
  | { readonly every: DurationInput; readonly cron?: never; readonly timezone?: never }
);

Source

ScheduleListOptions (interface)

Options accepted for schedule list operations.

Signature

export interface ScheduleListOptions {
  readonly limit?: number;
  readonly cursor?: string;
  readonly signal?: AbortSignal;
}

Source

ScheduleMisfire (type alias)

How missed occurrences are handled after downtime.

Signature

type ScheduleMisfire = "skip" | "latest" | "all";

Source

ScheduleOverlap (type alias)

Whether simultaneous occurrences are skipped or allowed.

Signature

type ScheduleOverlap = "allow" | "skip";

Source

ScheduleReadReceipt (interface)

Receipt returned after a schedule read operation.

Signature

export interface ScheduleReadReceipt<Definition = ScheduleDefinition> {
  readonly outcome: "available" | "unavailable";
  readonly schedule?: ScheduleRecord<Definition>;
  readonly schedules?: readonly ScheduleRecord<Definition>[];
  readonly nextCursor?: string;
  readonly hasMore?: boolean;
  readonly reason?: string;
}

Source

ScheduleRecord (interface)

Provider read model for a persisted schedule.

Signature

export interface ScheduleRecord<Definition = ScheduleDefinition> {
  readonly id: string;
  readonly jobId: string;
  readonly state: "active" | "paused" | "missing" | "unknown";
  readonly definition: Definition;
  readonly observedAt?: string;
}

Source

ScheduleWriteOptions (interface)

Options accepted for schedule write operations.

Signature

export interface ScheduleWriteOptions {
  readonly operationId: string;
  readonly signal?: AbortSignal;
}

Source

ScheduleWriteOutcome (type alias)

Result category for a native schedule mutation.

Signature

type ScheduleWriteOutcome =
  "created" | "updated" | "paused" | "resumed" | "deleted" | "requested" | "unsupported";

Source

ScheduleWriteReceipt (type alias)

Receipt returned after a schedule write operation.

Signature

type ScheduleWriteReceipt<Definition = ScheduleDefinition> =
  | {
      readonly operationId: string;
      readonly scheduleId: string;
      readonly outcome: ScheduleWriteOutcome;
      readonly schedule?: ScheduleRecord<Definition>;
    }
  | (JobUnknownOutcome & { readonly scheduleId: string });

Source

server-manifest.ts

JobsManifestReader (class)

Substitutable manifest file reader.

Example

Effect.provide(readJobsManifestEffect(config), JobsManifestReaderLive);

Signature

declare class JobsManifestReader

Source

JobsManifestReaderLive

Live UTF-8 reader backed by Node’s file system.

Example

Effect.provide(readJobsManifestEffect(config), JobsManifestReaderLive);

Signature

declare const JobsManifestReaderLive: Layer.Layer<JobsManifestReader, never, never>;

Source

JobsServerError (class)

A typed file, manifest, runtime, or callback failure.

Example

new JobsServerError({ operation: "readManifest", cause: new Error("missing") });

Signature

declare class JobsServerError

Source

readJobsManifestEffect

Reads and validates the optional generated jobs manifest.

Example

Effect.provide(readJobsManifestEffect({ projectRoot: "." }), JobsManifestReaderLive);

Signature

declare const readJobsManifestEffect: (
  config: RunWithJobsConfig,
) => Effect.Effect<Readonly<JobsManifestLike> | undefined, JobsServerError, JobsManifestReader>;

Source

server.ts

JobsManifestReader

Signature

declare const JobsManifestReader: typeof JobsManifestReader;

Source

JobsManifestReaderLive

Signature

declare const JobsManifestReaderLive: Layer<JobsManifestReader, never, never>;

Source

JobsServerError

Signature

declare const JobsServerError: typeof JobsServerError;

Source

RunResultOptions

Signature

declare const RunResultOptions: RunResultOptions;

Source

RunWithJobsConfig

Signature

declare const RunWithJobsConfig: RunWithJobsConfig;

Source

ServerTriggerOptions

Signature

declare const ServerTriggerOptions: ServerTriggerOptions;

Source

TriggerOptions

Signature

declare const TriggerOptions: TriggerOptions;

Source

runWithJobs

Promise compatibility adapter for server invocation.

Throws

The original manifest, runtime, callback, or close error.

Example

await runWithJobs({ projectRoot: "." }, () => "ok");

Signature

declare const runWithJobs: <A>(
  config: RunWithJobsConfig,
  callback: () => A | PromiseLike<A>,
) => Promise<Awaited<A>>;

Source

runWithJobsEffect

Runs a server callback inside an owned or borrowed jobs runtime. An owned runtime closes after success, typed failure, or interruption.

Example

Effect.provide(
  runWithJobsEffect({ projectRoot: "." }, () => "ok"),
  JobsManifestReaderLive,
);

Signature

declare const runWithJobsEffect: <A>(
  config: RunWithJobsConfig,
  callback: () => A | PromiseLike<A>,
) => Effect.Effect<A, JobsServerError, JobsManifestReader>;

Source

server.types.ts

JobsManifestLike

Signature

declare const JobsManifestLike: JobsManifestLike;

Source

JobsManifestReaderService (interface)

Injectable file reader for manifest loading.

Example

const reader: JobsManifestReaderService = { read: () => Effect.succeed("{}") };

Signature

export interface JobsManifestReaderService {
  /** Reads UTF-8 manifest data.
   * @param path - Resolved manifest path.
   * @returns File contents or JobsServerError.
   * @example reader.read("/project/.relkit/generated/jobs.manifest.json");
   */
  readonly read: (path: string) => Effect.Effect<string, JobsServerError>;
}

Source

JobsRuntimeOptions

Signature

declare const JobsRuntimeOptions: JobsRuntimeOptions;

Source

RunWithJobsConfig (interface)

Options for a server invocation with a jobs runtime. The caller retains ownership when runtime is supplied.

Example

const config: RunWithJobsConfig = { projectRoot: process.cwd() };

Signature

export interface RunWithJobsConfig {
  readonly projectRoot: string;
  readonly environment?: string;
  readonly manifestPath?: string;
  readonly runtime?: JobsRuntime;
  readonly adapter?: unknown;
  readonly provider?: unknown;
  readonly providerHandle?: { readonly value: unknown };
  readonly application?: string;
  readonly scope?: string;
  readonly service?: string;
  readonly serviceGeneration?: string;
  readonly capabilities?: JobsRuntimeOptions["capabilities"];
  readonly jobs?: JobsRuntimeOptions["jobs"];
  readonly taskExecutor?: JobsRuntimeOptions["taskExecutor"];
}

Source

service-options-validation.ts

JobsServiceOptionsError (class)

Invalid authored jobs service options.

Example

if (error instanceof JobsServiceOptionsError) console.log(error.message);

Signature

declare class JobsServiceOptionsError

Source

validateJobsServiceOptions

Synchronously validates jobs service options.

Throws

TypeError when any option is invalid.

Example

validateJobsServiceOptions({});

Signature

declare const validateJobsServiceOptions: (value: JobsServiceOptions | undefined) => void;

Source

validateJobsServiceOptionsEffect

Validates jobs service limits, durations, and worker classes in Effect.

Example

Effect.runSync(validateJobsServiceOptionsEffect({}));

Signature

declare const validateJobsServiceOptionsEffect: (
  value: JobsServiceOptions | undefined,
) => Effect.Effect<void, JobsServiceOptionsError, never>;

Source

service-options.ts

JobsServiceBehavior

Signature

declare const JobsServiceBehavior: Readonly<Record<string, JsonValue>>;

Source

JobsServiceOptionName

Signature

declare const JobsServiceOptionName: JobsServiceOptionName;

Source

JobsServiceOptions

Signature

declare const JobsServiceOptions: JobsServiceOptions;

Source

JobsServiceOptionsError

Signature

declare const JobsServiceOptionsError: typeof JobsServiceOptionsError;

Source

assertSupportedJobsServiceOptions

Synchronously checks a provider’s supported option names.

Throws

Error with the unsupported option name.

Example

assertSupportedJobsServiceOptions({}, []);

Signature

declare const assertSupportedJobsServiceOptions: (
  value: JobsServiceOptions,
  supported: readonly JobsServiceOptionName[],
) => void;

Source

assertSupportedJobsServiceOptionsEffect

Checks a provider’s supported service option names in Effect.

Example

Effect.runSync(assertSupportedJobsServiceOptionsEffect({}, []));

Signature

declare const assertSupportedJobsServiceOptionsEffect: (
  value: JobsServiceOptions,
  supported: ReadonlyArray<JobsServiceOptionName>,
) => Effect.Effect<undefined, JobsServiceOptionsError, never>;

Source

deserializeJobsServiceOptions

Synchronously reads common options from stored service behavior.

Throws

TypeError when the record or an option is invalid.

Example

deserializeJobsServiceOptions({});

Signature

declare const deserializeJobsServiceOptions: (value: unknown) => JobsServiceOptions;

Source

deserializeJobsServiceOptionsEffect

Parses common options from a stored service behavior record.

Example

Effect.runSync(deserializeJobsServiceOptionsEffect({}));

Signature

declare const deserializeJobsServiceOptionsEffect: (
  value: unknown,
) => Effect.Effect<Readonly<JobsServiceOptions>, JobsServiceOptionsError, never>;

Source

serializeJobsServiceOptions

Synchronously serializes service options.

Throws

TypeError when a field is not JSON.

Example

serializeJobsServiceOptions({}, undefined);

Signature

declare const serializeJobsServiceOptions: (
  value: JobsServiceOptions | undefined,
  native: JsonValue | undefined,
) => Readonly<Record<string, JsonValue>>;

Source

serializeJobsServiceOptionsEffect

Serializes validated service options into a provider neutral record.

Example

Effect.runSync(serializeJobsServiceOptionsEffect({}, undefined));

Signature

declare const serializeJobsServiceOptionsEffect: (
  value: JobsServiceOptions | undefined,
  native: JsonValue | undefined,
) => Effect.Effect<Readonly<Record<string, JsonValue>>, JobsServiceOptionsError, never>;

Source

validateJobsServiceOptions

Signature

declare const validateJobsServiceOptions: (value: JobsServiceOptions | undefined) => void;

Source

validateJobsServiceOptionsEffect

Signature

declare const validateJobsServiceOptionsEffect: (
  value: JobsServiceOptions | undefined,
) => Effect.Effect<void, JobsServiceOptionsError, never>;

Source

service-options.types.ts

JobsServiceBehavior (type alias)

JSON configuration passed to a jobs service provider.

Signature

type JobsServiceBehavior = Readonly<Record<string, JsonValue>>;

Source

JobsServiceOptionName (type alias)

Recognized top-level jobs service configuration keys.

Signature

type JobsServiceOptionName =
  "limits" | "workers" | "observation" | "maxElapsed" | "hookTimeout" | "shutdownGrace";

Source

JobsServiceOptions (interface)

Options accepted for jobs service operations.

Signature

export interface JobsServiceOptions {
  readonly limits?: {
    readonly inputBytes?: number;
    readonly outputBytes?: number;
    readonly progressItemBytes?: number;
    readonly streamItemBytes?: number;
  };
  readonly workers?: {
    readonly classes: readonly {
      readonly id: string;
      readonly cpu: number;
      readonly memory: MemoryInput;
      readonly nativeClass?: string;
    }[];
  };
  readonly observation?: {
    readonly pollInterval?: DurationInput;
    readonly readTimeout?: DurationInput;
  };
  readonly maxElapsed?: DurationInput;
  readonly hookTimeout?: DurationInput;
  readonly shutdownGrace?: DurationInput;
}

Source

submission-admission.ts

AdmissionIdentity (class)

Substitutable operation ID generator for admitted submissions.

Example

const service = yield * AdmissionIdentity;

Signature

declare class AdmissionIdentity

Source

admissionIdentityLayer

Provides deterministic admission operation IDs.

Example

admissionIdentityLayer(() => "operation-1");

Signature

declare const admissionIdentityLayer: (
  next: () => string,
) => Layer.Layer<AdmissionIdentity, never, never>;

Source

boundedKey

Signature

declare const boundedKey: (value: string) => string;

Source

prepareAdmission

Promise compatibility admission preparation.

Throws

Original binding, validation, or hashing error.

Example

await prepareAdmission(runtime, task, wire, copied);

Signature

declare const prepareAdmission: (
  runtime: JobsRuntime,
  task: TaskDescriptorAny,
  wire: JobWireEnvelope,
  copied: ReturnType<typeof copyTriggerOptions>,
  job?: JobDescriptorAny,
) => Promise<SubmissionAdmission>;

Source

prepareAdmissionEffect

Prepares binding, identity, scheduling, and input hash in Effect.

Example

Effect.runPromise(prepareAdmissionEffect(runtime, task, wire, copied));

Signature

declare const prepareAdmissionEffect: (
  runtime: JobsRuntime,
  task: TaskDescriptorAny,
  wire: JobWireEnvelope,
  copied: CopiedTriggerOptions,
  job?: JobDescriptorAny | undefined,
) => Effect.Effect<
  Readonly<{
    binding: JobsRuntimeBinding;
    input: JsonValue;
    canonicalInput: JsonValue | undefined;
    inputHash: string;
    metadata: TaskSubmissionMetadata;
    job?: JobDescriptorAny;
    task: TaskDescriptorAny;
  }>,
  JobSubmissionPipelineFailure,
  never
>;

Source

submission-canonical.ts

submitCanonicalTask

Promise compatibility adapter for canonical submission.

Throws

The original validation, cancellation, or provider error.

Example

await submitCanonicalTask(runtime, task, options);

Signature

declare const submitCanonicalTask: (
  runtime: JobsRuntime,
  task: TaskDescriptorAny,
  options: CanonicalTaskSubmissionOptions,
) => Promise<import("@relkit/contracts/jobs").RunHandle>;

Source

submitCanonicalTaskEffect

Submits an already canonical task input in Effect.

Example

Effect.runPromise(submitCanonicalTaskEffect(runtime, task, options));

Signature

declare const submitCanonicalTaskEffect: (
  runtime: JobsRuntime,
  task: TaskDescriptorAny,
  options: CanonicalTaskSubmissionOptions,
) => Effect.Effect<RunHandle, JobSubmissionPipelineFailure, never>;

Source

submission-errors.ts

JobReceiptError (class)

A native accepted receipt failed durable identity validation.

Example

new JobReceiptError("Receipt is missing run ID");

Signature

declare class JobReceiptError {
  constructor(message: string);
}

Source

code (property)

Signature

readonly code: "RELKIT_JOB_RECEIPT_INVALID"

Source

JobSubmissionCancelledError (class)

Caller cancellation happened before native acceptance began.

Example

new JobSubmissionCancelledError();

Signature

declare class JobSubmissionCancelledError {
  constructor();
}

Source

code (property)

Signature

readonly code: "RELKIT_JOB_SUBMISSION_CANCELLED"

Source

JobSubmissionError (class)

A canonical job submission could not be accepted.

Example

new JobSubmissionError("Input hash mismatch");

Signature

declare class JobSubmissionError { constructor(
    message: string,
    readonly cause?: unknown,
  ) }

Source

code (property)

Signature

readonly code: "RELKIT_JOB_SUBMISSION_FAILED"

Source

JobSubmissionUnknownError (class)

Native acceptance may have committed and needs idempotent recovery.

Example

new JobSubmissionUnknownError("submit-1", "same-key");

Signature

declare class JobSubmissionUnknownError { constructor(
    readonly operationId: string,
    readonly idempotencyKey: string | undefined,
    recovery: JobUnknownOutcome["recovery"] = { action: "inspect-native" },
  ) }

Source

toJSON (method)

Serializes the bounded recovery contract for callers.

Example

error.toJSON();

Signature

declare const toJSON: () => JobUnknownOutcome;

Source

code (property)

Signature

readonly code: "RELKIT_JOB_SUBMISSION_UNKNOWN"

Source

outcome (property)

Signature

readonly outcome: "unknown"

Source

recovery (property)

Signature

readonly recovery: { readonly action: "retry-with-same-key" | "inspect-native" | "unavailable"; readonly expiresAt?: string; }

Source

submission-failure.ts

JobSubmissionPipelineFailure (class)

Expected failure at the jobs submission pipeline boundary.

Example

if (error instanceof JobSubmissionPipelineFailure) console.log(error.message);

Signature

declare class JobSubmissionPipelineFailure

Source

submission-pipeline.ts

createSubmissionPipeline

Synchronous facade factory for the jobs submission pipeline.

Example

createSubmissionPipeline(runtime);

Signature

declare const createSubmissionPipeline: (runtime: JobsRuntime) => SubmissionPipeline;

Source

createSubmissionPipelineEffect

Builds a task and job submission facade in Effect.

Example

Effect.runSync(createSubmissionPipelineEffect(runtime));

Signature

declare const createSubmissionPipelineEffect: (
  runtime: JobsRuntime,
) => Effect.Effect<SubmissionPipeline, never, never>;

Source

submitJob

Promise compatibility job submission.

Throws

The original capability, validation, cancellation, or provider error.

Example

await submitJob(job, "hello", {}, runtime);

Signature

declare const submitJob: (
  job: JobDescriptorAny,
  input: unknown,
  options?: unknown,
  runtime?: JobsRuntime,
) => Promise<RunHandle>;

Source

submitJobEffect

Submits an authored job in Effect.

Example

Effect.runPromise(submitJobEffect(job, "hello", {}, runtime));

Signature

declare const submitJobEffect: (
  job: JobDescriptorAny,
  input: unknown,
  options: unknown,
  runtime: JobsRuntime,
) => Effect.Effect<RunHandle, JobSubmissionPipelineFailure, never>;

Source

submitTask

Promise compatibility task submission.

Throws

The original capability, validation, cancellation, or provider error.

Example

await submitTask(task, "hello", {}, runtime);

Signature

declare const submitTask: (
  task: TaskDescriptorAny,
  input: unknown,
  options?: unknown,
  runtime?: JobsRuntime,
) => Promise<RunHandle>;

Source

submitTaskEffect

Submits an authored task in Effect.

Example

Effect.runPromise(submitTaskEffect(task, "hello", {}, runtime));

Signature

declare const submitTaskEffect: (
  task: TaskDescriptorAny,
  input: unknown,
  options: unknown,
  runtime: JobsRuntime,
) => Effect.Effect<RunHandle, JobSubmissionPipelineFailure, never>;

Source

submission-prepare.ts

prepareCanonicalSubmission

Promise compatibility adapter for canonical admission.

Throws

The original trigger or preparation error.

Example

await prepareCanonicalSubmission(runtime, task, wire);

Signature

declare const prepareCanonicalSubmission: (
  runtime: JobsRuntime,
  task: TaskDescriptorAny,
  canonicalInput: ReturnType<typeof encodeJobWire>,
  options?: unknown,
  job?: JobDescriptorAny,
) => Promise<SubmissionAdmission>;

Source

prepareCanonicalSubmissionEffect

Builds an admission from already canonical input in Effect.

Example

Effect.runPromise(prepareCanonicalSubmissionEffect(runtime, task, wire));

Signature

declare const prepareCanonicalSubmissionEffect: (
  runtime: JobsRuntime,
  task: TaskDescriptorAny,
  canonicalInput: JobWireEnvelope,
  options?: unknown,
  job?: JobDescriptorAny | undefined,
) => Effect.Effect<
  Readonly<{
    binding: JobsRuntimeBinding;
    input: JsonValue;
    canonicalInput: JsonValue | undefined;
    inputHash: string;
    metadata: TaskSubmissionMetadata;
    job?: JobDescriptorAny;
    task: TaskDescriptorAny;
  }>,
  JobSubmissionPipelineFailure,
  never
>;

Source

prepareSubmission

Promise compatibility adapter for authored input admission.

Throws

The original validation or preparation error.

Example

await prepareSubmission(runtime, task, "hello");

Signature

declare const prepareSubmission: (
  runtime: JobsRuntime,
  task: TaskDescriptorAny,
  input: unknown,
  options?: unknown,
  job?: JobDescriptorAny,
) => Promise<SubmissionAdmission>;

Source

prepareSubmissionEffect

Validates authored input and builds a durable admission in Effect.

Example

Effect.runPromise(prepareSubmissionEffect(runtime, task, "hello"));

Signature

declare const prepareSubmissionEffect: (
  runtime: JobsRuntime,
  task: TaskDescriptorAny,
  input: unknown,
  options?: unknown,
  job?: JobDescriptorAny | undefined,
) => Effect.Effect<
  Readonly<{
    binding: JobsRuntimeBinding;
    input: JsonValue;
    canonicalInput: JsonValue | undefined;
    inputHash: string;
    metadata: TaskSubmissionMetadata;
    job?: JobDescriptorAny;
    task: TaskDescriptorAny;
  }>,
  JobSubmissionPipelineFailure,
  never
>;

Source

submission-prepared.ts

submitPreparedSubmission

Promise compatibility prepared submission.

Throws

Original capability, cancellation, or provider error.

Example

await submitPreparedSubmission(runtime, admission);

Signature

declare const submitPreparedSubmission: (
  runtime: JobsRuntime,
  admission: SubmissionAdmission,
  signal?: AbortSignal,
) => Promise<RunHandle>;

Source

submitPreparedSubmissionEffect

Submits prepared canonical input in Effect.

Example

Effect.runPromise(submitPreparedSubmissionEffect(runtime, admission));

Signature

declare const submitPreparedSubmissionEffect: (
  runtime: JobsRuntime,
  admission: SubmissionAdmission,
  signal?: any,
) => Effect.Effect<RunHandle, JobSubmissionPipelineFailure, never>;

Source

submission-support-hash.ts

SubmissionDigest (class)

Substitutable SHA-256 digest provider for canonical submission input.

Example

const service = yield * SubmissionDigest;

Signature

declare class SubmissionDigest

Source

hashWire

Promise compatibility canonical wire hasher.

Throws

Original canonical JSON or digest error.

Example

await hashWire({ version: 1, kind: "void" });

Signature

declare const hashWire: (value: unknown) => Promise<string>;

Source

hashWireEffect

Hashes a canonical wire envelope in Effect.

Example

Effect.runPromise(hashWireEffect({ version: 1, kind: "void" }));

Signature

declare const hashWireEffect: (
  value: unknown,
) => Effect.Effect<string, SubmissionSupportFailure, never>;

Source

submissionDigestLayer

Provides a deterministic SHA-256 digest implementation.

Example

submissionDigestLayer(async () => new ArrayBuffer(32));

Signature

declare const submissionDigestLayer: (
  digest: (bytes: Uint8Array) => Promise<ArrayBuffer>,
) => Layer.Layer<SubmissionDigest, never, never>;

Source

submission-support-identity.ts

boundedKey

Synchronous bounded idempotency key.

Throws

TypeError when over 256 UTF-8 bytes.

Example

boundedKey("order-1");

Signature

declare const boundedKey: (value: string) => string;

Source

boundedKeyEffect

Checks an idempotency key’s encoded byte limit in Effect.

Example

Effect.runSync(boundedKeyEffect("order-1"));

Signature

declare const boundedKeyEffect: (
  value: string,
) => Effect.Effect<string, SubmissionSupportFailure, never>;

Source

currentCorrelation

Synchronous request correlation reader.

Example

currentCorrelation();

Signature

declare const currentCorrelation: () => string | undefined;

Source

currentCorrelationEffect

Reads request correlation from the invocation scope in Effect.

Example

Effect.runSync(currentCorrelationEffect());

Signature

declare const currentCorrelationEffect: () => Effect.Effect<
  string | undefined,
  SubmissionSupportFailure,
  never
>;

Source

currentTaskRunId

Synchronous current parent task run id reader.

Example

currentTaskRunId();

Signature

declare const currentTaskRunId: () => string | undefined;

Source

currentTaskRunIdEffect

Reads the current parent task run id in Effect.

Example

Effect.runSync(currentTaskRunIdEffect());

Signature

declare const currentTaskRunIdEffect: () => Effect.Effect<
  string | undefined,
  SubmissionSupportFailure,
  never
>;

Source

explicitOrDerivedKey

Synchronous idempotency key resolver.

Throws

TypeError for a mismatched or invalid scalar key.

Example

explicitOrDerivedKey(job, options, input);

Signature

declare const explicitOrDerivedKey: (
  job: { readonly admission?: { readonly idempotency?: { readonly key?: string } } } | undefined,
  options: CopiedTriggerOptions,
  input: JsonValue | undefined,
) => string | undefined;

Source

explicitOrDerivedKeyEffect

Resolves an explicit or declared input idempotency key in Effect.

Example

Effect.runSync(explicitOrDerivedKeyEffect(job, options, input));

Signature

declare const explicitOrDerivedKeyEffect: (
  job: { readonly admission?: { readonly idempotency?: { readonly key?: string } } } | undefined,
  options: CopiedTriggerOptions,
  input: JsonValue | undefined,
) => Effect.Effect<string | undefined, SubmissionSupportFailure, never>;

Source

propagationFor

Synchronous correlated trace propagation reader.

Example

propagationFor("request-1");

Signature

declare const propagationFor: (correlationId: string | undefined) => TracePropagation | undefined;

Source

propagationForEffect

Extends trace propagation with request correlation in Effect.

Example

Effect.runSync(propagationForEffect("request-1"));

Signature

declare const propagationForEffect: (
  correlationId: string | undefined,
) => Effect.Effect<TracePropagation | undefined, SubmissionSupportFailure, never>;

Source

scheduledTime

Synchronous absolute scheduled time calculator.

Throws

Original invalid duration error.

Example

scheduledTime(options, Date.now());

Signature

declare const scheduledTime: (options: CopiedTriggerOptions, now: number) => string | undefined;

Source

scheduledTimeEffect

Calculates an absolute scheduled submission time in Effect.

Example

Effect.runSync(scheduledTimeEffect(options, Date.now()));

Signature

declare const scheduledTimeEffect: (
  options: CopiedTriggerOptions,
  now: number,
) => Effect.Effect<string | undefined, SubmissionSupportFailure, never>;

Source

submission-support-receipts.ts

isRecord

Synchronous nonarray record guard.

Example

isRecord({ accepted: true });

Signature

declare const isRecord: (value: unknown) => value is Record<string, unknown>;

Source

isSubmissionRecordEffect

Tests for a nonarray submission record in Effect.

Example

Effect.runSync(isSubmissionRecordEffect({ accepted: true }));

Signature

declare const isSubmissionRecordEffect: (
  value: unknown,
) => Effect.Effect<boolean, SubmissionSupportFailure, never>;

Source

isUnknown

Synchronous uncertain submission type guard.

Example

if (isUnknown(response)) console.log(response.operationId);

Signature

declare const isUnknown: (value: unknown) => value is UnknownSubmissionOutcome;

Source

isUnknownSubmissionEffect

Tests an uncertain native submission outcome in Effect.

Example

Effect.runSync(isUnknownSubmissionEffect(response));

Signature

declare const isUnknownSubmissionEffect: (
  value: unknown,
) => Effect.Effect<boolean, SubmissionSupportFailure, never>;

Source

normalizeReceipt

Synchronous accepted receipt normalizer.

Throws

JobReceiptError or JobSubmissionUnknownError for invalid outcomes.

Example

normalizeReceipt(receipt, binding, metadata);

Signature

declare const normalizeReceipt: (
  value: NativeReceipt | unknown,
  binding: JobsRuntimeBinding,
  metadata: TaskSubmissionMetadata,
) => RunHandle;

Source

normalizeReceiptEffect

Validates a native accepted receipt in Effect.

Example

Effect.runSync(normalizeReceiptEffect(receipt, binding, metadata));

Signature

declare const normalizeReceiptEffect: (
  value: unknown,
  binding: JobsRuntimeBinding,
  metadata: TaskSubmissionMetadata,
) => Effect.Effect<RunHandle, SubmissionSupportFailure, never>;

Source

normalizeSubmissionError

Synchronous provider error normalizer.

Throws

Original constructor defect when normalization fails.

Example

normalizeSubmissionError(cause, metadata);

Signature

declare const normalizeSubmissionError: (cause: unknown, metadata: TaskSubmissionMetadata) => Error;

Source

normalizeSubmissionErrorEffect

Normalizes an uncertain provider error in Effect.

Example

Effect.runSync(normalizeSubmissionErrorEffect(cause, metadata));

Signature

declare const normalizeSubmissionErrorEffect: (
  cause: unknown,
  metadata: TaskSubmissionMetadata,
) => Effect.Effect<Error, SubmissionSupportFailure, never>;

Source

validatedEnvelope

Synchronous canonical envelope rebuilder.

Example

validatedEnvelope(admission);

Signature

declare const validatedEnvelope: (
  admission: SubmissionAdmission,
) => { version: 1; kind: "void"; value?: never } | { version: 1; kind: "json"; value: JsonValue };

Source

validatedEnvelopeEffect

Rebuilds a validated canonical envelope in Effect.

Example

Effect.runSync(validatedEnvelopeEffect(admission));

Signature

declare const validatedEnvelopeEffect: (
  admission: SubmissionAdmission,
) => Effect.Effect<
  { version: 1; kind: "void"; value?: never } | { version: 1; kind: "json"; value: JsonValue },
  SubmissionSupportFailure,
  never
>;

Source

submission-support-run.ts

SubmissionSupportFailure (class)

Expected submission helper failure with its original cause.

Example

if (error instanceof SubmissionSupportFailure) console.log(error.message);

Signature

declare class SubmissionSupportFailure

Source

runSubmissionSupport

Synchronous submission helper compatibility runner.

Throws

The original helper error on failure.

Example

runSubmissionSupport(submissionSupportEffect("submission.prepare", () => receipt));

Signature

declare const runSubmissionSupport: <A>(effect: Effect.Effect<A, SubmissionSupportFailure>) => A;

Source

submissionSupportEffect

Runs a submission helper inside an observed Effect.

Example

submissionSupportEffect("submission.prepare", () => receipt);

Signature

declare const submissionSupportEffect: <A>(
  operation: JobsOperation,
  compute: () => A,
) => Effect.Effect<A, SubmissionSupportFailure, never>;

Source

submission-support-value-context.ts

currentCorrelation

Reads the parent invocation’s correlation identity.

Example

currentCorrelation();

Signature

declare const currentCorrelation: () => string | undefined;

Source

currentTaskRunId

Reads the current parent task run from invocation ancestry.

Example

currentTaskRunId();

Signature

declare const currentTaskRunId: () => string | undefined;

Source

propagationFor

Extends current trace propagation with an optional correlation identity.

Example

propagationFor("request-1");

Signature

declare const propagationFor: (correlationId: string | undefined) => TracePropagation | undefined;

Source

submission-support-value.ts

boundedKey

Checks the 256-byte idempotency key limit.

Throws

TypeError for oversized keys.

Example

boundedKey("order-1");

Signature

declare const boundedKey: (value: string) => string;

Source

currentCorrelation

Signature

declare const currentCorrelation: () => string | undefined;

Source

currentTaskRunId

Signature

declare const currentTaskRunId: () => string | undefined;

Source

explicitOrDerivedKey

Resolves explicit or input-derived idempotency and checks agreement.

Throws

TypeError for mismatched or nonscalar keys.

Example

explicitOrDerivedKey(job, options, { orderId: "one" });

Signature

declare const explicitOrDerivedKey: (
  job: { readonly admission?: { readonly idempotency?: { readonly key?: string } } } | undefined,
  options: CopiedTriggerOptions,
  input: JsonValue | undefined,
) => string | undefined;

Source

isRecord

Tests for a nonarray provider record.

Example

isRecord({ accepted: true });

Signature

declare const isRecord: (value: unknown) => value is Record<string, unknown>;

Source

isUnknown

Recognizes a native unknown submission response with recovery data.

Example

isUnknown(response);

Signature

declare const isUnknown: (value: unknown) => value is UnknownSubmissionOutcome;

Source

normalizeReceipt

Validates that native acceptance matches the pinned task and job binding.

Throws

JobReceiptError or JobSubmissionUnknownError for invalid outcomes.

Example

normalizeReceipt(receipt, binding, metadata);

Signature

declare const normalizeReceipt: (
  value: NativeReceipt | unknown,
  binding: JobsRuntimeBinding,
  metadata: TaskSubmissionMetadata,
) => RunHandle;

Source

normalizeSubmissionError

Normalizes provider rejection and uncertain acceptance into public errors.

Example

normalizeSubmissionError(cause, metadata);

Signature

declare const normalizeSubmissionError: (cause: unknown, metadata: TaskSubmissionMetadata) => Error;

Source

propagationFor

Signature

declare const propagationFor: (correlationId: string | undefined) => TracePropagation | undefined;

Source

scheduledTime

Resolves a trigger’s absolute time or delay against a supplied clock.

Throws

TypeError for an invalid duration.

Example

scheduledTime({ delay: "1 second" }, 0);

Signature

declare const scheduledTime: (options: CopiedTriggerOptions, now: number) => string | undefined;

Source

validatedEnvelope

Rebuilds a canonical wire envelope from admitted input.

Example

validatedEnvelope(admission);

Signature

declare const validatedEnvelope: (
  admission: SubmissionAdmission,
) => { version: 1; kind: "void"; value?: never } | { version: 1; kind: "json"; value: JsonValue };

Source

submission-support.ts

“./submission-support-hash.js” (namespace export)

Re-exports all named exports from the “./submission-support-hash.js” module.

Signature

export * from "./submission-support-hash.js";

Source

“./submission-support-identity.js” (namespace export)

Re-exports all named exports from the “./submission-support-identity.js” module.

Signature

export * from "./submission-support-identity.js";

Source

“./submission-support-receipts.js” (namespace export)

Re-exports all named exports from the “./submission-support-receipts.js” module.

Signature

export * from "./submission-support-receipts.js";

Source

JobSubmissionWriteFailure

Signature

declare const JobSubmissionWriteFailure: typeof JobSubmissionWriteFailure;

Source

SubmissionSupportFailure

Signature

declare const SubmissionSupportFailure: typeof SubmissionSupportFailure;

Source

UnknownSubmissionOutcome

Signature

declare const UnknownSubmissionOutcome: UnknownSubmissionOutcome;

Source

submitAbortable

Signature

declare const submitAbortable: (
  adapter: JobsAdapterRuntime,
  request: Parameters<JobsAdapterRuntime["submit"]>[0],
  context: OperationContext,
  signal: AbortSignal,
  metadata: TaskSubmissionMetadata,
) => Promise<unknown>;

Source

submitAbortableEffect

Signature

declare const submitAbortableEffect: (
  adapter: JobsAdapterRuntime,
  request: NativeSubmission,
  context: OperationContext,
  signal: AbortSignal,
  metadata: TaskSubmissionMetadata,
) => Effect<NativeReceipt, JobSubmissionWriteFailure, never>;

Source

submission-support.types.ts

UnknownSubmissionOutcome (type alias)

Submission response that requires recovery after an uncertain native write.

Signature

type UnknownSubmissionOutcome = JobUnknownOutcome & {
  readonly recovery: JobUnknownOutcome["recovery"];
};

Source

submission-write.ts

JobSubmissionWriteFailure (class)

Cancelled, uncertain, or provider failed native submission.

Example

if (error instanceof JobSubmissionWriteFailure) console.log(error.message);

Signature

declare class JobSubmissionWriteFailure

Source

submitAbortable

Promise compatibility adapter for native submission.

Throws

The original cancellation, unknown outcome, or provider error.

Example

await submitAbortable(adapter, request, context, signal, metadata);

Signature

declare const submitAbortable: (
  adapter: JobsAdapterRuntime,
  request: Parameters<JobsAdapterRuntime["submit"]>[0],
  context: OperationContext,
  signal: AbortSignal,
  metadata: TaskSubmissionMetadata,
) => Promise<unknown>;

Source

submitAbortableEffect

Submits with an Effect owned abort listener and uncertain outcome semantics.

Example

Effect.runPromise(submitAbortableEffect(adapter, request, context, signal, metadata));

Signature

declare const submitAbortableEffect: (
  adapter: JobsAdapterRuntime,
  request: NativeSubmission,
  context: OperationContext,
  signal: AbortSignal,
  metadata: TaskSubmissionMetadata,
) => Effect.Effect<NativeReceipt, JobSubmissionWriteFailure, never>;

Source

submission-write.types.ts

Listener and abort state owned for one native submission.

SubmissionWriteRegistration (interface)

Listener and abort state owned for one native submission.

Signature

export interface SubmissionWriteRegistration {
  readonly aborted: Promise<void>;
  readonly isAborted: () => boolean;
  readonly dispose: () => void;
}

Source

submission.ts

CanonicalTaskSubmissionOptions

Signature

declare const CanonicalTaskSubmissionOptions: CanonicalTaskSubmissionOptions;

Source

JobReceiptError

Signature

declare const JobReceiptError: typeof JobReceiptError;

Source

JobSubmissionCancelledError

Signature

declare const JobSubmissionCancelledError: typeof JobSubmissionCancelledError;

Source

JobSubmissionError

Signature

declare const JobSubmissionError: typeof JobSubmissionError;

Source

JobSubmissionPipelineFailure

Signature

declare const JobSubmissionPipelineFailure: typeof JobSubmissionPipelineFailure;

Source

JobSubmissionUnknownError

Signature

declare const JobSubmissionUnknownError: typeof JobSubmissionUnknownError;

Source

SubmissionAdmission

Signature

declare const SubmissionAdmission: SubmissionAdmission;

Source

SubmissionPipeline

Signature

declare const SubmissionPipeline: SubmissionPipeline;

Source

TaskSubmissionMetadata

Signature

declare const TaskSubmissionMetadata: TaskSubmissionMetadata;

Source

createSubmissionPipeline

Signature

declare const createSubmissionPipeline: (runtime: JobsRuntime) => SubmissionPipeline;

Source

createSubmissionPipelineEffect

Signature

declare const createSubmissionPipelineEffect: (
  runtime: JobsRuntime,
) => Effect<SubmissionPipeline, never, never>;

Source

prepareCanonicalSubmission

Signature

declare const prepareCanonicalSubmission: (
  runtime: JobsRuntime,
  task: TaskDescriptorAny,
  canonicalInput: ReturnType<typeof encodeJobWire>,
  options?: unknown,
  job?: JobDescriptorAny,
) => Promise<SubmissionAdmission>;

Source

prepareCanonicalSubmissionEffect

Signature

declare const prepareCanonicalSubmissionEffect: (
  runtime: JobsRuntime,
  task: TaskDescriptorAny,
  canonicalInput: JobWireEnvelope,
  options?: unknown,
  job?: JobDescriptorAny | undefined,
) => Effect<
  Readonly<{
    binding: JobsRuntimeBinding;
    input: JsonValue;
    canonicalInput: JsonValue | undefined;
    inputHash: string;
    metadata: TaskSubmissionMetadata;
    job?: JobDescriptorAny;
    task: TaskDescriptorAny;
  }>,
  JobSubmissionPipelineFailure,
  never
>;

Source

prepareSubmission

Signature

declare const prepareSubmission: (
  runtime: JobsRuntime,
  task: TaskDescriptorAny,
  input: unknown,
  options?: unknown,
  job?: JobDescriptorAny,
) => Promise<SubmissionAdmission>;

Source

prepareSubmissionEffect

Signature

declare const prepareSubmissionEffect: (
  runtime: JobsRuntime,
  task: TaskDescriptorAny,
  input: unknown,
  options?: unknown,
  job?: JobDescriptorAny | undefined,
) => Effect<
  Readonly<{
    binding: JobsRuntimeBinding;
    input: JsonValue;
    canonicalInput: JsonValue | undefined;
    inputHash: string;
    metadata: TaskSubmissionMetadata;
    job?: JobDescriptorAny;
    task: TaskDescriptorAny;
  }>,
  JobSubmissionPipelineFailure,
  never
>;

Source

submitCanonicalTask

Signature

declare const submitCanonicalTask: (
  runtime: JobsRuntime,
  task: TaskDescriptorAny,
  options: CanonicalTaskSubmissionOptions,
) => Promise<import("@relkit/contracts/jobs").RunHandle>;

Source

submitCanonicalTaskEffect

Signature

declare const submitCanonicalTaskEffect: (
  runtime: JobsRuntime,
  task: TaskDescriptorAny,
  options: CanonicalTaskSubmissionOptions,
) => Effect<RunHandle, JobSubmissionPipelineFailure, never>;

Source

submitJob

Signature

declare const submitJob: (
  job: JobDescriptorAny,
  input: unknown,
  options?: unknown,
  runtime?: JobsRuntime,
) => Promise<RunHandle>;

Source

submitJobEffect

Signature

declare const submitJobEffect: (
  job: JobDescriptorAny,
  input: unknown,
  options: unknown,
  runtime: JobsRuntime,
) => Effect<RunHandle, JobSubmissionPipelineFailure, never>;

Source

submitPreparedSubmission

Signature

declare const submitPreparedSubmission: (
  runtime: JobsRuntime,
  admission: SubmissionAdmission,
  signal?: AbortSignal,
) => Promise<RunHandle>;

Source

submitTask

Signature

declare const submitTask: (
  task: TaskDescriptorAny,
  input: unknown,
  options?: unknown,
  runtime?: JobsRuntime,
) => Promise<RunHandle>;

Source

submitTaskEffect

Signature

declare const submitTaskEffect: (
  task: TaskDescriptorAny,
  input: unknown,
  options: unknown,
  runtime: JobsRuntime,
) => Effect<RunHandle, JobSubmissionPipelineFailure, never>;

Source

submission.types.ts

CanonicalTaskSubmissionOptions (interface)

Options accepted for canonical task submission operations.

Signature

export interface CanonicalTaskSubmissionOptions {
  readonly canonicalInput: JobWireEnvelope;
  readonly operationId: string;
  readonly idempotencyKey?: string;
  readonly signal?: AbortSignal;
  readonly scheduledFor?: string;
  readonly occurrenceIdentity?: string;
  readonly acceptanceIdentity?: string;
  readonly retryOfRunId?: string;
  readonly inputHash?: string;
  readonly inputSchemaHash?: string;
  readonly job?: JobDescriptorAny;
}

Source

SubmissionAdmission (interface)

Prepared admission identity and timing for one submission.

Signature

export interface SubmissionAdmission {
  readonly task: TaskDescriptorAny;
  readonly job?: JobDescriptorAny;
  readonly binding: JobsRuntimeBinding;
  readonly input: JsonValue;
  readonly canonicalInput: JsonValue | undefined;
  readonly inputHash: string;
  readonly metadata: TaskSubmissionMetadata;
}

Source

SubmissionPipeline (interface)

Validated submission stages and their prepared values.

Signature

export interface SubmissionPipeline {
  readonly submitTask: (
    task: TaskDescriptorAny,
    input: unknown,
    options?: unknown,
  ) => Promise<RunHandle>;
  readonly submitJob: (
    job: JobDescriptorAny,
    input: unknown,
    options?: unknown,
  ) => Promise<RunHandle>;
}

Source

TaskSubmissionMetadata (interface)

Task identity, build, and tracing facts sent with a submission.

Signature

export interface TaskSubmissionMetadata {
  readonly operationId: string;
  readonly idempotencyKey?: string;
  readonly scheduledFor?: string;
  readonly tags?: readonly string[];
  readonly correlationId?: string;
  readonly parentRunId?: string;
  readonly propagation?: TracePropagation;
  readonly acceptanceIdentity?: string;
  readonly occurrenceIdentity?: string;
  readonly inputSchemaHash?: string;
  readonly retryOfRunId?: string;
}

Source

task-client.types.ts

InputOf (type alias)

Caller input inferred from a task or job schema.

Signature

type InputOf<T> = T extends { readonly input: infer Schema }
  ? Schema extends StandardSchemaV1
    ? InferInput<Schema>
    : unknown
  : unknown;

Source

JobTriggerClients (type alias)

Named job trigger clients mapped from declared dependencies.

Signature

type JobTriggerClients<M> = {
  readonly [Name in keyof NonNullable<M> & string]: TaskJobClientFor<NonNullable<M>[Name]>;
};

Source

OutputOf (type alias)

Validated output inferred from a task or job schema.

Signature

type OutputOf<T> = T extends { readonly output: infer Schema }
  ? Schema extends StandardSchemaV1
    ? InferOutput<Schema>
    : unknown
  : unknown;

Source

TaskClientFor (type alias)

Typed trigger operation for one task reference.

Signature

type TaskClientFor<T> = {
  readonly trigger: (input: InputOf<T>, options?: ServerTriggerOptions) => Promise<RunHandle>;
};

Source

TaskClients (type alias)

Named task trigger clients mapped from declared dependencies.

Signature

type TaskClients<M> = {
  readonly [Name in keyof NonNullable<M> & string]: TaskClientFor<NonNullable<M>[Name]>;
};

Source

task-context-policy.types.ts

NormalizedTaskRetryPolicy (interface)

Fully populated retry policy used by the runtime.

Signature

export interface NormalizedTaskRetryPolicy {
  readonly maxAttempts: number;
  readonly initialDelay: DurationInput;
  readonly maxDelay: DurationInput;
  readonly factor: number;
  readonly jitter: "none" | "full";
}

Source

TaskAuthContext (interface)

Session lookup supplied to a task through its auth dependency.

Signature

export interface TaskAuthContext<Session = unknown> {
  readonly getSession: () => Promise<Session | null>;
}

Source

TaskConcurrency (interface)

Limit and optional input key for task execution concurrency.

Signature

export interface TaskConcurrency<InputKey extends string = string> {
  readonly limit: number;
  readonly key?: InputKey;
}

Source

TaskResources (interface)

CPU and memory resources requested for task execution.

Signature

export interface TaskResources {
  readonly cpu: number;
  readonly memory: MemoryInput;
}

Source

TaskRetryPolicy (interface)

Authoring policy for task retry attempts and backoff.

Signature

export interface TaskRetryPolicy {
  readonly maxAttempts: number;
  readonly initialDelay?: DurationInput;
  readonly maxDelay?: DurationInput;
  readonly factor?: number;
  readonly jitter?: "none" | "full";
}

Source

TaskSleepOptions (interface)

Stable sleep key used when a durable task suspends.

Signature

export interface TaskSleepOptions {
  readonly key: string;
}

Source

task-core.types.ts

DurationInput

Signature

declare const DurationInput:
  | `${number} second`
  | `${number} seconds`
  | `${number} minute`
  | `${number} minutes`
  | `${number} hour`
  | `${number} hours`
  | `${number} day`
  | `${number} days`
  | `${number} week`
  | `${number} weeks`
  | `${number} millisecond`
  | `${number} milliseconds`;

Source

InputOf

Signature

declare const InputOf: InputOf<T>;

Source

JobDescriptorForThisTask

Signature

declare const JobDescriptorForThisTask: JobDescriptorForThisTask<Task>;

Source

JobTriggerClients

Signature

declare const JobTriggerClients: JobTriggerClients<M>;

Source

MemoryInput (type alias)

Human-readable MiB or GiB memory quantity for task resources.

Signature

type MemoryInput = `${number} MiB` | `${number} GiB`;

Source

NormalizedTaskRetryPolicy

Signature

declare const NormalizedTaskRetryPolicy: NormalizedTaskRetryPolicy;

Source

OutputOf

Signature

declare const OutputOf: OutputOf<T>;

Source

PublishedEventName (type alias)

Event names registered for the application.

Signature

type PublishedEventName = Extract<keyof Relkit.EventRegistry, string>;

Source

RunResultOptions

Signature

declare const RunResultOptions: RunResultOptions;

Source

ServerTriggerOptions

Signature

declare const ServerTriggerOptions: ServerTriggerOptions;

Source

TaskAuthContext

Signature

declare const TaskAuthContext: TaskAuthContext<Session>;

Source

TaskClientFor

Signature

declare const TaskClientFor: TaskClientFor<T>;

Source

TaskClients

Signature

declare const TaskClients: TaskClients<M>;

Source

TaskConcurrency

Signature

declare const TaskConcurrency: TaskConcurrency<InputKey>;

Source

TaskContext (type alias)

Execution context assembled from the task’s declared dependencies and capabilities.

Signature

type TaskContext<
  Execution extends TaskExecution = TaskExecution,
  Dependencies extends TaskDependencies = {},
  ProgressSchema extends StandardSchemaV1 | undefined = undefined,
  Streams extends TaskStreamSchemas = {},
  Publishes extends readonly string[] = readonly [],
> = TaskContextBase<Dependencies, Publishes> &
  (Execution extends "durable"
    ? {
        readonly sleep: (duration: DurationInput, options: TaskSleepOptions) => Promise<void>;
        readonly sleepUntil: (instant: string, options: TaskSleepOptions) => Promise<void>;
      }
    : {}) &
  ([ProgressSchema] extends [StandardSchemaV1]
    ? { readonly progress: TaskProgressEmitter<InferInput<ProgressSchema>> }
    : {}) &
  ([keyof Streams] extends [never] ? {} : { readonly streams: TaskStreamEmitters<Streams> });

Source

TaskContextBase (interface)

Common invocation context shared by task handlers and hooks.

Signature

export interface TaskContextBase<
  Dependencies extends TaskDependencies = {},
  Publishes extends readonly string[] = readonly [],
> {
  readonly run: TaskRunContext;
  readonly invocation: InvocationMetadata;
  readonly signal: AbortSignal;
  readonly env: ResolvedApplicationEnv;
  readonly log: PublicLogger;
  readonly trace: PublicTrace;
  readonly time: PublicClock;
  readonly tasks: TaskClients<Dependencies["tasks"]>;
  readonly jobs: JobTriggerClients<Dependencies["jobs"]>;
  readonly agents: AgentClients<Dependencies["agents"]>;
  readonly buckets: BucketClients<Dependencies["buckets"]>;
  readonly cache: CacheClients<Dependencies["cache"]>;
  readonly events: EventClients<PublishedEventMap<Publishes>>;
  readonly database: RegisteredContext<"database", Readonly<Record<string, never>>>;
  readonly auth: RegisteredContext<"auth", TaskAuthContext>;
  readonly constants: RegisteredContext<"constants", Readonly<Record<string, never>>>;
  readonly prompts: RegisteredContext<"prompts", Readonly<Record<string, never>>>;
  readonly idempotencyKey: (operation: string) => string;
}

Source

TaskDependencies (interface)

Resources a task explicitly declares before it can be executed.

Signature

export interface TaskDependencies {
  readonly tasks?: Readonly<Record<string, TaskRefAny>>;
  readonly jobs?: Readonly<Record<string, JobRefAny>>;
  readonly agents?: Readonly<Record<string, AgentRefAny>>;
  readonly buckets?: Readonly<Record<string, BucketRefAny>>;
  readonly cache?: Readonly<Record<string, CacheRefAny>>;
}

Source

TaskExecution (type alias)

Whether a task uses durable or retryable execution.

Signature

type TaskExecution = "durable" | "retryable";

Source

TaskHookContext (type alias)

Invocation context visible to task lifecycle hooks.

Signature

type TaskHookContext<
  Dependencies extends TaskDependencies = {},
  Publishes extends readonly string[] = readonly [],
> = TaskContextBase<Dependencies, Publishes>;

Source

TaskProgressEmitter

Signature

declare const TaskProgressEmitter: TaskProgressEmitter<Value>;

Source

TaskProgressInput

Signature

declare const TaskProgressInput: TaskProgressInput<Schema>;

Source

TaskProgressOutput

Signature

declare const TaskProgressOutput: TaskProgressOutput<Schema>;

Source

TaskResources

Signature

declare const TaskResources: TaskResources;

Source

TaskRetryPolicy

Signature

declare const TaskRetryPolicy: TaskRetryPolicy;

Source

TaskRunContext (interface)

Stable run identity and attempt metadata available to a task.

Signature

export interface TaskRunContext {
  readonly runId: string;
  readonly jobId: string;
  readonly taskId: string;
  readonly taskVersion: string;
  readonly buildId: string;
  readonly service: string;
  readonly attempt: number;
  readonly acceptedAt: string;
  readonly scheduledFor?: string;
  readonly parentRunId?: string;
  readonly acceptanceIdentity?: string;
}

Source

TaskSleepOptions

Signature

declare const TaskSleepOptions: TaskSleepOptions;

Source

TaskStreamEmitter

Signature

declare const TaskStreamEmitter: TaskStreamEmitter<Value>;

Source

TaskStreamEmitters

Signature

declare const TaskStreamEmitters: TaskStreamEmitters<Streams>;

Source

TaskStreamFrames

Signature

declare const TaskStreamFrames: TaskStreamFrames<Streams>;

Source

TaskStreamInput

Signature

declare const TaskStreamInput: TaskStreamInput<Schema>;

Source

TaskStreamItem

Signature

declare const TaskStreamItem: TaskStreamItem<Schema>;

Source

TaskStreamOutput

Signature

declare const TaskStreamOutput: TaskStreamOutput<Schema>;

Source

TaskStreamSchemas (type alias)

Named item schemas used to validate task stream emissions.

Signature

type TaskStreamSchemas = Readonly<Record<string, StandardSchemaV1>>;

Source

TaskTriggerOptions

Signature

declare const TaskTriggerOptions: TaskTriggerOptions<Task>;

Source

TriggerOptions

Signature

declare const TriggerOptions: TriggerOptions;

Source

task-definition-inference.types.ts

TaskCallerInput (type alias)

Caller-facing input alias for a task reference.

Signature

type TaskCallerInput<T extends TaskRef> = TaskInput<T>;

Source

TaskCanonicalInput (type alias)

Parsed canonical input inferred from a task’s input schema.

Signature

type TaskCanonicalInput<T extends TaskRef> = T extends { readonly input: infer Schema }
  ? Schema extends StandardSchemaV1
    ? InferOutput<Schema>
    : unknown
  : unknown;

Source

TaskInput (type alias)

Caller input inferred from a task’s input schema.

Signature

type TaskInput<T extends TaskRef> = T extends { readonly input: infer Schema }
  ? Schema extends StandardSchemaV1
    ? InferInput<Schema>
    : unknown
  : unknown;

Source

TaskOutput (type alias)

Validated output inferred from a task’s output schema.

Signature

type TaskOutput<T extends TaskRef> = T extends { readonly output: infer Schema }
  ? Schema extends StandardSchemaV1
    ? InferOutput<Schema>
    : unknown
  : unknown;

Source

TaskRawHandlerOutput (type alias)

Handler return value accepted by a task’s output schema.

Signature

type TaskRawHandlerOutput<T extends TaskRef> = T extends { readonly output: infer Schema }
  ? Schema extends StandardSchemaV1
    ? InferInput<Schema>
    : unknown
  : unknown;

Source

TaskValidatedOutput (type alias)

Output after validation through a task’s output schema.

Signature

type TaskValidatedOutput<T extends TaskRef> = TaskOutput<T>;

Source

task-definition-support.types.ts

TaskFailureHook (type alias)

Hook invoked after task execution fails.

Signature

type TaskFailureHook<
  Dependencies extends TaskDependencies,
  Publishes extends readonly string[] = readonly [],
> = (error: unknown, context: TaskHookContext<Dependencies, Publishes>) => Promise<void>;

Source

TaskHandler (type alias)

Handler receives validated input and scoped context, then returns output or a declared failure.

Signature

type TaskHandler<
  InputSchema extends StandardSchemaV1,
  OutputSchema extends StandardSchemaV1,
  Execution extends TaskExecution,
  Dependencies extends TaskDependencies,
  Errors extends readonly ErrorDescriptorAny[],
  ProgressSchema extends StandardSchemaV1 | undefined,
  Streams extends TaskStreamSchemas,
  Publishes extends readonly string[],
> = (
  input: InferOutput<InputSchema>,
  context: TaskContext<Execution, Dependencies, ProgressSchema, Streams, Publishes>,
) => MaybePromise<TaskHandlerResult<InferInput<OutputSchema>, Errors>>;

Source

TaskHandlerResult (type alias)

Allowed output and declared failure forms returned by a task handler.

Signature

type TaskHandlerResult<Output, Errors extends readonly ErrorDescriptorAny[]> =
  Output | DeclaredErrorsOf<Errors> | FunctionFailure<DeclaredErrorsOf<Errors>>;

Source

TaskLogging (interface)

Log level and fields to redact during task execution.

Signature

export interface TaskLogging {
  readonly level?: "trace" | "debug" | "info" | "warn" | "error";
  readonly redact?: readonly string[];
}

Source

TaskObservation (interface)

Visibility settings for progress and named streams.

Signature

export interface TaskObservation<
  Streams extends TaskStreamSchemas = TaskStreamSchemas,
  ProgressSchema extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined,
> {
  readonly progress?: [ProgressSchema] extends [undefined] ? never : "live" | "durable";
  readonly streams?: Readonly<{ [Name in keyof Streams & string]?: "live" | "history" }>;
}

Source

TaskStartHook (type alias)

Hook invoked before task execution begins.

Signature

type TaskStartHook<
  InputSchema extends StandardSchemaV1,
  Dependencies extends TaskDependencies,
  Publishes extends readonly string[] = readonly [],
> = (
  input: InferOutput<InputSchema>,
  context: TaskHookContext<Dependencies, Publishes>,
) => Promise<void>;

Source

TaskSuccessHook (type alias)

Hook invoked after a task completes successfully.

Signature

type TaskSuccessHook<
  OutputSchema extends StandardSchemaV1,
  Dependencies extends TaskDependencies,
  Publishes extends readonly string[] = readonly [],
> = (
  output: InferOutput<OutputSchema>,
  context: TaskHookContext<Dependencies, Publishes>,
) => Promise<void>;

Source

task-definition.types.ts

DefineTaskOptions (interface)

Authoring contract for task schemas, dependencies, hooks, and execution policy.

Signature

export interface DefineTaskOptions<
  Id extends string,
  Version extends string,
  InputSchema extends StandardSchemaV1,
  OutputSchema extends StandardSchemaV1,
  Dependencies extends TaskDependencies = {},
  Errors extends readonly ErrorDescriptorAny[] = readonly [],
  Publishes extends readonly PublishedEventName[] = readonly [],
  ProgressSchema extends StandardSchemaV1 | undefined = undefined,
  Streams extends TaskStreamSchemas = {},
  Execution extends TaskExecution = "durable",
> extends DescriptorMetadata {
  readonly id: Id;
  readonly version: Version;
  readonly input: InputSchema;
  readonly inputWire?: StandardSchemaV1<InferOutput<InputSchema>, InferOutput<InputSchema>>;
  readonly output: OutputSchema;
  readonly errors?: Errors;
  readonly execution?: Execution;
  readonly dependencies?: ValidTaskDependencies<Dependencies>;
  readonly publishes?: Publishes;
  readonly progress?: ProgressSchema;
  readonly streams?: Streams;
  readonly observation?: TaskObservation<Streams, ProgressSchema>;
  readonly retry?: TaskRetryPolicy;
  readonly resources?: TaskResources;
  readonly concurrency?: TaskConcurrency<CanonicalInputKey<InputSchema>>;
  readonly maxDuration?: DurationInput;
  readonly maxElapsed?: DurationInput;
  readonly logging?: TaskLogging;
  readonly onStart?: TaskStartHook<InputSchema, Dependencies, Publishes>;
  readonly onSuccess?: TaskSuccessHook<OutputSchema, Dependencies, Publishes>;
  readonly onFailure?: TaskFailureHook<Dependencies, Publishes>;
  readonly handler: TaskHandler<
    InputSchema,
    OutputSchema,
    Execution,
    Dependencies,
    Errors,
    ProgressSchema,
    Streams,
    Publishes
  >;
}

Source

TaskCallerInput

Signature

declare const TaskCallerInput: TaskCallerInput<T>;

Source

TaskCanonicalInput

Signature

declare const TaskCanonicalInput: TaskCanonicalInput<T>;

Source

TaskDescriptor (interface)

Validated task definition with an attached trigger operation.

Signature

export interface TaskDescriptor<
  Id extends string,
  Version extends string,
  InputSchema extends StandardSchemaV1,
  OutputSchema extends StandardSchemaV1,
  Dependencies extends TaskDependencies = {},
  Errors extends readonly ErrorDescriptorAny[] = readonly [],
  Publishes extends readonly string[] = readonly [],
  ProgressSchema extends StandardSchemaV1 | undefined = undefined,
  Streams extends TaskStreamSchemas = {},
  Execution extends TaskExecution = TaskExecution,
>
  extends DescriptorBase<"task", Id>, TaskRef<Id, InputSchema, OutputSchema, Errors> {
  readonly version: Version;
  readonly execution: Execution;
  readonly inputWire?: StandardSchemaV1<InferOutput<InputSchema>, InferOutput<InputSchema>>;
  readonly dependencies?: Dependencies;
  readonly publishes?: Publishes;
  readonly progress?: ProgressSchema;
  readonly streams?: Streams;
  readonly observation?: TaskObservation<Streams, ProgressSchema>;
  readonly retry: NormalizedTaskRetryPolicy;
  readonly resources?: TaskResources;
  readonly concurrency?: TaskConcurrency<CanonicalInputKey<InputSchema>>;
  readonly maxDuration?: DurationInput;
  readonly maxElapsed?: DurationInput;
  readonly logging?: TaskLogging;
  readonly onStart?: TaskStartHook<InputSchema, Dependencies, Publishes>;
  readonly onSuccess?: TaskSuccessHook<OutputSchema, Dependencies, Publishes>;
  readonly onFailure?: TaskFailureHook<Dependencies, Publishes>;
  readonly handler: TaskHandler<
    InputSchema,
    OutputSchema,
    Execution,
    Dependencies,
    Errors,
    ProgressSchema,
    Streams,
    Publishes
  >;
  readonly trigger: (
    input: InferInput<InputSchema>,
    options?: TaskTriggerOptions<TaskRef<Id, InputSchema, OutputSchema, Errors>>,
  ) => Promise<RunHandle>;
}

Source

TaskDescriptorAny (type alias)

Task descriptor widened for registry and runtime boundaries.

Signature

type TaskDescriptorAny = DescriptorBase<"task", string> &
  TaskRef<string, StandardSchemaV1, StandardSchemaV1, readonly ErrorDescriptorAny[]> & {
    readonly version: string;
    readonly execution: TaskExecution;
    readonly inputWire?: StandardSchemaV1 | undefined;
    readonly dependencies?: TaskDependencies | undefined;
    readonly publishes?: readonly string[] | undefined;
    readonly progress?: StandardSchemaV1 | undefined;
    readonly streams?: TaskStreamSchemas | undefined;
    readonly observation?: TaskObservation | undefined;
    readonly retry: NormalizedTaskRetryPolicy;
    readonly resources?: TaskResources | undefined;
    readonly concurrency?: TaskConcurrency | undefined;
    readonly maxDuration?: DurationInput | undefined;
    readonly maxElapsed?: DurationInput | undefined;
    readonly logging?: TaskLogging | undefined;
    readonly onStart?: (...args: never[]) => Promise<void>;
    readonly onSuccess?: (...args: never[]) => Promise<void>;
    readonly onFailure?: (...args: never[]) => Promise<void>;
    readonly handler: (...args: never[]) => unknown;
    readonly trigger: (...args: never[]) => Promise<RunHandle>;
  };

Source

TaskFailureHook

Signature

declare const TaskFailureHook: TaskFailureHook<Dependencies, Publishes>;

Source

TaskHandler

Signature

declare const TaskHandler: TaskHandler<
  InputSchema,
  OutputSchema,
  Execution,
  Dependencies,
  Errors,
  ProgressSchema,
  Streams,
  Publishes
>;

Source

TaskHandlerResult

Signature

declare const TaskHandlerResult: TaskHandlerResult<Output, Errors>;

Source

TaskInput

Signature

declare const TaskInput: TaskInput<T>;

Source

TaskLogging

Signature

declare const TaskLogging: TaskLogging;

Source

TaskObservation

Signature

declare const TaskObservation: TaskObservation<Streams, ProgressSchema>;

Source

TaskOutput

Signature

declare const TaskOutput: TaskOutput<T>;

Source

TaskRawHandlerOutput

Signature

declare const TaskRawHandlerOutput: TaskRawHandlerOutput<T>;

Source

TaskStartHook

Signature

declare const TaskStartHook: TaskStartHook<InputSchema, Dependencies, Publishes>;

Source

TaskSuccessHook

Signature

declare const TaskSuccessHook: TaskSuccessHook<OutputSchema, Dependencies, Publishes>;

Source

TaskValidatedOutput

Signature

declare const TaskValidatedOutput: TaskValidatedOutput<T>;

Source

task-emission.types.ts

TaskProgressEmitter (interface)

Emitter contract for task progress items.

Signature

export interface TaskProgressEmitter<Value = unknown> {
  readonly emit: (value: Value) => Promise<ProgressEmitReceipt>;
}

Source

TaskProgressInput (type alias)

Input type inferred for task progress.

Signature

type TaskProgressInput<Schema extends StandardSchemaV1> = InferInput<Schema>;

Source

TaskProgressOutput (type alias)

Output type inferred for task progress.

Signature

type TaskProgressOutput<Schema extends StandardSchemaV1> = InferOutput<Schema>;

Source

TaskStreamEmitter (interface)

Emitter contract for task stream items.

Signature

export interface TaskStreamEmitter<Value = unknown> {
  readonly emit: (value: Value) => Promise<ProgressEmitReceipt>;
}

Source

TaskStreamEmitters (type alias)

Named emitters whose input types follow each declared stream schema.

Signature

type TaskStreamEmitters<Streams extends TaskStreamSchemas> = {
  readonly [Name in keyof Streams & string]: TaskStreamEmitter<TaskStreamInput<Streams[Name]>>;
};

Source

TaskStreamFrames (type alias)

Discriminated frames for all declared task streams.

Signature

type TaskStreamFrames<Streams extends TaskStreamSchemas> = {
  readonly [Name in keyof Streams & string]: NamedStreamFrame<TaskStreamOutput<Streams[Name]>> & {
    readonly name: Name;
  };
}[keyof Streams & string];

Source

TaskStreamInput (type alias)

Input type inferred for task stream.

Signature

type TaskStreamInput<Schema extends StandardSchemaV1> = InferInput<Schema>;

Source

TaskStreamItem (type alias)

Validated item output inferred from a stream schema.

Signature

type TaskStreamItem<Schema extends StandardSchemaV1> = InferOutput<Schema>;

Source

TaskStreamOutput (type alias)

Output type inferred for task stream.

Signature

type TaskStreamOutput<Schema extends StandardSchemaV1> = InferOutput<Schema>;

Source

task-observation-validation.ts

TaskObservationError (class)

An invalid task observation declaration.

Example

new TaskObservationError({ reason: "Task observation must be an object" });

Signature

declare class TaskObservationError

Source

copyObservation

Synchronous task observation compatibility adapter.

Throws

TypeError when the declaration contradicts task schemas.

Example

copyObservation(undefined, undefined, undefined);

Signature

declare const copyObservation: (
  value: unknown,
  progress: unknown,
  streams: ObservationStreams,
) => TaskObservation | undefined;

Source

copyObservationEffect

Normalizes a task’s progress and stream observation declarations in Effect.

Example

Effect.runPromise(copyObservationEffect(undefined, undefined, undefined));

Signature

declare const copyObservationEffect: (
  value: unknown,
  progress: unknown,
  streams: ObservationStreams,
) => Effect.Effect<NormalizedObservation, TaskObservationError, never>;

Source

task-observation-validation.types.ts

NormalizedObservation (type alias)

Normalized observation configuration.

Signature

type NormalizedObservation = TaskObservation | undefined;

Source

ObservationStreams (type alias)

Declared schemas available to the task observation validator.

Signature

type ObservationStreams = TaskStreamSchemas | undefined;

Source

TaskObservation

Signature

declare const TaskObservation: TaskObservation<Streams, ProgressSchema>;

Source

TaskStreamSchemas

Signature

declare const TaskStreamSchemas: Readonly<Record<string, StandardSchemaV1<unknown, unknown>>>;

Source

task-policy-basic.ts

assertBoundedString

Synchronous bounded string assertion.

Throws

TypeError for invalid text.

Example

assertBoundedString("tag", "Task tag");

Signature

declare const assertBoundedString: (
  value: unknown,
  name: string,
  maxBytes?: number,
) => asserts value is string;

Source

assertBoundedStringEffect

Checks nonempty bounded UTF-8 text in Effect.

Example

Effect.runSync(assertBoundedStringEffect("tag", "Task tag"));

Signature

declare const assertBoundedStringEffect: (
  value: unknown,
  name: string,
  maxBytes?: any,
) => Effect.Effect<void, TaskValidationFailure, never>;

Source

assertCanonicalScalarKey

Synchronous required canonical scalar key assertion.

Throws

TypeError for unsupported projections or fields.

Example

assertCanonicalScalarKey(schema, "tenantId", "concurrency.key");

Signature

declare const assertCanonicalScalarKey: (
  schema: StandardSchemaV1,
  key: string,
  name: string,
) => void;

Source

assertCanonicalScalarKeyEffect

Checks that a concurrency key is a required canonical scalar in Effect.

Example

Effect.runSync(assertCanonicalScalarKeyEffect(schema, "tenantId", "concurrency.key"));

Signature

declare const assertCanonicalScalarKeyEffect: (
  schema: StandardSchemaV1<unknown, unknown>,
  key: string,
  name: string,
) => Effect.Effect<void, TaskValidationFailure, never>;

Source

assertFieldName

Synchronous top-level field name assertion.

Throws

TypeError for invalid paths or expressions.

Example

assertFieldName("tenantId");

Signature

declare const assertFieldName: (value: unknown, name?: string) => asserts value is string;

Source

assertFieldNameEffect

Checks a top-level canonical field name in Effect.

Example

Effect.runSync(assertFieldNameEffect("tenantId"));

Signature

declare const assertFieldNameEffect: (
  value: unknown,
  name?: any,
) => Effect.Effect<void, TaskValidationFailure, never>;

Source

memoryBytes

Synchronous memory quantity parser.

Throws

TypeError for invalid or unsafe quantities.

Example

memoryBytes("1 GiB");

Signature

declare const memoryBytes: (value: string) => number;

Source

memoryBytesEffect

Parses an exact MiB or GiB memory quantity in Effect.

Example

Effect.runSync(memoryBytesEffect("1 GiB"));

Signature

declare const memoryBytesEffect: (
  value: string,
) => Effect.Effect<number, TaskValidationFailure, never>;

Source

utf8Bytes

Synchronous UTF-8 byte count.

Example

utf8Bytes("hello");

Signature

declare const utf8Bytes: (value: string) => number;

Source

utf8BytesEffect

Counts encoded UTF-8 bytes in Effect.

Example

Effect.runSync(utf8BytesEffect("hello"));

Signature

declare const utf8BytesEffect: (
  value: string,
) => Effect.Effect<number, TaskValidationFailure, never>;

Source

task-policy-copy.ts

copyConcurrency

Synchronous task concurrency copier.

Throws

TypeError for invalid concurrency settings.

Example

copyConcurrency({ limit: 2 });

Signature

declare const copyConcurrency: (
  value: unknown,
  canonicalSchema?: StandardSchemaV1,
) => TaskConcurrency | undefined;

Source

copyConcurrencyEffect

Copies bounded concurrency settings in Effect.

Example

Effect.runSync(copyConcurrencyEffect({ limit: 2 }));

Signature

declare const copyConcurrencyEffect: (
  value: unknown,
  canonicalSchema?: StandardSchemaV1<unknown, unknown> | undefined,
) => Effect.Effect<TaskConcurrency<string> | undefined, TaskValidationFailure, never>;

Source

copyLogging

Synchronous logging policy copier.

Throws

TypeError for invalid logging policy.

Example

copyLogging({ level: "info" });

Signature

declare const copyLogging: (value: unknown) => TaskLogging | undefined;

Source

copyLoggingEffect

Copies bounded logging settings in Effect.

Example

Effect.runSync(copyLoggingEffect({ level: "info" }));

Signature

declare const copyLoggingEffect: (
  value: unknown,
) => Effect.Effect<TaskLogging | undefined, TaskValidationFailure, never>;

Source

copyResources

Synchronous task resource copier.

Throws

TypeError for invalid CPU or memory settings.

Example

copyResources({ cpu: 1, memory: "1 GiB" });

Signature

declare const copyResources: (value: unknown) => TaskResources | undefined;

Source

copyResourcesEffect

Copies validated CPU and memory settings in Effect.

Example

Effect.runSync(copyResourcesEffect({ cpu: 1, memory: "1 GiB" }));

Signature

declare const copyResourcesEffect: (
  value: unknown,
) => Effect.Effect<TaskResources | undefined, TaskValidationFailure, never>;

Source

copyTaskTags

Synchronous task tag copier.

Throws

TypeError for invalid or duplicate tags.

Example

copyTaskTags(["important"]);

Signature

declare const copyTaskTags: (value: unknown) => readonly string[] | undefined;

Source

copyTaskTagsEffect

Copies bounded unique task tags in Effect.

Example

Effect.runSync(copyTaskTagsEffect(["important"]));

Signature

declare const copyTaskTagsEffect: (
  value: unknown,
) => Effect.Effect<ReadonlyArray<string> | undefined, TaskValidationFailure, never>;

Source

task-policy-random.ts

TaskPolicyRandom (class)

Substitutable random sample source for retry jitter.

Example

const service = yield * TaskPolicyRandom;

Signature

declare class TaskPolicyRandom

Source

retryDelayMillis

Synchronous bounded retry delay calculator.

Throws

TypeError for invalid attempts or samples.

Example

retryDelayMillis(policy, 2, 0, () => 0.5);

Signature

declare const retryDelayMillis: (
  policy: NormalizedTaskRetryPolicy,
  attempt: number,
  retryAfterMillis?: number,
  random?: () => number,
) => number;

Source

retryDelayMillisEffect

Computes bounded retry delay in Effect using an injectable sample source.

Example

Effect.runSync(
  Effect.provide(
    retryDelayMillisEffect(policy, 2),
    taskPolicyRandomLayer(() => 0.5),
  ),
);

Signature

declare const retryDelayMillisEffect: (
  policy: NormalizedTaskRetryPolicy,
  attempt: number,
  retryAfterMillis?: any,
  random?: (() => number) | undefined,
) => Effect.Effect<number, TaskValidationFailure, never>;

Source

taskPolicyRandomLayer

Provides deterministic retry jitter samples.

Example

taskPolicyRandomLayer(() => 0.5);

Signature

declare const taskPolicyRandomLayer: (
  sample: () => number,
) => Layer.Layer<TaskPolicyRandom, never, never>;

Source

task-policy-validation.ts

“./task-policy-basic.js” (namespace export)

Re-exports all named exports from the “./task-policy-basic.js” module.

Signature

export * from "./task-policy-basic.js";

Source

“./task-policy-copy.js” (namespace export)

Re-exports all named exports from the “./task-policy-copy.js” module.

Signature

export * from "./task-policy-copy.js";

Source

“./task-policy-random.js” (namespace export)

Re-exports all named exports from the “./task-policy-random.js” module.

Signature

export * from "./task-policy-random.js";

Source

TASK_INPUT_MAX_BYTES

Signature

declare const TASK_INPUT_MAX_BYTES: 1048576;

Source

TASK_ITEM_MAX_BYTES

Signature

declare const TASK_ITEM_MAX_BYTES: number;

Source

TASK_KEY_MAX_BYTES

Signature

declare const TASK_KEY_MAX_BYTES: 256;

Source

TASK_MAX_TAGS

Signature

declare const TASK_MAX_TAGS: 20;

Source

TASK_OUTPUT_MAX_BYTES

Signature

declare const TASK_OUTPUT_MAX_BYTES: 1048576;

Source

TASK_REASON_MAX_BYTES

Signature

declare const TASK_REASON_MAX_BYTES: 1024;

Source

task-policy-value-copy.ts

assertCanonicalScalarKey

Requires a projected required string or number field for partitioning.

Throws

TypeError for missing or unsupported schema projections.

Example

assertCanonicalScalarKey(schema, "tenantId", "concurrency.key");

Signature

declare const assertCanonicalScalarKey: (
  schema: StandardSchemaV1,
  key: string,
  name: string,
) => void;

Source

copyConcurrency

Validates a bounded concurrency limit and optional canonical scalar key.

Throws

TypeError for invalid limits or keys.

Example

copyConcurrency({ limit: 2, key: "tenantId" }, schema);

Signature

declare const copyConcurrency: (
  value: unknown,
  canonicalSchema?: StandardSchemaV1,
) => TaskConcurrency | undefined;

Source

copyLogging

Copies logging level and unique redaction keys.

Throws

TypeError for invalid levels or redaction names.

Example

copyLogging({ level: "info", redact: ["secret"] });

Signature

declare const copyLogging: (value: unknown) => TaskLogging | undefined;

Source

copyResources

Validates CPU and exact memory for a task resource request.

Throws

TypeError for invalid CPU or memory.

Example

copyResources({ cpu: 1, memory: "1 GiB" });

Signature

declare const copyResources: (value: unknown) => TaskResources | undefined;

Source

copyTaskTags

Copies unique, bounded task tags into a frozen list.

Throws

TypeError for duplicates, invalid text, or excess tags.

Example

copyTaskTags(["urgent"]);

Signature

declare const copyTaskTags: (value: unknown) => readonly string[] | undefined;

Source

task-policy-value.ts

TASK_INPUT_MAX_BYTES

Maximum canonical task input bytes.

Example

TASK_INPUT_MAX_BYTES === 1_048_576;

Signature

declare const TASK_INPUT_MAX_BYTES: 1048576;

Source

TASK_ITEM_MAX_BYTES

Maximum progress or stream item bytes.

Example

TASK_ITEM_MAX_BYTES === 65_536;

Signature

declare const TASK_ITEM_MAX_BYTES: number;

Source

TASK_KEY_MAX_BYTES

Maximum identifier and scalar key bytes.

Example

TASK_KEY_MAX_BYTES === 256;

Signature

declare const TASK_KEY_MAX_BYTES: 256;

Source

TASK_MAX_TAGS

Maximum count of unique task tags.

Example

TASK_MAX_TAGS === 20;

Signature

declare const TASK_MAX_TAGS: 20;

Source

TASK_OUTPUT_MAX_BYTES

Maximum canonical task output bytes.

Example

TASK_OUTPUT_MAX_BYTES === 1_048_576;

Signature

declare const TASK_OUTPUT_MAX_BYTES: 1048576;

Source

TASK_REASON_MAX_BYTES

Maximum bounded reason text bytes.

Example

TASK_REASON_MAX_BYTES === 1_024;

Signature

declare const TASK_REASON_MAX_BYTES: 1024;

Source

assertBoundedString

Requires a nonempty UTF-8 string within a configured byte limit.

Throws

TypeError for empty, nontext, or oversized values.

Example

assertBoundedString("order-1", "orderId");

Signature

declare const assertBoundedString: (
  value: unknown,
  name: string,
  maxBytes?: number,
) => asserts value is string;

Source

assertCanonicalScalarKey

Signature

declare const assertCanonicalScalarKey: (
  schema: StandardSchemaV1,
  key: string,
  name: string,
) => void;

Source

assertFieldName

Requires one top-level canonical field name rather than a path.

Throws

TypeError for invalid paths or expressions.

Example

assertFieldName("tenantId");

Signature

declare const assertFieldName: (value: unknown, name?: string) => asserts value is string;

Source

copyConcurrency

Signature

declare const copyConcurrency: (
  value: unknown,
  canonicalSchema?: StandardSchemaV1,
) => TaskConcurrency | undefined;

Source

copyLogging

Signature

declare const copyLogging: (value: unknown) => TaskLogging | undefined;

Source

copyResources

Signature

declare const copyResources: (value: unknown) => TaskResources | undefined;

Source

copyTaskTags

Signature

declare const copyTaskTags: (value: unknown) => readonly string[] | undefined;

Source

memoryBytes

Parses exact decimal MiB or GiB memory into safe integer bytes.

Throws

TypeError for fractional bytes or unsafe ranges.

Example

memoryBytes("1.5 GiB");

Signature

declare const memoryBytes: (value: string) => number;

Source

retryDelayMillis

Computes bounded task retry delay with optional jitter and retry-after floor.

Throws

TypeError for invalid attempt or jitter.

Example

retryDelayMillis(policy, 2, 0, () => 0.5);

Signature

declare const retryDelayMillis: (
  policy: NormalizedTaskRetryPolicy,
  attempt: number,
  retryAfterMillis?: number,
  random?: () => number,
) => number;

Source

utf8Bytes

Counts UTF-8 bytes rather than JavaScript code units.

Example

utf8Bytes("é");

Signature

declare const utf8Bytes: (value: string) => number;

Source

task-progress-emission.ts

createEmission

Builds a validated Effect emitter and its compatibility adapter.

Example

createEmission(progressSchema, options, "progress");

Signature

declare const createEmission: <S extends StandardSchemaV1>(
  schema: S,
  options: TaskEmitterOptions,
  kind: "progress" | "stream",
) => EffectTaskEmitter<InferInput<S>>;

Source

task-progress-error.ts

TaskEmissionError (class)

Compatibility error thrown by Promise based task emitters.

Example

if (error instanceof TaskEmissionError) console.log(error.message);

Signature

declare class TaskEmissionError { constructor(
    readonly code: TaskEmissionErrorCode,
    message: string,
  ) }

Source

TaskEmissionFailure (class)

Expected emission failure in Effect, retaining the compatibility error.

Example

if (error instanceof TaskEmissionFailure) console.log(error.message);

Signature

declare class TaskEmissionFailure

Source

task-progress.ts

EffectTaskEmitter

Signature

declare const EffectTaskEmitter: EffectTaskEmitter<Value>;

Source

TaskEmissionError

Signature

declare const TaskEmissionError: typeof TaskEmissionError;

Source

TaskEmissionErrorCode

Signature

declare const TaskEmissionErrorCode: TaskEmissionErrorCode;

Source

TaskEmissionFailure

Signature

declare const TaskEmissionFailure: typeof TaskEmissionFailure;

Source

TaskEmissionSink

Signature

declare const TaskEmissionSink: TaskEmissionSink;

Source

TaskEmitterOptions

Signature

declare const TaskEmitterOptions: TaskEmitterOptions;

Source

TaskStreamEmitterOptions

Signature

declare const TaskStreamEmitterOptions: TaskStreamEmitterOptions;

Source

TaskStreamSink

Signature

declare const TaskStreamSink: TaskStreamSink;

Source

createTaskProgressEmitter

Compatibility factory for validated progress emitters.

Throws

TypeError if the configured byte limit is invalid.

Example

createTaskProgressEmitter(z.string());

Signature

declare const createTaskProgressEmitter: <S extends StandardSchemaV1>(
  schema: S,
  options?: TaskEmitterOptions,
) => EffectTaskEmitter<InferInput<S>>;

Source

createTaskProgressEmitterEffect

Creates a validated progress emitter in Effect.

Example

Effect.runSync(createTaskProgressEmitterEffect(z.string()));

Signature

declare const createTaskProgressEmitterEffect: <S extends StandardSchemaV1>(
  schema: S,
  options?: TaskEmitterOptions | undefined,
) => Effect.Effect<EffectTaskEmitter<InferInput<S>>, TaskEmissionFailure, never>;

Source

createTaskStreamEmitter

Compatibility factory for named stream emitters.

Throws

TypeError for invalid names or byte limits.

Example

createTaskStreamEmitter(z.string(), { name: "events" });

Signature

declare const createTaskStreamEmitter: <S extends StandardSchemaV1>(
  schema: S,
  options: TaskStreamEmitterOptions,
) => EffectTaskEmitter<InferInput<S>>;

Source

createTaskStreamEmitterEffect

Creates a named stream emitter in Effect.

Example

Effect.runSync(createTaskStreamEmitterEffect(z.string(), { name: "events" }));

Signature

declare const createTaskStreamEmitterEffect: <S extends StandardSchemaV1>(
  schema: S,
  options: TaskStreamEmitterOptions,
) => Effect.Effect<EffectTaskEmitter<InferInput<S>>, TaskEmissionFailure, never>;

Source

task-progress.types.ts

EffectTaskEmitter (interface)

An emitter with a typed Effect operation alongside its Promise adapter.

Signature

export interface EffectTaskEmitter<Value> {
  readonly emit: (value: Value) => Promise<ProgressEmitReceipt>;
  readonly emitEffect: (value: Value) => Effect.Effect<ProgressEmitReceipt, TaskEmissionFailure>;
}

Source

TaskEmissionErrorCode (type alias)

Stable compatibility error codes for task emissions.

Signature

type TaskEmissionErrorCode =
  | "RELKIT_TASK_PROGRESS_INVALID"
  | "RELKIT_TASK_STREAM_INVALID"
  | "RELKIT_TASK_PROGRESS_TOO_LARGE"
  | "RELKIT_TASK_STREAM_TOO_LARGE"
  | "RELKIT_TASK_PROGRESS_PERSISTENCE"
  | "RELKIT_TASK_STREAM_PERSISTENCE"
  | "RELKIT_TASK_PROGRESS_RETENTION"
  | "RELKIT_TASK_STREAM_RETENTION"
  | "RELKIT_TASK_EMISSION_ABORTED";

Source

TaskEmissionSink (type alias)

Sink for a validated progress item.

Signature

type TaskEmissionSink = (
  value: unknown,
  signal: AbortSignal,
) => MaybePromise<ProgressEmitReceipt | void>;

Source

TaskEmitterOptions (interface)

Delivery and retention settings for a progress emitter.

Signature

export interface TaskEmitterOptions {
  readonly signal?: AbortSignal;
  readonly sink?: TaskEmissionSink;
  readonly durable?: boolean;
  readonly maxBytes?: number;
  readonly generation?: string;
  readonly requireGeneration?: boolean;
}

Source

TaskStreamEmitterOptions (interface)

Delivery settings for a named stream emitter.

Signature

export interface TaskStreamEmitterOptions extends Omit<TaskEmitterOptions, "sink"> {
  readonly name: string;
  readonly sink?: TaskStreamSink;
}

Source

TaskStreamSink (type alias)

Sink for a validated named stream item.

Signature

type TaskStreamSink = (
  value: unknown,
  signal: AbortSignal,
  identity: { readonly name: string; readonly generation?: string },
) => MaybePromise<ProgressEmitReceipt | void>;

Source

task-types.ts

“./task-core.types.js” (namespace export)

Re-exports all named exports from the “./task-core.types.js” module.

Signature

export * from "./task-core.types.js";

Source

“./task-definition.types.js” (namespace export)

Re-exports all named exports from the “./task-definition.types.js” module.

Signature

export * from "./task-definition.types.js";

Source

task-validation-copy.ts

copyDependencies

Synchronous dependency map copier.

Throws

TypeError for invalid dependencies.

Example

copyDependencies({ tasks: {} });

Signature

declare const copyDependencies: <Dependencies extends TaskDependencies>(
  value: unknown,
) => Dependencies | undefined;

Source

copyDependenciesEffect

Copies declared task dependencies in Effect.

Example

Effect.runSync(copyDependenciesEffect({ tasks: {} }));

Signature

declare const copyDependenciesEffect: <Dependencies extends TaskDependencies>(
  value: unknown,
) => Effect.Effect<Dependencies | undefined, TaskValidationFailure, never>;

Source

copyErrors

Synchronous task error descriptor copier.

Throws

TypeError for invalid descriptors.

Example

copyErrors([]);

Signature

declare const copyErrors: (value: unknown) => readonly ErrorDescriptorAny[] | undefined;

Source

copyErrorsEffect

Copies declared task errors in Effect.

Example

Effect.runSync(copyErrorsEffect([]));

Signature

declare const copyErrorsEffect: (
  value: unknown,
) => Effect.Effect<ReadonlyArray<ErrorDescriptorAny> | undefined, TaskValidationFailure, never>;

Source

copyStreams

Synchronous stream schema copier.

Throws

TypeError for invalid stream names or schemas.

Example

copyStreams({ text: z.string() });

Signature

declare const copyStreams: (value: unknown) => TaskStreamSchemas | undefined;

Source

copyStreamsEffect

Copies named task stream schemas in Effect.

Example

Effect.runSync(copyStreamsEffect({ text: z.string() }));

Signature

declare const copyStreamsEffect: (
  value: unknown,
) => Effect.Effect<
  Readonly<Record<string, StandardSchemaV1<unknown, unknown>>> | undefined,
  TaskValidationFailure,
  never
>;

Source

duration

Synchronous task duration validator.

Throws

TypeError for invalid duration.

Example

duration("1 second", "maxDuration", true);

Signature

declare const duration: (value: unknown, name: string, positive?: boolean) => DurationInput;

Source

normalizeRetry

Synchronous retry policy normalizer.

Throws

TypeError for invalid retry settings.

Example

normalizeRetry({ maxAttempts: 3 });

Signature

declare const normalizeRetry: (value: unknown) => NormalizedTaskRetryPolicy;

Source

normalizeRetryEffect

Normalizes a task retry policy in Effect.

Example

Effect.runSync(normalizeRetryEffect({ maxAttempts: 3 }));

Signature

declare const normalizeRetryEffect: (
  value: unknown,
) => Effect.Effect<NormalizedTaskRetryPolicy, TaskValidationFailure, never>;

Source

taskDurationEffect

Validates a readable task duration in Effect.

Example

Effect.runSync(taskDurationEffect("1 second", "maxDuration", true));

Signature

declare const taskDurationEffect: (
  value: unknown,
  name: string,
  positive?: any,
) => Effect.Effect<
  | `${number} second`
  | `${number} seconds`
  | `${number} minute`
  | `${number} minutes`
  | `${number} hour`
  | `${number} hours`
  | `${number} day`
  | `${number} days`
  | `${number} week`
  | `${number} weeks`
  | `${number} millisecond`
  | `${number} milliseconds`,
  TaskValidationFailure,
  never
>;

Source

task-validation-run.ts

TaskValidationFailure (class)

Expected task definition validation failure with its original cause.

Example

if (error instanceof TaskValidationFailure) console.log(error.message);

Signature

declare class TaskValidationFailure

Source

runTaskValidation

Synchronous task validation compatibility runner.

Throws

The original validation error on failure.

Example

runTaskValidation(taskValidationEffect("task.validate", () => descriptor));

Signature

declare const runTaskValidation: <A>(effect: Effect.Effect<A, TaskValidationFailure>) => A;

Source

taskValidationEffect

Runs a task validation calculation in observed Effect.

Example

taskValidationEffect("task.validate", () => descriptor);

Signature

declare const taskValidationEffect: <A>(
  operation: JobsOperation,
  compute: () => A,
) => Effect.Effect<A, TaskValidationFailure, never>;

Source

task-validation-schema.ts

assertCanonicalSchemaSupport

Synchronous canonical schema assertion.

Throws

TypeError for unsupported schema projections.

Example

assertCanonicalSchemaSupport(z.string(), "output");

Signature

declare const assertCanonicalSchemaSupport: (
  schema: StandardSchemaV1,
  name: string,
  allowVoid?: boolean,
) => void;

Source

assertCanonicalSchemaSupportEffect

Checks canonical schema projection in Effect.

Example

Effect.runSync(assertCanonicalSchemaSupportEffect(z.string(), "output"));

Signature

declare const assertCanonicalSchemaSupportEffect: (
  schema: StandardSchemaV1<unknown, unknown>,
  name: string,
  allowVoid?: any,
) => Effect.Effect<void, TaskValidationFailure, never>;

Source

assertCanonicalStreamSupport

Synchronous named stream schema assertion.

Throws

TypeError for noncanonical stream schemas.

Example

assertCanonicalStreamSupport({ text: z.string() });

Signature

declare const assertCanonicalStreamSupport: (streams: TaskStreamSchemas | undefined) => void;

Source

assertCanonicalStreamSupportEffect

Checks each named stream schema in Effect.

Example

Effect.runSync(assertCanonicalStreamSupportEffect({ text: z.string() }));

Signature

declare const assertCanonicalStreamSupportEffect: (
  streams: Readonly<Record<string, StandardSchemaV1<unknown, unknown>>> | undefined,
) => Effect.Effect<void, TaskValidationFailure, never>;

Source

assertInputWireSupport

Synchronous task inputWire support assertion.

Throws

TypeError for noncanonical input support.

Example

assertInputWireSupport(z.string(), undefined);

Signature

declare const assertInputWireSupport: (input: StandardSchemaV1, inputWire: unknown) => void;

Source

assertInputWireSupportEffect

Checks canonical support for input and optional inputWire in Effect.

Example

Effect.runSync(assertInputWireSupportEffect(z.string(), undefined));

Signature

declare const assertInputWireSupportEffect: (
  input: StandardSchemaV1<unknown, unknown>,
  inputWire: unknown,
) => Effect.Effect<void, TaskValidationFailure, never>;

Source

assertSchema

Synchronous Standard Schema v1 assertion.

Throws

TypeError for invalid schema.

Example

assertSchema(z.string(), "Task input");

Signature

declare const assertSchema: (value: unknown, name: string) => asserts value is StandardSchemaV1;

Source

assertSchemaEffect

Asserts Standard Schema v1 in Effect.

Example

Effect.runSync(assertSchemaEffect(z.string(), "Task input"));

Signature

declare const assertSchemaEffect: (
  value: unknown,
  name: string,
) => Effect.Effect<void, TaskValidationFailure, never>;

Source

normalizeVersion

Synchronous task version normalizer.

Throws

Original invalid identifier error.

Example

normalizeVersion("v1");

Signature

declare const normalizeVersion: (value: unknown) => string;

Source

normalizeVersionEffect

Normalizes a task version or identifier in Effect.

Example

Effect.runSync(normalizeVersionEffect("v1"));

Signature

declare const normalizeVersionEffect: (
  value: unknown,
) => Effect.Effect<string, TaskValidationFailure, never>;

Source

task-validation-value-copy.ts

copyDependencies

Copies declared task dependencies by supported kind and stable name.

Throws

TypeError for unsupported kinds or invalid references.

Example

copyDependencies({ jobs: { send: jobRef } });

Signature

declare const copyDependencies: <Dependencies extends TaskDependencies>(
  value: unknown,
) => Dependencies | undefined;

Source

copyErrors

Copies unique declared task error descriptors.

Throws

TypeError for invalid descriptors or duplicate IDs.

Example

copyErrors([notFoundError]);

Signature

declare const copyErrors: (value: unknown) => readonly ErrorDescriptorAny[] | undefined;

Source

copyStreams

Copies named task streams with Standard Schema validators.

Throws

TypeError for invalid stream names or validators.

Example

copyStreams({ events: eventSchema });

Signature

declare const copyStreams: (value: unknown) => TaskStreamSchemas | undefined;

Source

task-validation-value.ts

assertCanonicalSchemaSupport

Checks a schema’s faithful canonical output projection.

Throws

TypeError for transforms or missing projections.

Example

assertCanonicalSchemaSupport(outputSchema, "Task output");

Signature

declare const assertCanonicalSchemaSupport: (
  schema: StandardSchemaV1,
  name: string,
  allowVoid?: boolean,
) => void;

Source

assertCanonicalStreamSupport

Checks every stream item schema for canonical output support.

Throws

TypeError for unsupported stream item schemas.

Example

assertCanonicalStreamSupport({ events: eventSchema });

Signature

declare const assertCanonicalStreamSupport: (streams: TaskStreamSchemas | undefined) => void;

Source

assertInputWireSupport

Requires transformed input to provide a canonical identity validator.

Throws

TypeError for unsupported transformations.

Example

assertInputWireSupport(inputSchema, inputWireSchema);

Signature

declare const assertInputWireSupport: (input: StandardSchemaV1, inputWire: unknown) => void;

Source

assertSchema

Requires the Standard Schema v1 validator shape.

Throws

TypeError for missing or malformed Standard Schema fields.

Example

assertSchema(schema, "Task input");

Signature

declare const assertSchema: (value: unknown, name: string) => asserts value is StandardSchemaV1;

Source

duration

Validates readable duration text and optional positivity.

Throws

TypeError for unreadable or nonpositive durations.

Example

duration("1 second", "timeout", true);

Signature

declare const duration: (value: unknown, name: string, positive?: boolean) => DurationInput;

Source

normalizeRetry

Applies safe retry defaults and validates delay, factor, and jitter.

Throws

TypeError for invalid attempts or delay relationships.

Example

normalizeRetry({ maxAttempts: 5 });

Signature

declare const normalizeRetry: (value: unknown) => NormalizedTaskRetryPolicy;

Source

normalizeVersion

Normalizes the task version to a stable identifier.

Throws

TypeError for invalid identifiers.

Example

normalizeVersion("v1");

Signature

declare const normalizeVersion: (value: unknown) => string;

Source

task-validation.ts

“./task-validation-copy.js” (namespace export)

Re-exports all named exports from the “./task-validation-copy.js” module.

Signature

export * from "./task-validation-copy.js";

Source

“./task-validation-schema.js” (namespace export)

Re-exports all named exports from the “./task-validation-schema.js” module.

Signature

export * from "./task-validation-schema.js";

Source

TaskValidationFailure

Signature

declare const TaskValidationFailure: typeof TaskValidationFailure;

Source

copyConcurrency

Signature

declare const copyConcurrency: (
  value: unknown,
  canonicalSchema?: StandardSchemaV1,
) => TaskConcurrency | undefined;

Source

copyLogging

Signature

declare const copyLogging: (value: unknown) => TaskLogging | undefined;

Source

copyObservation

Signature

declare const copyObservation: (
  value: unknown,
  progress: unknown,
  streams: ObservationStreams,
) => TaskObservation | undefined;

Source

copyResources

Signature

declare const copyResources: (value: unknown) => TaskResources | undefined;

Source

task-wire-codec.ts

decodeJobWire

Synchronous validated job wire decoder.

Throws

TaskWireValidationError or TypeError for malformed input.

Example

decodeJobWire(encodeTaskInput("value"));

Signature

declare const decodeJobWire: (envelope: unknown, maxBytes?: number) => JsonValue | undefined;

Source

decodeJobWireEffect

Decodes and validates a job wire envelope in Effect.

Example

Effect.runSync(decodeJobWireEffect(encodeTaskInput("value")));

Signature

declare const decodeJobWireEffect: (
  envelope: unknown,
  maxBytes?: any,
) => Effect.Effect<JsonValue | undefined, TaskWireFailure, never>;

Source

encodeJobWire

Synchronous generic job wire encoder.

Throws

TaskWireValidationError or TypeError for invalid input.

Example

encodeJobWire({ id: 1 });

Signature

declare const encodeJobWire: (value: unknown, maxBytes?: number) => JobWireEnvelope;

Source

encodeJobWireEffect

Encodes a generic job wire envelope in Effect.

Example

Effect.runSync(encodeJobWireEffect({ id: 1 }));

Signature

declare const encodeJobWireEffect: (
  value: unknown,
  maxBytes?: any,
) => Effect.Effect<JobWireEnvelope, TaskWireFailure, never>;

Source

encodeTaskInput

Synchronous task input encoder.

Throws

TaskWireValidationError or TypeError for invalid input.

Example

encodeTaskInput({ id: 1 });

Signature

declare const encodeTaskInput: (value: unknown, maxBytes?: number) => JobWireEnvelope;

Source

encodeTaskInputEffect

Encodes task input in Effect.

Example

Effect.runSync(encodeTaskInputEffect({ id: 1 }));

Signature

declare const encodeTaskInputEffect: (
  value: unknown,
  maxBytes?: any,
) => Effect.Effect<JobWireEnvelope, TaskWireFailure, never>;

Source

encodeTaskOutput

Synchronous task output encoder.

Throws

TaskWireValidationError or TypeError for invalid output.

Example

encodeTaskOutput("done");

Signature

declare const encodeTaskOutput: (value: unknown, maxBytes?: number) => JobWireEnvelope;

Source

encodeTaskOutputEffect

Encodes task output in Effect.

Example

Effect.runSync(encodeTaskOutputEffect("done"));

Signature

declare const encodeTaskOutputEffect: (
  value: unknown,
  maxBytes?: any,
) => Effect.Effect<JobWireEnvelope, TaskWireFailure, never>;

Source

task-wire-run.ts

TaskWireFailure (class)

Expected wire operation failure with its original compatibility error.

Example

if (error instanceof TaskWireFailure) console.log(error.message);

Signature

declare class TaskWireFailure

Source

runWirePromise

Runs an Effect wire operation for Promise compatibility.

Throws

The original wire validation error on failure.

Example

await runWirePromise(wirePromiseEffect("wire.decode", async () => decoded));

Signature

declare const runWirePromise: <A>(effect: Effect.Effect<A, TaskWireFailure>) => Promise<A>;

Source

runWireSync

Runs an Effect wire operation for synchronous compatibility.

Throws

The original wire validation error on failure.

Example

runWireSync(wireEffect("wire.encode", () => encoded));

Signature

declare const runWireSync: <A>(effect: Effect.Effect<A, TaskWireFailure>) => A;

Source

wireEffect

Lifts a synchronous wire operation into observed Effect.

Example

wireEffect("wire.encode", () => encoded);

Signature

declare const wireEffect: <A>(
  operation: JobsOperation,
  compute: () => A,
) => Effect.Effect<A, TaskWireFailure, never>;

Source

wirePromiseEffect

Lifts an asynchronous wire operation into observed Effect.

Example

wirePromiseEffect("wire.decode", async () => decoded);

Signature

declare const wirePromiseEffect: <A>(
  operation: JobsOperation,
  compute: () => Promise<A>,
) => Effect.Effect<A, TaskWireFailure, never>;

Source

task-wire-support.ts

TaskWireErrorCode

Signature

declare const TaskWireErrorCode: TaskWireErrorCode;

Source

TaskWireValidationError (class)

Invalid canonical task wire data with a stable machine-readable code.

Example

new TaskWireValidationError("RELKIT_TASK_WIRE_INVALID", "Invalid envelope");

Signature

declare class TaskWireValidationError { constructor(
    readonly code: TaskWireErrorCode,
    message: string,
  ) }

Source

assertByteLimit

Requires a positive safe integer wire size limit.

Throws

TypeError for zero, negative, or noninteger limits.

Example

assertByteLimit(1024);

Signature

declare const assertByteLimit: (maxBytes: number) => void;

Source

assertEnvelope

Rejects hostile or malformed wire envelope object shapes.

Throws

TaskWireValidationError for invalid or accessor-backed envelopes.

Example

assertEnvelope({ version: 1, kind: "void" });

Signature

declare const assertEnvelope: (value: unknown) => asserts value is JobWireEnvelope;

Source

assertSize

Enforces the encoded UTF-8 size for canonical JSON text.

Throws

TaskWireValidationError or TypeError for invalid size.

Example

assertSize("{}", 1024, "RELKIT_TASK_INPUT_TOO_LARGE", "input");

Signature

declare const assertSize: (
  text: string,
  maxBytes: number,
  code: TaskWireErrorCode,
  name: string,
) => void;

Source

encode

Canonicalizes JSON or void data into a bounded wire envelope.

Throws

TaskWireValidationError or TypeError for invalid data or limit.

Example

encode({ id: "one" }, 1024, "RELKIT_TASK_INPUT_INVALID", "RELKIT_TASK_INPUT_TOO_LARGE", "input");

Signature

declare const encode: (
  value: unknown,
  maxBytes: number,
  invalidCode: TaskWireErrorCode,
  sizeCode: TaskWireErrorCode,
  name: string,
) => JobWireEnvelope;

Source

hasOwn

Checks an envelope’s own property without consulting its prototype.

Example

hasOwn({ kind: "void" }, "kind");

Signature

declare const hasOwn: (value: object, key: PropertyKey) => boolean;

Source

invalidEnvelope

Fails with the stable invalid-envelope error.

Throws

TaskWireValidationError with the wire-invalid code.

Example

if (invalid) invalidEnvelope();

Signature

declare const invalidEnvelope: () => never;

Source

message

Converts a validator rejection into a bounded diagnostic string.

Example

message(new Error("invalid"));

Signature

declare const message: (error: unknown) => string;

Source

validateValue

Runs Standard Schema validation and retains its parsed output.

Throws

TaskWireValidationError for issues or validator rejection.

Example

await validateValue(schema, "hello", "RELKIT_TASK_INPUT_INVALID");

Signature

declare const validateValue: <S extends StandardSchemaV1>(
  schema: S,
  value: InferInput<S>,
  code: Extract<TaskWireErrorCode, "RELKIT_TASK_INPUT_INVALID" | "RELKIT_TASK_OUTPUT_INVALID">,
) => Promise<InferOutput<S>>;

Source

task-wire-support.types.ts

Stable codes for wire validation, identity, and size errors.

TaskWireErrorCode (type alias)

Stable codes for wire validation, identity, and size errors.

Signature

type TaskWireErrorCode =
  | "RELKIT_TASK_WIRE_INVALID"
  | "RELKIT_TASK_INPUT_INVALID"
  | "RELKIT_TASK_OUTPUT_INVALID"
  | "RELKIT_TASK_INPUT_WIRE_NON_IDENTITY"
  | "RELKIT_TASK_INPUT_TOO_LARGE"
  | "RELKIT_TASK_OUTPUT_TOO_LARGE";

Source

task-wire-validation.ts

validateCanonicalInput

Promise compatibility canonical input validation.

Throws

TaskWireValidationError or TypeError for invalid input.

Example

await validateCanonicalInput(z.number(), 7);

Signature

declare const validateCanonicalInput: <S extends StandardSchemaV1>(
  schema: S,
  canonical: unknown,
  inputWire?: StandardSchemaV1<InferOutput<S>, InferOutput<S>>,
  maxBytes?: number,
) => Promise<InferOutput<S>>;

Source

validateCanonicalInputEffect

Validates retained canonical task input in Effect.

Example

Effect.runPromise(validateCanonicalInputEffect(z.number(), 7));

Signature

declare const validateCanonicalInputEffect: <S extends StandardSchemaV1>(
  schema: S,
  canonical: unknown,
  inputWire?: StandardSchemaV1<InferOutput<S>, InferOutput<S>> | undefined,
  maxBytes?: number | undefined,
) => Effect.Effect<InferOutput<S>, TaskWireFailure, never>;

Source

validateCanonicalOutput

Promise compatibility canonical output validation.

Throws

TaskWireValidationError or TypeError for invalid output.

Example

await validateCanonicalOutput(z.string(), "done");

Signature

declare const validateCanonicalOutput: <S extends StandardSchemaV1>(
  schema: S,
  canonical: unknown,
  maxBytes?: number,
) => Promise<InferOutput<S>>;

Source

validateCanonicalOutputEffect

Validates a retained canonical task output in Effect.

Example

Effect.runPromise(validateCanonicalOutputEffect(z.string(), "done"));

Signature

declare const validateCanonicalOutputEffect: <S extends StandardSchemaV1>(
  schema: S,
  canonical: unknown,
  maxBytes?: number | undefined,
) => Effect.Effect<InferOutput<S>, TaskWireFailure, never>;

Source

validateTaskInput

Promise compatibility input validation.

Throws

TaskWireValidationError or TypeError for invalid input.

Example

await validateTaskInput(z.string(), "value");

Signature

declare const validateTaskInput: <S extends StandardSchemaV1>(
  schema: S,
  input: InferInput<S>,
  maxBytes?: number,
) => Promise<{ readonly value: InferOutput<S>; readonly wire: JobWireEnvelope }>;

Source

validateTaskInputEffect

Validates and encodes submitted task input in Effect.

Example

Effect.runPromise(validateTaskInputEffect(z.string(), "value"));

Signature

declare const validateTaskInputEffect: <S extends StandardSchemaV1>(
  schema: S,
  input: InferInput<S>,
  maxBytes?: number | undefined,
) => Effect.Effect<
  { readonly value: InferOutput<S>; readonly wire: JobWireEnvelope },
  TaskWireFailure,
  never
>;

Source

validateTaskOutput

Promise compatibility output validation.

Throws

TaskWireValidationError or TypeError for invalid output.

Example

await validateTaskOutput(z.string(), "done");

Signature

declare const validateTaskOutput: <S extends StandardSchemaV1>(
  schema: S,
  output: InferInput<S>,
  maxBytes?: number,
) => Promise<{ readonly value: InferOutput<S>; readonly wire: JobWireEnvelope }>;

Source

validateTaskOutputEffect

Validates and encodes task output in Effect.

Example

Effect.runPromise(validateTaskOutputEffect(z.string(), "done"));

Signature

declare const validateTaskOutputEffect: <S extends StandardSchemaV1>(
  schema: S,
  output: InferInput<S>,
  maxBytes?: number | undefined,
) => Effect.Effect<
  { readonly value: InferOutput<S>; readonly wire: JobWireEnvelope },
  TaskWireFailure,
  never
>;

Source

task-wire-value-validation.ts

validateCanonicalInput

Validates retained input without changing its canonical JSON bytes.

Throws

TaskWireValidationError for schema, size, or identity failures.

Example

await validateCanonicalInput(schema, "hello");

Signature

declare const validateCanonicalInput: <S extends StandardSchemaV1>(
  schema: S,
  canonical: unknown,
  inputWire?: StandardSchemaV1<InferOutput<S>, InferOutput<S>>,
  maxBytes?: number,
) => Promise<InferOutput<S>>;

Source

validateCanonicalOutput

Validates retained output without changing canonical JSON bytes.

Throws

TaskWireValidationError for schema, size, or identity failures.

Example

await validateCanonicalOutput(schema, "done");

Signature

declare const validateCanonicalOutput: <S extends StandardSchemaV1>(
  schema: S,
  canonical: unknown,
  maxBytes?: number,
) => Promise<InferOutput<S>>;

Source

validateTaskInput

Validates authored task input and constructs its canonical wire form.

Throws

TaskWireValidationError for schema or size failures.

Example

await validateTaskInput(schema, "hello");

Signature

declare const validateTaskInput: <S extends StandardSchemaV1>(
  schema: S,
  input: InferInput<S>,
  maxBytes?: number,
) => Promise<{ readonly value: InferOutput<S>; readonly wire: JobWireEnvelope }>;

Source

validateTaskOutput

Validates task output and constructs its canonical wire form.

Throws

TaskWireValidationError for schema or size failures.

Example

await validateTaskOutput(schema, "done");

Signature

declare const validateTaskOutput: <S extends StandardSchemaV1>(
  schema: S,
  output: InferInput<S>,
  maxBytes?: number,
) => Promise<{ readonly value: InferOutput<S>; readonly wire: JobWireEnvelope }>;

Source

task-wire-value.ts

TaskWireErrorCode

Signature

declare const TaskWireErrorCode: TaskWireErrorCode;

Source

TaskWireValidationError

Signature

declare const TaskWireValidationError: typeof TaskWireValidationError;

Source

decodeJobWire

Decodes a hostile wire envelope into immutable canonical JSON.

Throws

TaskWireValidationError for malformed or oversized envelopes.

Example

decodeJobWire({ version: 1, kind: "void" });

Signature

declare const decodeJobWire: (envelope: unknown, maxBytes?: number) => JsonValue | undefined;

Source

encodeJobWire

Encodes a generic jobs wire value with the input byte limit.

Throws

TaskWireValidationError for invalid or oversized data.

Example

encodeJobWire({ id: "one" });

Signature

declare const encodeJobWire: (value: unknown, maxBytes?: number) => JobWireEnvelope;

Source

encodeTaskInput

Encodes submitted task input with input-specific failure codes.

Throws

TaskWireValidationError for invalid or oversized input.

Example

encodeTaskInput("hello");

Signature

declare const encodeTaskInput: (value: unknown, maxBytes?: number) => JobWireEnvelope;

Source

encodeTaskOutput

Encodes handler output with output-specific failure codes.

Throws

TaskWireValidationError for invalid or oversized output.

Example

encodeTaskOutput("done");

Signature

declare const encodeTaskOutput: (value: unknown, maxBytes?: number) => JobWireEnvelope;

Source

validateCanonicalInput

Signature

declare const validateCanonicalInput: <S extends StandardSchemaV1>(
  schema: S,
  canonical: unknown,
  inputWire?: StandardSchemaV1<InferOutput<S>, InferOutput<S>>,
  maxBytes?: number,
) => Promise<InferOutput<S>>;

Source

validateCanonicalOutput

Signature

declare const validateCanonicalOutput: <S extends StandardSchemaV1>(
  schema: S,
  canonical: unknown,
  maxBytes?: number,
) => Promise<InferOutput<S>>;

Source

validateTaskInput

Signature

declare const validateTaskInput: <S extends StandardSchemaV1>(
  schema: S,
  input: InferInput<S>,
  maxBytes?: number,
) => Promise<{ readonly value: InferOutput<S>; readonly wire: JobWireEnvelope }>;

Source

validateTaskOutput

Signature

declare const validateTaskOutput: <S extends StandardSchemaV1>(
  schema: S,
  output: InferInput<S>,
  maxBytes?: number,
) => Promise<{ readonly value: InferOutput<S>; readonly wire: JobWireEnvelope }>;

Source

task-wire.ts

“./task-wire-codec.js” (namespace export)

Re-exports all named exports from the “./task-wire-codec.js” module.

Signature

export * from "./task-wire-codec.js";

Source

“./task-wire-validation.js” (namespace export)

Re-exports all named exports from the “./task-wire-validation.js” module.

Signature

export * from "./task-wire-validation.js";

Source

TaskWireErrorCode

Signature

declare const TaskWireErrorCode: TaskWireErrorCode;

Source

TaskWireFailure

Signature

declare const TaskWireFailure: typeof TaskWireFailure;

Source

TaskWireValidationError

Signature

declare const TaskWireValidationError: typeof TaskWireValidationError;

Source

trigger-validation.ts

CopiedTriggerOptions

Signature

declare const CopiedTriggerOptions: CopiedTriggerOptions;

Source

TriggerValidationError (class)

Invalid trigger or result observation options.

Example

if (error instanceof TriggerValidationError) console.log(error.message);

Signature

declare class TriggerValidationError

Source

copyTriggerOptions

Synchronous trigger options validator.

Throws

TypeError for invalid fields.

Example

copyTriggerOptions({ operationId: "op" });

Signature

declare const copyTriggerOptions: (value: unknown) => CopiedTriggerOptions;

Source

copyTriggerOptionsEffect

Validates and freezes trigger options in Effect.

Example

Effect.runSync(copyTriggerOptionsEffect({ operationId: "op" }));

Signature

declare const copyTriggerOptionsEffect: (
  value: unknown,
) => Effect.Effect<CopiedTriggerOptions, TriggerValidationError, never>;

Source

validateResultOptions

Synchronous result options validator.

Throws

TypeError for invalid fields.

Example

validateResultOptions({ timeout: "1 second" });

Signature

declare const validateResultOptions: (value: unknown) => RunResultOptions;

Source

validateResultOptionsEffect

Validates bounded result observation options in Effect.

Example

Effect.runSync(validateResultOptionsEffect({ timeout: "1 second" }));

Signature

declare const validateResultOptionsEffect: (
  value: unknown,
) => Effect.Effect<RunResultOptions, TriggerValidationError, never>;

Source

trigger-validation.types.ts

CopiedTriggerOptions (type alias)

Validated trigger options with an optional authored job selector.

Signature

type CopiedTriggerOptions = ServerTriggerOptions & { readonly job?: unknown };

Source

trigger.types.ts

JobDescriptorForThisTask (type alias)

Job reference constrained to target the selected task.

Signature

type JobDescriptorForThisTask<Task extends TaskRefAny = TaskRefAny> = JobRefAny & {
  readonly task: Task;
};

Source

RunResultOptions (interface)

Options accepted for run result operations.

Signature

export interface RunResultOptions {
  readonly timeout: DurationInput;
  readonly signal?: AbortSignal;
}

Source

ServerTriggerOptions (interface)

Options accepted for server trigger operations.

Signature

export interface ServerTriggerOptions extends TriggerOptions {
  readonly signal?: AbortSignal;
}

Source

TaskTriggerOptions (interface)

Options accepted for task trigger operations.

Signature

export interface TaskTriggerOptions<
  Task extends TaskRefAny = TaskRefAny,
> extends ServerTriggerOptions {
  readonly job?: JobDescriptorForThisTask<Task>;
}

Source

TriggerOptions (interface)

Browser-safe submission fields. Server-only signals and selectors are separate.

Signature

export interface TriggerOptions {
  readonly operationId?: string;
  readonly idempotencyKey?: string;
  readonly delay?: DurationInput;
  readonly at?: string;
  readonly tags?: readonly string[];
  readonly correlationId?: string;
}

Source