Changelog #14
·
Better support for generic interfaces
CEO, Trigger.dev
We've improved our Integrations to support generic interfaces and better ergonomics.
Previously, integrations could not support tasks with generic type parameters or fluent interfaces. For example, previously our OpenAI integration looked like this:
_10await io.openai.createChatCompletion("chat-completion", {_10 model: "gpt-3.5-turbo",_10 messages: [_10 {_10 role: "user",_10 content: "Create a good programming joke about background jobs",_10 },_10 ],_10});
Which is now replaced with the following that much more closely matches the OpenAI SDK:
_10await io.openai.chat.completions.create("chat-completion", {_10 model: "gpt-3.5-turbo",_10 messages: [_10 {_10 role: "user",_10 content: "Create a good programming joke about background jobs",_10 },_10 ],_10});
Tasks can also now have generic type parameters as well, which is useful for integrations like Supabase or Airtable that have user-defined schemas:
_10const table = io.airtable_10 .base(payload.baseId)_10 .table<LaunchGoalsAndOkRs>(payload.tableName);_10_10const records = await table.getRecords("muliple records", {_10 fields: ["Status"],_10});