@superdurable/connector-front 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Super Durable
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,17 @@
1
- # Temporary Holding Version
1
+ # Front TypeScript connector
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `@superdurable/connector-front` supplies the five Front conversation and contact operations for Dex TypeScript Flows. Operation-specific Step factories, model validators, connection contracts, and mocks are generated from [`connector.yaml`](../connector.yaml) and the Go model types. Run `go run ./cmd/connectorctl generate connectors/front/connector.yaml` from the repository root after changing either source.
4
+
5
+ Use Node.js 22 or 24 and Dex TypeScript SDK 1.28.0 or newer. Create a secret Front API token in [Front Settings > Developers > API Tokens](https://app.frontapp.com/), grant the read, write, and send permissions needed by your Flow, and save it as the `api_token` credential in a Dex Web Connection. At Worker startup, load the project with `loadFromEnvironment()` and pass the static `ConnectionName` to `newProjectConnection`, as in the [runnable example](examples/find-contact/). Keep the token out of Flow inputs, Attributes, results, Streams, and logs.
6
+
7
+ | Factory | Front operation | Happy branch |
8
+ | --- | --- | --- |
9
+ | `newSearchConversationsStep` | Search one bounded conversation page | `searched` |
10
+ | `newGetConversationStep` | Read one conversation with messages and comments | `found` |
11
+ | `newReplyToConversationStep` | Send a reply or add an internal comment | `replied` |
12
+ | `newUpdateConversationStep` | Set status, assignee, and tags | `updated` |
13
+ | `newFindContactByEmailStep` | Look up a contact email alias | `found` |
14
+
15
+ Every other branch is optional, so an unwired branch fails the Flow. Replies and comments use the SDK single-dispatch fence: Front has no provider idempotency key, and an ambiguous send selects `uncertain` rather than sending twice. Updates set absolute values and read back the conversation, so they can retry safely.
16
+
17
+ Run `npm ci`, `npm run check`, and `npm run test:integration` with a local `dexcli dev` address. The package replays the Go-recorded provider scenarios; the integration test runs the checked-in Flow through a real Dex Worker and Client against a local Front-compatible fixture. Live Front authorization, conversation operations, and contact lookup have not been verified.
@@ -0,0 +1,201 @@
1
+ {
2
+ "connectorId": "front",
3
+ "releaseTag": "connectors/front/go/v0.23.0",
4
+ "package": {
5
+ "ecosystem": "npm",
6
+ "name": "@superdurable/connector-front",
7
+ "version": "0.1.0"
8
+ },
9
+ "factories": [
10
+ {
11
+ "name": "newSearchConversationsStep",
12
+ "kind": "query",
13
+ "operationId": "searchConversations",
14
+ "fields": {
15
+ "stepType": "stepType",
16
+ "annotations": "annotations",
17
+ "connectionName": "connectionName",
18
+ "resultAttribute": "resultAttribute"
19
+ },
20
+ "branches": [
21
+ {
22
+ "id": "searched",
23
+ "field": "searched",
24
+ "optional": false
25
+ },
26
+ {
27
+ "id": "providerRejected",
28
+ "field": "providerRejected",
29
+ "optional": true
30
+ },
31
+ {
32
+ "id": "invalidResponse",
33
+ "field": "invalidResponse",
34
+ "optional": true
35
+ },
36
+ {
37
+ "id": "defect",
38
+ "field": "defect",
39
+ "optional": true
40
+ }
41
+ ]
42
+ },
43
+ {
44
+ "name": "newGetConversationStep",
45
+ "kind": "query",
46
+ "operationId": "getConversation",
47
+ "fields": {
48
+ "stepType": "stepType",
49
+ "annotations": "annotations",
50
+ "connectionName": "connectionName",
51
+ "resultAttribute": "resultAttribute"
52
+ },
53
+ "branches": [
54
+ {
55
+ "id": "found",
56
+ "field": "found",
57
+ "optional": false
58
+ },
59
+ {
60
+ "id": "merged",
61
+ "field": "merged",
62
+ "optional": true
63
+ },
64
+ {
65
+ "id": "notFound",
66
+ "field": "notFound",
67
+ "optional": true
68
+ },
69
+ {
70
+ "id": "providerRejected",
71
+ "field": "providerRejected",
72
+ "optional": true
73
+ },
74
+ {
75
+ "id": "invalidResponse",
76
+ "field": "invalidResponse",
77
+ "optional": true
78
+ },
79
+ {
80
+ "id": "defect",
81
+ "field": "defect",
82
+ "optional": true
83
+ }
84
+ ]
85
+ },
86
+ {
87
+ "name": "newReplyToConversationStep",
88
+ "kind": "mutation",
89
+ "operationId": "replyToConversation",
90
+ "fields": {
91
+ "stepType": "stepType",
92
+ "annotations": "annotations",
93
+ "connectionName": "connectionName",
94
+ "resultAttribute": "resultAttribute"
95
+ },
96
+ "branches": [
97
+ {
98
+ "id": "replied",
99
+ "field": "replied",
100
+ "optional": false
101
+ },
102
+ {
103
+ "id": "notFound",
104
+ "field": "notFound",
105
+ "optional": true
106
+ },
107
+ {
108
+ "id": "providerRejected",
109
+ "field": "providerRejected",
110
+ "optional": true
111
+ },
112
+ {
113
+ "id": "uncertain",
114
+ "field": "uncertain",
115
+ "optional": true
116
+ },
117
+ {
118
+ "id": "defect",
119
+ "field": "defect",
120
+ "optional": true
121
+ }
122
+ ]
123
+ },
124
+ {
125
+ "name": "newUpdateConversationStep",
126
+ "kind": "mutation",
127
+ "operationId": "updateConversation",
128
+ "fields": {
129
+ "stepType": "stepType",
130
+ "annotations": "annotations",
131
+ "connectionName": "connectionName",
132
+ "resultAttribute": "resultAttribute"
133
+ },
134
+ "branches": [
135
+ {
136
+ "id": "updated",
137
+ "field": "updated",
138
+ "optional": false
139
+ },
140
+ {
141
+ "id": "notFound",
142
+ "field": "notFound",
143
+ "optional": true
144
+ },
145
+ {
146
+ "id": "providerRejected",
147
+ "field": "providerRejected",
148
+ "optional": true
149
+ },
150
+ {
151
+ "id": "invalidResponse",
152
+ "field": "invalidResponse",
153
+ "optional": true
154
+ },
155
+ {
156
+ "id": "defect",
157
+ "field": "defect",
158
+ "optional": true
159
+ }
160
+ ]
161
+ },
162
+ {
163
+ "name": "newFindContactByEmailStep",
164
+ "kind": "query",
165
+ "operationId": "findContactByEmail",
166
+ "fields": {
167
+ "stepType": "stepType",
168
+ "annotations": "annotations",
169
+ "connectionName": "connectionName",
170
+ "resultAttribute": "resultAttribute"
171
+ },
172
+ "branches": [
173
+ {
174
+ "id": "found",
175
+ "field": "found",
176
+ "optional": false
177
+ },
178
+ {
179
+ "id": "notFound",
180
+ "field": "notFound",
181
+ "optional": true
182
+ },
183
+ {
184
+ "id": "providerRejected",
185
+ "field": "providerRejected",
186
+ "optional": true
187
+ },
188
+ {
189
+ "id": "invalidResponse",
190
+ "field": "invalidResponse",
191
+ "optional": true
192
+ },
193
+ {
194
+ "id": "defect",
195
+ "field": "defect",
196
+ "optional": true
197
+ }
198
+ ]
199
+ }
200
+ ]
201
+ }
@@ -0,0 +1,358 @@
1
+ // src/generated/models.ts
2
+ import { z } from "zod";
3
+ var ConfigSchema = z.object({
4
+ "maxResponseBytes": z.number().int().optional()
5
+ });
6
+ var SearchConversationsInputSchema = z.strictObject({
7
+ "text": z.string().optional(),
8
+ "inboxId": z.string().optional(),
9
+ "tagId": z.string().optional(),
10
+ "statuses": z.array(z.string()).optional(),
11
+ "recipientEmail": z.string().optional(),
12
+ "assigneeId": z.string().optional(),
13
+ "activityAfter": z.iso.datetime({ offset: true }).nullable().optional(),
14
+ "pageSize": z.number().int().optional(),
15
+ "pageToken": z.string().optional()
16
+ });
17
+ var TeammateSchema = z.strictObject({
18
+ "id": z.string(),
19
+ "email": z.string().optional(),
20
+ "firstName": z.string().optional(),
21
+ "lastName": z.string().optional()
22
+ });
23
+ var RecipientSchema = z.strictObject({
24
+ "handle": z.string(),
25
+ "role": z.string().optional(),
26
+ "name": z.string().optional(),
27
+ "contactId": z.string().optional()
28
+ });
29
+ var TagSchema = z.strictObject({
30
+ "id": z.string(),
31
+ "name": z.string().optional()
32
+ });
33
+ var ConversationSchema = z.strictObject({
34
+ "id": z.string(),
35
+ "type": z.string().optional(),
36
+ "subject": z.string().optional(),
37
+ "status": z.string(),
38
+ "statusId": z.string().optional(),
39
+ "statusCategory": z.string().optional(),
40
+ "ticketIds": z.array(z.string()).optional(),
41
+ "assignee": TeammateSchema.optional(),
42
+ "recipient": RecipientSchema.optional(),
43
+ "tags": z.array(TagSchema).optional(),
44
+ "isPrivate": z.boolean().optional(),
45
+ "isSnoozed": z.boolean().optional(),
46
+ "createdAt": z.iso.datetime({ offset: true }),
47
+ "updatedAt": z.iso.datetime({ offset: true }).nullable().optional(),
48
+ "waitingSince": z.iso.datetime({ offset: true }).nullable().optional(),
49
+ "dueAt": z.iso.datetime({ offset: true }).nullable().optional()
50
+ });
51
+ var SearchConversationsOutputSchema = z.strictObject({
52
+ "conversations": z.array(ConversationSchema).nullable(),
53
+ "totalCount": z.number().int(),
54
+ "nextPageToken": z.string().optional(),
55
+ "query": z.string()
56
+ });
57
+ var GetConversationInputSchema = z.strictObject({
58
+ "conversationId": z.string(),
59
+ "messageLimit": z.number().int().optional(),
60
+ "commentLimit": z.number().int().optional()
61
+ });
62
+ var MessageSchema = z.strictObject({
63
+ "id": z.string(),
64
+ "type": z.string().optional(),
65
+ "isInbound": z.boolean(),
66
+ "isDraft": z.boolean().optional(),
67
+ "subject": z.string().optional(),
68
+ "blurb": z.string().optional(),
69
+ "body": z.string().optional(),
70
+ "isBodyTruncated": z.boolean().optional(),
71
+ "author": TeammateSchema.optional(),
72
+ "recipients": z.array(RecipientSchema).optional(),
73
+ "createdAt": z.iso.datetime({ offset: true })
74
+ });
75
+ var CommentSchema = z.strictObject({
76
+ "id": z.string(),
77
+ "body": z.string().optional(),
78
+ "isBodyTruncated": z.boolean().optional(),
79
+ "author": TeammateSchema.optional(),
80
+ "isPinned": z.boolean().optional(),
81
+ "postedAt": z.iso.datetime({ offset: true })
82
+ });
83
+ var ConversationDetailsSchema = z.strictObject({
84
+ "conversation": ConversationSchema,
85
+ "messages": z.array(MessageSchema).nullable(),
86
+ "hasOlderMessages": z.boolean().optional(),
87
+ "comments": z.array(CommentSchema).nullable(),
88
+ "hasOlderComments": z.boolean().optional(),
89
+ "mergedIntoConversationId": z.string().optional()
90
+ });
91
+ var ReplyToConversationInputSchema = z.strictObject({
92
+ "conversationId": z.string(),
93
+ "text": z.string(),
94
+ "isInternalNote": z.boolean().optional(),
95
+ "authorId": z.string().optional(),
96
+ "shouldArchive": z.boolean().optional()
97
+ });
98
+ var ConversationReplySchema = z.strictObject({
99
+ "conversationId": z.string(),
100
+ "isInternalNote": z.boolean().optional(),
101
+ "messageUid": z.string().optional(),
102
+ "commentId": z.string().optional(),
103
+ "authorId": z.string().optional()
104
+ });
105
+ var UpdateConversationInputSchema = z.strictObject({
106
+ "conversationId": z.string(),
107
+ "status": z.string().optional(),
108
+ "statusId": z.string().optional(),
109
+ "assigneeId": z.string().optional(),
110
+ "isUnassigned": z.boolean().optional(),
111
+ "addTagIds": z.array(z.string()).optional(),
112
+ "removeTagIds": z.array(z.string()).optional()
113
+ });
114
+ var UpdateConversationOutputSchema = z.strictObject({
115
+ "conversation": ConversationSchema,
116
+ "wasAlreadyApplied": z.boolean().optional()
117
+ });
118
+ var FindContactByEmailInputSchema = z.strictObject({
119
+ "email": z.string()
120
+ });
121
+ var ContactHandleSchema = z.strictObject({
122
+ "handle": z.string(),
123
+ "source": z.string()
124
+ });
125
+ var ContactSchema = z.strictObject({
126
+ "id": z.string(),
127
+ "name": z.string().optional(),
128
+ "description": z.string().optional(),
129
+ "handles": z.array(ContactHandleSchema).optional(),
130
+ "listNames": z.array(z.string()).optional(),
131
+ "isPrivate": z.boolean().optional(),
132
+ "updatedAt": z.iso.datetime({ offset: true }).nullable().optional()
133
+ });
134
+ var FindContactByEmailOutputSchema = z.strictObject({
135
+ "contacts": z.array(ContactSchema).nullable()
136
+ });
137
+
138
+ // src/generated/definitions.ts
139
+ var ConnectorID = "front";
140
+ var ProviderID = "front";
141
+ var SearchConversationsBranch = {
142
+ Searched: "searched",
143
+ ProviderRejected: "providerRejected",
144
+ InvalidResponse: "invalidResponse",
145
+ Defect: "defect"
146
+ };
147
+ var SearchConversationsBranchSearched = SearchConversationsBranch.Searched;
148
+ var SearchConversationsBranchProviderRejected = SearchConversationsBranch.ProviderRejected;
149
+ var SearchConversationsBranchInvalidResponse = SearchConversationsBranch.InvalidResponse;
150
+ var SearchConversationsBranchDefect = SearchConversationsBranch.Defect;
151
+ var SearchConversationsDefinition = {
152
+ operation: { connectorId: ConnectorID, operationId: "searchConversations" },
153
+ branches: [
154
+ { id: "searched", description: "Front returned one page of matching conversations; it may be empty." },
155
+ { id: "providerRejected", description: "Front conclusively rejected the search, such as an invalid token, a token without conversation read access, or an expired page token.", optional: true },
156
+ { id: "invalidResponse", description: "Front returned a malformed or oversized page, or a next-page link outside Front's API hosts.", optional: true },
157
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
158
+ ],
159
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
160
+ };
161
+ var SearchConversationsMetadata = { kind: "query", idempotency: "none", authorization: "required" };
162
+ var GetConversationBranch = {
163
+ Found: "found",
164
+ Merged: "merged",
165
+ NotFound: "notFound",
166
+ ProviderRejected: "providerRejected",
167
+ InvalidResponse: "invalidResponse",
168
+ Defect: "defect"
169
+ };
170
+ var GetConversationBranchFound = GetConversationBranch.Found;
171
+ var GetConversationBranchMerged = GetConversationBranch.Merged;
172
+ var GetConversationBranchNotFound = GetConversationBranch.NotFound;
173
+ var GetConversationBranchProviderRejected = GetConversationBranch.ProviderRejected;
174
+ var GetConversationBranchInvalidResponse = GetConversationBranch.InvalidResponse;
175
+ var GetConversationBranchDefect = GetConversationBranch.Defect;
176
+ var GetConversationDefinition = {
177
+ operation: { connectorId: ConnectorID, operationId: "getConversation" },
178
+ branches: [
179
+ { id: "found", description: "Front returned the conversation with its newest messages and comments." },
180
+ { id: "merged", description: "The conversation was merged into another; mergedIntoConversationId names the conversation to read instead.", optional: true },
181
+ { id: "notFound", description: "The conversation does not exist or is not visible to the API token.", optional: true },
182
+ { id: "providerRejected", description: "Front conclusively rejected the read, such as an invalid token or a token without message or comment read access.", optional: true },
183
+ { id: "invalidResponse", description: "Front returned a malformed or oversized conversation, message page, or comment list.", optional: true },
184
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
185
+ ],
186
+ stepDefaults: { executeMethodTimeoutMs: 45e3, executeDurability: "async" }
187
+ };
188
+ var GetConversationMetadata = { kind: "query", idempotency: "none", authorization: "required" };
189
+ var ReplyToConversationBranch = {
190
+ Replied: "replied",
191
+ NotFound: "notFound",
192
+ ProviderRejected: "providerRejected",
193
+ Uncertain: "uncertain",
194
+ Defect: "defect"
195
+ };
196
+ var ReplyToConversationBranchReplied = ReplyToConversationBranch.Replied;
197
+ var ReplyToConversationBranchNotFound = ReplyToConversationBranch.NotFound;
198
+ var ReplyToConversationBranchProviderRejected = ReplyToConversationBranch.ProviderRejected;
199
+ var ReplyToConversationBranchUncertain = ReplyToConversationBranch.Uncertain;
200
+ var ReplyToConversationBranchDefect = ReplyToConversationBranch.Defect;
201
+ var ReplyToConversationDefinition = {
202
+ operation: { connectorId: ConnectorID, operationId: "replyToConversation" },
203
+ branches: [
204
+ { id: "replied", description: "Front accepted the reply for delivery or created the comment." },
205
+ { id: "notFound", description: "The conversation does not exist, was merged, or is not visible to the API token; nothing was sent.", optional: true },
206
+ { id: "providerRejected", description: "Front conclusively rejected the reply or comment, such as a token without send permission or an unknown author; nothing was sent.", optional: true },
207
+ { id: "uncertain", description: "The reply or comment may exist after a lost answer, ambiguous server error, late answer, 409 conflict, or terminal credential failure during accepted-write read-back; an accepted comment may have been deleted before read-back. The connector never resends without proof of non-application.", optional: true },
208
+ { id: "defect", description: "Local input, connection credentials that require reauthorization or are unusable before sending, or the connector definition is invalid; transient credential failures Retry.", optional: true }
209
+ ],
210
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 6e4, maximumAttempts: 5, totalDurationMs: 3e5 } }
211
+ };
212
+ var ReplyToConversationMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
213
+ var UpdateConversationBranch = {
214
+ Updated: "updated",
215
+ NotFound: "notFound",
216
+ ProviderRejected: "providerRejected",
217
+ InvalidResponse: "invalidResponse",
218
+ Defect: "defect"
219
+ };
220
+ var UpdateConversationBranchUpdated = UpdateConversationBranch.Updated;
221
+ var UpdateConversationBranchNotFound = UpdateConversationBranch.NotFound;
222
+ var UpdateConversationBranchProviderRejected = UpdateConversationBranch.ProviderRejected;
223
+ var UpdateConversationBranchInvalidResponse = UpdateConversationBranch.InvalidResponse;
224
+ var UpdateConversationBranchDefect = UpdateConversationBranch.Defect;
225
+ var UpdateConversationDefinition = {
226
+ operation: { connectorId: ConnectorID, operationId: "updateConversation" },
227
+ branches: [
228
+ { id: "updated", description: "The conversation holds the requested status, assignee, and tags, written now or by an earlier attempt." },
229
+ { id: "notFound", description: "The conversation does not exist, was merged, or is not visible to the API token.", optional: true },
230
+ { id: "providerRejected", description: "Front conclusively rejected a change, such as an unknown teammate, tag, or ticket status; changes sent before it stay applied.", optional: true },
231
+ { id: "invalidResponse", description: "Front returned a malformed or oversized conversation, so the change may have been applied.", optional: true },
232
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
233
+ ],
234
+ stepDefaults: { executeMethodTimeoutMs: 6e4, executeDurability: "async" }
235
+ };
236
+ var UpdateConversationMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
237
+ var FindContactByEmailBranch = {
238
+ Found: "found",
239
+ NotFound: "notFound",
240
+ ProviderRejected: "providerRejected",
241
+ InvalidResponse: "invalidResponse",
242
+ Defect: "defect"
243
+ };
244
+ var FindContactByEmailBranchFound = FindContactByEmailBranch.Found;
245
+ var FindContactByEmailBranchNotFound = FindContactByEmailBranch.NotFound;
246
+ var FindContactByEmailBranchProviderRejected = FindContactByEmailBranch.ProviderRejected;
247
+ var FindContactByEmailBranchInvalidResponse = FindContactByEmailBranch.InvalidResponse;
248
+ var FindContactByEmailBranchDefect = FindContactByEmailBranch.Defect;
249
+ var FindContactByEmailDefinition = {
250
+ operation: { connectorId: ConnectorID, operationId: "findContactByEmail" },
251
+ branches: [
252
+ { id: "found", description: "A Front contact has the email handle." },
253
+ { id: "notFound", description: "No Front contact has the email handle.", optional: true },
254
+ { id: "providerRejected", description: "Front conclusively rejected the lookup, such as an invalid token or a token without contact read access.", optional: true },
255
+ { id: "invalidResponse", description: "Front returned a malformed or oversized contact.", optional: true },
256
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
257
+ ],
258
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
259
+ };
260
+ var FindContactByEmailMetadata = { kind: "query", idempotency: "none", authorization: "required" };
261
+
262
+ // src/generated/connection.ts
263
+ import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
264
+ var Connection = class {
265
+ /** Stable provider and connection name. */
266
+ reference;
267
+ /** Bound provider operations. */
268
+ operations;
269
+ /** Validate a reference and bind operations. */
270
+ constructor(reference, operations) {
271
+ this.reference = ConnectionRefSchema.parse(reference);
272
+ if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
273
+ if (!operations) throw new TypeError("connector operations are required");
274
+ this.operations = operations;
275
+ }
276
+ };
277
+ function newConnection(client, reference) {
278
+ if (!client) throw new TypeError("connector client is required");
279
+ return new Connection(reference, client);
280
+ }
281
+ function newConnectionWithOperations(operations, reference) {
282
+ return new Connection(reference, operations);
283
+ }
284
+ function newProjectConnection(project, connectionName, createClient) {
285
+ if (!project) throw new TypeError("loaded project is required");
286
+ const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
287
+ const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
288
+ if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
289
+ return newConnection(createClient(project, connectionName), reference);
290
+ }
291
+
292
+ export {
293
+ ConfigSchema,
294
+ SearchConversationsInputSchema,
295
+ TeammateSchema,
296
+ RecipientSchema,
297
+ TagSchema,
298
+ ConversationSchema,
299
+ SearchConversationsOutputSchema,
300
+ GetConversationInputSchema,
301
+ MessageSchema,
302
+ CommentSchema,
303
+ ConversationDetailsSchema,
304
+ ReplyToConversationInputSchema,
305
+ ConversationReplySchema,
306
+ UpdateConversationInputSchema,
307
+ UpdateConversationOutputSchema,
308
+ FindContactByEmailInputSchema,
309
+ ContactHandleSchema,
310
+ ContactSchema,
311
+ FindContactByEmailOutputSchema,
312
+ ConnectorID,
313
+ ProviderID,
314
+ SearchConversationsBranch,
315
+ SearchConversationsBranchSearched,
316
+ SearchConversationsBranchProviderRejected,
317
+ SearchConversationsBranchInvalidResponse,
318
+ SearchConversationsBranchDefect,
319
+ SearchConversationsDefinition,
320
+ SearchConversationsMetadata,
321
+ GetConversationBranch,
322
+ GetConversationBranchFound,
323
+ GetConversationBranchMerged,
324
+ GetConversationBranchNotFound,
325
+ GetConversationBranchProviderRejected,
326
+ GetConversationBranchInvalidResponse,
327
+ GetConversationBranchDefect,
328
+ GetConversationDefinition,
329
+ GetConversationMetadata,
330
+ ReplyToConversationBranch,
331
+ ReplyToConversationBranchReplied,
332
+ ReplyToConversationBranchNotFound,
333
+ ReplyToConversationBranchProviderRejected,
334
+ ReplyToConversationBranchUncertain,
335
+ ReplyToConversationBranchDefect,
336
+ ReplyToConversationDefinition,
337
+ ReplyToConversationMetadata,
338
+ UpdateConversationBranch,
339
+ UpdateConversationBranchUpdated,
340
+ UpdateConversationBranchNotFound,
341
+ UpdateConversationBranchProviderRejected,
342
+ UpdateConversationBranchInvalidResponse,
343
+ UpdateConversationBranchDefect,
344
+ UpdateConversationDefinition,
345
+ UpdateConversationMetadata,
346
+ FindContactByEmailBranch,
347
+ FindContactByEmailBranchFound,
348
+ FindContactByEmailBranchNotFound,
349
+ FindContactByEmailBranchProviderRejected,
350
+ FindContactByEmailBranchInvalidResponse,
351
+ FindContactByEmailBranchDefect,
352
+ FindContactByEmailDefinition,
353
+ FindContactByEmailMetadata,
354
+ Connection,
355
+ newConnection,
356
+ newConnectionWithOperations,
357
+ newProjectConnection
358
+ };