@oneplatform/plugin-sdk / Transformer
Interface: Transformer¶
Defined in: packages/plugin-sdk/src/types/transformer.ts:34
Methods¶
metadata()¶
metadata():
TransformerMetadata
Defined in: packages/plugin-sdk/src/types/transformer.ts:35
Returns¶
transform()¶
transform(
record,context):Promise\<DataRecord|null>
Defined in: packages/plugin-sdk/src/types/transformer.ts:48
Transform a single record.
Return the (possibly modified) DataRecord to pass it downstream. Return null to drop the record — it will not appear in the output. Do not mutate the input record — return a new object.
Parameters¶
record¶
context¶
Returns¶
Promise\<DataRecord | null>
Throws¶
PluginDataError if the record is malformed and cannot be processed. The platform will route the record to the pipeline's dead-letter queue. Do not throw for recoverable data issues — return a modified record instead.
transformBatch()?¶
optionaltransformBatch(records,context):Promise\<DataRecord[]>
Defined in: packages/plugin-sdk/src/types/transformer.ts:61
Transform a batch of records. Optional optimization for transformers that can process records more efficiently in bulk (e.g., batch enrichment API calls).
If implemented, the platform uses this instead of calling transform() N times. The result array must preserve ordering: records[i] maps to result[i] or is absent (dropped). Use an empty array to drop all records.
The platform NEVER calls both transform() and transformBatch() for the same batch — it prefers transformBatch() if present.
Parameters¶
records¶
context¶
Returns¶
Promise\<DataRecord[]>