@superdurable/connector-freshdesk 0.1.0 → 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/README.md +21 -3
- package/dex-connector.json +265 -7
- package/dist/{chunk-CLK5W7ZY.js → chunk-SSAMOXWJ.js} +52 -9
- package/dist/{connection-BRfKrSCD.d.ts → connection-Lx6ZBW6r.d.ts} +29 -24
- package/dist/index.d.ts +205 -12
- package/dist/index.js +424 -6
- package/dist/mock.d.ts +1 -1
- package/dist/mock.js +1 -1
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
# Freshdesk TypeScript Connector
|
|
2
2
|
|
|
3
|
-
`@superdurable/connector-freshdesk` supplies Dex Step factories for five Freshdesk API v2 operations: `searchTickets`, `getTicket`, `createTicket`, `updateTicket`, and `addNote`. The package uses the same connection, operation, and
|
|
3
|
+
`@superdurable/connector-freshdesk` supplies Dex Step factories for five Freshdesk API v2 operations: `searchTickets`, `getTicket`, `createTicket`, `updateTicket`, and `addNote`. The package uses the same connection, operation, branch, and Trigger identities as the Go connector, and from 0.2.0 implements the `ticketChanged` poll Trigger on `@superdurable/connectors-sdk` 0.12.0. See the [connector README](../README.md) for Freshdesk setup, statuses, limits, and duplicate safety.
|
|
4
4
|
|
|
5
5
|
Create a Dex Web connection named `freshdesk-helpdesk`. Set `domain` to the lowercase part before `.freshdesk.com`, and save the agent's API key in the secret `api_key` field. Keep the key out of Flow input. `newProjectConnection` loads that static connection at Worker startup and resolves the current credential for each operation.
|
|
6
6
|
|
|
7
7
|
The runnable [ticket search example](examples/search-tickets/README.md) uses `newSearchTicketsStep` inside a Flow. Its `searched` branch is wired; the optional `providerRejected`, `invalidResponse`, and `defect` branches fail the Flow if selected. The other generated factories are `newGetTicketStep`, `newCreateTicketStep`, `newUpdateTicketStep`, and `newAddNoteStep`.
|
|
8
8
|
|
|
9
|
+
## ticketChanged Trigger
|
|
10
|
+
|
|
11
|
+
`ticketChanged` starts a Flow for each Freshdesk ticket created or updated after the binding first started. It polls List All Tickets, `GET /api/v2/tickets` with `updated_since`, `order_by=updated_at`, `order_type=asc`, and `per_page=100`, on `@superdurable/connectors-sdk/pollingtrigger` at parity with the Go connector; the [connector README](../README.md#ticketchanged-trigger) describes the baseline, the one-minute overlap window, change kinds, paging, rate limits, and the rejected-cursor reseed. Each delivery is a `TriggerEvent<TicketChangedEvent>` whose ID is `freshdesk-ticket-<id>-<updated_at Unix seconds>`; `changeKind` is `created` or `updated`. Read the ticket with `getTicket` for its description, requester, and conversations, which the list omits.
|
|
12
|
+
|
|
13
|
+
The cursor token is the Go connector's JSON document byte for byte, and inbox payloads decode in either language, so Go and TypeScript replicas can share one binding. `test/ticket_change_fetcher.test.ts` replays fetches the Go connector recorded and compares every request, cursor token, and event ID.
|
|
14
|
+
|
|
15
|
+
`newProjectTicketTriggerRunner` loads each saved binding's configuration (an unsaved binding delivers every change kind) and records every change in the binding's project Trigger inbox before its cursor commits. From [`examples/ticket-changed/app.ts`](examples/ticket-changed/app.ts):
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
return newProjectTicketTriggerRunner(project, connection, {
|
|
19
|
+
ticketChangedRoutes: [{ bindingName: TicketChangedTriggerBinding, target: newDexFlowTriggerTarget(client, flow, acceptEveryTicketChange, resolveFlowId, mapToFlowInput) }],
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The runner takes the connection from `newProjectConnection`, whose `pollInterval` (at least 10 seconds) sets the delay between polls and whose `logger` client option receives the runner's and inboxes' records. `newTicketTriggerRunner` takes explicit routes and cursor stores; a route without a cursor keeps it in memory. `newTicketChangedTrigger` is the equivalent of Go's generated `NewTicketChangedTrigger`: it keeps its cursor in memory, so it records a new baseline on every start. A Flow declares the binding for Dex Web with `defineTicketChangedTriggerBinding`; the binding's only configuration is the optional `changeKinds` list. Differences from Go: durations are milliseconds (`TicketChangeOverlapMs`, `pollIntervalMs`), the project runner takes an open connection instead of a connection name and options, and timestamps keep JavaScript's millisecond precision.
|
|
24
|
+
|
|
25
|
+
## Validation
|
|
26
|
+
|
|
9
27
|
`createTicket` requester email and `searchTickets` requester email must be bare addresses with no dot at the start or end of the local part. A refused provider address is retried as an unsent request. `getTicket` and `updateTicket` receipts identify the requested ticket on provider response branches, including `notFound` and `invalidResponse`.
|
|
10
28
|
|
|
11
|
-
Run package checks with `npm ci && npm run check
|
|
29
|
+
Run package checks with `npm ci && npm run check`; until `@superdurable/connectors-sdk` 0.12.0 is published, install a local build of `sdkts` first. The Go-recorded fixture in `../../../../conformance/connectors/freshworks/freshdesk/scenarios.json` covers all five operations, including branches, retry classifications, request shapes, and unkeyed write uncertainty. Run the examples' integration tests with `DEX_FLOW_SERVICE_ADDRESS` set to a local `dexcli dev` gRPC address; the search test's stand-in provider binds a free loopback port, and the [ticket change example](examples/ticket-changed/README.md)'s tests poll a stateful ticket-list fake through the baseline, one Flow per change across a restart, a 429 with `Retry-After`, and a rejected-cursor reseed.
|
|
12
30
|
|
|
13
|
-
Live Freshdesk authorization and provider behavior have not been verified. The local integration test uses a Freshdesk-compatible HTTP stand-in through a real Dex Worker and Client.
|
|
31
|
+
Live Freshdesk authorization and provider behavior, including the `ticketChanged` polling behavior the connector README lists, have not been verified. The local integration test uses a Freshdesk-compatible HTTP stand-in through a real Dex Worker and Client.
|
package/dex-connector.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"connectorId": "freshdesk",
|
|
3
|
-
"releaseTag": "connectors/freshworks/freshdesk/go/v0.
|
|
3
|
+
"releaseTag": "connectors/freshworks/freshdesk/go/v0.24.0",
|
|
4
4
|
"package": {
|
|
5
5
|
"ecosystem": "npm",
|
|
6
6
|
"name": "@superdurable/connector-freshdesk",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.2.0"
|
|
8
8
|
},
|
|
9
9
|
"factories": [
|
|
10
10
|
{
|
|
11
11
|
"name": "newSearchTicketsStep",
|
|
12
12
|
"kind": "query",
|
|
13
13
|
"operationId": "searchTickets",
|
|
14
|
+
"inputType": "SearchTicketsInput",
|
|
15
|
+
"description": "Filter tickets by Freshdesk status, priority, tag, update date, and requester email with Freshdesk's filter query, returning one page of at most 30 tickets.",
|
|
14
16
|
"fields": {
|
|
15
17
|
"stepType": "stepType",
|
|
16
18
|
"annotations": "annotations",
|
|
@@ -38,12 +40,68 @@
|
|
|
38
40
|
"field": "defect",
|
|
39
41
|
"optional": true
|
|
40
42
|
}
|
|
41
|
-
]
|
|
43
|
+
],
|
|
44
|
+
"inputSchema": {
|
|
45
|
+
"additionalProperties": false,
|
|
46
|
+
"description": "SearchTicketsInput selects tickets with typed filters that the connector turns into one Freshdesk filter query. Different filters narrow each other; several statuses, priorities, or tags match any of them. At least one of Statuses, Priorities, Tags, or UpdatedSinceDate is required, because Freshdesk's filter query needs a condition and has no requester field.",
|
|
47
|
+
"properties": {
|
|
48
|
+
"page": {
|
|
49
|
+
"description": "Page is 1 to MaxSearchPage; zero reads the first page.",
|
|
50
|
+
"type": "integer"
|
|
51
|
+
},
|
|
52
|
+
"priorities": {
|
|
53
|
+
"description": "Priorities matches tickets with any of these Freshdesk priorities. Empty matches every priority.",
|
|
54
|
+
"items": {
|
|
55
|
+
"enum": [
|
|
56
|
+
1,
|
|
57
|
+
2,
|
|
58
|
+
3,
|
|
59
|
+
4
|
|
60
|
+
],
|
|
61
|
+
"type": "integer"
|
|
62
|
+
},
|
|
63
|
+
"type": "array"
|
|
64
|
+
},
|
|
65
|
+
"requesterEmail": {
|
|
66
|
+
"description": "RequesterEmail keeps only tickets requested by the contact with this email address, such as jane@example.com. The connector looks the contact up first and filters each page itself, so a page can hold fewer than SearchPageSize tickets, even none, while NextPage is set. Blank keeps every requester.",
|
|
67
|
+
"type": "string"
|
|
68
|
+
},
|
|
69
|
+
"statuses": {
|
|
70
|
+
"description": "Statuses matches tickets in any of these Freshdesk statuses, including custom ones. Empty matches every status.",
|
|
71
|
+
"items": {
|
|
72
|
+
"enum": [
|
|
73
|
+
2,
|
|
74
|
+
3,
|
|
75
|
+
4,
|
|
76
|
+
5,
|
|
77
|
+
6,
|
|
78
|
+
7
|
|
79
|
+
],
|
|
80
|
+
"type": "integer"
|
|
81
|
+
},
|
|
82
|
+
"type": "array"
|
|
83
|
+
},
|
|
84
|
+
"tags": {
|
|
85
|
+
"description": "Tags matches tickets carrying any of these tags.",
|
|
86
|
+
"items": {
|
|
87
|
+
"type": "string"
|
|
88
|
+
},
|
|
89
|
+
"type": "array"
|
|
90
|
+
},
|
|
91
|
+
"updatedSinceDate": {
|
|
92
|
+
"description": "UpdatedSinceDate matches tickets updated on or after this UTC calendar date, written YYYY-MM-DD. Freshdesk's filter query compares dates, not instants. Blank applies no time filter.",
|
|
93
|
+
"type": "string"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"type": "object"
|
|
97
|
+
}
|
|
42
98
|
},
|
|
43
99
|
{
|
|
44
100
|
"name": "newGetTicketStep",
|
|
45
101
|
"kind": "query",
|
|
46
102
|
"operationId": "getTicket",
|
|
103
|
+
"inputType": "GetTicketInput",
|
|
104
|
+
"description": "Read one ticket by ID with its requester and a bounded list of its first conversations.",
|
|
47
105
|
"fields": {
|
|
48
106
|
"stepType": "stepType",
|
|
49
107
|
"annotations": "annotations",
|
|
@@ -76,12 +134,32 @@
|
|
|
76
134
|
"field": "defect",
|
|
77
135
|
"optional": true
|
|
78
136
|
}
|
|
79
|
-
]
|
|
137
|
+
],
|
|
138
|
+
"inputSchema": {
|
|
139
|
+
"additionalProperties": false,
|
|
140
|
+
"description": "GetTicketInput names one ticket and how many of its first conversations to return.",
|
|
141
|
+
"properties": {
|
|
142
|
+
"conversationLimit": {
|
|
143
|
+
"description": "ConversationLimit is 1 to MaxConversationLimit; zero uses DefaultConversationLimit.",
|
|
144
|
+
"type": "integer"
|
|
145
|
+
},
|
|
146
|
+
"ticketId": {
|
|
147
|
+
"description": "TicketID is the Freshdesk ticket ID.",
|
|
148
|
+
"type": "integer"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"required": [
|
|
152
|
+
"ticketId"
|
|
153
|
+
],
|
|
154
|
+
"type": "object"
|
|
155
|
+
}
|
|
80
156
|
},
|
|
81
157
|
{
|
|
82
158
|
"name": "newCreateTicketStep",
|
|
83
159
|
"kind": "mutation",
|
|
84
160
|
"operationId": "createTicket",
|
|
161
|
+
"inputType": "CreateTicketInput",
|
|
162
|
+
"description": "Create one ticket for a requester email. The Step runs with sync durability; 429, 503, and traced pre-connection failures permit one next-attempt resend, while other dispatched outcomes are never resent.",
|
|
85
163
|
"fields": {
|
|
86
164
|
"stepType": "stepType",
|
|
87
165
|
"annotations": "annotations",
|
|
@@ -109,12 +187,99 @@
|
|
|
109
187
|
"field": "defect",
|
|
110
188
|
"optional": true
|
|
111
189
|
}
|
|
112
|
-
]
|
|
190
|
+
],
|
|
191
|
+
"inputSchema": {
|
|
192
|
+
"$defs": {
|
|
193
|
+
"TicketRequesterInput": {
|
|
194
|
+
"additionalProperties": false,
|
|
195
|
+
"description": "TicketRequesterInput identifies the requester by email. Freshdesk uses the contact with that address or, when none exists, adds a contact named Name.",
|
|
196
|
+
"properties": {
|
|
197
|
+
"email": {
|
|
198
|
+
"description": "Email is one bare address such as jane@example.com.",
|
|
199
|
+
"type": "string"
|
|
200
|
+
},
|
|
201
|
+
"name": {
|
|
202
|
+
"description": "Name names a contact Freshdesk adds; blank lets Freshdesk derive one.",
|
|
203
|
+
"type": "string"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"required": [
|
|
207
|
+
"email"
|
|
208
|
+
],
|
|
209
|
+
"type": "object"
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
"additionalProperties": false,
|
|
213
|
+
"description": "CreateTicketInput is one new ticket. Zero values leave a field to Freshdesk's defaults, the account's ticket form, and its automations.",
|
|
214
|
+
"properties": {
|
|
215
|
+
"description": {
|
|
216
|
+
"description": "Description is the ticket's plain-text content. It is required. The connector escapes it into Freshdesk's HTML description, so markup is shown literally and line breaks are kept.",
|
|
217
|
+
"type": "string"
|
|
218
|
+
},
|
|
219
|
+
"groupId": {
|
|
220
|
+
"description": "GroupID assigns the ticket to a group, or zero for Freshdesk's default routing.",
|
|
221
|
+
"type": "integer"
|
|
222
|
+
},
|
|
223
|
+
"priority": {
|
|
224
|
+
"description": "Priority is a Freshdesk priority, or zero for Freshdesk's default, Low (1).",
|
|
225
|
+
"enum": [
|
|
226
|
+
1,
|
|
227
|
+
2,
|
|
228
|
+
3,
|
|
229
|
+
4
|
|
230
|
+
],
|
|
231
|
+
"type": "integer"
|
|
232
|
+
},
|
|
233
|
+
"requester": {
|
|
234
|
+
"$ref": "#/$defs/TicketRequesterInput",
|
|
235
|
+
"description": "Requester is the customer asking for help. It is required."
|
|
236
|
+
},
|
|
237
|
+
"responderId": {
|
|
238
|
+
"description": "ResponderID assigns the ticket to an agent, Freshdesk's responder_id, or zero for none.",
|
|
239
|
+
"type": "integer"
|
|
240
|
+
},
|
|
241
|
+
"status": {
|
|
242
|
+
"description": "Status is a Freshdesk status, or zero for Freshdesk's default, Open (2).",
|
|
243
|
+
"enum": [
|
|
244
|
+
2,
|
|
245
|
+
3,
|
|
246
|
+
4,
|
|
247
|
+
5,
|
|
248
|
+
6,
|
|
249
|
+
7
|
|
250
|
+
],
|
|
251
|
+
"type": "integer"
|
|
252
|
+
},
|
|
253
|
+
"subject": {
|
|
254
|
+
"description": "Subject is the ticket subject. It is required.",
|
|
255
|
+
"type": "string"
|
|
256
|
+
},
|
|
257
|
+
"tags": {
|
|
258
|
+
"description": "Tags are set on the new ticket; account automations may add more.",
|
|
259
|
+
"items": {
|
|
260
|
+
"type": "string"
|
|
261
|
+
},
|
|
262
|
+
"type": "array"
|
|
263
|
+
},
|
|
264
|
+
"type": {
|
|
265
|
+
"description": "Type is one of the account's ticket type labels, such as Question, or empty for none.",
|
|
266
|
+
"type": "string"
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
"required": [
|
|
270
|
+
"description",
|
|
271
|
+
"requester",
|
|
272
|
+
"subject"
|
|
273
|
+
],
|
|
274
|
+
"type": "object"
|
|
275
|
+
}
|
|
113
276
|
},
|
|
114
277
|
{
|
|
115
278
|
"name": "newUpdateTicketStep",
|
|
116
279
|
"kind": "mutation",
|
|
117
280
|
"operationId": "updateTicket",
|
|
281
|
+
"inputType": "UpdateTicketInput",
|
|
282
|
+
"description": "Set the status, priority, group, or agent of one ticket and add or remove tags; a repeated attempt finds the change already applied and writes nothing.",
|
|
118
283
|
"fields": {
|
|
119
284
|
"stepType": "stepType",
|
|
120
285
|
"annotations": "annotations",
|
|
@@ -147,12 +312,72 @@
|
|
|
147
312
|
"field": "defect",
|
|
148
313
|
"optional": true
|
|
149
314
|
}
|
|
150
|
-
]
|
|
315
|
+
],
|
|
316
|
+
"inputSchema": {
|
|
317
|
+
"additionalProperties": false,
|
|
318
|
+
"description": "UpdateTicketInput is one change to an existing ticket. Zero and empty fields are left unchanged; this release cannot clear an agent or group.",
|
|
319
|
+
"properties": {
|
|
320
|
+
"addTags": {
|
|
321
|
+
"description": "AddTags adds tags and keeps the ticket's other tags. A tag already present in any letter case is kept as is.",
|
|
322
|
+
"items": {
|
|
323
|
+
"type": "string"
|
|
324
|
+
},
|
|
325
|
+
"type": "array"
|
|
326
|
+
},
|
|
327
|
+
"groupId": {
|
|
328
|
+
"description": "GroupID assigns a group, or zero to keep the group.",
|
|
329
|
+
"type": "integer"
|
|
330
|
+
},
|
|
331
|
+
"priority": {
|
|
332
|
+
"description": "Priority is the new Freshdesk priority, or zero to keep it.",
|
|
333
|
+
"enum": [
|
|
334
|
+
1,
|
|
335
|
+
2,
|
|
336
|
+
3,
|
|
337
|
+
4
|
|
338
|
+
],
|
|
339
|
+
"type": "integer"
|
|
340
|
+
},
|
|
341
|
+
"removeTags": {
|
|
342
|
+
"description": "RemoveTags removes tags in any letter case and keeps the ticket's other tags.",
|
|
343
|
+
"items": {
|
|
344
|
+
"type": "string"
|
|
345
|
+
},
|
|
346
|
+
"type": "array"
|
|
347
|
+
},
|
|
348
|
+
"responderId": {
|
|
349
|
+
"description": "ResponderID assigns an agent, Freshdesk's responder_id, or zero to keep the agent.",
|
|
350
|
+
"type": "integer"
|
|
351
|
+
},
|
|
352
|
+
"status": {
|
|
353
|
+
"description": "Status is the new Freshdesk status, including a custom one, or zero to keep it.",
|
|
354
|
+
"enum": [
|
|
355
|
+
2,
|
|
356
|
+
3,
|
|
357
|
+
4,
|
|
358
|
+
5,
|
|
359
|
+
6,
|
|
360
|
+
7
|
|
361
|
+
],
|
|
362
|
+
"type": "integer"
|
|
363
|
+
},
|
|
364
|
+
"ticketId": {
|
|
365
|
+
"description": "TicketID is the Freshdesk ticket ID.",
|
|
366
|
+
"type": "integer"
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
"required": [
|
|
370
|
+
"ticketId"
|
|
371
|
+
],
|
|
372
|
+
"type": "object"
|
|
373
|
+
}
|
|
151
374
|
},
|
|
152
375
|
{
|
|
153
376
|
"name": "newAddNoteStep",
|
|
154
377
|
"kind": "mutation",
|
|
155
378
|
"operationId": "addNote",
|
|
379
|
+
"inputType": "AddNoteInput",
|
|
380
|
+
"description": "Add one private note or one public reply to a ticket. The Step runs with sync durability; 429, 503, and traced pre-connection failures permit one next-attempt resend, while other dispatched outcomes are never resent.",
|
|
156
381
|
"fields": {
|
|
157
382
|
"stepType": "stepType",
|
|
158
383
|
"annotations": "annotations",
|
|
@@ -185,7 +410,40 @@
|
|
|
185
410
|
"field": "defect",
|
|
186
411
|
"optional": true
|
|
187
412
|
}
|
|
188
|
-
]
|
|
413
|
+
],
|
|
414
|
+
"inputSchema": {
|
|
415
|
+
"additionalProperties": false,
|
|
416
|
+
"description": "AddNoteInput is one private note or one public reply to add to a ticket.",
|
|
417
|
+
"properties": {
|
|
418
|
+
"body": {
|
|
419
|
+
"description": "Body is the plain-text note or reply. It is required. The connector escapes it into Freshdesk's HTML body, so markup is shown literally and line breaks are kept.",
|
|
420
|
+
"type": "string"
|
|
421
|
+
},
|
|
422
|
+
"isPublicReply": {
|
|
423
|
+
"description": "IsPublicReply sends the body as a reply that Freshdesk emails to the requester, through POST /api/v2/tickets/{id}/reply. False adds a private note that only agents can see.",
|
|
424
|
+
"type": "boolean"
|
|
425
|
+
},
|
|
426
|
+
"ticketId": {
|
|
427
|
+
"description": "TicketID is the Freshdesk ticket ID.",
|
|
428
|
+
"type": "integer"
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
"required": [
|
|
432
|
+
"body",
|
|
433
|
+
"ticketId"
|
|
434
|
+
],
|
|
435
|
+
"type": "object"
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"name": "defineTicketChangedTriggerBinding",
|
|
440
|
+
"kind": "trigger",
|
|
441
|
+
"triggerName": "ticketChanged",
|
|
442
|
+
"fields": {
|
|
443
|
+
"connectionName": "connectionName",
|
|
444
|
+
"bindingName": "bindingName",
|
|
445
|
+
"configurationUI": "configurationUI"
|
|
446
|
+
}
|
|
189
447
|
}
|
|
190
448
|
]
|
|
191
449
|
}
|
|
@@ -1,9 +1,45 @@
|
|
|
1
1
|
// src/generated/models.ts
|
|
2
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);
|
|
3
27
|
var ConfigSchema = z.object({
|
|
4
28
|
"domain": z.string(),
|
|
5
|
-
"maxResponseBytes": z.number().int().optional()
|
|
29
|
+
"maxResponseBytes": z.number().int().optional(),
|
|
30
|
+
"pollIntervalMs": z.number().int().optional()
|
|
6
31
|
});
|
|
32
|
+
function decodeCredentials(value) {
|
|
33
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
|
|
34
|
+
const fields = value;
|
|
35
|
+
const allowed = /* @__PURE__ */ new Set(["api_key"]);
|
|
36
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
|
|
37
|
+
if (fields["api_key"] != null && !(typeof fields["api_key"] === "string")) throw new TypeError("credential api_key has an invalid type");
|
|
38
|
+
const credentials = {};
|
|
39
|
+
if (!fields["api_key"]) throw new TypeError("credential api_key is required");
|
|
40
|
+
credentials.apiKey = new SecretString(fields["api_key"] ?? "");
|
|
41
|
+
return credentials;
|
|
42
|
+
}
|
|
7
43
|
var SearchTicketsInputSchema = z.strictObject({
|
|
8
44
|
"statuses": z.array(z.number().int()).optional(),
|
|
9
45
|
"priorities": z.array(z.number().int()).optional(),
|
|
@@ -29,10 +65,10 @@ var TicketSchema = z.strictObject({
|
|
|
29
65
|
"tags": z.array(z.string()).optional(),
|
|
30
66
|
"isEscalated": z.boolean().optional(),
|
|
31
67
|
"isSpam": z.boolean().optional(),
|
|
32
|
-
"createdAt":
|
|
33
|
-
"updatedAt":
|
|
34
|
-
"dueBy":
|
|
35
|
-
"firstResponseDueBy":
|
|
68
|
+
"createdAt": GoTimeJSONSchema,
|
|
69
|
+
"updatedAt": GoTimeJSONSchema,
|
|
70
|
+
"dueBy": GoTimeJSONSchema.nullable().optional(),
|
|
71
|
+
"firstResponseDueBy": GoTimeJSONSchema.nullable().optional()
|
|
36
72
|
});
|
|
37
73
|
var SearchTicketsOutputSchema = z.strictObject({
|
|
38
74
|
"tickets": z.array(TicketSchema).nullable(),
|
|
@@ -57,7 +93,7 @@ var TicketConversationSchema = z.strictObject({
|
|
|
57
93
|
"isIncoming": z.boolean().optional(),
|
|
58
94
|
"body": z.string(),
|
|
59
95
|
"isBodyTruncated": z.boolean().optional(),
|
|
60
|
-
"createdAt":
|
|
96
|
+
"createdAt": GoTimeJSONSchema
|
|
61
97
|
});
|
|
62
98
|
var TicketDetailsSchema = z.strictObject({
|
|
63
99
|
"ticket": TicketSchema,
|
|
@@ -171,7 +207,9 @@ var CreateTicketDefinition = {
|
|
|
171
207
|
{ id: "uncertain", description: "The request was sent but its outcome cannot be confirmed, so the ticket may exist; the connector never resends it.", optional: true },
|
|
172
208
|
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
173
209
|
],
|
|
174
|
-
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 6e4, maximumAttempts: 5, totalDurationMs: 3e5 } }
|
|
210
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 6e4, maximumAttempts: 5, totalDurationMs: 3e5 } },
|
|
211
|
+
repeatOnUnknown: "limited",
|
|
212
|
+
maxSends: 3
|
|
175
213
|
};
|
|
176
214
|
var CreateTicketMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
177
215
|
var UpdateTicketBranch = {
|
|
@@ -195,7 +233,9 @@ var UpdateTicketDefinition = {
|
|
|
195
233
|
{ id: "invalidResponse", description: "Freshdesk returned an invalid or oversized ticket, so the change may have been applied.", optional: true },
|
|
196
234
|
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
197
235
|
],
|
|
198
|
-
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
236
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
|
|
237
|
+
repeatOnUnknown: "limited",
|
|
238
|
+
maxSends: 3
|
|
199
239
|
};
|
|
200
240
|
var UpdateTicketMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
201
241
|
var AddNoteBranch = {
|
|
@@ -219,7 +259,9 @@ var AddNoteDefinition = {
|
|
|
219
259
|
{ id: "uncertain", description: "The request was sent but its outcome cannot be confirmed, so the note or reply may exist; the connector never resends it.", optional: true },
|
|
220
260
|
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
221
261
|
],
|
|
222
|
-
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 6e4, maximumAttempts: 5, totalDurationMs: 3e5 } }
|
|
262
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 6e4, maximumAttempts: 5, totalDurationMs: 3e5 } },
|
|
263
|
+
repeatOnUnknown: "limited",
|
|
264
|
+
maxSends: 3
|
|
223
265
|
};
|
|
224
266
|
var AddNoteMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
225
267
|
|
|
@@ -255,6 +297,7 @@ function newProjectConnection(project, connectionName, createClient) {
|
|
|
255
297
|
|
|
256
298
|
export {
|
|
257
299
|
ConfigSchema,
|
|
300
|
+
decodeCredentials,
|
|
258
301
|
SearchTicketsInputSchema,
|
|
259
302
|
TicketSchema,
|
|
260
303
|
SearchTicketsOutputSchema,
|
|
@@ -7,17 +7,22 @@ interface Config {
|
|
|
7
7
|
domain: string;
|
|
8
8
|
/** Maximum complete Freshdesk API response in bytes. Leave blank to keep the displayed safety limit; enter a positive integer only to change it, for example when ticket descriptions or notes are unusually large. An oversized response selects invalidResponse, or uncertain for a write. */
|
|
9
9
|
maxResponseBytes?: number;
|
|
10
|
+
/** Delay between ticketChanged Trigger polls of Freshdesk's ticket list, as a Go duration of at least 10s such as 30s or 2m. Leave blank to keep the displayed interval. Each poll normally makes one List All Tickets request, which counts against the account's per-minute API limit and its lower Tickets List sublimit (40 per minute on the Growth plan); lower it only when changes must arrive sooner, and raise it when other apps share the helpdesk's API limit. Runtime value in milliseconds. */
|
|
11
|
+
pollIntervalMs?: number;
|
|
10
12
|
}
|
|
11
13
|
/** Runtime schema for manifest configuration. */
|
|
12
14
|
declare const ConfigSchema: z.ZodObject<{
|
|
13
15
|
domain: z.ZodString;
|
|
14
16
|
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
pollIntervalMs: z.ZodOptional<z.ZodNumber>;
|
|
15
18
|
}, z.core.$strip>;
|
|
16
19
|
/** Private connector credentials resolved by the host. */
|
|
17
20
|
interface Credentials {
|
|
18
21
|
/** Secret Freshdesk API key of the agent the connector acts as. Sign in at https://{domain}.freshdesk.com, select your profile picture at the top right, choose Profile Settings, then View API key, and complete the captcha, as https://support.freshdesk.com/support/solutions/articles/215517 describes. It is an opaque string of letters and digits; Freshdesk's API documentation uses abcdefghij1234567890 as an example. The connector sends it over HTTP Basic as the user name with X as the password. Stored only in this credential field; after resetting the key in Freshdesk, paste the new key here. */
|
|
19
22
|
apiKey: SecretString;
|
|
20
23
|
}
|
|
24
|
+
/** Decode private credential fields for the connector. */
|
|
25
|
+
declare function decodeCredentials(value: unknown): Credentials;
|
|
21
26
|
/** Host-owned source of private connector credentials. */
|
|
22
27
|
type CredentialSource = CredentialProvider<Credentials>;
|
|
23
28
|
/** SearchTicketsInput selects tickets with typed filters that the connector turns into one
|
|
@@ -253,10 +258,10 @@ declare const TicketSchema: z.ZodObject<{
|
|
|
253
258
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
254
259
|
isEscalated: z.ZodOptional<z.ZodBoolean>;
|
|
255
260
|
isSpam: z.ZodOptional<z.ZodBoolean>;
|
|
256
|
-
createdAt: z.
|
|
257
|
-
updatedAt: z.
|
|
258
|
-
dueBy: z.ZodOptional<z.ZodNullable<z.
|
|
259
|
-
firstResponseDueBy: z.ZodOptional<z.ZodNullable<z.
|
|
261
|
+
createdAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
262
|
+
updatedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
263
|
+
dueBy: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
264
|
+
firstResponseDueBy: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
260
265
|
}, z.core.$strict>;
|
|
261
266
|
/** Runtime validator for SearchTicketsOutput. */
|
|
262
267
|
declare const SearchTicketsOutputSchema: z.ZodObject<{
|
|
@@ -277,10 +282,10 @@ declare const SearchTicketsOutputSchema: z.ZodObject<{
|
|
|
277
282
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
278
283
|
isEscalated: z.ZodOptional<z.ZodBoolean>;
|
|
279
284
|
isSpam: z.ZodOptional<z.ZodBoolean>;
|
|
280
|
-
createdAt: z.
|
|
281
|
-
updatedAt: z.
|
|
282
|
-
dueBy: z.ZodOptional<z.ZodNullable<z.
|
|
283
|
-
firstResponseDueBy: z.ZodOptional<z.ZodNullable<z.
|
|
285
|
+
createdAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
286
|
+
updatedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
287
|
+
dueBy: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
288
|
+
firstResponseDueBy: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
284
289
|
}, z.core.$strict>>>;
|
|
285
290
|
totalMatched: z.ZodNumber;
|
|
286
291
|
nextPage: z.ZodOptional<z.ZodNumber>;
|
|
@@ -306,7 +311,7 @@ declare const TicketConversationSchema: z.ZodObject<{
|
|
|
306
311
|
isIncoming: z.ZodOptional<z.ZodBoolean>;
|
|
307
312
|
body: z.ZodString;
|
|
308
313
|
isBodyTruncated: z.ZodOptional<z.ZodBoolean>;
|
|
309
|
-
createdAt: z.
|
|
314
|
+
createdAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
310
315
|
}, z.core.$strict>;
|
|
311
316
|
/** Runtime validator for TicketDetails. */
|
|
312
317
|
declare const TicketDetailsSchema: z.ZodObject<{
|
|
@@ -327,10 +332,10 @@ declare const TicketDetailsSchema: z.ZodObject<{
|
|
|
327
332
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
328
333
|
isEscalated: z.ZodOptional<z.ZodBoolean>;
|
|
329
334
|
isSpam: z.ZodOptional<z.ZodBoolean>;
|
|
330
|
-
createdAt: z.
|
|
331
|
-
updatedAt: z.
|
|
332
|
-
dueBy: z.ZodOptional<z.ZodNullable<z.
|
|
333
|
-
firstResponseDueBy: z.ZodOptional<z.ZodNullable<z.
|
|
335
|
+
createdAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
336
|
+
updatedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
337
|
+
dueBy: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
338
|
+
firstResponseDueBy: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
334
339
|
}, z.core.$strict>;
|
|
335
340
|
requester: z.ZodOptional<z.ZodObject<{
|
|
336
341
|
id: z.ZodNumber;
|
|
@@ -346,7 +351,7 @@ declare const TicketDetailsSchema: z.ZodObject<{
|
|
|
346
351
|
isIncoming: z.ZodOptional<z.ZodBoolean>;
|
|
347
352
|
body: z.ZodString;
|
|
348
353
|
isBodyTruncated: z.ZodOptional<z.ZodBoolean>;
|
|
349
|
-
createdAt: z.
|
|
354
|
+
createdAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
350
355
|
}, z.core.$strict>>>;
|
|
351
356
|
hasMoreConversations: z.ZodOptional<z.ZodBoolean>;
|
|
352
357
|
}, z.core.$strict>;
|
|
@@ -389,10 +394,10 @@ declare const CreateTicketOutputSchema: z.ZodObject<{
|
|
|
389
394
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
390
395
|
isEscalated: z.ZodOptional<z.ZodBoolean>;
|
|
391
396
|
isSpam: z.ZodOptional<z.ZodBoolean>;
|
|
392
|
-
createdAt: z.
|
|
393
|
-
updatedAt: z.
|
|
394
|
-
dueBy: z.ZodOptional<z.ZodNullable<z.
|
|
395
|
-
firstResponseDueBy: z.ZodOptional<z.ZodNullable<z.
|
|
397
|
+
createdAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
398
|
+
updatedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
399
|
+
dueBy: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
400
|
+
firstResponseDueBy: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
396
401
|
}, z.core.$strict>;
|
|
397
402
|
}, z.core.$strict>;
|
|
398
403
|
/** Runtime validator for UpdateTicketInput. */
|
|
@@ -424,10 +429,10 @@ declare const UpdateTicketOutputSchema: z.ZodObject<{
|
|
|
424
429
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
425
430
|
isEscalated: z.ZodOptional<z.ZodBoolean>;
|
|
426
431
|
isSpam: z.ZodOptional<z.ZodBoolean>;
|
|
427
|
-
createdAt: z.
|
|
428
|
-
updatedAt: z.
|
|
429
|
-
dueBy: z.ZodOptional<z.ZodNullable<z.
|
|
430
|
-
firstResponseDueBy: z.ZodOptional<z.ZodNullable<z.
|
|
432
|
+
createdAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
433
|
+
updatedAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
434
|
+
dueBy: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
435
|
+
firstResponseDueBy: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
431
436
|
}, z.core.$strict>;
|
|
432
437
|
wasAlreadyApplied: z.ZodOptional<z.ZodBoolean>;
|
|
433
438
|
}, z.core.$strict>;
|
|
@@ -448,7 +453,7 @@ declare const AddNoteOutputSchema: z.ZodObject<{
|
|
|
448
453
|
isIncoming: z.ZodOptional<z.ZodBoolean>;
|
|
449
454
|
body: z.ZodString;
|
|
450
455
|
isBodyTruncated: z.ZodOptional<z.ZodBoolean>;
|
|
451
|
-
createdAt: z.
|
|
456
|
+
createdAt: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
452
457
|
}, z.core.$strict>;
|
|
453
458
|
}, z.core.$strict>;
|
|
454
459
|
|
|
@@ -479,4 +484,4 @@ declare function newConnection(client: Operations, reference: ConnectionRef): Co
|
|
|
479
484
|
/** Bind scripted operations to a named connection. */
|
|
480
485
|
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
481
486
|
|
|
482
|
-
export { type AddNoteInput as A, UpdateTicketOutputSchema as B, Connection as C,
|
|
487
|
+
export { type AddNoteInput as A, UpdateTicketOutputSchema as B, Connection as C, decodeCredentials as D, newConnection as E, newConnectionWithOperations as F, type GetTicketInput as G, type Operations as O, type SearchTicketsInput as S, type TicketDetails as T, type UpdateTicketInput as U, type AddNoteOutput as a, type CreateTicketInput as b, type CreateTicketOutput as c, type SearchTicketsOutput as d, type UpdateTicketOutput as e, type Credentials as f, type Config as g, type Ticket as h, AddNoteInputSchema as i, AddNoteOutputSchema as j, ConfigSchema as k, CreateTicketInputSchema as l, CreateTicketOutputSchema as m, type CredentialSource as n, GetTicketInputSchema as o, SearchTicketsInputSchema as p, SearchTicketsOutputSchema as q, type TicketConversation as r, TicketConversationSchema as s, TicketDetailsSchema as t, type TicketRequester as u, type TicketRequesterInput as v, TicketRequesterInputSchema as w, TicketRequesterSchema as x, TicketSchema as y, UpdateTicketInputSchema as z };
|