Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d7e5737a0 | |||
| 305e3b7ef2 | |||
| 03721cb18d | |||
| 773a6e2c81 | |||
| 2f13ac100f | |||
| a10782490f | |||
| 6ad91123f2 | |||
| 81f2d5e4ec | |||
| f249d8defa | |||
| 09aef5cda7 | |||
| 3028b6ad9d | |||
| 060b650845 | |||
| 6186a14398 | |||
| 916a353660 | |||
| 699878a5b1 | |||
| d2c9b64212 | |||
| 3102deccfb | |||
| aa7458fe37 |
+17
-4
@@ -1,11 +1,24 @@
|
||||
{
|
||||
"$schema": "https://unpkg.com/@changesets/config@2.2.0/schema.json",
|
||||
"changelog": "@changesets/cli/changelog",
|
||||
"changelog": [
|
||||
"@remix-run/changelog-github",
|
||||
{
|
||||
"repo": "triggerdotdev/trigger.dev"
|
||||
}
|
||||
],
|
||||
"commit": false,
|
||||
"fixed": [["@trigger.dev/*"]],
|
||||
"fixed": [
|
||||
[
|
||||
"@trigger.dev/*"
|
||||
]
|
||||
],
|
||||
"linked": [],
|
||||
"access": "public",
|
||||
"baseBranch": "main",
|
||||
"updateInternalDependencies": "patch",
|
||||
"ignore": ["webapp", "emails", "@trigger.dev/database"]
|
||||
}
|
||||
"ignore": [
|
||||
"webapp",
|
||||
"emails",
|
||||
"@trigger.dev/database"
|
||||
]
|
||||
}
|
||||
@@ -27,6 +27,7 @@ export type EnqueueRunExecutionV2Options = {
|
||||
runAt?: Date;
|
||||
resumeTaskId?: string;
|
||||
isRetry?: boolean;
|
||||
skipRetrying?: boolean;
|
||||
};
|
||||
|
||||
export async function enqueueRunExecutionV2(
|
||||
@@ -47,6 +48,7 @@ export async function enqueueRunExecutionV2(
|
||||
tx,
|
||||
runAt: options.runAt,
|
||||
jobKey: `job_run:${run.id}`,
|
||||
maxAttempts: options.skipRetrying ? 1 : undefined,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -195,12 +195,13 @@ export class ZodWorker<TMessageCatalog extends MessageCatalogSchema> {
|
||||
): Promise<GraphileJob> {
|
||||
const task = this.#tasks[identifier];
|
||||
|
||||
const optionsWithoutTx = omit(options ?? {}, ["tx"]);
|
||||
const optionsWithoutTx = removeUndefinedKeys(omit(options ?? {}, ["tx"]));
|
||||
const taskWithoutJobKey = omit(task, ["jobKey"]);
|
||||
|
||||
// Make sure options passed in to enqueue take precedence over task options
|
||||
const spec = {
|
||||
...optionsWithoutTx,
|
||||
...taskWithoutJobKey,
|
||||
...optionsWithoutTx,
|
||||
};
|
||||
|
||||
if (typeof task.queueName === "function") {
|
||||
@@ -437,3 +438,12 @@ export class ZodWorker<TMessageCatalog extends MessageCatalogSchema> {
|
||||
logger.debug(`[worker][${this.#name}] ${message}`, args);
|
||||
}
|
||||
}
|
||||
|
||||
function removeUndefinedKeys<T extends object>(obj: T): T {
|
||||
for (let key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key) && obj[key] === undefined) {
|
||||
delete obj[key];
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,10 @@ export async function action({ request }: ActionArgs) {
|
||||
},
|
||||
body: JSON.stringify({
|
||||
title: body.type,
|
||||
content: body,
|
||||
content: {
|
||||
...body,
|
||||
example: { id: body.type, name: body.type, icon: "stripe", payload: body.data.object },
|
||||
},
|
||||
readOnly: true,
|
||||
}),
|
||||
});
|
||||
|
||||
+6
@@ -1,4 +1,5 @@
|
||||
import { ActionArgs, LoaderArgs, json } from "@remix-run/server-runtime";
|
||||
import { RuntimeEnvironmentType } from "@trigger.dev/database";
|
||||
import { z } from "zod";
|
||||
import { PrismaClient, prisma } from "~/db.server";
|
||||
import { logger } from "~/services/logger.server";
|
||||
@@ -99,6 +100,9 @@ export class TriggerEndpointIndexHookService {
|
||||
slug: endpointSlug,
|
||||
},
|
||||
},
|
||||
include: {
|
||||
environment: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!endpoint) {
|
||||
@@ -122,6 +126,8 @@ export class TriggerEndpointIndexHookService {
|
||||
},
|
||||
{
|
||||
runAt: new Date(Date.now() + 5000),
|
||||
maxAttempts:
|
||||
endpoint.environment.type === RuntimeEnvironmentType.DEVELOPMENT ? 1 : undefined,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,10 @@ export class EndpointApiError extends Error {
|
||||
}
|
||||
|
||||
export class EndpointApi {
|
||||
constructor(private apiKey: string, private url: string) {}
|
||||
constructor(
|
||||
private apiKey: string,
|
||||
private url: string
|
||||
) {}
|
||||
|
||||
async ping(endpointId: string): Promise<PongResponse> {
|
||||
const response = await safeFetch(this.url, {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { AuthenticatedEnvironment } from "../apiAuth.server";
|
||||
import { EndpointApi } from "../endpointApi.server";
|
||||
import { workerQueue } from "../worker.server";
|
||||
import { env } from "~/env.server";
|
||||
import { RuntimeEnvironmentType } from "@trigger.dev/database";
|
||||
|
||||
const indexingHookIdentifier = customAlphabet("0123456789abcdefghijklmnopqrstuvxyz", 10);
|
||||
|
||||
@@ -51,6 +52,9 @@ export class CreateEndpointService {
|
||||
slug: id,
|
||||
},
|
||||
},
|
||||
include: {
|
||||
environment: true,
|
||||
},
|
||||
create: {
|
||||
environment: {
|
||||
connect: {
|
||||
@@ -83,7 +87,11 @@ export class CreateEndpointService {
|
||||
id: endpoint.id,
|
||||
source: "INTERNAL",
|
||||
},
|
||||
{ tx }
|
||||
{
|
||||
tx,
|
||||
maxAttempts:
|
||||
endpoint.environment.type === RuntimeEnvironmentType.DEVELOPMENT ? 1 : undefined,
|
||||
}
|
||||
);
|
||||
|
||||
return endpoint;
|
||||
|
||||
@@ -5,6 +5,7 @@ import { AuthenticatedEnvironment } from "../apiAuth.server";
|
||||
import { workerQueue } from "../worker.server";
|
||||
import { CreateEndpointError } from "./createEndpoint.server";
|
||||
import { EndpointApi } from "../endpointApi.server";
|
||||
import { RuntimeEnvironmentType } from "@trigger.dev/database";
|
||||
|
||||
const indexingHookIdentifier = customAlphabet("0123456789abcdefghijklmnopqrstuvxyz", 10);
|
||||
|
||||
@@ -35,6 +36,9 @@ export class ValidateCreateEndpointService {
|
||||
slug: validationResult.endpointId,
|
||||
},
|
||||
},
|
||||
include: {
|
||||
environment: true,
|
||||
},
|
||||
create: {
|
||||
environment: {
|
||||
connect: {
|
||||
@@ -67,7 +71,11 @@ export class ValidateCreateEndpointService {
|
||||
id: endpoint.id,
|
||||
source: "INTERNAL",
|
||||
},
|
||||
{ tx }
|
||||
{
|
||||
tx,
|
||||
maxAttempts:
|
||||
endpoint.environment.type === RuntimeEnvironmentType.DEVELOPMENT ? 1 : undefined,
|
||||
}
|
||||
);
|
||||
|
||||
return endpoint;
|
||||
|
||||
@@ -7,7 +7,10 @@ import { logger } from "../logger.server";
|
||||
export class IngestSendEvent {
|
||||
#prismaClient: PrismaClientOrTransaction;
|
||||
|
||||
constructor(prismaClient: PrismaClientOrTransaction = prisma, private deliverEvents = true) {
|
||||
constructor(
|
||||
prismaClient: PrismaClientOrTransaction = prisma,
|
||||
private deliverEvents = true
|
||||
) {
|
||||
this.#prismaClient = prismaClient;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { RuntimeEnvironmentType } from "@trigger.dev/database";
|
||||
import { $transaction, Prisma, PrismaClient, prisma } from "~/db.server";
|
||||
import { enqueueRunExecutionV2 } from "~/models/jobRunExecution.server";
|
||||
|
||||
@@ -16,6 +17,9 @@ export class ContinueRunService {
|
||||
async (tx) => {
|
||||
const run = await tx.jobRun.findUniqueOrThrow({
|
||||
where: { id: runId },
|
||||
include: {
|
||||
environment: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!RESUMABLE_STATUSES.includes(run.status)) {
|
||||
@@ -35,7 +39,9 @@ export class ContinueRunService {
|
||||
},
|
||||
});
|
||||
|
||||
await enqueueRunExecutionV2(run, tx);
|
||||
await enqueueRunExecutionV2(run, tx, {
|
||||
skipRetrying: run.environment.type === RuntimeEnvironmentType.DEVELOPMENT,
|
||||
});
|
||||
},
|
||||
{ timeout: 10000 }
|
||||
);
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
RunJobSuccess,
|
||||
RunSourceContextSchema,
|
||||
} from "@trigger.dev/core";
|
||||
import type { Task } from "@trigger.dev/database";
|
||||
import { RuntimeEnvironmentType, type Task } from "@trigger.dev/database";
|
||||
import { generateErrorMessage } from "zod-error";
|
||||
import { eventRecordToApiJson } from "~/api.server";
|
||||
import { $transaction, PrismaClient, PrismaClientOrTransaction, prisma } from "~/db.server";
|
||||
@@ -135,7 +135,9 @@ export class PerformRunExecutionV2Service {
|
||||
},
|
||||
});
|
||||
|
||||
await enqueueRunExecutionV2(run, tx);
|
||||
await enqueueRunExecutionV2(run, tx, {
|
||||
skipRetrying: run.environment.type === RuntimeEnvironmentType.DEVELOPMENT,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -337,6 +339,7 @@ export class PerformRunExecutionV2Service {
|
||||
runAt: data.task.delayUntil ?? undefined,
|
||||
resumeTaskId: data.task.id,
|
||||
isRetry,
|
||||
skipRetrying: run.environment.type === RuntimeEnvironmentType.DEVELOPMENT,
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -409,6 +412,7 @@ export class PerformRunExecutionV2Service {
|
||||
runAt: data.retryAt,
|
||||
resumeTaskId: data.task.id,
|
||||
isRetry,
|
||||
skipRetrying: run.environment.type === RuntimeEnvironmentType.DEVELOPMENT,
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -464,7 +468,9 @@ export class PerformRunExecutionV2Service {
|
||||
},
|
||||
});
|
||||
|
||||
await enqueueRunExecutionV2(run, tx);
|
||||
await enqueueRunExecutionV2(run, tx, {
|
||||
skipRetrying: run.environment.type === RuntimeEnvironmentType.DEVELOPMENT,
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -477,7 +483,9 @@ export class PerformRunExecutionV2Service {
|
||||
}
|
||||
}
|
||||
|
||||
function prepareTasksForRun(tasks: FoundTask[]): CachedTask[] {
|
||||
function prepareTasksForRun(possibleTasks: FoundTask[]): CachedTask[] {
|
||||
const tasks = possibleTasks.filter((task) => task.status === "COMPLETED");
|
||||
|
||||
// We need to limit the cached tasks to not be too large >3.5MB when serialized
|
||||
const TOTAL_CACHED_TASK_BYTE_LIMIT = 3500000;
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import type { ConnectionType, Integration, IntegrationConnection } from "@trigger.dev/database";
|
||||
import {
|
||||
RuntimeEnvironmentType,
|
||||
type ConnectionType,
|
||||
type Integration,
|
||||
type IntegrationConnection,
|
||||
} from "@trigger.dev/database";
|
||||
import type { PrismaClient, PrismaClientOrTransaction } from "~/db.server";
|
||||
import { prisma } from "~/db.server";
|
||||
import { enqueueRunExecutionV2 } from "~/models/jobRunExecution.server";
|
||||
@@ -83,7 +88,9 @@ export class StartRunService {
|
||||
|
||||
const updatedRun = await updateRun();
|
||||
|
||||
await enqueueRunExecutionV2(updatedRun, this.#prismaClient);
|
||||
await enqueueRunExecutionV2(updatedRun, this.#prismaClient, {
|
||||
skipRetrying: run.environment.type === RuntimeEnvironmentType.DEVELOPMENT,
|
||||
});
|
||||
}
|
||||
|
||||
async #handleMissingConnections(id: string, runConnectionsByKey: RunConnectionsByKey) {
|
||||
@@ -140,6 +147,7 @@ async function findRun(tx: PrismaClientOrTransaction, id: string) {
|
||||
where: { id },
|
||||
include: {
|
||||
queue: true,
|
||||
environment: true,
|
||||
version: {
|
||||
include: {
|
||||
integrations: {
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { PrismaClient } from "~/db.server";
|
||||
import { prisma } from "~/db.server";
|
||||
import { workerQueue } from "../worker.server";
|
||||
import { requestUrl } from "~/utils/requestUrl.server";
|
||||
import { RuntimeEnvironmentType } from "@trigger.dev/database";
|
||||
|
||||
export class HandleHttpSourceService {
|
||||
#prismaClient: PrismaClient;
|
||||
@@ -55,6 +56,8 @@ export class HandleHttpSourceService {
|
||||
{
|
||||
queueName: `endpoint-${triggerSource.endpointId}`,
|
||||
tx,
|
||||
maxAttempts:
|
||||
triggerSource.environment.type === RuntimeEnvironmentType.DEVELOPMENT ? 1 : undefined,
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { env } from "process";
|
||||
import { Run } from "~/presenters/RunPresenter.server";
|
||||
import {
|
||||
FetchOperationSchema,
|
||||
FetchRequestInit,
|
||||
@@ -6,7 +8,7 @@ import {
|
||||
RedactString,
|
||||
calculateRetryAt,
|
||||
} from "@trigger.dev/core";
|
||||
import type { Task } from "@trigger.dev/database";
|
||||
import { RuntimeEnvironmentType, type Task } from "@trigger.dev/database";
|
||||
import { $transaction, PrismaClient, PrismaClientOrTransaction, prisma } from "~/db.server";
|
||||
import { enqueueRunExecutionV2 } from "~/models/jobRunExecution.server";
|
||||
import { formatUnknownError } from "~/utils/formatErrors.server";
|
||||
@@ -244,7 +246,9 @@ export class PerformTaskOperationService {
|
||||
}
|
||||
|
||||
async #resumeRunExecution(task: NonNullable<FoundTask>, prisma: PrismaClientOrTransaction) {
|
||||
await enqueueRunExecutionV2(task.run, prisma);
|
||||
await enqueueRunExecutionV2(task.run, prisma, {
|
||||
skipRetrying: task.run.environment.type === RuntimeEnvironmentType.DEVELOPMENT,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,6 +285,7 @@ async function findTask(prisma: PrismaClient, id: string) {
|
||||
attempts: true,
|
||||
run: {
|
||||
include: {
|
||||
environment: true,
|
||||
queue: true,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -9,11 +9,11 @@ title: Stripe
|
||||
<CodeGroup>
|
||||
|
||||
```bash npm
|
||||
npm install @trigger.dev/stripe@latest
|
||||
npm add @trigger.dev/stripe@latest
|
||||
```
|
||||
|
||||
```bash pnpm
|
||||
pnpm install @trigger.dev/stripe@latest
|
||||
pnpm add @trigger.dev/stripe@latest
|
||||
```
|
||||
|
||||
```bash yarn
|
||||
@@ -83,47 +83,87 @@ client.defineJob({
|
||||
|
||||
Available triggers are listed below:
|
||||
|
||||
| Function Name | Events | Description | Aggregate Version |
|
||||
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- | ------------------------ |
|
||||
| `onCharge` | `charge.succeeded`, `charge.failed`, `charge.captured`, `charge.refunded`, `charge.updated` | Triggered on all charge events | ✔️ |
|
||||
| `onChargeSucceeded` | `charge.succeeded` | Triggered on charge succeeded events | `onCharge` |
|
||||
| `onChargeFailed` | `charge.failed` | Triggered on charge failed events | `onCharge` |
|
||||
| `onChargeCaptured` | `charge.captured` | Triggered on charge captured events | `onCharge` |
|
||||
| `onChargeRefunded` | `charge.refunded` | Triggered on charge refunded events | `onCharge` |
|
||||
| `onChargeUpdated` | `charge.updated` | Triggered on charge updated events | `onCharge` |
|
||||
| `onProduct` | `product.created`, `product.updated`, `product.deleted` | Triggered on all product events | ✔️ |
|
||||
| `onProductCreated` | `product.created` | Triggered on product created events | `onProduct` |
|
||||
| `onProductUpdated` | `product.updated` | Triggered on product updated events | `onProduct` |
|
||||
| `onProductDeleted` | `product.deleted` | Triggered on product deleted events | `onProduct` |
|
||||
| `onPrice` | `price.created`, `price.updated`, `price.deleted` | Triggered on all price events | ✔️ |
|
||||
| `onPriceCreated` | `price.created` | Triggered on price created events | `onPrice` |
|
||||
| `onPriceUpdated` | `price.updated` | Triggered on price updated events | `onPrice` |
|
||||
| `onPriceDeleted` | `price.deleted` | Triggered on price deleted events | `onPrice` |
|
||||
| `onCheckoutSession` | `checkout.session.completed`, `checkout.session.async_payment_succeeded`, `checkout.session.async_payment_failed`, `checkout.session.expired` | Triggered on all checkout session events | ✔️ |
|
||||
| `onCheckoutSessionCompleted` | `checkout.session.completed` | Triggered on checkout session completed events | `onCheckoutSession` |
|
||||
| `onCheckoutSessionExpired` | `checkout.session.expired` | Triggered on checkout session expired events | `onCheckoutSession` |
|
||||
| `onCustomerSubscription` | `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` | Triggered on all customer subscription events | ✔️ |
|
||||
| `onCustomerSubscriptionCreated` | `customer.subscription.created` | Triggered on customer subscription created events | `onCustomerSubscription` |
|
||||
| `onCustomerSubscriptionUpdated` | `customer.subscription.updated` | Triggered on customer subscription updated events | `onCustomerSubscription` |
|
||||
| `onCustomerSubscriptionDeleted` | `customer.subscription.deleted` | Triggered on customer subscription deleted events | `onCustomerSubscription` |
|
||||
| `onCustomerSubscriptionPaused` | `customer.subscription.paused` | Triggered on customer subscription paused events | `onCustomerSubscription` |
|
||||
| `onCustomerSubscriptionPending` | `customer.subscription.pending_updated_applied`, `customer.subscription.pending_update_expired` | Triggered on customer subscription pending events | `onCustomerSubscription` |
|
||||
| `onCustomerSubscriptionResumed` | `customer.subscription.resumed` | Triggered on customer subscription resumed events | `onCustomerSubscription` |
|
||||
| `onCustomer` | `customer.created`, `customer.updated`, `customer.deleted` | Triggered on all customer events | ✔️ |
|
||||
| `onCustomerCreated` | `customer.created` | Triggered on customer created events | `onCustomer` |
|
||||
| `onCustomerUpdated` | `customer.updated` | Triggered on customer updated events | `onCustomer` |
|
||||
| `onCustomerDeleted` | `customer.deleted` | Triggered on customer deleted events | `onCustomer` |
|
||||
| `onExternalAccount` | `account.external_account.created`, `account.external_account.updated`, `account.external_account.deleted` | Triggered on all external account events | ✔️ |
|
||||
| `onExternalAccountCreated` | `account.external_account.created` | Triggered on external account created events | `onExternalAccount` |
|
||||
| `onExternalAccountUpdated` | `account.external_account.updated` | Triggered on external account updated events | `onExternalAccount` |
|
||||
| `onExternalAccountDeleted` | `account.external_account.deleted` | Triggered on external account deleted events | `onExternalAccount` |
|
||||
| `onPerson` | `account.person.created`, `account.person.updated`, `account.person.deleted` | Triggered on all person events | ✔️ |
|
||||
| `onPersonCreated` | `account.person.created` | Triggered on person created events | `onPerson` |
|
||||
| `onPersonUpdated` | `account.person.updated` | Triggered on person updated events | `onPerson` |
|
||||
| `onPersonDeleted` | `account.person.deleted` | Triggered on person deleted events | `onPerson` |
|
||||
| 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` |
|
||||
|
||||
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)
|
||||
|
||||
### Filtering
|
||||
|
||||
All the Stripe triggers take an optional `filter` parameter that allows you to only run the job when the filter matches the event payload:
|
||||
|
||||
```ts
|
||||
// Only trigger when the currency is USD
|
||||
client.defineJob({
|
||||
id: "stripe-on-subscription-created",
|
||||
name: "Stripe On Subscription Created",
|
||||
version: "0.1.0",
|
||||
trigger: stripe.onCustomerSubscriptionCreated({
|
||||
filter: {
|
||||
currency: ["usd"],
|
||||
},
|
||||
}),
|
||||
run: async (payload, io, ctx) => {
|
||||
await io.logger.info("ctx", { ctx });
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
Check out our [Event Filter docs](/documentation/guides/event-filter) for more information on how to use the filter.
|
||||
|
||||
## Tasks
|
||||
|
||||
You can make reliable calls to the Stripe API inside of jobs using the exposed stripe tasks:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { createExpressServer } from "@trigger.dev/express";
|
||||
import { TriggerClient, eventTrigger } from "@trigger.dev/sdk";
|
||||
import { z } from "zod";
|
||||
|
||||
export const client = new TriggerClient({
|
||||
id: "job-catalog",
|
||||
@@ -56,4 +57,45 @@ client.defineJob({
|
||||
},
|
||||
});
|
||||
|
||||
client.defineJob({
|
||||
id: "example-job",
|
||||
name: "Example Job: a joke with a delay",
|
||||
version: "0.0.2",
|
||||
trigger: eventTrigger({
|
||||
name: "shayan.event",
|
||||
schema: z.object({
|
||||
userId: z.string(),
|
||||
delay: z.number(),
|
||||
}),
|
||||
}),
|
||||
run: async (payload, io, ctx) => {
|
||||
await io.wait("sleeping", payload.delay);
|
||||
|
||||
await io.runTask("init", { name: "init" }, async () => {
|
||||
console.log("init function ran", payload.userId);
|
||||
});
|
||||
|
||||
await io.runTask("failable", { name: "task-1", retry: { limit: 3 } }, async (task) => {
|
||||
if (task.attempts > 2) {
|
||||
console.log("task succeeded");
|
||||
return {
|
||||
ok: true,
|
||||
};
|
||||
}
|
||||
console.log("task failed");
|
||||
throw new Error(`Task failed on ${task.attempts} attempt(s)`);
|
||||
});
|
||||
|
||||
await io.runTask(
|
||||
"log",
|
||||
{
|
||||
name: "log",
|
||||
},
|
||||
async () => {
|
||||
console.log("hello from the job", payload.userId);
|
||||
}
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
createExpressServer(client);
|
||||
|
||||
@@ -186,4 +186,14 @@ client.defineJob({
|
||||
},
|
||||
});
|
||||
|
||||
client.defineJob({
|
||||
id: "stripe-on-charge",
|
||||
name: "Stripe On Charge",
|
||||
version: "0.1.0",
|
||||
trigger: stripe.onCharge(),
|
||||
run: async (payload, io, ctx) => {
|
||||
await io.logger.info("ctx", { ctx });
|
||||
},
|
||||
});
|
||||
|
||||
createExpressServer(client);
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
# @trigger.dev/github
|
||||
|
||||
## 2.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/integration-kit@2.0.14`
|
||||
- `@trigger.dev/sdk@2.0.14`
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.13`
|
||||
- `@trigger.dev/integration-kit@2.0.13`
|
||||
|
||||
## 2.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/github",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "The official GitHub integration for Trigger.dev",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -29,8 +29,8 @@
|
||||
"@octokit/request": "^6.2.5",
|
||||
"@octokit/request-error": "^4.0.1",
|
||||
"@octokit/webhooks": "^10.4.0",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.12",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.12",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.14",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.14",
|
||||
"octokit": "^2.0.14",
|
||||
"zod": "3.21.4"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
# @trigger.dev/slack
|
||||
|
||||
## 2.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/integration-kit@2.0.14`
|
||||
- `@trigger.dev/sdk@2.0.14`
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.13`
|
||||
- `@trigger.dev/integration-kit@2.0.13`
|
||||
|
||||
## 2.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/openai",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "The official OpenAI integration for Trigger.dev",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -25,8 +25,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"openai": "^4.2.0",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.12",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.12"
|
||||
"@trigger.dev/sdk": "workspace:^2.0.14",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.14"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.8.0"
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
# @trigger.dev/plain
|
||||
|
||||
## 2.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/integration-kit@2.0.14`
|
||||
- `@trigger.dev/sdk@2.0.14`
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.13`
|
||||
- `@trigger.dev/integration-kit@2.0.13`
|
||||
|
||||
## 2.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/plain",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "The official Plain.com integration for Trigger.dev",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -24,8 +24,8 @@
|
||||
"build:tsup": "tsup"
|
||||
},
|
||||
"dependencies": {
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.12",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.12",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.14",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.14",
|
||||
"@team-plain/typescript-sdk": "^2.7.0"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
# @trigger.dev/resend
|
||||
|
||||
## 2.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/integration-kit@2.0.14`
|
||||
- `@trigger.dev/sdk@2.0.14`
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.13`
|
||||
- `@trigger.dev/integration-kit@2.0.13`
|
||||
|
||||
## 2.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/resend",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "The official Resend.com integration for Trigger.dev",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -24,8 +24,8 @@
|
||||
"build:tsup": "tsup"
|
||||
},
|
||||
"dependencies": {
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.12",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.12",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.14",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.14",
|
||||
"resend": "^0.9.1"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
# @trigger.dev/sendgrid
|
||||
|
||||
## 2.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/integration-kit@2.0.14`
|
||||
- `@trigger.dev/sdk@2.0.14`
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.13`
|
||||
- `@trigger.dev/integration-kit@2.0.13`
|
||||
|
||||
## 2.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/sendgrid",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "Trigger.dev integration for @sendgrid/mail",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -26,8 +26,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@sendgrid/mail": "^7.7.0",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.12",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.12"
|
||||
"@trigger.dev/sdk": "workspace:^2.0.14",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.14"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.8.0"
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @trigger.dev/slack
|
||||
|
||||
## 2.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.14`
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.13`
|
||||
|
||||
## 2.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/slack",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "The official Slack integration for Trigger.dev",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -25,7 +25,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@slack/web-api": "^6.8.1",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.12",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.14",
|
||||
"zod": "3.21.4"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# @trigger.dev/stripe
|
||||
|
||||
## 2.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Added additional triggers for PaymentIntent and Payout events ([`a1078249`](https://github.com/triggerdotdev/trigger.dev/commit/a10782490fd2764fde40beff4331da89a57e1f16))
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/integration-kit@2.0.14`
|
||||
- `@trigger.dev/sdk@2.0.14`
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.13`
|
||||
- `@trigger.dev/integration-kit@2.0.13`
|
||||
|
||||
## 2.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/stripe",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "Trigger.dev integration for stripe",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -26,8 +26,8 @@
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.12",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.12",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.14",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.14",
|
||||
"stripe": "^12.14.0",
|
||||
"zod": "3.21.4"
|
||||
},
|
||||
|
||||
@@ -1,9 +1,21 @@
|
||||
import type { EventSpecification } from "@trigger.dev/sdk";
|
||||
import {
|
||||
amountCapturablePaymentIntentExample,
|
||||
cancelledPaymentIntentExample,
|
||||
cancelledSubscriptionExample,
|
||||
capturedChargeExample,
|
||||
checkoutSessionExample,
|
||||
createdCustomerExample,
|
||||
createdPaymentIntentExample,
|
||||
customerSubscriptionExample,
|
||||
deletedCustomerExample,
|
||||
failedChargeExample,
|
||||
failedPaymentIntentExample,
|
||||
pausedSubscriptionExample,
|
||||
refundedChargeExample,
|
||||
succeededChargeExample,
|
||||
succeededPaymentIntentExample,
|
||||
updatedAccountExample,
|
||||
updatedSubscriptionExample,
|
||||
} from "./examples";
|
||||
import {
|
||||
@@ -13,6 +25,8 @@ import {
|
||||
OnCustomerEvent,
|
||||
OnCustomerSubscription,
|
||||
OnExternalAccountEvent,
|
||||
OnPaymentIntentEvent,
|
||||
OnPayoutEvent,
|
||||
OnPersonEvent,
|
||||
OnPriceEvent,
|
||||
OnProductEvent,
|
||||
@@ -467,7 +481,7 @@ export const onAccountUpdated: EventSpecification<OnAccountEvent> = {
|
||||
title: "On Account Updated",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
examples: [updatedAccountExample],
|
||||
parsePayload: (payload) => payload as OnAccountEvent,
|
||||
runProperties: (payload) => [
|
||||
{ label: "Account ID", text: payload.id },
|
||||
@@ -480,7 +494,7 @@ export const onCustomer: EventSpecification<OnCustomerEvent> = {
|
||||
title: "On Customer Event",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
examples: [createdCustomerExample],
|
||||
parsePayload: (payload) => payload as OnCustomerEvent,
|
||||
runProperties: (payload) => [{ label: "Customer ID", text: payload.id }],
|
||||
};
|
||||
@@ -490,7 +504,7 @@ export const onCustomerCreated: EventSpecification<OnCustomerEvent> = {
|
||||
title: "On Customer Created",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
examples: [createdCustomerExample],
|
||||
parsePayload: (payload) => payload as OnCustomerEvent,
|
||||
runProperties: (payload) => [{ label: "Customer ID", text: payload.id }],
|
||||
};
|
||||
@@ -500,7 +514,7 @@ export const onCustomerDeleted: EventSpecification<OnCustomerEvent> = {
|
||||
title: "On Customer Deleted",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
examples: [deletedCustomerExample],
|
||||
parsePayload: (payload) => payload as OnCustomerEvent,
|
||||
runProperties: (payload) => [{ label: "Customer ID", text: payload.id }],
|
||||
};
|
||||
@@ -510,7 +524,7 @@ export const onCustomerUpdated: EventSpecification<OnCustomerEvent> = {
|
||||
title: "On Customer Updated",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
examples: [createdCustomerExample],
|
||||
parsePayload: (payload) => payload as OnCustomerEvent,
|
||||
runProperties: (payload) => [{ label: "Customer ID", text: payload.id }],
|
||||
};
|
||||
@@ -528,7 +542,12 @@ export const onCharge: EventSpecification<OnChargeEvent> = {
|
||||
title: "On Charge Event",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
examples: [
|
||||
capturedChargeExample,
|
||||
succeededChargeExample,
|
||||
failedChargeExample,
|
||||
refundedChargeExample,
|
||||
],
|
||||
parsePayload: (payload) => payload as OnChargeEvent,
|
||||
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
|
||||
};
|
||||
@@ -538,7 +557,7 @@ export const onChargeCaptured: EventSpecification<OnChargeEvent> = {
|
||||
title: "On Charge Captured",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
examples: [capturedChargeExample],
|
||||
parsePayload: (payload) => payload as OnChargeEvent,
|
||||
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
|
||||
};
|
||||
@@ -558,7 +577,7 @@ export const onChargeFailed: EventSpecification<OnChargeEvent> = {
|
||||
title: "On Charge Failed",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
examples: [failedChargeExample],
|
||||
parsePayload: (payload) => payload as OnChargeEvent,
|
||||
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
|
||||
};
|
||||
@@ -578,7 +597,7 @@ export const onChargeRefunded: EventSpecification<OnChargeEvent> = {
|
||||
title: "On Charge Refunded",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
examples: [refundedChargeExample],
|
||||
parsePayload: (payload) => payload as OnChargeEvent,
|
||||
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
|
||||
};
|
||||
@@ -588,7 +607,7 @@ export const onChargeSucceeded: EventSpecification<OnChargeEvent> = {
|
||||
title: "On Charge Succeeded",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
examples: [succeededChargeExample],
|
||||
parsePayload: (payload) => payload as OnChargeEvent,
|
||||
runProperties: (payload) => [{ label: "Charge ID", text: payload.id }],
|
||||
};
|
||||
@@ -710,3 +729,206 @@ export const onPersonUpdated: EventSpecification<OnPersonEvent> = {
|
||||
{ label: "Account", text: payload.account },
|
||||
],
|
||||
};
|
||||
|
||||
export const onPaymentIntent: EventSpecification<OnPaymentIntentEvent> = {
|
||||
name: [
|
||||
"payment_intent.created",
|
||||
"payment_intent.succeeded",
|
||||
"payment_intent.canceled",
|
||||
"payment_intent.processing",
|
||||
"payment_intent.requires_action",
|
||||
"payment_intent.amount_capturable_updated",
|
||||
"payment_intent.payment_failed",
|
||||
"payment_intent.partially_funded",
|
||||
],
|
||||
title: "On Payment Intent Event",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [
|
||||
createdPaymentIntentExample,
|
||||
succeededPaymentIntentExample,
|
||||
cancelledPaymentIntentExample,
|
||||
amountCapturablePaymentIntentExample,
|
||||
failedPaymentIntentExample,
|
||||
],
|
||||
parsePayload: (payload) => payload as OnPaymentIntentEvent,
|
||||
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onPaymentIntentCreated: EventSpecification<OnPaymentIntentEvent> = {
|
||||
name: "payment_intent.created",
|
||||
title: "On Payment Intent Created",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [createdPaymentIntentExample],
|
||||
parsePayload: (payload) => payload as OnPaymentIntentEvent,
|
||||
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onPaymentIntentSucceeded: EventSpecification<OnPaymentIntentEvent> = {
|
||||
name: "payment_intent.succeeded",
|
||||
title: "On Payment Intent Succeeded",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [succeededPaymentIntentExample],
|
||||
parsePayload: (payload) => payload as OnPaymentIntentEvent,
|
||||
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onPaymentIntentCanceled: EventSpecification<OnPaymentIntentEvent> = {
|
||||
name: "payment_intent.canceled",
|
||||
title: "On Payment Intent Canceled",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [cancelledPaymentIntentExample],
|
||||
parsePayload: (payload) => payload as OnPaymentIntentEvent,
|
||||
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onPaymentIntentProcessing: EventSpecification<OnPaymentIntentEvent> = {
|
||||
name: "payment_intent.processing",
|
||||
title: "On Payment Intent Processing",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
parsePayload: (payload) => payload as OnPaymentIntentEvent,
|
||||
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onPaymentIntentRequiresAction: EventSpecification<OnPaymentIntentEvent> = {
|
||||
name: "payment_intent.requires_action",
|
||||
title: "On Payment Intent Requires Action",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
parsePayload: (payload) => payload as OnPaymentIntentEvent,
|
||||
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onPaymentIntentAmountCapturableUpdated: EventSpecification<OnPaymentIntentEvent> = {
|
||||
name: "payment_intent.amount_capturable_updated",
|
||||
title: "On Payment Intent Amount Capturable Updated",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [amountCapturablePaymentIntentExample],
|
||||
parsePayload: (payload) => payload as OnPaymentIntentEvent,
|
||||
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onPaymentIntentPaymentFailed: EventSpecification<OnPaymentIntentEvent> = {
|
||||
name: "payment_intent.payment_failed",
|
||||
title: "On Payment Intent Payment Failed",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [failedPaymentIntentExample],
|
||||
parsePayload: (payload) => payload as OnPaymentIntentEvent,
|
||||
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onPaymentIntentPartiallyFunded: EventSpecification<OnPaymentIntentEvent> = {
|
||||
name: "payment_intent.partially_funded",
|
||||
title: "On Payment Intent Partially Funded",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
parsePayload: (payload) => payload as OnPaymentIntentEvent,
|
||||
runProperties: (payload) => [{ label: "Payment Intent ID", text: payload.id }],
|
||||
};
|
||||
|
||||
export const onPayout: EventSpecification<OnPayoutEvent> = {
|
||||
name: [
|
||||
"payout.canceled",
|
||||
"payout.created",
|
||||
"payout.failed",
|
||||
"payout.paid",
|
||||
"payout.reconciliation_completed",
|
||||
"payout.updated",
|
||||
],
|
||||
title: "On Payout Event",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
parsePayload: (payload) => payload as OnPayoutEvent,
|
||||
runProperties: (payload) => [
|
||||
{ label: "Payout ID", text: payload.id },
|
||||
{ label: "Amount", text: `${payload.amount} ${payload.currency}` },
|
||||
],
|
||||
};
|
||||
|
||||
export const onPayoutCancelled: EventSpecification<OnPayoutEvent> = {
|
||||
name: "payout.canceled",
|
||||
title: "On Payout Cancelled Event",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
parsePayload: (payload) => payload as OnPayoutEvent,
|
||||
runProperties: (payload) => [
|
||||
{ label: "Payout ID", text: payload.id },
|
||||
{ label: "Amount", text: `${payload.amount} ${payload.currency}` },
|
||||
],
|
||||
};
|
||||
|
||||
export const onPayoutCreated: EventSpecification<OnPayoutEvent> = {
|
||||
name: "payout.created",
|
||||
title: "On Payout Created Event",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
parsePayload: (payload) => payload as OnPayoutEvent,
|
||||
runProperties: (payload) => [
|
||||
{ label: "Payout ID", text: payload.id },
|
||||
{ label: "Amount", text: `${payload.amount} ${payload.currency}` },
|
||||
],
|
||||
};
|
||||
|
||||
export const onPayoutFailed: EventSpecification<OnPayoutEvent> = {
|
||||
name: "payout.failed",
|
||||
title: "On Payout Failed Event",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
parsePayload: (payload) => payload as OnPayoutEvent,
|
||||
runProperties: (payload) => [
|
||||
{ label: "Payout ID", text: payload.id },
|
||||
{ label: "Amount", text: `${payload.amount} ${payload.currency}` },
|
||||
],
|
||||
};
|
||||
|
||||
export const onPayoutPaid: EventSpecification<OnPayoutEvent> = {
|
||||
name: "payout.paid",
|
||||
title: "On Payout Paid Event",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
parsePayload: (payload) => payload as OnPayoutEvent,
|
||||
runProperties: (payload) => [
|
||||
{ label: "Payout ID", text: payload.id },
|
||||
{ label: "Amount", text: `${payload.amount} ${payload.currency}` },
|
||||
],
|
||||
};
|
||||
|
||||
export const onPayoutReconciliationCompleted: EventSpecification<OnPayoutEvent> = {
|
||||
name: "payout.reconciliation_completed",
|
||||
title: "On Payout Reconciliation Completed Event",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
parsePayload: (payload) => payload as OnPayoutEvent,
|
||||
runProperties: (payload) => [
|
||||
{ label: "Payout ID", text: payload.id },
|
||||
{ label: "Amount", text: `${payload.amount} ${payload.currency}` },
|
||||
],
|
||||
};
|
||||
|
||||
export const onPayoutUpdated: EventSpecification<OnPayoutEvent> = {
|
||||
name: "payout.updated",
|
||||
title: "On Payout Updated Event",
|
||||
source: "stripe.com",
|
||||
icon: "stripe",
|
||||
examples: [],
|
||||
parsePayload: (payload) => payload as OnPayoutEvent,
|
||||
runProperties: (payload) => [
|
||||
{ label: "Payout ID", text: payload.id },
|
||||
{ label: "Amount", text: `${payload.amount} ${payload.currency}` },
|
||||
],
|
||||
};
|
||||
|
||||
@@ -698,3 +698,932 @@ export const updatedSubscriptionExample = {
|
||||
trial_start: null,
|
||||
},
|
||||
};
|
||||
|
||||
export const updatedAccountExample = {
|
||||
id: "test_account",
|
||||
name: "Updated Account",
|
||||
icon: "stripe",
|
||||
payload: {
|
||||
id: "acct_1Nk2DXINGsstqbEy",
|
||||
object: "account",
|
||||
business_profile: {
|
||||
mcc: null,
|
||||
name: null,
|
||||
support_address: null,
|
||||
support_email: null,
|
||||
support_phone: null,
|
||||
support_url: null,
|
||||
url: null,
|
||||
product_description: null,
|
||||
},
|
||||
capabilities: {},
|
||||
charges_enabled: false,
|
||||
controller: {
|
||||
type: "application",
|
||||
is_controller: true,
|
||||
},
|
||||
country: "GB",
|
||||
default_currency: "gbp",
|
||||
details_submitted: false,
|
||||
email: null,
|
||||
payouts_enabled: false,
|
||||
settings: {
|
||||
bacs_debit_payments: {},
|
||||
branding: {
|
||||
icon: null,
|
||||
logo: null,
|
||||
primary_color: null,
|
||||
secondary_color: null,
|
||||
},
|
||||
card_issuing: {
|
||||
tos_acceptance: {
|
||||
date: null,
|
||||
ip: null,
|
||||
},
|
||||
},
|
||||
card_payments: {
|
||||
statement_descriptor_prefix: null,
|
||||
statement_descriptor_prefix_kanji: null,
|
||||
statement_descriptor_prefix_kana: null,
|
||||
decline_on: {
|
||||
avs_failure: false,
|
||||
cvc_failure: false,
|
||||
},
|
||||
},
|
||||
dashboard: {
|
||||
display_name: null,
|
||||
timezone: "Etc/UTC",
|
||||
},
|
||||
payments: {
|
||||
statement_descriptor: null,
|
||||
statement_descriptor_kana: null,
|
||||
statement_descriptor_kanji: null,
|
||||
},
|
||||
sepa_debit_payments: {},
|
||||
payouts: {
|
||||
debit_negative_balances: true,
|
||||
schedule: {
|
||||
delay_days: 7,
|
||||
interval: "daily",
|
||||
},
|
||||
statement_descriptor: null,
|
||||
},
|
||||
},
|
||||
type: "standard",
|
||||
business_type: null,
|
||||
created: 1693216724,
|
||||
external_accounts: {
|
||||
object: "list",
|
||||
data: [],
|
||||
has_more: false,
|
||||
total_count: 0,
|
||||
url: "/v1/accounts/acct_1Nk2DXINGsstqbEy/external_accounts",
|
||||
},
|
||||
future_requirements: {
|
||||
alternatives: [],
|
||||
current_deadline: null,
|
||||
currently_due: [],
|
||||
disabled_reason: null,
|
||||
errors: [],
|
||||
eventually_due: [],
|
||||
past_due: [],
|
||||
pending_verification: [],
|
||||
},
|
||||
metadata: {
|
||||
foo: "bar",
|
||||
},
|
||||
requirements: {
|
||||
alternatives: [],
|
||||
current_deadline: null,
|
||||
currently_due: [
|
||||
"business_profile.product_description",
|
||||
"business_profile.support_phone",
|
||||
"business_profile.url",
|
||||
"external_account",
|
||||
"tos_acceptance.date",
|
||||
"tos_acceptance.ip",
|
||||
],
|
||||
disabled_reason: "requirements.past_due",
|
||||
errors: [],
|
||||
eventually_due: [
|
||||
"business_profile.product_description",
|
||||
"business_profile.support_phone",
|
||||
"business_profile.url",
|
||||
"external_account",
|
||||
"tos_acceptance.date",
|
||||
"tos_acceptance.ip",
|
||||
],
|
||||
past_due: ["external_account", "tos_acceptance.date", "tos_acceptance.ip"],
|
||||
pending_verification: [],
|
||||
},
|
||||
tos_acceptance: {
|
||||
date: null,
|
||||
ip: null,
|
||||
user_agent: null,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const createdCustomerExample = {
|
||||
id: "created_customer",
|
||||
name: "Created Customer",
|
||||
icon: "stripe",
|
||||
payload: {
|
||||
id: "cus_OX6SuD19Ej1AwM",
|
||||
object: "customer",
|
||||
address: null,
|
||||
balance: 0,
|
||||
created: 1693216865,
|
||||
currency: null,
|
||||
default_source: null,
|
||||
delinquent: false,
|
||||
description: "(created by Stripe CLI)",
|
||||
discount: null,
|
||||
email: null,
|
||||
invoice_prefix: "02F47541",
|
||||
invoice_settings: {
|
||||
custom_fields: null,
|
||||
default_payment_method: null,
|
||||
footer: null,
|
||||
rendering_options: null,
|
||||
},
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
name: null,
|
||||
phone: null,
|
||||
preferred_locales: [],
|
||||
shipping: null,
|
||||
tax_exempt: "none",
|
||||
test_clock: null,
|
||||
},
|
||||
};
|
||||
|
||||
export const deletedCustomerExample = {
|
||||
id: "deleted_customer",
|
||||
name: "Deleted Customer",
|
||||
icon: "stripe",
|
||||
payload: {
|
||||
id: "cus_OX6UWArTxl2eGx",
|
||||
object: "customer",
|
||||
address: null,
|
||||
balance: 0,
|
||||
created: 1693216947,
|
||||
currency: null,
|
||||
default_source: null,
|
||||
delinquent: false,
|
||||
description: "(created by Stripe CLI)",
|
||||
discount: null,
|
||||
email: null,
|
||||
invoice_prefix: "2761E4C9",
|
||||
invoice_settings: {
|
||||
custom_fields: null,
|
||||
default_payment_method: null,
|
||||
footer: null,
|
||||
rendering_options: null,
|
||||
},
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
name: null,
|
||||
phone: null,
|
||||
preferred_locales: [],
|
||||
shipping: null,
|
||||
tax_exempt: "none",
|
||||
test_clock: null,
|
||||
},
|
||||
};
|
||||
|
||||
export const capturedChargeExample = {
|
||||
id: "charge.captured",
|
||||
name: "charge.captured",
|
||||
icon: "stripe",
|
||||
payload: {
|
||||
id: "ch_3Nk2IZI0XSgju2ur1KjXKcEP",
|
||||
object: "charge",
|
||||
amount: 2000,
|
||||
amount_captured: 2000,
|
||||
amount_refunded: 0,
|
||||
application: null,
|
||||
application_fee: null,
|
||||
application_fee_amount: null,
|
||||
balance_transaction: "txn_3Nk2IZI0XSgju2ur1yBd2FPs",
|
||||
billing_details: {
|
||||
address: {
|
||||
city: null,
|
||||
country: null,
|
||||
line1: null,
|
||||
line2: null,
|
||||
postal_code: null,
|
||||
state: null,
|
||||
},
|
||||
email: null,
|
||||
name: null,
|
||||
phone: null,
|
||||
},
|
||||
calculated_statement_descriptor: "WWW.TRIGGER.DEV",
|
||||
captured: true,
|
||||
created: 1693217035,
|
||||
currency: "usd",
|
||||
customer: null,
|
||||
description: "(created by Stripe CLI)",
|
||||
destination: null,
|
||||
dispute: null,
|
||||
disputed: false,
|
||||
failure_balance_transaction: null,
|
||||
failure_code: null,
|
||||
failure_message: null,
|
||||
fraud_details: {},
|
||||
invoice: null,
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
on_behalf_of: null,
|
||||
order: null,
|
||||
outcome: {
|
||||
network_status: "approved_by_network",
|
||||
reason: null,
|
||||
risk_level: "normal",
|
||||
risk_score: 23,
|
||||
seller_message: "Payment complete.",
|
||||
type: "authorized",
|
||||
},
|
||||
paid: true,
|
||||
payment_intent: "pi_3Nk2IZI0XSgju2ur1c5PRXzB",
|
||||
payment_method: "pm_1Nk2IZI0XSgju2urQoHr945x",
|
||||
payment_method_details: {
|
||||
card: {
|
||||
brand: "visa",
|
||||
checks: {
|
||||
address_line1_check: null,
|
||||
address_postal_code_check: null,
|
||||
cvc_check: null,
|
||||
},
|
||||
country: "US",
|
||||
exp_month: 8,
|
||||
exp_year: 2024,
|
||||
fingerprint: "w6qgKDLO5EbIJ5VZ",
|
||||
funding: "credit",
|
||||
installments: null,
|
||||
last4: "4242",
|
||||
mandate: null,
|
||||
network: "visa",
|
||||
network_token: {
|
||||
used: false,
|
||||
},
|
||||
three_d_secure: null,
|
||||
wallet: null,
|
||||
},
|
||||
type: "card",
|
||||
},
|
||||
receipt_email: null,
|
||||
receipt_number: null,
|
||||
receipt_url:
|
||||
"https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xTVJtRzRJMFhTZ2p1MnVyKI3isacGMgaiHlW3-3o6LBbtHkEOlE2XK3_d2h9msrs3bTJvZi8DcqHrvcQrwxPHm8rP3LA2i5wTqA7Y",
|
||||
refunded: false,
|
||||
review: null,
|
||||
shipping: null,
|
||||
source: null,
|
||||
source_transfer: null,
|
||||
statement_descriptor: null,
|
||||
statement_descriptor_suffix: null,
|
||||
status: "succeeded",
|
||||
transfer_data: null,
|
||||
transfer_group: null,
|
||||
},
|
||||
};
|
||||
|
||||
export const succeededChargeExample = {
|
||||
id: "charge.succeeded",
|
||||
name: "charge.succeeded",
|
||||
icon: "stripe",
|
||||
payload: {
|
||||
id: "ch_3Nk2MlI0XSgju2ur0Zcv519e",
|
||||
object: "charge",
|
||||
amount: 2000,
|
||||
amount_captured: 0,
|
||||
amount_refunded: 0,
|
||||
application: null,
|
||||
application_fee: null,
|
||||
application_fee_amount: null,
|
||||
balance_transaction: null,
|
||||
billing_details: {
|
||||
address: {
|
||||
city: null,
|
||||
country: null,
|
||||
line1: null,
|
||||
line2: null,
|
||||
postal_code: null,
|
||||
state: null,
|
||||
},
|
||||
email: null,
|
||||
name: null,
|
||||
phone: null,
|
||||
},
|
||||
calculated_statement_descriptor: "WWW.TRIGGER.DEV",
|
||||
captured: false,
|
||||
created: 1693217296,
|
||||
currency: "usd",
|
||||
customer: null,
|
||||
description: "(created by Stripe CLI)",
|
||||
destination: null,
|
||||
dispute: null,
|
||||
disputed: false,
|
||||
failure_balance_transaction: null,
|
||||
failure_code: null,
|
||||
failure_message: null,
|
||||
fraud_details: {},
|
||||
invoice: null,
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
on_behalf_of: null,
|
||||
order: null,
|
||||
outcome: {
|
||||
network_status: "approved_by_network",
|
||||
reason: null,
|
||||
risk_level: "normal",
|
||||
risk_score: 3,
|
||||
seller_message: "Payment complete.",
|
||||
type: "authorized",
|
||||
},
|
||||
paid: true,
|
||||
payment_intent: "pi_3Nk2MlI0XSgju2ur0p8h6qIg",
|
||||
payment_method: "pm_1Nk2MlI0XSgju2urdy1jOUTb",
|
||||
payment_method_details: {
|
||||
card: {
|
||||
brand: "visa",
|
||||
checks: {
|
||||
address_line1_check: null,
|
||||
address_postal_code_check: null,
|
||||
cvc_check: null,
|
||||
},
|
||||
country: "US",
|
||||
exp_month: 8,
|
||||
exp_year: 2024,
|
||||
fingerprint: "w6qgKDLO5EbIJ5VZ",
|
||||
funding: "credit",
|
||||
installments: null,
|
||||
last4: "4242",
|
||||
mandate: null,
|
||||
network: "visa",
|
||||
network_token: {
|
||||
used: false,
|
||||
},
|
||||
three_d_secure: null,
|
||||
wallet: null,
|
||||
},
|
||||
type: "card",
|
||||
},
|
||||
receipt_email: null,
|
||||
receipt_number: null,
|
||||
receipt_url:
|
||||
"https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xTVJtRzRJMFhTZ2p1MnVyKJDksacGMgYAj-PAr_s6LBapIJAZx3QBJGs7up7CDkowPkzJbOD1CzDvmilNbsloUF9ovZ3sWPq6F5SN",
|
||||
refunded: false,
|
||||
review: null,
|
||||
shipping: null,
|
||||
source: null,
|
||||
source_transfer: null,
|
||||
statement_descriptor: null,
|
||||
statement_descriptor_suffix: null,
|
||||
status: "succeeded",
|
||||
transfer_data: null,
|
||||
transfer_group: null,
|
||||
},
|
||||
};
|
||||
|
||||
export const failedChargeExample = {
|
||||
id: "charge.failed",
|
||||
name: "charge.failed",
|
||||
icon: "stripe",
|
||||
payload: {
|
||||
id: "ch_3Nk2OVI0XSgju2ur09WGXz58",
|
||||
object: "charge",
|
||||
amount: 100,
|
||||
amount_captured: 0,
|
||||
amount_refunded: 0,
|
||||
application: null,
|
||||
application_fee: null,
|
||||
application_fee_amount: null,
|
||||
balance_transaction: null,
|
||||
billing_details: {
|
||||
address: {
|
||||
city: null,
|
||||
country: null,
|
||||
line1: null,
|
||||
line2: null,
|
||||
postal_code: null,
|
||||
state: null,
|
||||
},
|
||||
email: null,
|
||||
name: null,
|
||||
phone: null,
|
||||
},
|
||||
calculated_statement_descriptor: "WWW.TRIGGER.DEV",
|
||||
captured: false,
|
||||
created: 1693217403,
|
||||
currency: "usd",
|
||||
customer: null,
|
||||
description: "(created by Stripe CLI)",
|
||||
destination: null,
|
||||
dispute: null,
|
||||
disputed: false,
|
||||
failure_balance_transaction: null,
|
||||
failure_code: "card_declined",
|
||||
failure_message: "Your card was declined.",
|
||||
fraud_details: {},
|
||||
invoice: null,
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
on_behalf_of: null,
|
||||
order: null,
|
||||
outcome: {
|
||||
network_status: "declined_by_network",
|
||||
reason: "generic_decline",
|
||||
risk_level: "normal",
|
||||
risk_score: 10,
|
||||
seller_message: "The bank did not return any further details with this decline.",
|
||||
type: "issuer_declined",
|
||||
},
|
||||
paid: false,
|
||||
payment_intent: "pi_3Nk2OVI0XSgju2ur0HYvM3Zu",
|
||||
payment_method: "pm_1Nk2OVI0XSgju2uri9io5fc0",
|
||||
payment_method_details: {
|
||||
card: {
|
||||
brand: "visa",
|
||||
checks: {
|
||||
address_line1_check: null,
|
||||
address_postal_code_check: null,
|
||||
cvc_check: null,
|
||||
},
|
||||
country: "US",
|
||||
exp_month: 8,
|
||||
exp_year: 2024,
|
||||
fingerprint: "LvNwBVtV2ETBNH8a",
|
||||
funding: "credit",
|
||||
installments: null,
|
||||
last4: "0002",
|
||||
mandate: null,
|
||||
network: "visa",
|
||||
network_token: {
|
||||
used: false,
|
||||
},
|
||||
three_d_secure: null,
|
||||
wallet: null,
|
||||
},
|
||||
type: "card",
|
||||
},
|
||||
receipt_email: null,
|
||||
receipt_number: null,
|
||||
receipt_url: null,
|
||||
refunded: false,
|
||||
review: null,
|
||||
shipping: null,
|
||||
source: null,
|
||||
source_transfer: null,
|
||||
statement_descriptor: null,
|
||||
statement_descriptor_suffix: null,
|
||||
status: "failed",
|
||||
transfer_data: null,
|
||||
transfer_group: null,
|
||||
},
|
||||
};
|
||||
|
||||
export const refundedChargeExample = {
|
||||
id: "charge.refunded",
|
||||
name: "charge.refunded",
|
||||
icon: "stripe",
|
||||
payload: {
|
||||
id: "ch_3Nk2PLI0XSgju2ur1DqK0bOn",
|
||||
object: "charge",
|
||||
amount: 100,
|
||||
amount_captured: 100,
|
||||
amount_refunded: 100,
|
||||
application: null,
|
||||
application_fee: null,
|
||||
application_fee_amount: null,
|
||||
balance_transaction: "txn_3Nk2PLI0XSgju2ur18SfGzBU",
|
||||
billing_details: {
|
||||
address: {
|
||||
city: null,
|
||||
country: null,
|
||||
line1: null,
|
||||
line2: null,
|
||||
postal_code: null,
|
||||
state: null,
|
||||
},
|
||||
email: null,
|
||||
name: null,
|
||||
phone: null,
|
||||
},
|
||||
calculated_statement_descriptor: "WWW.TRIGGER.DEV",
|
||||
captured: true,
|
||||
created: 1693217456,
|
||||
currency: "usd",
|
||||
customer: null,
|
||||
description: "(created by Stripe CLI)",
|
||||
destination: null,
|
||||
dispute: null,
|
||||
disputed: false,
|
||||
failure_balance_transaction: null,
|
||||
failure_code: null,
|
||||
failure_message: null,
|
||||
fraud_details: {},
|
||||
invoice: null,
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
on_behalf_of: null,
|
||||
order: null,
|
||||
outcome: {
|
||||
network_status: "approved_by_network",
|
||||
reason: null,
|
||||
risk_level: "normal",
|
||||
risk_score: 50,
|
||||
seller_message: "Payment complete.",
|
||||
type: "authorized",
|
||||
},
|
||||
paid: true,
|
||||
payment_intent: "pi_3Nk2PLI0XSgju2ur1yLml2Ev",
|
||||
payment_method: "pm_1Nk2PLI0XSgju2urkxIUAHNK",
|
||||
payment_method_details: {
|
||||
card: {
|
||||
brand: "visa",
|
||||
checks: {
|
||||
address_line1_check: null,
|
||||
address_postal_code_check: null,
|
||||
cvc_check: null,
|
||||
},
|
||||
country: "US",
|
||||
exp_month: 8,
|
||||
exp_year: 2024,
|
||||
fingerprint: "w6qgKDLO5EbIJ5VZ",
|
||||
funding: "credit",
|
||||
installments: null,
|
||||
last4: "4242",
|
||||
mandate: null,
|
||||
network: "visa",
|
||||
network_token: {
|
||||
used: false,
|
||||
},
|
||||
three_d_secure: null,
|
||||
wallet: null,
|
||||
},
|
||||
type: "card",
|
||||
},
|
||||
receipt_email: null,
|
||||
receipt_number: null,
|
||||
receipt_url:
|
||||
"https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xTVJtRzRJMFhTZ2p1MnVyKLLlsacGMgbTw8sUtqQ6LBZlhILTcNiKqiXYypfyG6CAcLzUmgE7d6GU9FnnRWNQy6-jhF7lW9GCj7qY",
|
||||
refunded: true,
|
||||
review: null,
|
||||
shipping: null,
|
||||
source: null,
|
||||
source_transfer: null,
|
||||
statement_descriptor: null,
|
||||
statement_descriptor_suffix: null,
|
||||
status: "succeeded",
|
||||
transfer_data: null,
|
||||
transfer_group: null,
|
||||
},
|
||||
};
|
||||
|
||||
export const createdPaymentIntentExample = {
|
||||
id: "payment_intent.created",
|
||||
name: "payment_intent.created",
|
||||
icon: "stripe",
|
||||
payload: {
|
||||
id: "pi_3Nk2yoI0XSgju2ur14qyhbN6",
|
||||
object: "payment_intent",
|
||||
amount: 2000,
|
||||
amount_capturable: 0,
|
||||
amount_details: {
|
||||
tip: {},
|
||||
},
|
||||
amount_received: 0,
|
||||
application: null,
|
||||
application_fee_amount: null,
|
||||
automatic_payment_methods: null,
|
||||
canceled_at: null,
|
||||
cancellation_reason: null,
|
||||
capture_method: "automatic",
|
||||
client_secret: "pi_3Nk2yoI0XSgju2ur14qyhbN6_secret_gBSFGokLjHKfG8f5FeVYggBls",
|
||||
confirmation_method: "automatic",
|
||||
created: 1693219654,
|
||||
currency: "usd",
|
||||
customer: null,
|
||||
description: "(created by Stripe CLI)",
|
||||
invoice: null,
|
||||
last_payment_error: null,
|
||||
latest_charge: null,
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
next_action: null,
|
||||
on_behalf_of: null,
|
||||
payment_method: null,
|
||||
payment_method_options: {
|
||||
card: {
|
||||
installments: null,
|
||||
mandate_options: null,
|
||||
network: null,
|
||||
request_three_d_secure: "automatic",
|
||||
},
|
||||
},
|
||||
payment_method_types: ["card"],
|
||||
processing: null,
|
||||
receipt_email: null,
|
||||
review: null,
|
||||
setup_future_usage: null,
|
||||
shipping: null,
|
||||
source: null,
|
||||
statement_descriptor: null,
|
||||
statement_descriptor_suffix: null,
|
||||
status: "requires_payment_method",
|
||||
transfer_data: null,
|
||||
transfer_group: null,
|
||||
},
|
||||
};
|
||||
|
||||
export const succeededPaymentIntentExample = {
|
||||
id: "payment_intent.succeeded",
|
||||
name: "payment_intent.succeeded",
|
||||
icon: "stripe",
|
||||
payload: {
|
||||
id: "pi_3Nk30FI0XSgju2ur1OohIT9i",
|
||||
object: "payment_intent",
|
||||
amount: 2000,
|
||||
amount_capturable: 0,
|
||||
amount_details: {
|
||||
tip: {},
|
||||
},
|
||||
amount_received: 2000,
|
||||
application: null,
|
||||
application_fee_amount: null,
|
||||
automatic_payment_methods: null,
|
||||
canceled_at: null,
|
||||
cancellation_reason: null,
|
||||
capture_method: "automatic",
|
||||
client_secret: "pi_3Nk30FI0XSgju2ur1OohIT9i_secret_VPcrQS7qSyPZ4GL7BfQRA1X2y",
|
||||
confirmation_method: "automatic",
|
||||
created: 1693219743,
|
||||
currency: "usd",
|
||||
customer: null,
|
||||
description: "(created by Stripe CLI)",
|
||||
invoice: null,
|
||||
last_payment_error: null,
|
||||
latest_charge: "ch_3Nk30FI0XSgju2ur150Nf8Jf",
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
next_action: null,
|
||||
on_behalf_of: null,
|
||||
payment_method: "pm_1Nk30FI0XSgju2urEXQYKJsw",
|
||||
payment_method_options: {
|
||||
card: {
|
||||
installments: null,
|
||||
mandate_options: null,
|
||||
network: null,
|
||||
request_three_d_secure: "automatic",
|
||||
},
|
||||
},
|
||||
payment_method_types: ["card"],
|
||||
processing: null,
|
||||
receipt_email: null,
|
||||
review: null,
|
||||
setup_future_usage: null,
|
||||
shipping: {
|
||||
address: {
|
||||
city: "San Francisco",
|
||||
country: "US",
|
||||
line1: "510 Townsend St",
|
||||
line2: null,
|
||||
postal_code: "94103",
|
||||
state: "CA",
|
||||
},
|
||||
carrier: null,
|
||||
name: "Jenny Rosen",
|
||||
phone: null,
|
||||
tracking_number: null,
|
||||
},
|
||||
source: null,
|
||||
statement_descriptor: null,
|
||||
statement_descriptor_suffix: null,
|
||||
status: "succeeded",
|
||||
transfer_data: null,
|
||||
transfer_group: null,
|
||||
},
|
||||
};
|
||||
|
||||
export const cancelledPaymentIntentExample = {
|
||||
id: "payment_intent.canceled",
|
||||
name: "payment_intent.canceled",
|
||||
icon: "stripe",
|
||||
payload: {
|
||||
id: "pi_3Nk316I0XSgju2ur0WYHIexr",
|
||||
object: "payment_intent",
|
||||
amount: 2000,
|
||||
amount_capturable: 0,
|
||||
amount_details: {
|
||||
tip: {},
|
||||
},
|
||||
amount_received: 0,
|
||||
application: null,
|
||||
application_fee_amount: null,
|
||||
automatic_payment_methods: null,
|
||||
canceled_at: 1693219796,
|
||||
cancellation_reason: "requested_by_customer",
|
||||
capture_method: "automatic",
|
||||
client_secret: "pi_3Nk316I0XSgju2ur0WYHIexr_secret_NWXEzMmLe3IXZIW0HahXUXo9w",
|
||||
confirmation_method: "automatic",
|
||||
created: 1693219796,
|
||||
currency: "usd",
|
||||
customer: null,
|
||||
description: "(created by Stripe CLI)",
|
||||
invoice: null,
|
||||
last_payment_error: null,
|
||||
latest_charge: null,
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
next_action: null,
|
||||
on_behalf_of: null,
|
||||
payment_method: null,
|
||||
payment_method_options: {
|
||||
card: {
|
||||
installments: null,
|
||||
mandate_options: null,
|
||||
network: null,
|
||||
request_three_d_secure: "automatic",
|
||||
},
|
||||
},
|
||||
payment_method_types: ["card"],
|
||||
processing: null,
|
||||
receipt_email: null,
|
||||
review: null,
|
||||
setup_future_usage: null,
|
||||
shipping: null,
|
||||
source: null,
|
||||
statement_descriptor: null,
|
||||
statement_descriptor_suffix: null,
|
||||
status: "canceled",
|
||||
transfer_data: null,
|
||||
transfer_group: null,
|
||||
},
|
||||
};
|
||||
|
||||
export const amountCapturablePaymentIntentExample = {
|
||||
id: "payment_intent.amount_capturable_updated",
|
||||
name: "payment_intent.amount_capturable_updated",
|
||||
icon: "stripe",
|
||||
payload: {
|
||||
id: "pi_3Nk32UI0XSgju2ur0mIrhcYD",
|
||||
object: "payment_intent",
|
||||
amount: 2000,
|
||||
amount_capturable: 2000,
|
||||
amount_details: {
|
||||
tip: {},
|
||||
},
|
||||
amount_received: 0,
|
||||
application: null,
|
||||
application_fee_amount: null,
|
||||
automatic_payment_methods: null,
|
||||
canceled_at: null,
|
||||
cancellation_reason: null,
|
||||
capture_method: "manual",
|
||||
client_secret: "pi_3Nk32UI0XSgju2ur0mIrhcYD_secret_JyfSHNompZV9sipG3wBgfWf1s",
|
||||
confirmation_method: "manual",
|
||||
created: 1693219882,
|
||||
currency: "usd",
|
||||
customer: null,
|
||||
description: "(created by Stripe CLI)",
|
||||
invoice: null,
|
||||
last_payment_error: null,
|
||||
latest_charge: "ch_3Nk32UI0XSgju2ur0k1SMSZ4",
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
next_action: null,
|
||||
on_behalf_of: null,
|
||||
payment_method: "pm_1Nk32UI0XSgju2uriPepd9pr",
|
||||
payment_method_options: {
|
||||
card: {
|
||||
installments: null,
|
||||
mandate_options: null,
|
||||
network: null,
|
||||
request_three_d_secure: "automatic",
|
||||
},
|
||||
},
|
||||
payment_method_types: ["card"],
|
||||
processing: null,
|
||||
receipt_email: null,
|
||||
review: null,
|
||||
setup_future_usage: null,
|
||||
shipping: null,
|
||||
source: null,
|
||||
statement_descriptor: null,
|
||||
statement_descriptor_suffix: null,
|
||||
status: "requires_capture",
|
||||
transfer_data: null,
|
||||
transfer_group: null,
|
||||
},
|
||||
};
|
||||
|
||||
export const failedPaymentIntentExample = {
|
||||
id: "payment_intent.payment_failed",
|
||||
name: "payment_intent.payment_failed",
|
||||
icon: "stripe",
|
||||
payload: {
|
||||
id: "pi_3Nk341I0XSgju2ur1ckiktWk",
|
||||
object: "payment_intent",
|
||||
amount: 2000,
|
||||
amount_capturable: 0,
|
||||
amount_details: {
|
||||
tip: {},
|
||||
},
|
||||
amount_received: 0,
|
||||
application: null,
|
||||
application_fee_amount: null,
|
||||
automatic_payment_methods: null,
|
||||
canceled_at: null,
|
||||
cancellation_reason: null,
|
||||
capture_method: "automatic",
|
||||
client_secret: "pi_3Nk341I0XSgju2ur1ckiktWk_secret_3Km19PEIXajFEZRi9qi2VU2d3",
|
||||
confirmation_method: "automatic",
|
||||
created: 1693219977,
|
||||
currency: "usd",
|
||||
customer: null,
|
||||
description: "(created by Stripe CLI)",
|
||||
invoice: null,
|
||||
last_payment_error: {
|
||||
charge: "ch_3Nk341I0XSgju2ur1UZC5yvb",
|
||||
code: "card_declined",
|
||||
decline_code: "generic_decline",
|
||||
doc_url: "https://stripe.com/docs/error-codes/card-declined",
|
||||
message: "Your card was declined.",
|
||||
payment_method: {
|
||||
id: "pm_1Nk341I0XSgju2uraNBls6mm",
|
||||
object: "payment_method",
|
||||
billing_details: {
|
||||
address: {
|
||||
city: null,
|
||||
country: null,
|
||||
line1: null,
|
||||
line2: null,
|
||||
postal_code: null,
|
||||
state: null,
|
||||
},
|
||||
email: null,
|
||||
name: null,
|
||||
phone: null,
|
||||
},
|
||||
card: {
|
||||
brand: "visa",
|
||||
checks: {
|
||||
address_line1_check: null,
|
||||
address_postal_code_check: null,
|
||||
cvc_check: null,
|
||||
},
|
||||
country: "US",
|
||||
exp_month: 8,
|
||||
exp_year: 2024,
|
||||
fingerprint: "LvNwBVtV2ETBNH8a",
|
||||
funding: "credit",
|
||||
generated_from: null,
|
||||
last4: "0002",
|
||||
networks: {
|
||||
available: ["visa"],
|
||||
preferred: null,
|
||||
},
|
||||
three_d_secure_usage: {
|
||||
supported: true,
|
||||
},
|
||||
wallet: null,
|
||||
},
|
||||
created: 1693219977,
|
||||
customer: null,
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
type: "card",
|
||||
},
|
||||
type: "card_error",
|
||||
},
|
||||
latest_charge: "ch_3Nk341I0XSgju2ur1UZC5yvb",
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
next_action: null,
|
||||
on_behalf_of: null,
|
||||
payment_method: null,
|
||||
payment_method_options: {
|
||||
card: {
|
||||
installments: null,
|
||||
mandate_options: null,
|
||||
network: null,
|
||||
request_three_d_secure: "automatic",
|
||||
},
|
||||
},
|
||||
payment_method_types: ["card"],
|
||||
processing: null,
|
||||
receipt_email: null,
|
||||
review: null,
|
||||
setup_future_usage: null,
|
||||
shipping: null,
|
||||
source: null,
|
||||
statement_descriptor: null,
|
||||
statement_descriptor_suffix: null,
|
||||
status: "requires_payment_method",
|
||||
transfer_data: null,
|
||||
transfer_group: null,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -621,6 +621,218 @@ export class Stripe implements StripeIntegration {
|
||||
onPersonUpdated(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onPersonUpdated, params ?? { connect: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs on any payment_intent.* event. Accepts an optional array of events to filter on. By default it will listen to all payment_intent.* events.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* stripe.onPaymentIntent({ events: ["payment_intent.created", "payment_intent.succeeded"] })
|
||||
* ```
|
||||
*
|
||||
* 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.onPaymentIntent({ events: ["payment_intent.created", "payment_intent.succeeded"] }),
|
||||
* run: async (payload, io, ctx) => {
|
||||
* console.log(ctx.event.name); // "payment_intent.created" or "payment_intent.succeeded"
|
||||
* },
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
onPaymentIntent(
|
||||
params?: TriggerParams & {
|
||||
events?: Array<
|
||||
| "payment_intent.created"
|
||||
| "payment_intent.succeeded"
|
||||
| "payment_intent.canceled"
|
||||
| "payment_intent.processing"
|
||||
| "payment_intent.requires_action"
|
||||
| "payment_intent.amount_capturable_updated"
|
||||
| "payment_intent.payment_failed"
|
||||
| "payment_intent.partially_funded"
|
||||
>;
|
||||
}
|
||||
) {
|
||||
const event = {
|
||||
...events.onPaymentIntent,
|
||||
name: params?.events ?? events.onPaymentIntent.name,
|
||||
};
|
||||
|
||||
return createTrigger(this.source, event, params ?? { connect: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs when a new PaymentIntent is created..
|
||||
* */
|
||||
onPaymentIntentCreated(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onPaymentIntentCreated, params ?? { connect: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs when a PaymentIntent has successfully completed payment.
|
||||
* */
|
||||
onPaymentIntentSucceeded(params?: TriggerParams) {
|
||||
return createTrigger(
|
||||
this.source,
|
||||
events.onPaymentIntentSucceeded,
|
||||
params ?? { connect: false }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs when a PaymentIntent is canceled.
|
||||
* */
|
||||
onPaymentIntentCancelled(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onPaymentIntentCanceled, params ?? { connect: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs when a PaymentIntent has started processing.
|
||||
* */
|
||||
onPaymentIntentProcessing(params?: TriggerParams) {
|
||||
return createTrigger(
|
||||
this.source,
|
||||
events.onPaymentIntentProcessing,
|
||||
params ?? { connect: false }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs when a PaymentIntent transitions to requires_action state
|
||||
* */
|
||||
onPaymentIntentRequiresAction(params?: TriggerParams) {
|
||||
return createTrigger(
|
||||
this.source,
|
||||
events.onPaymentIntentRequiresAction,
|
||||
params ?? { connect: false }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs when a PaymentIntent has funds to be captured. Check the amount_capturable property on the PaymentIntent to determine the amount that can be captured. You may capture the PaymentIntent with an amount_to_capture value up to the specified amount. [Learn more about capturing PaymentIntents](https://stripe.com/docs/api/payment_intents/capture)
|
||||
* */
|
||||
onPaymentIntentAmountCapturableUpdated(params?: TriggerParams) {
|
||||
return createTrigger(
|
||||
this.source,
|
||||
events.onPaymentIntentAmountCapturableUpdated,
|
||||
params ?? { connect: false }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs when a PaymentIntent has failed the attempt to create a payment method or a payment.
|
||||
* */
|
||||
onPaymentIntentPaymentFailed(params?: TriggerParams) {
|
||||
return createTrigger(
|
||||
this.source,
|
||||
events.onPaymentIntentPaymentFailed,
|
||||
params ?? { connect: false }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs when funds are applied to a customer_balance PaymentIntent and the ‘amount_remaining’ changes.
|
||||
* */
|
||||
onPaymentIntentPartiallyFunded(params?: TriggerParams) {
|
||||
return createTrigger(
|
||||
this.source,
|
||||
events.onPaymentIntentPartiallyFunded,
|
||||
params ?? { connect: false }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs on any payout.* event. Accepts an optional array of events to filter on. By default it will listen to all payout.* events.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* stripe.onPayout({ events: ["payout.created", "payout.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.onPayout({ events: ["payout.created", "payout.paid"] }),
|
||||
* run: async (payload, io, ctx) => {
|
||||
* console.log(ctx.event.name); // "payout.created" or "payout.paid"
|
||||
* },
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
onPayout(
|
||||
params?: TriggerParams & {
|
||||
events?: Array<
|
||||
| "payout.canceled"
|
||||
| "payout.created"
|
||||
| "payout.failed"
|
||||
| "payout.paid"
|
||||
| "payout.reconciliation_completed"
|
||||
| "payout.updated"
|
||||
>;
|
||||
}
|
||||
) {
|
||||
const event = {
|
||||
...events.onPayout,
|
||||
name: params?.events ?? events.onPayout.name,
|
||||
};
|
||||
|
||||
return createTrigger(this.source, event, params ?? { connect: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs whenever a payout is created.
|
||||
* */
|
||||
onPayoutCreated(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onPayoutCreated, params ?? { connect: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs whenever a payout is updated.
|
||||
* */
|
||||
onPayoutUpdated(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onPayoutUpdated, params ?? { connect: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs whenever a payout is canceled.
|
||||
* */
|
||||
onPayoutCanceled(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onPayoutCancelled, params ?? { connect: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs whenever a payout attempt fails.
|
||||
* */
|
||||
onPayoutFailed(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onPayoutFailed, params ?? { connect: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs whenever a payout is expected to be available in the destination account. If the payout fails, a `payout.failed` notification is also sent, at a later time.
|
||||
* */
|
||||
onPayoutPaid(params?: TriggerParams) {
|
||||
return createTrigger(this.source, events.onPayoutPaid, params ?? { connect: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Occurs whenever balance transactions paid out in an automatic payout can be queried.
|
||||
* */
|
||||
onPayoutReconciliationCompleted(params?: TriggerParams) {
|
||||
return createTrigger(
|
||||
this.source,
|
||||
events.onPayoutReconciliationCompleted,
|
||||
params ?? { connect: false }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export type TriggerParams = {
|
||||
|
||||
@@ -81,3 +81,8 @@ export type OnExternalAccountEvent =
|
||||
ExtractWebhookPayload<Stripe.DiscriminatedEvent.AccountExternalAccountEvent>;
|
||||
|
||||
export type OnPersonEvent = ExtractWebhookPayload<Stripe.DiscriminatedEvent.PersonEvent>;
|
||||
|
||||
export type OnPaymentIntentEvent =
|
||||
ExtractWebhookPayload<Stripe.DiscriminatedEvent.PaymentIntentEvent>;
|
||||
|
||||
export type OnPayoutEvent = ExtractWebhookPayload<Stripe.DiscriminatedEvent.PayoutEvent>;
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
# @trigger.dev/supabase
|
||||
|
||||
## 2.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/integration-kit@2.0.14`
|
||||
- `@trigger.dev/sdk@2.0.14`
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.13`
|
||||
- `@trigger.dev/integration-kit@2.0.13`
|
||||
|
||||
## 2.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/supabase",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "Trigger.dev integration for @supabase/supabase-js",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -26,8 +26,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@supabase/supabase-js": "^2.26.0",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.12",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.12",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.14",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.14",
|
||||
"supabase-management-js": "^0.1.4",
|
||||
"zod": "3.21.4"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
# @trigger.dev/typeform
|
||||
|
||||
## 2.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/integration-kit@2.0.14`
|
||||
- `@trigger.dev/sdk@2.0.14`
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.13`
|
||||
- `@trigger.dev/integration-kit@2.0.13`
|
||||
|
||||
## 2.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/typeform",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "The official Typeform integration for Trigger.dev",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -26,8 +26,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@typeform/api-client": "^1.8.0",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.12",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.12",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.14",
|
||||
"@trigger.dev/integration-kit": "workspace:^2.0.14",
|
||||
"zod": "3.21.4"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
"packageManager": "pnpm@7.18.1",
|
||||
"dependencies": {
|
||||
"@changesets/cli": "^2.26.0",
|
||||
"@remix-run/changelog-github": "^0.0.5",
|
||||
"node-fetch": "2.6.x"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,19 @@
|
||||
# @trigger.dev/astro
|
||||
|
||||
## 2.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.14`
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.13`
|
||||
|
||||
## 2.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@trigger.dev/astro",
|
||||
"description": "An Astro-native integration for Trigger.dev background jobs platform",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"type": "module",
|
||||
"main": "main.js",
|
||||
"scripts": {},
|
||||
"peerDependencies": {
|
||||
"@trigger.dev/sdk": "workspace:^2.0.12",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.14",
|
||||
"astro": "^2.10.7"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# create-trigger
|
||||
|
||||
## 2.0.14
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- provided a fix to the CLI dev command tunnel not working if you are already running ngrok ([#407](https://github.com/triggerdotdev/trigger.dev/pull/407))
|
||||
- fix: init will no longer fail when outside of a git repo ([`3028b6ad`](https://github.com/triggerdotdev/trigger.dev/commit/3028b6ad9d693d2f1662c4338d44ac9d3bf0da3a))
|
||||
- feat: Checks for outdated packages when running the dev command with instructions on how to update ([#412](https://github.com/triggerdotdev/trigger.dev/pull/412))
|
||||
|
||||
## 2.0.12
|
||||
|
||||
## 2.0.11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/cli",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "The Trigger.dev CLI",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
|
||||
@@ -12,6 +12,8 @@ import { getTriggerApiDetails } from "../utils/getTriggerApiDetails";
|
||||
import { logger } from "../utils/logger";
|
||||
import { resolvePath } from "../utils/parseNameAndPath";
|
||||
import { TriggerApi } from "../utils/triggerApi";
|
||||
import { run as ncuRun } from 'npm-check-updates'
|
||||
import chalk from "chalk";
|
||||
|
||||
const asyncExecFile = util.promisify(childProcess.execFile);
|
||||
|
||||
@@ -45,6 +47,7 @@ export async function devCommand(path: string, anyOptions: any) {
|
||||
const options = result.data;
|
||||
|
||||
const resolvedPath = resolvePath(path);
|
||||
await checkForOutdatedPackages(resolvedPath)
|
||||
|
||||
// Read from package.json to get the endpointId
|
||||
const endpointId = await getEndpointIdFromPackageJson(resolvedPath, options);
|
||||
@@ -205,6 +208,36 @@ export async function devCommand(path: string, anyOptions: any) {
|
||||
throttle(refresh, throttleTimeMs);
|
||||
}
|
||||
|
||||
export async function checkForOutdatedPackages(path: string) {
|
||||
|
||||
const updates = await ncuRun({
|
||||
packageFile: `${path}/package.json`,
|
||||
filter: "/trigger.dev\/.+$/",
|
||||
upgrade: false,
|
||||
}) as {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
if (typeof updates === 'undefined' || Object.keys(updates).length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const packageFile = await fs.readFile(`${path}/package.json`);
|
||||
const data = JSON.parse(Buffer.from(packageFile).toString('utf8'));
|
||||
const dependencies = data.dependencies;
|
||||
console.log(
|
||||
chalk.bgYellow('Updates available for trigger.dev packages')
|
||||
);
|
||||
console.log(
|
||||
chalk.bgBlue('Run npx @trigger.dev/cli@latest update')
|
||||
);
|
||||
|
||||
for (let dep in updates) {
|
||||
console.log(`${dep} ${dependencies[dep]} → ${updates[dep]}`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export async function getEndpointIdFromPackageJson(path: string, options: DevCommandOptions) {
|
||||
if (options.clientId) {
|
||||
return options.clientId;
|
||||
@@ -258,6 +291,16 @@ async function createTunnel(port: number, spinner: Ora) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (
|
||||
typeof error.message === "string" &&
|
||||
error.message.includes("connect ECONNREFUSED 127.0.0.1:4041")
|
||||
) {
|
||||
spinner.fail(
|
||||
`Ngrok failed to create a tunnel for port ${port} because ngrok is already running`
|
||||
);
|
||||
return;
|
||||
}
|
||||
spinner.fail(`Ngrok failed to create a tunnel for port ${port}.\n${error.message}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,9 +253,19 @@ const resolveOptionsWithPrompts = async (
|
||||
// Detects if there are any uncommitted git changes at path
|
||||
async function detectGitChanges(path: string): Promise<boolean> {
|
||||
const git = simpleGit(path);
|
||||
const status = await git.status();
|
||||
|
||||
return status.files.length > 0;
|
||||
try {
|
||||
const isRepo = await git.checkIsRepo();
|
||||
|
||||
if (isRepo) {
|
||||
// Check if there are uncommitted changes
|
||||
const status = await git.status();
|
||||
return status.files.length > 0;
|
||||
}
|
||||
return false;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function detectTypescriptProject(path: string): Promise<boolean> {
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# internal-platform
|
||||
|
||||
## 2.0.14
|
||||
|
||||
## 2.0.13
|
||||
|
||||
## 2.0.12
|
||||
|
||||
## 2.0.11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/core",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "Core code used across the Trigger.dev SDK and platform",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @trigger.dev/eslint-plugin
|
||||
|
||||
## 2.0.14
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Fixes #391, now handling jobs when using new Job instead of client.defineJob ([`3028b6ad`](https://github.com/triggerdotdev/trigger.dev/commit/3028b6ad9d693d2f1662c4338d44ac9d3bf0da3a))
|
||||
|
||||
## 2.0.12
|
||||
|
||||
## 2.0.11
|
||||
|
||||
@@ -49,10 +49,7 @@ module.exports = {
|
||||
return property.name;
|
||||
}
|
||||
|
||||
const groupExpressionsByTask = (ExpressionStatements, map = new Map()) => ExpressionStatements.reduce((acc, { expression }) => {
|
||||
const taskName = getTaskName(expression);
|
||||
const taskKey = getKey(expression);
|
||||
|
||||
const groupByTaskKeyAndName = (acc, { taskKey, taskName }) => {
|
||||
if (acc.has(taskName)) {
|
||||
acc.get(taskName).push(taskKey);
|
||||
} else {
|
||||
@@ -60,6 +57,13 @@ module.exports = {
|
||||
}
|
||||
|
||||
return acc;
|
||||
}
|
||||
|
||||
const groupExpressionsByTask = (ExpressionStatements, map = new Map()) => ExpressionStatements.reduce((acc, { expression }) => {
|
||||
const taskName = getTaskName(expression);
|
||||
const taskKey = getKey(expression);
|
||||
|
||||
return groupByTaskKeyAndName(acc, { taskKey, taskName });
|
||||
}, map);
|
||||
|
||||
const groupVariableDeclarationsByTask = VariableDeclarations => VariableDeclarations.reduce((acc, { declarations }) => {
|
||||
@@ -70,30 +74,46 @@ module.exports = {
|
||||
|
||||
const taskKey = getKey(declaration.init);
|
||||
|
||||
if (acc.has(taskName)) {
|
||||
acc.get(taskName).push(taskKey);
|
||||
} else {
|
||||
acc.set(taskName, [taskKey]);
|
||||
}
|
||||
groupByTaskKeyAndName(acc, { taskKey, taskName });
|
||||
});
|
||||
|
||||
return acc;
|
||||
}, new Map());
|
||||
|
||||
const getInnerIfStatementBodies = (body) => body
|
||||
.filter((arg) => arg.type === 'IfStatement')
|
||||
.reduce((acc, arg) => {
|
||||
const consequent = arg.consequent.body;
|
||||
|
||||
const AlternateBodies = getInnerIfStatementBodies(consequent);
|
||||
|
||||
const body = consequent.filter((arg) => arg.type !== 'IfStatement');
|
||||
|
||||
return acc.concat(body).concat(AlternateBodies);
|
||||
}, [])
|
||||
|
||||
const getNodeBody = (node) => {
|
||||
const body = node.value.body.body;
|
||||
|
||||
return body
|
||||
.filter((arg) => arg.type !== 'IfStatement')
|
||||
.concat(getInnerIfStatementBodies(body));
|
||||
}
|
||||
|
||||
return {
|
||||
"CallExpression[callee.property.name='defineJob'] ObjectExpression BlockStatement": (node) => {
|
||||
const VariableDeclarations = node.body.filter((arg) => arg.type === 'VariableDeclaration');
|
||||
"Property[key.name='run']": (node) => {
|
||||
const body = getNodeBody(node);
|
||||
|
||||
const VariableDeclarations = body.filter((arg) => arg.type === 'VariableDeclaration');
|
||||
|
||||
const grouped = groupVariableDeclarationsByTask(VariableDeclarations);
|
||||
|
||||
const ExpressionStatements = node.body.filter((arg) => arg.type === 'ExpressionStatement');
|
||||
|
||||
|
||||
const ExpressionStatements = body.filter((arg) => arg.type === 'ExpressionStatement');
|
||||
|
||||
// it'll be a map of taskName => [key1, key2, ...]
|
||||
const groupedByTask = groupExpressionsByTask(ExpressionStatements, grouped);
|
||||
|
||||
groupedByTask.forEach((keys) => {
|
||||
const duplicated = keys.find((key, index) => keys.indexOf(key) !== index);
|
||||
|
||||
if (duplicated) {
|
||||
context.report({
|
||||
node,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/eslint-plugin",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "ESLint plugin with trigger.dev best practices",
|
||||
"keywords": [
|
||||
"eslint",
|
||||
|
||||
@@ -240,6 +240,86 @@ ruleTester.run("no-duplicated-task-keys", rule, {
|
||||
{ message: "Task key 'Get Tag' is duplicated" },
|
||||
{ message: "Task key 'Tag ' is duplicated" },
|
||||
]
|
||||
},
|
||||
{
|
||||
code: `import { Job, eventTrigger } from "@trigger.dev/sdk";
|
||||
import { client } from "@/trigger";
|
||||
|
||||
// your first job
|
||||
new Job(client, {
|
||||
id: "example-job",
|
||||
name: "Example Job",
|
||||
version: "0.0.1",
|
||||
trigger: eventTrigger({
|
||||
name: "example.event",
|
||||
}),
|
||||
run: async (payload, io, ctx) => {
|
||||
await io.runTask("example.task", { name: "Task 1" }, async () => {});
|
||||
await io.runTask("example.task", { name: "Task 2" }, async () => {});
|
||||
},
|
||||
});`,
|
||||
errors: [
|
||||
{ message: "Task key 'example.task' is duplicated" },
|
||||
]
|
||||
},
|
||||
{
|
||||
code: `import { Job, eventTrigger } from "@trigger.dev/sdk";
|
||||
import { client } from "@/trigger";
|
||||
|
||||
// your first job
|
||||
new Job(client, {
|
||||
id: "example-job",
|
||||
name: "Example Job",
|
||||
version: "0.0.1",
|
||||
trigger: eventTrigger({
|
||||
name: "example.event",
|
||||
}),
|
||||
run: async (payload, io, ctx) => {
|
||||
await io.runTask("example.task", { name: "Task 1" }, async () => {});
|
||||
|
||||
await io.anotherTask("different task", { name: "Task 1" }, async () => {});
|
||||
|
||||
if (true) {
|
||||
await io.runTask("example.task", { name: "Task 2" }, async () => {});
|
||||
|
||||
if (true) {
|
||||
await io.runTask("example.task", { name: "Task 3" }, async () => {});
|
||||
await io.anotherTask("different task", { name: "Task 1" }, async () => {});
|
||||
}
|
||||
}
|
||||
},
|
||||
});`,
|
||||
errors: [
|
||||
{ message: "Task key 'example.task' is duplicated" },
|
||||
{ message: "Task key 'different task' is duplicated" },
|
||||
]
|
||||
},
|
||||
{
|
||||
code: `import { Job, eventTrigger } from "@trigger.dev/sdk";
|
||||
import { client } from "@/trigger";
|
||||
|
||||
// your first job
|
||||
new Job(client, {
|
||||
id: "example-job",
|
||||
name: "Example Job",
|
||||
version: "0.0.1",
|
||||
trigger: eventTrigger({
|
||||
name: "example.event",
|
||||
}),
|
||||
run: async (payload, io, ctx) => {
|
||||
if (true) {
|
||||
await io.runTask("example.task", { name: "Task 1" }, async () => {});
|
||||
|
||||
if (true) {
|
||||
await io.runTask("example.task", { name: "Task 2" }, async () => {});
|
||||
await io.anotherTask("different task", { name: "Task 1" }, async () => {});
|
||||
}
|
||||
}
|
||||
},
|
||||
});`,
|
||||
errors: [
|
||||
{ message: "Task key 'example.task' is duplicated" },
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @trigger.dev/express
|
||||
|
||||
## 2.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.14`
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.13`
|
||||
|
||||
## 2.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/express",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "Official Express adapter for Trigger.dev",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
@@ -19,7 +19,7 @@
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@trigger.dev/sdk": "workspace:^2.0.12",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.14",
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
"@types/debug": "^4.1.7",
|
||||
"@types/express": "^4.17.13",
|
||||
@@ -33,7 +33,7 @@
|
||||
"build:tsup": "tsup"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@trigger.dev/sdk": "workspace:^2.0.12"
|
||||
"@trigger.dev/sdk": "workspace:^2.0.14"
|
||||
},
|
||||
"dependencies": {
|
||||
"@remix-run/web-fetch": "^4.3.5",
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# @trigger.dev/integration-kit
|
||||
|
||||
## 2.0.14
|
||||
|
||||
## 2.0.13
|
||||
|
||||
## 2.0.12
|
||||
|
||||
## 2.0.11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/integration-kit",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "Trigger.dev Integration Kit has helpers to make creating integrations easier",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @trigger.dev/nextjs
|
||||
|
||||
## 2.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.14`
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/sdk@2.0.13`
|
||||
|
||||
## 2.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/nextjs",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "Trigger.dev Next.js integration",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
@@ -33,7 +33,7 @@
|
||||
"build:tsup": "tsup"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@trigger.dev/sdk": "workspace:^2.0.12",
|
||||
"@trigger.dev/sdk": "workspace:^2.0.14",
|
||||
"next": ">=12.0.0 <14.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @trigger.dev/react
|
||||
|
||||
## 2.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/core@2.0.14`
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/core@2.0.13`
|
||||
|
||||
## 2.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/react",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "Trigger.dev React SDK",
|
||||
"license": "MIT",
|
||||
"types": "dist/index.d.ts",
|
||||
@@ -27,7 +27,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@tanstack/react-query": "5.0.0-beta.2",
|
||||
"@trigger.dev/core": "workspace:^2.0.12",
|
||||
"@trigger.dev/core": "workspace:^2.0.14",
|
||||
"debug": "^4.3.4",
|
||||
"zod": "3.21.4"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
# @trigger.dev/sdk
|
||||
|
||||
## 2.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/core@2.0.14`
|
||||
|
||||
## 2.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Only use cached tasks if they are completed, otherwise retrying tasks will be considered successful ([`916a3536`](https://github.com/triggerdotdev/trigger.dev/commit/916a353660e251946d76bdf565c26b7801d3beb8))
|
||||
- Updated dependencies:
|
||||
- `@trigger.dev/core@2.0.13`
|
||||
|
||||
## 2.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trigger.dev/sdk",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "trigger.dev Node.JS SDK",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
@@ -25,7 +25,7 @@
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@trigger.dev/core": "workspace:^2.0.12",
|
||||
"@trigger.dev/core": "workspace:^2.0.14",
|
||||
"chalk": "^5.2.0",
|
||||
"cronstrue": "^2.21.0",
|
||||
"debug": "^4.3.4",
|
||||
|
||||
@@ -504,8 +504,8 @@ export class IO {
|
||||
|
||||
const cachedTask = this._cachedTasks.get(idempotencyKey);
|
||||
|
||||
if (cachedTask) {
|
||||
this._logger.debug("Using cached task", {
|
||||
if (cachedTask && cachedTask.status === "COMPLETED") {
|
||||
this._logger.debug("Using completed cached task", {
|
||||
idempotencyKey,
|
||||
cachedTask,
|
||||
});
|
||||
|
||||
Generated
+51
-20
@@ -7,6 +7,7 @@ importers:
|
||||
'@changesets/cli': ^2.26.0
|
||||
'@manypkg/cli': ^0.19.2
|
||||
'@playwright/test': ^1.36.2
|
||||
'@remix-run/changelog-github': ^0.0.5
|
||||
'@tailwindcss/forms': ^0.5.3
|
||||
'@tailwindcss/typography': ^0.5.8
|
||||
'@trigger.dev/cli': workspace:*
|
||||
@@ -25,6 +26,7 @@ importers:
|
||||
vitest: ^0.28.4
|
||||
dependencies:
|
||||
'@changesets/cli': 2.26.0
|
||||
'@remix-run/changelog-github': 0.0.5
|
||||
node-fetch: 2.6.7
|
||||
devDependencies:
|
||||
'@manypkg/cli': 0.19.2
|
||||
@@ -614,8 +616,8 @@ importers:
|
||||
'@octokit/types': ^9.2.3
|
||||
'@octokit/webhooks': ^10.4.0
|
||||
'@octokit/webhooks-types': ^6.10.0
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.12
|
||||
'@trigger.dev/sdk': workspace:^2.0.12
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.14
|
||||
'@trigger.dev/sdk': workspace:^2.0.14
|
||||
'@trigger.dev/tsconfig': workspace:*
|
||||
'@types/node': '18'
|
||||
octokit: ^2.0.14
|
||||
@@ -640,8 +642,8 @@ importers:
|
||||
|
||||
integrations/openai:
|
||||
specifiers:
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.12
|
||||
'@trigger.dev/sdk': workspace:^2.0.12
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.14
|
||||
'@trigger.dev/sdk': workspace:^2.0.14
|
||||
'@trigger.dev/tsconfig': workspace:*
|
||||
'@types/node': '18'
|
||||
openai: ^4.2.0
|
||||
@@ -660,8 +662,8 @@ importers:
|
||||
integrations/plain:
|
||||
specifiers:
|
||||
'@team-plain/typescript-sdk': ^2.7.0
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.12
|
||||
'@trigger.dev/sdk': workspace:^2.0.12
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.14
|
||||
'@trigger.dev/sdk': workspace:^2.0.14
|
||||
'@trigger.dev/tsconfig': workspace:*
|
||||
'@types/node': '18'
|
||||
rimraf: ^3.0.2
|
||||
@@ -678,8 +680,8 @@ importers:
|
||||
|
||||
integrations/resend:
|
||||
specifiers:
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.12
|
||||
'@trigger.dev/sdk': workspace:^2.0.12
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.14
|
||||
'@trigger.dev/sdk': workspace:^2.0.14
|
||||
'@trigger.dev/tsconfig': workspace:*
|
||||
'@types/node': '18'
|
||||
resend: ^0.9.1
|
||||
@@ -698,8 +700,8 @@ importers:
|
||||
integrations/sendgrid:
|
||||
specifiers:
|
||||
'@sendgrid/mail': ^7.7.0
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.12
|
||||
'@trigger.dev/sdk': workspace:^2.0.12
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.14
|
||||
'@trigger.dev/sdk': workspace:^2.0.14
|
||||
'@types/node': 16.x
|
||||
rimraf: ^3.0.2
|
||||
tsup: 7.1.x
|
||||
@@ -717,7 +719,7 @@ importers:
|
||||
integrations/slack:
|
||||
specifiers:
|
||||
'@slack/web-api': ^6.8.1
|
||||
'@trigger.dev/sdk': workspace:^2.0.12
|
||||
'@trigger.dev/sdk': workspace:^2.0.14
|
||||
'@trigger.dev/tsconfig': workspace:*
|
||||
'@types/node': '18'
|
||||
rimraf: ^3.0.2
|
||||
@@ -735,8 +737,8 @@ importers:
|
||||
|
||||
integrations/stripe:
|
||||
specifiers:
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.12
|
||||
'@trigger.dev/sdk': workspace:^2.0.12
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.14
|
||||
'@trigger.dev/sdk': workspace:^2.0.14
|
||||
'@types/node': 16.x
|
||||
rimraf: ^3.0.2
|
||||
stripe: ^12.14.0
|
||||
@@ -759,8 +761,8 @@ importers:
|
||||
integrations/supabase:
|
||||
specifiers:
|
||||
'@supabase/supabase-js': ^2.26.0
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.12
|
||||
'@trigger.dev/sdk': workspace:^2.0.12
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.14
|
||||
'@trigger.dev/sdk': workspace:^2.0.14
|
||||
'@types/node': 18.x
|
||||
rimraf: ^3.0.2
|
||||
supabase-management-js: ^0.1.4
|
||||
@@ -781,8 +783,8 @@ importers:
|
||||
|
||||
integrations/typeform:
|
||||
specifiers:
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.12
|
||||
'@trigger.dev/sdk': workspace:^2.0.12
|
||||
'@trigger.dev/integration-kit': workspace:^2.0.14
|
||||
'@trigger.dev/sdk': workspace:^2.0.14
|
||||
'@typeform/api-client': ^1.8.0
|
||||
'@types/node': 16.x
|
||||
rimraf: ^3.0.2
|
||||
@@ -987,7 +989,7 @@ importers:
|
||||
packages/express:
|
||||
specifiers:
|
||||
'@remix-run/web-fetch': ^4.3.5
|
||||
'@trigger.dev/sdk': workspace:^2.0.12
|
||||
'@trigger.dev/sdk': workspace:^2.0.14
|
||||
'@trigger.dev/tsconfig': workspace:*
|
||||
'@types/debug': ^4.1.7
|
||||
'@types/express': ^4.17.13
|
||||
@@ -1056,7 +1058,7 @@ importers:
|
||||
packages/react:
|
||||
specifiers:
|
||||
'@tanstack/react-query': 5.0.0-beta.2
|
||||
'@trigger.dev/core': workspace:^2.0.12
|
||||
'@trigger.dev/core': workspace:^2.0.14
|
||||
'@trigger.dev/tsconfig': workspace:*
|
||||
'@types/debug': ^4.1.7
|
||||
'@types/react': 18.2.17
|
||||
@@ -1086,7 +1088,7 @@ importers:
|
||||
|
||||
packages/trigger-sdk:
|
||||
specifiers:
|
||||
'@trigger.dev/core': workspace:^2.0.12
|
||||
'@trigger.dev/core': workspace:^2.0.14
|
||||
'@trigger.dev/tsconfig': workspace:*
|
||||
'@types/debug': ^4.1.7
|
||||
'@types/node': '18'
|
||||
@@ -3778,6 +3780,15 @@ packages:
|
||||
semver: 5.7.1
|
||||
dev: false
|
||||
|
||||
/@changesets/get-github-info/0.5.2:
|
||||
resolution: {integrity: sha512-JppheLu7S114aEs157fOZDjFqUDpm7eHdq5E8SSR0gUBTEK0cNSHsrSR5a66xs0z3RWuo46QvA3vawp8BxDHvg==}
|
||||
dependencies:
|
||||
dataloader: 1.4.0
|
||||
node-fetch: 2.6.12
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
dev: false
|
||||
|
||||
/@changesets/get-release-plan/3.0.16:
|
||||
resolution: {integrity: sha512-OpP9QILpBp1bY2YNIKFzwigKh7Qe9KizRsZomzLe6pK8IUo8onkAAVUD8+JRKSr8R7d4+JRuQrfSSNlEwKyPYg==}
|
||||
dependencies:
|
||||
@@ -8712,6 +8723,17 @@ packages:
|
||||
react: 18.2.0
|
||||
dev: false
|
||||
|
||||
/@remix-run/changelog-github/0.0.5:
|
||||
resolution: {integrity: sha512-43tqwUqWqirbv6D9uzo55ASPsCJ61Ein1k/M8qn+Qpros0MmbmuzjLVPmtaxfxfe2ANX0LefLvCD0pAgr1tp4g==}
|
||||
dependencies:
|
||||
'@changesets/errors': 0.1.4
|
||||
'@changesets/get-github-info': 0.5.2
|
||||
'@changesets/types': 5.2.1
|
||||
dotenv: 8.6.0
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
dev: false
|
||||
|
||||
/@remix-run/dev/1.19.2-pre.0_36n2i74sizt32vwpdxc4husnkq:
|
||||
resolution: {integrity: sha512-8s7g8jLueKcIr5Gb7qvZRJVzfHx2KqyApGYW55LrQ63kNwZwuKHglYSMoaQGB4xUhX2cfmzW7pIcunfbh3SNyA==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
@@ -14268,6 +14290,10 @@ packages:
|
||||
engines: {node: '>= 14'}
|
||||
dev: true
|
||||
|
||||
/dataloader/1.4.0:
|
||||
resolution: {integrity: sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw==}
|
||||
dev: false
|
||||
|
||||
/date-fns/2.30.0:
|
||||
resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==}
|
||||
engines: {node: '>=0.11'}
|
||||
@@ -14760,6 +14786,11 @@ packages:
|
||||
resolution: {integrity: sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
/dotenv/8.6.0:
|
||||
resolution: {integrity: sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==}
|
||||
engines: {node: '>=10'}
|
||||
dev: false
|
||||
|
||||
/duplexer2/0.1.4:
|
||||
resolution: {integrity: sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==}
|
||||
dependencies:
|
||||
|
||||
Reference in New Issue
Block a user