Skip to content

@oneplatform/plugin-sdk


@oneplatform/plugin-sdk / Destination

Interface: Destination

Defined in: packages/plugin-sdk/src/types/destination.ts:43

Methods

metadata()

metadata(): DestinationMetadata

Defined in: packages/plugin-sdk/src/types/destination.ts:44

Returns

DestinationMetadata


write()

write(records, context): Promise\<WriteResult>

Defined in: packages/plugin-sdk/src/types/destination.ts:58

Write a batch of mapped records to the destination.

The platform calls this with batches sized according to the destination's delivery guarantee. For at-least-once destinations, the same record may be delivered more than once (e.g., after a retry). The destination must handle idempotent writes if its DestinationMetadata.deliveryGuarantee is "at-least-once" or "exactly-once".

Never partially fail silently — report all failures in WriteResult.errors. The platform uses this to trigger DLQ routing.

Parameters

records

MappedRecord[]

context

DestinationContext

Returns

Promise\<WriteResult>


writeStream()?

optional writeStream(stream, context): Promise\<WriteResult>

Defined in: packages/plugin-sdk/src/types/destination.ts:68

Stream records to the destination. Only implement if DestinationMetadata.supportsStreaming is true.

The platform provides an AsyncIterable of records. The destination should maintain an open connection to the target system and write records as they arrive. Return a WriteResult when the stream is exhausted.

Parameters

stream

AsyncIterable\<MappedRecord>

context

DestinationContext

Returns

Promise\<WriteResult>