Core package and move to @latest (#235)
* Changeset should ignore the example projects * Removed note in Contributing instructions about not adding a changeset for internal * Renamed @trigger.dev/internal to @trigger.dev/core. Set sdk and internal to be ES2020, so we don’t get errors about private identifiers * Env vars in nextjs-example use square bracket syntax to avoid Turbo Repo errors * Set the tsconfigs back for core and sdk * @examples/nextjs compile error with undefined tasks * Set the example projects to use ES2015 to avoid private modifier complaints * package-tester example, which will use built packages * package-tester package.json * Created a readme for the package-tester * Added all the packages to package-tester * Create .env.local.example and readme instructions * Added name to the package.json * Upgraded @types/react and @types/react-dom everywhrre, so we can use server actions * Upgraded @types/react and @types/react-dom everywhrre, so we can use server actions * Reworked the react package build, so it generates separate files * The SDK no longer bundles core * package-tester setup with a server action and react hooks * Added new SDK methods with logging * Working tsup settings for client and server * Explicit react hooks return types * Added all the hooks for testing * Added OpenAI step to the job to check types are still ok in integrations * Get rid of rogue Changeset ignores * Changeset: @trigger.dev/core is now a separate package * Exited prerelease mode, added a changeset * Changed @next to @latest * Deleted seed.js, this shouldn’t be committed * Ignore seed.js * The webapp was importing @trigger.dev/core with a folder path rather package name… * More webapp imports instead of @trigger.dev/core were a folder path * Accidentally edited Stripe internal API url in the comment * Added “sideEffects”: false so @trigger.dev/core is tree shaken by Remix
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
---
|
||||
"@trigger.dev/supabase": patch
|
||||
"@trigger.dev/sdk": patch
|
||||
"@trigger.dev/openai": patch
|
||||
"@trigger.dev/stripe": patch
|
||||
"@trigger.dev/react": patch
|
||||
"@trigger.dev/core": patch
|
||||
---
|
||||
|
||||
@trigger.dev/core is now a separate package
|
||||
@@ -7,8 +7,5 @@
|
||||
"access": "public",
|
||||
"baseBranch": "main",
|
||||
"updateInternalDependencies": "patch",
|
||||
"ignore": [
|
||||
"webapp",
|
||||
"emails"
|
||||
]
|
||||
}
|
||||
"ignore": ["webapp", "emails"]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
"@trigger.dev/supabase": patch
|
||||
"@trigger.dev/sdk": patch
|
||||
"@trigger.dev/openai": patch
|
||||
"@trigger.dev/stripe": patch
|
||||
"@trigger.dev/react": patch
|
||||
"@trigger.dev/core": patch
|
||||
---
|
||||
|
||||
Packages move to @latest
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"mode": "pre",
|
||||
"mode": "exit",
|
||||
"tag": "next",
|
||||
"initialVersions": {
|
||||
"webapp": "1.0.0",
|
||||
@@ -7,7 +7,7 @@
|
||||
"@trigger.dev/slack": "0.2.0",
|
||||
"create-trigger": "0.2.0",
|
||||
"emails": "1.0.0",
|
||||
"@trigger.dev/internal": "0.0.1",
|
||||
"@trigger.dev/core": "0.0.3",
|
||||
"@trigger.dev/nextjs": "0.1.0",
|
||||
"@trigger.dev/sdk": "1.0.0",
|
||||
"@trigger.dev/openai": "1.0.0-next.0",
|
||||
|
||||
+1
-1
@@ -215,7 +215,7 @@ Here's an example of creating a `patch` changeset for the `@trigger.dev/github`
|
||||
|
||||
[](https://asciinema.org/a/599228)
|
||||
|
||||
You will be prompted to select which packages to include in the changeset. Only select the packages that you have made changes for (Important: never include a changeset for the `@trigger.dev/internal` package, as it's bundled with other packages and should not be published).
|
||||
You will be prompted to select which packages to include in the changeset. Only select the packages that you have made changes for.
|
||||
|
||||
Most of the time the changes you'll make are likely to be categorized as patch releases. If you feel like there is the need for a minor or major release of the package based on the changes being made, add the changeset as such and it will be discussed during PR review.
|
||||
|
||||
|
||||
@@ -15,4 +15,6 @@ node_modules
|
||||
build-storybook.log
|
||||
.out
|
||||
.storybook-out
|
||||
storybook-static
|
||||
storybook-static
|
||||
|
||||
/prisma/seed.js
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DisplayProperty, StyleName } from "@trigger.dev/internal";
|
||||
import type { DisplayProperty, StyleName } from "@trigger.dev/core";
|
||||
import { motion } from "framer-motion";
|
||||
import { HourglassIcon } from "lucide-react";
|
||||
import { ReactNode, useEffect, useState } from "react";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { TaskStatus } from "@trigger.dev/internal";
|
||||
import type { TaskStatus } from "@trigger.dev/core";
|
||||
import {
|
||||
CheckCircleIcon,
|
||||
CheckIcon,
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
RunPanelIconSection,
|
||||
RunPanelProperties,
|
||||
} from "./RunCard";
|
||||
import { DisplayProperty } from "@trigger.dev/internal";
|
||||
import { DisplayProperty } from "@trigger.dev/core";
|
||||
|
||||
export function TriggerDetail({
|
||||
trigger,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Integration, RunConnection } from "@trigger.dev/database";
|
||||
import type { ConnectionAuth } from "@trigger.dev/internal";
|
||||
import type { ConnectionAuth } from "@trigger.dev/core";
|
||||
import type { ConnectionWithSecretReference } from "~/services/externalApis/integrationAuthRepository.server";
|
||||
import { integrationAuthRepository } from "~/services/externalApis/integrationAuthRepository.server";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Task, TaskAttempt } from "@trigger.dev/database";
|
||||
import { ServerTask } from "@trigger.dev/internal";
|
||||
import { ServerTask } from "@trigger.dev/core";
|
||||
|
||||
export type TaskWithAttempts = Task & { attempts: TaskAttempt[] };
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
DisplayProperty,
|
||||
DisplayPropertySchema,
|
||||
EventSpecificationSchema,
|
||||
} from "@trigger.dev/internal";
|
||||
} from "@trigger.dev/core";
|
||||
import { PrismaClient, Prisma, prisma } from "~/db.server";
|
||||
import { Organization } from "~/models/organization.server";
|
||||
import { Project } from "~/models/project.server";
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
ErrorWithStackSchema,
|
||||
EventSpecificationSchema,
|
||||
StyleSchema,
|
||||
} from "@trigger.dev/internal";
|
||||
} from "@trigger.dev/core";
|
||||
import { PrismaClient, prisma } from "~/db.server";
|
||||
import { mergeProperties } from "~/utils/mergeProperties.server";
|
||||
import { taskListToTree } from "~/utils/taskListToTree";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { User } from "@trigger.dev/database";
|
||||
import { ScheduleMetadataSchema } from "@trigger.dev/internal";
|
||||
import { ScheduleMetadataSchema } from "@trigger.dev/core";
|
||||
import { PrismaClient, prisma } from "~/db.server";
|
||||
import { Organization } from "~/models/organization.server";
|
||||
import { Project } from "~/models/project.server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DisplayPropertiesSchema, StyleSchema } from "@trigger.dev/internal";
|
||||
import { DisplayPropertiesSchema, StyleSchema } from "@trigger.dev/core";
|
||||
import { PrismaClient, prisma } from "~/db.server";
|
||||
import { mergeProperties } from "~/utils/mergeProperties.server";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { User } from "@trigger.dev/database";
|
||||
import { replacements } from "@trigger.dev/internal";
|
||||
import { replacements } from "@trigger.dev/core";
|
||||
import { PrismaClient, prisma } from "~/db.server";
|
||||
import { Job } from "~/models/job.server";
|
||||
import { Organization } from "~/models/organization.server";
|
||||
|
||||
@@ -3,7 +3,7 @@ import { json } from "@remix-run/server-runtime";
|
||||
import {
|
||||
RegisterScheduleBodySchema,
|
||||
RegisterScheduleResponseBodySchema,
|
||||
} from "@trigger.dev/internal";
|
||||
} from "@trigger.dev/core";
|
||||
import { z } from "zod";
|
||||
import { authenticateApiRequest } from "~/services/apiAuth.server";
|
||||
import { logger } from "~/services/logger.server";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ActionArgs } from "@remix-run/server-runtime";
|
||||
import { json } from "@remix-run/server-runtime";
|
||||
import { UpdateTriggerSourceBodySchema } from "@trigger.dev/internal";
|
||||
import { UpdateTriggerSourceBodySchema } from "@trigger.dev/core";
|
||||
import { z } from "zod";
|
||||
import { authenticateApiRequest } from "~/services/apiAuth.server";
|
||||
import { logger } from "~/services/logger.server";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ActionArgs } from "@remix-run/server-runtime";
|
||||
import { json } from "@remix-run/server-runtime";
|
||||
import { RegisterTriggerBodySchema } from "@trigger.dev/internal";
|
||||
import { RegisterTriggerBodySchema } from "@trigger.dev/core";
|
||||
import { z } from "zod";
|
||||
import { authenticateApiRequest } from "~/services/apiAuth.server";
|
||||
import { logger } from "~/services/logger.server";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ActionArgs } from "@remix-run/server-runtime";
|
||||
import { json } from "@remix-run/server-runtime";
|
||||
import { InitializeTriggerBodySchema } from "@trigger.dev/internal";
|
||||
import { InitializeTriggerBodySchema } from "@trigger.dev/core";
|
||||
import { z } from "zod";
|
||||
import { authenticateApiRequest } from "~/services/apiAuth.server";
|
||||
import { logger } from "~/services/logger.server";
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
CreateExternalConnectionBody,
|
||||
CreateExternalConnectionBodySchema,
|
||||
ErrorWithStackSchema,
|
||||
} from "@trigger.dev/internal";
|
||||
} from "@trigger.dev/core";
|
||||
import { z } from "zod";
|
||||
import { generateErrorMessage } from "zod-error";
|
||||
import { PrismaClientOrTransaction, prisma } from "~/db.server";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ActionArgs } from "@remix-run/server-runtime";
|
||||
import { json } from "@remix-run/server-runtime";
|
||||
import { SendEventBodySchema } from "@trigger.dev/internal";
|
||||
import { SendEventBodySchema } from "@trigger.dev/core";
|
||||
import { generateErrorMessage } from "zod-error";
|
||||
import { authenticateApiRequest } from "~/services/apiAuth.server";
|
||||
import { IngestSendEvent } from "~/services/events/ingestSendEvent.server";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { Organization, RuntimeEnvironment } from "@trigger.dev/database";
|
||||
import type { ActionArgs } from "@remix-run/server-runtime";
|
||||
import { json } from "@remix-run/server-runtime";
|
||||
import type { LogMessage } from "@trigger.dev/internal";
|
||||
import { LogMessageSchema } from "@trigger.dev/internal";
|
||||
import type { LogMessage } from "@trigger.dev/core";
|
||||
import { LogMessageSchema } from "@trigger.dev/core";
|
||||
import { z } from "zod";
|
||||
import type { PrismaClient } from "~/db.server";
|
||||
import { prisma } from "~/db.server";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ActionArgs } from "@remix-run/server-runtime";
|
||||
import { json } from "@remix-run/server-runtime";
|
||||
import type { CompleteTaskBodyOutput, ServerTask } from "@trigger.dev/internal";
|
||||
import { CompleteTaskBodyInputSchema } from "@trigger.dev/internal";
|
||||
import type { CompleteTaskBodyOutput, ServerTask } from "@trigger.dev/core";
|
||||
import { CompleteTaskBodyInputSchema } from "@trigger.dev/core";
|
||||
import { z } from "zod";
|
||||
import { $transaction, PrismaClient, prisma } from "~/db.server";
|
||||
import { taskWithAttemptsToServerTask } from "~/models/task.server";
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
FailTaskBodyInput,
|
||||
FailTaskBodyInputSchema,
|
||||
ServerTask,
|
||||
} from "@trigger.dev/internal";
|
||||
} from "@trigger.dev/core";
|
||||
import { z } from "zod";
|
||||
import { $transaction, PrismaClient, prisma } from "~/db.server";
|
||||
import { taskWithAttemptsToServerTask } from "~/models/task.server";
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
RunTaskBodyOutput,
|
||||
RunTaskBodyOutputSchema,
|
||||
ServerTask,
|
||||
} from "@trigger.dev/internal";
|
||||
} from "@trigger.dev/core";
|
||||
import { z } from "zod";
|
||||
import { $transaction, PrismaClient, prisma } from "~/db.server";
|
||||
import { taskWithAttemptsToServerTask } from "~/models/task.server";
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
RegisterTriggerBodySchema,
|
||||
RunJobBody,
|
||||
RunJobResponseSchema,
|
||||
} from "@trigger.dev/internal";
|
||||
} from "@trigger.dev/core";
|
||||
import { safeBodyFromResponse } from "~/utils/json";
|
||||
import { logger } from "./logger.server";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { EventDispatcher, EventRecord } from "@trigger.dev/database";
|
||||
import type { EventFilter } from "@trigger.dev/internal";
|
||||
import { EventFilterSchema } from "@trigger.dev/internal";
|
||||
import type { EventFilter } from "@trigger.dev/core";
|
||||
import { EventFilterSchema } from "@trigger.dev/core";
|
||||
import { $transaction, PrismaClientOrTransaction, prisma } from "~/db.server";
|
||||
import { logger } from "~/services/logger.server";
|
||||
import { workerQueue } from "../worker.server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { RawEvent, SendEventOptions } from "@trigger.dev/internal";
|
||||
import type { RawEvent, SendEventOptions } from "@trigger.dev/core";
|
||||
import {
|
||||
$transaction,
|
||||
PrismaClientOrTransaction,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MISSING_CONNECTION_RESOLVED_NOTIFICATION } from "@trigger.dev/internal";
|
||||
import { MISSING_CONNECTION_RESOLVED_NOTIFICATION } from "@trigger.dev/core";
|
||||
import { PrismaClientOrTransaction, prisma } from "~/db.server";
|
||||
import { IngestSendEvent } from "../events/ingestSendEvent.server";
|
||||
import { logger } from "../logger.server";
|
||||
|
||||
@@ -64,7 +64,7 @@ const usageSample: HelpSample = {
|
||||
export const github: Integration = {
|
||||
identifier: "github",
|
||||
name: "GitHub",
|
||||
packageName: "@trigger.dev/github@next",
|
||||
packageName: "@trigger.dev/github@latest",
|
||||
authenticationMethods: {
|
||||
oauth2: {
|
||||
name: "OAuth",
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { Integration } from "../types";
|
||||
export const resend: Integration = {
|
||||
identifier: "resend",
|
||||
name: "Resend",
|
||||
packageName: "@trigger.dev/resend@next",
|
||||
packageName: "@trigger.dev/resend@latest",
|
||||
authenticationMethods: {
|
||||
apikey: {
|
||||
type: "apikey",
|
||||
|
||||
@@ -45,7 +45,7 @@ client.defineJob({
|
||||
export const slack: Integration = {
|
||||
identifier: "slack",
|
||||
name: "Slack",
|
||||
packageName: "@trigger.dev/slack@next",
|
||||
packageName: "@trigger.dev/slack@latest",
|
||||
authenticationMethods: {
|
||||
oauth2Bot: {
|
||||
name: "OAuth2 (Bot)",
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
JobMetadata,
|
||||
SCHEDULED_EVENT,
|
||||
TriggerMetadata,
|
||||
} from "@trigger.dev/internal";
|
||||
} from "@trigger.dev/core";
|
||||
import { DEFAULT_MAX_CONCURRENT_RUNS } from "~/consts";
|
||||
import type { PrismaClient } from "~/db.server";
|
||||
import { prisma } from "~/db.server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { EventSpecificationSchema } from "@trigger.dev/internal";
|
||||
import { EventSpecificationSchema } from "@trigger.dev/core";
|
||||
import { $transaction, PrismaClient, prisma } from "~/db.server";
|
||||
import { CreateRunService } from "../runs/createRun.server";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { LogLevel } from "@trigger.dev/internal";
|
||||
import { Logger } from "@trigger.dev/internal";
|
||||
import type { LogLevel } from "@trigger.dev/core";
|
||||
import { Logger } from "@trigger.dev/core";
|
||||
import { sensitiveDataReplacer } from "./sensitiveDataReplacer";
|
||||
|
||||
export const logger = new Logger(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { $transaction, PrismaClientOrTransaction, prisma } from "~/db.server";
|
||||
import { IngestSendEvent } from "../events/ingestSendEvent.server";
|
||||
import { env } from "~/env.server";
|
||||
import { MISSING_CONNECTION_NOTIFICATION } from "@trigger.dev/internal";
|
||||
import { MISSING_CONNECTION_NOTIFICATION } from "@trigger.dev/core";
|
||||
|
||||
export class MissingConnectionCreatedService {
|
||||
#prismaClient: PrismaClientOrTransaction;
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
RunJobRetryWithTask,
|
||||
RunJobSuccess,
|
||||
RunSourceContextSchema,
|
||||
} from "@trigger.dev/internal";
|
||||
} from "@trigger.dev/core";
|
||||
import { generateErrorMessage } from "zod-error";
|
||||
import { EXECUTE_JOB_RETRY_LIMIT } from "~/consts";
|
||||
import {
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { PrismaClient } from "~/db.server";
|
||||
import { prisma } from "~/db.server";
|
||||
import { workerQueue } from "../worker.server";
|
||||
import { z } from "zod";
|
||||
import { RawEventSchema, SendEventOptionsSchema } from "@trigger.dev/internal";
|
||||
import { RawEventSchema, SendEventOptionsSchema } from "@trigger.dev/core";
|
||||
import { IngestSendEvent } from "../events/ingestSendEvent.server";
|
||||
|
||||
const SendEventOutputSchema = z.object({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SCHEDULED_EVENT, ScheduledPayload } from "@trigger.dev/internal";
|
||||
import { SCHEDULED_EVENT, ScheduledPayload } from "@trigger.dev/core";
|
||||
import { $transaction, PrismaClientOrTransaction, prisma } from "~/db.server";
|
||||
import { NextScheduledEventService } from "./nextScheduledEvent.server";
|
||||
import { IngestSendEvent } from "../events/ingestSendEvent.server";
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
IntervalMetadata,
|
||||
ScheduleMetadata,
|
||||
ScheduleMetadataSchema,
|
||||
} from "@trigger.dev/internal";
|
||||
} from "@trigger.dev/core";
|
||||
import { $transaction, PrismaClientOrTransaction, prisma } from "~/db.server";
|
||||
import { parseExpression } from "cron-parser";
|
||||
import { workerQueue } from "../worker.server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { RegisterScheduleBody } from "@trigger.dev/internal";
|
||||
import { RegisterScheduleBody } from "@trigger.dev/core";
|
||||
import { $transaction, PrismaClient } from "~/db.server";
|
||||
import { prisma } from "~/db.server";
|
||||
import { AuthenticatedEnvironment } from "../apiAuth.server";
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
CronMetadata,
|
||||
IntervalMetadata,
|
||||
ScheduleMetadata,
|
||||
} from "@trigger.dev/internal";
|
||||
} from "@trigger.dev/core";
|
||||
import { $transaction, PrismaClientOrTransaction, prisma } from "~/db.server";
|
||||
import { NextScheduledEventService } from "./nextScheduledEvent.server";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { RegisterScheduleBody } from "@trigger.dev/internal";
|
||||
import { RegisterScheduleBody } from "@trigger.dev/core";
|
||||
import { $transaction, PrismaClient } from "~/db.server";
|
||||
import { prisma } from "~/db.server";
|
||||
import { AuthenticatedEnvironment } from "../apiAuth.server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { RedactString } from "@trigger.dev/internal";
|
||||
import type { RedactString } from "@trigger.dev/core";
|
||||
|
||||
// Replaces redacted strings with "******".
|
||||
// For example, this object: {"Authorization":{"__redactedString":true,"strings":["Bearer ",""],"interpolations":["sk-1234"]}}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { env } from "~/env.server";
|
||||
import {
|
||||
REGISTER_SOURCE_EVENT,
|
||||
RegisterTriggerSource,
|
||||
} from "@trigger.dev/internal";
|
||||
} from "@trigger.dev/core";
|
||||
import {
|
||||
SecretStoreProvider,
|
||||
getSecretStore,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Endpoint } from "@trigger.dev/database";
|
||||
import type { SourceMetadata } from "@trigger.dev/internal";
|
||||
import type { SourceMetadata } from "@trigger.dev/core";
|
||||
import { $transaction, PrismaClientOrTransaction } from "~/db.server";
|
||||
import { prisma } from "~/db.server";
|
||||
import type { AuthenticatedEnvironment } from "../apiAuth.server";
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import type { RuntimeEnvironment } from "@trigger.dev/database";
|
||||
import type {
|
||||
TriggerSource,
|
||||
UpdateTriggerSourceBody,
|
||||
} from "@trigger.dev/internal";
|
||||
import type { TriggerSource, UpdateTriggerSourceBody } from "@trigger.dev/core";
|
||||
import type { PrismaClient } from "~/db.server";
|
||||
import { prisma } from "~/db.server";
|
||||
import { getSecretStore } from "../secrets/secretStore.server";
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
FetchRetryStrategy,
|
||||
RedactString,
|
||||
calculateRetryAt,
|
||||
} from "@trigger.dev/internal";
|
||||
} from "@trigger.dev/core";
|
||||
import { safeJsonFromResponse } from "~/utils/json";
|
||||
import { logger } from "../logger.server";
|
||||
import { formatUnknownError } from "~/utils/formatErrors.server";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
InitializeTriggerBody,
|
||||
REGISTER_SOURCE_EVENT,
|
||||
} from "@trigger.dev/internal";
|
||||
} from "@trigger.dev/core";
|
||||
import type { PrismaClient } from "~/db.server";
|
||||
import { prisma } from "~/db.server";
|
||||
import { AuthenticatedEnvironment } from "../apiAuth.server";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
RegisterDynamicSchedulePayload,
|
||||
SCHEDULED_EVENT,
|
||||
} from "@trigger.dev/internal";
|
||||
} from "@trigger.dev/core";
|
||||
import { PrismaClientOrTransaction, prisma } from "~/db.server";
|
||||
import { ExtendedEndpoint, findEndpoint } from "~/models/endpoint.server";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DynamicTriggerEndpointMetadata } from "@trigger.dev/internal";
|
||||
import type { DynamicTriggerEndpointMetadata } from "@trigger.dev/core";
|
||||
import type { PrismaClient } from "~/db.server";
|
||||
import { prisma } from "~/db.server";
|
||||
import { ExtendedEndpoint, findEndpoint } from "~/models/endpoint.server";
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
RegisterSourceEvent,
|
||||
RegisterTriggerBody,
|
||||
} from "@trigger.dev/internal";
|
||||
import { RegisterSourceEvent, RegisterTriggerBody } from "@trigger.dev/core";
|
||||
import { z } from "zod";
|
||||
import { $transaction, PrismaClient, prisma } from "~/db.server";
|
||||
import { env } from "~/env.server";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DeliverEmailSchema } from "@/../../packages/emails/src";
|
||||
import { ScheduledPayloadSchema } from "@trigger.dev/internal";
|
||||
import { ScheduledPayloadSchema } from "@trigger.dev/core";
|
||||
import { z } from "zod";
|
||||
import { prisma } from "~/db.server";
|
||||
import { env } from "~/env.server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ErrorWithStack, ErrorWithStackSchema } from "@trigger.dev/internal";
|
||||
import { ErrorWithStack, ErrorWithStackSchema } from "@trigger.dev/core";
|
||||
|
||||
export function formatError(
|
||||
error: ErrorWithStack,
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
DisplayProperty,
|
||||
DisplayPropertiesSchema,
|
||||
} from "@trigger.dev/internal";
|
||||
import { DisplayProperty, DisplayPropertiesSchema } from "@trigger.dev/core";
|
||||
|
||||
// Takes a list of potential arrays of DisplayProperties and merges them together so no duplicates exist based on the label
|
||||
// For example, if the propertyLists are:
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
"@team-plain/typescript-sdk": "^2.2.0",
|
||||
"@trigger.dev/companyicons": "^1.5.14",
|
||||
"@trigger.dev/database": "workspace:*",
|
||||
"@trigger.dev/internal": "workspace:*",
|
||||
"@trigger.dev/core": "workspace:*",
|
||||
"@uiw/react-codemirror": "^4.19.5",
|
||||
"class-variance-authority": "^0.5.2",
|
||||
"clsx": "^1.2.1",
|
||||
@@ -145,8 +145,8 @@
|
||||
"@types/node-fetch": "^2.6.2",
|
||||
"@types/prismjs": "^1.26.0",
|
||||
"@types/qs": "^6.9.7",
|
||||
"@types/react": "^18.0.21",
|
||||
"@types/react-dom": "^18.0.6",
|
||||
"@types/react": "18.2.17",
|
||||
"@types/react-dom": "18.2.7",
|
||||
"@types/semver": "^7.3.13",
|
||||
"@types/simple-oauth2": "^5.0.4",
|
||||
"@types/slug": "^5.0.3",
|
||||
|
||||
@@ -15,14 +15,11 @@ module.exports = {
|
||||
serverDependenciesToBundle: [
|
||||
"marked",
|
||||
"axios",
|
||||
"@trigger.dev/internal",
|
||||
"@trigger.dev/core",
|
||||
"emails",
|
||||
"highlight.run",
|
||||
],
|
||||
watchPaths: async () => {
|
||||
return [
|
||||
"../../packages/internal/src/**/*",
|
||||
"../../packages/emails/src/**/*",
|
||||
];
|
||||
return ["../../packages/core/src/**/*", "../../packages/emails/src/**/*"];
|
||||
},
|
||||
};
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
"paths": {
|
||||
"~/*": ["./app/*"],
|
||||
"@/*": ["./*"],
|
||||
"@trigger.dev/internal": ["../../packages/internal/src/index"],
|
||||
"@trigger.dev/internal/*": ["../../packages/internal/src/*"],
|
||||
"@trigger.dev/core": ["../../packages/core/src/index"],
|
||||
"@trigger.dev/core/*": ["../../packages/core/src/*"],
|
||||
"@trigger.dev/database": ["../../packages/database/src/index"],
|
||||
"@trigger.dev/database/*": ["../../packages/database/src/*"],
|
||||
"emails": ["../../packages/emails/src/index"],
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
"@trigger.dev/nextjs": "workspace:*",
|
||||
"@trigger.dev/sdk": "workspace:*",
|
||||
"@types/node": "20.4.2",
|
||||
"@types/react": "^18.0.21",
|
||||
"@types/react-dom": "^18.0.6",
|
||||
"@types/react": "18.2.17",
|
||||
"@types/react-dom": "18.2.7",
|
||||
"autoprefixer": "10.4.14",
|
||||
"eslint": "8.45.0",
|
||||
"eslint-config-next": "13.4.10",
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"target": "ES2015",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"ES2015"
|
||||
],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
@@ -15,11 +19,21 @@
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"paths": {
|
||||
"@/*": ["./*"],
|
||||
"@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"],
|
||||
"@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"],
|
||||
"@trigger.dev/nextjs": ["../../packages/nextjs/src/index"],
|
||||
"@trigger.dev/nextjs/*": ["../../packages/nextjs/src/*"]
|
||||
"@/*": [
|
||||
"./*"
|
||||
],
|
||||
"@trigger.dev/sdk": [
|
||||
"../../packages/trigger-sdk/src/index"
|
||||
],
|
||||
"@trigger.dev/sdk/*": [
|
||||
"../../packages/trigger-sdk/src/*"
|
||||
],
|
||||
"@trigger.dev/nextjs": [
|
||||
"../../packages/nextjs/src/index"
|
||||
],
|
||||
"@trigger.dev/nextjs/*": [
|
||||
"../../packages/nextjs/src/*"
|
||||
]
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
@@ -27,6 +41,13 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
".next/types/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ module.exports = {
|
||||
transpilePackages: [
|
||||
"@trigger.dev/sdk",
|
||||
"@trigger.dev/github",
|
||||
"@trigger.dev/internal",
|
||||
"@trigger.dev/core",
|
||||
],
|
||||
experimental: {
|
||||
appDir: true,
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
"@trigger.dev/slack": "workspace:*",
|
||||
"@trigger.dev/typeform": "workspace:*",
|
||||
"@types/node": "18.15.13",
|
||||
"@types/react": "^18.0.21",
|
||||
"@types/react-dom": "^18.0.6",
|
||||
"@types/react": "18.2.17",
|
||||
"@types/react-dom": "18.2.7",
|
||||
"next": "13.3.1",
|
||||
"node-fetch": "2.6.x",
|
||||
"react": "^18.2.0",
|
||||
|
||||
@@ -47,7 +47,7 @@ export function RunData({ id }: { id: string }) {
|
||||
<>
|
||||
<div>Run status: {data.status}</div>
|
||||
<div style={{ display: "flex", flexDirection: "column", gap: "0.3rem" }}>
|
||||
{data.tasks.map((task) => (
|
||||
{data.tasks?.map((task) => (
|
||||
<div key={task.id} style={{ display: "flex", gap: "0.5rem" }}>
|
||||
<h4>{task.name}</h4>
|
||||
<p>Status: {task.status}</p>
|
||||
@@ -77,7 +77,7 @@ export function EventRunData({ id }: { id: string }) {
|
||||
<>
|
||||
<div>Run status: {data.status}</div>
|
||||
<div style={{ display: "flex", flexDirection: "column", gap: "0.2rem" }}>
|
||||
{data.tasks.map((task) => (
|
||||
{data.tasks?.map((task) => (
|
||||
<div
|
||||
key={task.id}
|
||||
style={{ display: "flex", gap: "0.3rem", alignItems: "center" }}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Job } from "@trigger.dev/sdk";
|
||||
|
||||
const githubApiKey = new Github({
|
||||
id: "github-api-key",
|
||||
token: process.env.GITHUB_API_KEY!,
|
||||
token: process.env["GITHUB_API_KEY"]!,
|
||||
});
|
||||
|
||||
client.defineJob({
|
||||
|
||||
@@ -5,7 +5,7 @@ import { z } from "zod";
|
||||
|
||||
const openai = new OpenAI({
|
||||
id: "openai",
|
||||
apiKey: process.env.OPENAI_API_KEY!,
|
||||
apiKey: process.env["OPENAI_API_KEY"]!,
|
||||
});
|
||||
|
||||
client.defineJob({
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Job, eventTrigger } from "@trigger.dev/sdk";
|
||||
|
||||
export const plain = new Plain({
|
||||
id: "plain-1",
|
||||
apiKey: process.env.PLAIN_API_KEY!,
|
||||
apiKey: process.env["PLAIN_API_KEY"]!,
|
||||
});
|
||||
|
||||
client.defineJob({
|
||||
|
||||
@@ -5,7 +5,7 @@ import { z } from "zod";
|
||||
|
||||
const stripe = new Stripe({
|
||||
id: "stripe",
|
||||
apiKey: process.env.STRIPE_API_KEY!,
|
||||
apiKey: process.env["STRIPE_API_KEY"]!,
|
||||
});
|
||||
|
||||
client.defineJob({
|
||||
|
||||
@@ -16,21 +16,21 @@ const supabase = new SupabaseManagement({
|
||||
id: "supabase",
|
||||
});
|
||||
|
||||
const db = supabase.db<Database>(process.env.SUPABASE_ID!);
|
||||
const db = supabase.db<Database>(process.env["SUPABASE_ID"]!);
|
||||
|
||||
const dbNoTypes = supabase.db(process.env.SUPABASE_ID!);
|
||||
const dbNoTypes = supabase.db(process.env["SUPABASE_ID"]!);
|
||||
|
||||
const supabaseManagementKey = new SupabaseManagement({
|
||||
id: "supabase-management-key",
|
||||
apiKey: process.env.SUPABASE_API_KEY!,
|
||||
apiKey: process.env["SUPABASE_API_KEY"]!,
|
||||
});
|
||||
|
||||
const dbKey = supabase.db<Database>(process.env.SUPABASE_ID!);
|
||||
const dbKey = supabase.db<Database>(process.env["SUPABASE_ID"]!);
|
||||
|
||||
const supabaseDB = new Supabase<Database>({
|
||||
id: "supabase-db",
|
||||
supabaseUrl: `https://${process.env.SUPABASE_ID}.supabase.co`,
|
||||
supabaseKey: process.env.SUPABASE_KEY!,
|
||||
supabaseUrl: `https://${process.env["SUPABASE_ID"]}.supabase.co`,
|
||||
supabaseKey: process.env["SUPABASE_KEY"]!,
|
||||
});
|
||||
|
||||
async function doPlaygroundStuff(
|
||||
|
||||
@@ -6,7 +6,7 @@ import { z } from "zod";
|
||||
|
||||
export const typeform = new Typeform({
|
||||
id: "typeform-1",
|
||||
token: process.env.TYPEFORM_API_KEY!,
|
||||
token: process.env["TYPEFORM_API_KEY"]!,
|
||||
});
|
||||
|
||||
client.defineJob({
|
||||
|
||||
@@ -22,7 +22,7 @@ export const client = new TriggerClient({
|
||||
|
||||
export const openai = new OpenAI({
|
||||
id: "openai",
|
||||
apiKey: process.env.OPENAI_API_KEY!,
|
||||
apiKey: process.env["OPENAI_API_KEY"]!,
|
||||
});
|
||||
|
||||
export const github = new Github({
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"target": "ES2015",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"ES2015"
|
||||
],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
@@ -15,35 +19,81 @@
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"paths": {
|
||||
"@/*": ["./src/*"],
|
||||
"@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"],
|
||||
"@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"],
|
||||
"@trigger.dev/nextjs": ["../../packages/nextjs/src/index"],
|
||||
"@trigger.dev/nextjs/*": ["../../packages/nextjs/src/*"],
|
||||
"@trigger.dev/internal": ["../../packages/internal/src/index"],
|
||||
"@trigger.dev/internal/*": ["../../packages/internal/src/*"],
|
||||
"@/*": [
|
||||
"./src/*"
|
||||
],
|
||||
"@trigger.dev/sdk": [
|
||||
"../../packages/trigger-sdk/src/index"
|
||||
],
|
||||
"@trigger.dev/sdk/*": [
|
||||
"../../packages/trigger-sdk/src/*"
|
||||
],
|
||||
"@trigger.dev/nextjs": [
|
||||
"../../packages/nextjs/src/index"
|
||||
],
|
||||
"@trigger.dev/nextjs/*": [
|
||||
"../../packages/nextjs/src/*"
|
||||
],
|
||||
"@trigger.dev/core": [
|
||||
"../../packages/core/src/index"
|
||||
],
|
||||
"@trigger.dev/core/*": [
|
||||
"../../packages/core/src/*"
|
||||
],
|
||||
"@trigger.dev/integration-kit": [
|
||||
"../../packages/integration-kit/src/index"
|
||||
],
|
||||
"@trigger.dev/integration-kit/*": [
|
||||
"../../packages/integration-kit/src/*"
|
||||
],
|
||||
"@trigger.dev/github": ["../../integrations/github/src/index"],
|
||||
"@trigger.dev/github/*": ["../../integrations/github/src/*"],
|
||||
"@trigger.dev/slack": ["../../integrations/slack/src/index"],
|
||||
"@trigger.dev/slack/*": ["../../integrations/slack/src/*"],
|
||||
"@trigger.dev/openai": ["../../integrations/openai/src/index"],
|
||||
"@trigger.dev/openai/*": ["../../integrations/openai/src/*"],
|
||||
"@trigger.dev/resend": ["../../integrations/resend/src/index"],
|
||||
"@trigger.dev/resend/*": ["../../integrations/resend/src/*"],
|
||||
"@trigger.dev/typeform": ["../../integrations/typeform/src/index"],
|
||||
"@trigger.dev/typeform/*": ["../../integrations/typeform/src/*"],
|
||||
"@trigger.dev/plain": ["../../integrations/plain/src/index"],
|
||||
"@trigger.dev/plain/*": ["../../integrations/plain/src/*"],
|
||||
"@trigger.dev/supabase": ["../../integrations/supabase/src/index"],
|
||||
"@trigger.dev/supabase/*": ["../../integrations/supabase/src/*"],
|
||||
"@trigger.dev/stripe": ["../../integrations/stripe/src/index"],
|
||||
"@trigger.dev/stripe/*": ["../../integrations/stripe/src/*"]
|
||||
"@trigger.dev/github": [
|
||||
"../../integrations/github/src/index"
|
||||
],
|
||||
"@trigger.dev/github/*": [
|
||||
"../../integrations/github/src/*"
|
||||
],
|
||||
"@trigger.dev/slack": [
|
||||
"../../integrations/slack/src/index"
|
||||
],
|
||||
"@trigger.dev/slack/*": [
|
||||
"../../integrations/slack/src/*"
|
||||
],
|
||||
"@trigger.dev/openai": [
|
||||
"../../integrations/openai/src/index"
|
||||
],
|
||||
"@trigger.dev/openai/*": [
|
||||
"../../integrations/openai/src/*"
|
||||
],
|
||||
"@trigger.dev/resend": [
|
||||
"../../integrations/resend/src/index"
|
||||
],
|
||||
"@trigger.dev/resend/*": [
|
||||
"../../integrations/resend/src/*"
|
||||
],
|
||||
"@trigger.dev/typeform": [
|
||||
"../../integrations/typeform/src/index"
|
||||
],
|
||||
"@trigger.dev/typeform/*": [
|
||||
"../../integrations/typeform/src/*"
|
||||
],
|
||||
"@trigger.dev/plain": [
|
||||
"../../integrations/plain/src/index"
|
||||
],
|
||||
"@trigger.dev/plain/*": [
|
||||
"../../integrations/plain/src/*"
|
||||
],
|
||||
"@trigger.dev/supabase": [
|
||||
"../../integrations/supabase/src/index"
|
||||
],
|
||||
"@trigger.dev/supabase/*": [
|
||||
"../../integrations/supabase/src/*"
|
||||
],
|
||||
"@trigger.dev/stripe": [
|
||||
"../../integrations/stripe/src/index"
|
||||
],
|
||||
"@trigger.dev/stripe/*": [
|
||||
"../../integrations/stripe/src/*"
|
||||
]
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
@@ -51,6 +101,13 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
".next/types/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
TRIGGER_API_KEY=[YOUR_SERVER_API_KEY]
|
||||
NEXT_PUBLIC_TRIGGER_API_KEY=[YOUR_PUBLIC_API_KEY]
|
||||
TRIGGER_API_URL=http://localhost:3030
|
||||
NEXT_PUBLIC_TRIGGER_API_URL=http://localhost:3030
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "next/core-web-vitals"
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# local env files
|
||||
.env*.local
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
@@ -0,0 +1,20 @@
|
||||
This example is used to test the package building and bundling. It intentionally doesn't have any `paths` in the `tsconfig.json` file, so the packages need to be built to use it.
|
||||
|
||||
## Initial setup
|
||||
|
||||
Create an `.env.local` file, by copying the `.env.local.example` file:
|
||||
|
||||
```bash
|
||||
cd examples/package-tester
|
||||
cp .env.local.example .env.local
|
||||
```
|
||||
|
||||
Then fill in your API keys from the running local Trigger.dev webapp service.
|
||||
|
||||
## Running
|
||||
|
||||
Run the development server:
|
||||
|
||||
```bash
|
||||
pnpm run dev --filter @examples/package-tester
|
||||
```
|
||||
@@ -0,0 +1,23 @@
|
||||
"use server";
|
||||
|
||||
import { redirect } from "next/navigation";
|
||||
import { client } from "./trigger";
|
||||
|
||||
export async function sendReactHookEvent(data: FormData) {
|
||||
const event = await client.sendEvent({
|
||||
name: "react-hook",
|
||||
});
|
||||
|
||||
const eventDetails = await client.getEvent(event.id);
|
||||
console.log("eventDetails", eventDetails);
|
||||
|
||||
const runs = await client.getRuns("react-hook");
|
||||
console.log("runs", runs);
|
||||
|
||||
if (runs.runs[0]) {
|
||||
const runDetails = await client.getRun(runs.runs[0].id);
|
||||
console.log("runDetails", runDetails);
|
||||
}
|
||||
|
||||
redirect(`/events/${event.id}`);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { createAppRoute } from "@trigger.dev/nextjs";
|
||||
import { client } from "@/app/trigger";
|
||||
|
||||
// Replace this with your own jobs
|
||||
import "@/app/jobs/react-hook";
|
||||
|
||||
//this route is used to send and receive data with Trigger.dev
|
||||
export const { POST, dynamic } = createAppRoute(client);
|
||||
@@ -0,0 +1,98 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
useEventDetails,
|
||||
useEventRunDetails,
|
||||
useRunDetails,
|
||||
useTriggerProvider,
|
||||
} from "@trigger.dev/react";
|
||||
import Link from "next/link";
|
||||
|
||||
export function ReactHooks({ eventId }: { eventId: string }) {
|
||||
const providerData = useTriggerProvider();
|
||||
const { isSuccess, isLoading, isError, data, error } =
|
||||
useEventRunDetails(eventId);
|
||||
|
||||
const event = useEventDetails(eventId);
|
||||
console.log("event.data", event.data);
|
||||
|
||||
const run = useRunDetails(event.data?.runs?.at(0)?.id);
|
||||
console.log("run.data", run.data);
|
||||
|
||||
if (!isSuccess) {
|
||||
return <p>Error</p>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2 className="text-lg">useTriggerProvider()</h2>
|
||||
<code>
|
||||
<pre>
|
||||
{providerData !== undefined &&
|
||||
providerData.publicApiKey !== null &&
|
||||
"✅ Working"}
|
||||
</pre>
|
||||
</code>
|
||||
|
||||
<h2 className="text-lg">useEventRunDetails()</h2>
|
||||
|
||||
<div className="w-full flex flex-col gap-4">
|
||||
<div className="flex flex-col gap-2">
|
||||
<>
|
||||
<ProgressItem
|
||||
state={
|
||||
data?.tasks === undefined || data.tasks.length === 0
|
||||
? "progress"
|
||||
: "completed"
|
||||
}
|
||||
name="Starting up"
|
||||
/>
|
||||
{data?.tasks?.map((task) => (
|
||||
<ProgressItem
|
||||
key={task.id}
|
||||
state={
|
||||
task.status === "COMPLETED"
|
||||
? "completed"
|
||||
: task.status === "ERRORED"
|
||||
? "failed"
|
||||
: "progress"
|
||||
}
|
||||
name={task.displayKey ?? task.name ?? ""}
|
||||
icon={task.icon ?? undefined}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
</div>
|
||||
{data?.output && data.status === "SUCCESS" && (
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<h4 className="text-base font-semibold">Output</h4>
|
||||
<p className="text-slate-400 text-sm mb-4">{data.output.summary}</p>
|
||||
</div>
|
||||
)}
|
||||
{(data?.status === "SUCCESS" || data?.status === "FAILURE") && (
|
||||
<Link className="border border-slate-500 p-2 text-center" href={"/"}>
|
||||
Back to home
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
type ProgressItemProps = {
|
||||
icon?: string;
|
||||
state: "progress" | "completed" | "failed";
|
||||
name: string;
|
||||
};
|
||||
|
||||
function ProgressItem({ icon, state, name }: ProgressItemProps) {
|
||||
return (
|
||||
<div className="flex gap-2 items-center">
|
||||
{state === "progress" ? "⏳" : state === "completed" ? "✅" : "⛔️"}
|
||||
<div className="flex gap-1.5 items-center">
|
||||
{icon}
|
||||
<h4 className="text-base">{name}</h4>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import { sendReactHookEvent } from "../_actions";
|
||||
|
||||
export default function SendReactHookEventForm() {
|
||||
return (
|
||||
<form action={sendReactHookEvent}>
|
||||
<button className="border border-slate-600 rounded-sm p-2">
|
||||
Send react-hook event
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { ReactHooks } from "@/app/components/ReactHooks";
|
||||
|
||||
export default function Page({
|
||||
params: { eventId },
|
||||
}: {
|
||||
params: { eventId: string };
|
||||
}) {
|
||||
return (
|
||||
<main className="h-screen w-full bg-slate-900">
|
||||
<div className="flex flex-col gap-y-6 mx-auto items-center pt-40">
|
||||
<div className="bg-slate-800 p-10 max-w-2xl items-center rounded-md border border-slate-700 flex flex-col gap-10 w-full">
|
||||
<ReactHooks eventId={eventId} />
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@@ -0,0 +1,27 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
:root {
|
||||
--foreground-rgb: 0, 0, 0;
|
||||
--background-start-rgb: 214, 219, 220;
|
||||
--background-end-rgb: 255, 255, 255;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--foreground-rgb: 255, 255, 255;
|
||||
--background-start-rgb: 0, 0, 0;
|
||||
--background-end-rgb: 0, 0, 0;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
color: rgb(var(--foreground-rgb));
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
transparent,
|
||||
rgb(var(--background-end-rgb))
|
||||
)
|
||||
rgb(var(--background-start-rgb));
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { eventTrigger } from "@trigger.dev/sdk";
|
||||
import { client } from "../trigger";
|
||||
import { OpenAI } from "@trigger.dev/openai";
|
||||
|
||||
const openai = new OpenAI({
|
||||
id: "openai",
|
||||
apiKey: process.env["OPENAI_API_KEY"]!,
|
||||
});
|
||||
|
||||
// use Open AI to summarize text from the form
|
||||
client.defineJob({
|
||||
id: "react-hook",
|
||||
name: "React Hook test",
|
||||
version: "0.0.1",
|
||||
trigger: eventTrigger({
|
||||
name: "react-hook",
|
||||
}),
|
||||
integrations: {
|
||||
openai,
|
||||
},
|
||||
run: async (_payload, io) => {
|
||||
await io.wait("Wait 2 seconds", 2);
|
||||
await io.wait("Wait 1 second", 1);
|
||||
|
||||
const result = await io.openai.backgroundCreateChatCompletion(
|
||||
"Tell me a joke",
|
||||
{
|
||||
model: "gpt-3.5-turbo-16k",
|
||||
messages: [
|
||||
{
|
||||
role: "user",
|
||||
content: `Tell me a joke please`,
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
summary: result?.choices[0]?.message?.content,
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
import "./globals.css";
|
||||
import { TriggerProvider } from "@trigger.dev/react";
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>
|
||||
<TriggerProvider
|
||||
publicApiKey={process.env["NEXT_PUBLIC_TRIGGER_API_KEY"] ?? ""}
|
||||
apiUrl={process.env["NEXT_PUBLIC_TRIGGER_API_URL"]}
|
||||
>
|
||||
{children}
|
||||
</TriggerProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import SendReactHookEventForm from "./components/SendReactHookEventForm";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<main className="flex min-h-screen flex-col items-center p-24 gap-6">
|
||||
<SendReactHookEventForm />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { TriggerClient } from "@trigger.dev/sdk";
|
||||
|
||||
export const client = new TriggerClient({
|
||||
id: "package-tester",
|
||||
apiKey: process.env.TRIGGER_API_KEY,
|
||||
apiUrl: process.env.TRIGGER_API_URL,
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
module.exports = {
|
||||
experimental: {
|
||||
serverActions: true,
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "@examples/package-tester",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "concurrently --kill-others npm:dev:*",
|
||||
"dev:next": "next dev",
|
||||
"dev:trigger": "npx @trigger.dev/cli dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@trigger.dev/core": "workspace:*",
|
||||
"@trigger.dev/github": "workspace:*",
|
||||
"@trigger.dev/nextjs": "workspace:*",
|
||||
"@trigger.dev/openai": "workspace:*",
|
||||
"@trigger.dev/plain": "workspace:*",
|
||||
"@trigger.dev/react": "workspace:*",
|
||||
"@trigger.dev/resend": "workspace:*",
|
||||
"@trigger.dev/sdk": "workspace:*",
|
||||
"@trigger.dev/slack": "workspace:*",
|
||||
"@trigger.dev/stripe": "workspace:*",
|
||||
"@trigger.dev/supabase": "workspace:*",
|
||||
"@trigger.dev/typeform": "workspace:*",
|
||||
"autoprefixer": "10.4.14",
|
||||
"eslint": "8.45.0",
|
||||
"eslint-config-next": "13.4.12",
|
||||
"next": "13.4.12",
|
||||
"postcss": "8.4.27",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"tailwindcss": "3.3.3",
|
||||
"typescript": "5.1.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "20.4.5",
|
||||
"@types/react": "18.2.17",
|
||||
"@types/react-dom": "18.2.7",
|
||||
"@trigger.dev/cli": "workspace:*",
|
||||
"concurrently": "^8.2.0"
|
||||
},
|
||||
"trigger.dev": {
|
||||
"endpointId": "package-tester"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>
|
||||
|
After Width: | Height: | Size: 629 B |
@@ -0,0 +1,18 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
content: [
|
||||
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
|
||||
'./components/**/*.{js,ts,jsx,tsx,mdx}',
|
||||
'./app/**/*.{js,ts,jsx,tsx,mdx}',
|
||||
],
|
||||
theme: {
|
||||
extend: {
|
||||
backgroundImage: {
|
||||
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
|
||||
'gradient-conic':
|
||||
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@@ -74,7 +74,7 @@ export async function createIntegrationCommand(path: string, cliOptions: any) {
|
||||
const sdkVersion = await getInternalOrExternalPackageVersion({
|
||||
path: "packages/trigger-sdk",
|
||||
packageName: "@trigger.dev/sdk",
|
||||
tag: "next",
|
||||
tag: "latest",
|
||||
monorepoPath: triggerMonorepoPath,
|
||||
});
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ export const initCommand = async (options: InitCommandOptions) => {
|
||||
}
|
||||
|
||||
await addDependencies(resolvedPath, [
|
||||
{ name: "@trigger.dev/sdk", tag: "next" },
|
||||
{ name: "@trigger.dev/sdk", tag: "latest" },
|
||||
{ name: "@trigger.dev/nextjs", tag: "latest" },
|
||||
]);
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@trigger.dev/core",
|
||||
"version": "0.0.3",
|
||||
"description": "Common code used across the Trigger.dev SDK and platform",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/index.js",
|
||||
"require": "./dist/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"build": "npm run clean && npm run build:tsup",
|
||||
"build:tsup": "tsup --dts-resolve",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"ulid": "^2.3.0",
|
||||
"zod": "3.21.4",
|
||||
"zod-error": "1.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
"@types/node": "16",
|
||||
"rimraf": "^3.0.2",
|
||||
"tsup": "^7.1.0",
|
||||
"typescript": "^4.9.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.8.0"
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user