Move prisma to an internal database package
This commit is contained in:
@@ -1 +1,2 @@
|
||||
link-workspace-packages=false
|
||||
link-workspace-packages=false
|
||||
public-hoist-pattern[]=*prisma*
|
||||
@@ -1,4 +1,4 @@
|
||||
import { JobRunStatus } from ".prisma/client";
|
||||
import type { JobRunStatus } from "@trigger.dev/database";
|
||||
import {
|
||||
CheckCircleIcon,
|
||||
ClockIcon,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PrismaClient, Prisma } from ".prisma/client";
|
||||
import { PrismaClient, Prisma } from "@trigger.dev/database";
|
||||
import invariant from "tiny-invariant";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -96,7 +96,7 @@ function getClient() {
|
||||
}
|
||||
|
||||
export { prisma };
|
||||
export type { PrismaClient } from ".prisma/client";
|
||||
export type { PrismaClient } from "@trigger.dev/database";
|
||||
|
||||
export const PrismaErrorSchema = z.object({
|
||||
code: z.string(),
|
||||
|
||||
@@ -2,4 +2,4 @@ export type {
|
||||
ApiConnectionType,
|
||||
ApiConnectionClient,
|
||||
ApiConnection,
|
||||
} from ".prisma/client";
|
||||
} from "@trigger.dev/database";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { prisma } from "~/db.server";
|
||||
export type { Job, JobRunStatus } from ".prisma/client";
|
||||
export type { Job, JobRunStatus } from "@trigger.dev/database";
|
||||
|
||||
export function findJobByParams({
|
||||
userId,
|
||||
|
||||
@@ -4,15 +4,14 @@ import type {
|
||||
Project,
|
||||
RuntimeEnvironment,
|
||||
User,
|
||||
} from ".prisma/client";
|
||||
} from "@trigger.dev/database";
|
||||
import { customAlphabet } from "nanoid";
|
||||
import slug from "slug";
|
||||
import { prisma, PrismaClientOrTransaction } from "~/db.server";
|
||||
import { workerQueue } from "~/services/worker.server";
|
||||
import { generateTwoRandomWords } from "~/utils/randomWords";
|
||||
import { createProject } from "./project.server";
|
||||
|
||||
export type { Organization } from ".prisma/client";
|
||||
export type { Organization };
|
||||
|
||||
const nanoid = customAlphabet("1234567890abcdef", 4);
|
||||
const apiKeyId = customAlphabet(
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { nanoid } from "nanoid";
|
||||
import slug from "slug";
|
||||
import { prisma } from "~/db.server";
|
||||
import type { Project } from ".prisma/client";
|
||||
import type { Project } from "@trigger.dev/database";
|
||||
import { Organization, createEnvironment } from "./organization.server";
|
||||
export type { Project } from ".prisma/client";
|
||||
export type { Project } from "@trigger.dev/database";
|
||||
|
||||
export async function createProject(
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { RunConnection } from ".prisma/client";
|
||||
import type { RunConnection } from "@trigger.dev/database";
|
||||
import type { ConnectionAuth } from "@trigger.dev/internal";
|
||||
import type { ApiConnectionWithSecretReference } from "~/services/externalApis/apiAuthenticationRepository.server";
|
||||
import { apiAuthenticationRepository } from "~/services/externalApis/apiAuthenticationRepository.server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { RuntimeEnvironment } from ".prisma/client";
|
||||
import type { RuntimeEnvironment } from "@trigger.dev/database";
|
||||
import { prisma } from "~/db.server";
|
||||
|
||||
export type { RuntimeEnvironment };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Task, TaskAttempt } from ".prisma/client";
|
||||
import type { Task, TaskAttempt } from "@trigger.dev/database";
|
||||
import { ServerTask } from "@trigger.dev/internal";
|
||||
|
||||
export type TaskWithAttempts = Task & { attempts: TaskAttempt[] };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Prisma, User } from ".prisma/client";
|
||||
import type { Prisma, User } from "@trigger.dev/database";
|
||||
import type { GitHubProfile } from "remix-auth-github";
|
||||
import { prisma } from "~/db.server";
|
||||
export type { User } from ".prisma/client";
|
||||
export type { User } from "@trigger.dev/database";
|
||||
|
||||
type FindOrCreateMagicLink = {
|
||||
authenticationMethod: "MAGIC_LINK";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { User } from ".prisma/client";
|
||||
import { User } from "@trigger.dev/database";
|
||||
import { PrismaClient, prisma } from "~/db.server";
|
||||
import { env } from "~/env.server";
|
||||
import { Organization } from "~/models/organization.server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { User } from ".prisma/client";
|
||||
import { User } from "@trigger.dev/database";
|
||||
import { PrismaClient, prisma } from "~/db.server";
|
||||
import { Organization } from "~/models/organization.server";
|
||||
import { Project } from "~/models/project.server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { User } from ".prisma/client";
|
||||
import { User } from "@trigger.dev/database";
|
||||
import { PrismaClient, prisma } from "~/db.server";
|
||||
import { env } from "~/env.server";
|
||||
import { Organization } from "~/models/organization.server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { User } from ".prisma/client";
|
||||
import { User } from "@trigger.dev/database";
|
||||
import { PrismaClient, prisma } from "~/db.server";
|
||||
import { env } from "~/env.server";
|
||||
import { Organization } from "~/models/organization.server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { User } from ".prisma/client";
|
||||
import { User } from "@trigger.dev/database";
|
||||
import { PrismaClient, prisma } from "~/db.server";
|
||||
import { env } from "~/env.server";
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { User } from ".prisma/client";
|
||||
import { User } from "@trigger.dev/database";
|
||||
import { PrismaClient, prisma } from "~/db.server";
|
||||
import { env } from "~/env.server";
|
||||
import { Job } from "~/models/job.server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Organization, RuntimeEnvironment } from ".prisma/client";
|
||||
import type { Organization, RuntimeEnvironment } from "@trigger.dev/database";
|
||||
import type { ActionArgs } from "@remix-run/server-runtime";
|
||||
import { json } from "@remix-run/server-runtime";
|
||||
import type { LogMessage } from "@trigger.dev/internal";
|
||||
|
||||
@@ -2,7 +2,7 @@ import { $transaction, PrismaClient } from "~/db.server";
|
||||
import { prisma } from "~/db.server";
|
||||
import { EndpointApi } from "../endpointApi";
|
||||
import { workerQueue } from "../worker.server";
|
||||
import type { EndpointIndexSource } from ".prisma/client";
|
||||
import type { EndpointIndexSource } from "@trigger.dev/database";
|
||||
|
||||
export class IndexEndpointService {
|
||||
#prismaClient: PrismaClient;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { EventDispatcher, EventRecord } from ".prisma/client";
|
||||
import type { EventDispatcher, EventRecord } from "@trigger.dev/database";
|
||||
import type { EventFilter } from "@trigger.dev/internal";
|
||||
import { EventFilterSchema } from "@trigger.dev/internal";
|
||||
import { $transaction, PrismaClientOrTransaction, prisma } from "~/db.server";
|
||||
|
||||
@@ -4,7 +4,7 @@ import type {
|
||||
ApiConnectionClient,
|
||||
SecretReference,
|
||||
ExternalAccount,
|
||||
} from ".prisma/client";
|
||||
} from "@trigger.dev/database";
|
||||
import jsonpointer from "jsonpointer";
|
||||
import { customAlphabet } from "nanoid";
|
||||
import * as crypto from "node:crypto";
|
||||
|
||||
@@ -4,7 +4,7 @@ import type {
|
||||
JobIntegration,
|
||||
JobVersion,
|
||||
ApiConnectionClient,
|
||||
} from ".prisma/client";
|
||||
} from "@trigger.dev/database";
|
||||
import {
|
||||
IntegrationConfig,
|
||||
JobMetadata,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Job, JobVersion } from ".prisma/client";
|
||||
import type { Job, JobVersion } from "@trigger.dev/database";
|
||||
import { $transaction, PrismaClientOrTransaction } from "~/db.server";
|
||||
import { prisma } from "~/db.server";
|
||||
import { workerQueue } from "~/services/worker.server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Task } from ".prisma/client";
|
||||
import type { Task } from "@trigger.dev/database";
|
||||
import {
|
||||
ApiEventLogSchema,
|
||||
CachedTaskSchema,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ApiConnection, ApiConnectionType } from ".prisma/client";
|
||||
import type { ApiConnection, ApiConnectionType } from "@trigger.dev/database";
|
||||
import type { PrismaClient, PrismaClientOrTransaction } from "~/db.server";
|
||||
import { prisma } from "~/db.server";
|
||||
import { workerQueue } from "../worker.server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { EventDispatcher } from ".prisma/client";
|
||||
import type { EventDispatcher } from "@trigger.dev/database";
|
||||
import {
|
||||
CronMetadata,
|
||||
IntervalMetadata,
|
||||
|
||||
@@ -4,7 +4,7 @@ import type {
|
||||
TriggerSource,
|
||||
SecretReference,
|
||||
TriggerSourceEvent,
|
||||
} from ".prisma/client";
|
||||
} from "@trigger.dev/database";
|
||||
import type { AuthenticatedEnvironment } from "../apiAuth.server";
|
||||
import { env } from "~/env.server";
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Endpoint } from ".prisma/client";
|
||||
import type { Endpoint } from "@trigger.dev/database";
|
||||
import type { SourceMetadata } from "@trigger.dev/internal";
|
||||
import { $transaction, PrismaClientOrTransaction } from "~/db.server";
|
||||
import { prisma } from "~/db.server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { RuntimeEnvironment } from ".prisma/client";
|
||||
import type { RuntimeEnvironment } from "@trigger.dev/database";
|
||||
import type {
|
||||
TriggerSource,
|
||||
UpdateTriggerSourceBody,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ApiConnectionClient } from ".prisma/client";
|
||||
import { ApiConnectionClient } from "@trigger.dev/database";
|
||||
import { Job } from "~/models/job.server";
|
||||
import type { Organization } from "~/models/organization.server";
|
||||
import type { Project } from "~/models/project.server";
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
"test:e2e:run": "cross-env PORT=8811 start-server-and-test start:mocks http://localhost:8811 \"npx cypress run\"",
|
||||
"test:e2e:ci": "pnpx cypress run",
|
||||
"typecheck": "tsc -b && tsc -b cypress",
|
||||
"generate": "prisma generate",
|
||||
"db:migrate:deploy": "prisma migrate deploy",
|
||||
"db:migrate:dev": "prisma migrate dev",
|
||||
"db:seed": "ts-node prisma/seed.ts",
|
||||
"generate:sourcemaps": "remix build --sourcemap",
|
||||
"sentry-upload": "pnpm run generate:sourcemaps && sentry-upload-sourcemaps",
|
||||
@@ -57,7 +54,6 @@
|
||||
"@lezer/highlight": "^1.1.2",
|
||||
"@octokit/webhooks": "^10.4.0",
|
||||
"@octokit/webhooks-methods": "^3.0.2",
|
||||
"@prisma/client": "^4.13.0",
|
||||
"@radix-ui/react-alert-dialog": "^1.0.4",
|
||||
"@radix-ui/react-dialog": "^1.0.3",
|
||||
"@radix-ui/react-label": "^2.0.1",
|
||||
@@ -74,6 +70,7 @@
|
||||
"@tanstack/react-table": "^8.0.0-alpha.87",
|
||||
"@trigger.dev/companyicons": "^1.5.3",
|
||||
"@trigger.dev/internal": "workspace:*",
|
||||
"@trigger.dev/database": "workspace:*",
|
||||
"@typeform/embed-react": "^2.14.1",
|
||||
"@types/simple-oauth2": "^5.0.4",
|
||||
"@uiw/react-codemirror": "^4.19.5",
|
||||
@@ -115,7 +112,6 @@
|
||||
"pretty-bytes": "^6.0.0",
|
||||
"prism-react-renderer": "^1.3.5",
|
||||
"prismjs": "^1.29.0",
|
||||
"pulsar-client": "1.7.0",
|
||||
"qs": "^6.11.0",
|
||||
"react": "^18.2.0",
|
||||
"react-date-range": "^1.4.0",
|
||||
@@ -220,7 +216,6 @@
|
||||
"postcss": "^8.4.21",
|
||||
"prettier": "^2.6.2",
|
||||
"prettier-plugin-tailwindcss": "^0.1.13",
|
||||
"prisma": "^4.13.0",
|
||||
"prop-types": "^15.8.1",
|
||||
"react-date-range": "^1.4.0",
|
||||
"rimraf": "^3.0.2",
|
||||
@@ -240,4 +235,4 @@
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable turbo/no-undeclared-env-vars */
|
||||
import { PrismaClient } from ".prisma/client";
|
||||
import { PrismaClient } from "@trigger.dev/database";
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
"@/*": ["./*"],
|
||||
"@trigger.dev/internal": ["../../packages/internal/src/index"],
|
||||
"@trigger.dev/internal/*": ["../../packages/internal/src/*"],
|
||||
"@trigger.dev/database": ["../../packages/database/src/index"],
|
||||
"@trigger.dev/database/*": ["../../packages/database/src/*"],
|
||||
"emails": ["../../packages/emails/src/index"],
|
||||
"emails/*": ["../../packages/emails/src/*"]
|
||||
},
|
||||
|
||||
@@ -316,9 +316,11 @@ new Job(client, {
|
||||
}),
|
||||
run: async (payload, io, ctx) => {
|
||||
await io.wait("wait", 5); // wait for 5 seconds
|
||||
|
||||
await io.logger.info("This is a log info message", {
|
||||
payload,
|
||||
});
|
||||
|
||||
await io.sendEvent("send-event", {
|
||||
name: "custom.event",
|
||||
payload,
|
||||
|
||||
@@ -44,7 +44,7 @@ export const createIssue: GithubAuthenticatedTask<
|
||||
OctokitClient["rest"]["issues"]["create"]
|
||||
> = {
|
||||
onError,
|
||||
run: async (params, client, task) => {
|
||||
run: async (params, client, task, io) => {
|
||||
const [owner, repo] = params.repo.split("/");
|
||||
|
||||
return client.rest.issues
|
||||
|
||||
+4
-8
@@ -14,14 +14,10 @@
|
||||
"scripts": {
|
||||
"build": "turbo run build",
|
||||
"build:force": "turbo run build --force",
|
||||
"db:migrate:deploy": "turbo run db:migrate:deploy",
|
||||
"db:migrate:dev": "turbo run db:migrate:dev",
|
||||
"db:push": "turbo run db:push",
|
||||
"db:seed": "turbo run db:seed --no-cache",
|
||||
"i-db:seed": "infisical run -- turbo run db:seed --no-cache",
|
||||
"db:migrate:force": "turbo run db:migrate:force --no-cache",
|
||||
"db:migrate": "turbo run db:push db:generate",
|
||||
"db:seed": "turbo run db:seed",
|
||||
"dev": "turbo run dev --parallel",
|
||||
"i-dev": "infisical run -- turbo run dev --parallel",
|
||||
"i:dev": "infisical run -- turbo run dev --parallel",
|
||||
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
|
||||
"generate": "turbo run generate",
|
||||
"lint": "turbo run lint",
|
||||
@@ -57,7 +53,7 @@
|
||||
"prettier": "^2.5.1",
|
||||
"tailwindcss": "3.1.8",
|
||||
"tsx": "^3.7.1",
|
||||
"turbo": "^1.5.5",
|
||||
"turbo": "^1.10.3",
|
||||
"vite": "^4.1.1",
|
||||
"vite-tsconfig-paths": "^4.0.5",
|
||||
"vitest": "^0.28.4"
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
# Keep environment variables out of version control
|
||||
.env
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "@trigger.dev/database",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"dependencies": {
|
||||
"@prisma/client": "latest",
|
||||
"typescript": "^4.8.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prisma": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"db:generate": "prisma generate",
|
||||
"db:push": "prisma db push --skip-generate",
|
||||
"db:migrate:dev": "prisma migrate dev"
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user