diff --git a/.changeset/config.json b/.changeset/config.json index 4307a75e9..b348bb35f 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -16,11 +16,11 @@ "webapp", "emails", "proxy", - "yalt", "@trigger.dev/database", "coordinator", "docker-provider", - "kubernetes-provider" + "kubernetes-provider", + "@trigger.dev/otlp-importer" ], "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": { "onlyUpdatePeerDependentsWhenOutOfRange": true diff --git a/.changeset/eleven-tips-learn.md b/.changeset/eleven-tips-learn.md new file mode 100644 index 000000000..2bae37ec8 --- /dev/null +++ b/.changeset/eleven-tips-learn.md @@ -0,0 +1,7 @@ +--- +"@trigger.dev/sdk": patch +"trigger.dev": patch +"@trigger.dev/core": patch +--- + +New Build System diff --git a/.changeset/pre.json b/.changeset/pre.json index ce3ea1b25..edc3c8841 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -8,40 +8,12 @@ "proxy": "0.0.11", "webapp": "1.0.0", "yalt": "0.0.1", - "@trigger.dev/airtable": "2.3.18", - "@trigger.dev/github": "2.3.18", - "@trigger.dev/linear": "2.3.18", - "@trigger.dev/openai": "2.3.18", - "@trigger.dev/plain": "2.3.18", - "@trigger.dev/replicate": "2.3.18", - "@trigger.dev/resend": "2.3.18", - "@trigger.dev/sendgrid": "2.3.18", - "@trigger.dev/shopify": "2.3.18", - "@trigger.dev/slack": "2.3.18", - "@trigger.dev/stripe": "2.3.18", - "@trigger.dev/supabase": "2.3.18", - "@trigger.dev/typeform": "2.3.18", - "@trigger.dev/astro": "2.3.18", - "@trigger.dev/cli": "2.3.18", "trigger.dev": "2.3.18", "@trigger.dev/core": "2.3.18", - "@trigger.dev/core-apps": "0.0.0", - "@trigger.dev/core-backend": "2.3.18", "@trigger.dev/database": "0.0.1", "emails": "1.0.0", - "@trigger.dev/eslint-plugin": "2.3.18", - "@trigger.dev/express": "2.3.18", - "@trigger.dev/hono": "2.3.18", - "@trigger.dev/integration-kit": "2.3.18", - "@trigger.dev/nestjs": "2.3.18", - "@trigger.dev/nextjs": "2.3.18", "@trigger.dev/otlp-importer": "2.3.11", - "@trigger.dev/react": "2.3.18", - "@trigger.dev/remix": "2.3.18", - "@trigger.dev/sveltekit": "2.3.18", - "@trigger.dev/testing": "2.3.18", - "@trigger.dev/sdk": "2.3.18", - "@trigger.dev/yalt": "2.3.18" + "@trigger.dev/sdk": "2.3.18" }, "changesets": [ "afraid-sheep-joke", @@ -197,4 +169,4 @@ "young-jars-wait", "young-snails-sell" ] -} +} \ No newline at end of file diff --git a/.changeset/silly-suits-switch.md b/.changeset/silly-suits-switch.md index d0af46523..e2f6c696a 100644 --- a/.changeset/silly-suits-switch.md +++ b/.changeset/silly-suits-switch.md @@ -1,5 +1,4 @@ --- -"@trigger.dev/otlp-importer": patch "trigger.dev": patch --- diff --git a/.changeset/sweet-lizards-press.md b/.changeset/sweet-lizards-press.md index a374d121a..cfa8a59bd 100644 --- a/.changeset/sweet-lizards-press.md +++ b/.changeset/sweet-lizards-press.md @@ -1,7 +1,6 @@ --- "trigger.dev": major "@trigger.dev/core": major -"@trigger.dev/otlp-importer": major "@trigger.dev/sdk": major --- diff --git a/.changeset/warm-nails-jump.md b/.changeset/warm-nails-jump.md new file mode 100644 index 000000000..21f5c19dd --- /dev/null +++ b/.changeset/warm-nails-jump.md @@ -0,0 +1,5 @@ +--- +"@trigger.dev/build": patch +--- + +Added new @trigger.dev/build package that currently has all the build extensions diff --git a/.configs/tsconfig.base.json b/.configs/tsconfig.base.json new file mode 100644 index 000000000..7224a9a85 --- /dev/null +++ b/.configs/tsconfig.base.json @@ -0,0 +1,36 @@ +{ + "compilerOptions": { + "target": "es2022", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "module": "NodeNext", + "moduleResolution": "NodeNext", + "moduleDetection": "force", + "verbatimModuleSyntax": false, + "jsx": "react", + + "strict": true, + "alwaysStrict": true, + "strictPropertyInitialization": false, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + + "noFallthroughCasesInSwitch": true, + "resolveJsonModule": true, + + "removeComments": false, + "esModuleInterop": true, + "emitDecoratorMetadata": false, + "experimentalDecorators": false, + "downlevelIteration": true, + "isolatedModules": true, + "noUncheckedIndexedAccess": true, + + "pretty": true, + "customConditions": ["@triggerdotdev/source"] + } +} diff --git a/.dockerignore b/.dockerignore index 2b8f2382b..4d8429b6d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -37,6 +37,7 @@ packages/\*\*/dist .vercel .cache .output +.trigger apps/\*\*/public/build cypress/screenshots diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index c41e4eca3..0077d922a 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -76,11 +76,6 @@ jobs: node-version: 20.11.1 cache: "pnpm" - - name: Install Protoc - uses: arduino/setup-protoc@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: 📥 Download deps run: pnpm install --frozen-lockfile diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index 0bf7140e7..a8fec4a51 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -2,13 +2,7 @@ name: 🤖 PR Checks on: pull_request: - branches: - - main - paths-ignore: - - "**.md" - - "**.mdx" - - ".github/CODEOWNERS" - - ".github/ISSUE_TEMPLATE/**" + types: [opened, synchronize, reopened] concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -27,6 +21,38 @@ jobs: uses: ./.github/workflows/unit-tests.yml secrets: inherit + preview-release: + name: Preview Release + needs: [typecheck, units] + if: | + github.repository == 'triggerdotdev/trigger.dev' + runs-on: buildjet-8vcpu-ubuntu-2204 + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: ⎔ Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8.15.5 + + - name: ⎔ Setup node + uses: buildjet/setup-node@v3 + with: + node-version: 20.11.1 + cache: "pnpm" + + - name: 📥 Download deps + run: pnpm install --frozen-lockfile + + - name: 🏗️ Build + run: pnpm run build --filter "@trigger.dev/*" --filter "trigger.dev" + + - name: ⚡ publish preview release + run: npx pkg-pr-new publish --no-template $(ls -d ./packages/*) + # e2e: # uses: ./.github/workflows/e2e.yml # with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dda127796..fa4819072 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -49,12 +49,6 @@ jobs: uses: ./.github/workflows/unit-tests.yml secrets: inherit - e2e: - uses: ./.github/workflows/e2e.yml - with: - package: cli-v3 - secrets: inherit - publish: needs: [typecheck, units] uses: ./.github/workflows/publish-docker.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 949ff8230..c74b153ed 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,11 +38,6 @@ jobs: node-version: 20.11.1 cache: "pnpm" - - name: Install Protoc - uses: arduino/setup-protoc@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: 📥 Download deps run: pnpm install --frozen-lockfile diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index 4064192fd..4bc6486b7 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -22,11 +22,6 @@ jobs: node-version: 20.11.1 cache: "pnpm" - - name: Install Protoc - uses: arduino/setup-protoc@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: 📥 Download deps run: pnpm install --frozen-lockfile diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 08971b703..111c3b037 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -22,21 +22,6 @@ jobs: node-version: 20.11.1 cache: "pnpm" - - name: Install Protoc - uses: arduino/setup-protoc@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - - name: ⎔ Setup Deno - uses: denoland/setup-deno@v1 - with: - deno-version: v1.x - - - name: ⎔ Setup bun - uses: oven-sh/setup-bun@v1 - with: - bun-version: "1.0.15" - - name: 📥 Download deps run: pnpm install --frozen-lockfile diff --git a/.gitignore b/.gitignore index 2fdaed720..a60308472 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,6 @@ coverage # next.js .next/ out/ -build dist packages/**/dist @@ -54,4 +53,5 @@ apps/**/public/build /playwright/.cache/ .cosine -.trigger/ \ No newline at end of file +.trigger/ +.tshy* \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 7c73a4c74..a34447dd4 100644 --- a/.prettierignore +++ b/.prettierignore @@ -7,5 +7,4 @@ tailwind.css **/.react-email/ **/storybook-static/ **/.changeset/ -**/build/ **/dist/ \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 8bbed5139..1d312c2ce 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -33,7 +33,7 @@ "type": "node-terminal", "request": "launch", "name": "Debug V3 Dev CLI", - "command": "pnpm exec triggerdev dev --log-level debug", + "command": "pnpm exec triggerdev dev", "cwd": "${workspaceFolder}/references/v3-catalog", "sourceMaps": true }, @@ -41,7 +41,23 @@ "type": "node-terminal", "request": "launch", "name": "Debug V3 Deploy CLI", - "command": "pnpm exec triggerdev deploy", + "command": "pnpm exec triggerdev deploy --self-hosted --load-image", + "cwd": "${workspaceFolder}/references/v3-catalog", + "sourceMaps": true + }, + { + "type": "node-terminal", + "request": "launch", + "name": "Debug V3 list-profiles CLI", + "command": "pnpm exec triggerdev list-profiles --log-level debug", + "cwd": "${workspaceFolder}/references/v3-catalog", + "sourceMaps": true + }, + { + "type": "node-terminal", + "request": "launch", + "name": "Debug V3 update CLI", + "command": "pnpm exec triggerdev update", "cwd": "${workspaceFolder}/references/v3-catalog", "sourceMaps": true }, diff --git a/.vscode/settings.json b/.vscode/settings.json index 000318d27..346c45890 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,9 @@ { "deno.enablePaths": ["references/deno-reference", "runtime_tests/tests/deno"], - "debug.toolBarLocation": "commandCenter" + "debug.toolBarLocation": "commandCenter", + "typescript.tsdk": "node_modules/typescript/lib", + "search.exclude": { + "**/node_modules/**": true, + "packages/cli-v3/e2e": true + } } diff --git a/apps/coordinator/package.json b/apps/coordinator/package.json index 1c1584223..1268a1c62 100644 --- a/apps/coordinator/package.json +++ b/apps/coordinator/package.json @@ -17,7 +17,6 @@ "license": "MIT", "dependencies": { "@trigger.dev/core": "workspace:*", - "@trigger.dev/core-apps": "workspace:*", "execa": "^8.0.1", "nanoid": "^5.0.6", "prom-client": "^15.1.0", diff --git a/apps/coordinator/src/checkpointer.ts b/apps/coordinator/src/checkpointer.ts index d469541d7..d191f488f 100644 --- a/apps/coordinator/src/checkpointer.ts +++ b/apps/coordinator/src/checkpointer.ts @@ -1,6 +1,6 @@ -import { ExponentialBackoff } from "@trigger.dev/core-apps/backoff"; -import { isExecaChildProcess, testDockerCheckpoint } from "@trigger.dev/core-apps/checkpoints"; -import { SimpleLogger } from "@trigger.dev/core-apps/logger"; +import { ExponentialBackoff } from "@trigger.dev/core/v3/apps"; +import { testDockerCheckpoint, isExecaChildProcess } from "@trigger.dev/core/v3/apps"; +import { SimpleLogger } from "@trigger.dev/core/v3/apps"; import { $ } from "execa"; import { nanoid } from "nanoid"; import fs from "node:fs/promises"; diff --git a/apps/coordinator/src/index.ts b/apps/coordinator/src/index.ts index 52f08d779..0d922174f 100644 --- a/apps/coordinator/src/index.ts +++ b/apps/coordinator/src/index.ts @@ -10,8 +10,8 @@ import { } from "@trigger.dev/core/v3"; import { ZodNamespace } from "@trigger.dev/core/v3/zodNamespace"; import { ZodSocketConnection } from "@trigger.dev/core/v3/zodSocket"; -import { HttpReply, getTextBody } from "@trigger.dev/core-apps/http"; -import { SimpleLogger } from "@trigger.dev/core-apps/logger"; +import { HttpReply, getTextBody } from "@trigger.dev/core/v3/apps"; +import { SimpleLogger } from "@trigger.dev/core/v3/apps"; import { ChaosMonkey } from "./chaosMonkey"; import { Checkpointer } from "./checkpointer"; diff --git a/apps/coordinator/tsconfig.json b/apps/coordinator/tsconfig.json index 2e1257735..3c0376085 100644 --- a/apps/coordinator/tsconfig.json +++ b/apps/coordinator/tsconfig.json @@ -11,9 +11,7 @@ "skipLibCheck": true, "paths": { "@trigger.dev/core/v3": ["../../packages/core/src/v3"], - "@trigger.dev/core/v3/*": ["../../packages/core/src/v3/*"], - "@trigger.dev/core-apps": ["../../packages/core-apps/src"], - "@trigger.dev/core-apps/*": ["../../packages/core-apps/src/*"] + "@trigger.dev/core/v3/*": ["../../packages/core/src/v3/*"] } } } diff --git a/apps/docker-provider/package.json b/apps/docker-provider/package.json index 0c9e4e9a4..56d8f89b7 100644 --- a/apps/docker-provider/package.json +++ b/apps/docker-provider/package.json @@ -17,7 +17,6 @@ "license": "MIT", "dependencies": { "@trigger.dev/core": "workspace:*", - "@trigger.dev/core-apps": "workspace:*", "execa": "^8.0.1" }, "devDependencies": { diff --git a/apps/docker-provider/src/index.ts b/apps/docker-provider/src/index.ts index 7e891c354..dfa55d9fd 100644 --- a/apps/docker-provider/src/index.ts +++ b/apps/docker-provider/src/index.ts @@ -5,9 +5,9 @@ import { TaskOperationsCreateOptions, TaskOperationsIndexOptions, TaskOperationsRestoreOptions, -} from "@trigger.dev/core-apps/provider"; -import { SimpleLogger } from "@trigger.dev/core-apps/logger"; -import { isExecaChildProcess, testDockerCheckpoint } from "@trigger.dev/core-apps/checkpoints"; +} from "@trigger.dev/core/v3/apps"; +import { SimpleLogger } from "@trigger.dev/core/v3/apps"; +import { isExecaChildProcess, testDockerCheckpoint } from "@trigger.dev/core/v3/apps"; import { setTimeout } from "node:timers/promises"; import { PostStartCauses, PreStopCauses } from "@trigger.dev/core/v3"; diff --git a/apps/docker-provider/tsconfig.json b/apps/docker-provider/tsconfig.json index ff1edf980..3a866dd2b 100644 --- a/apps/docker-provider/tsconfig.json +++ b/apps/docker-provider/tsconfig.json @@ -9,9 +9,7 @@ "skipLibCheck": true, "paths": { "@trigger.dev/core/v3": ["../../packages/core/src/v3"], - "@trigger.dev/core/v3/*": ["../../packages/core/src/v3/*"], - "@trigger.dev/core-apps": ["../../packages/core-apps/src"], - "@trigger.dev/core-apps/*": ["../../packages/core-apps/src/*"] + "@trigger.dev/core/v3/*": ["../../packages/core/src/v3/*"] } } } diff --git a/apps/kubernetes-provider/package.json b/apps/kubernetes-provider/package.json index a34123bca..3b62f6544 100644 --- a/apps/kubernetes-provider/package.json +++ b/apps/kubernetes-provider/package.json @@ -18,7 +18,6 @@ "dependencies": { "@kubernetes/client-node": "^0.20.0", "@trigger.dev/core": "workspace:*", - "@trigger.dev/core-apps": "workspace:*", "p-queue": "^8.0.1" }, "devDependencies": { diff --git a/apps/kubernetes-provider/src/index.ts b/apps/kubernetes-provider/src/index.ts index d94d5f43c..437fcdd31 100644 --- a/apps/kubernetes-provider/src/index.ts +++ b/apps/kubernetes-provider/src/index.ts @@ -6,8 +6,8 @@ import { TaskOperationsIndexOptions, TaskOperationsPrePullDeploymentOptions, TaskOperationsRestoreOptions, -} from "@trigger.dev/core-apps/provider"; -import { SimpleLogger } from "@trigger.dev/core-apps/logger"; +} from "@trigger.dev/core/v3/apps"; +import { SimpleLogger } from "@trigger.dev/core/v3/apps"; import { MachinePreset, PostStartCauses, diff --git a/apps/kubernetes-provider/src/podCleaner.ts b/apps/kubernetes-provider/src/podCleaner.ts index ba9f40503..2cd23d1b6 100644 --- a/apps/kubernetes-provider/src/podCleaner.ts +++ b/apps/kubernetes-provider/src/podCleaner.ts @@ -1,5 +1,5 @@ import * as k8s from "@kubernetes/client-node"; -import { SimpleLogger } from "@trigger.dev/core-apps/logger"; +import { SimpleLogger } from "@trigger.dev/core/v3/apps"; type PodCleanerOptions = { runtimeEnv: "local" | "kubernetes"; diff --git a/apps/kubernetes-provider/src/taskMonitor.ts b/apps/kubernetes-provider/src/taskMonitor.ts index 61fd7a63e..fc142efbd 100644 --- a/apps/kubernetes-provider/src/taskMonitor.ts +++ b/apps/kubernetes-provider/src/taskMonitor.ts @@ -1,6 +1,6 @@ import * as k8s from "@kubernetes/client-node"; -import { SimpleLogger } from "@trigger.dev/core-apps/logger"; -import { EXIT_CODE_ALREADY_HANDLED, EXIT_CODE_CHILD_NONZERO } from "@trigger.dev/core-apps/process"; +import { SimpleLogger } from "@trigger.dev/core/v3/apps"; +import { EXIT_CODE_ALREADY_HANDLED, EXIT_CODE_CHILD_NONZERO } from "@trigger.dev/core/v3/apps"; import { setTimeout } from "timers/promises"; import PQueue from "p-queue"; import type { Prettify } from "@trigger.dev/core/v3"; diff --git a/apps/kubernetes-provider/src/uptimeHeartbeat.ts b/apps/kubernetes-provider/src/uptimeHeartbeat.ts index a73c0d39a..9ff63032f 100644 --- a/apps/kubernetes-provider/src/uptimeHeartbeat.ts +++ b/apps/kubernetes-provider/src/uptimeHeartbeat.ts @@ -1,5 +1,5 @@ import * as k8s from "@kubernetes/client-node"; -import { SimpleLogger } from "@trigger.dev/core-apps/logger"; +import { SimpleLogger } from "@trigger.dev/core/v3/apps"; type UptimeHeartbeatOptions = { runtimeEnv: "local" | "kubernetes"; diff --git a/apps/kubernetes-provider/tsconfig.json b/apps/kubernetes-provider/tsconfig.json index 8e6c54f74..661823ef7 100644 --- a/apps/kubernetes-provider/tsconfig.json +++ b/apps/kubernetes-provider/tsconfig.json @@ -9,9 +9,7 @@ "skipLibCheck": true, "paths": { "@trigger.dev/core/v3": ["../../packages/core/src/v3"], - "@trigger.dev/core/v3/*": ["../../packages/core/src/v3/*"], - "@trigger.dev/core-apps": ["../../packages/core-apps/src"], - "@trigger.dev/core-apps/*": ["../../packages/core-apps/src/*"] + "@trigger.dev/core/v3/*": ["../../packages/core/src/v3/*"] } } } diff --git a/apps/proxy/package.json b/apps/proxy/package.json index 15ed6ae0e..7518a6935 100644 --- a/apps/proxy/package.json +++ b/apps/proxy/package.json @@ -18,4 +18,4 @@ "zod": "3.22.3", "zod-error": "1.5.0" } -} +} \ No newline at end of file diff --git a/apps/webapp/app/components/runs/v3/ReplayRunDialog.tsx b/apps/webapp/app/components/runs/v3/ReplayRunDialog.tsx index 54e679d5f..91bd08880 100644 --- a/apps/webapp/app/components/runs/v3/ReplayRunDialog.tsx +++ b/apps/webapp/app/components/runs/v3/ReplayRunDialog.tsx @@ -1,10 +1,10 @@ -import { Form, useFetcher, useNavigation, useSubmit } from "@remix-run/react"; +import { Form, useNavigation, useSubmit } from "@remix-run/react"; import { useCallback, useEffect, useRef } from "react"; import { UseDataFunctionReturn, useTypedFetcher } from "remix-typedjson"; import { JSONEditor } from "~/components/code/JSONEditor"; import { EnvironmentLabel } from "~/components/environments/EnvironmentLabel"; import { Button } from "~/components/primitives/Buttons"; -import { DialogContent, DialogDescription, DialogHeader } from "~/components/primitives/Dialog"; +import { DialogContent, DialogHeader } from "~/components/primitives/Dialog"; import { Header3 } from "~/components/primitives/Headers"; import { InputGroup } from "~/components/primitives/InputGroup"; import { Label } from "~/components/primitives/Label"; @@ -27,7 +27,7 @@ export function ReplayRunDialog({ runFriendlyId, failedRedirect }: ReplayRunDial function ReplayContent({ runFriendlyId, failedRedirect }: ReplayRunDialogProps) { const fetcher = useTypedFetcher(); - const isLoading = fetcher.state !== "idle"; + const isLoading = fetcher.state === "loading"; useEffect(() => { fetcher.load(`/resources/taskruns/${runFriendlyId}/replay`); diff --git a/apps/webapp/app/models/runtimeEnvironment.server.ts b/apps/webapp/app/models/runtimeEnvironment.server.ts index db6b6909c..868a39bf1 100644 --- a/apps/webapp/app/models/runtimeEnvironment.server.ts +++ b/apps/webapp/app/models/runtimeEnvironment.server.ts @@ -116,6 +116,19 @@ export async function disconnectSession(environmentId: string) { return session; } +export async function findLatestSession(environmentId: string) { + const session = await prisma.runtimeEnvironmentSession.findFirst({ + where: { + environmentId, + }, + orderBy: { + createdAt: "desc", + }, + }); + + return session; +} + export type DisplayableInputEnvironment = Prisma.RuntimeEnvironmentGetPayload<{ select: { id: true; diff --git a/apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts b/apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts index 60763f970..7891c1191 100644 --- a/apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts +++ b/apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts @@ -1,16 +1,13 @@ import { DeploymentErrorData, ExternalBuildData, - TaskMetadataFailedToParseData, - groupTaskMetadataIssuesByTask, + prepareDeploymentError, } from "@trigger.dev/core/v3"; -import { WorkerDeployment, WorkerDeploymentStatus } from "@trigger.dev/database"; -import { z } from "zod"; +import { WorkerDeployment } from "@trigger.dev/database"; import { PrismaClient, prisma } from "~/db.server"; import { Organization } from "~/models/organization.server"; import { Project } from "~/models/project.server"; import { User } from "~/models/user.server"; -import { safeJsonParse } from "~/utils/json"; import { getUsername } from "~/utils/username"; export type ErrorData = { @@ -164,75 +161,12 @@ export class DeploymentPresenter { return; } - const parsedErrorData = DeploymentErrorData.safeParse(errorData); + const deploymentError = DeploymentErrorData.safeParse(errorData); - if (!parsedErrorData.success) { + if (!deploymentError.success) { return; } - if (parsedErrorData.data.name === "TaskMetadataParseError") { - const errorJson = safeJsonParse(parsedErrorData.data.stack); - - if (errorJson) { - const parsedError = TaskMetadataFailedToParseData.safeParse(errorJson); - - if (parsedError.success) { - return { - name: parsedErrorData.data.name, - message: parsedErrorData.data.message, - stack: createTaskMetadataFailedErrorStack(parsedError.data), - stderr: parsedErrorData.data.stderr, - }; - } else { - return { - name: parsedErrorData.data.name, - message: parsedErrorData.data.message, - stderr: parsedErrorData.data.stderr, - }; - } - } else { - return { - name: parsedErrorData.data.name, - message: parsedErrorData.data.message, - stderr: parsedErrorData.data.stderr, - }; - } - } - - return { - name: parsedErrorData.data.name, - message: parsedErrorData.data.message, - stack: parsedErrorData.data.stack, - stderr: parsedErrorData.data.stderr, - }; + return prepareDeploymentError(deploymentError.data); } } - -function createTaskMetadataFailedErrorStack( - data: z.infer -): string { - const stack = []; - - const groupedIssues = groupTaskMetadataIssuesByTask(data.tasks, data.zodIssues); - - for (const key in groupedIssues) { - const taskWithIssues = groupedIssues[key]; - - if (!taskWithIssues) { - continue; - } - - stack.push("\n"); - stack.push(` ❯ ${taskWithIssues.exportName} in ${taskWithIssues.filePath}`); - - for (const issue of taskWithIssues.issues) { - if (issue.path) { - stack.push(` x ${issue.path} ${issue.message}`); - } else { - stack.push(` x ${issue.message}`); - } - } - } - - return stack.join("\n"); -} diff --git a/apps/webapp/app/routes/api.v1.deployments.$deploymentId.background-workers.ts b/apps/webapp/app/routes/api.v1.deployments.$deploymentId.background-workers.ts new file mode 100644 index 000000000..1d8f29758 --- /dev/null +++ b/apps/webapp/app/routes/api.v1.deployments.$deploymentId.background-workers.ts @@ -0,0 +1,73 @@ +import { ActionFunctionArgs, json } from "@remix-run/server-runtime"; +import { CreateBackgroundWorkerRequestBody } from "@trigger.dev/core/v3"; +import { z } from "zod"; +import { authenticateApiRequest } from "~/services/apiAuth.server"; +import { logger } from "~/services/logger.server"; +import { ServiceValidationError } from "~/v3/services/baseService.server"; +import { CreateDeclarativeScheduleError } from "~/v3/services/createBackgroundWorker.server"; +import { CreateDeploymentBackgroundWorkerService } from "~/v3/services/createDeploymentBackgroundWorker.server"; + +const ParamsSchema = z.object({ + deploymentId: z.string(), +}); + +export async function action({ request, params }: ActionFunctionArgs) { + // Ensure this is a POST request + if (request.method.toUpperCase() !== "POST") { + return { status: 405, body: "Method Not Allowed" }; + } + + const parsedParams = ParamsSchema.safeParse(params); + + if (!parsedParams.success) { + return json({ error: "Invalid params" }, { status: 400 }); + } + + // Next authenticate the request + const authenticationResult = await authenticateApiRequest(request); + + if (!authenticationResult) { + logger.info("Invalid or missing api key", { url: request.url }); + return json({ error: "Invalid or Missing API key" }, { status: 401 }); + } + + const authenticatedEnv = authenticationResult.environment; + + const { deploymentId } = parsedParams.data; + + const rawBody = await request.json(); + const body = CreateBackgroundWorkerRequestBody.safeParse(rawBody); + + if (!body.success) { + return json({ error: "Invalid body", issues: body.error.issues }, { status: 400 }); + } + + const service = new CreateDeploymentBackgroundWorkerService(); + + try { + const backgroundWorker = await service.call(authenticatedEnv, deploymentId, body.data); + + if (!backgroundWorker) { + return json({ error: "Failed to create background worker" }, { status: 500 }); + } + + return json( + { + id: backgroundWorker.friendlyId, + version: backgroundWorker.version, + contentHash: backgroundWorker.contentHash, + }, + { status: 200 } + ); + } catch (e) { + logger.error("Failed to create background worker", { error: e }); + + if (e instanceof ServiceValidationError) { + return json({ error: e.message }, { status: 400 }); + } else if (e instanceof CreateDeclarativeScheduleError) { + return json({ error: e.message }, { status: 400 }); + } + + return json({ error: "Failed to create background worker" }, { status: 500 }); + } +} diff --git a/apps/webapp/app/routes/api.v1.deployments.$deploymentId.fail.ts b/apps/webapp/app/routes/api.v1.deployments.$deploymentId.fail.ts new file mode 100644 index 000000000..5edea5636 --- /dev/null +++ b/apps/webapp/app/routes/api.v1.deployments.$deploymentId.fail.ts @@ -0,0 +1,52 @@ +import { ActionFunctionArgs, json } from "@remix-run/server-runtime"; +import { FailDeploymentRequestBody } from "@trigger.dev/core/v3"; +import { z } from "zod"; +import { authenticateApiRequest } from "~/services/apiAuth.server"; +import { logger } from "~/services/logger.server"; +import { FailDeploymentService } from "~/v3/services/failDeployment.server"; + +const ParamsSchema = z.object({ + deploymentId: z.string(), +}); + +export async function action({ request, params }: ActionFunctionArgs) { + // Ensure this is a POST request + if (request.method.toUpperCase() !== "POST") { + return { status: 405, body: "Method Not Allowed" }; + } + + const parsedParams = ParamsSchema.safeParse(params); + + if (!parsedParams.success) { + return json({ error: "Invalid params" }, { status: 400 }); + } + + // Next authenticate the request + const authenticationResult = await authenticateApiRequest(request); + + if (!authenticationResult) { + logger.info("Invalid or missing api key", { url: request.url }); + return json({ error: "Invalid or Missing API key" }, { status: 401 }); + } + + const authenticatedEnv = authenticationResult.environment; + + const { deploymentId } = parsedParams.data; + + const rawBody = await request.json(); + const body = FailDeploymentRequestBody.safeParse(rawBody); + + if (!body.success) { + return json({ error: "Invalid body", issues: body.error.issues }, { status: 400 }); + } + + const service = new FailDeploymentService(); + await service.call(authenticatedEnv, deploymentId, body.data); + + return json( + { + id: deploymentId, + }, + { status: 200 } + ); +} diff --git a/apps/webapp/app/routes/api.v1.deployments.$deploymentId.finalize.ts b/apps/webapp/app/routes/api.v1.deployments.$deploymentId.finalize.ts new file mode 100644 index 000000000..9bd12e4bd --- /dev/null +++ b/apps/webapp/app/routes/api.v1.deployments.$deploymentId.finalize.ts @@ -0,0 +1,65 @@ +import { ActionFunctionArgs, json } from "@remix-run/server-runtime"; +import { FinalizeDeploymentRequestBody } from "@trigger.dev/core/v3"; +import { z } from "zod"; +import { authenticateApiRequest } from "~/services/apiAuth.server"; +import { logger } from "~/services/logger.server"; +import { ServiceValidationError } from "~/v3/services/baseService.server"; +import { FinalizeDeploymentService } from "~/v3/services/finalizeDeployment.server"; + +const ParamsSchema = z.object({ + deploymentId: z.string(), +}); + +export async function action({ request, params }: ActionFunctionArgs) { + // Ensure this is a POST request + if (request.method.toUpperCase() !== "POST") { + return { status: 405, body: "Method Not Allowed" }; + } + + const parsedParams = ParamsSchema.safeParse(params); + + if (!parsedParams.success) { + return json({ error: "Invalid params" }, { status: 400 }); + } + + // Next authenticate the request + const authenticationResult = await authenticateApiRequest(request); + + if (!authenticationResult) { + logger.info("Invalid or missing api key", { url: request.url }); + return json({ error: "Invalid or Missing API key" }, { status: 401 }); + } + + const authenticatedEnv = authenticationResult.environment; + + const { deploymentId } = parsedParams.data; + + const rawBody = await request.json(); + const body = FinalizeDeploymentRequestBody.safeParse(rawBody); + + if (!body.success) { + return json({ error: "Invalid body", issues: body.error.issues }, { status: 400 }); + } + + try { + const service = new FinalizeDeploymentService(); + await service.call(authenticatedEnv, deploymentId, body.data); + + return json( + { + id: deploymentId, + }, + { status: 200 } + ); + } catch (error) { + if (error instanceof ServiceValidationError) { + return json({ error: error.message }, { status: 400 }); + } else if (error instanceof Error) { + logger.error("Error finalizing deployment", { error: error.message }); + return json({ error: `Internal server error: ${error.message}` }, { status: 500 }); + } else { + logger.error("Error finalizing deployment", { error: String(error) }); + return json({ error: "Internal server error" }, { status: 500 }); + } + } +} diff --git a/apps/webapp/app/routes/api.v1.projects.$projectRef.$env.ts b/apps/webapp/app/routes/api.v1.projects.$projectRef.$env.ts index 90e41a4f5..bfcf174df 100644 --- a/apps/webapp/app/routes/api.v1.projects.$projectRef.$env.ts +++ b/apps/webapp/app/routes/api.v1.projects.$projectRef.$env.ts @@ -89,6 +89,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) { apiKey: runtimeEnv.apiKey, name: project.name, apiUrl: processEnv.APP_ORIGIN, + projectId: project.id, }; return json(result); diff --git a/apps/webapp/app/services/db/pgListen.server.ts b/apps/webapp/app/services/db/pgListen.server.ts index ddcc54c7b..b819ceec6 100644 --- a/apps/webapp/app/services/db/pgListen.server.ts +++ b/apps/webapp/app/services/db/pgListen.server.ts @@ -1,4 +1,4 @@ -import { Logger } from "@trigger.dev/core-backend"; +import { Logger } from "@trigger.dev/core/logger"; import type { PoolClient } from "pg"; import { z } from "zod"; import { logger } from "~/services/logger.server"; diff --git a/apps/webapp/app/services/logger.server.ts b/apps/webapp/app/services/logger.server.ts index 6fa563d1b..2d208bca0 100644 --- a/apps/webapp/app/services/logger.server.ts +++ b/apps/webapp/app/services/logger.server.ts @@ -1,5 +1,5 @@ -import type { LogLevel } from "@trigger.dev/core-backend"; -import { Logger } from "@trigger.dev/core-backend"; +import type { LogLevel } from "@trigger.dev/core/logger"; +import { Logger } from "@trigger.dev/core/logger"; import { sensitiveDataReplacer } from "./sensitiveDataReplacer"; import { AsyncLocalStorage } from "async_hooks"; import { getHttpContext } from "./httpAsyncStorage.server"; diff --git a/apps/webapp/app/services/runs/performRunExecutionV3.server.ts b/apps/webapp/app/services/runs/performRunExecutionV3.server.ts index ca2fb19f1..dee7b0fd7 100644 --- a/apps/webapp/app/services/runs/performRunExecutionV3.server.ts +++ b/apps/webapp/app/services/runs/performRunExecutionV3.server.ts @@ -15,7 +15,7 @@ import { RunSourceContextSchema, supportsFeature, } from "@trigger.dev/core"; -import { BloomFilter } from "@trigger.dev/core-backend"; +import { BloomFilter } from "@trigger.dev/core/bloom"; import { ConcurrencyLimitGroup, Job, JobRun, JobVersion } from "@trigger.dev/database"; import { generateErrorMessage } from "zod-error"; import { eventRecordToApiJson } from "~/api.server"; diff --git a/apps/webapp/app/services/worker.server.ts b/apps/webapp/app/services/worker.server.ts index ee4b8e064..299b86c77 100644 --- a/apps/webapp/app/services/worker.server.ts +++ b/apps/webapp/app/services/worker.server.ts @@ -50,6 +50,10 @@ import { PerformTaskOperationService } from "./tasks/performTaskOperation.server import { ProcessCallbackTimeoutService } from "./tasks/processCallbackTimeout.server"; import { ResumeTaskService } from "./tasks/resumeTask.server"; import { PerformTaskRunAlertsService } from "~/v3/services/alerts/performTaskRunAlerts.server"; +import { + CancelDevSessionRunsService, + CancelDevSessionRunsServiceOptions, +} from "~/v3/services/cancelDevSessionRuns.server"; const workerCatalog = { indexEndpoint: z.object({ @@ -191,6 +195,7 @@ const workerCatalog = { "v3.cancelTaskAttemptDependencies": z.object({ attemptId: z.string(), }), + "v3.cancelDevSessionRuns": CancelDevSessionRunsServiceOptions, }; const executionWorkerCatalog = { @@ -710,6 +715,15 @@ function getWorkerQueue() { return await service.call(payload.attemptId); }, }, + "v3.cancelDevSessionRuns": { + priority: 0, + maxAttempts: 5, + handler: async (payload, job) => { + const service = new CancelDevSessionRunsService(); + + return await service.call(payload); + }, + }, }, }); } diff --git a/apps/webapp/app/v3/marqs/concurrencyMonitor.server.ts b/apps/webapp/app/v3/marqs/concurrencyMonitor.server.ts index abf82ce36..cc091a6a0 100644 --- a/apps/webapp/app/v3/marqs/concurrencyMonitor.server.ts +++ b/apps/webapp/app/v3/marqs/concurrencyMonitor.server.ts @@ -1,4 +1,4 @@ -import { Logger } from "@trigger.dev/core-backend"; +import { Logger } from "@trigger.dev/core/logger"; import { Redis } from "ioredis"; import { prisma } from "~/db.server"; import { logger } from "~/services/logger.server"; diff --git a/apps/webapp/app/v3/marqs/devQueueConsumer.server.ts b/apps/webapp/app/v3/marqs/devQueueConsumer.server.ts index a5afad2aa..7ee0953d9 100644 --- a/apps/webapp/app/v3/marqs/devQueueConsumer.server.ts +++ b/apps/webapp/app/v3/marqs/devQueueConsumer.server.ts @@ -2,7 +2,6 @@ import { Context, ROOT_CONTEXT, Span, SpanKind, context, trace } from "@opentele import { TaskRunExecution, TaskRunExecutionLazyAttemptPayload, - TaskRunExecutionPayload, TaskRunExecutionResult, TaskRunFailedExecutionResult, serverWebsocketMessages, @@ -17,9 +16,8 @@ import { logger } from "~/services/logger.server"; import { marqs, sanitizeQueueName } from "~/v3/marqs/index.server"; import { resolveVariablesForEnvironment } from "../environmentVariables/environmentVariablesRepository.server"; import { FailedTaskRunService } from "../failedTaskRun.server"; -import { CancelTaskRunService } from "../services/cancelTaskRun.server"; +import { CancelDevSessionRunsService } from "../services/cancelDevSessionRuns.server"; import { CompleteAttemptService } from "../services/completeAttempt.server"; -import { CreateTaskRunAttemptService } from "../services/createTaskRunAttempt.server"; import { SEMINTATTRS_FORCE_RECORDING, attributesFromAuthenticatedEnv, @@ -194,10 +192,22 @@ export class DevQueueConsumer { this._enabled = false; // Create the session - await disconnectSession(this.env.id); + const session = await disconnectSession(this.env.id); - // We need to cancel all the in progress task run attempts and ack the messages so they will stop processing - await this.#cancelInProgressRunsAndAttempts(reason); + const runIds = Array.from(this._inProgressRuns.values()); + this._inProgressRuns.clear(); + + if (runIds.length > 0) { + await CancelDevSessionRunsService.enqueue( + { + runIds, + cancelledAt: new Date(), + reason, + cancelledSessionId: session?.id, + }, + new Date(Date.now() + 1000 * 10) // 10 seconds from now + ); + } // We need to unsubscribe from the background worker channels for (const [id, subscriber] of this._backgroundWorkerSubscriber) { @@ -215,54 +225,6 @@ export class DevQueueConsumer { } } - async #cancelInProgressRunsAndAttempts(reason: string) { - const cancelTaskRunService = new CancelTaskRunService(); - - const cancelledAt = new Date(); - - const inProgressRuns = new Map(this._inProgressRuns); - - this._inProgressRuns.clear(); - - logger.debug("Cancelling in progress runs and attempts", { - runs: Array.from(inProgressRuns.keys()), - }); - - for (const [_, runId] of inProgressRuns) { - await this.#cancelInProgressRun(runId, cancelTaskRunService, cancelledAt, reason); - } - } - - async #cancelInProgressRun( - runId: string, - service: CancelTaskRunService, - cancelledAt: Date, - reason: string - ) { - logger.debug("Cancelling in progress run", { runId }); - - const taskRun = runId.startsWith("run_") - ? await prisma.taskRun.findUnique({ - where: { friendlyId: runId }, - }) - : await prisma.taskRun.findUnique({ - where: { id: runId }, - }); - - if (!taskRun) { - return; - } - - try { - await service.call(taskRun, { reason, cancelAttempts: true, cancelledAt }); - } catch (e) { - logger.error("Failed to cancel in progress run", { - runId, - error: e, - }); - } - } - async #enable() { if (this._enabled) { return; @@ -534,63 +496,13 @@ export class DevQueueConsumer { setTimeout(() => this.#doWork(), 100); } } else { - const service = new CreateTaskRunAttemptService(); - const { execution } = await service.call(lockedTaskRun.friendlyId, this.env); + logger.debug("We no longer support non-lazy attempts, aborting this run", { + messageId: message.messageId, + backgroundWorker, + }); + await marqs?.acknowledgeMessage(message.messageId); - const payload: TaskRunExecutionPayload = { - traceContext: lockedTaskRun.traceContext as Record, - environment: variables.reduce((acc: Record, curr) => { - acc[curr.key] = curr.value; - return acc; - }, {}), - execution, - }; - - try { - await this._sender.send("BACKGROUND_WORKER_MESSAGE", { - backgroundWorkerId: backgroundWorker.friendlyId, - data: { - type: "EXECUTE_RUNS", - payloads: [payload], - }, - }); - - logger.debug("Executing the run", { - messageId: message.messageId, - }); - - this._inProgressRuns.set(lockedTaskRun.friendlyId, message.messageId); - } catch (e) { - if (e instanceof Error) { - this._currentSpan?.recordException(e); - } else { - this._currentSpan?.recordException(new Error(String(e))); - } - - this._endSpanInNextIteration = true; - - // We now need to unlock the task run and delete the task run attempt - await prisma.$transaction([ - prisma.taskRun.update({ - where: { - id: lockedTaskRun.id, - }, - data: { - lockedAt: null, - lockedById: null, - status: "PENDING", - startedAt: existingTaskRun.startedAt, - }, - }), - ]); - - this._inProgressRuns.delete(lockedTaskRun.friendlyId); - - // Finally we need to nack the message so it can be retried - await marqs?.nackMessage(message.messageId); - } finally { - setTimeout(() => this.#doWork(), 100); - } + setTimeout(() => this.#doWork(), 100); } } diff --git a/apps/webapp/app/v3/services/cancelDevSessionRuns.server.ts b/apps/webapp/app/v3/services/cancelDevSessionRuns.server.ts new file mode 100644 index 000000000..040131137 --- /dev/null +++ b/apps/webapp/app/v3/services/cancelDevSessionRuns.server.ts @@ -0,0 +1,103 @@ +import { workerQueue } from "~/services/worker.server"; +import { BaseService } from "./baseService.server"; +import { PrismaClientOrTransaction } from "~/db.server"; +import { z } from "zod"; +import { logger } from "~/services/logger.server"; +import { CancelTaskRunService } from "./cancelTaskRun.server"; +import { findLatestSession } from "~/models/runtimeEnvironment.server"; + +export const CancelDevSessionRunsServiceOptions = z.object({ + runIds: z.array(z.string()), + cancelledAt: z.coerce.date(), + reason: z.string(), + cancelledSessionId: z.string().optional(), +}); + +export type CancelDevSessionRunsServiceOptions = z.infer; + +export class CancelDevSessionRunsService extends BaseService { + public async call(options: CancelDevSessionRunsServiceOptions) { + const cancelledSession = options.cancelledSessionId + ? await this._prisma.runtimeEnvironmentSession.findFirst({ + where: { id: options.cancelledSessionId }, + }) + : undefined; + + if (cancelledSession) { + const latestSession = await findLatestSession(cancelledSession.environmentId); + + if ( + latestSession && + latestSession.id !== cancelledSession.id && + !latestSession.disconnectedAt + ) { + logger.debug("Not cancelling runs because there is a newer session", { + cancelledSessionId: cancelledSession.id, + latestSessionId: latestSession.id, + }); + + return; + } + } + + logger.debug( + "Cancelling in progress runs for dev session because there isn't a newer connected session", + { + options, + cancelledSession, + } + ); + + const cancelTaskRunService = new CancelTaskRunService(); + + for (const runId of options.runIds) { + await this.#cancelInProgressRun( + runId, + cancelTaskRunService, + options.cancelledAt, + options.reason + ); + } + } + + async #cancelInProgressRun( + runId: string, + service: CancelTaskRunService, + cancelledAt: Date, + reason: string + ) { + logger.debug("Cancelling in progress run", { runId }); + + const taskRun = runId.startsWith("run_") + ? await this._prisma.taskRun.findUnique({ + where: { friendlyId: runId }, + }) + : await this._prisma.taskRun.findUnique({ + where: { id: runId }, + }); + + if (!taskRun) { + return; + } + + try { + await service.call(taskRun, { reason, cancelAttempts: true, cancelledAt }); + } catch (e) { + logger.error("Failed to cancel in progress run", { + runId, + error: e, + }); + } + } + + static async enqueue( + options: CancelDevSessionRunsServiceOptions, + runAt?: Date, + tx?: PrismaClientOrTransaction + ) { + return await workerQueue.enqueue("v3.cancelDevSessionRuns", options, { + tx, + runAt: runAt, + }); + } +} diff --git a/apps/webapp/app/v3/services/createBackgroundWorker.server.ts b/apps/webapp/app/v3/services/createBackgroundWorker.server.ts index 34b747e76..478e82781 100644 --- a/apps/webapp/app/v3/services/createBackgroundWorker.server.ts +++ b/apps/webapp/app/v3/services/createBackgroundWorker.server.ts @@ -1,4 +1,8 @@ -import { CreateBackgroundWorkerRequestBody, TaskResource } from "@trigger.dev/core/v3"; +import { + BackgroundWorkerSourceFileMetadata, + CreateBackgroundWorkerRequestBody, + TaskResource, +} from "@trigger.dev/core/v3"; import type { BackgroundWorker } from "@trigger.dev/database"; import { Prisma, PrismaClientOrTransaction } from "~/db.server"; import { AuthenticatedEnvironment } from "~/services/apiAuth.server"; @@ -70,7 +74,19 @@ export class CreateBackgroundWorkerService extends BaseService { }, }); - await createBackgroundTasks(body.metadata.tasks, backgroundWorker, environment, this._prisma); + const tasksToBackgroundFiles = await createBackgroundFiles( + body.metadata.sourceFiles, + backgroundWorker, + environment, + this._prisma + ); + await createBackgroundTasks( + body.metadata.tasks, + backgroundWorker, + environment, + this._prisma, + tasksToBackgroundFiles + ); await syncDeclarativeSchedules( body.metadata.tasks, backgroundWorker, @@ -121,7 +137,8 @@ export async function createBackgroundTasks( tasks: TaskResource[], worker: BackgroundWorker, environment: AuthenticatedEnvironment, - prisma: PrismaClientOrTransaction + prisma: PrismaClientOrTransaction, + tasksToBackgroundFiles?: Map ) { for (const task of tasks) { try { @@ -138,6 +155,7 @@ export async function createBackgroundTasks( queueConfig: task.queue, machineConfig: task.machine, triggerSource: task.triggerSource === "schedule" ? "SCHEDULED" : "STANDARD", + fileId: tasksToBackgroundFiles?.get(task.id) ?? null, }, }); @@ -381,3 +399,53 @@ export async function syncDeclarativeSchedules( } } } + +export async function createBackgroundFiles( + files: Array | undefined, + worker: BackgroundWorker, + environment: AuthenticatedEnvironment, + prisma: PrismaClientOrTransaction +) { + // Maps from each taskId to the backgroundWorkerFileId + const results = new Map(); + + if (!files) { + return results; + } + + for (const file of files) { + const backgroundWorkerFile = await prisma.backgroundWorkerFile.upsert({ + where: { + projectId_contentHash: { + projectId: environment.projectId, + contentHash: file.contentHash, + }, + }, + create: { + friendlyId: generateFriendlyId("file"), + projectId: environment.projectId, + contentHash: file.contentHash, + filePath: file.filePath, + contents: Buffer.from(file.contents), + backgroundWorkers: { + connect: { + id: worker.id, + }, + }, + }, + update: { + backgroundWorkers: { + connect: { + id: worker.id, + }, + }, + }, + }); + + for (const taskId of file.taskIds) { + results.set(taskId, backgroundWorkerFile.id); + } + } + + return results; +} diff --git a/apps/webapp/app/v3/services/createDeploymentBackgroundWorker.server.ts b/apps/webapp/app/v3/services/createDeploymentBackgroundWorker.server.ts new file mode 100644 index 000000000..751a79a8d --- /dev/null +++ b/apps/webapp/app/v3/services/createDeploymentBackgroundWorker.server.ts @@ -0,0 +1,108 @@ +import { CreateBackgroundWorkerRequestBody } from "@trigger.dev/core/v3"; +import type { BackgroundWorker } from "@trigger.dev/database"; +import { AuthenticatedEnvironment } from "~/services/apiAuth.server"; +import { generateFriendlyId } from "../friendlyIdentifiers"; +import { BaseService } from "./baseService.server"; +import { + createBackgroundFiles, + createBackgroundTasks, + syncDeclarativeSchedules, +} from "./createBackgroundWorker.server"; +import { TimeoutDeploymentService } from "./timeoutDeployment.server"; + +export class CreateDeploymentBackgroundWorkerService extends BaseService { + public async call( + environment: AuthenticatedEnvironment, + deploymentId: string, + body: CreateBackgroundWorkerRequestBody + ): Promise { + return this.traceWithEnv("call", environment, async (span) => { + span.setAttribute("deploymentId", deploymentId); + + const deployment = await this._prisma.workerDeployment.findUnique({ + where: { + friendlyId: deploymentId, + }, + }); + + if (!deployment) { + return; + } + + if (deployment.status !== "BUILDING") { + return; + } + + const backgroundWorker = await this._prisma.backgroundWorker.create({ + data: { + friendlyId: generateFriendlyId("worker"), + version: deployment.version, + runtimeEnvironmentId: environment.id, + projectId: environment.projectId, + metadata: body.metadata, + contentHash: body.metadata.contentHash, + cliVersion: body.metadata.cliPackageVersion, + sdkVersion: body.metadata.packageVersion, + supportsLazyAttempts: body.supportsLazyAttempts, + }, + }); + + try { + const tasksToBackgroundFiles = await createBackgroundFiles( + body.metadata.sourceFiles, + backgroundWorker, + environment, + this._prisma + ); + await createBackgroundTasks( + body.metadata.tasks, + backgroundWorker, + environment, + this._prisma, + tasksToBackgroundFiles + ); + await syncDeclarativeSchedules( + body.metadata.tasks, + backgroundWorker, + environment, + this._prisma + ); + } catch (error) { + const name = error instanceof Error ? error.name : "UnknownError"; + const message = error instanceof Error ? error.message : JSON.stringify(error); + + await this._prisma.workerDeployment.update({ + where: { + id: deployment.id, + }, + data: { + status: "FAILED", + failedAt: new Date(), + errorData: { + name, + message, + }, + }, + }); + + throw error; + } + + // Link the deployment with the background worker + await this._prisma.workerDeployment.update({ + where: { + id: deployment.id, + }, + data: { + status: "DEPLOYING", + workerId: backgroundWorker.id, + deployedAt: new Date(), + }, + }); + + await TimeoutDeploymentService.dequeue(deployment.id, this._prisma); + + return backgroundWorker; + }); + } +} diff --git a/apps/webapp/app/v3/services/failDeployment.server.ts b/apps/webapp/app/v3/services/failDeployment.server.ts new file mode 100644 index 000000000..a5d7fc9e8 --- /dev/null +++ b/apps/webapp/app/v3/services/failDeployment.server.ts @@ -0,0 +1,56 @@ +import { PerformDeploymentAlertsService } from "./alerts/performDeploymentAlerts.server"; +import { BaseService } from "./baseService.server"; +import { logger } from "~/services/logger.server"; +import { WorkerDeploymentStatus } from "@trigger.dev/database"; +import { FailDeploymentRequestBody } from "@trigger.dev/core/v3/schemas"; +import { AuthenticatedEnvironment } from "~/services/apiAuth.server"; + +const FINAL_DEPLOYMENT_STATUSES: WorkerDeploymentStatus[] = [ + "CANCELED", + "DEPLOYED", + "FAILED", + "TIMED_OUT", +]; + +export class FailDeploymentService extends BaseService { + public async call( + authenticatedEnv: AuthenticatedEnvironment, + id: string, + params: FailDeploymentRequestBody + ) { + const deployment = await this._prisma.workerDeployment.findUnique({ + where: { + friendlyId: id, + environmentId: authenticatedEnv.id, + }, + }); + + if (!deployment) { + logger.error("Worker deployment not found", { id }); + return; + } + + if (FINAL_DEPLOYMENT_STATUSES.includes(deployment.status)) { + logger.error("Worker deployment already in final state", { + id: deployment.id, + status: deployment.status, + }); + return; + } + + const failedDeployment = await this._prisma.workerDeployment.update({ + where: { + id: deployment.id, + }, + data: { + status: "FAILED", + failedAt: new Date(), + errorData: params.error, + }, + }); + + await PerformDeploymentAlertsService.enqueue(failedDeployment.id, this._prisma); + + return failedDeployment; + } +} diff --git a/apps/webapp/app/v3/services/finalizeDeployment.server.ts b/apps/webapp/app/v3/services/finalizeDeployment.server.ts new file mode 100644 index 000000000..c610f9122 --- /dev/null +++ b/apps/webapp/app/v3/services/finalizeDeployment.server.ts @@ -0,0 +1,122 @@ +import { FinalizeDeploymentRequestBody } from "@trigger.dev/core/v3/schemas"; +import { CURRENT_DEPLOYMENT_LABEL } from "~/consts"; +import { AuthenticatedEnvironment } from "~/services/apiAuth.server"; +import { logger } from "~/services/logger.server"; +import { socketIo } from "../handleSocketIo.server"; +import { marqs } from "../marqs/index.server"; +import { registryProxy } from "../registryProxy.server"; +import { PerformDeploymentAlertsService } from "./alerts/performDeploymentAlerts.server"; +import { BaseService, ServiceValidationError } from "./baseService.server"; +import { ExecuteTasksWaitingForDeployService } from "./executeTasksWaitingForDeploy"; +import { projectPubSub } from "./projectPubSub.server"; + +export class FinalizeDeploymentService extends BaseService { + public async call( + authenticatedEnv: AuthenticatedEnvironment, + id: string, + body: FinalizeDeploymentRequestBody + ) { + const deployment = await this._prisma.workerDeployment.findUnique({ + where: { + friendlyId: id, + environmentId: authenticatedEnv.id, + }, + include: { + worker: { + include: { + tasks: true, + }, + }, + }, + }); + + if (!deployment) { + logger.error("Worker deployment not found", { id }); + return; + } + + if (!deployment.worker) { + logger.error("Worker deployment does not have a worker", { id }); + + // TODO: We need to fail the deployment here because it's not possible to deploy a worker without a worker + + throw new ServiceValidationError("Worker deployment does not have a worker"); + } + + if (deployment.status !== "DEPLOYING") { + logger.error("Worker deployment is not in DEPLOYING status", { id }); + throw new ServiceValidationError("Worker deployment is not in DEPLOYING status"); + } + + // Link the deployment with the background worker + const finalizedDeployment = await this._prisma.workerDeployment.update({ + where: { + id: deployment.id, + }, + data: { + status: "DEPLOYED", + deployedAt: new Date(), + imageReference: + registryProxy && body.selfHosted !== true + ? registryProxy.rewriteImageReference(body.imageReference) + : body.imageReference, + }, + }); + + //set this deployment as the current deployment for this environment + await this._prisma.workerDeploymentPromotion.upsert({ + where: { + environmentId_label: { + environmentId: authenticatedEnv.id, + label: CURRENT_DEPLOYMENT_LABEL, + }, + }, + create: { + deploymentId: finalizedDeployment.id, + environmentId: authenticatedEnv.id, + label: CURRENT_DEPLOYMENT_LABEL, + }, + update: { + deploymentId: finalizedDeployment.id, + }, + }); + + try { + //send a notification that a new worker has been created + await projectPubSub.publish( + `project:${authenticatedEnv.projectId}:env:${authenticatedEnv.id}`, + "WORKER_CREATED", + { + environmentId: authenticatedEnv.id, + environmentType: authenticatedEnv.type, + createdAt: authenticatedEnv.createdAt, + taskCount: deployment.worker.tasks.length, + type: "deployed", + } + ); + + await marqs?.updateEnvConcurrencyLimits(authenticatedEnv); + } catch (err) { + logger.error("Failed to publish WORKER_CREATED event", { err }); + } + + if (deployment.imageReference) { + socketIo.providerNamespace.emit("PRE_PULL_DEPLOYMENT", { + version: "v1", + imageRef: deployment.imageReference, + shortCode: deployment.shortCode, + // identifiers + deploymentId: deployment.id, + envId: authenticatedEnv.id, + envType: authenticatedEnv.type, + orgId: authenticatedEnv.organizationId, + projectId: deployment.projectId, + }); + } + + await ExecuteTasksWaitingForDeployService.enqueue(deployment.worker.id, this._prisma); + await PerformDeploymentAlertsService.enqueue(deployment.id, this._prisma); + + return finalizedDeployment; + } +} diff --git a/apps/webapp/app/v3/tracer.server.ts b/apps/webapp/app/v3/tracer.server.ts index 40e7e0966..ff669f3cf 100644 --- a/apps/webapp/app/v3/tracer.server.ts +++ b/apps/webapp/app/v3/tracer.server.ts @@ -12,7 +12,7 @@ import { trace, } from "@opentelemetry/api"; import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"; -import { InstrumentationOption, registerInstrumentations } from "@opentelemetry/instrumentation"; +import { type Instrumentation, registerInstrumentations } from "@opentelemetry/instrumentation"; import { ExpressInstrumentation } from "@opentelemetry/instrumentation-express"; import { HttpInstrumentation } from "@opentelemetry/instrumentation-http"; import { Resource } from "@opentelemetry/resources"; @@ -167,7 +167,7 @@ function getTracer() { provider.register(); - let instrumentations: InstrumentationOption[] = [ + let instrumentations: Instrumentation[] = [ new HttpInstrumentation(), new ExpressInstrumentation(), ]; diff --git a/apps/webapp/app/v3/utils/zodPubSub.server.ts b/apps/webapp/app/v3/utils/zodPubSub.server.ts index 4ba4ce14e..9680f89d3 100644 --- a/apps/webapp/app/v3/utils/zodPubSub.server.ts +++ b/apps/webapp/app/v3/utils/zodPubSub.server.ts @@ -1,4 +1,4 @@ -import { Logger } from "@trigger.dev/core-backend"; +import { Logger } from "@trigger.dev/core/logger"; import { ZodMessageCatalogSchema, ZodMessageHandler } from "@trigger.dev/core/v3/zodMessageHandler"; import { Evt } from "evt"; import Redis, { RedisOptions } from "ioredis"; diff --git a/apps/webapp/package.json b/apps/webapp/package.json index 90072f32b..64efcde7d 100644 --- a/apps/webapp/package.json +++ b/apps/webapp/package.json @@ -50,19 +50,19 @@ "@heroicons/react": "^2.0.12", "@internationalized/date": "^3.5.1", "@lezer/highlight": "^1.1.6", - "@opentelemetry/api": "^1.8.0", - "@opentelemetry/core": "^1.22.0", - "@opentelemetry/exporter-logs-otlp-http": "^0.49.1", - "@opentelemetry/exporter-trace-otlp-http": "^0.49.1", - "@opentelemetry/instrumentation": "^0.49.1", + "@opentelemetry/api": "1.9.0", + "@opentelemetry/core": "1.25.1", + "@opentelemetry/exporter-logs-otlp-http": "0.52.1", + "@opentelemetry/exporter-trace-otlp-http": "0.52.1", + "@opentelemetry/instrumentation": "0.52.1", "@opentelemetry/instrumentation-express": "^0.36.1", - "@opentelemetry/instrumentation-http": "^0.49.1", - "@opentelemetry/resources": "^1.22.0", - "@opentelemetry/sdk-logs": "^0.49.1", - "@opentelemetry/sdk-node": "^0.49.1", - "@opentelemetry/sdk-trace-base": "^1.22.0", - "@opentelemetry/sdk-trace-node": "^1.22.0", - "@opentelemetry/semantic-conventions": "^1.22.0", + "@opentelemetry/instrumentation-http": "0.52.1", + "@opentelemetry/resources": "1.25.1", + "@opentelemetry/sdk-logs": "0.52.1", + "@opentelemetry/sdk-node": "0.52.1", + "@opentelemetry/sdk-trace-base": "1.25.1", + "@opentelemetry/sdk-trace-node": "1.25.1", + "@opentelemetry/semantic-conventions": "1.25.1", "@popperjs/core": "^2.11.8", "@prisma/instrumentation": "^5.11.0", "@radix-ui/react-alert-dialog": "^1.0.4", @@ -93,12 +93,11 @@ "@team-plain/typescript-sdk": "^3.5.0", "@trigger.dev/companyicons": "^1.5.35", "@trigger.dev/core": "workspace:*", - "@trigger.dev/core-backend": "workspace:*", "@trigger.dev/database": "workspace:*", "@trigger.dev/otlp-importer": "workspace:*", "@trigger.dev/platform": "1.0.12", "@trigger.dev/sdk": "workspace:*", - "@trigger.dev/yalt": "workspace:*", + "@trigger.dev/yalt": "npm:@trigger.dev/yalt", "@types/pg": "8.6.6", "@uiw/react-codemirror": "^4.19.5", "@upstash/ratelimit": "^1.1.3", @@ -189,7 +188,6 @@ "@tailwindcss/forms": "^0.5.3", "@tailwindcss/typography": "^0.5.9", "@total-typescript/ts-reset": "^0.4.2", - "@trigger.dev/eslint-plugin": "workspace:*", "@types/bcryptjs": "^2.4.2", "@types/compression": "^1.7.2", "@types/eslint": "^8.4.6", @@ -245,4 +243,4 @@ "engines": { "node": ">=16.0.0" } -} +} \ No newline at end of file diff --git a/apps/webapp/remix.config.js b/apps/webapp/remix.config.js index ee2aee289..06f6ccf68 100644 --- a/apps/webapp/remix.config.js +++ b/apps/webapp/remix.config.js @@ -12,7 +12,6 @@ module.exports = { "marked", "axios", "@trigger.dev/core", - "@trigger.dev/core-backend", "@trigger.dev/sdk", "@trigger.dev/platform", "@trigger.dev/yalt", @@ -25,12 +24,6 @@ module.exports = { ], browserNodeBuiltinsPolyfill: { modules: { path: true, os: true, crypto: true } }, watchPaths: async () => { - return [ - "../../packages/core/src/**/*", - "../../packages/core-backend/src/**/*", - "../../packages/trigger-sdk/src/**/*", - "../../packages/yalt/src/**/*", - "../../packages/emails/src/**/*", - ]; + return ["../../packages/core/src/**/*", "../../packages/emails/src/**/*"]; }, }; diff --git a/apps/webapp/tailwind.config.js b/apps/webapp/tailwind.config.js index 5f387a4c9..15a38dd80 100644 --- a/apps/webapp/tailwind.config.js +++ b/apps/webapp/tailwind.config.js @@ -154,11 +154,7 @@ const radius = "0.5rem"; /** @type {import('tailwindcss').Config} */ module.exports = { - content: [ - "./app/**/*.{ts,jsx,tsx}", - // include packages if not transpiling - "../../packages/**/*.{ts,tsx}", - ], + content: ["./app/**/*.{ts,jsx,tsx}"], theme: { container: { center: true, diff --git a/apps/webapp/tsconfig.json b/apps/webapp/tsconfig.json index e9a5102cb..f2825d7e2 100644 --- a/apps/webapp/tsconfig.json +++ b/apps/webapp/tsconfig.json @@ -24,8 +24,6 @@ "@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"], "@trigger.dev/core": ["../../packages/core/src/index"], "@trigger.dev/core/*": ["../../packages/core/src/*"], - "@trigger.dev/core-backend": ["../../packages/core-backend/src/index"], - "@trigger.dev/core-backend/*": ["../../packages/core-backend/src/*"], "@trigger.dev/database": ["../../packages/database/src/index"], "@trigger.dev/database/*": ["../../packages/database/src/*"], "@trigger.dev/yalt": ["../../packages/yalt/src/index"], diff --git a/apps/yalt/.dev.vars.example b/apps/yalt/.dev.vars.example deleted file mode 100644 index 77bf4c333..000000000 --- a/apps/yalt/.dev.vars.example +++ /dev/null @@ -1 +0,0 @@ -SECRET_KEY= \ No newline at end of file diff --git a/apps/yalt/.editorconfig b/apps/yalt/.editorconfig deleted file mode 100644 index 64ab2601f..000000000 --- a/apps/yalt/.editorconfig +++ /dev/null @@ -1,13 +0,0 @@ -# http://editorconfig.org -root = true - -[*] -indent_style = tab -tab_width = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.yml] -indent_style = space diff --git a/apps/yalt/.gitignore b/apps/yalt/.gitignore deleted file mode 100644 index 3b0fe33c4..000000000 --- a/apps/yalt/.gitignore +++ /dev/null @@ -1,172 +0,0 @@ -# Logs - -logs -_.log -npm-debug.log_ -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -.pnpm-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) - -report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json - -# Runtime data - -pids -_.pid -_.seed -\*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover - -lib-cov - -# Coverage directory used by tools like istanbul - -coverage -\*.lcov - -# nyc test coverage - -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) - -.grunt - -# Bower dependency directory (https://bower.io/) - -bower_components - -# node-waf configuration - -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) - -build/Release - -# Dependency directories - -node_modules/ -jspm_packages/ - -# Snowpack dependency directory (https://snowpack.dev/) - -web_modules/ - -# TypeScript cache - -\*.tsbuildinfo - -# Optional npm cache directory - -.npm - -# Optional eslint cache - -.eslintcache - -# Optional stylelint cache - -.stylelintcache - -# Microbundle cache - -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history - -.node_repl_history - -# Output of 'npm pack' - -\*.tgz - -# Yarn Integrity file - -.yarn-integrity - -# dotenv environment variable files - -.env -.env.development.local -.env.test.local -.env.production.local -.env.local - -# parcel-bundler cache (https://parceljs.org/) - -.cache -.parcel-cache - -# Next.js build output - -.next -out - -# Nuxt.js build / generate output - -.nuxt -dist - -# Gatsby files - -.cache/ - -# Comment in the public line in if your project uses Gatsby and not Next.js - -# https://nextjs.org/blog/next-9-1#public-directory-support - -# public - -# vuepress build output - -.vuepress/dist - -# vuepress v2.x temp and cache directory - -.temp -.cache - -# Docusaurus cache and generated files - -.docusaurus - -# Serverless directories - -.serverless/ - -# FuseBox cache - -.fusebox/ - -# DynamoDB Local files - -.dynamodb/ - -# TernJS port file - -.tern-port - -# Stores VSCode versions used for testing VSCode extensions - -.vscode-test - -# yarn v2 - -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.pnp.\* - -# wrangler project - -.dev.vars -.wrangler/ diff --git a/apps/yalt/.prettierrc b/apps/yalt/.prettierrc deleted file mode 100644 index 5c7b5d3c7..000000000 --- a/apps/yalt/.prettierrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "printWidth": 140, - "singleQuote": true, - "semi": true, - "useTabs": true -} diff --git a/apps/yalt/README.md b/apps/yalt/README.md deleted file mode 100644 index d4604f0db..000000000 --- a/apps/yalt/README.md +++ /dev/null @@ -1,26 +0,0 @@ -## Trigger.dev Yalt Server - -Yalt (Yet Another Local Tunnel) is the Trigger.dev tunneling service that powers the local development of Trigger.dev cloud users. - -## Why? - -The Trigger.dev server communicates with user endpoints over HTTP, so during local development we need a way for the Trigger.dev server to make HTTP requests over the public internet to the user's local machine. This is accomplished via a tunneling service like ngrok, which we've been using up until now. Unfortunately, the ngrok free plan has pretty aggressive rate limits and some Trigger.dev users have faced issues with their local jobs not running/working because of this. Yalt.dev is our solution. - -## How does it work? - -Yalt.dev is a Cloudflare Worker that uses Durable Objects to persist a websocket connection from the `@trigger.dev/cli dev` command and proxies requests through the websocket connection and then returns responses from the websocket connection. - -- There is an admin API available at `admin.trigger.dev` that allows tunnels to be created (authenticated via a SECRET_KEY) -- The Cloudflare Worker has a wildcard subdomain route `*.yalt.dev/*` -- When the client receives the tunnel ID, they can connect to the server via `wss://${tunnelId}.yalt.dev/connect` -- Now, requests to `https://${tunnelId}.yalt.dev/api/trigger` are sent to the Durable Object (`YaltConnection`) using the subdomain/tunnelId -- Requests are serialized to a JSON string and sent to the WebSocket -- The WebSocket client running in `@trigger.dev/cli dev` receives the request message and makes a real request to the local dev server -- The `@trigger.dev/cli dev` serializes the response and sends it back to the server. -- The server responds to the original request - -Along with this server there is a package called `@trigger.dev/yalt` that has shared code and is used in: - -- Yalt.dev server (this project) -- `@trigger.dev/cli dev` command -- The Trigger.dev server (to create the tunnels) diff --git a/apps/yalt/package.json b/apps/yalt/package.json deleted file mode 100644 index 605f50f87..000000000 --- a/apps/yalt/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "yalt", - "version": "0.0.1", - "private": true, - "scripts": { - "deploy": "wrangler deploy", - "dev": "wrangler dev --port 8787", - "start": "wrangler dev" - }, - "devDependencies": { - "@cloudflare/workers-types": "~4.20231121.0", - "wrangler": "^3.21.0" - }, - "dependencies": { - "@trigger.dev/yalt": "workspace:*" - } -} \ No newline at end of file diff --git a/apps/yalt/src/index.ts b/apps/yalt/src/index.ts deleted file mode 100644 index d937ad17c..000000000 --- a/apps/yalt/src/index.ts +++ /dev/null @@ -1,259 +0,0 @@ -import { ClientMessages, createRequestMessage } from '@trigger.dev/yalt'; - -export interface Env { - // environemnt variables - SECRET_KEY: string; - WORKER_HOST: string; - - // bindings - connections: DurableObjectNamespace; - tunnelIds: KVNamespace; -} - -export default { - async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise { - const url = new URL(request.url); - const route = routeUrl(url, env); - - switch (route.type) { - case 'management': { - return handleManagementRequest(request, env, ctx); - } - case 'tunnel': { - console.log(`Handling tunnel request for ${route.name}`); - - const id = await env.tunnelIds.get(route.name); - - if (!id) { - return new Response('Not Found', { status: 404 }); - } - - const tunnel = env.connections.get(env.connections.idFromString(id)); - return tunnel.fetch(request); - } - case 'not_found': { - return new Response('Not Found', { status: 404 }); - } - } - - return new Response('Not Found', { status: 404 }); - }, -}; - -type RouteDecision = - | { - type: 'management'; - } - | { - type: 'tunnel'; - name: string; - } - | { type: 'not_found' }; - -function routeUrl(url: URL, env: Env): RouteDecision { - const searchParams = new URLSearchParams(url.search); - - if (searchParams.has('t')) { - const name = searchParams.get('t'); - - if (name) { - return { type: 'tunnel', name }; - } - - return { type: 'management' }; - } - - if (!url.host.includes(env.WORKER_HOST)) { - return { type: 'not_found' }; - } - - const parts = url.host.split('.'); - - if (parts.length === 2) { - return { type: 'management' }; - } - - const tunnelName = parts[0]; - - if (tunnelName === 'admin') { - return { type: 'management' }; - } - - if (parts.length === 3) { - return { type: 'tunnel', name: parts[0] }; - } - - return { type: 'not_found' }; -} - -async function handleManagementRequest(request: Request, env: Env, ctx: ExecutionContext): Promise { - const authHeader = request.headers.get('authorization'); - if (!authHeader) { - return new Response('Authorization header is required', { status: 401 }); - } - - const authHeaderParts = authHeader.split(' '); - if (authHeaderParts.length !== 2) { - return new Response('Authorization header is invalid', { status: 401 }); - } - - const [authType, authKey] = authHeaderParts; - - if (authType !== 'Bearer') { - return new Response('Authorization header is invalid', { status: 401 }); - } - - if (authKey !== env.SECRET_KEY) { - return new Response('Authorization header is invalid', { status: 401 }); - } - - // Okay now we can actually handle the request - // We need to look at the path and see what we are doing - // POST /api/tunnels -> create a new tunnel - const url = new URL(request.url); - - if (url.pathname === '/api/tunnels' && request.method === 'POST') { - return handleCreateTunnel(request, env, ctx); - } - - return new Response('Not Found', { status: 404 }); -} - -async function handleCreateTunnel(request: Request, env: Env, ctx: ExecutionContext): Promise { - const tunnelId = env.connections.newUniqueId(); - const tunnelName = crypto.randomUUID(); - - await env.tunnelIds.put(tunnelName, tunnelId.toString()); - - return new Response(JSON.stringify({ id: tunnelName }), { status: 201 }); -} - -type Resolver = { - resolve: (value: T) => void; - reject: (error: Error) => void; -}; - -export class YaltConnection implements DurableObject { - private socket?: WebSocket; - private responseResolvers: Record> = {}; - - constructor( - private state: DurableObjectState, - private env: Env, - ) {} - - async fetch(request: Request>): Promise { - const url = new URL(request.url); - - switch (url.pathname) { - case '/connect': { - console.log(`Handling connect request`); - - // This is a request from the client to connect to the tunnel - if (request.headers.get('Upgrade') !== 'websocket') { - return new Response('expected websocket', { status: 400 }); - } - - const pair = new WebSocketPair(); - const [clientSocket, serverSocket] = Object.values(pair); - - await this.handleSocket(serverSocket); - - console.log(`Successfully connected to tunnel`); - - return new Response(null, { status: 101, webSocket: clientSocket }); - } - case '/api/trigger': { - return this.handleTunnelRequest(request); - } - default: { - return new Response('Not Found', { status: 404 }); - } - } - } - - private async handleSocket(socket: WebSocket) { - if (this.socket) { - this.socket.close(1000, 'replaced'); - } - - this.socket = socket; - - this.socket.addEventListener('message', (event) => { - // Here we need to listen for "response" messages from the client and send them to the server via stored promises on this object - const data = JSON.parse(typeof event.data === 'string' ? event.data : new TextDecoder('utf-8').decode(event.data)); - - const message = ClientMessages.safeParse(data); - - if (!message.success) { - console.error(message.error); - return; - } - - switch (message.data.type) { - case 'response': { - const { id, ...response } = message.data; - - const resolver = this.responseResolvers[id]; - - if (!resolver) { - console.error(`No resolver found for ${id}`); - return; - } - - delete this.responseResolvers[id]; - - resolver.resolve( - new Response(response.body, { - status: response.status, - headers: response.headers, - }), - ); - - break; - } - } - }); - - this.socket.accept(); - } - - private async handleTunnelRequest(request: Request): Promise { - if (!this.socket) { - return createErrorResponse(); - } - - if (this.socket.readyState !== WebSocket.READY_STATE_OPEN) { - return createErrorResponse(); - } - - const id = crypto.randomUUID(); - - const promise = new Promise((resolve, reject) => { - this.responseResolvers[id] = { resolve, reject }; - }); - - try { - const message = await createRequestMessage(id, request); - this.socket.send(JSON.stringify(message)); - } catch (error) { - console.error(error); - delete this.responseResolvers[id]; - - return createErrorResponse(); - } - - return promise; - } -} - -const createErrorResponse = () => - new Response( - JSON.stringify({ - message: 'Could not connect to your dev server. Make sure you are running the `npx @trigger.dev/cli@latest dev` command', - }), - { - status: 400, - headers: { 'Content-Type': 'application/json' }, - }, - ); diff --git a/apps/yalt/tsconfig.json b/apps/yalt/tsconfig.json deleted file mode 100644 index 745718722..000000000 --- a/apps/yalt/tsconfig.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Projects */ - // "incremental": true, /* Enable incremental compilation */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ - // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ - // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ - // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ - - /* Language and Environment */ - "target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, - "lib": ["es2021"] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, - "jsx": "react" /* Specify what JSX code is generated. */, - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ - // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */ - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ - // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */ - // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - - /* Modules */ - "module": "es2022" /* Specify what module code is generated. */, - // "rootDir": "./", /* Specify the root folder within your source files. */ - "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */, - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ - "types": [ - "@cloudflare/workers-types/2023-07-01" - ] /* Specify type package names to be included without being referenced in a source file. */, - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - "resolveJsonModule": true /* Enable importing .json files */, - // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ - - /* JavaScript Support */ - "allowJs": true /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */, - "checkJs": false /* Enable error reporting in type-checked JavaScript files. */, - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ - - /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ - // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ - // "outDir": "./", /* Specify an output folder for all emitted files. */ - // "removeComments": true, /* Disable emitting comments. */ - "noEmit": true /* Disable emitting files from a compilation. */, - // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ - // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ - // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Set the newline character for emitting files. */ - // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */ - // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */ - // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ - // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ - // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ - - /* Interop Constraints */ - "isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */, - "allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */, - // "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */, - // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, - - /* Type Checking */ - "strict": true /* Enable all strict type-checking options. */, - // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ - // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ - // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ - // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */ - // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ - // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */ - // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ - // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ - // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */ - // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */ - // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ - // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ - // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ - // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ - // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */, - "paths": { - "@trigger.dev/yalt": ["../../packages/yalt/src/index"], - "@trigger.dev/yalt/*": ["../../packages/yalt/src/*"] - } - } -} diff --git a/apps/yalt/wrangler.toml b/apps/yalt/wrangler.toml deleted file mode 100644 index ed2591dcd..000000000 --- a/apps/yalt/wrangler.toml +++ /dev/null @@ -1,25 +0,0 @@ -name = "yalt" -main = "src/index.ts" -compatibility_date = "2023-12-06" -workers_dev = false -logpush = true - -routes = [ - { pattern = "*.yalt.dev/*", zone_name = "yalt.dev" }, - { pattern = "yalt.dev/*", zone_name = "yalt.dev" }, -] - -[vars] -WORKER_HOST = "yalt.dev" - -[[kv_namespaces]] -binding = "tunnelIds" -id = "e8cf1fcc9ad34fa0819694d86afa97ca" - -[[durable_objects.bindings]] -name = "connections" -class_name = "YaltConnection" - -[[migrations]] -tag = "v1" -new_classes = ["YaltConnection"] diff --git a/config-packages/eslint-config-custom/index.js b/config-packages/eslint-config-custom/index.js deleted file mode 100644 index b4006d63b..000000000 --- a/config-packages/eslint-config-custom/index.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - extends: ["turbo", "prettier"], - settings: { - react: { - version: "detect", - }, - }, -}; diff --git a/config-packages/eslint-config-custom/package.json b/config-packages/eslint-config-custom/package.json deleted file mode 100644 index 548197001..000000000 --- a/config-packages/eslint-config-custom/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "eslint-config-custom", - "version": "0.0.0", - "private": true, - "license": "MIT", - "main": "index.js", - "devDependencies": { - "eslint": "^8.24.0", - "eslint-config-prettier": "^8.3.0", - "eslint-config-turbo": "latest", - "eslint-plugin-react": "7.31.8", - "typescript": "^4.8.4" - }, - "publishConfig": { - "access": "public" - } -} diff --git a/config-packages/tsconfig/base.json b/config-packages/tsconfig/base.json deleted file mode 100644 index 858021ed8..000000000 --- a/config-packages/tsconfig/base.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/tsconfig", - "display": "Default", - "compilerOptions": { - "composite": false, - "declaration": true, - "declarationMap": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "inlineSources": false, - "isolatedModules": true, - "moduleResolution": "node", - "noUnusedLocals": false, - "noUnusedParameters": false, - "preserveWatchOutput": true, - "skipLibCheck": true, - "strict": true, - "experimentalDecorators": true, - "emitDecoratorMetadata": true, - "sourceMap": true, - "resolveJsonModule": true - }, - "exclude": ["node_modules", "**/*/lib", "**/*/dist"], - "references": [{ "path": "../utils/" }] -} diff --git a/config-packages/tsconfig/examples.json b/config-packages/tsconfig/examples.json deleted file mode 100644 index c6de5a931..000000000 --- a/config-packages/tsconfig/examples.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/tsconfig", - "display": "Workflow example", - "extends": "./base.json", - "compilerOptions": { - "module": "commonjs", - "target": "ES2021", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "experimentalDecorators": true, - "emitDecoratorMetadata": true, - "lib": ["esnext", "dom"], - "outDir": "lib", - "moduleResolution": "node", - "paths": { - "@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"], - "@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"], - "@trigger.dev/github": ["../../integrations/github/src/index"], - "@trigger.dev/github/*": ["../../integrations/github/src/*"] - } - } -} diff --git a/config-packages/tsconfig/integration.json b/config-packages/tsconfig/integration.json deleted file mode 100644 index d01231271..000000000 --- a/config-packages/tsconfig/integration.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "extends": "./node18.json", - "compilerOptions": { - "lib": [ - "DOM", - "DOM.Iterable", - "ES2019" - ], - "paths": { - "@trigger.dev/tsup/*": [ - "../../config-packages/tsup/src/*" - ], - "@trigger.dev/tsup": [ - "../../config-packages/tsup/src/index" - ], - "@trigger.dev/sdk/*": [ - "../../packages/trigger-sdk/src/*" - ], - "@trigger.dev/sdk": [ - "../../packages/trigger-sdk/src/index" - ], - "@trigger.dev/integration-kit/*": [ - "../../packages/integration-kit/src/*" - ], - "@trigger.dev/integration-kit": [ - "../../packages/integration-kit/src/index" - ] - }, - "declaration": false, - "declarationMap": false, - "baseUrl": ".", - "stripInternal": true - }, - "exclude": [ - "node_modules" - ] -} \ No newline at end of file diff --git a/config-packages/tsconfig/nextjs.json b/config-packages/tsconfig/nextjs.json deleted file mode 100644 index 91cd404f7..000000000 --- a/config-packages/tsconfig/nextjs.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/tsconfig", - "display": "Next.js", - "extends": "./base.json", - "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": false, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "incremental": true, - "esModuleInterop": true, - "module": "esnext", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "preserve" - }, - "include": ["src", "next-env.d.ts"], - "exclude": ["node_modules"] -} diff --git a/config-packages/tsconfig/node18.json b/config-packages/tsconfig/node18.json deleted file mode 100644 index 04423c7a1..000000000 --- a/config-packages/tsconfig/node18.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/tsconfig", - "display": "Node 18", - "extends": "./base.json", - "compilerOptions": { - "lib": ["ES2021"], - "module": "commonjs", - "target": "ES2021", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true - } -} diff --git a/config-packages/tsconfig/package.json b/config-packages/tsconfig/package.json deleted file mode 100644 index dde64db1d..000000000 --- a/config-packages/tsconfig/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "@trigger.dev/tsconfig", - "version": "0.0.0", - "private": true, - "license": "MIT", - "publishConfig": { - "access": "public" - } -} \ No newline at end of file diff --git a/config-packages/tsconfig/react-library.json b/config-packages/tsconfig/react-library.json deleted file mode 100644 index 6d6a7fea9..000000000 --- a/config-packages/tsconfig/react-library.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/tsconfig", - "display": "React Library", - "extends": "./base.json", - "compilerOptions": { - "lib": ["ES2015"], - "module": "ESNext", - "target": "ES6", - "jsx": "react-jsx" - } -} diff --git a/config-packages/tsup/package.json b/config-packages/tsup/package.json deleted file mode 100644 index a54939e7f..000000000 --- a/config-packages/tsup/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "@trigger.dev/tsup", - "version": "0.0.0", - "private": true, - "license": "MIT", - "main": "./src/index.ts", - "types": "./src/index.ts", - "dependencies": { - "esbuild": "^0.19.11", - "tsup": "^8.0.1" - }, - "devDependencies": { - "@types/node": "18", - "typescript": "^5.3.0" - }, - "engines": { - "node": ">=18.0.0" - } -} \ No newline at end of file diff --git a/config-packages/tsup/src/index.ts b/config-packages/tsup/src/index.ts deleted file mode 100644 index a28a5c2fd..000000000 --- a/config-packages/tsup/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { defineConfig } from "tsup"; -export { deepMergeOptions } from "./utils"; -export { options as integrationOptions } from "./integration"; -export { options as packageOptions, defineConfig as defineConfigPackage } from "./package"; diff --git a/config-packages/tsup/src/integration.ts b/config-packages/tsup/src/integration.ts deleted file mode 100644 index 0fb2a3d7d..000000000 --- a/config-packages/tsup/src/integration.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Options, defineConfig } from "tsup"; - -export const options: Options = { - name: "main", - entry: ["./src/index.ts"], - outDir: "./dist", - platform: "node", - format: ["cjs"], - legacyOutput: true, - sourcemap: true, - clean: true, - bundle: true, - splitting: false, - dts: true, - treeshake: { - preset: "smallest", - }, - esbuildPlugins: [], - external: ["http", "https", "util", "events", "tty", "os", "timers"], -}; - -export default defineConfig(options); diff --git a/config-packages/tsup/src/package.ts b/config-packages/tsup/src/package.ts deleted file mode 100644 index eb2a0734a..000000000 --- a/config-packages/tsup/src/package.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Plugin } from "esbuild"; -import { Options, defineConfig as defineConfigTSUP } from "tsup"; - -const restoreNodeProtocolPlugin = (): Plugin => { - return { - name: "node-protocol-plugin-restorer", - setup(build) { - build.onResolve( - { - filter: /node:/, - }, - async (args) => { - return { path: args.path, external: true }; - } - ); - }, - }; -}; - -export const options: Options = { - name: "main", - config: "tsconfig.json", - entry: ["./src/index.ts"], - outDir: "./dist", - platform: "node", - format: ["cjs", "esm"], - legacyOutput: false, - sourcemap: true, - clean: true, - bundle: true, - splitting: false, - dts: true, - treeshake: { - preset: "recommended", - }, - esbuildPlugins: [restoreNodeProtocolPlugin()], -}; - -export const defineConfig = defineConfigTSUP(options); diff --git a/config-packages/tsup/src/utils.ts b/config-packages/tsup/src/utils.ts deleted file mode 100644 index 6e46ff742..000000000 --- a/config-packages/tsup/src/utils.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Options } from "tsup"; - -export const deepMergeOptions = deepMergeRecords; - -function deepMergeRecords>(...options: TRecord[]): TRecord { - const result = {} as TRecord; - - for (const option of options) { - for (const key in option) { - if (option.hasOwnProperty(key)) { - const optionValue = option[key]; - const existingValue = result[key]; - - if ( - existingValue && - typeof existingValue === "object" && - typeof optionValue === "object" && - !Array.isArray(existingValue) && - !Array.isArray(optionValue) && - existingValue !== null && - optionValue !== null - ) { - result[key] = deepMergeRecords(existingValue, optionValue); - } else { - result[key] = optionValue; - } - } - } - } - - return result; -} diff --git a/docker/Dockerfile b/docker/Dockerfile index adab2301f..0b5833c11 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -40,8 +40,6 @@ FROM base AS builder WORKDIR /triggerdotdev # Corepack is used to install pnpm RUN corepack enable -# Install protobuf compiler -RUN apt-get update && apt-get install -y protobuf-compiler COPY --from=pruner --chown=node:node /triggerdotdev/out/full/ . COPY --from=dev-deps --chown=node:node /triggerdotdev/ . @@ -49,6 +47,8 @@ COPY --chown=node:node turbo.json turbo.json COPY --chown=node:node docker/scripts ./scripts RUN chmod +x ./scripts/wait-for-it.sh RUN chmod +x ./scripts/entrypoint.sh +COPY --chown=node:node .configs/tsconfig.base.json .configs/tsconfig.base.json +COPY --chown=node:node scripts/updateVersion.ts scripts/updateVersion.ts RUN pnpm run generate RUN pnpm run build --filter=webapp... diff --git a/docs/guides/new-build-system-preview.mdx b/docs/guides/new-build-system-preview.mdx new file mode 100644 index 000000000..fad85bdf6 --- /dev/null +++ b/docs/guides/new-build-system-preview.mdx @@ -0,0 +1,251 @@ +--- +title: "Upgrade to new build system" +description: "How to use the new build system preview release" +--- + +Based on feedback and a steady flow of issues from our previous build system, we're happy to share with you a preview release of our new build system that (hopefully) fixes most of the issues you may have faced. + +The main features of the new build sytem are: + +- **Bundling by default**: All dependencies are bundled by default, so you no longer need to specify which dependencies to bundle. This solves a whole bunch of issues related to monorepos. +- **Build extensions**: A new way to extend the build process with custom logic. This is a more flexible and powerful way to extend the build process compared to the old system. (including custom esbuild plugin support) +- **Improved configuration**: We've migrated to using [c12](https://github.com/unjs/c12) to power our configuration system. +- **Improved error handling**: We now do a much better job of reporting of any errors that happen during the indexing process by loading your trigger task files dynamically. +- **Improved cold start times**: Previously, we would load all your trigger task files at once, which could lead to long cold start times. Now we load your trigger task files dynamically, which should improve cold start times. + +## Update packages + +To use the new build system, you have to update to use our preview packages. Update the `@trigger.dev/sdk` package in your package.json: + +```json +"@trigger.dev/sdk": "https://pkg.pr.new/triggerdotdev/trigger.dev/@trigger.dev/sdk@1265" +``` + +You will also need to update your usage of the `trigger.dev` CLI to use the preview release. If you run the CLI via `npx` you can update to the preview release like so: + +```sh +# old way +npx trigger.dev@beta dev + +# using the preview release +npx https://pkg.pr.new/triggerdotdev/trigger.dev@1265 dev +``` + +If you've added the `trigger.dev` CLI to your `devDependencies`, then you should update the version to point to the preview release: + +```json +"trigger.dev": "https://pkg.pr.new/triggerdotdev/trigger.dev@1265" +``` + +Once you do that make sure you re-install your dependencies using `npm i` or the equivalent with your preferred package manager. + +## Update your `trigger.config.ts` + +The new build system does not effect your trigger task files at all, so those can remain unchanged. However, you may need to make changes to your `trigger.config.ts` file. + +### `defineConfig` + +You should now import the `defineConfig` function from `@trigger.dev/sdk/v3` and export the config as the default export: + +``` +import { defineConfig } from "@trigger.dev/sdk/v3"; + +export default defineConfig({ + project: "", +}); +``` + +### Deprecated: `dependenciesToBundle` + +The new build system will bundle all dependencies by default, so `dependenciesToBundle` no longer makes any sense and can be removed. + +#### Externals + +Now that all dependencies are bundled, there are some situations where bundling a dependency doesn't work, and needs to be made external (e.g. when a dependency includes a native module). You can now specify these dependencies as build externals in the `defineConfig` function: + +```ts +import { defineConfig } from "@trigger.dev/sdk/v3"; + +export default defineConfig({ + project: "", + build: { + externals: ["native-module"], + }, +}); +``` + +`externals` is an array of strings, where each string is the name of a dependency that should be made external. Glob expressions are also supported and use the [minimatch](https://github.com/isaacs/minimatch) matcher. + +### `additionalFiles` + +The `additionalFiles` option has been moved to our new build extension system. + +To use build extensions, you'll need to add the `@trigger.dev/build` package to your `devDependencies`: + +```sh +npm add https://pkg.pr.new/triggerdotdev/trigger.dev/@trigger.dev/build@1265 -D +``` + +Now you can import the `additionalFiles` build extension and use it in your `trigger.config.ts` file: + +```ts +import { defineConfig } from "@trigger.dev/sdk/v3"; +import { additionalFiles } from "@trigger.dev/build/extensions/core"; + +export default defineConfig({ + project: "", + build: { + extensions: [ + additionalFiles({ files: ["wrangler/wrangler.toml", "./assets/**", "./fonts/**"] }), + ], + }, +}); +``` + +### `additionalPackages` + +The `additionalPackages` option has been moved to our new build extension system. + +To use build extensions, you'll need to add the `@trigger.dev/build` package to your `devDependencies`: + +```sh +npm add https://pkg.pr.new/triggerdotdev/trigger.dev/@trigger.dev/build@1265 -D +``` + +Now you can import the `additionalPackages` build extension and use it in your `trigger.config.ts` file: + +```ts +import { defineConfig } from "@trigger.dev/sdk/v3"; +import { additionalPackages } from "@trigger.dev/build/extensions/core"; + +export default defineConfig({ + project: "", + build: { + extensions: [additionalPackages({ packages: ["wrangler"] })], + }, +}); +``` + +### `resolveEnvVars` + +The `resolveEnvVars` export has been moved to our new build extension system. + +To use build extensions, you'll need to add the `@trigger.dev/build` package to your `devDependencies`: + +```sh +npm add https://pkg.pr.new/triggerdotdev/trigger.dev/@trigger.dev/build@1265 -D +``` + +Now you can import the `syncEnvVars` build extension and use it in your `trigger.config.ts` file: + +```ts +import { defineConfig } from "@trigger.dev/sdk/v3"; +import { syncEnvVars } from "@trigger.dev/build/extensions/core"; + +export default defineConfig({ + project: "", + build: { + extensions: [ + syncEnvVars(async (params) => { + return { + MY_ENV_VAR: "my-value", + }; + }), + ], + }, +}); +``` + +The `syncEnvVars` callback function works very similarly to the [`resolveEnvVars`](/deploy-environment-variables#sync-env-vars-from-another-service) callback, but now instead of returning an object with a `variables` key that contains the environment variables, you return an object with the environment variables directly (see the example above). + +One other difference is now `params.env` only contains the environment variables that are set in the Trigger.dev environment variables, and not the environment variables from the process. If you want to access the environment variables from the process, you can use `process.env`. + +### emitDecoratorMetadata + +If you make use of decorators in your code, and have enabled the `emitDecoratorMetadata` tsconfig compiler option, you'll need to enable this in the new build sytem using the `emitDecoratorMetadata` build extension: + +```ts +import { defineConfig } from "@trigger.dev/sdk/v3"; +import { emitDecoratorMetadata } from "@trigger.dev/build/extensions/typescript"; + +export default defineConfig({ + project: "", + build: { + extensions: [emitDecoratorMetadata()], + }, +}); +``` + +### Prisma + +We've created a build extension to support using Prisma in your Trigger.dev tasks. To use this extension, you'll need to add the `@trigger.dev/build` package to your `devDependencies`: + +```sh +npm add https://pkg.pr.new/triggerdotdev/trigger.dev/@trigger.dev/build@1265 -D +``` + +Then you can import the `prismaExtension` build extension and use it in your `trigger.config.ts` file, passing in the path to your Prisma schema file: + +```ts +import { defineConfig } from "@trigger.dev/sdk/v3"; +import { prismaExtension } from "@trigger.dev/build/extensions/prisma"; + +export default defineConfig({ + project: "", + build: { + extensions: [ + prismaExtension({ + schema: "prisma/schema.prisma", + }), + ], + }, +}); +``` + +This will make sure that your prisma client is generated during the build process when deploying to Trigger.dev. + + + This does not have any effect when running the `dev` command, so you'll need to make sure you + generate your client locally first. + + +If you want to also run migrations during the build process, you can pass in the `migrate` option: + +```ts +import { defineConfig } from "@trigger.dev/sdk/v3"; +import { prismaExtension } from "@trigger.dev/build/extensions/prisma"; + +export default defineConfig({ + project: "", + build: { + extensions: [ + prismaExtension({ + schema: "prisma/schema.prisma", + migrate: true, + directUrlEnvVarName: "DATABASE_URL_UNPOOLED", // optional - the name of the environment variable that contains the direct database URL if you are using a direct database URL + }), + ], + }, +}); +``` + +### audioWaveform + +Previously, we installed [Audio Waveform](https://github.com/bbc/audiowaveform) in the build image. That's been moved to a build extension: + +```ts +import { defineConfig } from "@trigger.dev/sdk/v3"; +import { audioWaveform } from "@trigger.dev/build/extensions/audioWaveform"; + +export default defineConfig({ + project: "", + build: { + extensions: [audioWaveform()], // uses verson 1.1.0 of audiowaveform by default + }, +}); +``` + +## Known issues + +- Path aliases are not yet support in your `trigger.config.ts` file. To workaround this issue you'll need to rewrite path aliases to their relative paths. (See [this](https://github.com/unjs/jiti/issues/166) and [this](https://knip.dev/reference/known-issues#path-aliases-in-config-files)) for more info. +- Some events in the run trace view may get permanently stuck in a loading state. This is a known issue and we're working on a fix. diff --git a/experiments/context.ts b/experiments/context.ts deleted file mode 100644 index 3b723f873..000000000 --- a/experiments/context.ts +++ /dev/null @@ -1,604 +0,0 @@ -import { z } from "zod"; -import * as v from "valibot"; -import { wrap } from "@typeschema/valibot"; - -export type ParserZodEsque = { - _input: TInput; - _output: TParsedInput; -}; - -export type ParserMyZodEsque = { - parse: (input: any) => TInput; -}; - -export type ParserSuperstructEsque = { - create: (input: unknown) => TInput; -}; - -export type ParserCustomValidatorEsque = (input: unknown) => Promise | TInput; - -export type ParserYupEsque = { - validateSync: (input: unknown) => TInput; -}; - -export type ParserScaleEsque = { - assert(value: unknown): asserts value is TInput; -}; - -export type ParserWithoutInput = - | ParserCustomValidatorEsque - | ParserMyZodEsque - | ParserScaleEsque - | ParserSuperstructEsque - | ParserYupEsque; - -export type ParserWithInputOutput = ParserZodEsque; - -export type Parser = ParserWithInputOutput | ParserWithoutInput; - -export type inferParser = TParser extends ParserWithInputOutput< - infer $TIn, - infer $TOut -> - ? { - in: $TIn; - out: $TOut; - } - : TParser extends ParserWithoutInput - ? { - in: $InOut; - out: $InOut; - } - : never; - -export type Simplify = TType extends any[] | Date ? TType : { [K in keyof TType]: TType[K] }; - -export type TriggerResult = { - id: string; -}; - -export type TaskRunResult = - | { - ok: true; - id: string; - output: TOutput; - } - | { - ok: false; - id: string; - error: unknown; - }; - -export type RunMetadata = { - run: string; -}; - -export type inferContext = - TContextBuilder extends ContextBuilder - ? TContext extends UnsetMarker - ? unknown - : TContextOverrides extends UnsetMarker - ? Simplify - : Simplify> - : never; - -export type RunFnParams = { - /** Metadata about the task, run, attempt, queue, environment, organization, project and batch. */ - meta: RunMetadata; - - /** Context added by task middleware */ - ctx: inferContext; - - payload: TPayload; -}; - -/** - * See https://github.com/microsoft/TypeScript/issues/41966#issuecomment-758187996 - * Fixes issues with iterating over keys of objects with index signatures. - * Without this, iterations over keys of objects with index signatures will lose - * type information about the keys and only the index signature will remain. - * @internal - */ -export type WithoutIndexSignature = { - [K in keyof TObj as string extends K ? never : number extends K ? never : K]: TObj[K]; -}; - -/** - * @internal - * Overwrite properties in `TType` with properties in `TWith` - * Only overwrites properties when the type to be overwritten - * is an object. Otherwise it will just use the type from `TWith`. - */ -export type Overwrite = TWith extends any - ? TType extends object - ? { - [K in - | keyof WithoutIndexSignature - | keyof WithoutIndexSignature]: K extends keyof TWith // Exclude index signature from keys - ? TWith[K] - : K extends keyof TType - ? TType[K] - : never; - } & (string extends keyof TWith // Handle cases with an index signature - ? { [key: string]: TWith[string] } - : number extends keyof TWith - ? { [key: number]: TWith[number] } - : // eslint-disable-next-line @typescript-eslint/ban-types - {}) - : TWith - : never; - -/** @internal */ -export const contextMiddlewareMarker = "contextMiddlewareMarker" as "contextMiddlewareMarker" & { - __brand: "contextMiddlewareMarker"; -}; -type ContextMiddlewareMarker = typeof contextMiddlewareMarker; - -interface ContextMiddlewareResultBase { - /** - * All middlewares should pass through their `next()`'s output. - * Requiring this marker makes sure that can't be forgotten at compile-time. - */ - readonly marker: ContextMiddlewareMarker; -} - -interface ContextMiddlewareOKResult<_TContextOverride> extends ContextMiddlewareResultBase { - ok: true; - data: unknown; -} - -interface ContextMiddlewareErrorResult<_TContextOverride> extends ContextMiddlewareResultBase { - ok: false; - error: Error; // should be our error -} - -/** - * @internal - */ -export type ContextMiddlewareResult<_TContextOverride> = - | ContextMiddlewareErrorResult<_TContextOverride> - | ContextMiddlewareOKResult<_TContextOverride>; - -export type ContextMiddlewareFunction = { - (opts: { - ctx: Simplify>; - meta: RunMetadata; - next: { - (): Promise>; - <$ContextOverride>(ctx: $ContextOverride): Promise>; - }; - }): Promise>; -}; - -export const unsetMarker = Symbol("unsetMarker"); -export type UnsetMarker = typeof unsetMarker; - -export interface ContextBuilder { - use<$ContextOverridesOut>( - fn: ContextMiddlewareFunction - ): ContextBuilder>; -} - -export type AnyContextBuilder = ContextBuilder; - -export function createContext( - initialContext?: TContext -): ContextBuilder { - const builder: AnyContextBuilder = { - use(middlewareFn) { - return {} as AnyContextBuilder; - }, - }; - - return builder; -} - -const contextBuilder = createContext({ foo: "bar" }); -const context = contextBuilder - .use((opts) => { - return opts.next({ - baz: "whatever", - }); - }) - .use((opts) => { - return opts.next({ - db: { - find: async (id: string) => { - return "hello"; - }, - }, - }); - }); - -type ctx = inferContext; - -const contextBuilder2 = createContext(); - -type ctx2 = inferContext; - -const contextBuilder3 = createContext({ bar: "baz" }); - -type ctx3 = inferContext; - -const contextBuilder4 = createContext().use((opts) => { - return opts.next({ - hello: "world", - }); -}); - -type ctx4 = inferContext; - -export type TaskOptions< - TOutput, - TContext extends AnyContextBuilder, - TIdentifier extends string, - TParser extends Parser | undefined = undefined, -> = { - /** An id for your task. This must be unique inside your project and not change between versions. */ - id: TIdentifier; - - schema?: TParser; - - context?: TContext; - - /** This gets called when a task is triggered. It's where you put the code you want to execute. - * - * @param payload - The payload that is passed to your task when it's triggered. This must be JSON serializable. - * @param params - Metadata about the run. - */ - run: (params: Simplify, TContext>>) => Promise; -}; - -export interface Task< - TOutput, - TIdentifier extends string, - TParser extends Parser | undefined = undefined, -> { - /** - * The id of the task. - */ - id: TIdentifier; - /** - * Trigger a task with the given payload, and continue without waiting for the result. If you want to wait for the result, use `triggerAndWait`. Returns the id of the triggered task run. - * @param payload - * @param options - * @returns TriggerResult - * - `id` - The id of the triggered task run. - */ - trigger: ( - payload: Simplify>, - options?: TriggerTaskOptions - ) => Promise; - - /** - * Trigger a task with the given payload, and wait for the result. Returns the result of the task run - * @param payload - * @param options - Options for the task run - * @returns TaskRunResult - * @example - * ``` - * const result = await task.triggerAndWait({ foo: "bar" }); - * - * if (result.ok) { - * console.log(result.output); - * } else { - * console.error(result.error); - * } - * ``` - */ - triggerAndWait: ( - payload: Simplify>, - options?: TriggerTaskOptions - ) => Promise>; -} - -export type AnyTask = Task; - -type inferParserIn = TParser extends Parser - ? inferParser["in"] - : TDefault; -type inferParserOut = TParser extends Parser - ? inferParser["out"] - : TDefault; - -export type TaskPayloadIn = TTask extends Task - ? inferParserIn - : never; - -export type TaskPayloadOut = TTask extends Task - ? inferParserOut - : never; - -export type TaskOutput = TTask extends Task - ? TOutput - : never; - -export type TaskIdentifier = TTask extends Task - ? TIdentifier - : never; - -export type TaskTypes = TTask extends Task< - infer TOutput, - infer TIdentifier, - infer TParser -> - ? { - id: TIdentifier; - payloadIn: inferParserIn; - payloadOut: inferParserOut; - output: TOutput; - } - : never; - -export type TriggerTaskOptions = { - idempotencyKey?: string; - maxAttempts?: number; - startAt?: Date; - startAfter?: number; - concurrencyKey?: string; -}; - -export type Prettify = { - [K in keyof T]: T[K]; -} & {}; - -export function task< - TOutput, - TContext extends AnyContextBuilder, - TIdentifier extends string, - TParser extends Parser | undefined = undefined, ->( - options: TaskOptions -): Task { - return createTask(options); -} - -export function createTask< - TOutput, - TContext extends AnyContextBuilder, - TIndentifier extends string, - TParser extends Parser | undefined = undefined, ->( - params: TaskOptions -): Task { - const task: Task = { - id: params.id, - trigger: async (payload, options) => { - return { - id: "run_1234", - }; - }, - triggerAndWait: async (payload, options) => { - const output = await params.run({ - meta: { run: "run_1234" }, - payload: payload as unknown as inferParserOut, // Actually do the parsing - ctx: {} as inferContext, - }); - - return { - ok: true, - id: "run_1234", - output, - }; - }, - }; - - return task; -} - -export interface TaskLibraryRecord { - [key: string]: AnyTask | TaskLibraryRecord; -} - -export interface TaskLibrary { - _def: { record: TRecord }; -} - -export type AnyTaskLibrary = TaskLibrary; - -export type CreateTaskLibraryOptions = { - [key: string]: AnyTask | AnyTaskLibrary | CreateTaskLibraryOptions; -}; - -export type DecorateCreateTaskLibraryOptions = - { - [K in keyof TTaskLibraryOptions]: TTaskLibraryOptions[K] extends infer $Value - ? $Value extends AnyTask - ? $Value - : $Value extends TaskLibrary - ? TRecord - : $Value extends CreateTaskLibraryOptions - ? DecorateCreateTaskLibraryOptions<$Value> - : never - : never; - }; - -function taskLibrary( - input: TInput -): TaskLibrary>; -function taskLibrary(input: TInput): TaskLibrary; -function taskLibrary(input: TaskLibraryRecord | CreateTaskLibraryOptions) { - // TODO: reserved words - - return { - _def: { - record: input, - }, - }; -} - -// ======== client side -type DecorateTask = { - trigger: (id: TaskIdentifier, payload: TaskPayloadIn) => Promise<{ id: string }>; -}; - -type DecoratedTaskLibraryRecord< - TTaskLibrary extends AnyTaskLibrary, - TRecord extends TaskLibraryRecord, -> = { - [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value - ? $Value extends TaskLibraryRecord - ? DecoratedTaskLibraryRecord - : $Value extends AnyTask - ? DecorateTask<$Value> - : never - : never; -}; - -export type inferTaskLibraryClient = - DecoratedTaskLibraryRecord; - -export type CreateTriggerClient = { - lib: inferTaskLibraryClient; - runs: { - retrieve: (id: string) => Promise<{ status: boolean }>; - }; -}; - -export type CreateTriggerClientOptions = { - secretKey?: string; -}; - -export function createTriggerClient( - options?: CreateTriggerClientOptions -): CreateTriggerClient { - return {} as CreateTriggerClient; -} - -// trigger/my-tasks.ts -const taskOne = task({ - id: "task-1", - run: async () => { - const handle = await taskTwo.trigger({ url: "https://trigger.dev" }); - const result = await taskTwo.triggerAndWait({ url: "https://trigger.dev" }); - - return "foo-bar"; - }, -}); - -const taskTwo = task({ - id: "task-2", - async run(params) { - return { - hello: "world", - payload: params.payload.other, - }; - }, -}); - -const userTaskOne = task({ - id: "user/task-1", - context: contextBuilder4, - run: async (params) => { - return "foo-bar"; - }, -}); - -const userTaskTwo = task({ - id: "user/task-2", - context: contextBuilder3, - run: async (params) => { - return "foo-bar"; - }, -}); - -const zodTaskOne = task({ - id: "zod/task-1", - context: contextBuilder, - schema: z.object({ foo: z.string() }), - run: async (params) => {}, -}); - -const zodTaskTwo = task({ - id: "zod/task-2", - schema: z.object({ foo: z.string(), isAdmin: z.boolean().default(false) }), - context: contextBuilder2, - run: async (params) => { - console.log(params.payload.foo, params.meta.run); - }, -}); - -const valibotTaskOne = task({ - id: "valibot/task-1", - schema: wrap( - v.object({ - foo: v.string(), - }) - ), - run: async (params) => { - await zodTaskOne.trigger({ foo: "bar" }); - await zodTaskTwo.trigger({ foo: "bar" }); - - await valibotTaskTwo.trigger({ foo: "bar" }); - }, -}); - -const valibotTaskTwo = task({ - id: "valibot/task-2", - schema: wrap( - v.object({ - foo: v.string(), - isAdmin: v.optional(v.boolean(), true), - }) - ), - run: async (params) => { - await valibotTaskOne.trigger({ foo: "bar" }); - }, -}); - -// in trigger/lib.ts -const myTaskLibrary = taskLibrary({ - myTasks: { taskOne, taskTwo }, -}); - -const userTaskLibrary = taskLibrary({ - userTaskOne, - userTaskTwo, -}); - -const zodTaskLibrary = taskLibrary({ - zodTaskOne, - zodTaskTwo, -}); - -const valibotTaskLibrary = taskLibrary({ - valibotTaskOne, - valibotTaskTwo, -}); - -export const library = taskLibrary({ - foo: myTaskLibrary, - bar: userTaskLibrary, - zod: zodTaskLibrary, - valibot: valibotTaskLibrary, -}); - -// Export the library type -export type Library = typeof library; - -// Now on the client -const client = createTriggerClient({ - secretKey: "tr_dev_1234", -}); - -client.runs.retrieve("run_12343"); // Call regular API client calls - -// Tasks are now available under lib -client.lib.foo.myTasks.taskOne.trigger("task-1", { hello: "world" }); -client.lib.bar.userTaskOne.trigger("user/task-1", { userId: "user_123" }); -client.lib.bar.userTaskTwo.trigger("user/task-2", { - userId: "user_123", - isAdmin: true, -}); -client.lib.bar.userTaskTwo.trigger("user/task-2", { - userId: "user_123", - isAdmin: false, -}); -client.lib.zod.zodTaskOne.trigger("zod/task-1", { foo: "bar" }); -client.lib.zod.zodTaskTwo.trigger("zod/task-2", { foo: "bar" }); -client.lib.zod.zodTaskTwo.trigger("zod/task-2", { foo: "bar", isAdmin: false }); -client.lib.valibot.valibotTaskTwo.trigger("valibot/task-2", { foo: "bar" }); -client.lib.valibot.valibotTaskTwo.trigger("valibot/task-2", { - foo: "bar", - isAdmin: true, -}); diff --git a/experiments/with-generic-parser.ts b/experiments/with-generic-parser.ts deleted file mode 100644 index 19f50a176..000000000 --- a/experiments/with-generic-parser.ts +++ /dev/null @@ -1,444 +0,0 @@ -import { z } from "zod"; -import * as v from "valibot"; -import { wrap } from "@typeschema/valibot"; - -export type ParserZodEsque = { - _input: TInput; - _output: TParsedInput; -}; - -export type ParserMyZodEsque = { - parse: (input: any) => TInput; -}; - -export type ParserSuperstructEsque = { - create: (input: unknown) => TInput; -}; - -export type ParserCustomValidatorEsque = (input: unknown) => Promise | TInput; - -export type ParserYupEsque = { - validateSync: (input: unknown) => TInput; -}; - -export type ParserScaleEsque = { - assert(value: unknown): asserts value is TInput; -}; - -export type ParserWithoutInput = - | ParserCustomValidatorEsque - | ParserMyZodEsque - | ParserScaleEsque - | ParserSuperstructEsque - | ParserYupEsque; - -export type ParserWithInputOutput = ParserZodEsque; - -export type Parser = ParserWithInputOutput | ParserWithoutInput; - -export type inferParser = TParser extends ParserWithInputOutput< - infer $TIn, - infer $TOut -> - ? { - in: $TIn; - out: $TOut; - } - : TParser extends ParserWithoutInput - ? { - in: $InOut; - out: $InOut; - } - : never; - -export type Simplify = TType extends any[] | Date ? TType : { [K in keyof TType]: TType[K] }; - -export type TriggerResult = { - id: string; -}; - -export type TaskRunResult = - | { - ok: true; - id: string; - output: TOutput; - } - | { - ok: false; - id: string; - error: unknown; - }; - -export type RunMetadata = { - run: string; -}; - -export type RunFnParams = { - /** Metadata about the task, run, attempt, queue, environment, organization, project and batch. */ - meta: RunMetadata; - - /** Context added by task middleware */ - ctx: TContext; - - payload: TPayload; -}; - -export type TaskOptions< - TOutput, - TContext extends object, - TIdentifier extends string, - TParser extends Parser | undefined = undefined, -> = { - /** An id for your task. This must be unique inside your project and not change between versions. */ - id: TIdentifier; - - schema?: TParser; - - /** This gets called when a task is triggered. It's where you put the code you want to execute. - * - * @param payload - The payload that is passed to your task when it's triggered. This must be JSON serializable. - * @param params - Metadata about the run. - */ - run: (params: Simplify, TContext>>) => Promise; -}; - -export interface Task< - TOutput, - TIdentifier extends string, - TParser extends Parser | undefined = undefined, -> { - /** - * The id of the task. - */ - id: TIdentifier; - /** - * Trigger a task with the given payload, and continue without waiting for the result. If you want to wait for the result, use `triggerAndWait`. Returns the id of the triggered task run. - * @param payload - * @param options - * @returns TriggerResult - * - `id` - The id of the triggered task run. - */ - trigger: ( - payload: Simplify>, - options?: TriggerTaskOptions - ) => Promise; - - /** - * Trigger a task with the given payload, and wait for the result. Returns the result of the task run - * @param payload - * @param options - Options for the task run - * @returns TaskRunResult - * @example - * ``` - * const result = await task.triggerAndWait({ foo: "bar" }); - * - * if (result.ok) { - * console.log(result.output); - * } else { - * console.error(result.error); - * } - * ``` - */ - triggerAndWait: ( - payload: Simplify>, - options?: TriggerTaskOptions - ) => Promise>; -} - -export type AnyTask = Task; - -type inferParserIn = TParser extends Parser - ? inferParser["in"] - : TDefault; -type inferParserOut = TParser extends Parser - ? inferParser["out"] - : TDefault; - -export type TaskPayloadIn = TTask extends Task - ? inferParserIn - : never; - -export type TaskPayloadOut = TTask extends Task - ? inferParserOut - : never; - -export type TaskOutput = TTask extends Task - ? TOutput - : never; - -export type TaskIdentifier = TTask extends Task - ? TIdentifier - : never; - -export type TaskTypes = TTask extends Task< - infer TOutput, - infer TIdentifier, - infer TParser -> - ? { - id: TIdentifier; - payloadIn: inferParserIn; - payloadOut: inferParserOut; - output: TOutput; - } - : never; - -export type TriggerTaskOptions = { - idempotencyKey?: string; - maxAttempts?: number; - startAt?: Date; - startAfter?: number; - concurrencyKey?: string; -}; - -export type Prettify = { - [K in keyof T]: T[K]; -} & {}; - -export function task< - TOutput, - TContext extends object, - TIdentifier extends string, - TParser extends Parser | undefined = undefined, ->( - options: TaskOptions -): Task { - return createTask(options); -} - -export function createTask< - TOutput, - TContext extends object, - TIndentifier extends string, - TParser extends Parser | undefined = undefined, ->( - params: TaskOptions -): Task { - const task: Task = { - id: params.id, - trigger: async (payload, options) => { - return { - id: "run_1234", - }; - }, - triggerAndWait: async (payload, options) => { - const output = await params.run({ - meta: { run: "run_1234" }, - payload: payload as unknown as inferParserOut, // Actually do the parsing - ctx: {} as TContext, - }); - - return { - ok: true, - id: "run_1234", - output, - }; - }, - }; - - return task; -} - -export interface TaskLibraryRecord { - [key: string]: AnyTask | TaskLibraryRecord; -} - -export interface TaskLibrary { - _def: { record: TRecord }; -} - -export type AnyTaskLibrary = TaskLibrary; - -export type CreateTaskLibraryOptions = { - [key: string]: AnyTask | AnyTaskLibrary | CreateTaskLibraryOptions; -}; - -export type DecorateCreateTaskLibraryOptions = - { - [K in keyof TTaskLibraryOptions]: TTaskLibraryOptions[K] extends infer $Value - ? $Value extends AnyTask - ? $Value - : $Value extends TaskLibrary - ? TRecord - : $Value extends CreateTaskLibraryOptions - ? DecorateCreateTaskLibraryOptions<$Value> - : never - : never; - }; - -function taskLibrary( - input: TInput -): TaskLibrary>; -function taskLibrary(input: TInput): TaskLibrary; -function taskLibrary(input: TaskLibraryRecord | CreateTaskLibraryOptions) { - // TODO: reserved words - - return { - _def: { - record: input, - }, - }; -} - -// ======== client side -type DecorateTask = { - trigger: (id: TaskIdentifier, payload: TaskPayloadIn) => Promise<{ id: string }>; -}; - -type DecoratedTaskLibraryRecord< - TTaskLibrary extends AnyTaskLibrary, - TRecord extends TaskLibraryRecord, -> = { - [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value - ? $Value extends TaskLibraryRecord - ? DecoratedTaskLibraryRecord - : $Value extends AnyTask - ? DecorateTask<$Value> - : never - : never; -}; - -export type inferTaskLibraryClient = - DecoratedTaskLibraryRecord; - -export type CreateTriggerClient = { - lib: inferTaskLibraryClient; - runs: { - retrieve: (id: string) => Promise<{ status: boolean }>; - }; -}; - -export type CreateTriggerClientOptions = { - secretKey?: string; -}; - -export function createTriggerClient( - options?: CreateTriggerClientOptions -): CreateTriggerClient { - return {} as CreateTriggerClient; -} - -// trigger/my-tasks.ts -const taskOne = task({ - id: "task-1", - run: async () => { - const handle = await taskTwo.trigger({ url: "https://trigger.dev" }); - const result = await taskTwo.triggerAndWait({ url: "https://trigger.dev" }); - - return "foo-bar"; - }, -}); - -const taskTwo = task({ - id: "task-2", - async run(params) { - return { - hello: "world", - payload: params.payload.other, - }; - }, -}); - -const userTaskOne = task({ - id: "user/task-1", - run: async (params) => { - return "foo-bar"; - }, -}); - -const userTaskTwo = task({ - id: "user/task-2", - run: async (params) => { - return "foo-bar"; - }, -}); - -const zodTaskOne = task({ - id: "zod/task-1", - schema: z.object({ foo: z.string() }), - run: async (params) => {}, -}); - -const zodTaskTwo = task({ - id: "zod/task-2", - schema: z.object({ foo: z.string(), isAdmin: z.boolean().default(false) }), - run: async (params) => { - console.log(params.payload.foo, params.meta.run); - }, -}); - -const valibotTaskOne = task({ - id: "valibot/task-1", - schema: wrap( - v.object({ - foo: v.string(), - }) - ), - run: async (params) => { - await zodTaskOne.trigger({ foo: "bar" }); - await zodTaskTwo.trigger({ foo: "bar" }); - - await valibotTaskTwo.trigger({ foo: "bar" }); - }, -}); - -const valibotTaskTwo = task({ - id: "valibot/task-2", - schema: wrap( - v.object({ - foo: v.string(), - isAdmin: v.optional(v.boolean(), true), - }) - ), - run: async (params) => { - await valibotTaskOne.trigger({ foo: "bar" }); - }, -}); - -// in trigger/lib.ts -const myTaskLibrary = taskLibrary({ - myTasks: { taskOne, taskTwo }, -}); - -const userTaskLibrary = taskLibrary({ - userTaskOne, - userTaskTwo, -}); - -const zodTaskLibrary = taskLibrary({ - zodTaskOne, - zodTaskTwo, -}); - -const valibotTaskLibrary = taskLibrary({ - valibotTaskOne, - valibotTaskTwo, -}); - -export const library = taskLibrary({ - foo: myTaskLibrary, - bar: userTaskLibrary, - zod: zodTaskLibrary, - valibot: valibotTaskLibrary, -}); - -// Export the library type -export type Library = typeof library; - -// Now on the client -const client = createTriggerClient({ - secretKey: "tr_dev_1234", -}); - -client.runs.retrieve("run_12343"); // Call regular API client calls - -// Tasks are now available under lib -client.lib.foo.myTasks.taskOne.trigger("task-1", { hello: "world" }); -client.lib.bar.userTaskOne.trigger("user/task-1", { userId: "user_123" }); -client.lib.bar.userTaskTwo.trigger("user/task-2", { userId: "user_123", isAdmin: true }); -client.lib.bar.userTaskTwo.trigger("user/task-2", { userId: "user_123", isAdmin: false }); -client.lib.zod.zodTaskOne.trigger("zod/task-1", { foo: "bar" }); -client.lib.zod.zodTaskTwo.trigger("zod/task-2", { foo: "bar" }); -client.lib.zod.zodTaskTwo.trigger("zod/task-2", { foo: "bar", isAdmin: false }); -client.lib.valibot.valibotTaskTwo.trigger("valibot/task-2", { foo: "bar" }); -client.lib.valibot.valibotTaskTwo.trigger("valibot/task-2", { foo: "bar", isAdmin: true }); diff --git a/experiments/with-separate-zod-task.ts b/experiments/with-separate-zod-task.ts deleted file mode 100644 index 985111346..000000000 --- a/experiments/with-separate-zod-task.ts +++ /dev/null @@ -1,499 +0,0 @@ -import { z } from "zod"; -import * as v from "valibot"; - -export type ParserZodEsque = { - _input: TInput; - _output: TParsedInput; -}; - -export type ParserMyZodEsque = { - parse: (input: any) => TInput; -}; - -export type ParserSuperstructEsque = { - create: (input: unknown) => TInput; -}; - -export type ParserCustomValidatorEsque = (input: unknown) => Promise | TInput; - -export type ParserYupEsque = { - validateSync: (input: unknown) => TInput; -}; - -export type ParserScaleEsque = { - assert(value: unknown): asserts value is TInput; -}; - -export type ParserWithoutInput = - | ParserCustomValidatorEsque - | ParserMyZodEsque - | ParserScaleEsque - | ParserSuperstructEsque - | ParserYupEsque; - -export type ParserWithInputOutput = ParserZodEsque; - -export type Parser = ParserWithInputOutput | ParserWithoutInput; - -export type inferParser = TParser extends ParserWithInputOutput< - infer $TIn, - infer $TOut -> - ? { - in: $TIn; - out: $TOut; - } - : TParser extends ParserWithoutInput - ? { - in: $InOut; - out: $InOut; - } - : never; - -export type Simplify = TType extends any[] | Date ? TType : { [K in keyof TType]: TType[K] }; - -export type TriggerResult = { - id: string; -}; - -export type TaskRunResult = - | { - ok: true; - id: string; - output: TOutput; - } - | { - ok: false; - id: string; - error: unknown; - }; - -export type RunMetadata = { - run: string; -}; - -export type RunFnParams = { - /** Metadata about the task, run, attempt, queue, environment, organization, project and batch. */ - meta: RunMetadata; - - /** Context added by task middleware */ - ctx: TContext; - - payload: TPayload; -}; - -export type TaskOptions< - TPayloadIn, - TPayloadOut, - TOutput, - TContext extends object, - TIdentifier extends string, -> = { - /** An id for your task. This must be unique inside your project and not change between versions. */ - id: TIdentifier; - - schema?: Parser; - - /** This gets called when a task is triggered. It's where you put the code you want to execute. - * - * @param payload - The payload that is passed to your task when it's triggered. This must be JSON serializable. - * @param params - Metadata about the run. - */ - run: ( - params: Simplify, TContext>> - ) => Promise; -}; - -export interface Task { - /** - * The id of the task. - */ - id: TIdentifier; - /** - * Trigger a task with the given payload, and continue without waiting for the result. If you want to wait for the result, use `triggerAndWait`. Returns the id of the triggered task run. - * @param payload - * @param options - * @returns TriggerResult - * - `id` - The id of the triggered task run. - */ - trigger: ( - payload: Simplify>, - options?: TriggerTaskOptions - ) => Promise; - - /** - * Trigger a task with the given payload, and wait for the result. Returns the result of the task run - * @param payload - * @param options - Options for the task run - * @returns TaskRunResult - * @example - * ``` - * const result = await task.triggerAndWait({ foo: "bar" }); - * - * if (result.ok) { - * console.log(result.output); - * } else { - * console.error(result.error); - * } - * ``` - */ - triggerAndWait: ( - payload: Simplify>, - options?: TriggerTaskOptions - ) => Promise>; -} - -export type AnyTask = Task; - -type IsUnknown = unknown extends T ? (T extends unknown ? true : false) : false; -type NonUnknown = IsUnknown extends true ? never : T; - -export type inferTaskPayloadIn = NonUnknown extends never - ? TPayloadOut - : TPayloadIn; -export type inferTaskPayloadOut = NonUnknown extends never - ? TPayloadIn - : TPayloadOut; - -export type TaskPayloadIn = TTask extends Task< - infer TPayloadIn, - infer TPayloadOut, - any, - string -> - ? inferTaskPayloadIn - : never; - -export type TaskPayloadOut = TTask extends Task< - infer TPayloadIn, - infer TPayloadOut, - any, - string -> - ? inferTaskPayloadOut - : never; - -export type TaskOutput = TTask extends Task - ? TOutput - : never; - -export type TaskIdentifier = TTask extends Task< - any, - any, - any, - infer TIdentifier -> - ? TIdentifier - : never; - -export type TaskTypes = TTask extends Task< - infer TPayloadIn, - infer TPayloadOut, - infer TOutput, - infer TIdentifier -> - ? { - id: TIdentifier; - payloadIn: TPayloadIn; - payloadOut: TPayloadOut; - output: TOutput; - } - : never; - -export type TriggerTaskOptions = { - idempotencyKey?: string; - maxAttempts?: number; - startAt?: Date; - startAfter?: number; - concurrencyKey?: string; -}; - -export type Prettify = { - [K in keyof T]: T[K]; -} & {}; - -export function task< - TPayloadIn, - TPayloadOut, - TOutput, - TContext extends object, - TIdentifier extends string, ->( - options: TaskOptions -): Task { - return createTask(options); -} - -export function createTask< - TPayloadIn, - TPayloadOut, - TOutput, - TContext extends object, - TIndentifier extends string, ->( - params: TaskOptions -): Task { - const task: Task = { - id: params.id, - trigger: async (payload, options) => { - return { - id: "run_1234", - }; - }, - triggerAndWait: async (payload, options) => { - const output = await params.run({ - meta: { run: "run_1234" }, - payload: payload as unknown as inferTaskPayloadOut, - ctx: {} as TContext, - }); - - return { - ok: true, - id: "run_1234", - output, - }; - }, - }; - - return task; -} - -export type ZodTaskOptions< - TOutput, - TContext extends object, - TIdentifier extends string, - TSchema extends z.ZodTypeAny = z.ZodTypeAny, -> = { - schema: TSchema; -} & TaskOptions, z.output, TOutput, TContext, TIdentifier>; - -export function zodTask< - TOutput, - TContext extends object, - TIdentifier extends string, - TSchema extends z.ZodTypeAny = z.ZodTypeAny, ->( - options: ZodTaskOptions -): Task, z.output, TOutput, TIdentifier> { - return createTask, z.output, TOutput, TContext, TIdentifier>(options); -} - -export type ValibotTaskOptions< - TOutput, - TContext extends object, - TIdentifier extends string, - TSchema extends v.BaseSchema = v.AnySchema, -> = { - schema: TSchema; -} & TaskOptions, v.Output, TOutput, TContext, TIdentifier>; - -export function valibotTask< - TOutput, - TContext extends object, - TIdentifier extends string, - TSchema extends v.BaseSchema = v.AnySchema, ->( - options: ValibotTaskOptions -): Task, v.Output, TOutput, TIdentifier> { - return createTask, v.Output, TOutput, TContext, TIdentifier>(options); -} - -export interface TaskLibraryRecord { - [key: string]: AnyTask | TaskLibraryRecord; -} - -export interface TaskLibrary { - _def: { record: TRecord }; -} - -export type AnyTaskLibrary = TaskLibrary; - -export type CreateTaskLibraryOptions = { - [key: string]: AnyTask | AnyTaskLibrary | CreateTaskLibraryOptions; -}; - -export type DecorateCreateTaskLibraryOptions = - { - [K in keyof TTaskLibraryOptions]: TTaskLibraryOptions[K] extends infer $Value - ? $Value extends AnyTask - ? $Value - : $Value extends TaskLibrary - ? TRecord - : $Value extends CreateTaskLibraryOptions - ? DecorateCreateTaskLibraryOptions<$Value> - : never - : never; - }; - -function taskLibrary( - input: TInput -): TaskLibrary>; -function taskLibrary(input: TInput): TaskLibrary; -function taskLibrary(input: TaskLibraryRecord | CreateTaskLibraryOptions) { - // TODO: reserved words - - return { - _def: { - record: input, - }, - }; -} - -// ======== client side -type DecorateTask = { - trigger: (id: TaskIdentifier, payload: TaskPayloadIn) => Promise<{ id: string }>; -}; - -type DecoratedTaskLibraryRecord< - TTaskLibrary extends AnyTaskLibrary, - TRecord extends TaskLibraryRecord, -> = { - [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value - ? $Value extends TaskLibraryRecord - ? DecoratedTaskLibraryRecord - : $Value extends AnyTask - ? DecorateTask<$Value> - : never - : never; -}; - -export type inferTaskLibraryClient = - DecoratedTaskLibraryRecord; - -export type CreateTriggerClient = { - lib: inferTaskLibraryClient; - runs: { - retrieve: (id: string) => Promise<{ status: boolean }>; - }; -}; - -export type CreateTriggerClientOptions = { - secretKey?: string; -}; - -export function createTriggerClient( - options?: CreateTriggerClientOptions -): CreateTriggerClient { - return {} as CreateTriggerClient; -} - -// trigger/my-tasks.ts -const taskOne = task({ - id: "task-1", - run: async () => { - const handle = await taskTwo.trigger({ url: "https://trigger.dev" }); - const result = await taskTwo.triggerAndWait({ url: "https://trigger.dev" }); - - return "foo-bar"; - }, -}); - -const taskTwo = task({ - id: "task-2", - async run(params) { - return { - hello: "world", - payload: params.payload, - }; - }, -}); - -const userTaskOne = task({ - id: "user/task-1", - run: async (params: { payload: { userId: string } }) => { - return "foo-bar"; - }, -}); - -const userTaskTwo = task({ - id: "user/task-2", - run: async (params: { payload: { userId: string; isAdmin: boolean } }) => { - return "foo-bar"; - }, -}); - -const zodTaskOne = task({ - id: "zod/task-1", - schema: z.object({ foo: z.string() }), - run: async (params) => {}, -}); - -const zodTaskTwo = task({ - id: "zod/task-2", - schema: z.object({ foo: z.string(), isAdmin: z.boolean().default(false) }), - run: async (params) => { - console.log(params.payload.foo, params.meta.run); - }, -}); - -const valibotTaskOne = task({ - id: "valibot/task-1", - schema: v.object({ - foo: v.string(), - }), - run: async (params) => { - await zodTaskOne.trigger({ foo: "bar" }); - await zodTaskTwo.trigger({ foo: "bar" }); - - await valibotTaskTwo.trigger({ foo: "bar" }); - }, -}); - -const valibotTaskTwo = task({ - id: "valibot/task-2", - schema: v.object({ - foo: v.string(), - isAdmin: v.optional(v.boolean(), true), - }), - run: async (params) => { - await valibotTaskOne.trigger({ foo: "bar" }); - }, -}); - -// in trigger/lib.ts -const myTaskLibrary = taskLibrary({ - myTasks: { taskOne, taskTwo }, -}); - -const userTaskLibrary = taskLibrary({ - userTaskOne, - userTaskTwo, -}); - -const zodTaskLibrary = taskLibrary({ - zodTaskOne, - zodTaskTwo, -}); - -const valibotTaskLibrary = taskLibrary({ - valibotTaskOne, - valibotTaskTwo, -}); - -export const library = taskLibrary({ - foo: myTaskLibrary, - bar: userTaskLibrary, - zod: zodTaskLibrary, - valibot: valibotTaskLibrary, -}); - -// Export the library type -export type Library = typeof library; - -// Now on the client -const client = createTriggerClient({ - secretKey: "tr_dev_1234", -}); - -client.runs.retrieve("run_12343"); // Call regular API client calls - -// Tasks are now available under lib -client.lib.foo.myTasks.taskOne.trigger("task-1", { hello: "world" }); -client.lib.bar.userTaskOne.trigger("user/task-1", { userId: "user_123" }); -client.lib.bar.userTaskTwo.trigger("user/task-2", { userId: "user_123", isAdmin: true }); -client.lib.bar.userTaskTwo.trigger("user/task-2", { userId: "user_123", isAdmin: false }); -client.lib.zod.zodTaskOne.trigger("zod/task-1", { foo: "bar" }); -client.lib.zod.zodTaskTwo.trigger("zod/task-2", { foo: "bar" }); -client.lib.zod.zodTaskTwo.trigger("zod/task-2", { foo: "bar", isAdmin: false }); -client.lib.valibot.valibotTaskTwo.trigger("valibot/task-2", { foo: "bar" }); -client.lib.valibot.valibotTaskTwo.trigger("valibot/task-2", { foo: "bar", isAdmin: false }); diff --git a/helm-charts/.gitignore b/helm-charts/.gitignore deleted file mode 100644 index 711a39c54..000000000 --- a/helm-charts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -charts/ \ No newline at end of file diff --git a/helm-charts/.helmignore b/helm-charts/.helmignore deleted file mode 100644 index a58a8cc02..000000000 --- a/helm-charts/.helmignore +++ /dev/null @@ -1,24 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ -node_modules/ diff --git a/helm-charts/Chart.lock b/helm-charts/Chart.lock deleted file mode 100644 index 25db8abe6..000000000 --- a/helm-charts/Chart.lock +++ /dev/null @@ -1,9 +0,0 @@ -dependencies: -- name: postgresql - repository: https://charts.bitnami.com/bitnami - version: 13.1.5 -- name: ingress-nginx - repository: https://kubernetes.github.io/ingress-nginx - version: 4.0.13 -digest: sha256:e439e4b30ba18357defec97ba080973743a4724c423b78913990409f78f1ebd8 -generated: "2023-10-20T14:22:57.044126+05:30" diff --git a/helm-charts/Chart.yaml b/helm-charts/Chart.yaml deleted file mode 100644 index 04ff9e562..000000000 --- a/helm-charts/Chart.yaml +++ /dev/null @@ -1,34 +0,0 @@ -apiVersion: v2 -name: trigger -description: A Helm chart for a full Trigger application stack - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "1.16.0" - -dependencies: - - name: postgresql - version: "~13.1.5" - repository: https://charts.bitnami.com/bitnami - condition: postgresql.enabled - - name: ingress-nginx - version: 4.0.13 - repository: https://kubernetes.github.io/ingress-nginx - condition: ingress.nginx.enabled diff --git a/helm-charts/README.md b/helm-charts/README.md deleted file mode 100644 index 8003cb798..000000000 --- a/helm-charts/README.md +++ /dev/null @@ -1,119 +0,0 @@ -# Trigger.dev Helm Chart - -> WARNING: Kubernetes deploys are not officially supported yet, please only use these instructions as a general guide and starting point. - -## Installation - -As our charts aren't published for official use yet, you'll need a copy of the `helm-charts` dir and run the following commands within it: - -```bash -# with access to your cluster, e.g. KUBECONFIG correctly set -helm upgrade --install --atomic --namespace trigger --create-namespace trigger . - -# watch the deployment -kubectl --namespace trigger get deployments -w -``` - -## Parameters - -### Common parameters - -| Name | Description | Value | -| ------------------ | ------------------------- | ----- | -| `nameOverride` | Override release name | `""` | -| `fullnameOverride` | Override release fullname | `""` | - -### Trigger.dev parameters - -| Name | Description | Value | -| --------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------- | -| `trigger.name` | | `trigger` | -| `trigger.fullnameOverride` | trigger fullnameOverride | `""` | -| `trigger.podAnnotations` | trigger pod annotations | `{}` | -| `trigger.deploymentAnnotations` | trigger deployment annotations | `{}` | -| `trigger.replicaCount` | trigger replica count | `2` | -| `trigger.image.repository` | trigger image repository | `ghcr.io/triggerdotdev/trigger.dev` | -| `trigger.image.tag` | trigger image tag | `latest` | -| `trigger.image.pullPolicy` | trigger image pullPolicy | `Always` | -| `trigger.resources.limits.memory` | container memory limit [(docs)](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) | `800Mi` | -| `trigger.resources.requests.cpu` | container CPU requests [(docs)](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) | `250m` | -| `trigger.affinity` | Backend pod affinity | `{}` | -| `trigger.kubeSecretRef` | trigger secret resource reference name | `""` | -| `trigger.service.annotations` | trigger service annotations | `{}` | -| `trigger.service.type` | trigger service type | `ClusterIP` | -| `trigger.service.nodePort` | trigger service nodePort (used if above type is `NodePort`) | `""` | - -### Postgres parameters - -| Name | Description | Value | -| --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------- | -| `postgresql.enabled` | Enable Postgres | `true` | -| `postgresql.name` | Name used to build variables (deprecated) | `postgresql` | -| `postgresql.nameOverride` | Name override | `postgresql` | -| `postgresql.fullnameOverride` | Fullname override | `postgresql` | -| `postgresql.global.postgresql.auth.postgresPassword` | Password for the "postgres" admin user (overrides `auth.postgresPassword`) | `password` | -| `postgresql.global.postgresql.auth.username` | Name for a custom user to create (overrides `auth.username`) | `postgres` | -| `postgresql.global.postgresql.auth.password` | Password for the custom user to create (overrides `auth.password`) | `password` | -| `postgresql.global.postgresql.auth.database` | Name for a custom database to create (overrides `auth.database`) | `trigger` | -| `postgresql.global.postgresql.auth.existingSecret` | Name of existing secret to use for PostgreSQL credentials (overrides `auth.existingSecret`). | `""` | -| `postgresql.global.postgresql.auth.secretKeys.adminPasswordKey` | Name of key in existing secret to use for PostgreSQL credentials (overrides `auth.secretKeys.adminPasswordKey`). Only used when `postgresql.global.postgresql.auth.existingSecret` is set. | `""` | -| `postgresql.global.postgresql.auth.secretKeys.userPasswordKey` | Name of key in existing secret to use for PostgreSQL credentials (overrides `auth.secretKeys.userPasswordKey`). Only used when `postgresql.global.postgresql.auth.existingSecret` is set. | `""` | -| `postgresql.global.postgresql.auth.secretKeys.replicationPasswordKey` | Name of key in existing secret to use for PostgreSQL credentials (overrides `auth.secretKeys.replicationPasswordKey`). Only used when `postgresql.global.postgresql.auth.existingSecret` is set. | `""` | -| `postgresql.global.postgresql.service.ports.postgresql` | PostgreSQL service port (overrides `service.ports.postgresql`) | `5432` | -| `postgresql.image.registry` | PostgreSQL image registry | `docker.io` | -| `postgresql.image.repository` | PostgreSQL image repository | `bitnami/postgresql` | -| `postgresql.image.tag` | PostgreSQL image tag (immutable tags are recommended) | `14.10.0-debian-11-r21` | -| `postgresql.image.digest` | PostgreSQL image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag | `""` | -| `postgresql.image.pullPolicy` | PostgreSQL image pull policy | `IfNotPresent` | -| `postgresql.image.pullSecrets` | Specify image pull secrets | `[]` | -| `postgresql.image.debug` | Specify if debug values should be set | `false` | -| `postgresql.architecture` | PostgreSQL architecture (`standalone` or `replication`) | `standalone` | -| `postgresql.containerPorts.postgresql` | PostgreSQL container port | `5432` | -| `postgresql.postgresqlDataDir` | PostgreSQL data dir | `/bitnami/postgresql/data` | -| `postgresql.postgresqlSharedPreloadLibraries` | Shared preload libraries (comma-separated list) | `pgaudit` | - -### PostgreSQL Primary parameters - -| Name | Description | Value | -| ------------------------------------------------------- | ------------------------------------------------------ | ------------------- | -| `postgresql.primary.livenessProbe.enabled` | Enable livenessProbe on PostgreSQL Primary containers | `true` | -| `postgresql.primary.livenessProbe.initialDelaySeconds` | Initial delay seconds for livenessProbe | `30` | -| `postgresql.primary.livenessProbe.periodSeconds` | Period seconds for livenessProbe | `10` | -| `postgresql.primary.livenessProbe.timeoutSeconds` | Timeout seconds for livenessProbe | `5` | -| `postgresql.primary.livenessProbe.failureThreshold` | Failure threshold for livenessProbe | `6` | -| `postgresql.primary.livenessProbe.successThreshold` | Success threshold for livenessProbe | `1` | -| `postgresql.primary.readinessProbe.enabled` | Enable readinessProbe on PostgreSQL Primary containers | `true` | -| `postgresql.primary.readinessProbe.initialDelaySeconds` | Initial delay seconds for readinessProbe | `5` | -| `postgresql.primary.readinessProbe.periodSeconds` | Period seconds for readinessProbe | `10` | -| `postgresql.primary.readinessProbe.timeoutSeconds` | Timeout seconds for readinessProbe | `5` | -| `postgresql.primary.readinessProbe.failureThreshold` | Failure threshold for readinessProbe | `6` | -| `postgresql.primary.readinessProbe.successThreshold` | Success threshold for readinessProbe | `1` | -| `postgresql.primary.startupProbe.enabled` | Enable startupProbe on PostgreSQL Primary containers | `false` | -| `postgresql.primary.startupProbe.initialDelaySeconds` | Initial delay seconds for startupProbe | `30` | -| `postgresql.primary.startupProbe.periodSeconds` | Period seconds for startupProbe | `10` | -| `postgresql.primary.startupProbe.timeoutSeconds` | Timeout seconds for startupProbe | `1` | -| `postgresql.primary.startupProbe.failureThreshold` | Failure threshold for startupProbe | `15` | -| `postgresql.primary.startupProbe.successThreshold` | Success threshold for startupProbe | `1` | -| `postgresql.primary.persistence.enabled` | Enable PostgreSQL Primary data persistence using PVC | `true` | -| `postgresql.primary.persistence.existingClaim` | Name of an existing PVC to use | `""` | -| `postgresql.primary.persistence.accessModes` | PVC Access Mode for PostgreSQL volume | `["ReadWriteOnce"]` | -| `postgresql.primary.persistence.size` | PVC Storage Request for PostgreSQL volume | `8Gi` | - -### Ingress parameters - -| Name | Description | Value | -| -------------------------- | ------------------------------------------------------------------------ | -------- | -| `ingress.enabled` | Enable ingress | `true` | -| `ingress.ingressClassName` | Ingress class name | `nginx` | -| `ingress.nginx.enabled` | Ingress controller | `false` | -| `ingress.annotations` | Ingress annotations | `{}` | -| `ingress.hostName` | Ingress hostname (your custom domain name, e.g. `infisical.example.org`) | `""` | -| `ingress.tls` | Ingress TLS hosts (matching above hostName) | `[]` | -| `ingress.trigger.path` | Trigger.dev ingress path | `/` | -| `ingress.trigger.pathType` | Trigger.dev ingress path type | `Prefix` | - -## Generating docs - -This chart aims to be compliant with the [Readme Generator For Helm](https://github.com/bitnami/readme-generator-for-helm) to easily create and maintain the parameters tables above. - -To update the docs, just run: `pnpm generate-docs` diff --git a/helm-charts/my-values.yml b/helm-charts/my-values.yml deleted file mode 100644 index 438d7190d..000000000 --- a/helm-charts/my-values.yml +++ /dev/null @@ -1,14 +0,0 @@ -trigger: - name: trigger - replicaCount: 2 - image: - repository: ghcr.io/triggerdotdev/trigger.dev - tag: "latest" - pullPolicy: Always - env: - ENCRYPTION_KEY: "b1ebe43a6a6e24b2aa8fa0707d3890e3" - MAGIC_LINK_SECRET: "842727396bcee22da68518f959c5730b" - -ingress: - nginx: - enabled: false #<-- if you would like to install nginx along with Trigger.dev diff --git a/helm-charts/package-lock.json b/helm-charts/package-lock.json deleted file mode 100644 index 803b94a4e..000000000 --- a/helm-charts/package-lock.json +++ /dev/null @@ -1,203 +0,0 @@ -{ - "name": "helm-charts", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "helm-charts", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "@bitnami/readme-generator-for-helm": "^2.6.0" - } - }, - "node_modules/@bitnami/readme-generator-for-helm": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/@bitnami/readme-generator-for-helm/-/readme-generator-for-helm-2.6.0.tgz", - "integrity": "sha512-LcByNCryaC2OJExL9rnhyFJ18+vrZu1gVoN2Z7j/HI42EjV4kLgT4G1KEPNnrKbls9HvozBqMG+sKZIDh0McFg==", - "dependencies": { - "commander": "^7.1.0", - "dot-object": "^2.1.4", - "lodash": "^4.17.21", - "markdown-table": "^2.0.0", - "yaml": "^2.0.0-3" - }, - "bin": { - "readme-generator": "bin/index.js" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", - "engines": { - "node": ">= 10" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" - }, - "node_modules/dot-object": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/dot-object/-/dot-object-2.1.4.tgz", - "integrity": "sha512-7FXnyyCLFawNYJ+NhkqyP9Wd2yzuo+7n9pGiYpkmXCTYa8Ci2U0eUNDVg5OuO5Pm6aFXI2SWN8/N/w7SJWu1WA==", - "dependencies": { - "commander": "^4.0.0", - "glob": "^7.1.5" - }, - "bin": { - "dot-object": "bin/dot-object" - } - }, - "node_modules/dot-object/node_modules/commander": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", - "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", - "engines": { - "node": ">= 6" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" - }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/markdown-table": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-2.0.0.tgz", - "integrity": "sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==", - "dependencies": { - "repeat-string": "^1.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" - }, - "node_modules/yaml": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", - "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", - "engines": { - "node": ">= 14" - } - }, - "readme-generator-for-helm": { - "version": "2.6.1", - "extraneous": true, - "license": "Apache-2.0", - "dependencies": { - "commander": "^7.1.0", - "dot-object": "^2.1.4", - "lodash": "^4.17.21", - "markdown-table": "^2.0.0", - "yaml": "^2.0.0-3" - }, - "bin": { - "readme-generator": "bin/index.js" - }, - "devDependencies": { - "eslint": "^7.24.0", - "eslint-config-airbnb-base": "^14.2.1", - "eslint-plugin-import": "^2.22.1", - "jest": "^29.2.1", - "temp": "^0.9.4" - } - } - } -} diff --git a/helm-charts/package.json b/helm-charts/package.json deleted file mode 100644 index 78404a5d0..000000000 --- a/helm-charts/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "helm-charts", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "generate-docs": "readme-generator --readme README.md --values values.yaml" - }, - "keywords": [], - "author": "", - "license": "ISC", - "devDependencies": { - "@bitnami/readme-generator-for-helm": "^2.6.0" - } -} \ No newline at end of file diff --git a/helm-charts/templates/_helpers.tpl b/helm-charts/templates/_helpers.tpl deleted file mode 100644 index 5d060c433..000000000 --- a/helm-charts/templates/_helpers.tpl +++ /dev/null @@ -1,71 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "trigger.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "trigger.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Create unified labels for trigger components -*/}} -{{- define "trigger.common.matchLabels" -}} -app: {{ template "trigger.name" . }} -release: {{ .Release.Name }} -{{- end -}} - -{{- define "trigger.common.metaLabels" -}} -chart: {{ template "trigger.chart" . }} -heritage: {{ .Release.Service }} -{{- end -}} - -{{- define "trigger.common.labels" -}} -{{ include "trigger.common.matchLabels" . }} -{{ include "trigger.common.metaLabels" . }} -{{- end -}} - -{{- define "trigger.labels" -}} -{{ include "trigger.matchLabels" . }} -{{ include "trigger.common.metaLabels" . }} -{{- end -}} - -{{- define "trigger.matchLabels" -}} -component: {{ .Values.trigger.name | quote }} -{{ include "trigger.common.matchLabels" . }} -{{- end -}} - -{{/* -Create a fully qualified postgresql name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -*/}} -{{- define "trigger.postgresql.hostname" -}} -{{- if .Values.postgresql.fullnameOverride -}} -{{- .Values.postgresql.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- printf "%s-%s" .Release.Name .Values.postgresql.name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s-%s" .Release.Name $name .Values.postgresql.name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Create the postgresql connection string. -*/}} -{{- define "trigger.postgresql.connectionString" -}} -{{- $host := include "trigger.postgresql.hostname" . -}} -{{- $port := 5432 -}} -{{- $username := .Values.postgresql.global.postgresql.postgresqlUsername | default "postgres" -}} -{{- $password := .Values.postgresql.global.postgresql.postgresqlPassword | default "password" -}} -{{- $database := .Values.postgresql.global.postgresql.postgresqlDatabase | default "trigger" -}} -{{- $connectionString := printf "postgresql://%s:%s@%s:%d/%s" $username $password $host $port $database -}} -{{- printf "%s" $connectionString -}} -{{- end -}} \ No newline at end of file diff --git a/helm-charts/templates/ingress.yaml b/helm-charts/templates/ingress.yaml deleted file mode 100644 index 3f4e73f6e..000000000 --- a/helm-charts/templates/ingress.yaml +++ /dev/null @@ -1,43 +0,0 @@ -{{ if .Values.ingress.enabled }} -{{- $ingress := .Values.ingress }} -{{- if and $ingress.ingressClassName (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} - {{- if not (hasKey $ingress.annotations "kubernetes.io/ingress.class") }} - {{- $_ := set $ingress.annotations "kubernetes.io/ingress.class" $ingress.ingressClassName}} - {{- end }} -{{- end }} -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: trigger-ingress - {{- with $ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if and $ingress.ingressClassName (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} - ingressClassName: {{ $ingress.ingressClassName | default "nginx" }} - {{- end }} -{{- if $ingress.tls }} - tls: - {{- range $ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} -{{- end }} - rules: - - http: - paths: - - path: {{ $ingress.trigger.path }} - pathType: {{ $ingress.trigger.pathType }} - backend: - service: - name: {{ include "trigger.name" . }} - port: - number: 3000 - {{- if $ingress.hostName }} - host: {{ $ingress.hostName }} - {{- end }} -{{ end }} \ No newline at end of file diff --git a/helm-charts/templates/trigger.yaml b/helm-charts/templates/trigger.yaml deleted file mode 100644 index 66002716b..000000000 --- a/helm-charts/templates/trigger.yaml +++ /dev/null @@ -1,98 +0,0 @@ -{{- $trigger := .Values.trigger -}} -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "trigger.name" . }} - annotations: - updatedAt: {{ now | date "2006-01-01 MST 15:04:05" | quote }} - {{- with $trigger.deploymentAnnotations }} - {{- toYaml . | nindent 4 }} - {{- end }} - labels: - {{- include "trigger.labels" . | nindent 4 }} -spec: - replicas: {{ $trigger.replicaCount }} - selector: - matchLabels: - {{- include "trigger.matchLabels" . | nindent 6 }} - template: - metadata: - labels: - {{- include "trigger.matchLabels" . | nindent 8 }} - annotations: - updatedAt: {{ now | date "2006-01-01 MST 15:04:05" | quote }} - {{- with $trigger.podAnnotations }} - {{- toYaml . | nindent 8 }} - {{- end }} - spec: - {{- with $trigger.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - containers: - - name: {{ $trigger.name }} - image: "{{ $trigger.image.repository }}:{{ $trigger.image.tag | default "latest" }}" - imagePullPolicy: {{ $trigger.image.pullPolicy }} - ports: - - name: http - containerPort: 3000 - protocol: TCP - readinessProbe: - httpGet: - path: / - port: 3000 - envFrom: - - secretRef: - name: {{ $trigger.kubeSecretRef | default (include "trigger.name" .) }} - {{- if $trigger.resources }} - resources: {{- toYaml $trigger.resources | nindent 12 }} - {{- end }} ---- - -apiVersion: v1 -kind: Service -metadata: - name: {{ include "trigger.name" . }} - labels: - {{- include "trigger.labels" . | nindent 4 }} - {{- with $trigger.service.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - type: {{ $trigger.service.type }} - selector: - {{- include "trigger.matchLabels" . | nindent 8 }} - ports: - - port: 3000 - targetPort: 3000 - protocol: TCP - {{- if eq $trigger.service.type "NodePort" }} - nodePort: {{ $trigger.service.nodePort }} - {{- end }} - ---- - -{{ if not $trigger.kubeSecretRef }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ include "trigger.name" . }} - annotations: - "helm.sh/resource-policy": "keep" -type: Opaque -stringData: - {{- $requiredVars := dict "MAGIC_LINK_SECRET" (randAlphaNum 32 | lower) - "SESSION_SECRET" (randAlphaNum 32 | lower) - "ENCRYPTION_KEY" (randAlphaNum 32 | lower) - "DIRECT_URL" (include "trigger.postgresql.connectionString" .) - "DATABASE_URL" (include "trigger.postgresql.connectionString" .) }} - {{- $secretObj := (lookup "v1" "Secret" .Release.Namespace (include "trigger.name" .)) | default dict }} - {{- $secretData := (get $secretObj "data") | default dict }} - {{ range $key, $value := .Values.trigger.env }} - {{- $default := get $requiredVars $key -}} - {{- $current := get $secretData $key | b64dec -}} - {{- $v := $value | default ($current | default $default) -}} - {{ $key }}: {{ $v | quote }} - {{ end -}} -{{- end }} \ No newline at end of file diff --git a/helm-charts/values.yaml b/helm-charts/values.yaml deleted file mode 100644 index 713d918ad..000000000 --- a/helm-charts/values.yaml +++ /dev/null @@ -1,276 +0,0 @@ -# Default values for helm-charts. -# This is a YAML-formatted file. -## @section Common parameters -## - -## @param nameOverride Override release name -## -nameOverride: "" -## @param fullnameOverride Override release fullname -## -fullnameOverride: "" - -## @section Trigger.dev parameters -## -trigger: - ## @param trigger.name - name: trigger - ## @param trigger.fullnameOverride trigger fullnameOverride - ## - fullnameOverride: "" - ## @param trigger.podAnnotations trigger pod annotations - ## - podAnnotations: {} - ## @param trigger.deploymentAnnotations trigger deployment annotations - ## - deploymentAnnotations: {} - ## @param trigger.replicaCount trigger replica count - ## - replicaCount: 2 - ## trigger image parameters - ## - image: - ## @param trigger.image.repository trigger image repository - ## - repository: ghcr.io/triggerdotdev/trigger.dev - ## @param trigger.image.tag trigger image tag - ## - tag: "latest" - ## @param trigger.image.pullPolicy trigger image pullPolicy - ## - pullPolicy: Always - ## @param trigger.resources.limits.memory container memory limit [(docs)](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) - ## @param trigger.resources.requests.cpu container CPU requests [(docs)](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) - ## - resources: - limits: - memory: 800Mi - requests: - cpu: 250m - ## @param trigger.affinity Backend pod affinity - ## - affinity: {} - ## @param trigger.kubeSecretRef trigger secret resource reference name - ## - kubeSecretRef: "" - ## trigger service - ## - service: - ## @param trigger.service.annotations trigger service annotations - ## - annotations: {} - ## @param trigger.service.type trigger service type - ## - type: ClusterIP - ## @param trigger.service.nodePort trigger service nodePort (used if above type is `NodePort`) - ## - nodePort: "" - ## @skip trigger.env - ## - env: - ENCRYPTION_KEY: "" - MAGIC_LINK_SECRET: "" - SESSION_SECRET: "" - LOGIN_ORIGIN: "" - APP_ORIGIN: "" - DIRECT_URL: "" - DATABASE_URL: "" - FROM_EMAIL: "" - REPLY_TO_EMAIL: "" - RESEND_API_KEY: "" - AUTH_GITHUB_CLIENT_ID: "" - AUTH_GITHUB_CLIENT_SECRET: "" - -## @section Postgres parameters -## Documentation: https://github.com/bitnami/charts/tree/main/bitnami/postgresql-ha -## -postgresql: - ## @param postgresql.enabled Enable Postgres - ## - enabled: true - ## @param postgresql.name Name used to build variables (deprecated) - ## - name: "postgresql" - ## @param postgresql.nameOverride Name override - ## - nameOverride: "postgresql" - ## @param postgresql.fullnameOverride Fullname override - ## - fullnameOverride: "postgresql" - - global: - postgresql: - ## @param postgresql.global.postgresql.auth.postgresPassword Password for the "postgres" admin user (overrides `auth.postgresPassword`) - ## @param postgresql.global.postgresql.auth.username Name for a custom user to create (overrides `auth.username`) - ## @param postgresql.global.postgresql.auth.password Password for the custom user to create (overrides `auth.password`) - ## @param postgresql.global.postgresql.auth.database Name for a custom database to create (overrides `auth.database`) - ## @param postgresql.global.postgresql.auth.existingSecret Name of existing secret to use for PostgreSQL credentials (overrides `auth.existingSecret`). - ## @param postgresql.global.postgresql.auth.secretKeys.adminPasswordKey Name of key in existing secret to use for PostgreSQL credentials (overrides `auth.secretKeys.adminPasswordKey`). Only used when `postgresql.global.postgresql.auth.existingSecret` is set. - ## @param postgresql.global.postgresql.auth.secretKeys.userPasswordKey Name of key in existing secret to use for PostgreSQL credentials (overrides `auth.secretKeys.userPasswordKey`). Only used when `postgresql.global.postgresql.auth.existingSecret` is set. - ## @param postgresql.global.postgresql.auth.secretKeys.replicationPasswordKey Name of key in existing secret to use for PostgreSQL credentials (overrides `auth.secretKeys.replicationPasswordKey`). Only used when `postgresql.global.postgresql.auth.existingSecret` is set. - ## - auth: - postgresPassword: "password" - username: "postgres" - password: "password" - database: "trigger" - existingSecret: "" - secretKeys: - adminPasswordKey: "" - userPasswordKey: "" - replicationPasswordKey: "" - ## @param postgresql.global.postgresql.service.ports.postgresql PostgreSQL service port (overrides `service.ports.postgresql`) - ## - service: - ports: - postgresql: "5432" - - ## Bitnami PostgreSQL image version - ## ref: https://hub.docker.com/r/bitnami/postgresql/tags/ - ## @param postgresql.image.registry PostgreSQL image registry - ## @param postgresql.image.repository PostgreSQL image repository - ## @param postgresql.image.tag PostgreSQL image tag (immutable tags are recommended) - ## @param postgresql.image.digest PostgreSQL image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag - ## @param postgresql.image.pullPolicy PostgreSQL image pull policy - ## @param postgresql.image.pullSecrets Specify image pull secrets - ## @param postgresql.image.debug Specify if debug values should be set - ## - image: - registry: docker.io - repository: bitnami/postgresql - tag: 14.10.0-debian-11-r21 - digest: "" - ## Specify a imagePullPolicy - ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' - ## ref: https://kubernetes.io/docs/user-guide/images/#pre-pulling-images - ## - pullPolicy: IfNotPresent - ## Optionally specify an array of imagePullSecrets. - ## Secrets must be manually created in the namespace. - ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ - ## Example: - ## pullSecrets: - ## - myRegistryKeySecretName - ## - pullSecrets: [] - ## Set to true if you would like to see extra information on logs - ## - debug: false - - ## @param postgresql.architecture PostgreSQL architecture (`standalone` or `replication`) - ## - architecture: standalone - ## Replication configuration - ## Ignored if `postgresql.architecture` is `standalone` - ## - ## @param postgresql.containerPorts.postgresql PostgreSQL container port - ## - containerPorts: - postgresql: 5432 - - ## @param postgresql.postgresqlDataDir PostgreSQL data dir - ## - postgresqlDataDir: /bitnami/postgresql/data - ## @param postgresql.postgresqlSharedPreloadLibraries Shared preload libraries (comma-separated list) - ## - postgresqlSharedPreloadLibraries: "pgaudit" - ## @section PostgreSQL Primary parameters - ## - primary: - ## Configure extra options for PostgreSQL Primary containers' liveness, readiness and startup probes - ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes - ## @param postgresql.primary.livenessProbe.enabled Enable livenessProbe on PostgreSQL Primary containers - ## @param postgresql.primary.livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe - ## @param postgresql.primary.livenessProbe.periodSeconds Period seconds for livenessProbe - ## @param postgresql.primary.livenessProbe.timeoutSeconds Timeout seconds for livenessProbe - ## @param postgresql.primary.livenessProbe.failureThreshold Failure threshold for livenessProbe - ## @param postgresql.primary.livenessProbe.successThreshold Success threshold for livenessProbe - ## - livenessProbe: - enabled: true - initialDelaySeconds: 30 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 6 - successThreshold: 1 - ## @param postgresql.primary.readinessProbe.enabled Enable readinessProbe on PostgreSQL Primary containers - ## @param postgresql.primary.readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe - ## @param postgresql.primary.readinessProbe.periodSeconds Period seconds for readinessProbe - ## @param postgresql.primary.readinessProbe.timeoutSeconds Timeout seconds for readinessProbe - ## @param postgresql.primary.readinessProbe.failureThreshold Failure threshold for readinessProbe - ## @param postgresql.primary.readinessProbe.successThreshold Success threshold for readinessProbe - ## - readinessProbe: - enabled: true - initialDelaySeconds: 5 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 6 - successThreshold: 1 - ## @param postgresql.primary.startupProbe.enabled Enable startupProbe on PostgreSQL Primary containers - ## @param postgresql.primary.startupProbe.initialDelaySeconds Initial delay seconds for startupProbe - ## @param postgresql.primary.startupProbe.periodSeconds Period seconds for startupProbe - ## @param postgresql.primary.startupProbe.timeoutSeconds Timeout seconds for startupProbe - ## @param postgresql.primary.startupProbe.failureThreshold Failure threshold for startupProbe - ## @param postgresql.primary.startupProbe.successThreshold Success threshold for startupProbe - ## - startupProbe: - enabled: false - initialDelaySeconds: 30 - periodSeconds: 10 - timeoutSeconds: 1 - failureThreshold: 15 - successThreshold: 1 - persistence: - ## @param postgresql.primary.persistence.enabled Enable PostgreSQL Primary data persistence using PVC - ## - enabled: true - ## @param postgresql.primary.persistence.existingClaim Name of an existing PVC to use - ## - existingClaim: "" - ## @param postgresql.primary.persistence.accessModes PVC Access Mode for PostgreSQL volume - ## - accessModes: - - ReadWriteOnce - ## @param postgresql.primary.persistence.size PVC Storage Request for PostgreSQL volume - ## - size: 8Gi - -## @section Ingress parameters -## Documentation: https://kubernetes.io/docs/concepts/services-networking/ingress/ -## -ingress: - ## @param ingress.enabled Enable ingress - ## - enabled: true - ## @param ingress.ingressClassName Ingress class name - ## - ingressClassName: nginx - ## @param ingress.nginx.enabled Ingress controller - ## - nginx: - enabled: false - ## @param ingress.annotations Ingress annotations - ## - annotations: - {} - # kubernetes.io/ingress.class: "nginx" - # cert-manager.io/issuer: letsencrypt-nginx - ## @param ingress.hostName Ingress hostname (your custom domain name, e.g. `infisical.example.org`) - ## Replace with your own domain - ## - hostName: "" - ## @param ingress.tls Ingress TLS hosts (matching above hostName) - ## Replace with your own domain - ## - tls: - [] - # - secretName: letsencrypt-nginx - # hosts: - # - infisical.local - ## @param ingress.trigger.path Trigger.dev ingress path - ## @param ingress.trigger.pathType Trigger.dev ingress path type - ## - trigger: - path: / - pathType: Prefix diff --git a/integrations/airtable/CHANGELOG.md b/integrations/airtable/CHANGELOG.md deleted file mode 100644 index a4fda4dc9..000000000 --- a/integrations/airtable/CHANGELOG.md +++ /dev/null @@ -1,790 +0,0 @@ -# @trigger.dev/airtable - -## 3.0.0-beta.55 - -### Patch Changes - -- Updated dependencies [0591db5f2] - - @trigger.dev/sdk@3.0.0-beta.55 - - @trigger.dev/integration-kit@3.0.0-beta.55 - -## 3.0.0-beta.54 - -### Patch Changes - -- Updated dependencies [728eeeff6] - - @trigger.dev/sdk@3.0.0-beta.54 - - @trigger.dev/integration-kit@3.0.0-beta.54 - -## 3.0.0-beta.53 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.53 -- @trigger.dev/sdk@3.0.0-beta.53 - -## 3.0.0-beta.52 - -### Patch Changes - -- Updated dependencies [8cae1d087] - - @trigger.dev/sdk@3.0.0-beta.52 - - @trigger.dev/integration-kit@3.0.0-beta.52 - -## 3.0.0-beta.51 - -### Patch Changes - -- Updated dependencies [979bee50d] -- Updated dependencies [086a0f95c] -- Updated dependencies [55264657d] - - @trigger.dev/sdk@3.0.0-beta.51 - - @trigger.dev/integration-kit@3.0.0-beta.51 - -## 3.0.0-beta.50 - -### Patch Changes - -- Updated dependencies [8ba998794] - - @trigger.dev/sdk@3.0.0-beta.50 - - @trigger.dev/integration-kit@3.0.0-beta.50 - -## 3.0.0-beta.49 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.49 -- @trigger.dev/sdk@3.0.0-beta.49 - -## 3.0.0-beta.48 - -### Patch Changes - -- Updated dependencies [ecf1110ab] - - @trigger.dev/sdk@3.0.0-beta.48 - - @trigger.dev/integration-kit@3.0.0-beta.48 - -## 3.0.0-beta.47 - -### Patch Changes - -- Updated dependencies [4f95c9de4] - - @trigger.dev/sdk@3.0.0-beta.47 - - @trigger.dev/integration-kit@3.0.0-beta.47 - -## 3.0.0-beta.46 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.46 -- @trigger.dev/sdk@3.0.0-beta.46 - -## 3.0.0-beta.45 - -### Patch Changes - -- Updated dependencies [0e77e7ef7] - - @trigger.dev/sdk@3.0.0-beta.45 - - @trigger.dev/integration-kit@3.0.0-beta.45 - -## 3.0.0-beta.44 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.44 -- @trigger.dev/sdk@3.0.0-beta.44 - -## 3.0.0-beta.43 - -### Patch Changes - -- Updated dependencies [34ca7667d] - - @trigger.dev/sdk@3.0.0-beta.43 - - @trigger.dev/integration-kit@3.0.0-beta.43 - -## 3.0.0-beta.42 - -### Patch Changes - -- Updated dependencies [ecef19966] - - @trigger.dev/sdk@3.0.0-beta.42 - - @trigger.dev/integration-kit@3.0.0-beta.42 - -## 3.0.0-beta.41 - -### Patch Changes - -- Updated dependencies [7c36a1a4b] - - @trigger.dev/sdk@3.0.0-beta.41 - - @trigger.dev/integration-kit@3.0.0-beta.41 - -## 3.0.0-beta.40 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.40 -- @trigger.dev/sdk@3.0.0-beta.40 - -## 3.0.0-beta.39 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.39 -- @trigger.dev/sdk@3.0.0-beta.39 - -## 3.0.0-beta.38 - -### Patch Changes - -- Updated dependencies [1b90ffbb8] -- Updated dependencies [c405ae711] - - @trigger.dev/sdk@3.0.0-beta.38 - - @trigger.dev/integration-kit@3.0.0-beta.38 - -## 3.0.0-beta.37 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.37 -- @trigger.dev/sdk@3.0.0-beta.37 - -## 3.0.0-beta.36 - -### Patch Changes - -- Updated dependencies [51bb4c887] -- Updated dependencies [ba71f959e] - - @trigger.dev/sdk@3.0.0-beta.36 - - @trigger.dev/integration-kit@3.0.0-beta.36 - -## 3.0.0-beta.35 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.35 -- @trigger.dev/sdk@3.0.0-beta.35 - -## 3.0.0-beta.34 - -### Patch Changes - -- Updated dependencies [3a1b0c486] -- Updated dependencies [3f8b6d8fc] -- Updated dependencies [1281d40e4] - - @trigger.dev/sdk@3.0.0-beta.34 - - @trigger.dev/integration-kit@3.0.0-beta.34 - -## 3.0.0-beta.33 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.33 -- @trigger.dev/sdk@3.0.0-beta.33 - -## 3.0.0-beta.32 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.32 -- @trigger.dev/sdk@3.0.0-beta.32 - -## 3.0.0-beta.31 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.31 -- @trigger.dev/sdk@3.0.0-beta.31 - -## 3.0.0-beta.30 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.30 -- @trigger.dev/sdk@3.0.0-beta.30 - -## 3.0.0-beta.29 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.29 -- @trigger.dev/sdk@3.0.0-beta.29 - -## 3.0.0-beta.28 - -### Patch Changes - -- Updated dependencies [6d9dfbc75] - - @trigger.dev/sdk@3.0.0-beta.28 - - @trigger.dev/integration-kit@3.0.0-beta.28 - -## 3.0.0-beta.27 - -### Patch Changes - -- Updated dependencies [203e00208] - - @trigger.dev/sdk@3.0.0-beta.27 - - @trigger.dev/integration-kit@3.0.0-beta.27 - -## 3.0.0-beta.26 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.26 -- @trigger.dev/sdk@3.0.0-beta.26 - -## 3.0.0-beta.25 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.25 -- @trigger.dev/sdk@3.0.0-beta.25 - -## 3.0.0-beta.24 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.24 -- @trigger.dev/sdk@3.0.0-beta.24 - -## 3.0.0-beta.23 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.23 -- @trigger.dev/sdk@3.0.0-beta.23 - -## 3.0.0-beta.22 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.22 -- @trigger.dev/sdk@3.0.0-beta.22 - -## 3.0.0-beta.21 - -### Patch Changes - -- Updated dependencies [9491a1649] - - @trigger.dev/sdk@3.0.0-beta.21 - - @trigger.dev/integration-kit@3.0.0-beta.21 - -## 3.0.0-beta.20 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.20 -- @trigger.dev/sdk@3.0.0-beta.20 - -## 3.0.0-beta.19 - -### Patch Changes - -- Updated dependencies [e9a63a486] - - @trigger.dev/sdk@3.0.0-beta.19 - - @trigger.dev/integration-kit@3.0.0-beta.19 - -## 3.0.0-beta.18 - -### Patch Changes - -- Updated dependencies [b68012f81] -- Updated dependencies [b68012f81] -- Updated dependencies [b68012f81] - - @trigger.dev/sdk@3.0.0-beta.18 - - @trigger.dev/integration-kit@3.0.0-beta.18 - -## 3.0.0-beta.17 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.17 -- @trigger.dev/sdk@3.0.0-beta.17 - -## 3.0.0-beta.16 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.16 -- @trigger.dev/sdk@3.0.0-beta.16 - -## 3.0.0-beta.15 - -### Patch Changes - -- Updated dependencies [374edef02] -- Updated dependencies [26093896d] - - @trigger.dev/sdk@3.0.0-beta.15 - - @trigger.dev/integration-kit@3.0.0-beta.15 - -## 3.0.0-beta.14 - -### Patch Changes - -- Updated dependencies [c9e1a3e9c] - - @trigger.dev/sdk@3.0.0-beta.14 - - @trigger.dev/integration-kit@3.0.0-beta.14 - -## 3.0.0-beta.13 - -### Patch Changes - -- Updated dependencies [4986bfda2] -- Updated dependencies [44e1b8754] -- Updated dependencies [4986bfda2] -- Updated dependencies [4986bfda2] - - @trigger.dev/sdk@3.0.0-beta.13 - - @trigger.dev/integration-kit@3.0.0-beta.13 - -## 3.0.0-beta.12 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.12 -- @trigger.dev/sdk@3.0.0-beta.12 - -## 3.0.0-beta.11 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.11 -- @trigger.dev/sdk@3.0.0-beta.11 - -## 3.0.0-beta.7 - -### Patch Changes - -- Updated dependencies [f854cb90e] -- Updated dependencies [f854cb90e] - - @trigger.dev/sdk@3.0.0-beta.7 - - @trigger.dev/integration-kit@3.0.0-beta.7 - -## 3.0.0-beta.6 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.6 -- @trigger.dev/sdk@3.0.0-beta.6 - -## 3.0.0-beta.5 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.5 -- @trigger.dev/sdk@3.0.0-beta.5 - -## 3.0.0-beta.4 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.4 -- @trigger.dev/sdk@3.0.0-beta.4 - -## 3.0.0-beta.3 - -### Patch Changes - -- Updated dependencies [b271742dc] - - @trigger.dev/sdk@3.0.0-beta.3 - - @trigger.dev/integration-kit@3.0.0-beta.3 - -## 3.0.0-beta.2 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.2 -- @trigger.dev/sdk@3.0.0-beta.2 - -## 3.0.0-beta.1 - -### Patch Changes - -- Updated dependencies [b66d5525e] -- Updated dependencies [719c0a0b9] -- Updated dependencies [f93eae300] - - @trigger.dev/sdk@3.0.0-beta.1 - - @trigger.dev/integration-kit@3.0.0-beta.1 - -## 3.0.0-beta.0 - -### Patch Changes - -- Updated dependencies [395abe1b9] - - @trigger.dev/sdk@3.0.0-beta.0 - - @trigger.dev/integration-kit@3.0.0-beta.0 - -## 2.3.18 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.18 -- @trigger.dev/sdk@2.3.18 - -## 2.3.17 - -### Patch Changes - -- Updated dependencies [dd879c8e] - - @trigger.dev/sdk@2.3.17 - - @trigger.dev/integration-kit@2.3.17 - -## 2.3.16 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.16 -- @trigger.dev/sdk@2.3.16 - -## 2.3.15 - -### Patch Changes - -- Updated dependencies [6c4047cf] - - @trigger.dev/sdk@2.3.15 - - @trigger.dev/integration-kit@2.3.15 - -## 2.3.14 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.14 -- @trigger.dev/sdk@2.3.14 - -## 2.3.13 - -### Patch Changes - -- Updated dependencies [a93b554f] -- Updated dependencies [0f342cd1] - - @trigger.dev/sdk@2.3.13 - - @trigger.dev/integration-kit@2.3.13 - -## 2.3.12 - -### Patch Changes - -- Updated dependencies [129f023d] -- Updated dependencies [38f5a903] -- Updated dependencies [ff4ff869] - - @trigger.dev/sdk@2.3.12 - - @trigger.dev/integration-kit@2.3.12 - -## 2.3.11 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.11 -- @trigger.dev/sdk@2.3.11 - -## 2.3.10 - -### Patch Changes - -- Updated dependencies [8277f4d2] -- Updated dependencies [73cb8839] - - @trigger.dev/sdk@2.3.10 - - @trigger.dev/integration-kit@2.3.10 - -## 2.3.9 - -### Patch Changes - -- Updated dependencies [f7bf25f0] - - @trigger.dev/sdk@2.3.9 - - @trigger.dev/integration-kit@2.3.9 - -## 2.3.8 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.8 -- @trigger.dev/sdk@2.3.8 - -## 2.3.7 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.7 -- @trigger.dev/sdk@2.3.7 - -## 2.3.6 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.6 -- @trigger.dev/sdk@2.3.6 - -## 2.3.5 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.5 -- @trigger.dev/sdk@2.3.5 - -## 2.3.4 - -### Patch Changes - -- Updated dependencies [6a3c563f] - - @trigger.dev/sdk@2.3.4 - - @trigger.dev/integration-kit@2.3.4 - -## 2.3.3 - -### Patch Changes - -- 0f9f0102: Named exports don't work because Airtable is a CommonJS module - - @trigger.dev/integration-kit@2.3.3 - - @trigger.dev/sdk@2.3.3 - -## 2.3.2 - -### Patch Changes - -- 0c14e4cd: Fixed importing package subpath - - @trigger.dev/integration-kit@2.3.2 - - @trigger.dev/sdk@2.3.2 - -## 2.3.1 - -### Patch Changes - -- Updated dependencies [f3efcc0c] - - @trigger.dev/sdk@2.3.1 - - @trigger.dev/integration-kit@2.3.1 - -## 2.3.0 - -### Minor Changes - -- 17f6f29d: Support for Deno, Bun and Cloudflare workers, as well as conditionally exporting ESM versions of the package instead of just commonjs. - - Cloudflare worker support requires the node compat flag turned on (https://developers.cloudflare.com/workers/runtime-apis/nodejs/) - -### Patch Changes - -- Updated dependencies [17f6f29d] - - @trigger.dev/integration-kit@2.3.0 - - @trigger.dev/sdk@2.3.0 - -## 2.2.11 - -### Patch Changes - -- de652c1d: Fix Shopify task types and KV `get()` return types -- Updated dependencies [de652c1d] - - @trigger.dev/sdk@2.2.11 - - @trigger.dev/integration-kit@2.2.11 - -## 2.2.10 - -### Patch Changes - -- @trigger.dev/integration-kit@2.2.10 -- @trigger.dev/sdk@2.2.10 - -## 2.2.9 - -### Patch Changes - -- Updated dependencies [1dcd87a2] -- Updated dependencies [6ebd435e] - - @trigger.dev/sdk@2.2.9 - - @trigger.dev/integration-kit@2.2.9 - -## 2.2.8 - -### Patch Changes - -- 067e19fe: - Simplify `Webhook Triggers` and use the new HTTP Endpoints - - Add a `Key-Value Store` for use in and outside of Jobs - - Add a `@trigger.dev/shopify` package -- Updated dependencies [067e19fe] -- Updated dependencies [096151c0] - - @trigger.dev/integration-kit@2.2.8 - - @trigger.dev/sdk@2.2.8 - -## 2.2.7 - -### Patch Changes - -- Updated dependencies [756024da] - - @trigger.dev/sdk@2.2.7 - - @trigger.dev/integration-kit@2.2.7 - -## 2.2.6 - -### Patch Changes - -- Updated dependencies [cb1825bf] -- Updated dependencies [cb1825bf] -- Updated dependencies [d0217344] -- Updated dependencies [cb1825bf] - - @trigger.dev/integration-kit@2.2.6 - - @trigger.dev/sdk@2.2.6 - -## 2.2.5 - -### Patch Changes - -- Updated dependencies [7e57f1f3] -- Updated dependencies [cf8f9946] -- Updated dependencies [a74716a1] -- Updated dependencies [620b8383] -- Updated dependencies [620b8383] -- Updated dependencies [4a0f030e] -- Updated dependencies [f4275e50] - - @trigger.dev/sdk@2.2.5 - - @trigger.dev/integration-kit@2.2.5 - -## 2.2.4 - -### Patch Changes - -- 9c5a7cf0: Extend the Airtable field set to accept formula errors and special values -- Updated dependencies [c1710ae7] -- Updated dependencies [9c4be40a] - - @trigger.dev/sdk@2.2.4 - - @trigger.dev/integration-kit@2.2.4 - -## 2.2.3 - -### Patch Changes - -- Updated dependencies [6e1b8a11] -- Updated dependencies [c4533c36] - - @trigger.dev/sdk@2.2.3 - - @trigger.dev/integration-kit@2.2.3 - -## 2.2.2 - -### Patch Changes - -- @trigger.dev/integration-kit@2.2.2 -- @trigger.dev/sdk@2.2.2 - -## 2.2.1 - -### Patch Changes - -- b9eba680: Export Base and Table -- Updated dependencies [044d38e3] - - @trigger.dev/sdk@2.2.1 - - @trigger.dev/integration-kit@2.2.1 - -## 2.2.0 - -### Patch Changes - -- Updated dependencies [975c5f1d] - - @trigger.dev/integration-kit@2.2.0 - - @trigger.dev/sdk@2.2.0 - -## 2.1.9 - -### Patch Changes - -- 9a187f9e: upgrade zod to 3.22.3 -- Updated dependencies [9a187f9e] -- Updated dependencies [2e9452ab] - - @trigger.dev/sdk@2.1.9 - - @trigger.dev/integration-kit@2.1.9 - -## 2.1.8 - -### Patch Changes - -- 6a992a19: First release of `@trigger.dev/replicate` integration with remote callback support. -- Updated dependencies [6a992a19] -- Updated dependencies [ab9e4a98] -- Updated dependencies [ab9e4a98] - - @trigger.dev/sdk@2.1.8 - - @trigger.dev/integration-kit@2.1.8 - -## 2.1.7 - -### Patch Changes - -- @trigger.dev/integration-kit@2.1.7 -- @trigger.dev/sdk@2.1.7 - -## 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 - -- c0dfa804: Add support for Bring Your Own Auth -- Updated dependencies [ad14983e] -- Updated dependencies [15f17d27] -- Updated dependencies [50137a6f] -- Updated dependencies [c0dfa804] - - @trigger.dev/sdk@2.1.4 - - @trigger.dev/integration-kit@2.1.4 - -## 2.1.3 - -### Patch Changes - -- Updated dependencies: - - `@trigger.dev/sdk@2.1.3` - - `@trigger.dev/integration-kit@2.1.3` - -## 2.1.2 - -### Patch Changes - -- Updated dependencies: - - `@trigger.dev/integration-kit@2.1.2` - - `@trigger.dev/sdk@2.1.2` - -## 2.1.1 - -### Patch Changes - -- Updated dependencies: - - `@trigger.dev/sdk@2.1.1` - - `@trigger.dev/integration-kit@2.1.1` - -## 2.1.0 - -### Minor Changes - -- Integrations are now simpler and support authentication during webhook registration ([`878da3c0`](https://github.com/triggerdotdev/trigger.dev/commit/878da3c01f0a4dfaf33a1f8943a7ad4eed8b8877)) - -### Patch Changes - -- Updated dependencies: - - `@trigger.dev/integration-kit@2.1.0` - - `@trigger.dev/sdk@2.1.0` - -## 2.1.0-beta.1 - -### Patch Changes - -- Updated dependencies: - - `@trigger.dev/integration-kit@2.1.0-beta.1` - - `@trigger.dev/sdk@2.1.0-beta.1` - -## 2.1.0-beta.0 - -### Minor Changes - -- Integrations are now simpler and support authentication during webhook registration ([`878da3c0`](https://github.com/triggerdotdev/trigger.dev/commit/878da3c01f0a4dfaf33a1f8943a7ad4eed8b8877)) - -### Patch Changes - -- Updated dependencies: - - `@trigger.dev/integration-kit@2.1.0-beta.0` - - `@trigger.dev/sdk@2.1.0-beta.0` diff --git a/integrations/airtable/README.md b/integrations/airtable/README.md deleted file mode 100644 index 4fb788622..000000000 --- a/integrations/airtable/README.md +++ /dev/null @@ -1,3 +0,0 @@ - -# @trigger.dev/airtable - \ No newline at end of file diff --git a/integrations/airtable/package.json b/integrations/airtable/package.json deleted file mode 100644 index de0a5ea41..000000000 --- a/integrations/airtable/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "@trigger.dev/airtable", - "version": "3.0.0-beta.55", - "description": "Trigger.dev integration for airtable", - "main": "./dist/index.js", - "types": "./dist/index.d.ts", - "publishConfig": { - "access": "public" - }, - "files": [ - "dist" - ], - "devDependencies": { - "@trigger.dev/tsconfig": "workspace:*", - "@types/node": "16.x", - "rimraf": "^3.0.2", - "tsup": "8.0.1", - "typescript": "^5.3.0", - "@trigger.dev/tsup": "workspace:*" - }, - "scripts": { - "clean": "rimraf dist", - "build": "npm run clean && npm run build:tsup", - "build:tsup": "tsup", - "typecheck": "tsc --noEmit" - }, - "dependencies": { - "@trigger.dev/integration-kit": "workspace:^3.0.0-beta.55", - "@trigger.dev/sdk": "workspace:^3.0.0-beta.55", - "airtable": "^0.12.1", - "zod": "3.22.3" - }, - "engines": { - "node": ">=16.8.0" - }, - "exports": { - ".": { - "import": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "require": "./dist/index.js", - "types": "./dist/index.d.ts" - }, - "./package.json": "./package.json" - }, - "module": "./dist/index.mjs" -} diff --git a/integrations/airtable/src/base.ts b/integrations/airtable/src/base.ts deleted file mode 100644 index 0032aa916..000000000 --- a/integrations/airtable/src/base.ts +++ /dev/null @@ -1,164 +0,0 @@ -import { DisplayProperty, IntegrationTaskKey } from "@trigger.dev/sdk"; -import AirtableSDK from "airtable"; -import { AirtableFieldSet, AirtableRecord, AirtableRunTask } from "."; - -type TableParams> = { - tableName: string; -} & Params; - -export type AirtableRecordsParams = TableParams<{}>; -export type AirtableRecords = AirtableSDK.Records; - -export class Base { - constructor( - private runTask: AirtableRunTask, - public baseId: string - ) {} - - table(tableName: string) { - return new Table(this.runTask, this.baseId, tableName); - } -} - -export class Table { - runTask: AirtableRunTask; - baseId: string; - tableName: string; - - constructor(runTask: AirtableRunTask, baseId: string, tableName: string) { - this.runTask = runTask; - this.baseId = baseId; - this.tableName = tableName; - } - - getRecords(key: IntegrationTaskKey, params?: AirtableSDK.SelectOptions) { - return this.runTask( - key, - async (client) => { - const result = await client - .base(this.baseId) - // official types are wrong - we need to use our extended AirtableFieldSet here - // @ts-ignore - .table(this.tableName) - .select(params) - .all(); - return result.map((record) => toSerializableRecord(record)); - }, - { - name: "Get Records", - params, - properties: [...tableParams({ baseId: this.baseId, tableName: this.tableName })], - } - ); - } - - getRecord(key: IntegrationTaskKey, recordId: string) { - return this.runTask( - key, - async (client) => { - // official types are wrong - we need to use our extended AirtableFieldSet here - // @ts-ignore - const result = await client.base(this.baseId).table(this.tableName).find(recordId); - return toSerializableRecord(result); - }, - { - name: "Get Record", - params: { recordId }, - properties: [ - ...tableParams({ baseId: this.baseId, tableName: this.tableName }), - { label: "Record", text: recordId }, - ], - } - ); - } - - createRecords(key: IntegrationTaskKey, records: { fields: Partial }[]) { - return this.runTask( - key, - async (client) => { - const result = await client - .base(this.baseId) - // official types are wrong - we need to use our extended AirtableFieldSet here - // @ts-ignore - .table(this.tableName) - .create(records); - return result.map((record) => toSerializableRecord(record)); - }, - { - name: "Create Records", - params: records, - properties: [ - ...tableParams({ baseId: this.baseId, tableName: this.tableName }), - { label: "Created records", text: records.length.toString() }, - ], - } - ); - } - - updateRecords(key: IntegrationTaskKey, records: { id: string; fields: Partial }[]) { - return this.runTask( - key, - async (client) => { - const result = await client - .base(this.baseId) - // official types are wrong - we need to use our extended AirtableFieldSet here - // @ts-ignore - .table(this.tableName) - .update(records); - return result.map((record) => toSerializableRecord(record)); - }, - { - name: "Update Records", - params: records, - properties: [ - ...tableParams({ baseId: this.baseId, tableName: this.tableName }), - { label: "Updated records", text: records.length.toString() }, - ], - } - ); - } - - deleteRecords(key: IntegrationTaskKey, recordIds: string[]) { - return this.runTask( - key, - async (client) => { - const result = await client - .base(this.baseId) - // official types are wrong - we need to use our extended AirtableFieldSet here - // @ts-ignore - .table(this.tableName) - .destroy(recordIds); - return result.map((record) => toSerializableRecord(record)); - }, - { - name: "Delete Records", - params: { recordIds }, - properties: [ - ...tableParams({ baseId: this.baseId, tableName: this.tableName }), - { label: "Deleted records", text: recordIds.length.toString() }, - ], - } - ); - } -} - -function toSerializableRecord(record: AirtableRecord) { - return { - id: record.id, - fields: record.fields, - commentCount: record.commentCount, - } as AirtableRecord; -} - -function tableParams(params: { baseId: string; tableName: string }): DisplayProperty[] { - return [ - { - label: "Base", - text: params.baseId, - }, - { - label: "Table", - text: params.tableName, - }, - ]; -} diff --git a/integrations/airtable/src/events.ts b/integrations/airtable/src/events.ts deleted file mode 100644 index 1d4c83fc3..000000000 --- a/integrations/airtable/src/events.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { EventSpecification } from "@trigger.dev/sdk"; -import { WebhookPayload } from "./schemas"; - -type OnTableChanged = WebhookPayload; - -export const onTableChanged: EventSpecification = { - name: "changed", - title: "On Table Changed", - source: "airtable.com", - icon: "airtable", - //todo properties with base and table (if there is one), maybe other specs too - // properties: [ - //todo: add a payload example - // examples: [ - // { - // id: "recurring", - // name: "Recurring Price", - // icon: "airtable", - // payload: { - // id: "price_1NYV6vI0XSgju2urKsSmI53v", - // object: "price", - // active: true, - // billing_scheme: "per_unit", - // created: 1690467853, - // currency: "usd", - // custom_unit_amount: null, - // livemode: false, - // lookup_key: null, - // metadata: {}, - // nickname: null, - // product: "prod_OLBTh0QPxDXkIU", - // recurring: { - // aggregate_usage: null, - // interval: "month", - // interval_count: 1, - // trial_period_days: null, - // usage_type: "licensed", - // }, - // tax_behavior: "unspecified", - // tiers_mode: null, - // transform_quantity: null, - // type: "recurring", - // unit_amount: 1500, - // unit_amount_decimal: "1500", - // }, - // }, - // ], - parsePayload: (payload) => payload as OnTableChanged, - runProperties: (payload) => [{ label: "Change source", text: payload.actionMetadata.source }], -}; diff --git a/integrations/airtable/src/index.ts b/integrations/airtable/src/index.ts deleted file mode 100644 index 8cab7baf5..000000000 --- a/integrations/airtable/src/index.ts +++ /dev/null @@ -1,166 +0,0 @@ -import { Prettify } from "@trigger.dev/integration-kit"; -import { - Json, - retry, - type ConnectionAuth, - type IO, - type IOTask, - type IntegrationTaskKey, - type RunTaskErrorCallback, - type RunTaskOptions, - type TriggerIntegration, -} from "@trigger.dev/sdk"; -import AirtableSDK from "airtable"; -import { Base } from "./base"; -import { Webhooks, createWebhookSource } from "./webhooks"; - -export * from "./base"; -export * from "./types"; - -export type AirtableIntegrationOptions = { - /** An ID for this client */ - id: string; - /** Use this if you pass in a [Personal Access Token](https://airtable.com/developers/web/guides/personal-access-tokens). If omitted, it will use OAuth. */ - token?: string; -}; - -export type AirtableRunTask = InstanceType["runTask"]; - -export class Airtable implements TriggerIntegration { - // @internal - private _options: AirtableIntegrationOptions; - // @internal - private _client?: AirtableSDK; - // @internal - private _io?: IO; - // @internal - private _connectionKey?: string; - - constructor(options: Prettify) { - if (Object.keys(options).includes("token") && !options.token) { - throw `Can't create Airtable integration (${options.id}) as token was passed in but undefined`; - } - - this._options = options; - } - - get authSource() { - return this._options.token ? ("LOCAL" as const) : ("HOSTED" as const); - } - - get id() { - return this._options.id; - } - - get metadata() { - return { id: "airtable", name: "Airtable" }; - } - - get source() { - return createWebhookSource(this); - } - - cloneForRun(io: IO, connectionKey: string, auth?: ConnectionAuth) { - const airtable = new Airtable(this._options); - airtable._io = io; - airtable._connectionKey = connectionKey; - airtable._client = this.createClient(auth); - return airtable; - } - - createClient(auth?: ConnectionAuth) { - if (auth) { - return new AirtableSDK({ - apiKey: auth.accessToken, - }); - } - - if (this._options.token) { - return new AirtableSDK({ - apiKey: this._options.token, - }); - } - - throw new Error("No auth"); - } - - runTask | void>( - key: IntegrationTaskKey, - callback: (client: AirtableSDK, task: IOTask, io: IO) => Promise, - options?: RunTaskOptions, - errorCallback?: RunTaskErrorCallback - ): Promise { - if (!this._io) throw new Error("No IO"); - if (!this._connectionKey) throw new Error("No connection key"); - - return this._io.runTask( - key, - (task, io) => { - if (!this._client) throw new Error("No client"); - return callback(this._client, task, io); - }, - { - icon: "airtable", - retry: retry.standardBackoff, - ...(options ?? {}), - connectionKey: this._connectionKey, - }, - errorCallback ?? onError - ); - } - - base(baseId: string) { - return new Base(this.runTask.bind(this), baseId); - } - - //todo these require batch support because they send too many events - // onTableChanges(params: { - // baseId: string; - // tableId?: string; - // changeTypes?: WebhookChangeType[]; - // dataTypes?: WebhookDataType[]; - // }) { - // return createWebhookTrigger(this.source, events.onTableChanged, params, { - // changeTypes: params.changeTypes ?? ["add", "remove", "update"], - // dataTypes: ["tableData", "tableFields", "tableMetadata"], - // }); - // } - - webhooks() { - return new Webhooks(this.runTask.bind(this)); - } -} - -function isAirtableApiError(error: unknown): error is AirtableSDK.Error { - if (typeof error !== "object" || error === null) { - return false; - } - - const airtableError = error as AirtableSDK.Error; - - return ( - typeof airtableError.error === "string" && - typeof airtableError.message === "string" && - typeof airtableError.statusCode === "number" - ); -} - -export function onError(error: unknown): ReturnType { - if (!isAirtableApiError(error)) { - return; - } - - if (error.statusCode === 429) { - // see: https://airtable.com/developers/web/api/rate-limits - return { - retryAt: new Date(Date.now() + 30 * 1000), - }; - } - - if (error.statusCode >= 400 && error.statusCode < 500) { - // see: https://airtable.com/developers/web/api/errors#user-error-codes - return { - skipRetrying: true, - }; - } -} diff --git a/integrations/airtable/src/schemas.ts b/integrations/airtable/src/schemas.ts deleted file mode 100644 index a8c7fd52f..000000000 --- a/integrations/airtable/src/schemas.ts +++ /dev/null @@ -1,176 +0,0 @@ -import { z } from "zod"; - -const UserSourceMetadata = z.object({ - user: z.object({ - id: z.string(), - email: z.string(), - permissionLevel: z.union([ - z.literal("none"), - z.literal("read"), - z.literal("comment"), - z.literal("edit"), - z.literal("create"), - ]), - name: z.string().optional(), - profilePicUrl: z.string().optional(), - }), -}); - -const WebhookAction = z.discriminatedUnion("source", [ - z.object({ - source: z.literal("client"), - sourceMetadata: UserSourceMetadata, - }), - z.object({ - source: z.literal("publicApi"), - sourceMetadata: UserSourceMetadata, - }), - z.object({ - source: z.literal("formSubmission"), - sourceMetadata: z.object({ - viewId: z.string(), - }), - }), - z.object({ - source: z.literal("automation"), - sourceMetadata: z.object({ - automationId: z.string(), - }), - }), - z.object({ - source: z.literal("system"), - }), - z.object({ - source: z.literal("sync"), - }), - z.object({ - source: z.literal("anonymousUser"), - }), - z.object({ - source: z.literal("unknown"), - }), -]); - -const CreatedFieldSchema = z.object({ - name: z.string(), - type: z.union([ - z.literal("singleLineText"), - z.literal("email"), - z.literal("url"), - z.literal("multilineText"), - z.literal("number"), - z.literal("percent"), - z.literal("currency"), - z.literal("singleSelect"), - z.literal("multipleSelects"), - z.literal("singleCollaborator"), - z.literal("multipleCollaborators"), - z.literal("multipleRecordLinks"), - z.literal("date"), - z.literal("dateTime"), - z.literal("phoneNumber"), - z.literal("multipleAttachments"), - z.literal("checkbox"), - z.literal("formula"), - z.literal("createdTime"), - z.literal("rollup"), - z.literal("count"), - z.literal("lookup"), - z.literal("multipleLookupValues"), - z.literal("autoNumber"), - z.literal("barcode"), - z.literal("rating"), - z.literal("richText"), - z.literal("duration"), - z.literal("lastModifiedTime"), - z.literal("button"), - z.literal("createdBy"), - z.literal("lastModifiedBy"), - z.literal("externalSyncSource"), - z.literal("aiText"), - z.string(), - ]), -}); - -const ChangedRecordFieldSchema = z.object({ - cellValuesByFieldId: z.record(z.any()), -}); - -const CreatedRecordSchema = ChangedRecordFieldSchema.and( - z.object({ - createdTime: z.string(), - }) -); - -const ChangedRecordSchema = z.object({ - current: ChangedRecordFieldSchema, - previous: ChangedRecordFieldSchema.optional(), - unchanged: ChangedRecordFieldSchema.optional(), -}); - -const ChangedTableMetadata = z.object({ - name: z.string().optional(), - description: z.string().nullish(), -}); - -const ChangedTableSchema = z.object({ - changedViewsById: z - .record( - z.object({ - changedRecordsById: z.record(ChangedRecordSchema).optional(), - createdRecordsById: z.record(CreatedRecordSchema).optional(), - destroyedRecordIds: z.array(z.string()).optional(), - }) - ) - .optional(), - changedFieldsById: z - .record( - z.object({ - current: CreatedFieldSchema.partial(), - previous: CreatedFieldSchema.partial().optional(), - }) - ) - .optional(), - changedRecordsById: z.record(ChangedRecordSchema).optional(), - createdFieldsById: z.record(CreatedFieldSchema).optional(), - createdRecordsById: z.record(CreatedRecordSchema).optional(), - changedMetadata: z - .object({ - current: ChangedTableMetadata, - previous: ChangedTableMetadata.optional(), - }) - .optional(), - destroyedFieldIds: z.array(z.string()).optional(), - destroyedRecordIds: z.array(z.string()).optional(), -}); - -const CreatedTableSchema = z.object({ - metadata: z - .object({ - name: z.string(), - description: z.string().optional(), - }) - .optional(), - fieldsById: z.record(CreatedFieldSchema).optional(), - recordsById: z.record(CreatedRecordSchema).optional(), -}); - -export const WebhookPayloadSchema = z.object({ - timestamp: z.coerce.date(), - baseTransactionNumber: z.number(), - payloadFormat: z.literal("v0"), - actionMetadata: WebhookAction, - changedTablesById: z.record(ChangedTableSchema).optional(), - createdTablesById: z.record(CreatedTableSchema).optional(), - destroyedTableIds: z.array(z.string()).optional(), -}); - -export type WebhookPayload = z.infer; - -export const ListWebhooksResponseSchema = z.object({ - cursor: z.number(), - mightHaveMore: z.boolean(), - payloads: z.array(WebhookPayloadSchema), -}); - -export type ListWebhooksResponse = z.infer; diff --git a/integrations/airtable/src/types.ts b/integrations/airtable/src/types.ts deleted file mode 100644 index a85a4a4e7..000000000 --- a/integrations/airtable/src/types.ts +++ /dev/null @@ -1,58 +0,0 @@ -export type AirtableFieldSet = { - [key: string]: - | undefined - | string - | number - | boolean - | Collaborator - | Collaborator[] - | string[] - | Attachment[] - | Formula; -}; - -export type Collaborator = { - id: string; - email: string; - name: string; -}; - -export type Attachment = { - id: string; - url: string; - filename: string; - size: number; - type: string; - thumbnails?: { - small: Thumbnail; - large: Thumbnail; - full: Thumbnail; - }; -}; - -export type FormulaError = { - error: string; -}; - -export type FormulaSpecialValue = { - specialValue: "Infinity" | "NaN"; -}; - -export type Formula = string | number | FormulaError | FormulaSpecialValue; - -export type Thumbnail = { - url: string; - width: number; - height: number; -}; - -export type AirtableRecord = { - id: string; - fields: TFields; - commentCount?: number; -}; - -export type CreateAirtableRecord = Pick< - AirtableRecord>, - "fields" ->; diff --git a/integrations/airtable/src/webhooks.ts b/integrations/airtable/src/webhooks.ts deleted file mode 100644 index f993c9357..000000000 --- a/integrations/airtable/src/webhooks.ts +++ /dev/null @@ -1,464 +0,0 @@ -import { EventFilter, IntegrationTaskKey, verifyRequestSignature } from "@trigger.dev/sdk"; -import AirtableSDK from "airtable"; -import { z } from "zod"; -import * as events from "./events"; -import { Airtable, AirtableRunTask } from "./index"; -import { ListWebhooksResponse, ListWebhooksResponseSchema } from "./schemas"; -import { WebhookSource, WebhookTrigger } from "@trigger.dev/sdk"; -import { registerJobNamespace } from "@trigger.dev/integration-kit"; -import { Buffer } from "node:buffer"; - -const WebhookFromSourceSchema = z.union([ - z.literal("formSubmission"), - z.literal("client"), - z.literal("anonymousUser"), - // we don't currently support these as they can cause feedback loops - // z.literal("publicApi"), - // z.literal("automation"), - // z.literal("system"), - // z.literal("sync"), - // z.literal("unknown"), -]); - -type WebhookFromSource = z.infer; - -const WebhookDataTypeSchema = z.union([ - z.literal("tableData"), - z.literal("tableFields"), - z.literal("tableMetadata"), -]); - -export type WebhookDataType = z.infer; - -const WebhookChangeTypeSchema = z.union([ - z.literal("add"), - z.literal("remove"), - z.literal("update"), -]); - -export type WebhookChangeType = z.infer; -type WebhookSpecification = { - filters: { - dataTypes: WebhookDataType[]; - recordChangeScope?: string; - changeTypes?: WebhookChangeType[]; - fromSources?: WebhookFromSource[]; - }; -}; - -const AirtableErrorBodySchema = z - .union([ - z.object({ - error: z.string(), - }), - z.object({ - error: z.object({ - type: z.string(), - message: z.string().optional(), - }), - }), - ]) - .transform((body) => { - if (typeof body.error === "string") { - return { - type: body.error, - }; - } else { - return { - type: body.error.type, - message: body.error.message, - }; - } - }); - -const apiUrl = "https://api.airtable.com/v0/bases"; - -export class Webhooks { - runTask: AirtableRunTask; - - constructor(runTask: AirtableRunTask) { - this.runTask = runTask; - } - - create( - key: IntegrationTaskKey, - { baseId, url, options }: { baseId: string; url: string; options: WebhookSpecification } - ): Promise { - return this.runTask( - key, - async (client, task, io) => { - const response = await fetch(`${apiUrl}/${baseId}/webhooks`, { - method: "POST", - headers: { - Authorization: `Bearer ${client._apiKey}`, - "Content-Type": "application/json", - }, - body: JSON.stringify({ - notificationUrl: url, - specification: { - options: { - ...options, - includes: { - includePreviousCellValues: true, - includePreviousFieldDefinitions: true, - }, - }, - }, - }), - redirect: "follow", - }); - - if (!response.ok) { - await handleWebhookError(response, "WEBHOOK_CREATE"); - } - - const webhook = await response.json(); - const parsed = WebhookRegistrationDataSchema.parse(webhook); - return parsed; - }, - { - name: "Create webhook", - params: { - baseId, - url, - options, - }, - } - ); - } - - list(key: IntegrationTaskKey, { baseId }: { baseId: string }): Promise { - return this.runTask( - key, - async (client, task, io) => { - const response = await fetch(`${apiUrl}/${baseId}/webhooks`, { - headers: { - Authorization: `Bearer ${client._apiKey}`, - }, - redirect: "follow", - }); - - if (!response.ok) { - await handleWebhookError(response, "WEBHOOK_LIST"); - } - - const webhook = await response.json(); - const parsed = WebhookListDataSchema.parse(webhook); - return parsed; - }, - { - name: "List webhooks", - params: { - baseId, - }, - } - ); - } - - delete(key: IntegrationTaskKey, { baseId, webhookId }: { baseId: string; webhookId: string }) { - return this.runTask( - key, - async (client, task, io) => { - const response = await fetch(`${apiUrl}/${baseId}/webhooks/${webhookId}`, { - method: "DELETE", - headers: { - Authorization: `Bearer ${client._apiKey}`, - }, - redirect: "follow", - }); - - if (!response.ok) { - await handleWebhookError(response, "WEBHOOK_DELETE"); - } - }, - { - name: "Delete webhook", - params: { - baseId, - webhookId, - }, - } - ); - } - - async update( - key: IntegrationTaskKey, - { - baseId, - url, - webhookId, - options, - }: { baseId: string; url: string; webhookId: string; options: WebhookSpecification } - ) { - await this.delete(`${key}-delete`, { baseId, webhookId }); - return await this.create(`${key}-create`, { baseId, url, options }); - } -} - -type AirtableEvents = (typeof events)[keyof typeof events]; - -export type TriggerParams = { - baseId: string; - filter?: EventFilter; -}; - -type CreateWebhookTriggersResult = WebhookTrigger< - TEventSpecification, - ReturnType ->; - -export function createWebhookTrigger( - source: ReturnType, - event: TEventSpecification, - params: TriggerParams, - config: { - dataTypes: WebhookDataType[]; - changeTypes?: WebhookChangeType[]; - fromSources?: WebhookFromSource[]; - } -): CreateWebhookTriggersResult { - return new WebhookTrigger({ - event, - params, - source, - config, - }); -} - -const WebhookRegistrationDataSchema = z.object({ - id: z.string(), - expirationTime: z.string(), - macSecretBase64: z.string(), -}); - -type WebhookRegistrationData = z.infer; - -const WebhookListDataSchema = z.object({ - webhooks: z.array( - z.object({ - id: z.string(), - notificationUrl: z.string(), - expirationTime: z.coerce.date(), - areNotificationsEnabled: z.boolean(), - isHookEnabled: z.boolean(), - }) - ), -}); - -type WebhookListData = z.infer; - -const getSpecification = (config: Record, params: any): WebhookSpecification => { - return { - filters: { - dataTypes: config.dataTypes as WebhookDataType[], - changeTypes: config.changeTypes - ? (config.changeTypes as WebhookChangeType[]) - : ["add", "remove", "update"], - fromSources: (config.fromSources ?? [ - "client", - "anonymousUser", - "formSubmission", - ]) as WebhookFromSource[], - recordChangeScope: params?.tableId, - }, - }; -}; - -export function createWebhookSource( - integration: Airtable -): WebhookSource< - Airtable, - { baseId: string; tableId?: string }, - { dataTypes: WebhookDataType[]; fromSources?: WebhookFromSource[] } -> { - return new WebhookSource({ - id: "airtable.webhook", - schemas: { - params: z.object({ baseId: z.string(), tableId: z.string().optional() }), - config: z.object({ - dataTypes: z.array(WebhookDataTypeSchema), - fromSources: z.array(WebhookFromSourceSchema).optional(), - }), - }, - version: "0.1.0", - integration, - filter: (params, options) => ({ - actionMetadata: { - source: options?.fromSources ?? ["client", "anonymousUser", "formSubmission"], - }, - }), - key: (params) => - `airtable.webhook.${params.baseId}${params.tableId ? `.${params.tableId}` : ""}`, - crud: { - create: async ({ io, ctx }) => { - const webhook = await io.integration.webhooks().create("create-webhook", { - url: ctx.url, - baseId: ctx.params?.baseId, - options: getSpecification(ctx.config.desired, ctx.params), - }); - - await io.store.job.set("set-id", "webhook-id", webhook.id); - await io.store.job.set("set-secret", "webhook-secret-base64", webhook.macSecretBase64); - }, - read: async ({ io, ctx }) => { - const listResponse = await io.integration.webhooks().list("list-webhooks", { - baseId: ctx.params?.baseId, - }); - - const existingWebhook = listResponse.webhooks.find((w) => w.notificationUrl === ctx.url); - - if (!existingWebhook) { - return await io.store.job.delete("delete-stale-webhook-id", "webhook-id"); - } - - await io.store.job.set("set-webhook-id", "webhook-id", existingWebhook.id); - }, - delete: async ({ io, ctx }) => { - const webhookId = await io.store.job.get("get-webhook-id", "webhook-id"); - - if (!webhookId) { - throw new Error("Missing webhook ID for delete operation."); - } - - await io.integration.webhooks().delete("delete-webhook", { - baseId: ctx.params?.baseId, - webhookId, - }); - }, - }, - verify: async ({ request, client, ctx }) => { - // TODO: should pass namespaced store instead, e.g. client.store.webhookRegistration.get() - const secretBase64 = await client.store.env.get( - `${registerJobNamespace(ctx.key)}:webhook-secret-base64` - ); - - if (!secretBase64) { - throw new Error("Missing secret for verification."); - } - - return await verifyRequestSignature({ - request, - headerName: "x-airtable-content-mac", - secret: Buffer.from(secretBase64, "base64"), - algorithm: "sha256", - }); - }, - generateEvents: async ({ request, client, ctx }) => { - console.log("[@trigger.dev/airtable] Handling webhook payload"); - - const webhookPayload = ReceivedPayload.parse(await request.json()); - - const webhookId = await client.store.env.get( - `${registerJobNamespace(ctx.key)}:webhook-id` - ); - - const cursorKey = `cursor-${webhookId}`; - const cursor = await client.store.env.get(cursorKey); - - // TODO: get auth back - const airtable = integration.createClient(); - - const response = await getAllPayloads( - webhookPayload.base.id, - webhookPayload.webhook.id, - airtable, - cursor - ); - - if (!response) { - return console.log("[@trigger.dev/airtable] No payload fetch response, nothing to do!"); - } - - await client.store.env.set(cursorKey, response.cursor); - - const eventsFromResponse = response.payloads.map((payload) => ({ - id: `${payload.timestamp.getTime()}-${payload.baseTransactionNumber}`, - payload, - source: "airtable.com", - name: "changed", - timestamp: payload.timestamp, - })); - - await client.sendEvents(eventsFromResponse); - }, - }); -} - -/** This is the data received from Airtable. It's not useful on its own */ -const ReceivedPayload = z.object({ - base: z.object({ - id: z.string(), - }), - webhook: z.object({ - id: z.string(), - }), - timestamp: z.coerce.date(), -}); - -async function getAllPayloads( - baseId: string, - webhookId: string, - sdk: AirtableSDK, - cursor: number | undefined -) { - let response: ListWebhooksResponse | undefined = undefined; - let hasMore = true; - - while (hasMore) { - const newResponse = await getPayload(baseId, webhookId, sdk, cursor); - cursor = newResponse.cursor; - hasMore = newResponse.mightHaveMore; - - if (response) { - response.payloads.push(...newResponse.payloads); - } else { - response = newResponse; - } - } - - return response; -} - -async function getPayload( - baseId: string, - webhookId: string, - sdk: AirtableSDK, - cursor: number | undefined -) { - const url = new URL(`${apiUrl}/${baseId}/webhooks/${webhookId}/payloads`); - if (cursor) { - url.searchParams.append("cursor", cursor.toString()); - } - - const response = await fetch(url.href, { - headers: { - Authorization: `Bearer ${sdk._apiKey}`, - }, - redirect: "follow", - }); - - if (!response.ok) { - throw new Error(`Failed to list webhooks: ${response.statusText}`); - } - - const webhook = await response.json(); - return ListWebhooksResponseSchema.parse(webhook); -} - -async function handleWebhookError(response: Response, errorType: string) { - const rawErrorBody = await response.json(); - - const parsedErrorBody = AirtableErrorBodySchema.safeParse(rawErrorBody); - - if (!parsedErrorBody.success) { - throw new AirtableSDK.Error( - `${errorType}_PARSE_ERROR`, - `${response.statusText}:\n${rawErrorBody}`, - response.status - ); - } - - const { type, message } = parsedErrorBody.data; - - throw new AirtableSDK.Error(type, message ?? response.statusText, response.status); -} diff --git a/integrations/airtable/tsconfig.json b/integrations/airtable/tsconfig.json deleted file mode 100644 index a816ed394..000000000 --- a/integrations/airtable/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "@trigger.dev/tsconfig/node18.json", - "include": ["./src/**/*.ts", "tsup.config.ts"], - "compilerOptions": { - "lib": ["DOM", "DOM.Iterable", "ES2019"], - "paths": { - "@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"], - "@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"], - "@trigger.dev/integration-kit/*": ["../../packages/integration-kit/src/*"], - "@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"], - "@trigger.dev/tsup/*": ["../../config-packages/tsup/src/*"], - "@trigger.dev/tsup": ["../../config-packages/tsup/src/index"] - }, - "declaration": false, - "declarationMap": false, - "baseUrl": ".", - "stripInternal": true - }, - "exclude": ["node_modules"] -} diff --git a/integrations/airtable/tsup.config.ts b/integrations/airtable/tsup.config.ts deleted file mode 100644 index 1d1b59a08..000000000 --- a/integrations/airtable/tsup.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { defineConfigPackage } from "@trigger.dev/tsup"; - -export default defineConfigPackage; diff --git a/integrations/github/CHANGELOG.md b/integrations/github/CHANGELOG.md deleted file mode 100644 index 87736f1ef..000000000 --- a/integrations/github/CHANGELOG.md +++ /dev/null @@ -1,1052 +0,0 @@ -# @trigger.dev/github - -## 3.0.0-beta.55 - -### Patch Changes - -- Updated dependencies [0591db5f2] - - @trigger.dev/sdk@3.0.0-beta.55 - - @trigger.dev/integration-kit@3.0.0-beta.55 - -## 3.0.0-beta.54 - -### Patch Changes - -- Updated dependencies [728eeeff6] - - @trigger.dev/sdk@3.0.0-beta.54 - - @trigger.dev/integration-kit@3.0.0-beta.54 - -## 3.0.0-beta.53 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.53 -- @trigger.dev/sdk@3.0.0-beta.53 - -## 3.0.0-beta.52 - -### Patch Changes - -- Updated dependencies [8cae1d087] - - @trigger.dev/sdk@3.0.0-beta.52 - - @trigger.dev/integration-kit@3.0.0-beta.52 - -## 3.0.0-beta.51 - -### Patch Changes - -- Updated dependencies [979bee50d] -- Updated dependencies [086a0f95c] -- Updated dependencies [55264657d] - - @trigger.dev/sdk@3.0.0-beta.51 - - @trigger.dev/integration-kit@3.0.0-beta.51 - -## 3.0.0-beta.50 - -### Patch Changes - -- Updated dependencies [8ba998794] - - @trigger.dev/sdk@3.0.0-beta.50 - - @trigger.dev/integration-kit@3.0.0-beta.50 - -## 3.0.0-beta.49 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.49 -- @trigger.dev/sdk@3.0.0-beta.49 - -## 3.0.0-beta.48 - -### Patch Changes - -- Updated dependencies [ecf1110ab] - - @trigger.dev/sdk@3.0.0-beta.48 - - @trigger.dev/integration-kit@3.0.0-beta.48 - -## 3.0.0-beta.47 - -### Patch Changes - -- Updated dependencies [4f95c9de4] - - @trigger.dev/sdk@3.0.0-beta.47 - - @trigger.dev/integration-kit@3.0.0-beta.47 - -## 3.0.0-beta.46 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.46 -- @trigger.dev/sdk@3.0.0-beta.46 - -## 3.0.0-beta.45 - -### Patch Changes - -- Updated dependencies [0e77e7ef7] - - @trigger.dev/sdk@3.0.0-beta.45 - - @trigger.dev/integration-kit@3.0.0-beta.45 - -## 3.0.0-beta.44 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.44 -- @trigger.dev/sdk@3.0.0-beta.44 - -## 3.0.0-beta.43 - -### Patch Changes - -- Updated dependencies [34ca7667d] - - @trigger.dev/sdk@3.0.0-beta.43 - - @trigger.dev/integration-kit@3.0.0-beta.43 - -## 3.0.0-beta.42 - -### Patch Changes - -- Updated dependencies [ecef19966] - - @trigger.dev/sdk@3.0.0-beta.42 - - @trigger.dev/integration-kit@3.0.0-beta.42 - -## 3.0.0-beta.41 - -### Patch Changes - -- Updated dependencies [7c36a1a4b] - - @trigger.dev/sdk@3.0.0-beta.41 - - @trigger.dev/integration-kit@3.0.0-beta.41 - -## 3.0.0-beta.40 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.40 -- @trigger.dev/sdk@3.0.0-beta.40 - -## 3.0.0-beta.39 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.39 -- @trigger.dev/sdk@3.0.0-beta.39 - -## 3.0.0-beta.38 - -### Patch Changes - -- Updated dependencies [1b90ffbb8] -- Updated dependencies [c405ae711] - - @trigger.dev/sdk@3.0.0-beta.38 - - @trigger.dev/integration-kit@3.0.0-beta.38 - -## 3.0.0-beta.37 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.37 -- @trigger.dev/sdk@3.0.0-beta.37 - -## 3.0.0-beta.36 - -### Patch Changes - -- Updated dependencies [51bb4c887] -- Updated dependencies [ba71f959e] - - @trigger.dev/sdk@3.0.0-beta.36 - - @trigger.dev/integration-kit@3.0.0-beta.36 - -## 3.0.0-beta.35 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.35 -- @trigger.dev/sdk@3.0.0-beta.35 - -## 3.0.0-beta.34 - -### Patch Changes - -- Updated dependencies [3a1b0c486] -- Updated dependencies [3f8b6d8fc] -- Updated dependencies [1281d40e4] - - @trigger.dev/sdk@3.0.0-beta.34 - - @trigger.dev/integration-kit@3.0.0-beta.34 - -## 3.0.0-beta.33 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.33 -- @trigger.dev/sdk@3.0.0-beta.33 - -## 3.0.0-beta.32 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.32 -- @trigger.dev/sdk@3.0.0-beta.32 - -## 3.0.0-beta.31 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.31 -- @trigger.dev/sdk@3.0.0-beta.31 - -## 3.0.0-beta.30 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.30 -- @trigger.dev/sdk@3.0.0-beta.30 - -## 3.0.0-beta.29 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.29 -- @trigger.dev/sdk@3.0.0-beta.29 - -## 3.0.0-beta.28 - -### Patch Changes - -- Updated dependencies [6d9dfbc75] - - @trigger.dev/sdk@3.0.0-beta.28 - - @trigger.dev/integration-kit@3.0.0-beta.28 - -## 3.0.0-beta.27 - -### Patch Changes - -- Updated dependencies [203e00208] - - @trigger.dev/sdk@3.0.0-beta.27 - - @trigger.dev/integration-kit@3.0.0-beta.27 - -## 3.0.0-beta.26 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.26 -- @trigger.dev/sdk@3.0.0-beta.26 - -## 3.0.0-beta.25 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.25 -- @trigger.dev/sdk@3.0.0-beta.25 - -## 3.0.0-beta.24 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.24 -- @trigger.dev/sdk@3.0.0-beta.24 - -## 3.0.0-beta.23 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.23 -- @trigger.dev/sdk@3.0.0-beta.23 - -## 3.0.0-beta.22 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.22 -- @trigger.dev/sdk@3.0.0-beta.22 - -## 3.0.0-beta.21 - -### Patch Changes - -- Updated dependencies [9491a1649] - - @trigger.dev/sdk@3.0.0-beta.21 - - @trigger.dev/integration-kit@3.0.0-beta.21 - -## 3.0.0-beta.20 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.20 -- @trigger.dev/sdk@3.0.0-beta.20 - -## 3.0.0-beta.19 - -### Patch Changes - -- Updated dependencies [e9a63a486] - - @trigger.dev/sdk@3.0.0-beta.19 - - @trigger.dev/integration-kit@3.0.0-beta.19 - -## 3.0.0-beta.18 - -### Patch Changes - -- Updated dependencies [b68012f81] -- Updated dependencies [b68012f81] -- Updated dependencies [b68012f81] - - @trigger.dev/sdk@3.0.0-beta.18 - - @trigger.dev/integration-kit@3.0.0-beta.18 - -## 3.0.0-beta.17 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.17 -- @trigger.dev/sdk@3.0.0-beta.17 - -## 3.0.0-beta.16 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.16 -- @trigger.dev/sdk@3.0.0-beta.16 - -## 3.0.0-beta.15 - -### Patch Changes - -- Updated dependencies [374edef02] -- Updated dependencies [26093896d] - - @trigger.dev/sdk@3.0.0-beta.15 - - @trigger.dev/integration-kit@3.0.0-beta.15 - -## 3.0.0-beta.14 - -### Patch Changes - -- Updated dependencies [c9e1a3e9c] - - @trigger.dev/sdk@3.0.0-beta.14 - - @trigger.dev/integration-kit@3.0.0-beta.14 - -## 3.0.0-beta.13 - -### Patch Changes - -- Updated dependencies [4986bfda2] -- Updated dependencies [44e1b8754] -- Updated dependencies [4986bfda2] -- Updated dependencies [4986bfda2] - - @trigger.dev/sdk@3.0.0-beta.13 - - @trigger.dev/integration-kit@3.0.0-beta.13 - -## 3.0.0-beta.12 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.12 -- @trigger.dev/sdk@3.0.0-beta.12 - -## 3.0.0-beta.11 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.11 -- @trigger.dev/sdk@3.0.0-beta.11 - -## 3.0.0-beta.7 - -### Patch Changes - -- Updated dependencies [f854cb90e] -- Updated dependencies [f854cb90e] - - @trigger.dev/sdk@3.0.0-beta.7 - - @trigger.dev/integration-kit@3.0.0-beta.7 - -## 3.0.0-beta.6 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.6 -- @trigger.dev/sdk@3.0.0-beta.6 - -## 3.0.0-beta.5 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.5 -- @trigger.dev/sdk@3.0.0-beta.5 - -## 3.0.0-beta.4 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.4 -- @trigger.dev/sdk@3.0.0-beta.4 - -## 3.0.0-beta.3 - -### Patch Changes - -- Updated dependencies [b271742dc] - - @trigger.dev/sdk@3.0.0-beta.3 - - @trigger.dev/integration-kit@3.0.0-beta.3 - -## 3.0.0-beta.2 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.2 -- @trigger.dev/sdk@3.0.0-beta.2 - -## 3.0.0-beta.1 - -### Patch Changes - -- Updated dependencies [b66d5525e] -- Updated dependencies [719c0a0b9] -- Updated dependencies [f93eae300] - - @trigger.dev/sdk@3.0.0-beta.1 - - @trigger.dev/integration-kit@3.0.0-beta.1 - -## 3.0.0-beta.0 - -### Patch Changes - -- Updated dependencies [395abe1b9] - - @trigger.dev/sdk@3.0.0-beta.0 - - @trigger.dev/integration-kit@3.0.0-beta.0 - -## 2.3.18 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.18 -- @trigger.dev/sdk@2.3.18 - -## 2.3.17 - -### Patch Changes - -- Updated dependencies [dd879c8e] - - @trigger.dev/sdk@2.3.17 - - @trigger.dev/integration-kit@2.3.17 - -## 2.3.16 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.16 -- @trigger.dev/sdk@2.3.16 - -## 2.3.15 - -### Patch Changes - -- Updated dependencies [6c4047cf] - - @trigger.dev/sdk@2.3.15 - - @trigger.dev/integration-kit@2.3.15 - -## 2.3.14 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.14 -- @trigger.dev/sdk@2.3.14 - -## 2.3.13 - -### Patch Changes - -- Updated dependencies [a93b554f] -- Updated dependencies [0f342cd1] - - @trigger.dev/sdk@2.3.13 - - @trigger.dev/integration-kit@2.3.13 - -## 2.3.12 - -### Patch Changes - -- Updated dependencies [129f023d] -- Updated dependencies [38f5a903] -- Updated dependencies [ff4ff869] - - @trigger.dev/sdk@2.3.12 - - @trigger.dev/integration-kit@2.3.12 - -## 2.3.11 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.11 -- @trigger.dev/sdk@2.3.11 - -## 2.3.10 - -### Patch Changes - -- Updated dependencies [8277f4d2] -- Updated dependencies [73cb8839] - - @trigger.dev/sdk@2.3.10 - - @trigger.dev/integration-kit@2.3.10 - -## 2.3.9 - -### Patch Changes - -- Updated dependencies [f7bf25f0] - - @trigger.dev/sdk@2.3.9 - - @trigger.dev/integration-kit@2.3.9 - -## 2.3.8 - -### Patch Changes - -- 5060eec0: Update Octokit to account for CVE-2023-50728 - - @trigger.dev/integration-kit@2.3.8 - - @trigger.dev/sdk@2.3.8 - -## 2.3.7 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.7 -- @trigger.dev/sdk@2.3.7 - -## 2.3.6 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.6 -- @trigger.dev/sdk@2.3.6 - -## 2.3.5 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.5 -- @trigger.dev/sdk@2.3.5 - -## 2.3.4 - -### Patch Changes - -- Updated dependencies [6a3c563f] - - @trigger.dev/sdk@2.3.4 - - @trigger.dev/integration-kit@2.3.4 - -## 2.3.3 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.3 -- @trigger.dev/sdk@2.3.3 - -## 2.3.2 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.2 -- @trigger.dev/sdk@2.3.2 - -## 2.3.1 - -### Patch Changes - -- Updated dependencies [f3efcc0c] - - @trigger.dev/sdk@2.3.1 - - @trigger.dev/integration-kit@2.3.1 - -## 2.3.0 - -### Minor Changes - -- 17f6f29d: Support for Deno, Bun and Cloudflare workers, as well as conditionally exporting ESM versions of the package instead of just commonjs. - - Cloudflare worker support requires the node compat flag turned on (https://developers.cloudflare.com/workers/runtime-apis/nodejs/) - -### Patch Changes - -- Updated dependencies [17f6f29d] - - @trigger.dev/integration-kit@2.3.0 - - @trigger.dev/sdk@2.3.0 - -## 2.2.11 - -### Patch Changes - -- Updated dependencies [de652c1d] - - @trigger.dev/sdk@2.2.11 - - @trigger.dev/integration-kit@2.2.11 - -## 2.2.10 - -### Patch Changes - -- @trigger.dev/integration-kit@2.2.10 -- @trigger.dev/sdk@2.2.10 - -## 2.2.9 - -### Patch Changes - -- Updated dependencies [1dcd87a2] -- Updated dependencies [6ebd435e] - - @trigger.dev/sdk@2.2.9 - - @trigger.dev/integration-kit@2.2.9 - -## 2.2.8 - -### Patch Changes - -- Updated dependencies [067e19fe] -- Updated dependencies [096151c0] - - @trigger.dev/integration-kit@2.2.8 - - @trigger.dev/sdk@2.2.8 - -## 2.2.7 - -### Patch Changes - -- Updated dependencies [756024da] - - @trigger.dev/sdk@2.2.7 - - @trigger.dev/integration-kit@2.2.7 - -## 2.2.6 - -### Patch Changes - -- Updated dependencies [cb1825bf] -- Updated dependencies [cb1825bf] -- Updated dependencies [d0217344] -- Updated dependencies [cb1825bf] - - @trigger.dev/integration-kit@2.2.6 - - @trigger.dev/sdk@2.2.6 - -## 2.2.5 - -### Patch Changes - -- Updated dependencies [7e57f1f3] -- Updated dependencies [cf8f9946] -- Updated dependencies [a74716a1] -- Updated dependencies [620b8383] -- Updated dependencies [620b8383] -- Updated dependencies [4a0f030e] -- Updated dependencies [f4275e50] - - @trigger.dev/sdk@2.2.5 - - @trigger.dev/integration-kit@2.2.5 - -## 2.2.4 - -### Patch Changes - -- Updated dependencies [c1710ae7] -- Updated dependencies [9c4be40a] - - @trigger.dev/sdk@2.2.4 - - @trigger.dev/integration-kit@2.2.4 - -## 2.2.3 - -### Patch Changes - -- Updated dependencies [6e1b8a11] -- Updated dependencies [c4533c36] - - @trigger.dev/sdk@2.2.3 - - @trigger.dev/integration-kit@2.2.3 - -## 2.2.2 - -### Patch Changes - -- @trigger.dev/integration-kit@2.2.2 -- @trigger.dev/sdk@2.2.2 - -## 2.2.1 - -### Patch Changes - -- Updated dependencies [044d38e3] - - @trigger.dev/sdk@2.2.1 - - @trigger.dev/integration-kit@2.2.1 - -## 2.2.0 - -### Patch Changes - -- Updated dependencies [975c5f1d] - - @trigger.dev/integration-kit@2.2.0 - - @trigger.dev/sdk@2.2.0 - -## 2.1.9 - -### Patch Changes - -- 9a187f9e: upgrade zod to 3.22.3 -- Updated dependencies [9a187f9e] -- Updated dependencies [2e9452ab] - - @trigger.dev/sdk@2.1.9 - - @trigger.dev/integration-kit@2.1.9 - -## 2.1.8 - -### Patch Changes - -- 6a992a19: First release of `@trigger.dev/replicate` integration with remote callback support. -- Updated dependencies [6a992a19] -- Updated dependencies [ab9e4a98] -- Updated dependencies [ab9e4a98] - - @trigger.dev/sdk@2.1.8 - - @trigger.dev/integration-kit@2.1.8 - -## 2.1.7 - -### Patch Changes - -- @trigger.dev/integration-kit@2.1.7 -- @trigger.dev/sdk@2.1.7 - -## 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 - -- c0dfa804: Add support for Bring Your Own Auth -- Updated dependencies [ad14983e] -- Updated dependencies [15f17d27] -- Updated dependencies [50137a6f] -- Updated dependencies [c0dfa804] - - @trigger.dev/sdk@2.1.4 - - @trigger.dev/integration-kit@2.1.4 - -## 2.1.3 - -### Patch Changes - -- Updated dependencies: - - `@trigger.dev/sdk@2.1.3` - - `@trigger.dev/integration-kit@2.1.3` - -## 2.1.2 - -### Patch Changes - -- Updated dependencies: - - `@trigger.dev/integration-kit@2.1.2` - - `@trigger.dev/sdk@2.1.2` - -## 2.1.1 - -### Patch Changes - -- Updated dependencies: - - `@trigger.dev/sdk@2.1.1` - - `@trigger.dev/integration-kit@2.1.1` - -## 2.1.0 - -### Minor Changes - -- Integrations are now simpler and support authentication during webhook registration ([`878da3c0`](https://github.com/triggerdotdev/trigger.dev/commit/878da3c01f0a4dfaf33a1f8943a7ad4eed8b8877)) - -### Patch Changes - -- Updated dependencies: - - `@trigger.dev/integration-kit@2.1.0` - - `@trigger.dev/sdk@2.1.0` - -## 2.1.0-beta.1 - -### Patch Changes - -- Updated dependencies: - - `@trigger.dev/integration-kit@2.1.0-beta.1` - - `@trigger.dev/sdk@2.1.0-beta.1` - -## 2.1.0-beta.0 - -### Minor Changes - -- Integrations are now simpler and support authentication during webhook registration ([`878da3c0`](https://github.com/triggerdotdev/trigger.dev/commit/878da3c01f0a4dfaf33a1f8943a7ad4eed8b8877)) - -### Patch Changes - -- Updated dependencies: - - `@trigger.dev/integration-kit@2.1.0-beta.0` - - `@trigger.dev/sdk@2.1.0-beta.0` - -## 2.0.14 - -### Patch Changes - -- Updated dependencies: - - `@trigger.dev/integration-kit@2.0.14` - - `@trigger.dev/sdk@2.0.14` - -## 2.0.13 - -### Patch Changes - -- Updated dependencies: - - `@trigger.dev/sdk@2.0.13` - - `@trigger.dev/integration-kit@2.0.13` - -## 2.0.12 - -### Patch Changes - -- @trigger.dev/integration-kit@2.0.12 -- @trigger.dev/sdk@2.0.12 - -## 2.0.11 - -### Patch Changes - -- Updated dependencies [ac98219b] -- Updated dependencies [302bd02f] -- Updated dependencies [b5db9f5e] -- Updated dependencies [3ce53970] - - @trigger.dev/sdk@2.0.11 - - @trigger.dev/integration-kit@2.0.11 - -## 2.0.10 - -### Patch Changes - -- Updated dependencies [b1b9321a] -- Updated dependencies [b1b9321a] - - @trigger.dev/sdk@2.0.10 - - @trigger.dev/integration-kit@2.0.10 - -## 2.0.9 - -### Patch Changes - -- @trigger.dev/integration-kit@2.0.9 -- @trigger.dev/sdk@2.0.9 - -## 2.0.8 - -### Patch Changes - -- @trigger.dev/integration-kit@2.0.8 -- @trigger.dev/sdk@2.0.8 - -## 2.0.7 - -### Patch Changes - -- Updated dependencies [84126808] - - @trigger.dev/integration-kit@2.0.7 - - @trigger.dev/sdk@2.0.7 - -## 2.0.6 - -### Patch Changes - -- @trigger.dev/integration-kit@2.0.6 -- @trigger.dev/sdk@2.0.6 - -## 2.0.5 - -### Patch Changes - -- @trigger.dev/integration-kit@2.0.5 -- @trigger.dev/sdk@2.0.5 - -## 2.0.4 - -### Patch Changes - -- Updated dependencies [96384991] - - @trigger.dev/sdk@2.0.4 - - @trigger.dev/integration-kit@2.0.4 - -## 2.0.3 - -### Patch Changes - -- @trigger.dev/integration-kit@2.0.3 -- @trigger.dev/sdk@2.0.3 - -## 2.0.2 - -### Patch Changes - -- ee99191f: Sync all package versions -- Updated dependencies [0a790de2] -- Updated dependencies [ee99191f] - - @trigger.dev/sdk@2.0.2 - - @trigger.dev/integration-kit@2.0.2 - -## 1.0.0 - -### Major Changes - -- 99316df8: Preparing packages for V2 - -### Patch Changes - -- 23adc15c: Fixed the broken export issue with two of the new tasks -- 28914b87: Creating the init CLI package -- fe3bc6ef: Missing token/apikey error improved for display in Next.js logs -- f01af9c0: Upgrade to zod 3.21.4 -- 34ccf345: Add support for task errors and task retrying -- bac8ad10: Throw if the clients are passed an undefined apikey or token -- d4da2f32: Added getIssue Task -- e4b0b1e3: Added support for backgroundFetch -- 32ff3f31: Fixed some properties that had API urls instead of HTML urls -- 2c0ea0c1: Set Node version to 16.8 and above -- fdf1b214: added git database tasks -- Updated dependencies [acaae993] -- Updated dependencies [92233f2e] -- Updated dependencies [cca7da9d] -- Updated dependencies [9138976d] -- Updated dependencies [486d6818] -- Updated dependencies [24542d4e] -- Updated dependencies [c34a02c0] -- Updated dependencies [5ee0b188] -- Updated dependencies [28914b87] -- Updated dependencies [99316df8] -- Updated dependencies [722fe7b7] -- Updated dependencies [1961b994] -- Updated dependencies [1dc42dae] -- Updated dependencies [d6310a79] -- Updated dependencies [817b4ed1] -- Updated dependencies [f01af9c0] -- Updated dependencies [6d4922f4] -- Updated dependencies [34ccf345] -- Updated dependencies [b314178d] -- Updated dependencies [69af845a] -- Updated dependencies [c83443a4] -- Updated dependencies [8e147dbe] -- Updated dependencies [2cbf50b1] -- Updated dependencies [92233f2e] -- Updated dependencies [b4167a38] -- Updated dependencies [931be399] -- Updated dependencies [facae926] -- Updated dependencies [6d04f6c6] -- Updated dependencies [a11ddf65] -- Updated dependencies [ba446524] -- Updated dependencies [6c869466] -- Updated dependencies [f2f4d4b8] -- Updated dependencies [e4b0b1e3] -- Updated dependencies [094f6f5a] -- Updated dependencies [2c0ea0c1] -- Updated dependencies [e26923eb] -- Updated dependencies [0066971b] -- Updated dependencies [c83443a4] -- Updated dependencies [99c6cd03] -- Updated dependencies [3ee396d7] -- Updated dependencies [7e2d48ac] -- Updated dependencies [86dbd5d1] -- Updated dependencies [f160b34b] -- Updated dependencies [aaa70a9a] -- Updated dependencies [61ed1fb2] -- Updated dependencies [01cf5f3b] -- Updated dependencies [9351c051] -- Updated dependencies [94cc28d3] -- Updated dependencies [953e7fc9] -- Updated dependencies [0012bb21] -- Updated dependencies [807b9d4c] -- Updated dependencies [64477f6b] -- Updated dependencies [7f6bf992] -- Updated dependencies [767e09ee] -- Updated dependencies [917a70fb] - - @trigger.dev/sdk@2.0.0 - - @trigger.dev/integration-kit@2.0.0 - -## 1.0.0-next.9 - -### Patch Changes - -- d4da2f32: Added getIssue Task - -## 1.0.0-next.8 - -### Patch Changes - -- fe3bc6ef: Missing token/apikey error improved for display in Next.js logs - -## 1.0.0-next.7 - -### Patch Changes - -- bac8ad10: Throw if the clients are passed an undefined apikey or token -- Updated dependencies [1dc42dae] -- Updated dependencies [d6310a79] -- Updated dependencies [0012bb21] - - @trigger.dev/sdk@2.0.0-next.16 - -## 1.0.0-next.6 - -### Patch Changes - -- 2c0ea0c1: Set Node version to 16.8 and above -- Updated dependencies [2c0ea0c1] - - @trigger.dev/integration-kit@2.0.0-next.5 - - @trigger.dev/sdk@2.0.0-next.15 - -## 1.0.0-next.5 - -### Patch Changes - -- f01af9c0: Upgrade to zod 3.21.4 -- Updated dependencies [f01af9c0] -- Updated dependencies [94cc28d3] - - @trigger.dev/sdk@2.0.0-next.12 - - @trigger.dev/integration-kit@2.0.0-next.4 - -## 1.0.0-next.4 - -### Patch Changes - -- 32ff3f31: Fixed some properties that had API urls instead of HTML urls -- Updated dependencies [acaae993] -- Updated dependencies [aaa70a9a] - - @trigger.dev/sdk@2.0.0-next.9 - -## 1.0.0-next.3 - -### Patch Changes - -- 23adc15c: Fixed the broken export issue with two of the new tasks - -## 1.0.0-next.2 - -### Patch Changes - -- 28914b87: Creating the init CLI package -- e4b0b1e3: Added support for backgroundFetch -- Updated dependencies [28914b87] -- Updated dependencies [817b4ed1] -- Updated dependencies [e4b0b1e3] - - @trigger.dev/integration-kit@2.0.0-next.2 - - @trigger.dev/sdk@2.0.0-next.2 - -## 1.0.0-next.1 - -### Patch Changes - -- Add support for task errors and task retrying -- Updated dependencies -- Updated dependencies [b4167a38] - - @trigger.dev/sdk@2.0.0-next.1 - -## 1.0.0-next.0 - -### Major Changes - -- 53c9bd56: Preparing packages for V2 - -### Patch Changes - -- Updated dependencies [53c9bd56] - - @trigger.dev/sdk@2.0.0-next.0 diff --git a/integrations/github/package.json b/integrations/github/package.json deleted file mode 100644 index 727ae1faa..000000000 --- a/integrations/github/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "@trigger.dev/github", - "version": "3.0.0-beta.55", - "description": "The official GitHub integration for Trigger.dev", - "main": "./dist/index.js", - "types": "./dist/index.d.ts", - "publishConfig": { - "access": "public" - }, - "files": [ - "dist" - ], - "devDependencies": { - "@octokit/types": "^12.4.0", - "@octokit/webhooks-types": "^7.3.1", - "@trigger.dev/tsconfig": "workspace:*", - "@types/node": "18", - "rimraf": "^3.0.2", - "tsup": "8.0.1", - "@trigger.dev/tsup": "workspace:*", - "typescript": "^5.3.0" - }, - "scripts": { - "clean": "rimraf dist", - "build": "npm run clean && npm run build:tsup", - "build:tsup": "tsup" - }, - "dependencies": { - "@octokit/request": "^8.1.6", - "@octokit/request-error": "^5.0.1", - "@octokit/webhooks": "^12.0.10", - "octokit": "^3.1.2", - "@trigger.dev/integration-kit": "workspace:^3.0.0-beta.55", - "@trigger.dev/sdk": "workspace:^3.0.0-beta.55", - "zod": "3.22.3" - }, - "engines": { - "node": ">=16.8.0" - }, - "exports": { - ".": { - "import": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "require": "./dist/index.js", - "types": "./dist/index.d.ts" - }, - "./package.json": "./package.json" - }, - "module": "./dist/index.mjs" -} diff --git a/integrations/github/src/compound.ts b/integrations/github/src/compound.ts deleted file mode 100644 index ae8c85f4c..000000000 --- a/integrations/github/src/compound.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { IntegrationTaskKey } from "@trigger.dev/sdk"; -import { Octokit } from "octokit"; -import { GitHubReturnType, GitHubRunTask, onError } from "./index"; -import { Issues } from "./issues"; -import { ReactionContent, Reactions } from "./reactions"; - -export class Compound { - constructor( - private runTask: GitHubRunTask, - public issues: Issues, - public reactions: Reactions - ) {} - - createIssueCommentWithReaction( - key: IntegrationTaskKey, - params: { - body: string; - owner: string; - repo: string; - issueNumber: number; - reaction: ReactionContent; - } - ): GitHubReturnType { - return this.runTask( - key, - async () => { - const comment = await this.issues.createComment( - `Comment on Issue #${params.issueNumber}`, - params - ); - const reaction = await this.reactions.createForIssueComment( - `React with ${params.reaction}`, - { - owner: params.owner, - repo: params.repo, - commentId: comment.id, - content: params.reaction, - } - ); - return comment; - }, - { - name: "Create Issue Comment", - params, - properties: [ - { - label: "Repo", - text: params.repo, - }, - { - label: "Issue", - text: `#${params.issueNumber}`, - }, - ], - }, - onError - ); - } -} diff --git a/integrations/github/src/git.ts b/integrations/github/src/git.ts deleted file mode 100644 index 34bfd9540..000000000 --- a/integrations/github/src/git.ts +++ /dev/null @@ -1,466 +0,0 @@ -import { IntegrationTaskKey } from "@trigger.dev/sdk"; -import { Octokit } from "octokit"; -import { GitHubReturnType, GitHubRunTask, onError } from "./index"; -import { repoProperties } from "./propertyHelpers"; - -type Endcoding = "utf-8" | "base-64"; - -type AuthorContent = { - name: string; - email: string; - date?: string; -}; - -type CommitterContent = { - name?: string; - email?: string; - date?: string; -}; - -type TagType = "commit" | "tree" | "blob"; - -type TaggerContent = { - name: string; - email: string; - date?: string; -}; - -type TreeType = { - path?: string | undefined; - mode?: "100644" | "100755" | "040000" | "160000" | "120000" | undefined; - type?: "commit" | "tree" | "blob" | undefined; - sha?: string | null | undefined; - content?: string | undefined; -}; - -export class Git { - constructor(private runTask: GitHubRunTask) {} - - createBlob( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - content: string; - encoding?: Endcoding; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.git.createBlob({ - owner: params.owner, - repo: params.repo, - content: params.content, - encoding: params.encoding, - }); - return result.data; - }, - { - name: "Create Blob", - params, - properties: [ - ...repoProperties(params), - { - label: "Content", - text: params.content, - }, - ], - }, - onError - ); - } - - getBlob( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - fileSHA: string; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.git.getBlob({ - owner: params.owner, - repo: params.repo, - file_sha: params.fileSHA, - }); - return result.data; - }, - { - name: "Get Blob", - params, - properties: [...repoProperties(params)], - }, - onError - ); - } - - createCommit( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - message: string; - tree: string; - parents?: string[]; - author?: AuthorContent; - committer?: CommitterContent; - signature?: string; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.git.createCommit({ - ...params, - }); - return result.data; - }, - { - name: "Create Commit", - params, - properties: [ - ...repoProperties(params), - { - label: "Message", - text: params.message, - }, - { - label: "Tree", - text: params.tree, - }, - ], - }, - onError - ); - } - - getCommit( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - commitSHA: string; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.git.getCommit({ - owner: params.owner, - repo: params.repo, - commit_sha: params.commitSHA, - }); - return result.data; - }, - { - name: "Get Commit", - params, - properties: [ - ...repoProperties(params), - { - label: "Commit SHA", - text: params.commitSHA, - }, - ], - }, - onError - ); - } - - listMatchingRefs( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - ref: string; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.git.listMatchingRefs(params); - return result.data; - }, - { - name: "List Matching References", - params, - properties: [ - ...repoProperties(params), - { - label: "Ref", - text: params.ref, - }, - ], - }, - onError - ); - } - - getRef( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - ref: string; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.git.getRef(params); - return result.data; - }, - { - name: "Get Reference", - params, - properties: [ - ...repoProperties(params), - { - label: "Ref", - text: params.ref, - }, - ], - }, - onError - ); - } - - createRef( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - ref: string; - sha: string; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.git.createRef(params); - return result.data; - }, - { - name: "Create Reference", - params, - properties: [ - ...repoProperties(params), - { - label: "Ref", - text: params.ref, - }, - { - label: "SHA", - text: params.ref, - }, - ], - }, - onError - ); - } - - updateRef( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - ref: string; - sha: string; - force?: boolean; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.git.updateRef(params); - return result.data; - }, - { - name: "Update Reference", - params, - properties: [ - ...repoProperties(params), - { - label: "Ref", - text: params.ref, - }, - { - label: "SHA", - text: params.ref, - }, - ], - }, - onError - ); - } - - deleteRef( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - ref: string; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.git.deleteRef(params); - return result.data; - }, - { - name: "Delete Reference", - params, - properties: [ - ...repoProperties(params), - { - label: "Ref", - text: params.ref, - }, - ], - }, - onError - ); - } - - createTag( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - tag: string; - message: string; - object: string; - type: TagType; - tagger?: TaggerContent; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.git.createTag(params); - return result.data; - }, - { - name: "Create Tag", - params, - properties: [ - ...repoProperties(params), - { - label: "Tag", - text: params.tag, - }, - { - label: "Message", - text: params.message, - }, - { - label: "Object", - text: params.object, - }, - { - label: "Tag Type", - text: params.type, - }, - ], - }, - onError - ); - } - - getTag( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - tagSHA: string; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.git.getTag({ - owner: params.owner, - repo: params.repo, - tag_sha: params.tagSHA, - }); - return result.data; - }, - { - name: "Get Tag", - params, - properties: [ - ...repoProperties(params), - { - label: "Tag SHA", - text: params.tagSHA, - }, - ], - }, - onError - ); - } - - createTree( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - tree: TreeType[]; - baseTree?: string; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.git.createTree(params); - return result.data; - }, - { - name: "Create Tree", - params, - properties: [...repoProperties(params)], - }, - onError - ); - } - - getTree( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - treeSHA: string; - recursive?: string; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.git.getTree({ - owner: params.owner, - repo: params.repo, - tree_sha: params.treeSHA, - recursive: params.recursive, - }); - return result.data; - }, - { - name: "Get Tree", - params, - properties: [ - ...repoProperties(params), - { - label: "Tree SHA", - text: params.treeSHA, - }, - ], - }, - onError - ); - } -} diff --git a/integrations/github/src/index.ts b/integrations/github/src/index.ts deleted file mode 100644 index 0716e849b..000000000 --- a/integrations/github/src/index.ts +++ /dev/null @@ -1,628 +0,0 @@ -import { RequestError } from "@octokit/request-error"; -import { RequestRequestOptions } from "@octokit/types"; -import { - CreateEvent, - IssueCommentEvent, - IssuesAssignedEvent, - IssuesEvent, - IssuesOpenedEvent, - PullRequestEvent, - PullRequestReviewEvent, - PushEvent, - RepositoryCreatedEvent, - StarCreatedEvent, - StarEvent, -} from "@octokit/webhooks-types"; -import { truncate } from "@trigger.dev/integration-kit"; -import { - ConnectionAuth, - EventSpecification, - ExternalSourceTrigger, - IO, - IOTask, - IntegrationTaskKey, - Json, - RunTaskErrorCallback, - RunTaskOptions, - TriggerIntegration, - retry, -} from "@trigger.dev/sdk"; -import { Octokit } from "octokit"; -import { createOrgEventSource, createRepoEventSource } from "./sources"; -import { - issueAssigned, - issueCommentCreated, - issueOpened, - newBranch, - pullRequestOpened, - pullRequestReviewSubmitted, - push, - starredRepo, -} from "./webhook-examples"; -import { Issues } from "./issues"; -import { Repos } from "./repos"; -import { Reactions } from "./reactions"; -import { Compound } from "./compound"; -import { Orgs } from "./orgs"; -import { Git } from "./git"; - -export type GithubIntegrationOptions = { - id: string; - token?: string; - octokitRequest?: RequestRequestOptions; -}; - -type GithubSources = { - repo: ReturnType; - org: ReturnType; -}; - -type GithubTriggers = { - repo: ReturnType; - org: ReturnType; -}; - -export type GitHubRunTask = InstanceType["runTask"]; -export type GitHubReturnType Promise<{ data: K }>, K = any> = Promise< - Awaited>["data"] ->; - -export class Github implements TriggerIntegration { - // @internal - private _options: GithubIntegrationOptions; - // @internal - private _client?: Octokit; - // @internal - private _io?: IO; - // @internal - private _connectionKey?: string; - - _repoSource: ReturnType; - _orgSource: ReturnType; - _repoTrigger: ReturnType; - _orgTrigger: ReturnType; - - constructor(private options: GithubIntegrationOptions) { - if (Object.keys(options).includes("token") && !options.token) { - throw `Can't create GitHub integration (${options.id}) as token was undefined`; - } - - this._options = options; - - this._repoSource = createRepoEventSource(this); - this._orgSource = createOrgEventSource(this); - this._repoTrigger = createRepoTrigger(this._repoSource); - this._orgTrigger = createOrgTrigger(this._orgSource); - } - - get id() { - return this.options.id; - } - - get metadata() { - return { name: "GitHub", id: "github" }; - } - - get authSource() { - return this._options.token ? ("LOCAL" as const) : ("HOSTED" as const); - } - - cloneForRun(io: IO, connectionKey: string, auth?: ConnectionAuth) { - const github = new Github(this._options); - github._io = io; - github._connectionKey = connectionKey; - github._client = createClientFromOptions(this._options, auth); - return github; - } - - get sources(): GithubSources { - return { - repo: this._repoSource, - org: this._orgSource, - }; - } - - get triggers(): GithubTriggers { - return { - repo: this._repoTrigger, - org: this._orgTrigger, - }; - } - - runTask | void>( - key: IntegrationTaskKey, - callback: (client: Octokit, task: IOTask, io: IO) => Promise, - options?: RunTaskOptions, - errorCallback?: RunTaskErrorCallback - ): Promise { - if (!this._io) throw new Error("No IO"); - if (!this._connectionKey) throw new Error("No connection key"); - - return this._io.runTask( - key, - (task, io) => { - if (!this._client) throw new Error("No client"); - return callback(this._client, task, io); - }, - { - icon: "github", - retry: retry.standardBackoff, - ...(options ?? {}), - connectionKey: this._connectionKey, - }, - errorCallback - ); - } - - get issues() { - return new Issues(this.runTask.bind(this)); - } - - get repos() { - return new Repos(this.runTask.bind(this)); - } - - get reactions() { - return new Reactions(this.runTask.bind(this)); - } - - get compound() { - return new Compound(this.runTask.bind(this), this.issues, this.reactions); - } - - get orgs() { - return new Orgs(this.runTask.bind(this)); - } - - get git() { - return new Git(this.runTask.bind(this)); - } - - createIssue = this.issues.create; - addIssueAssignees = this.issues.addAssignees; - addIssueLabels = this.issues.addLabels; - createIssueComment = this.issues.createComment; - getIssue = this.issues.get; - getRepo = this.repos.get; - updateWebhook = this.repos.updateWebhook; - createWebhook = this.repos.createWebhook; - listWebhooks = this.repos.listWebhooks; - addIssueCommentReaction = this.reactions.createForIssueComment; - createIssueCommentWithReaction = this.compound.createIssueCommentWithReaction; - updateOrgWebhook = this.orgs.updateWebhook; - createOrgWebhook = this.orgs.createWebhook; - listOrgWebhooks = this.orgs.listWebhooks; - createBlob = this.git.createBlob; - getBlob = this.git.getBlob; - createCommit = this.git.createCommit; - getCommit = this.git.getCommit; - listMatchingReferences = this.git.listMatchingRefs; - getReference = this.git.getRef; - createReference = this.git.createRef; - updateReference = this.git.updateRef; - deleteReference = this.git.deleteRef; - createTag = this.git.createTag; - getTag = this.git.getTag; - createTree = this.git.createTree; - getTree = this.git.getTree; -} - -function createClientFromOptions( - options: GithubIntegrationOptions, - auth?: ConnectionAuth -): Octokit { - if (Object.keys(options).includes("token") && !options.token) { - throw `Can't create GitHub integration (${options.id}) as token was undefined`; - } - - if (options.token) { - return new Octokit({ - auth: options.token, - request: options.octokitRequest, - retry: { - enabled: false, - }, - }); - } - - if (!auth) { - throw new Error("No auth"); - } - - return new Octokit({ - auth: auth.accessToken, - request: options.octokitRequest, - retry: { - enabled: false, - }, - }); -} - -const onIssue: EventSpecification = { - name: "issues", - title: "On issue", - source: "github.com", - icon: "github", - examples: [issueOpened, issueAssigned], - parsePayload: (payload) => payload as IssuesEvent, - runProperties: (payload) => issueProperties(payload), -}; - -const onIssueOpened: EventSpecification = { - name: "issues", - title: "On issue opened", - source: "github.com", - icon: "github", - filter: { - action: ["opened"], - }, - examples: [issueOpened], - parsePayload: (payload) => payload as IssuesOpenedEvent, - runProperties: (payload) => issueProperties(payload), -}; - -const onIssueAssigned: EventSpecification = { - name: "issues", - title: "On issue assigned", - source: "github.com", - icon: "github", - filter: { - action: ["assigned"], - }, - examples: [issueAssigned], - parsePayload: (payload) => payload as IssuesAssignedEvent, - runProperties: (payload) => [ - ...issueProperties(payload), - { - label: "Assignee", - text: payload.assignee?.login ?? "none", - url: payload.assignee?.html_url, - }, - ], -}; - -const onIssueComment: EventSpecification = { - name: "issue_comment", - title: "On issue comment", - source: "github.com", - icon: "github", - examples: [issueCommentCreated], - parsePayload: (payload) => payload as IssueCommentEvent, - runProperties: (payload) => [ - ...issueProperties(payload), - { - label: "Comment body", - text: truncate(payload.comment.body, 40), - url: payload.comment.html_url, - }, - ], -}; - -function issueProperties(payload: IssuesEvent | IssueCommentEvent) { - return [ - { - label: "Issue", - text: `#${payload.issue.number}: ${payload.issue.title}`, - url: payload.issue.html_url, - }, - { - label: "Author", - text: payload.sender.login, - url: payload.sender.html_url, - }, - ]; -} - -const onStar: EventSpecification = { - name: "star", - title: "On star", - source: "github.com", - icon: "github", - examples: [starredRepo], - parsePayload: (payload) => payload as StarEvent, - runProperties: (payload) => starProperties(payload), -}; - -const onNewStar: EventSpecification = { - name: "star", - title: "On new star", - source: "github.com", - icon: "github", - filter: { - action: ["created"], - }, - examples: [starredRepo], - parsePayload: (payload) => payload as StarCreatedEvent, - runProperties: (payload) => starProperties(payload), -}; - -function starProperties(payload: StarEvent) { - return [ - { - label: "Repo", - text: `${payload.repository.name}`, - url: payload.repository.html_url, - }, - { - label: "Author", - text: payload.sender.login, - url: payload.sender.html_url, - }, - { - label: "Star count", - text: `${payload.repository.stargazers_count}`, - url: payload.repository.stargazers_url, - }, - ]; -} - -const onNewRepository: EventSpecification = { - name: "repository", - title: "On new repository", - source: "github.com", - icon: "github", - filter: { - action: ["created"], - }, - parsePayload: (payload) => payload as RepositoryCreatedEvent, -}; - -const onNewBranchOrTag: EventSpecification = { - name: "create", - title: "On new branch or tag", - source: "github.com", - icon: "github", - parsePayload: (payload) => payload as CreateEvent, - runProperties: (payload) => branchTagProperties(payload), -}; - -const onNewBranch: EventSpecification = { - name: "create", - title: "On new branch tag", - source: "github.com", - icon: "github", - filter: { - ref_type: ["branch"], - }, - examples: [newBranch], - parsePayload: (payload) => payload as CreateEvent, - runProperties: (payload) => branchTagProperties(payload), -}; - -function branchTagProperties(payload: CreateEvent) { - return [ - { - label: "Repo", - text: payload.repository.name, - url: payload.repository.html_url, - }, - { - label: payload.ref_type === "branch" ? "Branch" : "Tag", - text: payload.ref, - }, - ]; -} - -const onPush: EventSpecification = { - name: "push", - title: "On push", - source: "github.com", - icon: "github", - examples: [push], - parsePayload: (payload) => payload as PushEvent, - runProperties: (payload) => { - let props = [ - { - label: "Repo", - text: payload.repository.name, - url: payload.repository.html_url, - }, - { - label: "Branch", - text: payload.ref, - }, - { - label: "Pusher", - text: payload.pusher.name, - }, - { - label: "Commits", - text: `${payload.commits.length}`, - }, - ]; - - if (payload.head_commit) { - props.push({ - label: "Head commit", - text: payload.head_commit.id, - url: payload.head_commit.url, - }); - } - - return props; - }, -}; - -const onPullRequest: EventSpecification = { - name: "pull_request", - title: "On pull request", - source: "github.com", - icon: "github", - examples: [pullRequestOpened], - parsePayload: (payload) => payload as PullRequestEvent, - runProperties: (payload) => [ - { - label: "Repo", - text: payload.repository.name, - url: payload.repository.html_url, - }, - { - label: "action", - text: payload.action, - }, - { - label: "Number", - text: `${payload.number}`, - }, - { - label: "Title", - text: payload.pull_request.title, - }, - { - label: "Author", - text: payload.pull_request.user.login, - url: payload.pull_request.user.html_url, - }, - { - label: "Commits", - text: `${payload.pull_request.commits}`, - }, - { - label: "Body", - text: truncate(payload.pull_request.body ?? "none", 40), - }, - ], -}; - -const onPullRequestReview: EventSpecification = { - name: "pull_request_review", - title: "On pull request review", - source: "github.com", - icon: "github", - examples: [pullRequestReviewSubmitted], - parsePayload: (payload) => payload as PullRequestReviewEvent, - runProperties: (payload) => [ - { - label: "Repo", - text: payload.repository.name, - url: payload.repository.html_url, - }, - { - label: "action", - text: payload.action, - }, - { - label: "Author", - text: payload.review.user.login, - url: payload.review.user.html_url, - }, - { - label: "Body", - text: truncate(payload.review.body ?? "none", 40), - }, - { - label: "PR Number", - text: `${payload.pull_request.number}`, - }, - { - label: "PR Title", - text: payload.pull_request.title, - }, - ], -}; - -export const events = { - /** When any action is performed on an issue */ - onIssue, - /** When an issue is opened */ - onIssueOpened, - /** When an issue is assigned */ - onIssueAssigned, - /** When an issue is commented on */ - onIssueComment, - /** When a repo is starred or unstarred */ - onStar, - /** When a repo is starred */ - onNewStar, - /** When a new repo is created */ - onNewRepository, - /** When a new branch or tag is created */ - onNewBranchOrTag, - /** When a new branch is created */ - onNewBranch, - /** When a push is made to a repo */ - onPush, - /** When activity occurs on a pull request. Doesn't include reviews, issues or comments. */ - onPullRequest, - /** When Pull Request review has activity. */ - onPullRequestReview, -}; - -// params.event has to be a union of all the values of the exports events object -type GitHubEvents = (typeof events)[keyof typeof events]; - -type CreateRepoTriggerReturnType = (args: { - event: TEventSpecification; - owner: string; - repo: string; -}) => ExternalSourceTrigger>; - -function createRepoTrigger( - source: ReturnType -): CreateRepoTriggerReturnType { - return ({ - event, - owner, - repo, - }: { - event: TEventSpecification; - owner: string; - repo: string; - }) => { - return new ExternalSourceTrigger({ - event, - params: { owner, repo }, - source, - options: {}, - }); - }; -} - -type CreateOrgTriggerReturnType = (args: { - event: TEventSpecification; - org: string; -}) => ExternalSourceTrigger>; - -function createOrgTrigger( - source: ReturnType -): CreateOrgTriggerReturnType { - return ({ - event, - org, - }: { - event: TEventSpecification; - org: string; - }) => { - return new ExternalSourceTrigger({ - event, - params: { org }, - source, - options: {}, - }); - }; -} - -export function isRequestError(error: unknown): error is RequestError { - return typeof error === "object" && error !== null && "status" in error; -} - -export function onError(error: unknown) { - if (!isRequestError(error)) { - return; - } - - // Check if this is a rate limit error - if (error.status === 403 && error.response) { - const rateLimitRemaining = error.response.headers["x-ratelimit-remaining"]; - const rateLimitReset = error.response.headers["x-ratelimit-reset"]; - - if (rateLimitRemaining === "0" && rateLimitReset) { - const resetDate = new Date(Number(rateLimitReset) * 1000); - - return { - retryAt: resetDate, - error, - }; - } - } -} diff --git a/integrations/github/src/issues.ts b/integrations/github/src/issues.ts deleted file mode 100644 index 80eea7955..000000000 --- a/integrations/github/src/issues.ts +++ /dev/null @@ -1,148 +0,0 @@ -import { truncate } from "@trigger.dev/integration-kit"; -import { IntegrationTaskKey, Prettify, retry } from "@trigger.dev/sdk"; -import { GitHubReturnType, GitHubRunTask, onError } from "./index"; -import { Octokit } from "octokit"; -import { issueProperties, repoProperties } from "./propertyHelpers"; - -type AddIssueLabels = GitHubReturnType; -export class Issues { - constructor(private runTask: GitHubRunTask) {} - - create( - key: IntegrationTaskKey, - params: { title: string; owner: string; repo: string } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.issues.create({ - owner: params.owner, - repo: params.repo, - title: params.title, - }); - return result.data; - }, - { - name: "Create Issue", - params, - properties: [ - ...repoProperties(params), - { - label: "Title", - text: params.title, - }, - ], - }, - onError - ); - } - - addAssignees( - key: IntegrationTaskKey, - params: { owner: string; repo: string; issueNumber: number; assignees: string[] } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.issues.addAssignees({ - owner: params.owner, - repo: params.repo, - issue_number: params.issueNumber, - assignees: params.assignees, - }); - return result.data; - }, - { - name: "Add Issue Assignees", - params, - properties: [ - ...repoProperties(params), - ...issueProperties(params), - { - label: "assignees", - text: params.assignees.join(", "), - }, - ], - }, - onError - ); - } - - addLabels( - key: IntegrationTaskKey, - params: { owner: string; repo: string; issueNumber: number; labels: string[] } - ): AddIssueLabels { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.issues.addLabels({ - owner: params.owner, - repo: params.repo, - issue_number: params.issueNumber, - labels: params.labels, - }); - return result.data; - }, - { - name: "Add Issue Labels", - params, - properties: [ - ...repoProperties(params), - ...issueProperties(params), - { - label: "Labels", - text: params.labels.join(", "), - }, - ], - }, - onError - ); - } - - createComment( - key: IntegrationTaskKey, - params: { body: string; owner: string; repo: string; issueNumber: number } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.issues.createComment({ - owner: params.owner, - repo: params.repo, - body: params.body, - issue_number: params.issueNumber, - }); - return result.data; - }, - { - name: "Create Issue Comment", - params, - properties: [...repoProperties(params), ...issueProperties(params)], - }, - onError - ); - } - - get( - key: IntegrationTaskKey, - params: { owner: string; repo: string; issueNumber: number } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.issues.get({ - owner: params.owner, - repo: params.repo, - issue_number: params.issueNumber, - }); - return result.data; - }, - { - name: "Get Issue", - params, - properties: [...repoProperties(params), ...issueProperties(params)], - }, - onError - ); - } -} diff --git a/integrations/github/src/orgs.ts b/integrations/github/src/orgs.ts deleted file mode 100644 index 495aeb7b4..000000000 --- a/integrations/github/src/orgs.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { IntegrationTaskKey } from "@trigger.dev/sdk"; -import { Octokit } from "octokit"; -import { GitHubReturnType, GitHubRunTask, onError } from "./index"; - -export class Orgs { - constructor(private runTask: GitHubRunTask) {} - - updateWebhook( - key: IntegrationTaskKey, - params: { - org: string; - hookId: number; - url: string; - secret: string; - addEvents?: string[]; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.orgs.updateWebhook({ - org: params.org, - hook_id: params.hookId, - config: { - content_type: "json", - url: params.url, - secret: params.secret, - }, - add_events: params.addEvents, - }); - return result.data; - }, - { - name: "Update Org Webhook", - params, - properties: [ - { - label: "Org", - text: params.org, - }, - { - label: "Hook ID", - text: String(params.hookId), - }, - ], - }, - onError - ); - } - - createWebhook( - key: IntegrationTaskKey, - params: { - org: string; - url: string; - secret: string; - events: string[]; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.orgs.createWebhook({ - org: params.org, - name: "web", - config: { - content_type: "json", - url: params.url, - secret: params.secret, - }, - events: params.events, - }); - return result.data; - }, - { - name: "Create Org Webhook", - params, - properties: [ - { - label: "Org", - text: params.org, - }, - { - label: "Events", - text: params.events.join(", "), - }, - ], - }, - onError - ); - } - - listWebhooks( - key: IntegrationTaskKey, - params: { - org: string; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.orgs.listWebhooks({ - org: params.org, - }); - return result.data; - }, - { - name: "List Org Webhooks", - params, - properties: [ - { - label: "Org", - text: params.org, - }, - ], - }, - onError - ); - } -} diff --git a/integrations/github/src/propertyHelpers.ts b/integrations/github/src/propertyHelpers.ts deleted file mode 100644 index 86f03e22e..000000000 --- a/integrations/github/src/propertyHelpers.ts +++ /dev/null @@ -1,21 +0,0 @@ -export function repoProperties(params: { owner: string; repo: string }) { - return [ - { - label: "Owner", - text: params.owner, - }, - { - label: "Repo", - text: params.repo, - }, - ]; -} - -export function issueProperties(params: { issueNumber: number }) { - return [ - { - label: "Issue", - text: `#${params.issueNumber}`, - }, - ]; -} diff --git a/integrations/github/src/reactions.ts b/integrations/github/src/reactions.ts deleted file mode 100644 index e3b3c10d6..000000000 --- a/integrations/github/src/reactions.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { truncate } from "@trigger.dev/integration-kit"; -import { IntegrationTaskKey, Prettify, retry } from "@trigger.dev/sdk"; -import { GitHubReturnType, GitHubRunTask, onError } from "./index"; -import { Octokit } from "octokit"; -import { issueProperties, repoProperties } from "./propertyHelpers"; - -export type ReactionContent = - | "+1" - | "-1" - | "laugh" - | "confused" - | "heart" - | "hooray" - | "rocket" - | "eyes"; - -export class Reactions { - constructor(private runTask: GitHubRunTask) {} - - createForIssueComment( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - commentId: number; - content: ReactionContent; - } - ): GitHubReturnType { - let emoji = ""; - - switch (params.content) { - case "+1": - emoji = "👍"; - break; - case "-1": - emoji = "👎"; - break; - case "laugh": - emoji = "😄"; - break; - case "confused": - emoji = "😕"; - break; - case "heart": - emoji = "❤️"; - break; - case "hooray": - emoji = "🎉"; - break; - case "rocket": - emoji = "🚀"; - break; - case "eyes": - emoji = "👀"; - break; - } - - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.reactions.createForIssueComment({ - owner: params.owner, - repo: params.repo, - comment_id: params.commentId, - content: params.content, - }); - return result.data; - }, - { - name: "Add Issue Reaction", - params, - properties: [ - { - label: "Repo", - text: params.repo, - }, - { - label: "Comment", - text: `#${params.commentId}`, - }, - { label: "reaction", text: emoji }, - ], - }, - onError - ); - } -} diff --git a/integrations/github/src/repos.ts b/integrations/github/src/repos.ts deleted file mode 100644 index 50d569085..000000000 --- a/integrations/github/src/repos.ts +++ /dev/null @@ -1,167 +0,0 @@ -import { IntegrationTaskKey } from "@trigger.dev/sdk"; -import { Octokit } from "octokit"; -import { GitHubReturnType, GitHubRunTask, onError } from "./index"; - -export class Repos { - constructor(private runTask: GitHubRunTask) {} - - get( - key: IntegrationTaskKey, - params: { owner: string; repo: string } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.repos.get({ - owner: params.owner, - repo: params.repo, - headers: { - "x-trigger-attempt": String(task.attempts), - }, - }); - return result.data; - }, - { - name: "Get Repo", - params, - properties: [ - { - label: "Repo", - text: params.repo, - }, - ], - }, - onError - ); - } - - updateWebhook( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - hookId: number; - url: string; - secret: string; - addEvents?: string[]; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.repos.updateWebhook({ - owner: params.owner, - repo: params.repo, - hook_id: params.hookId, - config: { - content_type: "json", - url: params.url, - secret: params.secret, - }, - add_events: params.addEvents, - }); - return result.data; - }, - { - name: "Update Webhook", - params, - properties: [ - { - label: "Owner", - text: params.owner, - }, - { - label: "Repo", - text: params.repo, - }, - { - label: "Hook ID", - text: String(params.hookId), - }, - ], - }, - onError - ); - } - - createWebhook( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - url: string; - secret: string; - events: string[]; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.repos.createWebhook({ - owner: params.owner, - repo: params.repo, - config: { - content_type: "json", - url: params.url, - secret: params.secret, - }, - events: params.events, - }); - return result.data; - }, - { - name: "Create Webhook", - params, - properties: [ - { - label: "Owner", - text: params.owner, - }, - { - label: "Repo", - text: params.repo, - }, - { - label: "Events", - text: params.events.join(", "), - }, - ], - }, - onError - ); - } - - listWebhooks( - key: IntegrationTaskKey, - params: { - owner: string; - repo: string; - } - ): GitHubReturnType { - return this.runTask( - key, - async (client, task) => { - const result = await client.rest.repos.listWebhooks({ - owner: params.owner, - repo: params.repo, - }); - return result.data; - }, - { - name: "List Webhooks", - params, - properties: [ - { - label: "Owner", - text: params.owner, - }, - { - label: "Repo", - text: params.repo, - }, - ], - }, - onError - ); - } -} diff --git a/integrations/github/src/sources.ts b/integrations/github/src/sources.ts deleted file mode 100644 index adcd8fdae..000000000 --- a/integrations/github/src/sources.ts +++ /dev/null @@ -1,296 +0,0 @@ -import { Webhooks } from "@octokit/webhooks"; -import { omit, safeJsonParse } from "@trigger.dev/integration-kit"; -import type { Logger } from "@trigger.dev/sdk"; -import { ExternalSource, HandlerEvent } from "@trigger.dev/sdk"; -import { z } from "zod"; -import { Github } from "./index"; -import { Buffer } from "node:buffer"; - -type WebhookData = { - id: number; - active: boolean; - events: string[]; - config: { - url: string; - }; -}; - -function webhookData(data: any): data is WebhookData { - return ( - typeof data === "object" && - data !== null && - typeof data.id === "number" && - typeof data.config === "object" - ); -} - -export function createRepoEventSource( - integration: Github -): ExternalSource { - return new ExternalSource("HTTP", { - id: "github.repo", - version: "0.1.1", - schema: z.object({ owner: z.string(), repo: z.string() }), - integration, - key: (params) => `${params.owner}/${params.repo}`, - properties: (params) => [ - { - label: "Owner", - text: params.owner, - url: `https://github.com/${params.owner}`, - }, - { - label: "Repo", - text: params.repo, - url: `https://github.com/${params.owner}/${params.repo}`, - }, - ], - filter: (params) => ({ - repository: { - full_name: [`${params.owner}/${params.repo}`], - }, - }), - handler: webhookHandler, - register: async (event, io, ctx) => { - const { params, source: httpSource, options } = event; - - const registeredOptions = { - event: options.event.desired, - }; - - if (httpSource.active && webhookData(httpSource.data)) { - const hasMissingOptions = Object.values(options).some( - (option) => option.missing.length > 0 - ); - if (!hasMissingOptions) return; - - // We need to update the webhook to add the new events and then return - const newWebhookData = await io.integration.updateWebhook("update-webhook", { - owner: params.owner, - repo: params.repo, - hookId: httpSource.data.id, - url: httpSource.url, - secret: httpSource.secret, - addEvents: options.event.missing, - }); - - return { - data: newWebhookData, - options: registeredOptions, - }; - } - - const webhooks = await io.integration.listWebhooks("list-webhooks", { - owner: params.owner, - repo: params.repo, - }); - - const existingWebhook = webhooks.find((w) => w.config.url === httpSource.url); - - // There is an existing webhook, but it's not synced with Trigger.dev, so we need to update it with the secret - if (existingWebhook && existingWebhook.active) { - const updatedWebhook = await io.integration.updateWebhook("update-webhook", { - owner: params.owner, - repo: params.repo, - hookId: existingWebhook.id, - url: httpSource.url, - secret: httpSource.secret, - addEvents: options.event.missing, - }); - - return { - data: updatedWebhook, - options: registeredOptions, - }; - } - - const webhook = await io.integration.createWebhook("create-webhook", { - owner: params.owner, - repo: params.repo, - events: options.event.desired, - url: httpSource.url, - secret: httpSource.secret, - }); - - return { data: webhook, options: registeredOptions }; - }, - }); -} - -export function createOrgEventSource( - integration: Github -): ExternalSource { - return new ExternalSource("HTTP", { - id: "github.org", - version: "0.1.1", - integration, - schema: z.object({ org: z.string() }), - key: (params) => params.org, - properties: (params) => [ - { - label: "Org", - text: params.org, - url: `https://github.com/${params.org}`, - }, - ], - filter: (params) => ({ - organization: { - login: [params.org], - }, - }), - handler: webhookHandler, - register: async (event, io, ctx) => { - const { params, source: httpSource, options } = event; - - const registeredOptions = { - event: options.event.desired, - }; - - const hasMissingOptions = Object.values(options).some((option) => option.missing.length > 0); - - if ( - httpSource.active && - webhookData(httpSource.data) && - httpSource.secret && - hasMissingOptions - ) { - const existingData = httpSource.data; - - // We need to update the webhook to add the new events and then return - const newWebhookData = await io.integration.updateOrgWebhook("update-webhook", { - org: params.org, - hookId: existingData.id, - url: httpSource.url, - secret: httpSource.secret, - addEvents: options.event.missing, - }); - - return { - secret: httpSource.secret, - data: newWebhookData, - options: registeredOptions, - }; - } - - const webhooks = await io.integration.listOrgWebhooks("list-webhooks", { - org: params.org, - }); - - const existingWebhook = webhooks.find((w) => w.config.url === httpSource.url); - - const secret = Math.random().toString(36).slice(2); - - if (existingWebhook && existingWebhook.active) { - const updatedWebhook = await io.integration.updateOrgWebhook("update-webhook", { - org: params.org, - hookId: existingWebhook.id, - url: httpSource.url, - secret, - }); - - return { - secret, - data: updatedWebhook, - options: registeredOptions, - }; - } - - const webhook = await io.integration.createOrgWebhook("create-webhook", { - org: params.org, - events: options.event.desired, - url: httpSource.url, - secret, - }); - - return { secret, data: webhook, options: registeredOptions }; - }, - }); -} - -// Parses the body of a request -// If it's a Buffer, it will be parsed as JSON -function parseBody(body: any) { - if (Buffer.isBuffer(body)) { - return safeJsonParse(body.toString()); - } - - if (typeof body === "string") { - return safeJsonParse(body); - } - - return body; -} - -async function webhookHandler(event: HandlerEvent<"HTTP">, logger: Logger) { - logger.debug("[inside github integration] Handling github repo event"); - - const { rawEvent: request, source } = event; - - if (!request.body) { - logger.debug("[inside github integration] No body found"); - - return; - } - - const rawBody = await request.text(); - - const deliveryId = request.headers.get("x-github-delivery"); - const hookId = request.headers.get("x-github-hook-id"); - const signature = request.headers.get("x-hub-signature-256"); - - if (source.secret && signature) { - const githubWebhooks = new Webhooks({ - secret: source.secret, - }); - - if (!githubWebhooks.verify(rawBody, signature)) { - logger.debug("[inside github integration] Unable to verify the signature of the rawBody", { - signature, - secret: source.secret, - }); - - return; - } - } - - const name = request.headers.get("x-github-event") ?? "unknown"; - const allHeaders = Object.fromEntries(request.headers.entries()); - - const context = omit(allHeaders, [ - "x-github-event", - "x-github-delivery", - "x-hub-signature-256", - "x-hub-signature", - "content-type", - "content-length", - "accept", - "accept-encoding", - "x-forwarded-proto", - ]); - - const payload = parseBody(rawBody); - - if (!payload) { - logger.debug("[inside github integration] Unable to parse the rawBody"); - - return; - } - - logger.debug("[inside github integration] Returning an event for the webhook!", { - name, - payload, - context, - }); - - return { - events: [ - { - id: [hookId, deliveryId].join(":"), - source: "github.com", - payload, - name, - context, - }, - ], - }; -} diff --git a/integrations/github/src/webhook-examples.ts b/integrations/github/src/webhook-examples.ts deleted file mode 100644 index caec3776e..000000000 --- a/integrations/github/src/webhook-examples.ts +++ /dev/null @@ -1,2317 +0,0 @@ -import { EventSpecificationExample } from "@trigger.dev/sdk"; - -export const issueAssigned: EventSpecificationExample = { - id: "issue.assigned", - name: "Issue assigned", - payload: { - issue: { - id: 1767861922, - url: "https://api.github.com/repos/triggerdotdev/empty/issues/4", - body: "This is the bod", - user: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - state: "open", - title: "Fourth time lucky?", - labels: [], - locked: false, - number: 4, - node_id: "I_kwDOJyTwbc5pX26i", - assignee: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - comments: 1, - html_url: "https://github.com/triggerdotdev/empty/issues/4", - assignees: [ - { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - ], - closed_at: null, - milestone: null, - reactions: { - "+1": 0, - "-1": 0, - url: "https://api.github.com/repos/triggerdotdev/empty/issues/4/reactions", - eyes: 0, - heart: 0, - laugh: 0, - hooray: 0, - rocket: 0, - confused: 0, - total_count: 0, - }, - created_at: "2023-06-21T15:24:20Z", - events_url: "https://api.github.com/repos/triggerdotdev/empty/issues/4/events", - labels_url: "https://api.github.com/repos/triggerdotdev/empty/issues/4/labels{/name}", - updated_at: "2023-06-21T15:36:53Z", - comments_url: "https://api.github.com/repos/triggerdotdev/empty/issues/4/comments", - state_reason: null, - timeline_url: "https://api.github.com/repos/triggerdotdev/empty/issues/4/timeline", - repository_url: "https://api.github.com/repos/triggerdotdev/empty", - active_lock_reason: null, - author_association: "MEMBER", - performed_via_github_app: null, - }, - action: "assigned", - sender: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - assignee: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - repository: { - id: 656732269, - url: "https://api.github.com/repos/triggerdotdev/empty", - fork: false, - name: "empty", - size: 0, - forks: 0, - owner: { - id: 95297378, - url: "https://api.github.com/users/triggerdotdev", - type: "Organization", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - html_url: "https://github.com/triggerdotdev", - gists_url: "https://api.github.com/users/triggerdotdev/gists{/gist_id}", - repos_url: "https://api.github.com/users/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/users/triggerdotdev/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/triggerdotdev/followers", - following_url: "https://api.github.com/users/triggerdotdev/following{/other_user}", - organizations_url: "https://api.github.com/users/triggerdotdev/orgs", - subscriptions_url: "https://api.github.com/users/triggerdotdev/subscriptions", - received_events_url: "https://api.github.com/users/triggerdotdev/received_events", - }, - topics: [], - git_url: "git://github.com/triggerdotdev/empty.git", - license: null, - node_id: "R_kgDOJyTwbQ", - private: false, - ssh_url: "git@github.com:triggerdotdev/empty.git", - svn_url: "https://github.com/triggerdotdev/empty", - archived: false, - disabled: false, - has_wiki: true, - homepage: null, - html_url: "https://github.com/triggerdotdev/empty", - keys_url: "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", - language: null, - tags_url: "https://api.github.com/repos/triggerdotdev/empty/tags", - watchers: 0, - blobs_url: "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", - clone_url: "https://github.com/triggerdotdev/empty.git", - forks_url: "https://api.github.com/repos/triggerdotdev/empty/forks", - full_name: "triggerdotdev/empty", - has_pages: false, - hooks_url: "https://api.github.com/repos/triggerdotdev/empty/hooks", - pulls_url: "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", - pushed_at: "2023-06-21T14:21:08Z", - teams_url: "https://api.github.com/repos/triggerdotdev/empty/teams", - trees_url: "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", - created_at: "2023-06-21T14:21:07Z", - events_url: "https://api.github.com/repos/triggerdotdev/empty/events", - has_issues: true, - issues_url: "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", - labels_url: "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", - merges_url: "https://api.github.com/repos/triggerdotdev/empty/merges", - mirror_url: null, - updated_at: "2023-06-21T14:21:08Z", - visibility: "public", - archive_url: "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", - commits_url: "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", - compare_url: "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", - description: "An empty repo that can be used to test the @trigger.dev/github integration", - forks_count: 0, - is_template: false, - open_issues: 4, - branches_url: "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", - comments_url: "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", - contents_url: "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", - git_refs_url: "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", - git_tags_url: "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", - has_projects: true, - releases_url: "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", - statuses_url: "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", - allow_forking: true, - assignees_url: "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", - downloads_url: "https://api.github.com/repos/triggerdotdev/empty/downloads", - has_downloads: true, - languages_url: "https://api.github.com/repos/triggerdotdev/empty/languages", - default_branch: "main", - milestones_url: "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", - stargazers_url: "https://api.github.com/repos/triggerdotdev/empty/stargazers", - watchers_count: 0, - deployments_url: "https://api.github.com/repos/triggerdotdev/empty/deployments", - git_commits_url: "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", - has_discussions: false, - subscribers_url: "https://api.github.com/repos/triggerdotdev/empty/subscribers", - contributors_url: "https://api.github.com/repos/triggerdotdev/empty/contributors", - issue_events_url: "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", - stargazers_count: 0, - subscription_url: "https://api.github.com/repos/triggerdotdev/empty/subscription", - collaborators_url: - "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", - issue_comment_url: - "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", - notifications_url: - "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", - open_issues_count: 4, - web_commit_signoff_required: false, - }, - organization: { - id: 95297378, - url: "https://api.github.com/orgs/triggerdotdev", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - hooks_url: "https://api.github.com/orgs/triggerdotdev/hooks", - repos_url: "https://api.github.com/orgs/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/orgs/triggerdotdev/events", - issues_url: "https://api.github.com/orgs/triggerdotdev/issues", - description: "", - members_url: "https://api.github.com/orgs/triggerdotdev/members{/member}", - public_members_url: "https://api.github.com/orgs/triggerdotdev/public_members{/member}", - }, - }, -}; - -export const issueOpened: EventSpecificationExample = { - id: "issue.opened", - name: "Issue opened", - payload: { - issue: { - id: 1754473379, - url: "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21", - body: 'This is a *big* problem:\r\n\r\n```\r\nconst foo = "bar"\r\n```', - user: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - state: "open", - title: "This is a sample issue title #20", - labels: [], - locked: false, - number: 21, - node_id: "I_kwDOI-yZFc5okyOj", - assignee: null, - comments: 0, - html_url: "https://github.com/ericallam/basic-starter-12k/issues/21", - assignees: [], - closed_at: null, - milestone: null, - reactions: { - "+1": 0, - "-1": 0, - url: "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21/reactions", - eyes: 0, - heart: 0, - laugh: 0, - hooray: 0, - rocket: 0, - confused: 0, - total_count: 0, - }, - created_at: "2023-06-13T09:42:02Z", - events_url: "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21/events", - labels_url: - "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21/labels{/name}", - updated_at: "2023-06-13T09:42:02Z", - comments_url: "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21/comments", - state_reason: null, - timeline_url: "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21/timeline", - repository_url: "https://api.github.com/repos/ericallam/basic-starter-12k", - active_lock_reason: null, - author_association: "NONE", - performed_via_github_app: null, - }, - action: "opened", - sender: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - repository: { - id: 602708245, - url: "https://api.github.com/repos/ericallam/basic-starter-12k", - fork: false, - name: "basic-starter-12k", - size: 0, - forks: 0, - owner: { - id: 534, - url: "https://api.github.com/users/ericallam", - type: "User", - login: "ericallam", - node_id: "MDQ6VXNlcjUzNA==", - html_url: "https://github.com/ericallam", - gists_url: "https://api.github.com/users/ericallam/gists{/gist_id}", - repos_url: "https://api.github.com/users/ericallam/repos", - avatar_url: "https://avatars.githubusercontent.com/u/534?v=4", - events_url: "https://api.github.com/users/ericallam/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/ericallam/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/ericallam/followers", - following_url: "https://api.github.com/users/ericallam/following{/other_user}", - organizations_url: "https://api.github.com/users/ericallam/orgs", - subscriptions_url: "https://api.github.com/users/ericallam/subscriptions", - received_events_url: "https://api.github.com/users/ericallam/received_events", - }, - topics: [], - git_url: "git://github.com/ericallam/basic-starter-12k.git", - license: null, - node_id: "R_kgDOI-yZFQ", - private: false, - ssh_url: "git@github.com:ericallam/basic-starter-12k.git", - svn_url: "https://github.com/ericallam/basic-starter-12k", - archived: false, - disabled: false, - has_wiki: true, - homepage: null, - html_url: "https://github.com/ericallam/basic-starter-12k", - keys_url: "https://api.github.com/repos/ericallam/basic-starter-12k/keys{/key_id}", - language: null, - tags_url: "https://api.github.com/repos/ericallam/basic-starter-12k/tags", - watchers: 0, - blobs_url: "https://api.github.com/repos/ericallam/basic-starter-12k/git/blobs{/sha}", - clone_url: "https://github.com/ericallam/basic-starter-12k.git", - forks_url: "https://api.github.com/repos/ericallam/basic-starter-12k/forks", - full_name: "ericallam/basic-starter-12k", - has_pages: false, - hooks_url: "https://api.github.com/repos/ericallam/basic-starter-12k/hooks", - pulls_url: "https://api.github.com/repos/ericallam/basic-starter-12k/pulls{/number}", - pushed_at: "2023-02-16T19:25:20Z", - teams_url: "https://api.github.com/repos/ericallam/basic-starter-12k/teams", - trees_url: "https://api.github.com/repos/ericallam/basic-starter-12k/git/trees{/sha}", - created_at: "2023-02-16T19:25:19Z", - events_url: "https://api.github.com/repos/ericallam/basic-starter-12k/events", - has_issues: true, - issues_url: "https://api.github.com/repos/ericallam/basic-starter-12k/issues{/number}", - labels_url: "https://api.github.com/repos/ericallam/basic-starter-12k/labels{/name}", - merges_url: "https://api.github.com/repos/ericallam/basic-starter-12k/merges", - mirror_url: null, - updated_at: "2023-02-16T19:25:19Z", - visibility: "public", - archive_url: - "https://api.github.com/repos/ericallam/basic-starter-12k/{archive_format}{/ref}", - commits_url: "https://api.github.com/repos/ericallam/basic-starter-12k/commits{/sha}", - compare_url: - "https://api.github.com/repos/ericallam/basic-starter-12k/compare/{base}...{head}", - description: null, - forks_count: 0, - is_template: false, - open_issues: 21, - branches_url: "https://api.github.com/repos/ericallam/basic-starter-12k/branches{/branch}", - comments_url: "https://api.github.com/repos/ericallam/basic-starter-12k/comments{/number}", - contents_url: "https://api.github.com/repos/ericallam/basic-starter-12k/contents/{+path}", - git_refs_url: "https://api.github.com/repos/ericallam/basic-starter-12k/git/refs{/sha}", - git_tags_url: "https://api.github.com/repos/ericallam/basic-starter-12k/git/tags{/sha}", - has_projects: true, - releases_url: "https://api.github.com/repos/ericallam/basic-starter-12k/releases{/id}", - statuses_url: "https://api.github.com/repos/ericallam/basic-starter-12k/statuses/{sha}", - allow_forking: true, - assignees_url: "https://api.github.com/repos/ericallam/basic-starter-12k/assignees{/user}", - downloads_url: "https://api.github.com/repos/ericallam/basic-starter-12k/downloads", - has_downloads: true, - languages_url: "https://api.github.com/repos/ericallam/basic-starter-12k/languages", - default_branch: "main", - milestones_url: - "https://api.github.com/repos/ericallam/basic-starter-12k/milestones{/number}", - stargazers_url: "https://api.github.com/repos/ericallam/basic-starter-12k/stargazers", - watchers_count: 0, - deployments_url: "https://api.github.com/repos/ericallam/basic-starter-12k/deployments", - git_commits_url: "https://api.github.com/repos/ericallam/basic-starter-12k/git/commits{/sha}", - has_discussions: false, - subscribers_url: "https://api.github.com/repos/ericallam/basic-starter-12k/subscribers", - contributors_url: "https://api.github.com/repos/ericallam/basic-starter-12k/contributors", - issue_events_url: - "https://api.github.com/repos/ericallam/basic-starter-12k/issues/events{/number}", - stargazers_count: 0, - subscription_url: "https://api.github.com/repos/ericallam/basic-starter-12k/subscription", - collaborators_url: - "https://api.github.com/repos/ericallam/basic-starter-12k/collaborators{/collaborator}", - issue_comment_url: - "https://api.github.com/repos/ericallam/basic-starter-12k/issues/comments{/number}", - notifications_url: - "https://api.github.com/repos/ericallam/basic-starter-12k/notifications{?since,all,participating}", - open_issues_count: 21, - web_commit_signoff_required: false, - }, - }, -}; - -export const issueCommentCreated: EventSpecificationExample = { - id: "issuecomment.created", - name: "Issue comment created", - payload: { - issue: { - id: 1767861922, - url: "https://api.github.com/repos/triggerdotdev/empty/issues/4", - body: "This is the bod", - user: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - state: "open", - title: "Fourth time lucky?", - labels: [], - locked: false, - number: 4, - node_id: "I_kwDOJyTwbc5pX26i", - assignee: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - comments: 2, - html_url: "https://github.com/triggerdotdev/empty/issues/4", - assignees: [ - { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - ], - closed_at: null, - milestone: null, - reactions: { - "+1": 0, - "-1": 0, - url: "https://api.github.com/repos/triggerdotdev/empty/issues/4/reactions", - eyes: 0, - heart: 0, - laugh: 0, - hooray: 0, - rocket: 0, - confused: 0, - total_count: 0, - }, - created_at: "2023-06-21T15:24:20Z", - events_url: "https://api.github.com/repos/triggerdotdev/empty/issues/4/events", - labels_url: "https://api.github.com/repos/triggerdotdev/empty/issues/4/labels{/name}", - updated_at: "2023-06-21T16:02:28Z", - comments_url: "https://api.github.com/repos/triggerdotdev/empty/issues/4/comments", - state_reason: null, - timeline_url: "https://api.github.com/repos/triggerdotdev/empty/issues/4/timeline", - repository_url: "https://api.github.com/repos/triggerdotdev/empty", - active_lock_reason: null, - author_association: "MEMBER", - performed_via_github_app: null, - }, - action: "created", - sender: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - comment: { - id: 1601114728, - url: "https://api.github.com/repos/triggerdotdev/empty/issues/comments/1601114728", - body: 'This is a short comment with short code snippet:\r\n\r\n```\r\nconst rick = "astley";\r\n```', - user: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - node_id: "IC_kwDOJyTwbc5fbxJo", - html_url: "https://github.com/triggerdotdev/empty/issues/4#issuecomment-1601114728", - issue_url: "https://api.github.com/repos/triggerdotdev/empty/issues/4", - reactions: { - "+1": 0, - "-1": 0, - url: "https://api.github.com/repos/triggerdotdev/empty/issues/comments/1601114728/reactions", - eyes: 0, - heart: 0, - laugh: 0, - hooray: 0, - rocket: 0, - confused: 0, - total_count: 0, - }, - created_at: "2023-06-21T16:02:27Z", - updated_at: "2023-06-21T16:02:27Z", - author_association: "MEMBER", - performed_via_github_app: null, - }, - repository: { - id: 656732269, - url: "https://api.github.com/repos/triggerdotdev/empty", - fork: false, - name: "empty", - size: 0, - forks: 0, - owner: { - id: 95297378, - url: "https://api.github.com/users/triggerdotdev", - type: "Organization", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - html_url: "https://github.com/triggerdotdev", - gists_url: "https://api.github.com/users/triggerdotdev/gists{/gist_id}", - repos_url: "https://api.github.com/users/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/users/triggerdotdev/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/triggerdotdev/followers", - following_url: "https://api.github.com/users/triggerdotdev/following{/other_user}", - organizations_url: "https://api.github.com/users/triggerdotdev/orgs", - subscriptions_url: "https://api.github.com/users/triggerdotdev/subscriptions", - received_events_url: "https://api.github.com/users/triggerdotdev/received_events", - }, - topics: [], - git_url: "git://github.com/triggerdotdev/empty.git", - license: null, - node_id: "R_kgDOJyTwbQ", - private: false, - ssh_url: "git@github.com:triggerdotdev/empty.git", - svn_url: "https://github.com/triggerdotdev/empty", - archived: false, - disabled: false, - has_wiki: true, - homepage: null, - html_url: "https://github.com/triggerdotdev/empty", - keys_url: "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", - language: null, - tags_url: "https://api.github.com/repos/triggerdotdev/empty/tags", - watchers: 0, - blobs_url: "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", - clone_url: "https://github.com/triggerdotdev/empty.git", - forks_url: "https://api.github.com/repos/triggerdotdev/empty/forks", - full_name: "triggerdotdev/empty", - has_pages: false, - hooks_url: "https://api.github.com/repos/triggerdotdev/empty/hooks", - pulls_url: "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", - pushed_at: "2023-06-21T14:21:08Z", - teams_url: "https://api.github.com/repos/triggerdotdev/empty/teams", - trees_url: "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", - created_at: "2023-06-21T14:21:07Z", - events_url: "https://api.github.com/repos/triggerdotdev/empty/events", - has_issues: true, - issues_url: "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", - labels_url: "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", - merges_url: "https://api.github.com/repos/triggerdotdev/empty/merges", - mirror_url: null, - updated_at: "2023-06-21T14:21:08Z", - visibility: "public", - archive_url: "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", - commits_url: "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", - compare_url: "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", - description: "An empty repo that can be used to test the @trigger.dev/github integration", - forks_count: 0, - is_template: false, - open_issues: 4, - branches_url: "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", - comments_url: "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", - contents_url: "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", - git_refs_url: "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", - git_tags_url: "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", - has_projects: true, - releases_url: "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", - statuses_url: "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", - allow_forking: true, - assignees_url: "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", - downloads_url: "https://api.github.com/repos/triggerdotdev/empty/downloads", - has_downloads: true, - languages_url: "https://api.github.com/repos/triggerdotdev/empty/languages", - default_branch: "main", - milestones_url: "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", - stargazers_url: "https://api.github.com/repos/triggerdotdev/empty/stargazers", - watchers_count: 0, - deployments_url: "https://api.github.com/repos/triggerdotdev/empty/deployments", - git_commits_url: "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", - has_discussions: false, - subscribers_url: "https://api.github.com/repos/triggerdotdev/empty/subscribers", - contributors_url: "https://api.github.com/repos/triggerdotdev/empty/contributors", - issue_events_url: "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", - stargazers_count: 0, - subscription_url: "https://api.github.com/repos/triggerdotdev/empty/subscription", - collaborators_url: - "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", - issue_comment_url: - "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", - notifications_url: - "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", - open_issues_count: 4, - web_commit_signoff_required: false, - }, - organization: { - id: 95297378, - url: "https://api.github.com/orgs/triggerdotdev", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - hooks_url: "https://api.github.com/orgs/triggerdotdev/hooks", - repos_url: "https://api.github.com/orgs/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/orgs/triggerdotdev/events", - issues_url: "https://api.github.com/orgs/triggerdotdev/issues", - description: "", - members_url: "https://api.github.com/orgs/triggerdotdev/members{/member}", - public_members_url: "https://api.github.com/orgs/triggerdotdev/public_members{/member}", - }, - }, -}; - -export const starredRepo: EventSpecificationExample = { - id: "star.created", - name: "Repo starred", - payload: { - action: "created", - sender: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - repository: { - id: 656732269, - url: "https://api.github.com/repos/triggerdotdev/empty", - fork: false, - name: "empty", - size: 0, - forks: 0, - owner: { - id: 95297378, - url: "https://api.github.com/users/triggerdotdev", - type: "Organization", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - html_url: "https://github.com/triggerdotdev", - gists_url: "https://api.github.com/users/triggerdotdev/gists{/gist_id}", - repos_url: "https://api.github.com/users/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/users/triggerdotdev/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/triggerdotdev/followers", - following_url: "https://api.github.com/users/triggerdotdev/following{/other_user}", - organizations_url: "https://api.github.com/users/triggerdotdev/orgs", - subscriptions_url: "https://api.github.com/users/triggerdotdev/subscriptions", - received_events_url: "https://api.github.com/users/triggerdotdev/received_events", - }, - topics: [], - git_url: "git://github.com/triggerdotdev/empty.git", - license: null, - node_id: "R_kgDOJyTwbQ", - private: false, - ssh_url: "git@github.com:triggerdotdev/empty.git", - svn_url: "https://github.com/triggerdotdev/empty", - archived: false, - disabled: false, - has_wiki: true, - homepage: null, - html_url: "https://github.com/triggerdotdev/empty", - keys_url: "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", - language: null, - tags_url: "https://api.github.com/repos/triggerdotdev/empty/tags", - watchers: 1, - blobs_url: "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", - clone_url: "https://github.com/triggerdotdev/empty.git", - forks_url: "https://api.github.com/repos/triggerdotdev/empty/forks", - full_name: "triggerdotdev/empty", - has_pages: false, - hooks_url: "https://api.github.com/repos/triggerdotdev/empty/hooks", - pulls_url: "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", - pushed_at: "2023-06-21T14:21:08Z", - teams_url: "https://api.github.com/repos/triggerdotdev/empty/teams", - trees_url: "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", - created_at: "2023-06-21T14:21:07Z", - events_url: "https://api.github.com/repos/triggerdotdev/empty/events", - has_issues: true, - issues_url: "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", - labels_url: "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", - merges_url: "https://api.github.com/repos/triggerdotdev/empty/merges", - mirror_url: null, - updated_at: "2023-06-21T17:22:03Z", - visibility: "public", - archive_url: "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", - commits_url: "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", - compare_url: "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", - description: "An empty repo that can be used to test the @trigger.dev/github integration", - forks_count: 0, - is_template: false, - open_issues: 4, - branches_url: "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", - comments_url: "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", - contents_url: "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", - git_refs_url: "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", - git_tags_url: "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", - has_projects: true, - releases_url: "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", - statuses_url: "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", - allow_forking: true, - assignees_url: "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", - downloads_url: "https://api.github.com/repos/triggerdotdev/empty/downloads", - has_downloads: true, - languages_url: "https://api.github.com/repos/triggerdotdev/empty/languages", - default_branch: "main", - milestones_url: "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", - stargazers_url: "https://api.github.com/repos/triggerdotdev/empty/stargazers", - watchers_count: 1, - deployments_url: "https://api.github.com/repos/triggerdotdev/empty/deployments", - git_commits_url: "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", - has_discussions: false, - subscribers_url: "https://api.github.com/repos/triggerdotdev/empty/subscribers", - contributors_url: "https://api.github.com/repos/triggerdotdev/empty/contributors", - issue_events_url: "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", - stargazers_count: 1, - subscription_url: "https://api.github.com/repos/triggerdotdev/empty/subscription", - collaborators_url: - "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", - issue_comment_url: - "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", - notifications_url: - "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", - open_issues_count: 4, - web_commit_signoff_required: false, - }, - starred_at: "2023-06-21T17:22:03Z", - organization: { - id: 95297378, - url: "https://api.github.com/orgs/triggerdotdev", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - hooks_url: "https://api.github.com/orgs/triggerdotdev/hooks", - repos_url: "https://api.github.com/orgs/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/orgs/triggerdotdev/events", - issues_url: "https://api.github.com/orgs/triggerdotdev/issues", - description: "", - members_url: "https://api.github.com/orgs/triggerdotdev/members{/member}", - public_members_url: "https://api.github.com/orgs/triggerdotdev/public_members{/member}", - }, - }, -}; - -export const newBranch: EventSpecificationExample = { - id: "branch.new", - name: "Branch created", - payload: { - ref: "test", - sender: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - ref_type: "branch", - repository: { - id: 656732269, - url: "https://api.github.com/repos/triggerdotdev/empty", - fork: false, - name: "empty", - size: 0, - forks: 0, - owner: { - id: 95297378, - url: "https://api.github.com/users/triggerdotdev", - type: "Organization", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - html_url: "https://github.com/triggerdotdev", - gists_url: "https://api.github.com/users/triggerdotdev/gists{/gist_id}", - repos_url: "https://api.github.com/users/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/users/triggerdotdev/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/triggerdotdev/followers", - following_url: "https://api.github.com/users/triggerdotdev/following{/other_user}", - organizations_url: "https://api.github.com/users/triggerdotdev/orgs", - subscriptions_url: "https://api.github.com/users/triggerdotdev/subscriptions", - received_events_url: "https://api.github.com/users/triggerdotdev/received_events", - }, - topics: [], - git_url: "git://github.com/triggerdotdev/empty.git", - license: null, - node_id: "R_kgDOJyTwbQ", - private: false, - ssh_url: "git@github.com:triggerdotdev/empty.git", - svn_url: "https://github.com/triggerdotdev/empty", - archived: false, - disabled: false, - has_wiki: true, - homepage: null, - html_url: "https://github.com/triggerdotdev/empty", - keys_url: "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", - language: null, - tags_url: "https://api.github.com/repos/triggerdotdev/empty/tags", - watchers: 0, - blobs_url: "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", - clone_url: "https://github.com/triggerdotdev/empty.git", - forks_url: "https://api.github.com/repos/triggerdotdev/empty/forks", - full_name: "triggerdotdev/empty", - has_pages: false, - hooks_url: "https://api.github.com/repos/triggerdotdev/empty/hooks", - pulls_url: "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", - pushed_at: "2023-06-21T17:54:25Z", - teams_url: "https://api.github.com/repos/triggerdotdev/empty/teams", - trees_url: "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", - created_at: "2023-06-21T14:21:07Z", - events_url: "https://api.github.com/repos/triggerdotdev/empty/events", - has_issues: true, - issues_url: "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", - labels_url: "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", - merges_url: "https://api.github.com/repos/triggerdotdev/empty/merges", - mirror_url: null, - updated_at: "2023-06-21T17:23:26Z", - visibility: "public", - archive_url: "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", - commits_url: "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", - compare_url: "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", - description: "An empty repo that can be used to test the @trigger.dev/github integration", - forks_count: 0, - is_template: false, - open_issues: 4, - branches_url: "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", - comments_url: "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", - contents_url: "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", - git_refs_url: "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", - git_tags_url: "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", - has_projects: true, - releases_url: "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", - statuses_url: "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", - allow_forking: true, - assignees_url: "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", - downloads_url: "https://api.github.com/repos/triggerdotdev/empty/downloads", - has_downloads: true, - languages_url: "https://api.github.com/repos/triggerdotdev/empty/languages", - default_branch: "main", - milestones_url: "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", - stargazers_url: "https://api.github.com/repos/triggerdotdev/empty/stargazers", - watchers_count: 0, - deployments_url: "https://api.github.com/repos/triggerdotdev/empty/deployments", - git_commits_url: "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", - has_discussions: false, - subscribers_url: "https://api.github.com/repos/triggerdotdev/empty/subscribers", - contributors_url: "https://api.github.com/repos/triggerdotdev/empty/contributors", - issue_events_url: "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", - stargazers_count: 0, - subscription_url: "https://api.github.com/repos/triggerdotdev/empty/subscription", - collaborators_url: - "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", - issue_comment_url: - "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", - notifications_url: - "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", - open_issues_count: 4, - web_commit_signoff_required: false, - }, - description: "An empty repo that can be used to test the @trigger.dev/github integration", - pusher_type: "user", - organization: { - id: 95297378, - url: "https://api.github.com/orgs/triggerdotdev", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - hooks_url: "https://api.github.com/orgs/triggerdotdev/hooks", - repos_url: "https://api.github.com/orgs/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/orgs/triggerdotdev/events", - issues_url: "https://api.github.com/orgs/triggerdotdev/issues", - description: "", - members_url: "https://api.github.com/orgs/triggerdotdev/members{/member}", - public_members_url: "https://api.github.com/orgs/triggerdotdev/public_members{/member}", - }, - master_branch: "main", - }, -}; - -export const push: EventSpecificationExample = { - id: "push", - name: "Push", - payload: { - ref: "refs/heads/main", - after: "1ca6a91f4a1385e448364a5de1960a3da60d3fe2", - before: "7f0b6655803858ac09ae05354a679d6dad03120c", - forced: false, - pusher: { - name: "matt-aitken", - email: "matt@mattaitken.com", - }, - sender: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - commits: [ - { - id: "1ca6a91f4a1385e448364a5de1960a3da60d3fe2", - url: "https://github.com/triggerdotdev/empty/commit/1ca6a91f4a1385e448364a5de1960a3da60d3fe2", - added: [], - author: { - name: "Matt Aitken", - email: "matt@mattaitken.com", - username: "matt-aitken", - }, - message: "Updated the readme", - removed: [], - tree_id: "3a584b2cae2fe34a195e1fe437cc62031ddff447", - distinct: true, - modified: ["README.md"], - committer: { - name: "Matt Aitken", - email: "matt@mattaitken.com", - username: "matt-aitken", - }, - timestamp: "2023-06-21T19:27:16+01:00", - }, - ], - compare: "https://github.com/triggerdotdev/empty/compare/7f0b66558038...1ca6a91f4a13", - created: false, - deleted: false, - base_ref: null, - repository: { - id: 656732269, - url: "https://github.com/triggerdotdev/empty", - fork: false, - name: "empty", - size: 0, - forks: 0, - owner: { - id: 95297378, - url: "https://api.github.com/users/triggerdotdev", - name: "triggerdotdev", - type: "Organization", - email: "hello@trigger.dev", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - html_url: "https://github.com/triggerdotdev", - gists_url: "https://api.github.com/users/triggerdotdev/gists{/gist_id}", - repos_url: "https://api.github.com/users/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/users/triggerdotdev/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/triggerdotdev/followers", - following_url: "https://api.github.com/users/triggerdotdev/following{/other_user}", - organizations_url: "https://api.github.com/users/triggerdotdev/orgs", - subscriptions_url: "https://api.github.com/users/triggerdotdev/subscriptions", - received_events_url: "https://api.github.com/users/triggerdotdev/received_events", - }, - topics: [], - git_url: "git://github.com/triggerdotdev/empty.git", - license: null, - node_id: "R_kgDOJyTwbQ", - private: false, - ssh_url: "git@github.com:triggerdotdev/empty.git", - svn_url: "https://github.com/triggerdotdev/empty", - archived: false, - disabled: false, - has_wiki: true, - homepage: null, - html_url: "https://github.com/triggerdotdev/empty", - keys_url: "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", - language: null, - tags_url: "https://api.github.com/repos/triggerdotdev/empty/tags", - watchers: 0, - blobs_url: "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", - clone_url: "https://github.com/triggerdotdev/empty.git", - forks_url: "https://api.github.com/repos/triggerdotdev/empty/forks", - full_name: "triggerdotdev/empty", - has_pages: false, - hooks_url: "https://api.github.com/repos/triggerdotdev/empty/hooks", - pulls_url: "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", - pushed_at: 1687372039, - teams_url: "https://api.github.com/repos/triggerdotdev/empty/teams", - trees_url: "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", - created_at: 1687357267, - events_url: "https://api.github.com/repos/triggerdotdev/empty/events", - has_issues: true, - issues_url: "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", - labels_url: "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", - merges_url: "https://api.github.com/repos/triggerdotdev/empty/merges", - mirror_url: null, - stargazers: 0, - updated_at: "2023-06-21T17:23:26Z", - visibility: "public", - archive_url: "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", - commits_url: "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", - compare_url: "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", - description: "An empty repo that can be used to test the @trigger.dev/github integration", - forks_count: 0, - is_template: false, - open_issues: 4, - branches_url: "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", - comments_url: "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", - contents_url: "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", - git_refs_url: "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", - git_tags_url: "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", - has_projects: true, - organization: "triggerdotdev", - releases_url: "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", - statuses_url: "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", - allow_forking: true, - assignees_url: "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", - downloads_url: "https://api.github.com/repos/triggerdotdev/empty/downloads", - has_downloads: true, - languages_url: "https://api.github.com/repos/triggerdotdev/empty/languages", - master_branch: "main", - default_branch: "main", - milestones_url: "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", - stargazers_url: "https://api.github.com/repos/triggerdotdev/empty/stargazers", - watchers_count: 0, - deployments_url: "https://api.github.com/repos/triggerdotdev/empty/deployments", - git_commits_url: "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", - has_discussions: false, - subscribers_url: "https://api.github.com/repos/triggerdotdev/empty/subscribers", - contributors_url: "https://api.github.com/repos/triggerdotdev/empty/contributors", - issue_events_url: "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", - stargazers_count: 0, - subscription_url: "https://api.github.com/repos/triggerdotdev/empty/subscription", - collaborators_url: - "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", - issue_comment_url: - "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", - notifications_url: - "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", - open_issues_count: 4, - web_commit_signoff_required: false, - }, - head_commit: { - id: "1ca6a91f4a1385e448364a5de1960a3da60d3fe2", - url: "https://github.com/triggerdotdev/empty/commit/1ca6a91f4a1385e448364a5de1960a3da60d3fe2", - added: [], - author: { - name: "Matt Aitken", - email: "matt@mattaitken.com", - username: "matt-aitken", - }, - message: "Updated the readme", - removed: [], - tree_id: "3a584b2cae2fe34a195e1fe437cc62031ddff447", - distinct: true, - modified: ["README.md"], - committer: { - name: "Matt Aitken", - email: "matt@mattaitken.com", - username: "matt-aitken", - }, - timestamp: "2023-06-21T19:27:16+01:00", - }, - organization: { - id: 95297378, - url: "https://api.github.com/orgs/triggerdotdev", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - hooks_url: "https://api.github.com/orgs/triggerdotdev/hooks", - repos_url: "https://api.github.com/orgs/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/orgs/triggerdotdev/events", - issues_url: "https://api.github.com/orgs/triggerdotdev/issues", - description: "", - members_url: "https://api.github.com/orgs/triggerdotdev/members{/member}", - public_members_url: "https://api.github.com/orgs/triggerdotdev/public_members{/member}", - }, - }, -}; - -export const pullRequestOpened: EventSpecificationExample = { - id: "pull_request.opened", - name: "Pull request opened", - payload: { - action: "opened", - number: 5, - sender: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - repository: { - id: 656732269, - url: "https://api.github.com/repos/triggerdotdev/empty", - fork: false, - name: "empty", - size: 0, - forks: 0, - owner: { - id: 95297378, - url: "https://api.github.com/users/triggerdotdev", - type: "Organization", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - html_url: "https://github.com/triggerdotdev", - gists_url: "https://api.github.com/users/triggerdotdev/gists{/gist_id}", - repos_url: "https://api.github.com/users/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/users/triggerdotdev/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/triggerdotdev/followers", - following_url: "https://api.github.com/users/triggerdotdev/following{/other_user}", - organizations_url: "https://api.github.com/users/triggerdotdev/orgs", - subscriptions_url: "https://api.github.com/users/triggerdotdev/subscriptions", - received_events_url: "https://api.github.com/users/triggerdotdev/received_events", - }, - topics: [], - git_url: "git://github.com/triggerdotdev/empty.git", - license: null, - node_id: "R_kgDOJyTwbQ", - private: false, - ssh_url: "git@github.com:triggerdotdev/empty.git", - svn_url: "https://github.com/triggerdotdev/empty", - archived: false, - disabled: false, - has_wiki: true, - homepage: null, - html_url: "https://github.com/triggerdotdev/empty", - keys_url: "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", - language: null, - tags_url: "https://api.github.com/repos/triggerdotdev/empty/tags", - watchers: 0, - blobs_url: "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", - clone_url: "https://github.com/triggerdotdev/empty.git", - forks_url: "https://api.github.com/repos/triggerdotdev/empty/forks", - full_name: "triggerdotdev/empty", - has_pages: false, - hooks_url: "https://api.github.com/repos/triggerdotdev/empty/hooks", - pulls_url: "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", - pushed_at: "2023-06-21T18:38:34Z", - teams_url: "https://api.github.com/repos/triggerdotdev/empty/teams", - trees_url: "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", - created_at: "2023-06-21T14:21:07Z", - events_url: "https://api.github.com/repos/triggerdotdev/empty/events", - has_issues: true, - issues_url: "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", - labels_url: "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", - merges_url: "https://api.github.com/repos/triggerdotdev/empty/merges", - mirror_url: null, - updated_at: "2023-06-21T17:23:26Z", - visibility: "public", - archive_url: "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", - commits_url: "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", - compare_url: "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", - description: "An empty repo that can be used to test the @trigger.dev/github integration", - forks_count: 0, - is_template: false, - open_issues: 5, - branches_url: "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", - comments_url: "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", - contents_url: "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", - git_refs_url: "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", - git_tags_url: "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", - has_projects: true, - releases_url: "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", - statuses_url: "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", - allow_forking: true, - assignees_url: "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", - downloads_url: "https://api.github.com/repos/triggerdotdev/empty/downloads", - has_downloads: true, - languages_url: "https://api.github.com/repos/triggerdotdev/empty/languages", - default_branch: "main", - milestones_url: "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", - stargazers_url: "https://api.github.com/repos/triggerdotdev/empty/stargazers", - watchers_count: 0, - deployments_url: "https://api.github.com/repos/triggerdotdev/empty/deployments", - git_commits_url: "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", - has_discussions: false, - subscribers_url: "https://api.github.com/repos/triggerdotdev/empty/subscribers", - contributors_url: "https://api.github.com/repos/triggerdotdev/empty/contributors", - issue_events_url: "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", - stargazers_count: 0, - subscription_url: "https://api.github.com/repos/triggerdotdev/empty/subscription", - collaborators_url: - "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", - issue_comment_url: - "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", - notifications_url: - "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", - open_issues_count: 5, - web_commit_signoff_required: false, - }, - organization: { - id: 95297378, - url: "https://api.github.com/orgs/triggerdotdev", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - hooks_url: "https://api.github.com/orgs/triggerdotdev/hooks", - repos_url: "https://api.github.com/orgs/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/orgs/triggerdotdev/events", - issues_url: "https://api.github.com/orgs/triggerdotdev/issues", - description: "", - members_url: "https://api.github.com/orgs/triggerdotdev/members{/member}", - public_members_url: "https://api.github.com/orgs/triggerdotdev/public_members{/member}", - }, - pull_request: { - id: 1402223044, - url: "https://api.github.com/repos/triggerdotdev/empty/pulls/5", - base: { - ref: "main", - sha: "1ca6a91f4a1385e448364a5de1960a3da60d3fe2", - repo: { - id: 656732269, - url: "https://api.github.com/repos/triggerdotdev/empty", - fork: false, - name: "empty", - size: 0, - forks: 0, - owner: { - id: 95297378, - url: "https://api.github.com/users/triggerdotdev", - type: "Organization", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - html_url: "https://github.com/triggerdotdev", - gists_url: "https://api.github.com/users/triggerdotdev/gists{/gist_id}", - repos_url: "https://api.github.com/users/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/users/triggerdotdev/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/triggerdotdev/followers", - following_url: "https://api.github.com/users/triggerdotdev/following{/other_user}", - organizations_url: "https://api.github.com/users/triggerdotdev/orgs", - subscriptions_url: "https://api.github.com/users/triggerdotdev/subscriptions", - received_events_url: "https://api.github.com/users/triggerdotdev/received_events", - }, - topics: [], - git_url: "git://github.com/triggerdotdev/empty.git", - license: null, - node_id: "R_kgDOJyTwbQ", - private: false, - ssh_url: "git@github.com:triggerdotdev/empty.git", - svn_url: "https://github.com/triggerdotdev/empty", - archived: false, - disabled: false, - has_wiki: true, - homepage: null, - html_url: "https://github.com/triggerdotdev/empty", - keys_url: "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", - language: null, - tags_url: "https://api.github.com/repos/triggerdotdev/empty/tags", - watchers: 0, - blobs_url: "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", - clone_url: "https://github.com/triggerdotdev/empty.git", - forks_url: "https://api.github.com/repos/triggerdotdev/empty/forks", - full_name: "triggerdotdev/empty", - has_pages: false, - hooks_url: "https://api.github.com/repos/triggerdotdev/empty/hooks", - pulls_url: "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", - pushed_at: "2023-06-21T18:38:34Z", - teams_url: "https://api.github.com/repos/triggerdotdev/empty/teams", - trees_url: "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", - created_at: "2023-06-21T14:21:07Z", - events_url: "https://api.github.com/repos/triggerdotdev/empty/events", - has_issues: true, - issues_url: "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", - labels_url: "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", - merges_url: "https://api.github.com/repos/triggerdotdev/empty/merges", - mirror_url: null, - updated_at: "2023-06-21T17:23:26Z", - visibility: "public", - archive_url: "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", - commits_url: "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", - compare_url: "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", - description: "An empty repo that can be used to test the @trigger.dev/github integration", - forks_count: 0, - is_template: false, - open_issues: 5, - branches_url: "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", - comments_url: "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", - contents_url: "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", - git_refs_url: "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", - git_tags_url: "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", - has_projects: true, - releases_url: "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", - statuses_url: "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", - allow_forking: true, - assignees_url: "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", - downloads_url: "https://api.github.com/repos/triggerdotdev/empty/downloads", - has_downloads: true, - languages_url: "https://api.github.com/repos/triggerdotdev/empty/languages", - default_branch: "main", - milestones_url: "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", - stargazers_url: "https://api.github.com/repos/triggerdotdev/empty/stargazers", - watchers_count: 0, - deployments_url: "https://api.github.com/repos/triggerdotdev/empty/deployments", - git_commits_url: "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", - has_discussions: false, - subscribers_url: "https://api.github.com/repos/triggerdotdev/empty/subscribers", - allow_auto_merge: false, - contributors_url: "https://api.github.com/repos/triggerdotdev/empty/contributors", - issue_events_url: - "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", - stargazers_count: 0, - subscription_url: "https://api.github.com/repos/triggerdotdev/empty/subscription", - collaborators_url: - "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", - issue_comment_url: - "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", - notifications_url: - "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", - open_issues_count: 5, - allow_merge_commit: true, - allow_rebase_merge: true, - allow_squash_merge: true, - merge_commit_title: "MERGE_MESSAGE", - allow_update_branch: false, - merge_commit_message: "PR_TITLE", - delete_branch_on_merge: false, - squash_merge_commit_title: "COMMIT_OR_PR_TITLE", - squash_merge_commit_message: "COMMIT_MESSAGES", - web_commit_signoff_required: false, - use_squash_pr_title_as_default: false, - }, - user: { - id: 95297378, - url: "https://api.github.com/users/triggerdotdev", - type: "Organization", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - html_url: "https://github.com/triggerdotdev", - gists_url: "https://api.github.com/users/triggerdotdev/gists{/gist_id}", - repos_url: "https://api.github.com/users/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/users/triggerdotdev/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/triggerdotdev/followers", - following_url: "https://api.github.com/users/triggerdotdev/following{/other_user}", - organizations_url: "https://api.github.com/users/triggerdotdev/orgs", - subscriptions_url: "https://api.github.com/users/triggerdotdev/subscriptions", - received_events_url: "https://api.github.com/users/triggerdotdev/received_events", - }, - label: "triggerdotdev:main", - }, - body: "A bit more added to the readme which could be useful", - head: { - ref: "test", - sha: "073aa42afebca03c4b34361564e3976da5c65d48", - repo: { - id: 656732269, - url: "https://api.github.com/repos/triggerdotdev/empty", - fork: false, - name: "empty", - size: 0, - forks: 0, - owner: { - id: 95297378, - url: "https://api.github.com/users/triggerdotdev", - type: "Organization", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - html_url: "https://github.com/triggerdotdev", - gists_url: "https://api.github.com/users/triggerdotdev/gists{/gist_id}", - repos_url: "https://api.github.com/users/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/users/triggerdotdev/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/triggerdotdev/followers", - following_url: "https://api.github.com/users/triggerdotdev/following{/other_user}", - organizations_url: "https://api.github.com/users/triggerdotdev/orgs", - subscriptions_url: "https://api.github.com/users/triggerdotdev/subscriptions", - received_events_url: "https://api.github.com/users/triggerdotdev/received_events", - }, - topics: [], - git_url: "git://github.com/triggerdotdev/empty.git", - license: null, - node_id: "R_kgDOJyTwbQ", - private: false, - ssh_url: "git@github.com:triggerdotdev/empty.git", - svn_url: "https://github.com/triggerdotdev/empty", - archived: false, - disabled: false, - has_wiki: true, - homepage: null, - html_url: "https://github.com/triggerdotdev/empty", - keys_url: "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", - language: null, - tags_url: "https://api.github.com/repos/triggerdotdev/empty/tags", - watchers: 0, - blobs_url: "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", - clone_url: "https://github.com/triggerdotdev/empty.git", - forks_url: "https://api.github.com/repos/triggerdotdev/empty/forks", - full_name: "triggerdotdev/empty", - has_pages: false, - hooks_url: "https://api.github.com/repos/triggerdotdev/empty/hooks", - pulls_url: "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", - pushed_at: "2023-06-21T18:38:34Z", - teams_url: "https://api.github.com/repos/triggerdotdev/empty/teams", - trees_url: "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", - created_at: "2023-06-21T14:21:07Z", - events_url: "https://api.github.com/repos/triggerdotdev/empty/events", - has_issues: true, - issues_url: "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", - labels_url: "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", - merges_url: "https://api.github.com/repos/triggerdotdev/empty/merges", - mirror_url: null, - updated_at: "2023-06-21T17:23:26Z", - visibility: "public", - archive_url: "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", - commits_url: "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", - compare_url: "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", - description: "An empty repo that can be used to test the @trigger.dev/github integration", - forks_count: 0, - is_template: false, - open_issues: 5, - branches_url: "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", - comments_url: "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", - contents_url: "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", - git_refs_url: "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", - git_tags_url: "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", - has_projects: true, - releases_url: "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", - statuses_url: "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", - allow_forking: true, - assignees_url: "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", - downloads_url: "https://api.github.com/repos/triggerdotdev/empty/downloads", - has_downloads: true, - languages_url: "https://api.github.com/repos/triggerdotdev/empty/languages", - default_branch: "main", - milestones_url: "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", - stargazers_url: "https://api.github.com/repos/triggerdotdev/empty/stargazers", - watchers_count: 0, - deployments_url: "https://api.github.com/repos/triggerdotdev/empty/deployments", - git_commits_url: "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", - has_discussions: false, - subscribers_url: "https://api.github.com/repos/triggerdotdev/empty/subscribers", - allow_auto_merge: false, - contributors_url: "https://api.github.com/repos/triggerdotdev/empty/contributors", - issue_events_url: - "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", - stargazers_count: 0, - subscription_url: "https://api.github.com/repos/triggerdotdev/empty/subscription", - collaborators_url: - "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", - issue_comment_url: - "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", - notifications_url: - "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", - open_issues_count: 5, - allow_merge_commit: true, - allow_rebase_merge: true, - allow_squash_merge: true, - merge_commit_title: "MERGE_MESSAGE", - allow_update_branch: false, - merge_commit_message: "PR_TITLE", - delete_branch_on_merge: false, - squash_merge_commit_title: "COMMIT_OR_PR_TITLE", - squash_merge_commit_message: "COMMIT_MESSAGES", - web_commit_signoff_required: false, - use_squash_pr_title_as_default: false, - }, - user: { - id: 95297378, - url: "https://api.github.com/users/triggerdotdev", - type: "Organization", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - html_url: "https://github.com/triggerdotdev", - gists_url: "https://api.github.com/users/triggerdotdev/gists{/gist_id}", - repos_url: "https://api.github.com/users/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/users/triggerdotdev/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/triggerdotdev/followers", - following_url: "https://api.github.com/users/triggerdotdev/following{/other_user}", - organizations_url: "https://api.github.com/users/triggerdotdev/orgs", - subscriptions_url: "https://api.github.com/users/triggerdotdev/subscriptions", - received_events_url: "https://api.github.com/users/triggerdotdev/received_events", - }, - label: "triggerdotdev:test", - }, - user: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - draft: false, - state: "open", - title: "Added more to the readme", - _links: { - html: { - href: "https://github.com/triggerdotdev/empty/pull/5", - }, - self: { - href: "https://api.github.com/repos/triggerdotdev/empty/pulls/5", - }, - issue: { - href: "https://api.github.com/repos/triggerdotdev/empty/issues/5", - }, - commits: { - href: "https://api.github.com/repos/triggerdotdev/empty/pulls/5/commits", - }, - comments: { - href: "https://api.github.com/repos/triggerdotdev/empty/issues/5/comments", - }, - statuses: { - href: "https://api.github.com/repos/triggerdotdev/empty/statuses/073aa42afebca03c4b34361564e3976da5c65d48", - }, - review_comment: { - href: "https://api.github.com/repos/triggerdotdev/empty/pulls/comments{/number}", - }, - review_comments: { - href: "https://api.github.com/repos/triggerdotdev/empty/pulls/5/comments", - }, - }, - labels: [], - locked: false, - merged: false, - number: 5, - commits: 1, - node_id: "PR_kwDOJyTwbc5TlDnE", - assignee: null, - comments: 0, - diff_url: "https://github.com/triggerdotdev/empty/pull/5.diff", - html_url: "https://github.com/triggerdotdev/empty/pull/5", - additions: 2, - assignees: [], - closed_at: null, - deletions: 0, - issue_url: "https://api.github.com/repos/triggerdotdev/empty/issues/5", - mergeable: null, - merged_at: null, - merged_by: null, - milestone: null, - patch_url: "https://github.com/triggerdotdev/empty/pull/5.patch", - auto_merge: null, - created_at: "2023-06-21T18:39:13Z", - rebaseable: null, - updated_at: "2023-06-21T18:39:13Z", - commits_url: "https://api.github.com/repos/triggerdotdev/empty/pulls/5/commits", - comments_url: "https://api.github.com/repos/triggerdotdev/empty/issues/5/comments", - statuses_url: - "https://api.github.com/repos/triggerdotdev/empty/statuses/073aa42afebca03c4b34361564e3976da5c65d48", - changed_files: 1, - mergeable_state: "unknown", - requested_teams: [], - review_comments: 0, - merge_commit_sha: null, - active_lock_reason: null, - author_association: "MEMBER", - review_comment_url: - "https://api.github.com/repos/triggerdotdev/empty/pulls/comments{/number}", - requested_reviewers: [], - review_comments_url: "https://api.github.com/repos/triggerdotdev/empty/pulls/5/comments", - maintainer_can_modify: false, - }, - }, -}; - -export const pullRequestReviewSubmitted: EventSpecificationExample = { - id: "pull_request_review.submitted", - name: "Pull request review submitted", - payload: { - action: "submitted", - review: { - id: 1491475123, - body: "This needs some work still", - user: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - state: "commented", - _links: { - html: { - href: "https://github.com/triggerdotdev/empty/pull/5#pullrequestreview-1491475123", - }, - pull_request: { - href: "https://api.github.com/repos/triggerdotdev/empty/pulls/5", - }, - }, - node_id: "PRR_kwDOJyTwbc5Y5hqz", - html_url: "https://github.com/triggerdotdev/empty/pull/5#pullrequestreview-1491475123", - commit_id: "073aa42afebca03c4b34361564e3976da5c65d48", - submitted_at: "2023-06-21T18:47:47Z", - pull_request_url: "https://api.github.com/repos/triggerdotdev/empty/pulls/5", - author_association: "MEMBER", - }, - sender: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - repository: { - id: 656732269, - url: "https://api.github.com/repos/triggerdotdev/empty", - fork: false, - name: "empty", - size: 0, - forks: 0, - owner: { - id: 95297378, - url: "https://api.github.com/users/triggerdotdev", - type: "Organization", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - html_url: "https://github.com/triggerdotdev", - gists_url: "https://api.github.com/users/triggerdotdev/gists{/gist_id}", - repos_url: "https://api.github.com/users/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/users/triggerdotdev/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/triggerdotdev/followers", - following_url: "https://api.github.com/users/triggerdotdev/following{/other_user}", - organizations_url: "https://api.github.com/users/triggerdotdev/orgs", - subscriptions_url: "https://api.github.com/users/triggerdotdev/subscriptions", - received_events_url: "https://api.github.com/users/triggerdotdev/received_events", - }, - topics: [], - git_url: "git://github.com/triggerdotdev/empty.git", - license: null, - node_id: "R_kgDOJyTwbQ", - private: false, - ssh_url: "git@github.com:triggerdotdev/empty.git", - svn_url: "https://github.com/triggerdotdev/empty", - archived: false, - disabled: false, - has_wiki: true, - homepage: null, - html_url: "https://github.com/triggerdotdev/empty", - keys_url: "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", - language: null, - tags_url: "https://api.github.com/repos/triggerdotdev/empty/tags", - watchers: 0, - blobs_url: "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", - clone_url: "https://github.com/triggerdotdev/empty.git", - forks_url: "https://api.github.com/repos/triggerdotdev/empty/forks", - full_name: "triggerdotdev/empty", - has_pages: false, - hooks_url: "https://api.github.com/repos/triggerdotdev/empty/hooks", - pulls_url: "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", - pushed_at: "2023-06-21T18:39:13Z", - teams_url: "https://api.github.com/repos/triggerdotdev/empty/teams", - trees_url: "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", - created_at: "2023-06-21T14:21:07Z", - events_url: "https://api.github.com/repos/triggerdotdev/empty/events", - has_issues: true, - issues_url: "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", - labels_url: "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", - merges_url: "https://api.github.com/repos/triggerdotdev/empty/merges", - mirror_url: null, - updated_at: "2023-06-21T17:23:26Z", - visibility: "public", - archive_url: "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", - commits_url: "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", - compare_url: "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", - description: "An empty repo that can be used to test the @trigger.dev/github integration", - forks_count: 0, - is_template: false, - open_issues: 5, - branches_url: "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", - comments_url: "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", - contents_url: "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", - git_refs_url: "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", - git_tags_url: "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", - has_projects: true, - releases_url: "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", - statuses_url: "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", - allow_forking: true, - assignees_url: "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", - downloads_url: "https://api.github.com/repos/triggerdotdev/empty/downloads", - has_downloads: true, - languages_url: "https://api.github.com/repos/triggerdotdev/empty/languages", - default_branch: "main", - milestones_url: "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", - stargazers_url: "https://api.github.com/repos/triggerdotdev/empty/stargazers", - watchers_count: 0, - deployments_url: "https://api.github.com/repos/triggerdotdev/empty/deployments", - git_commits_url: "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", - has_discussions: false, - subscribers_url: "https://api.github.com/repos/triggerdotdev/empty/subscribers", - contributors_url: "https://api.github.com/repos/triggerdotdev/empty/contributors", - issue_events_url: "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", - stargazers_count: 0, - subscription_url: "https://api.github.com/repos/triggerdotdev/empty/subscription", - collaborators_url: - "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", - issue_comment_url: - "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", - notifications_url: - "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", - open_issues_count: 5, - web_commit_signoff_required: false, - }, - organization: { - id: 95297378, - url: "https://api.github.com/orgs/triggerdotdev", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - hooks_url: "https://api.github.com/orgs/triggerdotdev/hooks", - repos_url: "https://api.github.com/orgs/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/orgs/triggerdotdev/events", - issues_url: "https://api.github.com/orgs/triggerdotdev/issues", - description: "", - members_url: "https://api.github.com/orgs/triggerdotdev/members{/member}", - public_members_url: "https://api.github.com/orgs/triggerdotdev/public_members{/member}", - }, - pull_request: { - id: 1402223044, - url: "https://api.github.com/repos/triggerdotdev/empty/pulls/5", - base: { - ref: "main", - sha: "1ca6a91f4a1385e448364a5de1960a3da60d3fe2", - repo: { - id: 656732269, - url: "https://api.github.com/repos/triggerdotdev/empty", - fork: false, - name: "empty", - size: 0, - forks: 0, - owner: { - id: 95297378, - url: "https://api.github.com/users/triggerdotdev", - type: "Organization", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - html_url: "https://github.com/triggerdotdev", - gists_url: "https://api.github.com/users/triggerdotdev/gists{/gist_id}", - repos_url: "https://api.github.com/users/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/users/triggerdotdev/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/triggerdotdev/followers", - following_url: "https://api.github.com/users/triggerdotdev/following{/other_user}", - organizations_url: "https://api.github.com/users/triggerdotdev/orgs", - subscriptions_url: "https://api.github.com/users/triggerdotdev/subscriptions", - received_events_url: "https://api.github.com/users/triggerdotdev/received_events", - }, - topics: [], - git_url: "git://github.com/triggerdotdev/empty.git", - license: null, - node_id: "R_kgDOJyTwbQ", - private: false, - ssh_url: "git@github.com:triggerdotdev/empty.git", - svn_url: "https://github.com/triggerdotdev/empty", - archived: false, - disabled: false, - has_wiki: true, - homepage: null, - html_url: "https://github.com/triggerdotdev/empty", - keys_url: "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", - language: null, - tags_url: "https://api.github.com/repos/triggerdotdev/empty/tags", - watchers: 0, - blobs_url: "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", - clone_url: "https://github.com/triggerdotdev/empty.git", - forks_url: "https://api.github.com/repos/triggerdotdev/empty/forks", - full_name: "triggerdotdev/empty", - has_pages: false, - hooks_url: "https://api.github.com/repos/triggerdotdev/empty/hooks", - pulls_url: "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", - pushed_at: "2023-06-21T18:39:13Z", - teams_url: "https://api.github.com/repos/triggerdotdev/empty/teams", - trees_url: "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", - created_at: "2023-06-21T14:21:07Z", - events_url: "https://api.github.com/repos/triggerdotdev/empty/events", - has_issues: true, - issues_url: "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", - labels_url: "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", - merges_url: "https://api.github.com/repos/triggerdotdev/empty/merges", - mirror_url: null, - updated_at: "2023-06-21T17:23:26Z", - visibility: "public", - archive_url: "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", - commits_url: "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", - compare_url: "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", - description: "An empty repo that can be used to test the @trigger.dev/github integration", - forks_count: 0, - is_template: false, - open_issues: 5, - branches_url: "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", - comments_url: "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", - contents_url: "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", - git_refs_url: "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", - git_tags_url: "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", - has_projects: true, - releases_url: "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", - statuses_url: "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", - allow_forking: true, - assignees_url: "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", - downloads_url: "https://api.github.com/repos/triggerdotdev/empty/downloads", - has_downloads: true, - languages_url: "https://api.github.com/repos/triggerdotdev/empty/languages", - default_branch: "main", - milestones_url: "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", - stargazers_url: "https://api.github.com/repos/triggerdotdev/empty/stargazers", - watchers_count: 0, - deployments_url: "https://api.github.com/repos/triggerdotdev/empty/deployments", - git_commits_url: "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", - has_discussions: false, - subscribers_url: "https://api.github.com/repos/triggerdotdev/empty/subscribers", - allow_auto_merge: false, - contributors_url: "https://api.github.com/repos/triggerdotdev/empty/contributors", - issue_events_url: - "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", - stargazers_count: 0, - subscription_url: "https://api.github.com/repos/triggerdotdev/empty/subscription", - collaborators_url: - "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", - issue_comment_url: - "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", - notifications_url: - "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", - open_issues_count: 5, - allow_merge_commit: true, - allow_rebase_merge: true, - allow_squash_merge: true, - merge_commit_title: "MERGE_MESSAGE", - allow_update_branch: false, - merge_commit_message: "PR_TITLE", - delete_branch_on_merge: false, - squash_merge_commit_title: "COMMIT_OR_PR_TITLE", - squash_merge_commit_message: "COMMIT_MESSAGES", - web_commit_signoff_required: false, - use_squash_pr_title_as_default: false, - }, - user: { - id: 95297378, - url: "https://api.github.com/users/triggerdotdev", - type: "Organization", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - html_url: "https://github.com/triggerdotdev", - gists_url: "https://api.github.com/users/triggerdotdev/gists{/gist_id}", - repos_url: "https://api.github.com/users/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/users/triggerdotdev/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/triggerdotdev/followers", - following_url: "https://api.github.com/users/triggerdotdev/following{/other_user}", - organizations_url: "https://api.github.com/users/triggerdotdev/orgs", - subscriptions_url: "https://api.github.com/users/triggerdotdev/subscriptions", - received_events_url: "https://api.github.com/users/triggerdotdev/received_events", - }, - label: "triggerdotdev:main", - }, - body: "A bit more added to the readme which could be useful", - head: { - ref: "test", - sha: "073aa42afebca03c4b34361564e3976da5c65d48", - repo: { - id: 656732269, - url: "https://api.github.com/repos/triggerdotdev/empty", - fork: false, - name: "empty", - size: 0, - forks: 0, - owner: { - id: 95297378, - url: "https://api.github.com/users/triggerdotdev", - type: "Organization", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - html_url: "https://github.com/triggerdotdev", - gists_url: "https://api.github.com/users/triggerdotdev/gists{/gist_id}", - repos_url: "https://api.github.com/users/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/users/triggerdotdev/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/triggerdotdev/followers", - following_url: "https://api.github.com/users/triggerdotdev/following{/other_user}", - organizations_url: "https://api.github.com/users/triggerdotdev/orgs", - subscriptions_url: "https://api.github.com/users/triggerdotdev/subscriptions", - received_events_url: "https://api.github.com/users/triggerdotdev/received_events", - }, - topics: [], - git_url: "git://github.com/triggerdotdev/empty.git", - license: null, - node_id: "R_kgDOJyTwbQ", - private: false, - ssh_url: "git@github.com:triggerdotdev/empty.git", - svn_url: "https://github.com/triggerdotdev/empty", - archived: false, - disabled: false, - has_wiki: true, - homepage: null, - html_url: "https://github.com/triggerdotdev/empty", - keys_url: "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", - language: null, - tags_url: "https://api.github.com/repos/triggerdotdev/empty/tags", - watchers: 0, - blobs_url: "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", - clone_url: "https://github.com/triggerdotdev/empty.git", - forks_url: "https://api.github.com/repos/triggerdotdev/empty/forks", - full_name: "triggerdotdev/empty", - has_pages: false, - hooks_url: "https://api.github.com/repos/triggerdotdev/empty/hooks", - pulls_url: "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", - pushed_at: "2023-06-21T18:39:13Z", - teams_url: "https://api.github.com/repos/triggerdotdev/empty/teams", - trees_url: "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", - created_at: "2023-06-21T14:21:07Z", - events_url: "https://api.github.com/repos/triggerdotdev/empty/events", - has_issues: true, - issues_url: "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", - labels_url: "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", - merges_url: "https://api.github.com/repos/triggerdotdev/empty/merges", - mirror_url: null, - updated_at: "2023-06-21T17:23:26Z", - visibility: "public", - archive_url: "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", - commits_url: "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", - compare_url: "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", - description: "An empty repo that can be used to test the @trigger.dev/github integration", - forks_count: 0, - is_template: false, - open_issues: 5, - branches_url: "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", - comments_url: "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", - contents_url: "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", - git_refs_url: "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", - git_tags_url: "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", - has_projects: true, - releases_url: "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", - statuses_url: "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", - allow_forking: true, - assignees_url: "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", - downloads_url: "https://api.github.com/repos/triggerdotdev/empty/downloads", - has_downloads: true, - languages_url: "https://api.github.com/repos/triggerdotdev/empty/languages", - default_branch: "main", - milestones_url: "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", - stargazers_url: "https://api.github.com/repos/triggerdotdev/empty/stargazers", - watchers_count: 0, - deployments_url: "https://api.github.com/repos/triggerdotdev/empty/deployments", - git_commits_url: "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", - has_discussions: false, - subscribers_url: "https://api.github.com/repos/triggerdotdev/empty/subscribers", - allow_auto_merge: false, - contributors_url: "https://api.github.com/repos/triggerdotdev/empty/contributors", - issue_events_url: - "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", - stargazers_count: 0, - subscription_url: "https://api.github.com/repos/triggerdotdev/empty/subscription", - collaborators_url: - "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", - issue_comment_url: - "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", - notifications_url: - "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", - open_issues_count: 5, - allow_merge_commit: true, - allow_rebase_merge: true, - allow_squash_merge: true, - merge_commit_title: "MERGE_MESSAGE", - allow_update_branch: false, - merge_commit_message: "PR_TITLE", - delete_branch_on_merge: false, - squash_merge_commit_title: "COMMIT_OR_PR_TITLE", - squash_merge_commit_message: "COMMIT_MESSAGES", - web_commit_signoff_required: false, - use_squash_pr_title_as_default: false, - }, - user: { - id: 95297378, - url: "https://api.github.com/users/triggerdotdev", - type: "Organization", - login: "triggerdotdev", - node_id: "O_kgDOBa4fYg", - html_url: "https://github.com/triggerdotdev", - gists_url: "https://api.github.com/users/triggerdotdev/gists{/gist_id}", - repos_url: "https://api.github.com/users/triggerdotdev/repos", - avatar_url: "https://avatars.githubusercontent.com/u/95297378?v=4", - events_url: "https://api.github.com/users/triggerdotdev/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/triggerdotdev/followers", - following_url: "https://api.github.com/users/triggerdotdev/following{/other_user}", - organizations_url: "https://api.github.com/users/triggerdotdev/orgs", - subscriptions_url: "https://api.github.com/users/triggerdotdev/subscriptions", - received_events_url: "https://api.github.com/users/triggerdotdev/received_events", - }, - label: "triggerdotdev:test", - }, - user: { - id: 10635986, - url: "https://api.github.com/users/matt-aitken", - type: "User", - login: "matt-aitken", - node_id: "MDQ6VXNlcjEwNjM1OTg2", - html_url: "https://github.com/matt-aitken", - gists_url: "https://api.github.com/users/matt-aitken/gists{/gist_id}", - repos_url: "https://api.github.com/users/matt-aitken/repos", - avatar_url: "https://avatars.githubusercontent.com/u/10635986?v=4", - events_url: "https://api.github.com/users/matt-aitken/events{/privacy}", - site_admin: false, - gravatar_id: "", - starred_url: "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}", - followers_url: "https://api.github.com/users/matt-aitken/followers", - following_url: "https://api.github.com/users/matt-aitken/following{/other_user}", - organizations_url: "https://api.github.com/users/matt-aitken/orgs", - subscriptions_url: "https://api.github.com/users/matt-aitken/subscriptions", - received_events_url: "https://api.github.com/users/matt-aitken/received_events", - }, - draft: false, - state: "open", - title: "Added more to the readme", - _links: { - html: { - href: "https://github.com/triggerdotdev/empty/pull/5", - }, - self: { - href: "https://api.github.com/repos/triggerdotdev/empty/pulls/5", - }, - issue: { - href: "https://api.github.com/repos/triggerdotdev/empty/issues/5", - }, - commits: { - href: "https://api.github.com/repos/triggerdotdev/empty/pulls/5/commits", - }, - comments: { - href: "https://api.github.com/repos/triggerdotdev/empty/issues/5/comments", - }, - statuses: { - href: "https://api.github.com/repos/triggerdotdev/empty/statuses/073aa42afebca03c4b34361564e3976da5c65d48", - }, - review_comment: { - href: "https://api.github.com/repos/triggerdotdev/empty/pulls/comments{/number}", - }, - review_comments: { - href: "https://api.github.com/repos/triggerdotdev/empty/pulls/5/comments", - }, - }, - labels: [], - locked: false, - number: 5, - node_id: "PR_kwDOJyTwbc5TlDnE", - assignee: null, - diff_url: "https://github.com/triggerdotdev/empty/pull/5.diff", - html_url: "https://github.com/triggerdotdev/empty/pull/5", - assignees: [], - closed_at: null, - issue_url: "https://api.github.com/repos/triggerdotdev/empty/issues/5", - merged_at: null, - milestone: null, - patch_url: "https://github.com/triggerdotdev/empty/pull/5.patch", - auto_merge: null, - created_at: "2023-06-21T18:39:13Z", - updated_at: "2023-06-21T18:47:47Z", - commits_url: "https://api.github.com/repos/triggerdotdev/empty/pulls/5/commits", - comments_url: "https://api.github.com/repos/triggerdotdev/empty/issues/5/comments", - statuses_url: - "https://api.github.com/repos/triggerdotdev/empty/statuses/073aa42afebca03c4b34361564e3976da5c65d48", - requested_teams: [], - merge_commit_sha: "f146c57c260778db17300c47c366bce0e2dbd53d", - active_lock_reason: null, - author_association: "MEMBER", - review_comment_url: - "https://api.github.com/repos/triggerdotdev/empty/pulls/comments{/number}", - requested_reviewers: [], - review_comments_url: "https://api.github.com/repos/triggerdotdev/empty/pulls/5/comments", - }, - }, -}; diff --git a/integrations/github/tsconfig.json b/integrations/github/tsconfig.json deleted file mode 100644 index a816ed394..000000000 --- a/integrations/github/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "@trigger.dev/tsconfig/node18.json", - "include": ["./src/**/*.ts", "tsup.config.ts"], - "compilerOptions": { - "lib": ["DOM", "DOM.Iterable", "ES2019"], - "paths": { - "@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"], - "@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"], - "@trigger.dev/integration-kit/*": ["../../packages/integration-kit/src/*"], - "@trigger.dev/integration-kit": ["../../packages/integration-kit/src/index"], - "@trigger.dev/tsup/*": ["../../config-packages/tsup/src/*"], - "@trigger.dev/tsup": ["../../config-packages/tsup/src/index"] - }, - "declaration": false, - "declarationMap": false, - "baseUrl": ".", - "stripInternal": true - }, - "exclude": ["node_modules"] -} diff --git a/integrations/github/tsup.config.ts b/integrations/github/tsup.config.ts deleted file mode 100644 index 1d1b59a08..000000000 --- a/integrations/github/tsup.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { defineConfigPackage } from "@trigger.dev/tsup"; - -export default defineConfigPackage; diff --git a/integrations/linear/CHANGELOG.md b/integrations/linear/CHANGELOG.md deleted file mode 100644 index 54262b517..000000000 --- a/integrations/linear/CHANGELOG.md +++ /dev/null @@ -1,727 +0,0 @@ -# @trigger.dev/linear - -## 3.0.0-beta.55 - -### Patch Changes - -- Updated dependencies [0591db5f2] - - @trigger.dev/sdk@3.0.0-beta.55 - - @trigger.dev/integration-kit@3.0.0-beta.55 - -## 3.0.0-beta.54 - -### Patch Changes - -- Updated dependencies [728eeeff6] - - @trigger.dev/sdk@3.0.0-beta.54 - - @trigger.dev/integration-kit@3.0.0-beta.54 - -## 3.0.0-beta.53 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.53 -- @trigger.dev/sdk@3.0.0-beta.53 - -## 3.0.0-beta.52 - -### Patch Changes - -- Updated dependencies [8cae1d087] - - @trigger.dev/sdk@3.0.0-beta.52 - - @trigger.dev/integration-kit@3.0.0-beta.52 - -## 3.0.0-beta.51 - -### Patch Changes - -- Updated dependencies [979bee50d] -- Updated dependencies [086a0f95c] -- Updated dependencies [55264657d] - - @trigger.dev/sdk@3.0.0-beta.51 - - @trigger.dev/integration-kit@3.0.0-beta.51 - -## 3.0.0-beta.50 - -### Patch Changes - -- Updated dependencies [8ba998794] - - @trigger.dev/sdk@3.0.0-beta.50 - - @trigger.dev/integration-kit@3.0.0-beta.50 - -## 3.0.0-beta.49 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.49 -- @trigger.dev/sdk@3.0.0-beta.49 - -## 3.0.0-beta.48 - -### Patch Changes - -- Updated dependencies [ecf1110ab] - - @trigger.dev/sdk@3.0.0-beta.48 - - @trigger.dev/integration-kit@3.0.0-beta.48 - -## 3.0.0-beta.47 - -### Patch Changes - -- Updated dependencies [4f95c9de4] - - @trigger.dev/sdk@3.0.0-beta.47 - - @trigger.dev/integration-kit@3.0.0-beta.47 - -## 3.0.0-beta.46 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.46 -- @trigger.dev/sdk@3.0.0-beta.46 - -## 3.0.0-beta.45 - -### Patch Changes - -- Updated dependencies [0e77e7ef7] - - @trigger.dev/sdk@3.0.0-beta.45 - - @trigger.dev/integration-kit@3.0.0-beta.45 - -## 3.0.0-beta.44 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.44 -- @trigger.dev/sdk@3.0.0-beta.44 - -## 3.0.0-beta.43 - -### Patch Changes - -- Updated dependencies [34ca7667d] - - @trigger.dev/sdk@3.0.0-beta.43 - - @trigger.dev/integration-kit@3.0.0-beta.43 - -## 3.0.0-beta.42 - -### Patch Changes - -- Updated dependencies [ecef19966] - - @trigger.dev/sdk@3.0.0-beta.42 - - @trigger.dev/integration-kit@3.0.0-beta.42 - -## 3.0.0-beta.41 - -### Patch Changes - -- Updated dependencies [7c36a1a4b] - - @trigger.dev/sdk@3.0.0-beta.41 - - @trigger.dev/integration-kit@3.0.0-beta.41 - -## 3.0.0-beta.40 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.40 -- @trigger.dev/sdk@3.0.0-beta.40 - -## 3.0.0-beta.39 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.39 -- @trigger.dev/sdk@3.0.0-beta.39 - -## 3.0.0-beta.38 - -### Patch Changes - -- Updated dependencies [1b90ffbb8] -- Updated dependencies [c405ae711] - - @trigger.dev/sdk@3.0.0-beta.38 - - @trigger.dev/integration-kit@3.0.0-beta.38 - -## 3.0.0-beta.37 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.37 -- @trigger.dev/sdk@3.0.0-beta.37 - -## 3.0.0-beta.36 - -### Patch Changes - -- Updated dependencies [51bb4c887] -- Updated dependencies [ba71f959e] - - @trigger.dev/sdk@3.0.0-beta.36 - - @trigger.dev/integration-kit@3.0.0-beta.36 - -## 3.0.0-beta.35 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.35 -- @trigger.dev/sdk@3.0.0-beta.35 - -## 3.0.0-beta.34 - -### Patch Changes - -- Updated dependencies [3a1b0c486] -- Updated dependencies [3f8b6d8fc] -- Updated dependencies [1281d40e4] - - @trigger.dev/sdk@3.0.0-beta.34 - - @trigger.dev/integration-kit@3.0.0-beta.34 - -## 3.0.0-beta.33 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.33 -- @trigger.dev/sdk@3.0.0-beta.33 - -## 3.0.0-beta.32 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.32 -- @trigger.dev/sdk@3.0.0-beta.32 - -## 3.0.0-beta.31 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.31 -- @trigger.dev/sdk@3.0.0-beta.31 - -## 3.0.0-beta.30 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.30 -- @trigger.dev/sdk@3.0.0-beta.30 - -## 3.0.0-beta.29 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.29 -- @trigger.dev/sdk@3.0.0-beta.29 - -## 3.0.0-beta.28 - -### Patch Changes - -- Updated dependencies [6d9dfbc75] - - @trigger.dev/sdk@3.0.0-beta.28 - - @trigger.dev/integration-kit@3.0.0-beta.28 - -## 3.0.0-beta.27 - -### Patch Changes - -- Updated dependencies [203e00208] - - @trigger.dev/sdk@3.0.0-beta.27 - - @trigger.dev/integration-kit@3.0.0-beta.27 - -## 3.0.0-beta.26 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.26 -- @trigger.dev/sdk@3.0.0-beta.26 - -## 3.0.0-beta.25 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.25 -- @trigger.dev/sdk@3.0.0-beta.25 - -## 3.0.0-beta.24 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.24 -- @trigger.dev/sdk@3.0.0-beta.24 - -## 3.0.0-beta.23 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.23 -- @trigger.dev/sdk@3.0.0-beta.23 - -## 3.0.0-beta.22 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.22 -- @trigger.dev/sdk@3.0.0-beta.22 - -## 3.0.0-beta.21 - -### Patch Changes - -- Updated dependencies [9491a1649] - - @trigger.dev/sdk@3.0.0-beta.21 - - @trigger.dev/integration-kit@3.0.0-beta.21 - -## 3.0.0-beta.20 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.20 -- @trigger.dev/sdk@3.0.0-beta.20 - -## 3.0.0-beta.19 - -### Patch Changes - -- Updated dependencies [e9a63a486] - - @trigger.dev/sdk@3.0.0-beta.19 - - @trigger.dev/integration-kit@3.0.0-beta.19 - -## 3.0.0-beta.18 - -### Patch Changes - -- Updated dependencies [b68012f81] -- Updated dependencies [b68012f81] -- Updated dependencies [b68012f81] - - @trigger.dev/sdk@3.0.0-beta.18 - - @trigger.dev/integration-kit@3.0.0-beta.18 - -## 3.0.0-beta.17 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.17 -- @trigger.dev/sdk@3.0.0-beta.17 - -## 3.0.0-beta.16 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.16 -- @trigger.dev/sdk@3.0.0-beta.16 - -## 3.0.0-beta.15 - -### Patch Changes - -- Updated dependencies [374edef02] -- Updated dependencies [26093896d] - - @trigger.dev/sdk@3.0.0-beta.15 - - @trigger.dev/integration-kit@3.0.0-beta.15 - -## 3.0.0-beta.14 - -### Patch Changes - -- Updated dependencies [c9e1a3e9c] - - @trigger.dev/sdk@3.0.0-beta.14 - - @trigger.dev/integration-kit@3.0.0-beta.14 - -## 3.0.0-beta.13 - -### Patch Changes - -- Updated dependencies [4986bfda2] -- Updated dependencies [44e1b8754] -- Updated dependencies [4986bfda2] -- Updated dependencies [4986bfda2] - - @trigger.dev/sdk@3.0.0-beta.13 - - @trigger.dev/integration-kit@3.0.0-beta.13 - -## 3.0.0-beta.12 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.12 -- @trigger.dev/sdk@3.0.0-beta.12 - -## 3.0.0-beta.11 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.11 -- @trigger.dev/sdk@3.0.0-beta.11 - -## 3.0.0-beta.7 - -### Patch Changes - -- Updated dependencies [f854cb90e] -- Updated dependencies [f854cb90e] - - @trigger.dev/sdk@3.0.0-beta.7 - - @trigger.dev/integration-kit@3.0.0-beta.7 - -## 3.0.0-beta.6 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.6 -- @trigger.dev/sdk@3.0.0-beta.6 - -## 3.0.0-beta.5 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.5 -- @trigger.dev/sdk@3.0.0-beta.5 - -## 3.0.0-beta.4 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.4 -- @trigger.dev/sdk@3.0.0-beta.4 - -## 3.0.0-beta.3 - -### Patch Changes - -- Updated dependencies [b271742dc] - - @trigger.dev/sdk@3.0.0-beta.3 - - @trigger.dev/integration-kit@3.0.0-beta.3 - -## 3.0.0-beta.2 - -### Patch Changes - -- @trigger.dev/integration-kit@3.0.0-beta.2 -- @trigger.dev/sdk@3.0.0-beta.2 - -## 3.0.0-beta.1 - -### Patch Changes - -- Updated dependencies [b66d5525e] -- Updated dependencies [719c0a0b9] -- Updated dependencies [f93eae300] - - @trigger.dev/sdk@3.0.0-beta.1 - - @trigger.dev/integration-kit@3.0.0-beta.1 - -## 3.0.0-beta.0 - -### Patch Changes - -- Updated dependencies [395abe1b9] - - @trigger.dev/sdk@3.0.0-beta.0 - - @trigger.dev/integration-kit@3.0.0-beta.0 - -## 2.3.18 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.18 -- @trigger.dev/sdk@2.3.18 - -## 2.3.17 - -### Patch Changes - -- Updated dependencies [dd879c8e] - - @trigger.dev/sdk@2.3.17 - - @trigger.dev/integration-kit@2.3.17 - -## 2.3.16 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.16 -- @trigger.dev/sdk@2.3.16 - -## 2.3.15 - -### Patch Changes - -- Updated dependencies [6c4047cf] - - @trigger.dev/sdk@2.3.15 - - @trigger.dev/integration-kit@2.3.15 - -## 2.3.14 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.14 -- @trigger.dev/sdk@2.3.14 - -## 2.3.13 - -### Patch Changes - -- Updated dependencies [a93b554f] -- Updated dependencies [0f342cd1] - - @trigger.dev/sdk@2.3.13 - - @trigger.dev/integration-kit@2.3.13 - -## 2.3.12 - -### Patch Changes - -- Updated dependencies [129f023d] -- Updated dependencies [38f5a903] -- Updated dependencies [ff4ff869] - - @trigger.dev/sdk@2.3.12 - - @trigger.dev/integration-kit@2.3.12 - -## 2.3.11 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.11 -- @trigger.dev/sdk@2.3.11 - -## 2.3.10 - -### Patch Changes - -- Updated dependencies [8277f4d2] -- Updated dependencies [73cb8839] - - @trigger.dev/sdk@2.3.10 - - @trigger.dev/integration-kit@2.3.10 - -## 2.3.9 - -### Patch Changes - -- Updated dependencies [f7bf25f0] - - @trigger.dev/sdk@2.3.9 - - @trigger.dev/integration-kit@2.3.9 - -## 2.3.8 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.8 -- @trigger.dev/sdk@2.3.8 - -## 2.3.7 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.7 -- @trigger.dev/sdk@2.3.7 - -## 2.3.6 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.6 -- @trigger.dev/sdk@2.3.6 - -## 2.3.5 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.5 -- @trigger.dev/sdk@2.3.5 - -## 2.3.4 - -### Patch Changes - -- Updated dependencies [6a3c563f] - - @trigger.dev/sdk@2.3.4 - - @trigger.dev/integration-kit@2.3.4 - -## 2.3.3 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.3 -- @trigger.dev/sdk@2.3.3 - -## 2.3.2 - -### Patch Changes - -- @trigger.dev/integration-kit@2.3.2 -- @trigger.dev/sdk@2.3.2 - -## 2.3.1 - -### Patch Changes - -- Updated dependencies [f3efcc0c] - - @trigger.dev/sdk@2.3.1 - - @trigger.dev/integration-kit@2.3.1 - -## 2.3.0 - -### Minor Changes - -- 17f6f29d: Support for Deno, Bun and Cloudflare workers, as well as conditionally exporting ESM versions of the package instead of just commonjs. - - Cloudflare worker support requires the node compat flag turned on (https://developers.cloudflare.com/workers/runtime-apis/nodejs/) - -### Patch Changes - -- Updated dependencies [17f6f29d] - - @trigger.dev/integration-kit@2.3.0 - - @trigger.dev/sdk@2.3.0 - -## 2.2.11 - -### Patch Changes - -- Updated dependencies [de652c1d] - - @trigger.dev/sdk@2.2.11 - - @trigger.dev/integration-kit@2.2.11 - -## 2.2.10 - -### Patch Changes - -- @trigger.dev/integration-kit@2.2.10 -- @trigger.dev/sdk@2.2.10 - -## 2.2.9 - -### Patch Changes - -- Updated dependencies [1dcd87a2] -- Updated dependencies [6ebd435e] - - @trigger.dev/sdk@2.2.9 - - @trigger.dev/integration-kit@2.2.9 - -## 2.2.8 - -### Patch Changes - -- Updated dependencies [067e19fe] -- Updated dependencies [096151c0] - - @trigger.dev/integration-kit@2.2.8 - - @trigger.dev/sdk@2.2.8 - -## 2.2.7 - -### Patch Changes - -- Updated dependencies [756024da] - - @trigger.dev/sdk@2.2.7 - - @trigger.dev/integration-kit@2.2.7 - -## 2.2.6 - -### Patch Changes - -- Updated dependencies [cb1825bf] -- Updated dependencies [cb1825bf] -- Updated dependencies [d0217344] -- Updated dependencies [cb1825bf] - - @trigger.dev/integration-kit@2.2.6 - - @trigger.dev/sdk@2.2.6 - -## 2.2.5 - -### Patch Changes - -- Updated dependencies [7e57f1f3] -- Updated dependencies [cf8f9946] -- Updated dependencies [a74716a1] -- Updated dependencies [620b8383] -- Updated dependencies [620b8383] -- Updated dependencies [4a0f030e] -- Updated dependencies [f4275e50] - - @trigger.dev/sdk@2.2.5 - - @trigger.dev/integration-kit@2.2.5 - -## 2.2.4 - -### Patch Changes - -- Updated dependencies [c1710ae7] -- Updated dependencies [9c4be40a] - - @trigger.dev/sdk@2.2.4 - - @trigger.dev/integration-kit@2.2.4 - -## 2.2.3 - -### Patch Changes - -- Updated dependencies [6e1b8a11] -- Updated dependencies [c4533c36] - - @trigger.dev/sdk@2.2.3 - - @trigger.dev/integration-kit@2.2.3 - -## 2.2.2 - -### Patch Changes - -- @trigger.dev/integration-kit@2.2.2 -- @trigger.dev/sdk@2.2.2 - -## 2.2.1 - -### Patch Changes - -- Updated dependencies [044d38e3] - - @trigger.dev/sdk@2.2.1 - - @trigger.dev/integration-kit@2.2.1 - -## 2.2.0 - -### Patch Changes - -- Updated dependencies [975c5f1d] - - @trigger.dev/integration-kit@2.2.0 - - @trigger.dev/sdk@2.2.0 - -## 2.1.9 - -### Patch Changes - -- 9a187f9e: upgrade zod to 3.22.3 -- Updated dependencies [9a187f9e] -- Updated dependencies [2e9452ab] - - @trigger.dev/sdk@2.1.9 - - @trigger.dev/integration-kit@2.1.9 - -## 2.1.8 - -### Patch Changes - -- 6a992a19: First release of `@trigger.dev/replicate` integration with remote callback support. -- 81e886a1: Fix `getAll` helper and search function params -- Updated dependencies [6a992a19] -- Updated dependencies [ab9e4a98] -- Updated dependencies [ab9e4a98] - - @trigger.dev/sdk@2.1.8 - - @trigger.dev/integration-kit@2.1.8 - -## 2.1.7 - -### Patch Changes - -- @trigger.dev/integration-kit@2.1.7 -- @trigger.dev/sdk@2.1.7 - -## 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 - -- 15f17d27: First release of `@trigger.dev/linear` integration. `io.runTask()` error handlers can now prevent further retries. -- Updated dependencies [ad14983e] -- Updated dependencies [15f17d27] -- Updated dependencies [50137a6f] -- Updated dependencies [c0dfa804] - - @trigger.dev/sdk@2.1.4 - - @trigger.dev/integration-kit@2.1.4 diff --git a/integrations/linear/README.md b/integrations/linear/README.md deleted file mode 100644 index 13ffab69b..000000000 --- a/integrations/linear/README.md +++ /dev/null @@ -1,3 +0,0 @@ - -# @trigger.dev/linear - \ No newline at end of file diff --git a/integrations/linear/package.json b/integrations/linear/package.json deleted file mode 100644 index 89358f69b..000000000 --- a/integrations/linear/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "@trigger.dev/linear", - "version": "3.0.0-beta.55", - "description": "Trigger.dev integration for @linear/sdk", - "main": "./dist/index.js", - "types": "./dist/index.d.ts", - "publishConfig": { - "access": "public" - }, - "files": [ - "dist" - ], - "devDependencies": { - "@trigger.dev/tsconfig": "workspace:*", - "@types/node": "16.x", - "rimraf": "^3.0.2", - "tsup": "8.0.1", - "typescript": "^5.3.0", - "@trigger.dev/tsup": "workspace:*" - }, - "scripts": { - "clean": "rimraf dist", - "build": "npm run clean && npm run build:tsup", - "build:tsup": "tsup", - "typecheck": "tsc --noEmit" - }, - "dependencies": { - "@linear/sdk": "^8.0.0", - "@trigger.dev/integration-kit": "workspace:^3.0.0-beta.55", - "@trigger.dev/sdk": "workspace:^3.0.0-beta.55", - "zod": "3.22.3" - }, - "engines": { - "node": ">=16.8.0" - }, - "exports": { - ".": { - "import": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "require": "./dist/index.js", - "types": "./dist/index.d.ts" - }, - "./package.json": "./package.json" - }, - "module": "./dist/index.mjs" -} diff --git a/integrations/linear/src/events.ts b/integrations/linear/src/events.ts deleted file mode 100644 index 18dff27b5..000000000 --- a/integrations/linear/src/events.ts +++ /dev/null @@ -1,535 +0,0 @@ -import { EventSpecification } from "@trigger.dev/sdk"; -import { - AttachmentEvent, - CommentEvent, - CycleEvent, - IssueEvent, - IssueLabelEvent, - IssueSLAEvent, - ProjectEvent, - ProjectUpdateEvent, - ReactionEvent, -} from "./schemas"; -import { GetLinearPayload } from "./types"; -import { - attachmentCreated, - attachmentRemoved, - attachmentUpdated, - commentCreated, - commentRemoved, - commentUpdated, - cycleCreated, - cycleRemoved, - cycleUpdated, - issueCreated, - issueRemoved, - issueUpdated, - issueLabelCreated, - issueLabelRemoved, - issueLabelUpdated, - projectCreated, - projectRemoved, - projectUpdated, - projectUpdateCreated, - projectUpdateRemoved, - projectUpdateUpdated, - reactionCreated, - reactionRemoved, - reactionUpdated, -} from "./payload-examples"; -import { onCommentProperties, onIssueProperties, updatedFromProperties } from "./utils"; - -/** **WARNING:** Still in alpha - use with caution! */ -export const onAttachment: EventSpecification> = { - name: "Attachment", - title: "On Attachment", - source: "linear.app", - icon: "linear", - examples: [attachmentCreated, attachmentRemoved, attachmentUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [ - { label: "Event action", text: payload.action }, - { label: "Attachment ID", text: payload.data.id }, - ], -}; - -/** **WARNING:** Still in alpha - use with caution! */ -export const onAttachmentCreated: EventSpecification> = - { - name: "Attachment", - title: "On Attachment Created", - source: "linear.app", - icon: "linear", - filter: { - action: ["create"], - }, - examples: [attachmentCreated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "Attachment ID", text: payload.data.id }], - }; - -/** **WARNING:** Still in alpha - use with caution! */ -export const onAttachmentRemoved: EventSpecification> = - { - name: "Attachment", - title: "On Attachment Removed", - source: "linear.app", - icon: "linear", - filter: { - action: ["remove"], - }, - examples: [attachmentRemoved], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "Attachment ID", text: payload.data.id }], - }; - -/** **WARNING:** Still in alpha - use with caution! */ -export const onAttachmentUpdated: EventSpecification> = - { - name: "Attachment", - title: "On Attachment Updated", - source: "linear.app", - icon: "linear", - filter: { - action: ["update"], - }, - examples: [attachmentUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "Attachment ID", text: payload.data.id }], - }; - -export const onComment: EventSpecification> = { - name: "Comment", - title: "On Comment", - source: "linear.app", - icon: "linear", - examples: [commentCreated, commentRemoved, commentUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [ - { label: "Event action", text: payload.action }, - ...onCommentProperties(payload), - ...updatedFromProperties(payload), - ], -}; - -export const onCommentCreated: EventSpecification> = { - name: "Comment", - title: "On Comment Created", - source: "linear.app", - icon: "linear", - filter: { - action: ["create"], - }, - examples: [commentCreated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => onCommentProperties(payload), -}; - -export const onCommentRemoved: EventSpecification> = { - name: "Comment", - title: "On Comment Removed", - source: "linear.app", - icon: "linear", - filter: { - action: ["remove"], - }, - examples: [commentRemoved], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => onCommentProperties(payload), -}; - -export const onCommentUpdated: EventSpecification> = { - name: "Comment", - title: "On Comment Updated", - source: "linear.app", - icon: "linear", - filter: { - action: ["update"], - }, - examples: [commentUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [...onCommentProperties(payload), ...updatedFromProperties(payload)], -}; - -export const onCycle: EventSpecification> = { - name: "Cycle", - title: "On Cycle", - source: "linear.app", - icon: "linear", - examples: [cycleCreated, cycleRemoved, cycleUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [ - { label: "Event action", text: payload.action }, - { label: "Cycle ID", text: payload.data.id }, - ], -}; - -export const onCycleCreated: EventSpecification> = { - name: "Cycle", - title: "On Cycle Created", - source: "linear.app", - icon: "linear", - filter: { - action: ["create"], - }, - examples: [cycleCreated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "Cycle ID", text: payload.data.id }], -}; - -export const onCycleRemoved: EventSpecification> = { - name: "Cycle", - title: "On Cycle Removed", - source: "linear.app", - icon: "linear", - filter: { - action: ["remove"], - }, - examples: [cycleRemoved], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "Cycle ID", text: payload.data.id }], -}; - -export const onCycleUpdated: EventSpecification> = { - name: "Cycle", - title: "On Cycle Updated", - source: "linear.app", - icon: "linear", - filter: { - action: ["update"], - }, - examples: [cycleUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "Cycle ID", text: payload.data.id }], -}; - -export const onIssue: EventSpecification> = { - name: "Issue", - title: "On Issue", - source: "linear.app", - icon: "linear", - examples: [issueCreated, issueRemoved, issueUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [ - { label: "Event action", text: payload.action }, - ...onIssueProperties(payload), - ...updatedFromProperties(payload), - ], -}; - -export const onIssueCreated: EventSpecification> = { - name: "Issue", - title: "On Issue Created", - source: "linear.app", - icon: "linear", - filter: { - action: ["create"], - }, - examples: [issueCreated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => onIssueProperties(payload), -}; - -export const onIssueRemoved: EventSpecification> = { - name: "Issue", - title: "On Issue Removed", - source: "linear.app", - icon: "linear", - filter: { - action: ["remove"], - }, - examples: [issueRemoved], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => onIssueProperties(payload), -}; - -export const onIssueUpdated: EventSpecification> = { - name: "Issue", - title: "On Issue Updated", - source: "linear.app", - icon: "linear", - filter: { - action: ["update"], - }, - examples: [issueUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [...onIssueProperties(payload), ...updatedFromProperties(payload)], -}; - -export const onIssueLabel: EventSpecification> = { - name: "IssueLabel", - title: "On IssueLabel", - source: "linear.app", - icon: "linear", - examples: [issueLabelCreated, issueLabelRemoved, issueLabelUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [ - { label: "Event action", text: payload.action }, - { label: "IssueLabel ID", text: payload.data.id }, - ], -}; - -export const onIssueLabelCreated: EventSpecification> = - { - name: "IssueLabel", - title: "On IssueLabel Created", - source: "linear.app", - icon: "linear", - filter: { - action: ["create"], - }, - examples: [issueLabelCreated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "IssueLabel ID", text: payload.data.id }], - }; - -export const onIssueLabelRemoved: EventSpecification> = - { - name: "IssueLabel", - title: "On IssueLabel Removed", - source: "linear.app", - icon: "linear", - filter: { - action: ["remove"], - }, - examples: [issueLabelRemoved], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "IssueLabel ID", text: payload.data.id }], - }; - -export const onIssueLabelUpdated: EventSpecification> = - { - name: "IssueLabel", - title: "On IssueLabel Updated", - source: "linear.app", - icon: "linear", - filter: { - action: ["update"], - }, - examples: [issueLabelUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "IssueLabel ID", text: payload.data.id }], - }; - -// TODO: this needs to be tested -export const onIssueSLA: EventSpecification> = { - name: "IssueSLA", - title: "On Issue SLA", - source: "linear.app", - icon: "linear", - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [ - { label: "SLA action", text: payload.action }, - { label: "Issue ID", text: payload.issueData.id }, - ], -}; - -export const onIssueSLASet: EventSpecification> = { - name: "IssueSLA", - title: "On Issue SLA Set", - source: "linear.app", - icon: "linear", - filter: { - action: ["set"], - }, - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "Issue ID", text: payload.issueData.id }], -}; - -export const onIssueSLABreached: EventSpecification> = { - name: "IssueSLA", - title: "On Issue SLA Breached", - source: "linear.app", - icon: "linear", - filter: { - action: ["breached"], - }, - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "Issue ID", text: payload.issueData.id }], -}; - -export const onIssueSLAHighRisk: EventSpecification> = { - name: "IssueSLA", - title: "On Issue SLA High Risk", - source: "linear.app", - icon: "linear", - filter: { - action: ["highRisk"], - }, - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "Issue ID", text: payload.issueData.id }], -}; - -export const onProject: EventSpecification> = { - name: "Project", - title: "On Project", - source: "linear.app", - icon: "linear", - examples: [projectCreated, projectRemoved, projectUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [ - { label: "Event action", text: payload.action }, - { label: "Project ID", text: payload.data.id }, - { label: "Project Name", text: payload.data.name, url: payload.url ?? undefined }, - ...updatedFromProperties(payload), - ], -}; - -export const onProjectCreated: EventSpecification> = { - name: "Project", - title: "On Project Created", - source: "linear.app", - icon: "linear", - filter: { - action: ["create"], - }, - examples: [projectCreated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [ - { label: "Project ID", text: payload.data.id }, - { label: "Project Name", text: payload.data.name, url: payload.url ?? undefined }, - ], -}; - -export const onProjectRemoved: EventSpecification> = { - name: "Project", - title: "On Project Removed", - source: "linear.app", - icon: "linear", - filter: { - action: ["remove"], - }, - examples: [projectRemoved], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [ - { label: "Project ID", text: payload.data.id }, - { label: "Project Name", text: payload.data.name, url: payload.url ?? undefined }, - ], -}; - -export const onProjectUpdated: EventSpecification> = { - name: "Project", - title: "On Project Updated", - source: "linear.app", - icon: "linear", - filter: { - action: ["update"], - }, - examples: [projectUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [ - { label: "Project ID", text: payload.data.id }, - { label: "Project Name", text: payload.data.name, url: payload.url ?? undefined }, - ...updatedFromProperties(payload), - ], -}; - -export const onProjectUpdate: EventSpecification> = { - name: "ProjectUpdate", - title: "On ProjectUpdate", - source: "linear.app", - icon: "linear", - examples: [projectUpdateCreated, projectUpdateRemoved, projectUpdateUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [ - { label: "Event action", text: payload.action }, - { label: "ProjectUpdate ID", text: payload.data.id }, - ], -}; - -export const onProjectUpdateCreated: EventSpecification< - GetLinearPayload -> = { - name: "ProjectUpdate", - title: "On ProjectUpdate Created", - source: "linear.app", - icon: "linear", - filter: { - action: ["create"], - }, - examples: [projectUpdateCreated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "ProjectUpdate ID", text: payload.data.id }], -}; - -export const onProjectUpdateRemoved: EventSpecification< - GetLinearPayload -> = { - name: "ProjectUpdate", - title: "On ProjectUpdate Removed", - source: "linear.app", - icon: "linear", - filter: { - action: ["remove"], - }, - examples: [projectUpdateRemoved], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "ProjectUpdate ID", text: payload.data.id }], -}; - -export const onProjectUpdateUpdated: EventSpecification< - GetLinearPayload -> = { - name: "ProjectUpdate", - title: "On ProjectUpdate Updated", - source: "linear.app", - icon: "linear", - filter: { - action: ["update"], - }, - examples: [projectUpdateUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "ProjectUpdate ID", text: payload.data.id }], -}; - -export const onReaction: EventSpecification> = { - name: "Reaction", - title: "On Reaction", - source: "linear.app", - icon: "linear", - examples: [reactionCreated, reactionRemoved, reactionUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [ - { label: "Event action", text: payload.action }, - { label: "Reaction ID", text: payload.data.id }, - ], -}; - -export const onReactionCreated: EventSpecification> = { - name: "Reaction", - title: "On Reaction Created", - source: "linear.app", - icon: "linear", - filter: { - action: ["create"], - }, - examples: [reactionCreated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "Reaction ID", text: payload.data.id }], -}; - -export const onReactionRemoved: EventSpecification> = { - name: "Reaction", - title: "On Reaction Removed", - source: "linear.app", - icon: "linear", - filter: { - action: ["remove"], - }, - examples: [reactionRemoved], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "Reaction ID", text: payload.data.id }], -}; - -export const onReactionUpdated: EventSpecification> = { - name: "Reaction", - title: "On Reaction Updated", - source: "linear.app", - icon: "linear", - filter: { - action: ["update"], - }, - examples: [reactionUpdated], - parsePayload: (payload) => payload as GetLinearPayload, - runProperties: (payload) => [{ label: "Reaction ID", text: payload.data.id }], -}; diff --git a/integrations/linear/src/index.ts b/integrations/linear/src/index.ts deleted file mode 100644 index 0f53f9e7a..000000000 --- a/integrations/linear/src/index.ts +++ /dev/null @@ -1,2029 +0,0 @@ -import { - ConnectionAuth, - IO, - IOTask, - IntegrationTaskKey, - Json, - Prettify, - RunTaskErrorCallback, - RunTaskOptions, - TriggerIntegration, - retry, -} from "@trigger.dev/sdk"; -import { - Attachment, - AttachmentConnection, - AttachmentPayload, - Comment, - CommentConnection, - CommentPayload, - Connection, - CreateOrJoinOrganizationResponse, - CycleArchivePayload, - CyclePayload, - DeletePayload, - Document, - DocumentConnection, - DocumentPayload, - DocumentSearchPayload, - Favorite, - FavoriteConnection, - FavoritePayload, - FrontAttachmentPayload, - Issue, - IssueArchivePayload, - IssueConnection, - IssueLabel, - IssueLabelConnection, - IssueLabelPayload, - IssuePayload, - IssuePriorityValue, - IssueRelation, - IssueRelationConnection, - IssueRelationPayload, - IssueSearchPayload, - LinearClient, - LinearDocument as L, - LinearError, - Notification, - NotificationArchivePayload, - NotificationConnection, - NotificationSubscriptionPayload, - Organization, - OrganizationInvitePayload, - Project, - ProjectArchivePayload, - ProjectConnection, - ProjectLink, - ProjectLinkConnection, - ProjectLinkPayload, - ProjectMilestonePayload, - ProjectPayload, - ProjectSearchPayload, - ProjectUpdate, - ProjectUpdateConnection, - ProjectUpdatePayload, - RatelimitedLinearError, - ReactionPayload, - RoadmapArchivePayload, - RoadmapPayload, - Team, - TeamConnection, - TeamMembership, - TeamMembershipConnection, - TeamMembershipPayload, - TeamPayload, - Template, - User, - UserConnection, - UserPayload, - WorkflowState, - WorkflowStateArchivePayload, - WorkflowStateConnection, - WorkflowStatePayload, -} from "@linear/sdk"; - -import * as events from "./events"; -import { AwaitNested, LinearReturnType, SerializedLinearOutput } from "./types"; -import { Nullable, QueryVariables, queryProperties } from "./utils"; -import { TriggerParams, Webhooks, createTrigger, createWebhookEventSource } from "./webhooks"; - -export type LinearIntegrationOptions = { - id: string; - apiKey?: string; -}; - -export type LinearRunTask = InstanceType["runTask"]; - -export class Linear implements TriggerIntegration { - private _options: LinearIntegrationOptions; - private _client?: LinearClient; - private _io?: IO; - private _connectionKey?: string; - - constructor(private options: LinearIntegrationOptions) { - if (Object.keys(options).includes("apiKey") && !options.apiKey) { - throw `Can't create Linear integration (${options.id}) as apiKey was undefined`; - } - - this._options = options; - } - - get authSource() { - return this._options.apiKey ? "LOCAL" : "HOSTED"; - } - - get id() { - return this._options.id; - } - - get metadata() { - return { id: "linear", name: "Linear" }; - } - - get source() { - return createWebhookEventSource(this); - } - - cloneForRun(io: IO, connectionKey: string, auth?: ConnectionAuth) { - const linear = new Linear(this._options); - linear._io = io; - linear._connectionKey = connectionKey; - linear._client = this.createClient(auth); - return linear; - } - - createClient(auth?: ConnectionAuth) { - if (auth) { - return new LinearClient({ - accessToken: auth.accessToken, - }); - } - - if (this._options.apiKey) { - return new LinearClient({ - apiKey: this._options.apiKey, - }); - } - - throw new Error("No auth"); - } - - runTask | void>( - key: IntegrationTaskKey, - callback: (client: LinearClient, task: IOTask, io: IO) => Promise, - options?: RunTaskOptions, - errorCallback?: RunTaskErrorCallback - ): Promise { - if (!this._io) throw new Error("No IO"); - if (!this._connectionKey) throw new Error("No connection key"); - - return this._io.runTask( - key, - (task, io) => { - if (!this._client) throw new Error("No client"); - return callback(this._client, task, io); - }, - { - icon: "linear", - retry: retry.standardBackoff, - ...(options ?? {}), - connectionKey: this._connectionKey, - }, - errorCallback ?? onError - ); - } - - async getAll< - TTask extends ( - key: IntegrationTaskKey, - params: Partial> - ) => LinearReturnType>, - >( - task: TTask, - key: IntegrationTaskKey, - params: Parameters[1] = {} - ): Promise>["nodes"]> { - const boundTask = task.bind(this as any); - - let edges = await boundTask(`${key}-0`, params); - let nodes = edges.nodes; - - for (let i = 1; edges.pageInfo.hasNextPage; i++) { - edges = await boundTask(`${key}-${i}`, { ...params, after: edges.pageInfo.endCursor }); - nodes = nodes.concat(edges.nodes); - } - - return nodes; - } - - attachment(key: IntegrationTaskKey, params: { id: string }): LinearReturnType { - return this.runTask( - key, - async (client) => { - const entity = await client.attachment(params.id); - return serializeLinearOutput(entity); - }, - { - name: "Get Attachment", - params, - properties: [{ label: "Attachment ID", text: params.id }], - } - ); - } - - attachments( - key: IntegrationTaskKey, - params: L.AttachmentsQueryVariables = {} - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const edges = await client.attachments(params); - return serializeLinearOutput(edges); - }, - { - name: "Get Attachments", - params, - properties: queryProperties(params), - } - ); - } - - createAttachment( - key: IntegrationTaskKey, - params: L.AttachmentCreateInput - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createAttachment(params); - return serializeLinearOutput(await payload.attachment); - }, - { - name: "Create Attachment", - params, - properties: [ - { label: "Issue ID", text: params.issueId }, - { label: "Title", text: params.title }, - { label: "URL", text: params.url }, - ], - } - ); - } - - deleteAttachment(key: IntegrationTaskKey, params: { id: string }): Promise { - return this.runTask(key, (client) => client.deleteAttachment(params.id), { - name: "Delete Attachment", - params, - properties: [{ label: "Attachment ID", text: params.id }], - }); - } - - updateAttachment( - key: IntegrationTaskKey, - params: { id: string; input: L.AttachmentUpdateInput } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.updateAttachment(params.id, params.input); - return serializeLinearOutput(await payload.attachment); - }, - { - name: "Update Attachment", - params, - properties: [{ label: "Attachment ID", text: params.id }], - } - ); - } - - attachmentLinkDiscord( - key: IntegrationTaskKey, - params: { - channelId: string; - issueId: string; - messageId: string; - url: string; - variables?: Omit< - L.AttachmentLinkDiscordMutationVariables, - "channelId" | "issueId" | "messageId" | "url" - >; - } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.attachmentLinkDiscord( - params.channelId, - params.issueId, - params.messageId, - params.url, - params.variables - ); - return serializeLinearOutput(await payload.attachment); - }, - { - name: "Link Discord Message", - params, - properties: [ - { label: "Issue ID", text: params.issueId }, - { label: "Channel ID", text: params.channelId }, - { label: "Message ID", text: params.messageId }, - { label: "URL", text: params.url }, - ], - } - ); - } - - attachmentLinkFront( - key: IntegrationTaskKey, - params: { - conversationId: string; - issueId: string; - variables?: Omit; - } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.attachmentLinkFront( - params.conversationId, - params.issueId, - params.variables - ); - return serializeLinearOutput(payload); - }, - { - name: "Link Front Conversation", - params, - properties: [ - { label: "Issue ID", text: params.issueId }, - { label: "Conversation ID", text: params.conversationId }, - ], - } - ); - } - - attachmentLinkIntercom( - key: IntegrationTaskKey, - params: { - conversationId: string; - issueId: string; - variables?: Omit; - } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.attachmentLinkIntercom( - params.conversationId, - params.issueId, - params.variables - ); - return serializeLinearOutput(await payload.attachment); - }, - { - name: "Link Intercom Conversation", - params, - properties: [ - { label: "Issue ID", text: params.issueId }, - { label: "Conversation ID", text: params.conversationId }, - ], - } - ); - } - - attachmentLinkJiraIssue( - key: IntegrationTaskKey, - params: { - issueId: string; - jiraIssueId: string; - } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.attachmentLinkJiraIssue(params.issueId, params.jiraIssueId); - return serializeLinearOutput(await payload.attachment); - }, - { - name: "Link Jira Issue", - params, - properties: [ - { label: "Issue ID", text: params.issueId }, - { label: "Jira Issue ID", text: params.jiraIssueId }, - ], - } - ); - } - - attachmentLinkSlack( - key: IntegrationTaskKey, - params: { - channel: string; - issueId: string; - latest: string; - url: string; - variables?: Omit< - L.AttachmentLinkSlackMutationVariables, - "channel" | "issueId" | "latest" | "url" - >; - } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.attachmentLinkSlack( - params.channel, - params.issueId, - params.latest, - params.url, - params.variables - ); - return serializeLinearOutput(await payload.attachment); - }, - { - name: "Link Slack Message", - params, - properties: [ - { label: "Issue ID", text: params.issueId }, - { label: "Channel", text: params.channel }, - { label: "Latest", text: params.latest }, - { label: "URL", text: params.url }, - ], - } - ); - } - - attachmentLinkURL( - key: IntegrationTaskKey, - params: { - issueId: string; - url: string; - variables?: Omit; - } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.attachmentLinkURL( - params.issueId, - params.url, - params.variables - ); - return serializeLinearOutput(await payload.attachment); - }, - { - name: "Link URL", - params, - properties: [ - { label: "Issue ID", text: params.issueId }, - { label: "URL", text: params.url }, - ], - } - ); - } - - attachmentLinkZendesk( - key: IntegrationTaskKey, - params: { - issueId: string; - ticketId: string; - variables?: Omit; - } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.attachmentLinkZendesk( - params.issueId, - params.ticketId, - params.variables - ); - return serializeLinearOutput(await payload.attachment); - }, - { - name: "Link Zendesk Ticket", - params, - properties: [ - { label: "Issue ID", text: params.issueId }, - { label: "Ticket ID", text: params.ticketId }, - ], - } - ); - } - - comment(key: IntegrationTaskKey, params: { id: string }): LinearReturnType { - return this.runTask( - key, - async (client) => { - const entity = await client.comment(params.id); - return serializeLinearOutput(entity); - }, - { - name: "Get Comment", - params, - properties: [{ label: "Comment ID", text: params.id }], - } - ); - } - - comments( - key: IntegrationTaskKey, - params: L.CommentsQueryVariables = {} - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const edges = await client.comments(params); - return serializeLinearOutput(edges); - }, - { - name: "Get Comments", - params, - properties: queryProperties(params), - } - ); - } - - createComment( - key: IntegrationTaskKey, - params: L.CommentCreateInput - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createComment(params); - return serializeLinearOutput(await payload.comment); - }, - { - name: "Create Comment", - params, - properties: [ - { label: "Issue ID", text: params.issueId }, - { label: "Body", text: params.body ?? "" }, - ], - } - ); - } - - deleteComment(key: IntegrationTaskKey, params: { id: string }): Promise { - return this.runTask(key, (client) => client.deleteComment(params.id), { - name: "Delete Comment", - params, - properties: [{ label: "Comment ID", text: params.id }], - }); - } - - updateComment( - key: IntegrationTaskKey, - params: { id: string; input: L.CommentUpdateInput } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.updateComment(params.id, params.input); - return serializeLinearOutput(await payload.comment); - }, - { - name: "Update Comment", - params, - properties: [{ label: "Comment ID", text: params.id }], - } - ); - } - - archiveCycle( - key: IntegrationTaskKey, - params: { id: string } - ): LinearReturnType> { - return this.runTask( - key, - async (client) => { - const payload = await client.archiveCycle(params.id); - return serializeLinearOutput({ - ...payload, - entity: await payload.entity, - }); - }, - { - name: "Archive Cycle", - params, - properties: [{ label: "Cycle ID", text: params.id }], - } - ); - } - - createCycle( - key: IntegrationTaskKey, - params: L.CycleCreateInput - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createCycle(params); - return serializeLinearOutput(await payload.cycle); - }, - { - name: "Create Cycle", - params, - properties: [ - { label: "Team ID", text: params.teamId }, - { label: "Start at", text: params.startsAt.toISOString() }, - { label: "Ends at", text: params.endsAt.toISOString() }, - ], - } - ); - } - - // deleteCycle() does not exist - - updateCycle( - key: IntegrationTaskKey, - params: { id: string; input: L.CycleUpdateInput } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.updateCycle(params.id, params.input); - return serializeLinearOutput(await payload.cycle); - }, - { - name: "Update Cycle", - params, - properties: [{ label: "Cycle ID", text: params.id }], - } - ); - } - - document(key: IntegrationTaskKey, params: { id: string }): LinearReturnType { - return this.runTask( - key, - async (client) => { - const entity = await client.document(params.id); - return serializeLinearOutput(entity); - }, - { - name: "Get Document", - params, - properties: [{ label: "Document ID", text: params.id }], - } - ); - } - - documents( - key: IntegrationTaskKey, - params: L.DocumentsQueryVariables - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const edges = await client.documents(params); - return serializeLinearOutput(edges); - }, - { - name: "Get Documents", - params, - properties: queryProperties(params), - } - ); - } - - createDocument( - key: IntegrationTaskKey, - params: L.DocumentCreateInput - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createDocument(params); - return serializeLinearOutput(await payload.document); - }, - { - name: "Create Document", - params, - properties: [ - { label: "Project ID", text: params.projectId }, - { label: "Title", text: params.title }, - ], - } - ); - } - - searchDocuments( - key: IntegrationTaskKey, - params: { - term: string; - variables?: Parameters[1]; - } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.searchDocuments(params.term, params.variables); - return serializeLinearOutput(payload); - }, - { - name: "Search Documents", - params, - properties: [{ label: "Search Term", text: params.term }], - } - ); - } - - favorite(key: IntegrationTaskKey, params: { id: string }): LinearReturnType { - return this.runTask( - key, - async (client) => { - const entity = await client.favorite(params.id); - return serializeLinearOutput(entity); - }, - { - name: "Get Favorite", - params, - properties: [{ label: "Favorite ID", text: params.id }], - } - ); - } - - favorites( - key: IntegrationTaskKey, - params: L.FavoritesQueryVariables = {} - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const edges = await client.favorites(params); - return serializeLinearOutput(edges); - }, - { - name: "Get Favorites", - params, - properties: queryProperties(params), - } - ); - } - - createFavorite( - key: IntegrationTaskKey, - params: L.FavoriteCreateInput - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createFavorite(params); - return serializeLinearOutput(await payload.favorite); - }, - { - name: "Create Favorite", - params, - } - ); - } - - issue(key: IntegrationTaskKey, params: { id: string }): LinearReturnType { - return this.runTask( - key, - async (client) => { - const entity = await client.issue(params.id); - return serializeLinearOutput(entity); - }, - { - name: "Get Issue", - params, - properties: [{ label: "Issue ID", text: params.id }], - } - ); - } - - issues( - key: IntegrationTaskKey, - params: L.IssuesQueryVariables = {} - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const edges = await client.issues(params); - return serializeLinearOutput(edges); - }, - { - name: "Get Issues", - params, - properties: queryProperties(params), - } - ); - } - - archiveIssue( - key: IntegrationTaskKey, - params: { - id: string; - variables?: Omit; - } - ): LinearReturnType> { - return this.runTask( - key, - async (client) => { - const payload = await client.archiveIssue(params.id, params.variables); - return serializeLinearOutput({ - ...payload, - entity: await payload.entity, - }); - }, - { - name: "Archive Issue", - params, - properties: [{ label: "Issue ID", text: params.id }], - } - ); - } - - createIssue( - key: IntegrationTaskKey, - params: L.IssueCreateInput & { title: string } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createIssue(params); - return serializeLinearOutput(await payload.issue); - }, - { - name: "Create Issue", - params, - properties: [ - { label: "Team ID", text: params.teamId }, - { label: "Title", text: params.title }, - ], - } - ); - } - - deleteIssue( - key: IntegrationTaskKey, - params: { id: string } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.deleteIssue(params.id); - return serializeLinearOutput(await payload.entity); - }, - { - name: "Delete Issue", - params, - properties: [{ label: "Issue ID", text: params.id }], - } - ); - } - - searchIssues( - key: IntegrationTaskKey, - params: { - term: string; - variables?: Parameters[1]; - } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.searchIssues(params.term, params.variables); - return serializeLinearOutput(payload); - }, - { - name: "Search Issues", - params, - properties: [{ label: "Search Term", text: params.term }], - } - ); - } - - updateIssue( - key: IntegrationTaskKey, - params: { id: string; input: L.IssueUpdateInput } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.updateIssue(params.id, params.input); - return serializeLinearOutput(await payload.issue); - }, - { - name: "Update Issue", - params, - properties: [{ label: "Issue ID", text: params.id }], - } - ); - } - - issueLabel(key: IntegrationTaskKey, params: { id: string }): LinearReturnType { - return this.runTask( - key, - async (client) => { - const entity = await client.issueLabel(params.id); - return serializeLinearOutput(entity); - }, - { - name: "Get IssueLabel", - params, - properties: [{ label: "IssueLabel ID", text: params.id }], - } - ); - } - - issueLabels( - key: IntegrationTaskKey, - params: L.IssueLabelsQueryVariables = {} - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const edges = await client.issueLabels(params); - return serializeLinearOutput(edges); - }, - { - name: "Get IssueLabels", - params, - properties: queryProperties(params), - } - ); - } - - createIssueLabel( - key: IntegrationTaskKey, - params: L.IssueLabelCreateInput - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createIssueLabel(params); - return serializeLinearOutput(await payload.issueLabel); - }, - { - name: "Create IssueLabel", - params, - properties: [{ label: "Label name", text: params.name }], - } - ); - } - - deleteIssueLabel(key: IntegrationTaskKey, params: { id: string }): Promise { - return this.runTask(key, (client) => client.deleteIssueLabel(params.id), { - name: "Delete IssueLabel", - params, - properties: [{ label: "Label ID", text: params.id }], - }); - } - - updateIssueLabel( - key: IntegrationTaskKey, - params: { id: string; input: L.IssueLabelUpdateInput } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.updateIssueLabel(params.id, params.input); - return serializeLinearOutput(await payload.issueLabel); - }, - { - name: "Update IssueLabel", - params, - properties: [{ label: "Label ID", text: params.id }], - } - ); - } - - issuePriorityValues(key: IntegrationTaskKey): LinearReturnType { - return this.runTask( - key, - async (client) => { - const entity = await client.issuePriorityValues; - return serializeLinearOutput(entity); - }, - { - name: "Get Issue Priority Values", - } - ); - } - - issueRelation(key: IntegrationTaskKey, params: { id: string }): LinearReturnType { - return this.runTask( - key, - async (client) => { - const entity = await client.issueRelation(params.id); - return serializeLinearOutput(entity); - }, - { - name: "Get IssueRelation", - params, - properties: [{ label: "IssueRelation ID", text: params.id }], - } - ); - } - - issueRelations( - key: IntegrationTaskKey, - params: L.IssueRelationsQueryVariables = {} - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const edges = await client.issueRelations(params); - return serializeLinearOutput(edges); - }, - { - name: "Get IssueRelations", - params, - properties: queryProperties(params), - } - ); - } - - createIssueRelation( - key: IntegrationTaskKey, - params: L.IssueRelationCreateInput - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createIssueRelation(params); - return serializeLinearOutput(await payload.issueRelation); - }, - { - name: "Create IssueRelation", - params, - properties: [ - { label: "Issue ID", text: params.issueId }, - { label: "Related Issue ID", text: params.relatedIssueId }, - { label: "Relation Type", text: params.type }, - ], - } - ); - } - - notification(key: IntegrationTaskKey, params: { id: string }): LinearReturnType { - return this.runTask( - key, - async (client) => { - const entity = await client.notification(params.id); - return serializeLinearOutput(entity); - }, - { - name: "Get Notification", - params, - properties: [{ label: "Notification ID", text: params.id }], - } - ); - } - - notifications( - key: IntegrationTaskKey, - params: L.NotificationsQueryVariables = {} - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const edges = await client.notifications(params); - return serializeLinearOutput(edges); - }, - { - name: "Get Notifications", - params, - properties: queryProperties(params), - } - ); - } - - archiveNotification( - key: IntegrationTaskKey, - params: { id: string } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.archiveNotification(params.id); - return serializeLinearOutput(payload); - }, - { - name: "Archive Notification", - params, - properties: [{ label: "Notification ID", text: params.id }], - } - ); - } - - createNotificationSubscription( - key: IntegrationTaskKey, - params: { - input: L.NotificationSubscriptionCreateInput; - } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createNotificationSubscription(params.input); - return serializeLinearOutput(payload); - }, - { - name: "Create Notification Subscription", - params, - } - ); - } - - organization(key: IntegrationTaskKey): LinearReturnType { - return this.runTask( - key, - async (client) => { - const entity = await client.organization; - return serializeLinearOutput(entity); - }, - { - name: "Get Viewer's Organization", - } - ); - } - - createOrganizationFromOnboarding( - key: IntegrationTaskKey, - params: { - input: L.CreateOrganizationInput; - variables?: Omit; - } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createOrganizationFromOnboarding( - params.input, - params.variables - ); - return serializeLinearOutput(await payload.organization); - }, - { - name: "Create Organization", - params, - properties: [ - { label: "Name", text: params.input.name }, - { label: "URL Key", text: params.input.urlKey }, - ], - } - ); - } - - /** WARNING: Causes internal server errors on Linear's side, regardless of input. */ - createOrganizationInvite( - key: IntegrationTaskKey, - params: { - input: L.OrganizationInviteCreateInput; - } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createOrganizationInvite(params.input); - return serializeLinearOutput(await payload.organizationInvite); - }, - { - name: "Create Organization Invite", - params, - properties: [{ label: "Invitee Email", text: params.input.email }], - } - ); - } - - project(key: IntegrationTaskKey, params: { id: string }): LinearReturnType { - return this.runTask( - key, - async (client) => { - const entity = await client.project(params.id); - return serializeLinearOutput(entity); - }, - { - name: "Get Project", - params, - properties: [{ label: "Project ID", text: params.id }], - } - ); - } - - projects( - key: IntegrationTaskKey, - params: L.ProjectsQueryVariables = {} - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const edges = await client.projects(params); - return serializeLinearOutput(edges); - }, - { - name: "Get Projects", - params, - properties: queryProperties(params), - } - ); - } - - archiveProject( - key: IntegrationTaskKey, - params: { - id: string; - variables?: Omit; - } - ): LinearReturnType> { - return this.runTask( - key, - async (client) => { - const payload = await client.archiveProject(params.id, params.variables); - return serializeLinearOutput({ - ...payload, - entity: await payload.entity, - }); - }, - { - name: "Archive Project", - params, - properties: [{ label: "Project ID", text: params.id }], - } - ); - } - - createProject( - key: IntegrationTaskKey, - params: L.ProjectCreateInput - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createProject(params); - return serializeLinearOutput(await payload.project); - }, - { - name: "Create Project", - params, - properties: [ - { label: "Team IDs", text: params.teamIds.join(", ") }, - { label: "Project name", text: params.name }, - ], - } - ); - } - - deleteProject( - key: IntegrationTaskKey, - params: { id: string } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.deleteProject(params.id); - return serializeLinearOutput(await payload.entity); - }, - { - name: "Delete Project", - params, - properties: [{ label: "Project ID", text: params.id }], - } - ); - } - - searchProjects( - key: IntegrationTaskKey, - params: { - term: string; - variables?: Parameters[1]; - } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.searchProjects(params.term, params.variables); - return serializeLinearOutput(payload); - }, - { - name: "Search Projects", - params, - properties: [{ label: "Search Term", text: params.term }], - } - ); - } - - updateProject( - key: IntegrationTaskKey, - params: { id: string; input: L.ProjectUpdateInput } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.updateProject(params.id, params.input); - return serializeLinearOutput(await payload.project); - }, - { - name: "Update Project", - params, - properties: [{ label: "Project ID", text: params.id }], - } - ); - } - - projectLink(key: IntegrationTaskKey, params: { id: string }): LinearReturnType { - return this.runTask( - key, - async (client) => { - const entity = await client.projectLink(params.id); - return serializeLinearOutput(entity); - }, - { - name: "Get ProjectLink", - params, - properties: [{ label: "ProjectLink ID", text: params.id }], - } - ); - } - - projectLinks( - key: IntegrationTaskKey, - params: L.ProjectLinksQueryVariables = {} - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const edges = await client.projectLinks(params); - return serializeLinearOutput(edges); - }, - { - name: "Get ProjectLinks", - params, - properties: queryProperties(params), - } - ); - } - - createProjectLink( - key: IntegrationTaskKey, - params: L.ProjectLinkCreateInput - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createProjectLink(params); - return serializeLinearOutput(await payload.projectLink); - }, - { - name: "Create ProjectLink", - params, - properties: [ - { label: "Project ID", text: params.projectId }, - { label: "Link Label", text: params.label }, - { label: "Link URL", text: params.url }, - ], - } - ); - } - - createProjectMilestone( - key: IntegrationTaskKey, - params: L.ProjectMilestoneCreateInput - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createProjectMilestone(params); - return serializeLinearOutput(await payload.projectMilestone); - }, - { - name: "Create ProjectMilestone", - params, - properties: [ - { label: "Project ID", text: params.projectId }, - { label: "Milestone Name", text: params.name }, - ], - } - ); - } - - projectUpdate(key: IntegrationTaskKey, params: { id: string }): LinearReturnType { - return this.runTask( - key, - async (client) => { - const entity = await client.projectUpdate(params.id); - return serializeLinearOutput(entity); - }, - { - name: "Get ProjectUpdate", - params, - properties: [{ label: "ProjectUpdate ID", text: params.id }], - } - ); - } - - projectUpdates( - key: IntegrationTaskKey, - params: L.ProjectUpdatesQueryVariables = {} - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const edges = await client.projectUpdates(params); - return serializeLinearOutput(edges); - }, - { - name: "Get ProjectUpdates", - params, - properties: queryProperties(params), - } - ); - } - - createProjectUpdate( - key: IntegrationTaskKey, - params: L.ProjectUpdateCreateInput - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createProjectUpdate(params); - return serializeLinearOutput(await payload.projectUpdate); - }, - { - name: "Create ProjectUpdate", - params, - properties: [{ label: "Project ID", text: params.projectId }], - } - ); - } - - deleteProjectUpdate(key: IntegrationTaskKey, params: { id: string }): Promise { - return this.runTask(key, (client) => client.deleteProjectUpdate(params.id), { - name: "Delete ProjectUpdate", - params, - properties: [{ label: "ProjectUpdate ID", text: params.id }], - }); - } - - updateProjectUpdate( - key: IntegrationTaskKey, - params: { id: string; input: L.ProjectUpdateUpdateInput } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.updateProjectUpdate(params.id, params.input); - return serializeLinearOutput(await payload.projectUpdate); - }, - { - name: "Update ProjectUpdate", - params, - properties: [{ label: "ProjectUpdate ID", text: params.id }], - } - ); - } - - createReaction( - key: IntegrationTaskKey, - params: L.ReactionCreateInput & { emoji: string } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createReaction(params); - return serializeLinearOutput(await payload.reaction); - }, - { - name: "Create Reaction", - params, - properties: [ - ...(params.commentId ? [{ label: "Comment ID", text: params.commentId }] : []), - ...(params.issueId ? [{ label: "Issue ID", text: params.issueId }] : []), - ...(params.projectUpdateId - ? [{ label: "ProjectUpdate ID", text: params.projectUpdateId }] - : []), - { label: "Emoji", text: params.emoji }, - ], - } - ); - } - - deleteReaction(key: IntegrationTaskKey, params: { id: string }): Promise { - return this.runTask(key, (client) => client.deleteReaction(params.id), { - name: "Delete Reaction", - params, - properties: [{ label: "Reaction ID", text: params.id }], - }); - } - - archiveRoadmap( - key: IntegrationTaskKey, - params: { id: string } - ): LinearReturnType> { - return this.runTask( - key, - async (client) => { - const payload = await client.archiveRoadmap(params.id); - return serializeLinearOutput({ - ...payload, - entity: await payload.entity, - }); - }, - { - name: "Archive Roadmap", - params, - properties: [{ label: "Roadmap ID", text: params.id }], - } - ); - } - - createRoadmap( - key: IntegrationTaskKey, - params: L.RoadmapCreateInput - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createRoadmap(params); - return serializeLinearOutput(await payload.roadmap); - }, - { - name: "Create Roadmap", - params, - properties: [{ label: "Roadmap Name", text: params.name }], - } - ); - } - - team(key: IntegrationTaskKey, params: { id: string }): LinearReturnType { - return this.runTask( - key, - async (client) => { - const entity = await client.team(params.id); - return serializeLinearOutput(entity); - }, - { - name: "Get Team", - params, - properties: [{ label: "Team ID", text: params.id }], - } - ); - } - - teams( - key: IntegrationTaskKey, - params: L.TeamsQueryVariables = {} - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const edges = await client.teams(params); - return serializeLinearOutput(edges); - }, - { - name: "Get Teams", - params, - properties: queryProperties(params), - } - ); - } - - createTeam( - key: IntegrationTaskKey, - params: L.TeamCreateInput - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createTeam(params); - return serializeLinearOutput(await payload.team); - }, - { - name: "Create Team", - params, - properties: [{ label: "Team Name", text: params.name }], - } - ); - } - - teamMembership( - key: IntegrationTaskKey, - params: { id: string } - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const entity = await client.teamMembership(params.id); - return serializeLinearOutput(entity); - }, - { - name: "Get TeamMembership", - params, - properties: [{ label: "TeamMembership ID", text: params.id }], - } - ); - } - - teamMemberships( - key: IntegrationTaskKey, - params: L.TeamMembershipsQueryVariables = {} - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const edges = await client.teamMemberships(params); - return serializeLinearOutput(edges); - }, - { - name: "Get TeamMemberships", - params, - properties: queryProperties(params), - } - ); - } - - createTeamMembership( - key: IntegrationTaskKey, - params: L.TeamMembershipCreateInput - ): LinearReturnType { - return this.runTask( - key, - async (client) => { - const payload = await client.createTeamMembership(params); - return serializeLinearOutput(await payload.teamMembership); - }, - { - name: "Create TeamMembership", - params, - properties: [ - { label: "Team ID", text: params.teamId }, - { label: "User ID", text: params.userId }, - ], - } - ); - } - - template(key: IntegrationTaskKey, params: { id: string }): LinearReturnType