@superdurable/connector-linear 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +16 -2
- package/dex-connector.json +574 -0
- package/dist/chunk-SYZELIEF.js +579 -0
- package/dist/connection-DOHnQID8.d.ts +762 -0
- package/dist/index.d.ts +437 -0
- package/dist/index.js +1275 -0
- package/dist/mock.d.ts +203 -0
- package/dist/mock.js +515 -0
- package/package.json +62 -4
|
@@ -0,0 +1,579 @@
|
|
|
1
|
+
// src/generated/models.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { SecretString } from "@superdurable/connectors-sdk";
|
|
4
|
+
var goTimeJSONPattern = /^(\d{4})-(\d{2})-(\d{2})T(\d{1,2}):(\d{2}):(\d{2})(?:[.,](\d+))?(Z|([+-])(\d{2}):(\d{2}))$/;
|
|
5
|
+
function isGoTimeJSON(value) {
|
|
6
|
+
const match = goTimeJSONPattern.exec(value);
|
|
7
|
+
if (!match) return false;
|
|
8
|
+
const [, yearText, monthText, dayText, hourText, minuteText, secondText, , zone, , zoneHourText, zoneMinuteText] = match;
|
|
9
|
+
const year = Number(yearText);
|
|
10
|
+
const month = Number(monthText);
|
|
11
|
+
const day = Number(dayText);
|
|
12
|
+
const isLeap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
13
|
+
const monthDays = [31, isLeap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
14
|
+
return month >= 1 && month <= 12 && day >= 1 && day <= monthDays[month - 1] && Number(hourText) <= 23 && Number(minuteText) <= 59 && Number(secondText) <= 59 && (zone === "Z" || Number(zoneHourText) <= 24 && Number(zoneMinuteText) <= 60);
|
|
15
|
+
}
|
|
16
|
+
function canonicalGoTimeJSON(value) {
|
|
17
|
+
const match = goTimeJSONPattern.exec(value);
|
|
18
|
+
const [, year, month, day, hour, minute, second, fraction, zone, sign, zoneHour, zoneMinute] = match;
|
|
19
|
+
const clock = year + "-" + month + "-" + day + "T" + hour.padStart(2, "0") + ":" + minute + ":" + second;
|
|
20
|
+
const digits = (fraction ?? "").slice(0, 9).replace(/0+$/, "");
|
|
21
|
+
const offsetMinutes = zone === "Z" ? 0 : (Number(zoneHour) * 60 + Number(zoneMinute)) * (sign === "+" ? 1 : -1);
|
|
22
|
+
if (Math.abs(offsetMinutes) >= 1440) return value;
|
|
23
|
+
const offset = offsetMinutes === 0 ? "Z" : (offsetMinutes > 0 ? "+" : "-") + String(Math.floor(Math.abs(offsetMinutes) / 60)).padStart(2, "0") + ":" + String(Math.abs(offsetMinutes) % 60).padStart(2, "0");
|
|
24
|
+
return clock + (digits ? "." + digits : "") + offset;
|
|
25
|
+
}
|
|
26
|
+
var GoTimeJSONSchema = z.string().refine(isGoTimeJSON, "invalid Go time.Time JSON timestamp").transform(canonicalGoTimeJSON);
|
|
27
|
+
var ConfigSchema = z.object({
|
|
28
|
+
"maxResponseBytes": z.number().int().optional(),
|
|
29
|
+
"webhookMaxBodyBytes": z.number().int().optional(),
|
|
30
|
+
"webhookSignatureToleranceMs": z.number().int().optional()
|
|
31
|
+
});
|
|
32
|
+
var CredentialMaterialError = class extends TypeError {
|
|
33
|
+
constructor(message) {
|
|
34
|
+
super(message);
|
|
35
|
+
this.name = "CredentialMaterialError";
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var sdkCredentialDecodingFailureMessages = /* @__PURE__ */ new Set([
|
|
39
|
+
"project credential decoding failed",
|
|
40
|
+
"shared project credential decoding failed",
|
|
41
|
+
"project credential decoding failed: this connector version does not support shared credentials"
|
|
42
|
+
]);
|
|
43
|
+
function isCredentialMaterialError(error) {
|
|
44
|
+
return error instanceof CredentialMaterialError || error instanceof TypeError && sdkCredentialDecodingFailureMessages.has(error.message);
|
|
45
|
+
}
|
|
46
|
+
function decodeCredentials(value) {
|
|
47
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new CredentialMaterialError("credential fields are invalid");
|
|
48
|
+
const fields = value;
|
|
49
|
+
const allowed = /* @__PURE__ */ new Set(["auth_method", "api_key", "access_token", "oauth_client_id", "oauth_client_secret", "refresh_token", "webhook_signing_secret"]);
|
|
50
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new CredentialMaterialError("stored credential does not match the connector credential fields");
|
|
51
|
+
if (fields["api_key"] != null && !(typeof fields["api_key"] === "string")) throw new CredentialMaterialError("credential api_key has an invalid type");
|
|
52
|
+
if (fields["access_token"] != null && !(typeof fields["access_token"] === "string")) throw new CredentialMaterialError("credential access_token has an invalid type");
|
|
53
|
+
if (fields["oauth_client_id"] != null && !(typeof fields["oauth_client_id"] === "string")) throw new CredentialMaterialError("credential oauth_client_id has an invalid type");
|
|
54
|
+
if (fields["oauth_client_secret"] != null && !(typeof fields["oauth_client_secret"] === "string")) throw new CredentialMaterialError("credential oauth_client_secret has an invalid type");
|
|
55
|
+
if (fields["refresh_token"] != null && !(typeof fields["refresh_token"] === "string")) throw new CredentialMaterialError("credential refresh_token has an invalid type");
|
|
56
|
+
if (fields["webhook_signing_secret"] != null && !(typeof fields["webhook_signing_secret"] === "string")) throw new CredentialMaterialError("credential webhook_signing_secret has an invalid type");
|
|
57
|
+
const selectedMethod = fields["auth_method"] ?? "";
|
|
58
|
+
if (typeof selectedMethod !== "string") throw new CredentialMaterialError("credential auth_method is invalid");
|
|
59
|
+
const method = selectedMethod || "personal-api-key";
|
|
60
|
+
const credentials = { authMethodId: method };
|
|
61
|
+
if (method === "personal-api-key") {
|
|
62
|
+
if (!fields["api_key"]) throw new CredentialMaterialError("credential api_key is required");
|
|
63
|
+
if (fields["api_key"]) credentials.apiKey = new SecretString(fields["api_key"]);
|
|
64
|
+
credentials.webhookSigningSecret = new SecretString(fields["webhook_signing_secret"] ?? "");
|
|
65
|
+
} else if (method === "linear-oauth") {
|
|
66
|
+
if (!fields["oauth_client_id"]) throw new CredentialMaterialError("credential oauth_client_id is required");
|
|
67
|
+
if (fields["oauth_client_id"]) credentials.oauthClientId = fields["oauth_client_id"];
|
|
68
|
+
if (!fields["oauth_client_secret"]) throw new CredentialMaterialError("credential oauth_client_secret is required");
|
|
69
|
+
if (fields["oauth_client_secret"]) credentials.oauthClientSecret = new SecretString(fields["oauth_client_secret"]);
|
|
70
|
+
if (!fields["access_token"]) throw new CredentialMaterialError("credential access_token is required");
|
|
71
|
+
if (fields["access_token"]) credentials.accessToken = new SecretString(fields["access_token"]);
|
|
72
|
+
if (!fields["refresh_token"]) throw new CredentialMaterialError("credential refresh_token is required");
|
|
73
|
+
if (fields["refresh_token"]) credentials.refreshToken = new SecretString(fields["refresh_token"]);
|
|
74
|
+
credentials.webhookSigningSecret = new SecretString(fields["webhook_signing_secret"] ?? "");
|
|
75
|
+
} else {
|
|
76
|
+
throw new CredentialMaterialError("credential auth_method is invalid");
|
|
77
|
+
}
|
|
78
|
+
return credentials;
|
|
79
|
+
}
|
|
80
|
+
function decodeSharedCredentials(value) {
|
|
81
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new CredentialMaterialError("credential fields are invalid");
|
|
82
|
+
const fields = value;
|
|
83
|
+
const allowed = /* @__PURE__ */ new Set(["auth_method", "api_key", "access_token", "oauth_client_id", "oauth_client_secret", "refresh_token", "webhook_signing_secret"]);
|
|
84
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new CredentialMaterialError("stored credential does not match the connector credential fields");
|
|
85
|
+
if (fields["api_key"] != null && !(typeof fields["api_key"] === "string")) throw new CredentialMaterialError("credential api_key has an invalid type");
|
|
86
|
+
if (fields["access_token"] != null && !(typeof fields["access_token"] === "string")) throw new CredentialMaterialError("credential access_token has an invalid type");
|
|
87
|
+
if (fields["oauth_client_id"] != null && !(typeof fields["oauth_client_id"] === "string")) throw new CredentialMaterialError("credential oauth_client_id has an invalid type");
|
|
88
|
+
if (fields["oauth_client_secret"] != null && !(typeof fields["oauth_client_secret"] === "string")) throw new CredentialMaterialError("credential oauth_client_secret has an invalid type");
|
|
89
|
+
if (fields["refresh_token"] != null && !(typeof fields["refresh_token"] === "string")) throw new CredentialMaterialError("credential refresh_token has an invalid type");
|
|
90
|
+
if (fields["webhook_signing_secret"] != null && !(typeof fields["webhook_signing_secret"] === "string")) throw new CredentialMaterialError("credential webhook_signing_secret has an invalid type");
|
|
91
|
+
const selectedMethod = fields["auth_method"] ?? "";
|
|
92
|
+
if (typeof selectedMethod !== "string") throw new CredentialMaterialError("credential auth_method is invalid");
|
|
93
|
+
const method = selectedMethod || "personal-api-key";
|
|
94
|
+
const credentials = { authMethodId: method };
|
|
95
|
+
if (method === "personal-api-key") {
|
|
96
|
+
if (!fields["api_key"]) throw new CredentialMaterialError("credential api_key is required");
|
|
97
|
+
if (fields["api_key"]) credentials.apiKey = new SecretString(fields["api_key"]);
|
|
98
|
+
credentials.webhookSigningSecret = new SecretString(fields["webhook_signing_secret"] ?? "");
|
|
99
|
+
} else if (method === "linear-oauth") {
|
|
100
|
+
if (!fields["oauth_client_id"]) throw new CredentialMaterialError("credential oauth_client_id is required");
|
|
101
|
+
if (fields["oauth_client_id"]) credentials.oauthClientId = fields["oauth_client_id"];
|
|
102
|
+
if (fields["oauth_client_secret"]) credentials.oauthClientSecret = new SecretString(fields["oauth_client_secret"]);
|
|
103
|
+
if (!fields["access_token"]) throw new CredentialMaterialError("credential access_token is required");
|
|
104
|
+
if (fields["access_token"]) credentials.accessToken = new SecretString(fields["access_token"]);
|
|
105
|
+
if (fields["refresh_token"]) credentials.refreshToken = new SecretString(fields["refresh_token"]);
|
|
106
|
+
credentials.webhookSigningSecret = new SecretString(fields["webhook_signing_secret"] ?? "");
|
|
107
|
+
} else {
|
|
108
|
+
throw new CredentialMaterialError("credential auth_method is invalid");
|
|
109
|
+
}
|
|
110
|
+
return credentials;
|
|
111
|
+
}
|
|
112
|
+
var IssueSearchFilterSchema = z.strictObject({
|
|
113
|
+
"teamId": z.string().optional(),
|
|
114
|
+
"teamKey": z.string().optional(),
|
|
115
|
+
"stateTypes": z.array(z.string()).optional(),
|
|
116
|
+
"stateIds": z.array(z.string()).optional(),
|
|
117
|
+
"assigneeId": z.string().optional(),
|
|
118
|
+
"assigneeEmail": z.string().optional(),
|
|
119
|
+
"unassigned": z.boolean().optional(),
|
|
120
|
+
"labelIds": z.array(z.string()).optional(),
|
|
121
|
+
"labelNames": z.array(z.string()).optional(),
|
|
122
|
+
"projectId": z.string().optional(),
|
|
123
|
+
"title": z.string().optional(),
|
|
124
|
+
"titleContains": z.string().optional(),
|
|
125
|
+
"updatedAfter": GoTimeJSONSchema.nullable().optional(),
|
|
126
|
+
"createdAfter": GoTimeJSONSchema.nullable().optional()
|
|
127
|
+
});
|
|
128
|
+
var SearchIssuesInputSchema = z.strictObject({
|
|
129
|
+
"filter": IssueSearchFilterSchema,
|
|
130
|
+
"order": z.string().optional(),
|
|
131
|
+
"pageSize": z.number().int().optional(),
|
|
132
|
+
"cursor": z.string().optional(),
|
|
133
|
+
"includesArchived": z.boolean().optional()
|
|
134
|
+
});
|
|
135
|
+
var TeamReferenceSchema = z.strictObject({
|
|
136
|
+
"id": z.string(),
|
|
137
|
+
"key": z.string(),
|
|
138
|
+
"name": z.string()
|
|
139
|
+
});
|
|
140
|
+
var WorkflowStateReferenceSchema = z.strictObject({
|
|
141
|
+
"id": z.string(),
|
|
142
|
+
"name": z.string(),
|
|
143
|
+
"type": z.string()
|
|
144
|
+
});
|
|
145
|
+
var IssueSummarySchema = z.strictObject({
|
|
146
|
+
"id": z.string(),
|
|
147
|
+
"identifier": z.string(),
|
|
148
|
+
"title": z.string(),
|
|
149
|
+
"url": z.string(),
|
|
150
|
+
"team": TeamReferenceSchema,
|
|
151
|
+
"state": WorkflowStateReferenceSchema,
|
|
152
|
+
"assigneeId": z.string().optional(),
|
|
153
|
+
"priority": z.number().int(),
|
|
154
|
+
"labelIds": z.array(z.string()).optional(),
|
|
155
|
+
"dueDate": z.string().optional(),
|
|
156
|
+
"createdAt": GoTimeJSONSchema,
|
|
157
|
+
"updatedAt": GoTimeJSONSchema,
|
|
158
|
+
"archivedAt": GoTimeJSONSchema.nullable().optional()
|
|
159
|
+
});
|
|
160
|
+
var SearchIssuesOutputSchema = z.strictObject({
|
|
161
|
+
"issues": z.array(IssueSummarySchema).nullable(),
|
|
162
|
+
"nextCursor": z.string().optional()
|
|
163
|
+
});
|
|
164
|
+
var GetIssueInputSchema = z.strictObject({
|
|
165
|
+
"issueId": z.string()
|
|
166
|
+
});
|
|
167
|
+
var UserReferenceSchema = z.strictObject({
|
|
168
|
+
"id": z.string(),
|
|
169
|
+
"name": z.string().optional(),
|
|
170
|
+
"displayName": z.string().optional()
|
|
171
|
+
});
|
|
172
|
+
var IssueLabelSchema = z.strictObject({
|
|
173
|
+
"id": z.string(),
|
|
174
|
+
"name": z.string(),
|
|
175
|
+
"color": z.string().optional()
|
|
176
|
+
});
|
|
177
|
+
var ProjectReferenceSchema = z.strictObject({
|
|
178
|
+
"id": z.string(),
|
|
179
|
+
"name": z.string()
|
|
180
|
+
});
|
|
181
|
+
var CycleReferenceSchema = z.strictObject({
|
|
182
|
+
"id": z.string(),
|
|
183
|
+
"number": z.number().int(),
|
|
184
|
+
"name": z.string().optional()
|
|
185
|
+
});
|
|
186
|
+
var IssueReferenceSchema = z.strictObject({
|
|
187
|
+
"id": z.string(),
|
|
188
|
+
"identifier": z.string()
|
|
189
|
+
});
|
|
190
|
+
var IssueSchema = z.strictObject({
|
|
191
|
+
"id": z.string(),
|
|
192
|
+
"identifier": z.string(),
|
|
193
|
+
"title": z.string(),
|
|
194
|
+
"url": z.string(),
|
|
195
|
+
"team": TeamReferenceSchema,
|
|
196
|
+
"state": WorkflowStateReferenceSchema,
|
|
197
|
+
"assigneeId": z.string().optional(),
|
|
198
|
+
"priority": z.number().int(),
|
|
199
|
+
"labelIds": z.array(z.string()).optional(),
|
|
200
|
+
"dueDate": z.string().optional(),
|
|
201
|
+
"createdAt": GoTimeJSONSchema,
|
|
202
|
+
"updatedAt": GoTimeJSONSchema,
|
|
203
|
+
"archivedAt": GoTimeJSONSchema.nullable().optional(),
|
|
204
|
+
"number": z.number().int(),
|
|
205
|
+
"priorityLabel": z.string().optional(),
|
|
206
|
+
"estimate": z.number().optional(),
|
|
207
|
+
"description": z.string().optional(),
|
|
208
|
+
"descriptionTruncated": z.boolean().optional(),
|
|
209
|
+
"branchName": z.string().optional(),
|
|
210
|
+
"trashed": z.boolean().optional(),
|
|
211
|
+
"assignee": UserReferenceSchema.optional(),
|
|
212
|
+
"creator": UserReferenceSchema.optional(),
|
|
213
|
+
"labels": z.array(IssueLabelSchema).optional(),
|
|
214
|
+
"project": ProjectReferenceSchema.optional(),
|
|
215
|
+
"cycle": CycleReferenceSchema.optional(),
|
|
216
|
+
"parent": IssueReferenceSchema.optional(),
|
|
217
|
+
"startedAt": GoTimeJSONSchema.nullable().optional(),
|
|
218
|
+
"completedAt": GoTimeJSONSchema.nullable().optional(),
|
|
219
|
+
"canceledAt": GoTimeJSONSchema.nullable().optional()
|
|
220
|
+
});
|
|
221
|
+
var CreateIssueInputSchema = z.strictObject({
|
|
222
|
+
"teamId": z.string(),
|
|
223
|
+
"title": z.string(),
|
|
224
|
+
"description": z.string().optional(),
|
|
225
|
+
"stateId": z.string().optional(),
|
|
226
|
+
"assigneeId": z.string().optional(),
|
|
227
|
+
"labelIds": z.array(z.string()).optional(),
|
|
228
|
+
"priority": z.number().int().optional(),
|
|
229
|
+
"dueDate": z.string().optional(),
|
|
230
|
+
"projectId": z.string().optional(),
|
|
231
|
+
"parentId": z.string().optional()
|
|
232
|
+
});
|
|
233
|
+
var CreateIssueOutputSchema = z.strictObject({
|
|
234
|
+
"teamId": z.string(),
|
|
235
|
+
"title": z.string(),
|
|
236
|
+
"issueId": z.string().optional(),
|
|
237
|
+
"issue": IssueSummarySchema.optional(),
|
|
238
|
+
"replayed": z.boolean().optional()
|
|
239
|
+
});
|
|
240
|
+
var UpdateIssueInputSchema = z.strictObject({
|
|
241
|
+
"issueId": z.string(),
|
|
242
|
+
"stateId": z.string().optional(),
|
|
243
|
+
"assigneeId": z.string().optional(),
|
|
244
|
+
"unassigns": z.boolean().optional(),
|
|
245
|
+
"addedLabelIds": z.array(z.string()).optional(),
|
|
246
|
+
"removedLabelIds": z.array(z.string()).optional(),
|
|
247
|
+
"priority": z.number().int().optional(),
|
|
248
|
+
"dueDate": z.string().optional(),
|
|
249
|
+
"clearsDueDate": z.boolean().optional(),
|
|
250
|
+
"title": z.string().optional()
|
|
251
|
+
});
|
|
252
|
+
var UpdateIssueOutputSchema = z.strictObject({
|
|
253
|
+
"issueId": z.string(),
|
|
254
|
+
"issue": IssueSummarySchema.optional()
|
|
255
|
+
});
|
|
256
|
+
var AddCommentInputSchema = z.strictObject({
|
|
257
|
+
"issueId": z.string(),
|
|
258
|
+
"body": z.string()
|
|
259
|
+
});
|
|
260
|
+
var AddCommentOutputSchema = z.strictObject({
|
|
261
|
+
"issueId": z.string(),
|
|
262
|
+
"commentId": z.string().optional(),
|
|
263
|
+
"url": z.string().optional(),
|
|
264
|
+
"createdAt": GoTimeJSONSchema.nullable().optional(),
|
|
265
|
+
"replayed": z.boolean().optional()
|
|
266
|
+
});
|
|
267
|
+
var FindUserByEmailInputSchema = z.strictObject({
|
|
268
|
+
"email": z.string(),
|
|
269
|
+
"includesDisabled": z.boolean().optional()
|
|
270
|
+
});
|
|
271
|
+
var UserSchema = z.strictObject({
|
|
272
|
+
"id": z.string(),
|
|
273
|
+
"name": z.string(),
|
|
274
|
+
"displayName": z.string(),
|
|
275
|
+
"email": z.string(),
|
|
276
|
+
"active": z.boolean(),
|
|
277
|
+
"admin": z.boolean().optional(),
|
|
278
|
+
"guest": z.boolean().optional(),
|
|
279
|
+
"url": z.string().optional()
|
|
280
|
+
});
|
|
281
|
+
var ListWorkflowStatesInputSchema = z.strictObject({
|
|
282
|
+
"teamId": z.string()
|
|
283
|
+
});
|
|
284
|
+
var WorkflowStateSchema = z.strictObject({
|
|
285
|
+
"id": z.string(),
|
|
286
|
+
"name": z.string(),
|
|
287
|
+
"type": z.string(),
|
|
288
|
+
"position": z.number(),
|
|
289
|
+
"color": z.string().optional()
|
|
290
|
+
});
|
|
291
|
+
var ListWorkflowStatesOutputSchema = z.strictObject({
|
|
292
|
+
"teamId": z.string(),
|
|
293
|
+
"states": z.array(WorkflowStateSchema).nullable()
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// src/generated/definitions.ts
|
|
297
|
+
var ConnectorID = "linear";
|
|
298
|
+
var ProviderID = "linear";
|
|
299
|
+
var SearchIssuesBranch = {
|
|
300
|
+
Searched: "searched",
|
|
301
|
+
ProviderRejected: "providerRejected",
|
|
302
|
+
InvalidResponse: "invalidResponse",
|
|
303
|
+
Defect: "defect"
|
|
304
|
+
};
|
|
305
|
+
var SearchIssuesBranchSearched = SearchIssuesBranch.Searched;
|
|
306
|
+
var SearchIssuesBranchProviderRejected = SearchIssuesBranch.ProviderRejected;
|
|
307
|
+
var SearchIssuesBranchInvalidResponse = SearchIssuesBranch.InvalidResponse;
|
|
308
|
+
var SearchIssuesBranchDefect = SearchIssuesBranch.Defect;
|
|
309
|
+
var SearchIssuesDefinition = {
|
|
310
|
+
operation: { connectorId: ConnectorID, operationId: "searchIssues" },
|
|
311
|
+
branches: [
|
|
312
|
+
{ id: "searched", description: "One page of matching issue summaries was read; it can be empty." },
|
|
313
|
+
{ id: "providerRejected", description: "Linear conclusively rejected the search, such as an invalid cursor, missing team access, or a rejected credential.", optional: true },
|
|
314
|
+
{ id: "invalidResponse", description: "Linear returned an invalid or oversized page of issues.", optional: true },
|
|
315
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
316
|
+
],
|
|
317
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
318
|
+
};
|
|
319
|
+
var SearchIssuesMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
320
|
+
var GetIssueBranch = {
|
|
321
|
+
Found: "found",
|
|
322
|
+
NotFound: "notFound",
|
|
323
|
+
ProviderRejected: "providerRejected",
|
|
324
|
+
InvalidResponse: "invalidResponse",
|
|
325
|
+
Defect: "defect"
|
|
326
|
+
};
|
|
327
|
+
var GetIssueBranchFound = GetIssueBranch.Found;
|
|
328
|
+
var GetIssueBranchNotFound = GetIssueBranch.NotFound;
|
|
329
|
+
var GetIssueBranchProviderRejected = GetIssueBranch.ProviderRejected;
|
|
330
|
+
var GetIssueBranchInvalidResponse = GetIssueBranch.InvalidResponse;
|
|
331
|
+
var GetIssueBranchDefect = GetIssueBranch.Defect;
|
|
332
|
+
var GetIssueDefinition = {
|
|
333
|
+
operation: { connectorId: ConnectorID, operationId: "getIssue" },
|
|
334
|
+
branches: [
|
|
335
|
+
{ id: "found", description: "The issue was read." },
|
|
336
|
+
{ id: "notFound", description: "The issue does not exist, was deleted, or the connection cannot see its team.", optional: true },
|
|
337
|
+
{ id: "providerRejected", description: "Linear conclusively rejected the issue read.", optional: true },
|
|
338
|
+
{ id: "invalidResponse", description: "Linear returned an invalid or oversized issue.", optional: true },
|
|
339
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
340
|
+
],
|
|
341
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
342
|
+
};
|
|
343
|
+
var GetIssueMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
344
|
+
var CreateIssueBranch = {
|
|
345
|
+
Created: "created",
|
|
346
|
+
ProviderRejected: "providerRejected",
|
|
347
|
+
Defect: "defect"
|
|
348
|
+
};
|
|
349
|
+
var CreateIssueBranchCreated = CreateIssueBranch.Created;
|
|
350
|
+
var CreateIssueBranchProviderRejected = CreateIssueBranch.ProviderRejected;
|
|
351
|
+
var CreateIssueBranchDefect = CreateIssueBranch.Defect;
|
|
352
|
+
var CreateIssueDefinition = {
|
|
353
|
+
operation: { connectorId: ConnectorID, operationId: "createIssue" },
|
|
354
|
+
branches: [
|
|
355
|
+
{ id: "created", description: "Linear created the issue, or an earlier attempt of this Step already had, and the issue was read." },
|
|
356
|
+
{ id: "providerRejected", description: "Linear conclusively rejected the issue, such as an unknown team, a workflow state or label of another team, or missing permission; unless Linear rejected the credential or permission, a read-back by the Step's UUID found no issue.", optional: true },
|
|
357
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
358
|
+
],
|
|
359
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
360
|
+
};
|
|
361
|
+
var CreateIssueMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
362
|
+
var UpdateIssueBranch = {
|
|
363
|
+
Updated: "updated",
|
|
364
|
+
NotFound: "notFound",
|
|
365
|
+
ProviderRejected: "providerRejected",
|
|
366
|
+
InvalidResponse: "invalidResponse",
|
|
367
|
+
Defect: "defect"
|
|
368
|
+
};
|
|
369
|
+
var UpdateIssueBranchUpdated = UpdateIssueBranch.Updated;
|
|
370
|
+
var UpdateIssueBranchNotFound = UpdateIssueBranch.NotFound;
|
|
371
|
+
var UpdateIssueBranchProviderRejected = UpdateIssueBranch.ProviderRejected;
|
|
372
|
+
var UpdateIssueBranchInvalidResponse = UpdateIssueBranch.InvalidResponse;
|
|
373
|
+
var UpdateIssueBranchDefect = UpdateIssueBranch.Defect;
|
|
374
|
+
var UpdateIssueDefinition = {
|
|
375
|
+
operation: { connectorId: ConnectorID, operationId: "updateIssue" },
|
|
376
|
+
branches: [
|
|
377
|
+
{ id: "updated", description: "Linear applied the change and returned the issue." },
|
|
378
|
+
{ id: "notFound", description: "The issue does not exist, was deleted, or the connection cannot see its team; nothing was changed.", optional: true },
|
|
379
|
+
{ id: "providerRejected", description: "Linear conclusively rejected the change, such as a workflow state or label of another team, an unknown assignee, or missing permission.", optional: true },
|
|
380
|
+
{ id: "invalidResponse", description: "Kept for compatibility and no longer selected: an invalid or oversized issue after the change now retries, because repeating the absolute update is safe.", optional: true },
|
|
381
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
382
|
+
],
|
|
383
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
384
|
+
};
|
|
385
|
+
var UpdateIssueMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
386
|
+
var AddCommentBranch = {
|
|
387
|
+
Added: "added",
|
|
388
|
+
NotFound: "notFound",
|
|
389
|
+
ProviderRejected: "providerRejected",
|
|
390
|
+
Defect: "defect"
|
|
391
|
+
};
|
|
392
|
+
var AddCommentBranchAdded = AddCommentBranch.Added;
|
|
393
|
+
var AddCommentBranchNotFound = AddCommentBranch.NotFound;
|
|
394
|
+
var AddCommentBranchProviderRejected = AddCommentBranch.ProviderRejected;
|
|
395
|
+
var AddCommentBranchDefect = AddCommentBranch.Defect;
|
|
396
|
+
var AddCommentDefinition = {
|
|
397
|
+
operation: { connectorId: ConnectorID, operationId: "addComment" },
|
|
398
|
+
branches: [
|
|
399
|
+
{ id: "added", description: "Linear added the comment, or an earlier attempt of this Step already had, and the comment was read." },
|
|
400
|
+
{ id: "notFound", description: "The issue does not exist, was deleted, or the connection cannot see its team; nothing was added.", optional: true },
|
|
401
|
+
{ id: "providerRejected", description: "Linear conclusively rejected the comment, such as missing permission; unless Linear rejected the credential or permission, a read-back by the Step's UUID found no comment.", optional: true },
|
|
402
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
403
|
+
],
|
|
404
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
405
|
+
};
|
|
406
|
+
var AddCommentMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
407
|
+
var FindUserByEmailBranch = {
|
|
408
|
+
Found: "found",
|
|
409
|
+
NotFound: "notFound",
|
|
410
|
+
ProviderRejected: "providerRejected",
|
|
411
|
+
InvalidResponse: "invalidResponse",
|
|
412
|
+
Defect: "defect"
|
|
413
|
+
};
|
|
414
|
+
var FindUserByEmailBranchFound = FindUserByEmailBranch.Found;
|
|
415
|
+
var FindUserByEmailBranchNotFound = FindUserByEmailBranch.NotFound;
|
|
416
|
+
var FindUserByEmailBranchProviderRejected = FindUserByEmailBranch.ProviderRejected;
|
|
417
|
+
var FindUserByEmailBranchInvalidResponse = FindUserByEmailBranch.InvalidResponse;
|
|
418
|
+
var FindUserByEmailBranchDefect = FindUserByEmailBranch.Defect;
|
|
419
|
+
var FindUserByEmailDefinition = {
|
|
420
|
+
operation: { connectorId: ConnectorID, operationId: "findUserByEmail" },
|
|
421
|
+
branches: [
|
|
422
|
+
{ id: "found", description: "The user was found." },
|
|
423
|
+
{ id: "notFound", description: "No user of the workspace has the email, or the user is disabled and disabled users were not requested.", optional: true },
|
|
424
|
+
{ id: "providerRejected", description: "Linear conclusively rejected the user lookup.", optional: true },
|
|
425
|
+
{ id: "invalidResponse", description: "Linear returned an invalid or oversized user list.", optional: true },
|
|
426
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
427
|
+
],
|
|
428
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
429
|
+
};
|
|
430
|
+
var FindUserByEmailMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
431
|
+
var ListWorkflowStatesBranch = {
|
|
432
|
+
Listed: "listed",
|
|
433
|
+
NotFound: "notFound",
|
|
434
|
+
ProviderRejected: "providerRejected",
|
|
435
|
+
InvalidResponse: "invalidResponse",
|
|
436
|
+
Defect: "defect"
|
|
437
|
+
};
|
|
438
|
+
var ListWorkflowStatesBranchListed = ListWorkflowStatesBranch.Listed;
|
|
439
|
+
var ListWorkflowStatesBranchNotFound = ListWorkflowStatesBranch.NotFound;
|
|
440
|
+
var ListWorkflowStatesBranchProviderRejected = ListWorkflowStatesBranch.ProviderRejected;
|
|
441
|
+
var ListWorkflowStatesBranchInvalidResponse = ListWorkflowStatesBranch.InvalidResponse;
|
|
442
|
+
var ListWorkflowStatesBranchDefect = ListWorkflowStatesBranch.Defect;
|
|
443
|
+
var ListWorkflowStatesDefinition = {
|
|
444
|
+
operation: { connectorId: ConnectorID, operationId: "listWorkflowStates" },
|
|
445
|
+
branches: [
|
|
446
|
+
{ id: "listed", description: "The team's workflow states were read." },
|
|
447
|
+
{ id: "notFound", description: "The team does not exist or the connection cannot see it.", optional: true },
|
|
448
|
+
{ id: "providerRejected", description: "Linear conclusively rejected the read.", optional: true },
|
|
449
|
+
{ id: "invalidResponse", description: "Linear returned an invalid or oversized list of workflow states.", optional: true },
|
|
450
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
451
|
+
],
|
|
452
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
453
|
+
};
|
|
454
|
+
var ListWorkflowStatesMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
455
|
+
|
|
456
|
+
// src/generated/connection.ts
|
|
457
|
+
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
458
|
+
import { newRefreshingCredentialProvider } from "@superdurable/connectors-sdk/projectconfig";
|
|
459
|
+
var Connection = class {
|
|
460
|
+
/** Stable provider and connection name. */
|
|
461
|
+
reference;
|
|
462
|
+
/** Bound provider operations. */
|
|
463
|
+
operations;
|
|
464
|
+
/** Validate a reference and bind operations. */
|
|
465
|
+
constructor(reference, operations) {
|
|
466
|
+
this.reference = ConnectionRefSchema.parse(reference);
|
|
467
|
+
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
468
|
+
if (!operations) throw new TypeError("connector operations are required");
|
|
469
|
+
this.operations = operations;
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
function newConnection(client, reference) {
|
|
473
|
+
if (!client) throw new TypeError("connector client is required");
|
|
474
|
+
return new Connection(reference, client);
|
|
475
|
+
}
|
|
476
|
+
function newConnectionWithOperations(operations, reference) {
|
|
477
|
+
return new Connection(reference, operations);
|
|
478
|
+
}
|
|
479
|
+
function newProjectConnection(project, connectionName, createClient) {
|
|
480
|
+
if (!project) throw new TypeError("loaded project is required");
|
|
481
|
+
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
482
|
+
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
483
|
+
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
484
|
+
return newConnection(createClient(project, connectionName), reference);
|
|
485
|
+
}
|
|
486
|
+
function newProjectCredentialProvider(project, connectionName, decode, encode, decodeShared) {
|
|
487
|
+
return newRefreshingCredentialProvider(project.connections, { connectorId: ConnectorID, connectionName }, decode, encode, decodeShared);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export {
|
|
491
|
+
ConfigSchema,
|
|
492
|
+
CredentialMaterialError,
|
|
493
|
+
isCredentialMaterialError,
|
|
494
|
+
decodeCredentials,
|
|
495
|
+
decodeSharedCredentials,
|
|
496
|
+
IssueSearchFilterSchema,
|
|
497
|
+
SearchIssuesInputSchema,
|
|
498
|
+
TeamReferenceSchema,
|
|
499
|
+
WorkflowStateReferenceSchema,
|
|
500
|
+
IssueSummarySchema,
|
|
501
|
+
SearchIssuesOutputSchema,
|
|
502
|
+
GetIssueInputSchema,
|
|
503
|
+
UserReferenceSchema,
|
|
504
|
+
IssueLabelSchema,
|
|
505
|
+
ProjectReferenceSchema,
|
|
506
|
+
CycleReferenceSchema,
|
|
507
|
+
IssueReferenceSchema,
|
|
508
|
+
IssueSchema,
|
|
509
|
+
CreateIssueInputSchema,
|
|
510
|
+
CreateIssueOutputSchema,
|
|
511
|
+
UpdateIssueInputSchema,
|
|
512
|
+
UpdateIssueOutputSchema,
|
|
513
|
+
AddCommentInputSchema,
|
|
514
|
+
AddCommentOutputSchema,
|
|
515
|
+
FindUserByEmailInputSchema,
|
|
516
|
+
UserSchema,
|
|
517
|
+
ListWorkflowStatesInputSchema,
|
|
518
|
+
WorkflowStateSchema,
|
|
519
|
+
ListWorkflowStatesOutputSchema,
|
|
520
|
+
ConnectorID,
|
|
521
|
+
ProviderID,
|
|
522
|
+
SearchIssuesBranch,
|
|
523
|
+
SearchIssuesBranchSearched,
|
|
524
|
+
SearchIssuesBranchProviderRejected,
|
|
525
|
+
SearchIssuesBranchInvalidResponse,
|
|
526
|
+
SearchIssuesBranchDefect,
|
|
527
|
+
SearchIssuesDefinition,
|
|
528
|
+
SearchIssuesMetadata,
|
|
529
|
+
GetIssueBranch,
|
|
530
|
+
GetIssueBranchFound,
|
|
531
|
+
GetIssueBranchNotFound,
|
|
532
|
+
GetIssueBranchProviderRejected,
|
|
533
|
+
GetIssueBranchInvalidResponse,
|
|
534
|
+
GetIssueBranchDefect,
|
|
535
|
+
GetIssueDefinition,
|
|
536
|
+
GetIssueMetadata,
|
|
537
|
+
CreateIssueBranch,
|
|
538
|
+
CreateIssueBranchCreated,
|
|
539
|
+
CreateIssueBranchProviderRejected,
|
|
540
|
+
CreateIssueBranchDefect,
|
|
541
|
+
CreateIssueDefinition,
|
|
542
|
+
CreateIssueMetadata,
|
|
543
|
+
UpdateIssueBranch,
|
|
544
|
+
UpdateIssueBranchUpdated,
|
|
545
|
+
UpdateIssueBranchNotFound,
|
|
546
|
+
UpdateIssueBranchProviderRejected,
|
|
547
|
+
UpdateIssueBranchInvalidResponse,
|
|
548
|
+
UpdateIssueBranchDefect,
|
|
549
|
+
UpdateIssueDefinition,
|
|
550
|
+
UpdateIssueMetadata,
|
|
551
|
+
AddCommentBranch,
|
|
552
|
+
AddCommentBranchAdded,
|
|
553
|
+
AddCommentBranchNotFound,
|
|
554
|
+
AddCommentBranchProviderRejected,
|
|
555
|
+
AddCommentBranchDefect,
|
|
556
|
+
AddCommentDefinition,
|
|
557
|
+
AddCommentMetadata,
|
|
558
|
+
FindUserByEmailBranch,
|
|
559
|
+
FindUserByEmailBranchFound,
|
|
560
|
+
FindUserByEmailBranchNotFound,
|
|
561
|
+
FindUserByEmailBranchProviderRejected,
|
|
562
|
+
FindUserByEmailBranchInvalidResponse,
|
|
563
|
+
FindUserByEmailBranchDefect,
|
|
564
|
+
FindUserByEmailDefinition,
|
|
565
|
+
FindUserByEmailMetadata,
|
|
566
|
+
ListWorkflowStatesBranch,
|
|
567
|
+
ListWorkflowStatesBranchListed,
|
|
568
|
+
ListWorkflowStatesBranchNotFound,
|
|
569
|
+
ListWorkflowStatesBranchProviderRejected,
|
|
570
|
+
ListWorkflowStatesBranchInvalidResponse,
|
|
571
|
+
ListWorkflowStatesBranchDefect,
|
|
572
|
+
ListWorkflowStatesDefinition,
|
|
573
|
+
ListWorkflowStatesMetadata,
|
|
574
|
+
Connection,
|
|
575
|
+
newConnection,
|
|
576
|
+
newConnectionWithOperations,
|
|
577
|
+
newProjectConnection,
|
|
578
|
+
newProjectCredentialProvider
|
|
579
|
+
};
|