@superdurable/connector-freshdesk 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +30 -2
- package/dex-connector.json +449 -0
- package/dist/chunk-SSAMOXWJ.js +359 -0
- package/dist/connection-Lx6ZBW6r.d.ts +487 -0
- package/dist/index.d.ts +526 -0
- package/dist/index.js +1279 -0
- package/dist/mock.d.ts +145 -0
- package/dist/mock.js +350 -0
- package/package.json +62 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
import { A as AddNoteInput, a as AddNoteOutput, C as Connection, b as CreateTicketInput, c as CreateTicketOutput, G as GetTicketInput, T as TicketDetails, S as SearchTicketsInput, d as SearchTicketsOutput, U as UpdateTicketInput, e as UpdateTicketOutput, f as Credentials, g as Config, O as Operations, h as Ticket } from './connection-Lx6ZBW6r.js';
|
|
2
|
+
export { i as AddNoteInputSchema, j as AddNoteOutputSchema, k as ConfigSchema, l as CreateTicketInputSchema, m as CreateTicketOutputSchema, n as CredentialSource, o as GetTicketInputSchema, p as SearchTicketsInputSchema, q as SearchTicketsOutputSchema, r as TicketConversation, s as TicketConversationSchema, t as TicketDetailsSchema, u as TicketRequester, v as TicketRequesterInput, w as TicketRequesterInputSchema, x as TicketRequesterSchema, y as TicketSchema, z as UpdateTicketInputSchema, B as UpdateTicketOutputSchema, D as decodeCredentials, E as newConnection, F as newConnectionWithOperations } from './connection-Lx6ZBW6r.js';
|
|
3
|
+
import * as _superdurable_connectors_sdk from '@superdurable/connectors-sdk';
|
|
4
|
+
import { MutationDefinition, QueryDefinition, MutationStepConfig, Mutation, MutationResult, QueryStepConfig, Query, QueryResult, MutationStep, QueryStep, Call, QueryAttempt, MutationAttempt, CredentialProvider, TriggerLogger, Failure, ReceiptDraft, ConnectorConfigurationUI, TriggerDefinition, TriggerBindingDefinition, TriggerEvent, ConnectionRef, TriggerContext, TriggerTarget, TriggerRunner } from '@superdurable/connectors-sdk';
|
|
5
|
+
import { StepTarget } from '@superdurable/dex';
|
|
6
|
+
import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
|
|
7
|
+
import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { ChangeFetcher, Cursor, ChangePage, CursorStore, Runner } from '@superdurable/connectors-sdk/pollingtrigger';
|
|
10
|
+
|
|
11
|
+
/** Stable connector identity. */
|
|
12
|
+
declare const ConnectorID = "freshdesk";
|
|
13
|
+
/** Provider identity for named connections. */
|
|
14
|
+
declare const ProviderID = "freshdesk";
|
|
15
|
+
/** Branch IDs for searchTickets. */
|
|
16
|
+
declare const SearchTicketsBranch: {
|
|
17
|
+
readonly Searched: "searched";
|
|
18
|
+
readonly ProviderRejected: "providerRejected";
|
|
19
|
+
readonly InvalidResponse: "invalidResponse";
|
|
20
|
+
readonly Defect: "defect";
|
|
21
|
+
};
|
|
22
|
+
/** One page of matching tickets was returned; it may be empty. */
|
|
23
|
+
declare const SearchTicketsBranchSearched: "searched";
|
|
24
|
+
/** Freshdesk conclusively rejected the search, such as invalid credentials, a missing permission, or an unknown status. */
|
|
25
|
+
declare const SearchTicketsBranchProviderRejected: "providerRejected";
|
|
26
|
+
/** Freshdesk returned an invalid or oversized contact list or search page. */
|
|
27
|
+
declare const SearchTicketsBranchInvalidResponse: "invalidResponse";
|
|
28
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
29
|
+
declare const SearchTicketsBranchDefect: "defect";
|
|
30
|
+
/** Manifest definition for searchTickets. */
|
|
31
|
+
declare const SearchTicketsDefinition: QueryDefinition;
|
|
32
|
+
/** Manifest metadata for searchTickets. */
|
|
33
|
+
declare const SearchTicketsMetadata: {
|
|
34
|
+
readonly kind: "query";
|
|
35
|
+
readonly idempotency: "none";
|
|
36
|
+
readonly authorization: "required";
|
|
37
|
+
};
|
|
38
|
+
/** Branch IDs for getTicket. */
|
|
39
|
+
declare const GetTicketBranch: {
|
|
40
|
+
readonly Found: "found";
|
|
41
|
+
readonly NotFound: "notFound";
|
|
42
|
+
readonly ProviderRejected: "providerRejected";
|
|
43
|
+
readonly InvalidResponse: "invalidResponse";
|
|
44
|
+
readonly Defect: "defect";
|
|
45
|
+
};
|
|
46
|
+
/** The ticket and its first conversations were read. */
|
|
47
|
+
declare const GetTicketBranchFound: "found";
|
|
48
|
+
/** The ticket does not exist or is not visible to the connection's agent. */
|
|
49
|
+
declare const GetTicketBranchNotFound: "notFound";
|
|
50
|
+
/** Freshdesk conclusively rejected the ticket read. */
|
|
51
|
+
declare const GetTicketBranchProviderRejected: "providerRejected";
|
|
52
|
+
/** Freshdesk returned an invalid or oversized ticket or conversation page. */
|
|
53
|
+
declare const GetTicketBranchInvalidResponse: "invalidResponse";
|
|
54
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
55
|
+
declare const GetTicketBranchDefect: "defect";
|
|
56
|
+
/** Manifest definition for getTicket. */
|
|
57
|
+
declare const GetTicketDefinition: QueryDefinition;
|
|
58
|
+
/** Manifest metadata for getTicket. */
|
|
59
|
+
declare const GetTicketMetadata: {
|
|
60
|
+
readonly kind: "query";
|
|
61
|
+
readonly idempotency: "none";
|
|
62
|
+
readonly authorization: "required";
|
|
63
|
+
};
|
|
64
|
+
/** Branch IDs for createTicket. */
|
|
65
|
+
declare const CreateTicketBranch: {
|
|
66
|
+
readonly Created: "created";
|
|
67
|
+
readonly ProviderRejected: "providerRejected";
|
|
68
|
+
readonly Uncertain: "uncertain";
|
|
69
|
+
readonly Defect: "defect";
|
|
70
|
+
};
|
|
71
|
+
/** Freshdesk created the ticket and returned it. */
|
|
72
|
+
declare const CreateTicketBranchCreated: "created";
|
|
73
|
+
/** Freshdesk conclusively rejected the ticket, such as an unknown status, group, or agent; no ticket was created. */
|
|
74
|
+
declare const CreateTicketBranchProviderRejected: "providerRejected";
|
|
75
|
+
/** The request was sent but its outcome cannot be confirmed, so the ticket may exist; the connector never resends it. */
|
|
76
|
+
declare const CreateTicketBranchUncertain: "uncertain";
|
|
77
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
78
|
+
declare const CreateTicketBranchDefect: "defect";
|
|
79
|
+
/** Manifest definition for createTicket. */
|
|
80
|
+
declare const CreateTicketDefinition: MutationDefinition;
|
|
81
|
+
/** Manifest metadata for createTicket. */
|
|
82
|
+
declare const CreateTicketMetadata: {
|
|
83
|
+
readonly kind: "mutation";
|
|
84
|
+
readonly idempotency: "required";
|
|
85
|
+
readonly authorization: "required";
|
|
86
|
+
};
|
|
87
|
+
/** Branch IDs for updateTicket. */
|
|
88
|
+
declare const UpdateTicketBranch: {
|
|
89
|
+
readonly Updated: "updated";
|
|
90
|
+
readonly NotFound: "notFound";
|
|
91
|
+
readonly ProviderRejected: "providerRejected";
|
|
92
|
+
readonly InvalidResponse: "invalidResponse";
|
|
93
|
+
readonly Defect: "defect";
|
|
94
|
+
};
|
|
95
|
+
/** The ticket holds the requested values, written now or by an earlier attempt. */
|
|
96
|
+
declare const UpdateTicketBranchUpdated: "updated";
|
|
97
|
+
/** The ticket does not exist or is not visible to the connection's agent. */
|
|
98
|
+
declare const UpdateTicketBranchNotFound: "notFound";
|
|
99
|
+
/** Freshdesk conclusively rejected the change, such as an unknown status, a missing required field, or a spam or deleted ticket. */
|
|
100
|
+
declare const UpdateTicketBranchProviderRejected: "providerRejected";
|
|
101
|
+
/** Freshdesk returned an invalid or oversized ticket, so the change may have been applied. */
|
|
102
|
+
declare const UpdateTicketBranchInvalidResponse: "invalidResponse";
|
|
103
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
104
|
+
declare const UpdateTicketBranchDefect: "defect";
|
|
105
|
+
/** Manifest definition for updateTicket. */
|
|
106
|
+
declare const UpdateTicketDefinition: MutationDefinition;
|
|
107
|
+
/** Manifest metadata for updateTicket. */
|
|
108
|
+
declare const UpdateTicketMetadata: {
|
|
109
|
+
readonly kind: "mutation";
|
|
110
|
+
readonly idempotency: "required";
|
|
111
|
+
readonly authorization: "required";
|
|
112
|
+
};
|
|
113
|
+
/** Branch IDs for addNote. */
|
|
114
|
+
declare const AddNoteBranch: {
|
|
115
|
+
readonly Added: "added";
|
|
116
|
+
readonly NotFound: "notFound";
|
|
117
|
+
readonly ProviderRejected: "providerRejected";
|
|
118
|
+
readonly Uncertain: "uncertain";
|
|
119
|
+
readonly Defect: "defect";
|
|
120
|
+
};
|
|
121
|
+
/** Freshdesk added the note or reply and returned it. */
|
|
122
|
+
declare const AddNoteBranchAdded: "added";
|
|
123
|
+
/** The ticket does not exist or is not visible to the connection's agent; nothing was added. */
|
|
124
|
+
declare const AddNoteBranchNotFound: "notFound";
|
|
125
|
+
/** Freshdesk conclusively rejected the note or reply; nothing was added. */
|
|
126
|
+
declare const AddNoteBranchProviderRejected: "providerRejected";
|
|
127
|
+
/** The request was sent but its outcome cannot be confirmed, so the note or reply may exist; the connector never resends it. */
|
|
128
|
+
declare const AddNoteBranchUncertain: "uncertain";
|
|
129
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
130
|
+
declare const AddNoteBranchDefect: "defect";
|
|
131
|
+
/** Manifest definition for addNote. */
|
|
132
|
+
declare const AddNoteDefinition: MutationDefinition;
|
|
133
|
+
/** Manifest metadata for addNote. */
|
|
134
|
+
declare const AddNoteMetadata: {
|
|
135
|
+
readonly kind: "mutation";
|
|
136
|
+
readonly idempotency: "required";
|
|
137
|
+
readonly authorization: "required";
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/** Configuration for the searchTickets connector Step. */
|
|
141
|
+
interface SearchTicketsStepConfig<StepInput, OperationInput = SearchTicketsInput, OperationOutput = SearchTicketsOutput> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
142
|
+
/** Named connection supplying this operation. */
|
|
143
|
+
connection: Connection<{
|
|
144
|
+
searchTickets(): Query<OperationInput, OperationOutput>;
|
|
145
|
+
}>;
|
|
146
|
+
/** Name matching the bound connection. */
|
|
147
|
+
connectionName: string;
|
|
148
|
+
/** One page of matching tickets was returned; it may be empty. */
|
|
149
|
+
searched: StepTarget<QueryResult<OperationOutput>>;
|
|
150
|
+
/** Freshdesk conclusively rejected the search, such as invalid credentials, a missing permission, or an unknown status. */
|
|
151
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
152
|
+
/** Freshdesk returned an invalid or oversized contact list or search page. */
|
|
153
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
154
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
155
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
156
|
+
}
|
|
157
|
+
/** Build the searchTickets Step from a named connection. */
|
|
158
|
+
declare function newSearchTicketsStep<StepInput, OperationInput = SearchTicketsInput, OperationOutput = SearchTicketsOutput>(configuration: SearchTicketsStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
159
|
+
/** Configuration for the getTicket connector Step. */
|
|
160
|
+
interface GetTicketStepConfig<StepInput, OperationInput = GetTicketInput, OperationOutput = TicketDetails> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
161
|
+
/** Named connection supplying this operation. */
|
|
162
|
+
connection: Connection<{
|
|
163
|
+
getTicket(): Query<OperationInput, OperationOutput>;
|
|
164
|
+
}>;
|
|
165
|
+
/** Name matching the bound connection. */
|
|
166
|
+
connectionName: string;
|
|
167
|
+
/** The ticket and its first conversations were read. */
|
|
168
|
+
found: StepTarget<QueryResult<OperationOutput>>;
|
|
169
|
+
/** The ticket does not exist or is not visible to the connection's agent. */
|
|
170
|
+
notFound?: StepTarget<QueryResult<OperationOutput>>;
|
|
171
|
+
/** Freshdesk conclusively rejected the ticket read. */
|
|
172
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
173
|
+
/** Freshdesk returned an invalid or oversized ticket or conversation page. */
|
|
174
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
175
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
176
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
177
|
+
}
|
|
178
|
+
/** Build the getTicket Step from a named connection. */
|
|
179
|
+
declare function newGetTicketStep<StepInput, OperationInput = GetTicketInput, OperationOutput = TicketDetails>(configuration: GetTicketStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
180
|
+
/** Configuration for the createTicket connector Step. */
|
|
181
|
+
interface CreateTicketStepConfig<StepInput, OperationInput = CreateTicketInput, OperationOutput = CreateTicketOutput> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
182
|
+
/** Named connection supplying this operation. */
|
|
183
|
+
connection: Connection<{
|
|
184
|
+
createTicket(): Mutation<OperationInput, OperationOutput>;
|
|
185
|
+
}>;
|
|
186
|
+
/** Name matching the bound connection. */
|
|
187
|
+
connectionName: string;
|
|
188
|
+
/** Freshdesk created the ticket and returned it. */
|
|
189
|
+
created: StepTarget<MutationResult<OperationOutput>>;
|
|
190
|
+
/** Freshdesk conclusively rejected the ticket, such as an unknown status, group, or agent; no ticket was created. */
|
|
191
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
192
|
+
/** The request was sent but its outcome cannot be confirmed, so the ticket may exist; the connector never resends it. */
|
|
193
|
+
uncertain?: StepTarget<MutationResult<OperationOutput>>;
|
|
194
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
195
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
196
|
+
}
|
|
197
|
+
/** Build the createTicket Step from a named connection. */
|
|
198
|
+
declare function newCreateTicketStep<StepInput, OperationInput = CreateTicketInput, OperationOutput = CreateTicketOutput>(configuration: CreateTicketStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
199
|
+
/** Configuration for the updateTicket connector Step. */
|
|
200
|
+
interface UpdateTicketStepConfig<StepInput, OperationInput = UpdateTicketInput, OperationOutput = UpdateTicketOutput> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
201
|
+
/** Named connection supplying this operation. */
|
|
202
|
+
connection: Connection<{
|
|
203
|
+
updateTicket(): Mutation<OperationInput, OperationOutput>;
|
|
204
|
+
}>;
|
|
205
|
+
/** Name matching the bound connection. */
|
|
206
|
+
connectionName: string;
|
|
207
|
+
/** The ticket holds the requested values, written now or by an earlier attempt. */
|
|
208
|
+
updated: StepTarget<MutationResult<OperationOutput>>;
|
|
209
|
+
/** The ticket does not exist or is not visible to the connection's agent. */
|
|
210
|
+
notFound?: StepTarget<MutationResult<OperationOutput>>;
|
|
211
|
+
/** Freshdesk conclusively rejected the change, such as an unknown status, a missing required field, or a spam or deleted ticket. */
|
|
212
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
213
|
+
/** Freshdesk returned an invalid or oversized ticket, so the change may have been applied. */
|
|
214
|
+
invalidResponse?: StepTarget<MutationResult<OperationOutput>>;
|
|
215
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
216
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
217
|
+
}
|
|
218
|
+
/** Build the updateTicket Step from a named connection. */
|
|
219
|
+
declare function newUpdateTicketStep<StepInput, OperationInput = UpdateTicketInput, OperationOutput = UpdateTicketOutput>(configuration: UpdateTicketStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
220
|
+
/** Configuration for the addNote connector Step. */
|
|
221
|
+
interface AddNoteStepConfig<StepInput, OperationInput = AddNoteInput, OperationOutput = AddNoteOutput> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
222
|
+
/** Named connection supplying this operation. */
|
|
223
|
+
connection: Connection<{
|
|
224
|
+
addNote(): Mutation<OperationInput, OperationOutput>;
|
|
225
|
+
}>;
|
|
226
|
+
/** Name matching the bound connection. */
|
|
227
|
+
connectionName: string;
|
|
228
|
+
/** Freshdesk added the note or reply and returned it. */
|
|
229
|
+
added: StepTarget<MutationResult<OperationOutput>>;
|
|
230
|
+
/** The ticket does not exist or is not visible to the connection's agent; nothing was added. */
|
|
231
|
+
notFound?: StepTarget<MutationResult<OperationOutput>>;
|
|
232
|
+
/** Freshdesk conclusively rejected the note or reply; nothing was added. */
|
|
233
|
+
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
234
|
+
/** The request was sent but its outcome cannot be confirmed, so the note or reply may exist; the connector never resends it. */
|
|
235
|
+
uncertain?: StepTarget<MutationResult<OperationOutput>>;
|
|
236
|
+
/** Local input, connection configuration, or connector definition is invalid. */
|
|
237
|
+
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
238
|
+
}
|
|
239
|
+
/** Build the addNote Step from a named connection. */
|
|
240
|
+
declare function newAddNoteStep<StepInput, OperationInput = AddNoteInput, OperationOutput = AddNoteOutput>(configuration: AddNoteStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
|
|
241
|
+
|
|
242
|
+
/** Search one Freshdesk filter page, optionally using a contact lookup. */
|
|
243
|
+
declare class SearchTicketsOperation implements Query<SearchTicketsInput, SearchTicketsOutput> {
|
|
244
|
+
private readonly client;
|
|
245
|
+
/** Bind the API client. */ constructor(client: FreshdeskClient);
|
|
246
|
+
/** Return stable manifest metadata. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
247
|
+
/** Validate filters, then perform at most two reads. */
|
|
248
|
+
invoke(call: Call, input: SearchTicketsInput): Promise<QueryAttempt<SearchTicketsOutput>>;
|
|
249
|
+
}
|
|
250
|
+
/** Read one ticket, requester, and bounded conversation page. */
|
|
251
|
+
declare class GetTicketOperation implements Query<GetTicketInput, TicketDetails> {
|
|
252
|
+
private readonly client;
|
|
253
|
+
/** Bind the API client. */ constructor(client: FreshdeskClient);
|
|
254
|
+
/** Return stable manifest metadata. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
|
|
255
|
+
/** Perform the ticket and conversation reads. */
|
|
256
|
+
invoke(call: Call, input: GetTicketInput): Promise<QueryAttempt<TicketDetails>>;
|
|
257
|
+
}
|
|
258
|
+
/** Create one ticket with a checkpoint before the unkeyed POST. */
|
|
259
|
+
declare class CreateTicketOperation implements Mutation<CreateTicketInput, CreateTicketOutput> {
|
|
260
|
+
private readonly client;
|
|
261
|
+
/** Bind the API client. */ constructor(client: FreshdeskClient);
|
|
262
|
+
/** Return stable manifest metadata. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
|
|
263
|
+
/** Correlate the mutation by Call ID; Freshdesk does not receive this key. */ idempotencyKey(callID: string): string;
|
|
264
|
+
/** Validate, checkpoint, and send at most once per safe attempt. */
|
|
265
|
+
invoke(call: Call, input: CreateTicketInput): Promise<MutationAttempt<CreateTicketOutput>>;
|
|
266
|
+
}
|
|
267
|
+
/** Replace changed ticket fields after reading current values. */
|
|
268
|
+
declare class UpdateTicketOperation implements Mutation<UpdateTicketInput, UpdateTicketOutput> {
|
|
269
|
+
private readonly client;
|
|
270
|
+
/** Bind the API client. */ constructor(client: FreshdeskClient);
|
|
271
|
+
/** Return stable manifest metadata. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
|
|
272
|
+
/** Correlate the absolute replacement by Call ID. */ idempotencyKey(callID: string): string;
|
|
273
|
+
/** Read, diff, and write only when a field differs. */
|
|
274
|
+
invoke(call: Call, input: UpdateTicketInput): Promise<MutationAttempt<UpdateTicketOutput>>;
|
|
275
|
+
}
|
|
276
|
+
/** Add one private note or public reply with a checkpoint before POST. */
|
|
277
|
+
declare class AddNoteOperation implements Mutation<AddNoteInput, AddNoteOutput> {
|
|
278
|
+
private readonly client;
|
|
279
|
+
/** Bind the API client. */ constructor(client: FreshdeskClient);
|
|
280
|
+
/** Return stable manifest metadata. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
|
|
281
|
+
/** Correlate the mutation by Call ID; Freshdesk does not receive this key. */ idempotencyKey(callID: string): string;
|
|
282
|
+
/** Validate, checkpoint, and send one note or reply. */
|
|
283
|
+
invoke(call: Call, input: AddNoteInput): Promise<MutationAttempt<AddNoteOutput>>;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** Injected transport and clock for deterministic provider replay. */
|
|
287
|
+
interface FreshdeskClientOptions {
|
|
288
|
+
/** Local Freshdesk-compatible endpoint; production derives it from domain. */ apiBaseURL?: string;
|
|
289
|
+
/** Bounded request sender; production uses the SDK transport. */ send?: (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
290
|
+
/** Receipt, Retry-After, and ticketChanged baseline clock. */ now?: () => Date;
|
|
291
|
+
/**
|
|
292
|
+
* Receives the ticketChanged runner's records: seeds, reseeds after a rejected cursor, failed polls, rate-limit
|
|
293
|
+
* pauses, and the durable inboxes newProjectTicketTriggerRunner opens. Records carry binding identity and never
|
|
294
|
+
* ticket contents or credentials. Omitted uses defaultTriggerLogger. Operation Steps do not log.
|
|
295
|
+
*/
|
|
296
|
+
logger?: TriggerLogger;
|
|
297
|
+
}
|
|
298
|
+
/** Classified result of one Freshdesk HTTP exchange. */
|
|
299
|
+
type Exchange = {
|
|
300
|
+
outcome: 'succeeded';
|
|
301
|
+
response: ProviderResponse;
|
|
302
|
+
} | {
|
|
303
|
+
outcome: 'rateLimited' | 'notSent' | 'serviceUnavailable' | 'unavailable' | 'notFound' | 'invalid' | 'defect' | 'rejected';
|
|
304
|
+
failure: Failure;
|
|
305
|
+
response?: ProviderResponse;
|
|
306
|
+
retryAfterMs: number;
|
|
307
|
+
};
|
|
308
|
+
/** Validated, concurrent Freshdesk API client. */
|
|
309
|
+
declare class FreshdeskClient {
|
|
310
|
+
readonly credentials: CredentialProvider<Credentials>;
|
|
311
|
+
private readonly apiBaseURL;
|
|
312
|
+
private readonly maxResponseBytes;
|
|
313
|
+
private readonly send;
|
|
314
|
+
private readonly now;
|
|
315
|
+
/** Delay between ticketChanged polls in milliseconds, at least 10 seconds; one minute by default. */ readonly pollIntervalMs: number;
|
|
316
|
+
/** Receives the ticketChanged runner's and durable inboxes' records. */ readonly triggerLogger: TriggerLogger;
|
|
317
|
+
/** Bind immutable configuration and a live credential source. */
|
|
318
|
+
constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: FreshdeskClientOptions);
|
|
319
|
+
/** Bind the search query. */ searchTickets(): SearchTicketsOperation;
|
|
320
|
+
/** Bind the ticket read query. */ getTicket(): GetTicketOperation;
|
|
321
|
+
/** Bind the ticket creation mutation. */ createTicket(): CreateTicketOperation;
|
|
322
|
+
/** Bind the ticket update mutation. */ updateTicket(): UpdateTicketOperation;
|
|
323
|
+
/** Bind the note mutation. */ addNote(): AddNoteOperation;
|
|
324
|
+
/** Return the current time of the injected clock. */ currentTime(): Date;
|
|
325
|
+
/** Resolve the current API key, classifying terminal credential states. */
|
|
326
|
+
resolveCredential(call: Call, operation: string): Promise<{
|
|
327
|
+
key: string;
|
|
328
|
+
} | {
|
|
329
|
+
failure: Failure;
|
|
330
|
+
transient: boolean;
|
|
331
|
+
}>;
|
|
332
|
+
/** Send one bounded request and classify its observable outcome. */
|
|
333
|
+
exchange(call: Call, operation: string, key: string, method: string, path: string, query?: URLSearchParams, payload?: unknown, signal?: AbortSignal): Promise<Exchange>;
|
|
334
|
+
private classifyStatus;
|
|
335
|
+
/** Build secret-free failure metadata. */ failure(operation: string, kind: Failure['kind'], message: string): Failure;
|
|
336
|
+
/** Build a stable receipt after provider observation. */
|
|
337
|
+
receipt(call: Call, response?: ProviderResponse, objectID?: number): ReceiptDraft;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Open a configured static Freshdesk connection from a loaded Dex project. options, such as a ticketChanged
|
|
342
|
+
* logger or a local apiBaseURL for verification, apply to the connection's client.
|
|
343
|
+
*/
|
|
344
|
+
declare function newProjectConnection(project: LoadedProject, connectionName: string, options?: FreshdeskClientOptions): Connection<Operations>;
|
|
345
|
+
|
|
346
|
+
/** A ticket created inside the poll window that the binding has not delivered before. */
|
|
347
|
+
declare const TicketChangeCreated = "created";
|
|
348
|
+
/** Any later change that moved the ticket's updated_at, such as a status change or a new reply or note. */
|
|
349
|
+
declare const TicketChangeUpdated = "updated";
|
|
350
|
+
/** The derived kind of one ticketChanged delivery; Freshdesk's ticket list reports no change type. */
|
|
351
|
+
type TicketChangeKind = typeof TicketChangeCreated | typeof TicketChangeUpdated;
|
|
352
|
+
/**
|
|
353
|
+
* The ticketChanged binding configuration saved in the project configuration. Freshdesk setup commands
|
|
354
|
+
* cannot send the agent's HTTP Basic API key, so the binding has no provider picker; every field is optional.
|
|
355
|
+
*/
|
|
356
|
+
declare const TicketChangedTriggerConfigurationSchema: z.ZodObject<{
|
|
357
|
+
changeKinds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
358
|
+
}, z.core.$strict>;
|
|
359
|
+
/** The validated ticketChanged binding configuration. */
|
|
360
|
+
type TicketChangedTriggerConfiguration = z.infer<typeof TicketChangedTriggerConfigurationSchema>;
|
|
361
|
+
/**
|
|
362
|
+
* One created or updated ticket read from Freshdesk's List All Tickets endpoint; field names match the Go
|
|
363
|
+
* connector. Several changes between two polls arrive as one delivery of the latest version. Spam and deleted
|
|
364
|
+
* tickets are not listed, so a ticket moved to spam or trash is not delivered.
|
|
365
|
+
*/
|
|
366
|
+
declare const TicketChangedEventSchema: z.ZodObject<{
|
|
367
|
+
changeKind: z.ZodEnum<{
|
|
368
|
+
created: "created";
|
|
369
|
+
updated: "updated";
|
|
370
|
+
}>;
|
|
371
|
+
ticket: z.ZodObject<{
|
|
372
|
+
id: z.ZodNumber;
|
|
373
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
374
|
+
description: z.ZodOptional<z.ZodString>;
|
|
375
|
+
isDescriptionTruncated: z.ZodOptional<z.ZodBoolean>;
|
|
376
|
+
status: z.ZodNumber;
|
|
377
|
+
priority: z.ZodNumber;
|
|
378
|
+
source: z.ZodOptional<z.ZodNumber>;
|
|
379
|
+
type: z.ZodOptional<z.ZodString>;
|
|
380
|
+
requesterId: z.ZodOptional<z.ZodNumber>;
|
|
381
|
+
responderId: z.ZodOptional<z.ZodNumber>;
|
|
382
|
+
groupId: z.ZodOptional<z.ZodNumber>;
|
|
383
|
+
companyId: z.ZodOptional<z.ZodNumber>;
|
|
384
|
+
productId: z.ZodOptional<z.ZodNumber>;
|
|
385
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
386
|
+
isEscalated: z.ZodOptional<z.ZodBoolean>;
|
|
387
|
+
isSpam: z.ZodOptional<z.ZodBoolean>;
|
|
388
|
+
createdAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
389
|
+
updatedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
390
|
+
dueBy: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
391
|
+
firstResponseDueBy: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
392
|
+
}, z.core.$strict>;
|
|
393
|
+
}, z.core.$strip>;
|
|
394
|
+
/** One created or updated Freshdesk ticket. */
|
|
395
|
+
type TicketChangedEvent = z.infer<typeof TicketChangedEventSchema>;
|
|
396
|
+
/** Manifest definition of ticketChanged. */
|
|
397
|
+
declare const TicketChangedTriggerDefinition: TriggerDefinition;
|
|
398
|
+
/** One static application binding of ticketChanged. */
|
|
399
|
+
interface TicketChangedTriggerBindingConfig {
|
|
400
|
+
/** Static connection name. */ connectionName: string;
|
|
401
|
+
/** Static binding name. */ bindingName: string;
|
|
402
|
+
/** Connector Studio configuration units; ticketChanged has none, so omit it. */ configurationUI?: ConnectorConfigurationUI;
|
|
403
|
+
}
|
|
404
|
+
/** Declare a static ticketChanged binding for Flow Definition tooling and Dex Web. */
|
|
405
|
+
declare function defineTicketChangedTriggerBinding(config: TicketChangedTriggerBindingConfig): TriggerBindingDefinition;
|
|
406
|
+
|
|
407
|
+
/** The per_page of each ticketChanged list request, Freshdesk's maximum of 100. */
|
|
408
|
+
declare const TicketChangePageSize = 100;
|
|
409
|
+
/** The last page Freshdesk serves for List All Tickets (30,000 tickets). */
|
|
410
|
+
declare const MaxTicketListPage = 300;
|
|
411
|
+
/**
|
|
412
|
+
* How far, in milliseconds, before the committed updated_at high-water mark each poll window starts, so a
|
|
413
|
+
* ticket whose update commits a little after its timestamp is still read. Tickets already delivered in the
|
|
414
|
+
* window are recognized by ID and updated_at and not delivered again.
|
|
415
|
+
*/
|
|
416
|
+
declare const TicketChangeOverlapMs = 60000;
|
|
417
|
+
/** Thrown for a ticketChanged cursor token that is not a valid Go cursor document. */
|
|
418
|
+
declare class TicketChangeCursorInvalidError extends Error {
|
|
419
|
+
/** Describe the rejected token without echoing it. */
|
|
420
|
+
constructor();
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Return the Trigger event ID "freshdesk-ticket-<id>-<updated_at Unix seconds>". It is a pure function of the
|
|
424
|
+
* ticket version, so a refetch after a crash yields the same ID and a later change yields a new one.
|
|
425
|
+
*/
|
|
426
|
+
declare function ticketChangeEventId(ticket: Ticket): string;
|
|
427
|
+
/** Report whether the binding delivers kind: every kind when changeKinds is empty or omitted. */
|
|
428
|
+
declare function deliversTicketChangeKind(configuration: TicketChangedTriggerConfiguration, kind: TicketChangeKind): boolean;
|
|
429
|
+
/**
|
|
430
|
+
* Reads Freshdesk's List All Tickets in updated_at order for the poll Trigger kit, at parity with the Go
|
|
431
|
+
* connector: the cursor is the updated_at high-water mark, a one-minute overlap window, and the
|
|
432
|
+
* "<id>@<updated_at>" keys delivered inside it, encoded as Go's cursor document byte for byte. A poller owns
|
|
433
|
+
* one fetcher and calls it one poll at a time.
|
|
434
|
+
*/
|
|
435
|
+
declare class TicketChangeFetcher implements ChangeFetcher<TriggerEvent<TicketChangedEvent>> {
|
|
436
|
+
private readonly client;
|
|
437
|
+
private readonly connection;
|
|
438
|
+
private readonly configuration;
|
|
439
|
+
/** Bind the fetcher to one connection's client and one binding's validated configuration. */
|
|
440
|
+
constructor(client: FreshdeskClient, connection: ConnectionRef, configuration: TicketChangedTriggerConfiguration);
|
|
441
|
+
/**
|
|
442
|
+
* Record the baseline without reporting existing tickets: the high-water mark is Freshdesk's current time
|
|
443
|
+
* from the response Date header, or the local clock without one, and tickets changed within the overlap
|
|
444
|
+
* before it are remembered as delivered.
|
|
445
|
+
*/
|
|
446
|
+
seedCursor(context: TriggerContext): Promise<Cursor>;
|
|
447
|
+
private listSeedWindow;
|
|
448
|
+
/**
|
|
449
|
+
* Read one page of tickets updated since the cursor's window start, oldest first. An undecodable cursor and a
|
|
450
|
+
* Freshdesk 400 for the cursor's query reject with markCursorInvalid, so the kit records a new baseline; a
|
|
451
|
+
* 429 rejects with markRateLimited and Retry-After.
|
|
452
|
+
*/
|
|
453
|
+
fetchChanges(context: TriggerContext, cursor: Cursor): Promise<ChangePage<TriggerEvent<TicketChangedEvent>>>;
|
|
454
|
+
private listTicketPage;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/** Binds one ticketChanged configuration to its application target and cursor. */
|
|
458
|
+
interface TicketChangedTriggerRoute {
|
|
459
|
+
/** The stable application binding name, unique within the runner. */ bindingName: string;
|
|
460
|
+
/** Selects the delivered change kinds; omitted delivers created and updated tickets. */ configuration?: TicketChangedTriggerConfiguration;
|
|
461
|
+
/**
|
|
462
|
+
* Routes each change into the application. A durable target from newDurableTriggerTarget records each change
|
|
463
|
+
* before the cursor commits past it; any other target consumes it first.
|
|
464
|
+
*/
|
|
465
|
+
target: TriggerTarget<TicketChangedEvent>;
|
|
466
|
+
/**
|
|
467
|
+
* Stores the binding's updated_at position, such as LoadedProject.pollCursorStore. Omitted keeps it in memory,
|
|
468
|
+
* so every process start records a new baseline and changes made while stopped are lost.
|
|
469
|
+
*/
|
|
470
|
+
cursor?: CursorStore;
|
|
471
|
+
}
|
|
472
|
+
/** Configures every Freshdesk Trigger binding polled through one connection. */
|
|
473
|
+
interface TicketTriggerRunnerConfig {
|
|
474
|
+
/** A connection from newConnection with a FreshdeskClient or from newProjectConnection; a mock has no client. */ connection: Connection;
|
|
475
|
+
/** The ticketChanged bindings; at least one is required. */ ticketChangedRoutes: TicketChangedTriggerRoute[];
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Create one poll runner for the configured ticketChanged bindings. run replays each durable target, records a
|
|
479
|
+
* baseline for a binding without a cursor, then polls every binding each pollInterval with jitter. A Freshdesk
|
|
480
|
+
* 400 for the cursor's query or an undecodable cursor records a new baseline and logs a WARN record; changes
|
|
481
|
+
* made between the last poll and the new baseline are not delivered. A 429 pauses every binding of the
|
|
482
|
+
* connection for Retry-After, because Freshdesk's limit is per account, or backs off exponentially without it;
|
|
483
|
+
* other failures back off per binding up to 15 minutes. Delivery is at least once, and each change keeps one
|
|
484
|
+
* Trigger event ID across refetches. Throws for a missing or mock connection, no routes, a blank or duplicated
|
|
485
|
+
* binding name, a missing target, or an invalid configuration.
|
|
486
|
+
*/
|
|
487
|
+
declare function newTicketTriggerRunner(config: TicketTriggerRunnerConfig): Runner;
|
|
488
|
+
/** Validate a ticketChanged configuration; throws for an unknown field or an unknown or repeated change kind. */
|
|
489
|
+
declare function parseTicketChangedTriggerConfiguration(configuration: unknown): TicketChangedTriggerConfiguration;
|
|
490
|
+
/** Decode a replayed Trigger inbox payload that the Go or TypeScript connector recorded. */
|
|
491
|
+
declare function decodeTicketChangedEventPayload(payloadJSON: string): TicketChangedEvent;
|
|
492
|
+
/** Selects one ticketChanged binding saved in the project configuration. */
|
|
493
|
+
interface ProjectTicketChangedTriggerRoute {
|
|
494
|
+
/** The saved binding name. */ bindingName: string;
|
|
495
|
+
/** Routes each change into the application, usually newDexFlowTriggerTarget. */ target: TriggerTarget<TicketChangedEvent>;
|
|
496
|
+
}
|
|
497
|
+
/** Selects Freshdesk Trigger bindings saved in the project configuration. */
|
|
498
|
+
interface ProjectTicketTriggerRunnerConfig {
|
|
499
|
+
/** The ticketChanged bindings; at least one is required. */ ticketChangedRoutes: ProjectTicketChangedTriggerRoute[];
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Create a durable runner for bindings saved in the loaded project. connection is the project connection from
|
|
503
|
+
* newProjectConnection(project, name); its client options, such as logger, also apply to the durable inboxes.
|
|
504
|
+
* Each binding's saved configuration is loaded (an unsaved binding delivers every change kind), and each route
|
|
505
|
+
* records changes in its binding's project Trigger inbox before its updated_at position commits in the
|
|
506
|
+
* binding's project poll cursor, so a restarted or replaced replica neither misses nor repeats a change.
|
|
507
|
+
* Throws as newTicketTriggerRunner does and for an invalid saved configuration.
|
|
508
|
+
*/
|
|
509
|
+
declare function newProjectTicketTriggerRunner(project: LoadedProject, connection: Connection, config: ProjectTicketTriggerRunnerConfig): Runner;
|
|
510
|
+
/** Configuration of one in-memory ticketChanged Trigger. */
|
|
511
|
+
interface TicketChangedTriggerConfig {
|
|
512
|
+
/** A connection with a FreshdeskClient. */ connection: Connection;
|
|
513
|
+
/** Static connection name; must equal the connection's name. */ connectionName: string;
|
|
514
|
+
/** Static binding name. */ bindingName: string;
|
|
515
|
+
/** Selects the delivered change kinds; omitted delivers both. */ configuration?: TicketChangedTriggerConfiguration;
|
|
516
|
+
/** Routes accepted changes into the application. */ target: TriggerTarget<TicketChangedEvent>;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Create one ticketChanged Trigger with an in-memory cursor, as Go's generated NewTicketChangedTrigger. It has no
|
|
520
|
+
* project storage, so it records a new baseline on every start and changes made while it is stopped are lost;
|
|
521
|
+
* use newProjectTicketTriggerRunner for durable delivery. Throws when connectionName differs from the
|
|
522
|
+
* connection's name, for a mock connection, or for an invalid configuration.
|
|
523
|
+
*/
|
|
524
|
+
declare function newTicketChangedTrigger(config: TicketChangedTriggerConfig): TriggerRunner;
|
|
525
|
+
|
|
526
|
+
export { AddNoteBranch, AddNoteBranchAdded, AddNoteBranchDefect, AddNoteBranchNotFound, AddNoteBranchProviderRejected, AddNoteBranchUncertain, AddNoteDefinition, AddNoteInput, AddNoteMetadata, AddNoteOperation, AddNoteOutput, type AddNoteStepConfig, Config, Connection, ConnectorID, CreateTicketBranch, CreateTicketBranchCreated, CreateTicketBranchDefect, CreateTicketBranchProviderRejected, CreateTicketBranchUncertain, CreateTicketDefinition, CreateTicketInput, CreateTicketMetadata, CreateTicketOperation, CreateTicketOutput, type CreateTicketStepConfig, Credentials, FreshdeskClient, type FreshdeskClientOptions, GetTicketBranch, GetTicketBranchDefect, GetTicketBranchFound, GetTicketBranchInvalidResponse, GetTicketBranchNotFound, GetTicketBranchProviderRejected, GetTicketDefinition, GetTicketInput, GetTicketMetadata, GetTicketOperation, type GetTicketStepConfig, MaxTicketListPage, type ProjectTicketChangedTriggerRoute, type ProjectTicketTriggerRunnerConfig, ProviderID, SearchTicketsBranch, SearchTicketsBranchDefect, SearchTicketsBranchInvalidResponse, SearchTicketsBranchProviderRejected, SearchTicketsBranchSearched, SearchTicketsDefinition, SearchTicketsInput, SearchTicketsMetadata, SearchTicketsOperation, SearchTicketsOutput, type SearchTicketsStepConfig, Ticket, TicketChangeCreated, TicketChangeCursorInvalidError, TicketChangeFetcher, type TicketChangeKind, TicketChangeOverlapMs, TicketChangePageSize, TicketChangeUpdated, type TicketChangedEvent, TicketChangedEventSchema, type TicketChangedTriggerBindingConfig, type TicketChangedTriggerConfig, type TicketChangedTriggerConfiguration, TicketChangedTriggerConfigurationSchema, TicketChangedTriggerDefinition, type TicketChangedTriggerRoute, TicketDetails, type TicketTriggerRunnerConfig, UpdateTicketBranch, UpdateTicketBranchDefect, UpdateTicketBranchInvalidResponse, UpdateTicketBranchNotFound, UpdateTicketBranchProviderRejected, UpdateTicketBranchUpdated, UpdateTicketDefinition, UpdateTicketInput, UpdateTicketMetadata, UpdateTicketOperation, UpdateTicketOutput, type UpdateTicketStepConfig, decodeTicketChangedEventPayload, defineTicketChangedTriggerBinding, deliversTicketChangeKind, newAddNoteStep, newCreateTicketStep, newGetTicketStep, newProjectConnection, newProjectTicketTriggerRunner, newSearchTicketsStep, newTicketChangedTrigger, newTicketTriggerRunner, newUpdateTicketStep, parseTicketChangedTriggerConfiguration, ticketChangeEventId };
|