Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c04cdfde8c | |||
| 750c1ff1e3 | |||
| 0f9f010206 | |||
| 11f8ff1bb4 | |||
| 85b3352764 | |||
| 9fb8dceef4 | |||
| 0c14e4cdfe | |||
| 2099c6308e | |||
| 08e6cad28a | |||
| f3efcc0c28 | |||
| 37ef335b66 | |||
| 33d555d00e | |||
| 17f6f29d05 | |||
| 08f7c639ef | |||
| 1567239718 | |||
| de652c1dfb | |||
| 1f3733b70f | |||
| b5aea6c534 | |||
| 0769dc4315 | |||
| 5d00fc7cdb | |||
| 00b0c3e02e | |||
| 7e3a82ef47 | |||
| 5dda6cd16c | |||
| 76b7fb2337 | |||
| 68cbfd8d23 | |||
| 41a49f6bb2 |
@@ -22,6 +22,16 @@ jobs:
|
||||
node-version: 18
|
||||
cache: "pnpm"
|
||||
|
||||
- name: ⎔ Setup Deno
|
||||
uses: denoland/setup-deno@v1
|
||||
with:
|
||||
deno-version: v1.x
|
||||
|
||||
- name: ⎔ Setup bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: "1.0.15"
|
||||
|
||||
- name: 📥 Download deps
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"deno.enablePaths": ["references/deno-reference"],
|
||||
"deno.enablePaths": ["references/deno-reference", "runtime_tests/tests/deno"],
|
||||
"debug.toolBarLocation": "commandCenter"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,43 @@
|
||||
# proxy
|
||||
|
||||
## 0.0.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/core@2.3.3
|
||||
|
||||
## 0.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/core@2.3.2
|
||||
|
||||
## 0.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [f3efcc0c]
|
||||
- @trigger.dev/core@2.3.1
|
||||
|
||||
## 0.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17f6f29d]
|
||||
- @trigger.dev/core@2.3.0
|
||||
|
||||
## 0.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/core@2.2.11
|
||||
|
||||
## 0.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/core@2.2.10
|
||||
|
||||
## 0.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "proxy",
|
||||
"version": "0.0.3",
|
||||
"version": "0.0.9",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"deploy": "wrangler deploy",
|
||||
|
||||
@@ -150,7 +150,7 @@ export function RunOverview({ run, trigger, showRerun, paths }: RunOverviewProps
|
||||
<PageInfoProperty
|
||||
icon={"list-numbers"}
|
||||
label={"Execution Count"}
|
||||
value={run.executionCount}
|
||||
value={<>{run.executionCount}</>}
|
||||
/>
|
||||
</PageInfoGroup>
|
||||
<PageInfoGroup alignment="right">
|
||||
|
||||
@@ -8,4 +8,4 @@ export const EXECUTE_JOB_RETRY_LIMIT = 10;
|
||||
export const MAX_RUN_YIELDED_EXECUTIONS = 100;
|
||||
export const RUN_CHUNK_EXECUTION_BUFFER = 350;
|
||||
export const MAX_RUN_CHUNK_EXECUTION_LIMIT = 120000; // 2 minutes
|
||||
export const RESPONSE_TIMEOUT_STATUS_CODES = [408, 504];
|
||||
export const VERCEL_RESPONSE_TIMEOUT_STATUS_CODES = [408, 504];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { RESPONSE_TIMEOUT_STATUS_CODES } from "~/consts";
|
||||
import { VERCEL_RESPONSE_TIMEOUT_STATUS_CODES } from "~/consts";
|
||||
import { prisma } from "~/db.server";
|
||||
import { Prettify } from "~/lib.es5";
|
||||
|
||||
@@ -20,13 +20,33 @@ export async function findEndpoint(id: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export function detectResponseIsTimeout(response?: Response) {
|
||||
export function detectResponseIsTimeout(rawBody: string, response?: Response) {
|
||||
if (!response) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
RESPONSE_TIMEOUT_STATUS_CODES.includes(response.status) ||
|
||||
isResponseVercelTimeout(response) ||
|
||||
isResponseDenoDeployTimeout(rawBody, response) ||
|
||||
isResponseCloudflareTimeout(rawBody, response)
|
||||
);
|
||||
}
|
||||
|
||||
function isResponseCloudflareTimeout(rawBody: string, response: Response) {
|
||||
return (
|
||||
response.status === 503 &&
|
||||
rawBody.includes("Worker exceeded resource limits") &&
|
||||
typeof response.headers.get("cf-ray") === "string"
|
||||
);
|
||||
}
|
||||
|
||||
function isResponseVercelTimeout(response: Response) {
|
||||
return (
|
||||
VERCEL_RESPONSE_TIMEOUT_STATUS_CODES.includes(response.status) ||
|
||||
response.headers.get("x-vercel-error") === "FUNCTION_INVOCATION_TIMEOUT"
|
||||
);
|
||||
}
|
||||
|
||||
function isResponseDenoDeployTimeout(rawBody: string, response: Response) {
|
||||
return response.status === 502 && rawBody.includes("TIME_LIMIT");
|
||||
}
|
||||
|
||||
@@ -43,3 +43,14 @@ export function runBasicStatus(status: JobRunStatus): RunBasicStatus {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function runOriginalStatus(status: JobRunStatus) {
|
||||
switch (status) {
|
||||
case "EXECUTING":
|
||||
case "WAITING_TO_CONTINUE":
|
||||
case "WAITING_TO_EXECUTE":
|
||||
return "STARTED";
|
||||
default:
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PrismaClient, prisma } from "~/db.server";
|
||||
import { z } from "zod";
|
||||
import { PrismaClient, prisma } from "~/db.server";
|
||||
import { DirectionSchema } from "~/routes/_app.orgs.$organizationSlug.projects.$projectParam.jobs.$jobParam._index/route";
|
||||
|
||||
export type Direction = z.infer<typeof DirectionSchema>;
|
||||
@@ -36,6 +36,41 @@ export class RunListPresenter {
|
||||
}: RunListOptions) {
|
||||
const directionMultiplier = direction === "forward" ? 1 : -1;
|
||||
|
||||
// Find the organization that the user is a member of
|
||||
const organization = await this.#prismaClient.organization.findFirstOrThrow({
|
||||
where: {
|
||||
slug: organizationSlug,
|
||||
members: { some: { userId } },
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
// Find the project scoped to the organization
|
||||
const project = await this.#prismaClient.project.findFirstOrThrow({
|
||||
where: {
|
||||
slug: projectSlug,
|
||||
organizationId: organization.id,
|
||||
},
|
||||
});
|
||||
|
||||
// Find all runtimeEnvironments that the user has access to
|
||||
const environments = await this.#prismaClient.runtimeEnvironment.findMany({
|
||||
where: {
|
||||
projectId: project.id,
|
||||
OR: [
|
||||
{ orgMember: { userId } },
|
||||
{ orgMemberId: null },
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
const job = jobSlug ? await this.#prismaClient.job.findFirstOrThrow({
|
||||
where: {
|
||||
slug: jobSlug,
|
||||
projectId: project.id,
|
||||
},
|
||||
}) : undefined;
|
||||
|
||||
const runs = await this.#prismaClient.jobRun.findMany({
|
||||
select: {
|
||||
id: true,
|
||||
@@ -70,26 +105,11 @@ export class RunListPresenter {
|
||||
},
|
||||
},
|
||||
where: {
|
||||
job: jobSlug
|
||||
? {
|
||||
slug: jobSlug,
|
||||
}
|
||||
: undefined,
|
||||
project: {
|
||||
slug: projectSlug,
|
||||
},
|
||||
organization: { slug: organizationSlug, members: { some: { userId } } },
|
||||
environment: {
|
||||
OR: [
|
||||
{
|
||||
orgMember: null,
|
||||
},
|
||||
{
|
||||
orgMember: {
|
||||
userId,
|
||||
},
|
||||
},
|
||||
],
|
||||
jobId: job?.id,
|
||||
projectId: project.id,
|
||||
organizationId: organization.id,
|
||||
environmentId: {
|
||||
in: environments.map((environment) => environment.id),
|
||||
},
|
||||
},
|
||||
orderBy: [{ id: "desc" }],
|
||||
@@ -99,8 +119,8 @@ export class RunListPresenter {
|
||||
skip: cursor ? 1 : 0,
|
||||
cursor: cursor
|
||||
? {
|
||||
id: cursor,
|
||||
}
|
||||
id: cursor,
|
||||
}
|
||||
: undefined,
|
||||
});
|
||||
|
||||
|
||||
+2
-2
@@ -51,7 +51,7 @@ export default function Page() {
|
||||
|
||||
return (
|
||||
<PageContainer>
|
||||
<PageHeader hideBorder>
|
||||
<PageHeader>
|
||||
<PageTitleRow>
|
||||
<PageTitle title={`${project.name} Runs`} />
|
||||
<PageButtons>
|
||||
@@ -64,7 +64,7 @@ export default function Page() {
|
||||
</LinkButton>
|
||||
</PageButtons>
|
||||
</PageTitleRow>
|
||||
<PageDescription>All job runs in this project</PageDescription>
|
||||
<PageDescription>All Job Runs in this project</PageDescription>
|
||||
</PageHeader>
|
||||
|
||||
<PageBody scrollable={false}>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { json } from "@remix-run/server-runtime";
|
||||
import { GetEvent } from "@trigger.dev/core";
|
||||
import { z } from "zod";
|
||||
import { prisma } from "~/db.server";
|
||||
import { runOriginalStatus } from "~/models/jobRun.server";
|
||||
import { authenticateApiRequest } from "~/services/apiAuth.server";
|
||||
import { apiCors } from "~/utils/apiCors";
|
||||
|
||||
@@ -49,7 +50,7 @@ function toJSON(eventRecord: FoundEventRecord): GetEvent {
|
||||
updatedAt: eventRecord.updatedAt,
|
||||
runs: eventRecord.runs.map((run) => ({
|
||||
id: run.id,
|
||||
status: run.status,
|
||||
status: runOriginalStatus(run.status),
|
||||
startedAt: run.startedAt,
|
||||
completedAt: run.completedAt,
|
||||
})),
|
||||
|
||||
@@ -3,6 +3,7 @@ import { json } from "@remix-run/server-runtime";
|
||||
import { JobRunStatusRecordSchema } from "@trigger.dev/core";
|
||||
import { z } from "zod";
|
||||
import { prisma } from "~/db.server";
|
||||
import { runOriginalStatus } from "~/models/jobRun.server";
|
||||
import { authenticateApiRequest } from "~/services/apiAuth.server";
|
||||
import { logger } from "~/services/logger.server";
|
||||
import { apiCors } from "~/utils/apiCors";
|
||||
@@ -66,7 +67,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
|
||||
json({
|
||||
run: {
|
||||
id: run.id,
|
||||
status: run.status,
|
||||
status: runOriginalStatus(run.status),
|
||||
output: run.output,
|
||||
},
|
||||
statuses: parsedStatuses,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
|
||||
import { json } from "@remix-run/server-runtime";
|
||||
import { z } from "zod";
|
||||
import { runOriginalStatus } from "~/models/jobRun.server";
|
||||
import { ApiRunPresenter } from "~/presenters/ApiRunPresenter.server";
|
||||
import { authenticateApiRequest } from "~/services/apiAuth.server";
|
||||
import { apiCors } from "~/utils/apiCors";
|
||||
@@ -79,7 +80,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
|
||||
request,
|
||||
json({
|
||||
id: jobRun.id,
|
||||
status: jobRun.status,
|
||||
status: runOriginalStatus(jobRun.status),
|
||||
startedAt: jobRun.startedAt,
|
||||
updatedAt: jobRun.updatedAt,
|
||||
completedAt: jobRun.completedAt,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Logger } from "@trigger.dev/core-backend";
|
||||
import type { PoolClient } from "pg";
|
||||
import { z } from "zod";
|
||||
import { Logger } from "@trigger.dev/core";
|
||||
import { logger } from "~/services/logger.server";
|
||||
import { NotificationCatalog, NotificationChannel, notificationCatalog } from "./types";
|
||||
import { safeJsonParse } from "~/utils/json";
|
||||
import { NotificationCatalog, NotificationChannel, notificationCatalog } from "./types";
|
||||
|
||||
export class PgListenService {
|
||||
#poolClient: PoolClient;
|
||||
|
||||
@@ -444,6 +444,7 @@ function addStandardRequestOptions(options: RequestInit) {
|
||||
...options.headers,
|
||||
"user-agent": "triggerdotdev-server/2.0.0",
|
||||
"x-trigger-version": API_VERSIONS.LAZY_LOADED_CACHED_TASKS,
|
||||
accept: "application/json",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MAX_RUN_CHUNK_EXECUTION_LIMIT, RESPONSE_TIMEOUT_STATUS_CODES } from "~/consts";
|
||||
import { MAX_RUN_CHUNK_EXECUTION_LIMIT } from "~/consts";
|
||||
import { prisma, PrismaClient } from "~/db.server";
|
||||
import { EndpointApi } from "../endpointApi.server";
|
||||
import { logger } from "../logger.server";
|
||||
@@ -46,8 +46,10 @@ export class ProbeEndpointService {
|
||||
},
|
||||
});
|
||||
|
||||
const rawBody = await response.text();
|
||||
|
||||
// If the response is a 200, or it was a timeout, we can assume the endpoint is up and update the runChunkExecutionLimit
|
||||
if (response.status === 200 || detectResponseIsTimeout(response)) {
|
||||
if (response.status === 200 || detectResponseIsTimeout(rawBody, response)) {
|
||||
await this.#prismaClient.endpoint.update({
|
||||
where: {
|
||||
id,
|
||||
|
||||
@@ -9,7 +9,7 @@ const supabase = new SupabaseManagement({
|
||||
id: "__SLUG__",
|
||||
});
|
||||
|
||||
new Job(client, {
|
||||
client.defineJob({
|
||||
id: "on-new-todos",
|
||||
name: "On New Todos",
|
||||
version: "0.1.1",
|
||||
@@ -32,7 +32,7 @@ const supabase = new SupabaseManagement({
|
||||
apiKey: process.env.SUPABASE_API_KEY!,
|
||||
});
|
||||
|
||||
new Job(client, {
|
||||
client.defineJob({
|
||||
id: "on-new-todos",
|
||||
name: "On New Todos",
|
||||
version: "0.1.1",
|
||||
@@ -136,7 +136,7 @@ const supabase = new Supabase<Database>({
|
||||
supabaseKey: process.env.SUPABASE_API_KEY!,
|
||||
});
|
||||
|
||||
new Job(client, {
|
||||
client.defineJob({
|
||||
id: "on-new-users",
|
||||
name: "On New Users",
|
||||
version: "0.1.1",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { LogLevel } from "@trigger.dev/core";
|
||||
import { Logger } from "@trigger.dev/core";
|
||||
import type { LogLevel } from "@trigger.dev/core-backend";
|
||||
import { Logger } from "@trigger.dev/core-backend";
|
||||
import { sensitiveDataReplacer } from "./sensitiveDataReplacer";
|
||||
import { AsyncLocalStorage } from "async_hooks";
|
||||
|
||||
|
||||
@@ -202,9 +202,14 @@ export class PerformRunExecutionV3Service {
|
||||
forceYieldCoordinator.deregisterRun(run.id);
|
||||
|
||||
if (!response) {
|
||||
return await this.#failRunExecutionWithRetry(run, input.lastAttempt, {
|
||||
message: `Connection could not be established to the endpoint (${run.endpoint.url})`,
|
||||
});
|
||||
return await this.#failRunExecutionWithRetry(
|
||||
run,
|
||||
input.lastAttempt,
|
||||
{
|
||||
message: `Connection could not be established to the endpoint (${run.endpoint.url})`,
|
||||
},
|
||||
durationInMs
|
||||
);
|
||||
}
|
||||
|
||||
// Update the endpoint version if it has changed
|
||||
@@ -285,6 +290,8 @@ export class PerformRunExecutionV3Service {
|
||||
status: response.status,
|
||||
runId: run.id,
|
||||
endpoint: run.endpoint.url,
|
||||
headers: rawHeaders,
|
||||
rawBody,
|
||||
});
|
||||
|
||||
const errorBody = safeJsonZodParse(errorParser, rawBody);
|
||||
@@ -294,7 +301,12 @@ export class PerformRunExecutionV3Service {
|
||||
if (response.status >= 400 && response.status <= 499) {
|
||||
return await this.#failRunExecution(this.#prismaClient, run, errorBody.data);
|
||||
} else {
|
||||
return await this.#failRunExecutionWithRetry(run, input.lastAttempt, errorBody.data);
|
||||
return await this.#failRunExecutionWithRetry(
|
||||
run,
|
||||
input.lastAttempt,
|
||||
errorBody.data,
|
||||
durationInMs
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +323,7 @@ export class PerformRunExecutionV3Service {
|
||||
);
|
||||
} else {
|
||||
// If the error is a timeout, we should mark this execution as succeeded (by not throwing an error) and enqueue a new execution
|
||||
if (detectResponseIsTimeout(response)) {
|
||||
if (detectResponseIsTimeout(rawBody, response)) {
|
||||
return await this.#resumeRunExecutionAfterTimeout(
|
||||
this.#prismaClient,
|
||||
run,
|
||||
@@ -319,9 +331,14 @@ export class PerformRunExecutionV3Service {
|
||||
durationInMs
|
||||
);
|
||||
} else {
|
||||
return await this.#failRunExecutionWithRetry(run, input.lastAttempt, {
|
||||
message: `Endpoint responded with ${response.status} status code`,
|
||||
});
|
||||
return await this.#failRunExecutionWithRetry(
|
||||
run,
|
||||
input.lastAttempt,
|
||||
{
|
||||
message: `Endpoint responded with ${response.status} status code`,
|
||||
},
|
||||
durationInMs
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -834,6 +851,7 @@ export class PerformRunExecutionV3Service {
|
||||
],
|
||||
},
|
||||
forceYieldImmediately: false,
|
||||
status: "WAITING_TO_EXECUTE",
|
||||
},
|
||||
select: {
|
||||
executionCount: true,
|
||||
@@ -995,6 +1013,9 @@ export class PerformRunExecutionV3Service {
|
||||
executionDuration: {
|
||||
increment: durationInMs,
|
||||
},
|
||||
executionCount: {
|
||||
increment: 1,
|
||||
},
|
||||
endpoint: {
|
||||
update: {
|
||||
// Never allow the execution limit to be less than 10 seconds or more than MAX_RUN_CHUNK_EXECUTION_LIMIT
|
||||
@@ -1005,6 +1026,7 @@ export class PerformRunExecutionV3Service {
|
||||
},
|
||||
},
|
||||
forceYieldImmediately: false,
|
||||
status: "WAITING_TO_EXECUTE",
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1016,20 +1038,31 @@ export class PerformRunExecutionV3Service {
|
||||
async #failRunExecutionWithRetry(
|
||||
run: FoundRun,
|
||||
lastAttempt: boolean,
|
||||
output: Record<string, any>
|
||||
output: Record<string, any>,
|
||||
durationInMs: number = 0
|
||||
): Promise<void> {
|
||||
if (lastAttempt) {
|
||||
return await this.#failRunExecution(this.#prismaClient, run, output);
|
||||
}
|
||||
|
||||
await this.#prismaClient.jobRun.update({
|
||||
const updatedJob = await this.#prismaClient.jobRun.update({
|
||||
where: { id: run.id },
|
||||
data: {
|
||||
status: "WAITING_TO_EXECUTE",
|
||||
executionFailureCount: {
|
||||
increment: 1,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
throw new Error(JSON.stringify(output));
|
||||
if (updatedJob.executionFailureCount >= 10) {
|
||||
return await this.#failRunExecution(this.#prismaClient, run, output);
|
||||
}
|
||||
|
||||
// Use the job.executionFailureCount to determine how long to wait before retrying, using an exponential backoff
|
||||
const runAt = new Date(Date.now() + Math.pow(1.5, updatedJob.executionFailureCount) * 500); // 500ms, 750ms, 1125ms, 1687ms, 2531ms, 3796ms, 5694ms, 8541ms, 12812ms, 19218ms
|
||||
|
||||
await ResumeRunService.enqueue(run, this.#prismaClient, runAt);
|
||||
}
|
||||
|
||||
async #failRunExecution(
|
||||
@@ -1050,6 +1083,9 @@ export class PerformRunExecutionV3Service {
|
||||
executionDuration: {
|
||||
increment: durationInMs,
|
||||
},
|
||||
executionCount: {
|
||||
increment: 1,
|
||||
},
|
||||
tasks: {
|
||||
updateMany: {
|
||||
where: {
|
||||
|
||||
@@ -214,8 +214,8 @@ export class PerformTaskOperationService {
|
||||
const abortController = new AbortController();
|
||||
|
||||
// calculate the actual timeout. If timeoutInMs is undefined, we use the default of 120s
|
||||
// Also make sure the timeout is at least 1s, but not bigger than 120s
|
||||
const actualTimeoutInMs = Math.min(Math.max(timeout?.durationInMs ?? 120000, 1000), 120000);
|
||||
// Also make sure the timeout is at least 1s, but not bigger than 300s
|
||||
const actualTimeoutInMs = Math.min(Math.max(timeout?.durationInMs ?? 120000, 1000), 300000);
|
||||
|
||||
const timeoutId = setTimeout(() => {
|
||||
abortController.abort();
|
||||
|
||||
@@ -1,19 +1,37 @@
|
||||
{
|
||||
"extends": "./node18.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["DOM", "DOM.Iterable", "ES2019"],
|
||||
"lib": [
|
||||
"DOM",
|
||||
"DOM.Iterable",
|
||||
"ES2019"
|
||||
],
|
||||
"paths": {
|
||||
"@trigger.dev/tsup/*": ["../../config-packages/tsup/src/*"],
|
||||
"@trigger.dev/tsup": ["../../config-packages/tsup/src/index"],
|
||||
"@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"],
|
||||
"@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"],
|
||||
"@trigger.dev/integration-kit/*": ["../../packages/integration-kit/src/*"],
|
||||
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"]
|
||||
"@trigger.dev/tsup/*": [
|
||||
"../../config-packages/tsup/src/*"
|
||||
],
|
||||
"@trigger.dev/tsup": [
|
||||
"../../config-packages/tsup/src/index"
|
||||
],
|
||||
"@trigger.dev/sdk/*": [
|
||||
"../../packages/trigger-sdk/src/*"
|
||||
],
|
||||
"@trigger.dev/sdk": [
|
||||
"../../packages/trigger-sdk/src/index"
|
||||
],
|
||||
"@trigger.dev/integration-kit/*": [
|
||||
"../../packages/integration-kit/src/*"
|
||||
],
|
||||
"@trigger.dev/integration-kit": [
|
||||
"../../packages/integration-kit/src/index"
|
||||
]
|
||||
},
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
"baseUrl": ".",
|
||||
"stripInternal": true
|
||||
},
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
@@ -3,7 +3,17 @@
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"dependencies": {
|
||||
"esbuild": "^0.19.2",
|
||||
"tsup": "^8.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tsup": "7.1.x"
|
||||
"@types/node": "18",
|
||||
"typescript": "^5.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
export { defineConfig } from "tsup";
|
||||
export { deepMergeOptions } from "./utils";
|
||||
export { options as integrationOptions } from "./integration";
|
||||
export { options as packageOptions, defineConfig as defineConfigPackage } from "./package";
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import { Plugin } from "esbuild";
|
||||
import { Options, defineConfig as defineConfigTSUP } from "tsup";
|
||||
|
||||
const restoreNodeProtocolPlugin = (): Plugin => {
|
||||
return {
|
||||
name: "node-protocol-plugin-restorer",
|
||||
setup(build) {
|
||||
build.onResolve(
|
||||
{
|
||||
filter: /node:/,
|
||||
},
|
||||
async (args) => {
|
||||
return { path: args.path, external: true };
|
||||
}
|
||||
);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const options: Options = {
|
||||
name: "main",
|
||||
config: "tsconfig.json",
|
||||
entry: ["./src/index.ts"],
|
||||
outDir: "./dist",
|
||||
platform: "node",
|
||||
format: ["cjs", "esm"],
|
||||
legacyOutput: false,
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
dts: true,
|
||||
treeshake: {
|
||||
preset: "recommended",
|
||||
},
|
||||
esbuildPlugins: [restoreNodeProtocolPlugin()],
|
||||
};
|
||||
|
||||
export const defineConfig = defineConfigTSUP(options);
|
||||
@@ -5,15 +5,15 @@ To begin, install the necessary packages in your Remix project directory. You ca
|
||||
<CodeGroup>
|
||||
|
||||
```bash npm
|
||||
npm i @trigger.dev/sdk @trigger.dev/remix
|
||||
npm i @trigger.dev/sdk@latest @trigger.dev/remix@latest
|
||||
```
|
||||
|
||||
```bash pnpm
|
||||
pnpm install @trigger.dev/sdk @trigger.dev/remix
|
||||
pnpm install @trigger.dev/sdk@latest @trigger.dev/remix@latest
|
||||
```
|
||||
|
||||
```bash yarn
|
||||
yarn add @trigger.dev/sdk @trigger.dev/remix
|
||||
yarn add @trigger.dev/sdk@latest @trigger.dev/remix@latest
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
@@ -0,0 +1,433 @@
|
||||
---
|
||||
title: "Hono Quick Start"
|
||||
sidebarTitle: "Hono.dev"
|
||||
description: "Start creating Jobs in 5 minutes in your Hono project."
|
||||
icon: "fire"
|
||||
---
|
||||
|
||||
Hono is a fast & lightweight web framework built on top of Web Standards, and we support using Hono with Trigger.dev on Cloudflare Workers, Bun, Deno, and Node.js.
|
||||
|
||||
## Installing Required Packages
|
||||
|
||||
To begin, install the necessary packages in your Hono project:
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash npm
|
||||
npm add @trigger.dev/sdk@latest @trigger.dev/hono@latest
|
||||
```
|
||||
|
||||
```bash pnpm
|
||||
pnpm add @trigger.dev/sdk@latest @trigger.dev/hono@latest
|
||||
```
|
||||
|
||||
```bash yarn
|
||||
yarn add @trigger.dev/sdk@latest @trigger.dev/hono@latest
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
## Obtain the Development Server API Key
|
||||
|
||||
To locate your development Server API key, login to the [Trigger.dev
|
||||
dashboard](https://cloud.trigger.dev) and select the Project you want to
|
||||
connect to. Then click on the **Environments & API Keys** tab in the left menu.
|
||||
You can copy your development Server API Key from the field at the top of this page.
|
||||
(Your development key will start with `tr_dev_`).
|
||||
|
||||
## Configure Environment Variables
|
||||
|
||||
Add the following environment variables to your `.env` file (or `.dev.vars` file if you are using Cloudflare Workers):
|
||||
|
||||
```bash
|
||||
TRIGGER_API_KEY=<development server api key>
|
||||
TRIGGER_API_URL=https://api.trigger.dev # change this if you are self-hosting
|
||||
```
|
||||
|
||||
Replace `<development server api key>` with the actual API key obtained from the previous step.
|
||||
|
||||
## Enable Node.js compatibility
|
||||
|
||||
If you are using Cloudflare Workers, you'll need to enable Node.js compatibility mode in your `wrangler.toml` file:
|
||||
|
||||
```toml
|
||||
compatibility_flags = ["nodejs_compat"]
|
||||
```
|
||||
|
||||
## Add Middelware to Your Hono app
|
||||
|
||||
Our `@trigger.dev/hono` package provides two different ways of configuring the necessary middleware needed to connect your Hono app to Trigger.dev. `addMiddleware` which should be used for Cloudflare Workers, and `createMiddleware` which can be used with Bun, Deno, and Node.js.
|
||||
|
||||
### Cloudflare Workers
|
||||
|
||||
Becase environment variables in Cloudflare Workers aren't available in the global scope, but are instead available only inside the fetch handler, we need to use the `addMiddleware` function to add the necessary middleware to your Hono app.
|
||||
|
||||
```ts
|
||||
import { Hono } from "hono";
|
||||
import { addMiddleware } from "@trigger.dev/hono";
|
||||
import { TriggerClient } from "@trigger.dev/sdk";
|
||||
|
||||
const app = new Hono<{
|
||||
Bindings: {
|
||||
TRIGGER_API_KEY: string;
|
||||
TRIGGER_API_URL: string;
|
||||
};
|
||||
}>();
|
||||
|
||||
addMiddleware(app, (env) => {
|
||||
const client = new TriggerClient({
|
||||
id: "hono-client",
|
||||
apiKey: env.TRIGGER_API_KEY,
|
||||
apiUrl: env.TRIGGER_API_URL,
|
||||
});
|
||||
|
||||
return client;
|
||||
});
|
||||
|
||||
// Your other routes here
|
||||
|
||||
export default app;
|
||||
```
|
||||
|
||||
The second argument to `addMiddleware` is a function that receives the environment variables (either from `.dev.vars` in development or from Cloudflare when deployed), and returns a `TriggerClient` instance. This function will be called once per request.
|
||||
|
||||
If you want, you can extract our the function that creates the `TriggerClient` instance into a separate file, and import it into your `index.ts` file:
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```ts trigger-client.ts
|
||||
import { TriggerClient } from "@trigger.dev/sdk";
|
||||
|
||||
export function triggerClient(apiKey: string, apiUrl: string) {
|
||||
const client = new TriggerClient({
|
||||
id: "hono-client",
|
||||
apiKey,
|
||||
apiUrl,
|
||||
});
|
||||
|
||||
return client;
|
||||
}
|
||||
```
|
||||
|
||||
```ts index.ts
|
||||
import { Hono } from "hono";
|
||||
import { addMiddleware } from "@trigger.dev/hono";
|
||||
import { triggerClient } from "./trigger-client";
|
||||
|
||||
const app = new Hono<{
|
||||
Bindings: {
|
||||
TRIGGER_API_KEY: string;
|
||||
TRIGGER_API_URL: string;
|
||||
};
|
||||
}>();
|
||||
|
||||
addMiddleware(app, (env) => triggerClient(env.TRIGGER_API_KEY, env.TRIGGER_API_URL));
|
||||
|
||||
// Your other routes here
|
||||
|
||||
export default app;
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
Now that you've created the `TriggerClient` and setup the middleware, you can add your first job:
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```ts trigger-client.ts
|
||||
import { TriggerClient } from "@trigger.dev/sdk";
|
||||
import { exampleJob } from "./jobs";
|
||||
|
||||
export function triggerClient(apiKey: string, apiUrl: string) {
|
||||
const client = new TriggerClient({
|
||||
id: "hono-client",
|
||||
apiKey,
|
||||
apiUrl,
|
||||
});
|
||||
|
||||
exampleJob.attachToClient(client);
|
||||
|
||||
return client;
|
||||
}
|
||||
```
|
||||
|
||||
```ts jobs.ts
|
||||
import { Job, invokeTrigger } from "@trigger.dev/sdk";
|
||||
|
||||
export const exampleJob = new Job({
|
||||
id: "example-job",
|
||||
name: "Example Job",
|
||||
version: "0.0.1",
|
||||
trigger: invokeTrigger(),
|
||||
run: async (payload, io, ctx) => {
|
||||
await io.logger.info("Hello world!", { payload });
|
||||
|
||||
return {
|
||||
message: "Hello world!",
|
||||
};
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
As you can see above in `jobs.ts`, we define our first job using the `new Job` constructor from `@trigger.dev/sdk`, and then in `trigger-client.ts` we attach the job to the `TriggerClient` instance.
|
||||
|
||||
### Bun
|
||||
|
||||
If you are using Bun, you can use the `createMiddleware` function to create the necessary middleware to connect your Hono app to Trigger.dev and define your `TriggerClient` and jobs in the global scope:
|
||||
|
||||
```ts
|
||||
import { createMiddleware } from "@trigger.dev/hono";
|
||||
import { TriggerClient, invokeTrigger } from "@trigger.dev/sdk";
|
||||
import { Hono } from "hono";
|
||||
|
||||
const app = new Hono();
|
||||
|
||||
const client = new TriggerClient({
|
||||
id: "hono-client",
|
||||
apiKey: Bun.env.TRIGGER_API_KEY, // Bun.env is available in the global scope
|
||||
apiUrl: Bun.env.TRIGGER_API_URL, // Bun.env is available in the global scope
|
||||
});
|
||||
|
||||
client.defineJob({
|
||||
id: "example-job",
|
||||
name: "Example Job",
|
||||
version: "0.0.1",
|
||||
trigger: invokeTrigger(),
|
||||
run: async (payload, io, ctx) => {
|
||||
await io.logger.info("Hello world!", { payload });
|
||||
|
||||
return {
|
||||
message: "Hello world!",
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
app.use("/api/trigger", createMiddleware(client));
|
||||
|
||||
// The rest of your routes here
|
||||
|
||||
export default app;
|
||||
```
|
||||
|
||||
### Deno
|
||||
|
||||
Deno works similarly to Bun, but the imports are slightly different. First, import the `@trigger.dev/sdk` and `@trigger.dev/hono` packages using [npm: specifiers](https://docs.deno.com/runtime/manual/node/npm_specifiers)
|
||||
|
||||
```ts index.ts
|
||||
import { createMiddleware } from "npm:@trigger.dev/hono@latest";
|
||||
import { TriggerClient, invokeTrigger } from "npm:@trigger.dev/sdk@latest";
|
||||
import { Hono } from "npm:hono"; // Make sure to use the npm specifier for hono as well
|
||||
```
|
||||
|
||||
Deno doesn't automatically load environment variables from a `.env` file, so you'll need to load them manually using the `dotenv` package:
|
||||
|
||||
```ts index.ts
|
||||
import { load } from "https://deno.land/std@0.208.0/dotenv/mod.ts";
|
||||
const env = await load();
|
||||
```
|
||||
|
||||
Now we can create the `TriggerClient`, define our jobs, and create the middleware:
|
||||
|
||||
```ts index.ts
|
||||
const app = new Hono();
|
||||
|
||||
const client = new TriggerClient({
|
||||
id: "hono-client",
|
||||
apiKey: env["TRIGGER_API_KEY"],
|
||||
apiUrl: env["TRIGGER_API_URL"],
|
||||
});
|
||||
|
||||
client.defineJob({
|
||||
id: "example-job",
|
||||
name: "Example Job",
|
||||
version: "0.0.1",
|
||||
trigger: invokeTrigger(),
|
||||
run: async (payload, io, ctx) => {
|
||||
await io.logger.info("Hello world!", { payload });
|
||||
|
||||
return {
|
||||
message: "Hello world!",
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
app.use("/api/trigger", createMiddleware(client));
|
||||
|
||||
// The rest of your routes here
|
||||
|
||||
Deno.serve(app.fetch);
|
||||
```
|
||||
|
||||
### Node.js
|
||||
|
||||
Node.js works very similarly to Deno and Bun, in that you can define the `TriggerClient` and jobs in the global scope, and then create the middleware and add it to your Hono app:
|
||||
|
||||
```ts index.ts
|
||||
import "dotenv/config";
|
||||
import { serve } from "@hono/node-server";
|
||||
import { Hono } from "hono";
|
||||
import { createMiddleware } from "@trigger.dev/hono";
|
||||
import { TriggerClient, invokeTrigger } from "@trigger.dev/sdk";
|
||||
|
||||
const app = new Hono();
|
||||
|
||||
const client = new TriggerClient({
|
||||
id: "hono-client",
|
||||
apiKey: process.env.TRIGGER_API_KEY!,
|
||||
apiUrl: process.env.TRIGGER_API_URL!,
|
||||
});
|
||||
|
||||
client.defineJob({
|
||||
id: "example-job",
|
||||
name: "Example Job",
|
||||
version: "0.0.1",
|
||||
trigger: invokeTrigger(),
|
||||
run: async (payload, io, ctx) => {
|
||||
await io.logger.info("Hello world!", { payload });
|
||||
|
||||
return {
|
||||
message: "Hello world!",
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
app.use("/api/trigger", createMiddleware(client));
|
||||
|
||||
// Your other routes here
|
||||
|
||||
serve(app, (info) => {
|
||||
console.log(`Listening on port ${info.port}`);
|
||||
});
|
||||
```
|
||||
|
||||
## Running
|
||||
|
||||
### Cloudflare Workers
|
||||
|
||||
Run your Hono app locally, like you normally would. For example:
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash npm
|
||||
npm run dev
|
||||
```
|
||||
|
||||
```bash pnpm
|
||||
pnpm run dev
|
||||
```
|
||||
|
||||
```bash yarn
|
||||
yarn run dev
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
In a **_separate terminal window or tab_** run:
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash npm
|
||||
npx @trigger.dev/cli@latest dev --client-id hono-client -p 8787 -H localhost
|
||||
```
|
||||
|
||||
```bash pnpm
|
||||
pnpm dlx @trigger.dev/cli@latest dev --client-id hono-client -p 8787 -H localhost
|
||||
```
|
||||
|
||||
```bash yarn
|
||||
yarn dlx @trigger.dev/cli@latest dev --client-id hono-client -p 8787 -H localhost
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
### Bun
|
||||
|
||||
Run your Hono app locally, like you normally would. For example:
|
||||
|
||||
```bash
|
||||
bun run index.ts
|
||||
```
|
||||
|
||||
In a **_separate terminal window or tab_** run:
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash npm
|
||||
npx @trigger.dev/cli@latest dev --client-id hono-client -p 8787 -H localhost
|
||||
```
|
||||
|
||||
```bash pnpm
|
||||
pnpm dlx @trigger.dev/cli@latest dev --client-id hono-client -p 8787 -H localhost
|
||||
```
|
||||
|
||||
```bash yarn
|
||||
yarn dlx @trigger.dev/cli@latest dev --client-id hono-client -p 8787 -H localhost
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
### Deno
|
||||
|
||||
Run your Hono app locally, like you normally would. For example:
|
||||
|
||||
```bash
|
||||
deno run --allow-net --allow-read --watch index.ts
|
||||
```
|
||||
|
||||
In a **_separate terminal window or tab_** run:
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash npm
|
||||
npx @trigger.dev/cli@latest dev --client-id hono-client -p 8000 -H 127.0.0.1
|
||||
```
|
||||
|
||||
```bash pnpm
|
||||
pnpm dlx @trigger.dev/cli@latest dev --client-id hono-client -p 8000 -H 127.0.0.1
|
||||
```
|
||||
|
||||
```bash yarn
|
||||
yarn dlx @trigger.dev/cli@latest dev --client-id hono-client -p 8000 -H 127.0.0.1
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
### Node.js
|
||||
|
||||
Run your Hono app locally, like you normally would. For example:
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash npm
|
||||
npm run dev
|
||||
```
|
||||
|
||||
```bash pnpm
|
||||
pnpm run dev
|
||||
```
|
||||
|
||||
```bash yarn
|
||||
yarn run dev
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
In a **_separate terminal window or tab_** run:
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash npm
|
||||
npx @trigger.dev/cli@latest dev --client-id hono-client -p 8787
|
||||
```
|
||||
|
||||
```bash pnpm
|
||||
pnpm dlx @trigger.dev/cli@latest dev --client-id hono-client -p 8787
|
||||
```
|
||||
|
||||
```bash yarn
|
||||
yarn dlx @trigger.dev/cli@latest dev --client-id hono-client -p 8787
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
@@ -4,18 +4,17 @@ description: "Jobs and code examples you can use to get started."
|
||||
---
|
||||
|
||||
<CardGroup>
|
||||
<Card title="API catalog with code samples" icon="code" href="https://trigger.dev/apis">
|
||||
Find code examples for the API you need that you can copy and paste into your projects.
|
||||
</Card>
|
||||
<Card
|
||||
title="Browse our Jobs Showcase"
|
||||
title="Browse our Project Showcase"
|
||||
icon="rocket-launch"
|
||||
href="https://trigger.dev/showcase"
|
||||
color="#EC4899"
|
||||
>
|
||||
The showcase is our library of Jobs. Use them as they are, right out of the box, or customize
|
||||
them to suit your needs.
|
||||
</Card>
|
||||
<Card title="API catalog with code samples" icon="code" href="https://trigger.dev/apis">
|
||||
Find code examples for the API you need that you can copy and paste into your
|
||||
projects.
|
||||
Our library of full-stack projects. A great place to learn more and find inspiration for your
|
||||
next project.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -27,9 +26,10 @@ To run them, simply follow the instructions in the README files linked below.
|
||||
|
||||
| Project Name | Description | Integrations | Author | Status |
|
||||
| ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | ------ |
|
||||
| [OpenAI text summarizer](https://github.com/triggerdotdev/examples/tree/main/openai-text-summarizer) | An app which uses OpenAI to summarize an article and then post the result to Slack. | [OpenAI](https://trigger.dev/docs/integrations/apis/openai) [Slack](https://trigger.dev/docs/integrations/apis/slack) | Trigger.dev | ✅ |
|
||||
| [Supabase onboarding emails](https://github.com/triggerdotdev/examples/tree/main/supabase-onboarding-emails) | When a user signs up and confirms their email address, they will receive 3 "onboarding" emails over 2 days using Resend.com and Trigger.dev | [Supabase](https://trigger.dev/docs/integrations/apis/supabase) [Resend](https://trigger.dev/docs/integrations/apis/resend) | Trigger.dev | ✅ |
|
||||
| [OpenAI text summarizer](https://trigger.dev/showcase/projects/openai-text-summarizer) | An app which uses OpenAI to summarize an article and then post the result to Slack. | [OpenAI](https://trigger.dev/docs/integrations/apis/openai) [Slack](https://trigger.dev/docs/integrations/apis/slack) | Trigger.dev | ✅ |
|
||||
| [Supabase onboarding emails](https://trigger.dev/showcase/projects/supabase-onboarding-emails) | When a user signs up and confirms their email address, they will receive 3 "onboarding" emails over 2 days using Resend.com and Trigger.dev | [Supabase](https://trigger.dev/docs/integrations/apis/supabase) [Resend](https://trigger.dev/docs/integrations/apis/resend) | Trigger.dev | ✅ |
|
||||
| [Generate presentation titles using OpenAI](https://github.com/triggerdotdev/examples/tree/main/express-vanilla) | Generate presentation titles using OpenAI background jobs with Node.js, Express and Trigger.dev | [OpenAI](https://trigger.dev/docs/integrations/apis/openai) | [lirantal](https://github.com/lirantal) | ✅ |
|
||||
| [Send a basic email with Resend](https://github.com/triggerdotdev/examples/tree/main/resend-email-form) | Send a basic email from a form with Resend | [Resend](https://trigger.dev/docs/integrations/apis/resend) | Trigger.dev | ✅ |
|
||||
| [Send a basic email with Resend](https://trigger.dev/showcase/projects/resend-email-form) | Send a basic email from a form with Resend | [Resend](https://trigger.dev/docs/integrations/apis/resend) | Trigger.dev | ✅ |
|
||||
| [AI changelog generator](https://autochangelog.dev/) | Generates a changelog from your GitHub commits using OpenAI | [OpenAI](https://trigger.dev/docs/integrations/apis/openai) [GitHub](https://trigger.dev/docs/integrations/apis/github) | Trigger.dev | ✅ |
|
||||
| [AI avatar generator](https://trigger.dev/showcase/projects/avatar-generator) | Turn yourself into a superhero using AI | [OpenAI](https://trigger.dev/docs/integrations/apis/openai) | Trigger.dev | ✅ |
|
||||
| AI landing page copy generator | Copies your site and generates new copy using OpenAI | [OpenAI](https://trigger.dev/docs/integrations/apis/openai) | Trigger.dev | 🛠️ |
|
||||
| AI changelog generator | Generates a changelog from your GitHub commits using OpenAI | [OpenAI](https://trigger.dev/docs/integrations/apis/openai) [GitHub](https://trigger.dev/docs/integrations/apis/github) | Trigger.dev | 🛠️ |
|
||||
|
||||
@@ -161,3 +161,4 @@ client.defineJob({
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@@ -7,14 +7,6 @@ sidebarTitle: Overview & authentication
|
||||
|
||||
Our Airtable integration allows you to easily connect to the Airtable API and perform tasks such as creating / updating / deleting single or multiple records in your tables.
|
||||
|
||||
<Card
|
||||
title="Jobs Showcase - Airtable"
|
||||
icon="rocket"
|
||||
href="https://trigger.dev/showcase?tags=&apis=airtable"
|
||||
>
|
||||
Check out pre-built Airtable jobs in our showcase.
|
||||
</Card>
|
||||
|
||||
## Installation
|
||||
|
||||
To get started with our Airtable integration, you need to install the `@trigger.dev/airtable` packages. You can do this using `npm`, `pnpm`, or `yarn`:
|
||||
@@ -70,6 +62,14 @@ const airtable = new Airtable({
|
||||
|
||||
Once you have set up a Airtable client, you can use it to create tasks.
|
||||
|
||||
{" "}
|
||||
|
||||
<Card title="Tasks" icon="sparkles" href="/integrations/apis/airtable-tasks">
|
||||
Perform tasks such as creating / updating / deleting single or multiple records in table.
|
||||
</Card>
|
||||
|
||||
## Example jobs
|
||||
|
||||
<Card title="Code examples" icon="code" href="https://trigger.dev/apis/airtable">
|
||||
Check out pre-built jobs using Airtable in our API section.
|
||||
</Card>
|
||||
|
||||
@@ -7,14 +7,6 @@ sidebarTitle: Overview & authentication
|
||||
|
||||
Our GitHub integration allows you to create triggers and tasks that interact with GitHub. Trigger jobs when events happen, like when a new issue is added to a repo, or when a pull request is opened, etc. You can also perform tasks like creating issues, getting information about a repo, adding comments, and much more.
|
||||
|
||||
<Card
|
||||
title="Jobs Showcase - GitHub"
|
||||
icon="rocket"
|
||||
href="https://trigger.dev/showcase?tags=&apis=github"
|
||||
>
|
||||
Check out pre-built GitHub jobs in our showcase.
|
||||
</Card>
|
||||
|
||||
## Installing the GitHub packages
|
||||
|
||||
To get started with our GitHub integration, you need to install the `@trigger.dev/github` packages. You can do this using `npm`, `pnpm`, or `yarn`:
|
||||
@@ -80,3 +72,9 @@ Once you have set up a GitHub client, you can use it to create triggers and task
|
||||
Perform tasks such as creating a new issue or a new comment.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Example jobs
|
||||
|
||||
<Card title="Code examples" icon="code" href="https://trigger.dev/apis/github">
|
||||
Check out pre-built jobs using GitHub in our API section.
|
||||
</Card>
|
||||
|
||||
@@ -463,3 +463,9 @@ client.defineJob({
|
||||
| `createProjectMilestone` | Creates a project milestone. |
|
||||
| `issuePriorityValues` | Gets issue priority values and labels. |
|
||||
| `viewer` | Gets the currently authenticated user. |
|
||||
|
||||
## Example jobs
|
||||
|
||||
<Card title="Code examples" icon="code" href="https://trigger.dev/apis/linear">
|
||||
Check out pre-built jobs using Linear in our API section.
|
||||
</Card>
|
||||
|
||||
@@ -7,14 +7,6 @@ sidebarTitle: Overview & authentication
|
||||
|
||||
Our OpenAI integration allows you to easily perform AI-powered tasks, such as summarizing text, answering questions, generating images, fine tuning and much more.
|
||||
|
||||
<Card
|
||||
title="Jobs Showcase - OpenAI"
|
||||
icon="rocket"
|
||||
href="https://trigger.dev/showcase?tags=&apis=openai"
|
||||
>
|
||||
Check out pre-built OpenAI jobs in our showcase.
|
||||
</Card>
|
||||
|
||||
## Installing the OpenAI packages
|
||||
|
||||
<CodeGroup>
|
||||
@@ -173,3 +165,9 @@ client.defineJob({
|
||||
And you'll get the same experience in the Run Dashboard when viewing the logs:
|
||||
|
||||

|
||||
|
||||
## Example jobs
|
||||
|
||||
<Card title="Code examples" icon="code" href="https://trigger.dev/apis/openai">
|
||||
Check out pre-built jobs using OpenAI in our API section.
|
||||
</Card>
|
||||
|
||||
@@ -8,14 +8,6 @@ sidebarTitle: Overview & authentication
|
||||
Plain is the customer support tool for technical teams and products.
|
||||
It aims to bring engineering and customer service teams together by creating a modern opinionated platform that's fantastic to build with.
|
||||
|
||||
<Card
|
||||
title="Jobs Showcase - Plain"
|
||||
icon="rocket"
|
||||
href="https://trigger.dev/showcase?tags=&apis=plain"
|
||||
>
|
||||
Check out pre-built Plain jobs in our showcase.
|
||||
</Card>
|
||||
|
||||
## Installing the Plain packages
|
||||
|
||||
<CodeGroup>
|
||||
@@ -56,3 +48,9 @@ Once you have set up a Plain client, you can use it to create tasks.
|
||||
Perform tasks such as creating/updating customers and adding timeline entries.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Example jobs
|
||||
|
||||
<Card title="Code examples" icon="code" href="https://trigger.dev/apis/plain">
|
||||
Check out pre-built jobs using Plain in our API section.
|
||||
</Card>
|
||||
|
||||
@@ -168,3 +168,9 @@ client.defineJob({
|
||||
| `paginate` | Pagination helper that returns an async generator. |
|
||||
| `request` | Sends authenticated requests to the Replicate API. |
|
||||
| `run` | Creates and waits for a prediction. |
|
||||
|
||||
## Example jobs
|
||||
|
||||
<Card title="Code examples" icon="code" href="https://trigger.dev/apis/replicate">
|
||||
Check out pre-built jobs using Replicate in our API section.
|
||||
</Card>
|
||||
|
||||
@@ -7,14 +7,6 @@ sidebarTitle: Overview & authentication
|
||||
|
||||
Resend is the email API for developers. With our Resend integration you can send email campaigns, transactional emails, and automated emails (drip campaigns) from your app.
|
||||
|
||||
<Card
|
||||
title="Jobs Showcase - Resend"
|
||||
icon="rocket"
|
||||
href="https://trigger.dev/showcase?tags=&apis=resend"
|
||||
>
|
||||
Check out pre-built Resend jobs in our showcase.
|
||||
</Card>
|
||||
|
||||
## Installing the Resend packages
|
||||
|
||||
To get started with our Resend integration, you need to install the `@trigger.dev/resend` packages. You can do this using `npm`, `pnpm`, or `yarn`:
|
||||
@@ -55,3 +47,9 @@ Once you have set up a Resend client, you can use it to create tasks.
|
||||
<Card title="Tasks" icon="sparkles" href="/integrations/apis/resend-tasks">
|
||||
Send emails with Resend.
|
||||
</Card>
|
||||
|
||||
## Example jobs
|
||||
|
||||
<Card title="Code examples" icon="code" href="https://trigger.dev/apis/resend">
|
||||
Check out pre-built jobs using Resend in our API section.
|
||||
</Card>
|
||||
|
||||
@@ -7,14 +7,6 @@ sidebarTitle: Overview & authentication
|
||||
|
||||
SendGrid is a cloud-based SMTP provider that allows you to send email without having to maintain email servers. With our SendGrid integration you can send email campaigns, transactional emails, and automated emails (drip campaigns) from your app.
|
||||
|
||||
<Card
|
||||
title="Jobs Showcase - SendGrid"
|
||||
icon="rocket"
|
||||
href="https://trigger.dev/showcase?tags=&apis=sendgrid"
|
||||
>
|
||||
Check out pre-built SendGrid jobs in our showcase.
|
||||
</Card>
|
||||
|
||||
## Installing the SendGrid packages
|
||||
|
||||
To get started with our SendGrid integration, you need to install the `@trigger.dev/sendgrid` packages. You can do this using `npm`, `pnpm`, or `yarn`:
|
||||
@@ -57,3 +49,9 @@ Once you have set up a SendGrid client, you can use it to create tasks.
|
||||
<Card title="Tasks" icon="sparkles" href="/integrations/apis/sendgrid-tasks">
|
||||
Send emails with SendGrid.
|
||||
</Card>
|
||||
|
||||
## Example jobs
|
||||
|
||||
<Card title="Code examples" icon="code" href="https://trigger.dev/apis/sendgrid">
|
||||
Check out pre-built jobs using SendGrid in our API section.
|
||||
</Card>
|
||||
|
||||
@@ -7,14 +7,6 @@ sidebarTitle: Overview & authentication
|
||||
|
||||
Our Shopify integration allows you to create triggers and tasks that interact with Shopify. Trigger jobs when events happen, like when a new product is added to a shop, or when an order is paid for, etc. You can also perform tasks like creating products, editing variants, getting information about an order, and a lot more.
|
||||
|
||||
{/* <Card
|
||||
title="Jobs Showcase - Shopify"
|
||||
icon="rocket"
|
||||
href="https://trigger.dev/showcase?tags=&apis=shopify"
|
||||
>
|
||||
Check out pre-built Shopify jobs in our showcase.
|
||||
</Card> */}
|
||||
|
||||
## Installing the Shopify packages
|
||||
|
||||
To get started with our Shopify integration, you need to install the `@trigger.dev/shopify` packages. You can do this using `npm`, `pnpm`, or `yarn`:
|
||||
@@ -43,13 +35,13 @@ It's **required** to import the correct Runtime Adapter for your platform. All e
|
||||
|
||||
```ts
|
||||
// Import the Node.js adapter
|
||||
import '@shopify/shopify-api/adapters/node';
|
||||
import "@shopify/shopify-api/adapters/node";
|
||||
|
||||
// Import the CloudFlare Worker adapter
|
||||
import '@shopify/shopify-api/adapters/cf-worker';
|
||||
import "@shopify/shopify-api/adapters/cf-worker";
|
||||
|
||||
// Import the generic Web API adapter
|
||||
import '@shopify/shopify-api/adapters/web-api';
|
||||
import "@shopify/shopify-api/adapters/web-api";
|
||||
```
|
||||
|
||||
You can then import and use `@trigger.dev/shopify` like any other integration:
|
||||
@@ -102,3 +94,9 @@ Once you have set up a Shopify client, you can use it to create triggers and tas
|
||||
Perform Tasks such as creating new variants, or editing orders, and more.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Example jobs
|
||||
|
||||
<Card title="Code examples" icon="code" href="https://trigger.dev/apis/shopify">
|
||||
Check out pre-built jobs using Shopify in our API section.
|
||||
</Card>
|
||||
|
||||
@@ -67,8 +67,6 @@ client.defineJob({
|
||||
|
||||
Use their [Block kit builder](https://api.slack.com/block-kit), and then use the `blocks` property to send the message.
|
||||
|
||||
To see this in action, check out our 'Daily Slack alert for Linear issues' [example job](https://trigger.dev/showcase/jobs/linearIssuesDailySlackAlert).
|
||||
|
||||
```ts linearIssuesDailySlackAlert.ts
|
||||
...
|
||||
await io.slack.postMessage("post message", {
|
||||
|
||||
@@ -7,14 +7,6 @@ sidebarTitle: Overview & authentication
|
||||
|
||||
Our Slack integration allows you to connect to the Slack API and post messages to Slack.
|
||||
|
||||
<Card
|
||||
title="Jobs Showcase - Slack"
|
||||
icon="rocket"
|
||||
href="https://trigger.dev/showcase?tags=&apis=slack"
|
||||
>
|
||||
Check out pre-built Slack jobs in our showcase.
|
||||
</Card>
|
||||
|
||||
## Installation
|
||||
|
||||
<CodeGroup>
|
||||
@@ -58,3 +50,9 @@ Once you have set up a Slack client, you can use it to create tasks.
|
||||
<Card title="Tasks" icon="sparkles" href="/integrations/apis/slack-tasks">
|
||||
Perform tasks such as posting messages to a channel.
|
||||
</Card>
|
||||
|
||||
## Example jobs
|
||||
|
||||
<Card title="Code examples" icon="code" href="https://trigger.dev/apis/slack">
|
||||
Check out pre-built jobs using Slack in our API section.
|
||||
</Card>
|
||||
|
||||
@@ -85,61 +85,76 @@ client.defineJob({
|
||||
|
||||
Available triggers are listed below:
|
||||
|
||||
| Function Name | Payload Object | Events | Aggregate Version |
|
||||
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
|
||||
| `onCharge` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.succeeded`, `charge.failed`, `charge.captured`, `charge.refunded`, `charge.updated` | ✔️ |
|
||||
| `onChargeSucceeded` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.succeeded` | `onCharge` |
|
||||
| `onChargeFailed` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.failed` | `onCharge` |
|
||||
| `onChargeCaptured` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.captured` | `onCharge` |
|
||||
| `onChargeRefunded` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.refunded` | `onCharge` |
|
||||
| `onChargeUpdated` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.updated` | `onCharge` |
|
||||
| `onProduct` | [Product](https://stripe.com/docs/api/events/types#product_object) | `product.created`, `product.updated`, `product.deleted` | ✔️ |
|
||||
| `onProductCreated` | [Product](https://stripe.com/docs/api/events/types#product_object) | `product.created` | `onProduct` |
|
||||
| `onProductUpdated` | [Product](https://stripe.com/docs/api/events/types#product_object) | `product.updated` | `onProduct` |
|
||||
| `onProductDeleted` | [Product](https://stripe.com/docs/api/events/types#product_object) | `product.deleted` | `onProduct` |
|
||||
| `onPrice` | [Price](https://stripe.com/docs/api/events/types#price_object) | `price.created`, `price.updated`, `price.deleted` | ✔️ |
|
||||
| `onPriceCreated` | [Price](https://stripe.com/docs/api/events/types#price_object) | `price.created` | `onPrice` |
|
||||
| `onPriceUpdated` | [Price](https://stripe.com/docs/api/events/types#price_object) | `price.updated` | `onPrice` |
|
||||
| `onPriceDeleted` | [Price](https://stripe.com/docs/api/events/types#price_object) | `price.deleted` | `onPrice` |
|
||||
| `onCheckoutSession` | [CheckoutSession](https://stripe.com/docs/api/events/types#checkout_session_object) | `checkout.session.completed`, `checkout.session.async_payment_succeeded`, `checkout.session.async_payment_failed`, `checkout.session.expired` | ✔️ |
|
||||
| `onCheckoutSessionCompleted` | [CheckoutSession](https://stripe.com/docs/api/events/types#checkout_session_object) | `checkout.session.completed` | `onCheckoutSession` |
|
||||
| `onCheckoutSessionExpired` | [CheckoutSession](https://stripe.com/docs/api/events/types#checkout_session_object) | `checkout.session.expired` | `onCheckoutSession` |
|
||||
| `onCustomerSubscription` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.created`, `customer.subscription.updated`, `customer.subscription.deleted`, `customer.subscription.paused`, `customer.subscription.pending_updated_applied`, `customer.subscription.pending_update_expired`, `customer.subscription.resumed` | ✔️ |
|
||||
| `onCustomerSubscriptionCreated` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.created` | `onCustomerSubscription` |
|
||||
| `onCustomerSubscriptionUpdated` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.updated` | `onCustomerSubscription` |
|
||||
| `onCustomerSubscriptionDeleted` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.deleted` | `onCustomerSubscription` |
|
||||
| `onCustomerSubscriptionPaused` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.paused` | `onCustomerSubscription` |
|
||||
| `onCustomerSubscriptionPending` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.pending_updated_applied`, `customer.subscription.pending_update_expired` | `onCustomerSubscription` |
|
||||
| `onCustomerSubscriptionResumed` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.resumed` | `onCustomerSubscription` |
|
||||
| `onCustomer` | [Customer](https://stripe.com/docs/api/events/types#customer_object) | `customer.created`, `customer.updated`, `customer.deleted` | ✔️ |
|
||||
| `onCustomerCreated` | [Customer](https://stripe.com/docs/api/events/types#customer_object) | `customer.created` | `onCustomer` |
|
||||
| `onCustomerUpdated` | [Customer](https://stripe.com/docs/api/events/types#customer_object) | `customer.updated` | `onCustomer` |
|
||||
| `onCustomerDeleted` | [Customer](https://stripe.com/docs/api/events/types#customer_object) | `customer.deleted` | `onCustomer` |
|
||||
| `onExternalAccount` | [Card](https://stripe.com/docs/api/events/types#account_card_object) or [Bank Account](https://stripe.com/docs/api/events/types#account_bank_account_object) | `account.external_account.created`, `account.external_account.updated`, `account.external_account.deleted` | ✔️ |
|
||||
| `onExternalAccountCreated` | [Card](https://stripe.com/docs/api/events/types#account_card_object) or [Bank Account](https://stripe.com/docs/api/events/types#account_bank_account_object) | `account.external_account.created` | `onExternalAccount` |
|
||||
| `onExternalAccountUpdated` | [Card](https://stripe.com/docs/api/events/types#account_card_object) or [Bank Account](https://stripe.com/docs/api/events/types#account_bank_account_object) | `account.external_account.updated` | `onExternalAccount` |
|
||||
| `onExternalAccountDeleted` | [Card](https://stripe.com/docs/api/events/types#account_card_object) or [Bank Account](https://stripe.com/docs/api/events/types#account_bank_account_object) | `account.external_account.deleted` | `onExternalAccount` |
|
||||
| `onPerson` | [Person](https://stripe.com/docs/api/events/types#person_object) | `account.person.created`, `account.person.updated`, `account.person.deleted` | ✔️ |
|
||||
| `onPersonCreated` | [Person](https://stripe.com/docs/api/events/types#person_object) | `account.person.created` | `onPerson` |
|
||||
| `onPersonUpdated` | [Person](https://stripe.com/docs/api/events/types#person_object) | `account.person.updated` | `onPerson` |
|
||||
| `onPersonDeleted` | [Person](https://stripe.com/docs/api/events/types#person_object) | `account.person.deleted` | `onPerson` |
|
||||
| `onAccountUpdated` | [Account](https://stripe.com/docs/api/events/types#account_object) | `account.updated` | N/A |
|
||||
| `onPaymentIntent` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.created`, `payment_intent.succeeded`, `payment_intent.payment_failed`, `payment_intent.canceled`, `payment_intent.processing`, `payment_intent.amount_capturable_updated`, `payment_intent.requires_action`, `payment_intent.partially_funded` | ✔️ |
|
||||
| `onPaymentIntentCreated` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.created` | `onPaymentIntent` |
|
||||
| `onPaymentIntentSucceeded` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.succeeded` | `onPaymentIntent` |
|
||||
| `onPaymentIntentPaymentFailed` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.payment_failed` | `onPaymentIntent` |
|
||||
| `onPaymentIntentCanceled` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.canceled` | `onPaymentIntent` |
|
||||
| `onPaymentIntentProcessing` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.processing` | `onPaymentIntent` |
|
||||
| `onPaymentIntentRequiresAction` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.requires_action` | `onPaymentIntent` |
|
||||
| `onPaymentIntentAmountCapturableUpdated` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.amount_capturable_updated` | `onPaymentIntent` |
|
||||
| `onPaymentIntentPartiallyFunded` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.partially_funded` | `onPaymentIntent` |
|
||||
| `onPayout` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.created`, `payout.updated`, `payout.canceled`, `payout.paid`, `payout.failed`, `payout.reconciliation_completed` | ✔️ |
|
||||
| `onPayoutCreated` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.created` | `onPayout` |
|
||||
| `onPayoutUpdated` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.updated` | `onPayout` |
|
||||
| `onPayoutCanceled` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.canceled` | `onPayout` |
|
||||
| `onPayoutPaid` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.paid` | `onPayout` |
|
||||
| `onPayoutFailed` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.failed` | `onPayout` |
|
||||
| `onPayoutReconciliationCompleted` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.reconciliation_completed` | `onPayout` |
|
||||
| Function Name | Payload Object | Events | Aggregate Version |
|
||||
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
|
||||
| `onCharge` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.succeeded`, `charge.failed`, `charge.captured`, `charge.refunded`, `charge.updated` | ✔️ |
|
||||
| `onChargeSucceeded` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.succeeded` | `onCharge` |
|
||||
| `onChargeFailed` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.failed` | `onCharge` |
|
||||
| `onChargeCaptured` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.captured` | `onCharge` |
|
||||
| `onChargeRefunded` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.refunded` | `onCharge` |
|
||||
| `onChargeUpdated` | [Charge](https://stripe.com/docs/api/events/types#charge_object) | `charge.updated` | `onCharge` |
|
||||
| `onProduct` | [Product](https://stripe.com/docs/api/events/types#product_object) | `product.created`, `product.updated`, `product.deleted` | ✔️ |
|
||||
| `onProductCreated` | [Product](https://stripe.com/docs/api/events/types#product_object) | `product.created` | `onProduct` |
|
||||
| `onProductUpdated` | [Product](https://stripe.com/docs/api/events/types#product_object) | `product.updated` | `onProduct` |
|
||||
| `onProductDeleted` | [Product](https://stripe.com/docs/api/events/types#product_object) | `product.deleted` | `onProduct` |
|
||||
| `onPrice` | [Price](https://stripe.com/docs/api/events/types#price_object) | `price.created`, `price.updated`, `price.deleted` | ✔️ |
|
||||
| `onPriceCreated` | [Price](https://stripe.com/docs/api/events/types#price_object) | `price.created` | `onPrice` |
|
||||
| `onPriceUpdated` | [Price](https://stripe.com/docs/api/events/types#price_object) | `price.updated` | `onPrice` |
|
||||
| `onPriceDeleted` | [Price](https://stripe.com/docs/api/events/types#price_object) | `price.deleted` | `onPrice` |
|
||||
| `onCheckoutSession` | [CheckoutSession](https://stripe.com/docs/api/events/types#checkout_session_object) | `checkout.session.completed`, `checkout.session.async_payment_succeeded`, `checkout.session.async_payment_failed`, `checkout.session.expired` | ✔️ |
|
||||
| `onCheckoutSessionCompleted` | [CheckoutSession](https://stripe.com/docs/api/events/types#checkout_session_object) | `checkout.session.completed` | `onCheckoutSession` |
|
||||
| `onCheckoutSessionExpired` | [CheckoutSession](https://stripe.com/docs/api/events/types#checkout_session_object) | `checkout.session.expired` | `onCheckoutSession` |
|
||||
| `onCustomerSubscription` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.created`, `customer.subscription.updated`, `customer.subscription.deleted`, `customer.subscription.paused`, `customer.subscription.pending_updated_applied`, `customer.subscription.pending_update_expired`, `customer.subscription.resumed` | ✔️ |
|
||||
| `onCustomerSubscriptionCreated` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.created` | `onCustomerSubscription` |
|
||||
| `onCustomerSubscriptionUpdated` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.updated` | `onCustomerSubscription` |
|
||||
| `onCustomerSubscriptionDeleted` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.deleted` | `onCustomerSubscription` |
|
||||
| `onCustomerSubscriptionPaused` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.paused` | `onCustomerSubscription` |
|
||||
| `onCustomerSubscriptionPending` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.pending_updated_applied`, `customer.subscription.pending_update_expired` | `onCustomerSubscription` |
|
||||
| `onCustomerSubscriptionResumed` | [Subscription](https://stripe.com/docs/api/events/types#subscription_object) | `customer.subscription.resumed` | `onCustomerSubscription` |
|
||||
| `onCustomer` | [Customer](https://stripe.com/docs/api/events/types#customer_object) | `customer.created`, `customer.updated`, `customer.deleted` | ✔️ |
|
||||
| `onCustomerCreated` | [Customer](https://stripe.com/docs/api/events/types#customer_object) | `customer.created` | `onCustomer` |
|
||||
| `onCustomerUpdated` | [Customer](https://stripe.com/docs/api/events/types#customer_object) | `customer.updated` | `onCustomer` |
|
||||
| `onCustomerDeleted` | [Customer](https://stripe.com/docs/api/events/types#customer_object) | `customer.deleted` | `onCustomer` |
|
||||
| `onExternalAccount` | [Card](https://stripe.com/docs/api/events/types#account_card_object) or [Bank Account](https://stripe.com/docs/api/events/types#account_bank_account_object) | `account.external_account.created`, `account.external_account.updated`, `account.external_account.deleted` | ✔️ |
|
||||
| `onExternalAccountCreated` | [Card](https://stripe.com/docs/api/events/types#account_card_object) or [Bank Account](https://stripe.com/docs/api/events/types#account_bank_account_object) | `account.external_account.created` | `onExternalAccount` |
|
||||
| `onExternalAccountUpdated` | [Card](https://stripe.com/docs/api/events/types#account_card_object) or [Bank Account](https://stripe.com/docs/api/events/types#account_bank_account_object) | `account.external_account.updated` | `onExternalAccount` |
|
||||
| `onExternalAccountDeleted` | [Card](https://stripe.com/docs/api/events/types#account_card_object) or [Bank Account](https://stripe.com/docs/api/events/types#account_bank_account_object) | `account.external_account.deleted` | `onExternalAccount` |
|
||||
| `onPerson` | [Person](https://stripe.com/docs/api/events/types#person_object) | `account.person.created`, `account.person.updated`, `account.person.deleted` | ✔️ |
|
||||
| `onPersonCreated` | [Person](https://stripe.com/docs/api/events/types#person_object) | `account.person.created` | `onPerson` |
|
||||
| `onPersonUpdated` | [Person](https://stripe.com/docs/api/events/types#person_object) | `account.person.updated` | `onPerson` |
|
||||
| `onPersonDeleted` | [Person](https://stripe.com/docs/api/events/types#person_object) | `account.person.deleted` | `onPerson` |
|
||||
| `onAccountUpdated` | [Account](https://stripe.com/docs/api/events/types#account_object) | `account.updated` | N/A |
|
||||
| `onPaymentIntent` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.created`, `payment_intent.succeeded`, `payment_intent.payment_failed`, `payment_intent.canceled`, `payment_intent.processing`, `payment_intent.amount_capturable_updated`, `payment_intent.requires_action`, `payment_intent.partially_funded` | ✔️ |
|
||||
| `onPaymentIntentCreated` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.created` | `onPaymentIntent` |
|
||||
| `onPaymentIntentSucceeded` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.succeeded` | `onPaymentIntent` |
|
||||
| `onPaymentIntentPaymentFailed` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.payment_failed` | `onPaymentIntent` |
|
||||
| `onPaymentIntentCanceled` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.canceled` | `onPaymentIntent` |
|
||||
| `onPaymentIntentProcessing` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.processing` | `onPaymentIntent` |
|
||||
| `onPaymentIntentRequiresAction` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.requires_action` | `onPaymentIntent` |
|
||||
| `onPaymentIntentAmountCapturableUpdated` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.amount_capturable_updated` | `onPaymentIntent` |
|
||||
| `onPaymentIntentPartiallyFunded` | [PaymentIntent](https://stripe.com/docs/api/events/types#payment_intent_object) | `payment_intent.partially_funded` | `onPaymentIntent` |
|
||||
| `onPayout` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.created`, `payout.updated`, `payout.canceled`, `payout.paid`, `payout.failed`, `payout.reconciliation_completed` | ✔️ |
|
||||
| `onPayoutCreated` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.created` | `onPayout` |
|
||||
| `onPayoutUpdated` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.updated` | `onPayout` |
|
||||
| `onPayoutCanceled` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.canceled` | `onPayout` |
|
||||
| `onPayoutPaid` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.paid` | `onPayout` |
|
||||
| `onPayoutFailed` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.failed` | `onPayout` |
|
||||
| `onPayoutReconciliationCompleted` | [Payout](https://stripe.com/docs/api/events/types#payout_object) | `payout.reconciliation_completed` | `onPayout` |
|
||||
| `onInvoice` | [Invoice](https://stripe.com/docs/api/invoices/object) | `invoice.created`, `invoice.finalized`, `invoice.finalization_failed`, `invoice.deleted`, `invoice.marked_uncollectible`, `invoice.paid`, `invoice.payment_action_required`, `invoice.payment_failed`, `invoice.payment_succeeded`, `invoice.sent`, `invoice.upcoming`, `invoice.voided`, `invoiceitem.created`, `invoiceitem.deleted` | ✔️ |
|
||||
| `onInvoiceCreated` | [Invoice](https://stripe.com/docs/api/invoices/object) | `invoice.created` | `onInvoice` |
|
||||
| `onInvoiceFinalized` | [Invoice](https://stripe.com/docs/api/invoices/object) | `invoice.finalized` | `onInvoice` |
|
||||
| `onInvoiceFinalizationFailed` | [Invoice](https://stripe.com/docs/api/invoices/object) | `invoice.finalization_failed` | `onInvoice` |
|
||||
| `onInvoiceDeleted` | [Invoice](https://stripe.com/docs/api/invoices/object) | `invoice.deleted` | `onInvoice` |
|
||||
| `onInvoiceMarkedUncollectible` | [Invoice](https://stripe.com/docs/api/invoices/object) | `invoice.marked_uncollectible` | `onInvoice` |
|
||||
| `onInvoicePaid` | [Invoice](https://stripe.com/docs/api/invoices/object) | `invoice.paid` | `onInvoice` |
|
||||
| `onInvoicePaymentActionRequired` | [Invoice](https://stripe.com/docs/api/invoices/object) | `invoice.payment_action_required` | `onInvoice` |
|
||||
| `onInvoicePaymentFailed` | [Invoice](https://stripe.com/docs/api/invoices/object) | `invoice.payment_failed` | `onInvoice` |
|
||||
| `onInvoicePaymentSucceeded` | [Invoice](https://stripe.com/docs/api/invoices/object) | `invoice.payment_succeeded` | `onInvoice` |
|
||||
| `onInvoiceSent` | [Invoice](https://stripe.com/docs/api/invoices/object) | `invoice.sent` | `onInvoice` |
|
||||
| `onInvoiceUpcoming` | [Invoice](https://stripe.com/docs/api/invoices/object) | `invoice.upcoming` | `onInvoice` |
|
||||
| `onInvoiceVoided` | [Invoice](https://stripe.com/docs/api/invoices/object) | `invoice.voided` | `onInvoice` |
|
||||
| `onInvoiceItemCreated` | [InvoiceItem](https://stripe.com/docs/api/invoiceitems/object) | `invoiceitem.created` | N/A |
|
||||
| `onInvoiceItemDeleted` | [InvoiceItem](https://stripe.com/docs/api/invoiceitems/object) | `invoiceitem.deleted` | N/A |
|
||||
|
||||
If there are any triggers missing that you'd like to see added, please [open a new GitHub Issue](https://github.com/triggerdotdev/trigger.dev/issues/new)
|
||||
|
||||
@@ -260,3 +275,9 @@ client.defineJob({
|
||||
```
|
||||
|
||||
Make sure to pass the `idempotencyKey` to the underlying client to ensure that the API call is only executed once. This is only needed for mutating API calls.
|
||||
|
||||
## Example jobs
|
||||
|
||||
<Card title="Code examples" icon="code" href="https://trigger.dev/apis/stripe">
|
||||
Check out pre-built jobs using Stripe in our API section.
|
||||
</Card>
|
||||
|
||||
@@ -73,3 +73,9 @@ Our Supabase package supports two different integrations: One for the Supabase M
|
||||
[service_role](https://supabase.com/docs/guides/api/api-keys#the-servicerole-key) key.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Example jobs
|
||||
|
||||
<Card title="Code examples" icon="code" href="https://trigger.dev/apis/supabase">
|
||||
Check out pre-built jobs using Supabase in our API section.
|
||||
</Card>
|
||||
|
||||
@@ -165,3 +165,9 @@ client.defineJob({
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## Example jobs
|
||||
|
||||
<Card title="Code examples" icon="code" href="https://trigger.dev/apis/typeform">
|
||||
Check out pre-built jobs using Typeform in our API section.
|
||||
</Card>
|
||||
|
||||
+2
-1
@@ -91,6 +91,7 @@
|
||||
"documentation/quickstarts/astro",
|
||||
"documentation/quickstarts/nuxt",
|
||||
"documentation/quickstarts/sveltekit",
|
||||
"documentation/quickstarts/hono",
|
||||
"documentation/quickstarts/fastify"
|
||||
]
|
||||
},
|
||||
@@ -141,7 +142,7 @@
|
||||
"group": "Guides",
|
||||
"pages": [
|
||||
{
|
||||
"group": "Platforms",
|
||||
"group": "Frameworks",
|
||||
"pages": [
|
||||
"documentation/guides/platforms/nextjs",
|
||||
"documentation/guides/platforms/express",
|
||||
|
||||
+5
-9
@@ -9,8 +9,8 @@ You can define a job by using the `TriggerClient.defineJob` instance method:
|
||||
|
||||
<RequestExample>
|
||||
|
||||
```ts client.defineJob
|
||||
client.defineJob({
|
||||
```ts Example
|
||||
new Job({
|
||||
id: "github-integration-on-issue",
|
||||
name: "GitHub Integration - On Issue",
|
||||
version: "0.1.0",
|
||||
@@ -23,11 +23,11 @@ client.defineJob({
|
||||
await io.logger.info("This is a simple log info message");
|
||||
return { payload, ctx };
|
||||
},
|
||||
});
|
||||
}).attachToClient(client);
|
||||
```
|
||||
|
||||
```ts notifications
|
||||
client.defineJob({
|
||||
new Job({
|
||||
id: "github-integration-on-issue",
|
||||
name: "GitHub Integration - On Issue",
|
||||
version: "0.1.0",
|
||||
@@ -46,7 +46,7 @@ client.defineJob({
|
||||
await io.logger.info("This is a simple log info message");
|
||||
return { payload, ctx };
|
||||
},
|
||||
});
|
||||
}).attachToClient(client);
|
||||
```
|
||||
|
||||
</RequestExample>
|
||||
@@ -55,10 +55,6 @@ client.defineJob({
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParamField body="client" type="object" required>
|
||||
An instance of [TriggerClient](/sdk/triggerclient) that is used to send events to the Trigger API.
|
||||
</ParamField>
|
||||
|
||||
<Snippet file="jobs/options.mdx" />
|
||||
|
||||
## Returns
|
||||
|
||||
@@ -1,5 +1,59 @@
|
||||
# @trigger.dev/airtable
|
||||
|
||||
## 2.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 0f9f0102: Named exports don't work because Airtable is a CommonJS module
|
||||
- @trigger.dev/integration-kit@2.3.3
|
||||
- @trigger.dev/sdk@2.3.3
|
||||
|
||||
## 2.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 0c14e4cd: Fixed importing package subpath
|
||||
- @trigger.dev/integration-kit@2.3.2
|
||||
- @trigger.dev/sdk@2.3.2
|
||||
|
||||
## 2.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [f3efcc0c]
|
||||
- @trigger.dev/sdk@2.3.1
|
||||
- @trigger.dev/integration-kit@2.3.1
|
||||
|
||||
## 2.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 17f6f29d: Support for Deno, Bun and Cloudflare workers, as well as conditionally exporting ESM versions of the package instead of just commonjs.
|
||||
|
||||
Cloudflare worker support requires the node compat flag turned on (https://developers.cloudflare.com/workers/runtime-apis/nodejs/)
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17f6f29d]
|
||||
- @trigger.dev/integration-kit@2.3.0
|
||||
- @trigger.dev/sdk@2.3.0
|
||||
|
||||
## 2.2.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- de652c1d: Fix Shopify task types and KV `get()` return types
|
||||
- Updated dependencies [de652c1d]
|
||||
- @trigger.dev/sdk@2.2.11
|
||||
- @trigger.dev/integration-kit@2.2.11
|
||||
|
||||
## 2.2.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.2.10
|
||||
- @trigger.dev/sdk@2.2.10
|
||||
|
||||
## 2.2.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/airtable",
|
||||
"version": "2.2.9",
|
||||
"version": "2.3.3",
|
||||
"description": "Trigger.dev integration for airtable",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -8,16 +8,15 @@
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"dist/index.js",
|
||||
"dist/index.d.ts",
|
||||
"dist/index.js.map"
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
"@types/node": "16.x",
|
||||
"rimraf": "^3.0.2",
|
||||
"tsup": "7.1.x",
|
||||
"typescript": "4.9.4"
|
||||
"tsup": "8.0.1",
|
||||
"typescript": "^5.3.0",
|
||||
"@trigger.dev/tsup": "workspace:*"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
@@ -26,12 +25,24 @@
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@trigger.dev/integration-kit": "workspace:^2.2.9",
|
||||
"@trigger.dev/sdk": "workspace:^2.2.9",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.3.3",
|
||||
"@trigger.dev/sdk": "workspace:^2.3.3",
|
||||
"airtable": "^0.12.1",
|
||||
"zod": "3.22.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"module": "./dist/index.mjs"
|
||||
}
|
||||
|
||||
@@ -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,11 +1,12 @@
|
||||
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";
|
||||
import { ListWebhooksResponse, ListWebhooksResponseSchema } from "./schemas";
|
||||
import { WebhookSource, WebhookTrigger } from "@trigger.dev/sdk/triggers/webhook";
|
||||
import { registerJobNamespace } from "@trigger.dev/integration-kit/webhooks";
|
||||
import { WebhookSource, WebhookTrigger } from "@trigger.dev/sdk";
|
||||
import { registerJobNamespace } from "@trigger.dev/integration-kit";
|
||||
import { Buffer } from "node:buffer";
|
||||
|
||||
const WebhookFromSourceSchema = z.union([
|
||||
z.literal("formSubmission"),
|
||||
@@ -315,6 +316,10 @@ export function createWebhookSource(
|
||||
delete: async ({ io, ctx }) => {
|
||||
const webhookId = await io.store.job.get<string>("get-webhook-id", "webhook-id");
|
||||
|
||||
if (!webhookId) {
|
||||
throw new Error("Missing webhook ID for delete operation.");
|
||||
}
|
||||
|
||||
await io.integration.webhooks().delete("delete-webhook", {
|
||||
baseId: ctx.params?.baseId,
|
||||
webhookId,
|
||||
@@ -327,6 +332,10 @@ export function createWebhookSource(
|
||||
`${registerJobNamespace(ctx.key)}:webhook-secret-base64`
|
||||
);
|
||||
|
||||
if (!secretBase64) {
|
||||
throw new Error("Missing secret for verification.");
|
||||
}
|
||||
|
||||
return await verifyRequestSignature({
|
||||
request,
|
||||
headerName: "x-airtable-content-mac",
|
||||
@@ -442,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
|
||||
@@ -451,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);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
"@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"],
|
||||
"@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"],
|
||||
"@trigger.dev/integration-kit/*": ["../../packages/integration-kit/src/*"],
|
||||
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"]
|
||||
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"],
|
||||
"@trigger.dev/tsup/*": ["../../config-packages/tsup/src/*"],
|
||||
"@trigger.dev/tsup": ["../../config-packages/tsup/src/index"]
|
||||
},
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
import { defineConfigPackage } from "@trigger.dev/tsup";
|
||||
|
||||
import { defineConfig } from "tsup";
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
name: "main",
|
||||
entry: ["./src/index.ts"],
|
||||
outDir: "./dist",
|
||||
platform: "node",
|
||||
format: ["cjs"],
|
||||
legacyOutput: true,
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
dts: true,
|
||||
treeshake: {
|
||||
preset: "smallest",
|
||||
},
|
||||
esbuildPlugins: [],
|
||||
external: ["http", "https", "util", "events", "tty", "os", "timers"],
|
||||
},
|
||||
]);
|
||||
|
||||
export default defineConfigPackage;
|
||||
|
||||
@@ -1,5 +1,56 @@
|
||||
# @trigger.dev/github
|
||||
|
||||
## 2.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.3
|
||||
- @trigger.dev/sdk@2.3.3
|
||||
|
||||
## 2.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.2
|
||||
- @trigger.dev/sdk@2.3.2
|
||||
|
||||
## 2.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [f3efcc0c]
|
||||
- @trigger.dev/sdk@2.3.1
|
||||
- @trigger.dev/integration-kit@2.3.1
|
||||
|
||||
## 2.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 17f6f29d: Support for Deno, Bun and Cloudflare workers, as well as conditionally exporting ESM versions of the package instead of just commonjs.
|
||||
|
||||
Cloudflare worker support requires the node compat flag turned on (https://developers.cloudflare.com/workers/runtime-apis/nodejs/)
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17f6f29d]
|
||||
- @trigger.dev/integration-kit@2.3.0
|
||||
- @trigger.dev/sdk@2.3.0
|
||||
|
||||
## 2.2.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [de652c1d]
|
||||
- @trigger.dev/sdk@2.2.11
|
||||
- @trigger.dev/integration-kit@2.2.11
|
||||
|
||||
## 2.2.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.2.10
|
||||
- @trigger.dev/sdk@2.2.10
|
||||
|
||||
## 2.2.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/github",
|
||||
"version": "2.2.9",
|
||||
"version": "2.3.3",
|
||||
"description": "The official GitHub integration for Trigger.dev",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -8,9 +8,7 @@
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"dist/index.js",
|
||||
"dist/index.d.ts",
|
||||
"dist/index.js.map"
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@octokit/types": "^9.2.3",
|
||||
@@ -18,7 +16,9 @@
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
"@types/node": "18",
|
||||
"rimraf": "^3.0.2",
|
||||
"tsup": "^6.5.0"
|
||||
"tsup": "8.0.1",
|
||||
"@trigger.dev/tsup": "workspace:*",
|
||||
"typescript": "^5.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
@@ -29,12 +29,24 @@
|
||||
"@octokit/request": "^6.2.5",
|
||||
"@octokit/request-error": "^4.0.1",
|
||||
"@octokit/webhooks": "^10.4.0",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.2.9",
|
||||
"@trigger.dev/sdk": "workspace:^2.2.9",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.3.3",
|
||||
"@trigger.dev/sdk": "workspace:^2.3.3",
|
||||
"octokit": "^2.0.14",
|
||||
"zod": "3.22.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"module": "./dist/index.mjs"
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { Logger } from "@trigger.dev/sdk";
|
||||
import { ExternalSource, HandlerEvent } from "@trigger.dev/sdk";
|
||||
import { z } from "zod";
|
||||
import { Github } from "./index";
|
||||
import { Buffer } from "node:buffer";
|
||||
|
||||
type WebhookData = {
|
||||
id: number;
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
"@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"],
|
||||
"@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"],
|
||||
"@trigger.dev/integration-kit/*": ["../../packages/integration-kit/src/*"],
|
||||
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"]
|
||||
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"],
|
||||
"@trigger.dev/tsup/*": ["../../config-packages/tsup/src/*"],
|
||||
"@trigger.dev/tsup": ["../../config-packages/tsup/src/index"]
|
||||
},
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
import { defineConfig } from "tsup";
|
||||
import { defineConfigPackage } from "@trigger.dev/tsup";
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
name: "main",
|
||||
entry: ["./src/index.ts"],
|
||||
outDir: "./dist",
|
||||
platform: "node",
|
||||
format: ["cjs"],
|
||||
legacyOutput: true,
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
dts: true,
|
||||
treeshake: {
|
||||
preset: "smallest",
|
||||
},
|
||||
esbuildPlugins: [],
|
||||
external: ["http", "https", "util", "events", "tty", "os", "timers"],
|
||||
},
|
||||
]);
|
||||
export default defineConfigPackage;
|
||||
|
||||
@@ -1,5 +1,56 @@
|
||||
# @trigger.dev/linear
|
||||
|
||||
## 2.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.3
|
||||
- @trigger.dev/sdk@2.3.3
|
||||
|
||||
## 2.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.2
|
||||
- @trigger.dev/sdk@2.3.2
|
||||
|
||||
## 2.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [f3efcc0c]
|
||||
- @trigger.dev/sdk@2.3.1
|
||||
- @trigger.dev/integration-kit@2.3.1
|
||||
|
||||
## 2.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 17f6f29d: Support for Deno, Bun and Cloudflare workers, as well as conditionally exporting ESM versions of the package instead of just commonjs.
|
||||
|
||||
Cloudflare worker support requires the node compat flag turned on (https://developers.cloudflare.com/workers/runtime-apis/nodejs/)
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17f6f29d]
|
||||
- @trigger.dev/integration-kit@2.3.0
|
||||
- @trigger.dev/sdk@2.3.0
|
||||
|
||||
## 2.2.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [de652c1d]
|
||||
- @trigger.dev/sdk@2.2.11
|
||||
- @trigger.dev/integration-kit@2.2.11
|
||||
|
||||
## 2.2.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.2.10
|
||||
- @trigger.dev/sdk@2.2.10
|
||||
|
||||
## 2.2.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/linear",
|
||||
"version": "2.2.9",
|
||||
"version": "2.3.3",
|
||||
"description": "Trigger.dev integration for @linear/sdk",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -8,16 +8,15 @@
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"dist/index.js",
|
||||
"dist/index.d.ts",
|
||||
"dist/index.js.map"
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
"@types/node": "16.x",
|
||||
"rimraf": "^3.0.2",
|
||||
"tsup": "7.1.x",
|
||||
"typescript": "4.9.4"
|
||||
"tsup": "8.0.1",
|
||||
"typescript": "^5.3.0",
|
||||
"@trigger.dev/tsup": "workspace:*"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
@@ -27,11 +26,23 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@linear/sdk": "^8.0.0",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.2.9",
|
||||
"@trigger.dev/sdk": "workspace:^2.2.9",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.3.3",
|
||||
"@trigger.dev/sdk": "workspace:^2.3.3",
|
||||
"zod": "3.22.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"module": "./dist/index.mjs"
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import { Linear, LinearRunTask, serializeLinearOutput } from "./index";
|
||||
import { WebhookPayloadSchema } from "./schemas";
|
||||
import { LinearReturnType } from "./types";
|
||||
import { queryProperties } from "./utils";
|
||||
import { Buffer } from "node:buffer";
|
||||
|
||||
export class Webhooks {
|
||||
runTask: LinearRunTask;
|
||||
@@ -43,7 +44,10 @@ export class Webhooks {
|
||||
);
|
||||
}
|
||||
|
||||
webhooks(key: IntegrationTaskKey, params?: L.WebhooksQueryVariables): LinearReturnType<Webhook[]> {
|
||||
webhooks(
|
||||
key: IntegrationTaskKey,
|
||||
params?: L.WebhooksQueryVariables
|
||||
): LinearReturnType<Webhook[]> {
|
||||
return this.runTask(
|
||||
key,
|
||||
async (client, task, io) => {
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
"@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"],
|
||||
"@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"],
|
||||
"@trigger.dev/integration-kit/*": ["../../packages/integration-kit/src/*"],
|
||||
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"]
|
||||
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"],
|
||||
"@trigger.dev/tsup/*": ["../../config-packages/tsup/src/*"],
|
||||
"@trigger.dev/tsup": ["../../config-packages/tsup/src/index"]
|
||||
},
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
import { defineConfigPackage } from "@trigger.dev/tsup";
|
||||
|
||||
import { defineConfig } from "tsup";
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
name: "main",
|
||||
entry: ["./src/index.ts"],
|
||||
outDir: "./dist",
|
||||
platform: "node",
|
||||
format: ["cjs"],
|
||||
legacyOutput: true,
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
dts: true,
|
||||
treeshake: {
|
||||
preset: "smallest",
|
||||
},
|
||||
esbuildPlugins: [],
|
||||
external: ["http", "https", "util", "events", "tty", "os", "timers"],
|
||||
},
|
||||
]);
|
||||
|
||||
export default defineConfigPackage;
|
||||
|
||||
@@ -1,5 +1,56 @@
|
||||
# @trigger.dev/slack
|
||||
|
||||
## 2.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.3
|
||||
- @trigger.dev/sdk@2.3.3
|
||||
|
||||
## 2.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.2
|
||||
- @trigger.dev/sdk@2.3.2
|
||||
|
||||
## 2.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [f3efcc0c]
|
||||
- @trigger.dev/sdk@2.3.1
|
||||
- @trigger.dev/integration-kit@2.3.1
|
||||
|
||||
## 2.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 17f6f29d: Support for Deno, Bun and Cloudflare workers, as well as conditionally exporting ESM versions of the package instead of just commonjs.
|
||||
|
||||
Cloudflare worker support requires the node compat flag turned on (https://developers.cloudflare.com/workers/runtime-apis/nodejs/)
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17f6f29d]
|
||||
- @trigger.dev/integration-kit@2.3.0
|
||||
- @trigger.dev/sdk@2.3.0
|
||||
|
||||
## 2.2.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [de652c1d]
|
||||
- @trigger.dev/sdk@2.2.11
|
||||
- @trigger.dev/integration-kit@2.2.11
|
||||
|
||||
## 2.2.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.2.10
|
||||
- @trigger.dev/sdk@2.2.10
|
||||
|
||||
## 2.2.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,23 +1,34 @@
|
||||
{
|
||||
"name": "@trigger.dev/openai",
|
||||
"version": "2.2.9",
|
||||
"version": "2.3.3",
|
||||
"description": "The official OpenAI integration for Trigger.dev",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"module": "./dist/index.mjs",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"dist/index.js",
|
||||
"dist/index.d.ts",
|
||||
"dist/index.js.map"
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
"@types/node": "18",
|
||||
"rimraf": "^3.0.2",
|
||||
"tsup": "^6.5.0",
|
||||
"typescript": "^4.9.4",
|
||||
"tsup": "^8.0.1",
|
||||
"@trigger.dev/tsup": "workspace:*",
|
||||
"typescript": "^5.3.0",
|
||||
"@types/jest": "^29.5.3",
|
||||
"jest": "^29.6.2",
|
||||
"ts-jest": "^29.1.1"
|
||||
@@ -31,8 +42,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"openai": "^4.16.1",
|
||||
"@trigger.dev/sdk": "workspace:^2.2.9",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.2.9"
|
||||
"@trigger.dev/sdk": "workspace:^2.3.3",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.3.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { fileFromString } from "@trigger.dev/integration-kit";
|
||||
import { Buffer } from "node:buffer";
|
||||
import { IntegrationTaskKey } from "@trigger.dev/sdk";
|
||||
import OpenAI from "openai";
|
||||
import { OpenAIRunTask } from "./index";
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
createTaskOutputProperties,
|
||||
handleOpenAIError,
|
||||
} from "./taskUtils";
|
||||
import { Uploadable } from "openai/uploads";
|
||||
import { Uploadable, toFile } from "openai/uploads";
|
||||
|
||||
type CreateFileRequest = {
|
||||
file: string | File | Uploadable;
|
||||
@@ -42,7 +42,7 @@ export class Files {
|
||||
let file: Uploadable;
|
||||
|
||||
if (typeof params.file === "string") {
|
||||
file = await fileFromString(params.file, params.fileName ?? "file.txt");
|
||||
file = await toFile(Buffer.from(params.file), params.fileName ?? "file.txt");
|
||||
} else {
|
||||
file = params.file;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ export class Files {
|
||||
let file: Uploadable;
|
||||
|
||||
if (typeof params.file === "string") {
|
||||
file = await fileFromString(params.file, params.fileName ?? "file.txt");
|
||||
file = await toFile(Buffer.from(params.file), params.fileName ?? "file.txt");
|
||||
} else {
|
||||
file = params.file;
|
||||
}
|
||||
@@ -242,8 +242,8 @@ export class Files {
|
||||
return this.runTask(
|
||||
key,
|
||||
async (client, task) => {
|
||||
const file = await fileFromString(
|
||||
params.examples.map((d) => JSON.stringify(d)).join("\n"),
|
||||
const file = await toFile(
|
||||
Buffer.from(params.examples.map((d) => JSON.stringify(d)).join("\n")),
|
||||
params.fileName
|
||||
);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { FetchRetryOptions, FetchTimeoutOptions, fileFromUrl } from "@trigger.dev/integration-kit";
|
||||
import { FetchRetryOptions, FetchTimeoutOptions } from "@trigger.dev/integration-kit";
|
||||
import { IntegrationTaskKey, Prettify } from "@trigger.dev/sdk";
|
||||
import OpenAI from "openai";
|
||||
import { OpenAIRunTask } from "./index";
|
||||
@@ -209,9 +209,8 @@ export class Images {
|
||||
return this.runTask(
|
||||
key,
|
||||
async (client, task) => {
|
||||
const file =
|
||||
typeof params.image === "string" ? await fileFromUrl(params.image) : params.image;
|
||||
const mask = typeof params.mask === "string" ? await fileFromUrl(params.mask) : params.mask;
|
||||
const file = typeof params.image === "string" ? await fetch(params.image) : params.image;
|
||||
const mask = typeof params.mask === "string" ? await fetch(params.mask) : params.mask;
|
||||
|
||||
const { data, response } = await client.images
|
||||
.edit(
|
||||
@@ -288,8 +287,7 @@ export class Images {
|
||||
return this.runTask(
|
||||
key,
|
||||
async (client, task) => {
|
||||
const file =
|
||||
typeof params.image === "string" ? await fileFromUrl(params.image) : params.image;
|
||||
const file = typeof params.image === "string" ? await fetch(params.image) : params.image;
|
||||
|
||||
const { data, response } = await client.images
|
||||
.createVariation(
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
"@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"],
|
||||
"@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"],
|
||||
"@trigger.dev/integration-kit/*": ["../../packages/integration-kit/src/*"],
|
||||
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"]
|
||||
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"],
|
||||
"@trigger.dev/tsup/*": ["../../config-packages/tsup/src/*"],
|
||||
"@trigger.dev/tsup": ["../../config-packages/tsup/src/index"]
|
||||
},
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
|
||||
@@ -1,22 +1,4 @@
|
||||
import { defineConfig } from "tsup";
|
||||
import { packageOptions } from "@trigger.dev/tsup";
|
||||
import { defineConfig } from "@trigger.dev/tsup";
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
name: "main",
|
||||
entry: ["./src/index.ts"],
|
||||
outDir: "./dist",
|
||||
platform: "node",
|
||||
format: ["cjs"],
|
||||
legacyOutput: true,
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
dts: true,
|
||||
treeshake: {
|
||||
preset: "smallest",
|
||||
},
|
||||
esbuildPlugins: [],
|
||||
external: ["http", "https", "util", "events", "tty", "os", "timers"],
|
||||
},
|
||||
]);
|
||||
export default defineConfig({ ...packageOptions, config: "tsconfig.build.json" });
|
||||
|
||||
@@ -1,5 +1,57 @@
|
||||
# @trigger.dev/plain
|
||||
|
||||
## 2.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.3
|
||||
- @trigger.dev/sdk@2.3.3
|
||||
|
||||
## 2.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 0c14e4cd: Fixed importing package subpath
|
||||
- @trigger.dev/integration-kit@2.3.2
|
||||
- @trigger.dev/sdk@2.3.2
|
||||
|
||||
## 2.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [f3efcc0c]
|
||||
- @trigger.dev/sdk@2.3.1
|
||||
- @trigger.dev/integration-kit@2.3.1
|
||||
|
||||
## 2.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 17f6f29d: Support for Deno, Bun and Cloudflare workers, as well as conditionally exporting ESM versions of the package instead of just commonjs.
|
||||
|
||||
Cloudflare worker support requires the node compat flag turned on (https://developers.cloudflare.com/workers/runtime-apis/nodejs/)
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17f6f29d]
|
||||
- @trigger.dev/integration-kit@2.3.0
|
||||
- @trigger.dev/sdk@2.3.0
|
||||
|
||||
## 2.2.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [de652c1d]
|
||||
- @trigger.dev/sdk@2.2.11
|
||||
- @trigger.dev/integration-kit@2.2.11
|
||||
|
||||
## 2.2.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.2.10
|
||||
- @trigger.dev/sdk@2.2.10
|
||||
|
||||
## 2.2.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/plain",
|
||||
"version": "2.2.9",
|
||||
"version": "2.3.3",
|
||||
"description": "The official Plain.com integration for Trigger.dev",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -8,15 +8,15 @@
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"dist/index.js",
|
||||
"dist/index.d.ts",
|
||||
"dist/index.js.map"
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
"@types/node": "18",
|
||||
"rimraf": "^3.0.2",
|
||||
"tsup": "^6.5.0"
|
||||
"tsup": "8.0.1",
|
||||
"@trigger.dev/tsup": "workspace:*",
|
||||
"typescript": "^5.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
@@ -24,11 +24,23 @@
|
||||
"build:tsup": "tsup"
|
||||
},
|
||||
"dependencies": {
|
||||
"@trigger.dev/integration-kit": "workspace:^2.2.9",
|
||||
"@trigger.dev/sdk": "workspace:^2.2.9",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.3.3",
|
||||
"@trigger.dev/sdk": "workspace:^2.3.3",
|
||||
"@team-plain/typescript-sdk": "^2.7.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"module": "./dist/index.mjs"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PlainClient } from "@team-plain/typescript-sdk";
|
||||
import { Prettify } from "@trigger.dev/integration-kit/prettify";
|
||||
import { Prettify } from "@trigger.dev/integration-kit";
|
||||
|
||||
export type PlainSDK = InstanceType<typeof PlainClient>;
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
"@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"],
|
||||
"@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"],
|
||||
"@trigger.dev/integration-kit/*": ["../../packages/integration-kit/src/*"],
|
||||
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"]
|
||||
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"],
|
||||
"@trigger.dev/tsup/*": ["../../config-packages/tsup/src/*"],
|
||||
"@trigger.dev/tsup": ["../../config-packages/tsup/src/index"]
|
||||
},
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
import { defineConfig } from "tsup";
|
||||
import { defineConfigPackage } from "@trigger.dev/tsup";
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
name: "main",
|
||||
entry: ["./src/index.ts"],
|
||||
outDir: "./dist",
|
||||
platform: "node",
|
||||
format: ["cjs"],
|
||||
legacyOutput: true,
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
dts: true,
|
||||
treeshake: {
|
||||
preset: "smallest",
|
||||
},
|
||||
esbuildPlugins: [],
|
||||
external: ["http", "https", "util", "events", "tty", "os", "timers"],
|
||||
},
|
||||
]);
|
||||
export default defineConfigPackage;
|
||||
|
||||
@@ -1,5 +1,56 @@
|
||||
# @trigger.dev/replicate
|
||||
|
||||
## 2.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.3
|
||||
- @trigger.dev/sdk@2.3.3
|
||||
|
||||
## 2.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.2
|
||||
- @trigger.dev/sdk@2.3.2
|
||||
|
||||
## 2.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [f3efcc0c]
|
||||
- @trigger.dev/sdk@2.3.1
|
||||
- @trigger.dev/integration-kit@2.3.1
|
||||
|
||||
## 2.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 17f6f29d: Support for Deno, Bun and Cloudflare workers, as well as conditionally exporting ESM versions of the package instead of just commonjs.
|
||||
|
||||
Cloudflare worker support requires the node compat flag turned on (https://developers.cloudflare.com/workers/runtime-apis/nodejs/)
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17f6f29d]
|
||||
- @trigger.dev/integration-kit@2.3.0
|
||||
- @trigger.dev/sdk@2.3.0
|
||||
|
||||
## 2.2.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [de652c1d]
|
||||
- @trigger.dev/sdk@2.2.11
|
||||
- @trigger.dev/integration-kit@2.2.11
|
||||
|
||||
## 2.2.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.2.10
|
||||
- @trigger.dev/sdk@2.2.10
|
||||
|
||||
## 2.2.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/replicate",
|
||||
"version": "2.2.9",
|
||||
"version": "2.3.3",
|
||||
"description": "Trigger.dev integration for replicate",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -8,16 +8,15 @@
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"dist/index.js",
|
||||
"dist/index.d.ts",
|
||||
"dist/index.js.map"
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
"@types/node": "16.x",
|
||||
"rimraf": "^3.0.2",
|
||||
"tsup": "7.1.x",
|
||||
"typescript": "4.9.4"
|
||||
"tsup": "8.0.1",
|
||||
"typescript": "^5.3.0",
|
||||
"@trigger.dev/tsup": "workspace:*"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
@@ -26,12 +25,24 @@
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@trigger.dev/integration-kit": "workspace:^2.2.9",
|
||||
"@trigger.dev/sdk": "workspace:^2.2.9",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.3.3",
|
||||
"@trigger.dev/sdk": "workspace:^2.3.3",
|
||||
"replicate": "^0.18.1",
|
||||
"zod": "3.22.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.8.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"module": "./dist/index.mjs"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"extends": "@trigger.dev/tsconfig/integration.json",
|
||||
"include": ["./src/**/*.ts", "tsup.config.ts"],
|
||||
"include": ["./src/**/*.ts", "tsup.config.ts"]
|
||||
}
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
import { defineConfig } from "tsup";
|
||||
import { defineConfigPackage } from "@trigger.dev/tsup";
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
name: "main",
|
||||
entry: ["./src/index.ts"],
|
||||
outDir: "./dist",
|
||||
platform: "node",
|
||||
format: ["cjs"],
|
||||
legacyOutput: true,
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
dts: true,
|
||||
treeshake: {
|
||||
preset: "smallest",
|
||||
},
|
||||
esbuildPlugins: [],
|
||||
external: ["http", "https", "util", "events", "tty", "os", "timers"],
|
||||
},
|
||||
]);
|
||||
export default defineConfigPackage;
|
||||
|
||||
@@ -1,5 +1,56 @@
|
||||
# @trigger.dev/resend
|
||||
|
||||
## 2.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.3
|
||||
- @trigger.dev/sdk@2.3.3
|
||||
|
||||
## 2.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.2
|
||||
- @trigger.dev/sdk@2.3.2
|
||||
|
||||
## 2.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [f3efcc0c]
|
||||
- @trigger.dev/sdk@2.3.1
|
||||
- @trigger.dev/integration-kit@2.3.1
|
||||
|
||||
## 2.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 17f6f29d: Support for Deno, Bun and Cloudflare workers, as well as conditionally exporting ESM versions of the package instead of just commonjs.
|
||||
|
||||
Cloudflare worker support requires the node compat flag turned on (https://developers.cloudflare.com/workers/runtime-apis/nodejs/)
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17f6f29d]
|
||||
- @trigger.dev/integration-kit@2.3.0
|
||||
- @trigger.dev/sdk@2.3.0
|
||||
|
||||
## 2.2.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [de652c1d]
|
||||
- @trigger.dev/sdk@2.2.11
|
||||
- @trigger.dev/integration-kit@2.2.11
|
||||
|
||||
## 2.2.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.2.10
|
||||
- @trigger.dev/sdk@2.2.10
|
||||
|
||||
## 2.2.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/resend",
|
||||
"version": "2.2.9",
|
||||
"version": "2.3.3",
|
||||
"description": "The official Resend.com integration for Trigger.dev",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -8,15 +8,15 @@
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"dist/index.js",
|
||||
"dist/index.d.ts",
|
||||
"dist/index.js.map"
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
"@types/node": "18",
|
||||
"rimraf": "^3.0.2",
|
||||
"tsup": "^6.5.0"
|
||||
"tsup": "8.0.1",
|
||||
"@trigger.dev/tsup": "workspace:*",
|
||||
"typescript": "^5.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
@@ -24,11 +24,23 @@
|
||||
"build:tsup": "tsup"
|
||||
},
|
||||
"dependencies": {
|
||||
"@trigger.dev/integration-kit": "workspace:^2.2.9",
|
||||
"@trigger.dev/sdk": "workspace:^2.2.9",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.3.3",
|
||||
"@trigger.dev/sdk": "workspace:^2.3.3",
|
||||
"resend": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"module": "./dist/index.mjs"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
"@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"],
|
||||
"@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"],
|
||||
"@trigger.dev/integration-kit/*": ["../../packages/integration-kit/src/*"],
|
||||
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"]
|
||||
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"],
|
||||
"@trigger.dev/tsup/*": ["../../config-packages/tsup/src/*"],
|
||||
"@trigger.dev/tsup": ["../../config-packages/tsup/src/index"]
|
||||
},
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
import { defineConfig } from "tsup";
|
||||
import { defineConfigPackage } from "@trigger.dev/tsup";
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
name: "main",
|
||||
entry: ["./src/index.ts"],
|
||||
outDir: "./dist",
|
||||
platform: "node",
|
||||
format: ["cjs"],
|
||||
legacyOutput: true,
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
dts: true,
|
||||
treeshake: {
|
||||
preset: "smallest",
|
||||
},
|
||||
esbuildPlugins: [],
|
||||
external: ["http", "https", "util", "events", "tty", "os", "timers"],
|
||||
},
|
||||
]);
|
||||
export default defineConfigPackage;
|
||||
|
||||
@@ -1,5 +1,56 @@
|
||||
# @trigger.dev/sendgrid
|
||||
|
||||
## 2.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.3
|
||||
- @trigger.dev/sdk@2.3.3
|
||||
|
||||
## 2.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.2
|
||||
- @trigger.dev/sdk@2.3.2
|
||||
|
||||
## 2.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [f3efcc0c]
|
||||
- @trigger.dev/sdk@2.3.1
|
||||
- @trigger.dev/integration-kit@2.3.1
|
||||
|
||||
## 2.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 17f6f29d: Support for Deno, Bun and Cloudflare workers, as well as conditionally exporting ESM versions of the package instead of just commonjs.
|
||||
|
||||
Cloudflare worker support requires the node compat flag turned on (https://developers.cloudflare.com/workers/runtime-apis/nodejs/)
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17f6f29d]
|
||||
- @trigger.dev/integration-kit@2.3.0
|
||||
- @trigger.dev/sdk@2.3.0
|
||||
|
||||
## 2.2.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [de652c1d]
|
||||
- @trigger.dev/sdk@2.2.11
|
||||
- @trigger.dev/integration-kit@2.2.11
|
||||
|
||||
## 2.2.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.2.10
|
||||
- @trigger.dev/sdk@2.2.10
|
||||
|
||||
## 2.2.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/sendgrid",
|
||||
"version": "2.2.9",
|
||||
"version": "2.3.3",
|
||||
"description": "Trigger.dev integration for @sendgrid/mail",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -8,16 +8,15 @@
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"dist/index.js",
|
||||
"dist/index.d.ts",
|
||||
"dist/index.js.map"
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
"@types/node": "16.x",
|
||||
"rimraf": "^3.0.2",
|
||||
"tsup": "7.1.x",
|
||||
"typescript": "4.9.4"
|
||||
"tsup": "8.0.1",
|
||||
"typescript": "^5.3.0",
|
||||
"@trigger.dev/tsup": "workspace:*"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
@@ -27,10 +26,22 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@sendgrid/mail": "^7.7.0",
|
||||
"@trigger.dev/sdk": "workspace:^2.2.9",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.2.9"
|
||||
"@trigger.dev/sdk": "workspace:^2.3.3",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.3.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"module": "./dist/index.mjs"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
"@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"],
|
||||
"@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"],
|
||||
"@trigger.dev/integration-kit/*": ["../../packages/integration-kit/src/*"],
|
||||
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"]
|
||||
"@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"],
|
||||
"@trigger.dev/tsup/*": ["../../config-packages/tsup/src/*"],
|
||||
"@trigger.dev/tsup": ["../../config-packages/tsup/src/index"]
|
||||
},
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
import { defineConfigPackage } from "@trigger.dev/tsup";
|
||||
|
||||
import { defineConfig } from "tsup";
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
name: "main",
|
||||
entry: ["./src/index.ts"],
|
||||
outDir: "./dist",
|
||||
platform: "node",
|
||||
format: ["cjs"],
|
||||
legacyOutput: true,
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
dts: true,
|
||||
treeshake: {
|
||||
preset: "smallest",
|
||||
},
|
||||
esbuildPlugins: [],
|
||||
external: ["http", "https", "util", "events", "tty", "os", "timers"],
|
||||
},
|
||||
]);
|
||||
|
||||
export default defineConfigPackage;
|
||||
|
||||
@@ -1,5 +1,57 @@
|
||||
# @trigger.dev/shopify
|
||||
|
||||
## 2.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.3
|
||||
- @trigger.dev/sdk@2.3.3
|
||||
|
||||
## 2.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.2
|
||||
- @trigger.dev/sdk@2.3.2
|
||||
|
||||
## 2.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [f3efcc0c]
|
||||
- @trigger.dev/sdk@2.3.1
|
||||
- @trigger.dev/integration-kit@2.3.1
|
||||
|
||||
## 2.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 17f6f29d: Support for Deno, Bun and Cloudflare workers, as well as conditionally exporting ESM versions of the package instead of just commonjs.
|
||||
|
||||
Cloudflare worker support requires the node compat flag turned on (https://developers.cloudflare.com/workers/runtime-apis/nodejs/)
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17f6f29d]
|
||||
- @trigger.dev/integration-kit@2.3.0
|
||||
- @trigger.dev/sdk@2.3.0
|
||||
|
||||
## 2.2.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- de652c1d: Fix Shopify task types and KV `get()` return types
|
||||
- Updated dependencies [de652c1d]
|
||||
- @trigger.dev/sdk@2.2.11
|
||||
- @trigger.dev/integration-kit@2.2.11
|
||||
|
||||
## 2.2.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.2.10
|
||||
- @trigger.dev/sdk@2.2.10
|
||||
|
||||
## 2.2.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/shopify",
|
||||
"version": "2.2.9",
|
||||
"version": "2.3.3",
|
||||
"description": "Trigger.dev integration for @shopify/shopify-api",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -8,16 +8,15 @@
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"dist/index.js",
|
||||
"dist/index.d.ts",
|
||||
"dist/index.js.map"
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
"@types/node": "16.x",
|
||||
"rimraf": "^3.0.2",
|
||||
"tsup": "7.1.x",
|
||||
"typescript": "4.9.4"
|
||||
"tsup": "8.0.1",
|
||||
"typescript": "^5.3.0",
|
||||
"@trigger.dev/tsup": "workspace:*"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
@@ -27,11 +26,23 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@shopify/shopify-api": "^8.0.2",
|
||||
"@trigger.dev/sdk": "workspace:^2.2.9",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.2.9",
|
||||
"@trigger.dev/sdk": "workspace:^2.3.3",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.3.3",
|
||||
"zod": "3.22.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"module": "./dist/index.mjs"
|
||||
}
|
||||
|
||||
@@ -9,8 +9,23 @@ import {
|
||||
ShopifyInputType,
|
||||
} from "./types";
|
||||
|
||||
type AllReturnType<TResource extends ShopifyRestResources[ResourcesWithStandardMethods]> = Promise<{
|
||||
data: RecursiveShopifySerializer<Awaited<ReturnType<TResource["all"]>>["data"]>;
|
||||
type ResourceArrayWithIndexSignature<T extends any[]> = T extends Array<infer U>
|
||||
? Array<U & { [key: string]: any }>
|
||||
: never;
|
||||
|
||||
type RecursiveSomeNonNullable<T, TSome> = T extends object
|
||||
? T extends Array<infer U>
|
||||
? Array<RecursiveSomeNonNullable<U, TSome extends keyof U ? TSome : never>>
|
||||
: SomeNonNullable<T, TSome extends keyof T ? TSome : never>
|
||||
: T;
|
||||
|
||||
type AllReturnType<
|
||||
TResource extends ShopifyRestResources[ResourcesWithStandardMethods],
|
||||
TSerializedData extends Record<any, any>[] = RecursiveShopifySerializer<
|
||||
Awaited<ReturnType<TResource["all"]>>["data"]
|
||||
>,
|
||||
> = Promise<{
|
||||
data: ResourceArrayWithIndexSignature<RecursiveSomeNonNullable<TSerializedData, "id">>;
|
||||
pageInfo?: PageInfo;
|
||||
}>;
|
||||
|
||||
@@ -18,13 +33,23 @@ type CountReturnType = Promise<{ count: number }>;
|
||||
|
||||
type DeleteReturnType = Promise<void>;
|
||||
|
||||
type FindReturnType<
|
||||
TResource extends ShopifyRestResources[ResourcesWithStandardMethods],
|
||||
TSerialized extends Record<any, any> = RecursiveShopifySerializer<InstanceType<TResource>>,
|
||||
> = Promise<
|
||||
| (SomeNonNullable<TSerialized, "id"> & {
|
||||
[key: string]: any;
|
||||
})
|
||||
| null
|
||||
>;
|
||||
|
||||
type SaveReturnType<
|
||||
TResource extends ShopifyRestResources[ResourcesWithStandardMethods],
|
||||
TUpdate extends boolean,
|
||||
TFromData extends any,
|
||||
> = Promise<
|
||||
TUpdate extends true
|
||||
? SomeNonNullable<RecursiveShopifySerializer<TResource["prototype"], false>, "id">
|
||||
? SomeNonNullable<RecursiveShopifySerializer<TResource["prototype"]>, "id">
|
||||
: TFromData
|
||||
>;
|
||||
|
||||
@@ -58,14 +83,18 @@ export class Resource<
|
||||
/**
|
||||
* Fetch a single resource by its ID.
|
||||
*/
|
||||
async find(key: string, params: Optional<Parameters<TResource["find"]>[0], "session">) {
|
||||
async find(
|
||||
key: string,
|
||||
params: Optional<Parameters<TResource["find"]>[0], "session">
|
||||
): FindReturnType<TResource> {
|
||||
return this.runTask(
|
||||
key,
|
||||
async (client, task, io) => {
|
||||
const abc = this.#withSession(params ?? {});
|
||||
const resource = await client.rest[this.resourceType].find(this.#withSession(params));
|
||||
const resource = (await client.rest[this.resourceType].find(
|
||||
this.#withSession(params)
|
||||
)) as Awaited<ReturnType<TResource["find"]>>;
|
||||
|
||||
return serializeShopifyResource(resource);
|
||||
return JSON.parse(JSON.stringify(resource));
|
||||
},
|
||||
{
|
||||
name: `Find ${this.resourceType}`,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
ObjectNonNullable,
|
||||
OmitFunctions,
|
||||
OmitIndexSignature,
|
||||
OmitValues,
|
||||
@@ -7,16 +6,14 @@ import {
|
||||
} from "@trigger.dev/integration-kit";
|
||||
import { ShopifyRestResources } from "./index";
|
||||
|
||||
type OmitNonSerializable<T> = Omit<OmitFunctions<OmitIndexSignature<T>>, "session">;
|
||||
type OmitNonSerializable<T> = OmitFunctions<OmitIndexSignature<T>>;
|
||||
|
||||
export type SerializedShopifyResource<T, TNonNullable extends boolean = true> = Prettify<
|
||||
TNonNullable extends true ? ObjectNonNullable<OmitNonSerializable<T>> : OmitNonSerializable<T>
|
||||
>;
|
||||
export type SerializedShopifyResource<T> = Prettify<Omit<OmitNonSerializable<T>, "session">>;
|
||||
|
||||
export type RecursiveShopifySerializer<T, TNonNullable extends boolean = true> = T extends object
|
||||
export type RecursiveShopifySerializer<T> = T extends object
|
||||
? T extends Array<infer U>
|
||||
? Array<RecursiveShopifySerializer<U>>
|
||||
: SerializedShopifyResource<T, TNonNullable>
|
||||
: SerializedShopifyResource<T>
|
||||
: T;
|
||||
|
||||
export type ShopifyReturnType<
|
||||
@@ -42,7 +39,7 @@ export type ShopifyWebhookPayload = {
|
||||
|
||||
export type ShopifyInputType = {
|
||||
[K in keyof OmitIndexSignature<ShopifyRestResources>]: Prettify<
|
||||
Partial<SerializedShopifyResource<ShopifyResource<K>, false>>
|
||||
Partial<SerializedShopifyResource<ShopifyResource<K>>>
|
||||
> & { id?: number };
|
||||
};
|
||||
|
||||
|
||||
@@ -105,6 +105,10 @@ export function createWebhookEventSource(integration: Shopify) {
|
||||
delete: async ({ io, ctx }) => {
|
||||
const webhookId = await io.store.job.get<number>("get-webhook-id", "webhook-id");
|
||||
|
||||
if (!webhookId) {
|
||||
throw new Error("Missing webhook ID for delete operation.");
|
||||
}
|
||||
|
||||
await io.integration.rest.Webhook.delete("delete-webhook", {
|
||||
id: webhookId,
|
||||
});
|
||||
@@ -130,6 +134,10 @@ export function createWebhookEventSource(integration: Shopify) {
|
||||
`${registerJobNamespace(ctx.key)}:webhook-secret`
|
||||
);
|
||||
|
||||
if (!clientSecret) {
|
||||
throw new Error("Missing secret for verification.");
|
||||
}
|
||||
|
||||
return await verifyRequestSignature({
|
||||
request,
|
||||
headerName: "x-shopify-hmac-sha256",
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
import { defineConfig } from "tsup";
|
||||
import { defineConfigPackage } from "@trigger.dev/tsup";
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
name: "main",
|
||||
entry: ["./src/index.ts"],
|
||||
outDir: "./dist",
|
||||
platform: "node",
|
||||
format: ["cjs"],
|
||||
legacyOutput: true,
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
dts: true,
|
||||
treeshake: {
|
||||
preset: "smallest",
|
||||
},
|
||||
esbuildPlugins: [],
|
||||
external: ["http", "https", "util", "events", "tty", "os", "timers"],
|
||||
},
|
||||
]);
|
||||
export default defineConfigPackage;
|
||||
|
||||
@@ -1,5 +1,50 @@
|
||||
# @trigger.dev/slack
|
||||
|
||||
## 2.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/sdk@2.3.3
|
||||
|
||||
## 2.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/sdk@2.3.2
|
||||
|
||||
## 2.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [f3efcc0c]
|
||||
- @trigger.dev/sdk@2.3.1
|
||||
|
||||
## 2.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 17f6f29d: Support for Deno, Bun and Cloudflare workers, as well as conditionally exporting ESM versions of the package instead of just commonjs.
|
||||
|
||||
Cloudflare worker support requires the node compat flag turned on (https://developers.cloudflare.com/workers/runtime-apis/nodejs/)
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17f6f29d]
|
||||
- @trigger.dev/sdk@2.3.0
|
||||
|
||||
## 2.2.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [de652c1d]
|
||||
- @trigger.dev/sdk@2.2.11
|
||||
|
||||
## 2.2.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/sdk@2.2.10
|
||||
|
||||
## 2.2.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/slack",
|
||||
"version": "2.2.9",
|
||||
"version": "2.3.3",
|
||||
"description": "The official Slack integration for Trigger.dev",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -8,15 +8,15 @@
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"dist/index.js",
|
||||
"dist/index.d.ts",
|
||||
"dist/index.js.map"
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
"@types/node": "18",
|
||||
"rimraf": "^3.0.2",
|
||||
"tsup": "^6.5.0"
|
||||
"tsup": "8.0.1",
|
||||
"@trigger.dev/tsup": "workspace:*",
|
||||
"typescript": "^5.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
@@ -25,10 +25,22 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@slack/web-api": "^6.8.1",
|
||||
"@trigger.dev/sdk": "workspace:^2.2.9",
|
||||
"@trigger.dev/sdk": "workspace:^2.3.3",
|
||||
"zod": "3.22.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"module": "./dist/index.mjs"
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
"lib": ["DOM", "DOM.Iterable", "ES2019"],
|
||||
"paths": {
|
||||
"@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"],
|
||||
"@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"]
|
||||
"@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"],
|
||||
"@trigger.dev/tsup/*": ["../../config-packages/tsup/src/*"],
|
||||
"@trigger.dev/tsup": ["../../config-packages/tsup/src/index"]
|
||||
},
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
import { defineConfig } from "tsup";
|
||||
import { defineConfigPackage } from "@trigger.dev/tsup";
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
name: "main",
|
||||
entry: ["./src/index.ts"],
|
||||
outDir: "./dist",
|
||||
platform: "node",
|
||||
format: ["cjs"],
|
||||
legacyOutput: true,
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
dts: true,
|
||||
treeshake: {
|
||||
preset: "smallest",
|
||||
},
|
||||
esbuildPlugins: [],
|
||||
external: ["http", "https", "util", "events", "tty", "os", "timers"],
|
||||
},
|
||||
]);
|
||||
export default defineConfigPackage;
|
||||
|
||||
@@ -1,5 +1,57 @@
|
||||
# @trigger.dev/stripe
|
||||
|
||||
## 2.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.3
|
||||
- @trigger.dev/sdk@2.3.3
|
||||
|
||||
## 2.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @trigger.dev/integration-kit@2.3.2
|
||||
- @trigger.dev/sdk@2.3.2
|
||||
|
||||
## 2.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [f3efcc0c]
|
||||
- @trigger.dev/sdk@2.3.1
|
||||
- @trigger.dev/integration-kit@2.3.1
|
||||
|
||||
## 2.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 17f6f29d: Support for Deno, Bun and Cloudflare workers, as well as conditionally exporting ESM versions of the package instead of just commonjs.
|
||||
|
||||
Cloudflare worker support requires the node compat flag turned on (https://developers.cloudflare.com/workers/runtime-apis/nodejs/)
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [17f6f29d]
|
||||
- @trigger.dev/integration-kit@2.3.0
|
||||
- @trigger.dev/sdk@2.3.0
|
||||
|
||||
## 2.2.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [de652c1d]
|
||||
- @trigger.dev/sdk@2.2.11
|
||||
- @trigger.dev/integration-kit@2.2.11
|
||||
|
||||
## 2.2.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 7e3a82ef: Added invoice and invoice item webhook triggers
|
||||
- @trigger.dev/integration-kit@2.2.10
|
||||
- @trigger.dev/sdk@2.2.10
|
||||
|
||||
## 2.2.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/stripe",
|
||||
"version": "2.2.9",
|
||||
"version": "2.3.3",
|
||||
"description": "Trigger.dev integration for stripe",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -8,16 +8,15 @@
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"dist/index.js",
|
||||
"dist/index.d.ts",
|
||||
"dist/index.js.map"
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "16.x",
|
||||
"rimraf": "^3.0.2",
|
||||
"stripe-event-types": "^2.4.0",
|
||||
"tsup": "7.1.x",
|
||||
"typescript": "4.9.4"
|
||||
"tsup": "8.0.1",
|
||||
"typescript": "^5.3.0",
|
||||
"@trigger.dev/tsup": "workspace:*"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
@@ -26,12 +25,24 @@
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@trigger.dev/integration-kit": "workspace:^2.2.9",
|
||||
"@trigger.dev/sdk": "workspace:^2.2.9",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.3.3",
|
||||
"@trigger.dev/sdk": "workspace:^2.3.3",
|
||||
"stripe": "^12.14.0",
|
||||
"zod": "3.22.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"module": "./dist/index.mjs"
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import {
|
||||
OnCustomerEvent,
|
||||
OnCustomerSubscription,
|
||||
OnExternalAccountEvent,
|
||||
OnInvoiceEvent,
|
||||
OnInvoiceItemEvent,
|
||||
OnPaymentIntentEvent,
|
||||
OnPayoutEvent,
|
||||
OnPersonEvent,
|
||||
@@ -932,3 +934,660 @@ export const onPayoutUpdated: EventSpecification<OnPayoutEvent> = {
|
||||
{ label: "Amount", text: `${payload.amount} ${payload.currency}` },
|
||||
],
|
||||
};
|
||||
|
||||
export const onInvoice: EventSpecification<OnInvoiceEvent> = {
|
||||
name: [
|
||||
"invoice.created",
|
||||
"invoice.finalized",
|
||||
"invoice.finalization_failed",
|
||||
"invoice.deleted",
|
||||
"invoice.marked_uncollectible",
|
||||
"invoice.paid",
|
||||
"invoice.payment_action_required",
|
||||
"invoice.payment_failed",
|
||||
"invoice.payment_succeeded",
|
||||
"invoice.sent",
|
||||
"invoice.upcoming",
|
||||
"invoice.voided",
|
||||
],
|
||||
title: "On Invoice Event",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
parsePayload: (payload) => payload as OnInvoiceEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onInvoiceCreated: EventSpecification<OnInvoiceEvent> = {
|
||||
name: "invoice.created",
|
||||
title: "On Invoice Created",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [
|
||||
{
|
||||
id: "invoice.created",
|
||||
name: "Invoice Created",
|
||||
icon: "stripe",
|
||||
payload: {
|
||||
id: "in_1OIBngI0XSgju2urLPfyF8yN",
|
||||
object: "invoice",
|
||||
account_country: "GB",
|
||||
account_name: "Trigger.dev",
|
||||
account_tax_ids: null,
|
||||
amount_due: 2000,
|
||||
amount_paid: 0,
|
||||
amount_remaining: 2000,
|
||||
amount_shipping: 0,
|
||||
application: null,
|
||||
application_fee_amount: null,
|
||||
attempt_count: 0,
|
||||
attempted: false,
|
||||
auto_advance: false,
|
||||
automatic_tax: {
|
||||
enabled: false,
|
||||
status: null,
|
||||
},
|
||||
billing_reason: "manual",
|
||||
charge: null,
|
||||
collection_method: "charge_automatically",
|
||||
created: 1701356712,
|
||||
currency: "usd",
|
||||
custom_fields: null,
|
||||
customer: "cus_P6Oaqh5b0bx59U",
|
||||
customer_address: null,
|
||||
customer_email: null,
|
||||
customer_name: null,
|
||||
customer_phone: null,
|
||||
customer_shipping: null,
|
||||
customer_tax_exempt: "none",
|
||||
customer_tax_ids: [],
|
||||
default_payment_method: null,
|
||||
default_source: null,
|
||||
default_tax_rates: [],
|
||||
description: "(created by Stripe CLI)",
|
||||
discount: null,
|
||||
discounts: [],
|
||||
due_date: null,
|
||||
effective_at: null,
|
||||
ending_balance: null,
|
||||
footer: null,
|
||||
from_invoice: null,
|
||||
hosted_invoice_url: null,
|
||||
invoice_pdf: null,
|
||||
last_finalization_error: null,
|
||||
latest_revision: null,
|
||||
lines: {
|
||||
object: "list",
|
||||
data: [
|
||||
{
|
||||
id: "il_1OIBngI0XSgju2urOIBrJ3GK",
|
||||
object: "line_item",
|
||||
amount: 2000,
|
||||
amount_excluding_tax: 2000,
|
||||
currency: "usd",
|
||||
description: "(created by Stripe CLI)",
|
||||
discount_amounts: [],
|
||||
discountable: true,
|
||||
discounts: [],
|
||||
invoice_item: "ii_1OIBngI0XSgju2urw3wl9FUf",
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
period: {
|
||||
end: 1701356712,
|
||||
start: 1701356712,
|
||||
},
|
||||
plan: null,
|
||||
price: {
|
||||
id: "price_1OIBngI0XSgju2urxiG1M9fT",
|
||||
object: "price",
|
||||
active: false,
|
||||
billing_scheme: "per_unit",
|
||||
created: 1701356712,
|
||||
currency: "usd",
|
||||
custom_unit_amount: null,
|
||||
livemode: false,
|
||||
lookup_key: null,
|
||||
metadata: {},
|
||||
nickname: null,
|
||||
product: "prod_P6Oatqn6T5L2Ey",
|
||||
recurring: null,
|
||||
tax_behavior: "unspecified",
|
||||
tiers_mode: null,
|
||||
transform_quantity: null,
|
||||
type: "one_time",
|
||||
unit_amount: 2000,
|
||||
unit_amount_decimal: "2000",
|
||||
},
|
||||
proration: false,
|
||||
proration_details: {
|
||||
credited_items: null,
|
||||
},
|
||||
quantity: 1,
|
||||
subscription: null,
|
||||
tax_amounts: [],
|
||||
tax_rates: [],
|
||||
type: "invoiceitem",
|
||||
unit_amount_excluding_tax: "2000",
|
||||
},
|
||||
],
|
||||
has_more: false,
|
||||
total_count: 1,
|
||||
url: "/v1/invoices/in_1OIBngI0XSgju2urLPfyF8yN/lines",
|
||||
},
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
next_payment_attempt: null,
|
||||
number: null,
|
||||
on_behalf_of: null,
|
||||
paid: false,
|
||||
paid_out_of_band: false,
|
||||
payment_intent: null,
|
||||
payment_settings: {
|
||||
default_mandate: null,
|
||||
payment_method_options: null,
|
||||
payment_method_types: null,
|
||||
},
|
||||
period_end: 1701356712,
|
||||
period_start: 1701356712,
|
||||
post_payment_credit_notes_amount: 0,
|
||||
pre_payment_credit_notes_amount: 0,
|
||||
quote: null,
|
||||
receipt_number: null,
|
||||
rendering: {
|
||||
amount_tax_display: null,
|
||||
pdf: {
|
||||
page_size: "auto",
|
||||
},
|
||||
},
|
||||
rendering_options: null,
|
||||
shipping_cost: null,
|
||||
shipping_details: null,
|
||||
starting_balance: 0,
|
||||
statement_descriptor: null,
|
||||
status: "draft",
|
||||
status_transitions: {
|
||||
finalized_at: null,
|
||||
marked_uncollectible_at: null,
|
||||
paid_at: null,
|
||||
voided_at: null,
|
||||
},
|
||||
subscription: null,
|
||||
subscription_details: {
|
||||
metadata: null,
|
||||
},
|
||||
subtotal: 2000,
|
||||
subtotal_excluding_tax: 2000,
|
||||
tax: null,
|
||||
test_clock: null,
|
||||
total: 2000,
|
||||
total_discount_amounts: [],
|
||||
total_excluding_tax: 2000,
|
||||
total_tax_amounts: [],
|
||||
transfer_data: null,
|
||||
webhooks_delivered_at: null,
|
||||
},
|
||||
},
|
||||
],
|
||||
parsePayload: (payload) => payload as OnInvoiceEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onInvoiceFinalized: EventSpecification<OnInvoiceEvent> = {
|
||||
name: "invoice.finalized",
|
||||
title: "On Invoice Finalized",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [
|
||||
{
|
||||
id: "invoice.finalized",
|
||||
name: "Invoice Finalized",
|
||||
icon: "stripe",
|
||||
payload: {
|
||||
id: "in_1OIBqbI0XSgju2urMmXEFbj3",
|
||||
object: "invoice",
|
||||
account_country: "GB",
|
||||
account_name: "Trigger.dev",
|
||||
account_tax_ids: null,
|
||||
amount_due: 2000,
|
||||
amount_paid: 0,
|
||||
amount_remaining: 2000,
|
||||
amount_shipping: 0,
|
||||
application: null,
|
||||
application_fee_amount: null,
|
||||
attempt_count: 0,
|
||||
attempted: false,
|
||||
auto_advance: false,
|
||||
automatic_tax: {
|
||||
enabled: false,
|
||||
status: null,
|
||||
},
|
||||
billing_reason: "manual",
|
||||
charge: null,
|
||||
collection_method: "charge_automatically",
|
||||
created: 1701356892,
|
||||
currency: "usd",
|
||||
custom_fields: null,
|
||||
customer: "cus_P6Od2vu85eNeMI",
|
||||
customer_address: null,
|
||||
customer_email: null,
|
||||
customer_name: null,
|
||||
customer_phone: null,
|
||||
customer_shipping: null,
|
||||
customer_tax_exempt: "none",
|
||||
customer_tax_ids: [],
|
||||
default_payment_method: null,
|
||||
default_source: null,
|
||||
default_tax_rates: [],
|
||||
description: "(created by Stripe CLI)",
|
||||
discount: null,
|
||||
discounts: [],
|
||||
due_date: null,
|
||||
effective_at: 1701356893,
|
||||
ending_balance: 0,
|
||||
footer: null,
|
||||
from_invoice: null,
|
||||
hosted_invoice_url:
|
||||
"https://invoice.stripe.com/i/acct_1MRmG4I0XSgju2ur/test_YWNjdF8xTVJtRzRJMFhTZ2p1MnVyLF9QNk9kYmlDaVZyek53UXRJbUhEdmNxa1pPSUtKbmdPLDkxODk3Njk00200Ibh1G5H7?s=ap",
|
||||
invoice_pdf:
|
||||
"https://pay.stripe.com/invoice/acct_1MRmG4I0XSgju2ur/test_YWNjdF8xTVJtRzRJMFhTZ2p1MnVyLF9QNk9kYmlDaVZyek53UXRJbUhEdmNxa1pPSUtKbmdPLDkxODk3Njk00200Ibh1G5H7/pdf?s=ap",
|
||||
last_finalization_error: null,
|
||||
latest_revision: null,
|
||||
lines: {
|
||||
object: "list",
|
||||
data: [
|
||||
{
|
||||
id: "il_1OIBqaI0XSgju2urWRv5yH9h",
|
||||
object: "line_item",
|
||||
amount: 2000,
|
||||
amount_excluding_tax: 2000,
|
||||
currency: "usd",
|
||||
description: "(created by Stripe CLI)",
|
||||
discount_amounts: [],
|
||||
discountable: true,
|
||||
discounts: [],
|
||||
invoice_item: "ii_1OIBqaI0XSgju2urik7fdYlI",
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
period: {
|
||||
end: 1701356892,
|
||||
start: 1701356892,
|
||||
},
|
||||
plan: null,
|
||||
price: {
|
||||
id: "price_1OIBngI0XSgju2urxiG1M9fT",
|
||||
object: "price",
|
||||
active: false,
|
||||
billing_scheme: "per_unit",
|
||||
created: 1701356712,
|
||||
currency: "usd",
|
||||
custom_unit_amount: null,
|
||||
livemode: false,
|
||||
lookup_key: null,
|
||||
metadata: {},
|
||||
nickname: null,
|
||||
product: "prod_P6Oatqn6T5L2Ey",
|
||||
recurring: null,
|
||||
tax_behavior: "unspecified",
|
||||
tiers_mode: null,
|
||||
transform_quantity: null,
|
||||
type: "one_time",
|
||||
unit_amount: 2000,
|
||||
unit_amount_decimal: "2000",
|
||||
},
|
||||
proration: false,
|
||||
proration_details: {
|
||||
credited_items: null,
|
||||
},
|
||||
quantity: 1,
|
||||
subscription: null,
|
||||
tax_amounts: [],
|
||||
tax_rates: [],
|
||||
type: "invoiceitem",
|
||||
unit_amount_excluding_tax: "2000",
|
||||
},
|
||||
],
|
||||
has_more: false,
|
||||
total_count: 1,
|
||||
url: "/v1/invoices/in_1OIBqbI0XSgju2urMmXEFbj3/lines",
|
||||
},
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
next_payment_attempt: null,
|
||||
number: "FD943C29-0111",
|
||||
on_behalf_of: null,
|
||||
paid: false,
|
||||
paid_out_of_band: false,
|
||||
payment_intent: "pi_3OIBqbI0XSgju2ur0BelVhdO",
|
||||
payment_settings: {
|
||||
default_mandate: null,
|
||||
payment_method_options: null,
|
||||
payment_method_types: null,
|
||||
},
|
||||
period_end: 1701356892,
|
||||
period_start: 1701356892,
|
||||
post_payment_credit_notes_amount: 0,
|
||||
pre_payment_credit_notes_amount: 0,
|
||||
quote: null,
|
||||
receipt_number: null,
|
||||
rendering: {
|
||||
amount_tax_display: null,
|
||||
pdf: {
|
||||
page_size: "letter",
|
||||
},
|
||||
},
|
||||
rendering_options: null,
|
||||
shipping_cost: null,
|
||||
shipping_details: null,
|
||||
starting_balance: 0,
|
||||
statement_descriptor: null,
|
||||
status: "open",
|
||||
status_transitions: {
|
||||
finalized_at: 1701356893,
|
||||
marked_uncollectible_at: null,
|
||||
paid_at: null,
|
||||
voided_at: null,
|
||||
},
|
||||
subscription: null,
|
||||
subscription_details: {
|
||||
metadata: null,
|
||||
},
|
||||
subtotal: 2000,
|
||||
subtotal_excluding_tax: 2000,
|
||||
tax: null,
|
||||
test_clock: null,
|
||||
total: 2000,
|
||||
total_discount_amounts: [],
|
||||
total_excluding_tax: 2000,
|
||||
total_tax_amounts: [],
|
||||
transfer_data: null,
|
||||
webhooks_delivered_at: 1701356893,
|
||||
},
|
||||
},
|
||||
],
|
||||
parsePayload: (payload) => payload as OnInvoiceEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onInvoiceFinalizationFailed: EventSpecification<OnInvoiceEvent> = {
|
||||
name: "invoice.finalization_failed",
|
||||
title: "On Invoice Finalization failed",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
parsePayload: (payload) => payload as OnInvoiceEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onInvoiceDeleted: EventSpecification<OnInvoiceEvent> = {
|
||||
name: "invoice.deleted",
|
||||
title: "On Invoice Deleted",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
parsePayload: (payload) => payload as OnInvoiceEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onInvoiceMarkedUncollectible: EventSpecification<OnInvoiceEvent> = {
|
||||
name: "invoice.marked_uncollectible",
|
||||
title: "On Invoice Deleted",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
parsePayload: (payload) => payload as OnInvoiceEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onInvoicePaid: EventSpecification<OnInvoiceEvent> = {
|
||||
name: "invoice.paid",
|
||||
title: "On Invoice Paid",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [
|
||||
{
|
||||
id: "invoice.paid",
|
||||
name: "Invoice Paid",
|
||||
icon: "stripe",
|
||||
payload: {
|
||||
id: "in_1OIBuTI0XSgju2urKkqZFraX",
|
||||
object: "invoice",
|
||||
account_country: "GB",
|
||||
account_name: "Trigger.dev",
|
||||
account_tax_ids: null,
|
||||
amount_due: 2000,
|
||||
amount_paid: 2000,
|
||||
amount_remaining: 0,
|
||||
amount_shipping: 0,
|
||||
application: null,
|
||||
application_fee_amount: null,
|
||||
attempt_count: 1,
|
||||
attempted: true,
|
||||
auto_advance: false,
|
||||
automatic_tax: {
|
||||
enabled: false,
|
||||
status: null,
|
||||
},
|
||||
billing_reason: "manual",
|
||||
charge: "ch_3OIBuUI0XSgju2ur1ibTvTmE",
|
||||
collection_method: "charge_automatically",
|
||||
created: 1701357133,
|
||||
currency: "usd",
|
||||
custom_fields: null,
|
||||
customer: "cus_P6OhphiNsxG9aM",
|
||||
customer_address: null,
|
||||
customer_email: null,
|
||||
customer_name: null,
|
||||
customer_phone: null,
|
||||
customer_shipping: null,
|
||||
customer_tax_exempt: "none",
|
||||
customer_tax_ids: [],
|
||||
default_payment_method: null,
|
||||
default_source: null,
|
||||
default_tax_rates: [],
|
||||
description: "(created by Stripe CLI)",
|
||||
discount: null,
|
||||
discounts: [],
|
||||
due_date: null,
|
||||
effective_at: 1701357134,
|
||||
ending_balance: 0,
|
||||
footer: null,
|
||||
from_invoice: null,
|
||||
hosted_invoice_url:
|
||||
"https://invoice.stripe.com/i/acct_1MRmG4I0XSgju2ur/test_YWNjdF8xTVJtRzRJMFhTZ2p1MnVyLF9QNk9oeUJwdXpYVUtrb0hVQmJHYUFDclZhbmVha2w5LDkxODk3OTM20200JlMCKvkD?s=ap",
|
||||
invoice_pdf:
|
||||
"https://pay.stripe.com/invoice/acct_1MRmG4I0XSgju2ur/test_YWNjdF8xTVJtRzRJMFhTZ2p1MnVyLF9QNk9oeUJwdXpYVUtrb0hVQmJHYUFDclZhbmVha2w5LDkxODk3OTM20200JlMCKvkD/pdf?s=ap",
|
||||
last_finalization_error: null,
|
||||
latest_revision: null,
|
||||
lines: {
|
||||
object: "list",
|
||||
data: [
|
||||
{
|
||||
id: "il_1OIBuTI0XSgju2urpRdDk5DO",
|
||||
object: "line_item",
|
||||
amount: 2000,
|
||||
amount_excluding_tax: 2000,
|
||||
currency: "usd",
|
||||
description: "(created by Stripe CLI)",
|
||||
discount_amounts: [],
|
||||
discountable: true,
|
||||
discounts: [],
|
||||
invoice_item: "ii_1OIBuTI0XSgju2urRDAJz6ec",
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
period: {
|
||||
end: 1701357133,
|
||||
start: 1701357133,
|
||||
},
|
||||
plan: null,
|
||||
price: {
|
||||
id: "price_1OIBngI0XSgju2urxiG1M9fT",
|
||||
object: "price",
|
||||
active: false,
|
||||
billing_scheme: "per_unit",
|
||||
created: 1701356712,
|
||||
currency: "usd",
|
||||
custom_unit_amount: null,
|
||||
livemode: false,
|
||||
lookup_key: null,
|
||||
metadata: {},
|
||||
nickname: null,
|
||||
product: "prod_P6Oatqn6T5L2Ey",
|
||||
recurring: null,
|
||||
tax_behavior: "unspecified",
|
||||
tiers_mode: null,
|
||||
transform_quantity: null,
|
||||
type: "one_time",
|
||||
unit_amount: 2000,
|
||||
unit_amount_decimal: "2000",
|
||||
},
|
||||
proration: false,
|
||||
proration_details: {
|
||||
credited_items: null,
|
||||
},
|
||||
quantity: 1,
|
||||
subscription: null,
|
||||
tax_amounts: [],
|
||||
tax_rates: [],
|
||||
type: "invoiceitem",
|
||||
unit_amount_excluding_tax: "2000",
|
||||
},
|
||||
],
|
||||
has_more: false,
|
||||
total_count: 1,
|
||||
url: "/v1/invoices/in_1OIBuTI0XSgju2urKkqZFraX/lines",
|
||||
},
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
next_payment_attempt: null,
|
||||
number: "FD943C29-0112",
|
||||
on_behalf_of: null,
|
||||
paid: true,
|
||||
paid_out_of_band: false,
|
||||
payment_intent: "pi_3OIBuUI0XSgju2ur15gtauR9",
|
||||
payment_settings: {
|
||||
default_mandate: null,
|
||||
payment_method_options: null,
|
||||
payment_method_types: null,
|
||||
},
|
||||
period_end: 1701357133,
|
||||
period_start: 1701357133,
|
||||
post_payment_credit_notes_amount: 0,
|
||||
pre_payment_credit_notes_amount: 0,
|
||||
quote: null,
|
||||
receipt_number: null,
|
||||
rendering: {
|
||||
amount_tax_display: null,
|
||||
pdf: {
|
||||
page_size: "letter",
|
||||
},
|
||||
},
|
||||
rendering_options: null,
|
||||
shipping_cost: null,
|
||||
shipping_details: null,
|
||||
starting_balance: 0,
|
||||
statement_descriptor: null,
|
||||
status: "paid",
|
||||
status_transitions: {
|
||||
finalized_at: 1701357134,
|
||||
marked_uncollectible_at: null,
|
||||
paid_at: 1701357134,
|
||||
voided_at: null,
|
||||
},
|
||||
subscription: null,
|
||||
subscription_details: {
|
||||
metadata: null,
|
||||
},
|
||||
subtotal: 2000,
|
||||
subtotal_excluding_tax: 2000,
|
||||
tax: null,
|
||||
test_clock: null,
|
||||
total: 2000,
|
||||
total_discount_amounts: [],
|
||||
total_excluding_tax: 2000,
|
||||
total_tax_amounts: [],
|
||||
transfer_data: null,
|
||||
webhooks_delivered_at: 1701357134,
|
||||
},
|
||||
},
|
||||
],
|
||||
parsePayload: (payload) => payload as OnInvoiceEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onInvoicePaymentActionRequired: EventSpecification<OnInvoiceEvent> = {
|
||||
name: "invoice.payment_action_required",
|
||||
title: "On Invoice Payment Action Required",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
parsePayload: (payload) => payload as OnInvoiceEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onInvoicePaymentFailed: EventSpecification<OnInvoiceEvent> = {
|
||||
name: "invoice.payment_failed",
|
||||
title: "On Invoice Payment Failed",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
parsePayload: (payload) => payload as OnInvoiceEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onInvoicePaymentSucceeded: EventSpecification<OnInvoiceEvent> = {
|
||||
name: "invoice.payment_succeeded",
|
||||
title: "On Invoice Payment Succeeded",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
parsePayload: (payload) => payload as OnInvoiceEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onInvoiceSent: EventSpecification<OnInvoiceEvent> = {
|
||||
name: "invoice.sent",
|
||||
title: "On Invoice Sent",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
parsePayload: (payload) => payload as OnInvoiceEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onInvoiceUpcoming: EventSpecification<OnInvoiceEvent> = {
|
||||
name: "invoice.upcoming",
|
||||
title: "On Invoice Upcoming",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
parsePayload: (payload) => payload as OnInvoiceEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onInvoiceUpdated: EventSpecification<OnInvoiceEvent> = {
|
||||
name: "invoice.updated",
|
||||
title: "On Invoice Updated",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
parsePayload: (payload) => payload as OnInvoiceEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onInvoiceVoided: EventSpecification<OnInvoiceEvent> = {
|
||||
name: "invoice.voided",
|
||||
title: "On Invoice Voided",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
parsePayload: (payload) => payload as OnInvoiceEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onInvoiceItemCreated: EventSpecification<OnInvoiceItemEvent> = {
|
||||
name: "invoiceitem.created",
|
||||
title: "On Invoice Item Created",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
parsePayload: (payload) => payload as OnInvoiceItemEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice Item ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onInvoiceItemDeleted: EventSpecification<OnInvoiceItemEvent> = {
|
||||
name: "invoiceitem.deleted",
|
||||
title: "On Invoice Item Deleted",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
parsePayload: (payload) => payload as OnInvoiceItemEvent,
|
||||
runProperties: (payload) => [{ label: "Invoice Item ID", text: payload.id }],
|
||||
};
|
||||
|
||||
@@ -32,6 +32,8 @@ import {
|
||||
CustomerSubscriptionEventNamesSchema,
|
||||
ExternalAccountEventNames,
|
||||
ExternalAccountEventNamesSchema,
|
||||
InvoiceEventNames,
|
||||
InvoiceEventNamesSchema,
|
||||
PaymentIntentEventNames,
|
||||
PaymentIntentEventNamesSchema,
|
||||
PayoutEventNames,
|
||||
@@ -901,6 +903,123 @@ export class Stripe implements TriggerIntegration {
|
||||
params ?? { connect: false }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs on any invoice.* event. Accepts an optional array of events to filter on. By default it will listen to all invoice.* events.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* stripe.onInvoice({ events: ["invoice.created", "invoice.paid"] })
|
||||
* ```
|
||||
*
|
||||
* You can detect the event name in your job by using the `ctx.event.name` property:
|
||||
*
|
||||
* ```ts
|
||||
* client.defineJob({
|
||||
* id: "stripe-example",
|
||||
* name: "Stripe Example",
|
||||
* version: "0.1.0",
|
||||
* trigger: stripe.onInvoice({ events: ["invoice.created", "invoice.paid"] }),
|
||||
* run: async (payload, io, ctx) => {
|
||||
* console.log(ctx.event.name); // "invoice.created" or "invoice.paid"
|
||||
* },
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
onInvoice(params?: TriggerParams & { events?: InvoiceEventNames }) {
|
||||
const parsedEvents = InvoiceEventNamesSchema.optional().parse(params?.events);
|
||||
|
||||
const event = {
|
||||
...events.onInvoice,
|
||||
name: parsedEvents ?? events.onPayout.name,
|
||||
};
|
||||
|
||||
return createTrigger(this.source, event, params ?? { connect: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs whenever an invoice is created.
|
||||
*/
|
||||
onInvoiceCreated(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onInvoiceCreated, params ?? { connect: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs whenever an invoice is finalized.
|
||||
*/
|
||||
onInvoiceFinalized(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onInvoiceFinalized, params ?? { connect: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* The invoice couldn’t be finalized.
|
||||
*/
|
||||
onInvoiceFinalizationFailed(params?: TriggerParams) {
|
||||
return createTrigger(
|
||||
this.source,
|
||||
events.onInvoiceFinalizationFailed,
|
||||
params ?? { connect: false }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs whenever an invoice is marked uncollectible.
|
||||
*/
|
||||
onInvoiceMarkedUncollectible(params?: TriggerParams) {
|
||||
return createTrigger(
|
||||
this.source,
|
||||
events.onInvoiceMarkedUncollectible,
|
||||
params ?? { connect: false }
|
||||
);
|
||||
}
|
||||
|
||||
onInvoicePaid(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onInvoicePaid, params ?? { connect: false });
|
||||
}
|
||||
|
||||
onInvoicePaymentActionRequired(params?: TriggerParams) {
|
||||
return createTrigger(
|
||||
this.source,
|
||||
events.onInvoicePaymentActionRequired,
|
||||
params ?? { connect: false }
|
||||
);
|
||||
}
|
||||
|
||||
onInvoicePaymentFailed(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onInvoicePaymentFailed, params ?? { connect: false });
|
||||
}
|
||||
|
||||
onInvoicePaymentSucceeded(params?: TriggerParams) {
|
||||
return createTrigger(
|
||||
this.source,
|
||||
events.onInvoicePaymentSucceeded,
|
||||
params ?? { connect: false }
|
||||
);
|
||||
}
|
||||
|
||||
onInvoiceSent(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onInvoiceSent, params ?? { connect: false });
|
||||
}
|
||||
|
||||
onInvoiceUpcoming(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onInvoiceUpcoming, params ?? { connect: false });
|
||||
}
|
||||
|
||||
onInvoiceUpdated(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onInvoiceUpdated, params ?? { connect: false });
|
||||
}
|
||||
|
||||
onInvoiceVoided(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onInvoiceVoided, params ?? { connect: false });
|
||||
}
|
||||
|
||||
onInvoiceItemCreated(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onInvoiceItemCreated, params ?? { connect: false });
|
||||
}
|
||||
|
||||
onInvoiceItemDeleted(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onInvoiceItemDeleted, params ?? { connect: false });
|
||||
}
|
||||
}
|
||||
|
||||
export type TriggerParams = {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { z } from "zod"
|
||||
import { z } from "zod";
|
||||
|
||||
export const PriceEventNamesSchema = z.array(z.enum(["price.created", "price.updated", "price.deleted"]));
|
||||
export const PriceEventNamesSchema = z.array(
|
||||
z.enum(["price.created", "price.updated", "price.deleted"])
|
||||
);
|
||||
export type PriceEventNames = z.infer<typeof PriceEventNamesSchema>;
|
||||
|
||||
export const ProductEventNamesSchema = z.array(
|
||||
@@ -87,4 +89,22 @@ export const PayoutEventNamesSchema = z.array(
|
||||
"payout.updated",
|
||||
])
|
||||
);
|
||||
export type PayoutEventNames = z.infer<typeof PayoutEventNamesSchema>;
|
||||
export type PayoutEventNames = z.infer<typeof PayoutEventNamesSchema>;
|
||||
|
||||
export const InvoiceEventNamesSchema = z.array(
|
||||
z.enum([
|
||||
"invoice.created",
|
||||
"invoice.finalized",
|
||||
"invoice.finalization_failed",
|
||||
"invoice.deleted",
|
||||
"invoice.marked_uncollectible",
|
||||
"invoice.paid",
|
||||
"invoice.payment_action_required",
|
||||
"invoice.payment_failed",
|
||||
"invoice.payment_succeeded",
|
||||
"invoice.sent",
|
||||
"invoice.upcoming",
|
||||
"invoice.voided",
|
||||
])
|
||||
);
|
||||
export type InvoiceEventNames = z.infer<typeof InvoiceEventNamesSchema>;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user