MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / seedIntegrationAuthMethods

Function seedIntegrationAuthMethods

apps/webapp/prisma/seed.ts:8–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6import { createEnvironment } from "~/models/organization.server";
7
8async function seedIntegrationAuthMethods() {
9 for (const [_, integration] of Object.entries(integrationCatalog.getIntegrations())) {
10 await prisma.integrationDefinition.upsert({
11 where: {
12 id: integration.identifier,
13 },
14 create: {
15 id: integration.identifier,
16 name: integration.name,
17 icon: integration.icon ?? integration.identifier,
18 instructions: "Instructions go here",
19 description: integration.description,
20 packageName: integration.packageName,
21 },
22 update: {
23 name: integration.name,
24 description: integration.description,
25 packageName: integration.packageName,
26 icon: integration.icon ?? integration.identifier,
27 },
28 });
29
30 for (const [key, authMethod] of Object.entries(integration.authenticationMethods)) {
31 if (authMethod.type === "oauth2") {
32 console.log(`Upserting auth method ${integration.identifier}.${key}`);
33
34 await prisma.integrationAuthMethod.upsert({
35 where: {
36 definitionId_key: {
37 definitionId: integration.identifier,
38 key,
39 },
40 },
41 create: {
42 key,
43 name: authMethod.name,
44 description: authMethod.description ?? "",
45 type: authMethod.type,
46 client: authMethod.client,
47 config: authMethod.config,
48 scopes: authMethod.scopes,
49 definition: {
50 connect: {
51 id: integration.identifier,
52 },
53 },
54 help: authMethod.help,
55 },
56 update: {
57 name: authMethod.name,
58 description: authMethod.description ?? "",
59 type: authMethod.type,
60 client: authMethod.client,
61 config: authMethod.config,
62 scopes: authMethod.scopes,
63 help: authMethod.help,
64 },
65 });

Callers 1

seedFunction · 0.85

Calls 2

getIntegrationsMethod · 0.80
logMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…