@trigger.dev/airtable: Removed named imports (#782)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@trigger.dev/airtable": patch
|
||||
---
|
||||
|
||||
Named exports don't work because Airtable is a CommonJS module
|
||||
@@ -1,14 +1,13 @@
|
||||
import { DisplayProperty, IOWithIntegrations, IntegrationTaskKey } from "@trigger.dev/sdk";
|
||||
import { FieldSet, Records, SelectOptions } from "airtable";
|
||||
import { AirtableFieldSet, AirtableRecord, AirtableRunTask, CreateAirtableRecord } from ".";
|
||||
import { QueryParams } from "airtable/lib/query_params";
|
||||
import { DisplayProperty, IntegrationTaskKey } from "@trigger.dev/sdk";
|
||||
import AirtableSDK from "airtable";
|
||||
import { AirtableFieldSet, AirtableRecord, AirtableRunTask } from ".";
|
||||
|
||||
type TableParams<Params extends Record<string, unknown>> = {
|
||||
tableName: string;
|
||||
} & Params;
|
||||
|
||||
export type AirtableRecordsParams = TableParams<{}>;
|
||||
export type AirtableRecords = Records<FieldSet>;
|
||||
export type AirtableRecords = AirtableSDK.Records<AirtableSDK.FieldSet>;
|
||||
|
||||
export class Base {
|
||||
constructor(
|
||||
@@ -32,7 +31,7 @@ export class Table<TFields extends AirtableFieldSet> {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
getRecords(key: IntegrationTaskKey, params?: SelectOptions<TFields>) {
|
||||
getRecords(key: IntegrationTaskKey, params?: AirtableSDK.SelectOptions<TFields>) {
|
||||
return this.runTask(
|
||||
key,
|
||||
async (client) => {
|
||||
|
||||
@@ -10,19 +10,12 @@ import {
|
||||
type RunTaskOptions,
|
||||
type TriggerIntegration,
|
||||
} from "@trigger.dev/sdk";
|
||||
import AirtableSDK, { Error as AirtableApiError } from "airtable";
|
||||
import AirtableSDK from "airtable";
|
||||
import { Base } from "./base";
|
||||
import * as events from "./events";
|
||||
import {
|
||||
WebhookChangeType,
|
||||
WebhookDataType,
|
||||
Webhooks,
|
||||
createWebhookSource,
|
||||
createWebhookTrigger,
|
||||
} from "./webhooks";
|
||||
import { Webhooks, createWebhookSource } from "./webhooks";
|
||||
|
||||
export * from "./types";
|
||||
export * from "./base";
|
||||
export * from "./types";
|
||||
|
||||
export type AirtableIntegrationOptions = {
|
||||
/** An ID for this client */
|
||||
@@ -138,12 +131,12 @@ export class Airtable implements TriggerIntegration {
|
||||
}
|
||||
}
|
||||
|
||||
function isAirtableApiError(error: unknown): error is AirtableApiError {
|
||||
function isAirtableApiError(error: unknown): error is AirtableSDK.Error {
|
||||
if (typeof error !== "object" || error === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const airtableError = error as AirtableApiError;
|
||||
const airtableError = error as AirtableSDK.Error;
|
||||
|
||||
return (
|
||||
typeof airtableError.error === "string" &&
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { Prettify } from "@trigger.dev/integration-kit";
|
||||
|
||||
export type AirtableFieldSet = {
|
||||
[key: string]:
|
||||
| undefined
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { EventFilter, IntegrationTaskKey, verifyRequestSignature } from "@trigger.dev/sdk";
|
||||
import AirtableSDK, { Error as AirtableApiError } from "airtable";
|
||||
import AirtableSDK from "airtable";
|
||||
import { z } from "zod";
|
||||
import * as events from "./events";
|
||||
import { Airtable, AirtableRunTask } from "./index";
|
||||
@@ -451,7 +451,7 @@ async function handleWebhookError(response: Response, errorType: string) {
|
||||
const parsedErrorBody = AirtableErrorBodySchema.safeParse(rawErrorBody);
|
||||
|
||||
if (!parsedErrorBody.success) {
|
||||
throw new AirtableApiError(
|
||||
throw new AirtableSDK.Error(
|
||||
`${errorType}_PARSE_ERROR`,
|
||||
`${response.statusText}:\n${rawErrorBody}`,
|
||||
response.status
|
||||
@@ -460,5 +460,5 @@ async function handleWebhookError(response: Response, errorType: string) {
|
||||
|
||||
const { type, message } = parsedErrorBody.data;
|
||||
|
||||
throw new AirtableApiError(type, message ?? response.statusText, response.status);
|
||||
throw new AirtableSDK.Error(type, message ?? response.statusText, response.status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user