feat: BYO Auth (#491)
* feat: BYO Auth Define client-side auth resolvers to be able to supply custom authentication credentials for integrations before a run is performed - Added new defineAuthResolver - Update all integrations to support the new auth resolvers - Strip internal symbols from .d.ts in integrations and trigger-sdk - Added BYO Auth docs - Update Dynamic Schedule to support associated account IDs - Create external accounts just-in-time - Added Account ID field to test job when there are external auth integrations - Show Account ID on run dashboard - Added new Run error state called “Unresolved auth” * Added changeset * Remove @internal from TriggerIntegration public methods * Add void to the result union * DynamicTriggers now work with the new BYO auth system, and added a bunch of docs and docs changes * Add additional key material for registering dynamic trigger task * Add new define* instance methods to the overview
This commit is contained in:
@@ -5,15 +5,11 @@ import { Issues } from "./issues";
|
||||
import { ReactionContent, Reactions } from "./reactions";
|
||||
|
||||
export class Compound {
|
||||
runTask: GitHubRunTask;
|
||||
issues: Issues;
|
||||
reactions: Reactions;
|
||||
|
||||
constructor(runTask: GitHubRunTask, issues: Issues, reactions: Reactions) {
|
||||
this.runTask = runTask;
|
||||
this.issues = issues;
|
||||
this.reactions = reactions;
|
||||
}
|
||||
constructor(
|
||||
private runTask: GitHubRunTask,
|
||||
public issues: Issues,
|
||||
public reactions: Reactions
|
||||
) {}
|
||||
|
||||
createIssueCommentWithReaction(
|
||||
key: IntegrationTaskKey,
|
||||
|
||||
@@ -34,11 +34,7 @@ type TreeType = {
|
||||
};
|
||||
|
||||
export class Git {
|
||||
runTask: GitHubRunTask;
|
||||
|
||||
constructor(runTask: GitHubRunTask) {
|
||||
this.runTask = runTask;
|
||||
}
|
||||
constructor(private runTask: GitHubRunTask) {}
|
||||
|
||||
createBlob(
|
||||
key: IntegrationTaskKey,
|
||||
|
||||
@@ -68,9 +68,13 @@ export type GitHubReturnType<T extends (params: any) => Promise<{ data: K }>, K
|
||||
>;
|
||||
|
||||
export class Github implements TriggerIntegration {
|
||||
// @internal
|
||||
private _options: GithubIntegrationOptions;
|
||||
// @internal
|
||||
private _client?: Octokit;
|
||||
// @internal
|
||||
private _io?: IO;
|
||||
// @internal
|
||||
private _connectionKey?: string;
|
||||
|
||||
_repoSource: ReturnType<typeof createRepoEventSource>;
|
||||
|
||||
@@ -6,11 +6,7 @@ import { issueProperties, repoProperties } from "./propertyHelpers";
|
||||
|
||||
type AddIssueLabels = GitHubReturnType<Octokit["rest"]["issues"]["addLabels"]>;
|
||||
export class Issues {
|
||||
runTask: GitHubRunTask;
|
||||
|
||||
constructor(runTask: GitHubRunTask) {
|
||||
this.runTask = runTask;
|
||||
}
|
||||
constructor(private runTask: GitHubRunTask) {}
|
||||
|
||||
create(
|
||||
key: IntegrationTaskKey,
|
||||
|
||||
@@ -3,11 +3,7 @@ import { Octokit } from "octokit";
|
||||
import { GitHubReturnType, GitHubRunTask, onError } from "./index";
|
||||
|
||||
export class Orgs {
|
||||
runTask: GitHubRunTask;
|
||||
|
||||
constructor(runTask: GitHubRunTask) {
|
||||
this.runTask = runTask;
|
||||
}
|
||||
constructor(private runTask: GitHubRunTask) {}
|
||||
|
||||
updateWebhook(
|
||||
key: IntegrationTaskKey,
|
||||
|
||||
@@ -15,11 +15,7 @@ export type ReactionContent =
|
||||
| "eyes";
|
||||
|
||||
export class Reactions {
|
||||
runTask: GitHubRunTask;
|
||||
|
||||
constructor(runTask: GitHubRunTask) {
|
||||
this.runTask = runTask;
|
||||
}
|
||||
constructor(private runTask: GitHubRunTask) {}
|
||||
|
||||
createForIssueComment(
|
||||
key: IntegrationTaskKey,
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
import { truncate } from "@trigger.dev/integration-kit";
|
||||
import { IntegrationTaskKey, Prettify, retry } from "@trigger.dev/sdk";
|
||||
import { GitHubReturnType, GitHubRunTask, onError } from "./index";
|
||||
import { IntegrationTaskKey } from "@trigger.dev/sdk";
|
||||
import { Octokit } from "octokit";
|
||||
import { issueProperties, repoProperties } from "./propertyHelpers";
|
||||
import { GitHubReturnType, GitHubRunTask, onError } from "./index";
|
||||
|
||||
export class Repos {
|
||||
runTask: GitHubRunTask;
|
||||
|
||||
constructor(runTask: GitHubRunTask) {
|
||||
this.runTask = runTask;
|
||||
}
|
||||
constructor(private runTask: GitHubRunTask) {}
|
||||
|
||||
get(
|
||||
key: IntegrationTaskKey,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Webhooks } from "@octokit/webhooks";
|
||||
import { ExternalSource, TriggerIntegration, HandlerEvent } from "@trigger.dev/sdk";
|
||||
import { omit, safeJsonParse } from "@trigger.dev/integration-kit";
|
||||
import type { Logger } from "@trigger.dev/sdk";
|
||||
import { safeJsonParse, omit } from "@trigger.dev/integration-kit";
|
||||
import { Octokit } from "octokit";
|
||||
import { ExternalSource, HandlerEvent } from "@trigger.dev/sdk";
|
||||
import { z } from "zod";
|
||||
import { Github } from "./index";
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
},
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
"baseUrl": "."
|
||||
"baseUrl": ".",
|
||||
"stripInternal": true
|
||||
},
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user