@superdurable/connector-freshdesk 0.0.0-stage → 0.1.0

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/dist/index.js ADDED
@@ -0,0 +1,861 @@
1
+ import {
2
+ AddNoteBranch,
3
+ AddNoteBranchAdded,
4
+ AddNoteBranchDefect,
5
+ AddNoteBranchNotFound,
6
+ AddNoteBranchProviderRejected,
7
+ AddNoteBranchUncertain,
8
+ AddNoteDefinition,
9
+ AddNoteInputSchema,
10
+ AddNoteMetadata,
11
+ AddNoteOutputSchema,
12
+ ConfigSchema,
13
+ Connection,
14
+ ConnectorID,
15
+ CreateTicketBranch,
16
+ CreateTicketBranchCreated,
17
+ CreateTicketBranchDefect,
18
+ CreateTicketBranchProviderRejected,
19
+ CreateTicketBranchUncertain,
20
+ CreateTicketDefinition,
21
+ CreateTicketInputSchema,
22
+ CreateTicketMetadata,
23
+ CreateTicketOutputSchema,
24
+ GetTicketBranch,
25
+ GetTicketBranchDefect,
26
+ GetTicketBranchFound,
27
+ GetTicketBranchInvalidResponse,
28
+ GetTicketBranchNotFound,
29
+ GetTicketBranchProviderRejected,
30
+ GetTicketDefinition,
31
+ GetTicketInputSchema,
32
+ GetTicketMetadata,
33
+ ProviderID,
34
+ SearchTicketsBranch,
35
+ SearchTicketsBranchDefect,
36
+ SearchTicketsBranchInvalidResponse,
37
+ SearchTicketsBranchProviderRejected,
38
+ SearchTicketsBranchSearched,
39
+ SearchTicketsDefinition,
40
+ SearchTicketsInputSchema,
41
+ SearchTicketsMetadata,
42
+ SearchTicketsOutputSchema,
43
+ TicketConversationSchema,
44
+ TicketDetailsSchema,
45
+ TicketRequesterInputSchema,
46
+ TicketRequesterSchema,
47
+ TicketSchema,
48
+ UpdateTicketBranch,
49
+ UpdateTicketBranchDefect,
50
+ UpdateTicketBranchInvalidResponse,
51
+ UpdateTicketBranchNotFound,
52
+ UpdateTicketBranchProviderRejected,
53
+ UpdateTicketBranchUpdated,
54
+ UpdateTicketDefinition,
55
+ UpdateTicketInputSchema,
56
+ UpdateTicketMetadata,
57
+ UpdateTicketOutputSchema,
58
+ newConnection,
59
+ newConnectionWithOperations,
60
+ newProjectConnection
61
+ } from "./chunk-CLK5W7ZY.js";
62
+
63
+ // src/generated/steps.ts
64
+ import { goToBranch, newMutationStep, newQueryStep } from "@superdurable/connectors-sdk";
65
+ function newSearchTicketsStep(configuration) {
66
+ const { connection, connectionName, searched, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
67
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
68
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.searchTickets(), connection: connection.reference, branches: [
69
+ goToBranch("searched", searched),
70
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
71
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
72
+ ...defect ? [goToBranch("defect", defect)] : []
73
+ ] });
74
+ }
75
+ function newGetTicketStep(configuration) {
76
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
77
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
78
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getTicket(), connection: connection.reference, branches: [
79
+ goToBranch("found", found),
80
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
81
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
82
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
83
+ ...defect ? [goToBranch("defect", defect)] : []
84
+ ] });
85
+ }
86
+ function newCreateTicketStep(configuration) {
87
+ const { connection, connectionName, created, providerRejected, uncertain, defect, ...stepConfiguration } = configuration;
88
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
89
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.createTicket(), connection: connection.reference, branches: [
90
+ goToBranch("created", created),
91
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
92
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
93
+ ...defect ? [goToBranch("defect", defect)] : []
94
+ ] });
95
+ }
96
+ function newUpdateTicketStep(configuration) {
97
+ const { connection, connectionName, updated, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
98
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
99
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateTicket(), connection: connection.reference, branches: [
100
+ goToBranch("updated", updated),
101
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
102
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
103
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
104
+ ...defect ? [goToBranch("defect", defect)] : []
105
+ ] });
106
+ }
107
+ function newAddNoteStep(configuration) {
108
+ const { connection, connectionName, added, notFound, providerRejected, uncertain, defect, ...stepConfiguration } = configuration;
109
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
110
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.addNote(), connection: connection.reference, branches: [
111
+ goToBranch("added", added),
112
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
113
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
114
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
115
+ ...defect ? [goToBranch("defect", defect)] : []
116
+ ] });
117
+ }
118
+
119
+ // src/project.ts
120
+ import { SecretString as SecretString2 } from "@superdurable/connectors-sdk";
121
+
122
+ // src/client.ts
123
+ import { SecretString, ReauthorizationRequiredError } from "@superdurable/connectors-sdk";
124
+ import { AddressRefusal, BodyTooLargeError, ProviderTransportError, isHeaderSafeCredential, parseRetryAfter, readErrorTokens, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
125
+ import { ConnectionNotSelectedError, CredentialBrokerRejectedError, ObjectNotFoundError } from "@superdurable/connectors-sdk/projectconfig";
126
+
127
+ // src/operations.ts
128
+ import { newMutationBranch, newMutationRetry, newMutationUncertain, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
129
+ var zeroTicket = { id: 0, status: 0, priority: 0, createdAt: "0001-01-01T00:00:00Z", updatedAt: "0001-01-01T00:00:00Z" };
130
+ var zeroDetails = { ticket: zeroTicket, conversations: [] };
131
+ var zeroConversation = { id: 0, source: 0, isPrivate: false, body: "", createdAt: "0001-01-01T00:00:00Z" };
132
+ var tagPattern = /^[A-Za-z0-9](?:[A-Za-z0-9 _./+-]{0,62}[A-Za-z0-9_./+-])?$/;
133
+ var positive = (value) => Number.isSafeInteger(value) && value > 0;
134
+ var nonnegative = (value) => Number.isSafeInteger(value) && value >= 0;
135
+ function validateTags(tags) {
136
+ const seen = /* @__PURE__ */ new Set();
137
+ for (const tag of tags) {
138
+ if (!tagPattern.test(tag) || Buffer.byteLength(tag) > 64 || seen.has(tag.toLowerCase())) throw new TypeError("Freshdesk tag is invalid or duplicated");
139
+ seen.add(tag.toLowerCase());
140
+ }
141
+ }
142
+ function validateStatus(value) {
143
+ if (!Number.isSafeInteger(value) || value < 2) throw new TypeError("Freshdesk status is invalid");
144
+ }
145
+ function validatePriority(value) {
146
+ if (!Number.isSafeInteger(value) || value < 1 || value > 4) throw new TypeError("Freshdesk priority is invalid");
147
+ }
148
+ function validateText(value) {
149
+ if (!value?.trim()) throw new TypeError("Freshdesk text is required");
150
+ }
151
+ function validateEmail(value) {
152
+ if (!/^[A-Za-z0-9.!#$%&*+/=?^_`{|}~-]+@[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?$/.test(value) || value.includes("..") || value.startsWith(".") || value.slice(0, value.indexOf("@")).endsWith(".") || /["'()<>,;\s]/.test(value)) throw new TypeError("Freshdesk requester email is invalid");
153
+ }
154
+ function encodeHTML(text2) {
155
+ return text2.replaceAll("\r\n", "\n").replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&#34;").replaceAll("'", "&#39;").replaceAll("\n", "<br>");
156
+ }
157
+ function object(value) {
158
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("Freshdesk response is not an object");
159
+ return value;
160
+ }
161
+ function parse(body) {
162
+ return JSON.parse(Buffer.from(body).toString("utf8"));
163
+ }
164
+ function number(value) {
165
+ if (typeof value !== "number" || !Number.isSafeInteger(value)) throw new TypeError("Freshdesk numeric field is invalid");
166
+ return value;
167
+ }
168
+ function text(value) {
169
+ if (typeof value !== "string") throw new TypeError("Freshdesk text field is invalid");
170
+ return value;
171
+ }
172
+ function wireNumber(value) {
173
+ return value == null ? 0 : number(value);
174
+ }
175
+ function wireText(value) {
176
+ return value == null ? "" : text(value);
177
+ }
178
+ function wireBoolean(value) {
179
+ if (value == null) return false;
180
+ if (typeof value !== "boolean") throw new TypeError("Freshdesk boolean field is invalid");
181
+ return value;
182
+ }
183
+ function optionalField(value, name) {
184
+ return value ? { [name]: value } : {};
185
+ }
186
+ function timestamp(value) {
187
+ const raw = text(value);
188
+ const date = new Date(raw);
189
+ if (!Number.isFinite(date.getTime()) || !/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d+)?(?:Z|[+-]\d\d:\d\d)$/.test(raw)) throw new TypeError("Freshdesk timestamp is invalid");
190
+ return date.toISOString().replace(".000Z", "Z");
191
+ }
192
+ function truncated(value) {
193
+ const bytes = Buffer.from(value);
194
+ if (bytes.length <= 16384) return { text: value, isTruncated: false };
195
+ let end = 16384;
196
+ while (end > 0 && (bytes[end] & 192) === 128) end--;
197
+ return { text: bytes.subarray(0, end).toString("utf8"), isTruncated: true };
198
+ }
199
+ function ticket(value, expectedID = 0) {
200
+ const wire = object(value);
201
+ const id = number(wire.id);
202
+ const status = number(wire.status);
203
+ if (!positive(id) || status < 1 || expectedID && id !== expectedID) throw new TypeError("Freshdesk ticket ID or status is invalid");
204
+ const description = truncated(wireText(wire.description_text));
205
+ const tags = wire.tags === void 0 || wire.tags === null ? void 0 : wire.tags;
206
+ if (tags !== void 0 && (!Array.isArray(tags) || tags.some((item) => typeof item !== "string"))) throw new TypeError("Freshdesk ticket tags are invalid");
207
+ const result = {
208
+ id,
209
+ status,
210
+ priority: wireNumber(wire.priority),
211
+ createdAt: timestamp(wire.created_at),
212
+ updatedAt: timestamp(wire.updated_at),
213
+ ...optionalField(wireText(wire.subject), "subject"),
214
+ ...optionalField(description.text, "description"),
215
+ ...description.isTruncated ? { isDescriptionTruncated: true } : {},
216
+ ...optionalField(wireNumber(wire.source), "source"),
217
+ ...optionalField(wireText(wire.type), "type"),
218
+ ...optionalField(wireNumber(wire.requester_id), "requesterId"),
219
+ ...optionalField(wireNumber(wire.responder_id), "responderId"),
220
+ ...optionalField(wireNumber(wire.group_id), "groupId"),
221
+ ...optionalField(wireNumber(wire.company_id), "companyId"),
222
+ ...optionalField(wireNumber(wire.product_id), "productId"),
223
+ ...tags?.length ? { tags } : {},
224
+ ...wireBoolean(wire.is_escalated) ? { isEscalated: true } : {},
225
+ ...wireBoolean(wire.spam) ? { isSpam: true } : {}
226
+ };
227
+ if (wire.due_by) result.dueBy = timestamp(wire.due_by);
228
+ if (wire.fr_due_by) result.firstResponseDueBy = timestamp(wire.fr_due_by);
229
+ return result;
230
+ }
231
+ function conversation(value) {
232
+ const wire = object(value);
233
+ const id = number(wire.id);
234
+ if (!positive(id)) throw new TypeError("Freshdesk conversation ID is invalid");
235
+ const body = truncated(wireText(wire.body_text));
236
+ return {
237
+ id,
238
+ source: wireNumber(wire.source),
239
+ isPrivate: wireBoolean(wire.private),
240
+ body: body.text,
241
+ createdAt: timestamp(wire.created_at),
242
+ ...optionalField(wireNumber(wire.ticket_id), "ticketId"),
243
+ ...optionalField(wireNumber(wire.user_id), "userId"),
244
+ ...wireBoolean(wire.incoming) ? { isIncoming: true } : {},
245
+ ...body.isTruncated ? { isBodyTruncated: true } : {}
246
+ };
247
+ }
248
+ function queryFailure(client, call, operation, branch, value, kind, message, response, objectID = 0) {
249
+ return newQueryBranch(branch, value, client.receipt(call, response, objectID), client.failure(operation, kind, message));
250
+ }
251
+ function mutationFailure(client, call, operation, branch, value, kind, message, response, objectID = 0) {
252
+ return newMutationBranch(branch, value, client.receipt(call, response, objectID), client.failure(operation, kind, message));
253
+ }
254
+ function queryExchange(client, call, exchange, zero, notFoundBranch, objectID = 0) {
255
+ if (exchange.outcome === "succeeded") return void 0;
256
+ if (["rateLimited", "notSent", "serviceUnavailable", "unavailable"].includes(exchange.outcome)) return newQueryRetry(exchange.failure, exchange.retryAfterMs);
257
+ const branch = exchange.outcome === "notFound" ? notFoundBranch : exchange.outcome === "invalid" ? "invalidResponse" : exchange.outcome === "defect" ? "defect" : "providerRejected";
258
+ return newQueryBranch(branch, zero, client.receipt(call, exchange.response, objectID), exchange.failure);
259
+ }
260
+ function updateExchange(client, call, exchange, value, objectID) {
261
+ if (exchange.outcome === "succeeded") return void 0;
262
+ if (["rateLimited", "notSent", "serviceUnavailable", "unavailable"].includes(exchange.outcome)) return newMutationRetry(exchange.failure, exchange.retryAfterMs);
263
+ const branch = exchange.outcome === "notFound" ? "notFound" : exchange.outcome === "invalid" ? "invalidResponse" : exchange.outcome === "defect" ? "defect" : "providerRejected";
264
+ return newMutationBranch(branch, value, client.receipt(call, exchange.response, objectID), exchange.failure);
265
+ }
266
+ async function credential(client, call, operation) {
267
+ return client.resolveCredential(call, operation);
268
+ }
269
+ var SearchTicketsOperation = class {
270
+ /** Bind the API client. */
271
+ constructor(client) {
272
+ this.client = client;
273
+ }
274
+ client;
275
+ /** Return stable manifest metadata. */
276
+ definition() {
277
+ return SearchTicketsDefinition;
278
+ }
279
+ /** Validate filters, then perform at most two reads. */
280
+ async invoke(call, input) {
281
+ const operation = "searchTickets";
282
+ const zero = { tickets: [], totalMatched: 0 };
283
+ let filter;
284
+ try {
285
+ filter = buildFilter(input);
286
+ if (!nonnegative(input.page ?? 0) || (input.page ?? 0) > 10) throw new TypeError("page is invalid");
287
+ if (input.requesterEmail) validateEmail(input.requesterEmail);
288
+ } catch (error) {
289
+ return queryFailure(this.client, call, operation, "defect", zero, "VALIDATION", String(error));
290
+ }
291
+ const resolved = await credential(this.client, call, operation);
292
+ if ("failure" in resolved) return resolved.transient ? newQueryRetry(resolved.failure) : newQueryBranch("defect", zero, {}, resolved.failure);
293
+ let requesterIDs;
294
+ if (input.requesterEmail) {
295
+ const contact = await this.client.exchange(call, operation, resolved.key, "GET", "/contacts", new URLSearchParams({ email: input.requesterEmail }));
296
+ const terminal2 = queryExchange(this.client, call, contact, zero, "providerRejected");
297
+ if (terminal2) return terminal2;
298
+ try {
299
+ const rows = parse(contact.response.body);
300
+ if (!Array.isArray(rows)) throw new TypeError("contact list is not an array");
301
+ requesterIDs = /* @__PURE__ */ new Set();
302
+ for (const row of rows) {
303
+ const record = object(row);
304
+ const id = number(record.id);
305
+ if (!positive(id)) throw new TypeError("contact has no ID");
306
+ if (wireText(record.email).toLowerCase() === input.requesterEmail.toLowerCase()) requesterIDs.add(id);
307
+ }
308
+ } catch {
309
+ return queryFailure(this.client, call, operation, "invalidResponse", zero, "PROTOCOL", "Freshdesk returned an invalid contact list", contact.response);
310
+ }
311
+ if (requesterIDs.size === 0) return newQueryBranch("searched", { tickets: [], totalMatched: 0 }, this.client.receipt(call, contact.response));
312
+ }
313
+ const page = input.page || 1;
314
+ const response = await this.client.exchange(call, operation, resolved.key, "GET", "/search/tickets", new URLSearchParams({ query: `"${filter}"`, page: String(page) }));
315
+ const terminal = queryExchange(this.client, call, response, zero, "providerRejected");
316
+ if (terminal) return terminal;
317
+ try {
318
+ const wire = object(parse(response.response.body));
319
+ const total = number(wire.total);
320
+ if (total < 0 || !Array.isArray(wire.results) || wire.results.length > 30) throw new TypeError("invalid search page");
321
+ const tickets = wire.results.map((item) => ticket(item)).filter((item) => !requesterIDs || requesterIDs.has(item.requesterId ?? 0)).map((item) => {
322
+ delete item.description;
323
+ delete item.isDescriptionTruncated;
324
+ return item;
325
+ });
326
+ return newQueryBranch("searched", { tickets, totalMatched: total, ...page < 10 && page * 30 < total ? { nextPage: page + 1 } : {} }, this.client.receipt(call, response.response));
327
+ } catch {
328
+ return queryFailure(this.client, call, operation, "invalidResponse", zero, "PROTOCOL", "Freshdesk returned an invalid search page", response.response);
329
+ }
330
+ }
331
+ };
332
+ var GetTicketOperation = class {
333
+ /** Bind the API client. */
334
+ constructor(client) {
335
+ this.client = client;
336
+ }
337
+ client;
338
+ /** Return stable manifest metadata. */
339
+ definition() {
340
+ return GetTicketDefinition;
341
+ }
342
+ /** Perform the ticket and conversation reads. */
343
+ async invoke(call, input) {
344
+ const operation = "getTicket";
345
+ const zero = zeroDetails;
346
+ if (!positive(input.ticketId) || !nonnegative(input.conversationLimit ?? 0) || (input.conversationLimit ?? 0) > 20) return queryFailure(this.client, call, operation, "defect", zero, "VALIDATION", "ticketId or conversationLimit is invalid");
347
+ const resolved = await credential(this.client, call, operation);
348
+ if ("failure" in resolved) return resolved.transient ? newQueryRetry(resolved.failure) : newQueryBranch("defect", zero, {}, resolved.failure);
349
+ const path = `/tickets/${input.ticketId}`;
350
+ const first = await this.client.exchange(call, operation, resolved.key, "GET", path, new URLSearchParams({ include: "requester" }));
351
+ const terminal = queryExchange(this.client, call, first, zero, "notFound", input.ticketId);
352
+ if (terminal) return terminal;
353
+ let details;
354
+ try {
355
+ const wire = object(parse(first.response.body));
356
+ details = { ticket: ticket(wire, input.ticketId), conversations: [] };
357
+ if (wire.requester) {
358
+ const requester = object(wire.requester);
359
+ const id = number(requester.id);
360
+ if (positive(id)) {
361
+ if (id !== details.ticket.requesterId) throw new TypeError("requester mismatch");
362
+ details.requester = { id, ...optionalField(wireText(requester.name), "name"), ...optionalField(wireText(requester.email), "email") };
363
+ }
364
+ }
365
+ } catch {
366
+ return queryFailure(this.client, call, operation, "invalidResponse", zero, "PROTOCOL", "Freshdesk returned an invalid ticket", first.response, input.ticketId);
367
+ }
368
+ const limit = input.conversationLimit || 10;
369
+ const second = await this.client.exchange(call, operation, resolved.key, "GET", `${path}/conversations`, new URLSearchParams({ per_page: String(limit), page: "1" }));
370
+ const secondTerminal = queryExchange(this.client, call, second, zero, "notFound", input.ticketId);
371
+ if (secondTerminal) return secondTerminal;
372
+ try {
373
+ const rows = parse(second.response.body);
374
+ if (!Array.isArray(rows) || rows.length > limit) throw new TypeError("invalid conversation page");
375
+ details.conversations = rows.map((item) => conversation(item)).sort((left, right) => left.createdAt.localeCompare(right.createdAt) || left.id - right.id);
376
+ if (String(second.response.headers.link ?? "").includes('rel="next"')) details.hasMoreConversations = true;
377
+ return newQueryBranch("found", details, this.client.receipt(call, second.response, input.ticketId));
378
+ } catch {
379
+ return queryFailure(this.client, call, operation, "invalidResponse", zero, "PROTOCOL", "Freshdesk returned an invalid conversation page", second.response, input.ticketId);
380
+ }
381
+ }
382
+ };
383
+ function buildFilter(input) {
384
+ const clauses = [];
385
+ const any = (values) => {
386
+ if (values.length) clauses.push(values.length === 1 ? values[0] : `(${values.join(" OR ")})`);
387
+ };
388
+ const statuses = input.statuses ?? [];
389
+ statuses.forEach(validateStatus);
390
+ if (new Set(statuses).size !== statuses.length) throw new TypeError("duplicate statuses");
391
+ any(statuses.map((value) => `status:${value}`));
392
+ const priorities = input.priorities ?? [];
393
+ priorities.forEach(validatePriority);
394
+ if (new Set(priorities).size !== priorities.length) throw new TypeError("duplicate priorities");
395
+ any(priorities.map((value) => `priority:${value}`));
396
+ validateTags(input.tags ?? []);
397
+ any((input.tags ?? []).map((value) => `tag:'${value}'`));
398
+ if (input.updatedSinceDate) {
399
+ const date = /* @__PURE__ */ new Date(`${input.updatedSinceDate}T00:00:00Z`);
400
+ if (!/^\d{4}-\d\d-\d\d$/.test(input.updatedSinceDate) || !Number.isFinite(date.getTime()) || date.toISOString().slice(0, 10) !== input.updatedSinceDate) throw new TypeError("updatedSinceDate is invalid");
401
+ clauses.push(`updated_at:>'${input.updatedSinceDate}'`);
402
+ }
403
+ if (!clauses.length) throw new TypeError("at least one Freshdesk filter is required");
404
+ const query = clauses.join(" AND ");
405
+ if (Buffer.byteLength(query) + 2 > 512) throw new TypeError("Freshdesk filter is too long");
406
+ return query;
407
+ }
408
+ async function inspectDispatch(call) {
409
+ try {
410
+ if (!call.context.hasLastHeartbeatValue()) return call.context.attempt === 1 ? "allowed" : "uncertain";
411
+ const marker = call.context.getLastHeartbeatValue();
412
+ return marker?.freshdeskDispatchedCallId === call.id && marker.freshdeskRetryAttempt === call.context.attempt ? "allowed" : "uncertain";
413
+ } catch {
414
+ return "uncertain";
415
+ }
416
+ }
417
+ async function recordDispatch(call) {
418
+ try {
419
+ await call.context.recordHeartbeat({ freshdeskDispatchedCallId: call.id, freshdeskDispatchedAttempt: call.context.attempt });
420
+ return true;
421
+ } catch {
422
+ await permitRetry(call);
423
+ return false;
424
+ }
425
+ }
426
+ async function permitRetry(call) {
427
+ try {
428
+ await call.context.recordHeartbeat({ freshdeskDispatchedCallId: call.id, freshdeskRetryAttempt: call.context.attempt + 1 });
429
+ } catch {
430
+ }
431
+ }
432
+ async function singleDispatchExchange(client, call, exchange, zero, notFoundBranch = "providerRejected") {
433
+ if (exchange.outcome === "succeeded") return void 0;
434
+ if (["rateLimited", "notSent", "serviceUnavailable"].includes(exchange.outcome)) {
435
+ await permitRetry(call);
436
+ return newMutationRetry(exchange.failure, exchange.retryAfterMs);
437
+ }
438
+ if (exchange.outcome === "unavailable" || exchange.outcome === "invalid") return newMutationUncertain(zero, exchange.failure, client.receipt(call, exchange.response));
439
+ const branch = exchange.outcome === "notFound" ? notFoundBranch : exchange.outcome === "defect" ? "defect" : "providerRejected";
440
+ return newMutationBranch(branch, zero, client.receipt(call, exchange.response), exchange.failure);
441
+ }
442
+ async function beforeSingleDispatch(client, call, operation, zero) {
443
+ if (await inspectDispatch(call) === "uncertain") return newMutationUncertain(zero, client.failure(operation, "TRANSPORT", "an earlier attempt of this Step may have sent the request, so it is not sent again"), client.receipt(call));
444
+ return void 0;
445
+ }
446
+ var CreateTicketOperation = class {
447
+ /** Bind the API client. */
448
+ constructor(client) {
449
+ this.client = client;
450
+ }
451
+ client;
452
+ /** Return stable manifest metadata. */
453
+ definition() {
454
+ return CreateTicketDefinition;
455
+ }
456
+ /** Correlate the mutation by Call ID; Freshdesk does not receive this key. */
457
+ idempotencyKey(callID) {
458
+ return callID;
459
+ }
460
+ /** Validate, checkpoint, and send at most once per safe attempt. */
461
+ async invoke(call, input) {
462
+ const operation = "createTicket";
463
+ const zero = { ticket: zeroTicket };
464
+ try {
465
+ validateText(input.subject);
466
+ validateText(input.description);
467
+ validateEmail(input.requester.email);
468
+ if (input.requester.name && input.requester.name !== input.requester.name.trim()) throw new TypeError("requester name has surrounding spaces");
469
+ if (input.status) validateStatus(input.status);
470
+ if (input.priority) validatePriority(input.priority);
471
+ if (input.type && (input.type !== input.type.trim() || Buffer.byteLength(input.type) > 255)) throw new TypeError("ticket type is invalid");
472
+ validateTags(input.tags ?? []);
473
+ if (!nonnegative(input.groupId ?? 0) || !nonnegative(input.responderId ?? 0)) throw new TypeError("assignment ID is invalid");
474
+ } catch {
475
+ return mutationFailure(this.client, call, operation, "defect", zero, "VALIDATION", "Freshdesk create input is invalid");
476
+ }
477
+ const prior = await beforeSingleDispatch(this.client, call, operation, zero);
478
+ if (prior) return prior;
479
+ const resolved = await credential(this.client, call, operation);
480
+ if ("failure" in resolved) {
481
+ if (resolved.transient || call.context.attempt > 1) {
482
+ await permitRetry(call);
483
+ return newMutationRetry(resolved.failure);
484
+ }
485
+ return newMutationBranch("defect", zero, {}, resolved.failure);
486
+ }
487
+ if (!await recordDispatch(call)) return newMutationRetry(this.client.failure(operation, "AVAILABILITY", "Dex did not record the dispatch checkpoint; nothing was sent"));
488
+ const request = {
489
+ subject: input.subject,
490
+ description: encodeHTML(input.description),
491
+ email: input.requester.email,
492
+ ...input.requester.name ? { name: input.requester.name } : {},
493
+ ...input.status ? { status: input.status } : {},
494
+ ...input.priority ? { priority: input.priority } : {},
495
+ ...input.type ? { type: input.type } : {},
496
+ ...input.tags?.length ? { tags: input.tags } : {},
497
+ ...input.groupId ? { group_id: input.groupId } : {},
498
+ ...input.responderId ? { responder_id: input.responderId } : {}
499
+ };
500
+ const exchange = await this.client.exchange(call, operation, resolved.key, "POST", "/tickets", void 0, request);
501
+ const terminal = await singleDispatchExchange(this.client, call, exchange, zero);
502
+ if (terminal) return terminal;
503
+ try {
504
+ const created = ticket(parse(exchange.response.body));
505
+ return newMutationBranch("created", { ticket: created }, this.client.receipt(call, exchange.response, created.id));
506
+ } catch {
507
+ return newMutationUncertain(zero, this.client.failure(operation, "PROTOCOL", "Freshdesk accepted the ticket but returned an invalid ticket"), this.client.receipt(call, exchange.response));
508
+ }
509
+ }
510
+ };
511
+ var UpdateTicketOperation = class {
512
+ /** Bind the API client. */
513
+ constructor(client) {
514
+ this.client = client;
515
+ }
516
+ client;
517
+ /** Return stable manifest metadata. */
518
+ definition() {
519
+ return UpdateTicketDefinition;
520
+ }
521
+ /** Correlate the absolute replacement by Call ID. */
522
+ idempotencyKey(callID) {
523
+ return callID;
524
+ }
525
+ /** Read, diff, and write only when a field differs. */
526
+ async invoke(call, input) {
527
+ const operation = "updateTicket";
528
+ const zero = { ticket: zeroTicket };
529
+ try {
530
+ if (!positive(input.ticketId)) throw new TypeError("ticket ID is invalid");
531
+ if (input.status) validateStatus(input.status);
532
+ if (input.priority) validatePriority(input.priority);
533
+ if (!nonnegative(input.groupId ?? 0) || !nonnegative(input.responderId ?? 0)) throw new TypeError("assignment ID is invalid");
534
+ validateTags(input.addTags ?? []);
535
+ validateTags(input.removeTags ?? []);
536
+ if ((input.addTags ?? []).some((tag) => (input.removeTags ?? []).some((other) => other.toLowerCase() === tag.toLowerCase()))) throw new TypeError("tag appears in both changes");
537
+ if (!input.status && !input.priority && !input.groupId && !input.responderId && !input.addTags?.length && !input.removeTags?.length) throw new TypeError("no ticket change");
538
+ } catch {
539
+ return mutationFailure(this.client, call, operation, "defect", zero, "VALIDATION", "Freshdesk update input is invalid");
540
+ }
541
+ const resolved = await credential(this.client, call, operation);
542
+ if ("failure" in resolved) return resolved.transient ? newMutationRetry(resolved.failure) : newMutationBranch("defect", zero, {}, resolved.failure);
543
+ const path = `/tickets/${input.ticketId}`;
544
+ const read = await this.client.exchange(call, operation, resolved.key, "GET", path);
545
+ const readTerminal = updateExchange(this.client, call, read, zero, input.ticketId);
546
+ if (readTerminal) return readTerminal;
547
+ let current;
548
+ try {
549
+ current = ticket(parse(read.response.body), input.ticketId);
550
+ } catch {
551
+ return mutationFailure(this.client, call, operation, "invalidResponse", zero, "PROTOCOL", "Freshdesk returned an invalid ticket", read.response, input.ticketId);
552
+ }
553
+ const change = {};
554
+ if (input.status && input.status !== current.status) change.status = input.status;
555
+ if (input.priority && input.priority !== current.priority) change.priority = input.priority;
556
+ if (input.groupId && input.groupId !== current.groupId) change.group_id = input.groupId;
557
+ if (input.responderId && input.responderId !== current.responderId) change.responder_id = input.responderId;
558
+ const tags = (current.tags ?? []).filter((tag) => !(input.removeTags ?? []).some((other) => other.toLowerCase() === tag.toLowerCase()));
559
+ for (const tag of input.addTags ?? []) if (!tags.some((existing) => existing.toLowerCase() === tag.toLowerCase())) tags.push(tag);
560
+ if (JSON.stringify(tags) !== JSON.stringify(current.tags ?? [])) change.tags = tags;
561
+ if (!Object.keys(change).length) return newMutationBranch("updated", { ticket: current, wasAlreadyApplied: true }, this.client.receipt(call, read.response, input.ticketId));
562
+ const write = await this.client.exchange(call, operation, resolved.key, "PUT", path, void 0, change);
563
+ const writeTerminal = updateExchange(this.client, call, write, { ticket: current }, input.ticketId);
564
+ if (writeTerminal) return writeTerminal;
565
+ try {
566
+ return newMutationBranch("updated", { ticket: ticket(parse(write.response.body), input.ticketId) }, this.client.receipt(call, write.response, input.ticketId));
567
+ } catch {
568
+ return mutationFailure(this.client, call, operation, "invalidResponse", { ticket: current }, "PROTOCOL", "Freshdesk returned an invalid updated ticket", write.response, input.ticketId);
569
+ }
570
+ }
571
+ };
572
+ var AddNoteOperation = class {
573
+ /** Bind the API client. */
574
+ constructor(client) {
575
+ this.client = client;
576
+ }
577
+ client;
578
+ /** Return stable manifest metadata. */
579
+ definition() {
580
+ return AddNoteDefinition;
581
+ }
582
+ /** Correlate the mutation by Call ID; Freshdesk does not receive this key. */
583
+ idempotencyKey(callID) {
584
+ return callID;
585
+ }
586
+ /** Validate, checkpoint, and send one note or reply. */
587
+ async invoke(call, input) {
588
+ const operation = "addNote";
589
+ const zero = { conversation: zeroConversation };
590
+ if (!positive(input.ticketId) || !input.body?.trim()) return mutationFailure(this.client, call, operation, "defect", zero, "VALIDATION", "Freshdesk note input is invalid");
591
+ const prior = await beforeSingleDispatch(this.client, call, operation, zero);
592
+ if (prior) return prior;
593
+ const resolved = await credential(this.client, call, operation);
594
+ if ("failure" in resolved) {
595
+ if (resolved.transient || call.context.attempt > 1) {
596
+ await permitRetry(call);
597
+ return newMutationRetry(resolved.failure);
598
+ }
599
+ return newMutationBranch("defect", zero, {}, resolved.failure);
600
+ }
601
+ if (!await recordDispatch(call)) return newMutationRetry(this.client.failure(operation, "AVAILABILITY", "Dex did not record the dispatch checkpoint; nothing was sent"));
602
+ const path = `/tickets/${input.ticketId}/${input.isPublicReply ? "reply" : "notes"}`;
603
+ const payload = input.isPublicReply ? { body: encodeHTML(input.body) } : { body: encodeHTML(input.body), private: true };
604
+ const exchange = await this.client.exchange(call, operation, resolved.key, "POST", path, void 0, payload);
605
+ const terminal = await singleDispatchExchange(this.client, call, exchange, zero, "notFound");
606
+ if (terminal) return terminal;
607
+ try {
608
+ const wire = object(parse(exchange.response.body));
609
+ const added = conversation(wire);
610
+ if (added.ticketId && added.ticketId !== input.ticketId) throw new TypeError("conversation belongs to another ticket");
611
+ added.ticketId = input.ticketId;
612
+ added.source = input.isPublicReply ? 0 : 2;
613
+ added.isPrivate = input.isPublicReply ? false : wire.private !== false;
614
+ return newMutationBranch("added", { conversation: added }, this.client.receipt(call, exchange.response, added.id));
615
+ } catch {
616
+ return newMutationUncertain(zero, this.client.failure(operation, "PROTOCOL", "Freshdesk accepted the note but returned an invalid conversation"), this.client.receipt(call, exchange.response));
617
+ }
618
+ }
619
+ };
620
+
621
+ // src/client.ts
622
+ var domainPattern = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
623
+ var requestIDPattern = /^[A-Za-z0-9._:-]{1,128}$/;
624
+ var errorFieldPattern = /^[a-z][a-z0-9_]{0,63}$/;
625
+ var FreshdeskClient = class {
626
+ /** Bind immutable configuration and a live credential source. */
627
+ constructor(config, credentials, options = {}) {
628
+ this.credentials = credentials;
629
+ if (!domainPattern.test(config.domain)) throw new TypeError("Freshdesk domain is invalid");
630
+ if (!credentials) throw new TypeError("Freshdesk credential provider is required");
631
+ this.maxResponseBytes = config.maxResponseBytes ?? 4194304;
632
+ if (!Number.isSafeInteger(this.maxResponseBytes) || this.maxResponseBytes < 1) throw new TypeError("Freshdesk response limit must be positive");
633
+ this.apiBaseURL = validateBaseURL(options.apiBaseURL ?? `https://${config.domain}.freshdesk.com/api/v2`);
634
+ this.send = options.send ?? sendProviderRequest;
635
+ this.now = options.now ?? (() => /* @__PURE__ */ new Date());
636
+ }
637
+ credentials;
638
+ apiBaseURL;
639
+ maxResponseBytes;
640
+ send;
641
+ now;
642
+ /** Bind the search query. */
643
+ searchTickets() {
644
+ return new SearchTicketsOperation(this);
645
+ }
646
+ /** Bind the ticket read query. */
647
+ getTicket() {
648
+ return new GetTicketOperation(this);
649
+ }
650
+ /** Bind the ticket creation mutation. */
651
+ createTicket() {
652
+ return new CreateTicketOperation(this);
653
+ }
654
+ /** Bind the ticket update mutation. */
655
+ updateTicket() {
656
+ return new UpdateTicketOperation(this);
657
+ }
658
+ /** Bind the note mutation. */
659
+ addNote() {
660
+ return new AddNoteOperation(this);
661
+ }
662
+ /** Resolve the current API key, classifying terminal credential states. */
663
+ async resolveCredential(call, operation) {
664
+ let credential2;
665
+ try {
666
+ credential2 = await this.credentials.resolve(call, call.context.cancellationSignal);
667
+ } catch (error) {
668
+ const terminal = error instanceof ObjectNotFoundError || error instanceof ReauthorizationRequiredError || error instanceof ConnectionNotSelectedError || error instanceof CredentialBrokerRejectedError;
669
+ return { failure: this.failure(operation, terminal ? "AUTHENTICATION" : "AVAILABILITY", terminal ? "connection credentials are unavailable" : "connection credentials could not be read; no request was sent"), transient: !terminal };
670
+ }
671
+ if (!(credential2.apiKey instanceof SecretString) || !isHeaderSafeCredential(credential2.apiKey.reveal()) || credential2.apiKey.reveal().includes(":")) {
672
+ return { failure: this.failure(operation, "AUTHENTICATION", "connection credentials are unavailable"), transient: false };
673
+ }
674
+ return { key: credential2.apiKey.reveal() };
675
+ }
676
+ /** Send one bounded request and classify its observable outcome. */
677
+ async exchange(call, operation, key, method, path, query, payload, signal) {
678
+ const url = `${this.apiBaseURL}${path}${query ? `?${query.toString()}` : ""}`;
679
+ const headers = { Accept: "application/json", Authorization: `Basic ${Buffer.from(`${key}:X`).toString("base64")}` };
680
+ let body;
681
+ if (payload !== void 0) {
682
+ try {
683
+ body = Buffer.from(JSON.stringify(payload));
684
+ headers["Content-Type"] = "application/json";
685
+ } catch {
686
+ return { outcome: "defect", failure: this.failure(operation, "LOCAL_DEFECT", "Freshdesk request could not be built"), retryAfterMs: 0 };
687
+ }
688
+ }
689
+ try {
690
+ const response = await this.send({ url, method, headers, ...body ? { body } : {}, maxResponseBytes: this.maxResponseBytes, addressPolicy: this.apiBaseURL.startsWith("https://") ? "publicHTTPS" : "privateNetworkHTTP", timeoutMs: 12e3, signal: signal ?? call.context.cancellationSignal });
691
+ if (response.status >= 200 && response.status < 300) {
692
+ if (Buffer.from(response.body).includes(Buffer.from(key))) return { outcome: "invalid", response, failure: this.failure(operation, "PROTOCOL", "Freshdesk response reflected the connection credential"), retryAfterMs: 0 };
693
+ return { outcome: "succeeded", response };
694
+ }
695
+ return this.classifyStatus(operation, key, response);
696
+ } catch (error) {
697
+ if (error instanceof BodyTooLargeError) {
698
+ if (error.status !== void 0 && (error.status < 200 || error.status >= 300)) {
699
+ return this.classifyStatus(operation, key, { status: error.status, headers: error.headers ?? {}, body: new Uint8Array() });
700
+ }
701
+ return { outcome: "invalid", failure: this.failure(operation, "RESPONSE_TOO_LARGE", "Freshdesk response exceeds the configured maxResponseBytes limit"), retryAfterMs: 0 };
702
+ }
703
+ if (error instanceof AddressRefusal) return { outcome: "notSent", failure: this.failure(operation, "TRANSPORT", "Freshdesk could not be reached; no request was sent"), retryAfterMs: 0 };
704
+ if (error instanceof ProviderTransportError && error.isProvablyNotSent) return { outcome: "notSent", failure: this.failure(operation, "TRANSPORT", "Freshdesk could not be reached; no request was sent"), retryAfterMs: 0 };
705
+ return { outcome: "unavailable", failure: this.failure(operation, "TRANSPORT", "Freshdesk request failed before a response arrived"), retryAfterMs: 0 };
706
+ }
707
+ }
708
+ classifyStatus(operation, key, response) {
709
+ const status = response.status;
710
+ const retryAfterMs = parseRetryAfter(String(response.headers["retry-after"] ?? ""), this.now());
711
+ let outcome;
712
+ let kind;
713
+ let message;
714
+ if (status === 429) {
715
+ outcome = "rateLimited";
716
+ kind = "RATE_LIMIT";
717
+ message = "Freshdesk rate limited the request (HTTP 429)";
718
+ } else if (status === 503) {
719
+ outcome = "serviceUnavailable";
720
+ kind = "AVAILABILITY";
721
+ message = "Freshdesk is unavailable (HTTP 503)";
722
+ } else if (status === 408 || status >= 500) {
723
+ outcome = "unavailable";
724
+ kind = "AVAILABILITY";
725
+ message = `Freshdesk could not complete the request (HTTP ${status})`;
726
+ } else if (status === 404) {
727
+ outcome = "notFound";
728
+ kind = "NOT_FOUND";
729
+ message = "Freshdesk found no such resource (HTTP 404)";
730
+ } else if (status >= 300 && status < 400) {
731
+ outcome = "rejected";
732
+ kind = "PROTOCOL";
733
+ message = `Freshdesk redirected the request (HTTP ${status}); check that the domain is the freshdesk.com helpdesk domain`;
734
+ } else {
735
+ outcome = "rejected";
736
+ kind = status === 401 ? "AUTHENTICATION" : status === 403 ? "AUTHORIZATION" : status === 409 ? "CONFLICT" : status === 400 ? "VALIDATION" : "PROVIDER_REJECTION";
737
+ message = `Freshdesk rejected the request (HTTP ${status})`;
738
+ }
739
+ if (status < 300 || status >= 400) message += safeErrorSummary(response.body, key);
740
+ return { outcome, response, failure: this.failure(operation, kind, message), retryAfterMs };
741
+ }
742
+ /** Build secret-free failure metadata. */
743
+ failure(operation, kind, message) {
744
+ return { kind, provider: "freshdesk", operation, message };
745
+ }
746
+ /** Build a stable receipt after provider observation. */
747
+ receipt(call, response, objectID = 0) {
748
+ const requestID = response?.headers["x-request-id"];
749
+ const safeID = typeof requestID === "string" && requestIDPattern.test(requestID) ? requestID : "";
750
+ return { callId: call.id, provider: "freshdesk", observedAt: this.now().toISOString(), ...call.idempotencyKey ? { idempotencyKey: call.idempotencyKey } : {}, ...safeID ? { providerRequestId: safeID } : {}, ...objectID > 0 ? { providerObjectId: String(objectID) } : {} };
751
+ }
752
+ };
753
+ function safeErrorSummary(body, secret) {
754
+ const code = readErrorTokens(body, ["/code"])[0];
755
+ let document;
756
+ try {
757
+ document = JSON.parse(Buffer.from(body).toString("utf8"));
758
+ } catch {
759
+ document = null;
760
+ }
761
+ const errors = document && typeof document === "object" && "errors" in document && Array.isArray(document.errors) ? document.errors : [];
762
+ const fields = [];
763
+ errors.forEach((_, index) => {
764
+ const field = readErrorTokens(body, [`/errors/${index}/field`])[0];
765
+ const fieldCode = readErrorTokens(body, [`/errors/${index}/code`])[0];
766
+ if (field && errorFieldPattern.test(field) && !field.includes(secret)) fields.push(field + (fieldCode && !fieldCode.includes(secret) ? `=${fieldCode}` : ""));
767
+ });
768
+ const details = [...code && !code.includes(secret) ? [code] : [], ...fields.length ? [`errors: ${fields.sort().slice(0, 5).join(", ")}`] : []];
769
+ return details.length ? ` [${details.join("; ")}]` : "";
770
+ }
771
+
772
+ // src/project.ts
773
+ function newProjectConnection2(project, connectionName) {
774
+ return newProjectConnection(project, connectionName, (loaded, name) => {
775
+ const selected = loaded.configuration.connections.find((entry) => entry.connectorId === "freshdesk" && entry.connectionName === name);
776
+ if (!selected) throw new TypeError("Freshdesk project connection is not configured");
777
+ const config = ConfigSchema.parse(selected.configuration);
778
+ const credentials = {
779
+ async resolve(call, signal) {
780
+ void call;
781
+ const fields = await loaded.resolveCredential("freshdesk", name, signal);
782
+ const apiKey = fields.api_key;
783
+ if (typeof apiKey !== "string" || !apiKey) throw new TypeError("Freshdesk API key is unavailable");
784
+ return { apiKey: new SecretString2(apiKey) };
785
+ }
786
+ };
787
+ return new FreshdeskClient({ domain: config.domain, ...config.maxResponseBytes !== void 0 ? { maxResponseBytes: config.maxResponseBytes } : {} }, credentials);
788
+ });
789
+ }
790
+ export {
791
+ AddNoteBranch,
792
+ AddNoteBranchAdded,
793
+ AddNoteBranchDefect,
794
+ AddNoteBranchNotFound,
795
+ AddNoteBranchProviderRejected,
796
+ AddNoteBranchUncertain,
797
+ AddNoteDefinition,
798
+ AddNoteInputSchema,
799
+ AddNoteMetadata,
800
+ AddNoteOperation,
801
+ AddNoteOutputSchema,
802
+ ConfigSchema,
803
+ Connection,
804
+ ConnectorID,
805
+ CreateTicketBranch,
806
+ CreateTicketBranchCreated,
807
+ CreateTicketBranchDefect,
808
+ CreateTicketBranchProviderRejected,
809
+ CreateTicketBranchUncertain,
810
+ CreateTicketDefinition,
811
+ CreateTicketInputSchema,
812
+ CreateTicketMetadata,
813
+ CreateTicketOperation,
814
+ CreateTicketOutputSchema,
815
+ FreshdeskClient,
816
+ GetTicketBranch,
817
+ GetTicketBranchDefect,
818
+ GetTicketBranchFound,
819
+ GetTicketBranchInvalidResponse,
820
+ GetTicketBranchNotFound,
821
+ GetTicketBranchProviderRejected,
822
+ GetTicketDefinition,
823
+ GetTicketInputSchema,
824
+ GetTicketMetadata,
825
+ GetTicketOperation,
826
+ ProviderID,
827
+ SearchTicketsBranch,
828
+ SearchTicketsBranchDefect,
829
+ SearchTicketsBranchInvalidResponse,
830
+ SearchTicketsBranchProviderRejected,
831
+ SearchTicketsBranchSearched,
832
+ SearchTicketsDefinition,
833
+ SearchTicketsInputSchema,
834
+ SearchTicketsMetadata,
835
+ SearchTicketsOperation,
836
+ SearchTicketsOutputSchema,
837
+ TicketConversationSchema,
838
+ TicketDetailsSchema,
839
+ TicketRequesterInputSchema,
840
+ TicketRequesterSchema,
841
+ TicketSchema,
842
+ UpdateTicketBranch,
843
+ UpdateTicketBranchDefect,
844
+ UpdateTicketBranchInvalidResponse,
845
+ UpdateTicketBranchNotFound,
846
+ UpdateTicketBranchProviderRejected,
847
+ UpdateTicketBranchUpdated,
848
+ UpdateTicketDefinition,
849
+ UpdateTicketInputSchema,
850
+ UpdateTicketMetadata,
851
+ UpdateTicketOperation,
852
+ UpdateTicketOutputSchema,
853
+ newAddNoteStep,
854
+ newConnection,
855
+ newConnectionWithOperations,
856
+ newCreateTicketStep,
857
+ newGetTicketStep,
858
+ newProjectConnection2 as newProjectConnection,
859
+ newSearchTicketsStep,
860
+ newUpdateTicketStep
861
+ };