MCPcopy
hub / github.com/triggerdotdev/trigger.dev / Linear

Class Linear

integrations/linear/src/index.ts:98–1973  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96export type LinearRunTask = InstanceType<typeof Linear>["runTask"];
97
98export class Linear implements TriggerIntegration {
99 private _options: LinearIntegrationOptions;
100 private _client?: LinearClient;
101 private _io?: IO;
102 private _connectionKey?: string;
103
104 constructor(private options: LinearIntegrationOptions) {
105 if (Object.keys(options).includes("apiKey") && !options.apiKey) {
106 throw `Can't create Linear integration (${options.id}) as apiKey was undefined`;
107 }
108
109 this._options = options;
110 }
111
112 get authSource() {
113 return this._options.apiKey ? "LOCAL" : "HOSTED";
114 }
115
116 get id() {
117 return this._options.id;
118 }
119
120 get metadata() {
121 return { id: "linear", name: "Linear" };
122 }
123
124 get source() {
125 return createWebhookEventSource(this);
126 }
127
128 cloneForRun(io: IO, connectionKey: string, auth?: ConnectionAuth) {
129 const linear = new Linear(this._options);
130 linear._io = io;
131 linear._connectionKey = connectionKey;
132 linear._client = this.createClient(auth);
133 return linear;
134 }
135
136 createClient(auth?: ConnectionAuth) {
137 if (auth) {
138 return new LinearClient({
139 accessToken: auth.accessToken,
140 });
141 }
142
143 if (this._options.apiKey) {
144 return new LinearClient({
145 apiKey: this._options.apiKey,
146 });
147 }
148
149 throw new Error("No auth");
150 }
151
152 runTask<T, TResult extends Json<T> | void>(
153 key: IntegrationTaskKey,
154 callback: (client: LinearClient, task: IOTask, io: IO) => Promise<TResult>,
155 options?: RunTaskOptions,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…