Compare commits

...

13 Commits

Author SHA1 Message Date
Matt Aitken bc757c8ddb Latest lockfile 2023-09-27 18:12:54 +01:00
github-actions[bot] 6e11ab9183 chore: Update version for release (#513)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-27 18:09:16 +01:00
Matt Aitken 2397fcb640 Express frameworks docs + CLI (#512)
* Manual setup docs

* Added the onboarding

* The emails package now works with Node > 18

* Added CLi support for Express, including custom init command finished messages

* Need to actually log out the installation complete message…

* Fix for an old Remix reference

* Renamed the page export

* Use resolvedOptions.triggerUrl

* Typo in manual instructions
2023-09-27 17:44:50 +01:00
Eric Allam 35d0c2a06f Implement the task output redacting to prevent redacted values from showing in the logs 2023-09-27 16:38:30 +01:00
Matt Aitken 813ec74672 Increased the intervalTrigger max from 1 day to 30 days
🚀 Publish Trigger.dev Docker / ʦ TypeScript (push) Has been cancelled
🚀 Publish Trigger.dev Docker / Unit Tests (push) Has been cancelled
🚀 Publish Trigger.dev Docker / e2e Tests (push) Has been cancelled
🚀 Publish Trigger.dev Docker / publish (push) Has been cancelled
2023-09-26 17:23:36 +01:00
Matt Aitken 03db13171a Latest lockfile 2023-09-26 16:46:41 +01:00
Matt Aitken 0ecb5129e8 Fix for incorrectly named Next.js package in manual setup 2023-09-26 12:47:49 +01:00
github-actions[bot] 44cb28c1c4 chore: Update version for release (#508)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-26 11:49:03 +01:00
Matt Aitken 4578f6bd64 Astro CLI support (#506)
* Astro framework CLI support

* Changeset: Added Astro automatic installation

* Fixed the package name – was remix, now astro

* Fixed the export of the example

* Added IPv6 localhost to Astro hostnames

* Updated Astro onboarding to show the CLI init command, instead of manual instructions

* Astro quickstart

* Fix for type in Remix quickstart

* Next.js framework detection allows different config file extensions and “next” devDependency

* Made the dev command port more general so it works with various frameworks
2023-09-26 11:44:35 +01:00
Eric Allam 8b25e57613 hotfix 2 2023-09-24 14:43:02 -07:00
Eric Allam 8fb9ea19a3 hotfix 2023-09-24 14:04:46 -07:00
Eric Allam eb4ca0ce2d Fixed duplicate end month
🚀 Publish Trigger.dev Docker / ʦ TypeScript (push) Has been cancelled
🚀 Publish Trigger.dev Docker / Unit Tests (push) Has been cancelled
🚀 Publish Trigger.dev Docker / e2e Tests (push) Has been cancelled
🚀 Publish Trigger.dev Docker / publish (push) Has been cancelled
2023-09-22 17:24:55 -07:00
Eric Allam df24cd5b71 feat: Basic usage dashboard to show run volume (#501)
* New usage dashboard with static data

* Implement org usage dash

* Grab chart data for the last 12 months

* If no org is found just return undefined so a 404 will be shown

* Remove mock data

* Fill in missing months with 0s

---------

Co-authored-by: James Ritchie <james@jamesritchie.co.uk>
2023-09-22 17:02:53 -07:00
81 changed files with 2040 additions and 151 deletions
+1 -1
View File
@@ -106,7 +106,7 @@ export function TriggerDevStep() {
</Paragraph>
<TriggerDevCommand />
<Paragraph spacing variant="small">
If youre not running on port 3000 you can specify the port by adding{" "}
If youre not running on the default you can specify the port by adding{" "}
<InlineCode variant="extra-small">--port 3001</InlineCode> to the end.
</Paragraph>
<Paragraph spacing variant="small">
@@ -51,7 +51,7 @@ export function FrameworkSelector() {
<FrameworkLink to={projectSetupNextjsPath(organization, project)} supported>
<NextjsLogo className="w-32" />
</FrameworkLink>
<FrameworkLink to={projectSetupExpressPath(organization, project)}>
<FrameworkLink to={projectSetupExpressPath(organization, project)} supported>
<ExpressLogo className="w-36" />
</FrameworkLink>
<FrameworkLink to={projectSetupRemixPath(organization, project)} supported>
@@ -76,6 +76,10 @@ export async function createOrganization(
},
attemptCount = 0
): Promise<Organization & { projects: Project[] }> {
if (typeof process.env.BLOCKED_USERS === "string" && process.env.BLOCKED_USERS.includes(userId)) {
throw new Error("Organization could not be created.");
}
const uniqueOrgSlug = `${slug(title)}-${nanoid(4)}`;
const orgWithSameSlug = await prisma.organization.findFirst({
@@ -0,0 +1,198 @@
import { PrismaClient, prisma } from "~/db.server";
export class OrgUsagePresenter {
#prismaClient: PrismaClient;
constructor(prismaClient: PrismaClient = prisma) {
this.#prismaClient = prismaClient;
}
public async call({ userId, slug }: { userId: string; slug: string }) {
const organization = await this.#prismaClient.organization.findFirst({
where: {
slug,
members: {
some: {
userId,
},
},
},
});
if (!organization) {
return;
}
const startOfMonth = new Date(new Date().getFullYear(), new Date().getMonth(), 1);
const startOfLastMonth = new Date(new Date().getFullYear(), new Date().getMonth() - 1, 1); // this works for January as well
// Get count of runs since the start of the current month
const runsCount = await this.#prismaClient.jobRun.count({
where: {
organizationId: organization.id,
createdAt: {
gte: new Date(new Date().getFullYear(), new Date().getMonth(), 1),
},
},
});
// Get the count of runs for last month
const runsCountLastMonth = await this.#prismaClient.jobRun.count({
where: {
organizationId: organization.id,
createdAt: {
gte: startOfLastMonth,
lt: startOfMonth,
},
},
});
// Get the count of the runs for the last 6 months, by month. So for example we want the data shape to be:
// [
// { month: "2021-01", count: 10 },
// { month: "2021-02", count: 20 },
// { month: "2021-03", count: 30 },
// { month: "2021-04", count: 40 },
// { month: "2021-05", count: 50 },
// { month: "2021-06", count: 60 },
// ]
// This will be used to generate the chart on the usage page
// Use prisma queryRaw for this since prisma doesn't support grouping by month
const chartDataRaw = await this.#prismaClient.$queryRaw<
{
month: string;
count: number;
}[]
>`SELECT TO_CHAR("createdAt", 'YYYY-MM') as month, COUNT(*) as count FROM "JobRun" WHERE "organizationId" = ${organization.id} AND "createdAt" >= NOW() - INTERVAL '6 months' GROUP BY month ORDER BY month ASC`;
const chartData = chartDataRaw.map((obj) => ({
name: obj.month,
total: Number(obj.count), // Convert BigInt to Number
}));
const totalJobs = await this.#prismaClient.job.count({
where: {
organizationId: organization.id,
internal: false,
},
});
const totalJobsLastMonth = await this.#prismaClient.job.count({
where: {
organizationId: organization.id,
createdAt: {
lt: startOfMonth,
},
deletedAt: null,
internal: false,
},
});
const totalIntegrations = await this.#prismaClient.integration.count({
where: {
organizationId: organization.id,
},
});
const totalIntegrationsLastMonth = await this.#prismaClient.integration.count({
where: {
organizationId: organization.id,
createdAt: {
lt: startOfMonth,
},
},
});
const totalMembers = await this.#prismaClient.orgMember.count({
where: {
organizationId: organization.id,
},
});
const jobs = await this.#prismaClient.job.findMany({
where: {
organizationId: organization.id,
deletedAt: null,
internal: false,
},
select: {
id: true,
slug: true,
_count: {
select: {
runs: {
where: {
createdAt: {
gte: startOfMonth,
},
},
},
},
},
project: {
select: {
id: true,
name: true,
slug: true,
},
},
},
});
return {
id: organization.id,
runsCount,
runsCountLastMonth,
chartData: fillInMissingMonthlyData(chartData, 6),
totalJobs,
totalJobsLastMonth,
totalIntegrations,
totalIntegrationsLastMonth,
totalMembers,
jobs,
};
}
}
// This will fill in missing chart data with zeros
// So for example, if data is [{ name: "2021-01", total: 10 }, { name: "2021-03", total: 30 }] and the totalNumberOfMonths is 6
// And the current month is "2021-04", then this function will return:
// [{ name: "2020-11", total: 0 }, { name: "2020-12", total: 0 }, { name: "2021-01", total: 10 }, { name: "2021-02", total: 0 }, { name: "2021-03", total: 30 }, { name: "2021-04", total: 0 }]
function fillInMissingMonthlyData(
data: Array<{ name: string; total: number }>,
totalNumberOfMonths: number
): Array<{ name: string; total: number }> {
const currentMonth = new Date().toISOString().slice(0, 7);
const startMonth = new Date(
new Date(currentMonth).getFullYear(),
new Date(currentMonth).getMonth() - totalNumberOfMonths,
1
)
.toISOString()
.slice(0, 7);
const months = getMonthsBetween(startMonth, currentMonth);
let completeData = months.map((month) => {
let foundData = data.find((d) => d.name === month);
return foundData ? { ...foundData } : { name: month, total: 0 };
});
return completeData;
}
function getMonthsBetween(startMonth: string, endMonth: string): string[] {
const startDate = new Date(startMonth);
const endDate = new Date(endMonth);
const months = [];
let currentDate = startDate;
while (currentDate <= endDate) {
months.push(currentDate.toISOString().slice(0, 7));
currentDate = new Date(currentDate.setMonth(currentDate.getMonth() + 1));
}
return months;
}
@@ -1,6 +1,8 @@
import { RedactSchema } from "@trigger.dev/core";
import { StyleSchema } from "@trigger.dev/core";
import { PrismaClient, prisma } from "~/db.server";
import { mergeProperties } from "~/utils/mergeProperties.server";
import { Redactor } from "~/utils/redactor";
type DetailsProps = {
id: string;
@@ -61,6 +63,7 @@ export class TaskDetailsPresenter {
completedAt: true,
style: true,
parentId: true,
redact: true,
attempts: {
select: {
number: true,
@@ -85,11 +88,32 @@ export class TaskDetailsPresenter {
return {
...task,
output: task.output ? JSON.stringify(task.output, null, 2) : undefined,
redact: undefined,
output: task.output
? JSON.stringify(this.#stringifyOutputWithRedactions(task.output, task.redact), null, 2)
: undefined,
connection: task.runConnection,
params: task.params as Record<string, any>,
properties: mergeProperties(task.properties, task.outputProperties),
style: task.style ? StyleSchema.parse(task.style) : undefined,
};
}
#stringifyOutputWithRedactions(output: any, redact: unknown): any {
if (!output) {
return;
}
const parsedRedact = RedactSchema.safeParse(redact);
if (!parsedRedact.success) {
return output;
}
const paths = parsedRedact.data.paths;
const redactor = new Redactor(paths);
return redactor.redact(output);
}
}
@@ -1,17 +1,178 @@
import { ComingSoon } from "~/components/ComingSoon";
import { PageContainer, PageBody } from "~/components/layout/AppLayout";
import { ArrowRightIcon } from "@heroicons/react/20/solid";
import {
ForwardIcon,
SquaresPlusIcon,
UsersIcon,
WrenchScrewdriverIcon,
} from "@heroicons/react/24/solid";
import { Bar, BarChart, ResponsiveContainer, Tooltip, TooltipProps, XAxis, YAxis } from "recharts";
import { PageBody, PageContainer } from "~/components/layout/AppLayout";
import { Header2 } from "~/components/primitives/Headers";
import { Paragraph } from "~/components/primitives/Paragraph";
import { TextLink } from "~/components/primitives/TextLink";
import { useOrganization } from "~/hooks/useOrganizations";
import { OrganizationParamsSchema, jobPath, organizationTeamPath } from "~/utils/pathBuilder";
import { OrgAdminHeader } from "../_app.orgs.$organizationSlug._index/OrgAdminHeader";
import { Link } from "@remix-run/react/dist/components";
import { LoaderArgs } from "@remix-run/server-runtime";
import { typedjson, useTypedLoaderData } from "remix-typedjson";
import { OrgUsagePresenter } from "~/presenters/OrgUsagePresenter.server";
import { requireUserId } from "~/services/session.server";
export async function loader({ params, request }: LoaderArgs) {
const userId = await requireUserId(request);
const { organizationSlug } = OrganizationParamsSchema.parse(params);
const presenter = new OrgUsagePresenter();
const data = await presenter.call({ userId, slug: organizationSlug });
if (!data) {
throw new Response(null, { status: 404 });
}
return typedjson(data);
}
const CustomTooltip = ({ active, payload, label }: TooltipProps<number, string>) => {
if (active && payload) {
return (
<div className="flex items-center gap-2 rounded border border-border bg-slate-900 px-4 py-2 text-sm text-dimmed">
<p className="text-white">{label}:</p>
<p className="text-white">{payload[0].value}</p>
</div>
);
}
return null;
};
export default function Page() {
const organization = useOrganization();
const loaderData = useTypedLoaderData<typeof loader>();
return (
<PageContainer>
<OrgAdminHeader />
<PageBody>
<ComingSoon
title="Usage & billing"
description="View your usage, tier and billing information. During the beta we will display usage and start billing if you exceed your limits. But don't worry, we'll give you plenty of warning."
icon="billing"
/>
<div className="mb-4 grid gap-4 md:grid-cols-2 lg:grid-cols-4">
<div className="rounded border border-border p-6">
<div className="flex flex-row items-center justify-between space-y-0 pb-2">
<Header2>Total Runs this month</Header2>
<ForwardIcon className="h-6 w-6 text-dimmed" />
</div>
<div>
<p className="text-3xl font-bold">{loaderData.runsCount.toLocaleString()}</p>
<Paragraph variant="small" className="text-dimmed">
{loaderData.runsCountLastMonth} runs last month
</Paragraph>
</div>
</div>
<div className="rounded border border-border p-6">
<div className="flex flex-row items-center justify-between space-y-0 pb-2">
<Header2>Total Jobs</Header2>
<WrenchScrewdriverIcon className="h-6 w-6 text-dimmed" />
</div>
<div>
<p className="text-3xl font-bold">{loaderData.totalJobs.toLocaleString()}</p>
<Paragraph variant="small" className="text-dimmed">
{loaderData.totalJobs === loaderData.totalJobsLastMonth ? (
<>No change since last month</>
) : loaderData.totalJobs > loaderData.totalJobsLastMonth ? (
<>+{loaderData.totalJobs - loaderData.totalJobsLastMonth} since last month</>
) : (
<>-{loaderData.totalJobsLastMonth - loaderData.totalJobs} since last month</>
)}
</Paragraph>
</div>
</div>
<div className="rounded border border-border p-6">
<div className="flex flex-row items-center justify-between space-y-0 pb-2">
<Header2>Total Integrations</Header2>
<SquaresPlusIcon className="h-6 w-6 text-dimmed" />
</div>
<div>
<p className="text-3xl font-bold">{loaderData.totalIntegrations.toLocaleString()}</p>
<Paragraph variant="small" className="text-dimmed">
{loaderData.totalIntegrations === loaderData.totalIntegrationsLastMonth ? (
<>No change since last month</>
) : loaderData.totalIntegrations > loaderData.totalIntegrationsLastMonth ? (
<>
+{loaderData.totalIntegrations - loaderData.totalIntegrationsLastMonth} since
last month
</>
) : (
<>
-{loaderData.totalIntegrationsLastMonth - loaderData.totalIntegrations} since
last month
</>
)}
</Paragraph>
</div>
</div>
<div className="rounded border border-border p-6">
<div className="flex flex-row items-center justify-between space-y-0 pb-2">
<Header2>Team members</Header2>
<UsersIcon className="h-6 w-6 text-dimmed" />
</div>
<div>
<p className="text-3xl font-bold">{loaderData.totalMembers.toLocaleString()}</p>
<TextLink
to={organizationTeamPath(organization)}
className="group text-sm text-dimmed hover:text-bright"
>
Manage
<ArrowRightIcon className="-mb-0.5 ml-0.5 h-4 w-4 text-dimmed transition group-hover:translate-x-1 group-hover:text-bright" />
</TextLink>
</div>
</div>
</div>
<div className="flex max-h-[500px] gap-x-4">
<div className="w-1/2 rounded border border-border py-6 pr-2">
<Header2 className="mb-8 pl-6">Job Runs per month</Header2>
<ResponsiveContainer width="100%" height={400}>
<BarChart data={loaderData.chartData}>
<XAxis
dataKey="name"
stroke="#888888"
fontSize={12}
tickLine={false}
axisLine={false}
/>
<YAxis
stroke="#888888"
fontSize={12}
tickLine={false}
axisLine={false}
tickFormatter={(value) => `${value}`}
/>
<Tooltip cursor={{ fill: "rgba(255,255,255,0.05)" }} content={<CustomTooltip />} />
<Bar dataKey="total" fill="#DB2777" radius={[4, 4, 0, 0]} />
</BarChart>
</ResponsiveContainer>
</div>
<div className="w-1/2 overflow-y-auto rounded border border-border px-3 py-6">
<div className="mb-2 flex items-baseline justify-between border-b border-border px-3 pb-4">
<Header2 className="">Jobs</Header2>
<Header2 className="">Runs</Header2>
</div>
<div className="space-y-2">
{loaderData.jobs.map((job) => (
<Link
to={jobPath(organization, job.project, job)}
className="flex items-center rounded px-4 py-3 transition hover:bg-slate-850"
key={job.id}
>
<div className="space-y-1">
<p className="text-sm font-medium leading-none">{job.slug}</p>
<p className="text-sm text-muted-foreground">Project: {job.project.name}</p>
</div>
<div className="ml-auto font-medium">{job._count.runs.toLocaleString()}</div>
</Link>
))}
</div>
</div>
</div>
</PageBody>
</PageContainer>
);
@@ -39,6 +39,8 @@ export default function SetUpAstro() {
useProjectSetupComplete();
const devEnvironment = useDevEnvironment();
invariant(devEnvironment, "Dev environment must be defined");
const appOrigin = useAppOrigin();
return (
<PageGradient>
<div className="mx-auto max-w-3xl">
@@ -76,28 +78,16 @@ export default function SetUpAstro() {
<div>
<StepNumber
stepNumber="1"
title="Follow the steps from the Astro manual installation guide"
title="Run the CLI 'init' command in an existing Astro project"
/>
<StepContentContainer className="flex flex-col gap-2">
<Paragraph className="mt-2">Copy your server API Key to your clipboard:</Paragraph>
<div className="mb-2 flex w-full items-center justify-between">
<ClipboardField
secure
className="w-fit"
value={devEnvironment.apiKey}
variant={"secondary/medium"}
icon={<Badge variant="outline">Server</Badge>}
/>
</div>
<Paragraph>Now follow this guide:</Paragraph>
<LinkButton
to="https://trigger.dev/docs/documentation/guides/manual/astro"
variant="primary/medium"
TrailingIcon="external-link"
>
Manual installation guide
</LinkButton>
<div className="flex items-start justify-start gap-2"></div>
<StepContentContainer>
<InitCommand appOrigin={appOrigin} apiKey={devEnvironment.apiKey} />
<Paragraph spacing variant="small">
Youll notice a new folder in your project called 'jobs'. Weve added a very simple
example Job in <InlineCode variant="extra-small">example.ts</InlineCode> to help you
get started.
</Paragraph>
</StepContentContainer>
<StepNumber stepNumber="2" title="Run your Astro app" />
<StepContentContainer>
@@ -1,21 +1,116 @@
import { ExpressLogo } from "~/assets/logos/ExpressLogo";
import { FrameworkComingSoon } from "~/components/frameworks/FrameworkComingSoon";
import { ChatBubbleLeftRightIcon, Squares2X2Icon } from "@heroicons/react/20/solid";
import invariant from "tiny-invariant";
import { Feedback } from "~/components/Feedback";
import { PageGradient } from "~/components/PageGradient";
import { InitCommand, RunDevCommand, TriggerDevStep } from "~/components/SetupCommands";
import { StepContentContainer } from "~/components/StepContentContainer";
import { InlineCode } from "~/components/code/InlineCode";
import { BreadcrumbLink } from "~/components/navigation/NavBar";
import { Badge } from "~/components/primitives/Badge";
import { Button, LinkButton } from "~/components/primitives/Buttons";
import { Callout } from "~/components/primitives/Callout";
import { ClipboardField } from "~/components/primitives/ClipboardField";
import { Header1 } from "~/components/primitives/Headers";
import { Paragraph } from "~/components/primitives/Paragraph";
import { StepNumber } from "~/components/primitives/StepNumber";
import { useAppOrigin } from "~/hooks/useAppOrigin";
import { useDevEnvironment } from "~/hooks/useEnvironments";
import { useOrganization } from "~/hooks/useOrganizations";
import { useProject } from "~/hooks/useProject";
import { useProjectSetupComplete } from "~/hooks/useProjectSetupComplete";
import { Handle } from "~/utils/handle";
import { trimTrailingSlash } from "~/utils/pathBuilder";
import { projectSetupPath, trimTrailingSlash } from "~/utils/pathBuilder";
export const handle: Handle = {
breadcrumb: (match) => <BreadcrumbLink to={trimTrailingSlash(match.pathname)} title="Express" />,
};
export default function Page() {
const organization = useOrganization();
const project = useProject();
useProjectSetupComplete();
const devEnvironment = useDevEnvironment();
invariant(devEnvironment, "Dev environment must be defined");
const appOrigin = useAppOrigin();
return (
<FrameworkComingSoon
frameworkName="Express"
githubIssueUrl="https://github.com/triggerdotdev/trigger.dev/issues/451"
githubIssueNumber={451}
>
<ExpressLogo className="w-56" />
</FrameworkComingSoon>
<PageGradient>
<div className="mx-auto max-w-3xl">
<div className="flex items-center justify-between">
<Header1 spacing className="text-bright">
Get setup in 5 minutes
</Header1>
<div className="flex items-center gap-2">
<LinkButton
to={projectSetupPath(organization, project)}
variant="tertiary/small"
LeadingIcon={Squares2X2Icon}
>
Choose a different framework
</LinkButton>
<Feedback
button={
<Button variant="tertiary/small" LeadingIcon={ChatBubbleLeftRightIcon}>
I'm stuck!
</Button>
}
defaultValue="help"
/>
</div>
</div>
<div>
<Callout
variant={"info"}
to="https://github.com/triggerdotdev/trigger.dev/discussions/430"
className="mb-8"
>
Trigger.dev has full support for serverless. We will be adding support for long-running
servers soon.
</Callout>
<div>
<StepNumber
stepNumber="1"
title="Manually set up Trigger.dev in your existing Express project"
/>
<StepContentContainer className="flex flex-col gap-2">
<Paragraph className="mt-2">Copy your server API Key to your clipboard:</Paragraph>
<div className="mb-2 flex w-full items-center justify-between">
<ClipboardField
secure
className="w-fit"
value={devEnvironment.apiKey}
variant={"secondary/medium"}
icon={<Badge variant="outline">Server</Badge>}
/>
</div>
<Paragraph>Now follow this guide:</Paragraph>
<LinkButton
to="https://trigger.dev/docs/documentation/guides/manual/express"
variant="primary/medium"
TrailingIcon="external-link"
>
Manual installation guide
</LinkButton>
</StepContentContainer>
<StepNumber stepNumber="2" title="Run your Express app" />
<StepContentContainer>
<RunDevCommand />
<Callout variant="info">
You may be using the `start` script instead, in which case substitute `dev` in the
above commands.
</Callout>
</StepContentContainer>
<StepNumber stepNumber="3" title="Run the CLI 'dev' command" />
<StepContentContainer>
<TriggerDevStep />
</StepContentContainer>
<StepNumber stepNumber="6" title="Wait for Jobs" displaySpinner />
<StepContentContainer>
<Paragraph>This page will automatically refresh.</Paragraph>
</StepContentContainer>
</div>
</div>
</div>
</PageGradient>
);
}
@@ -153,6 +153,29 @@ export class PerformRunExecutionV2Service {
return;
}
try {
if (
typeof process.env.BLOCKED_ORGS === "string" &&
process.env.BLOCKED_ORGS.includes(run.organizationId)
) {
logger.debug("Skipping execution for blocked org", {
orgId: run.organizationId,
});
await this.#prismaClient.jobRun.update({
where: {
id: run.id,
},
data: {
status: "CANCELED",
completedAt: new Date(),
},
});
return;
}
} catch (e) {}
const client = new EndpointApi(run.environment.apiKey, run.endpoint.url);
const event = eventRecordToApiJson(run.event);
+71
View File
@@ -0,0 +1,71 @@
// Redacts the given object based on the given paths
// Example:
// const redactor = new Redactor(["data.object.balance_transaction"]);
// redactor.redact({
// data: {
// object: {
// balance_transaction: "txn_1NYWgTI0XSgju2urW3aXpinM",
// },
// },
// });
// Returns:
// {
// data: {
// object: {
// balance_transaction: "[REDACTED]",
// },
// },
// }
// Does not currenly support arrays
export class Redactor {
constructor(private paths: string[]) {}
public redact(subject: unknown): unknown {
if (!Array.isArray(this.paths)) {
return subject;
}
if (this.paths.length === 0) {
return subject;
}
const clonedSubject = JSON.parse(JSON.stringify(subject));
return this.redactPathsRecursive(clonedSubject, this.paths);
}
private redactPathsRecursive(subject: any, paths: string[]): any {
for (let path of paths) {
let parts = path.split(".");
let curSubject = subject;
// Make sure curSubject is an object
if (typeof curSubject !== "object") {
break;
}
for (let i = 0; i < parts.length; i++) {
const part = parts[i];
if (Object.prototype.hasOwnProperty.call(curSubject, part) === false) {
// Path is not found in object
break;
}
if (i === parts.length - 1) {
// We're at the end of our path and have a string, redact it
curSubject[part] = "[REDACTED]";
} else if (part in curSubject && typeof curSubject[part] === "object") {
// More paths to follow, continue down the path
curSubject = curSubject[part];
} else {
// Path is not found in object or doesn't point to a string
break;
}
}
}
return subject;
}
}
+2 -2
View File
@@ -61,8 +61,8 @@
"@remix-run/server-runtime": "1.19.2-pre.0",
"@team-plain/typescript-sdk": "^2.2.0",
"@trigger.dev/companyicons": "^1.5.14",
"@trigger.dev/database": "workspace:*",
"@trigger.dev/core": "workspace:*",
"@trigger.dev/database": "workspace:*",
"@trigger.dev/sdk": "workspace:*",
"@uiw/react-codemirror": "^4.19.5",
"class-variance-authority": "^0.5.2",
@@ -73,7 +73,6 @@
"cuid": "^2.1.8",
"emails": "workspace:*",
"express": "^4.18.1",
"fast-redact": "^3.1.2",
"framer-motion": "^10.12.11",
"graphile-worker": "^0.13.0",
"highlight.run": "^7.3.4",
@@ -96,6 +95,7 @@
"react-hot-toast": "^2.4.0",
"react-hotkeys-hook": "^3.4.7",
"react-use": "^17.4.0",
"recharts": "^2.8.0",
"remix-auth": "^3.2.2",
"remix-auth-email-link": "^1.4.2",
"remix-auth-github": "^1.1.1",
+193 -1
View File
@@ -1 +1,193 @@
We're in the process of building support for the Express framework. You can follow along with progress or contribute via [this GitHub issue](https://github.com/triggerdotdev/trigger.dev/issues).
## Installing Required Packages
Start by installing the necessary packages in your Express.js project directory. You can use npm, pnpm, or yarn as your package manager.
<CodeGroup>
```bash npm
npm install @trigger.dev/sdk @trigger.dev/express
```
```bash pnpm
pnpm install @trigger.dev/sdk @trigger.dev/express
```
```bash yarn
yarn add @trigger.dev/sdk @trigger.dev/express
```
</CodeGroup>
<br />
<Note>Ensure that you execute this command within a Express project.</Note>
## Obtaining the Development Server API Key
To locate your development Server API key, login to the [Trigger.dev
dashboard](https://cloud.trigger.dev) and select the Project you want to
connect to. Then click on the Environments & API Keys tab in the left menu.
You can copy your development Server API Key from the field at the top of this page.
(Your development key will start with `tr_dev_`).
## Adding Environment Variables
Create a `.env` file at the root of your project and include your Trigger API key and URL like this:
```bash
TRIGGER_API_KEY=ENTER_YOUR_DEVELOPMENT_API_KEY_HERE
TRIGGER_API_URL=https://api.trigger.dev # this is only necessary if you are self-hosting
```
Replace `ENTER_YOUR_DEVELOPMENT_API_KEY_HERE` with the actual API key obtained from the previous step.
## Configuring the Trigger Client
Create a file for your Trigger client, in this case we create it at `<root>/trigger.(ts/js)`
```ts trigger.(ts/js)
import { TriggerClient } from "@trigger.dev/sdk";
export const client = new TriggerClient({
id: "my-app",
apiKey: process.env.TRIGGER_API_KEY!,
apiUrl: process.env.TRIGGER_API_URL!,
});
```
Replace **"my-app"** with an appropriate identifier for your project.
## Adding the API endpoint
There are a few different options depending on how your Express project is configured.
- App middleware
- Entire app for Trigger.dev (only relevant if it's the only thing your project is for)
Select the appropriate code example from below:
<CodeGroup>
```typescript app middleware
//import the client from the other file
import { client } from "./trigger";
import { createMiddleware } from "@trigger.dev/express";
//import your job files
import "./jobs/example";
//..your existing Express code
const app: Express = express();
//add the middleware
app.use(createMiddleware(client));
//..the rest of your Express code
```
```typescript entire app
//if the entire app is just for Trigger.dev
import { client } from "./trigger";
import { createExpressServer } from "@trigger.dev/express";
//import your job files
import "./jobs/example";
//this creates an app
createExpressServer(client);
```
</CodeGroup>
## Creating the Example Job
Create a Job file. In this case created `<root>/jobs/example.(ts/js)`
```typescript jobs/example.(ts/js)
import { eventTrigger } from "@trigger.dev/sdk";
import { client } from "../trigger";
// your first job
client.defineJob({
id: "example-job",
name: "Example Job",
version: "0.0.1",
trigger: eventTrigger({
name: "example.event",
}),
run: async (payload, io, ctx) => {
await io.logger.info("Hello world!", { payload });
return {
message: "Hello world!",
};
},
});
```
## Adding Configuration to `package.json`
Inside the `package.json` file, add the following configuration under the root object:
```json
"trigger.dev": {
"endpointId": "my-app"
}
```
Replace **"my-app"** with the appropriate identifier you used in the trigger.js configuration file.
## Running
### Run your Express app
Run your Express app locally, like you normally would. For example:
<CodeGroup>
```bash npm
npm run dev
```
```bash pnpm
pnpm run dev
```
```bash yarn
yarn run dev
```
</CodeGroup>
<Note>You might use `npm run start` instead of dev</Note>
### Run the CLI 'dev' command
In a **_separate terminal window or tab_** run:
<CodeGroup>
```bash npm
npx @trigger.dev/cli@latest dev
```
```bash pnpm
pnpm dlx @trigger.dev/cli@latest dev
```
```bash yarn
yarn dlx @trigger.dev/cli@latest dev
```
</CodeGroup>
<br />
<Note>
You can optionally pass the port if you're not running on 3000 by adding
`--port 3001` to the end
</Note>
<Note>
You can optionally pass the hostname if you're not running on localhost by adding
`--hostname <host>`. Example, in case your Express is running on 0.0.0.0: `--hostname 0.0.0.0`.
</Note>
+3 -3
View File
@@ -22,15 +22,15 @@ To begin, install the necessary packages in your Next.js project directory. You
<CodeGroup>
```bash npm
npm i @trigger.dev/sdk @trigger-dev/nextjs
npm i @trigger.dev/sdk @trigger.dev/nextjs
```
```bash pnpm
pnpm install @trigger.dev/sdk @trigger-dev/nextjs
pnpm install @trigger.dev/sdk @trigger.dev/nextjs
```
```bash yarn
yarn add @trigger.dev/sdk @trigger-dev/nextjs
yarn add @trigger.dev/sdk @trigger.dev/nextjs
```
</CodeGroup>
+78 -1
View File
@@ -4,4 +4,81 @@ sidebarTitle: "Astro"
description: "Start creating Jobs in 5 minutes in your Astro project."
---
<Snippet file="manual-setup-astro.mdx" />
This quick start guide will get you up and running with Trigger.dev.
<Accordion title="Need to create a new Astro project to add Trigger.dev to?">
No problem, create a blank project by running the `create-astro` command in your terminal then continue with this quickstart guide as normal:
```bash
npx create-astro@latest
```
</Accordion>
<Steps titleSize="h3">
<Snippet file="quickstart-setup-steps.mdx" />
<Step title="Run the CLI `dev` command">
<Snippet file="quickstart-cli-dev.mdx" />
<AccordionGroup>
<Accordion title="Advanced: Run your Astro server together with the CLI">
You can modify your `package.json` to run both the Astro server and the CLI `dev` command together.
1. Install the `concurrently` package:
<CodeGroup>
```bash npm
npm install concurrently --save-dev
```
```bash pnpm
pnpm install concurrently --save-dev
```
```bash yarn
yarn add concurrently --dev
```
</CodeGroup>
2. Modify your `package.json` file's `dev` script.
```json package.json
//...
"scripts": {
"dev": "concurrently --kill-others npm:dev:*",
//your normal astro dev command would go here
"dev:astro": "astro dev",
"dev:trigger": "npx @trigger.dev/cli dev",
//...
}
//...
```
</Accordion>
</AccordionGroup>
</Step>
<Step title="Your first job">
The CLI init command created a simple Job for you. There will be a new file `src/jobs/example.(ts/js)`.
In there is this Job:
<Snippet file="quickstart-example-job.mdx" />
If you navigate to your Trigger.dev project you will see this Job in the "Jobs" section:
![Your first Job](/images/first-job.png)
</Step>
<Snippet file="quickstart-running-your-job.mdx" />
</Steps>
<Snippet file="quickstart-whats-next.mdx" />
+1 -1
View File
@@ -67,7 +67,7 @@ yarn add concurrently --dev
<Step title="Your first job">
The CLI init command created a simple Job for you. There will be a new file either `app/jobs/example.server.(ts/js)`.
The CLI init command created a simple Job for you. There will be a new file `app/jobs/example.server.(ts/js)`.
In there is this Job:
+1 -1
View File
@@ -87,7 +87,7 @@ description: "Use this method to register a new schedule with the DynamicSchedul
An object containing options about the interval.
<Expandable title="options" defaultOpen>
<ResponseField name="seconds" type="number" required>
The number of seconds for the interval. Min = 60, Max = 86400 (1 day)
The number of seconds for the interval. Min = 60, Max = 2_592_000 (30 days)
</ResponseField>
</Expandable>
</ResponseField>
+2 -2
View File
@@ -13,7 +13,7 @@ Intervals are set with a number of seconds. There are some important considerati
- The Job will first run the specified number of seconds after it has first connected to an [Environment](/documentation/concepts/environments-endpoints). This will happen when you first [deploy](/documentation/guides/deployment) that Job.
- The minimum interval is 60 seconds (any input less than this it will default to 60).
- The maximum interval is 86400 seconds (24 hours), if you pass more than this it will trigger every 24 hours.
- The maximum interval is 2_592_000 seconds (30 days), if you pass more than this it will trigger every 30 days.
If you wish to Run a Job at an exact time or less frequently than once pr day you should use a [cronTrigger()](/sdk/crontrigger) instead.
@@ -22,7 +22,7 @@ If you wish to Run a Job at an exact time or less frequently than once pr day yo
<ResponseField name="options" type="object" required>
<Expandable title="options" defaultOpen>
<ResponseField name="seconds" type="number" required>
The number of seconds for the interval. Min = 60, Max = 86400 (1 day)
The number of seconds for the interval. Min = 60, Max = 2_592_000 (30 days)
</ResponseField>
</Expandable>
</ResponseField>
+2 -2
View File
@@ -23,7 +23,7 @@ description: "`io.registerInterval()` allows you to register a [DynamicSchedule]
<Expandable title="options" defaultOpen>
<ResponseField name="seconds" type="number" required>
The number of seconds for the interval. Min = 60, Max = 86400 (1 day)
The number of seconds for the interval. Min = 60, Max = 2_592_000 (30 days)
</ResponseField>
</Expandable>
@@ -51,7 +51,7 @@ A Promise that resolves to an object with the following fields:
An object containing options about the interval.
<Expandable title="options" defaultOpen>
<ResponseField name="seconds" type="number" required>
The number of seconds for the interval. Min = 60, Max = 86400 (1 day)
The number of seconds for the interval. Min = 60, Max = 2_592_000 (30 days)
</ResponseField>
</Expandable>
</ResponseField>
+17 -3
View File
@@ -82,9 +82,12 @@ A Task is a resumable unit of a Run that can be retried, resumed and is logged.
</Expandable>
</ResponseField>
<ResponseField name="params" type="any">
The input params to the Task, will be displayed in the logs.
</ResponseField>
{" "}
<ResponseField name="params" type="any">
The input params to the Task, will be displayed in the logs.
</ResponseField>
<ResponseField name="style" type="object">
The style of the log entry.
@@ -98,6 +101,17 @@ A Task is a resumable unit of a Run that can be retried, resumed and is logged.
</Expandable>
</ResponseField>
<ResponseField name="redact" type="RedactOptions">
An optional object that specifies which fields to redact from the logs. This is useful for sensitive data like API keys.
<Expandable title="redact" defaultOpen>
<ResponseField name="paths" type="string[]">
An array of paths to redact. A path is a dot separated string, e.g. `user.email`. Currently does not support wildcards.
</ResponseField>
</Expandable>
</ResponseField>
</Expandable>
</ResponseField>
+14
View File
@@ -1,5 +1,19 @@
# @trigger.dev/airtable
## 2.1.6
### Patch Changes
- @trigger.dev/integration-kit@2.1.6
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/integration-kit@2.1.5
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/airtable",
"version": "2.1.4",
"version": "2.1.6",
"description": "Trigger.dev integration for airtable",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -26,8 +26,8 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@trigger.dev/integration-kit": "workspace:^2.1.4",
"@trigger.dev/sdk": "workspace:^2.1.4",
"@trigger.dev/integration-kit": "workspace:^2.1.6",
"@trigger.dev/sdk": "workspace:^2.1.6",
"airtable": "^0.12.1",
"zod": "3.21.4"
},
+14
View File
@@ -1,5 +1,19 @@
# @trigger.dev/github
## 2.1.6
### Patch Changes
- @trigger.dev/integration-kit@2.1.6
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/integration-kit@2.1.5
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/github",
"version": "2.1.4",
"version": "2.1.6",
"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.1.4",
"@trigger.dev/integration-kit": "workspace:^2.1.4",
"@trigger.dev/sdk": "workspace:^2.1.6",
"@trigger.dev/integration-kit": "workspace:^2.1.6",
"octokit": "^2.0.14",
"zod": "3.21.4"
},
+14
View File
@@ -1,5 +1,19 @@
# @trigger.dev/linear
## 2.1.6
### Patch Changes
- @trigger.dev/integration-kit@2.1.6
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/integration-kit@2.1.5
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/linear",
"version": "2.1.4",
"version": "2.1.6",
"description": "Trigger.dev integration for @linear/sdk",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -27,8 +27,8 @@
},
"dependencies": {
"@linear/sdk": "^8.0.0",
"@trigger.dev/integration-kit": "workspace:^2.1.4",
"@trigger.dev/sdk": "workspace:^2.1.4",
"@trigger.dev/integration-kit": "workspace:^2.1.6",
"@trigger.dev/sdk": "workspace:^2.1.6",
"zod": "3.21.4"
},
"engines": {
+14
View File
@@ -1,5 +1,19 @@
# @trigger.dev/slack
## 2.1.6
### Patch Changes
- @trigger.dev/integration-kit@2.1.6
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/integration-kit@2.1.5
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/openai",
"version": "2.1.4",
"version": "2.1.6",
"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.1.4",
"@trigger.dev/integration-kit": "workspace:^2.1.4"
"@trigger.dev/sdk": "workspace:^2.1.6",
"@trigger.dev/integration-kit": "workspace:^2.1.6"
},
"engines": {
"node": ">=16.8.0"
+14
View File
@@ -1,5 +1,19 @@
# @trigger.dev/plain
## 2.1.6
### Patch Changes
- @trigger.dev/integration-kit@2.1.6
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/integration-kit@2.1.5
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/plain",
"version": "2.1.4",
"version": "2.1.6",
"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.1.4",
"@trigger.dev/sdk": "workspace:^2.1.4",
"@trigger.dev/integration-kit": "workspace:^2.1.6",
"@trigger.dev/sdk": "workspace:^2.1.6",
"@team-plain/typescript-sdk": "^2.7.0"
},
"engines": {
+14
View File
@@ -1,5 +1,19 @@
# @trigger.dev/resend
## 2.1.6
### Patch Changes
- @trigger.dev/integration-kit@2.1.6
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/integration-kit@2.1.5
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/resend",
"version": "2.1.4",
"version": "2.1.6",
"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.1.4",
"@trigger.dev/sdk": "workspace:^2.1.4",
"@trigger.dev/integration-kit": "workspace:^2.1.6",
"@trigger.dev/sdk": "workspace:^2.1.6",
"resend": "^1.0.0"
},
"engines": {
+14
View File
@@ -1,5 +1,19 @@
# @trigger.dev/sendgrid
## 2.1.6
### Patch Changes
- @trigger.dev/integration-kit@2.1.6
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/integration-kit@2.1.5
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/sendgrid",
"version": "2.1.4",
"version": "2.1.6",
"description": "Trigger.dev integration for @sendgrid/mail",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -27,8 +27,8 @@
},
"dependencies": {
"@sendgrid/mail": "^7.7.0",
"@trigger.dev/sdk": "workspace:^2.1.4",
"@trigger.dev/integration-kit": "workspace:^2.1.4"
"@trigger.dev/sdk": "workspace:^2.1.6",
"@trigger.dev/integration-kit": "workspace:^2.1.6"
},
"engines": {
"node": ">=16.8.0"
+12
View File
@@ -1,5 +1,17 @@
# @trigger.dev/slack
## 2.1.6
### Patch Changes
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/slack",
"version": "2.1.4",
"version": "2.1.6",
"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.1.4",
"@trigger.dev/sdk": "workspace:^2.1.6",
"zod": "3.21.4"
},
"engines": {
+14
View File
@@ -1,5 +1,19 @@
# @trigger.dev/stripe
## 2.1.6
### Patch Changes
- @trigger.dev/integration-kit@2.1.6
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/integration-kit@2.1.5
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/stripe",
"version": "2.1.4",
"version": "2.1.6",
"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.1.4",
"@trigger.dev/sdk": "workspace:^2.1.4",
"@trigger.dev/integration-kit": "workspace:^2.1.6",
"@trigger.dev/sdk": "workspace:^2.1.6",
"stripe": "^12.14.0",
"zod": "3.21.4"
},
+14
View File
@@ -1,5 +1,19 @@
# @trigger.dev/supabase
## 2.1.6
### Patch Changes
- @trigger.dev/integration-kit@2.1.6
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/integration-kit@2.1.5
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/supabase",
"version": "2.1.4",
"version": "2.1.6",
"description": "Trigger.dev integration for @supabase/supabase-js",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -27,8 +27,8 @@
},
"dependencies": {
"@supabase/supabase-js": "^2.26.0",
"@trigger.dev/integration-kit": "workspace:^2.1.4",
"@trigger.dev/sdk": "workspace:^2.1.4",
"@trigger.dev/integration-kit": "workspace:^2.1.6",
"@trigger.dev/sdk": "workspace:^2.1.6",
"supabase-management-js": "^0.1.4",
"zod": "3.21.4"
},
+14
View File
@@ -1,5 +1,19 @@
# @trigger.dev/typeform
## 2.1.6
### Patch Changes
- @trigger.dev/integration-kit@2.1.6
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/integration-kit@2.1.5
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/typeform",
"version": "2.1.4",
"version": "2.1.6",
"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.1.4",
"@trigger.dev/integration-kit": "workspace:^2.1.4",
"@trigger.dev/sdk": "workspace:^2.1.6",
"@trigger.dev/integration-kit": "workspace:^2.1.6",
"zod": "3.21.4"
},
"engines": {
+12
View File
@@ -1,5 +1,17 @@
# @trigger.dev/astro
## 2.1.6
### Patch Changes
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@trigger.dev/astro",
"description": "An Astro-native integration for Trigger.dev background jobs platform",
"version": "2.1.4",
"version": "2.1.6",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
@@ -20,7 +20,7 @@
"build:tsup": "tsup"
},
"peerDependencies": {
"@trigger.dev/sdk": "workspace:^2.1.4"
"@trigger.dev/sdk": "workspace:^2.1.6"
},
"devDependencies": {
"astro": "^3.0.12",
+12
View File
@@ -1,5 +1,17 @@
# create-trigger
## 2.1.6
### Patch Changes
- 2397fcb6: Added Express support to the CLI
## 2.1.5
### Patch Changes
- 4578f6bd: Added Astro automatic installation
## 2.1.4
### Patch Changes
+2 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/cli",
"version": "2.1.4",
"version": "2.1.6",
"description": "The Trigger.dev CLI",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -57,6 +57,7 @@
},
"dependencies": {
"@types/degit": "^2.8.3",
"boxen": "^7.1.1",
"chalk": "^5.2.0",
"chokidar": "^3.5.3",
"commander": "^9.4.1",
+7 -5
View File
@@ -129,18 +129,20 @@ export const initCommand = async (options: InitCommandOptions) => {
await addConfigurationToPackageJson(resolvedPath, resolvedOptions);
await printNextSteps(resolvedOptions, authorizedKey, packageManager, framework);
const projectUrl = `${resolvedOptions.triggerUrl}/orgs/${authorizedKey.organization.slug}/projects/${authorizedKey.project.slug}`;
if (framework.printInstallationComplete) {
await framework.printInstallationComplete(projectUrl);
} else {
await printNextSteps(projectUrl, packageManager, framework);
}
telemetryClient.init.completed(resolvedOptions);
};
async function printNextSteps(
options: ResolvedOptions,
authorizedKey: WhoamiResponse,
projectUrl: string,
packageManager: PackageManager,
framework: Framework
) {
const projectUrl = `${options.triggerUrl}/orgs/${authorizedKey.organization.slug}/projects/${authorizedKey.project.slug}`;
logger.success(`✔ Successfully initialized Trigger.dev!`);
logger.info("Next steps:");
@@ -0,0 +1,81 @@
import mock from "mock-fs";
import { Astro } from ".";
import { getFramework } from "..";
import { pathExists } from "../../utils/fileSystem";
afterEach(() => {
mock.restore();
});
describe("Astro project detection", () => {
test("has dependency", async () => {
mock({
"package.json": JSON.stringify({ dependencies: { astro: "1.0.0" } }),
});
const framework = await getFramework("", "npm");
expect(framework?.id).toEqual("astro");
});
test("no dependency, has astro.config.js", async () => {
mock({
"package.json": JSON.stringify({ dependencies: { foo: "1.0.0" } }),
"astro.config.js": "module.exports = {}",
});
const framework = await getFramework("", "npm");
expect(framework?.id).toEqual("astro");
});
test("no dependency, has astro.config.mjs", async () => {
mock({
"package.json": JSON.stringify({ dependencies: { foo: "1.0.0" } }),
"astro.config.mjs": "module.exports = {}",
});
const framework = await getFramework("", "npm");
expect(framework?.id).toEqual("astro");
});
test("no dependency, no astro.config.*", async () => {
mock({
"package.json": JSON.stringify({ dependencies: { foo: "1.0.0" } }),
});
const framework = await getFramework("", "npm");
expect(framework?.id).not.toEqual("astro");
});
});
describe("install", () => {
test("javascript", async () => {
mock({
src: {
pages: {},
},
});
const astro = new Astro();
await astro.install("", { typescript: false, packageManager: "npm", endpointSlug: "foo" });
expect(await pathExists("src/trigger.js")).toEqual(true);
expect(await pathExists("src/pages/api/trigger.js")).toEqual(true);
expect(await pathExists("src/jobs/example.js")).toEqual(true);
expect(await pathExists("src/jobs/index.js")).toEqual(true);
});
test("typescript", async () => {
mock({
app: {
routes: {},
},
"tsconfig.json": JSON.stringify({}),
});
const astro = new Astro();
await astro.install("", { typescript: true, packageManager: "npm", endpointSlug: "foo" });
expect(await pathExists("src/trigger.ts")).toEqual(true);
expect(await pathExists("src/pages/api/trigger.ts")).toEqual(true);
expect(await pathExists("src/jobs/example.ts")).toEqual(true);
expect(await pathExists("src/jobs/index.ts")).toEqual(true);
});
});
+128
View File
@@ -0,0 +1,128 @@
import { Framework, ProjectInstallOptions } from "..";
import { InstallPackage } from "../../utils/addDependencies";
import { pathExists, someFileExists } from "../../utils/fileSystem";
import { PackageManager } from "../../utils/getUserPkgManager";
import pathModule from "path";
import { getPathAlias } from "../../utils/pathAlias";
import { createFileFromTemplate } from "../../utils/createFileFromTemplate";
import { templatesPath } from "../../paths";
import { logger } from "../../utils/logger";
import { readPackageJson } from "../../utils/readPackageJson";
import { standardWatchFilePaths } from "../watchConfig";
export class Astro implements Framework {
id = "astro";
name = "Astro";
async isMatch(path: string, packageManager: PackageManager): Promise<boolean> {
const configFilenames = [
"astro.config.js",
"astro.config.mjs",
"astro.config.cjs",
"astro.config.ts",
];
//check for astro.config.mjs
const hasConfigFile = await someFileExists(path, configFilenames);
if (hasConfigFile) {
return true;
}
//check for the astro package
const packageJsonContent = await readPackageJson(path);
if (packageJsonContent?.dependencies?.astro) {
return true;
}
return false;
}
async dependencies(): Promise<InstallPackage[]> {
return [
{ name: "@trigger.dev/sdk", tag: "latest" },
{ name: "@trigger.dev/astro", tag: "latest" },
{ name: "@trigger.dev/react", tag: "latest" },
];
}
possibleEnvFilenames(): string[] {
return [".env", ".env.development"];
}
async install(path: string, { typescript, endpointSlug }: ProjectInstallOptions): Promise<void> {
const pathAlias = await getPathAlias({
projectPath: path,
isTypescriptProject: typescript,
extraDirectories: ["src"],
});
const templatesDir = pathModule.join(templatesPath(), "astro");
const srcFolder = pathModule.join(path, "src");
const fileExtension = typescript ? ".ts" : ".js";
//create src/pages/api/trigger.js
const apiRoutePath = pathModule.join(srcFolder, "pages", "api", `trigger${fileExtension}`);
const apiRouteResult = await createFileFromTemplate({
templatePath: pathModule.join(templatesDir, "apiRoute.js"),
replacements: {
routePathPrefix: pathAlias ? pathAlias + "/" : "../../",
},
outputPath: apiRoutePath,
});
if (!apiRouteResult.success) {
throw new Error("Failed to create API route file");
}
logger.success(`✔ Created API route at ${apiRoutePath}`);
//src/trigger.js
const triggerFilePath = pathModule.join(srcFolder, `trigger${fileExtension}`);
const triggerResult = await createFileFromTemplate({
templatePath: pathModule.join(templatesDir, "trigger.js"),
replacements: {
endpointSlug,
},
outputPath: triggerFilePath,
});
if (!triggerResult.success) {
throw new Error("Failed to create trigger file");
}
logger.success(`✔ Created Trigger client at ${triggerFilePath}`);
//src/jobs/example.js
const exampleJobFilePath = pathModule.join(srcFolder, "jobs", `example${fileExtension}`);
const exampleJobResult = await createFileFromTemplate({
templatePath: pathModule.join(templatesDir, "exampleJob.js"),
replacements: {
jobsPathPrefix: pathAlias ? pathAlias + "/" : "../",
},
outputPath: exampleJobFilePath,
});
if (!exampleJobResult.success) {
throw new Error("Failed to create example job file");
}
logger.success(`✔ Created example job at ${exampleJobFilePath}`);
//src/jobs/index.js
const jobsIndexFilePath = pathModule.join(srcFolder, "jobs", `index${fileExtension}`);
const jobsIndexResult = await createFileFromTemplate({
templatePath: pathModule.join(templatesDir, "jobsIndex.js"),
replacements: {
jobsPathPrefix: pathAlias ? pathAlias + "/" : "../",
},
outputPath: jobsIndexFilePath,
});
if (!jobsIndexResult.success) {
throw new Error("Failed to create jobs index file");
}
logger.success(`✔ Created jobs index at ${jobsIndexFilePath}`);
}
async postInstall(path: string, options: ProjectInstallOptions): Promise<void> {
logger.warn(
`⚠︎ Ensure your astro.config output is "server" or "hybrid":\nhttps://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project`
);
}
defaultHostnames = ["localhost", "[::]"];
defaultPorts = [4321, 4322, 4323, 4324];
watchFilePaths = standardWatchFilePaths;
watchIgnoreRegex = /(node_modules)/;
}
@@ -0,0 +1,28 @@
import mock from "mock-fs";
import { Express } from ".";
import { getFramework } from "..";
import { pathExists } from "../../utils/fileSystem";
afterEach(() => {
mock.restore();
});
describe("Express project detection", () => {
test("has dependency", async () => {
mock({
"package.json": JSON.stringify({ dependencies: { express: "1.0.0" } }),
});
const framework = await getFramework("", "npm");
expect(framework?.id).toEqual("express");
});
test("no dependency", async () => {
mock({
"package.json": JSON.stringify({ dependencies: { foo: "1.0.0" } }),
});
const framework = await getFramework("", "npm");
expect(framework?.id).not.toEqual("express");
});
});
@@ -0,0 +1,51 @@
import { Framework, ProjectInstallOptions } from "..";
import { InstallPackage } from "../../utils/addDependencies";
import { PackageManager } from "../../utils/getUserPkgManager";
import { logger } from "../../utils/logger";
import { readPackageJson } from "../../utils/readPackageJson";
import { standardWatchFilePaths } from "../watchConfig";
import boxen from "boxen";
export class Express implements Framework {
id = "express";
name = "Express";
async isMatch(path: string, packageManager: PackageManager): Promise<boolean> {
//check for the express package
const packageJsonContent = await readPackageJson(path);
if (packageJsonContent?.dependencies?.express) {
return true;
}
return false;
}
async dependencies(): Promise<InstallPackage[]> {
return [
{ name: "@trigger.dev/sdk", tag: "latest" },
{ name: "@trigger.dev/express", tag: "latest" },
];
}
possibleEnvFilenames(): string[] {
return [".env"];
}
async install(path: string, { typescript, endpointSlug }: ProjectInstallOptions): Promise<void> {}
async postInstall(path: string, options: ProjectInstallOptions): Promise<void> {}
async printInstallationComplete(projectUrl: string): Promise<void> {
logger.info(
boxen(
"Automatic installation isn't currently supported for Express. \nFollow the steps in our manual installation guide: https://trigger.dev/docs/documentation/guides/manual/express",
{ padding: 1, margin: 1, borderStyle: "double", borderColor: "magenta" }
)
);
}
defaultHostnames = ["localhost", "[::]"];
defaultPorts = [3000, 8000, 80, 8080];
watchFilePaths = standardWatchFilePaths;
watchIgnoreRegex = /(node_modules)/;
}
+6 -1
View File
@@ -1,5 +1,7 @@
import { InstallPackage } from "../utils/addDependencies";
import { PackageManager } from "../utils/getUserPkgManager";
import { Astro } from "./astro";
import { Express } from "./express";
import { NextJs } from "./nextjs";
import { Remix } from "./remix";
@@ -31,6 +33,9 @@ export interface Framework {
/** You can check for middleware, add extra instructions, etc */
postInstall(path: string, options: ProjectInstallOptions): Promise<void>;
/** You can (optionally) override the initComplete messages */
printInstallationComplete?(projectUrl: string): Promise<void>;
/** Used by the dev command, if a hostname isn't passed in */
defaultHostnames: string[];
@@ -45,7 +50,7 @@ export interface Framework {
}
/** The order of these matters. The first one that matches the folder will be used, so stricter ones should be first. */
const frameworks: Framework[] = [new NextJs(), new Remix()];
const frameworks: Framework[] = [new NextJs(), new Remix(), new Astro(), new Express()];
export const getFramework = async (
path: string,
+14 -4
View File
@@ -4,13 +4,13 @@ import { Framework } from "..";
import { templatesPath } from "../../paths";
import { InstallPackage } from "../../utils/addDependencies";
import { createFileFromTemplate } from "../../utils/createFileFromTemplate";
import { pathExists } from "../../utils/fileSystem";
import { pathExists, someFileExists } from "../../utils/fileSystem";
import { PackageManager } from "../../utils/getUserPkgManager";
import { logger } from "../../utils/logger";
import { getPathAlias } from "../../utils/pathAlias";
import { readPackageJson } from "../../utils/readPackageJson";
import { detectMiddlewareUsage } from "./middleware";
import { standardWatchFilePaths } from "../watchConfig";
import { detectMiddlewareUsage } from "./middleware";
export class NextJs implements Framework {
id = "nextjs";
@@ -75,7 +75,14 @@ export class NextJs implements Framework {
}
async function detectNextConfigFile(path: string): Promise<boolean> {
return pathExists(pathModule.join(path, "next.config.js"));
const configFilenames = [
"next.config.js",
"next.config.mjs",
"next.config.cjs",
"next.config.ts",
];
return someFileExists(path, configFilenames);
}
export async function detectNextDependency(path: string): Promise<boolean> {
@@ -84,7 +91,10 @@ export async function detectNextDependency(path: string): Promise<boolean> {
return false;
}
return packageJsonContent.dependencies?.next !== undefined;
if (packageJsonContent.dependencies?.next !== undefined) return true;
if (packageJsonContent.devDependencies?.next !== undefined) return true;
return false;
}
export async function detectUseOfSrcDir(path: string): Promise<boolean> {
@@ -17,6 +17,15 @@ describe("Next project detection", () => {
expect(framework?.id).toEqual("nextjs");
});
test("has dev dependency", async () => {
mock({
"package.json": JSON.stringify({ devDependencies: { next: "1.0.0" } }),
});
const framework = await getFramework("", "npm");
expect(framework?.id).toEqual("nextjs");
});
test("no dependency, has next.config.js", async () => {
mock({
"package.json": JSON.stringify({ dependencies: { foo: "1.0.0" } }),
@@ -27,6 +36,16 @@ describe("Next project detection", () => {
expect(framework?.id).toEqual("nextjs");
});
test("no dependency, has next.config.mjs", async () => {
mock({
"package.json": JSON.stringify({ dependencies: { foo: "1.0.0" } }),
"next.config.mjs": "module.exports = {}",
});
const framework = await getFramework("", "npm");
expect(framework?.id).toEqual("nextjs");
});
test("no dependency, no next.config.js", async () => {
mock({
"package.json": JSON.stringify({ dependencies: { foo: "1.0.0" } }),
@@ -0,0 +1,9 @@
import { createAstroRoute } from "@trigger.dev/astro";
//you may need to update this path to point at your trigger.ts file
import { client } from "${routePathPrefix}trigger";
//import your jobs
import "${routePathPrefix}jobs";
export const prerender = false;
export const { POST } = createAstroRoute(client);
@@ -0,0 +1,27 @@
import { eventTrigger } from "@trigger.dev/sdk";
import { client } from "${jobsPathPrefix}trigger";
// Your first job
// This Job will be triggered by an event, log a joke to the console, and then wait 5 seconds before logging the punchline
client.defineJob({
// This is the unique identifier for your Job, it must be unique across all Jobs in your project
id: "example-job",
name: "Example Job: a joke with a delay",
version: "0.0.1",
// This is triggered by an event using eventTrigger. You can also trigger Jobs with webhooks, on schedules, and more: https://trigger.dev/docs/documentation/concepts/triggers/introduction
trigger: eventTrigger({
name: "example.event",
}),
run: async (payload, io, ctx) => {
// This logs a message to the console
await io.logger.info("🧪 Example Job: a joke with a delay");
await io.logger.info("How do you comfort a JavaScript bug?");
// This waits for 5 seconds, the second parameter is the number of seconds to wait, you can add delays of up to a year
await io.wait("Wait 5 seconds for the punchline...", 5);
await io.logger.info("You console it! 🤦");
await io.logger.info(
"✨ Congratulations, You just ran your first successful Trigger.dev Job! ✨"
);
// To learn how to write much more complex (and probably funnier) Jobs, check out our docs: https://trigger.dev/docs/documentation/guides/create-a-job
},
});
@@ -0,0 +1,3 @@
// export all your job files here
export * from "./example";
@@ -0,0 +1,7 @@
import { TriggerClient } from "@trigger.dev/sdk";
export const client = new TriggerClient({
id: "${endpointSlug}",
apiKey: import.meta.env.TRIGGER_API_KEY,
apiUrl: import.meta.env.TRIGGER_API_URL,
});
+14
View File
@@ -20,6 +20,20 @@ export async function pathExists(path: string): Promise<boolean> {
}
}
export async function someFileExists(directory: string, filenames: string[]): Promise<boolean> {
for (let index = 0; index < filenames.length; index++) {
const filename = filenames[index];
if (!filename) continue;
const path = pathModule.join(directory, filename);
if (await pathExists(path)) {
return true;
}
}
return false;
}
export async function removeFile(path: string) {
await fsModule.unlink(path);
}
+4
View File
@@ -1,5 +1,9 @@
# internal-platform
## 2.1.6
## 2.1.5
## 2.1.4
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/core",
"version": "2.1.4",
"version": "2.1.6",
"description": "Core code used across the Trigger.dev SDK and platform",
"license": "MIT",
"main": "./dist/index.js",
+2 -2
View File
@@ -10,8 +10,8 @@ export const ScheduledPayloadSchema = z.object({
export type ScheduledPayload = z.infer<typeof ScheduledPayloadSchema>;
export const IntervalOptionsSchema = z.object({
/** The number of seconds for the interval. Min = 60, Max = 86400 (1 day) */
seconds: z.number().int().positive().min(60).max(86400),
/** The number of seconds for the interval. Min = 60, Max = 2_592_000 (30 days) */
seconds: z.number().int().positive().min(60).max(2_592_000),
});
/** Interval options */
+1 -1
View File
@@ -34,6 +34,6 @@
"typescript": "^4.9.4"
},
"engines": {
"node": ">=18.0.0 <19.0.0"
"node": ">=18.0.0"
}
}
+4
View File
@@ -1,5 +1,9 @@
# @trigger.dev/eslint-plugin
## 2.1.6
## 2.1.5
## 2.1.4
## 2.1.3
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/eslint-plugin",
"version": "2.1.4",
"version": "2.1.6",
"description": "ESLint plugin with trigger.dev best practices",
"keywords": [
"eslint",
+12
View File
@@ -1,5 +1,17 @@
# @trigger.dev/express
## 2.1.6
### Patch Changes
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/express",
"version": "2.1.4",
"version": "2.1.6",
"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.1.4",
"@trigger.dev/sdk": "workspace:^2.1.6",
"@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.1.4"
"@trigger.dev/sdk": "workspace:^2.1.6"
},
"dependencies": {
"@remix-run/web-fetch": "^4.3.5",
+4
View File
@@ -1,5 +1,9 @@
# @trigger.dev/integration-kit
## 2.1.6
## 2.1.5
## 2.1.4
## 2.1.3
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/integration-kit",
"version": "2.1.4",
"version": "2.1.6",
"description": "Trigger.dev Integration Kit has helpers to make creating integrations easier",
"license": "MIT",
"main": "./dist/index.js",
+12
View File
@@ -1,5 +1,17 @@
# @trigger.dev/nextjs
## 2.1.6
### Patch Changes
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/nextjs",
"version": "2.1.4",
"version": "2.1.6",
"description": "Trigger.dev Next.js integration",
"license": "MIT",
"main": "./dist/index.js",
@@ -34,7 +34,7 @@
"build:tsup": "tsup"
},
"peerDependencies": {
"@trigger.dev/sdk": "workspace:^2.1.4",
"@trigger.dev/sdk": "workspace:^2.1.6",
"next": ">=12.0.0 <14.0.0"
},
"dependencies": {
+12
View File
@@ -1,5 +1,17 @@
# @trigger.dev/react
## 2.1.6
### Patch Changes
- @trigger.dev/core@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/core@2.1.5
## 2.1.4
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/react",
"version": "2.1.4",
"version": "2.1.6",
"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.1.4",
"@trigger.dev/core": "workspace:^2.1.6",
"debug": "^4.3.4",
"zod": "3.21.4"
},
+12
View File
@@ -1,5 +1,17 @@
# @trigger.dev/remix
## 2.1.6
### Patch Changes
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/remix",
"version": "2.1.4",
"version": "2.1.6",
"description": "Trigger.dev Remix integration",
"license": "MIT",
"main": "./dist/index.js",
@@ -34,7 +34,7 @@
"build:tsup": "tsup"
},
"peerDependencies": {
"@trigger.dev/sdk": "workspace:^2.1.4",
"@trigger.dev/sdk": "workspace:^2.1.6",
"@remix-run/server-runtime": ">1.19.0"
},
"dependencies": {
+14
View File
@@ -1,5 +1,19 @@
# @trigger.dev/testing
## 2.1.6
### Patch Changes
- @trigger.dev/core@2.1.6
- @trigger.dev/sdk@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/core@2.1.5
- @trigger.dev/sdk@2.1.5
## 2.1.4
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@trigger.dev/testing",
"description": "A collection of useful tools to write tests for Trigger.dev.",
"version": "2.1.4",
"version": "2.1.6",
"license": "MIT",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
+12
View File
@@ -1,5 +1,17 @@
# @trigger.dev/sdk
## 2.1.6
### Patch Changes
- @trigger.dev/core@2.1.6
## 2.1.5
### Patch Changes
- @trigger.dev/core@2.1.5
## 2.1.4
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@trigger.dev/sdk",
"version": "2.1.4",
"version": "2.1.6",
"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.1.4",
"@trigger.dev/core": "workspace:^2.1.6",
"chalk": "^5.2.0",
"cronstrue": "^2.21.0",
"debug": "^4.3.4",
+270 -31
View File
@@ -143,7 +143,6 @@ importers:
eslint: ^8.24.0
eslint-config-prettier: ^8.5.0
express: ^4.18.1
fast-redact: ^3.1.2
framer-motion: ^10.12.11
graphile-worker: ^0.13.0
highlight.run: ^7.3.4
@@ -171,6 +170,7 @@ importers:
react-hot-toast: ^2.4.0
react-hotkeys-hook: ^3.4.7
react-use: ^17.4.0
recharts: ^2.8.0
remix-auth: ^3.2.2
remix-auth-email-link: ^1.4.2
remix-auth-github: ^1.1.1
@@ -241,7 +241,6 @@ importers:
cuid: 2.1.8
emails: link:../../packages/emails
express: 4.18.2
fast-redact: 3.1.2
framer-motion: 10.12.11_biqbaboplfbrettd7655fr4n2y
graphile-worker: 0.13.0
highlight.run: 7.3.4
@@ -264,6 +263,7 @@ importers:
react-hot-toast: 2.4.0_biqbaboplfbrettd7655fr4n2y
react-hotkeys-hook: 3.4.7_biqbaboplfbrettd7655fr4n2y
react-use: 17.4.0_biqbaboplfbrettd7655fr4n2y
recharts: 2.8.0_v2m5e27vhdewzwhryxwfaorcca
remix-auth: 3.4.0_mrckq3wlqfipa3hs7ezq3k3x3y
remix-auth-email-link: 1.5.2_xmjsiulzsxcc3znmuhq3turs2q
remix-auth-github: 1.3.0_xmjsiulzsxcc3znmuhq3turs2q
@@ -366,8 +366,8 @@ importers:
integrations/airtable:
specifiers:
'@trigger.dev/integration-kit': workspace:^2.1.4
'@trigger.dev/sdk': workspace:^2.1.4
'@trigger.dev/integration-kit': workspace:^2.1.6
'@trigger.dev/sdk': workspace:^2.1.6
'@trigger.dev/tsconfig': workspace:*
'@types/node': 16.x
airtable: ^0.12.1
@@ -394,8 +394,8 @@ importers:
'@octokit/types': ^9.2.3
'@octokit/webhooks': ^10.4.0
'@octokit/webhooks-types': ^6.10.0
'@trigger.dev/integration-kit': workspace:^2.1.4
'@trigger.dev/sdk': workspace:^2.1.4
'@trigger.dev/integration-kit': workspace:^2.1.6
'@trigger.dev/sdk': workspace:^2.1.6
'@trigger.dev/tsconfig': workspace:*
'@types/node': '18'
octokit: ^2.0.14
@@ -421,8 +421,8 @@ importers:
integrations/linear:
specifiers:
'@linear/sdk': ^8.0.0
'@trigger.dev/integration-kit': workspace:^2.1.4
'@trigger.dev/sdk': workspace:^2.1.4
'@trigger.dev/integration-kit': workspace:^2.1.6
'@trigger.dev/sdk': workspace:^2.1.6
'@trigger.dev/tsconfig': workspace:*
'@types/node': 16.x
rimraf: ^3.0.2
@@ -443,8 +443,8 @@ importers:
integrations/openai:
specifiers:
'@trigger.dev/integration-kit': workspace:^2.1.4
'@trigger.dev/sdk': workspace:^2.1.4
'@trigger.dev/integration-kit': workspace:^2.1.6
'@trigger.dev/sdk': workspace:^2.1.6
'@trigger.dev/tsconfig': workspace:*
'@types/node': '18'
openai: ^4.2.0
@@ -463,8 +463,8 @@ importers:
integrations/plain:
specifiers:
'@team-plain/typescript-sdk': ^2.7.0
'@trigger.dev/integration-kit': workspace:^2.1.4
'@trigger.dev/sdk': workspace:^2.1.4
'@trigger.dev/integration-kit': workspace:^2.1.6
'@trigger.dev/sdk': workspace:^2.1.6
'@trigger.dev/tsconfig': workspace:*
'@types/node': '18'
rimraf: ^3.0.2
@@ -481,8 +481,8 @@ importers:
integrations/resend:
specifiers:
'@trigger.dev/integration-kit': workspace:^2.1.4
'@trigger.dev/sdk': workspace:^2.1.4
'@trigger.dev/integration-kit': workspace:^2.1.6
'@trigger.dev/sdk': workspace:^2.1.6
'@trigger.dev/tsconfig': workspace:*
'@types/node': '18'
resend: ^1.0.0
@@ -501,8 +501,8 @@ importers:
integrations/sendgrid:
specifiers:
'@sendgrid/mail': ^7.7.0
'@trigger.dev/integration-kit': workspace:^2.1.4
'@trigger.dev/sdk': workspace:^2.1.4
'@trigger.dev/integration-kit': workspace:^2.1.6
'@trigger.dev/sdk': workspace:^2.1.6
'@trigger.dev/tsconfig': workspace:*
'@types/node': 16.x
rimraf: ^3.0.2
@@ -522,7 +522,7 @@ importers:
integrations/slack:
specifiers:
'@slack/web-api': ^6.8.1
'@trigger.dev/sdk': workspace:^2.1.4
'@trigger.dev/sdk': workspace:^2.1.6
'@trigger.dev/tsconfig': workspace:*
'@types/node': '18'
rimraf: ^3.0.2
@@ -540,8 +540,8 @@ importers:
integrations/stripe:
specifiers:
'@trigger.dev/integration-kit': workspace:^2.1.4
'@trigger.dev/sdk': workspace:^2.1.4
'@trigger.dev/integration-kit': workspace:^2.1.6
'@trigger.dev/sdk': workspace:^2.1.6
'@types/node': 16.x
rimraf: ^3.0.2
stripe: ^12.14.0
@@ -564,8 +564,8 @@ importers:
integrations/supabase:
specifiers:
'@supabase/supabase-js': ^2.26.0
'@trigger.dev/integration-kit': workspace:^2.1.4
'@trigger.dev/sdk': workspace:^2.1.4
'@trigger.dev/integration-kit': workspace:^2.1.6
'@trigger.dev/sdk': workspace:^2.1.6
'@trigger.dev/tsconfig': workspace:*
'@types/node': 18.x
rimraf: ^3.0.2
@@ -588,8 +588,8 @@ importers:
integrations/typeform:
specifiers:
'@trigger.dev/integration-kit': workspace:^2.1.4
'@trigger.dev/sdk': workspace:^2.1.4
'@trigger.dev/integration-kit': workspace:^2.1.6
'@trigger.dev/sdk': workspace:^2.1.6
'@typeform/api-client': ^1.8.0
'@types/node': 16.x
rimraf: ^3.0.2
@@ -639,6 +639,7 @@ importers:
'@types/mock-fs': ^4.13.1
'@types/node': '16'
'@types/node-fetch': ^2.6.2
boxen: ^7.1.1
chalk: ^5.2.0
chokidar: ^3.5.3
commander: ^9.4.1
@@ -670,6 +671,7 @@ importers:
zod: 3.21.4
dependencies:
'@types/degit': 2.8.3
boxen: 7.1.1
chalk: 5.2.0
chokidar: 3.5.3
commander: 9.5.0
@@ -814,7 +816,7 @@ importers:
packages/express:
specifiers:
'@remix-run/web-fetch': ^4.3.5
'@trigger.dev/sdk': workspace:^2.1.4
'@trigger.dev/sdk': workspace:^2.1.6
'@trigger.dev/tsconfig': workspace:*
'@types/debug': ^4.1.7
'@types/express': ^4.17.13
@@ -887,7 +889,7 @@ importers:
packages/react:
specifiers:
'@tanstack/react-query': 5.0.0-beta.2
'@trigger.dev/core': workspace:^2.1.4
'@trigger.dev/core': workspace:^2.1.6
'@trigger.dev/tsconfig': workspace:*
'@types/debug': ^4.1.7
'@types/react': 18.2.17
@@ -963,7 +965,7 @@ importers:
packages/trigger-sdk:
specifiers:
'@trigger.dev/core': workspace:^2.1.4
'@trigger.dev/core': workspace:^2.1.6
'@trigger.dev/tsconfig': workspace:*
'@types/debug': ^4.1.7
'@types/node': '18'
@@ -12622,6 +12624,48 @@ packages:
'@types/node': 20.6.0
dev: false
/@types/d3-array/3.0.8:
resolution: {integrity: sha512-2xAVyAUgaXHX9fubjcCbGAUOqYfRJN1em1EKR2HfzWBpObZhwfnZKvofTN4TplMqJdFQao61I+NVSai/vnBvDQ==}
dev: false
/@types/d3-color/3.1.1:
resolution: {integrity: sha512-CSAVrHAtM9wfuLJ2tpvvwCU/F22sm7rMHNN+yh9D6O6hyAms3+O0cgMpC1pm6UEUMOntuZC8bMt74PteiDUdCg==}
dev: false
/@types/d3-ease/3.0.0:
resolution: {integrity: sha512-aMo4eaAOijJjA6uU+GIeW018dvy9+oH5Y2VPPzjjfxevvGQ/oRDs+tfYC9b50Q4BygRR8yE2QCLsrT0WtAVseA==}
dev: false
/@types/d3-interpolate/3.0.2:
resolution: {integrity: sha512-zAbCj9lTqW9J9PlF4FwnvEjXZUy75NQqPm7DMHZXuxCFTpuTrdK2NMYGQekf4hlasL78fCYOLu4EE3/tXElwow==}
dependencies:
'@types/d3-color': 3.1.1
dev: false
/@types/d3-path/3.0.0:
resolution: {integrity: sha512-0g/A+mZXgFkQxN3HniRDbXMN79K3CdTpLsevj+PXiTcb2hVyvkZUBg37StmgCQkaD84cUJ4uaDAWq7UJOQy2Tg==}
dev: false
/@types/d3-scale/4.0.5:
resolution: {integrity: sha512-w/C++3W394MHzcLKO2kdsIn5KKNTOqeQVzyPSGPLzQbkPw/jpeaGtSRlakcKevGgGsjJxGsbqS0fPrVFDbHrDA==}
dependencies:
'@types/d3-time': 3.0.1
dev: false
/@types/d3-shape/3.1.3:
resolution: {integrity: sha512-cHMdIq+rhF5IVwAV7t61pcEXfEHsEsrbBUPkFGBwTXuxtTAkBBrnrNA8++6OWm3jwVsXoZYQM8NEekg6CPJ3zw==}
dependencies:
'@types/d3-path': 3.0.0
dev: false
/@types/d3-time/3.0.1:
resolution: {integrity: sha512-5j/AnefKAhCw4HpITmLDTPlf4vhi8o/dES+zbegfPb7LaGfNyqkLxBR6E+4yvTAgnJLmhe80EXFMzUs38fw4oA==}
dev: false
/@types/d3-timer/3.0.0:
resolution: {integrity: sha512-HNB/9GHqu7Fo8AQiugyJbv6ZxYz58wef0esl4Mv828w1ZKpAshw/uFWVDUcIB9KKFeFKoxS3cHY07FFgtTRZ1g==}
dev: false
/@types/debug/4.1.7:
resolution: {integrity: sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==}
dependencies:
@@ -15576,6 +15620,10 @@ packages:
typescript: 4.9.4
dev: false
/classnames/2.3.2:
resolution: {integrity: sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==}
dev: false
/clean-css/5.3.2:
resolution: {integrity: sha512-JVJbM+f3d3Q704rF4bqQ5UUyTtuJ0JRKNbTKVEeujCCBoMdkEi+V+e8oktO9qGQNSvHrFTM6JZRXrUvGR1czww==}
engines: {node: '>= 10.0'}
@@ -16144,6 +16192,10 @@ packages:
source-map: 0.6.1
dev: false
/css-unit-converter/1.1.2:
resolution: {integrity: sha512-IiJwMC8rdZE0+xiEZHeru6YoONC4rfPMqGm2W85jMIbkFvv5nFTwJVFHam2eFrN6txmoUYFAFXiv8ICVeTO0MA==}
dev: false
/css-what/5.1.0:
resolution: {integrity: sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw==}
engines: {node: '>= 6'}
@@ -16195,6 +16247,77 @@ packages:
type: 1.2.0
dev: false
/d3-array/3.2.4:
resolution: {integrity: sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==}
engines: {node: '>=12'}
dependencies:
internmap: 2.0.3
dev: false
/d3-color/3.1.0:
resolution: {integrity: sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==}
engines: {node: '>=12'}
dev: false
/d3-ease/3.0.1:
resolution: {integrity: sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==}
engines: {node: '>=12'}
dev: false
/d3-format/3.1.0:
resolution: {integrity: sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==}
engines: {node: '>=12'}
dev: false
/d3-interpolate/3.0.1:
resolution: {integrity: sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==}
engines: {node: '>=12'}
dependencies:
d3-color: 3.1.0
dev: false
/d3-path/3.1.0:
resolution: {integrity: sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==}
engines: {node: '>=12'}
dev: false
/d3-scale/4.0.2:
resolution: {integrity: sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==}
engines: {node: '>=12'}
dependencies:
d3-array: 3.2.4
d3-format: 3.1.0
d3-interpolate: 3.0.1
d3-time: 3.1.0
d3-time-format: 4.1.0
dev: false
/d3-shape/3.2.0:
resolution: {integrity: sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==}
engines: {node: '>=12'}
dependencies:
d3-path: 3.1.0
dev: false
/d3-time-format/4.1.0:
resolution: {integrity: sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==}
engines: {node: '>=12'}
dependencies:
d3-time: 3.1.0
dev: false
/d3-time/3.1.0:
resolution: {integrity: sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==}
engines: {node: '>=12'}
dependencies:
d3-array: 3.2.4
dev: false
/d3-timer/3.0.1:
resolution: {integrity: sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==}
engines: {node: '>=12'}
dev: false
/damerau-levenshtein/1.0.8:
resolution: {integrity: sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==}
@@ -16318,6 +16441,10 @@ packages:
engines: {node: '>=10'}
dev: true
/decimal.js-light/2.5.1:
resolution: {integrity: sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==}
dev: false
/decode-named-character-reference/1.0.2:
resolution: {integrity: sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==}
dependencies:
@@ -16625,6 +16752,12 @@ packages:
utila: 0.4.0
dev: true
/dom-helpers/3.4.0:
resolution: {integrity: sha512-LnuPJ+dwqKDIyotW1VzmOZ5TONUN7CwkCR5hrgawTUbkBGYdeoNLZo6nNfGkCrjtE1nXXaj7iMMpDa8/d9WoIA==}
dependencies:
'@babel/runtime': 7.22.5
dev: false
/dom-serializer/1.4.1:
resolution: {integrity: sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==}
dependencies:
@@ -18783,6 +18916,11 @@ packages:
/fast-deep-equal/3.1.3:
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
/fast-equals/5.0.1:
resolution: {integrity: sha512-WF1Wi8PwwSY7/6Kx0vKXtw8RwuSGoM1bvDaJbu7MxDlR1vovZjIAKrnzyrThgAjm6JDTu0fVgWXDlMGspodfoQ==}
engines: {node: '>=6.0.0'}
dev: false
/fast-fifo/1.3.2:
resolution: {integrity: sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==}
optional: true
@@ -18858,11 +18996,6 @@ packages:
resolution: {integrity: sha512-Ue0LwpDYErFbmNnZSF0UH6eImUwDmogUO1jyE+JbN2gsQz/jICm1Ve7t9QT0rNSsfJt+Hs4/S3GnsDVjL4HVrw==}
dev: false
/fast-redact/3.1.2:
resolution: {integrity: sha512-+0em+Iya9fKGfEQGcd62Yv6onjBmmhV1uh86XVfOU8VwAe6kaFdQCWI9s0/Nnugx5Vd9tdbZ7e6gE2tR9dzXdw==}
engines: {node: '>=6'}
dev: false
/fast-shallow-equal/1.0.0:
resolution: {integrity: sha512-HPtaa38cPgWvaCFmRNhlc6NG7pv6NUHqjPgVAkWGoB9mQMwYB27/K0CvOM5Czy+qpT3e8XJ6Q4aPAnzpNpzNaw==}
dev: false
@@ -20420,6 +20553,11 @@ packages:
has: 1.0.3
side-channel: 1.0.4
/internmap/2.0.3:
resolution: {integrity: sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==}
engines: {node: '>=12'}
dev: false
/interpret/1.4.0:
resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==}
engines: {node: '>= 0.10'}
@@ -25012,6 +25150,10 @@ packages:
cssesc: 3.0.0
util-deprecate: 1.0.2
/postcss-value-parser/3.3.1:
resolution: {integrity: sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==}
dev: false
/postcss-value-parser/4.2.0:
resolution: {integrity: sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==}
@@ -25661,6 +25803,10 @@ packages:
/react-is/18.1.0:
resolution: {integrity: sha512-Fl7FuabXsJnV5Q1qIOQwx/sagGF18kogb4gpfcG4gjLBWO0WDiiz1ko/ExayuxE7InyQkBLkxRFG5oxY6Uu3Kg==}
/react-lifecycles-compat/3.0.4:
resolution: {integrity: sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==}
dev: false
/react-query/3.39.3_biqbaboplfbrettd7655fr4n2y:
resolution: {integrity: sha512-nLfLz7GiohKTJDuT4us4X3h/8unOh+00MLb2yJoGTPjxKs2bc1iDhkNx2bd5MKklXnOD3NrVZ+J2UXujA5In4g==}
peerDependencies:
@@ -25725,6 +25871,17 @@ packages:
use-sidecar: 1.1.2_e74vmjybjy5dsfplslbsgtbvvi
dev: false
/react-resize-detector/8.1.0_biqbaboplfbrettd7655fr4n2y:
resolution: {integrity: sha512-S7szxlaIuiy5UqLhLL1KY3aoyGHbZzsTpYal9eYMwCyKqoqoVLCmIgAgNyIM1FhnP2KyBygASJxdhejrzjMb+w==}
peerDependencies:
react: ^16.0.0 || ^17.0.0 || ^18.0.0
react-dom: ^16.0.0 || ^17.0.0 || ^18.0.0
dependencies:
lodash: 4.17.21
react: 18.2.0
react-dom: 18.2.0_react@18.2.0
dev: false
/react-router-dom/6.14.2_biqbaboplfbrettd7655fr4n2y:
resolution: {integrity: sha512-5pWX0jdKR48XFZBuJqHosX3AAHjRAzygouMTyimnBPOLdY3WjzUSKhus2FVMihUFWzeLebDgr4r8UeQFAct7Bg==}
engines: {node: '>=14'}
@@ -25746,6 +25903,20 @@ packages:
'@remix-run/router': 1.7.2
react: 18.2.0
/react-smooth/2.0.4_v2m5e27vhdewzwhryxwfaorcca:
resolution: {integrity: sha512-OkFsrrMBTvQUwEJthE1KXSOj79z57yvEWeFefeXPib+RmQEI9B1Ub1PgzlzzUyBOvl/TjXt5nF2hmD4NsgAh8A==}
peerDependencies:
prop-types: ^15.6.0
react: ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0
react-dom: ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0
dependencies:
fast-equals: 5.0.1
prop-types: 15.8.1
react: 18.2.0
react-dom: 18.2.0_react@18.2.0
react-transition-group: 2.9.0_biqbaboplfbrettd7655fr4n2y
dev: false
/react-style-singleton/2.2.1_e74vmjybjy5dsfplslbsgtbvvi:
resolution: {integrity: sha512-ZWj0fHEMyWkHzKYUr2Bs/4zU6XLmq9HsgBURm7g5pAVfyn49DgUiNgY2d4lXRlYSiCif9YBGpQleewkcqddc7g==}
engines: {node: '>=10'}
@@ -25763,6 +25934,20 @@ packages:
tslib: 2.6.2
dev: false
/react-transition-group/2.9.0_biqbaboplfbrettd7655fr4n2y:
resolution: {integrity: sha512-+HzNTCHpeQyl4MJ/bdE0u6XRMe9+XG/+aL4mCxVN4DnPBQ0/5bfHWPDuOZUzYdMj94daZaZdCCc1Dzt9R/xSSg==}
peerDependencies:
react: '>=15.0.0'
react-dom: '>=15.0.0'
dependencies:
dom-helpers: 3.4.0
loose-envify: 1.4.0
prop-types: 15.8.1
react: 18.2.0
react-dom: 18.2.0_react@18.2.0
react-lifecycles-compat: 3.0.4
dev: false
/react-universal-interface/0.6.2_react@18.2.0+tslib@2.5.0:
resolution: {integrity: sha512-dg8yXdcQmvgR13RIlZbTRQOoUrDciFVoSBZILwjE2LFISxZZ8loVJKAkuzswl5js8BHda79bIb2b84ehU8IjXw==}
peerDependencies:
@@ -25906,6 +26091,34 @@ packages:
tslib: 2.6.2
dev: true
/recharts-scale/0.4.5:
resolution: {integrity: sha512-kivNFO+0OcUNu7jQquLXAxz1FIwZj8nrj+YkOKc5694NbjCvcT6aSZiIzNzd2Kul4o4rTto8QVR9lMNtxD4G1w==}
dependencies:
decimal.js-light: 2.5.1
dev: false
/recharts/2.8.0_v2m5e27vhdewzwhryxwfaorcca:
resolution: {integrity: sha512-nciXqQDh3aW8abhwUlA4EBOBusRHLNiKHfpRZiG/yjups1x+auHb2zWPuEcTn/IMiN47vVMMuF8Sr+vcQJtsmw==}
engines: {node: '>=12'}
peerDependencies:
prop-types: ^15.6.0
react: ^16.0.0 || ^17.0.0 || ^18.0.0
react-dom: ^16.0.0 || ^17.0.0 || ^18.0.0
dependencies:
classnames: 2.3.2
eventemitter3: 4.0.7
lodash: 4.17.21
prop-types: 15.8.1
react: 18.2.0
react-dom: 18.2.0_react@18.2.0
react-is: 16.13.1
react-resize-detector: 8.1.0_biqbaboplfbrettd7655fr4n2y
react-smooth: 2.0.4_v2m5e27vhdewzwhryxwfaorcca
recharts-scale: 0.4.5
reduce-css-calc: 2.1.8
victory-vendor: 36.6.11
dev: false
/rechoir/0.6.2:
resolution: {integrity: sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==}
engines: {node: '>= 0.10'}
@@ -25920,6 +26133,13 @@ packages:
strip-indent: 3.0.0
dev: false
/reduce-css-calc/2.1.8:
resolution: {integrity: sha512-8liAVezDmUcH+tdzoEGrhfbGcP7nOV4NkGE3a74+qqvE7nt9i4sKLGBuZNOnpI4WiGksiNPklZxva80061QiPg==}
dependencies:
css-unit-converter: 1.1.2
postcss-value-parser: 3.3.1
dev: false
/regenerate-unicode-properties/10.1.0:
resolution: {integrity: sha512-d1VudCLoIGitcU/hEg2QqvyGZQmdC0Lf8BqdOMXGFSvJP4bNV1+XqbPQeHHLD51Jh4QJJ225dlIFvY4Ly6MXmQ==}
engines: {node: '>=4'}
@@ -29409,6 +29629,25 @@ packages:
unist-util-stringify-position: 3.0.2
vfile-message: 3.1.3
/victory-vendor/36.6.11:
resolution: {integrity: sha512-nT8kCiJp8dQh8g991J/R5w5eE2KnO8EAIP0xocWlh9l2okngMWglOPoMZzJvek8Q1KUc4XE/mJxTZnvOB1sTYg==}
dependencies:
'@types/d3-array': 3.0.8
'@types/d3-ease': 3.0.0
'@types/d3-interpolate': 3.0.2
'@types/d3-scale': 4.0.5
'@types/d3-shape': 3.1.3
'@types/d3-time': 3.0.1
'@types/d3-timer': 3.0.0
d3-array: 3.2.4
d3-ease: 3.0.1
d3-interpolate: 3.0.1
d3-scale: 4.0.2
d3-shape: 3.2.0
d3-time: 3.1.0
d3-timer: 3.0.1
dev: false
/vite-node/0.28.5:
resolution: {integrity: sha512-LmXb9saMGlrMZbXTvOveJKwMTBTNUH66c8rJnQ0ZPNX+myPEol64+szRzXtV5ORb0Hb/91yq+/D3oERoyAt6LA==}
engines: {node: '>=v14.16.0'}
+1
View File
@@ -24,6 +24,7 @@
"linear": "nodemon --watch src/linear.ts -r tsconfig-paths/register -r dotenv/config src/linear.ts",
"status": "nodemon --watch src/status.ts -r tsconfig-paths/register -r dotenv/config src/status.ts",
"byo-auth": "nodemon --watch src/byo-auth.ts -r tsconfig-paths/register -r dotenv/config src/byo-auth.ts",
"redacted": "nodemon --watch src/redacted.ts -r tsconfig-paths/register -r dotenv/config src/redacted.ts",
"dev:trigger": "trigger-cli dev --port 8080"
},
"dependencies": {
+153
View File
@@ -0,0 +1,153 @@
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",
apiKey: process.env["TRIGGER_API_KEY"],
apiUrl: process.env["TRIGGER_API_URL"],
verbose: false,
ioLogLocalEnabled: true,
});
client.defineJob({
id: "redaction-example-1",
name: "Redaction Example 1",
version: "1.0.0",
enabled: true,
trigger: eventTrigger({
name: "redaction.example",
}),
run: async (payload, io, ctx) => {
const result = await io.runTask(
"task-example-1",
async () => {
return {
id: "evt_3NYWgVI0XSgju2ur0PN22Hsu",
object: "event",
api_version: "2022-11-15",
created: 1690473903,
data: {
object: {
id: "ch_3NYWgVI0XSgju2ur0C2UzeKC",
object: "charge",
amount: 1500,
amount_captured: 1500,
amount_refunded: 0,
application: null,
application_fee: null,
application_fee_amount: null,
balance_transaction: "txn_3NYWgVI0XSgju2ur0qujz4Kc",
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: 1690473903,
currency: "usd",
customer: "cus_OLD6IR3D8CJasG",
description: "Subscription creation",
destination: null,
dispute: null,
disputed: false,
failure_balance_transaction: null,
failure_code: null,
failure_message: null,
fraud_details: {},
invoice: "in_1NYWgUI0XSgju2urV5ZTEyIn",
livemode: false,
metadata: {},
on_behalf_of: null,
order: null,
outcome: {
network_status: "approved_by_network",
reason: null,
risk_level: "normal",
risk_score: 61,
seller_message: "Payment complete.",
type: "authorized",
},
paid: true,
payment_intent: "pi_3NYWgVI0XSgju2ur0fWNLexG",
payment_method: "pm_1NYWgTI0XSgju2urW3aXpinM",
payment_method_details: {
card: {
brand: "visa",
checks: {
address_line1_check: null,
address_postal_code_check: null,
cvc_check: null,
},
country: "US",
exp_month: 7,
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/invoices/CAcaFwoVYWNjdF8xTVJtRzRJMFhTZ2p1MnVyKLCriqYGMga_ozxgMkA6LBbrKccthI_hGdug_gXtuu_piRAvzyNVaH_aMq9mUTOl3VdNbfcH7nhFjK08?s=ap",
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,
},
},
livemode: false,
pending_webhooks: 2,
request: {
id: "req_vtwGrzB2O98Pnc",
idempotency_key: "215856c0-4f06-48eb-94c6-7ed4e839d7bc",
},
type: "charge.succeeded",
};
},
{
redact: {
paths: [
"data.object.balance_transaction",
"data.object.billing_details",
"data.object.this_does_not_exist",
"data.object.$$$$hello",
],
},
}
);
await io.logger.info("Log.1", { ctx, result });
await io.wait("wait-1", 1);
await io.logger.info("Log.2", { ctx, result });
},
});
createExpressServer(client);